mirror of
https://github.com/Cog-Creators/Red-DiscordBot.git
synced 2025-11-20 18:06:08 -05:00
[V3 Core] Encoding issue fix (#1365)
* Don't let the system encoding screw with things, specify opens as happening with utf-8 encoding * And also deal with encoding issues because windows is a special snowflake (see: #1366) * let's just use the encoding param in str() rather than encode/decode...
This commit is contained in:
@@ -322,7 +322,7 @@ class Mod:
|
||||
except discord.errors.Forbidden:
|
||||
await ctx.send(_("I'm not allowed to do that."))
|
||||
except Exception as e:
|
||||
print(e)
|
||||
print(str(e, encoding='utf-8', errors='replace'))
|
||||
else:
|
||||
await ctx.send(_("Done. That felt good."))
|
||||
|
||||
@@ -379,7 +379,7 @@ class Mod:
|
||||
await ctx.send(_("I'm not allowed to do that."))
|
||||
except Exception as e:
|
||||
self.ban_queue.remove(queue_entry)
|
||||
print(e)
|
||||
print(str(e, encoding='utf-8', errors='replace'))
|
||||
else:
|
||||
await ctx.send(_("Done. It was about time."))
|
||||
|
||||
@@ -540,14 +540,14 @@ class Mod:
|
||||
return
|
||||
except discord.HTTPException as e:
|
||||
self.ban_queue.remove(queue_entry)
|
||||
print(e)
|
||||
print(str(e, encoding='utf-8', errors='replace'))
|
||||
return
|
||||
self.unban_queue.append(queue_entry)
|
||||
try:
|
||||
await guild.unban(user)
|
||||
except discord.HTTPException as e:
|
||||
self.unban_queue.remove(queue_entry)
|
||||
print(e)
|
||||
print(str(e, encoding='utf-8', errors='replace'))
|
||||
return
|
||||
else:
|
||||
await ctx.send(_("Done. Enough chaos."))
|
||||
@@ -1209,7 +1209,7 @@ class Mod:
|
||||
"Mention spam (Autoban)", until=None, channel=None
|
||||
)
|
||||
except RuntimeError as e:
|
||||
print(e)
|
||||
print(str(e, encoding='utf-8', errors='replace'))
|
||||
return False
|
||||
return True
|
||||
return False
|
||||
@@ -1269,7 +1269,7 @@ class Mod:
|
||||
"ban", member, mod,
|
||||
reason if reason else None)
|
||||
except RuntimeError as e:
|
||||
print(e)
|
||||
print(str(e, encoding='utf-8', errors='replace'))
|
||||
|
||||
async def on_member_unban(self, guild: discord.Guild, user: discord.User):
|
||||
if (guild.id, user.id) in self.unban_queue:
|
||||
@@ -1287,7 +1287,7 @@ class Mod:
|
||||
await modlog.create_case(guild, date, "unban",
|
||||
user, mod, reason)
|
||||
except RuntimeError as e:
|
||||
print(e)
|
||||
print(str(e, encoding='utf-8', errors='replace'))
|
||||
|
||||
async def get_audit_entry_info(self,
|
||||
guild: discord.Guild,
|
||||
|
||||
Reference in New Issue
Block a user