mirror of
https://github.com/Cog-Creators/Red-DiscordBot.git
synced 2025-11-06 11:18:54 -05:00
Catch discord.errors.Forbidden when DMing a user the invite message (#2948)
* Catch discord.errors.Forbidden when DMing a user the invite message Uses the same error message as `[p]help` * Create 2948.bugfix.rst * You saw nothing
This commit is contained in:
parent
b8a7a66566
commit
efcf91e934
1
changelog.d/2948.bugfix.rst
Normal file
1
changelog.d/2948.bugfix.rst
Normal file
@ -0,0 +1 @@
|
|||||||
|
The [p]invite command no longer errors when a user has the bot blocked or DMs disabled in the server.
|
||||||
@ -435,7 +435,13 @@ class Core(commands.Cog, CoreLogic):
|
|||||||
@commands.check(CoreLogic._can_get_invite_url)
|
@commands.check(CoreLogic._can_get_invite_url)
|
||||||
async def invite(self, ctx):
|
async def invite(self, ctx):
|
||||||
"""Show's Red's invite url"""
|
"""Show's Red's invite url"""
|
||||||
await ctx.author.send(await self._invite_url())
|
try:
|
||||||
|
await ctx.author.send(await self._invite_url())
|
||||||
|
except discord.errors.Forbidden:
|
||||||
|
await ctx.send(
|
||||||
|
"I couldn't send the invite message to you in DM. "
|
||||||
|
"Either you blocked me or you disabled DMs in this server."
|
||||||
|
)
|
||||||
|
|
||||||
@commands.group()
|
@commands.group()
|
||||||
@checks.is_owner()
|
@checks.is_owner()
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user