-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathwcb.py
38 lines (30 loc) · 1.18 KB
/
wcb.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
#!/usr/bin/python3
# -*- coding: utf-8 -*-
#
# WeeChatBot (WCB), ©2020 Sander Smeenk <[email protected]>
#
SN = 'wcb'
SA = 'Sander Smeenk <[email protected]>'
SV = '0.1'
SL = 'GPLv3'
SD = 'Pluggable WeeChat IRC bot'
import sys
sys.dont_write_bytecode = True
import weechat
import wcb_bot as wcb
# Shims for hooking to WeeChatBot-Class functions
def shim_wcb_handle_buffer_input(data, buffer, input_data):
return bot.wcb_handle_buffer_input(data, buffer, input_data)
def shim_wcb_handle_event(data, signal, signal_data):
return bot.wcb_handle_event(data, signal, signal_data)
def shim_wcb_handle_timer_signal(data, remaining_calls):
return bot.wcb_handle_timer_signal(data, remaining_calls)
def shim_wcb_hook_process_callback(callback_data, process, process_rc, process_stdout, process_stderr):
return bot.wcb_handle_hook_process_callback(callback_data, process, process_rc, process_stdout, process_stderr)
def shim_wcb_unload():
return bot.wcb_unload()
def shim_wcb_handle_udp_input(data, fd):
return bot.wcb_handle_udp_input(data, fd)
# Init!
if __name__ == '__main__' and weechat.register(SN, SA, SV, SL, SD, 'shim_wcb_unload', 'UTF-8'):
bot = wcb.WeeChatBot(weechat)