Skip to content

Instantly share code, notes, and snippets.

@ivey
Created February 17, 2011 04:15
Show Gist options
  • Save ivey/830962 to your computer and use it in GitHub Desktop.
Save ivey/830962 to your computer and use it in GitHub Desktop.
From e1812b240cb46f43697002360255e722d13334c6 Mon Sep 17 00:00:00 2001
From: Michael D. Ivey <ivey@gweezlebur.com>
Date: Wed, 16 Feb 2011 22:11:33 -0600
Subject: [PATCH] Handle nickserv'd accounts and private channels
---
src/douglbutt.conf-sample | 2 ++
src/douglbutt/_douglbutt.py | 9 +++++++--
2 files changed, 9 insertions(+), 2 deletions(-)
diff --git a/src/douglbutt.conf-sample b/src/douglbutt.conf-sample
index 7d99ceb..9e750bd 100644
--- a/src/douglbutt.conf-sample
+++ b/src/douglbutt.conf-sample
@@ -1,7 +1,9 @@
[douglbutt]
server=irc.slashnet.org
channel=#test
+#key=channel_key
nick=dougltest
+#pass=nickserv_key
plugin_dir=plugins
user=Frederick Douglbutt
debug=True
diff --git a/src/douglbutt/_douglbutt.py b/src/douglbutt/_douglbutt.py
index 7a0aa2e..b685c3e 100644
--- a/src/douglbutt/_douglbutt.py
+++ b/src/douglbutt/_douglbutt.py
@@ -178,7 +178,12 @@ class DouglButt(SingleServerIRCBot):
def on_welcome(self, c, e):
if self.debug:
print e.arguments()[0]
- c.join(self.channel)
+ if self.settings.has_key('pass'):
+ c.privmsg('nickserv', "identify " + self.settings['pass'])
+ if self.settings.has_key('key'):
+ c.join(self.channel, self.settings['key'])
+ else:
+ c.join(self.channel)
self._hook('on_welcome', c, e)
def on_privmsg(self, c, e):
@@ -258,4 +263,4 @@ def main():
bot.start()
if __name__ == "__main__":
- main()
\ No newline at end of file
+ main()
--
1.7.3.2
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment