コード例 #1
0
        public static Task <IReadOnlyList <IThreadChannel> > FetchJoinedPrivateArchivedThreadsAsync(this ITextChannel channel,
                                                                                                    int limit = Discord.Limits.Rest.FetchThreadsPageSize, Snowflake?startFromId = null,
                                                                                                    IRestRequestOptions options = null, CancellationToken cancellationToken     = default)
        {
            var client = channel.GetRestClient();

            return(client.FetchJoinedPrivateArchivedThreadsAsync(channel.Id, limit, startFromId, options, cancellationToken));
        }
コード例 #2
0
        public static IPagedEnumerable <IThreadChannel> EnumerateJoinedPrivateArchivedThreads(this ITextChannel channel,
                                                                                              int limit, Snowflake?startFromId = null,
                                                                                              IRestRequestOptions options      = null)
        {
            var client = channel.GetRestClient();

            return(client.EnumerateJoinedPrivateArchivedThreads(channel.Id, limit, startFromId, options));
        }
コード例 #3
0
        public static IPagedEnumerable <IThreadChannel> EnumeratePrivateArchivedThreads(this ITextChannel channel,
                                                                                        int limit, DateTimeOffset?startFromDate = null,
                                                                                        IRestRequestOptions options             = null)
        {
            var client = channel.GetRestClient();

            return(client.EnumeratePrivateArchivedThreads(channel.Id, limit, startFromDate, options));
        }
コード例 #4
0
        public static Task <IThreadChannel> CreatePrivateThreadAsync(this ITextChannel channel,
                                                                     string name, TimeSpan?automaticArchiveDuration = null, bool?allowInvitation = null,
                                                                     IRestRequestOptions options = null, CancellationToken cancellationToken     = default)
        {
            var client = channel.GetRestClient();

            return(client.CreatePrivateThreadAsync(channel.Id, name, automaticArchiveDuration, allowInvitation, options, cancellationToken));
        }
コード例 #5
0
        /*
         * Threads
         */
        public static Task <IThreadChannel> CreatePublicThreadAsync(this ITextChannel channel,
                                                                    string name, Snowflake?messageId = null, TimeSpan?automaticArchiveDuration   = null,
                                                                    IRestRequestOptions options      = null, CancellationToken cancellationToken = default)
        {
            var client = channel.GetRestClient();

            return(client.CreatePublicThreadAsync(channel.Id, name, messageId, automaticArchiveDuration, options, cancellationToken));
        }
コード例 #6
0
        public static Task <ITextChannel> ModifyAsync(this ITextChannel channel,
                                                      Action <ModifyTextChannelActionProperties> action,
                                                      IRestRequestOptions options = null, CancellationToken cancellationToken = default)
        {
            var client = channel.GetRestClient();

            return(client.ModifyTextChannelAsync(channel.Id, action, options, cancellationToken));
        }
コード例 #7
0
        public static Task <IUserMessage> CrosspostMessageAsync(this ITextChannel channel, Snowflake messageId, IRestRequestOptions options = null)
        {
            if (!channel.IsNews)
            {
                throw new ArgumentException("This text channel must be a news channel to have messages crossposted from it.", nameof(channel));
            }

            var client = channel.GetRestClient();

            return(client.CrosspostMessageAsync(channel.Id, messageId, options));
        }
コード例 #8
0
        public static Task <IFollowedChannel> FollowAsync(this ITextChannel channel, Snowflake targetChannelId, IRestRequestOptions options = null)
        {
            if (!channel.IsNews)
            {
                throw new ArgumentException("This text channel must be a news channel to follow it.", nameof(channel));
            }

            var client = channel.GetRestClient();

            return(client.FollowNewsChannelAsync(channel.Id, targetChannelId, options));
        }
コード例 #9
0
        public static Task <IReadOnlyList <IThreadChannel> > FetchJoinedPrivateArchivedThreadsAsync(this ITextChannel channel, int limit = 100, Snowflake?startFromId = null, IRestRequestOptions options = null)
        {
            var client = channel.GetRestClient();

            return(client.FetchJoinedPrivateArchivedThreadsAsync(channel.Id, limit, startFromId, options));
        }
コード例 #10
0
        public static Task <IReadOnlyList <IThreadChannel> > FetchPrivateArchivedThreadsAsync(this ITextChannel channel, int limit = 100, DateTimeOffset?startFromDate = null, IRestRequestOptions options = null)
        {
            var client = channel.GetRestClient();

            return(client.FetchPrivateArchivedThreadsAsync(channel.Id, limit, startFromDate, options));
        }
コード例 #11
0
        public static Task <IThreadChannel> CreatePrivateThreadAsync(this ITextChannel channel, string name, TimeSpan?automaticArchiveDuration = null, IRestRequestOptions options = null)
        {
            var client = channel.GetRestClient();

            return(client.CreatePrivateThreadAsync(channel.Id, name, automaticArchiveDuration, options));
        }
コード例 #12
0
        public static Task DeleteMessagesAsync(this ITextChannel channel, IEnumerable <Snowflake> messageIds, IRestRequestOptions options = null)
        {
            var client = channel.GetRestClient();

            return(client.DeleteMessagesAsync(channel.Id, messageIds, options));
        }
コード例 #13
0
        public static IPagedEnumerable <Snowflake> EnumerateMessageDeletion(this ITextChannel channel, IEnumerable <Snowflake> messageIds, IRestRequestOptions options = null)
        {
            var client = channel.GetRestClient();

            return(client.EnumerateMessageDeletion(channel.Id, messageIds, options));
        }