8000 Releases · disutils/disckit · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

Releases: disutils/disckit

disckit v1.1.2

04 Jul 21:16
5ff74c1
Compare
Choose a tag to compare

A bug fix release. This release patches the following issues-

  • Fixed owner commands showing up under All Commands section in the help command
  • Fixed non authorized interaction for help command & paginator
  • Improved help command autocompletion

disckit v1.1.1

03 Jul 08:34
189659f
Compare
Choose a tag to compare

A small bug fix for the help command where disckit.UtilConfig.OWNER_ONLY_HELP_COGS would show up under All Commands section of the help application command.

This patch fixes it.

disckit v1.1.0

03 Jul 07:57
@Jiggly-Balls Jiggly-Balls 10000
91a8b1a
Compare
Choose a tag to compare

Many more features have been added in this update.

  • Added help command cog
  • Added disckit.utils.MentionTree
  • Fixed disckit.paginator.create_empty_button type hint
  • Fixed autocomplete
  • Added disckit.utils.sku_check_user
  • Added disckit.utils.sku_check_guild
  • Added guild-based SKU cooldown
  • Updated error handler on disckit.ui.BaseView
  • Updated parameters of disckit.paginator.create_empty_button
  • Removed disckit.uilts.sku_check

disckit v1.0.2

03 Jun 22:35
2161035
Compare
Choose a tag to compare

Fixed interaction_check for BaseView and BaseModal. The main issue was the author check was not working, so even if you put author=None it would still fail to realize that!

Full Changelog: v1.0.1...v1.0.2

disckit v1.0.1

03 Jun 17:21
Compare
Choose a tag to compare

Embeds issue fixed, if there was no description the title of the embed would become the description.

This issue was in the past 2-3 versions, this version fixes this issue.

Full Changelog: v1.0.0...v1.0.1

disckit v1.0.0

02 Jun 09:20
Compare
Choose a tag to compare

The first actual stable release of disckit. We've fixed all type checking errors.

In this release, the following decorators will need to be called while using them-

  • disckit.utils.is_owner
  • disckit.utils.disallow_bots

Meaning, instead of doing-

    @app_commands.command(name="is-owner")
    @is_owner
    async def is_owner_example(self, interaction: Interaction) -> None: ...

You will have to do-

    @app_commands.command(name="is-owner")
    @is_owner()
    async def is_owner_example(self, interaction: Interaction) -> None: ...

There are some additional features features that has been added too such as-

  • disckit.utils.get_or_fetch_guild
  • disckit.utils.get_or_fetch_user
  • disckit.utils.get_or_fetch_channel

These functions attempt to simplify fetching guild, user or channel objects efficiently by first attempting to obtain it from cache, if it's unavailable, it makes an API request to fetch it.

Minor bug fix in the paginator home button & a new parameter added to it's __init__ : extra_buttons_format which takes in a bool and is by default True. This automatically symmetrically formats the extra buttons passed to it.

Full Changelog: v0.9...v1.0.0

disckit v0.9

28 May 13:40
Compare
Choose a tag to compare

The v0.9 update brings a lot of more features, enhanced code and some breaking changes.

The major change in this version is the rework done to all embeds, namely-

  • disckit.utils.ErrorEmbed
  • disckit.utils.MainEmbed
  • disckit.utils.SuccessEmbed

Their __init__ signatures now allow you to make embeds like so-

from disckit.utils import MainEmbed

MainEmbed(
    "This is a title",
    "This is the description"
)
MainEmbed("Now I only have a description")
MainEmbed(title="I can take in regular kwargs too")
MainEmbed(description="Testing description")

# ErrorEmbed & SuccessEmbed follow the same pattern

This new rework of embeds may cause unexpected behaviours in previous versions of disckit. Hence update your code accordingly if you're planning on updating to v0.9

The new features that have been added are-

  • Cooldown
  • Paginator
  • BaseView
  • BaseModal
  • BaseCog

Cooldowns-

The new cooldown feature allows you to place cooldown dynamically or statically based on per users, channels or guilds.

Example for adding cooldown statically & dynamically-

from disckit.utils.cooldown import CoolDown, CoolDownBucket
from discord import app_commands
from discord.ext import command


