47 lines
1.6 KiB
Python
47 lines
1.6 KiB
Python
from abc import ABCMeta
|
|
|
|
from commands.command_base import AbstractCommand
|
|
|
|
import discord
|
|
import discord.message
|
|
|
|
import utilities_script as utilities
|
|
|
|
class CommandTTS_Twitch(AbstractCommand, metaclass=ABCMeta):
|
|
command = "!restart"
|
|
|
|
def __init__(self):
|
|
super().__init__(CommandTTS_Twitch.command, n_args=0, command_type=AbstractCommand.CommandType.TWITCH)
|
|
self.help = ["MISSING HELP ENTRY",
|
|
"\nExample:","command \"PARAM\""]
|
|
self.isCommandEnabled = True
|
|
|
|
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()
|
|
|
|
def get_help(self):
|
|
return self.help
|
|
|
|
class CommandTTS_Discord(AbstractCommand, metaclass=ABCMeta):
|
|
command = "//restart"
|
|
|
|
def __init__(self):
|
|
super().__init__(CommandTTS_Discord.command, n_args=0, command_type=AbstractCommand.CommandType.DISCORD)
|
|
self.help = ["MISSING HELP ENTRY",
|
|
"\nExample:","command \"PARAM\""]
|
|
self.isCommandEnabled = True
|
|
|
|
async def do_command(self, bot, discord_message: discord.message):
|
|
|
|
if str(discord_message.author.top_role) == "Admin":
|
|
print("Admin Check")
|
|
#response = str("Bot restarting... on %s" % discord_message.guild.name)
|
|
response = str("Bot restarting...")
|
|
await bot.send_message(discord_message, response)
|
|
utilities.restart_self()
|
|
|
|
def get_help(self):
|
|
return self.help |