~akshatj/rabbitbot/steal

« back to all changes in this revision

Viewing changes to rabbitbot.py

  • Committer: Akshat Jain
  • Date: 2011-03-27 01:49:44 UTC
  • mfrom: (90.1.8 rabbitbot)
  • Revision ID: akshat@novacut.com-20110327014944-tb7nyq0hik0g8l55
MergedĀ fromĀ upstream

Show diffs side-by-side

added added

removed removed

Lines of Context:
103
103
                                serv.notice(znick, "!logs - show #elementary's logs")
104
104
                                serv.notice(znick, "!translate <language> - translate your messages from <language> to English")
105
105
                                serv.notice(znick, "!translate off - stop translating")
 
106
                                serv.notice(znick, "!ops - emergency: alert the operators")
106
107
                                serv.notice(znick, "!google <search> | <user> - send a link to the Google search <search> to <user>")
107
108
                                serv.notice(znick, "!report <project> | <user> - send a link to report a bug in the Launchpad project <project> to <user>")
108
109
                                serv.notice(znick, "!rabbitsay <message> - make a cute little bunny speak <message>")
118
119
                                serv.privmsg(chan, "(=\"=) -<" + message.split("!rabbitsay")[1])
119
120
                                serv.privmsg(chan, "( . )")
120
121
                                serv.privmsg(chan, "(\")(\")")
 
122
                                self.logs += "() ()"
 
123
                                self.logs += "(=\"=) -<" + message.split("!rabbitsay")[1]
 
124
                                self.logs += "( . )"
 
125
                                self.logs += "(\")(\")"
121
126
                        
122
127
                        elif "!rabbit" in message:
123
128
                                serv.privmsg(chan, "() ()")
124
129
                                serv.privmsg(chan, "(=\"=)")
125
130
                                serv.privmsg(chan, "( . )")
126
131
                                serv.privmsg(chan, "(\")(\")")
 
132
                                self.logs += "() ()"
 
133
                                self.logs += "(=\"=)"
 
134
                                self.logs += "( . )"
 
135
                                self.logs += "(\")(\")"
 
136
                        
 
137
                        # Alert an operator?
 
138
                        elif "!ops" in message:
 
139
                                serv.notice(nick, "Alert launched.")
 
140
                                opnames = ["agent00tai", "kalikiana", "aroman", "lallenlowe", "Marin_M", "ammonkey", "DanRabbit"]
 
141
                                
 
142
                                for i in opnames:
 
143
                                        serv.notice(i, "Alert from " + nick + ".")
127
144
                                
128
145
                        # Kick?
129
146
                        elif "!kick " in message and irclib.nm_to_h(ev.source()) in ops and message.split("!kick ")[1].lower().strip() != "rabbitbot":
159
176
                                        serv.notice(nick, "Please enter a the name of a language, like french, german or spanish, or \"off\".")
160
177
                        
161
178
                        # AutoVoice
162
 
                        elif "!voice " in message.lower() and nick in ["agent00tai", "kalikiana", "aroman", "lallenlowe", "Marin_M"]:
 
179
                        elif "!voice " in message.lower() and irclib.nm_to_h(ev.source()) in ops:
163
180
                                open("../voice", "a").write(message.split("!voice")[1].strip().lower() + "\n")
164
181
                                serv.mode("#elementary-dev", "+v " + message.split("!voice")[1].strip())
165
182
                        
166
183
                        # UnAutoVoice
167
 
                        elif "!unvoice " in message.lower() and nick in ["agent00tai", "kalikiana", "aroman", "lallenlowe", "Marin_M"]:
 
184
                        elif "!unvoice " in message.lower() and irclib.nm_to_h(ev.source()) in ops:
168
185
                                content = open("../voice", "r").read()
169
186
                                open("../voice", "w").write(content.replace(message.split("!unvoice")[1].strip().lower() + "\n", ""))
170
187
                                serv.mode("#elementary-dev", "-v " + message.split("!unvoice")[1].strip())
177
194
                                        if grreed is False:
178
195
                                                if i in message.lower():
179
196
                                                        serv.privmsg(chan, "Grrrrrr...")
 
197
                                                        sel.logs += "Grrrrrr..."
180
198
                                                        grreed = True
181
199
 
182
200
                                # Autotranslate
264
282
        def on_quit(self, serv, ev):
265
283
                try:
266
284
                        nick = irclib.nm_to_n(ev.source())
267
 
                        newLog = "* " + nick + " got connected.\n"
 
285
                        newLog = "* " + nick + " got disconnected.\n"
268
286
                        if nick != "RabbitBot" and self.logs[len(self.logs) - len(newLog):] != newLog:
269
287
                                self.logs += newLog
270
288