A new, modern API wrapper for top.gg
Project description
Top.py
A modern python module wrapper for the official top.gg API.
THIS MODULE IS NOT ENDORSED BY TOP.GG. Their official package is here.
Installation
Dev
without pip
git clone https://github.com/dragdev-studios/top.py
cd top.py
python3 setup.py build && python3 setup.py install
with pip
pip install git+https://github.com/dragdev-studios/top.py
Stable
pip
pip install top.py
git
# replace curl with wget, or whatever you use to make web requests
curl https://github.com/dragdev-studios/top.py/archive/<version>.tar.gz > top.py.tar.gz
tar -xf top.py.tar.gz
cd top.py
python3 setup.py install
Usage
Documentation can be found in the github's wiki
from toppy.client import TopGG
from discord.ext import commands
class TopGGCog(commands.Cog):
def __init__(self, bot):
self.bot = bot
self.top_gg = TopGG(
self.bot,
token="example-token-please-replace"
)
@commands.command()
@commands.cooldown(1, 5) # this can be changed, however over 60 requests per minute will get you blocked.
async def voted(self, ctx):
"""Tells you if you've voted for me!"""
has_voted = await self.top_gg.upvote_check(ctx.author.id)
return await ctx.send("You have voted for me <3" if has_voted else "No, you haven't. Please vote!")
def setup(bot):
bot.add_cog(TopGGCog(bot))
The above example will create a cog that will have a top_gg
attribute and a voted
command, which tells the user if
they've voted.
TopGG(
bot,
token="...",
autopost=False
)
This example will disable the internal autopost task (which posts your server count evey 30 minutes)
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
top.py-1.0.0.tar.gz
(9.8 kB
view hashes)
Built Distribution
top.py-1.0.0-py3-none-any.whl
(1.9 MB
view hashes)