Allow configuring username and realname.

This commit is contained in:
Steve Dougherty 2013-01-20 02:14:18 -05:00
parent f56f9998d1
commit c26d3b7619
2 changed files with 5 additions and 3 deletions

View File

@ -9,6 +9,8 @@ nick=RelayBot
mode=Default
#Response sent when addressed with <nickname>: or privmsg'd.
info=This is a relay bot.
username=RelayBot
realname=Relay P. Botterson
heartbeat=90
[Freenode]

View File

@ -32,7 +32,7 @@ def main():
return None
options = {}
for option in [ "timeout", "host", "port", "nick", "channel", "info", "heartbeat", "password" ]:
for option in [ "timeout", "host", "port", "nick", "channel", "info", "heartbeat", "password", "username", "realname" ]:
options[option] = get(option)
mode = get("mode")
@ -83,8 +83,6 @@ class Communicator:
communicator = Communicator()
class IRCRelayer(irc.IRCClient):
realname = "Relay P. Botternson"
username = "RelayBot"
def __init__(self, config):
self.network = config['host']
@ -94,6 +92,8 @@ class IRCRelayer(irc.IRCClient):
self.identifier = config['identifier']
self.privMsgResponse = config['info']
self.heartbeatInterval = float(config['heartbeat'])
self.username = config['username']
self.realname = config['realname']
log.msg("IRC Relay created. Name: %s | Host: %s | Channel: %s"%(self.nickname, self.network, self.channel))
def formatUsername(self, username):