An API wrapper for BotiCord API written in Python
Find a file
Victor Kotlin 719b814713 fix docs
2021-09-19 12:14:30 +03:00
boticordpy add bot's vote model 2021-09-19 11:45:26 +03:00
docs fix docs 2021-09-19 12:14:30 +03:00
examples fix comments classes 2021-09-18 17:53:48 +03:00
.gitignore Update .gitignore 2021-09-16 23:54:58 +03:00
LICENSE.txt fix setup.py 2021-08-24 21:20:10 +03:00
README.md some new examples 2021-09-11 16:10:17 +03:00
requirements.txt fix setup.py 2021-08-24 21:20:10 +03:00
setuo.cfg fix setup.py 2021-08-24 21:20:10 +03:00
setup.py change versions 2021-09-12 12:58:17 +03:00

Boticordpy

Модуль для работы с Boticord API



Примеры

Без Когов

Публикуем статистику при запуске бота.

from discord.ext import commands

from boticordpy import BoticordClient

bot = commands.Bot(command_prefix="!")
boticord = BoticordClient(bot, "your-boticord-token")


@bot.event
async def on_ready():
    stats = {"servers": len(bot.guilds), "shards": bot.shard_count, "users": len(bot.users)}
    await boticord.Bots.postStats(stats)


bot.run("your-bot-token")

С Когами

Ког с автоматической публикацией статистики раз в 15 минут + команда для публикации статистики для владельца бота.

from discord.ext import commands

from boticordpy import BoticordClient


class BoticordCog(commands.Cog):
    def __init__(self, bot):
        self.bot = bot
        self.boticord = BoticordClient(self.bot, "your-boticord-token")
        self.boticord.start_loop()

    @commands.command(name="boticord-update")
    @commands.is_owner()
    async def boticord_update(self, ctx):
        """
            This commands can be used by owner to post stats to boticord
        """
        stats = {"servers": len(self.bot.guilds), "shards": 0, "users": len(self.bot.users)}
        await self.boticord.Bots.postStats(stats)


def setup(bot):
    bot.add_cog(BoticordCog(bot))