Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # You need to install discord by running "pip install discord.py"
- # I'm assuming nothing will break on python 3.5
- # But it probably will
- import discord
- import argparse
- import sys
- import getopt
- client = discord.Client()
- parser = argparse.ArgumentParser(description='Change your current game on discord.')
- parser.add_argument('username',)
- def main(argv):
- username = ''
- password = ''
- game = ''
- try:
- opts, args = getopt.getopt(argv, "hu:p:g:", ["username=", "password=", "game="])
- except getopt.GetoptError:
- print('change_game.py -u <username> -p <password> -g "<game>" [in quotes]')
- sys.exit(2)
- for opt, arg in opts:
- if opt == '-h':
- print('change_game.py -u <username> -p <password> -g "<game>" [in quotes]')
- sys.exit()
- elif opt in ("-u", "--username"):
- username = arg
- elif opt in ("-p", "--password"):
- password = arg
- elif opt in ("-g", "--game"):
- game = arg.split('"')
- print game
- game = game[0]
- try:
- client.login(username, password)
- except:
- print('Could not log into discord. Check that the username and password are correct.')
- sys.exit(0)
- cur_game = discord.Game(name=game)
- client.change_status(game=cur_game)
- print('Game set to {0}'.format(game))
- if __name__ == "__main__":
- main(sys.argv[1:])
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement