【发布时间】:2021-05-18 23:33:43
【问题描述】:
@commands.Cog.listener()
async def on_message(self, message):
channel = self.client.get_channel(797863482380124170)
if message.channel.id in talk_channel:
stats = levelling.find_one({"id": message.author.id})
if not message.author.bot:
if stats is None:
newuser = {"id": message.author.id, "xp": 100}
levelling.insert_one(newuser)
else:
xp = stats["xp"] + 100
levelling.update_one({"id": message.author.id}, {"$set": {"xp": xp}})
lvl = 0
while True:
if xp < ((50 ** (lvl ** 2)) + (50 * lvl)):
break
lvl += 1
# lvl += 1
xp -= ((50 * ((lvl - 1) ** 2)) + (50 * (lvl - 1)))
if xp == 0:
await message.channel.send(f"{message.author.mention} Lvl Up!")
所以这是我的代码,但 await message.channel.send 不起作用请帮助我
我尝试了很多方法,但都不起作用
【问题讨论】:
标签: python discord.py