Repository: hikari-py/hikari
Pull request #776 (2021-09-06 05:09:32)

Add ApplicationCommand.version
### Summary
<!-- Small summary of the merge request -->

### 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/hikari/commands.py b/hikari/commands.py
index 0f38242a..cc42d500 100644
--- a/hikari/commands.py
+++ b/hikari/commands.py
@@ -181,6 +181,9 @@ class Command(snowflakes.Unique):
     This will be `builtins.None` if this is a global command.
     """
 
+    version: snowflakes.Snowflake = attr.field(eq=False, hash=False, repr=True)
+    """Auto-incrementing version identifier updated during substantial record changes."""
+
     async def fetch_self(self) -> Command:
         """Fetch an up-to-date version of this command object.
 
diff --git a/hikari/impl/entity_factory.py b/hikari/impl/entity_factory.py
index a3f011eb..58a3d908 100644
--- a/hikari/impl/entity_factory.py
+++ b/hikari/impl/entity_factory.py
@@ -1696,6 +1696,7 @@ def deserialize_command(
             options=options,
             default_permission=payload.get("default_permission", True),
             guild_id=guild_id,
+            version=snowflakes.Snowflake(payload["version"]),
         )
 
     def deserialize_guild_command_permissions(
diff --git a/hikari/messages.py b/hikari/messages.py
index aea92c6a..68064421 100644
--- a/hikari/messages.py
+++ b/hikari/messages.py
@@ -133,12 +133,15 @@ class MessageType(int, enums.Enum):
     REPLY = 19
     """A message that replies to another message."""
 
-    APPLICATION_COMMAND = 20
-    """A message sent to indicate a application command has been executed."""
+    CHAT_INPUT = 20
+    """A message sent to indicate a chat input application command has been executed."""
 
     GUILD_INVITE_REMINDER = 22
     """A message sent to remind to invite people to the guild."""
 
+    CONTEXT_MENU_COMMAND = 23
+    """A message sent to indicate a context menu has been executed."""
+
 
 @typing.final
 class MessageFlag(enums.Flag):
diff --git a/hikari/permissions.py b/hikari/permissions.py
index 9dce0f4e..667113b3 100644
--- a/hikari/permissions.py
+++ b/hikari/permissions.py
@@ -270,6 +270,9 @@ class Permissions(enums.Flag):
     USE_PRIVATE_THREADS = 1 << 36
     """Allows for creating and participating in private threads."""
 
+    USE_EXTERNAL_STICKERS = 1 << 37
+    """Allows the usage of custom stickers from other servers."""
+
     @classmethod
     def all_permissions(cls) -> Permissions:
         """Get an instance of `Permissions` with all the known permissions.


Test patch:
diff --git a/tests/hikari/impl/test_entity_factory.py b/tests/hikari/impl/test_entity_factory.py
index a0fe3e1c..99b58e84 100644
--- a/tests/hikari/impl/test_entity_factory.py
+++ b/tests/hikari/impl/test_entity_factory.py
@@ -2717,6 +2717,7 @@ def command_payload(self):
                     ],
                 }
             ],
+            "version": "123321123",
         }
 
     def test_deserialize_command(self, entity_factory_impl, mock_app, command_payload):
@@ -2729,6 +2730,7 @@ def test_deserialize_command(self, entity_factory_impl, mock_app, command_payloa
         assert command.name == "good name"
         assert command.description == "very good description"
         assert command.default_permission is False
+        assert command.version == 123321123
 
         # CommandOption
         assert len(command.options) == 1
@@ -2766,6 +2768,7 @@ def test_deserialize_command_with_passed_through_guild_id(self, entity_factory_i
             "name": "good name",
             "description": "very good description",
             "options": [],
+            "version": "123312",
         }
 
         command = entity_factory_impl.deserialize_command(payload, guild_id=123123)
@@ -2780,6 +2783,7 @@ def test_deserialize_command_with_null_and_unset_values(self, entity_factory_imp
             "name": "good name",
             "description": "very good description",
             "options": [],
+            "version": "43123",
         }
 
         command = entity_factory_impl.deserialize_command(payload)
diff --git a/tests/hikari/test_commands.py b/tests/hikari/test_commands.py
index 9e0716ad..f197ca0d 100644
--- a/tests/hikari/test_commands.py
+++ b/tests/hikari/test_commands.py
@@ -45,6 +45,7 @@ def mock_command(self, mock_app):
             options=[],
             guild_id=snowflakes.Snowflake(31231235),
             default_permission=False,
+            version=snowflakes.Snowflake(43123123),
         )
 
     @pytest.mark.asyncio()
diff --git a/tests/hikari/test_permissions.py b/tests/hikari/test_permissions.py
index 409a1b61..feb2a4ac 100644
--- a/tests/hikari/test_permissions.py
+++ b/tests/hikari/test_permissions.py
@@ -27,4 +27,4 @@ def test_all_permissions(self):
         all_perms = permissions.Permissions.all_permissions()
 
         assert isinstance(all_perms, permissions.Permissions)
-        assert all_perms == 128849018879
+        assert all_perms == 266287972351