mirror of
https://github.com/boticord/boticordpy.git
synced 2024-09-22 19:32:01 +03:00
1.7 KiB
1.7 KiB
Migration Guide
You can use this guide to make it easier to switch to new version (3x) of boticordpy.
Upgrading boticordpy
Run this command in terminal:
pip install boticordpy --upgrade
BoticordClient
With a new BotiCord token system you don't need to specify type of token:
Was:
boticord_client = BoticordClient(
"Bot your_api_token", version=2
)
Became:
boticord_client = BoticordClient(
"your_api_token", version=3
)
You can get a new token in your account settings (not a bot's!)
Autoposting
Since the token is no longer connected to the bot you need to specify the ID when starting the autoposting:
Was:
autopost = (
boticord_client.autopost()
.init_stats(get_stats)
.on_success(on_success_posting)
.start()
)
Became:
autopost = (
boticord_client.autopost()
.init_stats(get_stats)
.on_success(on_success_posting)
.start("id_of_your_bot") # <--- ID of your bot
)
Also, JSON's keys for bot stats must be changed:
Was:
async def get_stats():
return {"servers": len(bot.guilds), "shards": 0, "users": len(bot.users)}
Became:
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.
Extra changes
There are some additional changes to the data models and new search methods added. So, I recommend you to read the docs