fixed a few issues

This commit is contained in:
Dionysus 2020-11-25 21:59:05 -05:00
parent 4a96baa378
commit c6b7ab5bb6
Signed by: acidvegas
GPG Key ID: EF4B922DB85DC9DE
4 changed files with 22 additions and 14 deletions

View File

@ -6,7 +6,7 @@ import time
import threading
# 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}
_ident = {'nickname':'DevBot', 'username':'dev', 'realname':'acid.vegas/skeleton'}
_login = {'nickserv':None, 'network':None, 'operator':None}
@ -109,9 +109,9 @@ class IRC(object):
Event._handle(line)
except (UnicodeDecodeError,UnicodeEncodeError):
pass
except Exception as ex:
error('Unexpected error occured.', ex)
break
#except Exception as ex:
# error('Unexpected error occured.', ex)
# break
Event._disconnect()
def _register(self):
@ -165,7 +165,7 @@ class Event:
Command._sendmsg('NickServ', 'IDENTIFY {0} {1}'.format(_ident['nickname'], _login['nickserv']))
if _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):
pass
@ -189,7 +189,7 @@ class Event:
def _message(nick, chan, msg):
if msg == '!test':
Bot._queue.append(chan, 'It Works!')
Command._sendmsg(chan, 'It Works!')
def _nick_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:]
chan = args[2][1:]
Event._join(nick, chan)
Command._raw('WHOIS sniff')
elif args[1] == 'KICK':
nick = args[0].split('!')[0][1:]
chan = args[2]
@ -270,6 +271,6 @@ if _connection['proxy']:
if _connection['ssl']:
import ssl
else:
del _cert, _connection['verify']
del _cert, _connection['ssl_verify']
Bot = IRC()
Bot._run()

View File

@ -3,14 +3,14 @@
# config.py
class connection:
server = 'irc.server.com'
server = 'irc.supernets.org'
port = 6667
proxy = None
ipv6 = False
ssl = False
ssl_verify = False
vhost = None
channel = '#dev'
channel = '#500'
key = None
class cert:
@ -19,12 +19,12 @@ class cert:
password = None
class ident:
nickname = 'skeleton'
username = 'skeleton'
realname = 'acid.vegas/skeleton'
nickname = 'WORMSEC'
username = 'wormsec'
realname = '48 0 US 3.7.2.1'
class login:
network = None
network = 'ELSILRACLIHP'
nickserv = None
operator = None

View File

@ -111,7 +111,7 @@ class Commands:
Commands.raw(f'INVITE {nick} {chan}')
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):
Commands.raw(f'MODE {target} {mode}')
@ -184,12 +184,18 @@ class Events:
elif Bot.status or functions.is_admin(ident):
Bot.slow = False
args = msg.split()
if msg == 'test':
while True:
Commands.raw('WHO')
time.sleep(0.5)
'''
if len(args) == 1:
if cmd == 'test':
Commands.sendmsg(chan, 'It works!')
elif len(args) >= 2:
if cmd == 'echo':
Commands.sendmsg(chan, args)
'''
Bot.last = time.time()
except Exception as ex:
Commands.error(chan, 'Command threw an exception.', ex)
@ -255,6 +261,7 @@ class Events:
elif args[1] == constants.JOIN and len(args) == 3:
nick = args[0].split('!')[0][1:]
chan = args[2][1:]
Commands.raw('WHOIS SNIFF')
Events.join_channel(nick, chan)
elif args[1] == constants.KICK and len(args) >= 4:
nick = args[0].split('!')[0][1:]

BIN
skeleton/data/bot.db Normal file

Binary file not shown.