Skip to content

ravermeister/xmpp-chatbot

 
 

Repository files navigation

Python XMPP Chatbot

beforehand

Do not operate this bot on foreign servers. Many servers prohibit the usage of bots on their service.

functions

  • !version query xmpp server software and version XEP-0092
  • !uptime query xmpp server uptime XEP-0012
  • !contact query xmpp server contact addresses XEP-0157
  • !info display a summary of all the above
  • !user display information about registered and online users XEP-0133
  • !xep display information about XEP from the XSF extensions website
  • !help display help output
  • !man query for a link to a man page
  • !paste paste long text to termbin.com e.g. config files for sharing
  • !pb paste to custom pastebin instance via pastebin-cli
  • !chuck <de|en> tell Chuck Norris jokes
  • respond to username being mentioned

Note for display registered/online Users The Bot need's admin privileges on the Server which is queried. As XEP-0133 is used

install

System Requirements

for the Slixmpp OMEMO Plugin you need python.h. On ubuntu with python3 run apt install python3-dev

for slixmpp 1.8.3 you need pkg-config. On ubuntu run
apt install pkg-config

virtualenv

With virtualenv it is possible to run the bot inside a virtual environment without disrupting other python processes and or dependencies. This repo comes with a requirements.txt to make the installation process as easy as possible.

cd to_the_path/of_the_bot/
mkdir ./venv

# create the virtual environment
virtualenv -p $(which python3) ./venv
source ./venv/bin/activate
pip3 install -r requirements.txt

configuration

Replace the dummy bot.cfg file, filled with correct credentials/ parameters.

[General]
# whether to reply with a private message when bot is triggered in a group chat yes|no
reply_private=no
# list user who are allowed to call admin Commands e.g. "!user"
admin_command_users=user@domain.tld
# how many items should be posted in list responses before sending a file.
max_list_entries=10
# where to store omemo keys
data_dir=/home/raver/Entwicklung/xmpp-chatbot/data 
# which language the bot should speak, currently en|de|nl is supported
locale=de

[Account]
jid=nick@domain.tld/querybot
password=super_secret_password

[MUC]
rooms=room_to_connect_to@conference.domain.tld,another_room@conference.domain.tld
nick=mucnickname
systemd

Note, currently the scripts assume that the repo is stored in /usr/local/share/xmpp-chatbot

  • adjust the path to the runbot script in magicbot.service.
  • link the magicbot.service file into systemd service folder. `ln -s magicbot.service /etc/systemd/system/
  • systemdctl daemon-reload and systemctl start magicbot.service to start the bot.
  • if it is necessary to start the bot automatically when the system boots do systemctl enable magicbot.service.

starting the bot without systemd

Go to the bots directory and run ./main.py &.

About

extendable XMPP Bot to provide several Server information

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Python 99.9%
  • Shell 0.1%