Skip to main content

glennbotlist.xyz API Wrapper in Python

Project description

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

Method Action
post_guild_count(bot_id, guild_count, shard_count: optional) (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(bot_id) (note: requires authentication) GET bot votes
fetch_bot_stats(bot_id) GET bot stats
fetch_vote_count(bot_id) (note: requires authentication) GET bot vote count

Examples

Post server count

from glennbotlist import GBL
from discord.ext import tasks

gbl = GBL("token") # glenbotlist.xyz API token

@tasks.loop(minutes=30) # posts guild count every 30 minutes
async def post_guilds(self):
    await gbl.post_guild_count(self.bot.user.id, len(self.bot.guilds))

Get Bot Info

import discord
from glennbotlist import GBL
from discord.ext import commands

gbl = GBL()

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

    info = await gbl.fetch_bot_stats(user.id)
    await ctx.send(info['name'])

Get Bot Votes

from glennbotlist import GBL
from discord.ext import commands

gbl = GBL("token") # glenbotlist.xyz API token

@commands.command()
async def botvotes(self, ctx):
    votes = await gbl.fetch_bot_votes(self.bot.user.id)
    await ctx.send(votes['current_votes']['monthly']) # people who have voted this month

Get Bot Vote Count

from glennbotlist import GBL
from discord.ext import commands

gbl = GBL("token") # glenbotlist.xyz API token

@commands.command()
async def botvotecount(self, ctx):
    votes = await gbl.fetch_vote_count(self.bot.user.id)
    await ctx.send(votes['alltime']) # all time votes

Get User Info

import discord
from glennbotlist import GBL
from discord.ext import commands

gbl = GBL()

@commands.command()
async def userinfo(self, ctx, user: discord.Member):
    info = await gbl.fetch_user_info(user.id)
    await ctx.send(info['username'])

Get User Has Voted

import discord
from glennbotlist import GBL
from discord.ext import commands

gbl = GBL("token") # glenbotlist.xyz API token

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

    voted = await gbl.fetch_has_voted(self.bot.id, user.id)
    await ctx.send(voted)

Authors

Made with ❤️ by A Trash Coder#0981 and A Discord User#6130.

Help

Join the Discord for more help on this module.

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

gblpyapi-0.2.1.tar.gz (3.5 kB view details)

Uploaded Source

File details

Details for the file gblpyapi-0.2.1.tar.gz.

File metadata

  • Download URL: gblpyapi-0.2.1.tar.gz
  • Upload date:
  • Size: 3.5 kB
  • Tags: Source
  • Uploaded using 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.45.0 CPython/3.8.2

File hashes

Hashes for gblpyapi-0.2.1.tar.gz
Algorithm Hash digest
SHA256 2902b0b5a1dc8cc6659b250eba2b348b644cb75458c0e3ce75c7a343ce6976b2
MD5 c369be2e2eaeee28d2f1db8edba486e7
BLAKE2b-256 40ab8a1dde5d91287cab09cb3dc50f0ad11eec8b65b126ce526e90a8d7c9a144

See more details on using hashes here.

Supported by

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