From c4ce053e690f141cbfa950e108fac9ea68f26c3e Mon Sep 17 00:00:00 2001 From: Yuuki Chan Date: Sun, 18 Feb 2024 23:07:58 +0900 Subject: [PATCH] Reformatted plugins/commands.py --- plugins/commands.py | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/plugins/commands.py b/plugins/commands.py index 3c12c99..318950e 100644 --- a/plugins/commands.py +++ b/plugins/commands.py @@ -1,15 +1,16 @@ -from src.plugin_base import PluginBase -from src.channel_manager import ChannelManager import sys +from src.channel_manager import ChannelManager +from src.plugin_base import PluginBase + + class Plugin(PluginBase): - def handle_message(self, source_nick, channel, message): message_parts = message.split() - self.channel_manager = ChannelManager() + self.channel_manager = ChannelManager() if message_parts[0] == '!hello': self.bot.ircsend(f'PRIVMSG {channel} :Hello, {source_nick}!') - + elif message_parts[0] == '!join': if len(message_parts) == 0: self.bot.ircsend(f'PRIVMSG {channel} :Please specify a channel to join') @@ -26,12 +27,11 @@ class Plugin(PluginBase): self.bot.ircsend(f'PART {message_parts[1]}') self.channel_manager.remove_channel(message_parts[1]) - elif message_parts[0] == "!quit": if len(message_parts) == 0: quit_message = 'EliteBot!' else: - quit_message = message[len(message_parts[0])+1:] + quit_message = message[len(message_parts[0]) + 1:] self.bot.ircsend(f'QUIT :{quit_message}') self.bot.ircsock.close() self.bot.connected = False @@ -44,7 +44,7 @@ class Plugin(PluginBase): else: raw_command = ' '.join(message_parts[1:]) self.bot.ircsend(raw_command) - + elif message_parts[0] == '!me': if len(message_parts) > 1: action_message = ' '.join(message_parts[1:]) @@ -56,4 +56,4 @@ class Plugin(PluginBase): if len(message_parts) > 1: self.bot.ircsend(f'PRIVMSG {channel} :Pinging {message_parts[1]}') else: - self.bot.ircsend(f'PRIVMSG {channel} :Please specify a nick to ping') \ No newline at end of file + self.bot.ircsend(f'PRIVMSG {channel} :Please specify a nick to ping')