-
Notifications
You must be signed in to change notification settings - Fork 0
/
emote.py
42 lines (33 loc) · 987 Bytes
/
emote.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
# -*- coding: utf-8 -*-
#
# Insert unicode faces into weechat
#
# Usage: /emote name
#
# History:
#
# Version 1.0.0: initial release
import weechat
mappings = {
"disapproval": "ಠ_ಠ",
"doubleflip": "┻━┻ ︵ \(°□°)/ ︵ ┻━┻",
"shrug": "¯\_(ツ)_/¯",
"tableflip": "(╯°□°)╯︵ ┻━┻",
}
def emote(data, buf, args):
try:
key = args.split()[0]
value = mappings[key]
weechat.buffer_set(buf, "input", value)
weechat.buffer_set(buf, "input_pos", str(len(value)))
except (IndexError, KeyError):
pass
return weechat.WEECHAT_RC_OK
def main():
if not weechat.register("emote", "Keith Smiley", "1.0.0", "MIT",
"Paste awesome unicode!", "", ""):
return weechat.WEECHAT_RC_ERROR
weechat.hook_command("emote", "Paste awesome unicode!", "", "",
"|".join(mappings.keys()), "emote", "")
if __name__ == "__main__":
main()