Skip to main content

gblapi.py - The official Python API Wrapper for the GBL API

PyPI

About

This is the official API wrapper for GlennBotList.xyz written in Python and published to PyPi.

Installation

To install gblapi.py, run this command in a terminal:

$ pip install gblpyapi

Features

glennbotlist.WebhookServer

gblpyapi now has a webhook server! Create an instance of the WebhookServer module and pass the required parameters. Get when a user votes with the event below!

Event Name Parameters
on_glenn_vote data

glennbotlist.GBL

Method Action
post_guild_count() (note: requires authentication) POST guild count
fetch_user_info(user_id) GET user info
fetch_has_voted(user_id) (note: required authentication) GET if a user has voted
fetch_bot_votes() (note: requires authentication) GET bot votes
fetch_bot_stats(bot_id) GET bot stats
fetch_vote_count() (note: requires authentication) GET bot vote count

Examples

To easily combine all examples, all examples will be shown in a discord.ext.commands.Cog

from glennbotlist import GBL
from glennbotlist import WebhookServer
import discord
from discord.ext import commands, tasks

class GlennBotList(commands.Cog):
    def __init__(self, bot):
        self.bot = bot
        self.glenn = GBL(bot=self.bot, token=config.gbl, logging=True) # Replace "GBL TOKEN" with your GBL Token. True enables logging.
        self.server = WebhookServer(self.bot) # Initiate Webhook Server
        self.postservers.start() # Starts the postservers task

    @commands.Cog.listener()
    async def on_glenn_vote(self, data): # Triggered whenever a user votes
        print(data)

    @tasks.loop(hours = 1)
    async def postservers(self):
        await self.glenn.post_guild_count() # Post you server count and shard count. If logging is enabled, it will print a success message

    @commands.command()
    async def user_info(self, ctx, user: discord.Member):
        if user.bot:
            return await ctx.send("This user is not a bot")

        guser = await self.glenn.fetch_user_info(user.id) # Returns a glennbotlist.User object
        await ctx.send(f"Name: {guser.name}. Bio: {guser.bio}") # Sends the users name and bio. For all User attributes, print the directory of glennbotlist.User

    @commands.command()
    async def has_voted(self, ctx, user: discord.Member):
        if user.bot:
            return await ctx.send("This user is not a bot")

        voted = await self.glenn.fetch_has_voted(user.id) # Returns a bool of whether the user has voted
        await ctx.send(f"{user}'s vote status: {voted}")

    @commands.command()
    async def votes(self, ctx):
        votes = await self.glenn.fetch_bot_votes() # Gets a dict of votes
        await ctx.send(votes)

    @commands.command()
    async def botinfo(self, ctx, user: discord.Member):
        if not user.bot:
            await ctx.send("This is not a bot!")

        bot = await self.glenn.fetch_bot_stats(user.id) # Returns a glennbotlist.Bot object
        await ctx.send(f"Name: {bot.name}. Prefix: {bot.prefix}") # Sends the bots name and prefix. For all Bot attributes, print the directory of glennbotlist.Bot

    @commands.command()
    async def vote_count(self, ctx):
        votes = await self.glenn.fetch_vote_count() # Gets all time and monthly votes
        await ctx.send(f"I have {votes['monthly']} votes this month!") # Sends amount of votes for the current month

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

Authors

Made with ❤️ by A Trash Coder#0214 and A Discord User#1173.

Help

Join the Discord for more help on this module.

Metadata

Release files for gblpyapi 0.3.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for gblpyapi 0.3.1
File Size Uploaded Provenance Actions
gblpyapi-0.3.1.tar.gz 6.2 kB Without provenance Details for gblpyapi-0.3.1.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for gblpyapi 0.3.1
File Interpreter ABI Platform Actions
gblpyapi-0.3.1-py3-none-any.whl Python 3 none any Details for gblpyapi-0.3.1-py3-none-any.whl

Total release size: 14.2 kB

Release files / gblpyapi-0.3.1.tar.gz

Download URL gblpyapi-0.3.1.tar.gz
Size 6.2 kB
Tags Source
SHA-256 checksum
How to use checksums
a7e306d2865fe482f84772df980e3724cc551fa0adf26cc8acb5effcfb526e32
BLAKE2b-256 checksum
How to use checksums
b424a9ce664aef68699fa4d0dd75ac8b7536561c8d94a2cd01d7122a5b44c269
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/41.2.0 requests-toolbelt/0.9.1 tqdm/4.46.0 CPython/3.8.2

Release files / gblpyapi-0.3.1-py3-none-any.whl

Download URL gblpyapi-0.3.1-py3-none-any.whl
Size 8.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
92e7c8a8818181c81ea3c5bda9b949dca96f11b998ddefc5f00e9b7f2cd252ac
BLAKE2b-256 checksum
How to use checksums
a61b4b2fda74d489e51fab44e3a179b97b18fb2255b9f6ee53aad34b460d645e
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/41.2.0 requests-toolbelt/0.9.1 tqdm/4.46.0 CPython/3.8.2

Security for gblpyapi 0.3.1

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page