A node.js discord bot written to monitor the Clash of Clans API and announce war attacks to a discord channel. It will also announce when prep day has started and when war day begins. There is also a reminder message 1 hour before war ends. There is a final message that announces 15 minutes, by default, before war ends.
No longer maintained feel free to fork and edit the code. It is provided as is.
- Authorize Announcer on your server.
- Have someone that has
Manage Channel
permissions for the server assign a clan with the command!announce #CLANTAG
in the channel you want messages in. - To stop messages in a channel use the command
!unannounce #CLANTAG
requires the same permission as the!announce
command.
!announce #CLANTAG
Assign a clan to announce in a channel.!unannounce #CLANTAG
Stop a clan from announcing in a channel.!warstats #CLANTAG
Display war stats for a clan that is tracked by The Announcer. If not provided with a clan tag it will display war stats for all clans assigned to the channel the command was run in.!hitrate #CLANTAG
Display hit rate stats for a clan that is tracked by The Announcer. If not provided with a clan tag it will display hit rate stats for all clans assigned to the channel the command was run in.!playerstats #PLAYERTAG
Display player stats for any player tag provided.!style [1-6](+)
Choose a style to use for war attacks in this channel. Requires a number to select style type, optionally append a + if you want war stats included in every message.!styletest
Show a preview of all styles.!showmissing [yes,no]
Show missing attacks with final hours and final minutes messages. Default value is no.!info
Display bot information.!help
Display list of commands.
- Clone this repository.
- Make sure you have Node.JS 6.10.x or newer installed.
- Run
npm i
to install the node modules. - Duplicate and rename
config.example.js
toconfig.js
. - You will need a api key from Clash of Clans API which should be placed inside
config.js
undercoc->apiKey
. - You will need an app from Discord My Apps. You will need the apps Client ID and Bot Token these belong inside
config.js
underdiscord->clientId
anddiscord->userToken
. - The bot needs you clan tag and a Channel ID to post the announcements in. The clan will need a public war log. To get the Channel ID follow this guide.
- Give the bot permissions on your server using this url
https://discordapp.com/oauth2/authorize?client_id=__CLIENT_ID__&scope=bot&permissions=396352
and replace__CLIENT_ID__
with your bot's client id - The clan being monitored will need their war log set to public.
- Run
node index.js
to start the bot. - If you need the bot to be kept alive look into PM2
-
Q: Why do the icons not show up on android?
A: There is currently a bug with the android version of the app that prevents emojis in RichEmbeds from appearing -
Q: I saw an attack in game but the bot hasn't said anything in chat about it yet.
A: Currently the Clash of Clans API only updates every 10 minutes. So it can take anywhere from immediately to 10 minutes for an attack to show up in chat. -
Q: How many clans can the Announcer monitor?
A: The bot should be able handle as many clans as you configure it for. -
Q: What does 🍃 mean?
A: A leaf icons stands for a fresh attack. An attack on a base not yet attacked in this war. -
Q: What does 🔺 and 🔻 mean?
A: When a Town Hall 9 attacks a Town Hall 10 it displays a 🔺. When a Town Hall 10 attacks a Town Hall 9 it displays a 🔻. -
Q: Can I get info about the current/upcoming war from the bot?
A: Yes just type!warstats
into chat. If you have multiple clan's attacks showing up in a single channel you can use!warstats #CLANTAG
to get stats for a specific clan. -
Q: Can I customize the emojis the bot uses?
A: Yes you can by uploading you own emojis and using the names belowName Meaning dwasword Attack Success dwaswordbroken Attack Failed dwashield Defend Success dwashieldbroken Defend Failed dwastar Star dwastarnew New Star dwastarempty Empty Star -
Q: Can I use this bot to call bases?
A: No not at this time. -
Q: Will this bot keep detailed statistics of our wars?
A: No not at this time.