[Otfbot-svn] r484 - contrib

allo at BerliOS allo
Sa Nov 1 20:31:29 CET 2008


Author: allo
Date: 2008-11-01 20:31:28 +0100 (Sat, 01 Nov 2008)
New Revision: 484

Modified:
   contrib/nobodyisperfectMod.py
Log:
changed config calls


Modified: contrib/nobodyisperfectMod.py
===================================================================
--- contrib/nobodyisperfectMod.py	2008-11-01 19:23:30 UTC (rev 483)
+++ contrib/nobodyisperfectMod.py	2008-11-01 19:31:28 UTC (rev 484)
@@ -49,7 +49,7 @@
 nipbuffer="NIPbuffer.data"
 scoredata="NIPScore.data"
 
-class chatMod(chatMod.chatMod):
+class Plugin(chatMod.chatMod):
 	
 	def __init__(self, bot):
 		self.bot=bot
@@ -230,30 +230,30 @@
 		#################
 		
 	def default_nip(self):
-		self.NIPencoding=self.bot.getConfig("encoding","UTF-8")
-		self.cchar=self.bot.getConfig("commandChar", "", "main")
+		self.NIPencoding=self.bot.config.get("encoding","UTF-8")
+		self.cchar=self.bot.config.get("commandChar", "", "main")
 		if self.cchar == "":
 			self.cchar="!"
-		#self.nipdatadir=self.bot.getConfig("datadir", "data/nobodyisperfectMod/", "NIP")
-		#self.hofdatafile=self.bot.getConfig("HoFdata", "niphof.txt", "NIP")
-		#self.channels=self.bot.getConfig("channels", "#otf-quiz  #nobody-is-perfect", "NIP").split() #all channels where NIPmod will throw messages from and allow to start a game
-		self.minplayers=int(self.bot.getConfig("minPlayer", "5", "NIP"))
-		self.maxplayers=int(self.bot.getConfig("maxPlayer", "12", "NIP"))
-		#self.fp_time=int(self.bot.getConfig("FPTime", "5", "NIP")) #default time for floodprotection
+		#self.nipdatadir=self.bot.config.get("datadir", "data/nobodyisperfectMod/", "NIP")
+		#self.hofdatafile=self.bot.config.get("HoFdata", "niphof.txt", "NIP")
+		#self.channels=self.bot.config.get("channels", "#otf-quiz  #nobody-is-perfect", "NIP").split() #all channels where NIPmod will throw messages from and allow to start a game
+		self.minplayers=int(self.bot.config.get("minPlayer", "5", "NIP"))
+		self.maxplayers=int(self.bot.config.get("maxPlayer", "12", "NIP"))
+		#self.fp_time=int(self.bot.config.get("FPTime", "5", "NIP")) #default time for floodprotection
 		
-		#self.kcs_config=str(self.bot.getConfig("FPSpecialCommands", "favorits 0,place 0,savegame 52,halloffame 12,place 0,vote 0,scores 12,abortgame 0,add 0,remove 0", "NIP")) #overwrite default fp_time, note: no whitespace after ",".
+		#self.kcs_config=str(self.bot.config.get("FPSpecialCommands", "favorits 0,place 0,savegame 52,halloffame 12,place 0,vote 0,scores 12,abortgame 0,add 0,remove 0", "NIP")) #overwrite default fp_time, note: no whitespace after ",".
 		
