From 266ec0e2d03ccac4058db9273475108cae1a4053 Mon Sep 17 00:00:00 2001 From: Julian Pufler Date: Sat, 4 Jul 2020 13:25:59 +0200 Subject: [PATCH 1/3] added discord-bot example --- examples/discord-bot/index.ws | 33 ++++++++++++ package-lock.json | 95 +++++++++++++++++++++++++++++++++++ package.json | 2 +- 3 files changed, 129 insertions(+), 1 deletion(-) create mode 100644 examples/discord-bot/index.ws create mode 100644 package-lock.json diff --git a/examples/discord-bot/index.ws b/examples/discord-bot/index.ws new file mode 100644 index 0000000..736bec3 --- /dev/null +++ b/examples/discord-bot/index.ws @@ -0,0 +1,33 @@ +FIX OIDA Discord = require('discord.js'); +FIX OIDA client = new Discord(); + +client.on('ready', () => { + I MAN JA NUR('bot has started'); + client.user.setActivity(`Watching ${client.guilds.cache.size} servers`); +}); + +client.on('message', OWIZAHRA () => { + WOS WÜSTN(message.author.bot) + DRAH DI HAM; + WOS WÜSTN(!message.content.startsWith(process.env.PREFIX)) + DRAH DI HAM; + FIX OIDA args = message.content.slice(process.env.PREFIX).trim().split(/ +/g); + FIX OIDA command = args.shift().toLowerCase(); + + WOS IS MIT DIR(command) { + I SCHAU NUR "ping": + FIX OIDA m = JO GLEI message.channel.send("Ping?"); + m.edit(`Pong! Latency is ${m.createdTimestamp - message.createdTimestamp}ms. API Latency is ${Math.round(client.ws.ping)}ms`); + PASST SCHO; + I SCHAU NUR "say": + SCHAU MA MOL { + JO GLEI message.delete(); + JO GLEI message.channel.send(args.join(" ")); + } LECK OASCH (err) { + GSCHISSN GRISSN(err) + } + PASST SCHO; + } +}); + +client.login(process.env.TOKEN); diff --git a/package-lock.json b/package-lock.json new file mode 100644 index 0000000..e235a06 --- /dev/null +++ b/package-lock.json @@ -0,0 +1,95 @@ +{ + "name": "wienerscript", + "version": "1.0.2", + "lockfileVersion": 1, + "requires": true, + "dependencies": { + "balanced-match": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.0.tgz", + "integrity": "sha1-ibTRmasr7kneFk6gK4nORi1xt2c=" + }, + "brace-expansion": { + "version": "1.1.11", + "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.11.tgz", + "integrity": "sha512-iCuPHDFgrHX7H2vEI/5xpz07zSHB00TpugqhmYtVmMO6518mCuRMoOYFldEBl0g187ufozdaHgWKcYFb61qGiA==", + "requires": { + "balanced-match": "^1.0.0", + "concat-map": "0.0.1" + } + }, + "concat-map": { + "version": "0.0.1", + "resolved": "https://registry.npmjs.org/concat-map/-/concat-map-0.0.1.tgz", + "integrity": "sha1-2Klr13/Wjfd5OnMDajug1UBdR3s=" + }, + "fs.realpath": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/fs.realpath/-/fs.realpath-1.0.0.tgz", + "integrity": "sha1-FQStJSMVjKpA20onh8sBQRmU6k8=" + }, + "glob": { + "version": "7.1.6", + "resolved": "https://registry.npmjs.org/glob/-/glob-7.1.6.tgz", + "integrity": "sha512-LwaxwyZ72Lk7vZINtNNrywX0ZuLyStrdDtabefZKAY5ZGJhVtgdznluResxNmPitE0SAO+O26sWTHeKSI2wMBA==", + "requires": { + "fs.realpath": "^1.0.0", + "inflight": "^1.0.4", + "inherits": "2", + "minimatch": "^3.0.4", + "once": "^1.3.0", + "path-is-absolute": "^1.0.0" + } + }, + "inflight": { + "version": "1.0.6", + "resolved": "https://registry.npmjs.org/inflight/-/inflight-1.0.6.tgz", + "integrity": "sha1-Sb1jMdfQLQwJvJEKEHW6gWW1bfk=", + "requires": { + "once": "^1.3.0", + "wrappy": "1" + } + }, + "inherits": { + "version": "2.0.4", + "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.4.tgz", + "integrity": "sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ==" + }, + "minimatch": { + "version": "3.0.4", + "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.0.4.tgz", + "integrity": "sha512-yJHVQEhyqPLUTgt9B83PXu6W3rx4MvvHvSUvToogpwoGDOUQ+yDrR0HRot+yOCdCO7u4hX3pWft6kWBBcqh0UA==", + "requires": { + "brace-expansion": "^1.1.7" + } + }, + "mkdirp": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/mkdirp/-/mkdirp-1.0.4.tgz", + "integrity": "sha512-vVqVZQyf3WLx2Shd0qJ9xuvqgAyKPLAiqITEtqW0oIUjzo3PePDd6fW9iFz30ef7Ysp/oiWqbhszeGWW2T6Gzw==" + }, + "once": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/once/-/once-1.4.0.tgz", + "integrity": "sha1-WDsap3WWHUsROsF9nFC6753Xa9E=", + "requires": { + "wrappy": "1" + } + }, + "path-is-absolute": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/path-is-absolute/-/path-is-absolute-1.0.1.tgz", + "integrity": "sha1-F0uSaHNVNP+8es5r9TpanhtcX18=" + }, + "prettier": { + "version": "2.0.5", + "resolved": "https://registry.npmjs.org/prettier/-/prettier-2.0.5.tgz", + "integrity": "sha512-7PtVymN48hGcO4fGjybyBSIWDsLU4H4XlvOHfq91pz9kkGlonzwTfYkaIEwiRg/dAJF9YlbsduBAgtYLi+8cFg==" + }, + "wrappy": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/wrappy/-/wrappy-1.0.2.tgz", + "integrity": "sha1-tSQ9jz7BqjXxNkYFvA0QNuMKtp8=" + } + } +} diff --git a/package.json b/package.json index 4bbff3e..b46f354 100644 --- a/package.json +++ b/package.json @@ -22,4 +22,4 @@ "mkdirp": "^1.0.4", "prettier": "^2.0.5" } -} \ No newline at end of file +} From f1067c9783106ae27cf3ed8afe317cc0725f06ed Mon Sep 17 00:00:00 2001 From: Julian Pufler Date: Mon, 6 Jul 2020 08:14:44 +0200 Subject: [PATCH 2/3] tested and fixed --- examples/discord-bot/index.ws | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/examples/discord-bot/index.ws b/examples/discord-bot/index.ws index 736bec3..992d5f1 100644 --- a/examples/discord-bot/index.ws +++ b/examples/discord-bot/index.ws @@ -1,17 +1,17 @@ FIX OIDA Discord = require('discord.js'); -FIX OIDA client = new Discord(); +FIX OIDA client = new Discord.Client(); client.on('ready', () => { I MAN JA NUR('bot has started'); client.user.setActivity(`Watching ${client.guilds.cache.size} servers`); }); -client.on('message', OWIZAHRA () => { +client.on('message', OWIZAHRA (message) => { WOS WÜSTN(message.author.bot) DRAH DI HAM; WOS WÜSTN(!message.content.startsWith(process.env.PREFIX)) DRAH DI HAM; - FIX OIDA args = message.content.slice(process.env.PREFIX).trim().split(/ +/g); + FIX OIDA args = message.content.replace(process.env.PREFIX, '').trim().split(/ +/g); FIX OIDA command = args.shift().toLowerCase(); WOS IS MIT DIR(command) { From 67cbba05f75b277b9dfa672e30f1a3df399a2efa Mon Sep 17 00:00:00 2001 From: puf17640 Date: Mon, 6 Jul 2020 21:12:45 +0200 Subject: [PATCH 3/3] Update index.ws --- examples/discord-bot/index.ws | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/examples/discord-bot/index.ws b/examples/discord-bot/index.ws index 992d5f1..9056135 100644 --- a/examples/discord-bot/index.ws +++ b/examples/discord-bot/index.ws @@ -1,12 +1,12 @@ -FIX OIDA Discord = require('discord.js'); -FIX OIDA client = new Discord.Client(); +FIX OIDA Discord WENNST MANST require('discord.js'); +FIX OIDA client WENNST MANST new Discord.Client(); -client.on('ready', () => { +client.on('ready', () HUACH ZUA { I MAN JA NUR('bot has started'); client.user.setActivity(`Watching ${client.guilds.cache.size} servers`); }); -client.on('message', OWIZAHRA (message) => { +client.on('message', OWIZAHRA (message) HUACH ZUA { WOS WÜSTN(message.author.bot) DRAH DI HAM; WOS WÜSTN(!message.content.startsWith(process.env.PREFIX))