DeleteGame: added a try catch

This commit is contained in:
Elnath 2021-06-11 00:00:17 +02:00
parent 21810d3b53
commit fa28e10f27
1 changed files with 4 additions and 1 deletions

View File

@ -127,7 +127,10 @@ class SecretBot(commands.Cog):
gm_role = game.get_gm_role() gm_role = game.get_gm_role()
await game.delete() await game.delete()
await ctx.guild.get_member(self.bot.user.id).remove_roles(gm_role) await ctx.guild.get_member(self.bot.user.id).remove_roles(gm_role)
await ctx.reply(":white_check_mark: Game deleted!") try:
await ctx.reply(":white_check_mark: Game deleted!")
except discord.NotFound: # If the command is executed in a game channel, then the channel won't exist anymore for the reply
pass
@commands.command("StartVote") @commands.command("StartVote")
async def start_vote(self, ctx: commands.Context, president: discord.Member, chancellor: discord.Member): async def start_vote(self, ctx: commands.Context, president: discord.Member, chancellor: discord.Member):