我仍然真的不熟悉Discord Bots(在相同的24小时内),但是我似乎无法弄清楚为什么这个异步功能没有运行,而我的其他<section>
<h2>Title here</h2>
<article>
<div>
<div class="image">
<img s src="https://upload.wikimedia.org/wikipedia/commons/0/01/Aloe_vera_%284759242525%29.jpg" >
</div>
<div>
<h3> text that needs to be wrapped here</h3>
text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text
xt text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text
xt text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text
xt text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text
xt text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text
xt text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text
</div>
</article>
</section>
功能却可以正常工作很好,我感到很困惑。
on_message
我还试图找出如何查找第二个功能发送消息的通道。因此,如果用户在@bot.event
async def on_ready():
print('Logged in')
print("Username: %s" % (bot.user.name))
print("Userid: %s" % (bot.user.id))
@bot.event
async def on_message(message): # function doesn't run
print("function test")
if message.author.id==bot.user.id:
return
if 'foo' in message.content.lower():
await message.channel.send('{0.author.mention} bar'.format(message))
@bot.event
async def on_message(message):
print("function2 test") # function does run
userNames=["foo","bar"]
if message.author.id==bot.user.id:
return
for name in userNames:
if name in message.content.lower():
await message.channel.send('{0.author.mention} use <#754183376621010954>'.format(message))
with open("Token.txt","r") as f:
bot.run(f.read())
中键入包含元素的消息,则会提及它们并向他们发送频道。