{"id":16779889,"url":"https://github.com/louim/anthembot","last_synced_at":"2026-04-16T17:35:22.699Z","repository":{"id":148636283,"uuid":"84594581","full_name":"louim/anthembot","owner":"louim","description":"A slack bot to sing national anthems","archived":false,"fork":false,"pushed_at":"2017-03-22T05:05:58.000Z","size":225,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-01-23T06:32:25.388Z","etag":null,"topics":["botkit","botkit-bots","slack"],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/louim.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2017-03-10T19:38:43.000Z","updated_at":"2023-01-23T16:07:45.000Z","dependencies_parsed_at":"2023-05-20T18:34:13.217Z","dependency_job_id":null,"html_url":"https://github.com/louim/anthembot","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/louim%2Fanthembot","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/louim%2Fanthembot/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/louim%2Fanthembot/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/louim%2Fanthembot/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/louim","download_url":"https://codeload.github.com/louim/anthembot/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243926071,"owners_count":20369910,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["botkit","botkit-bots","slack"],"created_at":"2024-10-13T07:32:52.004Z","updated_at":"2025-10-17T19:44:54.186Z","avatar_url":"https://github.com/louim.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# AnthemBOT\n**AnthemBOT** is a SlackBot that listen to Slack for countries flag emoji 🇨🇦 in the `:flag-ca:` format, and play the country national anthem.\n\n![Chip](images/chip.jpeg)\n\n## How it works\nThe bot was created to run on a Linux board (I'm currently running it on a [C.H.I.P.](https://getchip.com/pages/chip)), and should run on most Linux distros.\n\nThe bot is made with [Botkit](https://github.com/howdyai/botkit)\n\nThe bot listens to direct messages, mentions, other bots messages, in the channels where he is a member. It looks for country flag emoji (or the text version).\n\nWhen a flag emoji trigger the bot, it uses the two letter country code to play a midi `.mid` file using **TiMidity++**.\n\nFor example, `:flag-ca:` will play the `ca.mid` file.\n\n## How to setup the bot\n\n### Creating the bot\n\nFirst, [create a new bot in your slack](https://my.slack.com/services/new/bot). We will need the token to make **AnthemBOT** connect to slack.\n\nMore info about bots can be found here: [https://api.slack.com/bot-users](https://api.slack.com/bot-users)\n\n### Intalling required dependencies\n\nYou will need **[Node.js](https://nodejs.org/)** to run the bot. Make sure that you have it installed. In the bot folder run:\n\n```\nnpm install\n```\n\nInstall **Timidity++** and a soundfont to play the midi files:\n\n```\nsudo apt-get install timidity\nsudo apt-get install fluid-soundfont-gm fluid-soundfont-gs\n```\n\nEnable the soundfont by editing the TiMidity config: `sudo nano /etc/timidity/timidity.cfg`\n\nThe bottom of the file should look like this, with the freepats commented out and the fluid uncommented: \n\n```\n# By default, try to use the instrument patches from freepats:\n# source /etc/timidity/freepats.cfg\n\n# alternatively, you can use the fluid-soundfont:\nsource /etc/timidity/fluidr3_gm.cfg\nsource /etc/timidity/fluidr3_gs.cfg\n```\n\n### Getting the midi anthem files\n\nYou will need to download the midi files for each countries, and place them in the `media` folder. They are not included in the repository because I'm not sure of the copyright.\n\nFor example, you could get them using the following command:\n\n```\ncd media\ncurl -JLO --referer http://www.download-midi.com http://www.download-midi.com/files/download/[8892-9026]\n```\n\nIncluded in the utils folder is a simple **Ruby** script that you can use to mass rename the files to their two letters name.\n\n```\ncd utils\ngem install countries\nruby rename.rb\n```\n## Running the bot\n\n### The config\n\nThe bot has 3 required params to start correctly:\n\n```\nALLOWED_USERS='userid1 userid2'\nALLOWED_BOTS='botid1'\nTOKEN='slack_token'\n```\n\nThe parameters are pretty much self explanatory. `ALLOWED_USERS` and  `ALLOWED_BOTS` are space separated user or bot ids allowed to interact with AnthemBOT. `TOKEN` is the Slack toke you created in the first step. There is an optional `DEBUG='true'` param that can be used to enable verbose logging. Params should be fed to the bot via the environment.\n\n### Starting the bot\n\nHow you run the bot is up to you. I strongly recommend running with a process manager to handle environment injection, restarts, monitoring and logging.  There is an example [PM2](http://pm2.keymetrics.io/) config file included (`ecosystem.config.js.example`).\n\nTo use PM2 config file:\n\n```\ncp ecosystem.config.js.example ecosystem.config.js\n```\n\nEdit the file to add your config and then start the bot with:\n\n```\npm2 start ecosystem.config.js\n```\n\nIf all is well, should see the bot come online in your Slack\n\n#### This is what it looks like:\n\n* First answer is when it can't find a file matching the country\n* Second answer is playing the requested anthem\n* Third answer is when a user or bot that is not allowed try to trigger it\n\n![In Slack](images/slack_interaction.png)\n\n## Contributing\n\nPull request with improvements are very much welcome!\n\n© Louis-Michel Couture 2017\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flouim%2Fanthembot","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Flouim%2Fanthembot","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flouim%2Fanthembot/lists"}