예제 #1
0
        public DiscordCommandResult RemovePrefixAsync([Remainder] IPrefix prefix)
        {
            if (!CurrentGuildSettings.Prefixes.Contains(prefix))
            {
                return(Response($"The prefix {prefix.Format()} is not enabled on this server."));
            }
            else if (CurrentGuildSettings.Prefixes.Count == 1)
            {
                return(Response("You cannot remove the last enabled prefix on this server."));
            }

            CurrentGuildSettings.Prefixes.Remove(prefix);

            return(Response($"Ok, the prefix {prefix.Format()} will no longer be recognized on this server."));
        }
예제 #2
0
        public DiscordCommandResult AddPrefixAsync([Remainder] IPrefix prefix)
        {
            if (CurrentGuildSettings.Prefixes.Count >= DefaultGuildSettingsProvider.MaxNumberOfPrefixes)
            {
                return(Response($"Your server has reached the max number of prefixes ({DefaultGuildSettingsProvider.MaxNumberOfPrefixes})"));
            }
            else if (CurrentGuildSettings.Prefixes.Contains(prefix))
            {
                return(Response($"Prefix: {prefix.Format()} is already enabled on this server."));
            }
            else if (prefix is MentionPrefix mentionPrefix && mentionPrefix.UserId != Context.Bot.CurrentUser.Id)
            {
                return(Response("You cannot enable mentions for users other than myself as a prefix."));
            }

            CurrentGuildSettings.Prefixes.Add(prefix);

            return(Response($"Ok, the prefix {prefix.Format()} will now be recognized on this server."));
        }