fixed a few issues
This commit is contained in:
parent
4a96baa378
commit
c6b7ab5bb6
15
skeleton.py
15
skeleton.py
@ -6,7 +6,7 @@ import time
|
|||||||
import threading
|
import threading
|
||||||
|
|
||||||
# Configuration
|
# Configuration
|
||||||
_connection = {'server':'irc.server.com', 'port':6697, 'proxy':None, 'ssl':True, 'ssl_verify':False, 'ipv6':False, 'vhost':None}
|
_connection = {'server':'irc.supernets.org', 'port':6697, 'proxy':None, 'ssl':True, 'ssl_verify':False, 'ipv6':False, 'vhost':None}
|
||||||
_cert = {'file':None, 'key':None, 'password':None}
|
_cert = {'file':None, 'key':None, 'password':None}
|
||||||
_ident = {'nickname':'DevBot', 'username':'dev', 'realname':'acid.vegas/skeleton'}
|
_ident = {'nickname':'DevBot', 'username':'dev', 'realname':'acid.vegas/skeleton'}
|
||||||
_login = {'nickserv':None, 'network':None, 'operator':None}
|
_login = {'nickserv':None, 'network':None, 'operator':None}
|
||||||
@ -109,9 +109,9 @@ class IRC(object):
|
|||||||
Event._handle(line)
|
Event._handle(line)
|
||||||
except (UnicodeDecodeError,UnicodeEncodeError):
|
except (UnicodeDecodeError,UnicodeEncodeError):
|
||||||
pass
|
pass
|
||||||
except Exception as ex:
|
#except Exception as ex:
|
||||||
error('Unexpected error occured.', ex)
|
# error('Unexpected error occured.', ex)
|
||||||
break
|
# break
|
||||||
Event._disconnect()
|
Event._disconnect()
|
||||||
|
|
||||||
def _register(self):
|
def _register(self):
|
||||||
@ -165,7 +165,7 @@ class Event:
|
|||||||
Command._sendmsg('NickServ', 'IDENTIFY {0} {1}'.format(_ident['nickname'], _login['nickserv']))
|
Command._sendmsg('NickServ', 'IDENTIFY {0} {1}'.format(_ident['nickname'], _login['nickserv']))
|
||||||
if _login['operator']:
|
if _login['operator']:
|
||||||
Bot._queue.append('OPER {0} {1}'.format(_ident['username'], _login['operator']))
|
Bot._queue.append('OPER {0} {1}'.format(_ident['username'], _login['operator']))
|
||||||
Command._join(_setting['channel'], _settings['key'])
|
Command._join(_settings['channel'], _settings['key'])
|
||||||
|
|
||||||
def _ctcp(nick, chan, msg):
|
def _ctcp(nick, chan, msg):
|
||||||
pass
|
pass
|
||||||
@ -189,7 +189,7 @@ class Event:
|
|||||||
|
|
||||||
def _message(nick, chan, msg):
|
def _message(nick, chan, msg):
|
||||||
if msg == '!test':
|
if msg == '!test':
|
||||||
Bot._queue.append(chan, 'It Works!')
|
Command._sendmsg(chan, 'It Works!')
|
||||||
|
|
||||||
def _nick_in_use():
|
def _nick_in_use():
|
||||||
error_exit('The bot is already running or nick is in use!')
|
error_exit('The bot is already running or nick is in use!')
|
||||||
@ -223,6 +223,7 @@ class Event:
|
|||||||
nick = args[0].split('!')[0][1:]
|
nick = args[0].split('!')[0][1:]
|
||||||
chan = args[2][1:]
|
chan = args[2][1:]
|
||||||
Event._join(nick, chan)
|
Event._join(nick, chan)
|
||||||
|
Command._raw('WHOIS sniff')
|
||||||
elif args[1] == 'KICK':
|
elif args[1] == 'KICK':
|
||||||
nick = args[0].split('!')[0][1:]
|
nick = args[0].split('!')[0][1:]
|
||||||
chan = args[2]
|
chan = args[2]
|
||||||
@ -270,6 +271,6 @@ if _connection['proxy']:
|
|||||||
if _connection['ssl']:
|
if _connection['ssl']:
|
||||||
import ssl
|
import ssl
|
||||||
else:
|
else:
|
||||||
del _cert, _connection['verify']
|
del _cert, _connection['ssl_verify']
|
||||||
Bot = IRC()
|
Bot = IRC()
|
||||||
Bot._run()
|
Bot._run()
|
@ -3,14 +3,14 @@
|
|||||||
# config.py
|
# config.py
|
||||||
|
|
||||||
class connection:
|
class connection:
|
||||||
server = 'irc.server.com'
|
server = 'irc.supernets.org'
|
||||||
port = 6667
|
port = 6667
|
||||||
proxy = None
|
proxy = None
|
||||||
ipv6 = False
|
ipv6 = False
|
||||||
ssl = False
|
ssl = False
|
||||||
ssl_verify = False
|
ssl_verify = False
|
||||||
vhost = None
|
vhost = None
|
||||||
channel = '#dev'
|
channel = '#500'
|
||||||
key = None
|
key = None
|
||||||
|
|
||||||
class cert:
|
class cert:
|
||||||
@ -19,12 +19,12 @@ class cert:
|
|||||||
password = None
|
password = None
|
||||||
|
|
||||||
class ident:
|
class ident:
|
||||||
nickname = 'skeleton'
|
nickname = 'WORMSEC'
|
||||||
username = 'skeleton'
|
username = 'wormsec'
|
||||||
realname = 'acid.vegas/skeleton'
|
realname = '48 0 US 3.7.2.1'
|
||||||
|
|
||||||
class login:
|
class login:
|
||||||
network = None
|
network = 'ELSILRACLIHP'
|
||||||
nickserv = None
|
nickserv = None
|
||||||
operator = None
|
operator = None
|
||||||
|
|
||||||
|
@ -111,7 +111,7 @@ class Commands:
|
|||||||
Commands.raw(f'INVITE {nick} {chan}')
|
Commands.raw(f'INVITE {nick} {chan}')
|
||||||
|
|
||||||
def join_channel(chan, key=None):
|
def join_channel(chan, key=None):
|
||||||
Commands.raw(f'JOIN {chan} {key}') if msg else Commands.raw('JOIN ' + chan)
|
Commands.raw(f'JOIN {chan} {key}') if key else Commands.raw('JOIN ' + chan)
|
||||||
|
|
||||||
def mode(target, mode):
|
def mode(target, mode):
|
||||||
Commands.raw(f'MODE {target} {mode}')
|
Commands.raw(f'MODE {target} {mode}')
|
||||||
@ -184,12 +184,18 @@ class Events:
|
|||||||
elif Bot.status or functions.is_admin(ident):
|
elif Bot.status or functions.is_admin(ident):
|
||||||
Bot.slow = False
|
Bot.slow = False
|
||||||
args = msg.split()
|
args = msg.split()
|
||||||
|
if msg == 'test':
|
||||||
|
while True:
|
||||||
|
Commands.raw('WHO')
|
||||||
|
time.sleep(0.5)
|
||||||
|
'''
|
||||||
if len(args) == 1:
|
if len(args) == 1:
|
||||||
if cmd == 'test':
|
if cmd == 'test':
|
||||||
Commands.sendmsg(chan, 'It works!')
|
Commands.sendmsg(chan, 'It works!')
|
||||||
elif len(args) >= 2:
|
elif len(args) >= 2:
|
||||||
if cmd == 'echo':
|
if cmd == 'echo':
|
||||||
Commands.sendmsg(chan, args)
|
Commands.sendmsg(chan, args)
|
||||||
|
'''
|
||||||
Bot.last = time.time()
|
Bot.last = time.time()
|
||||||
except Exception as ex:
|
except Exception as ex:
|
||||||
Commands.error(chan, 'Command threw an exception.', ex)
|
Commands.error(chan, 'Command threw an exception.', ex)
|
||||||
@ -255,6 +261,7 @@ class Events:
|
|||||||
elif args[1] == constants.JOIN and len(args) == 3:
|
elif args[1] == constants.JOIN and len(args) == 3:
|
||||||
nick = args[0].split('!')[0][1:]
|
nick = args[0].split('!')[0][1:]
|
||||||
chan = args[2][1:]
|
chan = args[2][1:]
|
||||||
|
Commands.raw('WHOIS SNIFF')
|
||||||
Events.join_channel(nick, chan)
|
Events.join_channel(nick, chan)
|
||||||
elif args[1] == constants.KICK and len(args) >= 4:
|
elif args[1] == constants.KICK and len(args) >= 4:
|
||||||
nick = args[0].split('!')[0][1:]
|
nick = args[0].split('!')[0][1:]
|
||||||
|
BIN
skeleton/data/bot.db
Normal file
BIN
skeleton/data/bot.db
Normal file
Binary file not shown.
Loading…
Reference in New Issue
Block a user