weechat-notify/weechat-notify.py

33 lines
709 B
Python
Raw Permalink Normal View History

2022-05-11 12:16:57 -05:00
import weechat
import wn_backend
2022-07-09 01:18:33 -05:00
weechat.register(
"weechat-notify",
"Yash Karandikar",
"22.05.11",
"Unlicense",
"Notification script for weechat",
"",
"",
)
2022-05-11 12:16:57 -05:00
def notify(data, signal, signal_data):
arr = signal_data.split("\t")
2022-07-09 01:18:10 -05:00
if len(arr) == 1:
a = arr[0].split("PRIVMSG")
b = a[0].split("!")[0].removeprefix(":")
c = a[1].split(":")[1]
arr = [b, c]
2022-05-11 12:16:57 -05:00
nick = arr[0]
2022-07-09 01:18:10 -05:00
text = arr[1]
2022-07-09 01:18:33 -05:00
wn_backend.send_notification(
"/usr/share/icons/Papirus-Dark/128x128/apps/weechat.svg", nick, text
)
2022-05-11 12:16:57 -05:00
return weechat.WEECHAT_RC_OK
2022-07-09 01:18:33 -05:00
weechat.hook_signal("weechat_highlight", "notify", "")
weechat.hook_signal("irc_pv", "notify", "")