Ignore on_message(_edit) from @jarvis

This commit is contained in:
Zeva Rose 2021-07-16 17:39:49 -06:00
parent a2704475b0
commit 0519dbd91f
2 changed files with 46 additions and 39 deletions

View file

@ -34,6 +34,9 @@ jarvis_self = Process()
__version__ = "0.9.9" __version__ = "0.9.9"
db = DBManager(get_config().mongo).mongo
@jarvis.event @jarvis.event
async def on_ready(): async def on_ready():
global restart_ctx global restart_ctx
@ -84,8 +87,10 @@ async def on_member_join(user: Member):
@jarvis.event @jarvis.event
async def on_message(message: Message): async def on_message(message: Message):
if not isinstance(message.channel, DMChannel): if (
db = DBManager(get_config().mongo).mongo not isinstance(message.channel, DMChannel)
and not message.author.id == jarvis.client.id
):
autoreact = db.jarvis.autoreact.find_one( autoreact = db.jarvis.autoreact.find_one(
{"guild": message.guild.id, "channel": message.channel.id} {"guild": message.guild.id, "channel": message.channel.id}
) )

View file

@ -2,12 +2,13 @@ import asyncio
from datetime import datetime, timedelta from datetime import datetime, timedelta
import discord import discord
import jarvis
import pymongo import pymongo
from discord import DMChannel from discord import DMChannel
from discord.ext import commands from discord.ext import commands
from discord.utils import find from discord.utils import find
from discord_slash import SlashContext from discord_slash import SlashContext
import jarvis
from jarvis.config import get_config from jarvis.config import get_config
from jarvis.utils import build_embed from jarvis.utils import build_embed
from jarvis.utils.db import DBManager from jarvis.utils.db import DBManager
@ -356,6 +357,7 @@ class ModlogCog(commands.Cog):
async def on_message_edit( async def on_message_edit(
self, before: discord.Message, after: discord.Message self, before: discord.Message, after: discord.Message
): ):
if before.author != self.bot.client.id:
modlog = self.db.jarvis.settings.find_one( modlog = self.db.jarvis.settings.find_one(
{"guild": after.guild.id, "setting": "modlog"} {"guild": after.guild.id, "setting": "modlog"}
) )