Skip to content

Commit

Permalink
New Features and Stuff
Browse files Browse the repository at this point in the history
  • Loading branch information
shubshub committed May 7, 2016
1 parent 9a1b93f commit cc36e70
Show file tree
Hide file tree
Showing 13 changed files with 1,296 additions and 83 deletions.
80 changes: 80 additions & 0 deletions discordPureJS.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,9 @@ var readyHandle = setTimeout(checkReady,1000);
var authToken;
var lru;

var guildServers = [];
var guildChannels = [];
var channelID = [];
function checkReady()
{
if (chatReady == 0)
Expand Down Expand Up @@ -41,3 +44,80 @@ function sendMessage(msg,chan)
});
}

function getGuildStuff()
{
$.ajax(
{
type: "GET",
url: "https://discordapp.com/api/users/@me/guilds",
headers:
{
'Accept': "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8",
'Accept-Language': "en-US",
'Content-Type': "application/json",
'Authorization': authToken
},
beforeSend: function(xhr)
{
xhr.setRequestHeader('X-Requested-With',{toString: function() { return ''; }}
);
},
success: function(e)
{
guildServers = e;
getChannels(guildServers[0],0);
}
});
}
var count = 0;
function getChannels(servers,i)
{
$.ajax(
{
type: "GET",
url: "https://discordapp.com/api/guilds/"+servers.id+"/channels",
headers:
{
'Accept': "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8",
'Accept-Language': "en-US",
'Content-Type': "text/html; charset=utf-8",
'Authorization': authToken
},
beforeSend: function(xhr)
{
xhr.setRequestHeader('X-Requested-With',{toString: function() { return ''; }}
);
},
success: function(e)
{

guildChannels[i] = e;

if (servers != guildServers[guildServers.length-1])
{
getChannels(guildServers[i+1],i+1);
}
else
{
setChannelID();
}

}
});
}

function setChannelID()
{
for (var i = 0; i < guildServers.length; i++)
{
for (var j = 0; j < guildChannels[i].length; j++)
{
if (guildChannels[i][j].type !="voice")
{
channelID = channelID.concat(guildChannels[i][j].id);
}

}

}
}
37 changes: 37 additions & 0 deletions evaluater.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
//Dangerous EVAL command
function evaluate(txt,chan,userId)
{
var evaluate = "Nope";
var splitHold = String.prototype.split;
var subHold = String.prototype.substring;
txt = txt.replace(commandTag+"eval ","");
txt = txt.replace(commandTag+"eval","");
txt = txt.replace("userId","");
txt = txt.replace("evaluate","");
txt = txt.replace("whitelist","blacklist");
if (userId != "147284801647411200")
{
txt = txt.replace("147284801647411200","[Can't do that with Shubshub]");
txt = txt.replace("authToken","");
txt = txt.replace("substring","[No SubStrings]");
txt = txt.replace("window","");
txt = txt.replace("this","");
txt = txt.replace("login");
txt = txt.replace("api_key","");
txt = txt.replace("sendMessage","[No Sending Messages]");
String.prototype.split = 0;
String.prototype.substring = 0;
}
try{
output = eval(txt);
String.prototype.split = splitHold;
String.prototype.substring = subHold;
output = output.toString();
output = output.replace(authToken,"[Auth Token Redacted!]");
output = output.replace(authToken.split(""),"[Auth Token Redacted!]");
sendMessage(output,chan);
}
catch(err) {sendMessage("``Error with the code: "+err+"``",chan);}


}
101 changes: 101 additions & 0 deletions games/crossServer_Guess/crossServerDescribe.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,101 @@
var challengeServer = 0;
var chlngServOne = "";
var chlngServTwo = "";
var chlngServTwoID = 0;
var chlngServOneID = 0;

function challengeDescribe(txt,chan,userId)
{
txt = txt.replace(commandTag+"servChallenge ","");
if (challengeServer == 0)
{
chlngServOneID = chan;
chlngServTwoID = txt;
for (var i = 0; i < guildChannels.length; i++)
{
for (var j = 0; j < guildChannels[i].length; j++)
{
if (chlngServOneID == guildChannels[i][j].id)
{
for (var k = 0; k < guildServers.length; k++)
{
if (guildChannels[i][j].guild_id == guildServers[k].id)
{
chlngServOne = guildServers[k].name;
}
}

}
if (chlngServTwoID == guildChannels[i][j].id)
{
for (var k = 0; k < guildServers.length; k++)
{
if (guildChannels[i][j].guild_id == guildServers[k].id)
{
chlngServTwo = guildServers[k].name;
}
}
}

}
}
challengeServer = 1;
sendMessage("Sending Challenge Request to "+chlngServTwo,chlngServOneID);
sendMessage(chlngServOne+" is challenging you to a game of Guess! type ```<@169712284149481472> acceptChallenge``` to start!",chlngServTwoID);
setTimeout(function(){if (challengeServer == 1) {sendMessage("Challenge was dropped nobody picked up call them back later with ``"+commandTag+"servChallenge "+chlngServOneID+"``",chlngServTwoID); chlngServTwoID = 0; challengeServer = 0; sendMessage("Nobody answered the call...",chlngServOneID); chlngServOneID = 0; }},60000);
}
else
{
sendMessage("Challenge in Progress",chan);
}
}

