Пример #1
0
 async def _info(self, ctx, user: discord.Member=None):
     if user is None: user = ctx.author
     point = getdata(id=user.id, item='point')
     checks = getdata(id=user.id, item='countCheck')
     try: percentCheck = int(getdata(id=user.id, item='winningRandom')) / int(getdata(id=user.id, item='countRandom')) * 100
     except: percentCheck = 0
     embed = discord.Embed(title=f'{user}', description=getdata(id=user.id, item='introduce'), color=embedcolor)
     embed.set_footer(text=f'{ctx.author} | {mainprefix}�움', icon_url=ctx.author.avatar_url)
     embed.set_thumbnail(url=user.avatar_url)
     embed.add_field(name='μ� μ € id', value=f'{user.id}')
     statuses = ['<:online:809612933633146881>', '<:DND:809612933561843712>', '<:idle:809612931775594526>', '<:offline:809612930932670505>']
     a2 = ['online', 'dnd', 'idle', 'offline']
     a = ['���', '방해 �지', '�리 비움', '�프��']
     status = statuses[a2.index(str(user.status))] + ' ' + a[a2.index(str(user.status))] 
     embed.add_field(name='�저 ��', value=f'{(["���톱", "�바�"])[int(user.is_on_mobile())]}, {status}')
     embed.add_field(name='봇 여부', value=f'{([ "�", "�"])[int(user.bot)]} 계정')
     embed.add_field(name='계정 �성�', value=f'{(user.created_at).strftime("%Y년 %m월 %d�")}', inline=False)
     if not user.bot:
         embed.add_field(name='�령어 사� ��', value=f'`{getdata(id=user.id, item="commandCount")}`�')
         embed.add_field(name='���', value=f'� `{point}`���')
         embed.add_field(name='μ�Ήλ¥ ', value=f'`{round(percentCheck)}`%')
         embed.add_field(name='�� ��', value=f'`{checks}`�')
     else:
         embed.add_field(name='�� 여부', value=f'{(["<:bot:812119117711933461>", "<:verified_bot:812119144731902013>"])[int(user.public_flags.verified_bot)]}')
     await ctx.send(embed=embed)
Пример #2
0
 async def _info(self, ctx, user: discord.Member = None):
     if user is None: user = ctx.author
     point = getdata(id=user.id, item='point')
     checks = getdata(id=user.id, item='countCheck')
     try:
         percentCheck = int(getdata(
             id=user.id, item='winningRandom')) / int(
                 getdata(id=user.id, item='countRandom')) * 100
     except:
         percentCheck = 0
     embed = discord.Embed(title=f'{user}',
                           description=getdata(id=user.id,
                                               item='introduce'),
                           color=embedcolor)
     embed.set_footer(text=f'{ctx.author} | {mainprefix}�움',
                      icon_url=ctx.author.avatar_url)
     embed.set_thumbnail(url=user.avatar_url)
     embed.add_field(name='μ� μ € id', value=f'{user.id}')
     embed.add_field(name='봇 여부',
                     value=f'{([ "�", "�"])[int(user.bot)]} 계정')
     embed.add_field(
         name='계정 �성�',
         value=f'{(user.created_at).strftime("%Y년 %m월 %d�")}',
         inline=False)
     if not user.bot:
         embed.add_field(
             name='�령어 사� ��',
             value=f'`{getdata(id=user.id, item="commandCount")}`�')
         embed.add_field(name='���', value=f'� `{point}`���')
         embed.add_field(name='μ�Ήλ¥ ', value=f'`{round(percentCheck)}`%')
         embed.add_field(name='�� ��', value=f'`{checks}`�')
     await ctx.send(embed=embed)
