Exemplo n.º 1
0
        public async Task Add(string channelId, string groupName)
        {
            var translation = await GetTranslation();

            if (!IsOwner)
            {
                return;
            }

            var youTubeChannel = await _youTubeManager.GetYouTubeChannelByChannelId(channelId);

            if (youTubeChannel == null && youTubeChannel.Items.Count == 0)
            {
                await Context.Channel.SendMessageAsync("Sorry, a YouTube Channel with that ID does not exist.");

                return;
            }

            var group = await _groupManager.GetGuildGroupByGuildIdAndName(Context.Guild.Id, groupName);

            if (group == null)
            {
                await Context.Channel.SendMessageAsync($"{translation.GroupCommands.InvalidGroupName} '{Prefix} group list'");

                return;
            }

            var groupChannel =
                await _channelManager.GetChannelByGuildGroupIdAndChannelId(group.Id, channelId);

            if (groupChannel != null)
            {
                await Context.Channel.SendMessageAsync("Sorry, a this Youtube channel has already been added to this group.");

                return;
            }

            await _channelManager.AddChannel(new GuildGroupChannel
            {
                ChannelId    = channelId,
                GuildGroupId = group.Id,
                Platform     = Platform.YouTube
            });

            await Context.Channel.SendMessageAsync("This new YouTube channel has been added.");
        }
Exemplo n.º 2
0
        public async Task Add(string channelName, string groupName)
        {
            var translation = await GetTranslation();

            if (!IsOwner)
            {
                return;
            }

            var mixerChannel = await _mixerManager.GetMixerChannelByChannelName(channelName);

            if (mixerChannel == null)
            {
                await Context.Channel.SendMessageAsync("Sorry, a Mixer channel with that name does not exist.");

                return;
            }

            var group = await _groupManager.GetGuildGroupByGuildIdAndName(Context.Guild.Id, groupName);

            if (group == null)
            {
                await Context.Channel.SendMessageAsync($"{translation.GroupCommands.InvalidGroupName} '{Prefix} group list'");

                return;
            }

            var groupChannel =
                await _channelManager.GetChannelByGuildGroupIdAndChannelId(group.Id, mixerChannel.Id.ToString());

            if (groupChannel != null)
            {
                await Context.Channel.SendMessageAsync("Sorry, a this Mixer channel has already been added to this group.");

                return;
            }

            await _channelManager.AddChannel(new GuildGroupChannel
            {
                ChannelId    = mixerChannel.Id.ToString(),
                GuildGroupId = group.Id,
                Platform     = Platform.Mixer
            });

            await Context.Channel.SendMessageAsync("This new Mixer channel has been added.");
        }
Exemplo n.º 3
0
        public async Task Add(string loginName, string groupName)
        {
            var translation = await GetTranslation();

            if (!IsOwner)
            {
                return;
            }

            var twitchChannel = await _twitchManager.GetTwitchUserByLoginName(loginName);

            if (twitchChannel == null || twitchChannel.Users.Count < 1)
            {
                await Context.Channel.SendMessageAsync("Sorry, a Twitch channel with that name does not exist.");

                return;
            }

            var group = await _groupManager.GetGuildGroupByGuildIdAndName(Context.Guild.Id, groupName);

            if (group == null)
            {
                await Context.Channel.SendMessageAsync($"{translation.GroupCommands.InvalidGroupName} '{Prefix} group list'");

                return;
            }

            var groupChannel =
                await _channelManager.GetChannelByGuildGroupIdAndChannelId(group.Id, twitchChannel.Users[0].Id);

            if (groupChannel != null)
            {
                await Context.Channel.SendMessageAsync("Sorry, a this Twitch channel has already been added to this group.");

                return;
            }

            await _channelManager.AddChannel(new GuildGroupChannel
            {
                ChannelId    = twitchChannel.Users[0].Id,
                GuildGroupId = group.Id,
                Platform     = Platform.Twitch
            });

            await Context.Channel.SendMessageAsync("This new Twitch channel has been added.");
        }