【发布时间】:2022-11-19 14:25:41
【问题描述】:
我在用着交互.py(client = interactions.Client) 这样我就可以使用其复杂的斜杠命令系统,但结果是不再触发 on_message 事件方法。当我使用不和谐.py(client = discord.Client) on_message 方法成功运行。
在使用斜杠命令系统时如何让on_message工作交互.py?
import os
import os.path
import interactions
import mysql.connector
import ast
from asyncio.windows_events import NULL
import operator as op
import discord
import inspect
from math import sqrt
from dotenv import load_dotenv
intents = discord.Intents
intents.messages = True
client = interactions.Client(token=TOKEN)
@client.command(
#command details here
)
async def count(ctx: interactions.CommandContext, command: str):
#manage incoming commands
#this only works correctly when I use client = interactions.Client
@client.event
async def on_message(message):
#do things based on message contents
#this only works correctly when I use client = discord.Client
client.Start()
谢谢!
【问题讨论】:
-
您确定
interactions.py与discord.py一样支持on_message事件吗? -
交互内置于 discord.py,为什么要为此使用单独的包?
-
@stijndcl 根本不知道,哈哈。
标签: python discord.py discord-interactions