Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/bin/python3
- import sys, random
- ## HOW TO USE:
- ## python emojitext.py "your text here" zws
- ## zws: This option is used to enable a zero-width space character to prevent discord from
- ## converting your characters into flags.
- DIGIT = [':zero:', ':one:', ':two:', ':three:', ':four:', ':five:', ':six:', ':seven:', ':eight:', ':nine:']
- ALTS = ['ben', 'crap', 'jx9', 'tuts', 'thinking', 'smirk', 'tada', 'snus', 'punk', 'face_palm', 'facepalm', 'clap', 'ok_hand', 'smile', '1234']
- ZWS = '\u200b' if len(sys.argv) > 2 and sys.argv[2] == 'zws' else ''
- def to_emoji(word):
- if word in ALTS:
- print(':%s:' % word, end=ZWS)
- else:
- for c in word:
- if random.randint(0, 100) >= 50 and c == 'b':
- print(':b:', end=ZWS)
- else:
- if c.isdigit():
- print(DIGIT[int(c)], end=ZWS)
- else:
- print(':regional_indicator_%s:' % c, end=ZWS)
- if len(sys.argv) > 1:
- spl = sys.argv[1].lower().split(' ')
- for word in spl:
- to_emoji(word.strip())
- print('', end=' ')
- print('')
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement