skeleton

- bot skeleton for irc
git clone git://git.acid.vegas/skeleton.git
Log | Files | Refs | Archive | README | LICENSE

commit c6b7ab5bb64476f196d8b841e2482745403c288a
parent 4a96baa37842bbd27d977662da14d071898106eb
Author: acidvegas <acid.vegas@acid.vegas>
Date: Wed, 25 Nov 2020 21:59:05 -0500

fixed a few issues

Diffstat:
Mskeleton.py | 15++++++++-------
Mskeleton/core/config.py | 12++++++------
Mskeleton/core/irc.py | 9++++++++-
Askeleton/data/bot.db | 0

4 files changed, 22 insertions(+), 14 deletions(-)

diff --git a/skeleton.py b/skeleton.py
@@ -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()
 \ No newline at end of file
diff --git a/skeleton/core/config.py b/skeleton/core/config.py
@@ -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
 
diff --git a/skeleton/core/irc.py b/skeleton/core/irc.py
@@ -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:]
diff --git a/skeleton/data/bot.db b/skeleton/data/bot.db
Binary files differ.