Skip to main content

A simple API wrapper for botblock.org providing server count posting to all bot lists and fetching botinformation from all.

Project description

discordlists.py

A simple API wrapper for botblock.org providing server count posting to all bot lists and fetching bot information from all.

PyPi Version GitHub Sponsors Patreon Slack


Installation

Install via pip (recommended)

python3 -m pip install discordlists.py -U

Features

  • POST server count
  • AUTOMATIC server count updating
  • ALL bot lists' APIs included
  • GET bot information from all bot lists and Discord

Example Discord.py Cogs

Posting Server Count

from discord.ext import commands

import discordlists


class DiscordListsPost(commands.Cog):
    def __init__(self, bot):
        self.bot = bot
        self.api = discordlists.Client(self.bot)  # Create a Client instance
        self.api.set_auth("bots.ondiscord.xyz", "dsag38_auth_token_fda6gs") # Set authorisation token for a bot list
        self.api.set_auth("discordbots.group", "qos56a_auth_token_gfd8g6") # Set authorisation token for a bot list
        self.api.start_loop()  # Posts the server count automatically every 30 minutes

    @commands.command()
    async def post(self, ctx: commands.Context):
        """
        Manually posts guild count using discordlists.py (BotBlock)
        """
        try:
            result = await self.api.post_count()
        except Exception as e:
            await ctx.send("Request failed: `{}`".format(e))
            return

        await ctx.send("Successfully manually posted server count ({:,}) to {:,} lists."
                       "\nFailed to post server count to {:,} lists.".format(self.api.server_count,
                                                                             len(result["success"].keys()),
                                                                             len(result["failure"].keys())))


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

Getting Bot Info

from discord.ext import commands

import discordlists


class DiscordListsGet(commands.Cog):
    def __init__(self, bot):
        self.bot = bot
        self.api = discordlists.Client(self.bot)  # Create a Client instance

    @commands.command()
    async def get(self, ctx: commands.Context, bot_id: int = None):
        """
        Gets a bot using discordlists.py (BotBlock)
        """
        if bot_id is None:
            bot_id = self.bot.user.id
        try:
            result = (await self.api.get_bot_info(bot_id))[1]
        except Exception as e:
            await ctx.send("Request failed: `{}`".format(e))
            return

        await ctx.send("Bot: {}#{} ({})\nOwners: {}\nServer Count: {}".format(
            result['username'], result['discriminator'], result['id'],
            ", ".join(result['owners']) if result['owners'] else "Unknown",
            "{:,}".format(result['server_count']) if result['server_count'] else "Unknown"
        ))


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

Contributing

Contributions are always welcome to this project!
Take a look at any existing issues on this repository for starting places to help contribute towards, or simply create your own new contribution to the project.

Please make sure to follow the existing standards within the project such as code styles, naming conventions and commenting/documentation.

When you are ready, simply create a pull request for your contribution and I will review it whenever I can!

Donating

You can also help me and the project out by sponsoring me through GitHub Sponsors (preferred), contributing through a donation on PayPal or by supporting me monthly on my Patreon page.

GitHub Sponsors Patreon PayPal

Discussion, Support and Issues

Need support with this project, have found an issue or want to chat with others about contributing to the project?

Please check the project's issues page first for support & bugs!

Not found what you need here?

  • If you have an issue, please create a GitHub issue here to report the situation, include as much detail as you can!
  • or, You can join our Slack workspace to discuss any issue, to get support for the project or to chat with contributors and myself:
Slack

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

discordlists.py-1.1.1.tar.gz (7.2 kB view details)

Uploaded Source

Built Distributions

discordlists.py-1.1.1-py3.6.egg (9.9 kB view details)

Uploaded Source

discordlists.py-1.1.1-py3-none-any.whl (10.0 kB view details)

Uploaded Python 3

File details

Details for the file discordlists.py-1.1.1.tar.gz.

File metadata

  • Download URL: discordlists.py-1.1.1.tar.gz
  • Upload date:
  • Size: 7.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.13.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.0.1 requests-toolbelt/0.9.1 tqdm/4.32.2 CPython/3.6.4

File hashes

Hashes for discordlists.py-1.1.1.tar.gz
Algorithm Hash digest
SHA256 f6d49c93c3eb1d5ffbaeddf663d3bfa80bb3073a4fc43787b832ea55de49113d
MD5 af8b7f338de09f8415cbf9d054e71753
BLAKE2b-256 7792ee9f7b9862af86d8defbbb66513d6826ab2c2b774b30b2f08d7d2587f71f

See more details on using hashes here.

File details

Details for the file discordlists.py-1.1.1-py3.6.egg.

File metadata

  • Download URL: discordlists.py-1.1.1-py3.6.egg
  • Upload date:
  • Size: 9.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.13.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.0.1 requests-toolbelt/0.9.1 tqdm/4.32.2 CPython/3.6.4

File hashes

Hashes for discordlists.py-1.1.1-py3.6.egg
Algorithm Hash digest
SHA256 3ef38ee36fe469dce267a85633067087bb92c0840f8eb60033df05f5866f3bbe
MD5 bee31f46efb84c986cb66a6d22680eea
BLAKE2b-256 6f810c4ea72e95c19ef409a09ae516c66effe6cba2efe4fd17deaf09756aec18

See more details on using hashes here.

File details

Details for the file discordlists.py-1.1.1-py3-none-any.whl.

File metadata

  • Download URL: discordlists.py-1.1.1-py3-none-any.whl
  • Upload date:
  • Size: 10.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.13.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.0.1 requests-toolbelt/0.9.1 tqdm/4.32.2 CPython/3.6.4

File hashes

Hashes for discordlists.py-1.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 0211aecde3c3b3881239511aadc0c753f3cece423d8374d01fa815e958ca2537
MD5 9e8f0f8a35257b79f5c0def636040b00
BLAKE2b-256 24fd99db4a946f764335fadbeef241ab7cb55582ed8ce459704d3265bc7602d7

See more details on using hashes here.

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