public static Task <IStage> FetchStageAsync(this IStageChannel channel,
                                                    IRestRequestOptions options = null, CancellationToken cancellationToken = default)
        {
            var client = channel.GetRestClient();

            return(client.FetchStageAsync(channel.Id, options, cancellationToken));
        }
        /*
         * Stages
         */
        public static Task <IStage> CreateStageAsync(this IStageChannel channel,
                                                     string topic, Action <CreateStageActionProperties> action = null,
                                                     IRestRequestOptions options = null, CancellationToken cancellationToken = default)
        {
            var client = channel.GetRestClient();

            return(client.CreateStageAsync(channel.Id, topic, action, options, cancellationToken));
        }
        public static CachedStage GetStage(this IStageChannel stageChannel)
        {
            var client = stageChannel.GetGatewayClient();

            if (client.CacheProvider.TryGetStages(stageChannel.GuildId, out var cache))
            {
                return(Array.Find(cache.Values, x => x.ChannelId == stageChannel.Id));
            }

            return(null);
        }
Ejemplo n.º 4
0
        public static async Task <StageInstance> ModifyAsync(IStageChannel channel, BaseDiscordClient client,
                                                             Action <StageInstanceProperties> func, RequestOptions options = null)
        {
            var args = new StageInstanceProperties();

            func(args);

            var apiArgs = new ModifyStageInstanceParams()
            {
                PrivacyLevel = args.PrivacyLevel,
                Topic        = args.Topic
            };

            return(await client.ApiClient.ModifyStageInstanceAsync(channel.Id, apiArgs, options));
        }
Ejemplo n.º 5
0
        public static Task <IStage> FetchStageAsync(this IStageChannel channel, IRestRequestOptions options = null)
        {
            var client = channel.GetRestClient();

            return(client.FetchStageAsync(channel.Id, options));
        }