pew
This commit is contained in:
commit
aa0d60f883
33 changed files with 7398 additions and 0 deletions
0
plugins/__init__.py
Normal file
0
plugins/__init__.py
Normal file
BIN
plugins/__pycache__/__init__.cpython-310.pyc
Normal file
BIN
plugins/__pycache__/__init__.cpython-310.pyc
Normal file
Binary file not shown.
BIN
plugins/__pycache__/__init__.cpython-311.pyc
Normal file
BIN
plugins/__pycache__/__init__.cpython-311.pyc
Normal file
Binary file not shown.
BIN
plugins/__pycache__/commands.cpython-310.pyc
Normal file
BIN
plugins/__pycache__/commands.cpython-310.pyc
Normal file
Binary file not shown.
BIN
plugins/__pycache__/commands.cpython-311.pyc
Normal file
BIN
plugins/__pycache__/commands.cpython-311.pyc
Normal file
Binary file not shown.
59
plugins/commands.py
Normal file
59
plugins/commands.py
Normal file
|
@ -0,0 +1,59 @@
|
|||
from src.plugin_base import PluginBase
|
||||
from src.channel_manager import ChannelManager
|
||||
import sys
|
||||
|
||||
class Plugin(PluginBase):
|
||||
|
||||
def handle_message(self, source_nick, channel, message):
|
||||
message_parts = message.split()
|
||||
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')
|
||||
return
|
||||
else:
|
||||
self.channel_manager.save_channel(message_parts[1])
|
||||
self.bot.ircsend(f'JOIN {message_parts[1]}')
|
||||
|
||||
elif message_parts[0] == '!part':
|
||||
if len(message_parts) == 1:
|
||||
self.bot.ircsend(f'PART {channel}')
|
||||
self.channel_manager.remove_channel(channel)
|
||||
else:
|
||||
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:]
|
||||
self.bot.ircsend(f'QUIT :{quit_message}')
|
||||
self.bot.ircsock.close()
|
||||
self.bot.connected = False
|
||||
sys.exit()
|
||||
|
||||
elif message_parts[0] == "!raw":
|
||||
if len(message_parts) > 1:
|
||||
if message_parts[1].upper() == "PRIVMSG" and len(message_parts) > 3:
|
||||
raw_command = ' '.join(message_parts[1:3]) + " :" + ' '.join(message_parts[3:])
|
||||
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:])
|
||||
self.bot.ircsend(f'PRIVMSG {channel} :\x01ACTION {action_message}\x01')
|
||||
else:
|
||||
self.bot.ircsend(f'PRIVMSG {channel} :Please specify an action')
|
||||
|
||||
elif message_parts[0] == '!ping':
|
||||
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')
|
Loading…
Add table
Add a link
Reference in a new issue