我的命令实际上不起作用,我尝试的其他任何内容(例如
on_message
)也不起作用。我对此有点陌生。
from discord.ext import commands
import discord
import math
import random as r
from discord import message
from discord.colour import Color
token = ''
client = commands.Bot(command_prefix = '%')
@client.event
async def on_ready():
print("Goldie is ready to run. Logged into {0.user}".format(discord.Client()))
@client.command()
async def helpm(ctx):
embed = discord.Embed(
title="Help System", color = discord.colour.Color.gold(),description=" Need some help?\n\nLook below for some commands or other support. For more information visit my website! ").set_author(name="Goldie Support",icon_url='https://ih1.redbubble.net/image.2049235988.9593/st,small,507x507-pad,600x600,f8f8f8.jpg')
embed.add_field(name="Commands", value="%help\n%website", inline=True)
embed.add_field(name="Math", value="`%add(Number 1) (Number 2)`\n%subtract(Number 1) (Number 2)\n%multiply (Number 1) (Number 2)\n%divide (Number 1) (Number 2)\n%remainder (Number 1) (Number 2)\n%random (Parameter 1) (Parameter 2)", inline=True)
embed.add_field(name="Support", value="My website - link", inline=True)
await ctx.send(embed=embed)
client.run(token)
网上看了很多资料,也搜索了很多,都没有效果。不知道是我做错了还是什么。
基于您提供的代码。你的机器人缺乏意图。如果您进行以下更改,您的机器人应该按预期工作:
client = commands.Bot(command_prefix = '%', intents=discord.Intents.all())
@client.event
async def on_ready():
print("Goldie is ready to run. Logged into {0.user}".format(discord.Client(intents=discord.Intents.all())))