interactions-py / interactions.py

A highly extensible, easy to use, and feature complete bot framework for Discord
https://interactions-py.github.io/interactions.py/
MIT License
833 stars 185 forks source link

fix: make ClientT covariant #1708

Closed AstreaTSS closed 2 months ago

AstreaTSS commented 2 months ago

Pull Request Type

Description

This PR makes ClientT covariant. This fixes a couple of typehinting issues I noticed, and... well, it makes sense for it to be covariant anyways, considering what it's meant for.

Changes

See description.

Related Issues

Test Scenarios

import interactions as ipy
from interactions.ext import prefixed_commands as prefixed

class MyBot(ipy.Client):
    pass

class MyContext(prefixed.PrefixedContext[MyBot]):
    pass

@prefixed.prefixed_command()
async def test(ctx: MyContext):
    await ctx.reply("Hi!")

bot = MyBot(...)
prefixed.setup(bot, prefixed_context=MyContext)  # here

Python Compatibility

Checklist