From bdb4e9d9494e0e722ca5d8a015d107e95ac6b102 Mon Sep 17 00:00:00 2001 From: Murat <59137982+theMuwat@users.noreply.github.com> Date: Wed, 29 Nov 2023 18:22:10 +0300 Subject: [PATCH] Add files via upload --- commands/example.js | 8 ++++ config.json | 4 ++ index.js | 38 ++++++++++++++++++ package-lock.json | 93 +++++++++++++++++++++++++++++++++++++++++++++ package.json | 15 ++++++++ 5 files changed, 158 insertions(+) create mode 100644 commands/example.js create mode 100644 config.json create mode 100644 index.js create mode 100644 package-lock.json create mode 100644 package.json diff --git a/commands/example.js b/commands/example.js new file mode 100644 index 0000000..1f13860 --- /dev/null +++ b/commands/example.js @@ -0,0 +1,8 @@ +exports.run = (client, message, args) => { + console.log("Works!") +} + +exports.info = { + name: "example", + enabled: true +} \ No newline at end of file diff --git a/config.json b/config.json new file mode 100644 index 0000000..ddb3c23 --- /dev/null +++ b/config.json @@ -0,0 +1,4 @@ +{ + "token": "", + "prefix": "!" +} \ No newline at end of file diff --git a/index.js b/index.js new file mode 100644 index 0000000..9e09860 --- /dev/null +++ b/index.js @@ -0,0 +1,38 @@ +const Eris = require('eris') +const config = require('./config.json') +const client = new Eris(config.token, {maxShards: "auto", getAllUsers:true, intents:["guildPresences", "guildMembers", "guilds", "guildMessages"]}) +const fs = require('fs') + +// Command Handler +client.commands = new Eris.Collection() +fs.readdir('./commands/', (err, files) => { + if (err) console.error(err) + files.forEach(file => { + let f = require(`./commands/${file}`) + client.commands.set(f.info.name, f) + }) +}) + +let prefix = config.prefix + +client.on('messageCreate', async message => { + if (message.author.bot || !message.channel.guild || !message.content.startsWith(prefix)) return + + let args = message.content.slice(prefix.length).trim().split(/ +/g) + let command = args.shift().toLowerCase() + let cmd; + if (client.commands.has(command)) cmd = client.commands.get(command) + if (cmd) cmd.run(client, message, args) + +}) + + + +// Ready Event +client.on('ready', () => { + console.log('Bot is ready!') +}) + + + +client.connect() \ No newline at end of file diff --git a/package-lock.json b/package-lock.json new file mode 100644 index 0000000..06ec0d0 --- /dev/null +++ b/package-lock.json @@ -0,0 +1,93 @@ +{ + "name": "eris-template", + "version": "1.0.0", + "lockfileVersion": 2, + "requires": true, + "packages": { + "": { + "name": "eris-template", + "version": "1.0.0", + "license": "ISC", + "dependencies": { + "eris": "^0.17.2" + } + }, + "node_modules/eris": { + "version": "0.17.2", + "resolved": "https://registry.npmjs.org/eris/-/eris-0.17.2.tgz", + "integrity": "sha512-OzffDSL81VooFXfRn56ienSg7J6fagoN8WdkmCHjn0B9a4jUA3bVouMztQiaXT54jHV5jaX9D0mJ/b9/0mFoVg==", + "dependencies": { + "ws": "^8.2.3" + }, + "engines": { + "node": ">=10.4.0" + }, + "optionalDependencies": { + "opusscript": "^0.0.8", + "tweetnacl": "^1.0.3" + } + }, + "node_modules/opusscript": { + "version": "0.0.8", + "resolved": "https://registry.npmjs.org/opusscript/-/opusscript-0.0.8.tgz", + "integrity": "sha512-VSTi1aWFuCkRCVq+tx/BQ5q9fMnQ9pVZ3JU4UHKqTkf0ED3fKEPdr+gKAAl3IA2hj9rrP6iyq3hlcJq3HELtNQ==", + "optional": true + }, + "node_modules/tweetnacl": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/tweetnacl/-/tweetnacl-1.0.3.tgz", + "integrity": "sha512-6rt+RN7aOi1nGMyC4Xa5DdYiukl2UWCbcJft7YhxReBGQD7OAM8Pbxw6YMo4r2diNEA8FEmu32YOn9rhaiE5yw==", + "optional": true + }, + "node_modules/ws": { + "version": "8.14.2", + "resolved": "https://registry.npmjs.org/ws/-/ws-8.14.2.tgz", + "integrity": "sha512-wEBG1ftX4jcglPxgFCMJmZ2PLtSbJ2Peg6TmpJFTbe9GZYOQCDPdMYu/Tm0/bGZkw8paZnJY45J4K2PZrLYq8g==", + "engines": { + "node": ">=10.0.0" + }, + "peerDependencies": { + "bufferutil": "^4.0.1", + "utf-8-validate": ">=5.0.2" + }, + "peerDependenciesMeta": { + "bufferutil": { + "optional": true + }, + "utf-8-validate": { + "optional": true + } + } + } + }, + "dependencies": { + "eris": { + "version": "0.17.2", + "resolved": "https://registry.npmjs.org/eris/-/eris-0.17.2.tgz", + "integrity": "sha512-OzffDSL81VooFXfRn56ienSg7J6fagoN8WdkmCHjn0B9a4jUA3bVouMztQiaXT54jHV5jaX9D0mJ/b9/0mFoVg==", + "requires": { + "opusscript": "^0.0.8", + "tweetnacl": "^1.0.3", + "ws": "^8.2.3" + } + }, + "opusscript": { + "version": "0.0.8", + "resolved": "https://registry.npmjs.org/opusscript/-/opusscript-0.0.8.tgz", + "integrity": "sha512-VSTi1aWFuCkRCVq+tx/BQ5q9fMnQ9pVZ3JU4UHKqTkf0ED3fKEPdr+gKAAl3IA2hj9rrP6iyq3hlcJq3HELtNQ==", + "optional": true + }, + "tweetnacl": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/tweetnacl/-/tweetnacl-1.0.3.tgz", + "integrity": "sha512-6rt+RN7aOi1nGMyC4Xa5DdYiukl2UWCbcJft7YhxReBGQD7OAM8Pbxw6YMo4r2diNEA8FEmu32YOn9rhaiE5yw==", + "optional": true + }, + "ws": { + "version": "8.14.2", + "resolved": "https://registry.npmjs.org/ws/-/ws-8.14.2.tgz", + "integrity": "sha512-wEBG1ftX4jcglPxgFCMJmZ2PLtSbJ2Peg6TmpJFTbe9GZYOQCDPdMYu/Tm0/bGZkw8paZnJY45J4K2PZrLYq8g==", + "requires": {} + } + } +} diff --git a/package.json b/package.json new file mode 100644 index 0000000..631812c --- /dev/null +++ b/package.json @@ -0,0 +1,15 @@ +{ + "name": "eris-template", + "version": "1.0.0", + "description": "", + "main": "index.js", + "scripts": { + "test": "echo \"Error: no test specified\" && exit 1" + }, + "keywords": [], + "author": "", + "license": "ISC", + "dependencies": { + "eris": "^0.17.2" + } +}