From 832bdfde226e2069b107b4d23f5bbee012cfc456 Mon Sep 17 00:00:00 2001 From: MeatyChunks <6160351+MeatyChunks@users.noreply.github.com> Date: Wed, 29 Jul 2020 00:46:20 +0100 Subject: [PATCH] [Economy] Prevent forbidden error when blocked by user (#4120) Stop `[p]payouts` throwing a console error if the user has blocked the bot. Probably too spammy to put the payout message in chat. --- redbot/cogs/economy/economy.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/redbot/cogs/economy/economy.py b/redbot/cogs/economy/economy.py index ee3bc830d..c05195d8d 100644 --- a/redbot/cogs/economy/economy.py +++ b/redbot/cogs/economy/economy.py @@ -532,7 +532,10 @@ class Economy(commands.Cog): @guild_only_check() async def payouts(self, ctx: commands.Context): """Show the payouts for the slot machine.""" - await ctx.author.send(SLOT_PAYOUTS_MSG) + try: + await ctx.author.send(SLOT_PAYOUTS_MSG) + except discord.Forbidden: + await ctx.send(_("I can't send direct messages to you.")) @commands.command() @guild_only_check()