Sending messages in DM
This commit is contained in:
parent
a0a1c7adc9
commit
781d6cb756
@ -32,16 +32,24 @@ class Recruitment(commands.Cog):
|
|||||||
async def cog_check(self, ctx: commands.Context):
|
async def cog_check(self, ctx: commands.Context):
|
||||||
if await ctx.bot.is_admin(ctx.author):
|
if await ctx.bot.is_admin(ctx.author):
|
||||||
return True
|
return True
|
||||||
|
|
||||||
guild_id = ctx.guild.id
|
guild_id = ctx.guild.id
|
||||||
if guild_id not in self.antispam:
|
if guild_id not in self.antispam:
|
||||||
self.antispam[guild_id] = AntiSpam([(datetime.timedelta(hours=1), 1)])
|
self.antispam[guild_id] = AntiSpam([(datetime.timedelta(hours=1), 1)])
|
||||||
antispam = self.antispam[guild_id]
|
antispam = self.antispam[guild_id]
|
||||||
|
|
||||||
if antispam.spammy:
|
if antispam.spammy:
|
||||||
await ctx.send("Please wait for an hour before sending another application.")
|
try:
|
||||||
|
await ctx.message.delete()
|
||||||
|
except discord.Forbidden:
|
||||||
|
pass
|
||||||
|
await ctx.author.send("Please wait for an hour before sending your application again.")
|
||||||
return False
|
return False
|
||||||
|
|
||||||
antispam.stamp()
|
antispam.stamp()
|
||||||
return True
|
return True
|
||||||
|
|
||||||
|
|
||||||
@commands.guild_only()
|
@commands.guild_only()
|
||||||
@checks.admin_or_permissions(manage_guild=True)
|
@checks.admin_or_permissions(manage_guild=True)
|
||||||
@commands.group(name="setapplicationschannel", pass_context=True, no_pm=True)
|
@commands.group(name="setapplicationschannel", pass_context=True, no_pm=True)
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user