Repository: hikari-py/hikari
Pull request #1653 (2023-07-10 21:27:43)

Support text in stage channels
### Summary
<!-- Small summary of the merge request -->
Support text in stage channels

### Checklist
<!-- Make sure to tick all the following boxes by putting an `x` in between (like this `[x]`) -->
- [x] I have run `nox` and all the pipelines have passed.
- [x] I have made unittests according to the code I have added/modified/deleted.

### Related issues
<!--
To mention an issue use `#issue-id` and to mention a merge request use `!merge-request-id`
To close/fix an issue use `Close #issue-id` or `Fix #issue-id` (depending on the merge request)
-->



Patch:
diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml
index 67775e08..67a25b3f 100644
--- a/.github/workflows/ci.yml
+++ b/.github/workflows/ci.yml
@@ -86,7 +86,7 @@ jobs:
           coverage report
 
       - name: Upload coverage to codeclimate
-        uses: paambaati/codeclimate-action@v4.0.0
+        uses: paambaati/codeclimate-action@v5.0.0
         env:
           CC_TEST_REPORTER_ID: d40e64ea0ff74713f79365fea4378ab51a2141ad4fcf0fb118496bbf560d4192
         with:
diff --git a/changes/1653.bugfix.md b/changes/1653.bugfix.md
new file mode 100644
index 00000000..67d9e115
--- /dev/null
+++ b/changes/1653.bugfix.md
@@ -0,0 +1,1 @@
+Add support for text in stage channels
diff --git a/dev-requirements/formatting.txt b/dev-requirements/formatting.txt
index 72fde7f1..e49a07bd 100644
--- a/dev-requirements/formatting.txt
+++ b/dev-requirements/formatting.txt
@@ -1,2 +1,2 @@
-black==23.3.0
+black==23.7.0
 isort==5.12.0
diff --git a/dev-requirements/pyright.txt b/dev-requirements/pyright.txt
index d023f962..9bbcd6a1 100644
--- a/dev-requirements/pyright.txt
+++ b/dev-requirements/pyright.txt
@@ -1,1 +1,1 @@
-pyright==1.1.316
+pyright==1.1.317
diff --git a/hikari/channels.py b/hikari/channels.py
index 75d3cde6..7c7519d6 100644
--- a/hikari/channels.py
+++ b/hikari/channels.py
@@ -1367,7 +1367,7 @@ class GuildVoiceChannel(PermissibleGuildChannel, TextableGuildChannel):
 
 
 @attrs.define(hash=True, kw_only=True, weakref_slot=False)
-class GuildStageChannel(PermissibleGuildChannel):
+class GuildStageChannel(PermissibleGuildChannel, TextableGuildChannel):
     """Represents a stage channel."""
 
     bitrate: int = attrs.field(eq=False, hash=False, repr=True)
@@ -1387,6 +1387,14 @@ class GuildStageChannel(PermissibleGuildChannel):
     If this is `0`, then assume no limit.
     """
 
+    last_message_id: typing.Optional[snowflakes.Snowflake] = attrs.field(eq=False, hash=False, repr=False)
+    """The ID of the last message sent in this channel.
+
+    .. warning::
+        This might point to an invalid or deleted message. Do not assume that
+        this will always be valid.
+    """
+
 
 @typing.final
 class ForumSortOrderType(int, enums.Enum):
diff --git a/hikari/impl/entity_factory.py b/hikari/impl/entity_factory.py
index 031cfe11..d6369063 100644
--- a/hikari/impl/entity_factory.py
+++ b/hikari/impl/entity_factory.py
@@ -1173,6 +1173,7 @@ def deserialize_guild_stage_channel(
             snowflakes.Snowflake(overwrite["id"]): self.deserialize_permission_overwrite(overwrite)
             for overwrite in payload["permission_overwrites"]
         }
+        last_message_id = snowflakes.Snowflake(payload["last_message_id"]) if "last_message_id" in payload else None
         return channel_models.GuildStageChannel(
             app=self._app,
             id=channel_fields.id,
@@ -1186,6 +1187,7 @@ def deserialize_guild_stage_channel(
             bitrate=int(payload["bitrate"]),
             user_limit=int(payload["user_limit"]),
             position=int(payload["position"]),
+            last_message_id=last_message_id,
         )
 
     def deserialize_guild_forum_channel(


Test patch:
diff --git a/dev-requirements/pytest.txt b/dev-requirements/pytest.txt
index e6753936..c0fa0228 100644
--- a/dev-requirements/pytest.txt
+++ b/dev-requirements/pytest.txt
@@ -1,10 +1,10 @@
 # mock in the stdlib changes between versions of Python, so are not consistent in behaviour like the backport is
-mock==5.0.2
+mock==5.1.0
 
 pytest==7.4.0
-pytest-asyncio==0.21.0
+pytest-asyncio==0.21.1
 pytest-cov==4.1.0
-pytest-randomly==3.12.0
+pytest-randomly==3.13.0
 
 async-timeout==4.0.2  # Used for timeouts in some test cases.
 
diff --git a/tests/hikari/impl/test_entity_factory.py b/tests/hikari/impl/test_entity_factory.py
index 1706e820..9ad10d49 100644
--- a/tests/hikari/impl/test_entity_factory.py
+++ b/tests/hikari/impl/test_entity_factory.py
@@ -1999,6 +1999,7 @@ def guild_stage_channel_payload(self, permission_overwrite_payload):
             "user_limit": 3,
             "rtc_region": "euoo",
             "parent_id": "543",
+            "last_message_id": "1000101",
         }
 
     def test_deserialize_guild_stage_channel(
@@ -2018,6 +2019,7 @@ def test_deserialize_guild_stage_channel(
         assert voice_channel.region == "euoo"
         assert voice_channel.bitrate == 64000
         assert voice_channel.user_limit == 3
+        assert voice_channel.last_message_id == 1000101
         assert isinstance(voice_channel, channel_models.GuildStageChannel)
 
     def test_deserialize_guild_stage_channel_with_null_fields(self, entity_factory_impl):
@@ -2034,10 +2036,12 @@ def test_deserialize_guild_stage_channel_with_null_fields(self, entity_factory_i
                 "user_limit": 3,
                 "rtc_region": None,
                 "type": 6,
+                "last_message_id": None,
             }
         )
         assert voice_channel.parent_id is None
         assert voice_channel.region is None
+        assert voice_channel.last_message_id is None
 
     def test_deserialize_guild_stage_channel_with_unset_fields(self, entity_factory_impl):
         voice_channel = entity_factory_impl.deserialize_guild_stage_channel(
@@ -2055,6 +2059,7 @@ def test_deserialize_guild_stage_channel_with_unset_fields(self, entity_factory_
         )
         assert voice_channel.parent_id is None
         assert voice_channel.is_nsfw is False
+        assert voice_channel.last_message_id is None
 
     @pytest.fixture()
     def guild_forum_channel_payload(self, permission_overwrite_payload):