Giter Site home page Giter Site logo

spanser / discord-coc-war-announcer Goto Github PK

View Code? Open in Web Editor NEW
29.0 16.0 24.0 3.19 MB

A node.js discord bot written to monitor the Clash of Clans API and announce war attacks to a discord channel. spAnser#2031

License: MIT License

JavaScript 100.00%
discord-bot clashofclans

discord-coc-war-announcer's Introduction

Discord Clash of Clans War Details

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.

Support

No longer maintained feel free to fork and edit the code. It is provided as is.

Installation

  1. Authorize Announcer on your server.
  2. 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.
  3. To stop messages in a channel use the command !unannounce #CLANTAG requires the same permission as the !announce command.

Commands

  1. !announce #CLANTAG Assign a clan to announce in a channel.
  2. !unannounce #CLANTAG Stop a clan from announcing in a channel.
  3. !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.
  4. !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.
  5. !playerstats #PLAYERTAG Display player stats for any player tag provided.
  6. !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.
  7. !styletest Show a preview of all styles.
  8. !showmissing [yes,no] Show missing attacks with final hours and final minutes messages. Default value is no.
  9. !info Display bot information.
  10. !help Display list of commands.

Screenshot

Self Hosted Installation

  1. Clone this repository.
  2. Make sure you have Node.JS 6.10.x or newer installed.
  3. Run npm i to install the node modules.
  4. Duplicate and rename config.example.js to config.js.
  5. You will need a api key from Clash of Clans API which should be placed inside config.js under coc->apiKey.
  6. You will need an app from Discord My Apps. You will need the apps Client ID and Bot Token these belong inside config.js under discord->clientId and discord->userToken.
  7. 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.
  8. 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
  9. The clan being monitored will need their war log set to public.
  10. Run node index.js to start the bot.
  11. If you need the bot to be kept alive look into PM2

FAQ

  1. 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

  2. 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.

  3. Q: How many clans can the Announcer monitor?
    A: The bot should be able handle as many clans as you configure it for.

  4. Q: What does ๐Ÿƒ mean?
    A: A leaf icons stands for a fresh attack. An attack on a base not yet attacked in this war.

  5. 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 ๐Ÿ”ป.

  6. 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.

  7. Q: Can I customize the emojis the bot uses?
    A: Yes you can by uploading you own emojis and using the names below

    Name Meaning
    dwasword Attack Success
    dwaswordbroken Attack Failed
    dwashield Defend Success
    dwashieldbroken Defend Failed
    dwastar Star
    dwastarnew New Star
    dwastarempty Empty Star
  8. Q: Can I use this bot to call bases?
    A: No not at this time.

  9. Q: Will this bot keep detailed statistics of our wars?
    A: No not at this time.

discord-coc-war-announcer's People

Contributors

danilose avatar dragonpox avatar jime86 avatar johanben avatar spanser avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

discord-coc-war-announcer's Issues

not working, did i do something wrong?

I followed the installation instructions, made a channel just for the announcer bot, gave the command to announce followed by our clan tag and it said war announcements for our clan are registered but that's it. war started and it just sits there.

bot

is this bot still active

Add support for Th13

Currently there is no support for Townhall 13 and it's new troop, hero, and building.

Playerstats command showing max level for TH and completely

I'm not sure if the star next to the level of the troop, spell and heroes should show that it is the maximum level but some suggestions about it:

  • Use golden number if it is completely maxed

  • Use a star next to the level if it is maxed for the townhall level of the user

Here an example:
bildschirmfoto 2017-05-08 um 20 08 57

You can see that the star is missing for the last troop, spell or hero in a row.

Another suggestion: clan logos and clan tag

Another enhancement suggestions about the very nice bot:

  1. You are using some icons as emojis to get the small size. If this would also be possible to do with normal clan logo pictures, it would be a nice UI thing to add the clan logos next to the clan names.

  2. The clan tags are shown for every command except the announcement command for preparation and war battle day.

Bot automatically offline

Authorized the bot on our server (I am the administrator, so I have priviliges for it), gave it all the rights it needed (actually, every right), but it goes offline instantly, and i can't summon it. Tried kicking even, and re-authorizing, but I didn't solve it. Are the other bots the problem, or did I fuck it up somehow?
image
image

War Stars

Can you add it so that in one of the styles, it also adds the war stars for each clan? Thanks

Enhancement suggestions

Using your discord war announcer. Working good with discord web version. Following are my enhancement suggestions.

  • adding stars scored along with each attack message
  • at the end of the war, send a total war status message
  • currently I am getting notification of each message in Chrome as myclan vs opponentclan. It's too simple. Anyway to enable rich notifications!

Looking forward to more improvements and enhancements on this

Minor issue when clan tag is invalid.

I made the mistake of typing in my clan tag in all lower case which resulted in the bot not working. But on the call back to getCurrentWar if data is null, it returns no errors, so it left me scratching my head for a bit.

It might be worth testing initially if the clan tag is valid.

Issue with bot upon installation

screen shot 2017-05-10 at 1 17 48 am

Added the clan but has not allowed us to do much else with it. Any ideas? I'm sure I'm missing something obvious. I have done this both with and without a Public War Log (saw your post in another thread and thought I'd try that)

Add missing attacks for reminder message

Would be very nice to see which attacks are missing. So the name of the users which must make one or even both attacks. Event better would be a separation between one and two attacks.

This info should be added along the two reminder message.

Error with running the bot

I got this error when trying to run the bot using node index.js TypeError: Cannot read property 'sendEmbed' of undefined

Any idea about this? Thank you for your help!

War starts not being detected without restarting the bot

So it's happened twice now. We ended a war, then 40 minutes later a new war is searched and the bot says nothing. I currently have it running as a service using node-windows, and I keep it alive by having a scheduled task restart it daily. It seems to run fine but it doesn't detect a new wars starting without restarting it.

On a side note, it be nice if the bot also announced the conclusion of a war with results.

Add new help command with all available commands

I would suggest to add a new help command which shows all commands of the bot and what they do.

I'm not sure if !help would be the best suggestion because many bots use a ! as prefix. You could use the current !info command and show all available commands below the info with explanation.

Issues and suggestions for hitrate command

First the suggestions for the hitrate command:

  1. A header showing the clan names would be very helpful. At the moment you don't know instantly which is opponent and which is home clan.
  2. What about TH 11 vs TH 11 3 stars?

Bug reports

  • 10 vs 11 seems to be wrong. It shows 1/2 attacks for opponent although there was no attack from a TH 10 vs 11. But maybe I'm wrong and the second table is referring to the defenses and not opponent attacks?

bildschirmfoto 2017-05-08 um 20 37 51

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.