Jump to conversation
Unresolved conversations (0)
Nice work!

Nice work!

All of your conversations have been resolved.

Resolved conversations (23)
@Cadair Cadair Aug 6, 2020
I think `id` should just be `linked_event` which is in the base `Event` class.
Outdated
opsdroid/events.py
FabioRosado
@Cadair Cadair Aug 3, 2020
have you considered using our handy [`EventCreator`](https://github.com/opsdroid/opsdroid/blob/master/opsdroid/events.py#L19) to replace this list of ifs?
opsdroid/connector/twitch/__init__.py
Cadair FabioRosado
jacobtomlinson
@Cadair Cadair Aug 3, 2020
Ban user should also be a core event.
Outdated
docs/connectors/twitch.md
@Cadair Cadair Aug 3, 2020
DeleteMessage is certainly generic enough it should be a core event
Outdated
docs/connectors/twitch.md
Cadair FabioRosado
@Cadair Cadair Aug 3, 2020
Isn't there a core event for this? https://github.com/opsdroid/opsdroid/blob/master/opsdroid/events.py#L451
Outdated
docs/connectors/twitch.md
FabioRosado
@Cadair Cadair Aug 3, 2020
@jacobtomlinson is correct these need to be double backticks, also I would put a space after the close backticks.
Outdated
opsdroid/connector/twitch/__init__.py
@jacobtomlinson jacobtomlinson Aug 3, 2020
```suggestion For stream changes a lot more things are returned but we only really care about `type`(if live/offline) `title`(stream title). ```
Outdated
opsdroid/connector/twitch/__init__.py
@jacobtomlinson jacobtomlinson Aug 3, 2020
```suggestion `to_id`(follower id), `to_name`(follower name) and `followed_at`(timestamp). ```
Outdated
opsdroid/connector/twitch/__init__.py
@FabioRosado FabioRosado Jun 12, 2020
Apparently when I do `raise aiohttp.ServerDisconnectedError` inside the `get_messages_loop` this will throw an "exception not caught", I would expect that the try/catch inside the `listen` method should handle that but doesn't seem like it. So I might have to re-raise the same exception here, what do you think about it? 🤔 --EDIT-- After playing around and testing things out I'm still getting the same problem. So the connection is re-started after Twitch closes the connection the first time, but then when Twitch closes the connection the second time that's when the exception isn't caught. I'm assuming that the problem might be because that loop is still running? <details> <summary><i>This is the Traceback that I'm getting - changed the raise for ConnectionError</i></summary> ```python INFO opsdroid.connector.twitch: Exception INFO opsdroid.connector.twitch: Connecting to Twitch IRC Server. DEBUG opsdroid.connector.twitch: Got message from Twitch Connector chat - :tmi.twitch.tv 001 theflyingdev :Welcome, GLHF! :tmi.twitch.tv 002 theflyingdev :Your host is tmi.twitch.tv :tmi.twitch.tv 003 theflyingdev :This server is rather new :tmi.twitch.tv 004 theflyingdev :- :tmi.twitch.tv 375 theflyingdev :- :tmi.twitch.tv 372 theflyingdev :You are in a maze of twisty passages, all alike. :tmi.twitch.tv 376 theflyingdev :> DEBUG opsdroid.connector.twitch: Got message from Twitch Connector chat - :theflyingdev!theflyingdev@theflyingdev.tmi.twitch.tv JOIN #theflyingdev :theflyingdev.tmi.twitch.tv 353 theflyingdev = #theflyingdev :theflyingdev :theflyingdev.tmi.twitch.tv 366 theflyingdev #theflyingdev :End of /NAMES list DEBUG opsdroid.connector.twitch: Got message from Twitch Connector chat - :tmi.twitch.tv CAP * ACK :twitch.tv/commands :tmi.twitch.tv CAP * ACK :twitch.tv/tags DEBUG opsdroid.connector.twitch: Got message from Twitch Connector chat - :tmi.twitch.tv CAP * ACK :twitch.tv/membership DEBUG opsdroid.connector.twitch: Got message from Twitch Connector chat - :universe!universe@universe.tmi.twitch.tv JOIN #theflyingdev :agressive_sock!agressive_sock@agressive_sock.tmi.twitch.tv JOIN #theflyingdev :anotherttvviewer!anotherttvviewer@anotherttvviewer.tmi.twitch.tv JOIN #theflyingdev :hotlocalmom!hotlocalmom@hotlocalmom.tmi.twitch.tv JOIN #theflyingdev :lurxx!lurxx@lurxx.tmi.twitch.tv JOIN #theflyingdev :nicholsstand!nicholsstand@nicholsstand.tmi.twitch.tv JOIN #theflyingdev :streamelements!streamelements@streamelements.tmi.twitch.tv JOIN #theflyingdev DEBUG opsdroid.connector.twitch: Got message from Twitch Connector chat - :lauradesk!lauradesk@lauradesk.tmi.twitch.tv JOIN #theflyingdev :nicholsstand!nicholsstand@nicholsstand.tmi.twitch.tv PART #theflyingdev DEBUG opsdroid.connector.twitch: Got message from Twitch Connector chat - :nicholsstand!nicholsstand@nicholsstand.tmi.twitch.tv JOIN #theflyingdev DEBUG opsdroid.connector.twitch: Got message from Twitch Connector chat - PING :tmi.twitch.tv DEBUG opsdroid.connector.twitch: Got message from Twitch Connector chat - PING :tmi.twitch.tv DEBUG opsdroid.connector.twitch: Got message from Twitch Connector chat - :nicholsstand!nicholsstand@nicholsstand.tmi.twitch.tv PART #theflyingdev DEBUG asyncio: Using selector: KqueueSelector Traceback (most recent call last): File "/Users/fabiorosado/Documents/GitHub.tmp/opsdroid/opsdroid/connector/twitch/__init__.py", line 517, in listen await self.connect_websocket() File "/Users/fabiorosado/Documents/GitHub.tmp/opsdroid/opsdroid/connector/twitch/__init__.py", line 278, in connect_websocket await self.get_messages_loop() File "/Users/fabiorosado/Documents/GitHub.tmp/opsdroid/opsdroid/connector/twitch/__init__.py", line 541, in get_messages_loop raise ConnectionError ConnectionError During handling of the above exception, another exception occurred: Traceback (most recent call last): File "/usr/local/Cellar/python/3.7.6_1/Frameworks/Python.framework/Versions/3.7/lib/python3.7/runpy.py", line 193, in _run_module_as_main "__main__", mod_spec) File "/usr/local/Cellar/python/3.7.6_1/Frameworks/Python.framework/Versions/3.7/lib/python3.7/runpy.py", line 85, in _run_code exec(code, run_globals) File "/Users/fabiorosado/Documents/GitHub.tmp/opsdroid/opsdroid/__main__.py", line 12, in <module> init() File "/Users/fabiorosado/Documents/GitHub.tmp/opsdroid/opsdroid/__main__.py", line 9, in init opsdroid.cli.cli() File "/Users/fabiorosado/.local/share/virtualenvs/opsdroid-AmeH9qot/lib/python3.7/site-packages/click/core.py", line 829, in __call__ return self.main(*args, **kwargs) File "/Users/fabiorosado/.local/share/virtualenvs/opsdroid-AmeH9qot/lib/python3.7/site-packages/click/core.py", line 782, in main rv = self.invoke(ctx) File "/Users/fabiorosado/.local/share/virtualenvs/opsdroid-AmeH9qot/lib/python3.7/site-packages/click/core.py", line 1259, in invoke return _process_result(sub_ctx.command.invoke(sub_ctx)) File "/Users/fabiorosado/.local/share/virtualenvs/opsdroid-AmeH9qot/lib/python3.7/site-packages/click/core.py", line 1066, in invoke return ctx.invoke(self.callback, **ctx.params) File "/Users/fabiorosado/.local/share/virtualenvs/opsdroid-AmeH9qot/lib/python3.7/site-packages/click/core.py", line 610, in invoke return callback(*args, **kwargs) File "/Users/fabiorosado/Documents/GitHub.tmp/opsdroid/opsdroid/cli/start.py", line 43, in start opsdroid.run() File "/Users/fabiorosado/Documents/GitHub.tmp/opsdroid/opsdroid/core.py", line 169, in run self.eventloop.run_until_complete(asyncio.gather(*pending)) File "/usr/local/Cellar/python/3.7.6_1/Frameworks/Python.framework/Versions/3.7/lib/python3.7/asyncio/base_events.py", line 583, in run_until_complete return future.result() File "/Users/fabiorosado/Documents/GitHub.tmp/opsdroid/opsdroid/connector/twitch/__init__.py", line 520, in listen await self.connect_websocket() File "/Users/fabiorosado/Documents/GitHub.tmp/opsdroid/opsdroid/connector/twitch/__init__.py", line 278, in connect_websocket await self.get_messages_loop() File "/Users/fabiorosado/Documents/GitHub.tmp/opsdroid/opsdroid/connector/twitch/__init__.py", line 541, in get_messages_loop raise ConnectionError ConnectionError ERROR: Unhandled exception in opsdroid, exiting... ``` </details> So you can see that it got the exception, tried to reconnect, got stuff from the websocket and THEN the exception happened. Might need to re-think the whole reconnect method 🤷‍♂️
opsdroid/connector/twitch/__init__.py
FabioRosado
@jacobtomlinson jacobtomlinson Jun 4, 2020
I don't think users will care about details like opsdroid subscribing to three webhooks. They will just case about the kind of events that will come down the connector.
Outdated
docs/connectors/twitch.md
@jacobtomlinson jacobtomlinson Jun 4, 2020
Does the user need to do this themselves, or can the connector handle this for them?
docs/connectors/twitch.md
jacobtomlinson
@jacobtomlinson jacobtomlinson Jun 4, 2020
In the GitHub connector rewrite I've added a `base-url` configuration option to the `web` config, so I would quite like to use that consistently between connectors. More and more connectors are moving to this model so it would be good to configure it in one place. ```yaml web: base-url: https://url-to-opsdroid.com ```
docs/connectors/twitch.md
jacobtomlinson
@jacobtomlinson jacobtomlinson Jun 4, 2020
I would maybe change the example values to something like `MYTWITCHCODE`, `MYCLIENTID`, `MYCLIENTSECRET`, etc.
Outdated
docs/connectors/twitch.md
@jacobtomlinson jacobtomlinson May 26, 2020
Should this URL be a constant too?
Outdated
opsdroid/connector/twitch/__init__.py
@jacobtomlinson jacobtomlinson May 26, 2020
I would reconnect and then return here. That way you go round the `while self.listening` loop and come back in at the top of the try again. Otherwise if the next `self.websocket.recv` also gets a `websockets.ConnectionClosed` exception it will not be caught. ```suggestion await self.reconnect() return else: ```
Outdated
opsdroid/connector/twitch/__init__.py
@jacobtomlinson jacobtomlinson May 26, 2020
You don't seem to be parsing this event.
opsdroid/connector/twitch/__init__.py
@jacobtomlinson jacobtomlinson May 26, 2020
If the list is only ever one item it is more Pythonic to unpack at assingment like this ```suggestion [data] = payload.get('data') ```
Outdated
opsdroid/connector/twitch/__init__.py
@jacobtomlinson jacobtomlinson May 26, 2020
Maybe log here to show the user the challenge failed.
opsdroid/connector/twitch/__init__.py
@jacobtomlinson jacobtomlinson May 26, 2020
These should be in the `connect` method. The `__init__` shouldn't do anything other than setting attributes of the instance.
Outdated
opsdroid/connector/twitch/__init__.py
@jacobtomlinson jacobtomlinson May 26, 2020
I recommend changing this to >=400 as there are many valid reasons why you would get a non 200 error with a valid response body. A temporary redirect for example. ```suggestion if response.status >= 400: ```
Outdated
opsdroid/connector/twitch/__init__.py
@jacobtomlinson jacobtomlinson May 26, 2020
The `login` here should probably also be passed as a parameter. That way special characters will be handled for you.
Outdated
opsdroid/connector/twitch/__init__.py
@jacobtomlinson jacobtomlinson May 26, 2020
Have you seen the [docs on passing URL paramaters with aiohttp](https://docs.aiohttp.org/en/stable/client_quickstart.html#passing-parameters-in-urls)? You don't need to build urls like this, you can pass a dictionary of parameters in the `get` method and it will do it for you.
Outdated
opsdroid/connector/twitch/__init__.py
@jacobtomlinson jacobtomlinson May 26, 2020
These should probably be in your [global .gitignore](https://stackoverflow.com/a/7335487/1003288)
Outdated
.gitignore
FabioRosado