Skip to main content

Simple Python Module for boticord api

Project description

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))

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

boticordpy-1.3.7.tar.gz (5.0 kB view hashes)

Uploaded Source

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page