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

[BUG] WARNING:interactions:Class `ChannelType` received an invalid and unexpected value `Missing`, a new enum item will be created to represent this value. #1707

Closed bakert closed 2 months ago

bakert commented 2 months ago

Library Version

5.12.1

Describe the Bug

Looking for a channel that doesn't exist the library emits this message:

WARNING:interactions:Class `ChannelType` received an invalid and unexpected value `Missing`, a new enum item will be created to represent this value. Please update interactions.py or report this issue on GitHub - https://github.com/interactions-py/interactions.py/issues

Steps to Reproduce

from interactions import Extension

class BackgroundTasks(Extension):
    @listen()
    async def on_startup(self) -> None:
        await self.prepare_tournaments()

        async def prepare_tournaments(self) -> None:
            tournament_channel_id = 1 # An int, but not one that corresponds to a real channel on the current server.
            channel = await self.bot.fetch_channel(tournament_channel_id)

Expected Results

No warning about an enum when running this code.

Minimal Reproducible Code

from interactions import Extension

class BackgroundTasks(Extension):
    @listen()
    async def on_startup(self) -> None:
        await self.prepare_tournaments()

        async def prepare_tournaments(self) -> None:
            tournament_channel_id = 1 # An int, but not one that corresponds to a real channel on the current server.
            channel = await self.bot.fetch_channel(tournament_channel_id)


### Traceback

_No response_

### Checklist

- [X] I have searched the open issues for duplicates.
- [X] I have shown the entire traceback, if possible.
- [X] I have removed my token from display, if visible.
- [X] I have attempted to debug this myself, and I believe this issue is with the library

### Additional Information

_No response_
AstreaTSS commented 2 months ago

This happens thanks to the fallback code for fetching channels, and so I'm calling this working as intended.

bakert commented 2 months ago

Should probably remove the message asking people to report it?

Please update interactions.py or report this issue on GitHub - https://github.com/interactions-py/interactions.py/issues

AstreaTSS commented 2 months ago

This would unfortunately have unintended side effects since that message is used in a variety of cases. Even adding a special case for Missing could cause issues with things slipping by when they shouldn't.

I believe I've argued for the "report this issue" part to be removed from the general message a long time ago, but to be fair, we usually do need to add what values they have.

AstreaTSS commented 2 months ago

No idea why it reopened, reclosing.