mirror of
https://github.com/boticord/boticordpy.git
synced 2024-11-11 19:07:29 +03:00
31 lines
865 B
Python
31 lines
865 B
Python
# 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`.
|
|
|
|
from discord.ext import commands
|
|
from boticordpy import BoticordClient
|
|
|
|
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)}
|
|
|
|
|
|
# Function that will be called if stats are posted successfully.
|
|
async def on_success_posting():
|
|
print("wow stats posting works")
|
|
|
|
|
|
boticord_client = BoticordClient(
|
|
"your_boticord_api_token", version=3
|
|
) # <--- BotiCord API token
|
|
autopost = (
|
|
boticord_client.autopost()
|
|
.init_stats(get_stats)
|
|
.on_success(on_success_posting)
|
|
.start("id_of_your_bot") # <--- ID of your bot
|
|
)
|
|
|
|
bot.run("bot token") # <--- Discord bot's token
|