收到 Discord bot 命令,但未执行命令

时间:2021-05-21 23:01:30

标签: python discord discord.py

再问一个问题。这次更复杂(至少对我而言)。所以我正在制作一个不和谐的机器人,当我做例如 k!ship 时,它会打印“a”(这是用于调试)但不会显示嵌入。当我删除“小圆”和“魔法少女”这两个词的关键字检测器时,evrey 就好了。我认为这个代码位是问题所在。这是完整的代码。 (但不是 ofc 的标记)而且 Couple_list 删除了名字,还有朋友的名字,所以这是有道理的。

# Imports

import discord
from discord.ext import commands
import random

# Credentials
TOKEN = 'use your imagination and imagine a token here :)'

# Create bot
client = commands.Bot(command_prefix='k!')


# Startup Information
@client.event
async def on_message(message):
    if "madoka" in message.content:
        await message.channel.send("✨being meguca is suffering✨")


@client.event
async def on_message(message):
    if "magical girl" in message.content:
        await message.channel.send("✨being meguca is suffering✨")


# Commands

@client.command()
async def jupiter(ctx):
    await ctx.send('Peanut Butter')


# lists for commands
couple_list = ['imagination™']
ship_list = ['Madoka Kaname', 'Homura Akemi', 'Sayaka Miki', 'Mami Tomoe', 'Kyo(u)ko Sakura', 'Hitomi Shizuki',
             'Kyosuke Kamijio']
ship_dis = ['It would be so intense!', 'A nail biter!', 'Its the best pick I got!']


# couple command

@client.command()
async def couple(ctx):
    embed = discord.Embed(title=('In my opinion, ' + (random.choice(couple_list)) + ' and ' + (
        random.choice(couple_list)) + ' would be a great pair!'), color=0x8b0000)
    embed.set_footer(text="What a nice couple ???????❤??♥♥")
    await ctx.send(embed=embed)


# ship command
@client.command()
async def ship(ctx):
    ship_cmd = discord.Embed(title=('In my opinion, ' + (random.choice(ship_list)) + ' and ' + (
        random.choice(ship_list)) + ' would be a great ship!'), color=0x8b0000)
    ship_cmd.set_footer(text=(random.choice(ship_dis)))
    ship_cmd.set_thumbnail(
        url="https://cdn.discordapp.com/attachments/801105512933752882/845050099678576640/unknown.png")
    await ctx.send(embed=ship_cmd)
print("a")

# status
@client.event
async def on_ready():
    await client.change_presence(
        activity=discord.Activity(type=discord.ActivityType.watching, name='TOO MANY NAGITO EDITS!!'))



client.run(TOKEN)

任何帮助解决这个问题都会很棒! -杰克

0 个答案:

没有答案