Changed unicode encoding in mysql, it is being lazy with 3 chars not 4

This commit is contained in:
Jeremy Zhang 2017-05-27 10:50:52 -07:00
parent d90cd64b0f
commit 5cb224e20c

View File

@ -56,13 +56,13 @@ class Titan(discord.Client):
) )
try: try:
await self.database.connect(config["database-uri"] + "?charset=utf8") await self.database.connect(config["database-uri"] + "?charset=utf8mb4")
except Exception: except Exception:
self.logger.error("Unable to connect to specified database!") self.logger.error("Unable to connect to specified database!")
traceback.print_exc() traceback.print_exc()
await self.logout() await self.logout()
return return
if "no-init" not in sys.argv: if "no-init" not in sys.argv:
for server in self.servers: for server in self.servers:
await self.database.update_guild(server) await self.database.update_guild(server)
@ -84,7 +84,7 @@ class Titan(discord.Client):
async def on_message(self, message): async def on_message(self, message):
await self.database.push_message(message) await self.database.push_message(message)
msg_arr = message.content.split() # split the message msg_arr = message.content.split() # split the message
if len(message.content.split()) > 1 and message.server: #making sure there is actually stuff in the message and have arguments and check if it is sent in server (not PM) if len(message.content.split()) > 1 and message.server: #making sure there is actually stuff in the message and have arguments and check if it is sent in server (not PM)
if msg_arr[0] == "<@{}>".format(self.user.id): #make sure it is mention if msg_arr[0] == "<@{}>".format(self.user.id): #make sure it is mention
@ -106,7 +106,7 @@ class Titan(discord.Client):
await asyncio.sleep(1) await asyncio.sleep(1)
await self.leave_server(guild) await self.leave_server(guild)
return return
await self.database.update_guild(guild) await self.database.update_guild(guild)
for channel in guild.channels: for channel in guild.channels:
async for message in self.logs_from(channel, limit=50, reverse=True): async for message in self.logs_from(channel, limit=50, reverse=True):
@ -160,4 +160,4 @@ class Titan(discord.Client):
await self.database.update_guild_member(member, active=False, banned=True) await self.database.update_guild_member(member, active=False, banned=True)
async def on_member_unban(self, server, user): async def on_member_unban(self, server, user):
await self.database.unban_server_user(user, server) await self.database.unban_server_user(user, server)