Пример #3
0
 async def _check(self, ctx):
     date = getnow('%Y%m%d')
     if getdata(id=ctx.author.id, item='lastCheck') == date:
         await warn(ctx=ctx, content='��� �미 �����다. 내� ��해 주십��.')
         return
     point = str(int(getdata(id=ctx.author.id, item='point')) + 500 * randint(2, 4))
     writedata(id=ctx.author.id, item='point', value=point)
     writedata(id=ctx.author.id, item='coundCheck', value=str(1+int(getdata(id=ctx.author.id, item='countCheck'))))
     writedata(id=ctx.author.id, item='lastCheck', value=date)
     await sendEmbed(ctx=ctx, title='��', content=f'�� 완�����다.\n�� ���: `{point}`')
     writingDate = getnow('**%H:%M:%S.%f**')
     if not isdir('rank'):
         makedirs('rank')
     if not isfile('rank/check.json'):
         with open('rank/check.json', 'w') as f:
             json.dump({
                 'date': date,
                 '1': {'id': 'none',
                       'time': 'none'},
                 '2': {'id': 'none',
                       'time': 'none'},  
                 '3': {'id': 'none',
                       'time': 'none'},
                 '4': {'id': 'none',
                       'time': 'none'},
                 '5': {'id': 'none',
                       'time': 'none'},
                 'len': '0'
             }, f)
     with open('rank/check.json', 'r') as f:
         data = json.load(f)
     if data['date'] != date:
         data = {
             'date': date,
             '1': {'id': 'none',
                   'time': 'none'},
             '2': {'id': 'none',
                   'time': 'none'},  
             '3': {'id': 'none',
                   'time': 'none'},
             '4': {'id': 'none',
                   'time': 'none'},
             '5': {'id': 'none',
                   'time': 'none'},
             'len': '0'
             }
     if data['len'] == '5': return
     data['len'] = str(int(data['len']) + 1)
     data[data['len']]['id'] = str(ctx.author.id)
     data[data['len']]['time'] = writingDate
     data['date'] = date
     with open('rank/check.json', 'w') as f:
         json.dump(data, f)
     content = []
     for i in range(int(data['len'])):
         content.append('**' + str(i+1) + '**. `' + str(await self.bot.fetch_user(int(data[str(i+1)]['id']))) + '` : ' + data[str(i+1)]['time'])
     await sendEmbed(ctx=ctx, title='�� �킹', content='\n'.join(content))
Пример #4
0
 async def _sendmoney(self, ctx, user:discord.Member, amount:int):
     if amount < 50:
         return await warn(ctx=ctx, content='50뭔 ��부터 송�할 � ���다')
     if user.bot or user.id == ctx.author.id:
         return await warn(ctx=ctx, content='송�할 � 없� �저��다')
     if amount > int(getdata(id=ctx.author.id, item='point')):
         return await warn(ctx=ctx, content='�� 부족합�다')
     writedata(id=ctx.author.id, item='point', value=str(int(getdata(id=ctx.author.id, item='point'))-amount))
     writedata(id=user.id, item='point', value=str(int(getdata(id=user.id, item='point'))+round(amount*0.95)))
     await sendEmbed(ctx=ctx, title='� 송� �', content=f'`{user}`�� � `{round(amount*0.95)}`�� 송�����다.\n���: � `{amount-round(amount*0.95)}`')
Пример #5
0
 async def _buy_stock(self, ctx, name, count='모두'):
     stock_names = {
         '삼송': '삼송증권',
         '알지': '알지전자',
         '현내': '현내보험',
         '동영': '동영화학',
         '한와': '한와금융',
         '로데': '로데관광',
         '동안': '동안출판',
         '하태': '하태식품',
         '소울': '소울우유',
         '남영': '남영유업',
         '대환': '대환통운'
     }
     if not (name in list(stock_names.keys()) or name in list(stock_names.values())):
         return await warn(ctx=ctx, content='주식을 찾을 수 없습니다.')
     if name in list(stock_names.keys()):
         name = stock_names[name]
     if isfile(f'stocks/users/{ctx.author.id}.bin'):
         with open(f'stocks/users/{ctx.author.id}.bin', 'rb') as f:
             data = load(f)
     else:
         data = {}
     with open('stocks/stocks.bin', 'rb') as f:
         stocks = load(f)
     if count in ['모두', 'ㅇㅇ', '올인', '최대']:
         count = int(getdata(id=ctx.author.id, item='point')) // stocks[name]['price']
         if count == 0:
             return await warn(ctx=ctx, content='돈이 부족합니다')
     else:
         count = int(count)
         if count < 1: return await warn(ctx=ctx, content='살 주식의 개수를 1개 이상으로 입력해 주세요')
     if count * stocks[name]['price'] > int(getdata(id=ctx.author.id, item='point')): return await warn(ctx=ctx, content='돈이 부족합니다')
     if name in data:
         data[name].append({'count': count,
                            'price': stocks[name]['price']})
     else:
         data[name] = [{'count': count,
                        'price': stocks[name]['price']}]
     deliting = []
     for i in data:
         if len(data[i]) == 0: deliting.append(i)
     for i in deliting:
         del data[i]
     with open(f'stocks/users/{ctx.author.id}.bin', 'wb') as f:
         dump(data, f)
     writedata(id=ctx.author.id, item='point', value=str(int(getdata(id=ctx.author.id, item='point')) - count * stocks[name]['price']))
     await sendEmbed(ctx=ctx, title='매수', content=f'{name}의 주식을 `{count}`주 매수했습니다.')
