Skip to content

Examples

Rahul Nanwani edited this page Dec 9, 2022 · 3 revisions

Examples

Using bot.py

import interactions
from interactions.ext.dbl import DBLClient

from config import BOT_TOKEN, TOPGG_TOKEN, DBL_TOKEN

if __name__ == '__main__':
    bot = interactions.Client(
        token=BOT_TOKEN,
        intents=interactions.Intents.DEFAULT
    )


    @bot.event
    async def on_ready():
        auth = {
            "top.gg": TOPGG_TOKEN,
            "discordbotlist.com": DBL_TOKEN
        }
        DBLClient(bot=bot, auth=auth)


    bot.start()

Using cogs

import interactions
from interactions.ext.dbl import DBLClient

from config import TOPGG_TOKEN, DBL_TOKEN


class UpdateCount(interactions.Extension):
    def __init__(self, bot):
        self.bot: interactions.Extension = bot

        auth = {
            "top.gg": TOPGG_TOKEN,
            "discordbotlist.com": DBL_TOKEN
        }
        DBLClient(bot=self.bot, auth=auth)


def setup(client):
    UpdateCount(client)
Clone this wiki locally