mirror of
https://git.wownero.com/wownero/tippero.git
synced 2024-08-15 00:33:14 +00:00
Add a quit command
This commit is contained in:
parent
8d115438a3
commit
852e75dc16
2 changed files with 21 additions and 0 deletions
|
@ -32,6 +32,7 @@ current_send_delay = irc_min_send_delay
|
|||
irc_network = None
|
||||
irc_port = None
|
||||
irc_name = None
|
||||
irc_quitting = False
|
||||
|
||||
userstable=dict()
|
||||
registered_users=set()
|
||||
|
@ -115,6 +116,11 @@ def Join(chan):
|
|||
def Part(chan):
|
||||
SendIRC ( 'PART ' + chan)
|
||||
|
||||
def Quit(msg):
|
||||
global irc_quitting
|
||||
irc_quitting = True
|
||||
SendIRC ( 'QUIT%s' % msg)
|
||||
|
||||
def Who(chan):
|
||||
userstable[chan] = dict()
|
||||
SendIRC ( 'WHO ' + chan)
|
||||
|
@ -280,6 +286,9 @@ def IRCLoop(on_idle,on_identified,on_command):
|
|||
continue
|
||||
|
||||
if data.find('ERROR :Closing Link:') == 0:
|
||||
if irc_quitting:
|
||||
log_info('IRC stopped, bye')
|
||||
break
|
||||
log_warn('We were kicked from IRC, reconnecting in 5 seconds')
|
||||
time.sleep(5)
|
||||
last_ping_time = time.time()
|
|
@ -39,6 +39,11 @@ def PartChannel(nick,chan,cmd):
|
|||
pchan = chan
|
||||
Part(pchan)
|
||||
|
||||
def QuitIRC(nick,chan,cmd):
|
||||
msg = ""
|
||||
for w in cmd[:1]:
|
||||
msg = msg + " " + w
|
||||
Quit(msg)
|
||||
|
||||
RegisterCommand({
|
||||
'module': __name__,
|
||||
|
@ -56,3 +61,10 @@ RegisterCommand({
|
|||
'admin': True,
|
||||
'help': "Makes %s part from a channel" % (config.tipbot_name)
|
||||
})
|
||||
RegisterCommand({
|
||||
'module': __name__,
|
||||
'name': 'quit',
|
||||
'function': QuitIRC,
|
||||
'admin': True,
|
||||
'help': "Makes %s quit IRC" % (config.tipbot_name)
|
||||
})
|
||||
|
|
Loading…
Reference in a new issue