class DisckitTestCog(commands.Cog):
    def __init__(self, bot: commands.Bot) -> None:
        self.bot = bot

    @app_commands.command()
    @CoolDown.cooldown(10, CoolDownBucket.CHANNEL)  # Adds a cooldown of 10 seconds for that channel
    async def cooldown_channel(self, interaction: Interaction) -> None:
        """Testing static cooldown for a channel for all users"""
        await interaction.response.send_message("This is to test cooldown on a channel for all users!")

    @app_commands.command()
    @CoolDown.cooldown(10, CoolDownBucket.USER)
    async def cooldown_user(self, interaction: Interaction) -> None:
        """Testing static cooldown for every user"""
        await interaction.response.send_message("This is to test cooldown per user!")

    @app_commands.command()
    async def dynamic_cooldown(self, interaction: Interaction) -> None:
        """Dynamically add cooldown to a specific user."""

        if interaction.user.id == 1022085572719808542:

            # Check if user of that ID is in cooldown or not
            allowed, cooldown_text = CoolDown.check(
                interaction, CoolDownBucket.USER
            )

            if not allowed:
                # If they are in cooldown, send an appropriate message
                await interaction.response.send_message(cooldown_text)
                return
            
            # If they are allowed, add the cooldown and continue the command
            CoolDown.add(25, interaction, CoolDownBucket.USER)

        await interaction.response.send_message(
            "Testing dynamic cooldowns"
        )

Paginators

Paginators allow users to view multiple "pages" of data within discord in a simple manner. The implementation allows it to be integrated to your bot with minimal code. You can paginate over strings or embeds. A small examples-

    @app_commands.command()
    async def pages(self, interaction: Interaction) -> None:
        """A test command for the custom disckit paginator"""

        await interaction.response.defer()

        home_page = MainEmbed("THIS IS HOME PAGE")

        pages = [
            MainEmbed("Page 1: Welcome to the paginator!"),
            SuccessEmbed(
                "Title 2", "Page 2: Here's some more content."
            ),
            MainEmbed("Page 3: Did you know this is a test?"),
            MainEmbed("Title 4", "Page 4: Almost halfway there!"),
            ErrorEmbed("Page 5: This is the fifth page."),
            "Some regular strings too.",
            "This is the second last page.",
            "This is the last page!"
        ]

        paginator = Paginator(
            interaction=interaction,
            pages=pages,
            home_page=home_page,
        )
        await paginator.start()

BaseView & BaseModal

The custom ui elements: BaseView & BaseModal extend discord.ui.View & discord.ui.Modal respectively while adding some additional features to them.

BaseView has some extra parameters which it can accept: disable_on_timeout & stop_on_timeout.

  • disable_on_timeout : This parameter controls weather to disable all children / items of a view once it times out.
  • stop_on_timeout : This parameter stops the view from listening to any further events associated to it once it times out.

Both BaseView & BaseModal have an error handler attached to them which is only enabled if disckit.UtilConfig.BUG_REPORT_CHANNEL attribute is defined.

BaseCog

BaseCog is just like a regular cog but it comes along with some basic logging which is executed on cog_load & cog_unload.

More

Other than these additions, the library is now finally properly typed and completely tested. If you do find any issues or errors, please make an issue or PR regarding it.

🦈

Full Changelog: v0.8...v0.9

disckit v0.8

17 Apr 15:20
Compare
Choose a tag to compare

This update introduces more precise static typing via basedpyright.

A lot more minor bug fixes and a new extension has been added (src\disckit\cogs\worker\owner_ids_handler.py)
You can load it using disckit.cogs.dis_load_extension(disckit.CogEnum.OWNER_IDS_HANDLER)

Removed attributes related to the LemmaTranslator in the disckit.UtilConfig and also it's related exception classes in disckit.errors

Full Changelog: v0.5...v0.8

PS: I forgot to draft a github release on other versions 🙏 , hopefully I remember to draft them from now onwards.

disckit v0.5

09 Jan 17:47
Compare
Choose a tag to compare

Disckit version 0.5 fixes many bug issues, mostly related to the error handler.

Along with that, class methods such as ErrorHandler.send_response and ErrorHandler.throw_err have been made to staticmethods so developers can manually raise and reply custom error messages.

Full Changelog: https://github.com/disutils/disckit/commits/v0.5

0