function challengeConnected(nothing,chan,nothingg)
{
console.log(chan);
if ((challengeServer == 1) && (chan == chlngServTwoID))
{
sendMessage("Challenge accepted starting game!",chlngServOneID);
sendMessage("Challenge accepted starting game!",chlngServTwoID);
startChallenge();
challengeServer = 2;
}

}

function challengeEnd(txt,chan)
{
if (challengeServer >= 1)
{
sendMessage("Challenge Withdrawn",chlngServOneID);
sendMessage("Challenge Withdrawn",chlngServTwoID);
chlngServOneID = 0;
chlngServTwoID = 0;
challengeServer = 0;
}
}

function challengeSpeak(txt,chan,userId)
{
txt = txt.replace(commandTag+"describe ", "");
txt = txt.replaceAll("@everyone","[everyone ping removed!]");
txt = txt.replaceAll("@here","[here ping removed!]");
if (challengeServer == 2)
{
if (chlngServOneID == chan)
{
sendMessage("*<@"+userId+"> says '"+txt+"' from Server: "+chlngServOne,chlngServTwoID);
}
else if (chlngServTwoID == chan)
{
sendMessage("*<@"+userId+"> says '"+txt+"' from Server: "+chlngServTwo,chlngServOneID);
}
}
}

function startChallenge()
{
sendMessage("Picking a Topic... Please Wait",chlngServTwoID);
sendMessage("Picking a Topic... Please Wait",chlngServOneID);
}

47 changes: 47 additions & 0 deletions games/slots/slots.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

75 changes: 75 additions & 0 deletions interpreters/Golfpher.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
//eval("(function(){return 'Hello'})(self)")
function getCloser(a, b, c) {
b = b || c;
return Math.round(a / b) * b;
}
function convert(txt){
var tex = "(function(){return 'Hello'})(self)";
tex = txt;
t=""
j = 0;
for (var i = 0;i<tex.length;i++)
{
/*if (j!=0)
{
var z = getCloser(j,0,tex.charCodeAt(i));
if (z == 0)
{
j=0;
t+="#";
}
}*/
while(j!=tex.charCodeAt(i))
{
t+=(j>tex.charCodeAt(i))?"-":"+"
if(j > tex.charCodeAt(i))
{
j--;
}
if (j < tex.charCodeAt(i))
{
j++;
}
}
t+="<"
}
t+="=";
console.log(t)}
function golfpherHelp(nothing,chan)
{
var msg="Golfpher is an Esoteric Language that works on a single Char Pointer\nThere are only 4 functions in Golfpher\n+ : Add one to the Char Pointer\n- : Remove one from the Char Pointer\n< : Push the character at the char pointers position onto the stack\n= : execute the code thats on the stack\nEach function must be seperated by a ;";
sendMessage("Golfpher is an Esoteric Language that works on a single Char Pointer\nThere are only 4 functions in Golfpher\n```+ : Add one to the Char Pointer\n- : Remove one from the Char Pointer\n< : Push the character at the char pointers position onto the stack\n= : execute the code thats on the stack\n```\n\n"+commandTag+"golfpher [code] to execute a golfpher program",chan);
}
function lang(txt,chan)
{
i=0;
txt = txt.replace(commandTag+"golfpher ","");
output = txt.split("");
code="";
data="";
for(j = 0;j<output.length;j++)
{
if(output[j]=="=")
{
code=code.replaceAll("authToken","");
data+=eval(code);
}
else if(output[j]=="<")
{
code+=String.fromCharCode(i);
}
else if(output[j]=="+")
{
i++;
}
else if (output[j]=="-")
{
i--;
}
else if (output[j]=="#")
{
i=0;
}
}
sendMessage(data,chan);
}
Loading

0 comments on commit cc36e70

Please sign in to comment.