internal void ListSongs(IMessageChannel channel)
        {
            var embedlist = new EmbedList(channel, this);

            if (Lists.TryAdd(embedlist.Message.Id, embedlist))
            {
            }
        }
Exemple #2
0
        internal async Task JoinAudio(IGuild guild, IMessageChannel channel, IVoiceChannel target)
        {
            if (Clients.TryGetValue(guild.Id, out _))
            {
                return;
            }
            if (target.Guild.Id != guild.Id)
            {
                return;
            }

            var guildConfig = Config.GuildConfigs.GetValueOrDefault(guild.Id);
            var audioClient = await target.ConnectAsync().ConfigureAwait(false);

            var message = await channel.SendMessageAsync("", embed : _initEmbed).ConfigureAwait(false);

            var wrapper = new AudioClientWrapper(audioClient, message, Config, guildConfig);

            if (Clients.TryAdd(guild.Id, wrapper))
            {
                await Log(LogSeverity.Info, $"Connected to voice channel '{target.Name}' on '{guild.Name}'.").ConfigureAwait(false);

                //audioClient.Connected += AudioClient_Connected;
                //audioClient.Disconnected += AudioClient_Disconnected;
            }

            var embedlist = new EmbedList(channel, this);

            if (Lists.TryAdd(embedlist.Message.Id, embedlist))
            {
            }

            if (guildConfig?.AutoPlay ?? Config.AutoPlay)
            {
#pragma warning disable CS4014 // Because this call is not awaited, execution of the current method continues before the call is completed
                Task.Run(() => Playlist(guild).ConfigureAwait(false));
#pragma warning restore CS4014 // Because this call is not awaited, execution of the current method continues before the call is completed
            }
        }
Exemple #3
0
        private async Task UpdateEmbedList(EmbedList embedList, SocketReaction reaction)
        {
            await embedList.Message.RemoveReactionAsync(reaction.Emote, reaction.User.Value).ConfigureAwait(false);

            switch (reaction.Emote.Name)
            {
            case EmbedList.SFirst:
                await embedList.First(reaction.User.Value).ConfigureAwait(false);

                return;

            case EmbedList.SBack:
                await embedList.Back(reaction.User.Value).ConfigureAwait(false);

                return;

            case EmbedList.SNext:
                await embedList.Next(reaction.User.Value).ConfigureAwait(false);

                return;

            case EmbedList.SLast:
                await embedList.Last(reaction.User.Value).ConfigureAwait(false);

                return;

            case EmbedList.SDelete:
                await embedList.Delete().ConfigureAwait(false);

                Lists.TryRemove(embedList.Message.Id, out _);
                return;

            default:
                return;
            }
        }