Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- from jabberbot import JabberBot, botcmd
- import datetime
- class SystemInfoJabberBot(JabberBot):
- @botcmd
- def spiegel( self, mess, args):
- """Gibt einen Downloadlink zur aktuellen Ausgabe des SPIEGELs aus"""
- lines = []
- if args.endswith("2009"):
- print "2009"
- else:
- print "2010"
- file = open("spiegel_2010.txt", 'r')
- while 1:
- line = file.readline()
- if line == '':
- break
- lines.append(line)
- file.close()
- a, b = {
- 1: (0, 1),
- 2: (0, 2),
- 5: (0, 1),
- 6: (0, 2)
- }.get(len(args), (0, 0))
- try:
- nr = int(args[a:b])
- except ValueError:
- nr = 0
- indexError = "Fehler: Ungueltige Eingabe oder Magazin nicht im Bestand."
- try:
- return lines[0-nr]
- except IndexError:
- return indexError
- @botcmd
- def frundschau( self, mess, args):
- """Gibt einen Downloadlink zur aktuellen Ausgabe der Frankfurter Rundschau aus"""
- today = datetime.date.today()
- return today
- username = 'botta-heinz2@im.calug.de'
- password = ''
- bot = SystemInfoJabberBot(username,password)
- bot.serve_forever()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement