Last active
November 22, 2016 13:19
-
-
Save Kyu/bab767f37b32c4e46fd528fe894606fa to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// from https://github.com/izy521/discord.io/blob/master/lib/index.js |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!doctype HTML> | |
<html> | |
<head> | |
<title>discord.io browser example</title> | |
<script src="index.js"></script> <!-- The discord.io client file --> | |
</head> | |
<body> | |
<script> | |
var client = new Discord.Client({ | |
token: "token", | |
autorun: true | |
}); | |
client.on('message', function(user, userID, channelID, message, event) { | |
if (message === 'ping ping motherfucker') { | |
client.sendMessage({ | |
to: channelID, | |
message: "pong back bitch" | |
}); | |
} | |
if (message === 'roll like a donut') { | |
client.sendMessage({ | |
to: channelID, | |
message: (Math.floor(Math.random() * 10) + 1) | |
}); | |
console.log(userID) | |
} | |
if (message.startsWith("eval") && userID === '142510125255491584') { | |
try { | |
client.sendMessage({ | |
to: channelID, | |
message: "```js\n%s```".replace("%s", (eval(message.replace("eval", "")))) | |
}); | |
} catch(err) { | |
client.sendMessage({ | |
to: channelID, | |
message: "```js\n%s```".replace("%s", err) | |
}); | |
} | |
} | |
}); | |
</script> | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment