2022-09-10 15:00:26 +03:00
|
|
|
# You can use any library to interact with the Discord API.
|
|
|
|
# This example uses discord.py.
|
|
|
|
# You can install it with `pip install discord.py`.
|
2022-02-17 19:14:39 +03:00
|
|
|
|
|
|
|
from discord.ext import commands
|
|
|
|
from boticordpy import BoticordClient
|
|
|
|
|
|
|
|
bot = commands.Bot(command_prefix="!")
|
|
|
|
|
|
|
|
|
2022-09-10 15:00:26 +03:00
|
|
|
# Function that will return the current bot's stats.
|
2022-02-17 19:14:39 +03:00
|
|
|
async def get_stats():
|
|
|
|
return {"servers": len(bot.guilds), "shards": 0, "users": len(bot.users)}
|
|
|
|
|
|
|
|
|
2022-09-10 15:00:26 +03:00
|
|
|
# Function that will be called if stats are posted successfully.
|
2022-02-17 19:14:39 +03:00
|
|
|
async def on_success_posting():
|
|
|
|
print("stats posting successfully")
|
|
|
|
|
2022-09-10 15:00:26 +03:00
|
|
|
|
2023-04-18 19:42:02 +03:00
|
|
|
boticord_client = BoticordClient("Bot your_api_token", version=2)
|
2022-02-17 19:14:39 +03:00
|
|
|
autopost = (
|
|
|
|
boticord_client.autopost()
|
|
|
|
.init_stats(get_stats)
|
|
|
|
.on_success(on_success_posting)
|
2022-02-17 19:35:54 +03:00
|
|
|
.start()
|
2022-02-17 19:14:39 +03:00
|
|
|
)
|
|
|
|
|
|
|
|
bot.run("bot token")
|