【问题标题】:on_message not being triggered when using interactions.Client使用 interactions.Client 时未触发 on_message
【发布时间】: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.pydiscord.py 一样支持on_message 事件吗?
  • 交互内置于 discord.py,为什么要为此使用单独的包?
  • @stijndcl 根本不知道,哈哈。

标签: python discord.py discord-interactions


【解决方案1】:

它将是on_message_create,因为这是 discord api 使用的名称

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2021-09-14
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2020-01-16
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多