HoneyBot is a python-based IRC bot. (python3)
Feel free to contribute to the project!
Implementing the project in Java was weird, py's connect was sleek. Thus, the project stack was shifted over to Python. If you can think of any features, plugins, or functionality you wish to see in the project. Feel free to add it yourself, or create an issue detailing your ideas. We highly recommend you attempt to implement it yourself first and ask for help in our discord server!
Psst. since i learnt py through this bot, we decided to keep a new-comers friendly policy. Feeling lost? Just ping.
๐ฒ๐บ ๐บ๐ธ ๐จ๐ฆ ๐ฆ๐ท ๐ฎ๐ณ
get issues delivered in your inbox.
With experience in programming in Python, and implementing an SMTP email plugin for a different system, picking up HoneyBot and following the documentation provided for new-comers made it very simple to implement the same SMTP email plugin to the HoneyBot system. This was my first time contributing to an open-source project on GitHub and it was an overall great experience. The welcoming of new contributors and documentation on how to contribute and implement plugins is great for people who have never contributed to a project before, and Abdur-Rahmaan Janhangeer was extremely helpful when answering my questions and helping me along the way.
HoneyBot is my first time collaborating to an open source project and I'm loving it. Before discovering HoneyBot, I was very intimidated on the idea of working with other people and had no idea what an IRC even was. Now I realize how much fun and rewarding it is to work together on a project with dedicated and friendly individuals. The documentation is easy to follow and everyone is super helpful. I highly recommend any new programmer who want to contribute on an open source project to try out HoneyBot. Personally I enjoy working on this project more than my own schoolwork.
- ๐ฌ OOP architecture
- ๐ฐ๏ธ keyword parameters
- ๐ต password security with config file [disabled for now]
- ๐ now with plugins
- ๐ bitcoin by @Macr0Nerd - get price of bitcoin
- โฒ caesar cipher by @kylegalloway - encode your text
- ๐ข calc by @Abdur-rahmaanJ - evaluates maths expressions
- ๐ maths by @Abdur-rahmaanJ - sin cos and the like
- ๐ conv sniff by @Abdur-rahmaanJ - set triggers like how many times a word occur for one or more words and send response
- โ greet by @Abdur-rahmaanJ - demo plugin
- ๐ถ joke by @Abdur-rahmaanJ, @colbyjayallen - get random joke
- โ self Trivia by @ajimenezUCLA - random trivia
- ๐ข username by @Abdur-rahmaanJ, @sseryani - username generator
- ๐ quotes by @German-Corpaz - inspirational quotes
- ๐ dictionary by @iamnishant14 - returns meaning of word
- ๐ฃ password generator by @iamnishant14 - the name tells it all
- ๐ debug by @Abdur-rahmaanJ - prints all parameters passed to bot
- ๐ wikipedia by @Macr0Nerd - returns a wikipedia article
- ๐ฟ translate by Ahmed Deeb - google translate plugin
- ๐ test by @Abdur-rahmaanJ - runs tests
- โ ๏ธ weather by @Macr0Nerd - returns weather info for a given location
- โ๏ธ mail by @TannerFry - send emails within the chat
- ๐ด๏ธ hangman by @JustinWalker4179 - play hangman in the chat
- ๐ age by @JustinWalker4179 - takes in birthday and outputs age
- โ๏ธ fact by @JustinWalker4179 - returns a random fact
- ๐ log by @RiceAbove - logs the chat into a log file
- ๐ช joins by @RiceAbove - greets everyone who joins the channel
including it here. let's begin
a plugin has the following structure:
# -*- coding: utf-8 -*-
"""
[greet.py]
Greet Plugin
[Author]
Abdur-Rahmaan Janhangeer, pythonmembers.club
[About]
responds to .hi, demo of a basic plugin
[Commands]
>>> .hi
returns hoo
"""
class Plugin:
def __init__(self):
pass
def run(self, incoming, methods, info):
try:
if info['command'] == 'PRIVMSG' and info['args'][1] == '.hi':
methods['send'](info['address'], 'hooo')
except Exception as e:
print('woops plugin error ', e)
we see three parameters being passed to the run method , incoming, methods, info)
incoming
is the raw line and is not used except if you are not satisfied with the already provided methods
methods
is a dictionary of methods to ease your life. a quick look at main.py reveals
def methods(self):
return {
'send_raw': self.send,
'send': self.send_target,
'join': self.join
}
where send_raw
allows you to send in any string you want, thereby allowing you to implement any irc protocol from scratch
but, for most uses, send
allows you to send a message to an address methods['send']('<address>', '<message>')
. using it in conjunction with info parameter allows you to send messages where it came from, in pm to the bot or in a channel. you can however hardcode the address.
join
allows you to join a channel by methods['join']('<channel name>')
for a normal run, info produces
{
'prefix': 'appinv!c5e342c5@gateway/web/cgi-irc/kiwiirc.com/ip.200.200.22.200',
'command': 'PRIVMSG',
'address': '##bottestingmu',
'args': ['##bottestingmu', 'ef']
}
hence if you want messages, messages = info['args'][1:]
or the first word if you want to check for command will be info['args'][1]
hence
if info['command'] == 'PRIVMSG' and info['args'][1] == '.hi':
methods['send'](info['address'], 'hooo')
from above means
if message received == .hi:
send(address, message)
- don't forget to add your country flag here after accepted PR. i'll have to hunt it down on your profile if not.
- make sure to follow PEP8
about PR
different changes to different files. for example, someone making a weather plugin first he creates a new branch
git checkout -b "weather-plugin"
then he commits
git add *
git commit -m "added weather plugin"
then he push to create a PR with the branch
git push origin head
now let us say he wants to work on another issue, adding a joke in the jokes plugin, he creates another branch
git checkout -b "add-jokes"
after, same as before
git add *
git commit -m "added some jokes"
git push origin head
now he wants to fix his weather plugin, he changes branch
git checkout weather-plugin
works, then commit
git add *
git commit -m "fixed <issue>"
then a PR
git push origin head
Why all these?
So as not to reject a whole PR just because of some oddities. Reject only unneeded part.
Now, other changes are ongoing, what if you need the latest changes?
git pull origin master
helps if you cloned your own repo. What is you want to update your local copy of someone else repo? you do it like that
cd <your/local/cloned/repo/path/here>
git remote add upstream git://github.com/Abdur-rahmaanJ/honeybot.git
git fetch upstream
git pull upstream master
- specify your details in CONNECT.conf (already included)
[INFO]
server_url = chat.freenode.net
port = 6667
name = appinventormuBot
- run main.py
- ๐ humour
- ๐จ๏ธ weather
- โ๏ธ mail
- ๐๏ธ maths
- ๐ฅ pm when user online
in PLUGINS.conf, add the plugin to allow on a new line !
calc
username
- Abdur-Rahmaan Janhangeer | [email protected]
@arwinneil for opensource and madeinmoris badges