Пример #6
0
 async def _sell_stock(self, ctx, name, count='모두'):
     stock_names = {
         '삼송': '삼송증권',
         '알지': '알지전자',
         '현내': '현내보험',
         '동영': '동영화학',
         '한와': '한와금융',
         '로데': '로데관광',
         '동안': '동안출판',
         '하태': '하태식품',
         '소울': '소울우유',
         '남영': '남영유업',
         '대환': '대환통운'
     }
     if not (name in list(stock_names.keys()) or name in list(stock_names.values())):
         return await warn(ctx=ctx, content='주식을 찾을 수 없습니다.')
     if name in list(stock_names.keys()):
         name = stock_names[name]
     if isfile(f'stocks/users/{ctx.author.id}.bin'):
         with open(f'stocks/users/{ctx.author.id}.bin', 'rb') as f:
             data = load(f)
     else:
         return await warn(ctx=ctx, content=f'{ctx.author.mention}님은 주식을 갖고 있지 않습니다.')
     if not name in data:
         return await warn(ctx=ctx, content=f'{ctx.author.mention}님은 주식을 갖고 있지 않습니다.')
     with open('stocks/stocks.bin', 'rb') as f:
         stocks = load(f)
     if count in ['모두', 'ㅇㅇ', '올인', '최대']:
         count = 0
         for i in data[name]:
             count += i['count']
     else:
         count = int(count)
         if count < 1: return await warn(ctx=ctx, content='팔 주식의 개수를 1개 이상으로 입력해 주세요')
     user_stocks = 0
     for i in data[name]:
         user_stocks += i['count']
     if user_stocks < count: return await warn(ctx=ctx, content='팔 주식이 부족합니다.')
     addmoney = 0
     counts = 0
     while count != 0:
         if count >= data[name][0]['count']:
             addmoney += data[name][0]['count'] * stocks[name]['price']
             count -= data[name][0]['count']
             counts += data[name][0]['count']
             del data[name][0]
         else:
             data[name][0]['count'] -= count
             counts += count
             addmoney += count * stocks[name]['price']
             count = 0
     deliting = []
     for i in data:
         if len(data[i]) == 0: deliting.append(i)
     for i in deliting:
         del data[i]
     with open(f'stocks/users/{ctx.author.id}.bin', 'wb') as f:
         dump(data, f)
     writedata(id=ctx.author.id, item='point', value=str(int(getdata(id=ctx.author.id, item='point')) + addmoney))
     await sendEmbed(ctx=ctx, title='매도', content=f'{name}의 주식을 `{counts}`주 매도했습니다.')
