From dfbeb63aef68107dba4abba48674a00a35135dd7 Mon Sep 17 00:00:00 2001 From: Alex Orid Date: Tue, 8 Dec 2020 06:19:56 -0500 Subject: [PATCH] Added Commands & changed prefix Added restart and shutdown commands to the twitch bot module. --- commands/implemented/command_restartBot.py | 18 ++++++++++++++++++ commands/implemented/command_shutdownBot.py | 18 ++++++++++++++++++ commands/implemented/command_tts.py | 2 +- 3 files changed, 37 insertions(+), 1 deletion(-) create mode 100644 commands/implemented/command_restartBot.py create mode 100644 commands/implemented/command_shutdownBot.py diff --git a/commands/implemented/command_restartBot.py b/commands/implemented/command_restartBot.py new file mode 100644 index 0000000..b42dd24 --- /dev/null +++ b/commands/implemented/command_restartBot.py @@ -0,0 +1,18 @@ +from abc import ABCMeta + +from commands.command_base import AbstractCommand + +import utilities_script as utilities + +class CommandTTS(AbstractCommand, metaclass=ABCMeta): + command = "//restart" + + def __init__(self): + super().__init__(CommandTTS.command, n_args=0, command_type=AbstractCommand.CommandType.TWITCH) + + def do_command(self, bot, twitch_message): + args = self.get_args(twitch_message.text) + if twitch_message.sender.lower() == twitch_message.channel: + bot.send_message("Bot restarting...") + utilities.restart_self() + diff --git a/commands/implemented/command_shutdownBot.py b/commands/implemented/command_shutdownBot.py new file mode 100644 index 0000000..6c78155 --- /dev/null +++ b/commands/implemented/command_shutdownBot.py @@ -0,0 +1,18 @@ +from abc import ABCMeta + +from commands.command_base import AbstractCommand + +import utilities_script as utilities + +class CommandTTS(AbstractCommand, metaclass=ABCMeta): + command = "//shutdown" + + def __init__(self): + super().__init__(CommandTTS.command, n_args=0, command_type=AbstractCommand.CommandType.TWITCH) + + def do_command(self, bot, twitch_message): + args = self.get_args(twitch_message.text) + if twitch_message.sender.lower() == twitch_message.channel: + bot.send_message("Bot shutting down...") + utilities.hard_shutdown() + diff --git a/commands/implemented/command_tts.py b/commands/implemented/command_tts.py index 133d851..a678fc2 100644 --- a/commands/implemented/command_tts.py +++ b/commands/implemented/command_tts.py @@ -5,7 +5,7 @@ from commands.command_base import AbstractCommand class CommandTTS(AbstractCommand, metaclass=ABCMeta): - command = "!tts" + command = "//tts" def __init__(self): super().__init__(CommandTTS.command, n_args=1, command_type=AbstractCommand.CommandType.TWITCH)