Skip to content

Instantly share code, notes, and snippets.

@tkoz0
Created March 29, 2021 11:21
Show Gist options
  • Save tkoz0/2026cc3578beeaea4bb61e1c7f767815 to your computer and use it in GitHub Desktop.
Save tkoz0/2026cc3578beeaea4bb61e1c7f767815 to your computer and use it in GitHub Desktop.
Some dumb thing I wrote a long time ago to copy and paste discord messages written in emoji
import sys
map_ = dict()
for c in 'abcdefghijklmnopqrstuvwxyz':
map_[c] = ':regional_indicator_'+c+':'
map_['0'] = ':zero:'
map_['1'] = ':one:'
map_['2'] = ':two:'
map_['3'] = ':three:'
map_['4'] = ':four:'
map_['5'] = ':five:'
map_['6'] = ':six:'
map_['7'] = ':seven:'
map_['8'] = ':eight:'
map_['9'] = ':nine:'
map_[' '] = ' '
if len(sys.argv) > 1: # modify some characters
if 'a' in sys.argv[1]: map_['a'] = ':a:'
if 'b' in sys.argv[1]: map_['b'] = ':b:'
if 'o' in sys.argv[1]: map_['o'] = ':o:'
for line in sys.stdin:
try: print(' '.join(map_[c] for c in line[:-1].lower()))
except: sys.stderr.write('invalid character\n')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment