コード例 #1
0
ファイル: GroupCommands.cs プロジェクト: Xronosmax/CouchBot
        public async Task Remove(string groupName)
        {
            var translation = await GetTranslation();

            if (!IsOwner)
            {
                return;
            }

            if (groupName.Equals("Default", StringComparison.CurrentCultureIgnoreCase))
            {
                await Context.Channel.SendMessageAsync(translation.GroupCommands.DefaultNoRemove);

                return;
            }

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

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

                return;
            }

            await _groupManager.DeleteGuildGroup(guildGroup);

            await Context.Channel.SendMessageAsync(translation.GroupCommands.RemovedSuccessfully);
        }
コード例 #2
0
        private async Task _discord_LeftGuild(SocketGuild arg)
        {
            var guild = await _guildManager.GetGuildById(arg.Id);

            if (guild != null)
            {
                await _guildManager.DeleteGuild(guild);
            }

            var guildConfiguration = await _guildManager.GetGuildConfigurationByGuildId(arg.Id);

            if (guild != null)
            {
                await _guildManager.DeleteGuildConfiguration(guildConfiguration);
            }

            var defaultGroup = await _groupManager.GetGuildGroupByGuildIdAndName(arg.Id, "Default");

            if (defaultGroup != null)
            {
                await _groupManager.DeleteGuildGroup(defaultGroup);
            }
        }