Repository: Cog-Creators/Red-DiscordBot

Issue:
ERROR in streams, KeyError: 'partial_message'
### What Red version are you using?

3.4.9

### What were you trying to do?

Nothing.

### What did you expect to happen?

Nothing

### What actually happened?

```py
[10:50:53] ERROR    An error has occured with Streams. Please report it.                                                                                    [red.core.cogs.Streams]
╭─────────────────────────────────────────────────────────────────────── Traceback (most recent call last) ───────────────────────────────────────────────────────────────────────╮
│ /home/andolia/redenv/lib/python3.8/site-packages/redbot/cogs/streams/streams.py:749 in check_streams                                                                            │
│ ❱ 749                         embed, is_rerun = await stream.is_online()                                                                                                        │
│ /home/andolia/redenv/lib/python3.8/site-packages/redbot/cogs/streams/streamtypes.py:364 in is_online                                                                            │
│ ❱ 364                 raise OfflineStream()                                                                                                                                     │
╰─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯
OfflineStream:

During handling of the above exception, another exception occurred:

╭─────────────────────────────────────────────────────────────────────── Traceback (most recent call last) ───────────────────────────────────────────────────────────────────────╮
│ /home/andolia/redenv/lib/python3.8/site-packages/redbot/cogs/streams/streams.py:765 in check_streams                                                                            │
│ ❱ 765                         partial_msg = msg_data["partial_message"]                                                                                                         │
╰─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯
KeyError: 'partial_message'
```


### How can we reproduce this error?

I ssh'd onto my bot, and noticed this on the console.


### Anything else?

it seems to happen every 6-10 minutes, over and over.

Doesnt seem to have any negative impact on other bot features.


Discussion:

Resolving patch:
diff --git a/redbot/cogs/streams/streamtypes.py b/redbot/cogs/streams/streamtypes.py
--- a/redbot/cogs/streams/streamtypes.py
+++ b/redbot/cogs/streams/streamtypes.py
@@ -80,8 +80,10 @@ def iter_messages(self):
                 channel = guild and guild.get_channel(msg_data["channel"])
             else:
                 channel = self._bot.get_channel(msg_data["channel"])
-            if channel is not None:
-                data["partial_message"] = channel.get_partial_message(data["message"])
+
+            data["partial_message"] = (
+                channel.get_partial_message(data["message"]) if channel is not None else None
+            )
             yield data
 
     def export(self):


Test patch: