A Telegram bot designed to be included in Telegram groups. The bot expose these features:
/setname
@DanielZottiBot/setdescription
A Telegram bot that manages events, jokes, member and more/setuserpic
: /assets/profile.jpg
/start
it shows a message when the bot is started/help
it shows info about the bot/jokes
it shows how many jokes are in the DB/random_joke
it sends a random jokeSome examples to trigger a joke:
What would Daniel say?
(keyword: "Daniel")I need a joke!
(keyword: "joke")In order to add (or edit) a joke, you have to edit the /assets/jokes.json
file.
The JSON file is an array of objects having this structure:
date
(optional): data with following format yyyy-mm-dd
.event
(optional): info about the place or the occasion the joke has been stated.sentences (required)
: a list of sentences, structured this way:
name
(optional) name of the persontext
(required): the actual sentence{ "date": "2021-10-05", "event": "In pub with friends", "sentences": [ { "name": "Daniel", "text": "Why do programmers keep pressing the F5 button??" }, { "name": "Friends", "text": "No, not again....." }, { "name": "Daniel", "text": "Because it’s <i>refreshing</i>." } ] }
@danielzotti has just added a member to the group! Let's welcome @mario aka Mario Rossi
Oh no! @mario aka Mario Rossi has left the group!
nvm use
to set the right node versionnpm install
npm run start
to run it locallynpm run dev
to run it locally with nodemonOn Daniel's server through GitHub Actions
In order to make the "send joke triggered by keyword" work, the Daniel Zotti bot needs to have access to the message of a group. The group privacy has to be turned off: https://stackoverflow.com/questions/50204633/allow-bot-to-access-telegram-group-messages
Add runner on private linux server:
sudo groupadd docker
sudo useradd github-runner
sudo usermod -aG docker github-runner
cd /home/github-runner
More info: https://docs.github.com/en/actions/hosting-your-own-runners/about-self-hosted-runners
Running as a service: https://docs.github.com/en/actions/hosting-your-own-runners/managing-self-hosted-runners/configuring-the-self-hosted-runner-application-as-a-service
Create a file in .github/workflows/main.yml