update post_connect to accept a /command to do things other than "msg"

these are just /msg and /mode for now, and the slash is retained out of
convention

Signed-off-by: Brian S. Stephan <bss@incorporeal.org>
这个提交包含在:
Brian S. Stephan 2024-12-16 23:47:32 -06:00
父节点 166b506843
当前提交 d0cbc815d1
签署人:: bss
GPG 密钥 ID: 3DE06D3180895FCB

查看文件

@ -537,9 +537,13 @@ class IRCBot(irc.client.SimpleIRCClient):
# run automsg commands
if self.server_config.post_connect:
for cmd in self.server_config.post_connect.split('\n'):
cmd_split = cmd.split(' ')
# TODO NOTE: if the bot is sending something that changes the vhost
# (like 'hostserv on') we don't pick it up
self.connection.privmsg(cmd.split(' ')[0], ' '.join(cmd.split(' ')[1:]))
if cmd_split[0] == '/msg':
self.connection.privmsg(cmd.split(' ')[1], ' '.join(cmd.split(' ')[2:]))
elif cmd_split[0] == '/mode':
self.connection.mode(*cmd_split[1:])
# sleep before doing autojoins
time.sleep(self.server_config.delay_before_joins)