/clash-discord

Discord bot for Clash of Clans discord servers written in Python

Primary LanguagePython

ClashDiscord

Discord bot for Clash of Clans discord servers written in Python

Table of Contents

Introduction

ClashDiscord is a discord bot written in Python that, while having a great many uses and commands, focuses primarily on discord member management. This entails, but is not limited to, adding an uninitiated role to incoming members, allowing members to give themselves roles based on their clash of clans profile, and focusing on discord server security.

Non-management commands include, but are also not limited to, returning player or clan information based on their tag, getting troop levels and how close they are to max for their town hall as well as total max, who can donate the best of a specific troop in a clan, war information, cwl lineup, cwl war, and cwl clan member scores.

Setup

Getting ClashDiscord set up in your discord server can be somewhat confusing, but never fear for I am here.

  1. invite ClashDiscord to your discord server

  2. claim your user in ClashDiscord

    • client user claim
      • this will claim you as a user
  3. claim your discord server

    • client guild claim
      • this will claim your discord server and add you as the guild admin within ClashDiscord
      • guild is what the discord API calls a server
  4. link a player to your user

    • client player claim player tag api key
      • claims the requested player and links it to your discord user
      • getting your api key is annoying, but for everyone’s security this is necessary
  5. link a clan to your guild

    • client clan claim clan tag
      • claims a clan and links it to the claimed guild
      • a linked player must be in the clan
        • this is also for security
  6. link existing roles to your server

    A. claim clan roles

    • client clanrole claim clan tag role mention
      • links the clan role to a claimed clan

    B. claim rank roles

    • client rankrole claim rank name role mention
      • links the rank role to a discord role
        • leader
        • co-leader
        • elder
        • member
        • uninitiated
          • this means they aren't verified or they aren't in a claimed clan
  7. Use ClashDiscord, you are set up!

Setup Summary

  • invite Clash Discord to your server
  • claim your discord user
  • claim the guild
  • claim your player
  • claim your clan
  • claim the necessary roles

Usage

ClashDiscord is largely command focused, meaning it doesn't do anything that it is not told to do. The only exception to this is when a member joins. If a server has claimed an uninitiated role, then they will be given that role, otherwise nothing will happen. The other action ClashDiscord will take is if it detects a role being deleted from discord it will delete the database instance of that role.

Once setup is complete you will be able to interact with ClashDiscord using the prefix / and run the commands as desired.

