예제 #1
0
파일: dumbot.py 프로젝트: raeez/pybots
from pybot import Pybot

p = Pybot("comm.secretsite.com", nick="dumbot")
p.join("#secretchannel")

while True:
    p.say("#secretchannel", "haha, can't catch me")
예제 #2
0
파일: logbot.py 프로젝트: raeez/pybots
from pybot import Pybot
from os import mkdir
from os import popen
import logging
import logging.handlers
import re

HOST = "localhost"
CHANNELS = ["#somechannel"]
BOTNICK = "logbot"

p = Pybot(HOST, nick='logbot')
p.join(CHANNELS)

LOG = True

MAIL_HOST = ''
FROM_ADDR = ''
TO_ADDR = ''
SUBJECT = ''
MAIL_ADMINS = ['*****@*****.**']

class Logger(dict):
  """docstring for Logger"""
  def __init__(self, system_name):
    super(Logger, self).__init__()

    self.system_name = str(system_name)
    try:
      mkdir('log')
    except OSError:
예제 #3
0
파일: todobot.py 프로젝트: raeez/pybots
from pybot import Pybot

HOST = "comm.secretsite.com"
CHANNELS = ["#pcilevelonecompliant", "#pcileveltwocompliant", "#general"]

p = Pybot(HOST, nick="todobot")
p.join("#general")

#create a new pybot : Pybot(hostname, port=394024, nick='somenick'
#tell pybot to join a channel: p.join("#channelname")
#fetch available messages : p.fetch() ----> [msg, msg, msg, msg]
#say something in a particular channel : p.say("#channelgoeshere", "thing to say goes here")

FILENAME = 'todobot.data'

class TodoList:
  def __init__(self):
    self.file = open(FILENAME, 'r')
    items = self.file.readlines()
    if len(items) > 0:
      self.items = [f.rstrip() for f in items]
    else:
      self.items = []
    self.file.close()

  def save(self):
    self.file = open(FILENAME, 'w')
    for i in self.items:
      print >>self.file, i
    self.file.close()