Пример #1
0
        public async Task ListAdminChannels()
        {
            var adminChannel = await AdminChannelService.GetAll(Context.Guild.Id);

            StringBuilder sb = new StringBuilder();

            foreach (var ac in adminChannel)
            {
                var channel = Client.GetChannel(ac.ChannelId) as SocketTextChannel;

                sb.Append($"{ac.Server.ServerName} - {channel.Name} - {ac.Server.ServerIp}:{ac.Server.ServerPort}\n");
            }

            await ReplyAsync($"{sb}");
        }
Пример #2
0
        public async Task ChangePrefix(string newPrefix)
        {
            var adminChannel = await AdminChannelService.Get(Context.Channel.Id);

            if (adminChannel == null)
            {
                await ReplyAsync($"{adminChannel.Server.ServerName} is not registered on this channel!");

                return;
            }

            await AdminChannelService.ChangePrefix(adminChannel, newPrefix);

            await ReplyAsync("Prefix has been updated!");
        }
Пример #3
0
        public async Task RegisterChatServer()
        {
            var adminChannel = await AdminChannelService.Get(Context.Channel.Id);

            if (adminChannel == null)
            {
                await ReplyAsync($"{adminChannel.Server.ServerName} is not registered on this channel!");

                return;
            }

            await AdminChannelService.Remove(adminChannel);

            await ReplyAsync("Admin Channel has been removed!");
        }
Пример #4
0
        public async Task RegisterChatServer(string serverName, string prefix)
        {
            var server = await ServerService.Get(Context.Guild.Id, serverName);

            if (server == null)
            {
                await ReplyAsync("Server does not exist!");

                return;
            }

            var adminChannel = await AdminChannelService.Get(Context.Channel.Id);

            if (adminChannel != null)
            {
                await ReplyAsync($"{adminChannel.Server.ServerName} is already registered on this channel!");

                return;
            }

            await AdminChannelService.Add(server, Context.Channel.Id, prefix);

            await ReplyAsync("Server has been registered!");
        }