Beispiel #1
0
        public async Task AddLimit(string value = null)
        {
            await Context.Channel.TriggerTypingAsync();

            if (value != null)
            {
                if (!MentionUtils.TryParseChannel(value, out ulong parsedId))
                {
                    await Context.Channel.SendErrorAsync("Channel Limits", "Please pass in a valid channel!");

                    return;
                }
                var parsedChannel = Context.Guild.GetTextChannel(parsedId);
                if (parsedChannel == null)
                {
                    await Context.Channel.SendErrorAsync("Channel Limits", "Please pass in a valid channel!");

                    return;
                }
                await _limits.AddLimitAsync(Context.Guild.Id, parsedId);

                await _serverHelper.SendLogAsync(Context.Guild, "Situation Log", $"{Context.User.Mention} added {parsedChannel.Mention} to the list of limited channels!");

                await Context.Channel.SendSuccessAsync("Channel Limits", $"Successfully limited the bot to {parsedChannel.Mention}.");
            }
        }