예제 #1
0
        private bool IsValidMessage(IMessage m, bool checkReactions = true)
        {
            if (!(m is IUserMessage msg))
            {
                return(false);
            }
            if (msg.Author.IsBot || msg.Author.IsWebhook)
            {
                return(false);
            }
            if (msg.Embeds.Count < 1 && msg.Attachments.Count < 1)
            {
                return(false);
            }
            CommandHandlingService commands = this.ServiceManager.GetService <CommandHandlingService>("Commands");

            if (commands.IsCommandMessage(msg))
            {
                return(false);
            }
            if (checkReactions && ((msg.Reactions.TryGetValue(Emote, out ReactionMetadata data) && !data.IsMe) || !msg.Reactions.ContainsKey(Emote)))
            {
                return(false);
            }

            return(true);
        }
예제 #2
0
        private bool IsValidMessage(IUserMessage msg)
        {
            if (msg.Author.IsBot || msg.Author.IsWebhook)
            {
                return(false);
            }
            if (!this.HasSupportedUrl(msg))
            {
                return(false);
            }
            CommandHandlingService commands = this.ServiceManager.GetService <CommandHandlingService>("Commands");

            if (commands.IsCommandMessage(msg))
            {
                return(false);
            }
            if (!msg.Reactions.ContainsKey(EmoteExtend) || (msg.Reactions.TryGetValue(EmoteExtend, out ReactionMetadata data) && !data.IsMe))
            {
                return(false);
            }

            return(true);
        }