Added a force stop command
This commit is contained in:
parent
bf535f3cbc
commit
b6a2f491ef
2 changed files with 26 additions and 0 deletions
|
@ -159,6 +159,19 @@ class Hangman:
|
||||||
await self.bot.say(
|
await self.bot.say(
|
||||||
"Alright, a hangman game has just started, you can start guessing now!\n{}".format(str(game)))
|
"Alright, a hangman game has just started, you can start guessing now!\n{}".format(str(game)))
|
||||||
|
|
||||||
|
@hangman.command(name='delete', aliases=['stop', 'remove'], pass_context=True, no_pm=True)
|
||||||
|
@checks.custom_perms(kick_members=True)
|
||||||
|
async def stop_game(self, ctx):
|
||||||
|
"""Force stops a game of hangman
|
||||||
|
This should realistically only be used in a situation like one player leaves
|
||||||
|
Hopefully a moderator will not abuse it, but there's not much we can do to avoid that"""
|
||||||
|
if self.games.get(ctx.message.server.id) is None:
|
||||||
|
await self.bot.say("There are no Hangman games running on this server!")
|
||||||
|
return
|
||||||
|
|
||||||
|
del self.games[ctx.message.server.id]
|
||||||
|
await self.bot.say("I have just stopped the game of Hangman, a new should be able to be started now!")
|
||||||
|
|
||||||
|
|
||||||
def setup(bot):
|
def setup(bot):
|
||||||
bot.add_cog(Hangman(bot))
|
bot.add_cog(Hangman(bot))
|
||||||
|
|
|
@ -265,6 +265,19 @@ class TicTacToe:
|
||||||
x_player.display_name)
|
x_player.display_name)
|
||||||
await self.bot.say(fmt)
|
await self.bot.say(fmt)
|
||||||
|
|
||||||
|
@tictactoe.command(name='delete', aliases=['stop', 'remove'], pass_context=True, no_pm=True)
|
||||||
|
@checks.custom_perms(kick_members=True)
|
||||||
|
async def stop_game(self, ctx):
|
||||||
|
"""Force stops a game of tictactoe
|
||||||
|
This should realistically only be used in a situation like one player leaves
|
||||||
|
Hopefully a moderator will not abuse it, but there's not much we can do to avoid that"""
|
||||||
|
if self.boards.get(ctx.message.server.id) is None:
|
||||||
|
await self.bot.say("There are no tictactoe games running on this server!")
|
||||||
|
return
|
||||||
|
|
||||||
|
del self.boards[ctx.message.server.id]
|
||||||
|
await self.bot.say("I have just stopped the game of TicTacToe, a new should be able to be started now!")
|
||||||
|
|
||||||
|
|
||||||
def setup(bot):
|
def setup(bot):
|
||||||
bot.add_cog(TicTacToe(bot))
|
bot.add_cog(TicTacToe(bot))
|
||||||
|
|
Loading…
Reference in a new issue