Skip to main content

DiscorsUtils is a very useful library made to be used with discord.py

Project description

DiscordUtils

A very useful library made to be used in with discord.py

Installation

pip install DiscordUtils

Example code

DiscordUtils.Pagination.AutoEmbedPaginator

@bot.command()
async def paginate(ctx):
    embed1 = discord.Embed(color=ctx.author.color).add_field(name="Example", value="Page 1")
    embed2 = discord.Embed(color=ctx.author.color).add_field(name="Example", value="Page 2")
    embed3 = discord.Embed(color=ctx.author.color).add_field(name="Example", value="Page 3")
    paginator = DiscordUtils.Pagination.AutoEmbedPaginator(ctx)
    embeds = [embed1, embed2, embed3]
    await paginator.run(embeds)

DiscordUtils.Pagination.CustomEmbedPaginator

@bot.command()
async def paginate(ctx):
    embed1 = discord.Embed(color=ctx.author.color).add_field(name="Example", value="Page 1")
    embed2 = discord.Embed(color=ctx.author.color).add_field(name="Example", value="Page 2")
    embed3 = discord.Embed(color=ctx.author.color).add_field(name="Example", value="Page 3")
    paginator = DiscordUtils.Pagination.CustomEmbedPaginator(ctx)
    paginator.add_reaction('⏮️', "first")
    paginator.add_reaction('⏪', "back")
    paginator.add_reaction('🔐', "lock")
    paginator.add_reaction('⏩', "next")
    paginator.add_reaction('⏭️', "last")
    embeds = [embed1, embed2, embed3]
    await paginator.run(embeds)

DiscordUtils.InviteTracker

import discord
from discord.ext import commands
import DiscordUtils

bot = commands.AutoShardedBot(command_prefix=">")
tracker = DiscordUtils.InviteTracker(bot)

@bot.event
async def on_ready():
    await tracker.cache_invites()

@bot.event
async def on_invite_create(invite):
    await tracker.update_invite_cache(invite)

@bot.event
async def on_guild_join(guild):
    await tracker.update_guild_cache(guild)

@bot.event
async def on_invite_delete(invite):
    await tracker.remove_invite_cache(invite)

@bot.event
async def on_guild_remove(guild):
    await tracker.remove_guild_cache(guild)

@bot.event
async def on_member_join(member):
    inviter = await tracker.fetch_inviter(member) # inviter is the member who invited

For further information please read the docs

Links

Documentation

Github

Support

DM/PM toxic_recker#6764 on Discord

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

DiscordUtils-1.1.5.tar.gz (4.3 kB view details)

Uploaded Source

Built Distribution

DiscordUtils-1.1.5-py3-none-any.whl (5.6 kB view details)

Uploaded Python 3

File details

Details for the file DiscordUtils-1.1.5.tar.gz.

File metadata

  • Download URL: DiscordUtils-1.1.5.tar.gz
  • Upload date:
  • Size: 4.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/47.1.1 requests-toolbelt/0.9.1 tqdm/4.49.0 CPython/3.8.3

File hashes

Hashes for DiscordUtils-1.1.5.tar.gz
Algorithm Hash digest
SHA256 b4a2ff3f6db9e1cdd20c77fdddd51be40763bde0b087be65ee177916f34c18ea
MD5 eccbce513f1c2215df1f80eeb1becb81
BLAKE2b-256 904ebd4b840cb53fda513fc0365999bd30aaec0dc1a68b47173b4d8bf4af11c7

See more details on using hashes here.

File details

Details for the file DiscordUtils-1.1.5-py3-none-any.whl.

File metadata

  • Download URL: DiscordUtils-1.1.5-py3-none-any.whl
  • Upload date:
  • Size: 5.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/47.1.1 requests-toolbelt/0.9.1 tqdm/4.49.0 CPython/3.8.3

File hashes

Hashes for DiscordUtils-1.1.5-py3-none-any.whl
Algorithm Hash digest
SHA256 a6ccfa5e4b318370096e354d59e3c49caeb7ef527d9911d832c7d0e3efbfc419
MD5 2ff53d8fedb2a0d3ca12dbf8d423d196
BLAKE2b-256 38a9c4e16705fede5d2b202321db3928a5f8232c91d9c02e9a99ef7a9e5acd1b

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