Пример #7
0
 async def _betting(self, ctx, amount):
     point = int(getdata(id=ctx.author.id, item='point'))
     if amount in ['��', '��']:
         amount = point
     try:
         amount = int(amount)
     except ValueError:
         await warn(ctx=ctx,
                    content='걸 �� ��� 넣어 주세�.')
         return
     if int(point) < amount:
         return await warn(ctx=ctx, content='�� 부족합�다.')
     result = randint(-1, 1)
     writedata(
         id=ctx.author.id,
         item='countRandom',
         value=str(int(getdata(id=ctx.author.id, item='countRandom')) + 1))
     if result == 1:
         writedata(id=ctx.author.id,
                   item='point',
                   value=str(point + amount))
         await sendEmbed(
             ctx=ctx,
             title='와아아',
             content=f'�겼��다!\n�� ���: `{point+amount}`'
         )
         writedata(
             id=ctx.author.id,
             item='winningRandom',
             value=str(
                 int(getdata(id=ctx.author.id, item='winningRandom')) + 1))
     elif result == 0:
         await sendEmbed(
             ctx=ctx,
             title='�...',
             content=
             '�기진 ��지� 다행� �지� ��어�!')
     else:
         writedata(id=ctx.author.id,
                   item='point',
                   value=str(point - amount))
         await sendEmbed(
             ctx=ctx,
             title='��!',
             content=
             f'아쉽�� 져� � {amount}�� ��어�...\n�� ���: `{point-amount}`'
         )
Пример #8
0
 async def give_stock_profit(self):
     for i in listdir('stocks/users'):
         user_id = int(i.replace('.bin', ''))
         with open(i, 'rb') as f:
             data = load(f)
         with open('stocks/stocks.bin', 'rb') as f:
             stock_price = load(f)
         for i in data:
             count = 0
             for j in data[i]:
                 count += j['count']
             writedata(id=user_id, item='point', value=str(int(getdata(id=user_id, item='point')) + round(stock_price[i]['price'] * 0.01 * count)))
     await log(embed=discord.Embed(title='정상적으로 배당금 부여', description=str(datetime.now()), color=embedcolor), bot=self.bot)
Пример #9
0
 async def _addpoint(self, ctx, user: discord.user, addpoint: int):
     point = int(getdata(id=user.id, item='point'))
     point += addpoint
     writedata(id=user.id, item='point', value=str(point))
     await sendEmbed(ctx=ctx,
                     title='관리자송금',
                     content=f'{addpoint}원이 {user.mention}님께 보내졌습니다.')
     await log(embed=discord.Embed(
         title='관리자송금',
         description=
         f'{user.mention}님의 돈에 `{addpoint}`가 추가되었습니다.\n처리자: {ctx.author.mention}\n{(str(ctx.message.created_at))[:-7]}',
         color=embedcolor),
               bot=self.bot)
Пример #10
0
 async def _sendmoney(self, ctx, user: discord.User, amount: int):
     if amount < 100:
         await warn(
             ctx=ctx,
             content='100� ��부터 송�할 � ���다')
         return
     if user.bot:
         return await warn(
             ctx=ctx, content='봇��� 송�할 � 없��다')
     writedata(
         id=ctx.author.id,
         item='point',
         value=str(int(getdata(id=ctx.author.id, item='point')) - amount))
     writedata(id=user.id,
               item='point',
               value=str(
                   int(getdata(id=user.id, item='point')) +
                   round(amount * 0.95)))
     await sendEmbed(
         ctx=ctx,
         title='� 송� �',
         content=
         f'`{user}`�� � `{round(amount*0.95)}`�� 송�����다.\n���: � `{amount-round(amount*0.95)}`'
     )
Пример #11
0
 async def _check(self, ctx):
     date = getnow('%Y%m%d')
     if getdata(id=ctx.author.id, item='lastCheck') == date:
         await warn(ctx=ctx, content='오늘은 이미 출석체크를 하였습니다.')
         return
     await sendEmbed(ctx=ctx, title='출석체크', content=f'출석체크가 완료되었습니다.')
Пример #12
0
 async def _point(self, ctx, user: discord.User = None):
     if user is None or user.bot: user = ctx.author
     point = int(getdata(id=user.id, item='point'))
     await sendEmbed(ctx=ctx,
                     title='� � �',
                     content=f'`{user}`�� �: `{point}`�')
Пример #13
0
 async def on_command_completion(self, ctx):
     if ctx.author.bot: return
     writedata(
         id=ctx.author.id,
         item='commandCount',
         value=str(1 + int(getdata(id=ctx.author.id, item='commandCount'))))