Пример #1
0
 async def _ranking(self, ctx, category='전체'):
     if category not in ['����']: return await warn(ctx=ctx, content=f'`{category}` �킹� 찾� � 없��다.')
     await ctx.trigger_typing()
     if not isdir('rank'):
         makedirs('rank')
     if not isfile('rank/check.json'):
         date = getnow('%Y%m%d')
         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)
     if category == '����':
         content = []
         with open('rank/check.json', 'r') as f:
             data = json.load(f)
         if data['date'] != getnow('%Y%m%d'): return await sendEmbed(ctx=ctx, title='�� �� �킹', content='��� ���가 없��다.')
         for i in range(5):
             if data[str(i+1)]['id'] == 'none': break
             content.append('**' + str(i+1) + '**. ' + str(await self.bot.fetch_user(int(data[str(i+1)]['id']))) + ' : ' + data[str(i+1)]['time'])
         content = '\n'.join(content)
         return await sendEmbed(ctx=ctx, title='�� �� �킹', content=content)
Пример #2
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))
Пример #3
0
 async def _post(self, ctx, *, content):
     if not isdir('posts'):
         makedirs('posts')
     if not isfile('posts/count.bin'):
         with open('posts/count.bin', 'wb') as f:
             pickle.dump(0, f)
         count = 0
     else:
         with open('posts/count.bin', 'rb') as f:
             count = pickle.load(f)
     with open(f'posts/{count}.json', 'w') as f:
         json.dump(
             {
                 'content': content,
                 'date': getnow('%Y년 %m월 %d일 %H시 %M분'),
                 'writer': str(ctx.author.id)
             }, f)
     with open(f'posts/count.bin', 'wb') as f:
         pickle.dump(count + 1, f)
     await sendEmbed(ctx=ctx, title='공지발행', content='공지 발행완료')
Пример #4
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'출석체크가 완료되었습니다.')