Skip to main content

DCList.net Python SDK

This module is official python sdk for dclist.net.

It's open-source and always open to prs and contributions.

Installation

You can install package via pip or github with following commands :

Recomended:

pip install dclist.py

or

git clone https://github.com/dclist/python-sdk.git
cd python-sdk
python -m venv env
pip install .

Gettings Started

Posting botstats automaticly as a Cog:

import dclist

from discord.ext import commands, tasks

class dclistpy(commands.Cog):
    def __init__(self, bot):
        self.bot = bot
        self.dclistapi = dclist.DCLClient(bot, "YOUR_TOKEN_HERE")
        # you can get the token from your bot's page on dclist.net
        # you have option to pass your token as environment variable as `DCLIST_TOKEN`
        self.update_stats.start()

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

    @tasks.loop(minutes=30.0)
    async def update_stats(self):
        await self.bot.wait_until_ready()
        try:
            await self.dclistapi.postBotStats()
        except dclist.DCListException as e:
            print(e)
            # print sucs lol use logger instead :walter_the_dog:
        else:
            print('Posted stats to dclist.net successfully')

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

Getting bot or user info from api:

    @commands.group(invoke_without_command=True)
    async def dclist(self, ctx):
        await ctx.send('available commands -> `dclist bot` `dclist user` `dclist voted`')

    @dclist.command(name="bot")
    async def get_dclist_bot(self, ctx, bot_id):
        bot = await self.dclistapi.getBotById(bot_id)
        to_send = f"found bot {bot['username']} using this github {bot['github']} and vote_count is {bot['stats']['voteCount']}"
        await ctx.send(to_send)

    @dclist.command(name="me")
    async def get_dclist_user(self, ctx):
        user = await self.dclistapi.getUserById(ctx.author.id)
        to_send = f"found user {user['username']} using this website {user['website']} and discriminator is {user['discriminator']}"
        await ctx.send(to_send)

    @dclist.command(name="voted")
    async def get_dclist_user(self, ctx, user_id):
        is_voted = await self.dclistapi.isUserVoted(user_id)
        if is_voted:
            await ctx.send('yessir, i did voted from this dude.')
        else:
            await ctx.send('this user is not voted :(')

More

You can use sdk to get more information like getUserComment.

Metadata

Release files for dclist.py 0.1.6

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

Source distribution (sdist)

Source distribution for dclist.py 0.1.6
File Size Uploaded
dclist.py-0.1.6.tar.gz 8.6 kB Details

Release files / dclist.py-0.1.6.tar.gz

Download URL dclist.py-0.1.6.tar.gz
Size 8.6 kB
Tags Source
SHA-256 checksum
How to use checksums
aacccab5b2af41f59128dc7efa0fda0bd8dc86c45f890d138090a61abcc524ad
BLAKE2b-256 checksum
How to use checksums
ac23bc402c4c79a637618d5476b7d8bef678460805f51b8e3c40217ca64f1db8
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.4.1 importlib_metadata/3.10.0 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.59.0 CPython/3.8.5

Release history Release notifications | RSS feed

This release

0.1.6 This release

1 release file

0.1.5

1 release file

0.1.2

1 release file

0.1.1

1 release file

0.1.0

1 release file

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