【发布时间】:2020-08-06 05:39:26
【问题描述】:
我是 python 和一般编码的新手。我创建了这个机器人 MIDA,每当我发送一条消息让机器人响应它时,都会用不同的命令输出回复,然后一遍又一遍地发送该消息。
代码:
@client.event
async def on_member_join(member):
for channel in member.server.channels:
if str(channel) == "conversing":
await client.send_message(f"""Welcome Consul {member.mention}""")
@client.event
async def on_message(message):
id = client.get_guild(enter id here)
channels = ("bot-requests")
if str(message.channel) in channels:
if message.content.find("MIDA hello there"):
await message.channel.send("GENERAL KENOBI!")
@client.event
async def on_message(message):
id = client.get_guild(enter id here)
channels = ("bot-requests")
if message.content.find("MIDA users"):
await message.channel.send(f"""# number of members {id.member_count}""")
@client.event
async def on_message(message):
id = client.get_guild(enter id here)
channels = ("bot-requests")
if message.content.find("MIDA Skyrim sucks"):
await message.channel.send("The voice of Todd Howard echos in the past: You're on thin ice kiddo.")
【问题讨论】: