.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 consoleHelper
|
||||
from helpers import discordBotHelper
|
||||
from constants import bcolors
|
||||
|
||||
"""
|
||||
|
@ -176,7 +177,10 @@ def silence(fro, chan, message):
|
|||
if targetToken != None:
|
||||
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):
|
||||
# Get parameters
|
||||
|
|
|
@ -12,6 +12,7 @@ from events import channelJoinEvent
|
|||
import sys
|
||||
import traceback
|
||||
from helpers import requestHelper
|
||||
from helpers import discordBotHelper
|
||||
|
||||
def handle(tornadoRequest):
|
||||
# Data to return
|
||||
|
@ -183,4 +184,8 @@ def handle(tornadoRequest):
|
|||
if err == True:
|
||||
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)
|
||||
|
|
|
@ -81,7 +81,7 @@ class handler(requestHelper.asyncRequestHandler):
|
|||
# Token exists, get its object and lock it
|
||||
userToken = glob.tokens.tokens[requestTokenString]
|
||||
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
|
||||
while pos < len(requestData):
|
||||
|
@ -171,7 +171,7 @@ class handler(requestHelper.asyncRequestHandler):
|
|||
finally:
|
||||
# Unlock token
|
||||
if userToken != None:
|
||||
consoleHelper.printColored("[{}] unlocked".format(userToken.token), bcolors.GREEN)
|
||||
#consoleHelper.printColored("[{}] unlocked".format(userToken.token), bcolors.GREEN)
|
||||
userToken.lock.release()
|
||||
|
||||
if glob.requestTime == True:
|
||||
|
@ -194,32 +194,38 @@ class handler(requestHelper.asyncRequestHandler):
|
|||
self.add_header("Content-Encoding", "gzip")
|
||||
self.write(gzip.compress(responseData, 6))
|
||||
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)
|
||||
discordBotHelper.sendConfidential(msg)
|
||||
discordBotHelper.sendConfidential(msg, True)
|
||||
finally:
|
||||
self.finish()
|
||||
try:
|
||||
if not self._finished:
|
||||
self.finish()
|
||||
except:
|
||||
pass
|
||||
|
||||
def asyncGet(self):
|
||||
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 += "<b>PYTHON > ALL VERSION</b><br><br>"
|
||||
html += "<marquee style='white-space:pre;'><br>"
|
||||
html += " .. o .<br>"
|
||||
html += " o.o o . o<br>"
|
||||
html += " oo...<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 += "</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.write(html)
|
||||
self.finish()
|
||||
try:
|
||||
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 += "<b>PYTHON > ALL VERSION</b><br><br>"
|
||||
html += "<marquee style='white-space:pre;'><br>"
|
||||
html += " .. o .<br>"
|
||||
html += " o.o o . o<br>"
|
||||
html += " oo...<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 += "</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.write(html)
|
||||
finally:
|
||||
self.finish()
|
||||
|
|
|
@ -58,6 +58,7 @@ class config:
|
|||
|
||||
self.config.get("discord","enable")
|
||||
self.config.get("discord","boturl")
|
||||
self.config.get("discord","devgroup")
|
||||
|
||||
self.config.get("ci","key")
|
||||
return True
|
||||
|
@ -95,6 +96,7 @@ class config:
|
|||
self.config.add_section("discord")
|
||||
self.config.set("discord", "enable", "False")
|
||||
self.config.set("discord", "boturl", "")
|
||||
self.config.set("discord", "devgroup", "")
|
||||
|
||||
# Write ini to file and close
|
||||
self.config.write(f)
|
||||
|
|
|
@ -2,35 +2,36 @@ import requests
|
|||
from objects import glob
|
||||
from helpers import generalFunctions
|
||||
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.
|
||||
This is used with ripple's schiavobot.
|
||||
|
||||
channel -- bunk, staff or general
|
||||
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:
|
||||
requests.get("{}/{}?{}".format(glob.conf.config["discord"]["boturl"], channel, urlencode({ "message": message })))
|
||||
if glob.discord == True:
|
||||
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
|
||||
|
||||
message -- message to send
|
||||
"""
|
||||
sendDiscordMessage("bunk", message)
|
||||
|
||||
|
||||
def sendChatlog(message):
|
||||
"""
|
||||
Send a message to #chatlog
|
||||
|
||||
message -- message to send
|
||||
"""
|
||||
sendDiscordMessage("chatlog", message)
|
||||
sendDiscordMessage("bunk", message, alertDev)
|
||||
|
||||
|
||||
def sendStaff(message):
|
||||
|
@ -49,3 +50,12 @@ def sendGeneral(message):
|
|||
message -- message to send
|
||||
"""
|
||||
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 channelList
|
||||
from objects import matchList
|
||||
import threading
|
||||
|
||||
VERSION = "1.2"
|
||||
|
||||
|
@ -13,7 +12,7 @@ banchoConf = None
|
|||
tokens = tokenList.tokenList()
|
||||
channels = channelList.channelList()
|
||||
matches = matchList.matchList()
|
||||
memes = True
|
||||
restarting = False
|
||||
pool = None
|
||||
requestTime = False
|
||||
discord = False
|
||||
|
|
9
pep.py
9
pep.py
|
@ -176,15 +176,20 @@ if __name__ == "__main__":
|
|||
raise
|
||||
|
||||
# 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)
|
||||
|
||||
# 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
|
||||
serverPort = int(glob.conf.config["server"]["port"])
|
||||
glob.requestTime = generalFunctions.stringToBool(glob.conf.config["server"]["outputrequesttime"])
|
||||
|
||||
# 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)
|
||||
|
||||
# Start tornado
|
||||
|
|
Loading…
Reference in New Issue
Block a user