#VSC Pylance's is having issues by recognizing some functions

1 messages · Page 1 of 1 (latest)

stone ravine
crisp mistBOT
#

Hey! Once your issue is solved, press the button below to close this thread!

misty raven
#

The first screenshot is just a massive problem with pyright (pylance) and i.py typing. There are many more places like that
The second screenshot is just normal pyright behavior, where if it sees multiple possible types, it wants you to write logic to handle any type. You can try to find if this can be disabled or not in pyright config

stone ravine
#

thanks!

misty raven
#

Technically i.py typing can be rewritten to work with pyright, but I can't imagine how much work it will take with such aggressive, but very useful pyright checks

desert arrow
#

I used to have this problem, the way i fixed it was in vsc set the python interpreter to the version of python you use and make use on the computer you use to code have interactions installed for that version of python, setting up a developer environment makes that easier and once i did that it fixed all the type hinting problems with with i.py and pylance

#

hope that helps

sharp hornet
#

Both of these are accurate warnings. For the first, you'll need to check ctx.guild is not None, because it might be happening in DMs

#

For the second, you'll need to check that the channel is a channel that actually has text chat.

#

Because yeah, you can't send to a Category 😛

misty raven
#

The first one is still a problem, because when you set inside your bot/command "not_allowed_in_dms", you still need to check if guild exists everywhere

sharp hornet
#

Just throw in an assert ctx.guild is not None, and it'll be treated as a NOP when running your bot normally