All Projects → top-gg → Python Sdk

top-gg / Python Sdk

Licence: mit
A simple API wrapper for top.gg written in Python

Programming Languages

python
139335 projects - #7 most used programming language

Projects that are alternatives of or similar to Python Sdk

Throw Voice
Simple audio recording for Discord. Mirror of https://gitlab.com/pawabot/pawa
Stars: ✭ 36 (-33.33%)
Mutual labels:  bot, discord
Thm Discord Bot
TryHackMe Python Bot
Stars: ✭ 53 (-1.85%)
Mutual labels:  bot, discord
Clara
A general purpose Node.JS bot for Discord.
Stars: ✭ 37 (-31.48%)
Mutual labels:  bot, discord
Kuro
An easy to use self bot with different utilities written in NodeJS
Stars: ✭ 31 (-42.59%)
Mutual labels:  bot, discord
Automod Bot
Fun moderation economy bot discord.js
Stars: ✭ 41 (-24.07%)
Mutual labels:  bot, discord
Modmail
A feature rich discord Modmail bot
Stars: ✭ 957 (+1672.22%)
Mutual labels:  bot, discord
Calebj Cogs
⚙ Cogs for Red-Discordbot
Stars: ✭ 42 (-22.22%)
Mutual labels:  bot, discord
Clinet
Official repository for Clinet, a Discord bot intended for assistance and control within your guilds.
Stars: ✭ 28 (-48.15%)
Mutual labels:  bot, discord
Juniperbot
Fluffy Discord Bot (Music, Ranking, Reminder, Vk Community bridge,WikiFur) created using JDA
Stars: ✭ 43 (-20.37%)
Mutual labels:  bot, discord
System Bot
Moderative and user-friendly discord bot using discord.js
Stars: ✭ 43 (-20.37%)
Mutual labels:  bot, discord
Dogey
🐶 - My general purpose bot for Discord
Stars: ✭ 30 (-44.44%)
Mutual labels:  bot, discord
Smorebot
SmoreBot is a fun, lightweight, multipurpose bot packed with features.
Stars: ✭ 51 (-5.56%)
Mutual labels:  bot, discord
Discord Bot
🤖 Our BIG help in things about moderation and many more useful stuff on our Discord server.
Stars: ✭ 30 (-44.44%)
Mutual labels:  bot, discord
Discord4j
Discord4J is a fast, powerful, unopinionated, reactive library to enable quick and easy development of Discord bots for Java, Kotlin, and other JVM languages using the official Discord Bot API.
Stars: ✭ 973 (+1701.85%)
Mutual labels:  bot, discord
Pvpcraft
PvPCraft Discord bot
Stars: ✭ 29 (-46.3%)
Mutual labels:  bot, discord
Progress Bot
High-tech weaponized moe progress delivery bot for IRC, Discord, and web
Stars: ✭ 38 (-29.63%)
Mutual labels:  bot, discord
Eris
A NodeJS Discord library
Stars: ✭ 879 (+1527.78%)
Mutual labels:  bot, discord
Pixie
An open-source Discord bot built for weebs, by a weeb.
Stars: ✭ 20 (-62.96%)
Mutual labels:  bot, discord
Scrape Youtube
A lightning fast package to scrape YouTube search results. This was made and optimized for Discord Bots.
Stars: ✭ 43 (-20.37%)
Mutual labels:  bot, discord
Community Bot
The bot used on the TypeScript Community discord server
Stars: ✭ 46 (-14.81%)
Mutual labels:  bot, discord

DBL Python Library

.. image:: https://img.shields.io/pypi/v/dblpy.svg :target: https://pypi.python.org/pypi/dblpy :alt: View on PyPi .. image:: https://img.shields.io/pypi/pyversions/dblpy.svg :target: https://pypi.python.org/pypi/dblpy :alt: v0.4.0 .. image:: https://readthedocs.org/projects/dblpy/badge/?version=latest :target: https://dblpy.readthedocs.io/en/latest/?badge=latest :alt: Documentation Status

A simple API wrapper for top.gg_ written in Python, supporting discord.py.

Installation

Install via pip (recommended)

.. code:: bash

pip3 install dblpy

Install from source

.. code:: bash

pip3 install git+https://github.com/top-gg/python-sdk/

Documentation

Documentation can be found here_

Features

  • POST server count
  • GET bot info, server count, upvote info
  • GET all bots
  • GET user info
  • GET widgets (large and small) including custom ones. See docs.top.gg_ for more info.
  • GET weekend status
  • Built-in webhook to help you handle top.gg upvotes
  • Automated server count posting
  • Searching for bots via the API

Additional information

  • Before using the webhook provided by this library, make sure that you have specified port open.
  • webhook_port should be between 1024 and 49151.
  • Below examples are to be used as discord.py cogs. If you need help adding them to your bot, feel free to ask in the #development channel in our Discord server_.

Examples

Posting server count manually every 30 minutes:

.. code:: py

from discord.ext import commands, tasks

import dbl


class TopGG(commands.Cog):
    """
    This example uses tasks provided by discord.ext to create a task that posts guild count to top.gg every 30 minutes.
    """

    def __init__(self, bot):
        self.bot = bot
        self.token = 'dbl_token'  # set this to your DBL token
        self.dblpy = dbl.DBLClient(self.bot, self.token)
        self.update_stats.start()

    def cog_unload(self):
        self.update_stats.cancel()

    @tasks.loop(minutes=30)
    async def update_stats(self):
        """This function runs every 30 minutes to automatically update your server count."""
        await self.bot.wait_until_ready()
        try:
            server_count = len(self.bot.guilds)
            await self.dblpy.post_guild_count(server_count)
            print('Posted server count ({})'.format(server_count))
        except Exception as e:
            print('Failed to post server count\n{}: {}'.format(type(e).__name__, e))


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

Using webhook:

.. code:: py

from discord.ext import commands

import dbl


class TopGG(commands.Cog):
    """
    This example uses dblpy's webhook system.
    In order to run the webhook, at least webhook_port must be specified (number between 1024 and 49151).
    """

    def __init__(self, bot):
        self.bot = bot
        self.token = 'dbl_token'  # set this to your DBL token
        self.dblpy = dbl.DBLClient(self.bot, self.token, webhook_path='/dblwebhook', webhook_auth='password', webhook_port=5000)

    @commands.Cog.listener()
    async def on_dbl_vote(self, data):
        """An event that is called whenever someone votes for the bot on top.gg."""
        print("Received an upvote:", "\n", data, sep="")

    @commands.Cog.listener()
    async def on_dbl_test(self, data):
        """An event that is called whenever someone tests the webhook system for your bot on top.gg."""
        print("Received a test upvote:", "\n", data, sep="")


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

With autopost:

.. code:: py

from discord.ext import commands

import dbl


class TopGG(commands.Cog):
    """
    This example uses dblpy's autopost feature to post guild count to top.gg every 30 minutes.
    """

    def __init__(self, bot):
        self.bot = bot
        self.token = 'dbl_token'  # set this to your DBL token
        self.dblpy = dbl.DBLClient(self.bot, self.token, autopost=True)  # Autopost will post your guild count every 30 minutes

    @commands.Cog.listener()
    async def on_guild_post(self):
        print("Server count posted successfully")


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

.. _top.gg: https://top.gg/ .. _docs.top.gg: https://docs.top.gg/ .. _here: https://dblpy.rtfd.io .. _Discord server: https://discord.gg/EYHTgJX

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].