Skip to main content

24/7 channel daaemon.

Project description

Welcome to MADBOT, the 24/7 channel daemon ! see https://pypi.org/project/madbot/

MADBOT can serve as a 24/7 background daaemon in an IRC channel, it can work as a UDP to IRC relay, has user management to limit access to prefered users and can run as a service to let it restart after reboots. MADBOT is has no copyright, no license and is placed in the Public Domain. This makes MADBOT truely free (pastable) code you can use how you see fit,

INSTALL

you can download with pip3 and install globally:

$ sudo pip3 install madbot

You can download the tarball from https://pypi.org/project/madbot/#files

if you want to develop on MADBOT the source at bitbucket.org:

$ git clone https://bitbucket.org/bthate/madbot

USAGE

MADBOT has it’s own CLI, you can run it by giving the madbot command on the prompt, it will return with no response:

$ madbot
$

you can use madbot <cmd> to run a command directly:

$ madbot cmds
cfg|cmd|dne|edt|fnd|flt|krn|log|add|tsk|tdo|udp|upt|ver

configuration is done with the cfg command:

$ madbot cfg
channel=#botlib nick=madbot port=6667 realname=madbot server=localhost username=madbot

you can use setters to edit fields in a configuration:

$ madbot cfg server=irc.freenode.net channel=\#dunkbots nick=madbot
channel=#dunkbots nick=botje port=6667 realname=botlib server=irc.freenode.net
username=botlib

to start a irc server with the cmd and opr modules loaded and a console running:

$ madbot mods=irc,csl,cmd,opr
> ps
0 0s       Console.input
1 0s       IRC.handler
2 0s       IRC.input
3 0s       IRC.output
4 0s       Kernel.handler
>

to run a pure UDP to IRC relay, run the bot with irc,udp modules loaded

$ madbot mods=irc,udp
>

use the udp command to send text via the bot to the channel on the irc server:

$ tail -f /var/log/syslog | madbot udp

to send a udp packet to the bot:

import socket

def toudp(host=localhost, port=5500, txt=""):
    sock = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
    sock.sendto(bytes(txt.strip(), "utf-8"), host, port)

MODULES

you can use the mods= setter to set the modules to load:

$ madbot mods=csl,cmd,opr
> cmd
cfg|cmd|flt|fnd|krn|tsk|upt|ver

MADBOT has the following modules:

cmd                 - commands
irc                 - internet relay chat
opr                 - opers
mbx                 - email
rss                 - rich site syndicate
udp                 - udp to channel
usr                 - users

SERVICE

if you want to run the bot 24/7 you can install MADBOT as a service for the systemd daemon. You can do this by copying the following into the /etc/systemd/system/madbot.service file:

[Unit]
Description=MADBOT - 24/7 channel daemon
After=network-online.target
Wants=network-online.target

[Service]
User=madbot
Group=madbot
ExecStart=/usr/local/bin/madbot mods=irc,rss,fnd,cmd -w

[Install]
WantedBy=multi-user.target

create homedir for the bot:

$ mkdir /home/madbot
$ mkdir /home/madbot/.madbot
$ mkdir /home/madbot/.madbot/mods

add the madbot user to the system:

$ groupadd madbot
$ chown -R madbot:madbot /home/madbot
$ useradd madbot -d /home/madbot
$ passwd madbot

configure the bot to connect to irc:

$ sudo -u madbot madbot cfg server=192.168.2.2 channel=#madbot nick=madbot

copy modules over to the bot’s work directory:

$ cp -Ra mods/*.py /home/madbot/.madbot/mods

make sure permissions are set properly:

$ chown -R madbot:madbot /home/madbot
$ chown -R madbot:madbot /home/madbot/.madbot
$ chmod -R 700 /home/madbot/.madbot/mods/
$ chmod -R 400 /home/madbot/.madbot/mods/*.py

add the madbot service with:

$ sudo systemctl enable madbot
$ sudo systemctl daemon-reload

then restart the madbot service.

$ sudo service madbot stop
$ sudo service madbot start

if you don’t want madbot to startup at boot, remove the service file:

$ sudo rm /etc/systemd/system/madbot.service

CONTACT

contact me on IRC/freenode/#dunkbots or email me at bthate@dds.nl

botfather on #dunkbots irc.freenode.net

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Files for madbot, version 12
Filename, size File type Python version Upload date Hashes
Filename, size madbot-12.tar.gz (38.9 kB) File type Source Python version None Upload date Hashes View

Supported by

Pingdom Pingdom Monitoring Google Google Object Storage and Download Analytics Sentry Sentry Error logging AWS AWS Cloud computing DataDog DataDog Monitoring Fastly Fastly CDN DigiCert DigiCert EV certificate StatusPage StatusPage Status page