Add reset command / module
This commit is contained in:
parent
ff5e7f310a
commit
9702e1e77a
@ -27,6 +27,7 @@ class HelpManager(BaseGameManager):
|
|||||||
+ " You can also add a batter's guess with: "
|
+ " You can also add a batter's guess with: "
|
||||||
+ "!resolve <value> <discord id #> <guess>\n"
|
+ "!resolve <value> <discord id #> <guess>\n"
|
||||||
+ "!points - Shows a table of the most recent players, and their scores\n"
|
+ "!points - Shows a table of the most recent players, and their scores\n"
|
||||||
|
+ "!reset - Removes all the guesses"
|
||||||
+ "!help - Shows this message"
|
+ "!help - Shows this message"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -14,11 +14,12 @@ from game.new_game import NewGameManager
|
|||||||
from game.end_game import EndGameManager
|
from game.end_game import EndGameManager
|
||||||
from game.guess import GuessManager
|
from game.guess import GuessManager
|
||||||
from game.points import PointsManager
|
from game.points import PointsManager
|
||||||
|
from game.reset import ResetManager
|
||||||
from game.help import HelpManager
|
from game.help import HelpManager
|
||||||
|
|
||||||
|
|
||||||
class GameManager(
|
class GameManager(
|
||||||
NewGameManager, EndGameManager, GuessManager, PointsManager, HelpManager
|
NewGameManager, EndGameManager, GuessManager, PointsManager, ResetManager, HelpManager
|
||||||
):
|
):
|
||||||
"""
|
"""
|
||||||
Represents what this bot is able to do on a channel (or DMs)
|
Represents what this bot is able to do on a channel (or DMs)
|
||||||
|
22
game/reset.py
Normal file
22
game/reset.py
Normal file
@ -0,0 +1,22 @@
|
|||||||
|
#!/usr/bin/env python3
|
||||||
|
# Copyright 2022 - c0de <c0de@c0de.dev>
|
||||||
|
# Licensed under the MIT License (https://opensource.org/licenses/MIT)
|
||||||
|
|
||||||
|
# pylint: disable=missing-module-docstring,too-few-public-methods
|
||||||
|
|
||||||
|
from database.models import GuessModel as Guess
|
||||||
|
from game.base import BaseGameManager
|
||||||
|
|
||||||
|
|
||||||
|
class ResetManager(BaseGameManager):
|
||||||
|
"""Commands that run when a player asks for help"""
|
||||||
|
|
||||||
|
def __init__(self):
|
||||||
|
super().__init__()
|
||||||
|
self.commands.append(("reset", self.reset))
|
||||||
|
|
||||||
|
async def reset(self):
|
||||||
|
"""Reset command purges all guesses"""
|
||||||
|
Guess.delete().where(True).execute()
|
||||||
|
|
||||||
|
return await self.message.channel.send("ok")
|
Loading…
Reference in New Issue
Block a user