Interface IDiscordRestUser
Contains all the API calls mentioned in the user documentation. Docs: https://discord.com/developers/docs/resources/user
Namespace: Color_Chan.Discord.Core.Common.API.Rest
Assembly: Color-Chan.Discord.Core.dll
Syntax
public interface IDiscordRestUser
Methods
| Improve this Doc View SourceCreateDm(DiscordCreateDm, CancellationToken)
Creates a new DM channel with a user.
Declaration
Task<Result<IDiscordChannel>> CreateDm(DiscordCreateDm createDm, CancellationToken ct = default(CancellationToken))
Parameters
Type | Name | Description |
---|---|---|
DiscordCreateDm | createDm | The DiscordCreateDm containing the recipient ID. |
System.Threading.CancellationToken | ct | The System.Threading.CancellationToken. |
Returns
Type | Description |
---|---|
System.Threading.Tasks.Task<Result<IDiscordChannel>> | A Result<T> of IDiscordChannel with the request results. |
Remarks
You should not use this endpoint to DM everyone in a server about something. DMs should generally be initiated by a user action. If you open a significant amount of DMs too quickly, your bot may be rate limited or blocked from opening new ones.
CreateDmGroup(DiscordCreateDmGroup, CancellationToken)
Create a new group DM channel with multiple users.
Declaration
Task<Result<IDiscordChannel>> CreateDmGroup(DiscordCreateDmGroup createDm, CancellationToken ct = default(CancellationToken))
Parameters
Type | Name | Description |
---|---|---|
DiscordCreateDmGroup | createDm | The DiscordCreateDmGroup containing all the members data for the group. |
System.Threading.CancellationToken | ct | The System.Threading.CancellationToken. |
Returns
Type | Description |
---|---|
System.Threading.Tasks.Task<Result<IDiscordChannel>> | A Result<T> of IDiscordChannel with the request results. |
Remarks
This endpoint is limited to 10 active group DMs.
GetCurrentUser(CancellationToken)
Get the user object of the requesters account. For OAuth2, this requires the identify scope, which will return the object without an email, and optionally the email scope, which returns the object with an email.
Declaration
Task<Result<IDiscordUser>> GetCurrentUser(CancellationToken ct = default(CancellationToken))
Parameters
Type | Name | Description |
---|---|---|
System.Threading.CancellationToken | ct | The System.Threading.CancellationToken. |
Returns
Type | Description |
---|---|
System.Threading.Tasks.Task<Result<IDiscordUser>> | A Result<T> of IDiscordUser with the request results. |
GetCurrentUserGuildMember(UInt64, CancellationToken)
Get a IDiscordGuildMember of the current user for a specific guild.
Declaration
Task<Result<IDiscordGuildMember>> GetCurrentUserGuildMember(ulong guildId, CancellationToken ct = default(CancellationToken))
Parameters
Type | Name | Description |
---|---|---|
System.UInt64 | guildId | The ID of the guild. |
System.Threading.CancellationToken | ct | The System.Threading.CancellationToken. |
Returns
Type | Description |
---|---|
System.Threading.Tasks.Task<Result<IDiscordGuildMember>> | A Result<T> of IDiscordGuildMember with the request results. |
Remarks
Requires the guilds.members.read OAuth2 scope.
GetCurrentUserGuilds(CancellationToken)
Get a list of IDiscordPartialGuilds objects the current suer is a member off.
Declaration
Task<Result<IReadOnlyList<IDiscordPartialGuild>>> GetCurrentUserGuilds(CancellationToken ct = default(CancellationToken))
Parameters
Type | Name | Description |
---|---|---|
System.Threading.CancellationToken | ct | The System.Threading.CancellationToken. |
Returns
Type | Description |
---|---|
System.Threading.Tasks.Task<Result<System.Collections.Generic.IReadOnlyList<IDiscordPartialGuild>>> | A Result<T> of IDiscordPartialGuilds with the request results. |
Remarks
Requires the guilds OAuth2 scope.
GetUser(UInt64, CancellationToken)
Get a user with their userId
.
Declaration
Task<Result<IDiscordUser>> GetUser(ulong userId, CancellationToken ct = default(CancellationToken))
Parameters
Type | Name | Description |
---|---|---|
System.UInt64 | userId | The ID of the user. |
System.Threading.CancellationToken | ct | The System.Threading.CancellationToken. |
Returns
Type | Description |
---|---|
System.Threading.Tasks.Task<Result<IDiscordUser>> | A Result<T> of IDiscordUser with the request results. |
GetUserConnections(CancellationToken)
Get a list of IDiscordConnection objects.
Declaration
Task<Result<IReadOnlyList<IDiscordConnection>>> GetUserConnections(CancellationToken ct = default(CancellationToken))
Parameters
Type | Name | Description |
---|---|---|
System.Threading.CancellationToken | ct | The System.Threading.CancellationToken. |
Returns
Type | Description |
---|---|
System.Threading.Tasks.Task<Result<System.Collections.Generic.IReadOnlyList<IDiscordConnection>>> | A Result<T> of IDiscordConnections with the request results. |
Remarks
Requires the connections OAuth2 scope.
LeaveGuild(UInt64, CancellationToken)
Leave a guild.
Declaration
Task<Result> LeaveGuild(ulong guildId, CancellationToken ct = default(CancellationToken))
Parameters
Type | Name | Description |
---|---|---|
System.UInt64 | guildId | The ID of the guild that the current user will leave. |
System.Threading.CancellationToken | ct | The System.Threading.CancellationToken. |
Returns
Type | Description |
---|---|
System.Threading.Tasks.Task<Result> | A Result containing the request results. |
ModifyCurrentUser(DiscordModifyCurrentUser, CancellationToken)
Modify the current user.
Declaration
Task<Result<IDiscordUser>> ModifyCurrentUser(DiscordModifyCurrentUser modifyCurrentUser, CancellationToken ct = default(CancellationToken))
Parameters
Type | Name | Description |
---|---|---|
DiscordModifyCurrentUser | modifyCurrentUser | The data used to modify the current user. |
System.Threading.CancellationToken | ct | The System.Threading.CancellationToken. |
Returns
Type | Description |
---|---|
System.Threading.Tasks.Task<Result<IDiscordUser>> | A Result<T> of IDiscordUser with the request results. |