尝试制作不和谐机器人的完全业余爱好者。
@client.command(pass_context=True) ##checking for people on the map
async def inspect1(ctx):
test = collection.find({"Country": "Umi" , "Location": "Start"})
position = collection.distinct("Position" , {"Country": "Umi", "Location": "Start"})
print(position)
name = collection.distinct("Name" , {"Country": "Umi", "Location": "Start"})
print(name)
for result in test:
name1 = result["Name"]
position1 = result["Position"]
print("Player {} at {}".format(name1 , position1))
await ctx.channel.send(("Player {} at {}".format(name1 , position1)))
await ctx.channel.send("Players:{} \nAt locations: {}".format(name , position))
据我所知,每当我尝试从多个文档中引用信息时,都会在尝试发送消息时出现问题。当我打印它时,它将所有相关条目打印到底部的日志中,但是当我尝试发布它时,它只发布列表中匹配的最后一个条目。编辑数据库中的文档最终只会将最后一部分保存在那里,但我不知道为什么要这样做。
Attached shows both Player test (and location) as well as Player tester in the print, but not the discord post.(我知道它发布了两次,它们是我试图使这项工作的两种不同方式,我希望使独特的方式工作,因为它在功能上更准确)