Skip to content

Commit d715964

Browse files
Merge pull request EliteBot-irc#1 from ComputerTech312/main
Update
2 parents ab6f751 + 2369772 commit d715964

File tree

16 files changed

+106
-129
lines changed

16 files changed

+106
-129
lines changed

‎README.md‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ This is an IRC bot written in Python. It connects to an IRC server, authenticate
1717

1818
## Usage
1919

20-
To run the bot, simply execute the script with `python3 irc_bot.py`. The bot will connect to the specified server and authenticate if necessary. It will then listen for commands and respond accordingly.
20+
To run the bot, simply execute the script with `python3 elitebot.py config.json`. The bot will connect to the specified server and authenticate if necessary. It will then listen for commands and respond accordingly.
2121

2222
## Commands
2323

‎data/channels.json‎

Lines changed: 0 additions & 1 deletion
This file was deleted.
-870 Bytes
Binary file not shown.
-1.03 KB
Binary file not shown.

‎modules/moo.py‎

Lines changed: 0 additions & 14 deletions
This file was deleted.

‎modules/quit.py‎

Lines changed: 0 additions & 24 deletions
This file was deleted.

‎plugins/commands.py‎

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
fromsrc.plugin_baseimportPluginBase
2+
fromsrc.channel_managerimportChannelManager
3+
importsys
4+
importtime
5+
6+
classPlugin(PluginBase):
7+
8+
defhandle_message(self, source_nick, channel, message):
9+
message_parts=message.split()
10+
self.channel_manager=ChannelManager()
11+
ifmessage_parts[0] =='!hello':
12+
self.bot._ircsend(f'PRIVMSG {channel} :Hello, {source_nick}!')
13+
14+
elifmessage_parts[0] =='!join':
15+
iflen(message_parts) ==0:
16+
self.bot._ircsend(f'PRIVMSG {channel} :Please specify a channel to join')
17+
return
18+
else:
19+
self.channel_manager.save_channel(message_parts[1])
20+
self.bot._ircsend(f'JOIN {message_parts[1]}')
21+
22+
elifmessage_parts[0] =='!part':
23+
iflen(message_parts) ==1:
24+
self.bot._ircsend(f'PART {channel}')
25+
self.channel_manager.remove_channel(channel)
26+
else:
27+
self.bot._ircsend(f'PART {message_parts[1]}')
28+
self.channel_manager.remove_channel(message_parts[1])
29+
30+
31+
elifmessage_parts[0] =="!quit":
32+
iflen(message_parts) ==0:
33+
quit_message='EliteBot!'
34+
else:
35+
quit_message=message[len(message_parts[0])+1:]
36+
self.bot._ircsend(f'QUIT :{quit_message}')
37+
self.bot.ircsock.close()
38+
self.bot.connected=False
39+
sys.exit()
40+
41+
defsend_hello_to_ct_periodically(self):
42+
whileTrue:
43+
time.sleep(60) # Wait for 60 seconds
44+
self.bot._ircsend('PRIVMSG #ct :Hello, #ct!')
-122 Bytes
Binary file not shown.

‎src/__pycache__/bot.cpython-36.pyc‎

-5.42 KB
Binary file not shown.
-1.88 KB
Binary file not shown.

0 commit comments

Comments
(0)