Add cock-block
This commit is contained in:
3
.gitignore
vendored
3
.gitignore
vendored
@@ -1,4 +1,5 @@
|
||||
node_modules/
|
||||
config.json
|
||||
logs/
|
||||
access.log
|
||||
access.log
|
||||
players.json
|
||||
17
app.js
17
app.js
@@ -37,7 +37,7 @@ app.use(cookieParser());
|
||||
app.use(express.static(path.join(__dirname, 'public')));
|
||||
|
||||
app.use('/', indexRouter);
|
||||
app.use('/shows/schedule', newShowsRouter)
|
||||
app.use('/shows/schedule', newShowsRouter);
|
||||
app.use('/config', configRouter);
|
||||
app.use('/shows/now', showsRouter);
|
||||
app.use('/tes.pac', pacRouter);
|
||||
@@ -368,7 +368,7 @@ client.on("message", function (message) {
|
||||
}
|
||||
}
|
||||
}
|
||||
if(message.channel.id == 495378712716640256) {
|
||||
if(message.channel.id == 489175804790571008) {
|
||||
clients.forEach(function (ws) {
|
||||
try {
|
||||
ws.send(chat(message.content, message.author.username, message.author.avatarURL));
|
||||
@@ -376,6 +376,19 @@ client.on("message", function (message) {
|
||||
//console.warn('A client is missing');
|
||||
}
|
||||
});
|
||||
} else if(message.channel.id == 514656310910910464) {
|
||||
if(message.content.includes("!verify ")) {
|
||||
var un = message.content.split(' ')[1];
|
||||
fs.readFile('config.json', 'utf8', function (err, data) {
|
||||
if (err) throw err;
|
||||
var objw = JSON.parse(data);
|
||||
objw.players.push(un);
|
||||
fs.writeFile('players.json', data, (err) => {
|
||||
if (err) throw err;
|
||||
message.reply('You\'re on the list!');
|
||||
});
|
||||
});
|
||||
}
|
||||
} else if(message.channel.id == 485940877580304394){
|
||||
if(message.content.includes("!bc=")){
|
||||
fs.readFile('config.json', 'utf8', function (err, data) {
|
||||
|
||||
@@ -8,9 +8,48 @@ router.all('/', function(req, res, next) {
|
||||
if (err) throw err;
|
||||
obj = JSON.parse(data);
|
||||
var bearer = 'Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1c2VySWQiOjIzMTkxMzU3LCJ1c2VybmFtZSI6Ikh1YlRyaXZpYSIsImF2YXRhclVybCI6Imh0dHBzOi8vZDJ4dTFoZG9taDNucnguY2xvdWRmcm9udC5uZXQvZGVmYXVsdF9hdmF0YXJzL1VudGl0bGVkLTFfMDAwMF9ncmVlbi5wbmciLCJ0b2tlbiI6bnVsbCwicm9sZXMiOltdLCJjbGllbnQiOiJpT1MvMS4yLjE5IGI3OSIsImd1ZXN0SWQiOm51bGwsInYiOjEsImlhdCI6MTUzNzgzNzQ2NywiZXhwIjoxNTQ1NjEzNDY3LCJpc3MiOiJoeXBlcXVpei8xIn0.TYOuoH3qTANR7HSrhg1VtGyILrUKbm8TPUVspKgHVvQ';
|
||||
if(req.headers.Authorization !== undefined){
|
||||
bearer = req.headers.Authorization;
|
||||
if(req.headers.authorization !== undefined){
|
||||
bearer = req.headers.authorization;
|
||||
}
|
||||
//Firewall
|
||||
fs.readFile('players.json', 'utf8', function (err, data) {
|
||||
var tokeeen = bearer.split(' ')[1];
|
||||
var un = JSON.parse(new Buffer(tokeeen.split(".")[1], 'base64').toString()).username;
|
||||
if (err) throw err;
|
||||
accs = JSON.parse(data);
|
||||
//find player
|
||||
if (accs.players.indexOf(un) > -1) {
|
||||
//In the array!
|
||||
} else {
|
||||
//Not in the array
|
||||
fs.appendFile('logs/players.txt', un+' Tried to sign in and failed' + '\n', function (err) {
|
||||
if (err) console.error(err);
|
||||
});
|
||||
res.json({
|
||||
"shows": [
|
||||
{
|
||||
"showType": "hq",
|
||||
"showId": 8384,
|
||||
"gameType": "trivia",
|
||||
"vertical": "general",
|
||||
"startTime": "2018-11-22T02:00:00.000Z",
|
||||
"prizeCents": 0,
|
||||
"currency": "USD",
|
||||
"display": {
|
||||
"title": "Unverified Account",
|
||||
"summary": "Please add your HQ username to the whitelist.",
|
||||
"accentColor": "#FFFFFF",
|
||||
"description": "Unverified account.",
|
||||
"logo": "https://mailaton.com/dl/unverified.png",
|
||||
"bgImage": "https://mailaton.com/dl/unverified.png",
|
||||
"bgVideo": "https://mailaton.com/dl/piracy.mp4"
|
||||
},
|
||||
"media": []
|
||||
}
|
||||
]
|
||||
});
|
||||
}
|
||||
});
|
||||
request({
|
||||
headers: {Authorization: bearer},
|
||||
uri: 'https://api-quiz.hype.space/shows/schedule'
|
||||
@@ -61,7 +100,14 @@ router.all('/', function(req, res, next) {
|
||||
tesShow.live = liveObj;
|
||||
}
|
||||
output.shows.unshift(tesShow);
|
||||
res.json(output);
|
||||
setTimeout(function () {
|
||||
try{
|
||||
res.json(output);
|
||||
}catch(e){
|
||||
|
||||
}
|
||||
},300);
|
||||
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user