command to change the bot's nick, refer to that rather than the original config option when needed
This commit is contained in:
parent
226ad6709e
commit
93c86257a0
15
dr.botzo.py
15
dr.botzo.py
@ -108,6 +108,17 @@ def sub_save_config(connection, event, nick, userhost, replypath, what, admin_un
|
|||||||
config.write(cfg)
|
config.write(cfg)
|
||||||
connection.privmsg(replypath, 'saved config file')
|
connection.privmsg(replypath, 'saved config file')
|
||||||
|
|
||||||
|
#####
|
||||||
|
# sub_change_nick
|
||||||
|
# change the bot's nickname
|
||||||
|
#####
|
||||||
|
|
||||||
|
def sub_change_nick(connection, event, nick, userhost, replypath, what, admin_unlocked):
|
||||||
|
if what.split(' ')[0] == 'nick' and admin_unlocked:
|
||||||
|
newnick = what.split(' ')[1]
|
||||||
|
connection.nick(newnick)
|
||||||
|
connection.privmsg(replypath, 'changed nickname')
|
||||||
|
|
||||||
#####
|
#####
|
||||||
# on_connect
|
# on_connect
|
||||||
# handler for when the bot has connected to IRC
|
# handler for when the bot has connected to IRC
|
||||||
@ -152,6 +163,7 @@ def on_privmsg(connection, event):
|
|||||||
sub_quit_channel(connection, event, nick, userhost, replypath, what, admin_unlocked)
|
sub_quit_channel(connection, event, nick, userhost, replypath, what, admin_unlocked)
|
||||||
sub_autojoin_manipulate(connection, event, nick, userhost, replypath, what, admin_unlocked)
|
sub_autojoin_manipulate(connection, event, nick, userhost, replypath, what, admin_unlocked)
|
||||||
sub_save_config(connection, event, nick, userhost, replypath, what, admin_unlocked)
|
sub_save_config(connection, event, nick, userhost, replypath, what, admin_unlocked)
|
||||||
|
sub_change_nick(connection, event, nick, userhost, replypath, what, admin_unlocked)
|
||||||
|
|
||||||
# standard commands
|
# standard commands
|
||||||
sub_report_seen(connection, event, nick, userhost, replypath, what, admin_unlocked)
|
sub_report_seen(connection, event, nick, userhost, replypath, what, admin_unlocked)
|
||||||
@ -177,7 +189,7 @@ def on_pubmsg(connection, event):
|
|||||||
sub_add_to_seen(connection, event, nick, userhost, what)
|
sub_add_to_seen(connection, event, nick, userhost, what)
|
||||||
|
|
||||||
# only do commands if the bot has been addressed directly
|
# only do commands if the bot has been addressed directly
|
||||||
addressed_pattern = '^' + botnick + '[:,]?\s+'
|
addressed_pattern = '^' + connection.get_nickname() + '[:,]?\s+'
|
||||||
addressed_re = re.compile(addressed_pattern)
|
addressed_re = re.compile(addressed_pattern)
|
||||||
|
|
||||||
if not addressed_re.match(what):
|
if not addressed_re.match(what):
|
||||||
@ -191,6 +203,7 @@ def on_pubmsg(connection, event):
|
|||||||
sub_quit_channel(connection, event, nick, userhost, replypath, what, admin_unlocked)
|
sub_quit_channel(connection, event, nick, userhost, replypath, what, admin_unlocked)
|
||||||
sub_autojoin_manipulate(connection, event, nick, userhost, replypath, what, admin_unlocked)
|
sub_autojoin_manipulate(connection, event, nick, userhost, replypath, what, admin_unlocked)
|
||||||
sub_save_config(connection, event, nick, userhost, replypath, what, admin_unlocked)
|
sub_save_config(connection, event, nick, userhost, replypath, what, admin_unlocked)
|
||||||
|
sub_change_nick(connection, event, nick, userhost, replypath, what, admin_unlocked)
|
||||||
|
|
||||||
# standard commands
|
# standard commands
|
||||||
sub_report_seen(connection, event, nick, userhost, replypath, what, admin_unlocked)
|
sub_report_seen(connection, event, nick, userhost, replypath, what, admin_unlocked)
|
||||||
|
Loading…
Reference in New Issue
Block a user