public static string Channel(long channelId) => $"channels/{channelId}";
public static string ChannelInvites(long channelId) => $"channels/{channelId}/invites";
public static string ChannelMessages(long channelId) => $"channels/{channelId}/messages";
public static string ChannelMessages(long channelId, int limit) => $"channels/{channelId}/messages?limit={limit}";
public static string ChannelMessages(long channelId, int limit, long relativeId, string relativeDir) => $"channels/{channelId}/messages?limit={limit}&{relativeDir}={relativeId}";
public static string ChannelMessage(long channelId, long msgId) => $"channels/{channelId}/messages/{msgId}";
public static string ChannelMessageAck(long channelId, long msgId) => $"channels/{channelId}/messages/{msgId}/ack";
public static string ChannelPermission(long channelId, long userOrRoleId) => $"channels/{channelId}/permissions/{userOrRoleId}";
public static string ChannelTyping(long channelId) => $"channels/{channelId}/typing";
public static string Channel(ulong channelId) => $"channels/{channelId}";
public static string ChannelInvites(ulong channelId) => $"channels/{channelId}/invites";
public static string ChannelMessages(ulong channelId) => $"channels/{channelId}/messages";
public static string ChannelMessages(ulong channelId, int limit) => $"channels/{channelId}/messages?limit={limit}";
public static string ChannelMessages(ulong channelId, int limit, ulong relativeId, string relativeDir) => $"channels/{channelId}/messages?limit={limit}&{relativeDir}={relativeId}";
public static string ChannelMessage(ulong channelId, ulong msgId) => $"channels/{channelId}/messages/{msgId}";
public static string ChannelMessageAck(ulong channelId, ulong msgId) => $"channels/{channelId}/messages/{msgId}/ack";
public static string ChannelPermission(ulong channelId, ulong userOrRoleId) => $"channels/{channelId}/permissions/{userOrRoleId}";
public static string ChannelTyping(ulong channelId) => $"channels/{channelId}/typing";
public const string Servers = "guilds";
public static string Server(long serverId) => $"guilds/{serverId}";
public static string ServerBan(long serverId, long userId) => $"guilds/{serverId}/bans/{userId}";
public static string ServerChannels(long serverId) => $"guilds/{serverId}/channels";
public static string ServerInvites(long serverId) => $"guilds/{serverId}/invites";
public static string ServerMember(long serverId, long userId) => $"guilds/{serverId}/members/{userId}";
public static string ServerPrune(long serverId, int days) => $"guilds/{serverId}/prune?days={days}";
public static string ServerRoles(long serverId) => $"guilds/{serverId}/roles";
public static string ServerRole(long serverId, long roleId) => $"guilds/{serverId}/roles/{roleId}";
public event EventHandler<BanEventArgs> UserBanned;
private void RaiseUserBanned(long userId, Server server)
private void RaiseUserBanned(ulong userId, Server server)
{
if (UserBanned != null)
EventHelper.Raise(_logger, nameof(UserBanned), () => UserBanned(this, new BanEventArgs(userId, server)));
}
public event EventHandler<BanEventArgs> UserUnbanned;
private void RaiseUserUnbanned(long userId, Server server)
private void RaiseUserUnbanned(ulong userId, Server server)
{
if (UserUnbanned != null)
EventHelper.Raise(_logger, nameof(UserUnbanned), () => UserUnbanned(this, new BanEventArgs(userId, server)));
@@ -119,39 +119,37 @@ namespace Discord
internal User PrivateUser => _privateUser;
private User _privateUser;
/// <summary> Returns information about the currently logged-in account. </summary>
public GlobalUser CurrentUser => _privateUser?.Global;
/// <summary> Returns information about the currently logged-in account. </summary>
public GlobalUser CurrentUser => _currentUser;
private GlobalUser _currentUser;
/// <summary> Returns a collection of all unique users this client can currently see. </summary>
public IEnumerable<GlobalUser> AllUsers { get { CheckReady(); return _globalUsers; } }
/// <summary> Returns a collection of all unique users this client can currently see. </summary>
public IEnumerable<GlobalUser> AllUsers { get { CheckReady(); return _globalUsers; } }
internal GlobalUsers GlobalUsers => _globalUsers;
private readonly GlobalUsers _globalUsers;
internal Users Users => _users;
private readonly Users _users;
public GlobalUser GetUser(long userId)
public GlobalUser GetUser(ulong userId)
{
if (userId <= 0) throw new ArgumentOutOfRangeException(nameof(userId));
CheckReady();
return _globalUsers[userId];
}
/// <summary> Returns the user with the specified id, along with their server-specific data, or null if none was found. </summary>
public User GetUser(Server server, long userId)
public User GetUser(Server server, ulong userId)
{
if (server == null) throw new ArgumentNullException(nameof(server));
if (userId <= 0) throw new ArgumentOutOfRangeException(nameof(userId));
CheckReady();
return _users[userId, server.Id];
}
/// <summary> Returns the user with the specified name and discriminator, along withtheir server-specific data, or null if they couldn't be found. </summary>
public User GetUser(Server server, string username, short discriminator)
public User GetUser(Server server, string username, ushort discriminator)
{
if (server == null) throw new ArgumentNullException(nameof(server));
if (username == null) throw new ArgumentNullException(nameof(username));
if (discriminator <= 0) throw new ArgumentOutOfRangeException(nameof(discriminator));
/// <summary> Returns a collection of all messages the client has seen posted in this channel. This collection does not guarantee any ordering. </summary>
[JsonIgnore]
public IEnumerable<Message> Messages => _messages?.Values ?? Enumerable.Empty<Message>();
/// <summary> Returns the string used to mention this role. </summary>
public string Mention { get { if (IsEveryone) return "@everyone"; else throw new InvalidOperationException("Discord currently only supports mentioning the everyone role"); } }
internal Role(DiscordClient client, long id, long serverId)
Thank you for your continuous support to the Openl Qizhi Community AI Collaboration Platform. In order to protect your usage rights and ensure network security, we updated the Openl Qizhi Community AI Collaboration Platform Usage Agreement in January 2024. The updated agreement specifies that users are prohibited from using intranet penetration tools. After you click "Agree and continue", you can continue to use our services. Thank you for your cooperation and understanding.