import requests
import json
import sys

def main():
    if len(sys.argv) != 2:
        print("Usage: python3 {} <token>".format(sys.argv[0]))
        sys.exit(1)

    token = sys.argv[1]
    headers = {
        'Authorization': token,
        'Content-Type': 'application/json'
    }

    r = requests.get('https://discordapp.com/api/v6/users/@me', headers=headers)
    if r.status_code != 200:
        print("[-] Error: {}".format(r.status_code))
        sys.exit(1)

    user = json.loads(r.text)
    print("[+] User: {}".format(user['username']))
    print("[+] ID: {}".format(user['id']))
    print("[+] Email: {}".format(user['email']))
    print("[+] Avatar: {}".format(user['avatar']))
    print("[+] Locale: {}".format(user['locale']))
    print("[+] MFA: {}".format(user['mfa_enabled']))
    print("[+] Flags: {}".format(user['flags']))
    print("[+] Premium Type: {}".format(user['premium_type']))

if __name__ == '__main__':
    main()

# You need a developer API token which is not hard to obtain
# https://www.writebots.com/discord-bot-token/