Skip to content

Instantly share code, notes, and snippets.

@xziyue
Created December 26, 2020 05:36
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save xziyue/83e4770fdca96cd83f2801ef1d2db8f5 to your computer and use it in GitHub Desktop.
Save xziyue/83e4770fdca96cd83f2801ef1d2db8f5 to your computer and use it in GitHub Desktop.
enter groovy music list into Discord
import time
from pynput.keyboard import Key, Controller
import pyperclip
import json
with open('crawl_list.json', 'r') as infile:
song_list = json.load(infile)
kb = Controller()
input('press enter and focus on Discord input box\nthe script will start in 3 seconds')
time.sleep(3)
for song in song_list:
pyperclip.copy('-play {}'.format(song['url']))
kb.press(Key.ctrl)
kb.press('v')
kb.release('v')
kb.release(Key.ctrl)
kb.press(Key.enter)
kb.release(Key.enter)
time.sleep(1)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment