Git Product home page Git Product logo

honeybot's Introduction

๐Ÿฏ honeybot py [ docs ]

PyPI version First Timers Only Open Source Love Made in Moris CII Best Practices OpenSSF Scorecard

Launching pyhoneybot Rewards

Contributed to pyhoneybot? Here is a big thank you from our community to you. Claim your badge and showcase them with pride. Let us inspire more folks !

pyhoneybot Badges


๐Ÿ‡ฒ๐Ÿ‡บ ๐Ÿ‡บ๐Ÿ‡ธ ๐Ÿ‡จ๐Ÿ‡ฆ ๐Ÿ‡ฆ๐Ÿ‡ท ๐Ÿ‡ฎ๐Ÿ‡ณ ๐Ÿ‡ฌ๐Ÿ‡ง ๐Ÿ‡ฌ๐Ÿ‡ฌ ๐Ÿ‡ง๐Ÿ‡ท ๐Ÿ‡ธ๐Ÿ‡ฝ ๐Ÿ‡ต๐Ÿ‡ฑ ๐Ÿ‡ฉ๐Ÿ‡ช ๐Ÿ‡ฒ๐Ÿ‡ผ

Open Source Helpers Discord

Table of Contents

๐Ÿ“ฎ About

HoneyBot is a python-based IRC bot. (python3.7) | If you want to just run the bot, go to the quick start section

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. --@RiceAbove

Feel free to contribute to the project!

๐Ÿ•น Project Motivation

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.

โœ‚ Current Features

  • ๐Ÿฌ OOP architecture
  • ๐Ÿ›ฐ๏ธ keyword parameters
  • ๐ŸŒต password security with config file [disabled for now]
  • ๐Ÿ”Œ now with plugins

โ›ฐ๏ธ GUI clients

GUI clients are used to manage plugins, launch bot as well as specify credentials.

โŒš Current Plugins

Plugin Description Contributor
๐Ÿ’Ž bitcoin Get price of bitcoin @Macr0Nerd
โฒ caesar cipher Encode your text @kylegalloway
๐Ÿ”ข calc Evaluates maths expressions @Abdur-rahmaanJ
๐Ÿ“ maths Trigonometry & random number generator @Abdur-rahmaanJ
๐Ÿƒ conv sniff Set triggers like how many times a word occur for one or more words and send response @Abdur-rahmaanJ
โ„ greet Demo plugin @Abdur-rahmaanJ
โ›“ installed_modules Checks dependencies installed @Abdur-rahmaanJ
๐Ÿ•ถ joke Get random joke @Abdur-rahmaanJ, @colbyjayallen
โ“ self Trivia Random trivia @ajimenezUCLA
๐Ÿ’ข username Username generator @Abdur-rahmaanJ, @sseryani
๐Ÿ“œ quotes Inspirational quotes @German-Corpaz
๐Ÿ“– dictionary Returns meaning of word @iamnishant14
๐Ÿ”ฃ password generator The name tells it all @iamnishant14
๐Ÿœ debug Prints all parameters passed to bot @Abdur-rahmaanJ
๐Ÿ“š wikipedia Returns a wikipedia article @Macr0Nerd
๐Ÿ—ฟ translate Google translate plugin @a-deeb
๐Ÿ“‘ test Runs tests @Abdur-rahmaanJ
โ›…๏ธ weather Returns weather info for a given location @Macr0Nerd
โœ‰๏ธ mail Send emails within the chat @TannerFry
๐Ÿ•ด๏ธ hangman Play hangman in the chat @JustinWalker4179
๐ŸŽ‚ age Takes in birthday and outputs age @JustinWalker4179
โœ”๏ธ fact Returns a random fact @JustinWalker4179
๐Ÿ” google Returns three search results from google @JustinWalker4179
๐Ÿ“ฎ send message Sends a message to another channel @JustinWalker4179
๐Ÿ“ log Logs the chat into a log file @RiceAbove
๐Ÿšช joins Greets everyone who joins the channel @RiceAbove
๐Ÿ“… date Posts the current date @RiceAbove
๐Ÿ•ต๏ธโ€ riddle Returns a random riddle @AngeloGiacco
๐Ÿ—ž news Gets the top 10 headlines from bbc world news @AngeloGiacco
๐Ÿ“ horoscope Gets your daily horoscope for your starsign @AngeloGiacco
๐Ÿ’ต currency converter Converts currencies @AngeloGiacco
๐Ÿ”ซ russian_roulette May or may not kick you off the channel @AngeloGiacco
๐Ÿจ monopoly Honeybot now supports the world's worst game! @AngeloGiacco
โšฝ๏ธ transfer_rumour Shows the day's transfer rumours @AngeloGiacco
๐Ÿƒ blackjack/21 Play 21 on honeybot! @AngeloGiacco
๐Ÿค’ corona Get the latest news on coronavirus with honeybot! @AngeloGiacco
๐Ÿ“– diary Keep a diary with honeybot @AngeloGiacco
๐Ÿ›ฉ flight Gets flight info from flightradar24 @AngeloGiacco
๐ŸŽฒ roll Rolls a dice @GlennToms
โ“ help Show link to plugin's information page @edumello
โœ… channeljoin Join command for bot @marceloyb
๐Ÿ“ƒ comic Returns a random comic @mboekhold
๐Ÿ“ todo Makes a to do list @h-ranjan1110
๐ŸŽฑ Magic 8 Ball Answer questions using magic 8 ball @ZakariaTalhami
๐ŸŽŸ Random Excuse Generates a random excuse for you. @rakeshseal0
๐Ÿฆ† DuckDuckGo Search Search queries in duckduckgo and return abstract. @rakeshseal0
๐Ÿ–ผ Random Image Returns a random image url. @rakeshseal0
๐Ÿ›ข URL Shortener Shortens a url @rakeshseal0
๐Ÿ˜ emoji Returns emoji meaning @deadex-ng
๐ŸŽ‚ birthday Shows birthday match probability on a people group. @paulosgf
๐Ÿ€ basketball Shows information about the medals of euroBasket and Basketball world cup @kefthymic
๐ŸŽฌ movies_imdb Returns certain information about a certain movie or shows 250 all time best movies @ZoeyKats

โšก Quickstart

setup

mkdir botx
cd botx
python -m venv venv
venv\scripts\activate # or source venv/bin/activate for linux
python -m pip install honeybot

run

honeybot init
honeybot run

in settings/CONNECT.conf

[INFO]

server_url = irc.libera.chat
port = 6667
name = appinventormuBot

In settings/PLUGINS.conf listed plugins under plugins/downloaded will load. Plugins listed under plugins/core are auto loaded.

๐Ÿ’ป Seeing The Bot In Action

Get an IRC client

configure

port: 6667
url: irc.libera.chat

then join channel #ltch

you should see the bot as hbot ... or as it's name is in settings

Docker

Building Docker image

Change SERVER, PORT and NICKNAME variables to match your preferences

docker build -t "honeybot/honeybot:6.0.2" .

Running Docker image

docker run -d --name=honeybot honeybot/honeybot:v6.0.2 honeybot run

๐Ÿ”ง Plugins Development

Each plugin has a folder named after it. In it there is a file called main.py. In each there is a class called Plugin.

# -*- coding: utf-8 -*-

class Plugin:
    def __init__(self):
        pass

    def run(self, incoming, methods, info, bot_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 four parameters being passed to the run method , incoming, methods, info, bot_info)

parameter1: incoming

incoming is the raw line and is not used except if you are not satisfied with the already provided methods

parameter2: 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>')

parameter3: info (meaning message info)

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]

use example

  • the command info is used in the join channel plugin to detect a join command and greet the user who just joined

bot info

bot_info returns info about the bot

        return {
            'name': self.name,
            'special_command': self.sp_command,
            'required_modules': self.required_modules,
            'owners': self.owners,
            'time': self.time,
            'friends': self.friends
        }

so that in run method you can access those.

use example

  • For example, the time info is used in the uptime plugin by minussing it from the current time to get time bot has been running.
  • The required modules is used in the installed plugin to determine what required plugin the bot runner did not install

wrapping up

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)

๐Ÿ“ƒ Contributing Guide

https://pyhoneybot.github.io/honeybot/How_Tos/contributing.html

  • 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

Check out Contributing to get started on contributing.

๐Ÿ”Œ Todo Plugins

  • ๐Ÿ’ humour
  • ๐ŸŒจ๏ธ weather
  • โœ‰๏ธ mail
  • ๐ŸŽ›๏ธ maths
  • ๐Ÿ“ฅ pm when user online
  • Random Colour

โ˜‘ Allowing Plugins

Plugins available https://pyhoneybot.github.io/honeybot/plugins.html

in settings/settings.toml, add the plugin to allow!

[PLUGINS]

downloaded = ["greet",] # Downloaded plugins to load

๐Ÿ“ง Contact (Including vulnerabilities)

Email

๐Ÿ–Š Credits

  • @arwinneil, "Open Source" and "Made In Moris" badges

honeybot's People

Contributors

a-deeb avatar abdur-rahmaanj avatar ajimenezucla avatar amanzholov8 avatar andrea-pasini avatar angelogiacco avatar azeemshaikh38 avatar de-blaxe avatar deadex-ng avatar eigenbrot avatar gicocarlo avatar glenntoms avatar h-ranjan1110 avatar iamnishant14 avatar ironpenguin4179 avatar kevinbanana avatar macr0nerd avatar marceloyb avatar mboekhold avatar moffetma avatar mrtanoshii avatar nickw409 avatar paulosgf avatar pre-commit-ci-lite[bot] avatar rakeshseal0 avatar tannerfry avatar tomlisankie avatar ujjaldas89 avatar zernerus avatar zoeykats avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

honeybot's Issues

Platform independent application directory

There should be a global directory where configurations and plugins are stored. This will enable the bot and the GUI to see a uniform configuration across the system.

Create makefile to run executable

Use the makefile system to create an executable from the code. Try and implement it so the GUI leads directly to the python code. Worst case scenario we have a python GUI thatโ€™s just a tkinter button.

Sent with GitHawk

Add Github CI

CI pipeline will test all PR, build and push docker images to dockerhub.

Configure Signed Commits

Suggestion

The commits aren't signed with a trusted key

Enforce only signed commits

Implement this via GitHub Actions

Code of Conduct

  • I agree to follow this project's Code of Conduct

IRC <=> Discord bridge

Since Discord is quite popular alternative for chatting it will be nice to make a plugin that allows bridging two channels.

For example:
#IRC on Discord and specific channel on IRC that have this bot.

Requirements:

  • Discord API key
  • Ability to list online people on IRC
  • Ability to list people on Discord (with marks near online nicknames)
  • Ability to mention people both sides

Dockerization

It will help with fast deployment of bot on various systems without fighting with dependencies. I will make a Dockerfile.

Maintainer needed

Volunteer here

Conditions:

If you are new to Python: Send PRs to put the project in shape and you get the keys

If you are already an experienced Python programmer (to volunteer): Send in your names here directly

If you are already an experienced Python programmer (not volunteer): Comment here, fork and send in some PRs that will put the project back in shape!

Contribute to documentation broken link at Readme

Hello,

At the contributing section regarding documentation the current link is broken, redirecting to a non existing page.

I've been looking around and I've seen that the new page might be this one. But I've notice that most of what is explained in the read the docs is currently at Readme. So I could be a good idea to add the documentation info at Readme or fix the link.

If this is considered an Issue I could make a PR ๐Ÿ˜ƒ

[Bug]: Plugin errors on startup and keepalive

What happened?

Version: GitHub master branch
Operating System: Windows

