Discord.py 试图使Discord bot发送使用多个随机选择的单词的消息
我想用Discord.py创建一个Discord机器人,它发送一条由随机选择的预定单词组成的消息。我尝试在第一个变量之后插入另一个变量,但这只会导致语法错误。顺便说一下,这是我的代码Discord.py 试图使Discord bot发送使用多个随机选择的单词的消息,discord.py,Discord.py,我想用Discord.py创建一个Discord机器人,它发送一条由随机选择的预定单词组成的消息。我尝试在第一个变量之后插入另一个变量,但这只会导致语法错误。顺便说一下,这是我的代码 @client.event async def on_message(message): if message.author == client.user: return if message.content.startswith('f!generate'): vari
@client.event
async def on_message(message):
if message.author == client.user:
return
if message.content.startswith('f!generate'):
variable1 = [
'test',
'test2',
'test3',]
variable2 = [
'test',
'test2',
'test3',]
await message.channel.send((random.choice(variable1)),(random.choice(variable2)))
如何解决此问题?
Messageable.send
只接受1个位置参数,传递2个。只需将这两个字符串加在一起,就可以了
wait message.channel.send(random.choice(variable1)+random.choice(variable2))
是否有错误?机器人发送了什么?我想OP是以元组的形式传递的?他传递了两个元组