Skip to content

Commit ecc85a8

Browse files
added error tracking commands
1 parent 4e04e29 commit ecc85a8

File tree

2 files changed

+19
-0
lines changed

2 files changed

+19
-0
lines changed

hitbloq_bot.py

+16
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
import json
33
import time
44
import sys
5+
import os
56

67
import discord
78
from discord.utils import get
@@ -237,6 +238,21 @@ async def on_message(message):
237238
output_text += '```'
238239
await message.channel.send(message.author.mention + '\n' + output_text)
239240

241+
if message_args[0] == '!error_groups':
242+
output_text = '```'
243+
for error_log in os.listdir('logs'):
244+
output_text += error_log + '\n'
245+
output_text += '```'
246+
await message.channel.send(message.author.mention + '\n' + output_text)
247+
248+
if message_args[0] == '!errors':
249+
error_group = message_args[1]
250+
f = open('logs/' + error_group, 'r')
251+
dat = f.read()
252+
f.close()
253+
output_text = '```' + dat[-5000:] + '```'
254+
await message.channel.send(message.author.mention + '\n' + output_text)
255+
240256
if message_args[0] == '!stop_bot':
241257
await message.channel.send(message.author.mention + ' stopping... :(')
242258
sys.exit()

logs/placeholder.txt

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
this is
2+
3+
a placeholder

0 commit comments

Comments
 (0)