Basic Discord.js Code to make the bot login to Discord
This commit is contained in:
		
							parent
							
								
									e6c80ae4df
								
							
						
					
					
						commit
						9ead7f8080
					
				|  | @ -0,0 +1,2 @@ | |||
| # ConnectX Xantic | ||||
| Open-Source Version of ConnectX by Unbound | ||||
|  | @ -0,0 +1,3 @@ | |||
| discord_token=meow?? | ||||
| discord_client_id=198484 | ||||
| discord_client_secret=xyz | ||||
							
								
								
									
										2
									
								
								index.js
								
								
								
								
							
							
						
						
									
										2
									
								
								index.js
								
								
								
								
							|  | @ -1,2 +0,0 @@ | |||
| // Initalize dotenv to read .env files
 | ||||
| require("dotenv").config(); | ||||
|  | @ -10,7 +10,8 @@ | |||
|       "license": "AGPLv3", | ||||
|       "dependencies": { | ||||
|         "discord.js": "^14.14.1", | ||||
|         "dotenv": "^16.4.5" | ||||
|         "dotenv": "^16.4.5", | ||||
|         "nodemon": "^3.1.0" | ||||
|       } | ||||
|     }, | ||||
|     "node_modules/@discordjs/builders": { | ||||
|  | @ -174,6 +175,100 @@ | |||
|         "npm": ">=7.0.0" | ||||
|       } | ||||
|     }, | ||||
|     "node_modules/abbrev": { | ||||
|       "version": "1.1.1", | ||||
|       "resolved": "https://registry.npmjs.org/abbrev/-/abbrev-1.1.1.tgz", | ||||
|       "integrity": "sha512-nne9/IiQ/hzIhY6pdDnbBtz7DjPTKrY00P/zvPSm5pOFkl6xuGrGnXn/VtTNNfNtAfZ9/1RtehkszU9qcTii0Q==" | ||||
|     }, | ||||
|     "node_modules/anymatch": { | ||||
|       "version": "3.1.3", | ||||
|       "resolved": "https://registry.npmjs.org/anymatch/-/anymatch-3.1.3.tgz", | ||||
|       "integrity": "sha512-KMReFUr0B4t+D+OBkjR3KYqvocp2XaSzO55UcB6mgQMd3KbcE+mWTyvVV7D/zsdEbNnV6acZUutkiHQXvTr1Rw==", | ||||
|       "dependencies": { | ||||
|         "normalize-path": "^3.0.0", | ||||
|         "picomatch": "^2.0.4" | ||||
|       }, | ||||
|       "engines": { | ||||
|         "node": ">= 8" | ||||
|       } | ||||
|     }, | ||||
|     "node_modules/balanced-match": { | ||||
|       "version": "1.0.2", | ||||
|       "resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.2.tgz", | ||||
|       "integrity": "sha512-3oSeUO0TMV67hN1AmbXsK4yaqU7tjiHlbxRDZOpH0KW9+CeX4bRAaX0Anxt0tx2MrpRpWwQaPwIlISEJhYU5Pw==" | ||||
|     }, | ||||
|     "node_modules/binary-extensions": { | ||||
|       "version": "2.2.0", | ||||
|       "resolved": "https://registry.npmjs.org/binary-extensions/-/binary-extensions-2.2.0.tgz", | ||||
|       "integrity": "sha512-jDctJ/IVQbZoJykoeHbhXpOlNBqGNcwXJKJog42E5HDPUwQTSdjCHdihjj0DlnheQ7blbT6dHOafNAiS8ooQKA==", | ||||
|       "engines": { | ||||
|         "node": ">=8" | ||||
|       } | ||||
|     }, | ||||
|     "node_modules/brace-expansion": { | ||||
|       "version": "1.1.11", | ||||
|       "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.11.tgz", | ||||
|       "integrity": "sha512-iCuPHDFgrHX7H2vEI/5xpz07zSHB00TpugqhmYtVmMO6518mCuRMoOYFldEBl0g187ufozdaHgWKcYFb61qGiA==", | ||||
|       "dependencies": { | ||||
|         "balanced-match": "^1.0.0", | ||||
|         "concat-map": "0.0.1" | ||||
|       } | ||||
|     }, | ||||
|     "node_modules/braces": { | ||||
|       "version": "3.0.2", | ||||
|       "resolved": "https://registry.npmjs.org/braces/-/braces-3.0.2.tgz", | ||||
|       "integrity": "sha512-b8um+L1RzM3WDSzvhm6gIz1yfTbBt6YTlcEKAvsmqCZZFw46z626lVj9j1yEPW33H5H+lBQpZMP1k8l+78Ha0A==", | ||||
|       "dependencies": { | ||||
|         "fill-range": "^7.0.1" | ||||
|       }, | ||||
|       "engines": { | ||||
|         "node": ">=8" | ||||
|       } | ||||
|     }, | ||||
|     "node_modules/chokidar": { | ||||
|       "version": "3.6.0", | ||||
|       "resolved": "https://registry.npmjs.org/chokidar/-/chokidar-3.6.0.tgz", | ||||
|       "integrity": "sha512-7VT13fmjotKpGipCW9JEQAusEPE+Ei8nl6/g4FBAmIm0GOOLMua9NDDo/DWp0ZAxCr3cPq5ZpBqmPAQgDda2Pw==", | ||||
|       "dependencies": { | ||||
|         "anymatch": "~3.1.2", | ||||
|         "braces": "~3.0.2", | ||||
|         "glob-parent": "~5.1.2", | ||||
|         "is-binary-path": "~2.1.0", | ||||
|         "is-glob": "~4.0.1", | ||||
|         "normalize-path": "~3.0.0", | ||||
|         "readdirp": "~3.6.0" | ||||
|       }, | ||||
|       "engines": { | ||||
|         "node": ">= 8.10.0" | ||||
|       }, | ||||
|       "funding": { | ||||
|         "url": "https://paulmillr.com/funding/" | ||||
|       }, | ||||
|       "optionalDependencies": { | ||||
|         "fsevents": "~2.3.2" | ||||
|       } | ||||
|     }, | ||||
|     "node_modules/concat-map": { | ||||
|       "version": "0.0.1", | ||||
|       "resolved": "https://registry.npmjs.org/concat-map/-/concat-map-0.0.1.tgz", | ||||
|       "integrity": "sha512-/Srv4dswyQNBfohGpz9o6Yb3Gz3SrUDqBH5rTuhGR7ahtlbYKnVxw2bCFMRljaA7EXHaXZ8wsHdodFvbkhKmqg==" | ||||
|     }, | ||||
|     "node_modules/debug": { | ||||
|       "version": "4.3.4", | ||||
|       "resolved": "https://registry.npmjs.org/debug/-/debug-4.3.4.tgz", | ||||
|       "integrity": "sha512-PRWFHuSU3eDtQJPvnNY7Jcket1j0t5OuOsFzPPzsekD52Zl8qUfFIPEiswXqIvHWGVHOgX+7G/vCNNhehwxfkQ==", | ||||
|       "dependencies": { | ||||
|         "ms": "2.1.2" | ||||
|       }, | ||||
|       "engines": { | ||||
|         "node": ">=6.0" | ||||
|       }, | ||||
|       "peerDependenciesMeta": { | ||||
|         "supports-color": { | ||||
|           "optional": true | ||||
|         } | ||||
|       } | ||||
|     }, | ||||
|     "node_modules/discord-api-types": { | ||||
|       "version": "0.37.61", | ||||
|       "resolved": "https://registry.npmjs.org/discord-api-types/-/discord-api-types-0.37.61.tgz", | ||||
|  | @ -219,6 +314,92 @@ | |||
|       "resolved": "https://registry.npmjs.org/fast-deep-equal/-/fast-deep-equal-3.1.3.tgz", | ||||
|       "integrity": "sha512-f3qQ9oQy9j2AhBe/H9VC91wLmKBCCU/gDOnKNAYG5hswO7BLKj09Hc5HYNz9cGI++xlpDCIgDaitVs03ATR84Q==" | ||||
|     }, | ||||
|     "node_modules/fill-range": { | ||||
|       "version": "7.0.1", | ||||
|       "resolved": "https://registry.npmjs.org/fill-range/-/fill-range-7.0.1.tgz", | ||||
|       "integrity": "sha512-qOo9F+dMUmC2Lcb4BbVvnKJxTPjCm+RRpe4gDuGrzkL7mEVl/djYSu2OdQ2Pa302N4oqkSg9ir6jaLWJ2USVpQ==", | ||||
|       "dependencies": { | ||||
|         "to-regex-range": "^5.0.1" | ||||
|       }, | ||||
|       "engines": { | ||||
|         "node": ">=8" | ||||
|       } | ||||
|     }, | ||||
|     "node_modules/fsevents": { | ||||
|       "version": "2.3.3", | ||||
|       "resolved": "https://registry.npmjs.org/fsevents/-/fsevents-2.3.3.tgz", | ||||
|       "integrity": "sha512-5xoDfX+fL7faATnagmWPpbFtwh/R77WmMMqqHGS65C3vvB0YHrgF+B1YmZ3441tMj5n63k0212XNoJwzlhffQw==", | ||||
|       "hasInstallScript": true, | ||||
|       "optional": true, | ||||
|       "os": [ | ||||
|         "darwin" | ||||
|       ], | ||||
|       "engines": { | ||||
|         "node": "^8.16.0 || ^10.6.0 || >=11.0.0" | ||||
|       } | ||||
|     }, | ||||
|     "node_modules/glob-parent": { | ||||
|       "version": "5.1.2", | ||||
|       "resolved": "https://registry.npmjs.org/glob-parent/-/glob-parent-5.1.2.tgz", | ||||
|       "integrity": "sha512-AOIgSQCepiJYwP3ARnGx+5VnTu2HBYdzbGP45eLw1vr3zB3vZLeyed1sC9hnbcOc9/SrMyM5RPQrkGz4aS9Zow==", | ||||
|       "dependencies": { | ||||
|         "is-glob": "^4.0.1" | ||||
|       }, | ||||
|       "engines": { | ||||
|         "node": ">= 6" | ||||
|       } | ||||
|     }, | ||||
|     "node_modules/has-flag": { | ||||
|       "version": "3.0.0", | ||||
|       "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-3.0.0.tgz", | ||||
|       "integrity": "sha512-sKJf1+ceQBr4SMkvQnBDNDtf4TXpVhVGateu0t918bl30FnbE2m4vNLX+VWe/dpjlb+HugGYzW7uQXH98HPEYw==", | ||||
|       "engines": { | ||||
|         "node": ">=4" | ||||
|       } | ||||
|     }, | ||||
|     "node_modules/ignore-by-default": { | ||||
|       "version": "1.0.1", | ||||
|       "resolved": "https://registry.npmjs.org/ignore-by-default/-/ignore-by-default-1.0.1.tgz", | ||||
|       "integrity": "sha512-Ius2VYcGNk7T90CppJqcIkS5ooHUZyIQK+ClZfMfMNFEF9VSE73Fq+906u/CWu92x4gzZMWOwfFYckPObzdEbA==" | ||||
|     }, | ||||
|     "node_modules/is-binary-path": { | ||||
|       "version": "2.1.0", | ||||
|       "resolved": "https://registry.npmjs.org/is-binary-path/-/is-binary-path-2.1.0.tgz", | ||||
|       "integrity": "sha512-ZMERYes6pDydyuGidse7OsHxtbI7WVeUEozgR/g7rd0xUimYNlvZRE/K2MgZTjWy725IfelLeVcEM97mmtRGXw==", | ||||
|       "dependencies": { | ||||
|         "binary-extensions": "^2.0.0" | ||||
|       }, | ||||
|       "engines": { | ||||
|         "node": ">=8" | ||||
|       } | ||||
|     }, | ||||
|     "node_modules/is-extglob": { | ||||
|       "version": "2.1.1", | ||||
|       "resolved": "https://registry.npmjs.org/is-extglob/-/is-extglob-2.1.1.tgz", | ||||
|       "integrity": "sha512-SbKbANkN603Vi4jEZv49LeVJMn4yGwsbzZworEoyEiutsN3nJYdbO36zfhGJ6QEDpOZIFkDtnq5JRxmvl3jsoQ==", | ||||
|       "engines": { | ||||
|         "node": ">=0.10.0" | ||||
|       } | ||||
|     }, | ||||
|     "node_modules/is-glob": { | ||||
|       "version": "4.0.3", | ||||
|       "resolved": "https://registry.npmjs.org/is-glob/-/is-glob-4.0.3.tgz", | ||||
|       "integrity": "sha512-xelSayHH36ZgE7ZWhli7pW34hNbNl8Ojv5KVmkJD4hBdD3th8Tfk9vYasLM+mXWOZhFkgZfxhLSnrwRr4elSSg==", | ||||
|       "dependencies": { | ||||
|         "is-extglob": "^2.1.1" | ||||
|       }, | ||||
|       "engines": { | ||||
|         "node": ">=0.10.0" | ||||
|       } | ||||
|     }, | ||||
|     "node_modules/is-number": { | ||||
|       "version": "7.0.0", | ||||
|       "resolved": "https://registry.npmjs.org/is-number/-/is-number-7.0.0.tgz", | ||||
|       "integrity": "sha512-41Cifkg6e8TylSpdtTpeLVMqvSBEVzTttHvERD741+pnZ8ANv0004MRL43QKPDlK9cGvNp6NZWZUBlbGXYxxng==", | ||||
|       "engines": { | ||||
|         "node": ">=0.12.0" | ||||
|       } | ||||
|     }, | ||||
|     "node_modules/lodash": { | ||||
|       "version": "4.17.21", | ||||
|       "resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.21.tgz", | ||||
|  | @ -229,11 +410,172 @@ | |||
|       "resolved": "https://registry.npmjs.org/lodash.snakecase/-/lodash.snakecase-4.1.1.tgz", | ||||
|       "integrity": "sha512-QZ1d4xoBHYUeuouhEq3lk3Uq7ldgyFXGBhg04+oRLnIz8o9T65Eh+8YdroUwn846zchkA9yDsDl5CVVaV2nqYw==" | ||||
|     }, | ||||
|     "node_modules/lru-cache": { | ||||
|       "version": "6.0.0", | ||||
|       "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-6.0.0.tgz", | ||||
|       "integrity": "sha512-Jo6dJ04CmSjuznwJSS3pUeWmd/H0ffTlkXXgwZi+eq1UCmqQwCh+eLsYOYCwY991i2Fah4h1BEMCx4qThGbsiA==", | ||||
|       "dependencies": { | ||||
|         "yallist": "^4.0.0" | ||||
|       }, | ||||
|       "engines": { | ||||
|         "node": ">=10" | ||||
|       } | ||||
|     }, | ||||
|     "node_modules/magic-bytes.js": { | ||||
|       "version": "1.10.0", | ||||
|       "resolved": "https://registry.npmjs.org/magic-bytes.js/-/magic-bytes.js-1.10.0.tgz", | ||||
|       "integrity": "sha512-/k20Lg2q8LE5xiaaSkMXk4sfvI+9EGEykFS4b0CHHGWqDYU0bGUFSwchNOMA56D7TCs9GwVTkqe9als1/ns8UQ==" | ||||
|     }, | ||||
|     "node_modules/minimatch": { | ||||
|       "version": "3.1.2", | ||||
|       "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.1.2.tgz", | ||||
|       "integrity": "sha512-J7p63hRiAjw1NDEww1W7i37+ByIrOWO5XQQAzZ3VOcL0PNybwpfmV/N05zFAzwQ9USyEcX6t3UO+K5aqBQOIHw==", | ||||
|       "dependencies": { | ||||
|         "brace-expansion": "^1.1.7" | ||||
|       }, | ||||
|       "engines": { | ||||
|         "node": "*" | ||||
|       } | ||||
|     }, | ||||
|     "node_modules/ms": { | ||||
|       "version": "2.1.2", | ||||
|       "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz", | ||||
|       "integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==" | ||||
|     }, | ||||
|     "node_modules/nodemon": { | ||||
|       "version": "3.1.0", | ||||
|       "resolved": "https://registry.npmjs.org/nodemon/-/nodemon-3.1.0.tgz", | ||||
|       "integrity": "sha512-xqlktYlDMCepBJd43ZQhjWwMw2obW/JRvkrLxq5RCNcuDDX1DbcPT+qT1IlIIdf+DhnWs90JpTMe+Y5KxOchvA==", | ||||
|       "dependencies": { | ||||
|         "chokidar": "^3.5.2", | ||||
|         "debug": "^4", | ||||
|         "ignore-by-default": "^1.0.1", | ||||
|         "minimatch": "^3.1.2", | ||||
|         "pstree.remy": "^1.1.8", | ||||
|         "semver": "^7.5.3", | ||||
|         "simple-update-notifier": "^2.0.0", | ||||
|         "supports-color": "^5.5.0", | ||||
|         "touch": "^3.1.0", | ||||
|         "undefsafe": "^2.0.5" | ||||
|       }, | ||||
|       "bin": { | ||||
|         "nodemon": "bin/nodemon.js" | ||||
|       }, | ||||
|       "engines": { | ||||
|         "node": ">=10" | ||||
|       }, | ||||
|       "funding": { | ||||
|         "type": "opencollective", | ||||
|         "url": "https://opencollective.com/nodemon" | ||||
|       } | ||||
|     }, | ||||
|     "node_modules/nopt": { | ||||
|       "version": "1.0.10", | ||||
|       "resolved": "https://registry.npmjs.org/nopt/-/nopt-1.0.10.tgz", | ||||
|       "integrity": "sha512-NWmpvLSqUrgrAC9HCuxEvb+PSloHpqVu+FqcO4eeF2h5qYRhA7ev6KvelyQAKtegUbC6RypJnlEOhd8vloNKYg==", | ||||
|       "dependencies": { | ||||
|         "abbrev": "1" | ||||
|       }, | ||||
|       "bin": { | ||||
|         "nopt": "bin/nopt.js" | ||||
|       }, | ||||
|       "engines": { | ||||
|         "node": "*" | ||||
|       } | ||||
|     }, | ||||
|     "node_modules/normalize-path": { | ||||
|       "version": "3.0.0", | ||||
|       "resolved": "https://registry.npmjs.org/normalize-path/-/normalize-path-3.0.0.tgz", | ||||
|       "integrity": "sha512-6eZs5Ls3WtCisHWp9S2GUy8dqkpGi4BVSz3GaqiE6ezub0512ESztXUwUB6C6IKbQkY2Pnb/mD4WYojCRwcwLA==", | ||||
|       "engines": { | ||||
|         "node": ">=0.10.0" | ||||
|       } | ||||
|     }, | ||||
|     "node_modules/picomatch": { | ||||
|       "version": "2.3.1", | ||||
|       "resolved": "https://registry.npmjs.org/picomatch/-/picomatch-2.3.1.tgz", | ||||
|       "integrity": "sha512-JU3teHTNjmE2VCGFzuY8EXzCDVwEqB2a8fsIvwaStHhAWJEeVd1o1QD80CU6+ZdEXXSLbSsuLwJjkCBWqRQUVA==", | ||||
|       "engines": { | ||||
|         "node": ">=8.6" | ||||
|       }, | ||||
|       "funding": { | ||||
|         "url": "https://github.com/sponsors/jonschlinkert" | ||||
|       } | ||||
|     }, | ||||
|     "node_modules/pstree.remy": { | ||||
|       "version": "1.1.8", | ||||
|       "resolved": "https://registry.npmjs.org/pstree.remy/-/pstree.remy-1.1.8.tgz", | ||||
|       "integrity": "sha512-77DZwxQmxKnu3aR542U+X8FypNzbfJ+C5XQDk3uWjWxn6151aIMGthWYRXTqT1E5oJvg+ljaa2OJi+VfvCOQ8w==" | ||||
|     }, | ||||
|     "node_modules/readdirp": { | ||||
|       "version": "3.6.0", | ||||
|       "resolved": "https://registry.npmjs.org/readdirp/-/readdirp-3.6.0.tgz", | ||||
|       "integrity": "sha512-hOS089on8RduqdbhvQ5Z37A0ESjsqz6qnRcffsMU3495FuTdqSm+7bhJ29JvIOsBDEEnan5DPu9t3To9VRlMzA==", | ||||
|       "dependencies": { | ||||
|         "picomatch": "^2.2.1" | ||||
|       }, | ||||
|       "engines": { | ||||
|         "node": ">=8.10.0" | ||||
|       } | ||||
|     }, | ||||
|     "node_modules/semver": { | ||||
|       "version": "7.6.0", | ||||
|       "resolved": "https://registry.npmjs.org/semver/-/semver-7.6.0.tgz", | ||||
|       "integrity": "sha512-EnwXhrlwXMk9gKu5/flx5sv/an57AkRplG3hTK68W7FRDN+k+OWBj65M7719OkA82XLBxrcX0KSHj+X5COhOVg==", | ||||
|       "dependencies": { | ||||
|         "lru-cache": "^6.0.0" | ||||
|       }, | ||||
|       "bin": { | ||||
|         "semver": "bin/semver.js" | ||||
|       }, | ||||
|       "engines": { | ||||
|         "node": ">=10" | ||||
|       } | ||||
|     }, | ||||
|     "node_modules/simple-update-notifier": { | ||||
|       "version": "2.0.0", | ||||
|       "resolved": "https://registry.npmjs.org/simple-update-notifier/-/simple-update-notifier-2.0.0.tgz", | ||||
|       "integrity": "sha512-a2B9Y0KlNXl9u/vsW6sTIu9vGEpfKu2wRV6l1H3XEas/0gUIzGzBoP/IouTcUQbm9JWZLH3COxyn03TYlFax6w==", | ||||
|       "dependencies": { | ||||
|         "semver": "^7.5.3" | ||||
|       }, | ||||
|       "engines": { | ||||
|         "node": ">=10" | ||||
|       } | ||||
|     }, | ||||
|     "node_modules/supports-color": { | ||||
|       "version": "5.5.0", | ||||
|       "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-5.5.0.tgz", | ||||
|       "integrity": "sha512-QjVjwdXIt408MIiAqCX4oUKsgU2EqAGzs2Ppkm4aQYbjm+ZEWEcW4SfFNTr4uMNZma0ey4f5lgLrkB0aX0QMow==", | ||||
|       "dependencies": { | ||||
|         "has-flag": "^3.0.0" | ||||
|       }, | ||||
|       "engines": { | ||||
|         "node": ">=4" | ||||
|       } | ||||
|     }, | ||||
|     "node_modules/to-regex-range": { | ||||
|       "version": "5.0.1", | ||||
|       "resolved": "https://registry.npmjs.org/to-regex-range/-/to-regex-range-5.0.1.tgz", | ||||
|       "integrity": "sha512-65P7iz6X5yEr1cwcgvQxbbIw7Uk3gOy5dIdtZ4rDveLqhrdJP+Li/Hx6tyK0NEb+2GCyneCMJiGqrADCSNk8sQ==", | ||||
|       "dependencies": { | ||||
|         "is-number": "^7.0.0" | ||||
|       }, | ||||
|       "engines": { | ||||
|         "node": ">=8.0" | ||||
|       } | ||||
|     }, | ||||
|     "node_modules/touch": { | ||||
|       "version": "3.1.0", | ||||
|       "resolved": "https://registry.npmjs.org/touch/-/touch-3.1.0.tgz", | ||||
|       "integrity": "sha512-WBx8Uy5TLtOSRtIq+M03/sKDrXCLHxwDcquSP2c43Le03/9serjQBIztjRz6FkJez9D/hleyAXTBGLwwZUw9lA==", | ||||
|       "dependencies": { | ||||
|         "nopt": "~1.0.10" | ||||
|       }, | ||||
|       "bin": { | ||||
|         "nodetouch": "bin/nodetouch.js" | ||||
|       } | ||||
|     }, | ||||
|     "node_modules/ts-mixer": { | ||||
|       "version": "6.0.4", | ||||
|       "resolved": "https://registry.npmjs.org/ts-mixer/-/ts-mixer-6.0.4.tgz", | ||||
|  | @ -244,6 +586,11 @@ | |||
|       "resolved": "https://registry.npmjs.org/tslib/-/tslib-2.6.2.tgz", | ||||
|       "integrity": "sha512-AEYxH93jGFPn/a2iVAwW87VuUIkR1FVUKB77NwMF7nBTDkDrrT/Hpt/IrCJ0QXhW27jTBDcf5ZY7w6RiqTMw2Q==" | ||||
|     }, | ||||
|     "node_modules/undefsafe": { | ||||
|       "version": "2.0.5", | ||||
|       "resolved": "https://registry.npmjs.org/undefsafe/-/undefsafe-2.0.5.tgz", | ||||
|       "integrity": "sha512-WxONCrssBM8TSPRqN5EmsjVrsv4A8X12J4ArBiiayv3DyyG3ZlIg6yysuuSYdZsVz3TKcTg2fd//Ujd4CHV1iA==" | ||||
|     }, | ||||
|     "node_modules/undici": { | ||||
|       "version": "5.27.2", | ||||
|       "resolved": "https://registry.npmjs.org/undici/-/undici-5.27.2.tgz", | ||||
|  | @ -279,6 +626,11 @@ | |||
|           "optional": true | ||||
|         } | ||||
|       } | ||||
|     }, | ||||
|     "node_modules/yallist": { | ||||
|       "version": "4.0.0", | ||||
|       "resolved": "https://registry.npmjs.org/yallist/-/yallist-4.0.0.tgz", | ||||
|       "integrity": "sha512-3wdGidZyq5PB084XLES5TpOSRA3wjXAlIWMhum2kRcv/41Sn2emQ0dycQW4uZXLejwKvg6EsvbdlVL+FYEct7A==" | ||||
|     } | ||||
|   } | ||||
| } | ||||
|  |  | |||
|  | @ -4,7 +4,8 @@ | |||
|   "description": "ConnectX Xantic", | ||||
|   "main": "index.js", | ||||
|   "scripts": { | ||||
|     "test": "node index" | ||||
|     "test": "nodemon src/index", | ||||
|     "start": "node src/index" | ||||
|   }, | ||||
|   "keywords": [ | ||||
|     "cx", | ||||
|  | @ -14,6 +15,7 @@ | |||
|   "license": "AGPLv3", | ||||
|   "dependencies": { | ||||
|     "discord.js": "^14.14.1", | ||||
|     "dotenv": "^16.4.5" | ||||
|     "dotenv": "^16.4.5", | ||||
|     "nodemon": "^3.1.0" | ||||
|   } | ||||
| } | ||||
|  |  | |||
|  | @ -0,0 +1,10 @@ | |||
| const { SlashCommandBuilder } = require('discord.js'); | ||||
| 
 | ||||
| module.exports = { | ||||
| 	data: new SlashCommandBuilder() | ||||
| 		.setName('ping') | ||||
| 		.setDescription('Replies with Pong!'), | ||||
| 	async execute(interaction) { | ||||
| 		await interaction.reply('Pong!'); | ||||
| 	}, | ||||
| }; | ||||
|  | @ -3,5 +3,7 @@ module.exports = { | |||
|     // Discord Bot Token **It's not recommend to put it here**,
 | ||||
|     discord_token: process.env['discord_token'] || "", | ||||
|     // Discord Bot Client Id **It's not recommend to put it here**,
 | ||||
|     discord_client_id: process.env['discord_client_id'] || "" | ||||
|     discord_client_id: process.env['discord_client_id'] || "", | ||||
|     // Discord Bot Client Id **It's not recommend to put it here**,
 | ||||
|     discord_client_secret: process.env['discord_client_secret'] || "" | ||||
| } | ||||
|  | @ -0,0 +1,48 @@ | |||
| // Initalize dotenv to read .env files
 | ||||
| require("dotenv").config(); | ||||
| const config = require("./config/prod"); | ||||
| const { REST, Routes } = require('discord.js'); | ||||
| const fs = require('node:fs'); | ||||
| const path = require('node:path'); | ||||
| 
 | ||||
| const commands = []; | ||||
| // Grab all the command folders from the commands directory you created earlier
 | ||||
| const foldersPath = path.join(__dirname, 'commands'); | ||||
| const commandFolders = fs.readdirSync(foldersPath); | ||||
| 
 | ||||
| for (const folder of commandFolders) { | ||||
| 	// Grab all the command files from the commands directory you created earlier
 | ||||
| 	const commandsPath = path.join(foldersPath, folder); | ||||
| 	const commandFiles = fs.readdirSync(commandsPath).filter(file => file.endsWith('.js')); | ||||
| 	// Grab the SlashCommandBuilder#toJSON() output of each command's data for deployment
 | ||||
| 	for (const file of commandFiles) { | ||||
| 		const filePath = path.join(commandsPath, file); | ||||
| 		const command = require(filePath); | ||||
| 		if ('data' in command && 'execute' in command) { | ||||
| 			commands.push(command.data.toJSON()); | ||||
| 		} else { | ||||
| 			console.log(`[WARNING] The command at ${filePath} is missing a required "data" or "execute" property.`); | ||||
| 		} | ||||
| 	} | ||||
| } | ||||
| 
 | ||||
| // Construct and prepare an instance of the REST module
 | ||||
| const rest = new REST().setToken(config.discord_token); | ||||
| 
 | ||||
