mirror of
https://git.wownero.com/wownero/tippero.git
synced 2024-08-15 00:33:14 +00:00
Move some config from the IRC module to the config module
This commit is contained in:
parent
92bd13fdcd
commit
997173f1c6
2 changed files with 11 additions and 9 deletions
|
@ -11,9 +11,13 @@
|
||||||
#
|
#
|
||||||
|
|
||||||
tipbot_name = "monero-testnet-tipbot"
|
tipbot_name = "monero-testnet-tipbot"
|
||||||
|
|
||||||
irc_network = 'irc.freenode.net'
|
irc_network = 'irc.freenode.net'
|
||||||
irc_port = 6667
|
irc_port = 6667
|
||||||
irc_send_delay = 0.4
|
irc_send_delay = 0.4
|
||||||
|
irc_welcome_line = 'Welcome to the freenode Internet Relay Chat Network'
|
||||||
|
irc_homechan = '#txtptest000'
|
||||||
|
irc_timeout_seconds = 600
|
||||||
|
|
||||||
redis_host="127.0.0.1"
|
redis_host="127.0.0.1"
|
||||||
redis_port=7777
|
redis_port=7777
|
||||||
|
|
|
@ -15,15 +15,13 @@ import socket
|
||||||
import select
|
import select
|
||||||
import time
|
import time
|
||||||
import string
|
import string
|
||||||
|
import tipbot.config as config
|
||||||
from tipbot.log import log_error, log_warn, log_info, log_log, log_IRCSEND, log_IRCRECV
|
from tipbot.log import log_error, log_warn, log_info, log_log, log_IRCSEND, log_IRCRECV
|
||||||
|
|
||||||
irc_line_delay = 0
|
irc_line_delay = 0
|
||||||
irc = None
|
irc = None
|
||||||
irc_password = ""
|
irc_password = ""
|
||||||
|
|
||||||
irc_welcome_line = 'Welcome to the freenode Internet Relay Chat Network'
|
|
||||||
irc_homechan = '#txtptest000'
|
|
||||||
irc_timeout_seconds = 600
|
|
||||||
last_ping_time = time.time()
|
last_ping_time = time.time()
|
||||||
irc_network = None
|
irc_network = None
|
||||||
irc_port = None
|
irc_port = None
|
||||||
|
@ -67,7 +65,7 @@ def reconnect_to_irc():
|
||||||
connect_to_irc(irc_network,irc_port,irc_name,irc_password,irc_line_delay)
|
connect_to_irc(irc_network,irc_port,irc_name,irc_password,irc_line_delay)
|
||||||
|
|
||||||
def Send(msg):
|
def Send(msg):
|
||||||
SendIRC ('PRIVMSG ' + irc_homechan + ' : ' + msg)
|
SendIRC ('PRIVMSG ' + config.irc_homechan + ' : ' + msg)
|
||||||
|
|
||||||
def SendTo(where,msg):
|
def SendTo(where,msg):
|
||||||
SendIRC ('PRIVMSG ' + where + ' : ' + msg)
|
SendIRC ('PRIVMSG ' + where + ' : ' + msg)
|
||||||
|
@ -214,8 +212,8 @@ def IRCLoop(on_idle,on_identified,on_command):
|
||||||
on_idle()
|
on_idle()
|
||||||
|
|
||||||
if data == None:
|
if data == None:
|
||||||
if time.time() - last_ping_time > irc_timeout_seconds:
|
if time.time() - last_ping_time > config.irc_timeout_seconds:
|
||||||
log_warn('%s seconds without PING, reconnecting in 5 seconds' % irc_timeout_seconds)
|
log_warn('%s seconds without PING, reconnecting in 5 seconds' % config.irc_timeout_seconds)
|
||||||
time.sleep(5)
|
time.sleep(5)
|
||||||
last_ping_time = time.time()
|
last_ping_time = time.time()
|
||||||
reconnect_to_irc(irc_network,irc_port)
|
reconnect_to_irc(irc_network,irc_port)
|
||||||
|
@ -227,12 +225,12 @@ def IRCLoop(on_idle,on_identified,on_command):
|
||||||
# consider any IRC data as a ping
|
# consider any IRC data as a ping
|
||||||
last_ping_time = time.time()
|
last_ping_time = time.time()
|
||||||
|
|
||||||
if data.find ( irc_welcome_line ) != -1:
|
if data.find ( config.irc_welcome_line ) != -1:
|
||||||
userstable = dict()
|
userstable = dict()
|
||||||
registered_users.clear()
|
registered_users.clear()
|
||||||
SendTo("nickserv", "IDENTIFY %s" % irc_password)
|
SendTo("nickserv", "IDENTIFY %s" % irc_password)
|
||||||
Join(irc_homechan)
|
Join(config.irc_homechan)
|
||||||
#ScanWho(None,[irc_homechan])
|
#ScanWho(None,[config.irc_homechan])
|
||||||
|
|
||||||
if data.find ( 'PING' ) == 0:
|
if data.find ( 'PING' ) == 0:
|
||||||
log_log('Got PING, replying PONG')
|
log_log('Got PING, replying PONG')
|
||||||
|
|
Loading…
Reference in a new issue