Exemple #1
0
 internal OptionalSnowflakeEntity(Snowflake id)
 {
     Id       = id;
     _value   = default;
     HasValue = false;
 }
 public CachedGuild GetGuild(Snowflake id)
 => State.GetGuild(id);
 /// <summary>
 ///     Looks up the user cache for the <see cref="CachedUser"/> with the given id.
 /// </summary>
 /// <param name="id"> The id of the user. </param>
 /// <returns>
 ///     The found <see cref="CachedUser"/> or <see langword="null"/>.
 /// </returns>
 public CachedUser GetUser(Snowflake id)
 => State.GetUser(id);
Exemple #4
0
 public static string Role(Snowflake id)
 => $"<@&{id}>";
 public CachedUserMessage GetMessage(Snowflake channelId, Snowflake messageId)
 => State.GetMessage(channelId, messageId);
Exemple #6
0
        public async Task PinMessageAsync(Snowflake messageId, RestRequestOptions options = null)
        {
            await Client.PinMessageAsync(Id, messageId, options).ConfigureAwait(false);

            LastPinTimestamp = DateTimeOffset.UtcNow;
        }
Exemple #7
0
 public static string User(Snowflake id, bool hasNick = false)
 => hasNick ? $"<@!{id}>" : $"<@{id}>";
Exemple #8
0
 internal void AddOrUpdateNote(Snowflake id, string note, Func <Snowflake, string, string> func)
 {
     _notes.AddOrUpdate(id, note, func);
 }
 public LocalReferenceBuilder WithMessageId(Snowflake messageId)
 {
     MessageId = messageId;
     return(this);
 }
Exemple #10
0
 public static bool TryParseUser(ReadOnlySpan <char> value, out Snowflake result)
 {
     result = 0;
     return(value.Length > 3 && value[0] == '<' && value[1] == '@' && value[^ 1] == '>' &&
            Snowflake.TryParse(value[2] == '!' ? value[3..^ 1] : value[2..^ 1], out result));
 public TransientGuildEmoji(IClient client, Snowflake guildId, EmojiJsonModel model)
     : base(client, model)
 {
     GuildId = guildId;
 }
Exemple #12
0
        public static bool TryParseUser(string value, out Snowflake result)
        {
            Guard.IsNotNull(value);

            return(TryParseUser(value.AsSpan(), out result));
        }
Exemple #13
0
 internal CachedSnowflakeEntity(DiscordClientBase client, Snowflake id) : base(client)
 {
     Id = id;
 }
Exemple #14
0
 internal OptionalSnowflakeEntity(T value, Snowflake id)
 {
     _value   = value;
     Id       = id;
     HasValue = value != null;
 }
Exemple #15
0
 public Task <IReadOnlyList <RestUser> > GetReactionsAsync(Snowflake messageId, IEmoji emoji, int limit = 100, Snowflake?startFromId = null, RestRequestOptions options = null)
 => Client.GetReactionsAsync(Id, messageId, emoji, limit, startFromId, options);
Exemple #16
0
 public TransientIntegration(IClient client, Snowflake guildId, IntegrationJsonModel model)
     : base(client, model)
 {
     GuildId = guildId;
 }
Exemple #17
0
 public Task <RestUserMessage> ModifyMessageAsync(Snowflake messageId, Action <ModifyMessageProperties> action, RestRequestOptions options = null)
 => Client.ModifyMessageAsync(Id, messageId, action, options);
Exemple #18
0
 public TransientVanityInvite(IClient client, Snowflake guildId, InviteJsonModel model)
     : base(client, model)
 {
     GuildId = guildId;
 }
Exemple #19
0
 public Task UnpinMessageAsync(Snowflake messageId, RestRequestOptions options = null)
 => Client.UnpinMessageAsync(Id, messageId, options);
 internal DownloadableOptionalSnowflakeEntity(Snowflake id, RestDownloadableDelegate <TDownloadable> func)
     : this(null, id, func)
 {
 }
Exemple #21
0
 public static string TextChannel(Snowflake id)
 => $"<#{id}>";
 internal DownloadableOptionalSnowflakeEntity(T value, Snowflake id, RestDownloadableDelegate <TDownloadable> func)
     : base(value, id)
 {
     Downloadable = new RestDownloadable <TDownloadable>(func);
 }
Exemple #23
0
 public LocalOverwrite(Snowflake targetId, OverwriteTargetType targetType, OverwritePermissions permissions)
 {
     TargetId    = targetId;
     TargetType  = targetType;
     Permissions = permissions;
 }
Exemple #24
0
 public Task <RestMessage> GetMessageAsync(Snowflake messageId, RestRequestOptions options = null)
 => Client.GetMessageAsync(Id, messageId, options);
 public IReadOnlyList <CachedUserMessage> GetMessages(Snowflake channelId)
 => State.GetMessages(channelId);
Exemple #26
0
 public Task RemoveOwnReactionAsync(Snowflake messageId, IEmoji emoji, RestRequestOptions options = null)
 => Client.RemoveOwnReactionAsync(Id, messageId, emoji, options);
 public CachedGuildChannel GetGuildChannel(Snowflake id)
 => State.GetGuildChannel(id);
Exemple #28
0
 public RestRequestEnumerable <RestUser> GetReactionsEnumerable(Snowflake messageId, IEmoji emoji, int limit, Snowflake?startFromId = null, RestRequestOptions options = null)
 => Client.GetReactionsEnumerable(Id, messageId, emoji, limit, startFromId, options);
 public CachedPrivateChannel GetPrivateChannel(Snowflake id)
 => State.GetPrivateChannel(id);
Exemple #30
0
 public static TMessage AddStickerId <TMessage>(this TMessage message, Snowflake stickerId)
     where TMessage : LocalMessageBase
 {
     message._stickerIds.Add(stickerId);
     return(message);
 }