예제 #1
0
def bot():
    import ircbotframe
    ret = ircbotframe.ircBot(core.config('irc')['server'], core.config('irc').get('port', 6667), core.config('irc')['nick'], core.config('irc')['nick'], password=core.config('irc').get('password'), ssl=core.config('irc').get('ssl', False))
    ret.log_own_messages = False
    ret.bind('376', endMOTD)
    ret.bind('433', error_nick_in_use)
    ret.bind('482', error_not_chan_op)
    ret.bind('ACTION', action)
    ret.bind('JOIN', join)
    ret.bind('PART', part)
    ret.bind('PRIVMSG', privmsg)
    return ret
예제 #2
0
 def __init__(self,
              host,
              port=6667,
              name='MediaWiki',
              description='MediaWiki recent changes bot',
              channels=[],
              server_pass=None):
     self.channels = channels
     self.bot = ircbotframe.ircBot(host,
                                   port,
                                   name,
                                   description,
                                   password=server_pass)
     self.bot.bind('376', self.endMOTD)
     self.bot.start()
예제 #3
0
	def Run(self):
		global BINDINGS
	
		self.Bot = ircBot(NETWORK, PORT, NICKNAME, DESCRIPTION)
		for Binding in BINDINGS:
			self.Bot.bind(Binding[0], Binding[1])
    
		self.Bot.connect()
		# Joining and IDing with NickServ handled in LagHandler
		self.Bot.run()

		self.WriteStateFile()

		if self.RestartSelf:
			print "Restarting self..."
			subprocess.Popen(COMMAND_FOR_SELF, shell = True)
예제 #4
0
    #parser.add_argument('-s','--server', help='IRC server to connect to')
    #parser.add_argument('-p','--port', help='IRC server port')
    #parser.add_argument('-c','--channel', help='The channel to join')
    #parser.add_argument('-n','--nick', help='Bot nickname')
    #args = parser.parse_args()

    server = 'irc.speedrunslive.com'
    #try:
     #   port = int(args.port)
    #except:
    #    print "Port must be an integer"
    #    sys.exit(0)
    port = 6667
    botNick = 'refbot'
    chanName = "#kpop"
    bot = ircBot(server, port, botNick, "streams")
    bot.bind("PRIVMSG", privmsg)
    bot.bind("ACTION", actionmsg)
    bot.bind("376", endMOTD)
    bot.debugging(True)

    # Load plugins
    plugins = pluginLoader.pluginLoader()

    # Load config
    config = configmanager()
    configuredStreams = config.readConfig()

    bot.start()
    checkOnlineStreams(plugins, configuredStreams)
예제 #5
0
    bot.say(chanName, "Quit (disconnects from the IRC server); Usage: \"!quit [<quit message>]\"")
    bot.say(chanName, "Say (makes the bot say something); Usage: \"!say <channel/user> <message>\"")
    bot.say(chanName, "The underlying framework is in no way limited to the above functions.")
    bot.say(chanName, "This is merely an example of the framework's usage")

def useSSL(argv):
    return len (argv) == 6 and argv[5] == "ssl"

# Main program begins here
if __name__ == "__main__":
    if len(sys.argv) == 5 or useSSL(sys.argv):
        server = sys.argv[1]
        port = int(sys.argv[2])
        owner = sys.argv[3]
        chanName = "#" + sys.argv[4]
        bot = ircBot(server, port, "ExampleBot", "An example bot written with the new IRC bot framework", ssl=useSSL(sys.argv))
        bot.bind("PRIVMSG", privmsg)
        bot.bind("ACTION", actionmsg)
        bot.bind("376", endMOTD)
        bot.debugging(True)
        bot.start()
        inputStr = "" 
        while inputStr != "stop":
            inputStr = raw_input()
        bot.stop()
        bot.join()
    else:
        print "Usage: python examplebot.py <server> <port> <your IRC nick> <irc channel (no '#' character please)> <ssl (optional)>"


예제 #6
0
    bot.say(chanName, "I have 4 functions, they are Join, Kick, Quit and Say.")
    bot.say(chanName, "Join (joins a channel); Usage: \"!join #<channel>\"")
    bot.say(chanName, "Kick (kicks a user); Usage: \"!kick <nick> #<channel> <reason>\"")
    bot.say(chanName, "Quit (disconnects from the IRC server); Usage: \"!quit [<quit message>]\"")
    bot.say(chanName, "Say (makes the bot say something); Usage: \"!say <channel/user> <message>\"")
    bot.say(chanName, "The underlying framework is in no way limited to the above functions.")
    bot.say(chanName, "This is merely an example of the framework's usage")

# Main program begins here
if __name__ == "__main__":
    if len(sys.argv) == 5:
        server = sys.argv[1]
        port = int(sys.argv[2])
        owner = sys.argv[3]
        chanName = "#" + sys.argv[4]
        bot = ircBot(server, port, "ExampleBot", "An example bot written with the new IRC bot framework")
        bot.bind("PRIVMSG", privmsg)
        bot.bind("ACTION", actionmsg)
        bot.bind("376", endMOTD)
        bot.debugging(True)
        bot.start()
        inputStr = "" 
        while inputStr != "stop":
            inputStr = input()
        bot.stop()
        bot.join()
    else:
        print("Usage: python examplebot.py <server> <port> <your IRC nick> <irc channel (no '#' character please)>")


예제 #7
0
        fs = map(lambda f: path + '/' + f, os.listdir(path))
        fs = filter(os.path.isfile, fs)
        fs = map(lambda f: '#' + os.path.basename(f), fs)
        return fs
    return []


# Main program begins here
if __name__ == "__main__":
    server = 'irc.freenode.net'
    port = 6667
    owner = 'fajoy'
    chanDir = os.getenv('PWD') + '/chanel'
    userDir = os.getenv('PWD') + '/user'
    chanNames = getChanNames(chanDir)
    bot = ircBot(server, port, "fajoy_bot", "I am bot of fajoy")
    bot.bind("PRIVMSG", privmsg)
    bot.bind("ACTION", actionmsg)
    bot.bind("376", endMOTD)
    bot.debugging(True)
    bot.start()
    df = DetectFileBot({
        chanDir: chanelsay,
        userDir: usersay,
    })
    inputStr = ""
    while inputStr != "stop":
        inputStr = raw_input()
    bot.outBuf.sendBuffered("QUIT")
    df.stop()
    bot.stop()
예제 #8
0
파일: mybot.py 프로젝트: fajoy/py
        fs=filter(os.path.isfile,fs)
        fs=map(lambda f:'#'+os.path.basename(f),fs)
        return fs
    return []



# Main program begins here
if __name__ == "__main__":
        server = 'irc.freenode.net'
        port = 6667
        owner = 'fajoy'
	chanDir= os.getenv('PWD')+'/chanel'
	userDir= os.getenv('PWD')+'/user'
        chanNames = getChanNames(chanDir)
	bot = ircBot(server, port, "fajoy_bot", "I am bot of fajoy")
        bot.bind("PRIVMSG", privmsg)
        bot.bind("ACTION", actionmsg)
        bot.bind("376", endMOTD)
        bot.debugging(True)
        bot.start()
	df=DetectFileBot({
	 chanDir:chanelsay,
  	 userDir:usersay,
	})
        inputStr = "" 
        while inputStr != "stop":
            inputStr = raw_input()
        bot.outBuf.sendBuffered("QUIT")  
	df.stop()
        bot.stop()