Skip to content

Commit 8987229

Browse files
authored
feat: add helper method to get the current user (#1183)
* feat: add helper method to get the current user * docs: sutff
1 parent bc00b54 commit 8987229

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

interactions/client/bot.py

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1806,6 +1806,14 @@ def _check(ctx: CommandContext):
18061806

18071807
return ctx, fields
18081808

1809+
async def get_self_user(self) -> User:
1810+
"""
1811+
.. versionadded:: 4.4.0
1812+
1813+
Gets the bot's user information.
1814+
"""
1815+
return User(**await self._http.get_self(), _client=self._http)
1816+
18091817

18101818
class Extension:
18111819
"""
@@ -1823,8 +1831,7 @@ class CoolCode(interactions.Extension):
18231831
def __init__(self, client):
18241832
self.client = client
18251833
1826-
@command(
1827-
type=interactions.ApplicationCommandType.USER,
1834+
@extension_user_command(
18281835
name="User command in cog",
18291836
)
18301837
async def cog_user_cmd(self, ctx):

0 commit comments

Comments
 (0)