Struct discord_sdk::Discord [−][src]
pub struct Discord { /* fields omitted */ }
Implementations
pub async fn update_activity(
&self,
activity: impl Into<ActivityArgs>
) -> Result<Option<Activity>, Error>
pub async fn update_activity(
&self,
activity: impl Into<ActivityArgs>
) -> Result<Option<Activity>, Error>
pub async fn invite_user(
&self,
user_id: UserId,
message: impl Into<String>,
kind: ActivityActionKind
) -> Result<(), Error>
pub async fn invite_user(
&self,
user_id: UserId,
message: impl Into<String>,
kind: ActivityActionKind
) -> Result<(), Error>
Invites the specified User
to join the current
user’s game.
Errors
The current User
must have their presence updated
with all of the required fields
otherwise this call will fail.
Accepts the invite to another user’s activity.
pub async fn send_join_request_reply(
&self,
user_id: UserId,
reply: impl Into<JoinRequestReply>
) -> Result<(), Error>
pub async fn send_join_request_reply(
&self,
user_id: UserId,
reply: impl Into<JoinRequestReply>
) -> Result<(), Error>
Sends a reply to an Ask to Join request.
Searches available lobbies based on the search criteria
Deletes the specified lobby.
Connects to the specified lobby, which comprises 2 pieces of information, the lobby identifier, and the lobby secret.
Disconnects the current user from a lobby.
pub async fn send_lobby_message(
&self,
lobby_id: LobbyId,
data: LobbyMessage
) -> Result<(), Error>
pub async fn send_lobby_message(
&self,
lobby_id: LobbyId,
data: LobbyMessage
) -> Result<(), Error>
Opens or closes the overlay. If the overlay is not enabled this will instead focus the Discord app itself.
Opens the overlay modal for sending game invitations to users, channels, and servers.
Errors
If you do not have a valid activity with all the required fields, this call will error. See Activity Action Field Requirements for the fields required to have join and spectate invites function properly.
Opens the overlay modal for joining a Discord guild, given its invite code. Unlike the normal SDK, this method automatically parses the code from the provided string so you don’t need to do it yourself.
Note that just because the result might be Result::Ok
doesn’t
necessarily mean the user accepted the invite.
The regular Game SDK does not really expose this functionality directly, but rather exposed via the “on refresh” event as described in the docs.
Basically, this method should be used to bootstrap the relationships for
the current user, with updates to that list coming via the
RelationshipUpdate
event
Changes whether the local user is muted and/or deafened
Sets a new voice input mode for the user. Refer to Shortcut Keys for a table of valid values for shortcuts.
Mutes or unmutes the given user for the currently connected user.
Sets the local volume for a given user. This is the volume level at which the currently connected users hears the given user speak. Valid volume values are from 0 to 200, with 100 being the default. Lower than 100 will be a reduced volume level from default, whereas over 100 will be a boosted volume level from default.
pub fn new(
app: impl Into<DiscordApp>,
subscriptions: Subscriptions,
handler: Box<dyn DiscordHandler>
) -> Result<Self, Error>
pub fn new(
app: impl Into<DiscordApp>,
subscriptions: Subscriptions,
handler: Box<dyn DiscordHandler>
) -> Result<Self, Error>
Creates a new Discord connection for the specified application, providing
a DiscordHandler
which can handle events as they arrive from Discord
Disconnects from Discord, shutting down the tasks that have been created to handle sending and receiving messages from it.
Auto Trait Implementations
impl !RefUnwindSafe for Discord
impl !UnwindSafe for Discord
Blanket Implementations
Mutably borrows from an owned value. Read more
Attaches the provided Subscriber
to this type, returning a
WithDispatch
wrapper. Read more
Attaches the current default Subscriber
to this type, returning a
WithDispatch
wrapper. Read more