Fix on_message to not execute on DMs
This commit is contained in:
parent
24616d14dc
commit
6e21b7bb67
1 changed files with 9 additions and 8 deletions
|
@ -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,13 +70,14 @@ async def on_member_join(user: Member):
|
||||||
|
|
||||||
@jarvis.event
|
@jarvis.event
|
||||||
async def on_message(message: Message):
|
async def on_message(message: Message):
|
||||||
db = DBManager(get_config().mongo).mongo
|
if not isinstance(message.channel, DMChannel):
|
||||||
autoreact = db.jarvis.autoreact.find_one(
|
db = DBManager(get_config().mongo).mongo
|
||||||
{"guild": message.guild.id, "channel": message.channel.id}
|
autoreact = db.jarvis.autoreact.find_one(
|
||||||
)
|
{"guild": message.guild.id, "channel": message.channel.id}
|
||||||
if autoreact:
|
)
|
||||||
for reaction in autoreact["reactions"]:
|
if autoreact:
|
||||||
await message.add_reaction(reaction)
|
for reaction in autoreact["reactions"]:
|
||||||
|
await message.add_reaction(reaction)
|
||||||
await jarvis.process_commands(message)
|
await jarvis.process_commands(message)
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue