Skip to content

Latest commit

 

History

History
76 lines (64 loc) · 3.11 KB

README.MD

File metadata and controls

76 lines (64 loc) · 3.11 KB

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"
[email protected]
# 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]
[email protected]/querybot
password=super_secret_password

[MUC]
[email protected],[email protected]
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 &.