-		self.maxnicklen=int(self.bot.getConfig("maxNickLength", "14", "NIP"))
-		self.scoreLimit=int(self.bot.getConfig("ScoreLimit", "0", "NIP"))
-		self.userWarnMax=(int(self.bot.getConfig("AutoremovePlayerAfterRounds", "2", "NIP")))
-		self.init_timeouts(int(self.bot.getConfig("TimeOutBase", "60", "NIP"))) #see function
-		self.TGAMEADMIN=str(self.bot.getConfig("NameGameAdmin", "#BOLD#NIP-Admin#BOLD#", "NIP"))
-		self.TGAMEMASTER=str(self.bot.getConfig("NameGameMaster", "#BOLD#QUIZ-Meister#BOLD#", "NIP"))
-		self.TNIPQUESTION=str(self.bot.getConfig("NameNipQuestion", "#BOLD##DBLUE#NIP-Frage#NORM#" ,"NIP"))
-		self.TNIPWARNINGS=str(self.bot.getConfig("NameNipWarnings", "Verteilung der#BOLD# #DRED#Schnarchnasenorden#NORM#:" ,"NIP"))
-		#self.NIPRULES=str(self.bot.getConfig("RULES","http://otf-chat.xenim.de/wiki/games:nobody-is-perfect" ,"NIP"))
-		self.NIPRULES=str(self.bot.getConfig("RULES","Ask my admin to set the link to rules in my config" ,"NIP"))
-		self.Nobody=self.bot.getBoolConfig("Nobody", "true", "NIP") #Player NobodyX for probably missing answers
+		self.maxnicklen=int(self.bot.config.get("maxNickLength", "14", "NIP"))
+		self.scoreLimit=int(self.bot.config.get("ScoreLimit", "0", "NIP"))
+		self.userWarnMax=(int(self.bot.config.get("AutoremovePlayerAfterRounds", "2", "NIP")))
+		self.init_timeouts(int(self.bot.config.get("TimeOutBase", "60", "NIP"))) #see function
+		self.TGAMEADMIN=str(self.bot.config.get("NameGameAdmin", "#BOLD#NIP-Admin#BOLD#", "NIP"))
+		self.TGAMEMASTER=str(self.bot.config.get("NameGameMaster", "#BOLD#QUIZ-Meister#BOLD#", "NIP"))
+		self.TNIPQUESTION=str(self.bot.config.get("NameNipQuestion", "#BOLD##DBLUE#NIP-Frage#NORM#" ,"NIP"))
+		self.TNIPWARNINGS=str(self.bot.config.get("NameNipWarnings", "Verteilung der#BOLD# #DRED#Schnarchnasenorden#NORM#:" ,"NIP"))
+		#self.NIPRULES=str(self.bot.config.get("RULES","http://otf-chat.xenim.de/wiki/games:nobody-is-perfect" ,"NIP"))
+		self.NIPRULES=str(self.bot.config.get("RULES","Ask my admin to set the link to rules in my config" ,"NIP"))
+		self.Nobody=self.bot.config.getBool("Nobody", "true", "NIP") #Player NobodyX for probably missing answers
 		self.mirc_stuff_init()
 
 
@@ -262,7 +262,7 @@
 		if type(timeOutBase)==int:
 			if timeOutBase>19 and timeOutBase<1000:
 				self.TimeBase=timeOutBase
-				self.bot.setConfig("TimeOutBase", str(self.TimeBase), "NIP")
+				self.bot.config.set("TimeOutBase", str(self.TimeBase), "NIP")
 			else:
 				self.bot.logger.error("TimeOutBase Config must not be smaller 20 or greater 420")
 				self.TimeBase=60
@@ -1047,7 +1047,7 @@
 				else:
 					self.Nobody=False
 					self.nipmsg("PRE_X#BOLD#Nobody#BOLD# spielt nicht mehr mit.")
-				self.bot.setConfig("Nobody", str(self.Nobody), "NIP")
+				self.bot.config.set("Nobody", str(self.Nobody), "NIP")
 			else:
 				if self.Nobody:
 					self.nipmsg("PRE_X#BOLD#Nobody#BOLD# spielt mit.")
@@ -1245,7 +1245,7 @@
 					self.nTimerset('TIMEOUT', "end_of_quiz")
 					if not self.check_nip_buffer(self.gamemaster):
 						self.nipmsg("PRE_Q"+self.gamemaster+": Schick' mir die "+self.TNIPQUESTION+". ~"+str(self.gl_ts)+" Sek. Zeit! #DGREY# (/msg "+self.bot.nickname+" die Frage)")
-						self.bot.sendmsg(self.gamemaster, "Du kannst im "+self.gamechannel+" !resetgame machen, falls du dich vertippt hast. Und nun die NIP-Frage:",self.bot.getConfig("enncoding","UTF-8"))
+						self.bot.sendmsg(self.gamemaster, "Du kannst im "+self.gamechannel+" !resetgame machen, falls du dich vertippt hast. Und nun die NIP-Frage:",self.bot.config.get("enncoding","UTF-8"))
 
 				else:
 					self.nipmsg("PRE_X"+self.gameadmin+": Zuwenig Mitspieler! Mindestens "+str(self.minplayers)+" muessen mitspielen. #BOLD#\"ich\" rufen!")
@@ -1821,4 +1821,4 @@
 			self.NIPbuffer.replace_user(oldname,newname)
 			if c:
 				self.nipmsg("PRE_P"+ oldname+" ist mir nun bekannt als "+newname)
-				self.bot.notice(newname,"Bitte beachte, dass \""+newname+"\" am Ende des Spiels in die \"Hall of Fame\" geschrieben wird!")
\ No newline at end of file
+				self.bot.notice(newname,"Bitte beachte, dass \""+newname+"\" am Ende des Spiels in die \"Hall of Fame\" geschrieben wird!")




Mehr Informationen über die Mailingliste Otfbot-dev