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)
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))
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='공지 발행완료')
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'출석체크가 완료되었습니다.')