-
Notifications
You must be signed in to change notification settings - Fork 5
/
text.py
82 lines (68 loc) · 1.24 KB
/
text.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
# -*- coding: utf-8 -*-
import itertools
from sopel import module
flip_table = {
'1': 'Ɩ',
'2': 'ᄅ',
'3': 'Ɛ',
'4': 'ㄣ',
'5': 'ϛ',
'6': '9',
'7': 'ㄥ',
'8': '8',
'9': '6',
'0': '0',
'a': 'ɐ',
'b': 'q',
'c': 'ɔ',
'd': 'p',
'e': 'ǝ',
'f': 'ɟ',
'g': 'ƃ',
'h': 'ɥ',
'i': 'ı',
'j': 'ɾ',
'k': 'ʞ',
'l': 'ן',
'm': 'ɯ',
'n': 'u',
'o': 'o',
'p': 'd',
'q': 'b',
'r': 'ɹ',
's': 's',
't': 'ʇ',
'u': 'n',
'v': 'ʌ',
'w': 'ʍ',
'x': 'x',
'y': 'ʎ',
'z': 'z',
'.': '',
'[': ']',
'(': ')',
'{': '}',
'?': '¿',
'!': '¡',
"'": ',',
'<': '>',
'_': '‾',
'"': '„',
';': '؛'
}
def _reverse(text):
return text[::-1]
def _map_by_table(table, text):
return "".join(table.get(w, w) for w in text)
def caps(bot, input):
bot.say(input.upper())
caps.commands = ['caps']
def reverse(bot, input):
bot.say(input[::-1])
reverse.commands = ['reverse']
def flip(bot, input):
flip_reverse(bot, input[::-1])
flip.commands = ['flip']
def flip_reverse(bot, input):
bot.say(_map_by_table(flip_table, input.lower()))
flip_reverse.commands = ['flip_reverse']