Praxis_Bot/commands/implemented/command_tempText.py
Alex Orid c791f71845 typo
2021-04-16 14:16:06 -04:00

52 lines
1.9 KiB
Python

from abc import ABCMeta
import tempText_Module
from commands.command_base import AbstractCommand
import random
import utilities_script as utilities
class CommandChyron(AbstractCommand, metaclass=ABCMeta):
"""
this is the temptext command.
"""
command = "temptext"
def __init__(self):
super().__init__(CommandChyron.command, n_args=5, command_type=AbstractCommand.CommandType.Praxis)
self.help = ["The temptext string can be generated and updated with this command.",
"\nExample:","temptext update \"Name\" \"Title\" \"Content\""]
self.isCommandEnabled = True
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]:
tempTextModule = tempText_Module.tempText_Module()
tempText = tempText_Module.tempTextItem()
if i > 2:
newText = ""
counter = 0
for word in tempParsedMessage:
if counter > 2:
newText = newText + word + " "
counter = counter + 1
newText = newText[:-1] # Gets rid of last space
print(tempParsedMessage[2], newText)
tempText.itemName = tempParsedMessage[2]
tempText.itemContent = newText
tempTextModule.makeItem(tempText)
else:
tempText.main()
#tempTextModule.update_tempTextFiles()
returnMessage = "@" + user_message.user + " updated the temptextFiles!"
bot.return_message(returnMessage)
def get_help(self):
return self.help