【发布时间】:2022-11-27 01:08:49
【问题描述】:
你好,我是 stackoverflow 的新手,我正在开发一个不和谐的机器人 但它不会仅在 mp 中对我的不和谐服务器中的命令做出反应
这是我的代码
`
from discord.ext import commands
TOKEN = "X"
bot = commands.Bot(command_prefix="!")
@bot.event
async def on_ready():
print(f'{bot.user} succesfully logged in!')
@bot.event
async def on_message(message):
# Make sure the Bot doesn't respond to it's own messages
if message.author == bot.user:
return
if message.content == 'hello':
await message.channel.send(f'Hi {message.author}')
if message.content == 'bye':
await message.channel.send(f'Goodbye {message.author}')
await bot.process_commands(message)
@bot.command()
async def test(ctx, *, arg):
await ctx.send(arg)
def to_upper(argument):
return argument.upper()
@bot.command()
async def up(ctx, *, content: to_upper):
await ctx.send(content)
bot.run(TOKEN)
` 请帮我 IN a server : in a mp:
我尝试了很多东西 但没有任何效果我正在为我的朋友制作一个不错的机器人而且我是 discord.py 的菜鸟
【问题讨论】:
-
Does this回答你的问题?
标签: python-3.x discord discord.py bots