Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 23 additions & 0 deletions lib/pyborg/pyborg-irc.py
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,7 @@ class ModIRC(SingleServerIRCBot):
"me": "Owner command. Usage !me nick message\nmake the bot send the sentence 'message' to 'nick'",
"jump": "Owner command. Usage: !jump\nMake the bot reconnect to IRC",
"quit": "Owner command. Usage: !quit\nMake the bot quit IRC",
"prompted": "Owner command. Usage: !prompted [on|off]\nTurn prompted mode on or off (bot will respond every time a message contains its name)",
"owner": "Usage: !owner password\nAllow to become owner of the bot"
}

Expand All @@ -118,6 +119,7 @@ def __init__(self, my_pyborg, args):
"reply2ignored": ("Reply to ignored people", 0),
"reply_chance": ("Chance of reply (%) per message", 33),
"quitmsg": ("IRC quit message", "Bye :-("),
"prompted": ("Respond whenever bot name is mentioned", 0),
"password": ("password for control the bot (Edit manually !)", ""),
"autosaveperiod": ("Save every X minutes. Leave at 0 for no saving.", 60),
"nickserv": ("username and password for nickserv", ("", ""))
Expand Down Expand Up @@ -366,6 +368,9 @@ def on_msg(self, c, e):
# double reply chance if the text contains our nickname :-)
if body_contains_me:
replyrate = replyrate * 2
# always respond if prompted is true as well
if self.settings.prompted == 1:
replyrate = 100

# Always reply to private messages
if e.eventtype() == "privmsg":
Expand Down Expand Up @@ -453,6 +458,24 @@ def irc_commands(self, body, source, target, c, e):
else:
msg = msg + "off"
self.settings.reply2ignored = 0

# prompted mode
elif command_list[0] == "!prompted":
msg = "Prompted mode "
if len(command_list) == 1:
if self.settings.prompted == 0:
msg = msg + "off"
else:
msg = msg + "on"
else:
toggle = command_list[1].lower()
if toggle == "on":
msg = msg + "on"
self.settings.prompted = 1
else:
msg = msg + "off"
self.settings.prompted = 0

# Stop talking
elif command_list[0] == "!shutup":
if self.settings.speaking == 1:
Expand Down