| // and deploy your commands!
 | ||||
| (async () => { | ||||
| 	try { | ||||
| 		console.log(`Started refreshing ${commands.length} application (/) commands.`); | ||||
| 
 | ||||
| 		// The put method is used to fully refresh all commands in the guild with the current set
 | ||||
| 		const data = await rest.put( | ||||
| 			Routes.applicationCommands(config.discord_client_id), | ||||
| 			{ body: commands }, | ||||
| 		); | ||||
| 
 | ||||
| 		console.log(`Successfully reloaded ${data.length} application (/) commands.`); | ||||
| 	} catch (error) { | ||||
| 		// And of course, make sure you catch and log any errors!
 | ||||
| 		console.error(error); | ||||
| 	} | ||||
| })(); | ||||
|  | @ -0,0 +1,68 @@ | |||
| // Initalize dotenv to read .env files
 | ||||
| require("dotenv").config(); | ||||
| const config = require("./config/prod"); | ||||
| const fs = require('node:fs'); | ||||
| const path = require('node:path'); | ||||
| const { Client, Events, GatewayIntentBits, Collection } = require('discord.js'); | ||||
| 
 | ||||
| const client = new Client({ intents: [ | ||||
|     GatewayIntentBits.Guilds, | ||||
|     GatewayIntentBits.GuildMessages, | ||||
|     GatewayIntentBits.DirectMessages, | ||||
|     GatewayIntentBits.MessageContent | ||||
| ] }); | ||||
| 
 | ||||
