Mee6 py api not refreshing



我正在尝试使用一个api为mee6使用python的一个不和谐的机器人得到一个用户的经验。

下面是使用client.run remove 的代码
import discord
from discord.ext import commands
import os
from mee6_py_api import API
from discord.ext import tasks
mee6API = API(670824141225590815)
client = commands.Bot(command_prefix = '$')
@client.event
async def on_ready():
print('Logged in as {0.user}'.format(client))
@client.command()
async def xp(ctx):
xp = await mee6API.levels.get_user_xp(ctx.message.author.id)
await ctx.send("Your xp is {}.".format(xp))

当我启动程序时,它在第一个命令上准确地工作,但之后的每一次,它都显示完全相同的xp数字,即使我获得了mee6级别网站上显示的xp。

我知道这是一个很晚的回复,但我希望它仍然帮助别人。我偶然发现了这个问题,因为我有同样的问题,我相信我通过查看mee6-py-api的github找到了解决方案。(https://github.com/hyperevo/mee6-py-api)

api自动缓存你的最后一个请求,只是在你的下一个请求中再次给出它,要覆盖这个,你必须使用参数dont_use_cache = True。当获取用户详细信息、用户xp或用户级别时,该参数可用。

所以这里应该为你工作:

xp = await mee6API.levels.get_user_xp(ctx.message.author.id, dont_use_cache = True)

如果你想获得上面提到的级别或用户详细信息,也是一样的。

最新更新