[Otfbot-svn] r125 - trunk/modules

allo at BerliOS allo
Mo Jun 25 23:57:46 CEST 2007


Author: allo
Date: 2007-06-25 23:57:46 +0200 (Mon, 25 Jun 2007)
New Revision: 125

Added:
   trunk/modules/psycMod.py
Log:
allow admins to send psyc commands to the bot, which the bot should send prefixed with the psyccmdchar to the psyc-server


Added: trunk/modules/psycMod.py
===================================================================
--- trunk/modules/psycMod.py	2007-06-25 21:39:51 UTC (rev 124)
+++ trunk/modules/psycMod.py	2007-06-25 21:57:46 UTC (rev 125)
@@ -0,0 +1,37 @@
+# OtfBot module to allow the botowner to control the bot with psyc commands
+#
+# Otfbot is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# Otfbot is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with OtfBot; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+# 
+# (c) 2007 by Alexander Schier
+#
+
+import string, re
+import chatMod, functions
+
+def default_settings():
+	settings={};
+	settings['psycmod.psyccommand']='!psyc'
+	settings['psycmod.psyccmdchar']='!psyc'
+	return settings
+		
+class chatMod(chatMod.chatMod):
+	def __init__(self, bot):
+		self.bot = bot
+
+	def msg(self, user, channel, msg):
+		user = user.split("!")[0] #only nick
+		if self.bot.auth(user) > 5 and msg[:len(self.bot.getConfig('psycmod.psyccommand', '!psyc'))]:
+			msg=msg[len(self.bot.getConfig('psycmod.psyccommand', '!psyc')):]
+			self.bot.sendmsg(channel, self.bot.getConfig('psycmod.psyccmdchar', '+')+msg[1:])




Mehr Informationen über die Mailingliste Otfbot-dev