From b4a7f36126ea687b3fc6bcf7c54bf0271a42c47f Mon Sep 17 00:00:00 2001 From: MadCat9958 Date: Sat, 1 Jul 2023 13:02:10 +0300 Subject: [PATCH 1/4] update examples --- README.md | 2 +- examples/autopost.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index fc3edaa..c5287f6 100644 --- a/README.md +++ b/README.md @@ -56,7 +56,7 @@ bot = commands.Bot(command_prefix="!") # Function that will return the current bot's stats. async def get_stats(): - return {"servers": len(bot.guilds), "shards": 0, "users": len(bot.users)} + return {"guilds": len(bot.guilds), "shards": 0, "members": len(bot.users)} # Function that will be called if stats are posted successfully. diff --git a/examples/autopost.py b/examples/autopost.py index 6d41e6f..1239635 100644 --- a/examples/autopost.py +++ b/examples/autopost.py @@ -10,7 +10,7 @@ bot = commands.Bot(command_prefix="!") # Function that will return the current bot's stats. async def get_stats(): - return {"servers": len(bot.guilds), "shards": 0, "users": len(bot.users)} + return {"guilds": len(bot.guilds), "shards": 0, "members": len(bot.users)} # Function that will be called if stats are posted successfully. From 41630e608892905c3662c819ceffbc5db6ab1f7d Mon Sep 17 00:00:00 2001 From: MadCat9958 Date: Sat, 1 Jul 2023 13:46:01 +0300 Subject: [PATCH 2/4] migration guide --- MIGRATION.md | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/MIGRATION.md b/MIGRATION.md index d4105f8..eda2e9f 100644 --- a/MIGRATION.md +++ b/MIGRATION.md @@ -50,6 +50,20 @@ autopost = ( ) ``` +Also, JSON's keys for bot stats must be changed: + +### Was: +```py +async def get_stats(): + return {"servers": len(bot.guilds), "shards": 0, "users": len(bot.users)} +``` + +### Became: +```py +async def get_stats(): + return {"guilds": len(bot.guilds), "shards": 0, "members": len(bot.users)} +``` + ## Webhook or websocket... that is the question Webhooks are no longer supported in boticordpy. You can find guide how to use boticord websocket [here](https://github.com/boticord/boticordpy/blob/master/examples/websocket.py). From e5175681ad086f0775be2335b094ac71d9b00d58 Mon Sep 17 00:00:00 2001 From: MadCat9958 Date: Sat, 1 Jul 2023 13:46:02 +0300 Subject: [PATCH 3/4] too --- MIGRATION.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/MIGRATION.md b/MIGRATION.md index eda2e9f..a920a16 100644 --- a/MIGRATION.md +++ b/MIGRATION.md @@ -1,5 +1,5 @@ -# Migration Guilde +# Migration Guide You can use this guide to make it easier to switch to new version (3x) of boticordpy. From 7aff87636b2e98b4c3fa8a23b4921a82c935d34f Mon Sep 17 00:00:00 2001 From: MadCat9958 Date: Sat, 1 Jul 2023 13:49:06 +0300 Subject: [PATCH 4/4] one more fix --- boticordpy/client.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/boticordpy/client.py b/boticordpy/client.py index aab9970..8cf5726 100644 --- a/boticordpy/client.py +++ b/boticordpy/client.py @@ -77,7 +77,7 @@ class BoticordClient: _logger.info("Posting bot stats") response = await self.http.post_bot_stats( - bot_id, {"servers": servers, "shards": shards, "users": users} + bot_id, {"guilds": servers, "shards": shards, "members": users} ) return boticord_types.ResourceBot.from_dict(response)