Command List

  • Help

    • help
      • displays relevant help-text regarding what commands can be run
      • react to the help message to parse through command groups
  • ClashDiscord

    • client info

      • overview for the client
    • client user

      • claims the user by discord user id within ClashDiscord
    • client player

      • client player options
        • options for client player command
        • claim - links a specified player to your user
          • values needed - player tag api key
        • show default - return all claimed players
        • update - updates the requested player as your active player
          • values needed - player tag
        • remove - removes the linked player from your user
          • values needed - player tag
    • client guild

      • claims the guild by discord guild id within ClashDiscord
      • sets the user who called the command as the guild admin within ClashDiscord
        • if the guild has already been claimed, then nothing will happen
    • client clan

      • client clan options
        • options for client clan command
        • claim - links a specified clan to your guild
          • values needed - clan tag
        • show default - return all claimed clans
        • remove - removes the linked clan from your guild
          • values needed - clan tag
    • client role

      • client role options
        • options for client role command
        • show default - return all linked roles
        • remove - removes claim on the mentioned role
          • values needed - role mention
    • client clanrole

      • client clanrole options
        • options for client clanrole command
        • claim - links a specified clanrole the specified guild's claimed clan
          • values needed - role mention clan tag
    • client rankrole

      • client rankrole options
        • options for client rankrole command
        • claim - links a specified rankrole the specified Clash of Clans rank
          • values needed - role mention rank name
          • rank names
            • leader
            • co-leader
            • elder
            • member
            • uninitiated
              • this means they aren't verified or they aren't in a claimed clan
  • Discord

    • discord role me

      • update your roles
    • discord role member membermention

      • update mentioned user's roles
      • restricted to leaders and co-leaders
    • discord role all

      • update roles for every member in the server
      • restricted to ClashDiscord server admin
    • discord emoji coc_name

      • sends specified emoji
    • discord user

      • returns the user linked to a requested player
      • discord user options
        • options for discord user command
        • player - finding the linked user to the specified player
          • player tag must be specified
        • clan default - finding the linked user for each member in the clan
          • restricted to leaders and co-leaders
          • if no clan role is specified, then the user's active player's clan will be used
  • Announce

    • announce options

      • options for announce commands
      • channel - specify a channel to send the announcement to that channel
        • if no channel is specified, then the announcement will be sent to the current channel
    • announce message channel message

      • announces message to specified channel
      • restricted to leaders and co-leaders
    • announce player channel message player tag

      • announces message to specified channel, pings the requested player's user
      • restricted to leaders and co-leaders
    • announce donate channel message unit name

      • announces message to specified channel, pings all users that can donate the requested
      • announce donate options
        • options for announce donate command
          • clan_role - mention a role linked to a clan to get that clan's information
            • if no clan role is specified, then the user's active player's clan will be used
    • announce supertroop channel message super troop name

      • announces message to specified channel, pings all users that have the requested super troop active
      • announce supertroop options
        • options for announce supertroop command
          • clan_role - mention a role linked to a clan to get that clan's information
            • if no clan role is specified, then the user's active player's clan will be used
    • announce war channel message

      • announces message to specified channel, pings all in current war
      • restricted to leaders and co-leaders
      • announce war options
        • options for announce war command
          • clan_role - mention a role linked to a clan to get that clan's information
            • if no clan role is specified, then the user's active player's clan will be used
          • cwl_war_selection - only for cwl specify whether to look for the previous, current, or upcoming war
            • defaults to current
    • announce warnoatk channel message

      • announces message to channel, pings all in war missing attacks
      • restricted to leaders and co-leaders
      • announce warnoattack options
        • options for announce warnoattack command
          • clan_role - mention a role linked to a clan to get that clan's information
            • if no clan role is specified, then the user's active player's clan will be used
          • missed_attacks - returns players who missed exactly the specified missed attack count
            • if not specified, then it will simply return all who are or have missed attacks
          • cwl_war_selection - only for cwl specify whether to look for the previous, current, or upcoming war
            • defaults to current
  • Player

    • player options

      • options for player commands
      • user - mention a user to get their active player's information
        • if no user is specified, then the user's active player will be used
      • tag - specify a player's tag for that player's information
        • if no tag is specified, then the user's active player will be used
    • player info

      • shows player information based on your active player
    • player recruit

      • displays player recruit information for requested player tag
    • player unit all

      • shows the level your units based on the specified type
    • player unit find unit name

      • shows the level, town hall max, and overall max levels for the requested unit
      • you can search troops, spells, and heroes
      • example
        • /player unit find hog rider
        • /player unit find jump spell
        • /player unit find archer queen
    • player supertroop

      • shows the super troops you have active
  • Clan

    • clan options

      • options for clan commands
      • clan_role - mention a role linked to a clan to get that clan's information
        • if no clan role is specified, then the user's active player's clan will be used
      • tag - specify a clan's tag for that clan's information
        • if no tag is specified, then the user's active player's clan will be used
    • clan info

      • displays clan information
    • clan lineup

      • displays clan town hall lineup
      • clan lineup options
        • options for clan lineup command
        • overview default - returns an overview of the clan's town hall lineup
        • member - returns each member of the clan and their town hall and their hero levels
        • count - returns a count of the clan's town hall lineup
    • clan warpreference

      • displays rundown of clan member's war preference
      • clan warpreference options
        • options for clan warpreference command
        • overview default - returns an overview of the clan's war preference
        • member - returns each member of the clan and their war preference
    • clan donate unit name

      • search the clan for available donors for a specified unit
      • examples
        • /clan donate hog rider
        • /clan donate freeze spell
    • clan supertroop

      • shows all active super troops in the clan
      • clan supertroop option
        • option for clan supertroop command
        • super_troop - if a super troop is specified, then it will search the clan and show who has the specified super troop active
  • War

    • war options

      • options for war commands
      • clan_role - mention a role linked to a clan to get that clan's war information
        • if no clan role is specified, then the user's active player's clan will be used
      • cwl_war_selection - only for cwl specify whether to look for the previous, current, or upcoming war
        • defaults to current
    • war info

      • displays war information
    • war noattack

      • lists players that missed attacks in war
      • war noattack option
        • option for war noattack command
        • missed_attacks - returns players who missed exactly the specified missed attack count
          • if not specified, then it will simply return all who are or have missed attacks
    • war open

      • show opponent bases that are open
      • war open option
        • star_count - star count selection for open bases
          • if not specified, then it show all open bases that haven't been 3 starred
    • war stars

      • show all war members and their stars
      • war stars options
        • options for war stars command
        • stars default - returns all war members and their stars
        • member - show all war members and their attacks
    • war score user

      • user's active player's war score
      • war score user option
        • option for war score user command
        • user - returns the mentioned user's active player's war score
          • if not specified, then it will return the author's active player's war score
    • war score clan

      • every clan member's war score
      • restricted to leaders and co-leaders
    • war lineup

      • war town hall lineup
      • war lineup options
        • options for war lineup command
        • overview - short overview of the war's lineup
        • clan default - war lineup for each clan
        • member - lineup for every member in war
  • CWL

    • cwl options

      • options for cwl commands
      • clan_role - mention a role linked to a clan to get that clan's cwl information
        • if no clan role is specified, then the user's active player's clan will be used
    • cwl info

      • CWL info
    • cwl lineup

      • CWL town hall lineup
      • cwl lineup options
        • options for cwl lineup command
        • overview - short overview of the cwl's lineup
        • clan default - cwl lineup for each clan
        • member - lineup for every member in each clan in cwl
    • cwl scoreboard

      • CWL scoreboard
      • cwl scoreboard options
        • options for cwl scoreboard command
        • group default - cwl scoreboard for the group
        • rounds - cwl scoreboard for each round
        • clan - cwl scoreboard for each clan member
    • cwl score user

      • user's active player's cwl score
      • cwl score user option
        • option for cwl score user command
        • user - returns the mentioned user's active player's cwl score
          • if not specified, then it will return the author's active player's cwl score
    • cwl score clan

      • every clan member's cwl score
      • restricted to leaders and co-leaders

Contributing

If you would like to contribute to this project please message me on discord or email me. I currently do not have any contribution instruction and will figure that out when the time comes if someone would like to.

Requirements

There aren't many required packages, but here are the few that are required and the versions I am using.

Links and Contact

Official ClashDiscord Server

Email: clashdiscord21@gmail.com