Bot API Reference¶
Client¶
-
class
shinkei.ext.bot.
BotClient
¶ -
add_handler
(handler)¶ Events are now handled by bot listeners so this method now raises a
NotImplementedError
.
-
remove_handler
(handler_name)¶ Events are now handled by bot listeners so this method now raises a
NotImplementedError
.
-
await
wait_for
(event, *, timeout=None, check=None)¶ Proxy to
discord.Client.wait_for()
.
-
await
broadcast
(data, *, target, nonce=None)¶ Send data to all clients which matches the predicates of the
target
query.Restricted clients cannot use this method.
-
await
close
()¶ Close the connection to singyeong.
Run this when cleaning up.
-
await
discover
(tags)¶ Discover an application id by it’s clients tags.
-
await
proxy_request
(method, route, *, target, body=None, headers=None)¶ Make a proxy HTTP request to a client.
- Parameters
method (
str
) – The HTTP method to use. Supports only POST, PATCH, PUT, DELETE, MOVE, GET and HEAD.route (
str
) – The route to make the request to.body (Optional[Union[
str
,dict
,list
]]) – The request body, silently ignored in GET and HEAD. If none is provided but the method requires one an empty string will be sent.target (
QueryBuilder
) – The query that is used to match the client.
- Returns
The HTTP response.
- Return type
- Raises
ValueError – An unsupported request method was passed.
ShinkeiHTTPException – The HTTP proxy request failed.
-
await
send
(data, *, target, nonce=None)¶ Send data to a client which matches the predicates of the
target
query.Restricted clients cannot use this method.
-
stream
(event, *, timeout=None, check=None, limit=None)¶ Return an async iterator which waits until an event is dispatched before continuing the iterations.
- Parameters
- Yields
Any – The return value of the event.
-
await
update_metadata
(data, *, cache=True)¶ Update metadata on singyeong.
The data is not consistent between server restarts but if
cache
is set toTrue
then it will persist between reconnects.- Parameters
- Raises
ShinkeiWSException – The metadata structure was invalid or a restricted key was used.
-