| client.commands = new Collection(); | ||||
| 
 | ||||
| client.once(Events.ClientReady, readyClient => { | ||||
| 	console.log(`Ready! Logged in as ${readyClient.user.tag}`); | ||||
| 
 | ||||
|     client.user.setActivity({ | ||||
|         name: `crossMessage on ${client.guilds.cache.size.toString()}`, | ||||
|         state: "idle" | ||||
|     }); | ||||
| }); | ||||
| 
 | ||||
| const foldersPath = path.join(__dirname, 'commands'); | ||||
| const commandFolders = fs.readdirSync(foldersPath); | ||||
| 
 | ||||
| for (const folder of commandFolders) { | ||||
| 	const commandsPath = path.join(foldersPath, folder); | ||||
| 	const commandFiles = fs.readdirSync(commandsPath).filter(file => file.endsWith('.js')); | ||||
| 	for (const file of commandFiles) { | ||||
| 		const filePath = path.join(commandsPath, file); | ||||
| 		const command = require(filePath); | ||||
| 		// Set a new item in the Collection with the key as the command name and the value as the exported module
 | ||||
| 		if ('data' in command && 'execute' in command) { | ||||
| 			client.commands.set(command.data.name, command); | ||||
| 			console.log("Loaded /" + command.data.name); | ||||
| 		} else { | ||||
| 			console.log(`[WARNING] The command at ${filePath} is missing a required "data" or "execute" property.`); | ||||
| 		} | ||||
| 	} | ||||
| } | ||||
| 
 | ||||
| client.on(Events.InteractionCreate, async interaction => { | ||||
| 	if (!interaction.isChatInputCommand()) return; | ||||
| 
 | ||||
| 	const command = interaction.client.commands.get(interaction.commandName); | ||||
| 
 | ||||
| 	if (!command) { | ||||
| 		console.error(`No command matching ${interaction.commandName} was found.`); | ||||
| 		return; | ||||
| 	} | ||||
| 
 | ||||
| 	try { | ||||
| 		await command.execute(interaction); | ||||
| 	} catch (error) { | ||||
| 		console.error(error); | ||||
| 		if (interaction.replied || interaction.deferred) { | ||||
| 			await interaction.followUp({ content: 'There was an error while executing this command!', ephemeral: true }); | ||||
| 		} else { | ||||
| 			await interaction.reply({ content: 'There was an error while executing this command!', ephemeral: true }); | ||||
| 		} | ||||
| 	} | ||||
| }); | ||||
| 
 | ||||
| // Login to ConnectX
 | ||||
| client.login(config.discord_token); | ||||
		Loading…
	
		Reference in New Issue