【问题标题】:I am trying to use the discord.py integration but I am getting an error every time我正在尝试使用 discord.py 集成,但每次都会出错
【发布时间】:2021-10-22 07:12:30
【问题描述】:

我尝试了许多不同的方法来尝试让 discord_slash 导入工作,但我一遍又一遍地遇到同样的错误

我的代码中的错误是:

ModuleNotFoundError: No module named 'discord_slash'

这是我的代码:

import discord
from discord_slash.utils.manage_components import create_select, create_select_option, create_actionrow

select = create_select(
    options=[
        create_select_option("Test 1", value="Test 1", emoji="????"),
        create_select_option("Test 2", value="Test 2", emoji="????"),
        create_select_option("Test 3", value="test 3", emoji="????")
    ],
    placeholder="Choose your option",
    min_values=1,
    max_values=2
)
action_row = create_actionrow(select)

client = discord.Client()

@client.event
async def on_message(message):
  if message.content.lower().startswith():
    await ctx.send(components=[action_row])

【问题讨论】:

    标签: discord.py


    【解决方案1】:

    您下载了discord_slash 库吗?如果不在终端运行此行:

    pip install -U discord-py-slash-command

    如果这仍然不起作用,请确保 pip 将模块安装在正确的目录中,以供您选择的 IDE 访问。 以下是有关此的更多信息: Pip Install not installing into correct directory?.

    【讨论】:

      猜你喜欢
      • 2021-07-15
      • 2023-01-08
      • 2020-10-13
      • 1970-01-01
      • 1970-01-01
      • 2021-04-12
      • 2021-09-30
      • 2020-12-26
      • 1970-01-01
      相关资源
      最近更新 更多