Steps:

  1. Setup venv
  2. python -m honeybot init
  3. python -m honeybot run

Expected behavior:

Bot runs without warnings and errors

Additional information:

It seems to happen during bot startup (server join) and keepalive (ping from server)

Screenshot:

WindowsTerminal_7Dvo1jaE3P

Relevant log output

Loading core
loading plugin: joins
loading plugin: log
loading plugin: uptime
2022-10-04 03:32:25 bot_core INFO - Loaded plugins
---
2022-10-04 03:32:25 bot_core INFO - Plugin.run() takes 4 positional arguments but 5 were given
2022-10-04 03:32:25 bot_core INFO - Plugin.run() takes 4 positional arguments but 5 were given
2022-10-04 03:32:31 bot_core INFO - Plugin.run() takes 4 positional arguments but 5 were given
2022-10-04 03:32:31 bot_core INFO - Plugin.run() takes 4 positional arguments but 5 were given
2022-10-04 03:32:31 bot_core INFO - Plugin.run() takes 4 positional arguments but 5 were given
quack quack! list index out of range
2022-10-04 03:32:37 bot_core INFO - Plugin.run() takes 4 positional arguments but 5 were given
2022-10-04 03:32:37 bot_core INFO - Plugin.run() takes 4 positional arguments but 5 were given

Code of Conduct

  • I agree to follow this project's Code of Conduct

Random Colour plugin description

In the README.md file I saw "Random Color" under "To-do plugins". I think I can make this plugin, but I wanted to get a more detailed description of what this plugin needs to do if possible.

short stories plugin

.story

returns

any short story. by short it means what fits in 2 or 3 irc messages

Search Pypi Plugin

sending .pypi flask

returns the first 3 links in 3 messages

https://...
https://...
https://...

create run.py file

instead of if name equals main in main.py, create a new run.py file that imports from main.py and runs the bot

Number of Stars and Fork plugin

create a plugin to get the number of forks and stars for a given repo

.repostats https://github.com/pyhoneybot/honeybot

returns

4 stars | 10 forks

New feature idea (IMDB)

Suggestion

Hello i am interested in implementing a new plugin that connects to the website https://www.imdb.com/
It will give information about a certain movie or series that the user asks for. Are you interested in me implementing it?

Code of Conduct

  • I agree to follow this project's Code of Conduct

Complete docstrings in main.py

Currently there are incomplete or example docstrings in main.py in Google style, see here.

The task would be to understand the code in main.py and document it properly, following our guide here. This will require some time since you'll need to understand the code but it is (in my opinion) a good introductory to the project.

If you have any questions or problems regarding the task or the documentation guide let me know or ask on our discord!

[Bug]: Unable to pip install on `python 3.10`

What happened?

Version: 5.0.9
Operating System: Windows

Steps:

  1. Setup venv
  2. pip install honeybot

Expected behavior:

Installation completes without error.

Additional information:

I tried the recommendation from https://stackoverflow.com/questions/54338270/syntax-error-after-installing-futures-package-in-my-virtualenv and downgraded my setuptools to 45.2.0 and it worked.

Screenshot:

WindowsTerminal_pM1mWBff3f

Relevant log output

Collecting colorama
  Using cached colorama-0.4.5-py2.py3-none-any.whl (16 kB)
