2929
3030# Initialize variables and load environment tables
3131load_dotenv ()
32- DISCORD_TOKEN = os .getenv ("DISCORD_TOKEN " ) # Normal ChadCounting token
32+ PROD_TOKEN = os .getenv ("PROD_TOKEN " ) # Normal ChadCounting token
3333DEV_TOKEN = os .getenv ("DEV_TOKEN" ) # ChadCounting Dev bot account token
34- DISCORDBOTLIST_TOKEN = os .getenv ("DISCORDBOTLIST_TOKEN" ) # For using the https://discordbotlist.com API
35- TOPGG_TOKEN = os .getenv ("TOPGG_TOKEN" ) # For using the https://top.gg API
3634guild_data = {} # Global variable for database
37- bot_version = "1.0.1-indev "
35+ bot_version = "1.0.1"
3836chadcounting_color = 0xCA93FF # Color of the embeds
3937image_gigachad = "https://github.com/Gitfoe/ChadCounting/blob/main/gigachad.jpeg?raw=true"
38+
39+ # Initialize API tokens and URIs
40+ DISCORDBOTLIST_TOKEN = os .getenv ("DISCORDBOTLIST_TOKEN" )
41+ TOPGG_TOKEN = os .getenv ("TOPGG_TOKEN" )
42+ DISCORDS_TOKEN = os .getenv ("DISCORDS_TOKEN" )
43+ DISCORDBOTSGG_TOKEN = os .getenv ("DISCORDBOTSGG_TOKEN" )
4044api_discordbotslist = "https://discordbotlist.com/api/v1/bots/chadcounting"
4145api_topgg = "https://top.gg/api/bots/1066081427935993886"
46+ api_discords = "https://discords.com/bots/api/bot/1066081427935993886"
47+ api_discordbotsgg = "https://discord.bots.gg/api/v1/bots/1066081427935993886"
4248
4349# Initialize bot and intents
4450intents = discord .Intents .default ()
@@ -713,6 +719,7 @@ def __init__(self):
713719 {"label" : "More information" , "url" : "https://github.com/Gitfoe/ChadCounting" , "emoji" : "ℹ️" },
714720 {"label" : "Vote on top.gg" , "url" : "https://top.gg/bot/1066081427935993886/vote" , "emoji" : "⬆️" },
715721 {"label" : "Vote on discordbotlist" , "url" : "https://discordbotlist.com/bots/chadcounting/upvote" , "emoji" : "⬆️" },
722+ {"label" : "Vote on discords" , "url" : "https://discordbotlist.com/bots/chadcounting/upvote" , "emoji" : "⬆️" },
716723 ]
717724 for button in buttons :
718725 self .add_item (Button (** button ))
@@ -1206,10 +1213,10 @@ def discordbotlist_api_authorization_header():
12061213 "Content-Type" : "application/json"
12071214 }
12081215
1209- def topgg_api_authorization_header ( ):
1216+ def generic_api_authorization_header ( token ):
12101217 """Base headers for the Top.GG API."""
12111218 return {
1212- "Authorization" : TOPGG_TOKEN ,
1219+ "Authorization" : token ,
12131220 "Content-Type" : "application/json"
12141221 }
12151222
@@ -1229,9 +1236,13 @@ def push_guilds_count_to_all_bot_websites():
12291236 """Pushes the current guild count to all bot websites configured."""
12301237 if check_dev_disable_apis (push_guilds_count_to_all_bot_websites .__name__ ): return
12311238 discordbotlist_headers = discordbotlist_api_authorization_header ()
1232- topgg_headers = topgg_api_authorization_header ()
1239+ topgg_headers = generic_api_authorization_header (TOPGG_TOKEN )
1240+ discords_headers = generic_api_authorization_header (DISCORDS_TOKEN )
1241+ discordbotsgg_headers = generic_api_authorization_header (DISCORDBOTSGG_TOKEN )
12331242 push_guilds_count_to_bot_website (f"{ api_discordbotslist } /stats" , "guilds" , discordbotlist_headers )
12341243 push_guilds_count_to_bot_website (f"{ api_topgg } /stats" , "server_count" , topgg_headers )
1244+ push_guilds_count_to_bot_website (api_discords , "server_count" , discords_headers )
1245+ push_guilds_count_to_bot_website (f"{ api_discordbotsgg } /stats" , "guildCount" , discordbotsgg_headers )
12351246
12361247def push_guilds_count_to_bot_website (url , payload_string , headers ):
12371248 """Sends the number of guilds via the API."""
@@ -1240,5 +1251,5 @@ def push_guilds_count_to_bot_website(url, payload_string, headers):
12401251 print (f"[{ datetime .now ()} ] { push_guilds_count_to_bot_website .__name__ } : { url } API response { response .status_code } ." )
12411252#endregion
12421253
1243- bot .run (DEV_TOKEN )
1254+ bot .run (PROD_TOKEN )
12441255# Coded by https://github.com/Gitfoe
0 commit comments