Modified do_command to receive the Twitch_Module class from twitch_script.py and the twitch.chat.Message from the bot implemented the loader in the bot
23 lines
735 B
Python
23 lines
735 B
Python
from abc import ABCMeta
|
|
|
|
import twitch.chat
|
|
|
|
from commands.command_base import AbstractCommand
|
|
from twitch_script import Twitch_Module
|
|
|
|
|
|
class CommandTTS(AbstractCommand, metaclass=ABCMeta):
|
|
command = "!tts"
|
|
|
|
def __init__(self):
|
|
super().__init__(CommandTTS.command, n_args=1, command_type=AbstractCommand.CommandType.TWITCH)
|
|
|
|
def do_command(self, bot: Twitch_Module, twitch_message: twitch.chat.Message):
|
|
args = self.get_args(twitch_message.text)
|
|
if args[1] == "start":
|
|
bot.send_message("tts activated on #%s" % twitch_message.channel)
|
|
bot.tts_enabled = True
|
|
elif args[1] == "stop":
|
|
bot.send_message("tts deactivated")
|
|
bot.tts_enabled = False
|