[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.
This commit is contained in:
MeatyChunks 2020-07-29 00:46:20 +01:00 committed by GitHub
parent 260a2d5c78
commit 832bdfde22
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -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()