Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/adrian17/inzbot
https://github.com/adrian17/inzbot
Last synced: about 1 month ago
JSON representation
- Host: GitHub
- URL: https://github.com/adrian17/inzbot
- Owner: adrian17
- Created: 2015-01-21T22:13:57.000Z (almost 10 years ago)
- Default Branch: master
- Last Pushed: 2018-03-09T22:34:07.000Z (over 6 years ago)
- Last Synced: 2023-08-06T13:05:41.016Z (over 1 year ago)
- Language: Python
- Size: 37.1 KB
- Stars: 1
- Watchers: 6
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
### Running
Copy `example_config.yaml` to `config.yaml` and customize it to your needs.
Then:
./inzbot.py
### Dependencies
See requirements.txt.
Core:
- [irc](https://github.com/jaraco/irc) (My bot is basically a high-level wrapper over their low-level wrapper)
- [yaml](https://pypi.python.org/pypi/PyYAML) (for config files)Remaining dependencies are used by the bot's plugins.
### Writing a basic plugin
```python
from plugin_base import Plugin, commandclass MyPlugin(Plugin):
"""docstring used by !help MyPlugin"""# reacts to !echo abc or bot_name: echo abc
@command # optional arguments give alternative command names
def echo(self, bot, event):
"""docstring shown by !help echo"""
# event is the irc.Event object with
# extra `text` attribute on command events
# and `message` attribute on pubmsg events
# you can also access the irc.ServerConnection object
# with bot.connection
# it provides wrappers for all actions like kick, mode, privmsg etc.# bot.message is a special utility that responds to wherever the original message was sent from
bot.message(event.text)
# triggers on every message
@on_pubmsg
def echo_when_duck(self, bot, event):
if "duck" in event.message:
bot.message('did someone say "duck"?', target=bot.channel) # forcing a message target
```