Fix on_message to not execute on DMs

This commit is contained in:
Zeva Rose 2021-07-02 13:27:59 -06:00
parent 24616d14dc
commit 6e21b7bb67

View file

@ -1,7 +1,7 @@
from pathlib import Path from pathlib import Path
import pymongo import pymongo
from datetime import datetime, timedelta from datetime import datetime, timedelta
from discord import Intents, Member, Message from discord import Intents, Member, Message, DMChannel
from discord.ext import commands from discord.ext import commands
from discord.ext.tasks import loop from discord.ext.tasks import loop
from discord.utils import find, get from discord.utils import find, get
@ -70,6 +70,7 @@ 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):
db = DBManager(get_config().mongo).mongo db = DBManager(get_config().mongo).mongo
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}