Skip to content

Commit 830aa2d

Browse files
committed
Added way to update commands to api
1 parent a92de74 commit 830aa2d

File tree

3 files changed

+34
-3
lines changed

3 files changed

+34
-3
lines changed

IreneAPIWrapper/__init__.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,4 @@
33
__title__ = "IreneAPIWrapper"
44
__author__ = "MujyKun"
55
__license__ = "MIT"
6-
__version__ = "2.3.2"
6+
__version__ = "2.3.3"

IreneAPIWrapper/models/client.py

+32-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
from IreneAPIWrapper.exceptions import InvalidToken, APIError
66
from IreneAPIWrapper.sections import outer as ref_outer_client
77
from typing import Union, Optional
8-
from IreneAPIWrapper.models import CallBack, callbacks, Preload
8+
from IreneAPIWrapper.models import CallBack, callbacks, Preload, basic_call
99

1010

1111
class IreneAPIClient:
@@ -263,6 +263,37 @@ async def disconnect(self):
263263
callback = CallBack(callback_type="disconnect", request=self._disconnect)
264264
await self.add_to_queue(callback)
265265

266+
async def update_commands(self, commands):
267+
"""
268+
Update the bot commands on the API side.
269+
270+
:param commands:
271+
A dictionary of commands. Example:
272+
{
273+
"Slash Commands": [
274+
{
275+
"name": "Moderator",
276+
"commands": [
277+
{
278+
"name": "/kick",
279+
"description": "Kicks a user.",
280+
"syntax": "/kick (user)",
281+
"permissionsNeeded": "Admin",
282+
"notes": "Can only be used by an admin.",
283+
}
284+
]
285+
},
286+
...
287+
}
288+
"""
289+
await basic_call(
290+
request={
291+
"route": "bot/commands",
292+
"commands": commands,
293+
"method": "PUT",
294+
}
295+
)
296+
266297

267298
class Logger:
268299
"""

pyproject.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[tool.poetry]
22
name = "IreneAPIWrapper"
3-
version = "2.3.2"
3+
version = "2.3.3"
44
description = "The Wrapper for the Websocket and REST API of Irene."
55
authors = ["MujyKun <[email protected]>"]
66
classifiers = [

0 commit comments

Comments
 (0)