Praxis_Bot/commands/implemented/command_chyron.py
2021-04-11 21:49:15 -04:00

47 lines
1.6 KiB
Python

from abc import ABCMeta
import chyron_module
from commands.command_base import AbstractCommand
import random
import utilities_script as utilities
class CommandChyron(AbstractCommand, metaclass=ABCMeta):
"""
this is the chyron command.
"""
command = "chyron"
def __init__(self):
super().__init__(CommandChyron.command, n_args=5, command_type=AbstractCommand.CommandType.Praxis)
self.help = ["The chyron string can be generated and updated with this command.",
"\nExample:","chyron update \"RIGHTNOW\""]
def do_command(self, bot, user_message):
tempBool = True
if tempBool == True:
tempParsedMessage = user_message.message.split(" ")
i = len(tempParsedMessage)
if i > 2:
if "update" in tempParsedMessage[1]:
chyron = chyron_module.Chyron_Module()
if i > 2:
rightNow = ""
counter = 0
for word in tempParsedMessage:
if counter > 1:
rightNow = rightNow + word + " "
counter = counter + 1
rightNow = rightNow[:-1]
chyron.main(rightNow)
else:
chyron.main()
chyron.updateChyronFile()
returnMessage = "@" + user_message.user + " updated the chyron!"
bot.return_message(returnMessage)
def get_help(self):
return self.help