Fix vote parsing

This commit is contained in:
Jeremy Zhang 2019-11-02 01:14:28 -07:00
parent 2dfdad197e
commit 8dec93d087

View File

@ -605,12 +605,12 @@ def list_users(guild_id):
def webhook_discordbotsorg_vote(): def webhook_discordbotsorg_vote():
incoming = request.get_json() incoming = request.get_json()
client_id = incoming.get('bot') client_id = incoming.get('bot')
if config["client-id"] != client_id: if str(config["client-id"]) != str(client_id):
abort(401) abort(401)
if request.headers.get("Authorization", "") != config.get("discordbotsorg-webhook-secret", ""): if str(request.headers.get("Authorization", "")) != str(config.get("discordbotsorg-webhook-secret", "")):
abort(403) abort(403)
user_id = incoming.get("user") user_id = str(incoming.get("user"))
vote_type = incoming.get("type") vote_type = str(incoming.get("type"))
params = dict(parse_qsl(urlsplit(incoming.get("query", "")).query)) params = dict(parse_qsl(urlsplit(incoming.get("query", "")).query))
if vote_type == "upvote": if vote_type == "upvote":
redis_store.set("DiscordBotsOrgVoted/" + user_id, "voted", 86400) redis_store.set("DiscordBotsOrgVoted/" + user_id, "voted", 86400)