fedora-magazine-chatbot

Created 2 years ago
Maintained by glb
a chatbot to help with running fedora magazine meetings
Members 2
Gregory Lee Bartholomew committed 2 years ago

Zinebot is a chatbot designed to help Fedora Magazine editors run their weekly meetings.

Synopsis

$ sudo semanage permissive -a container_t
$ buildah unshare ./build.sh zinebot
$ sudo make selinux-policy
$ touch $HOME/.local/opt/zinebot/config
$ chmod 600 $HOME/.local/opt/zinebot/config
$ cat << 'END' > $HOME/.local/opt/zinebot/config
# Matrix
HOMESRVR = fedora.ems.host
USERNAME = @zinebot:fedora.im
PASSWORD = # zinebot usr password here
ATHTOKEN = # zinebot matrix token here
ROOMNAME = \#meeting:fedoraproject.org

# Fedora Account System (FAS)
JSONSRVR = fasjson.fedoraproject.org
FASACCNT = zinebot
FASREALM = @FEDORAPROJECT.ORG
FEDORAPW = # zinebot usr password here

# Discourse
FORUMSRV = discussion.fedoraproject.org
FORUMUSR = zinebot
FORUMKEY = # zinebot forum api key here
CALENDAR = # calendar post topic id num

# Pagure
FORGESRV = pagure.io
FORGEPTH = /api/0/fedora-magazine-newsroom
FORGEKEY = # pagure repo api key here
FORGEBRD = articles

# Kanban Columns
# - KBCOLUMN and COLCOLOR are ordered arrays
# - the first assigned value will be at index 0, the second at index 1, etc.
KBINICOL = 2 # the index of the initial/default kanban column
KBCOLUMN = stalled
COLCOLOR = red
KBCOLUMN = ideas
COLCOLOR = orange
KBCOLUMN = in-progress
COLCOLOR = yellow
KBCOLUMN = review
COLCOLOR = green
KBCOLUMN = to-edit
COLCOLOR = aqua
KBCOLUMN = scheduled
COLCOLOR = fuchsia
END
$ zinebot

The ROOMNAME line may be repeated to have the bot listen in multiple rooms.

The above commands for building the container image and creating the configuration file only need to be run once. Notice that the hash symbol (#) on the ROOMNAME line must be prefixed with a backslash (\) to prevent it from being interpreted as the start of a comment.

There are a few passwords and API keys that need to be added to the example configuration file so Zinebot can access the various systems. Obviously, these should be kept secret. You will need to obtain the passwords and API keys from another Fedora Magazine editor. Be sure to use an encrypted means of communication such as an encrypted DM on chat.fedoraproject.org or GPG-encrypted messages when exchanging the secrets.

Once the container image is built and a configuration file is defined, enter zinebot to start the container and Ctrl-C to stop the container. Zinebot will dump a log of all the chat messages that it saw while it was running when it is stopped.

Tip: After Zinebot is running on your system, you can enter Zinebot's call sign -- ⋄ -- in the Matrix room that it should be listening in to see if it is working. Zinebot should reply with "zinebot is online".

Note: It has been known for Zinebot to take a long time to respond after start-up. You may need to wait several seconds (or even tens of seconds) for Zinebot to respond to the first command you enter in Matrix. The cause of this delay is unknown.

Defining Commands

The commands that Zinebot will respond to are defined in the $HOME/.local/opt/zinebot/commands.pm file.

If you add any package dependencies to run, commands.pm, or any modules under the commands directory, be sure to list them in the build.sh script. The container will need to be rebuilt if you add package dependencies.

License

Zinebot is free software; you can redistribute it and/or modify it under the same terms as Perl itself. See the Perl 5 License for details.

Disclaimer

This package is provided "as is" and without any express or implied warranties, including, without limitation, the implied warranties of merchantibility and fitness for a particular purpose.