public static InteractivityExtension UseInteractivity(this DiscordClient c, InteractivityConfiguration cfg) { if (c.GetExtension <InteractivityExtension>() != null) { throw new Exception("Interactivity module is already enabled for this client!"); } var m = new InteractivityExtension(cfg); c.AddExtension(m); return(m); }
internal InteractivityExtension(InteractivityConfiguration cfg) { this.Config = new InteractivityConfiguration(cfg); }
public static async Task <IReadOnlyDictionary <int, InteractivityExtension> > UseInteractivityAsync(this DiscordShardedClient c, InteractivityConfiguration cfg) { var modules = new Dictionary <int, InteractivityExtension>(); await c.InitializeShardsAsync().ConfigureAwait(false); foreach (var shard in c.ShardClients.Select(xkvp => xkvp.Value)) { var m = shard.GetExtension <InteractivityExtension>(); if (m == null) { m = shard.UseInteractivity(cfg); } modules[shard.ShardId] = m; } return(new ReadOnlyDictionary <int, InteractivityExtension>(modules)); }
/// <summary> /// Creates a new instance of <see cref="InteractivityConfiguration"/>, copying the properties of another configuration. /// </summary> /// <param name="other">Configuration the properties of which are to be copied.</param> public InteractivityConfiguration(InteractivityConfiguration other) { this.PaginationBehavior = other.PaginationBehavior; this.PaginationTimeout = other.PaginationTimeout; this.Timeout = other.Timeout; }
/// <summary> /// Creates a new instance of <see cref="InteractivityConfiguration"/>, copying the properties of another configuration. /// </summary> /// <param name="other">Configuration the properties of which are to be copied.</param> public InteractivityConfiguration(InteractivityConfiguration other) { this.Timeout = other.Timeout; }
public static IReadOnlyDictionary <int, InteractivityExtension> UseInteractivity(this DiscordShardedClient c, InteractivityConfiguration cfg) { var modules = new Dictionary <int, InteractivityExtension>(); c.InitializeShardsAsync().GetAwaiter().GetResult(); foreach (var shard in c.ShardClients.Select(xkvp => xkvp.Value)) { var m = shard.GetModule <InteractivityExtension>(); if (m == null) { m = shard.UseInteractivity(cfg); } modules.Add(shard.ShardId, m); } return(new ReadOnlyDictionary <int, InteractivityExtension>(modules)); }
internal InteractivityModule(InteractivityConfiguration cfg) { this.Config = cfg; }