From b4f5c2c0a11f316b724bb5262a586aa0a195b889 Mon Sep 17 00:00:00 2001 From: Michael H Date: Mon, 5 Mar 2018 16:18:41 -0500 Subject: [PATCH] Revert "[V3]Encoding issue fix" (#1392) * Revert "[V3 Core] Encoding issue fix (#1365)" This reverts commit f6903cf5820ec93833aced058622cb2f235ac22b. * Don't let the system encoding screw with things, specify opens as happening with utf-8 encoding (cherry picked from commit c10e4dddca32a7a74978f2938359be8a65e7e40f) --- redbot/cogs/mod/mod.py | 14 +++++++------- redbot/core/events.py | 5 +---- 2 files changed, 8 insertions(+), 11 deletions(-) diff --git a/redbot/cogs/mod/mod.py b/redbot/cogs/mod/mod.py index f86a5b374..c4969e43d 100644 --- a/redbot/cogs/mod/mod.py +++ b/redbot/cogs/mod/mod.py @@ -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(str(e, encoding='utf-8', errors='replace')) + print(e) 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(str(e, encoding='utf-8', errors='replace')) + print(e) 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(str(e, encoding='utf-8', errors='replace')) + print(e) return self.unban_queue.append(queue_entry) try: await guild.unban(user) except discord.HTTPException as e: self.unban_queue.remove(queue_entry) - print(str(e, encoding='utf-8', errors='replace')) + print(e) 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(str(e, encoding='utf-8', errors='replace')) + print(e) 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(str(e, encoding='utf-8', errors='replace')) + print(e) 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(str(e, encoding='utf-8', errors='replace')) + print(e) async def get_audit_entry_info(self, guild: discord.Guild, diff --git a/redbot/core/events.py b/redbot/core/events.py index 6a78bbc72..45131075b 100644 --- a/redbot/core/events.py +++ b/redbot/core/events.py @@ -140,10 +140,7 @@ def init_events(bot, cli_flags): print(Fore.RED + INTRO) print(Style.RESET_ALL) - print( - str(bordered(INFO, INFO2, ascii_border=ascii_border), - encoding='utf-8', errors='replace') - ) + print(bordered(INFO, INFO2, ascii_border=ascii_border)) if invite_url: print("\nInvite URL: {}\n".format(invite_url))