Collecting futures
  Using cached futures-3.0.5.tar.gz (25 kB)
  Preparing metadata (setup.py) ... error
  error: subprocess-exited-with-error

  ร— python setup.py egg_info did not run successfully.
  โ”‚ exit code: 1
  โ•ฐโ”€> [27 lines of output]
      Traceback (most recent call last):
        File "<string>", line 2, in <module>
        File "<pip-setuptools-caller>", line 14, in <module>
        File "C:\Users\USERNAME\DIRECTORY\honeybot\venv\lib\site-packages\setuptools\__init__.py", line 247, in <module>
          monkey.patch_all()
        File "C:\Users\USERNAME\DIRECTORY\honeybot\venv\lib\site-packages\setuptools\monkey.py", line 99, in patch_all
          patch_for_msvc_specialized_compiler()
        File "C:\Users\USERNAME\DIRECTORY\honeybot\venv\lib\site-packages\setuptools\monkey.py", line 159, in patch_for_msvc_specialized_compiler
          patch_func(*msvc14('_get_vc_env'))
        File "C:\Users\USERNAME\DIRECTORY\honeybot\venv\lib\site-packages\setuptools\monkey.py", line 149, in patch_params
          mod = import_module(mod_name)
        File "C:\Python310\lib\importlib\__init__.py", line 126, in import_module
          return _bootstrap._gcd_import(name[level:], package, level)
        File "C:\Users\USERNAME\DIRECTORY\honeybot\venv\lib\site-packages\setuptools\_distutils\_msvccompiler.py", line 20, in <module>
          import unittest.mock as mock
        File "C:\Python310\lib\unittest\mock.py", line 26, in <module>
          import asyncio
        File "C:\Python310\lib\asyncio\__init__.py", line 8, in <module>
          from .base_events import *
        File "C:\Python310\lib\asyncio\base_events.py", line 18, in <module>
          import concurrent.futures
        File "C:\Users\USERNAME\AppData\Local\Temp\pip-install-8l60h8r4\futures_c2a719274b2049b68e4ac623293c0808\concurrent\futures\__init__.py", line 8, in <module>
          from concurrent.futures._base import (FIRST_COMPLETED,
        File "C:\Users\USERNAME\AppData\Local\Temp\pip-install-8l60h8r4\futures_c2a719274b2049b68e4ac623293c0808\concurrent\futures\_base.py", line 357
          raise type(self._exception), self._exception, self._traceback
                                     ^
      SyntaxError: invalid syntax
      [end of output]

  note: This error originates from a subprocess, and is likely not a problem with pip.
error: metadata-generation-failed

ร— Encountered error while generating package metadata.
โ•ฐโ”€> See above for output.

note: This is an issue with the package mentioned above, not pip.
hint: See above for details.

Code of Conduct

  • I agree to follow this project's Code of Conduct

setup sphinx

write appropriate comments in main.py and use sphinx to generate docs

Feature Idea: Adding football standings

Suggestion

Hello there! I am wondering if i could add a new plugin to the project that displays the standings of the premier league and from some other championships and tournaments.

Code of Conduct

  • I agree to follow this project's Code of Conduct

Feature Idea: Adding plugin with basketball info

Suggestion

Hello. I am wondering if i could add a plugin that will show some information about Basketball World Cup and eurobasket. Through this plugin, someone can see which country won a specific year an event and also see how many medals has a country.

Code of Conduct

  • I agree to follow this project's Code of Conduct

Get latest news from python.org

On the landing page at python.org, fetch the latest news

.pynews

returns frist 5 links of news section

https:\\...
https:\\...
https:\\...
https:\\...
https:\\...

[Bug]: Plugin error, list index out of range

What happened?

Version: Not specified
Operating System: Not specified

Steps:

  1. Installed the bot
  2. Run with default settings
  3. Crashes after a while

Expected behavior:

Additional information:

As per report on Discord. Link

Screenshot:

Relevant log output

woops plugin error:  list index out of range
woops plugin /root/botx/plugins/downloaded/caesar_cipher/main.py list index out of range
2023-02-02 09:02:58 bot_core INFO - PING Bot
woops plugin error:  list index out of range
woops plugin /root/botx/plugins/downloaded/caesar_cipher/main.py list index out of range
2023-02-02 09:03:58 bot_core INFO - :Bot!~u@kq9jmsiq4tnjw.irc QUIT :Ping timeout: 2m30s
ERROR :Ping timeout: 2m30s
2023-02-02 09:03:58 bot_core CRITICAL - <must handle reconnection - incoming is not True>

Code of Conduct

  • I agree to follow this project's Code of Conduct

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.