| 1 | <!doctype HTML> |
| 2 | <html> |
| 3 | <head> |
| 4 | <title>discord.io browser example</title> |
| 5 | <script src="index.js"></script> <!-- The discord.io client file --> |
| 6 | </head> |
| 7 | <body> |
| 8 | <script> |
| 9 | var client = new Discord.Client({ |
| 10 | token: "", |
| 11 | autorun: true |
| 12 | }); |
| 13 | |
| 14 | client.on('ready', function() { |
| 15 | console.log("%s (%s)... in the browser!", client.username, client.id); |
| 16 | }); |
| 17 | |
| 18 | client.on('message', function(user, userID, channelID, message, event) { |
| 19 | if (message === 'ping') { |
| 20 | client.sendMessage({ |
| 21 | to: userID, |
| 22 | message: "pong" |
| 23 | }); |
| 24 | } |
| 25 | }); |
| 26 | </script> |
| 27 | </body> |
| 28 | </html> |