# Path: constants/exceptions.py
# class loginFailedException(Exception):
# class loginBannedException(Exception):
# class tokenNotFoundException(Exception):
# class channelNoPermissionsException(Exception):
# class channelUnknownException(Exception):
# class channelModeratedException(Exception):
# class noAdminException(Exception):
# class commandSyntaxException(Exception):
# class banchoConfigErrorException(Exception):
# class banchoMaintenanceException(Exception):
# class moderatedPMException(Exception):
# class userNotFoundException(Exception):
# class alreadyConnectedException(Exception):
# class stopSpectating(Exception):
# class matchWrongPasswordException(Exception):
# class matchNotFoundException(Exception):
# class matchJoinErrorException(Exception):
# class matchCreateError(Exception):
# class banchoRestartingException(Exception):
# class apiException(Exception):
# class invalidArgumentsException(Exception):
# class messageTooLongWarnException(Exception):
# class messageTooLongException(Exception):
# class userSilencedException(Exception):
# class need2FAException(Exception):
# class userRestrictedException(Exception):
# class haxException(Exception):
# class forceUpdateException(Exception):
# class loginLockedException(Exception):
# class unknownStreamException(Exception):
# class userTournamentException(Exception):
# class userAlreadyInChannelException(Exception):
# class userNotInChannelException(Exception):
# class missingReportInfoException(Exception):
# class invalidUserException(Exception):
# class wrongChannelException(Exception):
# class periodicLoopException(Exception):
# 
# Path: helpers/chatHelper.py
# def joinChannel(userID = 0, channel = "", token = None, toIRC = True, force=False):
# def partChannel(userID = 0, channel = "", token = None, toIRC = True, kick = False, force=False):
# def sendMessage(fro = "", to = "", message = "", token = None, toIRC = True):
# def fixUsernameForBancho(username):
# def fixUsernameForIRC(username):
# def IRCConnect(username):
# def IRCDisconnect(username):
# def IRCJoinChannel(username, channel):
# def IRCPartChannel(username, channel):
# def IRCAway(username, message):
# 
# Path: objects/glob.py
# 		VERSION = f.read().strip()
# 	VERSION = "Unknown"
# DATADOG_PREFIX = "peppy"


import json
import tornado.web
import tornado.gen
from common.sentry import sentry
from common.web import requestsManager
from constants import exceptions
from helpers import chatHelper
from objects import glob




class handler(requestsManager.asyncRequestHandler):
	@tornado.web.asynchronous
	@tornado.gen.engine
	@sentry.captureTornado
	def asyncGet(self):
		statusCode = 400
		data = {"message": "unknown error"}
		try:
			# Check arguments
			if not requestsManager.checkArguments(self.request.arguments, ["k", "to", "msg"]):

# Path: constants/exceptions.py
# class loginFailedException(Exception):
# class loginBannedException(Exception):
# class tokenNotFoundException(Exception):
# class channelNoPermissionsException(Exception):
# class channelUnknownException(Exception):
# class channelModeratedException(Exception):
# class noAdminException(Exception):
# class commandSyntaxException(Exception):
# class banchoConfigErrorException(Exception):
# class banchoMaintenanceException(Exception):
# class moderatedPMException(Exception):
# class userNotFoundException(Exception):
# class alreadyConnectedException(Exception):
# class stopSpectating(Exception):
# class matchWrongPasswordException(Exception):
# class matchNotFoundException(Exception):
# class matchJoinErrorException(Exception):
# class matchCreateError(Exception):
# class banchoRestartingException(Exception):
# class apiException(Exception):
# class invalidArgumentsException(Exception):
# class messageTooLongWarnException(Exception):
# class messageTooLongException(Exception):
# class userSilencedException(Exception):
# class need2FAException(Exception):
# class userRestrictedException(Exception):
# class haxException(Exception):
# class forceUpdateException(Exception):
# class loginLockedException(Exception):
# class unknownStreamException(Exception):
# class userTournamentException(Exception):
# class userAlreadyInChannelException(Exception):
# class userNotInChannelException(Exception):
# class missingReportInfoException(Exception):
# class invalidUserException(Exception):
# class wrongChannelException(Exception):
# class periodicLoopException(Exception):
# 
# Path: helpers/chatHelper.py
# def joinChannel(userID = 0, channel = "", token = None, toIRC = True, force=False):
# def partChannel(userID = 0, channel = "", token = None, toIRC = True, kick = False, force=False):
# def sendMessage(fro = "", to = "", message = "", token = None, toIRC = True):
# def fixUsernameForBancho(username):
# def fixUsernameForIRC(username):
# def IRCConnect(username):
# def IRCDisconnect(username):
# def IRCJoinChannel(username, channel):
# def IRCPartChannel(username, channel):
# def IRCAway(username, message):
# 
# Path: objects/glob.py
# 		VERSION = f.read().strip()
# 	VERSION = "Unknown"
# DATADOG_PREFIX = "peppy"


# Path: handlers/apiFokabotMessageHandler.py
import json
import tornado.web
import tornado.gen
from common.sentry import sentry
from common.web import requestsManager
from constants import exceptions
from helpers import chatHelper
from objects import glob





class handler(requestsManager.asyncRequestHandler):
	@tornado.web.asynchronous
	@tornado.gen.engine
	@sentry.captureTornado
	def asyncGet(self):
		statusCode = 400
		data = {"message": "unknown error"}
		try:
			# Check arguments
			if not requestsManager.checkArguments(self.request.arguments, ["k", "to", "msg"]):

				raise exceptions.invalidArgumentsException()