def check_for_stats(osu_name):
cursor.execute("SELECT osuId FROM users WHERE osuName = ?", (osu_name,))
osu_id = cursor.fetchall()
if not osu_id:
sender.send_message(osu_name, "Hey ! Nice to meet you, it seems to be your first time here ! Remember that this bot is also available on discord [https://discord.gg/Qsw3yD5 server] [https://discordapp.com/oauth2/authorize?client_id=318357311951208448&scope=bot&permissions=8 add the bot to your server] ! Oh and also, if you need a list of the commands avaiable, type : o!help. GL & HF")
response = requests.get("https://osu.ppy.sh/api/get_user?k=" + constants.Api.osuApiKey + "&u=" + osu_name, verify=True)
data = response.json()
osu_id = data[0]["user_id"]
cursor.execute("INSERT INTO users (osuId, osuName) VALUES (?, ?)", (osu_id, osu_name,))
conn.commit()
api = OsuApi(constants.Api.osuApiKey, connector=ReqConnector())
update_stats.update_stats(0, conn, api, username = osu_name)
return osu_id
else:
return osu_id[0][0]
评论列表
文章目录