My IRC-Bot named Thor2
| Key | Description | Type |
|---|---|---|
| ip | ip of the IRC-server | string |
| port | port of the IRC-server | integer |
| Key | Description | Type |
|---|---|---|
| realname | realname of the bot | string |
| nick | nick of the bot | string |
| Key | Description | Type |
|---|---|---|
| call | char before commands | string |
| channel | channel to join | string |
| debuglevel | 0 => nothing 1 => important messages 2 => everything | integer |
Append this line to the __init__.py:
bot.setAuthPassword('pw') # set the auth password to 'pw'
Place your plugin in the plugins-folder, it will be load automatically at startup. You can reload plugins using the reload-command!
from plugin import Plugin
class MyPlugin(Plugin):
def onLoad(self):
# called on load
# register events and add commands here
self.addCommand('mytestcommand', self.mytestcommand_func, 'a simple test command', 0)
# cmd, function, helpstring, needed level
# for a eventlist look down here
self.registerEvent('onUserMessage', self.onMessage)
def onMessage(self, eventobj):
msg = eventobj.getMessage()
sender = eventobj.getSender()
def mytestcommand_func(self, sender, args):
# sender: sender of the message
# dict with args (everything after the command)
# mytestcommand thor77
nick = args[0] # thor77
self.sendMessage('Hi %s!' % nick) # Hi thor77!
getMessage
getSender
getChannel
getUser
getUser
getOldNick
getNewNick
- unload Plugins through a command
- load Plugins through a command
- Permission System | DONE