GatewayBot.stream produces typing errors
See original GitHub issueSteps to reproduce
- Create a GatewayBot
- Open a stream (I have only tested with
InteractionCreateEvent
’s - With or without filter, they both give typing errors.
- Deprecated async or sync both produce these errors.
with bot.stream(hikari.InteractionCreateEvent, 120).filter(
lambda e: (
isinstance(e.interaction, hikari.ComponentInteraction)
and e.interaction.user == author
and e.interaction.message == message
)
) as stream:
for event in stream:
...
Expected result
Everything works as expected, without typing errors. This is the exact syntax used in the hikari examples.
Actual result
Everything works as expected except for when using filter this error is displayed:
Object of type "LazyIterator[InteractionCreateEvent]" cannot be used with "with" because it does not implement __enter__
and when not using filter:
"EventStream[InteractionCreateEvent]" is not iterable "__next__" method not defined on type "LazyIterator[InteractionCreateEvent]"
System info
hikari (2.0.0.dev104) [79548984]
located at /home/projects/hikari-lightbulb/.venv/lib/python3.10/site-packages/hikari
CPython 3.10.0 GCC 11.1.0
Linux love 5.10.79-1-lts #1 SMP Fri, 12 Nov 2021 19:04:00 +0000 x86_64
Further info
We discussed this briefly, but I wanted to get it onto the issue tracker as it’s quite annoying.
Checklist
- I have made sure to remove ANY sensitive information (bot token, passwords, credentials, personal details, etc.).
- I have searched the issue tracker and have made sure it’s not a duplicate. If it is a follow up of another issue, I have specified it.
Issue Analytics
- State:
- Created 2 years ago
- Comments:6 (6 by maintainers)
Top Results From Across the Web
2 - Stack Overflow
I'm working with a Discord bot using the node.js module discord.js. Recently an error appears on start up (when the bot attempts to...
Read more >hikari-py/hikari: A Discord API wrapper for Python ... - GitHub
An opinionated, static typed Discord microframework for Python3 and asyncio that supports Discord's v10 REST and Gateway APIs. Built on good intentions and ......
Read more >Voice.AI Gateway Bot API Reference - AudioCodes
The Voice.AI Gateway creates a new conversation by using a pre-configured URL. 2. The reply contains URLs for posting messages to the ...
Read more >Search - appsloveworld.com
Coding example for the question FetchError: request to https://discordapp.com/api/v7/gateway/bot failed, reason: read ECONNRESET-discord.js.
Read more >Gateway Intents - discord.js Guide
Intents are named groups of pre-defined WebSocket events, which the discord.js client will receive. If you omit DirectMessageTyping , for ...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
You are correct about that, it should be async for event in stream. That does not resolve the issue though.
Closed by #917