コード例 #1
0
 public AudioClientWrapper(
     IAudioClient client, IUserMessage message,
     IAudioConfig globalConfig, IAudioGuildConfig?guildConfig = null)
 {
     Message = message;
     Client  = client;
     if (guildConfig?.AllowReactions ?? globalConfig.AllowReactions)
     {
         _ = message.AddReactionsAsync(_emotes);
     }
     message.ModifyAsync(m => m.Embed = _readyEmbed);
 }
コード例 #2
0
        public AudioService(
            DiscordSocketClient client, IAudioConfig config,
            Func <LogMessage, Task>?logger = null)
        {
            Client = client ?? throw new ArgumentNullException(nameof(client));
            Config = config ?? throw new ArgumentNullException(nameof(config));
            Logger = logger ?? Extensions.NoOpLogger;

            Client.ReactionAdded  += Client_ReactionAdded;
            Client.GuildAvailable += Client_GuildAvailable;

            Log(LogSeverity.Info, "Created Audio service.");

            //_presenceChecker = new Timer(o =>
            //{
            //    foreach (var (guildId, wrapper) in Clients)
            //    {
            //        if (wrapper.Client.ConnectionState == ConnectionState.Disconnected)
            //        {
            //            Clients.TryRemove(guildId, out var _);
            //        }
            //    }
            //}, null, TimeSpan.FromSeconds(10), TimeSpan.FromMinutes(1));
        }