Skip to content

Commit 832bdfd

Browse files
authored
[Economy] Prevent forbidden error when blocked by user (Cog-Creators#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.
1 parent 260a2d5 commit 832bdfd

1 file changed

Lines changed: 4 additions & 1 deletion

File tree

redbot/cogs/economy/economy.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -532,7 +532,10 @@ async def leaderboard(self, ctx: commands.Context, top: int = 10, show_global: b
532532
@guild_only_check()
533533
async def payouts(self, ctx: commands.Context):
534534
"""Show the payouts for the slot machine."""
535-
await ctx.author.send(SLOT_PAYOUTS_MSG)
535+
try:
536+
await ctx.author.send(SLOT_PAYOUTS_MSG)
537+
except discord.Forbidden:
538+
await ctx.send(_("I can't send direct messages to you."))
536539

537540
@commands.command()
538541
@guild_only_check()

0 commit comments

Comments
 (0)