.HIDE. Suppress memes, idgaf
This commit is contained in:
parent
6c85995e53
commit
611216fea2
|
@ -12,6 +12,7 @@ from constants import mods
|
||||||
from helpers import generalFunctions
|
from helpers import generalFunctions
|
||||||
|
|
||||||
from helpers import consoleHelper
|
from helpers import consoleHelper
|
||||||
|
from helpers import discordBotHelper
|
||||||
from constants import bcolors
|
from constants import bcolors
|
||||||
|
|
||||||
"""
|
"""
|
||||||
|
@ -176,7 +177,10 @@ def silence(fro, chan, message):
|
||||||
if targetToken != None:
|
if targetToken != None:
|
||||||
targetToken.enqueue(serverPackets.silenceEndTime(silenceTime))
|
targetToken.enqueue(serverPackets.silenceEndTime(silenceTime))
|
||||||
|
|
||||||
return "{} has been silenced for the following reason: {}".format(target, reason)
|
# Log message
|
||||||
|
msg = "{} has been silenced for the following reason: {}".format(target, reason)
|
||||||
|
discordBotHelper.sendConfidential(msg)
|
||||||
|
return msg
|
||||||
|
|
||||||
def removeSilence(fro, chan, message):
|
def removeSilence(fro, chan, message):
|
||||||
# Get parameters
|
# Get parameters
|
||||||
|
|
|
@ -12,6 +12,7 @@ from events import channelJoinEvent
|
||||||
import sys
|
import sys
|
||||||
import traceback
|
import traceback
|
||||||
from helpers import requestHelper
|
from helpers import requestHelper
|
||||||
|
from helpers import discordBotHelper
|
||||||
|
|
||||||
def handle(tornadoRequest):
|
def handle(tornadoRequest):
|
||||||
# Data to return
|
# Data to return
|
||||||
|
@ -183,4 +184,8 @@ def handle(tornadoRequest):
|
||||||
if err == True:
|
if err == True:
|
||||||
consoleHelper.printColored("> {}'s login failed".format(loginData[0]), bcolors.YELLOW)
|
consoleHelper.printColored("> {}'s login failed".format(loginData[0]), bcolors.YELLOW)
|
||||||
|
|
||||||
|
# Discord message
|
||||||
|
discordBotHelper.sendConfidential("Bancho login request from {} for user {} ({})".format(requestIP, loginData[0], "failed" if err == True else "success"))
|
||||||
|
|
||||||
|
# Return token string and data
|
||||||
return (responseTokenString, responseData)
|
return (responseTokenString, responseData)
|
||||||
|
|
|
@ -81,7 +81,7 @@ class handler(requestHelper.asyncRequestHandler):
|
||||||
# Token exists, get its object and lock it
|
# Token exists, get its object and lock it
|
||||||
userToken = glob.tokens.tokens[requestTokenString]
|
userToken = glob.tokens.tokens[requestTokenString]
|
||||||
userToken.lock.acquire()
|
userToken.lock.acquire()
|
||||||
consoleHelper.printColored("[{}] locked".format(userToken.token), bcolors.YELLOW)
|
#consoleHelper.printColored("[{}] locked".format(userToken.token), bcolors.YELLOW)
|
||||||
|
|
||||||
# Keep reading packets until everything has been read
|
# Keep reading packets until everything has been read
|
||||||
while pos < len(requestData):
|
while pos < len(requestData):
|
||||||
|
@ -171,7 +171,7 @@ class handler(requestHelper.asyncRequestHandler):
|
||||||
finally:
|
finally:
|
||||||
# Unlock token
|
# Unlock token
|
||||||
if userToken != None:
|
if userToken != None:
|
||||||
consoleHelper.printColored("[{}] unlocked".format(userToken.token), bcolors.GREEN)
|
#consoleHelper.printColored("[{}] unlocked".format(userToken.token), bcolors.GREEN)
|
||||||
userToken.lock.release()
|
userToken.lock.release()
|
||||||
|
|
||||||
if glob.requestTime == True:
|
if glob.requestTime == True:
|
||||||
|
@ -194,32 +194,38 @@ class handler(requestHelper.asyncRequestHandler):
|
||||||
self.add_header("Content-Encoding", "gzip")
|
self.add_header("Content-Encoding", "gzip")
|
||||||
self.write(gzip.compress(responseData, 6))
|
self.write(gzip.compress(responseData, 6))
|
||||||
except:
|
except:
|
||||||
msg = "**asyncppytornadovroom error** *(aka test server, ignore this)*\nUnhandled exception in mainHandler:\n```\n{}\n{}\n```".format(sys.exc_info(), traceback.format_exc())
|
msg = "Unhandled exception in mainHandler:\n```\n{}\n{}\n```".format(sys.exc_info(), traceback.format_exc())
|
||||||
consoleHelper.printColored("[!] {}".format(msg), bcolors.RED)
|
consoleHelper.printColored("[!] {}".format(msg), bcolors.RED)
|
||||||
discordBotHelper.sendConfidential(msg)
|
discordBotHelper.sendConfidential(msg, True)
|
||||||
finally:
|
finally:
|
||||||
self.finish()
|
try:
|
||||||
|
if not self._finished:
|
||||||
|
self.finish()
|
||||||
|
except:
|
||||||
|
pass
|
||||||
|
|
||||||
def asyncGet(self):
|
def asyncGet(self):
|
||||||
html = "<html><head><title>MA MAURO ESISTE?</title><style type='text/css'>body{width:30%}</style></head><body><pre>"
|
try:
|
||||||
html += " _ __<br>"
|
html = "<html><head><title>MA MAURO ESISTE?</title><style type='text/css'>body{width:30%}</style></head><body><pre>"
|
||||||
html += " (_) / /<br>"
|
html += " _ __<br>"
|
||||||
html += " ______ __ ____ ____ / /____<br>"
|
html += " (_) / /<br>"
|
||||||
html += " / ___/ / _ \\/ _ \\/ / _ \\<br>"
|
html += " ______ __ ____ ____ / /____<br>"
|
||||||
html += " / / / / /_) / /_) / / ____/<br>"
|
html += " / ___/ / _ \\/ _ \\/ / _ \\<br>"
|
||||||
html += "/__/ /__/ .___/ .___/__/ \\_____/<br>"
|
html += " / / / / /_) / /_) / / ____/<br>"
|
||||||
html += " / / / /<br>"
|
html += "/__/ /__/ .___/ .___/__/ \\_____/<br>"
|
||||||
html += " /__/ /__/<br>"
|
html += " / / / /<br>"
|
||||||
html += "<b>PYTHON > ALL VERSION</b><br><br>"
|
html += " /__/ /__/<br>"
|
||||||
html += "<marquee style='white-space:pre;'><br>"
|
html += "<b>PYTHON > ALL VERSION</b><br><br>"
|
||||||
html += " .. o .<br>"
|
html += "<marquee style='white-space:pre;'><br>"
|
||||||
html += " o.o o . o<br>"
|
html += " .. o .<br>"
|
||||||
html += " oo...<br>"
|
html += " o.o o . o<br>"
|
||||||
html += " __[]__<br>"
|
html += " oo...<br>"
|
||||||
html += " phwr--> _\\:D/_/o_o_o_|__ <span style=\"font-family: 'Comic Sans MS'; font-size: 8pt;\">u wot m8</span><br>"
|
html += " __[]__<br>"
|
||||||
html += " \\\"\"\"\"\"\"\"\"\"\"\"\"\"\"/<br>"
|
html += " phwr--> _\\:D/_/o_o_o_|__ <span style=\"font-family: 'Comic Sans MS'; font-size: 8pt;\">u wot m8</span><br>"
|
||||||
html += " \\ . .. .. . /<br>"
|
html += " \\\"\"\"\"\"\"\"\"\"\"\"\"\"\"/<br>"
|
||||||
html += "^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^<br>"
|
html += " \\ . .. .. . /<br>"
|
||||||
html += "</marquee><br><strike>reverse engineering a protocol impossible to reverse engineer since always</strike><br>we are actually reverse engineering bancho successfully. for the third time.</pre></body></html>"
|
html += "^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^<br>"
|
||||||
self.write(html)
|
html += "</marquee><br><strike>reverse engineering a protocol impossible to reverse engineer since always</strike><br>we are actually reverse engineering bancho successfully. for the third time.</pre></body></html>"
|
||||||
self.finish()
|
self.write(html)
|
||||||
|
finally:
|
||||||
|
self.finish()
|
||||||
|
|
|
@ -58,6 +58,7 @@ class config:
|
||||||
|
|
||||||
self.config.get("discord","enable")
|
self.config.get("discord","enable")
|
||||||
self.config.get("discord","boturl")
|
self.config.get("discord","boturl")
|
||||||
|
self.config.get("discord","devgroup")
|
||||||
|
|
||||||
self.config.get("ci","key")
|
self.config.get("ci","key")
|
||||||
return True
|
return True
|
||||||
|
@ -95,6 +96,7 @@ class config:
|
||||||
self.config.add_section("discord")
|
self.config.add_section("discord")
|
||||||
self.config.set("discord", "enable", "False")
|
self.config.set("discord", "enable", "False")
|
||||||
self.config.set("discord", "boturl", "")
|
self.config.set("discord", "boturl", "")
|
||||||
|
self.config.set("discord", "devgroup", "")
|
||||||
|
|
||||||
# Write ini to file and close
|
# Write ini to file and close
|
||||||
self.config.write(f)
|
self.config.write(f)
|
||||||
|
|
|
@ -2,35 +2,36 @@ import requests
|
||||||
from objects import glob
|
from objects import glob
|
||||||
from helpers import generalFunctions
|
from helpers import generalFunctions
|
||||||
from urllib.parse import urlencode
|
from urllib.parse import urlencode
|
||||||
|
from helpers import consoleHelper
|
||||||
|
from constants import bcolors
|
||||||
|
|
||||||
def sendDiscordMessage(channel, message):
|
def sendDiscordMessage(channel, message, alertDev = False, prefix = "**pep.py**"):
|
||||||
"""
|
"""
|
||||||
Send a message to a discord server.
|
Send a message to a discord server.
|
||||||
This is used with ripple's schiavobot.
|
This is used with ripple's schiavobot.
|
||||||
|
|
||||||
channel -- bunk, staff or general
|
channel -- bunk, staff or general
|
||||||
message -- message to send
|
message -- message to send
|
||||||
|
alertDev -- if True, hl developers group
|
||||||
|
prefix -- string to prepend to message
|
||||||
"""
|
"""
|
||||||
if generalFunctions.stringToBool(glob.conf.config["discord"]["enable"]) == True:
|
if glob.discord == True:
|
||||||
requests.get("{}/{}?{}".format(glob.conf.config["discord"]["boturl"], channel, urlencode({ "message": message })))
|
for _ in range(0,20):
|
||||||
|
try:
|
||||||
|
finalMsg = "{prefix} {message}".format(prefix=prefix, message=message) if alertDev == False else "{prefix} {hl} - {message}".format(prefix=prefix, hl=glob.conf.config["discord"]["devgroup"], message=message)
|
||||||
|
requests.get("{}/{}?{}".format(glob.conf.config["discord"]["boturl"], channel, urlencode({ "message": finalMsg })))
|
||||||
|
break
|
||||||
|
except:
|
||||||
|
continue
|
||||||
|
|
||||||
|
|
||||||
def sendConfidential(message):
|
def sendConfidential(message, alertDev = False):
|
||||||
"""
|
"""
|
||||||
Send a message to #bunker
|
Send a message to #bunker
|
||||||
|
|
||||||
message -- message to send
|
message -- message to send
|
||||||
"""
|
"""
|
||||||
sendDiscordMessage("bunk", message)
|
sendDiscordMessage("bunk", message, alertDev)
|
||||||
|
|
||||||
|
|
||||||
def sendChatlog(message):
|
|
||||||
"""
|
|
||||||
Send a message to #chatlog
|
|
||||||
|
|
||||||
message -- message to send
|
|
||||||
"""
|
|
||||||
sendDiscordMessage("chatlog", message)
|
|
||||||
|
|
||||||
|
|
||||||
def sendStaff(message):
|
def sendStaff(message):
|
||||||
|
@ -49,3 +50,12 @@ def sendGeneral(message):
|
||||||
message -- message to send
|
message -- message to send
|
||||||
"""
|
"""
|
||||||
sendDiscordMessage("general", message)
|
sendDiscordMessage("general", message)
|
||||||
|
|
||||||
|
|
||||||
|
def sendChatlog(message):
|
||||||
|
"""
|
||||||
|
Send a message to #chatlog
|
||||||
|
|
||||||
|
message -- message to send
|
||||||
|
"""
|
||||||
|
sendDiscordMessage("chatlog", message, prefix="")
|
||||||
|
|
|
@ -3,7 +3,6 @@
|
||||||
from objects import tokenList
|
from objects import tokenList
|
||||||
from objects import channelList
|
from objects import channelList
|
||||||
from objects import matchList
|
from objects import matchList
|
||||||
import threading
|
|
||||||
|
|
||||||
VERSION = "1.2"
|
VERSION = "1.2"
|
||||||
|
|
||||||
|
@ -13,7 +12,7 @@ banchoConf = None
|
||||||
tokens = tokenList.tokenList()
|
tokens = tokenList.tokenList()
|
||||||
channels = channelList.channelList()
|
channels = channelList.channelList()
|
||||||
matches = matchList.matchList()
|
matches = matchList.matchList()
|
||||||
memes = True
|
|
||||||
restarting = False
|
restarting = False
|
||||||
pool = None
|
pool = None
|
||||||
requestTime = False
|
requestTime = False
|
||||||
|
discord = False
|
||||||
|
|
9
pep.py
9
pep.py
|
@ -176,15 +176,20 @@ if __name__ == "__main__":
|
||||||
raise
|
raise
|
||||||
|
|
||||||
# Localize warning
|
# Localize warning
|
||||||
if(generalFunctions.stringToBool(glob.conf.config["server"]["localizeusers"]) == False):
|
if generalFunctions.stringToBool(glob.conf.config["server"]["localizeusers"]) == False:
|
||||||
consoleHelper.printColored("[!] Warning! users localization is disabled!", bcolors.YELLOW)
|
consoleHelper.printColored("[!] Warning! users localization is disabled!", bcolors.YELLOW)
|
||||||
|
|
||||||
|
# Discord
|
||||||
|
glob.discord = generalFunctions.stringToBool(glob.conf.config["discord"]["enable"])
|
||||||
|
if glob.discord == False:
|
||||||
|
consoleHelper.printColored("[!] Discord logging is disabled!", bcolors.YELLOW)
|
||||||
|
|
||||||
# Get server parameters from config.ini
|
# Get server parameters from config.ini
|
||||||
serverPort = int(glob.conf.config["server"]["port"])
|
serverPort = int(glob.conf.config["server"]["port"])
|
||||||
glob.requestTime = generalFunctions.stringToBool(glob.conf.config["server"]["outputrequesttime"])
|
glob.requestTime = generalFunctions.stringToBool(glob.conf.config["server"]["outputrequesttime"])
|
||||||
|
|
||||||
# Server start message and console output
|
# Server start message and console output
|
||||||
discordBotHelper.sendConfidential("**asyncppytornadovroom** Server started!")
|
discordBotHelper.sendConfidential("Server started!")
|
||||||
consoleHelper.printColored("> Tornado listening for clients on 127.0.0.1:{}...".format(serverPort), bcolors.GREEN)
|
consoleHelper.printColored("> Tornado listening for clients on 127.0.0.1:{}...".format(serverPort), bcolors.GREEN)
|
||||||
|
|
||||||
# Start tornado
|
# Start tornado
|
||||||
|
|
Loading…
Reference in New Issue
Block a user