我尝试在互联网上寻找答案,但没有找到解决我问题的方法:
import os
import asyncio
import discord
from discord.ext import commands
token = "here is my token"
bot = discord.Client()
bot = commands.Bot(command_prefix='!')
@bot.command()
async def length(ctx):
await ctx.send('your message is {} characters long.'.format(len(ctx.message.content)))
print("test print")
bot.run(token)
length
功能根本无法使用,并且无法在控制台中打印测试打印。
有人知道问题出在哪里吗?还有一些其他bot.xxx
函数可以正常工作。
答案 0 :(得分:0)
它不起作用,因为您有双重机器人。
您只能有bot = commands.Bot(command_prefix='!')