Skip to content

Commit da9c79f

Browse files
committed
Removed square brackets when logging json embeds in database
Signed-off-by: ColaIan <colaian.yt@gmail.com>
1 parent c1ab42c commit da9c79f

File tree

2 files changed

+7
-8
lines changed

2 files changed

+7
-8
lines changed

requirements.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
1-
aiohttp==3.5.4
1+
aiohttp==3.6.2
22
async-timeout==3.0.1
33
attrs==19.3.0
44
beautifulsoup4==4.8.2
55
bs4==0.0.1
66
certifi==2019.11.28
77
chardet==3.0.4
8-
discord.py==1.2.5
8+
discord.py==1.3.0
99
idna==2.8
1010
lavalink==3.0.0
1111
multidict==4.7.4

teapot/events.py

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ def __init__(bot):
1010
message_send(bot)
1111
message_edit(bot)
1212
message_delete(bot)
13-
on_command_error(bot)
13+
# on_command_error(bot)
1414

1515

1616
def join(bot):
@@ -99,7 +99,7 @@ async def on_raw_message_edit(ctx):
9999
except Exception as e:
100100
print(e)
101101
except:
102-
content = str(json.loads(json.dumps(ctx.data))['embeds'])
102+
content = str(json.loads(json.dumps(ctx.data))['embeds'][0])
103103
if teapot.config.storage_type() == "mysql":
104104
try:
105105
database = teapot.database.__init__()
@@ -129,15 +129,14 @@ async def on_message_delete(ctx):
129129

130130
def on_command_error(bot):
131131
@bot.event
132-
async def on_command_error(ctx, error):
132+
async def on_command_error(ctx, e):
133133
if teapot.config.storage_type() == "mysql":
134134
try:
135135
database = teapot.database.__init__()
136136
db = teapot.database.db(database)
137137
db.execute(
138-
"INSERT INTO `guild_logs`(timestamp, guild_id, channel_id, message_id, user_id, action_type, message) VALUES(%s, %s, %s, %s, %s, %s, %s)",
139-
(teapot.time(), ctx.guild.id, ctx.message.channel.id, ctx.message.id, ctx.message.author.id,
140-
"CMD_ERROR", str(error)))
138+
"INSERT INTO `bot_logs`(timestamp, type, class, message) VALUES(%s, %s, %s, %s)",
139+
(teapot.time(), "CMD_ERROR", __name__, str(e)))
141140
database.commit()
142141
except Exception as e:
143142
print(e)

0 commit comments

Comments
 (0)