faut que je trouve des blagues de cul, rapport avec le nom du projet, m'voyez ?
This commit is contained in:
parent
f24dac6714
commit
2053ef7388
|
@ -1,19 +0,0 @@
|
|||
#!/usr/bin/env python3
|
||||
|
||||
import socket
|
||||
|
||||
sock = socket.socket(socket.AF_UNIX, socket.SOCK_STREAM)
|
||||
sockpath = "/root/sexiibot/sexiibot.sock"
|
||||
try:
|
||||
sock.connect(sockpath)
|
||||
except socket.error:
|
||||
sys.exit(1)
|
||||
|
||||
try:
|
||||
|
||||
# Send data
|
||||
message = 'join #bordel'
|
||||
sock.sendall(bytes(message, 'UTF-8'))
|
||||
|
||||
finally:
|
||||
sock.close()
|
|
@ -1,19 +0,0 @@
|
|||
#!/usr/bin/env python3
|
||||
|
||||
import socket
|
||||
|
||||
sock = socket.socket(socket.AF_UNIX, socket.SOCK_STREAM)
|
||||
sockpath = "/root/sexiibot/sexiibot.sock"
|
||||
try:
|
||||
sock.connect(sockpath)
|
||||
except socket.error:
|
||||
sys.exit(1)
|
||||
|
||||
try:
|
||||
|
||||
# Send data
|
||||
message = 'leave #bordel'
|
||||
sock.sendall(bytes(message, 'UTF-8'))
|
||||
|
||||
finally:
|
||||
sock.close()
|
|
@ -0,0 +1,69 @@
|
|||
#!/usr/bin/env python3
|
||||
|
||||
import socket
|
||||
import sys
|
||||
import os
|
||||
|
||||
sock = socket.socket(socket.AF_UNIX, socket.SOCK_STREAM)
|
||||
sockpath = "/var/tmp/%s/sexiibot.sock" % os.environ["USER"]
|
||||
|
||||
logo = """\
|
||||
.-.
|
||||
(/ \)
|
||||
(\ /) SEXIIBOT : The Bot Of Your Dreams
|
||||
.-'-. Simple EXtensible II Bot
|
||||
/(_Y_)\\ v.0.1.1
|
||||
\\\\) (//
|
||||
/ \ Author: raspbeguy
|
||||
\ Y / raspbeguy@hashtagueule.fr
|
||||
\|/
|
||||
/|\ https://git.hashtagueule.fr/raspbeguy/sexiibot
|
||||
\|/
|
||||
/Y\\
|
||||
"""
|
||||
|
||||
usage = """\
|
||||
usage: %s [-p <path_to_socket>] <command>
|
||||
|
||||
To get a list of possible commands, use command "help"
|
||||
"""
|
||||
|
||||
args = sys.argv
|
||||
|
||||
if len(args) < 2:
|
||||
print(usage, file=sys.stderr)
|
||||
sys.exit(1)
|
||||
elif args[1] == "-v":
|
||||
print(logo)
|
||||
sys.exit(0)
|
||||
elif args[1] == "-p":
|
||||
try:
|
||||
sockpath = args[2]
|
||||
except IndexError:
|
||||
print(usage, file=sys.stderr)
|
||||
sys.exit(1)
|
||||
message = " ".join(args[3:])
|
||||
else:
|
||||
message = " ".join(args[1:])
|
||||
|
||||
try:
|
||||
print(message)
|
||||
sock.connect(sockpath)
|
||||
except socket.error:
|
||||
error = """\
|
||||
It seems that sexiibot isn't awaken.
|
||||
To start your sexiibot instance, run the following command:
|
||||
sexiictl start <config_file>
|
||||
|
||||
It is also possible than the instance of sexiibot you're trying to reach uses a different control socket.
|
||||
You can try running the following command :
|
||||
sexiictl -p <path_to_socket> """ + "".join(sys.argv[1:]) + """
|
||||
|
||||
If you need help to generate a config file, use the sexiiwizard script.
|
||||
"""
|
||||
print(error, file=sys.stderr)
|
||||
sys.exit(1)
|
||||
try:
|
||||
sock.sendall(bytes(message, 'UTF-8'))
|
||||
finally:
|
||||
sock.close()
|
|
@ -116,9 +116,11 @@ class Sexiibot(object):
|
|||
def leaveChan(self, args):
|
||||
if len(args) == 1:
|
||||
self.__channels[args[0]].leave()
|
||||
if len(args) == 2:
|
||||
elif if len(args) == 2:
|
||||
self.__channels[args[0]].leave(args[1])
|
||||
del self.__channel[args[0]]
|
||||
else:
|
||||
return "warning: \"%s\" garbage"
|
||||
del self.__channels[args[0]]
|
||||
|
||||
def incomingChan(self, dirname):
|
||||
root = self.getIrcPath()
|
||||
|
@ -151,12 +153,12 @@ class Sexiibot(object):
|
|||
data = connection.recv(16)
|
||||
command += data.decode('UTF-8')
|
||||
if not data:
|
||||
self.parseCommand(command)
|
||||
self.parseCommand(command, connexion)
|
||||
break
|
||||
finally:
|
||||
connection.close()
|
||||
|
||||
def parseCommand(self, command):
|
||||
def parseCommand(self, command, connexion):
|
||||
cmd = command.split(" ")
|
||||
order = {
|
||||
"join" : self.newChan,
|
||||
|
@ -166,7 +168,7 @@ class Sexiibot(object):
|
|||
"action" : self.actionChan,
|
||||
"nick" : self.setNick
|
||||
}
|
||||
order[cmd[0]](cmd[1:])
|
||||
#connection.sendall(order[cmd[0]](cmd[1:], 'UTF-8'))
|
||||
|
||||
def quit(selfi, args=[]):
|
||||
for chan in self.__channels:
|
||||
|
|
Loading…
Reference in New Issue