From 4cd76db96960f42c5cff868a97746f90fa983044 Mon Sep 17 00:00:00 2001 From: Skillz Date: Thu, 19 Nov 2020 23:10:14 -0500 Subject: [PATCH] fixes --- docs/.cache/.eslintrc.json | 9 + docs/.cache/__tests__/.babelrc | 3 + .../__snapshots__/dev-loader.js.snap | 18 + .../__tests__/__snapshots__/loader.js.snap | 18 + .../__snapshots__/static-entry.js.snap | 13 + docs/.cache/__tests__/dev-loader.js | 557 +++++++++++++++++ docs/.cache/__tests__/ensure-resources.tsx | 33 + .../.cache/__tests__/error-overlay-handler.js | 58 ++ docs/.cache/__tests__/find-path.js | 116 ++++ docs/.cache/__tests__/loader.js | 572 ++++++++++++++++++ docs/.cache/__tests__/minimal-config.js | 32 + .../__tests__/public-page-renderer-dev.tsx | 42 ++ .../__tests__/public-page-renderer-prod.tsx | 38 ++ docs/.cache/__tests__/static-entry.js | 346 +++++++++++ docs/.cache/__tests__/strip-prefix.js | 31 + docs/.cache/api-runner-browser-plugins.js | 13 + docs/.cache/api-runner-browser.js | 61 ++ docs/.cache/api-runner-ssr.js | 58 ++ docs/.cache/api-ssr-docs.js | 198 ++++++ docs/.cache/app.js | 100 +++ docs/.cache/async-requires.js | 8 + docs/.cache/babelState.json | 184 ++++++ ...tore-0185e0f001d1a2df3cc96621404f18fd.json | 1 + ...tore-02c8c8bda13d33f5c814ad5d52c1605e.json | 1 + ...tore-03663d6a4f438a7d626759e765a1add7.json | 1 + ...tore-04a38d73a68fa1e804319439011e11d9.json | 1 + ...tore-04ffaeb7e60f7c69f2be2d9c62d27c89.json | 1 + ...tore-05230a4939f290a6033bbfc09ea1b935.json | 1 + ...tore-05e987acc3d5e7b9d000f7bfe7b62105.json | 1 + ...tore-0aedfa9d0d75212ceecd48a3b46b7a7b.json | 1 + ...tore-0b81b8775aeaa953c65a46009331eb99.json | 1 + ...tore-0d2c17f1488867f2dffe5b55ad3a4316.json | 1 + ...tore-0eee710e93678baeabe4b3aba4bbf5f7.json | 1 + ...tore-0fb27743948f516aa90e985c5052f9ae.json | 1 + ...tore-113a31d4b6cbf7e91d13a23bcc388165.json | 1 + ...tore-149d68ad6d5c452536cd7471bcda8a26.json | 1 + ...tore-197303de8e8c05c6067f92a342669add.json | 1 + ...tore-1a299f58c275aa4ccca1c63ed73af141.json | 1 + ...tore-1b75a1da0a207c608314560357c0ffcc.json | 1 + ...tore-1e05ce69417e6e39cf47210dff5c520a.json | 1 + ...tore-1ecfdc79509821bb67ad0139242eb020.json | 1 + ...tore-20b82ce0c38da297167503a0689e79eb.json | 1 + ...tore-2133e165ca6c909f24ebf19b6ab5a6c6.json | 1 + ...tore-215396216730f0a74d19163a8b790ed5.json | 1 + ...tore-22903bb47406f19dea194b0bdca29de3.json | 1 + ...tore-24ad22243e43177255b836d98838e179.json | 1 + ...tore-255969f006670bdb650251db3cb562ab.json | 1 + ...tore-26431506f956ca87374159b7b0df7424.json | 1 + ...tore-26b8b6c7688485c8887043a9ad28fae4.json | 1 + ...tore-279e940a043d93d0cc4ef6f739569883.json | 1 + ...tore-2bbdee6f6981626b803c1a89697d92a7.json | 1 + ...tore-2d0cc7b68095d91c7a5e7020fec9ede1.json | 1 + ...tore-2d893a36201ea8c27ca177dd70cc50dc.json | 1 + ...tore-2e96b20f1fe2f4a29580a271de978a28.json | 1 + ...tore-2ed4a8660238fa0843129437135cce8b.json | 1 + ...tore-2f6d2f3521d2b2827e6ecd2246216688.json | 1 + ...tore-2fb375a5daaca3d922669166e80f5896.json | 1 + ...tore-2feed06b5c382f85fd8ac516d633ae39.json | 1 + ...tore-32eb83ed38d07ed1c91b8e08f1fba466.json | 1 + ...tore-3425a0648a8d54d9f46f9da3c263ab0b.json | 1 + ...tore-34a4acfe01a0275e6326e6ce53ae75ee.json | 1 + ...tore-368eae47c7bcba4b37cede9a8d9e812c.json | 1 + ...tore-370943155a334bc8c7da62041fe3efea.json | 1 + ...tore-3aacbad8303a268479a96099b423e2d6.json | 1 + ...tore-3b07aab8aef58a7b80390ef7ed5a58b4.json | 1 + ...tore-3de550f11eaca5577c6e46a61102df9e.json | 1 + ...tore-3fa301ca43ce78de093cd98ece436062.json | 1 + ...tore-40a9ecfef4111b17d024b3b7155902db.json | 1 + ...tore-41944ca0837cb3dff1ad035ebcca9173.json | 1 + ...tore-438d1d4d51c07abf0c56bef8f3061580.json | 1 + ...tore-45335280506205b267fa24939f66a7a2.json | 1 + ...tore-46cfa0f805b5feb9157382b2cdd6e3fc.json | 1 + ...tore-46f228c491807eb72544f4e29d43af57.json | 1 + ...tore-4849d65f9f719edca85e89f2877d14aa.json | 1 + ...tore-498145645926159b73b80d18f82ab579.json | 1 + ...tore-4a201e513228102f84d47e1d65453335.json | 1 + ...tore-4a78dd7a552cc77c4f55d57f3443877b.json | 1 + ...tore-4f6d0a38ed5cb1fc487e4b0530ac3758.json | 1 + ...tore-4f83dd443785eb26ad81572a5b149d6e.json | 1 + ...tore-4fe774b5ec1ead5bf01db3eb5336e5ed.json | 1 + ...tore-51ebaae4b3322366598354b14491fd0e.json | 1 + ...tore-51f081f0d9daa5d3e3b97358c9a0d6e3.json | 1 + ...tore-5221d7a133e99116b22e656af927fca7.json | 1 + ...tore-569b61f23c759cc425604a583501cc29.json | 1 + ...tore-57c268670c7fc0b69e57e50ee08a28cf.json | 1 + ...tore-5a931acdf6c13efd74cef3e5c64561d5.json | 1 + ...tore-5b49a3a2037e09b0b767101a0ba9d679.json | 1 + ...tore-5c9357b248181abfaba7c457c93f8853.json | 1 + ...tore-5d95dc7df00bb011c165c9390441facf.json | 1 + ...tore-651a52a02788cae1d13a988a653c5754.json | 1 + ...tore-67746d58d4cc8a61799ed91117b51303.json | 1 + ...tore-67a4416f6199e0263e2fdef9ccb769d7.json | 1 + ...tore-683661f7c6f3bab20ab1dde554c699ac.json | 1 + ...tore-6ac9865e532d4c06cc6575a815a5cb87.json | 1 + ...tore-6c4d5c3f58a54075704406c9152c8629.json | 1 + ...tore-6e802be7b87638c47cf4a3844aee228f.json | 1 + ...tore-6fc5d5eef37afc0a534ff4ebad37218a.json | 1 + ...tore-7259aedea45c9b0de34264203207aff4.json | 1 + ...tore-72787bc26e4f5cc2b39382ec9008f12b.json | 1 + ...tore-72acad23a065a02f9da956503f5680a8.json | 1 + ...tore-737e99c52ea631b48b570e12d4afe63a.json | 1 + ...tore-73e958c154415a617e359a958fdcf8c7.json | 1 + ...tore-7401ad1aecbbae1ae281022c6350a3bf.json | 1 + ...tore-74119f2cf2b84308129e13bd0d3a7046.json | 1 + ...tore-74987a851eaf18ea6eabc2c76c6f8105.json | 1 + ...tore-75ae9b7a0b3d0d5c86883980f02b94f0.json | 1 + ...tore-75bea16c14b4f40816dc5cd6013e717d.json | 1 + ...tore-7624176d8560d4dc695be036bfbeccc9.json | 1 + ...tore-765afef9bd4e34d3860b1e8f7b06926a.json | 1 + ...tore-77cd89d184cb3acbc2bb9db50a587b5c.json | 1 + ...tore-78813b6c296158893ff9a721082fd0e8.json | 1 + ...tore-7946f359a67ab79556fe70c7ea4b3884.json | 1 + ...tore-794797195edf61a3b05547501cb7a1d5.json | 1 + ...tore-7a7059fb75507b5fc793da3f6ea6b0cf.json | 1 + ...tore-7aa7740504ab81a59de1396473cb350c.json | 1 + ...tore-7b8aaa1037478cb56350f784d9d9542a.json | 1 + ...tore-7bc9578329298fbb8e415ab47e1c6d57.json | 1 + ...tore-7ceb97a6eec71c23d8606266ce3af052.json | 1 + ...tore-7cf5149eab885b394a7e7659efb3896c.json | 1 + ...tore-7dce378488ec25253649ceb2d7039248.json | 1 + ...tore-7f0818e6118769601060e8a3725f99f5.json | 1 + ...tore-7fd2e1131a8bc0c4793e2efda5519b4b.json | 1 + ...tore-815e75d2440bc4728043ad2952f65839.json | 1 + ...tore-8232a7a77e9961ea47a5c3819d571e6b.json | 1 + ...tore-82fb914e5ec9036bd275d7dd5d223369.json | 1 + ...tore-831dfceb538231323dc563f9b0c6fba7.json | 1 + ...tore-836f4fa4ecb3909368989d148f191749.json | 1 + ...tore-8375d5d629cad4caa205c8429309263f.json | 1 + ...tore-837811b4e69e55144f8688469fa6f922.json | 1 + ...tore-86a51897ace3a214e556214d0bae2ac0.json | 1 + ...tore-86f5ca31aff62e4ff6610d03bfb91124.json | 1 + ...tore-87866b163bfadfadae9de8a1f7eda544.json | 1 + ...tore-882d2b403440aad428ee348925648524.json | 1 + ...tore-89728c6b5a3c76f64e7b67015ef49029.json | 1 + ...tore-8ab466bafaeed6004ebcce705e3ac5ea.json | 1 + ...tore-8aeb0fbdcf116e02eda4d7ad64a6cd22.json | 1 + ...tore-8cd370ab88b3e8bdb0d05df678c0c157.json | 1 + ...tore-8f37e5fb91e478272a82b22be8349649.json | 1 + ...tore-90aea6765ffd064dc1855c368bc4f35a.json | 1 + ...tore-93e1cced495a2f783d0b731bf610732c.json | 1 + ...tore-93ed76efa1e16fead411796ef2375e98.json | 1 + ...tore-9579b93c65f7f53d59b10d47e2b8f499.json | 1 + ...tore-957f0e96b16acab41790fb5f6abf1cd7.json | 1 + ...tore-95be68775e17319e434f495d5a7ff08c.json | 1 + ...tore-96c3cefc21a452d127cb41816d06bb62.json | 1 + ...tore-9a37d616d0c39b3996f33076c21a2dd3.json | 1 + ...tore-9b27620307e2d376af34b3e6c30543e2.json | 1 + ...tore-9c35db43ebe234368f04bea3419c0e82.json | 1 + ...tore-9c570a2fd92c7f30091b8d50d36fbca9.json | 1 + ...tore-9d9f4b39f7019084d7acb8e78111070e.json | 1 + ...tore-9e3152bb6411d1248c048614c29aaafc.json | 1 + ...tore-9e5f517f97f91e55a8c34695c20cf08f.json | 1 + ...tore-9f86fa820e9fe16e1b2acba9bd5ea1df.json | 1 + ...tore-9fc0886cdfbc8148f6c87f4be64d39cb.json | 1 + ...tore-9fcf8aa9565636f55fa5b58db2acec9d.json | 1 + ...tore-a1c7fd9f2a3a839efbae3bb259368a36.json | 1 + ...tore-a2b1cd729c26406912f27b96f9b42a63.json | 1 + ...tore-a3edef28539a644dcce547dcfb8618ce.json | 1 + ...tore-a40bfb7aaed68f24c0c77f8251f6cc93.json | 1 + ...tore-a410cb7b25513d5de696c2edab60222e.json | 1 + ...tore-a563fbde30ec53b454886209421786f4.json | 1 + ...tore-a64e6583e36462c2f995ac0719e123c1.json | 1 + ...tore-a749d978085d1a19343e9ef2e01906d0.json | 1 + ...tore-a93254839716a1a78aa72d0d2c436bad.json | 1 + ...tore-a940b4d7ec548d7b13ba82ca3f50a54f.json | 1 + ...tore-aa79913840d590ada89951e5811b2ca4.json | 1 + ...tore-ab10729ae432bc6806b8f9aec80b80fa.json | 1 + ...tore-ab32531e84c1f96f119bc121757ce267.json | 1 + ...tore-b25e501e373f5af2184e3848f895b33d.json | 1 + ...tore-b300efacc5c8bad6009cea0638f8580e.json | 1 + ...tore-b3ffb1fd6badd0f83fb6dffe9217e372.json | 1 + ...tore-b65d68433ee0fc259ad6ce888d901f33.json | 1 + ...tore-b7e41a04d04ac13b5a9c6c8861b8d11a.json | 1 + ...tore-ba6ca7f27f0d72cdd8c54b4f555f31f1.json | 1 + ...tore-bbc05335acd004cce5258beedef0dd00.json | 1 + ...tore-bbe13e974d5ee3d14e72aef622ecee47.json | 1 + ...tore-bc1dade7eb3711769ba8bdd2da853f34.json | 1 + ...tore-bee30d4ed0ab5e78080d24e5c193d58f.json | 1 + ...tore-c38821458db3f7ea1dc608d769784f70.json | 1 + ...tore-c38955e72fcba00329def8d75a8530d5.json | 1 + ...tore-c3aca1602f527e43d4c80728e4432b73.json | 1 + ...tore-c4b7da4be44fb94a3e299eb2d7b5e869.json | 1 + ...tore-c4d657a394d00a7bba2c191b6572ea9c.json | 1 + ...tore-c5964f96ac27ef706978573c962d5b28.json | 1 + ...tore-c73955a38b6ba81c00ac6fab3fe402fc.json | 1 + ...tore-c77e6b93ef93afe695da165a4bea7d70.json | 1 + ...tore-c799fa361d4435d2813d74ae9e90955b.json | 1 + ...tore-c955cdaffbf2e74516b25ffb6dd5f47c.json | 1 + ...tore-cc35f6439ecf46b8ca62e054cbe9f9bb.json | 1 + ...tore-ccb8fd4d70cc7606904ce728015a8c91.json | 1 + ...tore-cd1a389ab235a607ffce55177cad7015.json | 1 + ...tore-cd1ed76bbd7e068062d29b89fb5e2406.json | 1 + ...tore-ced8a65b2547dc4ecd07eb7e553cf209.json | 1 + ...tore-cfd4225219eb57ca4e1b297ced12d60e.json | 1 + ...tore-d0206f0c19b6e19f320bdee5a8aabc4e.json | 1 + ...tore-d1b5c8a2fe19315f0574266d275505c1.json | 1 + ...tore-d32158d46c75b3c16cf387d06c3bde0f.json | 1 + ...tore-d47347e3e7b72f57e523655de5c24457.json | 1 + ...tore-d66eaf1ed8c4b7320e3f11eb5c756df5.json | 1 + ...tore-d704f79611bc66f6e420fea792eb973e.json | 1 + ...tore-d8b82ea2d5e9b8cf0ed2fb0b9c4d110c.json | 1 + ...tore-d9b8ce7d728e6c46d9674a9b92a1d571.json | 1 + ...tore-da47700eed50f4e18f76c4c755dd4382.json | 1 + ...tore-de28827b10baa5522f7d3b4720bde0a1.json | 1 + ...tore-deed356d84abb4c8a335e584506101f0.json | 1 + ...tore-dfd0afb8c5df2e9c84e86ae949dcc032.json | 1 + ...tore-e25228a50d456a7313b86cd103dbc0a3.json | 1 + ...tore-e3033b62c546c2e4d949a920bdc38728.json | 1 + ...tore-e718c442bc0a9e7c49a5993824e7f563.json | 1 + ...tore-e73d84b99c51e5e80c2727e4ec78d056.json | 1 + ...tore-e7eb20663aa447727162e1101ea1f493.json | 1 + ...tore-e83281e8c42e1a99e1e05084c8e3ff68.json | 1 + ...tore-e8eb02eb31fcf60a834e7ed5accb056c.json | 1 + ...tore-e9705a7a27256a83004607546e6c6337.json | 1 + ...tore-ebdd53108c5131930180839be05a208e.json | 1 + ...tore-ec24df1a40ad5096bda4a0fcebe5d19e.json | 1 + ...tore-ec40168b8fd40a8eb0f724b4c6cc08fa.json | 1 + ...tore-ecc80478ddecaf48c545ae511c42e960.json | 1 + ...tore-ece0ffec1c1dfb0744cec61b378aaa16.json | 1 + ...tore-ed442c06a5509cb228b891acd55be845.json | 1 + ...tore-eee18940f5863ac20b7a103ca35928ab.json | 1 + ...tore-ef7ccd85b3ec1f14596b805cbe5e96e8.json | 1 + ...tore-f1264c7d1daf7d4f2e5351beb90ee03a.json | 1 + ...tore-f2d24116339a81f3f59eba9270293ca5.json | 1 + ...tore-f2f2a41a6fd95fe72661e97b4dc2d38b.json | 1 + ...tore-f3276b7a1880bd6c95fbacf8dcddffc4.json | 1 + ...tore-f49c90b62ca7a5bfa69c247e96c3c257.json | 1 + ...tore-f4e0a51bcdcafcf7296a50dce16b3ffc.json | 1 + ...tore-f511d4e6b40f6576d3ec7af00a09f74c.json | 1 + ...tore-f56a9867ceea0134353f09a149a75268.json | 1 + ...tore-f79514e482d3378c47b031e0941fd1ef.json | 1 + ...tore-f96905d8fb403d6ef6bc75ddfe2a2530.json | 1 + ...tore-fab4139b88733bad72b839d16451f95d.json | 1 + ...tore-fd2bca5948303a0e809d0df23a488374.json | 1 + ...tore-febbefc413098db85509b541775a63c8.json | 1 + ...tore-fec66b01cb65f13e4b4c6eb2a4fc30fd.json | 1 + ...tore-ff41dccc0b6b6515c7eaee05ba741dcc.json | 1 + .../e92f8988d65cf25c087d226e6c0ef06f.js | 4 + .../commonjs/api-runner-browser-plugins.js | 15 + docs/.cache/commonjs/api-runner-browser.js | 67 ++ docs/.cache/commonjs/api-runner-ssr.js | 46 ++ docs/.cache/commonjs/api-ssr-docs.js | 200 ++++++ docs/.cache/commonjs/app.js | 118 ++++ docs/.cache/commonjs/create-react-context.js | 29 + docs/.cache/commonjs/default-html.js | 57 ++ docs/.cache/commonjs/dev-loader.js | 51 ++ docs/.cache/commonjs/develop-static-entry.js | 152 +++++ docs/.cache/commonjs/emitter.js | 14 + docs/.cache/commonjs/ensure-resources.js | 116 ++++ docs/.cache/commonjs/error-overlay-handler.js | 91 +++ docs/.cache/commonjs/find-path.js | 130 ++++ docs/.cache/commonjs/gatsby-browser-entry.js | 150 +++++ docs/.cache/commonjs/loader.js | 562 +++++++++++++++++ docs/.cache/commonjs/navigation.js | 312 ++++++++++ docs/.cache/commonjs/normalize-page-path.js | 22 + docs/.cache/commonjs/page-renderer.js | 68 +++ docs/.cache/commonjs/polyfill-entry.js | 7 + docs/.cache/commonjs/polyfills/fetch.js | 3 + docs/.cache/commonjs/polyfills/no-op.js | 2 + .../commonjs/polyfills/object-assign.js | 3 + .../.cache/commonjs/polyfills/whatwg-fetch.js | 5 + docs/.cache/commonjs/prefetch.js | 82 +++ docs/.cache/commonjs/production-app.js | 243 ++++++++ .../commonjs/public-page-renderer-dev.js | 38 ++ .../commonjs/public-page-renderer-prod.js | 40 ++ docs/.cache/commonjs/public-page-renderer.js | 11 + docs/.cache/commonjs/query-result-store.js | 152 +++++ .../commonjs/react-lifecycles-compat.js | 3 + .../commonjs/register-service-worker.js | 73 +++ docs/.cache/commonjs/root.js | 199 ++++++ docs/.cache/commonjs/route-announcer-props.js | 23 + docs/.cache/commonjs/socketIo.js | 138 +++++ docs/.cache/commonjs/static-entry.js | 535 ++++++++++++++++ docs/.cache/commonjs/strip-prefix.js | 24 + docs/.cache/create-react-context.js | 26 + docs/.cache/default-html.js | 36 ++ docs/.cache/dev-404-page.js | 183 ++++++ docs/.cache/dev-loader.js | 45 ++ docs/.cache/develop-static-entry.js | 120 ++++ docs/.cache/emitter.js | 4 + docs/.cache/ensure-resources.js | 89 +++ docs/.cache/error-overlay-handler.js | 77 +++ docs/.cache/find-path.js | 109 ++++ docs/.cache/gatsby-browser-entry.js | 119 ++++ docs/.cache/json/_.json | 1 + docs/.cache/json/_advanced.json | 1 + docs/.cache/json/_advanced_permlevels.json | 1 + docs/.cache/json/_dev-404-page.json | 1 + docs/.cache/json/_djs.json | 1 + docs/.cache/json/_faq.json | 1 + docs/.cache/json/_gettingstarted.json | 1 + docs/.cache/json/_guides.json | 1 + docs/.cache/json/_introduction.json | 1 + docs/.cache/json/_stepbystep.json | 1 + docs/.cache/json/_stepbystep_1createbot.json | 1 + .../.cache/json/_stepbystep_1creatingbot.json | 1 + .../json/_stepbystep_2createcommand.json | 1 + docs/.cache/json/_stepbystep_createbot.json | 1 + .../json/_stepbystep_createcommand.json | 1 + docs/.cache/json/_stepbystep_createevent.json | 1 + .../json/_stepbystep_createinhibitor.json | 1 + .../json/_stepbystep_createlanguage.json | 1 + .../json/_stepbystep_createmonitor.json | 1 + docs/.cache/json/_stepbystep_creatingbot.json | 1 + docs/.cache/loader.js | 538 ++++++++++++++++ docs/.cache/match-paths.json | 1 + docs/.cache/navigation.js | 241 ++++++++ docs/.cache/normalize-page-path.js | 12 + docs/.cache/page-renderer.js | 45 ++ docs/.cache/pages.json | 1 + docs/.cache/polyfill-entry.js | 5 + docs/.cache/polyfills/fetch.js | 1 + docs/.cache/polyfills/no-op.js | 1 + docs/.cache/polyfills/object-assign.js | 1 + docs/.cache/polyfills/whatwg-fetch.js | 3 + docs/.cache/prefetch.js | 79 +++ docs/.cache/production-app.js | 189 ++++++ docs/.cache/public-page-renderer-dev.js | 21 + docs/.cache/public-page-renderer-prod.js | 25 + docs/.cache/public-page-renderer.js | 9 + docs/.cache/query-result-store.js | 126 ++++ docs/.cache/react-lifecycles-compat.js | 1 + docs/.cache/redirects.json | 1 + docs/.cache/redux/redux.node.state_0 | Bin 0 -> 474075 bytes docs/.cache/redux/redux.rest.state | Bin 0 -> 8343 bytes docs/.cache/register-service-worker.js | 64 ++ docs/.cache/root.js | 138 +++++ docs/.cache/route-announcer-props.js | 18 + docs/.cache/socketIo.js | 110 ++++ docs/.cache/static-entry.js | 510 ++++++++++++++++ docs/.cache/strip-prefix.js | 20 + docs/.cache/sync-requires.js | 11 + docs/.cache/test-require-error.js | 28 + docs/.cache/tmp-39165-wIHd6P6zOgYA | 5 + docs/.cache/tmp-39283-UfvkCdDYslW4 | 5 + docs/.cache/tmp-39368-omySHTTPbhvw | 5 + docs/.cache/tmp-39444-tITwPsAv5R5h | 5 + docs/.cache/tmp-39637-p0s0K7WdRpbt | 5 + docs/.cache/tmp-39722-wH4V4Bz84j6s | 5 + docs/.cache/tmp-39780-4bqlWhbtqVNM | 5 + docs/.cache/tmp-40678-TjhDvbQHy4Di | 5 + docs/.cache/tmp-43228-fRwYdGv04XkY | 5 + docs/.cache/tmp-43441-BMt4qrXkoW6r | 5 + docs/.cache/tmp-44535-jH2nY3Rdm4iE | 5 + docs/.cache/tmp-44965-jpyUYhJhbKzt | 5 + docs/.cache/tmp-52835-NtlQMERbyqRy | 5 + .../068af3a852170bfd99dcccc4d6e85a16.json.gz | Bin 0 -> 3184 bytes .../08ae15b587e892d805200792e61c0eb4.json.gz | Bin 0 -> 1070 bytes .../09669c11b5c8d119f993ac5b79114a0f.json.gz | Bin 0 -> 4328 bytes .../0a7754cc5652f75394aa47c969649dc1.json.gz | Bin 0 -> 2213 bytes .../0b88f0a846f7d4fc6cc22f306c39827a.json.gz | Bin 0 -> 372 bytes .../0b944228a50306f3ab7de22297d984df.json.gz | Bin 0 -> 2553 bytes .../0bb9429819cb6a56cf143532a703f4b2.json.gz | Bin 0 -> 2317 bytes .../0ca2190d92db08ad331212611f1b158c.json.gz | Bin 0 -> 1159 bytes .../0ddffaa9c1a10fe536c28c91c2b22c35.json.gz | Bin 0 -> 544 bytes .../0fa362415414f55e1ab9528ff4c29f82.json.gz | Bin 0 -> 746 bytes .../10d6e3fcb2d9ea2d122cc4e5d3ae2ce8.json.gz | Bin 0 -> 953 bytes .../11cc430654ea646348e5088ae852f3e7.json.gz | Bin 0 -> 2269 bytes .../12fee89ec9f93d28ce0a2ab2bb4f484f.json.gz | Bin 0 -> 3326 bytes .../1342b2a4ae12d4b9d57de9b83d78c33a.json.gz | Bin 0 -> 14160 bytes .../13476374e084409f3a3cfe38dcc3ea29.json.gz | Bin 0 -> 287 bytes .../17a7ed203f22a8e23b470db6966ae3a3.json.gz | Bin 0 -> 2891 bytes .../17eb525c2c51729e3bb8d830d4aa005a.json.gz | Bin 0 -> 3432 bytes .../18308bcf898b172aea8d3dff209a0f3b.json.gz | Bin 0 -> 4134 bytes .../1854ea6e01d5c829793f56b76587ed0f.json.gz | Bin 0 -> 554 bytes .../1aa315fb5d9573e4c807b21194bd7779.json.gz | Bin 0 -> 648 bytes .../1aebf84004c1cafc191cf356cf2f48ca.json.gz | Bin 0 -> 5133 bytes .../1c9ee0743276cda604be4e1cd582f990.json.gz | Bin 0 -> 411 bytes .../1deded483542317276ed1562febd5716.json.gz | Bin 0 -> 514 bytes .../1ee45c7720106ce0760b79c81a53d025.json.gz | Bin 0 -> 411 bytes .../22ac74ced9b6ed20fc04d183db2402df.json.gz | Bin 0 -> 932 bytes .../23257725b785800c94b2656d9c183004.json.gz | Bin 0 -> 2946 bytes .../273ecfbd308172f6c3ea1ff4ee7b1e4c.json.gz | Bin 0 -> 1362 bytes .../2914d7aa85a7cae254ef7eac41a6a67b.json.gz | Bin 0 -> 2299 bytes .../2a3e09a23645f62e010c83c767ffbda5.json.gz | Bin 0 -> 942 bytes .../2c59b4ea626ca3e9341ef7351c7a2ce5.json.gz | Bin 0 -> 1057 bytes .../32482cf97f0042e13b2eb9c7b46b8bf3.json.gz | Bin 0 -> 987 bytes .../33c8624ce362b3cea926b0154ca87be0.json.gz | Bin 0 -> 382 bytes .../34ecbc79f413526378509c714eebab94.json.gz | Bin 0 -> 975 bytes .../3625b0102a148dd7b3e8165023f6745b.json.gz | Bin 0 -> 2295 bytes .../362b179334dcee0fdfa984edfa300bee.json.gz | Bin 0 -> 7514 bytes .../379bc1e7737b75f11dbf377269b6fb08.json.gz | Bin 0 -> 422 bytes .../38a15c94187e30a8b49aa1f58ebeaf9e.json.gz | Bin 0 -> 674 bytes .../397e07581a3701278e114a9f83100df4.json.gz | Bin 0 -> 3254 bytes .../3cdf3f066ad032993a687cad17efe876.json.gz | Bin 0 -> 2576 bytes .../3cf60e7ffcbdd29dd477db212b9a505e.json.gz | Bin 0 -> 973 bytes .../3d6f8853e968fc4d781205bb2ebf1f1f.json.gz | Bin 0 -> 486 bytes .../3e65c2e1cff808b6413c9275b62b3d9a.json.gz | Bin 0 -> 821 bytes .../3f15baf601f13e40b97d83a64efd87da.json.gz | Bin 0 -> 1855 bytes .../3f59f67bb56b63ecfe82e0c9dc48bf6a.json.gz | Bin 0 -> 2590 bytes .../3f9a8f13d0b5e669794ee4fa1e8ac360.json.gz | Bin 0 -> 284 bytes .../40e2fdaa791942ee47b65d78cce36a80.json.gz | Bin 0 -> 527 bytes .../42aee1f09ae4b9bf753be4462b00af92.json.gz | Bin 0 -> 3658 bytes .../441c43ce1639a9356fb33141782a8f7c.json.gz | Bin 0 -> 4226 bytes .../4774e144e9eb07a1b74fba721eb9b4cb.json.gz | Bin 0 -> 8016 bytes .../48c7547d4b6d7f83af7c29cb4086f4e2.json.gz | Bin 0 -> 2554 bytes .../49ce5d60e0c38ab13fd3083be80f59ac.json.gz | Bin 0 -> 373 bytes .../4dc6f190a9be54be44a21ecdeb65609a.json.gz | Bin 0 -> 1040 bytes .../4e935a4be99c270a9a0583c777374845.json.gz | Bin 0 -> 621 bytes .../525ec8888c90a216b7bd82bee0a223f2.json.gz | Bin 0 -> 303 bytes .../53d464d00fea543dfb892749f5ca96ca.json.gz | Bin 0 -> 293 bytes .../56cd3fd9b70289ea693be4a0d4922fbc.json.gz | Bin 0 -> 1974 bytes .../5748d953e500875d66920c2ac45eec20.json.gz | Bin 0 -> 1090 bytes .../58a944ba849de2bd449c07baf5050f62.json.gz | Bin 0 -> 473 bytes .../5a91aae3cc08e68fd4b74f3c4ea9cadf.json.gz | Bin 0 -> 2558 bytes .../5b2b393bc71f2b8cd9c87f5e6053988d.json.gz | Bin 0 -> 1998 bytes .../5e2660ab398f2f0dccdb754b76779df8.json.gz | Bin 0 -> 5028 bytes .../5e7915239069057e0caec3d4e2e11608.json.gz | Bin 0 -> 4456 bytes .../5f4a15a1afc5c8e1b17237eb7f4fe388.json.gz | Bin 0 -> 7024 bytes .../64e755669e176d01d90bcb344dc5877b.json.gz | Bin 0 -> 514 bytes .../64ee76ddc6d3a51516a1ce5c3fdb4a3a.json.gz | Bin 0 -> 2855 bytes .../66c97fca3924d4197d8c98cea3c94000.json.gz | Bin 0 -> 3603 bytes .../66ef46a7836c2aae7aba6de03783c103.json.gz | Bin 0 -> 5731 bytes .../68bd272d4f95c2d10c00b46281bfdc62.json.gz | Bin 0 -> 14722 bytes .../69841d6ed8c44948240f9619f0edefa6.json.gz | Bin 0 -> 926 bytes .../69cf51bcab94fba63863daa9409b3268.json.gz | Bin 0 -> 808 bytes .../69f39ec1c05a2e997ab71b7d2f463a0c.json.gz | Bin 0 -> 648 bytes .../6a3872b69adb5e5591585e8738e5386c.json.gz | Bin 0 -> 2339 bytes .../6ba322c74f6c21064af40372361b5273.json.gz | Bin 0 -> 3817 bytes .../6c2870ebd30b96a85ecf6a3f2d20f163.json.gz | Bin 0 -> 3793 bytes .../7035de3726ddf0586f69e6138a38379e.json.gz | Bin 0 -> 2488 bytes .../729a00395b91115723fd55bf72f9a46e.json.gz | Bin 0 -> 774 bytes .../738ae9e3349ef7789d268c67b2145b45.json.gz | Bin 0 -> 2546 bytes .../75855cd92eb276bb9e9a1a54d97a469e.json.gz | Bin 0 -> 2452 bytes .../782d5e355e7288ecb57727694f188b38.json.gz | Bin 0 -> 1854 bytes .../7aab8b2886e38eb40bf45b25e0427d54.json.gz | Bin 0 -> 3225 bytes .../7c4d38363fe51b470ccf163a598d2390.json.gz | Bin 0 -> 2509 bytes .../7ebc0398b3688dddcc5da2982c98d06f.json.gz | Bin 0 -> 497 bytes .../8013323a92a9acd486e40d83adc12afe.json.gz | Bin 0 -> 8248 bytes .../80b274dad51f0d07e51c4be0ad747b20.json.gz | Bin 0 -> 2371 bytes .../851c31ed36990e5cc567a22588ea9f3a.json.gz | Bin 0 -> 3887 bytes .../867ac4fbb9961c50423c96bf17496b3a.json.gz | Bin 0 -> 2155 bytes .../86f74eac431115a7d2fe05e351e27546.json.gz | Bin 0 -> 2241 bytes .../873066abc34c0ea15a9728adb6ec4fc1.json.gz | Bin 0 -> 397 bytes .../87945434f74c096923589ab546f6a5e3.json.gz | Bin 0 -> 306 bytes .../8c67ab7b81655ff94508c52438034782.json.gz | Bin 0 -> 2329 bytes .../8cd31ad91d9ded33a6971a0a35656acc.json.gz | Bin 0 -> 5478 bytes .../8cece618dd1463a46919c5b2b0d5de90.json.gz | Bin 0 -> 302 bytes .../8d043b0b1baf2e0863b71b5aa976f60e.json.gz | Bin 0 -> 8574 bytes .../8eb57e3e579f03187e92f7e783b6cb97.json.gz | Bin 0 -> 1891 bytes .../8f653add1448fc78a580b580b67038d6.json.gz | Bin 0 -> 920 bytes .../8f7a30ac416aa041ebfd36463f63fb8e.json.gz | Bin 0 -> 8446 bytes .../920e16ce56a1488ff54f49d3eb68b596.json.gz | Bin 0 -> 1464 bytes .../9272f7170f02cb015f80c00f5cfcb3f8.json.gz | Bin 0 -> 1016 bytes .../92bd654c0d43f9f680564781f0f2e75e.json.gz | Bin 0 -> 749 bytes .../933e74c90f43824c79ec813e75f0aef2.json.gz | Bin 0 -> 1950 bytes .../93a6ac1f5e1eb732d88fb931e2d3ad07.json.gz | Bin 0 -> 9093 bytes .../94dbeaefa9a50232f808a4ef70a4812a.json.gz | Bin 0 -> 3173 bytes .../960e798d4c77d7dc57dba47f7a7e99d4.json.gz | Bin 0 -> 776 bytes .../9c7726d8b9e23a308f573654f6546ed4.json.gz | Bin 0 -> 1048 bytes .../9e4541500a37b03d79777b8a6d005a1d.json.gz | Bin 0 -> 1135 bytes .../9fc139d910147ba2513dcd544e5cb887.json.gz | Bin 0 -> 347 bytes .../a0173a1ee9784059caf7d7e37274434e.json.gz | Bin 0 -> 2545 bytes .../a14bafb40338b61d3562df728c1af9f9.json.gz | Bin 0 -> 333 bytes .../a1c5e3b431395242c7f62bf5cd46ef19.json.gz | Bin 0 -> 587 bytes .../a26c76b39c1e102609fe02a4d90744ae.json.gz | Bin 0 -> 13700 bytes .../a5c4a732c0e7be5149542eee72069cad.json.gz | Bin 0 -> 1159 bytes .../a5fd862e3f55e9dad9b4fe4737f661d9.json.gz | Bin 0 -> 725 bytes .../a82af9a7939ffc63e04e1eaaafd7a317.json.gz | Bin 0 -> 774 bytes .../a95b29d3ddd9944eb7827a9b35f9aa7c.json.gz | Bin 0 -> 3096 bytes .../a9a0d6fb1adb6e18be21287392116b71.json.gz | Bin 0 -> 482 bytes .../ab36e3e42759d5e44aa14d80b15a1809.json.gz | Bin 0 -> 614 bytes .../add0089f1950e78448b53e3357f14e2d.json.gz | Bin 0 -> 719 bytes .../af9e180507f9bce0f1dc0d0cbddb9446.json.gz | Bin 0 -> 3471 bytes .../b0404edddfc524431922e7288ab5f445.json.gz | Bin 0 -> 4986 bytes .../b0805a7ccb35aad0a930bc1fa8d73b9d.json.gz | Bin 0 -> 2550 bytes .../b4e9f6bfbb7e6d93640512a386a92efd.json.gz | Bin 0 -> 3006 bytes .../b726e994b81f85cef97b440ff6bdc057.json.gz | Bin 0 -> 641 bytes .../bb8fa37b0084a477b51d238ee8256f88.json.gz | Bin 0 -> 4747 bytes .../be584a53d9afb283027d2f34b2ff8055.json.gz | Bin 0 -> 1153 bytes .../bf9eb34ce3b611c51716a12680e3ed63.json.gz | Bin 0 -> 3468 bytes .../c2e27ab5b588a94044ebda0339544065.json.gz | Bin 0 -> 9156 bytes .../c49121bfd66a37a5f0f097c912bf62bd.json.gz | Bin 0 -> 950 bytes .../c5180750d6185f9f6f3f6d002c5de383.json.gz | Bin 0 -> 446 bytes .../c5b1a1122ba371ca71457ad025c31b4f.json.gz | Bin 0 -> 3553 bytes .../c749d9c14eade04baa5c390686b48bbc.json.gz | Bin 0 -> 526 bytes .../c7f2d84face60b8a63055237884c0e82.json.gz | Bin 0 -> 1274 bytes .../c8367503762000031458a98332692bb2.json.gz | Bin 0 -> 2118 bytes .../c887afbc639ae1478c1722a2aa2455fc.json.gz | Bin 0 -> 815 bytes .../cdf275ce653becae1c5fd676436fef60.json.gz | Bin 0 -> 2553 bytes .../ce841c9b90bc8924ddd4796874519bf8.json.gz | Bin 0 -> 2212 bytes .../d16d39e541d1be06c443a053a1ee404a.json.gz | Bin 0 -> 776 bytes .../d277908b3596943b6897ca63621b588c.json.gz | Bin 0 -> 1989 bytes .../d29b6018df500c7b464985c296f5c79c.json.gz | Bin 0 -> 3565 bytes .../d338761435232880e5cdea0409c37954.json.gz | Bin 0 -> 2544 bytes .../d470373612d7fa8d290077c01ef77177.json.gz | Bin 0 -> 2339 bytes .../d8440a1dacdb1717f4965db0a171e3fb.json.gz | Bin 0 -> 6138 bytes .../d9b70db7e46b0f74d03d72b73aa968de.json.gz | Bin 0 -> 1902 bytes .../d9c3f798fb45467fef5ee758d72f4ef2.json.gz | Bin 0 -> 2553 bytes .../da317528b4835c13fd335a52612cc03d.json.gz | Bin 0 -> 7746 bytes .../da6dd1034327269d3d7937455a5ddbd6.json.gz | Bin 0 -> 2555 bytes .../dadb5538f493a9378c9562aaf01e3baf.json.gz | Bin 0 -> 294 bytes .../de76b23b2122bdec8bfd3f2020734f32.json.gz | Bin 0 -> 284 bytes .../e02fb32ac4dd653192a9d1ecbac92cae.json.gz | Bin 0 -> 3232 bytes .../e14b6c5c18a45a39265b239c7337425f.json.gz | Bin 0 -> 1050 bytes .../e52c2ba414144fc99a6f18b0957a9a0b.json.gz | Bin 0 -> 3986 bytes .../e5b6b5ba34bf9596c1c61dec06a53cc7.json.gz | Bin 0 -> 1836 bytes .../eba6fa1564c8f99b480f5d1beba0f6f2.json.gz | Bin 0 -> 2514 bytes .../ed7c8339291954ba7b9a1f0659bbb63d.json.gz | Bin 0 -> 783 bytes .../ed98daff7c4ab0176e8fb029d8ff469e.json.gz | Bin 0 -> 330 bytes .../f052f6484ddf7350dc151127a5f3cceb.json.gz | Bin 0 -> 2530 bytes .../f0a72b7458dbf6d23ee0d16421feff7b.json.gz | Bin 0 -> 13975 bytes .../f29d2968c56e7208b5d9a1bb6eca82b6.json.gz | Bin 0 -> 3447 bytes .../f36dbb60f42fc089ebd38393f8ed1070.json.gz | Bin 0 -> 691 bytes .../f52ffaccfde6d2400f9ac7f99d543d75.json.gz | Bin 0 -> 2369 bytes .../f5d762b45b71660428691e1c2803ebdf.json.gz | Bin 0 -> 1995 bytes .../f849c28cceca773abd027cb001f8e8a5.json.gz | Bin 0 -> 2797 bytes .../f96d1ede3a5dccf345bac85cb0dac8c4.json.gz | Bin 0 -> 603 bytes .../f99281532f57bd23b84270275e9fca5f.json.gz | Bin 0 -> 3374 bytes .../f9f917a3f70cecfb0fda76c5b898a226.json.gz | Bin 0 -> 2908 bytes .../fb8b6187af5f21b22d2591c566a73a83.json.gz | Bin 0 -> 638 bytes .../fc1f09dd9497ddee8aed0f54c48e6e05.json.gz | Bin 0 -> 2546 bytes .../ffc221bc99cd672547b5292fe43096c3.json.gz | Bin 0 -> 5090 bytes docs/public/index.html | 10 + docs/public/page-data/advanced/page-data.json | 1 + .../advanced/permlevels/page-data.json | 1 + .../page-data/dev-404-page/page-data.json | 1 + docs/public/page-data/djs/page-data.json | 1 + docs/public/page-data/faq/page-data.json | 1 + .../page-data/gettingstarted/page-data.json | 1 + docs/public/page-data/guides/page-data.json | 1 + docs/public/page-data/index/page-data.json | 1 + .../page-data/introduction/page-data.json | 1 + .../stepbystep/1createbot/page-data.json | 1 + .../stepbystep/1creatingbot/page-data.json | 1 + .../stepbystep/2createcommand/page-data.json | 1 + .../stepbystep/createbot/page-data.json | 1 + .../stepbystep/createcommand/page-data.json | 1 + .../stepbystep/createevent/page-data.json | 1 + .../stepbystep/createinhibitor/page-data.json | 1 + .../stepbystep/createlanguage/page-data.json | 1 + .../stepbystep/createmonitor/page-data.json | 1 + .../stepbystep/creatingbot/page-data.json | 1 + .../page-data/stepbystep/page-data.json | 1 + docs/public/static/d/2619113677.json | 1 + docs/public/static/d/3706406642.json | 1 + docs/public/static/d/417421954.json | 1 + src/controllers/misc.ts | 4 +- src/handlers/channel.ts | 4 +- src/structures/member.ts | 38 +- src/utils/permissions.ts | 1 - 541 files changed, 9640 insertions(+), 40 deletions(-) create mode 100644 docs/.cache/.eslintrc.json create mode 100644 docs/.cache/__tests__/.babelrc create mode 100644 docs/.cache/__tests__/__snapshots__/dev-loader.js.snap create mode 100644 docs/.cache/__tests__/__snapshots__/loader.js.snap create mode 100644 docs/.cache/__tests__/__snapshots__/static-entry.js.snap create mode 100644 docs/.cache/__tests__/dev-loader.js create mode 100644 docs/.cache/__tests__/ensure-resources.tsx create mode 100644 docs/.cache/__tests__/error-overlay-handler.js create mode 100644 docs/.cache/__tests__/find-path.js create mode 100644 docs/.cache/__tests__/loader.js create mode 100644 docs/.cache/__tests__/minimal-config.js create mode 100644 docs/.cache/__tests__/public-page-renderer-dev.tsx create mode 100644 docs/.cache/__tests__/public-page-renderer-prod.tsx create mode 100644 docs/.cache/__tests__/static-entry.js create mode 100644 docs/.cache/__tests__/strip-prefix.js create mode 100644 docs/.cache/api-runner-browser-plugins.js create mode 100644 docs/.cache/api-runner-browser.js create mode 100644 docs/.cache/api-runner-ssr.js create mode 100644 docs/.cache/api-ssr-docs.js create mode 100644 docs/.cache/app.js create mode 100644 docs/.cache/async-requires.js create mode 100644 docs/.cache/babelState.json create mode 100644 docs/.cache/caches/gatsby-plugin-mdx/diskstore-0185e0f001d1a2df3cc96621404f18fd.json create mode 100644 docs/.cache/caches/gatsby-plugin-mdx/diskstore-02c8c8bda13d33f5c814ad5d52c1605e.json create mode 100644 docs/.cache/caches/gatsby-plugin-mdx/diskstore-03663d6a4f438a7d626759e765a1add7.json create mode 100644 docs/.cache/caches/gatsby-plugin-mdx/diskstore-04a38d73a68fa1e804319439011e11d9.json create mode 100644 docs/.cache/caches/gatsby-plugin-mdx/diskstore-04ffaeb7e60f7c69f2be2d9c62d27c89.json create mode 100644 docs/.cache/caches/gatsby-plugin-mdx/diskstore-05230a4939f290a6033bbfc09ea1b935.json create mode 100644 docs/.cache/caches/gatsby-plugin-mdx/diskstore-05e987acc3d5e7b9d000f7bfe7b62105.json create mode 100644 docs/.cache/caches/gatsby-plugin-mdx/diskstore-0aedfa9d0d75212ceecd48a3b46b7a7b.json create mode 100644 docs/.cache/caches/gatsby-plugin-mdx/diskstore-0b81b8775aeaa953c65a46009331eb99.json create mode 100644 docs/.cache/caches/gatsby-plugin-mdx/diskstore-0d2c17f1488867f2dffe5b55ad3a4316.json create mode 100644 docs/.cache/caches/gatsby-plugin-mdx/diskstore-0eee710e93678baeabe4b3aba4bbf5f7.json create mode 100644 docs/.cache/caches/gatsby-plugin-mdx/diskstore-0fb27743948f516aa90e985c5052f9ae.json create mode 100644 docs/.cache/caches/gatsby-plugin-mdx/diskstore-113a31d4b6cbf7e91d13a23bcc388165.json create mode 100644 docs/.cache/caches/gatsby-plugin-mdx/diskstore-149d68ad6d5c452536cd7471bcda8a26.json create mode 100644 docs/.cache/caches/gatsby-plugin-mdx/diskstore-197303de8e8c05c6067f92a342669add.json create mode 100644 docs/.cache/caches/gatsby-plugin-mdx/diskstore-1a299f58c275aa4ccca1c63ed73af141.json create mode 100644 docs/.cache/caches/gatsby-plugin-mdx/diskstore-1b75a1da0a207c608314560357c0ffcc.json create mode 100644 docs/.cache/caches/gatsby-plugin-mdx/diskstore-1e05ce69417e6e39cf47210dff5c520a.json create mode 100644 docs/.cache/caches/gatsby-plugin-mdx/diskstore-1ecfdc79509821bb67ad0139242eb020.json create mode 100644 docs/.cache/caches/gatsby-plugin-mdx/diskstore-20b82ce0c38da297167503a0689e79eb.json create mode 100644 docs/.cache/caches/gatsby-plugin-mdx/diskstore-2133e165ca6c909f24ebf19b6ab5a6c6.json create mode 100644 docs/.cache/caches/gatsby-plugin-mdx/diskstore-215396216730f0a74d19163a8b790ed5.json create mode 100644 docs/.cache/caches/gatsby-plugin-mdx/diskstore-22903bb47406f19dea194b0bdca29de3.json create mode 100644 docs/.cache/caches/gatsby-plugin-mdx/diskstore-24ad22243e43177255b836d98838e179.json create mode 100644 docs/.cache/caches/gatsby-plugin-mdx/diskstore-255969f006670bdb650251db3cb562ab.json create mode 100644 docs/.cache/caches/gatsby-plugin-mdx/diskstore-26431506f956ca87374159b7b0df7424.json create mode 100644 docs/.cache/caches/gatsby-plugin-mdx/diskstore-26b8b6c7688485c8887043a9ad28fae4.json create mode 100644 docs/.cache/caches/gatsby-plugin-mdx/diskstore-279e940a043d93d0cc4ef6f739569883.json create mode 100644 docs/.cache/caches/gatsby-plugin-mdx/diskstore-2bbdee6f6981626b803c1a89697d92a7.json create mode 100644 docs/.cache/caches/gatsby-plugin-mdx/diskstore-2d0cc7b68095d91c7a5e7020fec9ede1.json create mode 100644 docs/.cache/caches/gatsby-plugin-mdx/diskstore-2d893a36201ea8c27ca177dd70cc50dc.json create mode 100644 docs/.cache/caches/gatsby-plugin-mdx/diskstore-2e96b20f1fe2f4a29580a271de978a28.json create mode 100644 docs/.cache/caches/gatsby-plugin-mdx/diskstore-2ed4a8660238fa0843129437135cce8b.json create mode 100644 docs/.cache/caches/gatsby-plugin-mdx/diskstore-2f6d2f3521d2b2827e6ecd2246216688.json create mode 100644 docs/.cache/caches/gatsby-plugin-mdx/diskstore-2fb375a5daaca3d922669166e80f5896.json create mode 100644 docs/.cache/caches/gatsby-plugin-mdx/diskstore-2feed06b5c382f85fd8ac516d633ae39.json create mode 100644 docs/.cache/caches/gatsby-plugin-mdx/diskstore-32eb83ed38d07ed1c91b8e08f1fba466.json create mode 100644 docs/.cache/caches/gatsby-plugin-mdx/diskstore-3425a0648a8d54d9f46f9da3c263ab0b.json create mode 100644 docs/.cache/caches/gatsby-plugin-mdx/diskstore-34a4acfe01a0275e6326e6ce53ae75ee.json create mode 100644 docs/.cache/caches/gatsby-plugin-mdx/diskstore-368eae47c7bcba4b37cede9a8d9e812c.json create mode 100644 docs/.cache/caches/gatsby-plugin-mdx/diskstore-370943155a334bc8c7da62041fe3efea.json create mode 100644 docs/.cache/caches/gatsby-plugin-mdx/diskstore-3aacbad8303a268479a96099b423e2d6.json create mode 100644 docs/.cache/caches/gatsby-plugin-mdx/diskstore-3b07aab8aef58a7b80390ef7ed5a58b4.json create mode 100644 docs/.cache/caches/gatsby-plugin-mdx/diskstore-3de550f11eaca5577c6e46a61102df9e.json create mode 100644 docs/.cache/caches/gatsby-plugin-mdx/diskstore-3fa301ca43ce78de093cd98ece436062.json create mode 100644 docs/.cache/caches/gatsby-plugin-mdx/diskstore-40a9ecfef4111b17d024b3b7155902db.json create mode 100644 docs/.cache/caches/gatsby-plugin-mdx/diskstore-41944ca0837cb3dff1ad035ebcca9173.json create mode 100644 docs/.cache/caches/gatsby-plugin-mdx/diskstore-438d1d4d51c07abf0c56bef8f3061580.json create mode 100644 docs/.cache/caches/gatsby-plugin-mdx/diskstore-45335280506205b267fa24939f66a7a2.json create mode 100644 docs/.cache/caches/gatsby-plugin-mdx/diskstore-46cfa0f805b5feb9157382b2cdd6e3fc.json create mode 100644 docs/.cache/caches/gatsby-plugin-mdx/diskstore-46f228c491807eb72544f4e29d43af57.json create mode 100644 docs/.cache/caches/gatsby-plugin-mdx/diskstore-4849d65f9f719edca85e89f2877d14aa.json create mode 100644 docs/.cache/caches/gatsby-plugin-mdx/diskstore-498145645926159b73b80d18f82ab579.json create mode 100644 docs/.cache/caches/gatsby-plugin-mdx/diskstore-4a201e513228102f84d47e1d65453335.json create mode 100644 docs/.cache/caches/gatsby-plugin-mdx/diskstore-4a78dd7a552cc77c4f55d57f3443877b.json create mode 100644 docs/.cache/caches/gatsby-plugin-mdx/diskstore-4f6d0a38ed5cb1fc487e4b0530ac3758.json create mode 100644 docs/.cache/caches/gatsby-plugin-mdx/diskstore-4f83dd443785eb26ad81572a5b149d6e.json create mode 100644 docs/.cache/caches/gatsby-plugin-mdx/diskstore-4fe774b5ec1ead5bf01db3eb5336e5ed.json create mode 100644 docs/.cache/caches/gatsby-plugin-mdx/diskstore-51ebaae4b3322366598354b14491fd0e.json create mode 100644 docs/.cache/caches/gatsby-plugin-mdx/diskstore-51f081f0d9daa5d3e3b97358c9a0d6e3.json create mode 100644 docs/.cache/caches/gatsby-plugin-mdx/diskstore-5221d7a133e99116b22e656af927fca7.json create mode 100644 docs/.cache/caches/gatsby-plugin-mdx/diskstore-569b61f23c759cc425604a583501cc29.json create mode 100644 docs/.cache/caches/gatsby-plugin-mdx/diskstore-57c268670c7fc0b69e57e50ee08a28cf.json create mode 100644 docs/.cache/caches/gatsby-plugin-mdx/diskstore-5a931acdf6c13efd74cef3e5c64561d5.json create mode 100644 docs/.cache/caches/gatsby-plugin-mdx/diskstore-5b49a3a2037e09b0b767101a0ba9d679.json create mode 100644 docs/.cache/caches/gatsby-plugin-mdx/diskstore-5c9357b248181abfaba7c457c93f8853.json create mode 100644 docs/.cache/caches/gatsby-plugin-mdx/diskstore-5d95dc7df00bb011c165c9390441facf.json create mode 100644 docs/.cache/caches/gatsby-plugin-mdx/diskstore-651a52a02788cae1d13a988a653c5754.json create mode 100644 docs/.cache/caches/gatsby-plugin-mdx/diskstore-67746d58d4cc8a61799ed91117b51303.json create mode 100644 docs/.cache/caches/gatsby-plugin-mdx/diskstore-67a4416f6199e0263e2fdef9ccb769d7.json create mode 100644 docs/.cache/caches/gatsby-plugin-mdx/diskstore-683661f7c6f3bab20ab1dde554c699ac.json create mode 100644 docs/.cache/caches/gatsby-plugin-mdx/diskstore-6ac9865e532d4c06cc6575a815a5cb87.json create mode 100644 docs/.cache/caches/gatsby-plugin-mdx/diskstore-6c4d5c3f58a54075704406c9152c8629.json create mode 100644 docs/.cache/caches/gatsby-plugin-mdx/diskstore-6e802be7b87638c47cf4a3844aee228f.json create mode 100644 docs/.cache/caches/gatsby-plugin-mdx/diskstore-6fc5d5eef37afc0a534ff4ebad37218a.json create mode 100644 docs/.cache/caches/gatsby-plugin-mdx/diskstore-7259aedea45c9b0de34264203207aff4.json create mode 100644 docs/.cache/caches/gatsby-plugin-mdx/diskstore-72787bc26e4f5cc2b39382ec9008f12b.json create mode 100644 docs/.cache/caches/gatsby-plugin-mdx/diskstore-72acad23a065a02f9da956503f5680a8.json create mode 100644 docs/.cache/caches/gatsby-plugin-mdx/diskstore-737e99c52ea631b48b570e12d4afe63a.json create mode 100644 docs/.cache/caches/gatsby-plugin-mdx/diskstore-73e958c154415a617e359a958fdcf8c7.json create mode 100644 docs/.cache/caches/gatsby-plugin-mdx/diskstore-7401ad1aecbbae1ae281022c6350a3bf.json create mode 100644 docs/.cache/caches/gatsby-plugin-mdx/diskstore-74119f2cf2b84308129e13bd0d3a7046.json create mode 100644 docs/.cache/caches/gatsby-plugin-mdx/diskstore-74987a851eaf18ea6eabc2c76c6f8105.json create mode 100644 docs/.cache/caches/gatsby-plugin-mdx/diskstore-75ae9b7a0b3d0d5c86883980f02b94f0.json create mode 100644 docs/.cache/caches/gatsby-plugin-mdx/diskstore-75bea16c14b4f40816dc5cd6013e717d.json create mode 100644 docs/.cache/caches/gatsby-plugin-mdx/diskstore-7624176d8560d4dc695be036bfbeccc9.json create mode 100644 docs/.cache/caches/gatsby-plugin-mdx/diskstore-765afef9bd4e34d3860b1e8f7b06926a.json create mode 100644 docs/.cache/caches/gatsby-plugin-mdx/diskstore-77cd89d184cb3acbc2bb9db50a587b5c.json create mode 100644 docs/.cache/caches/gatsby-plugin-mdx/diskstore-78813b6c296158893ff9a721082fd0e8.json create mode 100644 docs/.cache/caches/gatsby-plugin-mdx/diskstore-7946f359a67ab79556fe70c7ea4b3884.json create mode 100644 docs/.cache/caches/gatsby-plugin-mdx/diskstore-794797195edf61a3b05547501cb7a1d5.json create mode 100644 docs/.cache/caches/gatsby-plugin-mdx/diskstore-7a7059fb75507b5fc793da3f6ea6b0cf.json create mode 100644 docs/.cache/caches/gatsby-plugin-mdx/diskstore-7aa7740504ab81a59de1396473cb350c.json create mode 100644 docs/.cache/caches/gatsby-plugin-mdx/diskstore-7b8aaa1037478cb56350f784d9d9542a.json create mode 100644 docs/.cache/caches/gatsby-plugin-mdx/diskstore-7bc9578329298fbb8e415ab47e1c6d57.json create mode 100644 docs/.cache/caches/gatsby-plugin-mdx/diskstore-7ceb97a6eec71c23d8606266ce3af052.json create mode 100644 docs/.cache/caches/gatsby-plugin-mdx/diskstore-7cf5149eab885b394a7e7659efb3896c.json create mode 100644 docs/.cache/caches/gatsby-plugin-mdx/diskstore-7dce378488ec25253649ceb2d7039248.json create mode 100644 docs/.cache/caches/gatsby-plugin-mdx/diskstore-7f0818e6118769601060e8a3725f99f5.json create mode 100644 docs/.cache/caches/gatsby-plugin-mdx/diskstore-7fd2e1131a8bc0c4793e2efda5519b4b.json create mode 100644 docs/.cache/caches/gatsby-plugin-mdx/diskstore-815e75d2440bc4728043ad2952f65839.json create mode 100644 docs/.cache/caches/gatsby-plugin-mdx/diskstore-8232a7a77e9961ea47a5c3819d571e6b.json create mode 100644 docs/.cache/caches/gatsby-plugin-mdx/diskstore-82fb914e5ec9036bd275d7dd5d223369.json create mode 100644 docs/.cache/caches/gatsby-plugin-mdx/diskstore-831dfceb538231323dc563f9b0c6fba7.json create mode 100644 docs/.cache/caches/gatsby-plugin-mdx/diskstore-836f4fa4ecb3909368989d148f191749.json create mode 100644 docs/.cache/caches/gatsby-plugin-mdx/diskstore-8375d5d629cad4caa205c8429309263f.json create mode 100644 docs/.cache/caches/gatsby-plugin-mdx/diskstore-837811b4e69e55144f8688469fa6f922.json create mode 100644 docs/.cache/caches/gatsby-plugin-mdx/diskstore-86a51897ace3a214e556214d0bae2ac0.json create mode 100644 docs/.cache/caches/gatsby-plugin-mdx/diskstore-86f5ca31aff62e4ff6610d03bfb91124.json create mode 100644 docs/.cache/caches/gatsby-plugin-mdx/diskstore-87866b163bfadfadae9de8a1f7eda544.json create mode 100644 docs/.cache/caches/gatsby-plugin-mdx/diskstore-882d2b403440aad428ee348925648524.json create mode 100644 docs/.cache/caches/gatsby-plugin-mdx/diskstore-89728c6b5a3c76f64e7b67015ef49029.json create mode 100644 docs/.cache/caches/gatsby-plugin-mdx/diskstore-8ab466bafaeed6004ebcce705e3ac5ea.json create mode 100644 docs/.cache/caches/gatsby-plugin-mdx/diskstore-8aeb0fbdcf116e02eda4d7ad64a6cd22.json create mode 100644 docs/.cache/caches/gatsby-plugin-mdx/diskstore-8cd370ab88b3e8bdb0d05df678c0c157.json create mode 100644 docs/.cache/caches/gatsby-plugin-mdx/diskstore-8f37e5fb91e478272a82b22be8349649.json create mode 100644 docs/.cache/caches/gatsby-plugin-mdx/diskstore-90aea6765ffd064dc1855c368bc4f35a.json create mode 100644 docs/.cache/caches/gatsby-plugin-mdx/diskstore-93e1cced495a2f783d0b731bf610732c.json create mode 100644 docs/.cache/caches/gatsby-plugin-mdx/diskstore-93ed76efa1e16fead411796ef2375e98.json create mode 100644 docs/.cache/caches/gatsby-plugin-mdx/diskstore-9579b93c65f7f53d59b10d47e2b8f499.json create mode 100644 docs/.cache/caches/gatsby-plugin-mdx/diskstore-957f0e96b16acab41790fb5f6abf1cd7.json create mode 100644 docs/.cache/caches/gatsby-plugin-mdx/diskstore-95be68775e17319e434f495d5a7ff08c.json create mode 100644 docs/.cache/caches/gatsby-plugin-mdx/diskstore-96c3cefc21a452d127cb41816d06bb62.json create mode 100644 docs/.cache/caches/gatsby-plugin-mdx/diskstore-9a37d616d0c39b3996f33076c21a2dd3.json create mode 100644 docs/.cache/caches/gatsby-plugin-mdx/diskstore-9b27620307e2d376af34b3e6c30543e2.json create mode 100644 docs/.cache/caches/gatsby-plugin-mdx/diskstore-9c35db43ebe234368f04bea3419c0e82.json create mode 100644 docs/.cache/caches/gatsby-plugin-mdx/diskstore-9c570a2fd92c7f30091b8d50d36fbca9.json create mode 100644 docs/.cache/caches/gatsby-plugin-mdx/diskstore-9d9f4b39f7019084d7acb8e78111070e.json create mode 100644 docs/.cache/caches/gatsby-plugin-mdx/diskstore-9e3152bb6411d1248c048614c29aaafc.json create mode 100644 docs/.cache/caches/gatsby-plugin-mdx/diskstore-9e5f517f97f91e55a8c34695c20cf08f.json create mode 100644 docs/.cache/caches/gatsby-plugin-mdx/diskstore-9f86fa820e9fe16e1b2acba9bd5ea1df.json create mode 100644 docs/.cache/caches/gatsby-plugin-mdx/diskstore-9fc0886cdfbc8148f6c87f4be64d39cb.json create mode 100644 docs/.cache/caches/gatsby-plugin-mdx/diskstore-9fcf8aa9565636f55fa5b58db2acec9d.json create mode 100644 docs/.cache/caches/gatsby-plugin-mdx/diskstore-a1c7fd9f2a3a839efbae3bb259368a36.json create mode 100644 docs/.cache/caches/gatsby-plugin-mdx/diskstore-a2b1cd729c26406912f27b96f9b42a63.json create mode 100644 docs/.cache/caches/gatsby-plugin-mdx/diskstore-a3edef28539a644dcce547dcfb8618ce.json create mode 100644 docs/.cache/caches/gatsby-plugin-mdx/diskstore-a40bfb7aaed68f24c0c77f8251f6cc93.json create mode 100644 docs/.cache/caches/gatsby-plugin-mdx/diskstore-a410cb7b25513d5de696c2edab60222e.json create mode 100644 docs/.cache/caches/gatsby-plugin-mdx/diskstore-a563fbde30ec53b454886209421786f4.json create mode 100644 docs/.cache/caches/gatsby-plugin-mdx/diskstore-a64e6583e36462c2f995ac0719e123c1.json create mode 100644 docs/.cache/caches/gatsby-plugin-mdx/diskstore-a749d978085d1a19343e9ef2e01906d0.json create mode 100644 docs/.cache/caches/gatsby-plugin-mdx/diskstore-a93254839716a1a78aa72d0d2c436bad.json create mode 100644 docs/.cache/caches/gatsby-plugin-mdx/diskstore-a940b4d7ec548d7b13ba82ca3f50a54f.json create mode 100644 docs/.cache/caches/gatsby-plugin-mdx/diskstore-aa79913840d590ada89951e5811b2ca4.json create mode 100644 docs/.cache/caches/gatsby-plugin-mdx/diskstore-ab10729ae432bc6806b8f9aec80b80fa.json create mode 100644 docs/.cache/caches/gatsby-plugin-mdx/diskstore-ab32531e84c1f96f119bc121757ce267.json create mode 100644 docs/.cache/caches/gatsby-plugin-mdx/diskstore-b25e501e373f5af2184e3848f895b33d.json create mode 100644 docs/.cache/caches/gatsby-plugin-mdx/diskstore-b300efacc5c8bad6009cea0638f8580e.json create mode 100644 docs/.cache/caches/gatsby-plugin-mdx/diskstore-b3ffb1fd6badd0f83fb6dffe9217e372.json create mode 100644 docs/.cache/caches/gatsby-plugin-mdx/diskstore-b65d68433ee0fc259ad6ce888d901f33.json create mode 100644 docs/.cache/caches/gatsby-plugin-mdx/diskstore-b7e41a04d04ac13b5a9c6c8861b8d11a.json create mode 100644 docs/.cache/caches/gatsby-plugin-mdx/diskstore-ba6ca7f27f0d72cdd8c54b4f555f31f1.json create mode 100644 docs/.cache/caches/gatsby-plugin-mdx/diskstore-bbc05335acd004cce5258beedef0dd00.json create mode 100644 docs/.cache/caches/gatsby-plugin-mdx/diskstore-bbe13e974d5ee3d14e72aef622ecee47.json create mode 100644 docs/.cache/caches/gatsby-plugin-mdx/diskstore-bc1dade7eb3711769ba8bdd2da853f34.json create mode 100644 docs/.cache/caches/gatsby-plugin-mdx/diskstore-bee30d4ed0ab5e78080d24e5c193d58f.json create mode 100644 docs/.cache/caches/gatsby-plugin-mdx/diskstore-c38821458db3f7ea1dc608d769784f70.json create mode 100644 docs/.cache/caches/gatsby-plugin-mdx/diskstore-c38955e72fcba00329def8d75a8530d5.json create mode 100644 docs/.cache/caches/gatsby-plugin-mdx/diskstore-c3aca1602f527e43d4c80728e4432b73.json create mode 100644 docs/.cache/caches/gatsby-plugin-mdx/diskstore-c4b7da4be44fb94a3e299eb2d7b5e869.json create mode 100644 docs/.cache/caches/gatsby-plugin-mdx/diskstore-c4d657a394d00a7bba2c191b6572ea9c.json create mode 100644 docs/.cache/caches/gatsby-plugin-mdx/diskstore-c5964f96ac27ef706978573c962d5b28.json create mode 100644 docs/.cache/caches/gatsby-plugin-mdx/diskstore-c73955a38b6ba81c00ac6fab3fe402fc.json create mode 100644 docs/.cache/caches/gatsby-plugin-mdx/diskstore-c77e6b93ef93afe695da165a4bea7d70.json create mode 100644 docs/.cache/caches/gatsby-plugin-mdx/diskstore-c799fa361d4435d2813d74ae9e90955b.json create mode 100644 docs/.cache/caches/gatsby-plugin-mdx/diskstore-c955cdaffbf2e74516b25ffb6dd5f47c.json create mode 100644 docs/.cache/caches/gatsby-plugin-mdx/diskstore-cc35f6439ecf46b8ca62e054cbe9f9bb.json create mode 100644 docs/.cache/caches/gatsby-plugin-mdx/diskstore-ccb8fd4d70cc7606904ce728015a8c91.json create mode 100644 docs/.cache/caches/gatsby-plugin-mdx/diskstore-cd1a389ab235a607ffce55177cad7015.json create mode 100644 docs/.cache/caches/gatsby-plugin-mdx/diskstore-cd1ed76bbd7e068062d29b89fb5e2406.json create mode 100644 docs/.cache/caches/gatsby-plugin-mdx/diskstore-ced8a65b2547dc4ecd07eb7e553cf209.json create mode 100644 docs/.cache/caches/gatsby-plugin-mdx/diskstore-cfd4225219eb57ca4e1b297ced12d60e.json create mode 100644 docs/.cache/caches/gatsby-plugin-mdx/diskstore-d0206f0c19b6e19f320bdee5a8aabc4e.json create mode 100644 docs/.cache/caches/gatsby-plugin-mdx/diskstore-d1b5c8a2fe19315f0574266d275505c1.json create mode 100644 docs/.cache/caches/gatsby-plugin-mdx/diskstore-d32158d46c75b3c16cf387d06c3bde0f.json create mode 100644 docs/.cache/caches/gatsby-plugin-mdx/diskstore-d47347e3e7b72f57e523655de5c24457.json create mode 100644 docs/.cache/caches/gatsby-plugin-mdx/diskstore-d66eaf1ed8c4b7320e3f11eb5c756df5.json create mode 100644 docs/.cache/caches/gatsby-plugin-mdx/diskstore-d704f79611bc66f6e420fea792eb973e.json create mode 100644 docs/.cache/caches/gatsby-plugin-mdx/diskstore-d8b82ea2d5e9b8cf0ed2fb0b9c4d110c.json create mode 100644 docs/.cache/caches/gatsby-plugin-mdx/diskstore-d9b8ce7d728e6c46d9674a9b92a1d571.json create mode 100644 docs/.cache/caches/gatsby-plugin-mdx/diskstore-da47700eed50f4e18f76c4c755dd4382.json create mode 100644 docs/.cache/caches/gatsby-plugin-mdx/diskstore-de28827b10baa5522f7d3b4720bde0a1.json create mode 100644 docs/.cache/caches/gatsby-plugin-mdx/diskstore-deed356d84abb4c8a335e584506101f0.json create mode 100644 docs/.cache/caches/gatsby-plugin-mdx/diskstore-dfd0afb8c5df2e9c84e86ae949dcc032.json create mode 100644 docs/.cache/caches/gatsby-plugin-mdx/diskstore-e25228a50d456a7313b86cd103dbc0a3.json create mode 100644 docs/.cache/caches/gatsby-plugin-mdx/diskstore-e3033b62c546c2e4d949a920bdc38728.json create mode 100644 docs/.cache/caches/gatsby-plugin-mdx/diskstore-e718c442bc0a9e7c49a5993824e7f563.json create mode 100644 docs/.cache/caches/gatsby-plugin-mdx/diskstore-e73d84b99c51e5e80c2727e4ec78d056.json create mode 100644 docs/.cache/caches/gatsby-plugin-mdx/diskstore-e7eb20663aa447727162e1101ea1f493.json create mode 100644 docs/.cache/caches/gatsby-plugin-mdx/diskstore-e83281e8c42e1a99e1e05084c8e3ff68.json create mode 100644 docs/.cache/caches/gatsby-plugin-mdx/diskstore-e8eb02eb31fcf60a834e7ed5accb056c.json create mode 100644 docs/.cache/caches/gatsby-plugin-mdx/diskstore-e9705a7a27256a83004607546e6c6337.json create mode 100644 docs/.cache/caches/gatsby-plugin-mdx/diskstore-ebdd53108c5131930180839be05a208e.json create mode 100644 docs/.cache/caches/gatsby-plugin-mdx/diskstore-ec24df1a40ad5096bda4a0fcebe5d19e.json create mode 100644 docs/.cache/caches/gatsby-plugin-mdx/diskstore-ec40168b8fd40a8eb0f724b4c6cc08fa.json create mode 100644 docs/.cache/caches/gatsby-plugin-mdx/diskstore-ecc80478ddecaf48c545ae511c42e960.json create mode 100644 docs/.cache/caches/gatsby-plugin-mdx/diskstore-ece0ffec1c1dfb0744cec61b378aaa16.json create mode 100644 docs/.cache/caches/gatsby-plugin-mdx/diskstore-ed442c06a5509cb228b891acd55be845.json create mode 100644 docs/.cache/caches/gatsby-plugin-mdx/diskstore-eee18940f5863ac20b7a103ca35928ab.json create mode 100644 docs/.cache/caches/gatsby-plugin-mdx/diskstore-ef7ccd85b3ec1f14596b805cbe5e96e8.json create mode 100644 docs/.cache/caches/gatsby-plugin-mdx/diskstore-f1264c7d1daf7d4f2e5351beb90ee03a.json create mode 100644 docs/.cache/caches/gatsby-plugin-mdx/diskstore-f2d24116339a81f3f59eba9270293ca5.json create mode 100644 docs/.cache/caches/gatsby-plugin-mdx/diskstore-f2f2a41a6fd95fe72661e97b4dc2d38b.json create mode 100644 docs/.cache/caches/gatsby-plugin-mdx/diskstore-f3276b7a1880bd6c95fbacf8dcddffc4.json create mode 100644 docs/.cache/caches/gatsby-plugin-mdx/diskstore-f49c90b62ca7a5bfa69c247e96c3c257.json create mode 100644 docs/.cache/caches/gatsby-plugin-mdx/diskstore-f4e0a51bcdcafcf7296a50dce16b3ffc.json create mode 100644 docs/.cache/caches/gatsby-plugin-mdx/diskstore-f511d4e6b40f6576d3ec7af00a09f74c.json create mode 100644 docs/.cache/caches/gatsby-plugin-mdx/diskstore-f56a9867ceea0134353f09a149a75268.json create mode 100644 docs/.cache/caches/gatsby-plugin-mdx/diskstore-f79514e482d3378c47b031e0941fd1ef.json create mode 100644 docs/.cache/caches/gatsby-plugin-mdx/diskstore-f96905d8fb403d6ef6bc75ddfe2a2530.json create mode 100644 docs/.cache/caches/gatsby-plugin-mdx/diskstore-fab4139b88733bad72b839d16451f95d.json create mode 100644 docs/.cache/caches/gatsby-plugin-mdx/diskstore-fd2bca5948303a0e809d0df23a488374.json create mode 100644 docs/.cache/caches/gatsby-plugin-mdx/diskstore-febbefc413098db85509b541775a63c8.json create mode 100644 docs/.cache/caches/gatsby-plugin-mdx/diskstore-fec66b01cb65f13e4b4c6eb2a4fc30fd.json create mode 100644 docs/.cache/caches/gatsby-plugin-mdx/diskstore-ff41dccc0b6b6515c7eaee05ba741dcc.json create mode 100644 docs/.cache/caches/gatsby-plugin-mdx/mdx-scopes-dir/e92f8988d65cf25c087d226e6c0ef06f.js create mode 100644 docs/.cache/commonjs/api-runner-browser-plugins.js create mode 100644 docs/.cache/commonjs/api-runner-browser.js create mode 100644 docs/.cache/commonjs/api-runner-ssr.js create mode 100644 docs/.cache/commonjs/api-ssr-docs.js create mode 100644 docs/.cache/commonjs/app.js create mode 100644 docs/.cache/commonjs/create-react-context.js create mode 100644 docs/.cache/commonjs/default-html.js create mode 100644 docs/.cache/commonjs/dev-loader.js create mode 100644 docs/.cache/commonjs/develop-static-entry.js create mode 100644 docs/.cache/commonjs/emitter.js create mode 100644 docs/.cache/commonjs/ensure-resources.js create mode 100644 docs/.cache/commonjs/error-overlay-handler.js create mode 100644 docs/.cache/commonjs/find-path.js create mode 100644 docs/.cache/commonjs/gatsby-browser-entry.js create mode 100644 docs/.cache/commonjs/loader.js create mode 100644 docs/.cache/commonjs/navigation.js create mode 100644 docs/.cache/commonjs/normalize-page-path.js create mode 100644 docs/.cache/commonjs/page-renderer.js create mode 100644 docs/.cache/commonjs/polyfill-entry.js create mode 100644 docs/.cache/commonjs/polyfills/fetch.js create mode 100644 docs/.cache/commonjs/polyfills/no-op.js create mode 100644 docs/.cache/commonjs/polyfills/object-assign.js create mode 100644 docs/.cache/commonjs/polyfills/whatwg-fetch.js create mode 100644 docs/.cache/commonjs/prefetch.js create mode 100644 docs/.cache/commonjs/production-app.js create mode 100644 docs/.cache/commonjs/public-page-renderer-dev.js create mode 100644 docs/.cache/commonjs/public-page-renderer-prod.js create mode 100644 docs/.cache/commonjs/public-page-renderer.js create mode 100644 docs/.cache/commonjs/query-result-store.js create mode 100644 docs/.cache/commonjs/react-lifecycles-compat.js create mode 100644 docs/.cache/commonjs/register-service-worker.js create mode 100644 docs/.cache/commonjs/root.js create mode 100644 docs/.cache/commonjs/route-announcer-props.js create mode 100644 docs/.cache/commonjs/socketIo.js create mode 100644 docs/.cache/commonjs/static-entry.js create mode 100644 docs/.cache/commonjs/strip-prefix.js create mode 100644 docs/.cache/create-react-context.js create mode 100644 docs/.cache/default-html.js create mode 100644 docs/.cache/dev-404-page.js create mode 100644 docs/.cache/dev-loader.js create mode 100644 docs/.cache/develop-static-entry.js create mode 100644 docs/.cache/emitter.js create mode 100644 docs/.cache/ensure-resources.js create mode 100644 docs/.cache/error-overlay-handler.js create mode 100644 docs/.cache/find-path.js create mode 100644 docs/.cache/gatsby-browser-entry.js create mode 100644 docs/.cache/json/_.json create mode 100644 docs/.cache/json/_advanced.json create mode 100644 docs/.cache/json/_advanced_permlevels.json create mode 100644 docs/.cache/json/_dev-404-page.json create mode 100644 docs/.cache/json/_djs.json create mode 100644 docs/.cache/json/_faq.json create mode 100644 docs/.cache/json/_gettingstarted.json create mode 100644 docs/.cache/json/_guides.json create mode 100644 docs/.cache/json/_introduction.json create mode 100644 docs/.cache/json/_stepbystep.json create mode 100644 docs/.cache/json/_stepbystep_1createbot.json create mode 100644 docs/.cache/json/_stepbystep_1creatingbot.json create mode 100644 docs/.cache/json/_stepbystep_2createcommand.json create mode 100644 docs/.cache/json/_stepbystep_createbot.json create mode 100644 docs/.cache/json/_stepbystep_createcommand.json create mode 100644 docs/.cache/json/_stepbystep_createevent.json create mode 100644 docs/.cache/json/_stepbystep_createinhibitor.json create mode 100644 docs/.cache/json/_stepbystep_createlanguage.json create mode 100644 docs/.cache/json/_stepbystep_createmonitor.json create mode 100644 docs/.cache/json/_stepbystep_creatingbot.json create mode 100644 docs/.cache/loader.js create mode 100644 docs/.cache/match-paths.json create mode 100644 docs/.cache/navigation.js create mode 100644 docs/.cache/normalize-page-path.js create mode 100644 docs/.cache/page-renderer.js create mode 100644 docs/.cache/pages.json create mode 100644 docs/.cache/polyfill-entry.js create mode 100644 docs/.cache/polyfills/fetch.js create mode 100644 docs/.cache/polyfills/no-op.js create mode 100644 docs/.cache/polyfills/object-assign.js create mode 100644 docs/.cache/polyfills/whatwg-fetch.js create mode 100644 docs/.cache/prefetch.js create mode 100644 docs/.cache/production-app.js create mode 100644 docs/.cache/public-page-renderer-dev.js create mode 100644 docs/.cache/public-page-renderer-prod.js create mode 100644 docs/.cache/public-page-renderer.js create mode 100644 docs/.cache/query-result-store.js create mode 100644 docs/.cache/react-lifecycles-compat.js create mode 100644 docs/.cache/redirects.json create mode 100644 docs/.cache/redux/redux.node.state_0 create mode 100644 docs/.cache/redux/redux.rest.state create mode 100644 docs/.cache/register-service-worker.js create mode 100644 docs/.cache/root.js create mode 100644 docs/.cache/route-announcer-props.js create mode 100644 docs/.cache/socketIo.js create mode 100644 docs/.cache/static-entry.js create mode 100644 docs/.cache/strip-prefix.js create mode 100644 docs/.cache/sync-requires.js create mode 100644 docs/.cache/test-require-error.js create mode 100644 docs/.cache/tmp-39165-wIHd6P6zOgYA create mode 100644 docs/.cache/tmp-39283-UfvkCdDYslW4 create mode 100644 docs/.cache/tmp-39368-omySHTTPbhvw create mode 100644 docs/.cache/tmp-39444-tITwPsAv5R5h create mode 100644 docs/.cache/tmp-39637-p0s0K7WdRpbt create mode 100644 docs/.cache/tmp-39722-wH4V4Bz84j6s create mode 100644 docs/.cache/tmp-39780-4bqlWhbtqVNM create mode 100644 docs/.cache/tmp-40678-TjhDvbQHy4Di create mode 100644 docs/.cache/tmp-43228-fRwYdGv04XkY create mode 100644 docs/.cache/tmp-43441-BMt4qrXkoW6r create mode 100644 docs/.cache/tmp-44535-jH2nY3Rdm4iE create mode 100644 docs/.cache/tmp-44965-jpyUYhJhbKzt create mode 100644 docs/.cache/tmp-52835-NtlQMERbyqRy create mode 100644 docs/.cache/webpack/babel/068af3a852170bfd99dcccc4d6e85a16.json.gz create mode 100644 docs/.cache/webpack/babel/08ae15b587e892d805200792e61c0eb4.json.gz create mode 100644 docs/.cache/webpack/babel/09669c11b5c8d119f993ac5b79114a0f.json.gz create mode 100644 docs/.cache/webpack/babel/0a7754cc5652f75394aa47c969649dc1.json.gz create mode 100644 docs/.cache/webpack/babel/0b88f0a846f7d4fc6cc22f306c39827a.json.gz create mode 100644 docs/.cache/webpack/babel/0b944228a50306f3ab7de22297d984df.json.gz create mode 100644 docs/.cache/webpack/babel/0bb9429819cb6a56cf143532a703f4b2.json.gz create mode 100644 docs/.cache/webpack/babel/0ca2190d92db08ad331212611f1b158c.json.gz create mode 100644 docs/.cache/webpack/babel/0ddffaa9c1a10fe536c28c91c2b22c35.json.gz create mode 100644 docs/.cache/webpack/babel/0fa362415414f55e1ab9528ff4c29f82.json.gz create mode 100644 docs/.cache/webpack/babel/10d6e3fcb2d9ea2d122cc4e5d3ae2ce8.json.gz create mode 100644 docs/.cache/webpack/babel/11cc430654ea646348e5088ae852f3e7.json.gz create mode 100644 docs/.cache/webpack/babel/12fee89ec9f93d28ce0a2ab2bb4f484f.json.gz create mode 100644 docs/.cache/webpack/babel/1342b2a4ae12d4b9d57de9b83d78c33a.json.gz create mode 100644 docs/.cache/webpack/babel/13476374e084409f3a3cfe38dcc3ea29.json.gz create mode 100644 docs/.cache/webpack/babel/17a7ed203f22a8e23b470db6966ae3a3.json.gz create mode 100644 docs/.cache/webpack/babel/17eb525c2c51729e3bb8d830d4aa005a.json.gz create mode 100644 docs/.cache/webpack/babel/18308bcf898b172aea8d3dff209a0f3b.json.gz create mode 100644 docs/.cache/webpack/babel/1854ea6e01d5c829793f56b76587ed0f.json.gz create mode 100644 docs/.cache/webpack/babel/1aa315fb5d9573e4c807b21194bd7779.json.gz create mode 100644 docs/.cache/webpack/babel/1aebf84004c1cafc191cf356cf2f48ca.json.gz create mode 100644 docs/.cache/webpack/babel/1c9ee0743276cda604be4e1cd582f990.json.gz create mode 100644 docs/.cache/webpack/babel/1deded483542317276ed1562febd5716.json.gz create mode 100644 docs/.cache/webpack/babel/1ee45c7720106ce0760b79c81a53d025.json.gz create mode 100644 docs/.cache/webpack/babel/22ac74ced9b6ed20fc04d183db2402df.json.gz create mode 100644 docs/.cache/webpack/babel/23257725b785800c94b2656d9c183004.json.gz create mode 100644 docs/.cache/webpack/babel/273ecfbd308172f6c3ea1ff4ee7b1e4c.json.gz create mode 100644 docs/.cache/webpack/babel/2914d7aa85a7cae254ef7eac41a6a67b.json.gz create mode 100644 docs/.cache/webpack/babel/2a3e09a23645f62e010c83c767ffbda5.json.gz create mode 100644 docs/.cache/webpack/babel/2c59b4ea626ca3e9341ef7351c7a2ce5.json.gz create mode 100644 docs/.cache/webpack/babel/32482cf97f0042e13b2eb9c7b46b8bf3.json.gz create mode 100644 docs/.cache/webpack/babel/33c8624ce362b3cea926b0154ca87be0.json.gz create mode 100644 docs/.cache/webpack/babel/34ecbc79f413526378509c714eebab94.json.gz create mode 100644 docs/.cache/webpack/babel/3625b0102a148dd7b3e8165023f6745b.json.gz create mode 100644 docs/.cache/webpack/babel/362b179334dcee0fdfa984edfa300bee.json.gz create mode 100644 docs/.cache/webpack/babel/379bc1e7737b75f11dbf377269b6fb08.json.gz create mode 100644 docs/.cache/webpack/babel/38a15c94187e30a8b49aa1f58ebeaf9e.json.gz create mode 100644 docs/.cache/webpack/babel/397e07581a3701278e114a9f83100df4.json.gz create mode 100644 docs/.cache/webpack/babel/3cdf3f066ad032993a687cad17efe876.json.gz create mode 100644 docs/.cache/webpack/babel/3cf60e7ffcbdd29dd477db212b9a505e.json.gz create mode 100644 docs/.cache/webpack/babel/3d6f8853e968fc4d781205bb2ebf1f1f.json.gz create mode 100644 docs/.cache/webpack/babel/3e65c2e1cff808b6413c9275b62b3d9a.json.gz create mode 100644 docs/.cache/webpack/babel/3f15baf601f13e40b97d83a64efd87da.json.gz create mode 100644 docs/.cache/webpack/babel/3f59f67bb56b63ecfe82e0c9dc48bf6a.json.gz create mode 100644 docs/.cache/webpack/babel/3f9a8f13d0b5e669794ee4fa1e8ac360.json.gz create mode 100644 docs/.cache/webpack/babel/40e2fdaa791942ee47b65d78cce36a80.json.gz create mode 100644 docs/.cache/webpack/babel/42aee1f09ae4b9bf753be4462b00af92.json.gz create mode 100644 docs/.cache/webpack/babel/441c43ce1639a9356fb33141782a8f7c.json.gz create mode 100644 docs/.cache/webpack/babel/4774e144e9eb07a1b74fba721eb9b4cb.json.gz create mode 100644 docs/.cache/webpack/babel/48c7547d4b6d7f83af7c29cb4086f4e2.json.gz create mode 100644 docs/.cache/webpack/babel/49ce5d60e0c38ab13fd3083be80f59ac.json.gz create mode 100644 docs/.cache/webpack/babel/4dc6f190a9be54be44a21ecdeb65609a.json.gz create mode 100644 docs/.cache/webpack/babel/4e935a4be99c270a9a0583c777374845.json.gz create mode 100644 docs/.cache/webpack/babel/525ec8888c90a216b7bd82bee0a223f2.json.gz create mode 100644 docs/.cache/webpack/babel/53d464d00fea543dfb892749f5ca96ca.json.gz create mode 100644 docs/.cache/webpack/babel/56cd3fd9b70289ea693be4a0d4922fbc.json.gz create mode 100644 docs/.cache/webpack/babel/5748d953e500875d66920c2ac45eec20.json.gz create mode 100644 docs/.cache/webpack/babel/58a944ba849de2bd449c07baf5050f62.json.gz create mode 100644 docs/.cache/webpack/babel/5a91aae3cc08e68fd4b74f3c4ea9cadf.json.gz create mode 100644 docs/.cache/webpack/babel/5b2b393bc71f2b8cd9c87f5e6053988d.json.gz create mode 100644 docs/.cache/webpack/babel/5e2660ab398f2f0dccdb754b76779df8.json.gz create mode 100644 docs/.cache/webpack/babel/5e7915239069057e0caec3d4e2e11608.json.gz create mode 100644 docs/.cache/webpack/babel/5f4a15a1afc5c8e1b17237eb7f4fe388.json.gz create mode 100644 docs/.cache/webpack/babel/64e755669e176d01d90bcb344dc5877b.json.gz create mode 100644 docs/.cache/webpack/babel/64ee76ddc6d3a51516a1ce5c3fdb4a3a.json.gz create mode 100644 docs/.cache/webpack/babel/66c97fca3924d4197d8c98cea3c94000.json.gz create mode 100644 docs/.cache/webpack/babel/66ef46a7836c2aae7aba6de03783c103.json.gz create mode 100644 docs/.cache/webpack/babel/68bd272d4f95c2d10c00b46281bfdc62.json.gz create mode 100644 docs/.cache/webpack/babel/69841d6ed8c44948240f9619f0edefa6.json.gz create mode 100644 docs/.cache/webpack/babel/69cf51bcab94fba63863daa9409b3268.json.gz create mode 100644 docs/.cache/webpack/babel/69f39ec1c05a2e997ab71b7d2f463a0c.json.gz create mode 100644 docs/.cache/webpack/babel/6a3872b69adb5e5591585e8738e5386c.json.gz create mode 100644 docs/.cache/webpack/babel/6ba322c74f6c21064af40372361b5273.json.gz create mode 100644 docs/.cache/webpack/babel/6c2870ebd30b96a85ecf6a3f2d20f163.json.gz create mode 100644 docs/.cache/webpack/babel/7035de3726ddf0586f69e6138a38379e.json.gz create mode 100644 docs/.cache/webpack/babel/729a00395b91115723fd55bf72f9a46e.json.gz create mode 100644 docs/.cache/webpack/babel/738ae9e3349ef7789d268c67b2145b45.json.gz create mode 100644 docs/.cache/webpack/babel/75855cd92eb276bb9e9a1a54d97a469e.json.gz create mode 100644 docs/.cache/webpack/babel/782d5e355e7288ecb57727694f188b38.json.gz create mode 100644 docs/.cache/webpack/babel/7aab8b2886e38eb40bf45b25e0427d54.json.gz create mode 100644 docs/.cache/webpack/babel/7c4d38363fe51b470ccf163a598d2390.json.gz create mode 100644 docs/.cache/webpack/babel/7ebc0398b3688dddcc5da2982c98d06f.json.gz create mode 100644 docs/.cache/webpack/babel/8013323a92a9acd486e40d83adc12afe.json.gz create mode 100644 docs/.cache/webpack/babel/80b274dad51f0d07e51c4be0ad747b20.json.gz create mode 100644 docs/.cache/webpack/babel/851c31ed36990e5cc567a22588ea9f3a.json.gz create mode 100644 docs/.cache/webpack/babel/867ac4fbb9961c50423c96bf17496b3a.json.gz create mode 100644 docs/.cache/webpack/babel/86f74eac431115a7d2fe05e351e27546.json.gz create mode 100644 docs/.cache/webpack/babel/873066abc34c0ea15a9728adb6ec4fc1.json.gz create mode 100644 docs/.cache/webpack/babel/87945434f74c096923589ab546f6a5e3.json.gz create mode 100644 docs/.cache/webpack/babel/8c67ab7b81655ff94508c52438034782.json.gz create mode 100644 docs/.cache/webpack/babel/8cd31ad91d9ded33a6971a0a35656acc.json.gz create mode 100644 docs/.cache/webpack/babel/8cece618dd1463a46919c5b2b0d5de90.json.gz create mode 100644 docs/.cache/webpack/babel/8d043b0b1baf2e0863b71b5aa976f60e.json.gz create mode 100644 docs/.cache/webpack/babel/8eb57e3e579f03187e92f7e783b6cb97.json.gz create mode 100644 docs/.cache/webpack/babel/8f653add1448fc78a580b580b67038d6.json.gz create mode 100644 docs/.cache/webpack/babel/8f7a30ac416aa041ebfd36463f63fb8e.json.gz create mode 100644 docs/.cache/webpack/babel/920e16ce56a1488ff54f49d3eb68b596.json.gz create mode 100644 docs/.cache/webpack/babel/9272f7170f02cb015f80c00f5cfcb3f8.json.gz create mode 100644 docs/.cache/webpack/babel/92bd654c0d43f9f680564781f0f2e75e.json.gz create mode 100644 docs/.cache/webpack/babel/933e74c90f43824c79ec813e75f0aef2.json.gz create mode 100644 docs/.cache/webpack/babel/93a6ac1f5e1eb732d88fb931e2d3ad07.json.gz create mode 100644 docs/.cache/webpack/babel/94dbeaefa9a50232f808a4ef70a4812a.json.gz create mode 100644 docs/.cache/webpack/babel/960e798d4c77d7dc57dba47f7a7e99d4.json.gz create mode 100644 docs/.cache/webpack/babel/9c7726d8b9e23a308f573654f6546ed4.json.gz create mode 100644 docs/.cache/webpack/babel/9e4541500a37b03d79777b8a6d005a1d.json.gz create mode 100644 docs/.cache/webpack/babel/9fc139d910147ba2513dcd544e5cb887.json.gz create mode 100644 docs/.cache/webpack/babel/a0173a1ee9784059caf7d7e37274434e.json.gz create mode 100644 docs/.cache/webpack/babel/a14bafb40338b61d3562df728c1af9f9.json.gz create mode 100644 docs/.cache/webpack/babel/a1c5e3b431395242c7f62bf5cd46ef19.json.gz create mode 100644 docs/.cache/webpack/babel/a26c76b39c1e102609fe02a4d90744ae.json.gz create mode 100644 docs/.cache/webpack/babel/a5c4a732c0e7be5149542eee72069cad.json.gz create mode 100644 docs/.cache/webpack/babel/a5fd862e3f55e9dad9b4fe4737f661d9.json.gz create mode 100644 docs/.cache/webpack/babel/a82af9a7939ffc63e04e1eaaafd7a317.json.gz create mode 100644 docs/.cache/webpack/babel/a95b29d3ddd9944eb7827a9b35f9aa7c.json.gz create mode 100644 docs/.cache/webpack/babel/a9a0d6fb1adb6e18be21287392116b71.json.gz create mode 100644 docs/.cache/webpack/babel/ab36e3e42759d5e44aa14d80b15a1809.json.gz create mode 100644 docs/.cache/webpack/babel/add0089f1950e78448b53e3357f14e2d.json.gz create mode 100644 docs/.cache/webpack/babel/af9e180507f9bce0f1dc0d0cbddb9446.json.gz create mode 100644 docs/.cache/webpack/babel/b0404edddfc524431922e7288ab5f445.json.gz create mode 100644 docs/.cache/webpack/babel/b0805a7ccb35aad0a930bc1fa8d73b9d.json.gz create mode 100644 docs/.cache/webpack/babel/b4e9f6bfbb7e6d93640512a386a92efd.json.gz create mode 100644 docs/.cache/webpack/babel/b726e994b81f85cef97b440ff6bdc057.json.gz create mode 100644 docs/.cache/webpack/babel/bb8fa37b0084a477b51d238ee8256f88.json.gz create mode 100644 docs/.cache/webpack/babel/be584a53d9afb283027d2f34b2ff8055.json.gz create mode 100644 docs/.cache/webpack/babel/bf9eb34ce3b611c51716a12680e3ed63.json.gz create mode 100644 docs/.cache/webpack/babel/c2e27ab5b588a94044ebda0339544065.json.gz create mode 100644 docs/.cache/webpack/babel/c49121bfd66a37a5f0f097c912bf62bd.json.gz create mode 100644 docs/.cache/webpack/babel/c5180750d6185f9f6f3f6d002c5de383.json.gz create mode 100644 docs/.cache/webpack/babel/c5b1a1122ba371ca71457ad025c31b4f.json.gz create mode 100644 docs/.cache/webpack/babel/c749d9c14eade04baa5c390686b48bbc.json.gz create mode 100644 docs/.cache/webpack/babel/c7f2d84face60b8a63055237884c0e82.json.gz create mode 100644 docs/.cache/webpack/babel/c8367503762000031458a98332692bb2.json.gz create mode 100644 docs/.cache/webpack/babel/c887afbc639ae1478c1722a2aa2455fc.json.gz create mode 100644 docs/.cache/webpack/babel/cdf275ce653becae1c5fd676436fef60.json.gz create mode 100644 docs/.cache/webpack/babel/ce841c9b90bc8924ddd4796874519bf8.json.gz create mode 100644 docs/.cache/webpack/babel/d16d39e541d1be06c443a053a1ee404a.json.gz create mode 100644 docs/.cache/webpack/babel/d277908b3596943b6897ca63621b588c.json.gz create mode 100644 docs/.cache/webpack/babel/d29b6018df500c7b464985c296f5c79c.json.gz create mode 100644 docs/.cache/webpack/babel/d338761435232880e5cdea0409c37954.json.gz create mode 100644 docs/.cache/webpack/babel/d470373612d7fa8d290077c01ef77177.json.gz create mode 100644 docs/.cache/webpack/babel/d8440a1dacdb1717f4965db0a171e3fb.json.gz create mode 100644 docs/.cache/webpack/babel/d9b70db7e46b0f74d03d72b73aa968de.json.gz create mode 100644 docs/.cache/webpack/babel/d9c3f798fb45467fef5ee758d72f4ef2.json.gz create mode 100644 docs/.cache/webpack/babel/da317528b4835c13fd335a52612cc03d.json.gz create mode 100644 docs/.cache/webpack/babel/da6dd1034327269d3d7937455a5ddbd6.json.gz create mode 100644 docs/.cache/webpack/babel/dadb5538f493a9378c9562aaf01e3baf.json.gz create mode 100644 docs/.cache/webpack/babel/de76b23b2122bdec8bfd3f2020734f32.json.gz create mode 100644 docs/.cache/webpack/babel/e02fb32ac4dd653192a9d1ecbac92cae.json.gz create mode 100644 docs/.cache/webpack/babel/e14b6c5c18a45a39265b239c7337425f.json.gz create mode 100644 docs/.cache/webpack/babel/e52c2ba414144fc99a6f18b0957a9a0b.json.gz create mode 100644 docs/.cache/webpack/babel/e5b6b5ba34bf9596c1c61dec06a53cc7.json.gz create mode 100644 docs/.cache/webpack/babel/eba6fa1564c8f99b480f5d1beba0f6f2.json.gz create mode 100644 docs/.cache/webpack/babel/ed7c8339291954ba7b9a1f0659bbb63d.json.gz create mode 100644 docs/.cache/webpack/babel/ed98daff7c4ab0176e8fb029d8ff469e.json.gz create mode 100644 docs/.cache/webpack/babel/f052f6484ddf7350dc151127a5f3cceb.json.gz create mode 100644 docs/.cache/webpack/babel/f0a72b7458dbf6d23ee0d16421feff7b.json.gz create mode 100644 docs/.cache/webpack/babel/f29d2968c56e7208b5d9a1bb6eca82b6.json.gz create mode 100644 docs/.cache/webpack/babel/f36dbb60f42fc089ebd38393f8ed1070.json.gz create mode 100644 docs/.cache/webpack/babel/f52ffaccfde6d2400f9ac7f99d543d75.json.gz create mode 100644 docs/.cache/webpack/babel/f5d762b45b71660428691e1c2803ebdf.json.gz create mode 100644 docs/.cache/webpack/babel/f849c28cceca773abd027cb001f8e8a5.json.gz create mode 100644 docs/.cache/webpack/babel/f96d1ede3a5dccf345bac85cb0dac8c4.json.gz create mode 100644 docs/.cache/webpack/babel/f99281532f57bd23b84270275e9fca5f.json.gz create mode 100644 docs/.cache/webpack/babel/f9f917a3f70cecfb0fda76c5b898a226.json.gz create mode 100644 docs/.cache/webpack/babel/fb8b6187af5f21b22d2591c566a73a83.json.gz create mode 100644 docs/.cache/webpack/babel/fc1f09dd9497ddee8aed0f54c48e6e05.json.gz create mode 100644 docs/.cache/webpack/babel/ffc221bc99cd672547b5292fe43096c3.json.gz create mode 100644 docs/public/index.html create mode 100644 docs/public/page-data/advanced/page-data.json create mode 100644 docs/public/page-data/advanced/permlevels/page-data.json create mode 100644 docs/public/page-data/dev-404-page/page-data.json create mode 100644 docs/public/page-data/djs/page-data.json create mode 100644 docs/public/page-data/faq/page-data.json create mode 100644 docs/public/page-data/gettingstarted/page-data.json create mode 100644 docs/public/page-data/guides/page-data.json create mode 100644 docs/public/page-data/index/page-data.json create mode 100644 docs/public/page-data/introduction/page-data.json create mode 100644 docs/public/page-data/stepbystep/1createbot/page-data.json create mode 100644 docs/public/page-data/stepbystep/1creatingbot/page-data.json create mode 100644 docs/public/page-data/stepbystep/2createcommand/page-data.json create mode 100644 docs/public/page-data/stepbystep/createbot/page-data.json create mode 100644 docs/public/page-data/stepbystep/createcommand/page-data.json create mode 100644 docs/public/page-data/stepbystep/createevent/page-data.json create mode 100644 docs/public/page-data/stepbystep/createinhibitor/page-data.json create mode 100644 docs/public/page-data/stepbystep/createlanguage/page-data.json create mode 100644 docs/public/page-data/stepbystep/createmonitor/page-data.json create mode 100644 docs/public/page-data/stepbystep/creatingbot/page-data.json create mode 100644 docs/public/page-data/stepbystep/page-data.json create mode 100644 docs/public/static/d/2619113677.json create mode 100644 docs/public/static/d/3706406642.json create mode 100644 docs/public/static/d/417421954.json diff --git a/docs/.cache/.eslintrc.json b/docs/.cache/.eslintrc.json new file mode 100644 index 000000000..7396d0ec0 --- /dev/null +++ b/docs/.cache/.eslintrc.json @@ -0,0 +1,9 @@ +{ + "env": { + "browser": true + }, + "globals": { + "__PATH_PREFIX__": false, + "___emitter": false + } +} diff --git a/docs/.cache/__tests__/.babelrc b/docs/.cache/__tests__/.babelrc new file mode 100644 index 000000000..9e67ce276 --- /dev/null +++ b/docs/.cache/__tests__/.babelrc @@ -0,0 +1,3 @@ +{ + "presets": [["babel-preset-gatsby"]] +} diff --git a/docs/.cache/__tests__/__snapshots__/dev-loader.js.snap b/docs/.cache/__tests__/__snapshots__/dev-loader.js.snap new file mode 100644 index 000000000..6073b7018 --- /dev/null +++ b/docs/.cache/__tests__/__snapshots__/dev-loader.js.snap @@ -0,0 +1,18 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`Dev loader loadPage should be successful when component can be loaded 1`] = ` +Object { + "component": "instance", + "json": Object { + "pageContext": "something something", + }, + "page": Object { + "componentChunkName": "chunk", + "matchPath": undefined, + "path": "/mypage/", + "staticQueryHashes": Array [], + "webpackCompilationHash": "123", + }, + "staticQueryResults": Object {}, +} +`; diff --git a/docs/.cache/__tests__/__snapshots__/loader.js.snap b/docs/.cache/__tests__/__snapshots__/loader.js.snap new file mode 100644 index 000000000..362789b85 --- /dev/null +++ b/docs/.cache/__tests__/__snapshots__/loader.js.snap @@ -0,0 +1,18 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`Production loader loadPage should be successful when component can be loaded 1`] = ` +Object { + "component": "instance", + "json": Object { + "pageContext": "something something", + }, + "page": Object { + "componentChunkName": "chunk", + "matchPath": undefined, + "path": "/mypage/", + "staticQueryHashes": Array [], + "webpackCompilationHash": "123", + }, + "staticQueryResults": Object {}, +} +`; diff --git a/docs/.cache/__tests__/__snapshots__/static-entry.js.snap b/docs/.cache/__tests__/__snapshots__/static-entry.js.snap new file mode 100644 index 000000000..a32218f3e --- /dev/null +++ b/docs/.cache/__tests__/__snapshots__/static-entry.js.snap @@ -0,0 +1,13 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`develop-static-entry onPreRenderHTML can be used to replace headComponents 1`] = `"
"`; + +exports[`develop-static-entry onPreRenderHTML can be used to replace postBodyComponents 1`] = `"
div3
div2
div1
"`; + +exports[`develop-static-entry onPreRenderHTML can be used to replace preBodyComponents 1`] = `"
div3
div2
div1
"`; + +exports[`static-entry onPreRenderHTML can be used to replace headComponents 1`] = `"
"`; + +exports[`static-entry onPreRenderHTML can be used to replace postBodyComponents 1`] = `"
div3
div2
div1
"`; + +exports[`static-entry onPreRenderHTML can be used to replace preBodyComponents 1`] = `"
div3
div2
div1
"`; diff --git a/docs/.cache/__tests__/dev-loader.js b/docs/.cache/__tests__/dev-loader.js new file mode 100644 index 000000000..a355a49b6 --- /dev/null +++ b/docs/.cache/__tests__/dev-loader.js @@ -0,0 +1,557 @@ +// This is by no means a full test file for loader.js so feel free to add more tests. +import mock from "xhr-mock"; +import DevLoader from "../dev-loader"; +import emitter from "../emitter"; + +jest.mock(`../emitter`); +jest.mock(`../socketIo`, () => { + return { + default: jest.fn(), + getPageData: jest.fn().mockResolvedValue(), + }; +}); + +describe(`Dev loader`, () => { + let originalBasePath; + let originalPathPrefix; + beforeEach(() => { + originalBasePath = global.__BASE_PATH__; + originalPathPrefix = global.__PATH_PREFIX__; + global.__BASE_PATH__ = ``; + global.__PATH_PREFIX__ = ``; + }); + + afterEach(() => { + global.__BASE_PATH__ = originalBasePath; + global.__PATH_PREFIX__ = originalPathPrefix; + }); + + describe(`loadPageDataJson`, () => { + let xhrCount; + + /** + * @param {string} path + * @param {number} status + * @param {string|Object?} responseText + * @param {boolean?} json + */ + const mockPageData = (path, status, responseText = ``, json = false) => { + mock.get(`/page-data${path}/page-data.json`, (req, res) => { + xhrCount++; + if (json) { + res.header(`content-type`, `application/json`); + } + + return res + .status(status) + .body( + typeof responseText === `string` + ? responseText + : JSON.stringify(responseText), + ); + }); + }; + + const defaultPayload = { + path: `/mypage/`, + }; + + // replace the real XHR object with the mock XHR object before each test + beforeEach(() => { + xhrCount = 0; + mock.setup(); + }); + + // put the real XHR object back and clear the mocks after each test + afterEach(() => { + mock.teardown(); + }); + + it(`should return a pageData json on success`, async () => { + const devLoader = new DevLoader(null, []); + + mockPageData(`/mypage`, 200, defaultPayload, true); + + const expectation = { + status: `success`, + pagePath: `/mypage`, + payload: defaultPayload, + }; + expect(await devLoader.loadPageDataJson(`/mypage/`)).toEqual(expectation); + expect(devLoader.pageDataDb.get(`/mypage`)).toEqual(expectation); + expect(xhrCount).toBe(1); + }); + + it(`should return a pageData json on success without contentType`, async () => { + const devLoader = new DevLoader(null, []); + + mockPageData(`/mypage`, 200, defaultPayload); + + const expectation = { + status: `success`, + pagePath: `/mypage`, + payload: defaultPayload, + }; + expect(await devLoader.loadPageDataJson(`/mypage/`)).toEqual(expectation); + expect(devLoader.pageDataDb.get(`/mypage`)).toEqual(expectation); + expect(xhrCount).toBe(1); + }); + + it(`should return a pageData json with an empty compilation hash (gatsby develop)`, async () => { + const devLoader = new DevLoader(null, []); + + const payload = { ...defaultPayload, webpackCompilationHash: `` }; + mockPageData(`/mypage`, 200, payload); + + const expectation = { + status: `success`, + pagePath: `/mypage`, + payload, + }; + expect(await devLoader.loadPageDataJson(`/mypage/`)).toEqual(expectation); + expect(devLoader.pageDataDb.get(`/mypage`)).toEqual(expectation); + expect(xhrCount).toBe(1); + }); + + it(`should load a 404 page when page-path file is not a gatsby json`, async () => { + const devLoader = new DevLoader(null, []); + + const payload = { ...defaultPayload, path: `/404.html/` }; + mockPageData(`/unknown-page`, 200, { random: `string` }, true); + mockPageData(`/404.html`, 200, payload, true); + + const expectation = { + status: `success`, + pagePath: `/404.html`, + notFound: true, + payload, + }; + expect(await devLoader.loadPageDataJson(`/unknown-page/`)).toEqual( + expectation, + ); + expect(devLoader.pageDataDb.get(`/unknown-page`)).toEqual(expectation); + expect(xhrCount).toBe(2); + }); + + it(`should load a 404 page when page-path file is not a json`, async () => { + const devLoader = new DevLoader(null, []); + + const payload = { ...defaultPayload, path: `/404.html/` }; + mockPageData(`/unknown-page`, 200); + mockPageData(`/404.html`, 200, payload, true); + + const expectation = { + status: `success`, + pagePath: `/404.html`, + notFound: true, + payload, + }; + expect(await devLoader.loadPageDataJson(`/unknown-page/`)).toEqual( + expectation, + ); + expect(devLoader.pageDataDb.get(`/unknown-page`)).toEqual(expectation); + expect(xhrCount).toBe(2); + }); + + it(`should load a 404 page when path returns a 404`, async () => { + const devLoader = new DevLoader(null, []); + + const payload = { ...defaultPayload, path: `/404.html/` }; + mockPageData(`/unknown-page`, 200); + mockPageData(`/404.html`, 200, payload, true); + + const expectation = { + status: `success`, + pagePath: `/404.html`, + notFound: true, + payload, + }; + expect(await devLoader.loadPageDataJson(`/unknown-page/`)).toEqual( + expectation, + ); + expect(devLoader.pageDataDb.get(`/unknown-page`)).toEqual(expectation); + expect(xhrCount).toBe(2); + }); + + it(`should return the dev-404-page when no 404 page can be found`, async () => { + const devLoader = new DevLoader(null, []); + + const payload = { ...defaultPayload, path: `/dev-404-page/` }; + mockPageData(`/unknown-page`, 404); + mockPageData(`/404.html`, 404); + mockPageData(`/dev-404-page`, 200, payload, true); + + const expectation = { + status: `success`, + pagePath: `/dev-404-page`, + notFound: true, + payload, + }; + expect(await devLoader.loadPageDataJson(`/unknown-page/`)).toEqual( + expectation, + ); + + expect(devLoader.pageDataDb.get(`/unknown-page`)).toEqual({ + notFound: true, + pagePath: `/404.html`, + status: `error`, + }); + expect(xhrCount).toBe(3); + }); + + it(`should return an error when status is 500`, async () => { + const devLoader = new DevLoader(null, []); + + mockPageData(`/error-page`, 500); + + const expectation = { + status: `error`, + pagePath: `/error-page`, + }; + expect(await devLoader.loadPageDataJson(`/error-page/`)).toEqual({ + status: `error`, + pagePath: `/dev-404-page`, + retries: 3, + }); + expect(devLoader.pageDataDb.get(`/error-page`)).toEqual(expectation); + expect(xhrCount).toBe(1); + }); + + it(`should retry 3 times before returning an error`, async () => { + const devLoader = new DevLoader(null, []); + + mockPageData(`/blocked-page`, 0); + + const expectation = { + status: `error`, + retries: 3, + pagePath: `/blocked-page`, + }; + expect(await devLoader.loadPageDataJson(`/blocked-page/`)).toEqual({ + status: `error`, + retries: 3, + pagePath: `/dev-404-page`, + }); + expect(devLoader.pageDataDb.get(`/blocked-page`)).toEqual(expectation); + expect(xhrCount).toBe(4); + }); + + it(`should recover if we get 1 failure`, async () => { + const devLoader = new DevLoader(null, []); + const payload = { + path: `/blocked-page/`, + }; + + let xhrCount = 0; + mock.get(`/page-data/blocked-page/page-data.json`, (req, res) => { + if (xhrCount++ === 0) { + return res.status(0).body(``); + } else { + res.header(`content-type`, `application/json`); + return res.status(200).body(JSON.stringify(payload)); + } + }); + + const expectation = { + status: `success`, + retries: 1, + pagePath: `/blocked-page`, + payload, + }; + expect(await devLoader.loadPageDataJson(`/blocked-page/`)).toEqual( + expectation, + ); + expect(devLoader.pageDataDb.get(`/blocked-page`)).toEqual(expectation); + expect(xhrCount).toBe(2); + }); + + it(`shouldn't load pageData multiple times`, async () => { + const devLoader = new DevLoader(null, []); + + mockPageData(`/mypage`, 200, defaultPayload, true); + + const expectation = await devLoader.loadPageDataJson(`/mypage/`); + expect(await devLoader.loadPageDataJson(`/mypage/`)).toBe(expectation); + expect(xhrCount).toBe(1); + }); + }); + + describe(`loadPage`, () => { + const createSyncRequires = (components) => { + return { + components, + }; + }; + + let originalPathPrefix; + + beforeEach(() => { + originalPathPrefix = global.__PATH_PREFIX__; + global.__PATH_PREFIX__ = ``; + mock.setup(); + mock.get(`/page-data/app-data.json`, (req, res) => + res + .status(200) + .header(`content-type`, `application/json`) + .body( + JSON.stringify({ + webpackCompilationHash: `123`, + }), + )); + emitter.emit.mockReset(); + }); + + afterEach(() => { + global.__PATH_PREFIX__ = originalPathPrefix; + mock.teardown(); + }); + + it(`should be successful when component can be loaded`, async () => { + const syncRequires = createSyncRequires({ + chunk: `instance`, + }); + const devLoader = new DevLoader(syncRequires, []); + const pageData = { + path: `/mypage/`, + componentChunkName: `chunk`, + result: { + pageContext: `something something`, + }, + staticQueryHashes: [], + }; + devLoader.loadPageDataJson = jest.fn(() => + Promise.resolve({ + payload: pageData, + status: `success`, + }) + ); + + const expectation = await devLoader.loadPage(`/mypage/`); + expect(expectation).toMatchSnapshot(); + expect(Object.keys(expectation)).toEqual([ + `component`, + `json`, + `page`, + `staticQueryResults`, + ]); + expect(devLoader.pageDb.get(`/mypage`)).toEqual( + expect.objectContaining({ + payload: expectation, + status: `success`, + }), + ); + expect(emitter.emit).toHaveBeenCalledTimes(1); + expect(emitter.emit).toHaveBeenCalledWith(`onPostLoadPageResources`, { + page: expectation, + pageResources: expectation, + }); + }); + + it(`should set not found on finalResult`, async () => { + const syncRequires = createSyncRequires({ + chunk: `instance`, + }); + const devLoader = new DevLoader(syncRequires, []); + const pageData = { + path: `/mypage/`, + componentChunkName: `chunk`, + }; + devLoader.loadPageDataJson = jest.fn(() => + Promise.resolve({ + payload: pageData, + status: `success`, + notFound: true, + }) + ); + + await devLoader.loadPage(`/mypage/`); + const expectation = devLoader.pageDb.get(`/mypage`); + expect(expectation).toHaveProperty(`notFound`, true); + expect(emitter.emit).toHaveBeenCalledTimes(1); + expect(emitter.emit).toHaveBeenCalledWith(`onPostLoadPageResources`, { + page: expectation.payload, + pageResources: expectation.payload, + }); + }); + + it(`should return an error when component cannot be loaded`, async () => { + const syncRequires = createSyncRequires({ + chunk: false, + }); + const devLoader = new DevLoader(syncRequires, []); + const pageData = { + path: `/mypage/`, + componentChunkName: `chunk`, + staticQueryHashes: [], + }; + devLoader.loadPageDataJson = jest.fn(() => + Promise.resolve({ + payload: pageData, + status: `success`, + }) + ); + + await devLoader.loadPage(`/mypage/`); + const expectation = devLoader.pageDb.get(`/mypage`); + expect(expectation).toHaveProperty(`status`, `error`); + expect(emitter.emit).toHaveBeenCalledTimes(0); + }); + + it(`should return an error pageData contains an error`, async () => { + const syncRequires = createSyncRequires({ + chunk: `instance`, + }); + const devLoader = new DevLoader(syncRequires, []); + const pageData = { + path: `/mypage/`, + componentChunkName: `chunk`, + staticQueryHashes: [], + }; + devLoader.loadPageDataJson = jest.fn(() => + Promise.resolve({ + payload: pageData, + status: `error`, + }) + ); + + expect(await devLoader.loadPage(`/mypage/`)).toEqual({ status: `error` }); + expect(devLoader.pageDb.size).toBe(0); + expect(emitter.emit).toHaveBeenCalledTimes(0); + }); + + it(`should log an error when 404 cannot be fetched`, async () => { + const devLoader = new DevLoader(null, []); + const consoleErrorSpy = jest.spyOn(console, `error`); + const defaultXHRMockErrorHandler = XMLHttpRequest.errorCallback; + mock.error(() => {}); + + await devLoader.loadPage(`/404.html/`); + + expect(consoleErrorSpy).toHaveBeenCalledTimes(1); + expect(consoleErrorSpy).toHaveBeenCalledWith( + `404 page could not be found. Checkout https://www.gatsbyjs.org/docs/add-404-page/`, + ); + + mock.error(defaultXHRMockErrorHandler); + consoleErrorSpy.mockRestore(); + + expect(devLoader.pageDb.size).toBe(0); + expect(emitter.emit).toHaveBeenCalledTimes(0); + }); + + it(`should cache the result of loadPage`, async () => { + const syncRequires = createSyncRequires({ + chunk: `instance`, + }); + const devLoader = new DevLoader(syncRequires, []); + devLoader.loadPageDataJson = jest.fn(() => + Promise.resolve({ + payload: { + componentChunkName: `chunk`, + staticQueryHashes: [], + }, + status: `success`, + }) + ); + + const expectation = await devLoader.loadPage(`/mypage/`); + expect(await devLoader.loadPage(`/mypage/`)).toBe(expectation); + expect(devLoader.loadPageDataJson).toHaveBeenCalledTimes(1); + }); + }); + + describe(`loadPageSync`, () => { + it(`returns page resources when already fetched`, () => { + const devLoader = new DevLoader(null, []); + + devLoader.pageDb.set(`/mypage`, { payload: true }); + expect(devLoader.loadPageSync(`/mypage/`)).toBe(true); + }); + + it(`returns page resources when already fetched`, () => { + const devLoader = new DevLoader(null, []); + + expect(devLoader.loadPageSync(`/mypage/`)).toBeUndefined(); + }); + }); + + describe(`prefetch`, () => { + const flushPromises = () => new Promise((resolve) => setImmediate(resolve)); + + it(`shouldn't prefetch when shouldPrefetch is false`, () => { + const devLoader = new DevLoader(null, []); + devLoader.shouldPrefetch = jest.fn(() => false); + devLoader.doPrefetch = jest.fn(); + devLoader.apiRunner = jest.fn(); + + expect(devLoader.prefetch(`/mypath/`)).toBe(false); + expect(devLoader.shouldPrefetch).toHaveBeenCalledWith(`/mypath/`); + expect(devLoader.apiRunner).not.toHaveBeenCalled(); + expect(devLoader.doPrefetch).not.toHaveBeenCalled(); + }); + + it(`should trigger custom prefetch logic when core is disabled`, () => { + const devLoader = new DevLoader(null, []); + devLoader.shouldPrefetch = jest.fn(() => true); + devLoader.doPrefetch = jest.fn(); + devLoader.apiRunner = jest.fn(); + devLoader.prefetchDisabled = true; + + expect(devLoader.prefetch(`/mypath/`)).toBe(false); + expect(devLoader.shouldPrefetch).toHaveBeenCalledWith(`/mypath/`); + expect(devLoader.apiRunner).toHaveBeenCalledWith(`onPrefetchPathname`, { + pathname: `/mypath/`, + }); + expect(devLoader.doPrefetch).not.toHaveBeenCalled(); + }); + + it(`should prefetch when not yet triggered`, async () => { + jest.useFakeTimers(); + const devLoader = new DevLoader(null, []); + devLoader.shouldPrefetch = jest.fn(() => true); + devLoader.apiRunner = jest.fn(); + devLoader.doPrefetch = jest.fn(() => Promise.resolve({})); + + expect(devLoader.prefetch(`/mypath/`)).toBe(true); + + // wait for doPrefetchPromise + await flushPromises(); + + expect(devLoader.apiRunner).toHaveBeenCalledWith(`onPrefetchPathname`, { + pathname: `/mypath/`, + }); + expect(devLoader.apiRunner).toHaveBeenNthCalledWith( + 2, + `onPostPrefetchPathname`, + { + pathname: `/mypath/`, + }, + ); + }); + + it(`should only run apis once`, async () => { + const devLoader = new DevLoader(null, []); + devLoader.shouldPrefetch = jest.fn(() => true); + devLoader.apiRunner = jest.fn(); + devLoader.doPrefetch = jest.fn(() => Promise.resolve({})); + + expect(devLoader.prefetch(`/mypath/`)).toBe(true); + expect(devLoader.prefetch(`/mypath/`)).toBe(true); + + // wait for doPrefetchPromise + await flushPromises(); + + expect(devLoader.apiRunner).toHaveBeenCalledTimes(2); + expect(devLoader.apiRunner).toHaveBeenNthCalledWith( + 1, + `onPrefetchPathname`, + expect.anything(), + ); + expect(devLoader.apiRunner).toHaveBeenNthCalledWith( + 2, + `onPostPrefetchPathname`, + expect.anything(), + ); + }); + }); +}); diff --git a/docs/.cache/__tests__/ensure-resources.tsx b/docs/.cache/__tests__/ensure-resources.tsx new file mode 100644 index 000000000..1e31cd298 --- /dev/null +++ b/docs/.cache/__tests__/ensure-resources.tsx @@ -0,0 +1,33 @@ +import React from "react"; +import EnsureResources from "../ensure-resources"; +import { render, getNodeText, cleanup } from "@testing-library/react"; + +jest.mock(`../loader`, () => { + return { + loadPageSync(path: string): { loadPageSync: boolean; path: string } { + return { loadPageSync: true, path }; + }, + loadPage(path: string): Promise<{ loadPage: boolean; path: string }> { + return Promise.resolve({ loadPage: true, path }); + }, + }; +}); + +afterAll(cleanup); + +describe(`EnsureResources`, () => { + it(`loads pages synchronously`, () => { + const location = { + pathname: `/`, + }; + const { container } = render( + + {(data: any): string => JSON.stringify(data.pageResources)} + , + ); + + expect(getNodeText(container)).toMatchInlineSnapshot( + `"{\\"loadPageSync\\":true,\\"path\\":\\"/\\"}"`, + ); + }); +}); diff --git a/docs/.cache/__tests__/error-overlay-handler.js b/docs/.cache/__tests__/error-overlay-handler.js new file mode 100644 index 000000000..1edf926f5 --- /dev/null +++ b/docs/.cache/__tests__/error-overlay-handler.js @@ -0,0 +1,58 @@ +const { + reportError, + clearError, + errorMap, +} = require(`../error-overlay-handler`); + +import * as ErrorOverlay from "react-error-overlay"; + +jest.mock(`react-error-overlay`, () => { + return { + reportBuildError: jest.fn(), + dismissBuildError: jest.fn(), + startReportingRuntimeErrors: jest.fn(), + setEditorHandler: jest.fn(), + }; +}); + +beforeEach(() => { + ErrorOverlay.reportBuildError.mockClear(); + ErrorOverlay.dismissBuildError.mockClear(); +}); + +describe(`errorOverlayHandler`, () => { + describe(`clearError()`, () => { + beforeEach(() => { + reportError(`foo`, `error`); + reportError(`bar`, `error`); + }); + afterAll(() => { + clearError(`foo`); + clearError(`bar`); + }); + it(`should clear specific error type`, () => { + expect(Object.keys(errorMap)).toHaveLength(2); + clearError(`foo`); + expect(Object.keys(errorMap)).toHaveLength(1); + expect(ErrorOverlay.dismissBuildError).not.toHaveBeenCalled(); + }); + + it(`should call ErrorOverlay to dismiss build errors`, () => { + clearError(`foo`); + clearError(`bar`); + expect(ErrorOverlay.dismissBuildError).toHaveBeenCalled(); + }); + }); + describe(`reportErrorOverlay()`, () => { + it(`should not add error if it's empty and not call ErrorOverlay`, () => { + reportError(`foo`, null); + expect(Object.keys(errorMap)).toHaveLength(0); + expect(ErrorOverlay.reportBuildError).not.toHaveBeenCalled(); + }); + it(`should add error if it has a truthy value and call ErrorOverlay`, () => { + reportError(`foo`, `bar`); + expect(Object.keys(errorMap)).toHaveLength(1); + expect(ErrorOverlay.reportBuildError).toHaveBeenCalled(); + }); + }); +}); diff --git a/docs/.cache/__tests__/find-path.js b/docs/.cache/__tests__/find-path.js new file mode 100644 index 000000000..879e3d2af --- /dev/null +++ b/docs/.cache/__tests__/find-path.js @@ -0,0 +1,116 @@ +import { + cleanPath, + setMatchPaths, + findMatchPath, + findPath, +} from "../find-path"; + +describe(`find-path`, () => { + describe(`cleanPath`, () => { + beforeEach(() => { + global.__BASE_PATH__ = ``; + }); + + it(`should strip out ? & # from a pathname`, () => { + expect(cleanPath(`/mypath#anchor?gatsby=cool`)).toBe(`/mypath`); + }); + + it(`should convert a /index.html to root dir`, () => { + expect(cleanPath(`/index.html`)).toBe(`/`); + }); + + it(`strip out a basePrefix`, () => { + global.__BASE_PATH__ = `/blog`; + expect(cleanPath(`/blog/mypath`)).toBe(`/mypath`); + }); + }); + + describe(`findMatchPath`, () => { + beforeEach(() => { + // reset matchPaths + setMatchPaths([]); + global.__BASE_PATH__ = ``; + }); + + it(`should find a path when matchPath found`, () => { + setMatchPaths([ + { + matchPath: `/app/*`, + path: `/app`, + }, + ]); + + expect(findMatchPath(`/app/dynamic-page#anchor?gatsby=cool`)).toBe( + `/app`, + ); + }); + + it(`should return null when no matchPathFound`, () => { + setMatchPaths([ + { + matchPath: `/app/*`, + path: `/app`, + }, + ]); + + expect(findMatchPath(`/notanapp/dynamic-page`)).toBeNull(); + }); + }); + + describe(`findPath`, () => { + beforeEach(() => { + // reset matchPaths + setMatchPaths([]); + global.__BASE_PATH__ = ``; + }); + + it(`should use matchPath if found`, () => { + setMatchPaths([ + { + matchPath: `/app/*`, + path: `/app`, + }, + ]); + + expect(findPath(`/app/dynamic-page#anchor?gatsby=cool`)).toBe(`/app`); + }); + + it(`should return the cleaned up path when no matchPathFound`, () => { + setMatchPaths([ + { + matchPath: `/app/*`, + path: `/app`, + }, + ]); + + expect(findPath(`/notanapp/my-page#anchor?gatsby=cool`)).toBe( + `/notanapp/my-page`, + ); + }); + + it(`should only process a request once`, () => { + jest.resetModules(); + jest.mock(`@reach/router/lib/utils`); + const findPath = require(`../find-path`).findPath; + const setMatchPaths = require(`../find-path`).setMatchPaths; + const match = require(`@reach/router/lib/utils`).match; + + setMatchPaths([ + { + matchPath: `/app/*`, + path: `/app`, + }, + ]); + + expect(findPath(`/notanapp/my-page#anchor?gatsby=cool`)).toBe( + `/notanapp/my-page`, + ); + expect(findPath(`/notanapp/my-page#anchor?gatsby=cool`)).toBe( + `/notanapp/my-page`, + ); + expect(findPath(`/notanapp/my-page`)).toBe(`/notanapp/my-page`); + + expect(match).toHaveBeenCalledTimes(1); + }); + }); +}); diff --git a/docs/.cache/__tests__/loader.js b/docs/.cache/__tests__/loader.js new file mode 100644 index 000000000..7e0c1560d --- /dev/null +++ b/docs/.cache/__tests__/loader.js @@ -0,0 +1,572 @@ +// This is by no means a full test file for loader.js so feel free to add more tests. +import mock from "xhr-mock"; +import { ProdLoader } from "../loader"; +import emitter from "../emitter"; + +jest.mock(`../emitter`); + +describe(`Production loader`, () => { + let originalBasePath; + let originalPathPrefix; + + beforeEach(() => { + originalBasePath = global.__BASE_PATH__; + originalPathPrefix = global.__PATH_PREFIX__; + global.__BASE_PATH__ = ``; + global.__PATH_PREFIX__ = ``; + }); + + // put the real XHR object back and clear the mocks after each test + afterEach(() => { + global.__BASE_PATH__ = originalBasePath; + global.__PATH_PREFIX__ = originalPathPrefix; + }); + + describe(`loadPageDataJson`, () => { + let xhrCount; + + /** + * @param {string} path + * @param {number} status + * @param {string|Object?} responseText + * @param {boolean?} json + */ + const mockPageData = (path, status, responseText = ``, json = false) => { + mock.get(`/page-data${path}/page-data.json`, (req, res) => { + xhrCount++; + if (json) { + res.header(`content-type`, `application/json`); + } + + return res + .status(status) + .body( + typeof responseText === `string` + ? responseText + : JSON.stringify(responseText), + ); + }); + }; + + const defaultPayload = { + path: `/mypage/`, + }; + + // replace the real XHR object with the mock XHR object before each test + beforeEach(() => { + xhrCount = 0; + mock.setup(); + }); + + // put the real XHR object back and clear the mocks after each test + afterEach(() => { + mock.teardown(); + }); + + it(`should return a pageData json on success`, async () => { + const prodLoader = new ProdLoader(null, []); + + mockPageData(`/mypage`, 200, defaultPayload, true); + + const expectation = { + status: `success`, + pagePath: `/mypage`, + payload: defaultPayload, + }; + expect(await prodLoader.loadPageDataJson(`/mypage/`)).toEqual( + expectation, + ); + expect(prodLoader.pageDataDb.get(`/mypage`)).toEqual(expectation); + expect(xhrCount).toBe(1); + }); + + it(`should return a pageData json on success without contentType`, async () => { + const prodLoader = new ProdLoader(null, []); + + mockPageData(`/mypage`, 200, defaultPayload); + + const expectation = { + status: `success`, + pagePath: `/mypage`, + payload: defaultPayload, + }; + expect(await prodLoader.loadPageDataJson(`/mypage/`)).toEqual( + expectation, + ); + expect(prodLoader.pageDataDb.get(`/mypage`)).toEqual(expectation); + expect(xhrCount).toBe(1); + }); + + it(`should return a pageData json with an empty compilation hash (gatsby develop)`, async () => { + const prodLoader = new ProdLoader(null, []); + + const payload = { ...defaultPayload, webpackCompilationHash: `` }; + mockPageData(`/mypage`, 200, payload); + + const expectation = { + status: `success`, + pagePath: `/mypage`, + payload, + }; + expect(await prodLoader.loadPageDataJson(`/mypage/`)).toEqual( + expectation, + ); + expect(prodLoader.pageDataDb.get(`/mypage`)).toEqual(expectation); + expect(xhrCount).toBe(1); + }); + + it(`should load a 404 page when page-path file is not a gatsby json`, async () => { + const prodLoader = new ProdLoader(null, []); + + const payload = { ...defaultPayload, path: `/404.html/` }; + mockPageData(`/unknown-page`, 200, { random: `string` }, true); + mockPageData(`/404.html`, 200, payload, true); + + const expectation = { + status: `success`, + pagePath: `/404.html`, + notFound: true, + payload, + }; + expect(await prodLoader.loadPageDataJson(`/unknown-page/`)).toEqual( + expectation, + ); + expect(prodLoader.pageDataDb.get(`/unknown-page`)).toEqual(expectation); + expect(xhrCount).toBe(2); + }); + + it(`should load a 404 page when page-path file is not a json`, async () => { + const prodLoader = new ProdLoader(null, []); + + const payload = { ...defaultPayload, path: `/404.html/` }; + mockPageData(`/unknown-page`, 200); + mockPageData(`/404.html`, 200, payload, true); + + const expectation = { + status: `success`, + pagePath: `/404.html`, + notFound: true, + payload, + }; + expect(await prodLoader.loadPageDataJson(`/unknown-page/`)).toEqual( + expectation, + ); + expect(prodLoader.pageDataDb.get(`/unknown-page`)).toEqual(expectation); + expect(xhrCount).toBe(2); + }); + + it(`should load a 404 page when path returns a 404`, async () => { + const prodLoader = new ProdLoader(null, []); + + const payload = { ...defaultPayload, path: `/404.html/` }; + mockPageData(`/unknown-page`, 200); + mockPageData(`/404.html`, 200, payload, true); + + const expectation = { + status: `success`, + pagePath: `/404.html`, + notFound: true, + payload, + }; + expect(await prodLoader.loadPageDataJson(`/unknown-page/`)).toEqual( + expectation, + ); + expect(prodLoader.pageDataDb.get(`/unknown-page`)).toEqual(expectation); + expect(xhrCount).toBe(2); + }); + + it(`should return a failure when status is 404 and 404 page is fetched`, async () => { + const prodLoader = new ProdLoader(null, []); + + mockPageData(`/unknown-page`, 404); + mockPageData(`/404.html`, 404); + + const expectation = { + status: `error`, + pagePath: `/404.html`, + notFound: true, + }; + expect(await prodLoader.loadPageDataJson(`/unknown-page/`)).toEqual( + expectation, + ); + expect(prodLoader.pageDataDb.get(`/unknown-page`)).toEqual(expectation); + expect(xhrCount).toBe(2); + }); + + it(`should return an error when status is 500`, async () => { + const prodLoader = new ProdLoader(null, []); + + mockPageData(`/error-page`, 500); + + const expectation = { + status: `error`, + pagePath: `/error-page`, + }; + expect(await prodLoader.loadPageDataJson(`/error-page/`)).toEqual( + expectation, + ); + expect(prodLoader.pageDataDb.get(`/error-page`)).toEqual(expectation); + expect(xhrCount).toBe(1); + }); + + it(`should retry 3 times before returning an error`, async () => { + const prodLoader = new ProdLoader(null, []); + + mockPageData(`/blocked-page`, 0); + + const expectation = { + status: `error`, + retries: 3, + pagePath: `/blocked-page`, + }; + expect(await prodLoader.loadPageDataJson(`/blocked-page/`)).toEqual( + expectation, + ); + expect(prodLoader.pageDataDb.get(`/blocked-page`)).toEqual(expectation); + expect(xhrCount).toBe(4); + }); + + it(`should recover if we get 1 failure`, async () => { + const prodLoader = new ProdLoader(null, []); + const payload = { + path: `/blocked-page/`, + }; + + let xhrCount = 0; + mock.get(`/page-data/blocked-page/page-data.json`, (req, res) => { + if (xhrCount++ === 0) { + return res.status(0).body(``); + } else { + res.header(`content-type`, `application/json`); + return res.status(200).body(JSON.stringify(payload)); + } + }); + + const expectation = { + status: `success`, + retries: 1, + pagePath: `/blocked-page`, + payload, + }; + expect(await prodLoader.loadPageDataJson(`/blocked-page/`)).toEqual( + expectation, + ); + expect(prodLoader.pageDataDb.get(`/blocked-page`)).toEqual(expectation); + expect(xhrCount).toBe(2); + }); + + it(`shouldn't load pageData multiple times`, async () => { + const prodLoader = new ProdLoader(null, []); + + mockPageData(`/mypage`, 200, defaultPayload, true); + + const expectation = await prodLoader.loadPageDataJson(`/mypage/`); + expect(await prodLoader.loadPageDataJson(`/mypage/`)).toBe(expectation); + expect(xhrCount).toBe(1); + }); + }); + + describe(`loadPage`, () => { + const createAsyncRequires = (components) => { + return { + components, + }; + }; + + beforeEach(() => { + mock.setup(); + mock.get(`/page-data/app-data.json`, (req, res) => + res + .status(200) + .header(`content-type`, `application/json`) + .body( + JSON.stringify({ + webpackCompilationHash: `123`, + }), + )); + emitter.emit.mockReset(); + }); + + afterEach(() => { + mock.teardown(); + }); + + it(`should be successful when component can be loaded`, async () => { + const asyncRequires = createAsyncRequires({ + chunk: () => Promise.resolve(`instance`), + }); + const prodLoader = new ProdLoader(asyncRequires, []); + const pageData = { + path: `/mypage/`, + componentChunkName: `chunk`, + result: { + pageContext: `something something`, + }, + staticQueryHashes: [], + }; + prodLoader.loadPageDataJson = jest.fn(() => + Promise.resolve({ + payload: pageData, + status: `success`, + }) + ); + + const expectation = await prodLoader.loadPage(`/mypage`); + + expect(expectation).toMatchSnapshot(); + expect(Object.keys(expectation)).toEqual([ + `component`, + `json`, + `page`, + `staticQueryResults`, + ]); + + expect(prodLoader.pageDb.get(`/mypage`)).toEqual( + expect.objectContaining({ + payload: expectation, + status: `success`, + }), + ); + expect(emitter.emit).toHaveBeenCalledTimes(1); + expect(emitter.emit).toHaveBeenCalledWith(`onPostLoadPageResources`, { + page: expectation, + pageResources: expectation, + }); + }); + + it(`should set not found on finalResult`, async () => { + const asyncRequires = createAsyncRequires({ + chunk: () => Promise.resolve(`instance`), + }); + const prodLoader = new ProdLoader(asyncRequires, []); + const pageData = { + path: `/mypage/`, + componentChunkName: `chunk`, + }; + prodLoader.loadPageDataJson = jest.fn(() => + Promise.resolve({ + payload: pageData, + status: `success`, + notFound: true, + }) + ); + + await prodLoader.loadPage(`/mypage/`); + const expectation = prodLoader.pageDb.get(`/mypage`); + expect(expectation).toHaveProperty(`notFound`, true); + expect(emitter.emit).toHaveBeenCalledTimes(1); + expect(emitter.emit).toHaveBeenCalledWith(`onPostLoadPageResources`, { + page: expectation.payload, + pageResources: expectation.payload, + }); + }); + + it(`should return an error when component cannot be loaded`, async () => { + const asyncRequires = createAsyncRequires({ + chunk: () => Promise.resolve(false), + }); + const prodLoader = new ProdLoader(asyncRequires, []); + const pageData = { + path: `/mypage/`, + componentChunkName: `chunk`, + staticQueryHashes: [], + }; + prodLoader.loadPageDataJson = jest.fn(() => + Promise.resolve({ + payload: pageData, + status: `success`, + }) + ); + + await prodLoader.loadPage(`/mypage/`); + const expectation = prodLoader.pageDb.get(`/mypage`); + expect(expectation).toHaveProperty(`status`, `error`); + expect(emitter.emit).toHaveBeenCalledTimes(0); + }); + + it(`should return an error pageData contains an error`, async () => { + const asyncRequires = createAsyncRequires({ + chunk: () => Promise.resolve(`instance`), + }); + const prodLoader = new ProdLoader(asyncRequires, []); + const pageData = { + path: `/mypage/`, + componentChunkName: `chunk`, + staticQueryHashes: [], + }; + prodLoader.loadPageDataJson = jest.fn(() => + Promise.resolve({ + payload: pageData, + status: `error`, + }) + ); + + expect(await prodLoader.loadPage(`/mypage/`)).toEqual( + { status: `error` }, + ); + expect(prodLoader.pageDb.size).toBe(0); + expect(emitter.emit).toHaveBeenCalledTimes(0); + }); + + it(`should return an error when 404 cannot be fetched`, async () => { + const prodLoader = new ProdLoader(null, []); + + prodLoader.loadPageDataJson = jest.fn(() => + Promise.resolve({ + status: `error`, + }) + ); + + expect(await prodLoader.loadPage(`/404.html/`)).toEqual({ + status: `error`, + }); + expect(prodLoader.pageDb.size).toBe(0); + expect(emitter.emit).toHaveBeenCalledTimes(0); + }); + + it(`should cache the result of loadPage`, async () => { + const asyncRequires = createAsyncRequires({ + chunk: () => Promise.resolve(`instance`), + }); + const prodLoader = new ProdLoader(asyncRequires, []); + prodLoader.loadPageDataJson = jest.fn(() => + Promise.resolve({ + payload: { + componentChunkName: `chunk`, + staticQueryHashes: [], + }, + status: `success`, + }) + ); + + const expectation = await prodLoader.loadPage(`/mypage/`); + expect(await prodLoader.loadPage(`/mypage/`)).toBe(expectation); + expect(prodLoader.loadPageDataJson).toHaveBeenCalledTimes(1); + }); + + it(`should only run 1 network request even when called multiple times`, async () => { + const asyncRequires = createAsyncRequires({ + chunk: () => Promise.resolve(`instance`), + }); + const prodLoader = new ProdLoader(asyncRequires, []); + prodLoader.loadPageDataJson = jest.fn(() => + Promise.resolve({ + payload: { + componentChunkName: `chunk`, + staticQueryHashes: [], + }, + status: `success`, + }) + ); + + const loadPagePromise = prodLoader.loadPage(`/test-page/`); + expect(prodLoader.inFlightDb.size).toBe(1); + expect(prodLoader.loadPage(`/test-page/`)).toBe(loadPagePromise); + expect(prodLoader.inFlightDb.size).toBe(1); + + const expectation = await loadPagePromise; + + expect(prodLoader.inFlightDb.size).toBe(0); + expect(emitter.emit).toHaveBeenCalledTimes(1); + expect(emitter.emit).toHaveBeenCalledWith(`onPostLoadPageResources`, { + page: expectation, + pageResources: expectation, + }); + }); + }); + + describe(`loadPageSync`, () => { + it(`returns page resources when already fetched`, () => { + const prodLoader = new ProdLoader(null, []); + + prodLoader.pageDb.set(`/mypage`, { payload: true }); + expect(prodLoader.loadPageSync(`/mypage/`)).toBe(true); + }); + + it(`returns page resources when already fetched`, () => { + const prodLoader = new ProdLoader(null, []); + + expect(prodLoader.loadPageSync(`/mypage/`)).toBeUndefined(); + }); + }); + + describe(`prefetch`, () => { + const flushPromises = () => new Promise((resolve) => setImmediate(resolve)); + + it(`shouldn't prefetch when shouldPrefetch is false`, () => { + const prodLoader = new ProdLoader(null, []); + prodLoader.shouldPrefetch = jest.fn(() => false); + prodLoader.doPrefetch = jest.fn(); + prodLoader.apiRunner = jest.fn(); + + expect(prodLoader.prefetch(`/mypath/`)).toBe(false); + expect(prodLoader.shouldPrefetch).toHaveBeenCalledWith(`/mypath/`); + expect(prodLoader.apiRunner).not.toHaveBeenCalled(); + expect(prodLoader.doPrefetch).not.toHaveBeenCalled(); + }); + + it(`should trigger custom prefetch logic when core is disabled`, () => { + const prodLoader = new ProdLoader(null, []); + prodLoader.shouldPrefetch = jest.fn(() => true); + prodLoader.doPrefetch = jest.fn(); + prodLoader.apiRunner = jest.fn(); + prodLoader.prefetchDisabled = true; + + expect(prodLoader.prefetch(`/mypath/`)).toBe(false); + expect(prodLoader.shouldPrefetch).toHaveBeenCalledWith(`/mypath/`); + expect(prodLoader.apiRunner).toHaveBeenCalledWith(`onPrefetchPathname`, { + pathname: `/mypath/`, + }); + expect(prodLoader.doPrefetch).not.toHaveBeenCalled(); + }); + + it(`should prefetch when not yet triggered`, async () => { + jest.useFakeTimers(); + const prodLoader = new ProdLoader(null, []); + prodLoader.shouldPrefetch = jest.fn(() => true); + prodLoader.apiRunner = jest.fn(); + prodLoader.doPrefetch = jest.fn(() => Promise.resolve({})); + + expect(prodLoader.prefetch(`/mypath/`)).toBe(true); + + // wait for doPrefetchPromise + await flushPromises(); + + expect(prodLoader.apiRunner).toHaveBeenCalledWith(`onPrefetchPathname`, { + pathname: `/mypath/`, + }); + expect(prodLoader.apiRunner).toHaveBeenNthCalledWith( + 2, + `onPostPrefetchPathname`, + { + pathname: `/mypath/`, + }, + ); + }); + + it(`should only run apis once`, async () => { + const prodLoader = new ProdLoader(null, []); + prodLoader.shouldPrefetch = jest.fn(() => true); + prodLoader.apiRunner = jest.fn(); + prodLoader.doPrefetch = jest.fn(() => Promise.resolve({})); + + expect(prodLoader.prefetch(`/mypath/`)).toBe(true); + expect(prodLoader.prefetch(`/mypath/`)).toBe(true); + + // wait for doPrefetchPromise + await flushPromises(); + + expect(prodLoader.apiRunner).toHaveBeenCalledTimes(2); + expect(prodLoader.apiRunner).toHaveBeenNthCalledWith( + 1, + `onPrefetchPathname`, + expect.anything(), + ); + expect(prodLoader.apiRunner).toHaveBeenNthCalledWith( + 2, + `onPostPrefetchPathname`, + expect.anything(), + ); + }); + }); +}); diff --git a/docs/.cache/__tests__/minimal-config.js b/docs/.cache/__tests__/minimal-config.js new file mode 100644 index 000000000..eb86da800 --- /dev/null +++ b/docs/.cache/__tests__/minimal-config.js @@ -0,0 +1,32 @@ +const path = require(`path`); +const child = require(`child_process`); + +it(`Builds cache-dir with minimal config`, (done) => { + const args = [ + require.resolve(`@babel/cli/bin/babel.js`), + path.join(__dirname, `..`), + `--config-file`, + path.join(__dirname, `.babelrc`), + `--ignore`, + `**/__tests__`, + ]; + + const spawn = child.spawn(process.execPath, args); + + let stderr = ``; + let stdout = ``; + + spawn.stderr.on(`data`, function (chunk) { + stderr += chunk; + }); + + spawn.stdout.on(`data`, function (chunk) { + stdout += chunk; + }); + + spawn.on(`close`, function () { + expect(stderr).toEqual(``); + expect(stdout).not.toEqual(``); + done(); + }); +}, 30000); diff --git a/docs/.cache/__tests__/public-page-renderer-dev.tsx b/docs/.cache/__tests__/public-page-renderer-dev.tsx new file mode 100644 index 000000000..4787f1217 --- /dev/null +++ b/docs/.cache/__tests__/public-page-renderer-dev.tsx @@ -0,0 +1,42 @@ +import React from "react"; +import { render, cleanup } from "@testing-library/react"; + +jest.mock(`../loader`, () => { + return { + loadPageSync: jest.fn((path: string): { + loadPageSync: boolean; + path: string; + } => { + return { loadPageSync: true, path }; + }), + loadPage: function loadPage( + path: string, + ): Promise<{ loadPage: boolean; path: string }> { + return Promise.resolve({ loadPage: true, path }); + }, + }; +}); + +jest.mock(`../query-result-store`, () => { + return { + PageQueryStore: (): string => `PageQueryStore`, + }; +}); + +import DevPageRenderer from "../public-page-renderer-dev"; +import loader from "../loader"; + +describe(`DevPageRenderer`, () => { + it(`loads pages synchronously`, () => { + const location = { + pathname: `/`, + }; + render(); + + expect(loader.loadPageSync).toHaveBeenCalled(); + }); +}); + +afterAll(cleanup); + +afterAll(jest.clearAllMocks); diff --git a/docs/.cache/__tests__/public-page-renderer-prod.tsx b/docs/.cache/__tests__/public-page-renderer-prod.tsx new file mode 100644 index 000000000..adca4744a --- /dev/null +++ b/docs/.cache/__tests__/public-page-renderer-prod.tsx @@ -0,0 +1,38 @@ +import React from "react"; +import { render, cleanup } from "@testing-library/react"; + +jest.mock(`../loader`, () => { + return { + loadPageSync: jest.fn((path: string): { + loadPageSync: boolean; + path: string; + } => { + return { loadPageSync: true, path }; + }), + loadPage: function loadPage( + path: string, + ): Promise<{ loadPage: boolean; path: string }> { + return Promise.resolve({ loadPage: true, path }); + }, + }; +}); + +jest.mock(`../page-renderer`, (): string => `InternalPageRenderer`); + +import ProdPageRenderer from "../public-page-renderer-prod"; +import loader from "../loader"; + +describe(`ProdPageRenderer`, () => { + it(`loads pages synchronously`, () => { + const location = { + pathname: `/`, + }; + render(); + + expect(loader.loadPageSync).toHaveBeenCalled(); + }); +}); + +afterAll(cleanup); + +afterAll(jest.clearAllMocks); diff --git a/docs/.cache/__tests__/static-entry.js b/docs/.cache/__tests__/static-entry.js new file mode 100644 index 000000000..0fb0a783f --- /dev/null +++ b/docs/.cache/__tests__/static-entry.js @@ -0,0 +1,346 @@ +import React from "react"; +import fs from "fs"; +const { join } = require(`path`); + +import DevelopStaticEntry from "../develop-static-entry"; + +jest.mock(`fs`, () => { + const fs = jest.requireActual(`fs`); + return { + ...fs, + readFileSync: jest.fn(), + }; +}); +jest.mock(`gatsby/package.json`, () => { + return { + version: `2.0.0`, + }; +}); + +jest.mock( + `$virtual/sync-requires`, + () => { + return { + components: { + "page-component---src-pages-test-js": () => null, + }, + }; + }, + { + virtual: true, + }, +); + +const MOCK_FILE_INFO = { + [`${process.cwd()}/public/webpack.stats.json`]: `{}`, + [`${process.cwd()}/public/chunk-map.json`]: `{}`, + [ + join( + process.cwd(), + `/public/page-data/about/page-data.json`, + ) + ]: JSON.stringify({ + componentChunkName: `page-component---src-pages-test-js`, + path: `/about/`, + webpackCompilationHash: `1234567890abcdef1234`, + staticQueryHashes: [], + }), + [join(process.cwd(), `/public/page-data/app-data.json`)]: JSON.stringify({ + webpackCompilationHash: `1234567890abcdef1234`, + }), +}; + +let StaticEntry; +beforeEach(() => { + fs.readFileSync.mockImplementation((file) => MOCK_FILE_INFO[file]); + StaticEntry = require(`../static-entry`).default; +}); + +const reverseHeadersPlugin = { + plugin: { + onPreRenderHTML: ({ getHeadComponents, replaceHeadComponents }) => { + const headComponents = getHeadComponents(); + headComponents.reverse(); + replaceHeadComponents(headComponents); + }, + }, +}; + +const injectValuePlugin = (hookName, methodName, value) => { + return { + plugin: { + [hookName]: (staticEntry) => { + const method = staticEntry[methodName]; + method(value); + }, + }, + }; +}; + +const checkSanitized = (components) => { + expect(components.includes(null)).toBeFalsy(); + expect( + components.find((val) => Array.isArray(val) && val.length === 0), + ).toBeFalsy(); + expect(components.find((val) => Array.isArray(val))).toBeFalsy(); +}; + +const checkNonEmptyHeadersPlugin = { + plugin: { + onPreRenderHTML: ({ + getHeadComponents, + getPreBodyComponents, + getPostBodyComponents, + }) => { + const headComponents = getHeadComponents(); + const preBodyComponents = getPreBodyComponents(); + const postBodyComponents = getPostBodyComponents(); + checkSanitized(headComponents); + checkSanitized(preBodyComponents); + checkSanitized(postBodyComponents); + }, + }, +}; + +const fakeStylesPlugin = { + plugin: { + onRenderBody: ({ setHeadComponents }) => + setHeadComponents([ + , + , + , + ]), + }, +}; + +const reverseBodyComponentsPluginFactory = (type) => { + return { + plugin: { + onPreRenderHTML: (props) => { + const components = props[`get${type}BodyComponents`](); + components.reverse(); + props[`replace${type}BodyComponents`](components); + }, + }, + }; +}; + +const fakeComponentsPluginFactory = (type) => { + return { + plugin: { + onRenderBody: (props) => { + props[`set${type}BodyComponents`]([ +
div1
, +
div2
, +
div3
, + ]); + }, + }, + }; +}; + +describe(`develop-static-entry`, () => { + test(`onPreRenderHTML can be used to replace headComponents`, (done) => { + global.plugins = [fakeStylesPlugin, reverseHeadersPlugin]; + + DevelopStaticEntry(`/about/`, (_, html) => { + expect(html).toMatchSnapshot(); + done(); + }); + }); + + test(`onPreRenderHTML can be used to replace postBodyComponents`, (done) => { + global.plugins = [ + fakeComponentsPluginFactory(`Post`), + reverseBodyComponentsPluginFactory(`Post`), + ]; + + DevelopStaticEntry(`/about/`, (_, html) => { + expect(html).toMatchSnapshot(); + done(); + }); + }); + + test(`onPreRenderHTML can be used to replace preBodyComponents`, (done) => { + global.plugins = [ + fakeComponentsPluginFactory(`Pre`), + reverseBodyComponentsPluginFactory(`Pre`), + ]; + + DevelopStaticEntry(`/about/`, (_, html) => { + expect(html).toMatchSnapshot(); + done(); + }); + }); + + test(`onPreRenderHTML adds metatag note for development environment`, ( + done, + ) => { + DevelopStaticEntry(`/about/`, (_, html) => { + expect(html).toContain( + ``, + ); + done(); + }); + }); + + test(`onPreRenderHTML adds metatag note for development environment after replaceHeadComponents`, ( + done, + ) => { + global.plugins = [reverseHeadersPlugin]; + + DevelopStaticEntry(`/about/`, (_, html) => { + expect(html).toContain( + ``, + ); + done(); + }); + }); +}); + +describe(`static-entry sanity checks`, () => { + beforeEach(() => { + global.__PATH_PREFIX__ = ``; + global.__BASE_PATH__ = ``; + global.__ASSET_PREFIX__ = ``; + }); + + const methodsToCheck = [ + `replaceHeadComponents`, + `replacePreBodyComponents`, + `replacePostBodyComponents`, + ]; + + methodsToCheck.forEach((methodName) => { + test(`${methodName} can filter out null value`, (done) => { + const plugin = injectValuePlugin(`onPreRenderHTML`, methodName, null); + global.plugins = [plugin, checkNonEmptyHeadersPlugin]; + + StaticEntry(`/about/`, (_, html) => { + done(); + }); + }); + + test(`${methodName} can filter out null values`, (done) => { + const plugin = injectValuePlugin(`onPreRenderHTML`, methodName, [ + null, + null, + ]); + global.plugins = [plugin, checkNonEmptyHeadersPlugin]; + + StaticEntry(`/about/`, (_, html) => { + done(); + }); + }); + + test(`${methodName} can filter out empty array`, (done) => { + const plugin = injectValuePlugin(`onPreRenderHTML`, methodName, []); + global.plugins = [plugin, checkNonEmptyHeadersPlugin]; + + StaticEntry(`/about/`, (_, html) => { + done(); + }); + }); + + test(`${methodName} can filter out empty arrays`, (done) => { + const plugin = injectValuePlugin(`onPreRenderHTML`, methodName, [[], []]); + global.plugins = [plugin, checkNonEmptyHeadersPlugin]; + + StaticEntry(`/about/`, (_, html) => { + done(); + }); + }); + + test(`${methodName} can flatten arrays`, (done) => { + const plugin = injectValuePlugin(`onPreRenderHTML`, methodName, [ + , + , + , + [], + ]); + global.plugins = [plugin, checkNonEmptyHeadersPlugin]; + + StaticEntry(`/about/`, (_, html) => { + done(); + }); + }); + }); +}); + +describe(`static-entry`, () => { + beforeEach(() => { + global.__PATH_PREFIX__ = ``; + global.__BASE_PATH__ = ``; + fs.readFileSync.mockImplementation((file) => MOCK_FILE_INFO[file]); + }); + + test(`onPreRenderHTML can be used to replace headComponents`, (done) => { + global.plugins = [fakeStylesPlugin, reverseHeadersPlugin]; + + StaticEntry(`/about/`, (_, html) => { + expect(html).toMatchSnapshot(); + done(); + }); + }); + + test(`onPreRenderHTML can be used to replace postBodyComponents`, (done) => { + global.plugins = [ + fakeComponentsPluginFactory(`Post`), + reverseBodyComponentsPluginFactory(`Post`), + ]; + + StaticEntry(`/about/`, (_, html) => { + expect(html).toMatchSnapshot(); + done(); + }); + }); + + test(`onPreRenderHTML can be used to replace preBodyComponents`, (done) => { + global.plugins = [ + fakeComponentsPluginFactory(`Pre`), + reverseBodyComponentsPluginFactory(`Pre`), + ]; + + StaticEntry(`/about/`, (_, html) => { + expect(html).toMatchSnapshot(); + done(); + }); + }); + + test(`onPreRenderHTML does not add metatag note for development environment`, ( + done, + ) => { + StaticEntry(`/about/`, (_, html) => { + expect(html).not.toContain( + ``, + ); + done(); + }); + }); +}); + +describe(`sanitizeComponents`, () => { + let sanitizeComponents; + + beforeEach(() => { + fs.readFileSync.mockImplementation((file) => MOCK_FILE_INFO[file]); + sanitizeComponents = require(`../static-entry`).sanitizeComponents; + }); + + it(`strips assetPrefix for manifest link`, () => { + global.__PATH_PREFIX__ = `https://gatsbyjs.org/blog`; + global.__BASE_PATH__ = `/blog`; + global.__ASSET_PREFIX__ = `https://gatsbyjs.org`; + + const sanitizedComponents = sanitizeComponents([ + , + ]); + expect(sanitizedComponents[0].props.href).toBe( + `/blog/manifest.webmanifest`, + ); + }); +}); diff --git a/docs/.cache/__tests__/strip-prefix.js b/docs/.cache/__tests__/strip-prefix.js new file mode 100644 index 000000000..74fde7203 --- /dev/null +++ b/docs/.cache/__tests__/strip-prefix.js @@ -0,0 +1,31 @@ +const stripPrefix = require(`../strip-prefix`).default; + +describe(`strip-prefix`, () => { + it(`strips a prefix`, () => { + expect(stripPrefix(`/foo/bar/`, `/foo`)).toBe(`/bar/`); + }); + + it(`strips first instance only`, () => { + expect(stripPrefix(`/foo/foo/bar/`, `/foo`)).toBe(`/foo/bar/`); + }); + + it(`strips full instance only`, () => { + expect(stripPrefix(`/footest/`, `/foo`)).toBe(`/footest/`); + }); + + it(`ignores prefix appearing elsewhere in the string`, () => { + expect(stripPrefix(`/foo/bar/`, `bar`)).toBe(`/foo/bar/`); + }); + + it(`ignores a non-existent prefix`, () => { + expect(stripPrefix(`/bar`, `/foo`)).toBe(`/bar`); + }); + + it(`returns input str if no prefix is provided`, () => { + expect(stripPrefix(`/bar`)).toBe(`/bar`); + }); + + it(`returns "/" if str equals prefix`, () => { + expect(stripPrefix(`/bar`, `/bar`)).toBe(`/`); + }); +}); diff --git a/docs/.cache/api-runner-browser-plugins.js b/docs/.cache/api-runner-browser-plugins.js new file mode 100644 index 000000000..da6d0d553 --- /dev/null +++ b/docs/.cache/api-runner-browser-plugins.js @@ -0,0 +1,13 @@ +module.exports = [{ + plugin: require('../node_modules/gatsby-plugin-layout/gatsby-browser.js'), + options: {"plugins":[],"component":"/Users/Dr.Zishan/Desktop/idk/G4M3R/Discordeno/docs/src/templates/docs.js"}, + },{ + plugin: require('../node_modules/gatsby-plugin-mdx/gatsby-browser.js'), + options: {"plugins":[],"gatsbyRemarkPlugins":[{"resolve":"gatsby-remark-images","options":{"maxWidth":1035,"sizeByPixelDensity":true}},{"resolve":"gatsby-remark-copy-linked-files"}],"extensions":[".mdx",".md"]}, + },{ + plugin: require('../node_modules/gatsby-plugin-gtag/gatsby-browser.js'), + options: {"plugins":[],"trackingId":null,"head":true,"anonymize":false}, + },{ + plugin: require('../gatsby-browser.js'), + options: {"plugins":[]}, + }] diff --git a/docs/.cache/api-runner-browser.js b/docs/.cache/api-runner-browser.js new file mode 100644 index 000000000..a4dd29b5e --- /dev/null +++ b/docs/.cache/api-runner-browser.js @@ -0,0 +1,61 @@ +const plugins = require(`./api-runner-browser-plugins`); +const { + getResourcesForPathname, + getResourcesForPathnameSync, + getResourceURLsForPathname, + loadPage, + loadPageSync, +} = require(`./loader`).publicLoader; + +exports.apiRunner = (api, args = {}, defaultReturn, argTransform) => { + // Hooks for gatsby-cypress's API handler + if (process.env.CYPRESS_SUPPORT) { + if (window.___apiHandler) { + window.___apiHandler(api); + } else if (window.___resolvedAPIs) { + window.___resolvedAPIs.push(api); + } else { + window.___resolvedAPIs = [api]; + } + } + + let results = plugins.map((plugin) => { + if (!plugin.plugin[api]) { + return undefined; + } + + // Deprecated April 2019. Use `loadPageSync` instead + args.getResourcesForPathnameSync = getResourcesForPathnameSync; + // Deprecated April 2019. Use `loadPage` instead + args.getResourcesForPathname = getResourcesForPathname; + args.getResourceURLsForPathname = getResourceURLsForPathname; + args.loadPage = loadPage; + args.loadPageSync = loadPageSync; + + const result = plugin.plugin[api](args, plugin.options); + if (result && argTransform) { + args = argTransform({ args, result, plugin }); + } + return result; + }); + + // Filter out undefined results. + results = results.filter((result) => typeof result !== `undefined`); + + if (results.length > 0) { + return results; + } else if (defaultReturn) { + return [defaultReturn]; + } else { + return []; + } +}; + +exports.apiRunnerAsync = (api, args, defaultReturn) => + plugins.reduce( + (previous, next) => + next.plugin[api] + ? previous.then(() => next.plugin[api](args, next.options)) + : previous, + Promise.resolve(), + ); diff --git a/docs/.cache/api-runner-ssr.js b/docs/.cache/api-runner-ssr.js new file mode 100644 index 000000000..8fbc162e9 --- /dev/null +++ b/docs/.cache/api-runner-ssr.js @@ -0,0 +1,58 @@ +var plugins = [{ + plugin: require('/Users/Dr.Zishan/Desktop/idk/G4M3R/Discordeno/docs/node_modules/gatsby-plugin-sitemap/gatsby-ssr'), + options: {"plugins":[]}, + },{ + plugin: require('/Users/Dr.Zishan/Desktop/idk/G4M3R/Discordeno/docs/node_modules/gatsby-plugin-layout/gatsby-ssr'), + options: {"plugins":[],"component":"/Users/Dr.Zishan/Desktop/idk/G4M3R/Discordeno/docs/src/templates/docs.js"}, + },{ + plugin: require('/Users/Dr.Zishan/Desktop/idk/G4M3R/Discordeno/docs/node_modules/gatsby-plugin-react-helmet/gatsby-ssr'), + options: {"plugins":[]}, + },{ + plugin: require('/Users/Dr.Zishan/Desktop/idk/G4M3R/Discordeno/docs/node_modules/gatsby-plugin-mdx/gatsby-ssr'), + options: {"plugins":[],"gatsbyRemarkPlugins":[{"resolve":"gatsby-remark-images","options":{"maxWidth":1035,"sizeByPixelDensity":true}},{"resolve":"gatsby-remark-copy-linked-files"}],"extensions":[".mdx",".md"]}, + },{ + plugin: require('/Users/Dr.Zishan/Desktop/idk/G4M3R/Discordeno/docs/node_modules/gatsby-plugin-gtag/gatsby-ssr'), + options: {"plugins":[],"trackingId":null,"head":true,"anonymize":false}, + }] +// During bootstrap, we write requires at top of this file which looks like: +// var plugins = [ +// { +// plugin: require("/path/to/plugin1/gatsby-ssr.js"), +// options: { ... }, +// }, +// { +// plugin: require("/path/to/plugin2/gatsby-ssr.js"), +// options: { ... }, +// }, +// ] + +const apis = require(`./api-ssr-docs`); + +// Run the specified API in any plugins that have implemented it +module.exports = (api, args, defaultReturn, argTransform) => { + if (!apis[api]) { + console.log(`This API doesn't exist`, api); + } + + // Run each plugin in series. + // eslint-disable-next-line no-undef + let results = plugins.map((plugin) => { + if (!plugin.plugin[api]) { + return undefined; + } + const result = plugin.plugin[api](args, plugin.options); + if (result && argTransform) { + args = argTransform({ args, result }); + } + return result; + }); + + // Filter out undefined results. + results = results.filter((result) => typeof result !== `undefined`); + + if (results.length > 0) { + return results; + } else { + return [defaultReturn]; + } +}; diff --git a/docs/.cache/api-ssr-docs.js b/docs/.cache/api-ssr-docs.js new file mode 100644 index 000000000..ee0671eff --- /dev/null +++ b/docs/.cache/api-ssr-docs.js @@ -0,0 +1,198 @@ +/** + * Object containing options defined in `gatsby-config.js` + * @typedef {object} pluginOptions + */ + +/** + * Replace the default server renderer. This is useful for integration with + * Redux, css-in-js libraries, etc. that need custom setups for server + * rendering. + * @param {object} $0 + * @param {string} $0.pathname The pathname of the page currently being rendered. + * @param {function} $0.replaceBodyHTMLString Call this with the HTML string + * you render. **WARNING** if multiple plugins implement this API it's the + * last plugin that "wins". TODO implement an automated warning against this. + * @param {function} $0.setHeadComponents Takes an array of components as its + * first argument which are added to the `headComponents` array which is passed + * to the `html.js` component. + * @param {function} $0.setHtmlAttributes Takes an object of props which will + * spread into the `` component. + * @param {function} $0.setBodyAttributes Takes an object of props which will + * spread into the `` component. + * @param {function} $0.setPreBodyComponents Takes an array of components as its + * first argument which are added to the `preBodyComponents` array which is passed + * to the `html.js` component. + * @param {function} $0.setPostBodyComponents Takes an array of components as its + * first argument which are added to the `postBodyComponents` array which is passed + * to the `html.js` component. + * @param {function} $0.setBodyProps Takes an object of data which + * is merged with other body props and passed to `html.js` as `bodyProps`. + * @param {pluginOptions} pluginOptions + * @example + * // From gatsby-plugin-glamor + * const { renderToString } = require("react-dom/server") + * const inline = require("glamor-inline") + * + * exports.replaceRenderer = ({ bodyComponent, replaceBodyHTMLString }) => { + * const bodyHTML = renderToString(bodyComponent) + * const inlinedHTML = inline(bodyHTML) + * + * replaceBodyHTMLString(inlinedHTML) + * } + */ +exports.replaceRenderer = true; + +/** + * Called after every page Gatsby server renders while building HTML so you can + * set head and body components to be rendered in your `html.js`. + * + * Gatsby does a two-pass render for HTML. It loops through your pages first + * rendering only the body and then takes the result body HTML string and + * passes it as the `body` prop to your `html.js` to complete the render. + * + * It's often handy to be able to send custom components to your `html.js`. + * For example, it's a very common pattern for React.js libraries that + * support server rendering to pull out data generated during the render to + * add to your HTML. + * + * Using this API over [`replaceRenderer`](#replaceRenderer) is preferable as + * multiple plugins can implement this API where only one plugin can take + * over server rendering. However, if your plugin requires taking over server + * rendering then that's the one to + * use + * @param {object} $0 + * @param {string} $0.pathname The pathname of the page currently being rendered. + * @param {function} $0.setHeadComponents Takes an array of components as its + * first argument which are added to the `headComponents` array which is passed + * to the `html.js` component. + * @param {function} $0.setHtmlAttributes Takes an object of props which will + * spread into the `` component. + * @param {function} $0.setBodyAttributes Takes an object of props which will + * spread into the `` component. + * @param {function} $0.setPreBodyComponents Takes an array of components as its + * first argument which are added to the `preBodyComponents` array which is passed + * to the `html.js` component. + * @param {function} $0.setPostBodyComponents Takes an array of components as its + * first argument which are added to the `postBodyComponents` array which is passed + * to the `html.js` component. + * @param {function} $0.setBodyProps Takes an object of data which + * is merged with other body props and passed to `html.js` as `bodyProps`. + * @param {pluginOptions} pluginOptions + * @example + * const { Helmet } = require("react-helmet") + * + * exports.onRenderBody = ( + * { setHeadComponents, setHtmlAttributes, setBodyAttributes }, + * pluginOptions + * ) => { + * const helmet = Helmet.renderStatic() + * setHtmlAttributes(helmet.htmlAttributes.toComponent()) + * setBodyAttributes(helmet.bodyAttributes.toComponent()) + * setHeadComponents([ + * helmet.title.toComponent(), + * helmet.link.toComponent(), + * helmet.meta.toComponent(), + * helmet.noscript.toComponent(), + * helmet.script.toComponent(), + * helmet.style.toComponent(), + * ]) + * } + */ +exports.onRenderBody = true; + +/** + * Called after every page Gatsby server renders while building HTML so you can + * replace head components to be rendered in your `html.js`. This is useful if + * you need to reorder scripts or styles added by other plugins. + * @param {object} $0 + * @param {string} $0.pathname The pathname of the page currently being rendered. + * @param {Array} $0.getHeadComponents Returns the current `headComponents` array. + * @param {function} $0.replaceHeadComponents Takes an array of components as its + * first argument which replace the `headComponents` array which is passed + * to the `html.js` component. **WARNING** if multiple plugins implement this + * API it's the last plugin that "wins". + * @param {Array} $0.getPreBodyComponents Returns the current `preBodyComponents` array. + * @param {function} $0.replacePreBodyComponents Takes an array of components as its + * first argument which replace the `preBodyComponents` array which is passed + * to the `html.js` component. **WARNING** if multiple plugins implement this + * API it's the last plugin that "wins". + * @param {Array} $0.getPostBodyComponents Returns the current `postBodyComponents` array. + * @param {function} $0.replacePostBodyComponents Takes an array of components as its + * first argument which replace the `postBodyComponents` array which is passed + * to the `html.js` component. **WARNING** if multiple plugins implement this + * API it's the last plugin that "wins". + * @param {pluginOptions} pluginOptions + * @example + * // Move Typography.js styles to the top of the head section so they're loaded first. + * exports.onPreRenderHTML = ({ getHeadComponents, replaceHeadComponents }) => { + * const headComponents = getHeadComponents() + * headComponents.sort((x, y) => { + * if (x.key === 'TypographyStyle') { + * return -1 + * } else if (y.key === 'TypographyStyle') { + * return 1 + * } + * return 0 + * }) + * replaceHeadComponents(headComponents) + * } + */ +exports.onPreRenderHTML = true; + +/** + * Allow a plugin to wrap the page element. + * + * This is useful for setting wrapper components around pages that won't get + * unmounted on page changes. For setting Provider components, use [wrapRootElement](#wrapRootElement). + * + * _Note:_ + * There is an equivalent hook in Gatsby's [Browser API](/docs/browser-apis/#wrapPageElement). + * It is recommended to use both APIs together. + * For example usage, check out [Using i18n](https://github.com/gatsbyjs/gatsby/tree/master/examples/using-i18n). + * @param {object} $0 + * @param {ReactNode} $0.element The "Page" React Element built by Gatsby. + * @param {object} $0.props Props object used by page. + * @param {pluginOptions} pluginOptions + * @returns {ReactNode} Wrapped element + * @example + * const React = require("react") + * const Layout = require("./src/components/layout").default + * + * exports.wrapPageElement = ({ element, props }) => { + * // props provide same data to Layout as Page element will get + * // including location, data, etc - you don't need to pass it + * return {element} + * } + */ +exports.wrapPageElement = true; + +/** + * Allow a plugin to wrap the root element. + * + * This is useful to set up any Provider components that will wrap your application. + * For setting persistent UI elements around pages use [wrapPageElement](#wrapPageElement). + * + * _Note:_ + * There is an equivalent hook in Gatsby's [Browser API](/docs/browser-apis/#wrapRootElement). + * It is recommended to use both APIs together. + * For example usage, check out [Using redux](https://github.com/gatsbyjs/gatsby/tree/master/examples/using-redux). + * @param {object} $0 + * @param {ReactNode} $0.element The "Root" React Element built by Gatsby. + * @param {pluginOptions} pluginOptions + * @returns {ReactNode} Wrapped element + * @example + * const React = require("react") + * const { Provider } = require("react-redux") + * + * const createStore = require("./src/state/createStore") + * const store = createStore() + * + * exports.wrapRootElement = ({ element }) => { + * return ( + * + * {element} + * + * ) + * } + */ +exports.wrapRootElement = true; diff --git a/docs/.cache/app.js b/docs/.cache/app.js new file mode 100644 index 000000000..b75c59f6f --- /dev/null +++ b/docs/.cache/app.js @@ -0,0 +1,100 @@ +import React from "react"; +import ReactDOM from "react-dom"; +import domReady from "@mikaelkristiansson/domready"; +import io from "socket.io-client"; + +import socketIo from "./socketIo"; +import emitter from "./emitter"; +import { apiRunner, apiRunnerAsync } from "./api-runner-browser"; +import { setLoader, publicLoader } from "./loader"; +import DevLoader from "./dev-loader"; +import syncRequires from "$virtual/sync-requires"; +// Generated during bootstrap +import matchPaths from "$virtual/match-paths.json"; + +window.___emitter = emitter; + +const loader = new DevLoader(syncRequires, matchPaths); +setLoader(loader); +loader.setApiRunner(apiRunner); + +window.___loader = publicLoader; + +// Let the site/plugins run code very early. +apiRunnerAsync(`onClientEntry`).then(() => { + // Hook up the client to socket.io on server + const socket = socketIo(); + if (socket) { + socket.on(`reload`, () => { + window.location.reload(); + }); + } + + fetch(`/___services`) + .then((res) => res.json()) + .then((services) => { + if (services.developstatusserver) { + const parentSocket = io( + `http://${window.location.hostname}:${services.developstatusserver.port}`, + ); + + parentSocket.on(`develop:needs-restart`, (msg) => { + if ( + window.confirm( + `The develop process needs to be restarted for the changes to ${msg.dirtyFile} to be applied.\nDo you want to restart the develop process now?`, + ) + ) { + parentSocket.once(`develop:is-starting`, (msg) => { + window.location.reload(); + }); + parentSocket.once(`develop:started`, (msg) => { + window.location.reload(); + }); + parentSocket.emit(`develop:restart`); + } + }); + } + }); + + /** + * Service Workers are persistent by nature. They stick around, + * serving a cached version of the site if they aren't removed. + * This is especially frustrating when you need to test the + * production build on your local machine. + * + * Let's warn if we find service workers in development. + */ + if (`serviceWorker` in navigator) { + navigator.serviceWorker.getRegistrations().then((registrations) => { + if (registrations.length > 0) { + console.warn( + `Warning: found one or more service workers present.`, + `If your site isn't behaving as expected, you might want to remove these.`, + registrations, + ); + } + }); + } + + const rootElement = document.getElementById(`___gatsby`); + + const renderer = apiRunner( + `replaceHydrateFunction`, + undefined, + ReactDOM.render, + )[0]; + + Promise.all([ + loader.loadPage(`/dev-404-page/`), + loader.loadPage(`/404.html`), + loader.loadPage(window.location.pathname), + ]).then(() => { + const preferDefault = (m) => (m && m.default) || m; + let Root = preferDefault(require(`./root`)); + domReady(() => { + renderer(, rootElement, () => { + apiRunner(`onInitialClientRender`); + }); + }); + }); +}); diff --git a/docs/.cache/async-requires.js b/docs/.cache/async-requires.js new file mode 100644 index 000000000..6b584ac57 --- /dev/null +++ b/docs/.cache/async-requires.js @@ -0,0 +1,8 @@ +// prefer default export if available +const preferDefault = m => m && m.default || m + +exports.components = { + "component---cache-dev-404-page-js": () => import("./../../.cache/dev-404-page.js" /* webpackChunkName: "component---cache-dev-404-page-js" */), + "component---src-templates-docs-js": () => import("./../../src/templates/docs.js" /* webpackChunkName: "component---src-templates-docs-js" */) +} + diff --git a/docs/.cache/babelState.json b/docs/.cache/babelState.json new file mode 100644 index 000000000..e5970a959 --- /dev/null +++ b/docs/.cache/babelState.json @@ -0,0 +1,184 @@ +{ + "stages": { + "develop": { + "plugins": [ + { + "name": "/Users/Dr.Zishan/Desktop/idk/G4M3R/Discordeno/docs/node_modules/@babel/plugin-proposal-object-rest-spread/lib/index.js", + "options": {} + }, + { + "name": "@babel/plugin-proposal-export-default-from", + "options": {} + }, + { + "name": "/Users/Dr.Zishan/Desktop/idk/G4M3R/Discordeno/docs/node_modules/@babel/plugin-proposal-optional-chaining/lib/index.js", + "options": {} + }, + { + "name": "/Users/Dr.Zishan/Desktop/idk/G4M3R/Discordeno/docs/node_modules/@babel/plugin-proposal-nullish-coalescing-operator/lib/index.js", + "options": {} + }, + { + "name": "/Users/Dr.Zishan/Desktop/idk/G4M3R/Discordeno/docs/node_modules/@babel/plugin-proposal-numeric-separator/lib/index.js", + "options": {} + } + ], + "presets": [ + { + "name": "/Users/Dr.Zishan/Desktop/idk/G4M3R/Discordeno/docs/node_modules/@emotion/babel-preset-css-prop/dist/babel-preset-css-prop.cjs.js", + "options": { + "sourceMap": true, + "autoLabel": true, + "plugins": [] + } + }, + { + "name": "/Users/Dr.Zishan/Desktop/idk/G4M3R/Discordeno/docs/node_modules/@babel/preset-typescript/lib/index.js", + "options": { + "plugins": [] + } + } + ], + "options": { + "cacheDirectory": true, + "sourceType": "unambiguous" + } + }, + "develop-html": { + "plugins": [ + { + "name": "/Users/Dr.Zishan/Desktop/idk/G4M3R/Discordeno/docs/node_modules/@babel/plugin-proposal-object-rest-spread/lib/index.js", + "options": {} + }, + { + "name": "@babel/plugin-proposal-export-default-from", + "options": {} + }, + { + "name": "/Users/Dr.Zishan/Desktop/idk/G4M3R/Discordeno/docs/node_modules/@babel/plugin-proposal-optional-chaining/lib/index.js", + "options": {} + }, + { + "name": "/Users/Dr.Zishan/Desktop/idk/G4M3R/Discordeno/docs/node_modules/@babel/plugin-proposal-nullish-coalescing-operator/lib/index.js", + "options": {} + }, + { + "name": "/Users/Dr.Zishan/Desktop/idk/G4M3R/Discordeno/docs/node_modules/@babel/plugin-proposal-numeric-separator/lib/index.js", + "options": {} + } + ], + "presets": [ + { + "name": "/Users/Dr.Zishan/Desktop/idk/G4M3R/Discordeno/docs/node_modules/@emotion/babel-preset-css-prop/dist/babel-preset-css-prop.cjs.js", + "options": { + "sourceMap": true, + "autoLabel": true, + "plugins": [] + } + }, + { + "name": "/Users/Dr.Zishan/Desktop/idk/G4M3R/Discordeno/docs/node_modules/@babel/preset-typescript/lib/index.js", + "options": { + "plugins": [] + } + } + ], + "options": { + "cacheDirectory": true, + "sourceType": "unambiguous" + } + }, + "build-html": { + "plugins": [ + { + "name": "/Users/Dr.Zishan/Desktop/idk/G4M3R/Discordeno/docs/node_modules/@babel/plugin-proposal-object-rest-spread/lib/index.js", + "options": {} + }, + { + "name": "@babel/plugin-proposal-export-default-from", + "options": {} + }, + { + "name": "/Users/Dr.Zishan/Desktop/idk/G4M3R/Discordeno/docs/node_modules/@babel/plugin-proposal-optional-chaining/lib/index.js", + "options": {} + }, + { + "name": "/Users/Dr.Zishan/Desktop/idk/G4M3R/Discordeno/docs/node_modules/@babel/plugin-proposal-nullish-coalescing-operator/lib/index.js", + "options": {} + }, + { + "name": "/Users/Dr.Zishan/Desktop/idk/G4M3R/Discordeno/docs/node_modules/@babel/plugin-proposal-numeric-separator/lib/index.js", + "options": {} + } + ], + "presets": [ + { + "name": "/Users/Dr.Zishan/Desktop/idk/G4M3R/Discordeno/docs/node_modules/@emotion/babel-preset-css-prop/dist/babel-preset-css-prop.cjs.js", + "options": { + "sourceMap": true, + "autoLabel": true, + "plugins": [] + } + }, + { + "name": "/Users/Dr.Zishan/Desktop/idk/G4M3R/Discordeno/docs/node_modules/@babel/preset-typescript/lib/index.js", + "options": { + "plugins": [] + } + } + ], + "options": { + "cacheDirectory": true, + "sourceType": "unambiguous" + } + }, + "build-javascript": { + "plugins": [ + { + "name": "/Users/Dr.Zishan/Desktop/idk/G4M3R/Discordeno/docs/node_modules/@babel/plugin-proposal-object-rest-spread/lib/index.js", + "options": {} + }, + { + "name": "@babel/plugin-proposal-export-default-from", + "options": {} + }, + { + "name": "/Users/Dr.Zishan/Desktop/idk/G4M3R/Discordeno/docs/node_modules/@babel/plugin-proposal-optional-chaining/lib/index.js", + "options": {} + }, + { + "name": "/Users/Dr.Zishan/Desktop/idk/G4M3R/Discordeno/docs/node_modules/@babel/plugin-proposal-nullish-coalescing-operator/lib/index.js", + "options": {} + }, + { + "name": "/Users/Dr.Zishan/Desktop/idk/G4M3R/Discordeno/docs/node_modules/@babel/plugin-proposal-numeric-separator/lib/index.js", + "options": {} + } + ], + "presets": [ + { + "name": "/Users/Dr.Zishan/Desktop/idk/G4M3R/Discordeno/docs/node_modules/@emotion/babel-preset-css-prop/dist/babel-preset-css-prop.cjs.js", + "options": { + "sourceMap": true, + "autoLabel": true, + "plugins": [] + } + }, + { + "name": "/Users/Dr.Zishan/Desktop/idk/G4M3R/Discordeno/docs/node_modules/@babel/preset-typescript/lib/index.js", + "options": { + "plugins": [] + } + } + ], + "options": { + "cacheDirectory": true, + "sourceType": "unambiguous" + } + } + }, + "browserslist": [ + ">0.25%", + "not dead" + ] +} \ No newline at end of file diff --git a/docs/.cache/caches/gatsby-plugin-mdx/diskstore-0185e0f001d1a2df3cc96621404f18fd.json b/docs/.cache/caches/gatsby-plugin-mdx/diskstore-0185e0f001d1a2df3cc96621404f18fd.json new file mode 100644 index 000000000..8a7756aa6 --- /dev/null +++ b/docs/.cache/caches/gatsby-plugin-mdx/diskstore-0185e0f001d1a2df3cc96621404f18fd.json @@ -0,0 +1 @@ +{"expireTime":9007200851642145000,"key":"gatsby-plugin-mdx-entire-payload-98963df7e66f2c09770523a07552c8ee-","val":{"mdast":{"type":"root","children":[{"type":"paragraph","children":[{"type":"text","value":"Woah! You are almost half way done with understanding all of Discordeno. Amazing isn't it? Something you may have noticed in the last section was when the bot started up you could see a bunch of messages like ","position":{"start":{"line":2,"column":1,"offset":1},"end":{"line":2,"column":210,"offset":210},"indent":[]}},{"type":"inlineCode","value":"Loaded X Commands","position":{"start":{"line":2,"column":210,"offset":210},"end":{"line":2,"column":229,"offset":229},"indent":[]}},{"type":"text","value":" and such. Let's jump into this part now and understand how event handling works in Discordeno.","position":{"start":{"line":2,"column":229,"offset":229},"end":{"line":2,"column":324,"offset":324},"indent":[]}}],"position":{"start":{"line":2,"column":1,"offset":1},"end":{"line":2,"column":324,"offset":324},"indent":[]}},{"type":"heading","depth":2,"children":[{"type":"text","value":"What Is An Event?","position":{"start":{"line":4,"column":4,"offset":329},"end":{"line":4,"column":21,"offset":346},"indent":[]}}],"position":{"start":{"line":4,"column":1,"offset":326},"end":{"line":4,"column":21,"offset":346},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"An event in Discordeno is a function that can be called when a specific event occurs. For the most part, events will usually be the ones that are available from Discordeno. However, you can create your own custom events as well if you wish.","position":{"start":{"line":6,"column":1,"offset":348},"end":{"line":6,"column":241,"offset":588},"indent":[]}}],"position":{"start":{"line":6,"column":1,"offset":348},"end":{"line":6,"column":241,"offset":588},"indent":[]}},{"type":"heading","depth":2,"children":[{"type":"text","value":"Understanding The Events","position":{"start":{"line":8,"column":4,"offset":593},"end":{"line":8,"column":28,"offset":617},"indent":[]}}],"position":{"start":{"line":8,"column":1,"offset":590},"end":{"line":8,"column":28,"offset":617},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"Go ahead and open up the ","position":{"start":{"line":10,"column":1,"offset":619},"end":{"line":10,"column":26,"offset":644},"indent":[]}},{"type":"inlineCode","value":"src/events/ready.ts","position":{"start":{"line":10,"column":26,"offset":644},"end":{"line":10,"column":47,"offset":665},"indent":[]}},{"type":"text","value":" file. When you open this file, you will see the code that is triggered on the ","position":{"start":{"line":10,"column":47,"offset":665},"end":{"line":10,"column":126,"offset":744},"indent":[]}},{"type":"inlineCode","value":"ready","position":{"start":{"line":10,"column":126,"offset":744},"end":{"line":10,"column":133,"offset":751},"indent":[]}},{"type":"text","value":" event. Whenever the bot completely starts up, Discordeno emits the ","position":{"start":{"line":10,"column":133,"offset":751},"end":{"line":10,"column":201,"offset":819},"indent":[]}},{"type":"inlineCode","value":"ready","position":{"start":{"line":10,"column":201,"offset":819},"end":{"line":10,"column":208,"offset":826},"indent":[]}},{"type":"text","value":" event. This is when this code will be run allowing you to log these messages.","position":{"start":{"line":10,"column":208,"offset":826},"end":{"line":10,"column":286,"offset":904},"indent":[]}}],"position":{"start":{"line":10,"column":1,"offset":619},"end":{"line":10,"column":286,"offset":904},"indent":[]}},{"type":"code","lang":"ts","meta":null,"value":"import { botCache } from \"../../mod.ts\";\nimport { cache } from \"https://raw.githubusercontent.com/Skillz4Killz/Discordeno/v7/src/utils/cache.ts\";\nimport logger from \"https://raw.githubusercontent.com/Skillz4Killz/Discordeno/v7/src/utils/logger.ts\";\n\nbotCache.eventHandlers.ready = function () {\n logger.info(`Loaded ${botCache.arguments.size} Argument(s)`);\n logger.info(`Loaded ${botCache.commands.size} Command(s)`);\n logger.info(`Loaded ${Object.keys(botCache.eventHandlers).length} Event(s)`);\n logger.info(`Loaded ${botCache.inhibitors.size} Inhibitor(s)`);\n logger.info(`Loaded ${botCache.monitors.size} Monitor(s)`);\n logger.info(`Loaded ${botCache.tasks.size} Task(s)`);\n\n logger.success(\n `[READY] Bot is online and ready in ${cache.guilds.size} guild(s)!`,\n );\n};","position":{"start":{"line":12,"column":1,"offset":906},"end":{"line":29,"column":4,"offset":1700},"indent":[1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1]}},{"type":"paragraph","children":[{"type":"text","value":"Overall, this code is pretty self-explanatory. When the bot is ready, it logs all these things to the console for you.","position":{"start":{"line":31,"column":1,"offset":1702},"end":{"line":31,"column":119,"offset":1820},"indent":[]}}],"position":{"start":{"line":31,"column":1,"offset":1702},"end":{"line":31,"column":119,"offset":1820},"indent":[]}},{"type":"heading","depth":2,"children":[{"type":"text","value":"Creating A Custom Event","position":{"start":{"line":33,"column":4,"offset":1825},"end":{"line":33,"column":27,"offset":1848},"indent":[]}}],"position":{"start":{"line":33,"column":1,"offset":1822},"end":{"line":33,"column":27,"offset":1848},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"Make a new file in the events folder called ","position":{"start":{"line":35,"column":1,"offset":1850},"end":{"line":35,"column":45,"offset":1894},"indent":[]}},{"type":"inlineCode","value":"discordLog.ts","position":{"start":{"line":35,"column":45,"offset":1894},"end":{"line":35,"column":60,"offset":1909},"indent":[]}},{"type":"text","value":" that will send a message to a discord channel whenever we get an error so we don't need to always be watching the console to see errors. Once you made the file, go ahead and paste the base event snippet below.","position":{"start":{"line":35,"column":60,"offset":1909},"end":{"line":35,"column":270,"offset":2119},"indent":[]}}],"position":{"start":{"line":35,"column":1,"offset":1850},"end":{"line":35,"column":270,"offset":2119},"indent":[]}},{"type":"code","lang":"ts","meta":null,"value":"import { botCache } from \"../../mod.ts\";\n\nbotCache.eventHandlers.eventname = function () {\n // Your code goes here\n};","position":{"start":{"line":37,"column":1,"offset":2121},"end":{"line":43,"column":4,"offset":2249},"indent":[1,1,1,1,1,1]}},{"type":"list","ordered":false,"start":null,"spread":false,"children":[{"type":"listItem","spread":false,"checked":null,"children":[{"type":"paragraph","children":[{"type":"text","value":"Change the event name to ","position":{"start":{"line":45,"column":3,"offset":2253},"end":{"line":45,"column":28,"offset":2278},"indent":[]}},{"type":"inlineCode","value":"discordLog","position":{"start":{"line":45,"column":28,"offset":2278},"end":{"line":45,"column":40,"offset":2290},"indent":[]}}],"position":{"start":{"line":45,"column":3,"offset":2253},"end":{"line":45,"column":40,"offset":2290},"indent":[]}}],"position":{"start":{"line":45,"column":1,"offset":2251},"end":{"line":45,"column":40,"offset":2290},"indent":[]}},{"type":"listItem","spread":false,"checked":null,"children":[{"type":"paragraph","children":[{"type":"text","value":"Go to ","position":{"start":{"line":46,"column":3,"offset":2293},"end":{"line":46,"column":9,"offset":2299},"indent":[]}},{"type":"inlineCode","value":"src/types/events.ts","position":{"start":{"line":46,"column":9,"offset":2299},"end":{"line":46,"column":30,"offset":2320},"indent":[]}},{"type":"text","value":" and add in the following code so it looks like this:","position":{"start":{"line":46,"column":30,"offset":2320},"end":{"line":46,"column":83,"offset":2373},"indent":[]}}],"position":{"start":{"line":46,"column":3,"offset":2293},"end":{"line":46,"column":83,"offset":2373},"indent":[]}}],"position":{"start":{"line":46,"column":1,"offset":2291},"end":{"line":46,"column":83,"offset":2373},"indent":[]}}],"position":{"start":{"line":45,"column":1,"offset":2251},"end":{"line":46,"column":83,"offset":2373},"indent":[1]}},{"type":"code","lang":"ts","meta":null,"value":"// This interface is a placeholder that allows you to easily add on custom events for your need.\nexport interface CustomEvents extends EventHandlers {\n discordLog: () => unknown;\n}","position":{"start":{"line":48,"column":1,"offset":2375},"end":{"line":53,"column":4,"offset":2566},"indent":[1,1,1,1,1]}},{"type":"paragraph","children":[{"type":"text","value":"Awesome, now we can get started on adding the code.","position":{"start":{"line":55,"column":1,"offset":2568},"end":{"line":55,"column":52,"offset":2619},"indent":[]}}],"position":{"start":{"line":55,"column":1,"offset":2568},"end":{"line":55,"column":52,"offset":2619},"indent":[]}},{"type":"code","lang":"ts","meta":null,"value":"import { botCache } from \"../../mod.ts\";\nimport { Embed } from \"../utils/Embed.ts\";\nimport { cache } from \"../../deps.ts\";\nimport { configs } from \"../../configs.ts\";\nimport { sendMessage } from \"https://raw.githubusercontent.com/Skillz4Killz/Discordeno/v7/src/handlers/channel.ts\";\nimport { sendEmbed } from \"../utils/helpers.ts\";\n\nbotCache.eventHandlers.discordLog = function (error) {\n const embed = new Embed()\n .setDescription([\n \"```ts\",\n error,\n \"```\",\n ].join(\"\\n\"))\n .setTimestamp();\n\n // Get the channel we need to send this error to\n const errorChannel = cache.channels.get(configs.channelIDs.errorChannelID);\n // If the channel is not found cancel out\n if (!errorChannel) return;\n\n // Send the message\n return sendEmbed(errorChannel, embed);\n};","position":{"start":{"line":57,"column":1,"offset":2621},"end":{"line":82,"column":4,"offset":3418},"indent":[1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1]}},{"type":"paragraph","children":[{"type":"text","value":"Now that we have fully covered events, it would be a good time to get some practice here. Feel free to make more events that you would like in your bot. The following is a list of all the events available to you by the library at the time of writing this guide. There may be more or some may have been removed. I'll try to keep this updated but either way, VSC will let you know through autocompletion what is and isn't available.","position":{"start":{"line":84,"column":1,"offset":3420},"end":{"line":84,"column":431,"offset":3850},"indent":[]}}],"position":{"start":{"line":84,"column":1,"offset":3420},"end":{"line":84,"column":431,"offset":3850},"indent":[]}},{"type":"code","lang":"ts","meta":null,"value":" botUpdate?: (user: UserPayload) => unknown;\n channelCreate?: (channel: Channel) => unknown;\n channelUpdate?: (channel: Channel, cachedChannel: Channel) => unknown;\n channelDelete?: (channel: Channel) => unknown;\n debug?: (args: DebugArg) => unknown;\n guildBanAdd?: (guild: Guild, user: Member | UserPayload) => unknown;\n guildBanRemove?: (guild: Guild, user: Member | UserPayload) => unknown;\n guildCreate?: (guild: Guild) => unknown;\n guildLoaded?: (guild: Guild) => unknown;\n guildUpdate?: (guild: Guild, changes: GuildUpdateChange[]) => unknown;\n guildDelete?: (guild: Guild) => unknown;\n guildEmojisUpdate?: (\n guild: Guild,\n emojis: Emoji[],\n cachedEmojis: Emoji[],\n ) => unknown;\n guildMemberAdd?: (guild: Guild, member: Member) => unknown;\n guildMemberRemove?: (guild: Guild, member: Member | UserPayload) => unknown;\n guildMemberUpdate?: (\n guild: Guild,\n member: Member,\n cachedMember?: Member,\n ) => unknown;\n heartbeat?: () => unknown;\n messageCreate?: (message: Message) => unknown;\n messageDelete?: (message: Message | PartialMessage) => unknown;\n messageUpdate?: (message: Message, cachedMessage: OldMessage) => unknown;\n nicknameUpdate?: (\n guild: Guild,\n member: Member,\n nickname: string,\n oldNickname?: string,\n ) => unknown;\n presenceUpdate?: (\n presence: PresenceUpdatePayload,\n oldPresence?: PresenceUpdatePayload,\n ) => unknown;\n raw?: (data: DiscordPayload) => unknown;\n rawGateway?: (data: unknown) => unknown;\n ready?: () => unknown;\n reactionAdd?: (\n message: Message | MessageReactionPayload,\n emoji: ReactionPayload,\n userID: string,\n ) => unknown;\n reactionRemove?: (\n message: Message | MessageReactionPayload,\n emoji: ReactionPayload,\n userID: string,\n ) => unknown;\n reactionRemoveAll?: (data: BaseMessageReactionPayload) => unknown;\n reactionRemoveEmoji?: (data: MessageReactionRemoveEmojiPayload) => unknown;\n roleCreate?: (guild: Guild, role: Role) => unknown;\n roleDelete?: (guild: Guild, role: Role) => unknown;\n roleUpdate?: (guild: Guild, role: Role, cachedRole: Role) => unknown;\n roleGained?: (guild: Guild, member: Member, roleID: string) => unknown;\n roleLost?: (guild: Guild, member: Member, roleID: string) => unknown;\n shardReady?: (shardID: number) => unknown;\n typingStart?: (data: TypingStartPayload) => unknown;\n voiceChannelJoin?: (member: Member, channelID: string) => unknown;\n voiceChannelLeave?: (member: Member, channelID: string) => unknown;\n voiceChannelSwitch?: (\n member: Member,\n channelID: string,\n oldChannelID: string,\n ) => unknown;\n voiceStateUpdate?: (\n member: Member,\n voiceState: VoiceStateUpdatePayload,\n ) => unknown;\n webhooksUpdate?: (channelID: string, guildID: string) => unknown;","position":{"start":{"line":86,"column":1,"offset":3852},"end":{"line":158,"column":4,"offset":6636},"indent":[1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1]}},{"type":"paragraph","children":[{"type":"text","value":"Once, you are ready, let's jump into creating some command inhibitors.","position":{"start":{"line":160,"column":1,"offset":6638},"end":{"line":160,"column":71,"offset":6708},"indent":[]}}],"position":{"start":{"line":160,"column":1,"offset":6638},"end":{"line":160,"column":71,"offset":6708},"indent":[]}},{"type":"export","value":"export const _frontmatter = {\"title\":\"Creating Events!\",\"metaTitle\":\"Creating An Event | Discordeno\",\"metaDescription\":\"Let's create our very own bot with Discordeno!\"}","position":{"start":{"line":163,"column":1,"offset":6711},"end":{"line":163,"column":169,"offset":6879},"indent":[]}}],"position":{"start":{"line":1,"column":1,"offset":0},"end":{"line":163,"column":169,"offset":6879}}},"scopeImports":["import * as React from 'react'"],"scopeIdentifiers":["React"],"body":"function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }\n\nfunction _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }\n\nfunction _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }\n\n/* @jsx mdx */\nvar _frontmatter = {\n \"title\": \"Creating Events!\",\n \"metaTitle\": \"Creating An Event | Discordeno\",\n \"metaDescription\": \"Let's create our very own bot with Discordeno!\"\n};\nvar layoutProps = {\n _frontmatter: _frontmatter\n};\nvar MDXLayout = \"wrapper\";\nreturn function MDXContent(_ref) {\n var components = _ref.components,\n props = _objectWithoutProperties(_ref, [\"components\"]);\n\n return mdx(MDXLayout, _extends({}, layoutProps, props, {\n components: components,\n mdxType: \"MDXLayout\"\n }), mdx(\"p\", null, \"Woah! You are almost half way done with understanding all of Discordeno. Amazing isn't it? Something you may have noticed in the last section was when the bot started up you could see a bunch of messages like \", mdx(\"inlineCode\", {\n parentName: \"p\"\n }, \"Loaded X Commands\"), \" and such. Let's jump into this part now and understand how event handling works in Discordeno.\"), mdx(\"h2\", null, \"What Is An Event?\"), mdx(\"p\", null, \"An event in Discordeno is a function that can be called when a specific event occurs. For the most part, events will usually be the ones that are available from Discordeno. However, you can create your own custom events as well if you wish.\"), mdx(\"h2\", null, \"Understanding The Events\"), mdx(\"p\", null, \"Go ahead and open up the \", mdx(\"inlineCode\", {\n parentName: \"p\"\n }, \"src/events/ready.ts\"), \" file. When you open this file, you will see the code that is triggered on the \", mdx(\"inlineCode\", {\n parentName: \"p\"\n }, \"ready\"), \" event. Whenever the bot completely starts up, Discordeno emits the \", mdx(\"inlineCode\", {\n parentName: \"p\"\n }, \"ready\"), \" event. This is when this code will be run allowing you to log these messages.\"), mdx(\"pre\", null, mdx(\"code\", _extends({\n parentName: \"pre\"\n }, {\n \"className\": \"language-ts\"\n }), \"import { botCache } from \\\"../../mod.ts\\\";\\nimport { cache } from \\\"https://raw.githubusercontent.com/Skillz4Killz/Discordeno/v7/src/utils/cache.ts\\\";\\nimport logger from \\\"https://raw.githubusercontent.com/Skillz4Killz/Discordeno/v7/src/utils/logger.ts\\\";\\n\\nbotCache.eventHandlers.ready = function () {\\n logger.info(`Loaded ${botCache.arguments.size} Argument(s)`);\\n logger.info(`Loaded ${botCache.commands.size} Command(s)`);\\n logger.info(`Loaded ${Object.keys(botCache.eventHandlers).length} Event(s)`);\\n logger.info(`Loaded ${botCache.inhibitors.size} Inhibitor(s)`);\\n logger.info(`Loaded ${botCache.monitors.size} Monitor(s)`);\\n logger.info(`Loaded ${botCache.tasks.size} Task(s)`);\\n\\n logger.success(\\n `[READY] Bot is online and ready in ${cache.guilds.size} guild(s)!`,\\n );\\n};\\n\")), mdx(\"p\", null, \"Overall, this code is pretty self-explanatory. When the bot is ready, it logs all these things to the console for you.\"), mdx(\"h2\", null, \"Creating A Custom Event\"), mdx(\"p\", null, \"Make a new file in the events folder called \", mdx(\"inlineCode\", {\n parentName: \"p\"\n }, \"discordLog.ts\"), \" that will send a message to a discord channel whenever we get an error so we don't need to always be watching the console to see errors. Once you made the file, go ahead and paste the base event snippet below.\"), mdx(\"pre\", null, mdx(\"code\", _extends({\n parentName: \"pre\"\n }, {\n \"className\": \"language-ts\"\n }), \"import { botCache } from \\\"../../mod.ts\\\";\\n\\nbotCache.eventHandlers.eventname = function () {\\n // Your code goes here\\n};\\n\")), mdx(\"ul\", null, mdx(\"li\", {\n parentName: \"ul\"\n }, \"Change the event name to \", mdx(\"inlineCode\", {\n parentName: \"li\"\n }, \"discordLog\")), mdx(\"li\", {\n parentName: \"ul\"\n }, \"Go to \", mdx(\"inlineCode\", {\n parentName: \"li\"\n }, \"src/types/events.ts\"), \" and add in the following code so it looks like this:\")), mdx(\"pre\", null, mdx(\"code\", _extends({\n parentName: \"pre\"\n }, {\n \"className\": \"language-ts\"\n }), \"// This interface is a placeholder that allows you to easily add on custom events for your need.\\nexport interface CustomEvents extends EventHandlers {\\n discordLog: () => unknown;\\n}\\n\")), mdx(\"p\", null, \"Awesome, now we can get started on adding the code.\"), mdx(\"pre\", null, mdx(\"code\", _extends({\n parentName: \"pre\"\n }, {\n \"className\": \"language-ts\"\n }), \"import { botCache } from \\\"../../mod.ts\\\";\\nimport { Embed } from \\\"../utils/Embed.ts\\\";\\nimport { cache } from \\\"../../deps.ts\\\";\\nimport { configs } from \\\"../../configs.ts\\\";\\nimport { sendMessage } from \\\"https://raw.githubusercontent.com/Skillz4Killz/Discordeno/v7/src/handlers/channel.ts\\\";\\nimport { sendEmbed } from \\\"../utils/helpers.ts\\\";\\n\\nbotCache.eventHandlers.discordLog = function (error) {\\n const embed = new Embed()\\n .setDescription([\\n \\\"```ts\\\",\\n error,\\n \\\"```\\\",\\n ].join(\\\"\\\\n\\\"))\\n .setTimestamp();\\n\\n // Get the channel we need to send this error to\\n const errorChannel = cache.channels.get(configs.channelIDs.errorChannelID);\\n // If the channel is not found cancel out\\n if (!errorChannel) return;\\n\\n // Send the message\\n return sendEmbed(errorChannel, embed);\\n};\\n\")), mdx(\"p\", null, \"Now that we have fully covered events, it would be a good time to get some practice here. Feel free to make more events that you would like in your bot. The following is a list of all the events available to you by the library at the time of writing this guide. There may be more or some may have been removed. I'll try to keep this updated but either way, VSC will let you know through autocompletion what is and isn't available.\"), mdx(\"pre\", null, mdx(\"code\", _extends({\n parentName: \"pre\"\n }, {\n \"className\": \"language-ts\"\n }), \" botUpdate?: (user: UserPayload) => unknown;\\n channelCreate?: (channel: Channel) => unknown;\\n channelUpdate?: (channel: Channel, cachedChannel: Channel) => unknown;\\n channelDelete?: (channel: Channel) => unknown;\\n debug?: (args: DebugArg) => unknown;\\n guildBanAdd?: (guild: Guild, user: Member | UserPayload) => unknown;\\n guildBanRemove?: (guild: Guild, user: Member | UserPayload) => unknown;\\n guildCreate?: (guild: Guild) => unknown;\\n guildLoaded?: (guild: Guild) => unknown;\\n guildUpdate?: (guild: Guild, changes: GuildUpdateChange[]) => unknown;\\n guildDelete?: (guild: Guild) => unknown;\\n guildEmojisUpdate?: (\\n guild: Guild,\\n emojis: Emoji[],\\n cachedEmojis: Emoji[],\\n ) => unknown;\\n guildMemberAdd?: (guild: Guild, member: Member) => unknown;\\n guildMemberRemove?: (guild: Guild, member: Member | UserPayload) => unknown;\\n guildMemberUpdate?: (\\n guild: Guild,\\n member: Member,\\n cachedMember?: Member,\\n ) => unknown;\\n heartbeat?: () => unknown;\\n messageCreate?: (message: Message) => unknown;\\n messageDelete?: (message: Message | PartialMessage) => unknown;\\n messageUpdate?: (message: Message, cachedMessage: OldMessage) => unknown;\\n nicknameUpdate?: (\\n guild: Guild,\\n member: Member,\\n nickname: string,\\n oldNickname?: string,\\n ) => unknown;\\n presenceUpdate?: (\\n presence: PresenceUpdatePayload,\\n oldPresence?: PresenceUpdatePayload,\\n ) => unknown;\\n raw?: (data: DiscordPayload) => unknown;\\n rawGateway?: (data: unknown) => unknown;\\n ready?: () => unknown;\\n reactionAdd?: (\\n message: Message | MessageReactionPayload,\\n emoji: ReactionPayload,\\n userID: string,\\n ) => unknown;\\n reactionRemove?: (\\n message: Message | MessageReactionPayload,\\n emoji: ReactionPayload,\\n userID: string,\\n ) => unknown;\\n reactionRemoveAll?: (data: BaseMessageReactionPayload) => unknown;\\n reactionRemoveEmoji?: (data: MessageReactionRemoveEmojiPayload) => unknown;\\n roleCreate?: (guild: Guild, role: Role) => unknown;\\n roleDelete?: (guild: Guild, role: Role) => unknown;\\n roleUpdate?: (guild: Guild, role: Role, cachedRole: Role) => unknown;\\n roleGained?: (guild: Guild, member: Member, roleID: string) => unknown;\\n roleLost?: (guild: Guild, member: Member, roleID: string) => unknown;\\n shardReady?: (shardID: number) => unknown;\\n typingStart?: (data: TypingStartPayload) => unknown;\\n voiceChannelJoin?: (member: Member, channelID: string) => unknown;\\n voiceChannelLeave?: (member: Member, channelID: string) => unknown;\\n voiceChannelSwitch?: (\\n member: Member,\\n channelID: string,\\n oldChannelID: string,\\n ) => unknown;\\n voiceStateUpdate?: (\\n member: Member,\\n voiceState: VoiceStateUpdatePayload,\\n ) => unknown;\\n webhooksUpdate?: (channelID: string, guildID: string) => unknown;\\n\")), mdx(\"p\", null, \"Once, you are ready, let's jump into creating some command inhibitors.\"));\n}\n;\nMDXContent.isMDXComponent = true;","rawMDXOutput":"/* @jsx mdx */\nimport { mdx } from '@mdx-js/react';\n/* @jsx mdx */\n\nexport const _frontmatter = {\n \"title\": \"Creating Events!\",\n \"metaTitle\": \"Creating An Event | Discordeno\",\n \"metaDescription\": \"Let's create our very own bot with Discordeno!\"\n};\n\nconst layoutProps = {\n _frontmatter\n};\nconst MDXLayout = \"wrapper\"\nexport default function MDXContent({\n components,\n ...props\n}) {\n return \n

{`Woah! You are almost half way done with understanding all of Discordeno. Amazing isn't it? Something you may have noticed in the last section was when the bot started up you could see a bunch of messages like `}{`Loaded X Commands`}{` and such. Let's jump into this part now and understand how event handling works in Discordeno.`}

\n

{`What Is An Event?`}

\n

{`An event in Discordeno is a function that can be called when a specific event occurs. For the most part, events will usually be the ones that are available from Discordeno. However, you can create your own custom events as well if you wish.`}

\n

{`Understanding The Events`}

\n

{`Go ahead and open up the `}{`src/events/ready.ts`}{` file. When you open this file, you will see the code that is triggered on the `}{`ready`}{` event. Whenever the bot completely starts up, Discordeno emits the `}{`ready`}{` event. This is when this code will be run allowing you to log these messages.`}

\n
{`import { botCache } from \"../../mod.ts\";\nimport { cache } from \"https://raw.githubusercontent.com/Skillz4Killz/Discordeno/v7/src/utils/cache.ts\";\nimport logger from \"https://raw.githubusercontent.com/Skillz4Killz/Discordeno/v7/src/utils/logger.ts\";\n\nbotCache.eventHandlers.ready = function () {\n  logger.info(\\`Loaded \\${botCache.arguments.size} Argument(s)\\`);\n  logger.info(\\`Loaded \\${botCache.commands.size} Command(s)\\`);\n  logger.info(\\`Loaded \\${Object.keys(botCache.eventHandlers).length} Event(s)\\`);\n  logger.info(\\`Loaded \\${botCache.inhibitors.size} Inhibitor(s)\\`);\n  logger.info(\\`Loaded \\${botCache.monitors.size} Monitor(s)\\`);\n  logger.info(\\`Loaded \\${botCache.tasks.size} Task(s)\\`);\n\n  logger.success(\n    \\`[READY] Bot is online and ready in \\${cache.guilds.size} guild(s)!\\`,\n  );\n};\n`}
\n

{`Overall, this code is pretty self-explanatory. When the bot is ready, it logs all these things to the console for you.`}

\n

{`Creating A Custom Event`}

\n

{`Make a new file in the events folder called `}{`discordLog.ts`}{` that will send a message to a discord channel whenever we get an error so we don't need to always be watching the console to see errors. Once you made the file, go ahead and paste the base event snippet below.`}

\n
{`import { botCache } from \"../../mod.ts\";\n\nbotCache.eventHandlers.eventname = function () {\n  // Your code goes here\n};\n`}
\n
    \n
  • {`Change the event name to `}{`discordLog`}
  • \n
  • {`Go to `}{`src/types/events.ts`}{` and add in the following code so it looks like this:`}
  • \n
\n
{`// This interface is a placeholder that allows you to easily add on custom events for your need.\nexport interface CustomEvents extends EventHandlers {\n  discordLog: () => unknown;\n}\n`}
\n

{`Awesome, now we can get started on adding the code.`}

\n
{`import { botCache } from \"../../mod.ts\";\nimport { Embed } from \"../utils/Embed.ts\";\nimport { cache } from \"../../deps.ts\";\nimport { configs } from \"../../configs.ts\";\nimport { sendMessage } from \"https://raw.githubusercontent.com/Skillz4Killz/Discordeno/v7/src/handlers/channel.ts\";\nimport { sendEmbed } from \"../utils/helpers.ts\";\n\nbotCache.eventHandlers.discordLog = function (error) {\n  const embed = new Embed()\n    .setDescription([\n      \"\\`\\`\\`ts\",\n      error,\n      \"\\`\\`\\`\",\n    ].join(\"\\\\n\"))\n    .setTimestamp();\n\n  // Get the channel we need to send this error to\n  const errorChannel = cache.channels.get(configs.channelIDs.errorChannelID);\n  // If the channel is not found cancel out\n  if (!errorChannel) return;\n\n  // Send the message\n  return sendEmbed(errorChannel, embed);\n};\n`}
\n

{`Now that we have fully covered events, it would be a good time to get some practice here. Feel free to make more events that you would like in your bot. The following is a list of all the events available to you by the library at the time of writing this guide. There may be more or some may have been removed. I'll try to keep this updated but either way, VSC will let you know through autocompletion what is and isn't available.`}

\n
{`  botUpdate?: (user: UserPayload) => unknown;\n  channelCreate?: (channel: Channel) => unknown;\n  channelUpdate?: (channel: Channel, cachedChannel: Channel) => unknown;\n  channelDelete?: (channel: Channel) => unknown;\n  debug?: (args: DebugArg) => unknown;\n  guildBanAdd?: (guild: Guild, user: Member | UserPayload) => unknown;\n  guildBanRemove?: (guild: Guild, user: Member | UserPayload) => unknown;\n  guildCreate?: (guild: Guild) => unknown;\n  guildLoaded?: (guild: Guild) => unknown;\n  guildUpdate?: (guild: Guild, changes: GuildUpdateChange[]) => unknown;\n  guildDelete?: (guild: Guild) => unknown;\n  guildEmojisUpdate?: (\n    guild: Guild,\n    emojis: Emoji[],\n    cachedEmojis: Emoji[],\n  ) => unknown;\n  guildMemberAdd?: (guild: Guild, member: Member) => unknown;\n  guildMemberRemove?: (guild: Guild, member: Member | UserPayload) => unknown;\n  guildMemberUpdate?: (\n    guild: Guild,\n    member: Member,\n    cachedMember?: Member,\n  ) => unknown;\n  heartbeat?: () => unknown;\n  messageCreate?: (message: Message) => unknown;\n  messageDelete?: (message: Message | PartialMessage) => unknown;\n  messageUpdate?: (message: Message, cachedMessage: OldMessage) => unknown;\n  nicknameUpdate?: (\n    guild: Guild,\n    member: Member,\n    nickname: string,\n    oldNickname?: string,\n  ) => unknown;\n  presenceUpdate?: (\n    presence: PresenceUpdatePayload,\n    oldPresence?: PresenceUpdatePayload,\n  ) => unknown;\n  raw?: (data: DiscordPayload) => unknown;\n  rawGateway?: (data: unknown) => unknown;\n  ready?: () => unknown;\n  reactionAdd?: (\n    message: Message | MessageReactionPayload,\n    emoji: ReactionPayload,\n    userID: string,\n  ) => unknown;\n  reactionRemove?: (\n    message: Message | MessageReactionPayload,\n    emoji: ReactionPayload,\n    userID: string,\n  ) => unknown;\n  reactionRemoveAll?: (data: BaseMessageReactionPayload) => unknown;\n  reactionRemoveEmoji?: (data: MessageReactionRemoveEmojiPayload) => unknown;\n  roleCreate?: (guild: Guild, role: Role) => unknown;\n  roleDelete?: (guild: Guild, role: Role) => unknown;\n  roleUpdate?: (guild: Guild, role: Role, cachedRole: Role) => unknown;\n  roleGained?: (guild: Guild, member: Member, roleID: string) => unknown;\n  roleLost?: (guild: Guild, member: Member, roleID: string) => unknown;\n  shardReady?: (shardID: number) => unknown;\n  typingStart?: (data: TypingStartPayload) => unknown;\n  voiceChannelJoin?: (member: Member, channelID: string) => unknown;\n  voiceChannelLeave?: (member: Member, channelID: string) => unknown;\n  voiceChannelSwitch?: (\n    member: Member,\n    channelID: string,\n    oldChannelID: string,\n  ) => unknown;\n  voiceStateUpdate?: (\n    member: Member,\n    voiceState: VoiceStateUpdatePayload,\n  ) => unknown;\n  webhooksUpdate?: (channelID: string, guildID: string) => unknown;\n`}
\n

{`Once, you are ready, let's jump into creating some command inhibitors.`}

\n\n
;\n}\n\n;\nMDXContent.isMDXComponent = true;"}} \ No newline at end of file diff --git a/docs/.cache/caches/gatsby-plugin-mdx/diskstore-02c8c8bda13d33f5c814ad5d52c1605e.json b/docs/.cache/caches/gatsby-plugin-mdx/diskstore-02c8c8bda13d33f5c814ad5d52c1605e.json new file mode 100644 index 000000000..911073443 --- /dev/null +++ b/docs/.cache/caches/gatsby-plugin-mdx/diskstore-02c8c8bda13d33f5c814ad5d52c1605e.json @@ -0,0 +1 @@ +{"expireTime":9007200851635339000,"key":"gatsby-plugin-mdx-entire-payload-1c6d09c97cecf6c650a19ea43940f36d-","val":{"mdast":{"type":"root","children":[{"type":"paragraph","children":[{"type":"text","value":"Woah! You are almost half way done with understanding all of Discordeno. Amazing isn't it? Something you may have noticed in the last section was when the bot started up you could see a bunch of messages like ","position":{"start":{"line":2,"column":1,"offset":1},"end":{"line":2,"column":210,"offset":210},"indent":[]}},{"type":"inlineCode","value":"Loaded X Commands","position":{"start":{"line":2,"column":210,"offset":210},"end":{"line":2,"column":229,"offset":229},"indent":[]}},{"type":"text","value":" and such. Let's jump into this part now and understand how event handling works in Discordeno.","position":{"start":{"line":2,"column":229,"offset":229},"end":{"line":2,"column":324,"offset":324},"indent":[]}}],"position":{"start":{"line":2,"column":1,"offset":1},"end":{"line":2,"column":324,"offset":324},"indent":[]}},{"type":"heading","depth":2,"children":[{"type":"text","value":"What Is An Event?","position":{"start":{"line":4,"column":4,"offset":329},"end":{"line":4,"column":21,"offset":346},"indent":[]}}],"position":{"start":{"line":4,"column":1,"offset":326},"end":{"line":4,"column":21,"offset":346},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"An event in Discordeno is a function that can be called when a specific event occurs. For the most part, events will usually be the ones that are available from Discordeno. However, you can create your own custom events as well if you wish.","position":{"start":{"line":6,"column":1,"offset":348},"end":{"line":6,"column":241,"offset":588},"indent":[]}}],"position":{"start":{"line":6,"column":1,"offset":348},"end":{"line":6,"column":241,"offset":588},"indent":[]}},{"type":"heading","depth":2,"children":[{"type":"text","value":"Creating The File","position":{"start":{"line":8,"column":4,"offset":593},"end":{"line":8,"column":21,"offset":610},"indent":[]}}],"position":{"start":{"line":8,"column":1,"offset":590},"end":{"line":8,"column":21,"offset":610},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"Make a new file in the events folder called ","position":{"start":{"line":10,"column":1,"offset":612},"end":{"line":10,"column":45,"offset":656},"indent":[]}},{"type":"inlineCode","value":"discordLog.ts","position":{"start":{"line":10,"column":45,"offset":656},"end":{"line":10,"column":60,"offset":671},"indent":[]}},{"type":"text","value":" that will send a message to a discord channel whenever we get an error so we don't need to always be watching the console to see errors. Once you made the file, go ahead and paste the base event snippet below.","position":{"start":{"line":10,"column":60,"offset":671},"end":{"line":10,"column":270,"offset":881},"indent":[]}}],"position":{"start":{"line":10,"column":1,"offset":612},"end":{"line":10,"column":270,"offset":881},"indent":[]}},{"type":"code","lang":"ts","meta":null,"value":"import { botCache } from \"../../mod.ts\";\nimport { cache } from \"https://raw.githubusercontent.com/Skillz4Killz/Discordeno/v7/src/utils/cache.ts\";\nimport logger from \"https://raw.githubusercontent.com/Skillz4Killz/Discordeno/v7/src/utils/logger.ts\";\n\nbotCache.eventHandlers.ready = function () {\n logger.info(`Loaded ${botCache.arguments.size} Argument(s)`);\n logger.info(`Loaded ${botCache.commands.size} Command(s)`);\n logger.info(`Loaded ${Object.keys(botCache.eventHandlers).length} Event(s)`);\n logger.info(`Loaded ${botCache.inhibitors.size} Inhibitor(s)`);\n logger.info(`Loaded ${botCache.monitors.size} Monitor(s)`);\n logger.info(`Loaded ${botCache.tasks.size} Task(s)`);\n\n logger.success(\n `[READY] Bot is online and ready in ${cache.guilds.size} guild(s)!`,\n );\n};\n","position":{"start":{"line":13,"column":1,"offset":884},"end":{"line":31,"column":4,"offset":1679},"indent":[1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1]}},{"type":"export","value":"export const _frontmatter = {\"title\":\"Creating Events!\",\"metaTitle\":\"Creating An Event | Discordeno\",\"metaDescription\":\"Let's create our very own bot with Discordeno!\"}","position":{"start":{"line":34,"column":1,"offset":1682},"end":{"line":34,"column":169,"offset":1850},"indent":[]}}],"position":{"start":{"line":1,"column":1,"offset":0},"end":{"line":34,"column":169,"offset":1850}}},"scopeImports":["import * as React from 'react'"],"scopeIdentifiers":["React"],"body":"function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }\n\nfunction _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }\n\nfunction _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }\n\n/* @jsx mdx */\nvar _frontmatter = {\n \"title\": \"Creating Events!\",\n \"metaTitle\": \"Creating An Event | Discordeno\",\n \"metaDescription\": \"Let's create our very own bot with Discordeno!\"\n};\nvar layoutProps = {\n _frontmatter: _frontmatter\n};\nvar MDXLayout = \"wrapper\";\nreturn function MDXContent(_ref) {\n var components = _ref.components,\n props = _objectWithoutProperties(_ref, [\"components\"]);\n\n return mdx(MDXLayout, _extends({}, layoutProps, props, {\n components: components,\n mdxType: \"MDXLayout\"\n }), mdx(\"p\", null, \"Woah! You are almost half way done with understanding all of Discordeno. Amazing isn't it? Something you may have noticed in the last section was when the bot started up you could see a bunch of messages like \", mdx(\"inlineCode\", {\n parentName: \"p\"\n }, \"Loaded X Commands\"), \" and such. Let's jump into this part now and understand how event handling works in Discordeno.\"), mdx(\"h2\", null, \"What Is An Event?\"), mdx(\"p\", null, \"An event in Discordeno is a function that can be called when a specific event occurs. For the most part, events will usually be the ones that are available from Discordeno. However, you can create your own custom events as well if you wish.\"), mdx(\"h2\", null, \"Creating The File\"), mdx(\"p\", null, \"Make a new file in the events folder called \", mdx(\"inlineCode\", {\n parentName: \"p\"\n }, \"discordLog.ts\"), \" that will send a message to a discord channel whenever we get an error so we don't need to always be watching the console to see errors. Once you made the file, go ahead and paste the base event snippet below.\"), mdx(\"pre\", null, mdx(\"code\", _extends({\n parentName: \"pre\"\n }, {\n \"className\": \"language-ts\"\n }), \"import { botCache } from \\\"../../mod.ts\\\";\\nimport { cache } from \\\"https://raw.githubusercontent.com/Skillz4Killz/Discordeno/v7/src/utils/cache.ts\\\";\\nimport logger from \\\"https://raw.githubusercontent.com/Skillz4Killz/Discordeno/v7/src/utils/logger.ts\\\";\\n\\nbotCache.eventHandlers.ready = function () {\\n logger.info(`Loaded ${botCache.arguments.size} Argument(s)`);\\n logger.info(`Loaded ${botCache.commands.size} Command(s)`);\\n logger.info(`Loaded ${Object.keys(botCache.eventHandlers).length} Event(s)`);\\n logger.info(`Loaded ${botCache.inhibitors.size} Inhibitor(s)`);\\n logger.info(`Loaded ${botCache.monitors.size} Monitor(s)`);\\n logger.info(`Loaded ${botCache.tasks.size} Task(s)`);\\n\\n logger.success(\\n `[READY] Bot is online and ready in ${cache.guilds.size} guild(s)!`,\\n );\\n};\\n\\n\")));\n}\n;\nMDXContent.isMDXComponent = true;","rawMDXOutput":"/* @jsx mdx */\nimport { mdx } from '@mdx-js/react';\n/* @jsx mdx */\n\nexport const _frontmatter = {\n \"title\": \"Creating Events!\",\n \"metaTitle\": \"Creating An Event | Discordeno\",\n \"metaDescription\": \"Let's create our very own bot with Discordeno!\"\n};\n\nconst layoutProps = {\n _frontmatter\n};\nconst MDXLayout = \"wrapper\"\nexport default function MDXContent({\n components,\n ...props\n}) {\n return \n

{`Woah! You are almost half way done with understanding all of Discordeno. Amazing isn't it? Something you may have noticed in the last section was when the bot started up you could see a bunch of messages like `}{`Loaded X Commands`}{` and such. Let's jump into this part now and understand how event handling works in Discordeno.`}

\n

{`What Is An Event?`}

\n

{`An event in Discordeno is a function that can be called when a specific event occurs. For the most part, events will usually be the ones that are available from Discordeno. However, you can create your own custom events as well if you wish.`}

\n

{`Creating The File`}

\n

{`Make a new file in the events folder called `}{`discordLog.ts`}{` that will send a message to a discord channel whenever we get an error so we don't need to always be watching the console to see errors. Once you made the file, go ahead and paste the base event snippet below.`}

\n
{`import { botCache } from \"../../mod.ts\";\nimport { cache } from \"https://raw.githubusercontent.com/Skillz4Killz/Discordeno/v7/src/utils/cache.ts\";\nimport logger from \"https://raw.githubusercontent.com/Skillz4Killz/Discordeno/v7/src/utils/logger.ts\";\n\nbotCache.eventHandlers.ready = function () {\n  logger.info(\\`Loaded \\${botCache.arguments.size} Argument(s)\\`);\n  logger.info(\\`Loaded \\${botCache.commands.size} Command(s)\\`);\n  logger.info(\\`Loaded \\${Object.keys(botCache.eventHandlers).length} Event(s)\\`);\n  logger.info(\\`Loaded \\${botCache.inhibitors.size} Inhibitor(s)\\`);\n  logger.info(\\`Loaded \\${botCache.monitors.size} Monitor(s)\\`);\n  logger.info(\\`Loaded \\${botCache.tasks.size} Task(s)\\`);\n\n  logger.success(\n    \\`[READY] Bot is online and ready in \\${cache.guilds.size} guild(s)!\\`,\n  );\n};\n\n`}
\n\n
;\n}\n\n;\nMDXContent.isMDXComponent = true;"}} \ No newline at end of file diff --git a/docs/.cache/caches/gatsby-plugin-mdx/diskstore-03663d6a4f438a7d626759e765a1add7.json b/docs/.cache/caches/gatsby-plugin-mdx/diskstore-03663d6a4f438a7d626759e765a1add7.json new file mode 100644 index 000000000..5199b0037 --- /dev/null +++ b/docs/.cache/caches/gatsby-plugin-mdx/diskstore-03663d6a4f438a7d626759e765a1add7.json @@ -0,0 +1 @@ +{"expireTime":9007200851632083000,"key":"gatsby-plugin-mdx-entire-payload-01dcb09e15d97f8a0bf0e541dc8aabe3-","val":{"mdast":{"type":"root","children":[{"type":"paragraph","children":[{"type":"text","value":"Woah! You are almost half way done with understanding all of Discordeno. Amazing isn't it? Something you may have noticed in the last section was there were some options that prevented some commands from running like ","position":{"start":{"line":2,"column":1,"offset":1},"end":{"line":2,"column":218,"offset":218},"indent":[]}},{"type":"inlineCode","value":"dmOnly","position":{"start":{"line":2,"column":218,"offset":218},"end":{"line":2,"column":226,"offset":226},"indent":[]}},{"type":"text","value":" or the permission options. we created a setting to prevent the monitor from running in certain channels. What if we wanted to do prevent commands from happening? How would we prevent commands from running?","position":{"start":{"line":2,"column":226,"offset":226},"end":{"line":2,"column":432,"offset":432},"indent":[]}}],"position":{"start":{"line":2,"column":1,"offset":1},"end":{"line":2,"column":432,"offset":432},"indent":[]}},{"type":"heading","depth":2,"children":[{"type":"text","value":"What is an Inhibitor?","position":{"start":{"line":4,"column":4,"offset":437},"end":{"line":4,"column":25,"offset":458},"indent":[]}}],"position":{"start":{"line":4,"column":1,"offset":434},"end":{"line":4,"column":25,"offset":458},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"An Inhibitor is very similar to how monitors work. A monitor runs on every message but an inhibitor runs on every command. Remember all those command options like cooldown, enabled, requiredPermissions, permissionLevel, nsfw, requiredSettings, runIn. Each and every one of these options has an inhibitor in Klasa core that checks commands for these settings.\nLet's create our own inhibitor that would prevent commands from being used if the user is not a VIP user.","position":{"start":{"line":6,"column":1,"offset":460},"end":{"line":7,"column":106,"offset":924},"indent":[1]}}],"position":{"start":{"line":6,"column":1,"offset":460},"end":{"line":7,"column":106,"offset":924},"indent":[1]}},{"type":"paragraph","children":[{"type":"strong","children":[{"type":"text","value":"Note:","position":{"start":{"line":9,"column":3,"offset":928},"end":{"line":9,"column":8,"offset":933},"indent":[]}}],"position":{"start":{"line":9,"column":1,"offset":926},"end":{"line":9,"column":10,"offset":935},"indent":[]}},{"type":"text","value":" It is important to remember that everything below can be done with a simple permission level as well. We will create our own custom permission levels but for the purposes of this guide and to be able to learn about Inhibitors, we will be using an inhibitor.","position":{"start":{"line":9,"column":10,"offset":935},"end":{"line":9,"column":268,"offset":1193},"indent":[]}}],"position":{"start":{"line":9,"column":1,"offset":926},"end":{"line":9,"column":268,"offset":1193},"indent":[]}},{"type":"export","value":"export const _frontmatter = {\"title\":\"Creating Inhibitors!\",\"metaTitle\":\"Creating An Inhibitor | Discordeno\",\"metaDescription\":\"Let's create our very own bot with Discordeno!\"}","position":{"start":{"line":12,"column":1,"offset":1196},"end":{"line":12,"column":177,"offset":1372},"indent":[]}}],"position":{"start":{"line":1,"column":1,"offset":0},"end":{"line":12,"column":177,"offset":1372}}},"scopeImports":["import * as React from 'react'"],"scopeIdentifiers":["React"],"body":"function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }\n\nfunction _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }\n\nfunction _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }\n\n/* @jsx mdx */\nvar _frontmatter = {\n \"title\": \"Creating Inhibitors!\",\n \"metaTitle\": \"Creating An Inhibitor | Discordeno\",\n \"metaDescription\": \"Let's create our very own bot with Discordeno!\"\n};\nvar layoutProps = {\n _frontmatter: _frontmatter\n};\nvar MDXLayout = \"wrapper\";\nreturn function MDXContent(_ref) {\n var components = _ref.components,\n props = _objectWithoutProperties(_ref, [\"components\"]);\n\n return mdx(MDXLayout, _extends({}, layoutProps, props, {\n components: components,\n mdxType: \"MDXLayout\"\n }), mdx(\"p\", null, \"Woah! You are almost half way done with understanding all of Discordeno. Amazing isn't it? Something you may have noticed in the last section was there were some options that prevented some commands from running like \", mdx(\"inlineCode\", {\n parentName: \"p\"\n }, \"dmOnly\"), \" or the permission options. we created a setting to prevent the monitor from running in certain channels. What if we wanted to do prevent commands from happening? How would we prevent commands from running?\"), mdx(\"h2\", null, \"What is an Inhibitor?\"), mdx(\"p\", null, \"An Inhibitor is very similar to how monitors work. A monitor runs on every message but an inhibitor runs on every command. Remember all those command options like cooldown, enabled, requiredPermissions, permissionLevel, nsfw, requiredSettings, runIn. Each and every one of these options has an inhibitor in Klasa core that checks commands for these settings.\\nLet's create our own inhibitor that would prevent commands from being used if the user is not a VIP user.\"), mdx(\"p\", null, mdx(\"strong\", {\n parentName: \"p\"\n }, \"Note:\"), \" It is important to remember that everything below can be done with a simple permission level as well. We will create our own custom permission levels but for the purposes of this guide and to be able to learn about Inhibitors, we will be using an inhibitor.\"));\n}\n;\nMDXContent.isMDXComponent = true;","rawMDXOutput":"/* @jsx mdx */\nimport { mdx } from '@mdx-js/react';\n/* @jsx mdx */\n\nexport const _frontmatter = {\n \"title\": \"Creating Inhibitors!\",\n \"metaTitle\": \"Creating An Inhibitor | Discordeno\",\n \"metaDescription\": \"Let's create our very own bot with Discordeno!\"\n};\n\nconst layoutProps = {\n _frontmatter\n};\nconst MDXLayout = \"wrapper\"\nexport default function MDXContent({\n components,\n ...props\n}) {\n return \n

{`Woah! You are almost half way done with understanding all of Discordeno. Amazing isn't it? Something you may have noticed in the last section was there were some options that prevented some commands from running like `}{`dmOnly`}{` or the permission options. we created a setting to prevent the monitor from running in certain channels. What if we wanted to do prevent commands from happening? How would we prevent commands from running?`}

\n

{`What is an Inhibitor?`}

\n

{`An Inhibitor is very similar to how monitors work. A monitor runs on every message but an inhibitor runs on every command. Remember all those command options like cooldown, enabled, requiredPermissions, permissionLevel, nsfw, requiredSettings, runIn. Each and every one of these options has an inhibitor in Klasa core that checks commands for these settings.\nLet's create our own inhibitor that would prevent commands from being used if the user is not a VIP user.`}

\n

{`Note:`}{` It is important to remember that everything below can be done with a simple permission level as well. We will create our own custom permission levels but for the purposes of this guide and to be able to learn about Inhibitors, we will be using an inhibitor.`}

\n\n
;\n}\n\n;\nMDXContent.isMDXComponent = true;"}} \ No newline at end of file diff --git a/docs/.cache/caches/gatsby-plugin-mdx/diskstore-04a38d73a68fa1e804319439011e11d9.json b/docs/.cache/caches/gatsby-plugin-mdx/diskstore-04a38d73a68fa1e804319439011e11d9.json new file mode 100644 index 000000000..c9e01fbb9 --- /dev/null +++ b/docs/.cache/caches/gatsby-plugin-mdx/diskstore-04a38d73a68fa1e804319439011e11d9.json @@ -0,0 +1 @@ +{"expireTime":9007200851634159000,"key":"gatsby-plugin-mdx-entire-payload-0b9ffaa2e009cc24c18143b0945de19b-","val":{"mdast":{"type":"root","children":[{"type":"paragraph","children":[{"type":"text","value":"Woah! You are almost half way done with understanding all of Discordeno. Amazing isn't it? Something you may have noticed in the last section was there were some options that prevented some commands from running like ","position":{"start":{"line":2,"column":1,"offset":1},"end":{"line":2,"column":218,"offset":218},"indent":[]}},{"type":"inlineCode","value":"dmOnly","position":{"start":{"line":2,"column":218,"offset":218},"end":{"line":2,"column":226,"offset":226},"indent":[]}},{"type":"text","value":" or the permission options. we created a setting to prevent the monitor from running in certain channels. What if we wanted to do prevent commands from happening? How would we prevent commands from running?","position":{"start":{"line":2,"column":226,"offset":226},"end":{"line":2,"column":432,"offset":432},"indent":[]}}],"position":{"start":{"line":2,"column":1,"offset":1},"end":{"line":2,"column":432,"offset":432},"indent":[]}},{"type":"heading","depth":2,"children":[{"type":"text","value":"What is an Inhibitor?","position":{"start":{"line":4,"column":4,"offset":437},"end":{"line":4,"column":25,"offset":458},"indent":[]}}],"position":{"start":{"line":4,"column":1,"offset":434},"end":{"line":4,"column":25,"offset":458},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"An Inhibitor is very similar to how monitors work. A monitor runs on every message but an inhibitor runs on every command. Remember all those command options like cooldown, permissions, permissionLevel, nsfw, etc... Each and every one of these options has an inhibitor in that checks commands for these settings.","position":{"start":{"line":6,"column":1,"offset":460},"end":{"line":6,"column":313,"offset":772},"indent":[]}}],"position":{"start":{"line":6,"column":1,"offset":460},"end":{"line":6,"column":313,"offset":772},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"Let's create our own inhibitor that would prevent commands from being used if the user is not a VIP user.","position":{"start":{"line":8,"column":1,"offset":774},"end":{"line":8,"column":106,"offset":879},"indent":[]}}],"position":{"start":{"line":8,"column":1,"offset":774},"end":{"line":8,"column":106,"offset":879},"indent":[]}},{"type":"blockquote","children":[{"type":"paragraph","children":[{"type":"strong","children":[{"type":"text","value":"Note:","position":{"start":{"line":10,"column":5,"offset":885},"end":{"line":10,"column":10,"offset":890},"indent":[]}}],"position":{"start":{"line":10,"column":3,"offset":883},"end":{"line":10,"column":12,"offset":892},"indent":[]}},{"type":"text","value":" It is important to remember that everything below can be done with a simple permission level as well. We will create our own custom permission levels but for the purposes of this guide and to be able to learn about Inhibitors, we will be using an inhibitor.","position":{"start":{"line":10,"column":12,"offset":892},"end":{"line":10,"column":270,"offset":1150},"indent":[]}}],"position":{"start":{"line":10,"column":3,"offset":883},"end":{"line":10,"column":270,"offset":1150},"indent":[]}}],"position":{"start":{"line":10,"column":1,"offset":881},"end":{"line":10,"column":270,"offset":1150},"indent":[]}},{"type":"heading","depth":2,"children":[{"type":"text","value":"Creating the File","position":{"start":{"line":12,"column":4,"offset":1155},"end":{"line":12,"column":21,"offset":1172},"indent":[]}}],"position":{"start":{"line":12,"column":1,"offset":1152},"end":{"line":12,"column":21,"offset":1172},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"Let's start by creating a file inside the inhibitors folder called ","position":{"start":{"line":14,"column":1,"offset":1174},"end":{"line":14,"column":68,"offset":1241},"indent":[]}},{"type":"inlineCode","value":"boosted.ts","position":{"start":{"line":14,"column":68,"offset":1241},"end":{"line":14,"column":80,"offset":1253},"indent":[]}},{"type":"text","value":" and paste the following snippet of code:","position":{"start":{"line":14,"column":80,"offset":1253},"end":{"line":14,"column":121,"offset":1294},"indent":[]}}],"position":{"start":{"line":14,"column":1,"offset":1174},"end":{"line":14,"column":121,"offset":1294},"indent":[]}},{"type":"code","lang":"ts","meta":null,"value":"import { botCache } from \"../../mod.ts\";\n\nbotCache.inhibitors.set(\"inhibitorname\", async function (message, command, guild) {\n\t// Your code goes here\n});","position":{"start":{"line":16,"column":1,"offset":1296},"end":{"line":22,"column":4,"offset":1459},"indent":[1,1,1,1,1,1]}},{"type":"paragraph","children":[{"type":"text","value":"Inhibitors can take up to 3 arguments.","position":{"start":{"line":24,"column":1,"offset":1461},"end":{"line":24,"column":39,"offset":1499},"indent":[]}}],"position":{"start":{"line":24,"column":1,"offset":1461},"end":{"line":24,"column":39,"offset":1499},"indent":[]}},{"type":"list","ordered":false,"start":null,"spread":false,"children":[{"type":"listItem","spread":false,"checked":null,"children":[{"type":"paragraph","children":[{"type":"inlineCode","value":"message","position":{"start":{"line":26,"column":3,"offset":1503},"end":{"line":26,"column":12,"offset":1512},"indent":[]}},{"type":"text","value":": The message object that triggered the command.","position":{"start":{"line":26,"column":12,"offset":1512},"end":{"line":26,"column":60,"offset":1560},"indent":[]}}],"position":{"start":{"line":26,"column":3,"offset":1503},"end":{"line":26,"column":60,"offset":1560},"indent":[]}}],"position":{"start":{"line":26,"column":1,"offset":1501},"end":{"line":26,"column":60,"offset":1560},"indent":[]}},{"type":"listItem","spread":false,"checked":null,"children":[{"type":"paragraph","children":[{"type":"inlineCode","value":"command","position":{"start":{"line":27,"column":3,"offset":1563},"end":{"line":27,"column":12,"offset":1572},"indent":[]}},{"type":"text","value":": The command object itself that was triggered.","position":{"start":{"line":27,"column":12,"offset":1572},"end":{"line":27,"column":59,"offset":1619},"indent":[]}}],"position":{"start":{"line":27,"column":3,"offset":1563},"end":{"line":27,"column":59,"offset":1619},"indent":[]}}],"position":{"start":{"line":27,"column":1,"offset":1561},"end":{"line":27,"column":59,"offset":1619},"indent":[]}},{"type":"listItem","spread":false,"checked":null,"children":[{"type":"paragraph","children":[{"type":"inlineCode","value":"guild","position":{"start":{"line":28,"column":3,"offset":1622},"end":{"line":28,"column":10,"offset":1629},"indent":[]}},{"type":"text","value":": The server guild object where this command was ran.","position":{"start":{"line":28,"column":10,"offset":1629},"end":{"line":28,"column":63,"offset":1682},"indent":[]}}],"position":{"start":{"line":28,"column":3,"offset":1622},"end":{"line":28,"column":63,"offset":1682},"indent":[]}}],"position":{"start":{"line":28,"column":1,"offset":1620},"end":{"line":28,"column":63,"offset":1682},"indent":[]}}],"position":{"start":{"line":26,"column":1,"offset":1501},"end":{"line":28,"column":63,"offset":1682},"indent":[1,1]}},{"type":"heading","depth":2,"children":[{"type":"text","value":"Understanding How Inhibitors Function","position":{"start":{"line":30,"column":4,"offset":1687},"end":{"line":30,"column":41,"offset":1724},"indent":[]}}],"position":{"start":{"line":30,"column":1,"offset":1684},"end":{"line":30,"column":41,"offset":1724},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"To block a command you have to return a truthy value.","position":{"start":{"line":32,"column":1,"offset":1726},"end":{"line":32,"column":54,"offset":1779},"indent":[]}}],"position":{"start":{"line":32,"column":1,"offset":1726},"end":{"line":32,"column":54,"offset":1779},"indent":[]}},{"type":"list","ordered":false,"start":null,"spread":false,"children":[{"type":"listItem","spread":false,"checked":null,"children":[{"type":"paragraph","children":[{"type":"strong","children":[{"type":"text","value":"return true;","position":{"start":{"line":33,"column":5,"offset":1784},"end":{"line":33,"column":17,"offset":1796},"indent":[]}}],"position":{"start":{"line":33,"column":3,"offset":1782},"end":{"line":33,"column":19,"offset":1798},"indent":[]}},{"type":"text","value":" If you return true the inhibitor will block the execution of the command.\nTo allow a command return a falsey value.","position":{"start":{"line":33,"column":19,"offset":1798},"end":{"line":34,"column":42,"offset":1914},"indent":[1]}}],"position":{"start":{"line":33,"column":3,"offset":1782},"end":{"line":34,"column":42,"offset":1914},"indent":[1]}}],"position":{"start":{"line":33,"column":1,"offset":1780},"end":{"line":34,"column":42,"offset":1914},"indent":[1]}},{"type":"listItem","spread":false,"checked":null,"children":[{"type":"paragraph","children":[{"type":"strong","children":[{"type":"text","value":"return false;","position":{"start":{"line":35,"column":5,"offset":1919},"end":{"line":35,"column":18,"offset":1932},"indent":[]}}],"position":{"start":{"line":35,"column":3,"offset":1917},"end":{"line":35,"column":20,"offset":1934},"indent":[]}},{"type":"text","value":" If you return false the inhibitor will not block the error.","position":{"start":{"line":35,"column":20,"offset":1934},"end":{"line":35,"column":80,"offset":1994},"indent":[]}}],"position":{"start":{"line":35,"column":3,"offset":1917},"end":{"line":35,"column":80,"offset":1994},"indent":[]}}],"position":{"start":{"line":35,"column":1,"offset":1915},"end":{"line":35,"column":80,"offset":1994},"indent":[]}}],"position":{"start":{"line":33,"column":1,"offset":1780},"end":{"line":35,"column":80,"offset":1994},"indent":[1,1]}},{"type":"code","lang":"ts","meta":null,"value":"// If the command is not VIP only we can allow this command to execute\nif (!command.vipOnly) return false;\n\n// The bot's support server\nconst guild = cache.guilds.get(configs.supportServerID);\n// If the command author is not in the server they won't have the vip role so cancel the command\nconst\n// Check if the user has the vip role on the support server given by patreon\nconst userIsVIP = await isUserVIP(message.author.id)\n// The user is VIP so we can allow this command to be used\nif (userIsVIP) return false;\n\n// The user is NOT VIP so we throw an error\nthrow `The ${command.name} is only allowed for VIP users.`","position":{"start":{"line":38,"column":1,"offset":1997},"end":{"line":53,"column":4,"offset":2624},"indent":[1,1,1,1,1,1,1,1,1,1,1,1,1,1,1]}},{"type":"export","value":"export const _frontmatter = {\"title\":\"Creating Inhibitors!\",\"metaTitle\":\"Creating An Inhibitor | Discordeno\",\"metaDescription\":\"Let's create our very own bot with Discordeno!\"}","position":{"start":{"line":56,"column":1,"offset":2627},"end":{"line":56,"column":177,"offset":2803},"indent":[]}}],"position":{"start":{"line":1,"column":1,"offset":0},"end":{"line":56,"column":177,"offset":2803}}},"scopeImports":["import * as React from 'react'"],"scopeIdentifiers":["React"],"body":"function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }\n\nfunction _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }\n\nfunction _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }\n\n/* @jsx mdx */\nvar _frontmatter = {\n \"title\": \"Creating Inhibitors!\",\n \"metaTitle\": \"Creating An Inhibitor | Discordeno\",\n \"metaDescription\": \"Let's create our very own bot with Discordeno!\"\n};\nvar layoutProps = {\n _frontmatter: _frontmatter\n};\nvar MDXLayout = \"wrapper\";\nreturn function MDXContent(_ref) {\n var components = _ref.components,\n props = _objectWithoutProperties(_ref, [\"components\"]);\n\n return mdx(MDXLayout, _extends({}, layoutProps, props, {\n components: components,\n mdxType: \"MDXLayout\"\n }), mdx(\"p\", null, \"Woah! You are almost half way done with understanding all of Discordeno. Amazing isn't it? Something you may have noticed in the last section was there were some options that prevented some commands from running like \", mdx(\"inlineCode\", {\n parentName: \"p\"\n }, \"dmOnly\"), \" or the permission options. we created a setting to prevent the monitor from running in certain channels. What if we wanted to do prevent commands from happening? How would we prevent commands from running?\"), mdx(\"h2\", null, \"What is an Inhibitor?\"), mdx(\"p\", null, \"An Inhibitor is very similar to how monitors work. A monitor runs on every message but an inhibitor runs on every command. Remember all those command options like cooldown, permissions, permissionLevel, nsfw, etc... Each and every one of these options has an inhibitor in that checks commands for these settings.\"), mdx(\"p\", null, \"Let's create our own inhibitor that would prevent commands from being used if the user is not a VIP user.\"), mdx(\"blockquote\", null, mdx(\"p\", {\n parentName: \"blockquote\"\n }, mdx(\"strong\", {\n parentName: \"p\"\n }, \"Note:\"), \" It is important to remember that everything below can be done with a simple permission level as well. We will create our own custom permission levels but for the purposes of this guide and to be able to learn about Inhibitors, we will be using an inhibitor.\")), mdx(\"h2\", null, \"Creating the File\"), mdx(\"p\", null, \"Let's start by creating a file inside the inhibitors folder called \", mdx(\"inlineCode\", {\n parentName: \"p\"\n }, \"boosted.ts\"), \" and paste the following snippet of code:\"), mdx(\"pre\", null, mdx(\"code\", _extends({\n parentName: \"pre\"\n }, {\n \"className\": \"language-ts\"\n }), \"import { botCache } from \\\"../../mod.ts\\\";\\n\\nbotCache.inhibitors.set(\\\"inhibitorname\\\", async function (message, command, guild) {\\n // Your code goes here\\n});\\n\")), mdx(\"p\", null, \"Inhibitors can take up to 3 arguments.\"), mdx(\"ul\", null, mdx(\"li\", {\n parentName: \"ul\"\n }, mdx(\"inlineCode\", {\n parentName: \"li\"\n }, \"message\"), \": The message object that triggered the command.\"), mdx(\"li\", {\n parentName: \"ul\"\n }, mdx(\"inlineCode\", {\n parentName: \"li\"\n }, \"command\"), \": The command object itself that was triggered.\"), mdx(\"li\", {\n parentName: \"ul\"\n }, mdx(\"inlineCode\", {\n parentName: \"li\"\n }, \"guild\"), \": The server guild object where this command was ran.\")), mdx(\"h2\", null, \"Understanding How Inhibitors Function\"), mdx(\"p\", null, \"To block a command you have to return a truthy value.\"), mdx(\"ul\", null, mdx(\"li\", {\n parentName: \"ul\"\n }, mdx(\"strong\", {\n parentName: \"li\"\n }, \"return true;\"), \" If you return true the inhibitor will block the execution of the command.\\nTo allow a command return a falsey value.\"), mdx(\"li\", {\n parentName: \"ul\"\n }, mdx(\"strong\", {\n parentName: \"li\"\n }, \"return false;\"), \" If you return false the inhibitor will not block the error.\")), mdx(\"pre\", null, mdx(\"code\", _extends({\n parentName: \"pre\"\n }, {\n \"className\": \"language-ts\"\n }), \"// If the command is not VIP only we can allow this command to execute\\nif (!command.vipOnly) return false;\\n\\n// The bot's support server\\nconst guild = cache.guilds.get(configs.supportServerID);\\n// If the command author is not in the server they won't have the vip role so cancel the command\\nconst\\n// Check if the user has the vip role on the support server given by patreon\\nconst userIsVIP = await isUserVIP(message.author.id)\\n// The user is VIP so we can allow this command to be used\\nif (userIsVIP) return false;\\n\\n// The user is NOT VIP so we throw an error\\nthrow `The ${command.name} is only allowed for VIP users.`\\n\")));\n}\n;\nMDXContent.isMDXComponent = true;","rawMDXOutput":"/* @jsx mdx */\nimport { mdx } from '@mdx-js/react';\n/* @jsx mdx */\n\nexport const _frontmatter = {\n \"title\": \"Creating Inhibitors!\",\n \"metaTitle\": \"Creating An Inhibitor | Discordeno\",\n \"metaDescription\": \"Let's create our very own bot with Discordeno!\"\n};\n\nconst layoutProps = {\n _frontmatter\n};\nconst MDXLayout = \"wrapper\"\nexport default function MDXContent({\n components,\n ...props\n}) {\n return \n

{`Woah! You are almost half way done with understanding all of Discordeno. Amazing isn't it? Something you may have noticed in the last section was there were some options that prevented some commands from running like `}{`dmOnly`}{` or the permission options. we created a setting to prevent the monitor from running in certain channels. What if we wanted to do prevent commands from happening? How would we prevent commands from running?`}

\n

{`What is an Inhibitor?`}

\n

{`An Inhibitor is very similar to how monitors work. A monitor runs on every message but an inhibitor runs on every command. Remember all those command options like cooldown, permissions, permissionLevel, nsfw, etc... Each and every one of these options has an inhibitor in that checks commands for these settings.`}

\n

{`Let's create our own inhibitor that would prevent commands from being used if the user is not a VIP user.`}

\n
\n

{`Note:`}{` It is important to remember that everything below can be done with a simple permission level as well. We will create our own custom permission levels but for the purposes of this guide and to be able to learn about Inhibitors, we will be using an inhibitor.`}

\n
\n

{`Creating the File`}

\n

{`Let's start by creating a file inside the inhibitors folder called `}{`boosted.ts`}{` and paste the following snippet of code:`}

\n
{`import { botCache } from \"../../mod.ts\";\n\nbotCache.inhibitors.set(\"inhibitorname\", async function (message, command, guild) {\n    // Your code goes here\n});\n`}
\n

{`Inhibitors can take up to 3 arguments.`}

\n
    \n
  • {`message`}{`: The message object that triggered the command.`}
  • \n
  • {`command`}{`: The command object itself that was triggered.`}
  • \n
  • {`guild`}{`: The server guild object where this command was ran.`}
  • \n
\n

{`Understanding How Inhibitors Function`}

\n

{`To block a command you have to return a truthy value.`}

\n
    \n
  • {`return true;`}{` If you return true the inhibitor will block the execution of the command.\nTo allow a command return a falsey value.`}
  • \n
  • {`return false;`}{` If you return false the inhibitor will not block the error.`}
  • \n
\n
{`// If the command is not VIP only we can allow this command to execute\nif (!command.vipOnly) return false;\n\n// The bot's support server\nconst guild = cache.guilds.get(configs.supportServerID);\n// If the command author is not in the server they won't have the vip role so cancel the command\nconst\n// Check if the user has the vip role on the support server given by patreon\nconst userIsVIP = await isUserVIP(message.author.id)\n// The user is VIP so we can allow this command to be used\nif (userIsVIP) return false;\n\n// The user is NOT VIP so we throw an error\nthrow \\`The \\${command.name} is only allowed for VIP users.\\`\n`}
\n\n
;\n}\n\n;\nMDXContent.isMDXComponent = true;"}} \ No newline at end of file diff --git a/docs/.cache/caches/gatsby-plugin-mdx/diskstore-04ffaeb7e60f7c69f2be2d9c62d27c89.json b/docs/.cache/caches/gatsby-plugin-mdx/diskstore-04ffaeb7e60f7c69f2be2d9c62d27c89.json new file mode 100644 index 000000000..9b1083eef --- /dev/null +++ b/docs/.cache/caches/gatsby-plugin-mdx/diskstore-04ffaeb7e60f7c69f2be2d9c62d27c89.json @@ -0,0 +1 @@ +{"expireTime":9007200851634321000,"key":"gatsby-plugin-mdx-entire-payload-d0d6823119271639c2160defab512786-","val":{"mdast":{"type":"root","children":[{"type":"paragraph","children":[{"type":"text","value":"Woah! You are almost half way done with understanding all of Discordeno. Amazing isn't it? Something you may have noticed in the last section was there were some options that prevented some commands from running like ","position":{"start":{"line":2,"column":1,"offset":1},"end":{"line":2,"column":218,"offset":218},"indent":[]}},{"type":"inlineCode","value":"dmOnly","position":{"start":{"line":2,"column":218,"offset":218},"end":{"line":2,"column":226,"offset":226},"indent":[]}},{"type":"text","value":" or the permission options. we created a setting to prevent the monitor from running in certain channels. What if we wanted to do prevent commands from happening? How would we prevent commands from running?","position":{"start":{"line":2,"column":226,"offset":226},"end":{"line":2,"column":432,"offset":432},"indent":[]}}],"position":{"start":{"line":2,"column":1,"offset":1},"end":{"line":2,"column":432,"offset":432},"indent":[]}},{"type":"heading","depth":2,"children":[{"type":"text","value":"What is an Inhibitor?","position":{"start":{"line":4,"column":4,"offset":437},"end":{"line":4,"column":25,"offset":458},"indent":[]}}],"position":{"start":{"line":4,"column":1,"offset":434},"end":{"line":4,"column":25,"offset":458},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"An Inhibitor is very similar to how monitors work. A monitor runs on every message but an inhibitor runs on every command. Remember all those command options like cooldown, permissions, permissionLevel, nsfw, etc... Each and every one of these options has an inhibitor in that checks commands for these settings.","position":{"start":{"line":6,"column":1,"offset":460},"end":{"line":6,"column":313,"offset":772},"indent":[]}}],"position":{"start":{"line":6,"column":1,"offset":460},"end":{"line":6,"column":313,"offset":772},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"Let's create our own inhibitor that would prevent commands from being used if the user is not a VIP user.","position":{"start":{"line":8,"column":1,"offset":774},"end":{"line":8,"column":106,"offset":879},"indent":[]}}],"position":{"start":{"line":8,"column":1,"offset":774},"end":{"line":8,"column":106,"offset":879},"indent":[]}},{"type":"blockquote","children":[{"type":"paragraph","children":[{"type":"strong","children":[{"type":"text","value":"Note:","position":{"start":{"line":10,"column":5,"offset":885},"end":{"line":10,"column":10,"offset":890},"indent":[]}}],"position":{"start":{"line":10,"column":3,"offset":883},"end":{"line":10,"column":12,"offset":892},"indent":[]}},{"type":"text","value":" It is important to remember that everything below can be done with a simple permission level as well. We will create our own custom permission levels but for the purposes of this guide and to be able to learn about Inhibitors, we will be using an inhibitor.","position":{"start":{"line":10,"column":12,"offset":892},"end":{"line":10,"column":270,"offset":1150},"indent":[]}}],"position":{"start":{"line":10,"column":3,"offset":883},"end":{"line":10,"column":270,"offset":1150},"indent":[]}}],"position":{"start":{"line":10,"column":1,"offset":881},"end":{"line":10,"column":270,"offset":1150},"indent":[]}},{"type":"heading","depth":2,"children":[{"type":"text","value":"Creating the File","position":{"start":{"line":12,"column":4,"offset":1155},"end":{"line":12,"column":21,"offset":1172},"indent":[]}}],"position":{"start":{"line":12,"column":1,"offset":1152},"end":{"line":12,"column":21,"offset":1172},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"Let's start by creating a file inside the inhibitors folder called ","position":{"start":{"line":14,"column":1,"offset":1174},"end":{"line":14,"column":68,"offset":1241},"indent":[]}},{"type":"inlineCode","value":"boosted.ts","position":{"start":{"line":14,"column":68,"offset":1241},"end":{"line":14,"column":80,"offset":1253},"indent":[]}},{"type":"text","value":" and paste the following snippet of code:","position":{"start":{"line":14,"column":80,"offset":1253},"end":{"line":14,"column":121,"offset":1294},"indent":[]}}],"position":{"start":{"line":14,"column":1,"offset":1174},"end":{"line":14,"column":121,"offset":1294},"indent":[]}},{"type":"code","lang":"ts","meta":null,"value":"import { botCache } from \"../../mod.ts\";\n\nbotCache.inhibitors.set(\"inhibitorname\", async function (message, command, guild) {\n\t// Your code goes here\n});","position":{"start":{"line":16,"column":1,"offset":1296},"end":{"line":22,"column":4,"offset":1459},"indent":[1,1,1,1,1,1]}},{"type":"paragraph","children":[{"type":"text","value":"Inhibitors can take up to 3 arguments.","position":{"start":{"line":24,"column":1,"offset":1461},"end":{"line":24,"column":39,"offset":1499},"indent":[]}}],"position":{"start":{"line":24,"column":1,"offset":1461},"end":{"line":24,"column":39,"offset":1499},"indent":[]}},{"type":"list","ordered":false,"start":null,"spread":false,"children":[{"type":"listItem","spread":false,"checked":null,"children":[{"type":"paragraph","children":[{"type":"inlineCode","value":"message","position":{"start":{"line":26,"column":3,"offset":1503},"end":{"line":26,"column":12,"offset":1512},"indent":[]}},{"type":"text","value":": The message object that triggered the command.","position":{"start":{"line":26,"column":12,"offset":1512},"end":{"line":26,"column":60,"offset":1560},"indent":[]}}],"position":{"start":{"line":26,"column":3,"offset":1503},"end":{"line":26,"column":60,"offset":1560},"indent":[]}}],"position":{"start":{"line":26,"column":1,"offset":1501},"end":{"line":26,"column":60,"offset":1560},"indent":[]}},{"type":"listItem","spread":false,"checked":null,"children":[{"type":"paragraph","children":[{"type":"inlineCode","value":"command","position":{"start":{"line":27,"column":3,"offset":1563},"end":{"line":27,"column":12,"offset":1572},"indent":[]}},{"type":"text","value":": The command object itself that was triggered.","position":{"start":{"line":27,"column":12,"offset":1572},"end":{"line":27,"column":59,"offset":1619},"indent":[]}}],"position":{"start":{"line":27,"column":3,"offset":1563},"end":{"line":27,"column":59,"offset":1619},"indent":[]}}],"position":{"start":{"line":27,"column":1,"offset":1561},"end":{"line":27,"column":59,"offset":1619},"indent":[]}},{"type":"listItem","spread":false,"checked":null,"children":[{"type":"paragraph","children":[{"type":"inlineCode","value":"guild","position":{"start":{"line":28,"column":3,"offset":1622},"end":{"line":28,"column":10,"offset":1629},"indent":[]}},{"type":"text","value":": The server guild object where this command was ran.","position":{"start":{"line":28,"column":10,"offset":1629},"end":{"line":28,"column":63,"offset":1682},"indent":[]}}],"position":{"start":{"line":28,"column":3,"offset":1622},"end":{"line":28,"column":63,"offset":1682},"indent":[]}}],"position":{"start":{"line":28,"column":1,"offset":1620},"end":{"line":28,"column":63,"offset":1682},"indent":[]}}],"position":{"start":{"line":26,"column":1,"offset":1501},"end":{"line":28,"column":63,"offset":1682},"indent":[1,1]}},{"type":"heading","depth":2,"children":[{"type":"text","value":"Understanding How Inhibitors Function","position":{"start":{"line":30,"column":4,"offset":1687},"end":{"line":30,"column":41,"offset":1724},"indent":[]}}],"position":{"start":{"line":30,"column":1,"offset":1684},"end":{"line":30,"column":41,"offset":1724},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"To block a command you have to return a truthy value.","position":{"start":{"line":32,"column":1,"offset":1726},"end":{"line":32,"column":54,"offset":1779},"indent":[]}}],"position":{"start":{"line":32,"column":1,"offset":1726},"end":{"line":32,"column":54,"offset":1779},"indent":[]}},{"type":"list","ordered":false,"start":null,"spread":false,"children":[{"type":"listItem","spread":false,"checked":null,"children":[{"type":"paragraph","children":[{"type":"strong","children":[{"type":"text","value":"return true;","position":{"start":{"line":33,"column":5,"offset":1784},"end":{"line":33,"column":17,"offset":1796},"indent":[]}}],"position":{"start":{"line":33,"column":3,"offset":1782},"end":{"line":33,"column":19,"offset":1798},"indent":[]}},{"type":"text","value":" If you return true the inhibitor will block the execution of the command.\nTo allow a command return a falsey value.","position":{"start":{"line":33,"column":19,"offset":1798},"end":{"line":34,"column":42,"offset":1914},"indent":[1]}}],"position":{"start":{"line":33,"column":3,"offset":1782},"end":{"line":34,"column":42,"offset":1914},"indent":[1]}}],"position":{"start":{"line":33,"column":1,"offset":1780},"end":{"line":34,"column":42,"offset":1914},"indent":[1]}},{"type":"listItem","spread":false,"checked":null,"children":[{"type":"paragraph","children":[{"type":"strong","children":[{"type":"text","value":"return false;","position":{"start":{"line":35,"column":5,"offset":1919},"end":{"line":35,"column":18,"offset":1932},"indent":[]}}],"position":{"start":{"line":35,"column":3,"offset":1917},"end":{"line":35,"column":20,"offset":1934},"indent":[]}},{"type":"text","value":" If you return false the inhibitor will not block the error.","position":{"start":{"line":35,"column":20,"offset":1934},"end":{"line":35,"column":80,"offset":1994},"indent":[]}}],"position":{"start":{"line":35,"column":3,"offset":1917},"end":{"line":35,"column":80,"offset":1994},"indent":[]}}],"position":{"start":{"line":35,"column":1,"offset":1915},"end":{"line":35,"column":80,"offset":1994},"indent":[]}}],"position":{"start":{"line":33,"column":1,"offset":1780},"end":{"line":35,"column":80,"offset":1994},"indent":[1,1]}},{"type":"code","lang":"ts","meta":null,"value":"// If the command is not VIP only we can allow this command to execute\nif (!command.vipOnly) return false;\n\n// The bot's support server\nconst guild = cache.guilds.get(configs.supportServerID);\n// If the command author is not in the server they won't have the vip role\nconst member = guild.members.get(message.author.id) || await getMember(guild.id, message.author.id);\n// Member doesn't exist so cancel the command\nif (!member) {\n\tsendMessage(m)\n\treturn true;\n}\n\n// If the user has the vip role on the support server given by patreon allow the command\nif (member.roles.includes(configs.patreonVIPRoleID)) return false;\n\n// Cancel the command since the user does not have vip\nreturn true;","position":{"start":{"line":38,"column":1,"offset":1997},"end":{"line":57,"column":4,"offset":2694},"indent":[1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1]}},{"type":"export","value":"export const _frontmatter = {\"title\":\"Creating Inhibitors!\",\"metaTitle\":\"Creating An Inhibitor | Discordeno\",\"metaDescription\":\"Let's create our very own bot with Discordeno!\"}","position":{"start":{"line":60,"column":1,"offset":2697},"end":{"line":60,"column":177,"offset":2873},"indent":[]}}],"position":{"start":{"line":1,"column":1,"offset":0},"end":{"line":60,"column":177,"offset":2873}}},"scopeImports":["import * as React from 'react'"],"scopeIdentifiers":["React"],"body":"function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }\n\nfunction _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }\n\nfunction _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }\n\n/* @jsx mdx */\nvar _frontmatter = {\n \"title\": \"Creating Inhibitors!\",\n \"metaTitle\": \"Creating An Inhibitor | Discordeno\",\n \"metaDescription\": \"Let's create our very own bot with Discordeno!\"\n};\nvar layoutProps = {\n _frontmatter: _frontmatter\n};\nvar MDXLayout = \"wrapper\";\nreturn function MDXContent(_ref) {\n var components = _ref.components,\n props = _objectWithoutProperties(_ref, [\"components\"]);\n\n return mdx(MDXLayout, _extends({}, layoutProps, props, {\n components: components,\n mdxType: \"MDXLayout\"\n }), mdx(\"p\", null, \"Woah! You are almost half way done with understanding all of Discordeno. Amazing isn't it? Something you may have noticed in the last section was there were some options that prevented some commands from running like \", mdx(\"inlineCode\", {\n parentName: \"p\"\n }, \"dmOnly\"), \" or the permission options. we created a setting to prevent the monitor from running in certain channels. What if we wanted to do prevent commands from happening? How would we prevent commands from running?\"), mdx(\"h2\", null, \"What is an Inhibitor?\"), mdx(\"p\", null, \"An Inhibitor is very similar to how monitors work. A monitor runs on every message but an inhibitor runs on every command. Remember all those command options like cooldown, permissions, permissionLevel, nsfw, etc... Each and every one of these options has an inhibitor in that checks commands for these settings.\"), mdx(\"p\", null, \"Let's create our own inhibitor that would prevent commands from being used if the user is not a VIP user.\"), mdx(\"blockquote\", null, mdx(\"p\", {\n parentName: \"blockquote\"\n }, mdx(\"strong\", {\n parentName: \"p\"\n }, \"Note:\"), \" It is important to remember that everything below can be done with a simple permission level as well. We will create our own custom permission levels but for the purposes of this guide and to be able to learn about Inhibitors, we will be using an inhibitor.\")), mdx(\"h2\", null, \"Creating the File\"), mdx(\"p\", null, \"Let's start by creating a file inside the inhibitors folder called \", mdx(\"inlineCode\", {\n parentName: \"p\"\n }, \"boosted.ts\"), \" and paste the following snippet of code:\"), mdx(\"pre\", null, mdx(\"code\", _extends({\n parentName: \"pre\"\n }, {\n \"className\": \"language-ts\"\n }), \"import { botCache } from \\\"../../mod.ts\\\";\\n\\nbotCache.inhibitors.set(\\\"inhibitorname\\\", async function (message, command, guild) {\\n // Your code goes here\\n});\\n\")), mdx(\"p\", null, \"Inhibitors can take up to 3 arguments.\"), mdx(\"ul\", null, mdx(\"li\", {\n parentName: \"ul\"\n }, mdx(\"inlineCode\", {\n parentName: \"li\"\n }, \"message\"), \": The message object that triggered the command.\"), mdx(\"li\", {\n parentName: \"ul\"\n }, mdx(\"inlineCode\", {\n parentName: \"li\"\n }, \"command\"), \": The command object itself that was triggered.\"), mdx(\"li\", {\n parentName: \"ul\"\n }, mdx(\"inlineCode\", {\n parentName: \"li\"\n }, \"guild\"), \": The server guild object where this command was ran.\")), mdx(\"h2\", null, \"Understanding How Inhibitors Function\"), mdx(\"p\", null, \"To block a command you have to return a truthy value.\"), mdx(\"ul\", null, mdx(\"li\", {\n parentName: \"ul\"\n }, mdx(\"strong\", {\n parentName: \"li\"\n }, \"return true;\"), \" If you return true the inhibitor will block the execution of the command.\\nTo allow a command return a falsey value.\"), mdx(\"li\", {\n parentName: \"ul\"\n }, mdx(\"strong\", {\n parentName: \"li\"\n }, \"return false;\"), \" If you return false the inhibitor will not block the error.\")), mdx(\"pre\", null, mdx(\"code\", _extends({\n parentName: \"pre\"\n }, {\n \"className\": \"language-ts\"\n }), \"// If the command is not VIP only we can allow this command to execute\\nif (!command.vipOnly) return false;\\n\\n// The bot's support server\\nconst guild = cache.guilds.get(configs.supportServerID);\\n// If the command author is not in the server they won't have the vip role\\nconst member = guild.members.get(message.author.id) || await getMember(guild.id, message.author.id);\\n// Member doesn't exist so cancel the command\\nif (!member) {\\n sendMessage(m)\\n return true;\\n}\\n\\n// If the user has the vip role on the support server given by patreon allow the command\\nif (member.roles.includes(configs.patreonVIPRoleID)) return false;\\n\\n// Cancel the command since the user does not have vip\\nreturn true;\\n\")));\n}\n;\nMDXContent.isMDXComponent = true;","rawMDXOutput":"/* @jsx mdx */\nimport { mdx } from '@mdx-js/react';\n/* @jsx mdx */\n\nexport const _frontmatter = {\n \"title\": \"Creating Inhibitors!\",\n \"metaTitle\": \"Creating An Inhibitor | Discordeno\",\n \"metaDescription\": \"Let's create our very own bot with Discordeno!\"\n};\n\nconst layoutProps = {\n _frontmatter\n};\nconst MDXLayout = \"wrapper\"\nexport default function MDXContent({\n components,\n ...props\n}) {\n return \n

{`Woah! You are almost half way done with understanding all of Discordeno. Amazing isn't it? Something you may have noticed in the last section was there were some options that prevented some commands from running like `}{`dmOnly`}{` or the permission options. we created a setting to prevent the monitor from running in certain channels. What if we wanted to do prevent commands from happening? How would we prevent commands from running?`}

\n

{`What is an Inhibitor?`}

\n

{`An Inhibitor is very similar to how monitors work. A monitor runs on every message but an inhibitor runs on every command. Remember all those command options like cooldown, permissions, permissionLevel, nsfw, etc... Each and every one of these options has an inhibitor in that checks commands for these settings.`}

\n

{`Let's create our own inhibitor that would prevent commands from being used if the user is not a VIP user.`}

\n
\n

{`Note:`}{` It is important to remember that everything below can be done with a simple permission level as well. We will create our own custom permission levels but for the purposes of this guide and to be able to learn about Inhibitors, we will be using an inhibitor.`}

\n
\n

{`Creating the File`}

\n

{`Let's start by creating a file inside the inhibitors folder called `}{`boosted.ts`}{` and paste the following snippet of code:`}

\n
{`import { botCache } from \"../../mod.ts\";\n\nbotCache.inhibitors.set(\"inhibitorname\", async function (message, command, guild) {\n    // Your code goes here\n});\n`}
\n

{`Inhibitors can take up to 3 arguments.`}

\n
    \n
  • {`message`}{`: The message object that triggered the command.`}
  • \n
  • {`command`}{`: The command object itself that was triggered.`}
  • \n
  • {`guild`}{`: The server guild object where this command was ran.`}
  • \n
\n

{`Understanding How Inhibitors Function`}

\n

{`To block a command you have to return a truthy value.`}

\n
    \n
  • {`return true;`}{` If you return true the inhibitor will block the execution of the command.\nTo allow a command return a falsey value.`}
  • \n
  • {`return false;`}{` If you return false the inhibitor will not block the error.`}
  • \n
\n
{`// If the command is not VIP only we can allow this command to execute\nif (!command.vipOnly) return false;\n\n// The bot's support server\nconst guild = cache.guilds.get(configs.supportServerID);\n// If the command author is not in the server they won't have the vip role\nconst member = guild.members.get(message.author.id) || await getMember(guild.id, message.author.id);\n// Member doesn't exist so cancel the command\nif (!member) {\n    sendMessage(m)\n    return true;\n}\n\n// If the user has the vip role on the support server given by patreon allow the command\nif (member.roles.includes(configs.patreonVIPRoleID)) return false;\n\n// Cancel the command since the user does not have vip\nreturn true;\n`}
\n\n
;\n}\n\n;\nMDXContent.isMDXComponent = true;"}} \ No newline at end of file diff --git a/docs/.cache/caches/gatsby-plugin-mdx/diskstore-05230a4939f290a6033bbfc09ea1b935.json b/docs/.cache/caches/gatsby-plugin-mdx/diskstore-05230a4939f290a6033bbfc09ea1b935.json new file mode 100644 index 000000000..c20fc82b6 --- /dev/null +++ b/docs/.cache/caches/gatsby-plugin-mdx/diskstore-05230a4939f290a6033bbfc09ea1b935.json @@ -0,0 +1 @@ +{"expireTime":9007200851634374000,"key":"gatsby-plugin-mdx-entire-payload-d34ba72dc067c0c7e92a1fbf67336ac2-","val":{"mdast":{"type":"root","children":[{"type":"paragraph","children":[{"type":"text","value":"Woah! You are almost half way done with understanding all of Discordeno. Amazing isn't it? Something you may have noticed in the last section was there were some options that prevented some commands from running like ","position":{"start":{"line":2,"column":1,"offset":1},"end":{"line":2,"column":218,"offset":218},"indent":[]}},{"type":"inlineCode","value":"dmOnly","position":{"start":{"line":2,"column":218,"offset":218},"end":{"line":2,"column":226,"offset":226},"indent":[]}},{"type":"text","value":" or the permission options. we created a setting to prevent the monitor from running in certain channels. What if we wanted to do prevent commands from happening? How would we prevent commands from running?","position":{"start":{"line":2,"column":226,"offset":226},"end":{"line":2,"column":432,"offset":432},"indent":[]}}],"position":{"start":{"line":2,"column":1,"offset":1},"end":{"line":2,"column":432,"offset":432},"indent":[]}},{"type":"heading","depth":2,"children":[{"type":"text","value":"What is an Inhibitor?","position":{"start":{"line":4,"column":4,"offset":437},"end":{"line":4,"column":25,"offset":458},"indent":[]}}],"position":{"start":{"line":4,"column":1,"offset":434},"end":{"line":4,"column":25,"offset":458},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"An Inhibitor is very similar to how monitors work. A monitor runs on every message but an inhibitor runs on every command. Remember all those command options like cooldown, permissions, permissionLevel, nsfw, etc... Each and every one of these options has an inhibitor in that checks commands for these settings.","position":{"start":{"line":6,"column":1,"offset":460},"end":{"line":6,"column":313,"offset":772},"indent":[]}}],"position":{"start":{"line":6,"column":1,"offset":460},"end":{"line":6,"column":313,"offset":772},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"Let's create our own inhibitor that would prevent commands from being used if the user is not a VIP user.","position":{"start":{"line":8,"column":1,"offset":774},"end":{"line":8,"column":106,"offset":879},"indent":[]}}],"position":{"start":{"line":8,"column":1,"offset":774},"end":{"line":8,"column":106,"offset":879},"indent":[]}},{"type":"blockquote","children":[{"type":"paragraph","children":[{"type":"strong","children":[{"type":"text","value":"Note:","position":{"start":{"line":10,"column":5,"offset":885},"end":{"line":10,"column":10,"offset":890},"indent":[]}}],"position":{"start":{"line":10,"column":3,"offset":883},"end":{"line":10,"column":12,"offset":892},"indent":[]}},{"type":"text","value":" It is important to remember that everything below can be done with a simple permission level as well. We will create our own custom permission levels but for the purposes of this guide and to be able to learn about Inhibitors, we will be using an inhibitor.","position":{"start":{"line":10,"column":12,"offset":892},"end":{"line":10,"column":270,"offset":1150},"indent":[]}}],"position":{"start":{"line":10,"column":3,"offset":883},"end":{"line":10,"column":270,"offset":1150},"indent":[]}}],"position":{"start":{"line":10,"column":1,"offset":881},"end":{"line":10,"column":270,"offset":1150},"indent":[]}},{"type":"heading","depth":2,"children":[{"type":"text","value":"Creating the File","position":{"start":{"line":12,"column":4,"offset":1155},"end":{"line":12,"column":21,"offset":1172},"indent":[]}}],"position":{"start":{"line":12,"column":1,"offset":1152},"end":{"line":12,"column":21,"offset":1172},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"Let's start by creating a file inside the inhibitors folder called ","position":{"start":{"line":14,"column":1,"offset":1174},"end":{"line":14,"column":68,"offset":1241},"indent":[]}},{"type":"inlineCode","value":"boosted.ts","position":{"start":{"line":14,"column":68,"offset":1241},"end":{"line":14,"column":80,"offset":1253},"indent":[]}},{"type":"text","value":" and paste the following snippet of code:","position":{"start":{"line":14,"column":80,"offset":1253},"end":{"line":14,"column":121,"offset":1294},"indent":[]}}],"position":{"start":{"line":14,"column":1,"offset":1174},"end":{"line":14,"column":121,"offset":1294},"indent":[]}},{"type":"code","lang":"ts","meta":null,"value":"import { botCache } from \"../../mod.ts\";\n\nbotCache.inhibitors.set(\"inhibitorname\", async function (message, command, guild) {\n\t// Your code goes here\n});","position":{"start":{"line":16,"column":1,"offset":1296},"end":{"line":22,"column":4,"offset":1459},"indent":[1,1,1,1,1,1]}},{"type":"paragraph","children":[{"type":"text","value":"Inhibitors can take up to 3 arguments.","position":{"start":{"line":24,"column":1,"offset":1461},"end":{"line":24,"column":39,"offset":1499},"indent":[]}}],"position":{"start":{"line":24,"column":1,"offset":1461},"end":{"line":24,"column":39,"offset":1499},"indent":[]}},{"type":"list","ordered":false,"start":null,"spread":false,"children":[{"type":"listItem","spread":false,"checked":null,"children":[{"type":"paragraph","children":[{"type":"inlineCode","value":"message","position":{"start":{"line":26,"column":3,"offset":1503},"end":{"line":26,"column":12,"offset":1512},"indent":[]}},{"type":"text","value":": The message object that triggered the command.","position":{"start":{"line":26,"column":12,"offset":1512},"end":{"line":26,"column":60,"offset":1560},"indent":[]}}],"position":{"start":{"line":26,"column":3,"offset":1503},"end":{"line":26,"column":60,"offset":1560},"indent":[]}}],"position":{"start":{"line":26,"column":1,"offset":1501},"end":{"line":26,"column":60,"offset":1560},"indent":[]}},{"type":"listItem","spread":false,"checked":null,"children":[{"type":"paragraph","children":[{"type":"inlineCode","value":"command","position":{"start":{"line":27,"column":3,"offset":1563},"end":{"line":27,"column":12,"offset":1572},"indent":[]}},{"type":"text","value":": The command object itself that was triggered.","position":{"start":{"line":27,"column":12,"offset":1572},"end":{"line":27,"column":59,"offset":1619},"indent":[]}}],"position":{"start":{"line":27,"column":3,"offset":1563},"end":{"line":27,"column":59,"offset":1619},"indent":[]}}],"position":{"start":{"line":27,"column":1,"offset":1561},"end":{"line":27,"column":59,"offset":1619},"indent":[]}},{"type":"listItem","spread":false,"checked":null,"children":[{"type":"paragraph","children":[{"type":"inlineCode","value":"guild","position":{"start":{"line":28,"column":3,"offset":1622},"end":{"line":28,"column":10,"offset":1629},"indent":[]}},{"type":"text","value":": The server guild object where this command was ran.","position":{"start":{"line":28,"column":10,"offset":1629},"end":{"line":28,"column":63,"offset":1682},"indent":[]}}],"position":{"start":{"line":28,"column":3,"offset":1622},"end":{"line":28,"column":63,"offset":1682},"indent":[]}}],"position":{"start":{"line":28,"column":1,"offset":1620},"end":{"line":28,"column":63,"offset":1682},"indent":[]}}],"position":{"start":{"line":26,"column":1,"offset":1501},"end":{"line":28,"column":63,"offset":1682},"indent":[1,1]}},{"type":"heading","depth":2,"children":[{"type":"text","value":"Understanding How Inhibitors Function","position":{"start":{"line":30,"column":4,"offset":1687},"end":{"line":30,"column":41,"offset":1724},"indent":[]}}],"position":{"start":{"line":30,"column":1,"offset":1684},"end":{"line":30,"column":41,"offset":1724},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"To block a command you have to return a truthy value.","position":{"start":{"line":32,"column":1,"offset":1726},"end":{"line":32,"column":54,"offset":1779},"indent":[]}}],"position":{"start":{"line":32,"column":1,"offset":1726},"end":{"line":32,"column":54,"offset":1779},"indent":[]}},{"type":"list","ordered":false,"start":null,"spread":false,"children":[{"type":"listItem","spread":false,"checked":null,"children":[{"type":"paragraph","children":[{"type":"strong","children":[{"type":"text","value":"return true;","position":{"start":{"line":33,"column":5,"offset":1784},"end":{"line":33,"column":17,"offset":1796},"indent":[]}}],"position":{"start":{"line":33,"column":3,"offset":1782},"end":{"line":33,"column":19,"offset":1798},"indent":[]}},{"type":"text","value":" If you return true the inhibitor will block the execution of the command.\nTo allow a command return a falsey value.","position":{"start":{"line":33,"column":19,"offset":1798},"end":{"line":34,"column":42,"offset":1914},"indent":[1]}}],"position":{"start":{"line":33,"column":3,"offset":1782},"end":{"line":34,"column":42,"offset":1914},"indent":[1]}}],"position":{"start":{"line":33,"column":1,"offset":1780},"end":{"line":34,"column":42,"offset":1914},"indent":[1]}},{"type":"listItem","spread":false,"checked":null,"children":[{"type":"paragraph","children":[{"type":"strong","children":[{"type":"text","value":"return false;","position":{"start":{"line":35,"column":5,"offset":1919},"end":{"line":35,"column":18,"offset":1932},"indent":[]}}],"position":{"start":{"line":35,"column":3,"offset":1917},"end":{"line":35,"column":20,"offset":1934},"indent":[]}},{"type":"text","value":" If you return false the inhibitor will not block the error.","position":{"start":{"line":35,"column":20,"offset":1934},"end":{"line":35,"column":80,"offset":1994},"indent":[]}}],"position":{"start":{"line":35,"column":3,"offset":1917},"end":{"line":35,"column":80,"offset":1994},"indent":[]}}],"position":{"start":{"line":35,"column":1,"offset":1915},"end":{"line":35,"column":80,"offset":1994},"indent":[]}}],"position":{"start":{"line":33,"column":1,"offset":1780},"end":{"line":35,"column":80,"offset":1994},"indent":[1,1]}},{"type":"code","lang":"ts","meta":null,"value":"// If the command is not VIP only we can allow this command to execute\nif (!command.vipOnly) return false;\n\n// The bot's support server\nconst guild = cache.guilds.get(configs.supportServerID);\n// If the command author is not in the server they won't have the vip role\nconst member = guild.members.get(message.author.id) || await getMember(guild.id, message.author.id);\n// Member doesn't exist so cancel the command\nif (!member) {\n\tsendResponse(message, `sorry, but you can not use this command until you become VIP.`)\n\treturn true;\n}\n\n// If the user has the vip role on the support server given by patreon allow the command\nif (member.roles.includes(configs.patreonVIPRoleID)) return false;\n\n// Alert the user they don't have vip and can't use the command\nsendResponse(message, `sorry, but you can not use this command `)\n// Cancel the command since the user does not have vip\nreturn true;","position":{"start":{"line":38,"column":1,"offset":1997},"end":{"line":59,"column":4,"offset":2896},"indent":[1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1]}},{"type":"export","value":"export const _frontmatter = {\"title\":\"Creating Inhibitors!\",\"metaTitle\":\"Creating An Inhibitor | Discordeno\",\"metaDescription\":\"Let's create our very own bot with Discordeno!\"}","position":{"start":{"line":62,"column":1,"offset":2899},"end":{"line":62,"column":177,"offset":3075},"indent":[]}}],"position":{"start":{"line":1,"column":1,"offset":0},"end":{"line":62,"column":177,"offset":3075}}},"scopeImports":["import * as React from 'react'"],"scopeIdentifiers":["React"],"body":"function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }\n\nfunction _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }\n\nfunction _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }\n\n/* @jsx mdx */\nvar _frontmatter = {\n \"title\": \"Creating Inhibitors!\",\n \"metaTitle\": \"Creating An Inhibitor | Discordeno\",\n \"metaDescription\": \"Let's create our very own bot with Discordeno!\"\n};\nvar layoutProps = {\n _frontmatter: _frontmatter\n};\nvar MDXLayout = \"wrapper\";\nreturn function MDXContent(_ref) {\n var components = _ref.components,\n props = _objectWithoutProperties(_ref, [\"components\"]);\n\n return mdx(MDXLayout, _extends({}, layoutProps, props, {\n components: components,\n mdxType: \"MDXLayout\"\n }), mdx(\"p\", null, \"Woah! You are almost half way done with understanding all of Discordeno. Amazing isn't it? Something you may have noticed in the last section was there were some options that prevented some commands from running like \", mdx(\"inlineCode\", {\n parentName: \"p\"\n }, \"dmOnly\"), \" or the permission options. we created a setting to prevent the monitor from running in certain channels. What if we wanted to do prevent commands from happening? How would we prevent commands from running?\"), mdx(\"h2\", null, \"What is an Inhibitor?\"), mdx(\"p\", null, \"An Inhibitor is very similar to how monitors work. A monitor runs on every message but an inhibitor runs on every command. Remember all those command options like cooldown, permissions, permissionLevel, nsfw, etc... Each and every one of these options has an inhibitor in that checks commands for these settings.\"), mdx(\"p\", null, \"Let's create our own inhibitor that would prevent commands from being used if the user is not a VIP user.\"), mdx(\"blockquote\", null, mdx(\"p\", {\n parentName: \"blockquote\"\n }, mdx(\"strong\", {\n parentName: \"p\"\n }, \"Note:\"), \" It is important to remember that everything below can be done with a simple permission level as well. We will create our own custom permission levels but for the purposes of this guide and to be able to learn about Inhibitors, we will be using an inhibitor.\")), mdx(\"h2\", null, \"Creating the File\"), mdx(\"p\", null, \"Let's start by creating a file inside the inhibitors folder called \", mdx(\"inlineCode\", {\n parentName: \"p\"\n }, \"boosted.ts\"), \" and paste the following snippet of code:\"), mdx(\"pre\", null, mdx(\"code\", _extends({\n parentName: \"pre\"\n }, {\n \"className\": \"language-ts\"\n }), \"import { botCache } from \\\"../../mod.ts\\\";\\n\\nbotCache.inhibitors.set(\\\"inhibitorname\\\", async function (message, command, guild) {\\n // Your code goes here\\n});\\n\")), mdx(\"p\", null, \"Inhibitors can take up to 3 arguments.\"), mdx(\"ul\", null, mdx(\"li\", {\n parentName: \"ul\"\n }, mdx(\"inlineCode\", {\n parentName: \"li\"\n }, \"message\"), \": The message object that triggered the command.\"), mdx(\"li\", {\n parentName: \"ul\"\n }, mdx(\"inlineCode\", {\n parentName: \"li\"\n }, \"command\"), \": The command object itself that was triggered.\"), mdx(\"li\", {\n parentName: \"ul\"\n }, mdx(\"inlineCode\", {\n parentName: \"li\"\n }, \"guild\"), \": The server guild object where this command was ran.\")), mdx(\"h2\", null, \"Understanding How Inhibitors Function\"), mdx(\"p\", null, \"To block a command you have to return a truthy value.\"), mdx(\"ul\", null, mdx(\"li\", {\n parentName: \"ul\"\n }, mdx(\"strong\", {\n parentName: \"li\"\n }, \"return true;\"), \" If you return true the inhibitor will block the execution of the command.\\nTo allow a command return a falsey value.\"), mdx(\"li\", {\n parentName: \"ul\"\n }, mdx(\"strong\", {\n parentName: \"li\"\n }, \"return false;\"), \" If you return false the inhibitor will not block the error.\")), mdx(\"pre\", null, mdx(\"code\", _extends({\n parentName: \"pre\"\n }, {\n \"className\": \"language-ts\"\n }), \"// If the command is not VIP only we can allow this command to execute\\nif (!command.vipOnly) return false;\\n\\n// The bot's support server\\nconst guild = cache.guilds.get(configs.supportServerID);\\n// If the command author is not in the server they won't have the vip role\\nconst member = guild.members.get(message.author.id) || await getMember(guild.id, message.author.id);\\n// Member doesn't exist so cancel the command\\nif (!member) {\\n sendResponse(message, `sorry, but you can not use this command until you become VIP.`)\\n return true;\\n}\\n\\n// If the user has the vip role on the support server given by patreon allow the command\\nif (member.roles.includes(configs.patreonVIPRoleID)) return false;\\n\\n// Alert the user they don't have vip and can't use the command\\nsendResponse(message, `sorry, but you can not use this command `)\\n// Cancel the command since the user does not have vip\\nreturn true;\\n\")));\n}\n;\nMDXContent.isMDXComponent = true;","rawMDXOutput":"/* @jsx mdx */\nimport { mdx } from '@mdx-js/react';\n/* @jsx mdx */\n\nexport const _frontmatter = {\n \"title\": \"Creating Inhibitors!\",\n \"metaTitle\": \"Creating An Inhibitor | Discordeno\",\n \"metaDescription\": \"Let's create our very own bot with Discordeno!\"\n};\n\nconst layoutProps = {\n _frontmatter\n};\nconst MDXLayout = \"wrapper\"\nexport default function MDXContent({\n components,\n ...props\n}) {\n return \n

{`Woah! You are almost half way done with understanding all of Discordeno. Amazing isn't it? Something you may have noticed in the last section was there were some options that prevented some commands from running like `}{`dmOnly`}{` or the permission options. we created a setting to prevent the monitor from running in certain channels. What if we wanted to do prevent commands from happening? How would we prevent commands from running?`}

\n

{`What is an Inhibitor?`}

\n

{`An Inhibitor is very similar to how monitors work. A monitor runs on every message but an inhibitor runs on every command. Remember all those command options like cooldown, permissions, permissionLevel, nsfw, etc... Each and every one of these options has an inhibitor in that checks commands for these settings.`}

\n

{`Let's create our own inhibitor that would prevent commands from being used if the user is not a VIP user.`}

\n
\n

{`Note:`}{` It is important to remember that everything below can be done with a simple permission level as well. We will create our own custom permission levels but for the purposes of this guide and to be able to learn about Inhibitors, we will be using an inhibitor.`}

\n
\n

{`Creating the File`}

\n

{`Let's start by creating a file inside the inhibitors folder called `}{`boosted.ts`}{` and paste the following snippet of code:`}

\n
{`import { botCache } from \"../../mod.ts\";\n\nbotCache.inhibitors.set(\"inhibitorname\", async function (message, command, guild) {\n    // Your code goes here\n});\n`}
\n

{`Inhibitors can take up to 3 arguments.`}

\n
    \n
  • {`message`}{`: The message object that triggered the command.`}
  • \n
  • {`command`}{`: The command object itself that was triggered.`}
  • \n
  • {`guild`}{`: The server guild object where this command was ran.`}
  • \n
\n

{`Understanding How Inhibitors Function`}

\n

{`To block a command you have to return a truthy value.`}

\n
    \n
  • {`return true;`}{` If you return true the inhibitor will block the execution of the command.\nTo allow a command return a falsey value.`}
  • \n
  • {`return false;`}{` If you return false the inhibitor will not block the error.`}
  • \n
\n
{`// If the command is not VIP only we can allow this command to execute\nif (!command.vipOnly) return false;\n\n// The bot's support server\nconst guild = cache.guilds.get(configs.supportServerID);\n// If the command author is not in the server they won't have the vip role\nconst member = guild.members.get(message.author.id) || await getMember(guild.id, message.author.id);\n// Member doesn't exist so cancel the command\nif (!member) {\n    sendResponse(message, \\`sorry, but you can not use this command until you become VIP.\\`)\n    return true;\n}\n\n// If the user has the vip role on the support server given by patreon allow the command\nif (member.roles.includes(configs.patreonVIPRoleID)) return false;\n\n// Alert the user they don't have vip and can't use the command\nsendResponse(message, \\`sorry, but you can not use this command \\`)\n// Cancel the command since the user does not have vip\nreturn true;\n`}
\n\n
;\n}\n\n;\nMDXContent.isMDXComponent = true;"}} \ No newline at end of file diff --git a/docs/.cache/caches/gatsby-plugin-mdx/diskstore-05e987acc3d5e7b9d000f7bfe7b62105.json b/docs/.cache/caches/gatsby-plugin-mdx/diskstore-05e987acc3d5e7b9d000f7bfe7b62105.json new file mode 100644 index 000000000..c05ac23c8 --- /dev/null +++ b/docs/.cache/caches/gatsby-plugin-mdx/diskstore-05e987acc3d5e7b9d000f7bfe7b62105.json @@ -0,0 +1 @@ +{"expireTime":9007200851596645000,"key":"gatsby-plugin-mdx-entire-payload-cd2cb429c7e81c29f41367888f96804c-","val":{"mdast":{"type":"root","children":[{"type":"heading","depth":2,"children":[{"type":"text","value":"Understanding The Goals of This Guide","position":{"start":{"line":2,"column":4,"offset":4},"end":{"line":2,"column":41,"offset":41},"indent":[]}}],"position":{"start":{"line":2,"column":1,"offset":1},"end":{"line":2,"column":41,"offset":41},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"This guide is for advanced ","position":{"start":{"line":4,"column":1,"offset":43},"end":{"line":4,"column":28,"offset":70},"indent":[]}}],"position":{"start":{"line":4,"column":1,"offset":43},"end":{"line":4,"column":28,"offset":70},"indent":[]}},{"type":"heading","depth":2,"children":[{"type":"text","value":"Who Made Discordeno?","position":{"start":{"line":6,"column":4,"offset":75},"end":{"line":6,"column":24,"offset":95},"indent":[]}}],"position":{"start":{"line":6,"column":1,"offset":72},"end":{"line":6,"column":24,"offset":95},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"Skillz4Killz. However, there are a lot of other contributors to the project as well. Join the discord server to meet and learn more about the wonderful team!","position":{"start":{"line":8,"column":1,"offset":97},"end":{"line":8,"column":158,"offset":254},"indent":[]}}],"position":{"start":{"line":8,"column":1,"offset":97},"end":{"line":8,"column":158,"offset":254},"indent":[]}},{"type":"heading","depth":2,"children":[{"type":"text","value":"Why You Should Use Discordeno?","position":{"start":{"line":10,"column":4,"offset":259},"end":{"line":10,"column":34,"offset":289},"indent":[]}}],"position":{"start":{"line":10,"column":1,"offset":256},"end":{"line":10,"column":34,"offset":289},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"Discordeno provides you all the tools that you need to make bot development really easy. All the tools are already made for you to just simply copy and use for yourself. We will go through each and every tool in other sections of this guide.","position":{"start":{"line":12,"column":1,"offset":291},"end":{"line":12,"column":242,"offset":532},"indent":[]}}],"position":{"start":{"line":12,"column":1,"offset":291},"end":{"line":12,"column":242,"offset":532},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"As the old saying goes, the best way to learn to ride a bicycle is to actually try riding a bicycle. So let's try out Discordeno.","position":{"start":{"line":14,"column":1,"offset":534},"end":{"line":14,"column":130,"offset":663},"indent":[]}}],"position":{"start":{"line":14,"column":1,"offset":534},"end":{"line":14,"column":130,"offset":663},"indent":[]}},{"type":"export","value":"export const _frontmatter = {\"title\":\"Step By Step Guide\",\"metaTitle\":\"Step By Step Guide | Discordeno\",\"metaDescription\":\"This guide will help you learn every part of Discordeno, step by step to create your own bot as you wish.\"}","position":{"start":{"line":17,"column":1,"offset":666},"end":{"line":17,"column":231,"offset":896},"indent":[]}}],"position":{"start":{"line":1,"column":1,"offset":0},"end":{"line":17,"column":231,"offset":896}}},"scopeImports":["import * as React from 'react'"],"scopeIdentifiers":["React"],"body":"function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }\n\nfunction _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }\n\nfunction _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }\n\n/* @jsx mdx */\nvar _frontmatter = {\n \"title\": \"Step By Step Guide\",\n \"metaTitle\": \"Step By Step Guide | Discordeno\",\n \"metaDescription\": \"This guide will help you learn every part of Discordeno, step by step to create your own bot as you wish.\"\n};\nvar layoutProps = {\n _frontmatter: _frontmatter\n};\nvar MDXLayout = \"wrapper\";\nreturn function MDXContent(_ref) {\n var components = _ref.components,\n props = _objectWithoutProperties(_ref, [\"components\"]);\n\n return mdx(MDXLayout, _extends({}, layoutProps, props, {\n components: components,\n mdxType: \"MDXLayout\"\n }), mdx(\"h2\", null, \"Understanding The Goals of This Guide\"), mdx(\"p\", null, \"This guide is for advanced \"), mdx(\"h2\", null, \"Who Made Discordeno?\"), mdx(\"p\", null, \"Skillz4Killz. However, there are a lot of other contributors to the project as well. Join the discord server to meet and learn more about the wonderful team!\"), mdx(\"h2\", null, \"Why You Should Use Discordeno?\"), mdx(\"p\", null, \"Discordeno provides you all the tools that you need to make bot development really easy. All the tools are already made for you to just simply copy and use for yourself. We will go through each and every tool in other sections of this guide.\"), mdx(\"p\", null, \"As the old saying goes, the best way to learn to ride a bicycle is to actually try riding a bicycle. So let's try out Discordeno.\"));\n}\n;\nMDXContent.isMDXComponent = true;","rawMDXOutput":"/* @jsx mdx */\nimport { mdx } from '@mdx-js/react';\n/* @jsx mdx */\n\nexport const _frontmatter = {\n \"title\": \"Step By Step Guide\",\n \"metaTitle\": \"Step By Step Guide | Discordeno\",\n \"metaDescription\": \"This guide will help you learn every part of Discordeno, step by step to create your own bot as you wish.\"\n};\n\nconst layoutProps = {\n _frontmatter\n};\nconst MDXLayout = \"wrapper\"\nexport default function MDXContent({\n components,\n ...props\n}) {\n return \n

{`Understanding The Goals of This Guide`}

\n

{`This guide is for advanced `}

\n

{`Who Made Discordeno?`}

\n

{`Skillz4Killz. However, there are a lot of other contributors to the project as well. Join the discord server to meet and learn more about the wonderful team!`}

\n

{`Why You Should Use Discordeno?`}

\n

{`Discordeno provides you all the tools that you need to make bot development really easy. All the tools are already made for you to just simply copy and use for yourself. We will go through each and every tool in other sections of this guide.`}

\n

{`As the old saying goes, the best way to learn to ride a bicycle is to actually try riding a bicycle. So let's try out Discordeno.`}

\n\n
;\n}\n\n;\nMDXContent.isMDXComponent = true;"}} \ No newline at end of file diff --git a/docs/.cache/caches/gatsby-plugin-mdx/diskstore-0aedfa9d0d75212ceecd48a3b46b7a7b.json b/docs/.cache/caches/gatsby-plugin-mdx/diskstore-0aedfa9d0d75212ceecd48a3b46b7a7b.json new file mode 100644 index 000000000..d8cc69c68 --- /dev/null +++ b/docs/.cache/caches/gatsby-plugin-mdx/diskstore-0aedfa9d0d75212ceecd48a3b46b7a7b.json @@ -0,0 +1 @@ +{"expireTime":9007200851634247000,"key":"gatsby-plugin-mdx-entire-payload-3d90c956c262f966b6ce8e4a2da823a2-","val":{"mdast":{"type":"root","children":[{"type":"paragraph","children":[{"type":"text","value":"Woah! You are almost half way done with understanding all of Discordeno. Amazing isn't it? Something you may have noticed in the last section was there were some options that prevented some commands from running like ","position":{"start":{"line":2,"column":1,"offset":1},"end":{"line":2,"column":218,"offset":218},"indent":[]}},{"type":"inlineCode","value":"dmOnly","position":{"start":{"line":2,"column":218,"offset":218},"end":{"line":2,"column":226,"offset":226},"indent":[]}},{"type":"text","value":" or the permission options. we created a setting to prevent the monitor from running in certain channels. What if we wanted to do prevent commands from happening? How would we prevent commands from running?","position":{"start":{"line":2,"column":226,"offset":226},"end":{"line":2,"column":432,"offset":432},"indent":[]}}],"position":{"start":{"line":2,"column":1,"offset":1},"end":{"line":2,"column":432,"offset":432},"indent":[]}},{"type":"heading","depth":2,"children":[{"type":"text","value":"What is an Inhibitor?","position":{"start":{"line":4,"column":4,"offset":437},"end":{"line":4,"column":25,"offset":458},"indent":[]}}],"position":{"start":{"line":4,"column":1,"offset":434},"end":{"line":4,"column":25,"offset":458},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"An Inhibitor is very similar to how monitors work. A monitor runs on every message but an inhibitor runs on every command. Remember all those command options like cooldown, permissions, permissionLevel, nsfw, etc... Each and every one of these options has an inhibitor in that checks commands for these settings.","position":{"start":{"line":6,"column":1,"offset":460},"end":{"line":6,"column":313,"offset":772},"indent":[]}}],"position":{"start":{"line":6,"column":1,"offset":460},"end":{"line":6,"column":313,"offset":772},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"Let's create our own inhibitor that would prevent commands from being used if the user is not a VIP user.","position":{"start":{"line":8,"column":1,"offset":774},"end":{"line":8,"column":106,"offset":879},"indent":[]}}],"position":{"start":{"line":8,"column":1,"offset":774},"end":{"line":8,"column":106,"offset":879},"indent":[]}},{"type":"blockquote","children":[{"type":"paragraph","children":[{"type":"strong","children":[{"type":"text","value":"Note:","position":{"start":{"line":10,"column":5,"offset":885},"end":{"line":10,"column":10,"offset":890},"indent":[]}}],"position":{"start":{"line":10,"column":3,"offset":883},"end":{"line":10,"column":12,"offset":892},"indent":[]}},{"type":"text","value":" It is important to remember that everything below can be done with a simple permission level as well. We will create our own custom permission levels but for the purposes of this guide and to be able to learn about Inhibitors, we will be using an inhibitor.","position":{"start":{"line":10,"column":12,"offset":892},"end":{"line":10,"column":270,"offset":1150},"indent":[]}}],"position":{"start":{"line":10,"column":3,"offset":883},"end":{"line":10,"column":270,"offset":1150},"indent":[]}}],"position":{"start":{"line":10,"column":1,"offset":881},"end":{"line":10,"column":270,"offset":1150},"indent":[]}},{"type":"heading","depth":2,"children":[{"type":"text","value":"Creating the File","position":{"start":{"line":12,"column":4,"offset":1155},"end":{"line":12,"column":21,"offset":1172},"indent":[]}}],"position":{"start":{"line":12,"column":1,"offset":1152},"end":{"line":12,"column":21,"offset":1172},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"Let's start by creating a file inside the inhibitors folder called ","position":{"start":{"line":14,"column":1,"offset":1174},"end":{"line":14,"column":68,"offset":1241},"indent":[]}},{"type":"inlineCode","value":"boosted.ts","position":{"start":{"line":14,"column":68,"offset":1241},"end":{"line":14,"column":80,"offset":1253},"indent":[]}},{"type":"text","value":" and paste the following snippet of code:","position":{"start":{"line":14,"column":80,"offset":1253},"end":{"line":14,"column":121,"offset":1294},"indent":[]}}],"position":{"start":{"line":14,"column":1,"offset":1174},"end":{"line":14,"column":121,"offset":1294},"indent":[]}},{"type":"code","lang":"ts","meta":null,"value":"import { botCache } from \"../../mod.ts\";\n\nbotCache.inhibitors.set(\"inhibitorname\", async function (message, command, guild) {\n\t// Your code goes here\n});","position":{"start":{"line":16,"column":1,"offset":1296},"end":{"line":22,"column":4,"offset":1459},"indent":[1,1,1,1,1,1]}},{"type":"paragraph","children":[{"type":"text","value":"Inhibitors can take up to 3 arguments.","position":{"start":{"line":24,"column":1,"offset":1461},"end":{"line":24,"column":39,"offset":1499},"indent":[]}}],"position":{"start":{"line":24,"column":1,"offset":1461},"end":{"line":24,"column":39,"offset":1499},"indent":[]}},{"type":"list","ordered":false,"start":null,"spread":false,"children":[{"type":"listItem","spread":false,"checked":null,"children":[{"type":"paragraph","children":[{"type":"inlineCode","value":"message","position":{"start":{"line":26,"column":3,"offset":1503},"end":{"line":26,"column":12,"offset":1512},"indent":[]}},{"type":"text","value":": The message object that triggered the command.","position":{"start":{"line":26,"column":12,"offset":1512},"end":{"line":26,"column":60,"offset":1560},"indent":[]}}],"position":{"start":{"line":26,"column":3,"offset":1503},"end":{"line":26,"column":60,"offset":1560},"indent":[]}}],"position":{"start":{"line":26,"column":1,"offset":1501},"end":{"line":26,"column":60,"offset":1560},"indent":[]}},{"type":"listItem","spread":false,"checked":null,"children":[{"type":"paragraph","children":[{"type":"inlineCode","value":"command","position":{"start":{"line":27,"column":3,"offset":1563},"end":{"line":27,"column":12,"offset":1572},"indent":[]}},{"type":"text","value":": The command object itself that was triggered.","position":{"start":{"line":27,"column":12,"offset":1572},"end":{"line":27,"column":59,"offset":1619},"indent":[]}}],"position":{"start":{"line":27,"column":3,"offset":1563},"end":{"line":27,"column":59,"offset":1619},"indent":[]}}],"position":{"start":{"line":27,"column":1,"offset":1561},"end":{"line":27,"column":59,"offset":1619},"indent":[]}},{"type":"listItem","spread":false,"checked":null,"children":[{"type":"paragraph","children":[{"type":"inlineCode","value":"guild","position":{"start":{"line":28,"column":3,"offset":1622},"end":{"line":28,"column":10,"offset":1629},"indent":[]}},{"type":"text","value":": The server guild object where this command was ran.","position":{"start":{"line":28,"column":10,"offset":1629},"end":{"line":28,"column":63,"offset":1682},"indent":[]}}],"position":{"start":{"line":28,"column":3,"offset":1622},"end":{"line":28,"column":63,"offset":1682},"indent":[]}}],"position":{"start":{"line":28,"column":1,"offset":1620},"end":{"line":28,"column":63,"offset":1682},"indent":[]}}],"position":{"start":{"line":26,"column":1,"offset":1501},"end":{"line":28,"column":63,"offset":1682},"indent":[1,1]}},{"type":"heading","depth":2,"children":[{"type":"text","value":"Understanding How Inhibitors Function","position":{"start":{"line":30,"column":4,"offset":1687},"end":{"line":30,"column":41,"offset":1724},"indent":[]}}],"position":{"start":{"line":30,"column":1,"offset":1684},"end":{"line":30,"column":41,"offset":1724},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"To block a command you have to return a truthy value.","position":{"start":{"line":32,"column":1,"offset":1726},"end":{"line":32,"column":54,"offset":1779},"indent":[]}}],"position":{"start":{"line":32,"column":1,"offset":1726},"end":{"line":32,"column":54,"offset":1779},"indent":[]}},{"type":"list","ordered":false,"start":null,"spread":false,"children":[{"type":"listItem","spread":false,"checked":null,"children":[{"type":"paragraph","children":[{"type":"strong","children":[{"type":"text","value":"return true;","position":{"start":{"line":33,"column":5,"offset":1784},"end":{"line":33,"column":17,"offset":1796},"indent":[]}}],"position":{"start":{"line":33,"column":3,"offset":1782},"end":{"line":33,"column":19,"offset":1798},"indent":[]}},{"type":"text","value":" If you return true the inhibitor will block the execution of the command.\nTo allow a command return a falsey value.","position":{"start":{"line":33,"column":19,"offset":1798},"end":{"line":34,"column":42,"offset":1914},"indent":[1]}}],"position":{"start":{"line":33,"column":3,"offset":1782},"end":{"line":34,"column":42,"offset":1914},"indent":[1]}}],"position":{"start":{"line":33,"column":1,"offset":1780},"end":{"line":34,"column":42,"offset":1914},"indent":[1]}},{"type":"listItem","spread":false,"checked":null,"children":[{"type":"paragraph","children":[{"type":"strong","children":[{"type":"text","value":"return false;","position":{"start":{"line":35,"column":5,"offset":1919},"end":{"line":35,"column":18,"offset":1932},"indent":[]}}],"position":{"start":{"line":35,"column":3,"offset":1917},"end":{"line":35,"column":20,"offset":1934},"indent":[]}},{"type":"text","value":" If you return false the inhibitor will not block the error.","position":{"start":{"line":35,"column":20,"offset":1934},"end":{"line":35,"column":80,"offset":1994},"indent":[]}}],"position":{"start":{"line":35,"column":3,"offset":1917},"end":{"line":35,"column":80,"offset":1994},"indent":[]}}],"position":{"start":{"line":35,"column":1,"offset":1915},"end":{"line":35,"column":80,"offset":1994},"indent":[]}}],"position":{"start":{"line":33,"column":1,"offset":1780},"end":{"line":35,"column":80,"offset":1994},"indent":[1,1]}},{"type":"code","lang":"ts","meta":null,"value":"// If the command is not VIP only we can allow this command to execute\nif (!command.vipOnly) return false;\n\n// The bot's support server\nconst guild = cache.guilds.get(configs.supportServerID);\n// If the command author is not in the server they won't have the vip role\nconst member = guild.members.get(message.author.id) || await getMember(guild.id, message.author.id);\n// Member doesn't exist so cancel the command\nif (!member) return true;\n\n// If the user has the vip role on the support server given by patreon\nif (userIsVIP) return false;\n\n// The user is NOT VIP so we throw an error\nthrow `The ${command.name} is only allowed for VIP users.`","position":{"start":{"line":38,"column":1,"offset":1997},"end":{"line":54,"column":4,"offset":2652},"indent":[1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1]}},{"type":"export","value":"export const _frontmatter = {\"title\":\"Creating Inhibitors!\",\"metaTitle\":\"Creating An Inhibitor | Discordeno\",\"metaDescription\":\"Let's create our very own bot with Discordeno!\"}","position":{"start":{"line":57,"column":1,"offset":2655},"end":{"line":57,"column":177,"offset":2831},"indent":[]}}],"position":{"start":{"line":1,"column":1,"offset":0},"end":{"line":57,"column":177,"offset":2831}}},"scopeImports":["import * as React from 'react'"],"scopeIdentifiers":["React"],"body":"function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }\n\nfunction _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }\n\nfunction _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }\n\n/* @jsx mdx */\nvar _frontmatter = {\n \"title\": \"Creating Inhibitors!\",\n \"metaTitle\": \"Creating An Inhibitor | Discordeno\",\n \"metaDescription\": \"Let's create our very own bot with Discordeno!\"\n};\nvar layoutProps = {\n _frontmatter: _frontmatter\n};\nvar MDXLayout = \"wrapper\";\nreturn function MDXContent(_ref) {\n var components = _ref.components,\n props = _objectWithoutProperties(_ref, [\"components\"]);\n\n return mdx(MDXLayout, _extends({}, layoutProps, props, {\n components: components,\n mdxType: \"MDXLayout\"\n }), mdx(\"p\", null, \"Woah! You are almost half way done with understanding all of Discordeno. Amazing isn't it? Something you may have noticed in the last section was there were some options that prevented some commands from running like \", mdx(\"inlineCode\", {\n parentName: \"p\"\n }, \"dmOnly\"), \" or the permission options. we created a setting to prevent the monitor from running in certain channels. What if we wanted to do prevent commands from happening? How would we prevent commands from running?\"), mdx(\"h2\", null, \"What is an Inhibitor?\"), mdx(\"p\", null, \"An Inhibitor is very similar to how monitors work. A monitor runs on every message but an inhibitor runs on every command. Remember all those command options like cooldown, permissions, permissionLevel, nsfw, etc... Each and every one of these options has an inhibitor in that checks commands for these settings.\"), mdx(\"p\", null, \"Let's create our own inhibitor that would prevent commands from being used if the user is not a VIP user.\"), mdx(\"blockquote\", null, mdx(\"p\", {\n parentName: \"blockquote\"\n }, mdx(\"strong\", {\n parentName: \"p\"\n }, \"Note:\"), \" It is important to remember that everything below can be done with a simple permission level as well. We will create our own custom permission levels but for the purposes of this guide and to be able to learn about Inhibitors, we will be using an inhibitor.\")), mdx(\"h2\", null, \"Creating the File\"), mdx(\"p\", null, \"Let's start by creating a file inside the inhibitors folder called \", mdx(\"inlineCode\", {\n parentName: \"p\"\n }, \"boosted.ts\"), \" and paste the following snippet of code:\"), mdx(\"pre\", null, mdx(\"code\", _extends({\n parentName: \"pre\"\n }, {\n \"className\": \"language-ts\"\n }), \"import { botCache } from \\\"../../mod.ts\\\";\\n\\nbotCache.inhibitors.set(\\\"inhibitorname\\\", async function (message, command, guild) {\\n // Your code goes here\\n});\\n\")), mdx(\"p\", null, \"Inhibitors can take up to 3 arguments.\"), mdx(\"ul\", null, mdx(\"li\", {\n parentName: \"ul\"\n }, mdx(\"inlineCode\", {\n parentName: \"li\"\n }, \"message\"), \": The message object that triggered the command.\"), mdx(\"li\", {\n parentName: \"ul\"\n }, mdx(\"inlineCode\", {\n parentName: \"li\"\n }, \"command\"), \": The command object itself that was triggered.\"), mdx(\"li\", {\n parentName: \"ul\"\n }, mdx(\"inlineCode\", {\n parentName: \"li\"\n }, \"guild\"), \": The server guild object where this command was ran.\")), mdx(\"h2\", null, \"Understanding How Inhibitors Function\"), mdx(\"p\", null, \"To block a command you have to return a truthy value.\"), mdx(\"ul\", null, mdx(\"li\", {\n parentName: \"ul\"\n }, mdx(\"strong\", {\n parentName: \"li\"\n }, \"return true;\"), \" If you return true the inhibitor will block the execution of the command.\\nTo allow a command return a falsey value.\"), mdx(\"li\", {\n parentName: \"ul\"\n }, mdx(\"strong\", {\n parentName: \"li\"\n }, \"return false;\"), \" If you return false the inhibitor will not block the error.\")), mdx(\"pre\", null, mdx(\"code\", _extends({\n parentName: \"pre\"\n }, {\n \"className\": \"language-ts\"\n }), \"// If the command is not VIP only we can allow this command to execute\\nif (!command.vipOnly) return false;\\n\\n// The bot's support server\\nconst guild = cache.guilds.get(configs.supportServerID);\\n// If the command author is not in the server they won't have the vip role\\nconst member = guild.members.get(message.author.id) || await getMember(guild.id, message.author.id);\\n// Member doesn't exist so cancel the command\\nif (!member) return true;\\n\\n// If the user has the vip role on the support server given by patreon\\nif (userIsVIP) return false;\\n\\n// The user is NOT VIP so we throw an error\\nthrow `The ${command.name} is only allowed for VIP users.`\\n\")));\n}\n;\nMDXContent.isMDXComponent = true;","rawMDXOutput":"/* @jsx mdx */\nimport { mdx } from '@mdx-js/react';\n/* @jsx mdx */\n\nexport const _frontmatter = {\n \"title\": \"Creating Inhibitors!\",\n \"metaTitle\": \"Creating An Inhibitor | Discordeno\",\n \"metaDescription\": \"Let's create our very own bot with Discordeno!\"\n};\n\nconst layoutProps = {\n _frontmatter\n};\nconst MDXLayout = \"wrapper\"\nexport default function MDXContent({\n components,\n ...props\n}) {\n return \n

{`Woah! You are almost half way done with understanding all of Discordeno. Amazing isn't it? Something you may have noticed in the last section was there were some options that prevented some commands from running like `}{`dmOnly`}{` or the permission options. we created a setting to prevent the monitor from running in certain channels. What if we wanted to do prevent commands from happening? How would we prevent commands from running?`}

\n

{`What is an Inhibitor?`}

\n

{`An Inhibitor is very similar to how monitors work. A monitor runs on every message but an inhibitor runs on every command. Remember all those command options like cooldown, permissions, permissionLevel, nsfw, etc... Each and every one of these options has an inhibitor in that checks commands for these settings.`}

\n

{`Let's create our own inhibitor that would prevent commands from being used if the user is not a VIP user.`}

\n
\n

{`Note:`}{` It is important to remember that everything below can be done with a simple permission level as well. We will create our own custom permission levels but for the purposes of this guide and to be able to learn about Inhibitors, we will be using an inhibitor.`}

\n
\n

{`Creating the File`}

\n

{`Let's start by creating a file inside the inhibitors folder called `}{`boosted.ts`}{` and paste the following snippet of code:`}

\n
{`import { botCache } from \"../../mod.ts\";\n\nbotCache.inhibitors.set(\"inhibitorname\", async function (message, command, guild) {\n    // Your code goes here\n});\n`}
\n

{`Inhibitors can take up to 3 arguments.`}

\n
    \n
  • {`message`}{`: The message object that triggered the command.`}
  • \n
  • {`command`}{`: The command object itself that was triggered.`}
  • \n
  • {`guild`}{`: The server guild object where this command was ran.`}
  • \n
\n

{`Understanding How Inhibitors Function`}

\n

{`To block a command you have to return a truthy value.`}

\n
    \n
  • {`return true;`}{` If you return true the inhibitor will block the execution of the command.\nTo allow a command return a falsey value.`}
  • \n
  • {`return false;`}{` If you return false the inhibitor will not block the error.`}
  • \n
\n
{`// If the command is not VIP only we can allow this command to execute\nif (!command.vipOnly) return false;\n\n// The bot's support server\nconst guild = cache.guilds.get(configs.supportServerID);\n// If the command author is not in the server they won't have the vip role\nconst member = guild.members.get(message.author.id) || await getMember(guild.id, message.author.id);\n// Member doesn't exist so cancel the command\nif (!member) return true;\n\n// If the user has the vip role on the support server given by patreon\nif (userIsVIP) return false;\n\n// The user is NOT VIP so we throw an error\nthrow \\`The \\${command.name} is only allowed for VIP users.\\`\n`}
\n\n
;\n}\n\n;\nMDXContent.isMDXComponent = true;"}} \ No newline at end of file diff --git a/docs/.cache/caches/gatsby-plugin-mdx/diskstore-0b81b8775aeaa953c65a46009331eb99.json b/docs/.cache/caches/gatsby-plugin-mdx/diskstore-0b81b8775aeaa953c65a46009331eb99.json new file mode 100644 index 000000000..27c6a70e9 --- /dev/null +++ b/docs/.cache/caches/gatsby-plugin-mdx/diskstore-0b81b8775aeaa953c65a46009331eb99.json @@ -0,0 +1 @@ +{"expireTime":9007200851634080000,"key":"gatsby-plugin-mdx-entire-payload-f73c0ca158a03c3334866e2dc427ed15-","val":{"mdast":{"type":"root","children":[{"type":"paragraph","children":[{"type":"text","value":"Woah! You are almost half way done with understanding all of Discordeno. Amazing isn't it? Something you may have noticed in the last section was there were some options that prevented some commands from running like ","position":{"start":{"line":2,"column":1,"offset":1},"end":{"line":2,"column":218,"offset":218},"indent":[]}},{"type":"inlineCode","value":"dmOnly","position":{"start":{"line":2,"column":218,"offset":218},"end":{"line":2,"column":226,"offset":226},"indent":[]}},{"type":"text","value":" or the permission options. we created a setting to prevent the monitor from running in certain channels. What if we wanted to do prevent commands from happening? How would we prevent commands from running?","position":{"start":{"line":2,"column":226,"offset":226},"end":{"line":2,"column":432,"offset":432},"indent":[]}}],"position":{"start":{"line":2,"column":1,"offset":1},"end":{"line":2,"column":432,"offset":432},"indent":[]}},{"type":"heading","depth":2,"children":[{"type":"text","value":"What is an Inhibitor?","position":{"start":{"line":4,"column":4,"offset":437},"end":{"line":4,"column":25,"offset":458},"indent":[]}}],"position":{"start":{"line":4,"column":1,"offset":434},"end":{"line":4,"column":25,"offset":458},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"An Inhibitor is very similar to how monitors work. A monitor runs on every message but an inhibitor runs on every command. Remember all those command options like cooldown, permissions, permissionLevel, nsfw, etc... Each and every one of these options has an inhibitor in that checks commands for these settings.","position":{"start":{"line":6,"column":1,"offset":460},"end":{"line":6,"column":313,"offset":772},"indent":[]}}],"position":{"start":{"line":6,"column":1,"offset":460},"end":{"line":6,"column":313,"offset":772},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"Let's create our own inhibitor that would prevent commands from being used if the user is not a VIP user.","position":{"start":{"line":8,"column":1,"offset":774},"end":{"line":8,"column":106,"offset":879},"indent":[]}}],"position":{"start":{"line":8,"column":1,"offset":774},"end":{"line":8,"column":106,"offset":879},"indent":[]}},{"type":"blockquote","children":[{"type":"paragraph","children":[{"type":"strong","children":[{"type":"text","value":"Note:","position":{"start":{"line":10,"column":5,"offset":885},"end":{"line":10,"column":10,"offset":890},"indent":[]}}],"position":{"start":{"line":10,"column":3,"offset":883},"end":{"line":10,"column":12,"offset":892},"indent":[]}},{"type":"text","value":" It is important to remember that everything below can be done with a simple permission level as well. We will create our own custom permission levels but for the purposes of this guide and to be able to learn about Inhibitors, we will be using an inhibitor.","position":{"start":{"line":10,"column":12,"offset":892},"end":{"line":10,"column":270,"offset":1150},"indent":[]}}],"position":{"start":{"line":10,"column":3,"offset":883},"end":{"line":10,"column":270,"offset":1150},"indent":[]}}],"position":{"start":{"line":10,"column":1,"offset":881},"end":{"line":10,"column":270,"offset":1150},"indent":[]}},{"type":"heading","depth":2,"children":[{"type":"text","value":"Creating the File","position":{"start":{"line":12,"column":4,"offset":1155},"end":{"line":12,"column":21,"offset":1172},"indent":[]}}],"position":{"start":{"line":12,"column":1,"offset":1152},"end":{"line":12,"column":21,"offset":1172},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"Let's start by creating a file inside the inhibitors folder called ","position":{"start":{"line":14,"column":1,"offset":1174},"end":{"line":14,"column":68,"offset":1241},"indent":[]}},{"type":"inlineCode","value":"boosted.ts","position":{"start":{"line":14,"column":68,"offset":1241},"end":{"line":14,"column":80,"offset":1253},"indent":[]}},{"type":"text","value":" and paste the following snippet of code:","position":{"start":{"line":14,"column":80,"offset":1253},"end":{"line":14,"column":121,"offset":1294},"indent":[]}}],"position":{"start":{"line":14,"column":1,"offset":1174},"end":{"line":14,"column":121,"offset":1294},"indent":[]}},{"type":"code","lang":"ts","meta":null,"value":"import { botCache } from \"../../mod.ts\";\n\nbotCache.inhibitors.set(\"inhibitorname\", async function (message, command, guild) {\n\t// Your code goes here\n});","position":{"start":{"line":16,"column":1,"offset":1296},"end":{"line":22,"column":4,"offset":1459},"indent":[1,1,1,1,1,1]}},{"type":"paragraph","children":[{"type":"text","value":"Inhibitors can take up to 3 arguments.","position":{"start":{"line":24,"column":1,"offset":1461},"end":{"line":24,"column":39,"offset":1499},"indent":[]}}],"position":{"start":{"line":24,"column":1,"offset":1461},"end":{"line":24,"column":39,"offset":1499},"indent":[]}},{"type":"list","ordered":false,"start":null,"spread":false,"children":[{"type":"listItem","spread":false,"checked":null,"children":[{"type":"paragraph","children":[{"type":"inlineCode","value":"message","position":{"start":{"line":26,"column":3,"offset":1503},"end":{"line":26,"column":12,"offset":1512},"indent":[]}},{"type":"text","value":": The message object that triggered the command.","position":{"start":{"line":26,"column":12,"offset":1512},"end":{"line":26,"column":60,"offset":1560},"indent":[]}}],"position":{"start":{"line":26,"column":3,"offset":1503},"end":{"line":26,"column":60,"offset":1560},"indent":[]}}],"position":{"start":{"line":26,"column":1,"offset":1501},"end":{"line":26,"column":60,"offset":1560},"indent":[]}},{"type":"listItem","spread":false,"checked":null,"children":[{"type":"paragraph","children":[{"type":"inlineCode","value":"command","position":{"start":{"line":27,"column":3,"offset":1563},"end":{"line":27,"column":12,"offset":1572},"indent":[]}},{"type":"text","value":": The command object itself that was triggered.","position":{"start":{"line":27,"column":12,"offset":1572},"end":{"line":27,"column":59,"offset":1619},"indent":[]}}],"position":{"start":{"line":27,"column":3,"offset":1563},"end":{"line":27,"column":59,"offset":1619},"indent":[]}}],"position":{"start":{"line":27,"column":1,"offset":1561},"end":{"line":27,"column":59,"offset":1619},"indent":[]}},{"type":"listItem","spread":false,"checked":null,"children":[{"type":"paragraph","children":[{"type":"inlineCode","value":"guild","position":{"start":{"line":28,"column":3,"offset":1622},"end":{"line":28,"column":10,"offset":1629},"indent":[]}},{"type":"text","value":": The server guild object where this command was ran.","position":{"start":{"line":28,"column":10,"offset":1629},"end":{"line":28,"column":63,"offset":1682},"indent":[]}}],"position":{"start":{"line":28,"column":3,"offset":1622},"end":{"line":28,"column":63,"offset":1682},"indent":[]}}],"position":{"start":{"line":28,"column":1,"offset":1620},"end":{"line":28,"column":63,"offset":1682},"indent":[]}}],"position":{"start":{"line":26,"column":1,"offset":1501},"end":{"line":28,"column":63,"offset":1682},"indent":[1,1]}},{"type":"heading","depth":2,"children":[{"type":"text","value":"Understanding How Inhibitors Function","position":{"start":{"line":30,"column":4,"offset":1687},"end":{"line":30,"column":41,"offset":1724},"indent":[]}}],"position":{"start":{"line":30,"column":1,"offset":1684},"end":{"line":30,"column":41,"offset":1724},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"To block a command you have to return a truthy value.","position":{"start":{"line":32,"column":1,"offset":1726},"end":{"line":32,"column":54,"offset":1779},"indent":[]}}],"position":{"start":{"line":32,"column":1,"offset":1726},"end":{"line":32,"column":54,"offset":1779},"indent":[]}},{"type":"list","ordered":false,"start":null,"spread":false,"children":[{"type":"listItem","spread":false,"checked":null,"children":[{"type":"paragraph","children":[{"type":"strong","children":[{"type":"text","value":"return true;","position":{"start":{"line":33,"column":5,"offset":1784},"end":{"line":33,"column":17,"offset":1796},"indent":[]}}],"position":{"start":{"line":33,"column":3,"offset":1782},"end":{"line":33,"column":19,"offset":1798},"indent":[]}},{"type":"text","value":" If you return true the inhibitor will block the execution of the command.\nTo allow a command return a falsey value.","position":{"start":{"line":33,"column":19,"offset":1798},"end":{"line":34,"column":42,"offset":1914},"indent":[1]}}],"position":{"start":{"line":33,"column":3,"offset":1782},"end":{"line":34,"column":42,"offset":1914},"indent":[1]}}],"position":{"start":{"line":33,"column":1,"offset":1780},"end":{"line":34,"column":42,"offset":1914},"indent":[1]}},{"type":"listItem","spread":false,"checked":null,"children":[{"type":"paragraph","children":[{"type":"strong","children":[{"type":"text","value":"return false;","position":{"start":{"line":35,"column":5,"offset":1919},"end":{"line":35,"column":18,"offset":1932},"indent":[]}}],"position":{"start":{"line":35,"column":3,"offset":1917},"end":{"line":35,"column":20,"offset":1934},"indent":[]}},{"type":"text","value":" If you return false the inhibitor will not block the error.","position":{"start":{"line":35,"column":20,"offset":1934},"end":{"line":35,"column":80,"offset":1994},"indent":[]}}],"position":{"start":{"line":35,"column":3,"offset":1917},"end":{"line":35,"column":80,"offset":1994},"indent":[]}}],"position":{"start":{"line":35,"column":1,"offset":1915},"end":{"line":35,"column":80,"offset":1994},"indent":[]}}],"position":{"start":{"line":33,"column":1,"offset":1780},"end":{"line":35,"column":80,"offset":1994},"indent":[1,1]}},{"type":"code","lang":"ts","meta":null,"value":"// If the command is not VIP only we can allow this command to execute\nif (!command.vipOnly) return false;\n\n// Check if the user has boosted this\nconst userIsVIP = await isUserVIP(message.author.id)\n// The user is VIP so we can allow this command to be used\nif (userIsVIP) return false;\n\n// The user is NOT VIP so we throw an error\nthrow `The ${command.name} is only allowed for VIP users.`","position":{"start":{"line":38,"column":1,"offset":1997},"end":{"line":49,"column":4,"offset":2397},"indent":[1,1,1,1,1,1,1,1,1,1,1]}},{"type":"export","value":"export const _frontmatter = {\"title\":\"Creating Inhibitors!\",\"metaTitle\":\"Creating An Inhibitor | Discordeno\",\"metaDescription\":\"Let's create our very own bot with Discordeno!\"}","position":{"start":{"line":52,"column":1,"offset":2400},"end":{"line":52,"column":177,"offset":2576},"indent":[]}}],"position":{"start":{"line":1,"column":1,"offset":0},"end":{"line":52,"column":177,"offset":2576}}},"scopeImports":["import * as React from 'react'"],"scopeIdentifiers":["React"],"body":"function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }\n\nfunction _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }\n\nfunction _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }\n\n/* @jsx mdx */\nvar _frontmatter = {\n \"title\": \"Creating Inhibitors!\",\n \"metaTitle\": \"Creating An Inhibitor | Discordeno\",\n \"metaDescription\": \"Let's create our very own bot with Discordeno!\"\n};\nvar layoutProps = {\n _frontmatter: _frontmatter\n};\nvar MDXLayout = \"wrapper\";\nreturn function MDXContent(_ref) {\n var components = _ref.components,\n props = _objectWithoutProperties(_ref, [\"components\"]);\n\n return mdx(MDXLayout, _extends({}, layoutProps, props, {\n components: components,\n mdxType: \"MDXLayout\"\n }), mdx(\"p\", null, \"Woah! You are almost half way done with understanding all of Discordeno. Amazing isn't it? Something you may have noticed in the last section was there were some options that prevented some commands from running like \", mdx(\"inlineCode\", {\n parentName: \"p\"\n }, \"dmOnly\"), \" or the permission options. we created a setting to prevent the monitor from running in certain channels. What if we wanted to do prevent commands from happening? How would we prevent commands from running?\"), mdx(\"h2\", null, \"What is an Inhibitor?\"), mdx(\"p\", null, \"An Inhibitor is very similar to how monitors work. A monitor runs on every message but an inhibitor runs on every command. Remember all those command options like cooldown, permissions, permissionLevel, nsfw, etc... Each and every one of these options has an inhibitor in that checks commands for these settings.\"), mdx(\"p\", null, \"Let's create our own inhibitor that would prevent commands from being used if the user is not a VIP user.\"), mdx(\"blockquote\", null, mdx(\"p\", {\n parentName: \"blockquote\"\n }, mdx(\"strong\", {\n parentName: \"p\"\n }, \"Note:\"), \" It is important to remember that everything below can be done with a simple permission level as well. We will create our own custom permission levels but for the purposes of this guide and to be able to learn about Inhibitors, we will be using an inhibitor.\")), mdx(\"h2\", null, \"Creating the File\"), mdx(\"p\", null, \"Let's start by creating a file inside the inhibitors folder called \", mdx(\"inlineCode\", {\n parentName: \"p\"\n }, \"boosted.ts\"), \" and paste the following snippet of code:\"), mdx(\"pre\", null, mdx(\"code\", _extends({\n parentName: \"pre\"\n }, {\n \"className\": \"language-ts\"\n }), \"import { botCache } from \\\"../../mod.ts\\\";\\n\\nbotCache.inhibitors.set(\\\"inhibitorname\\\", async function (message, command, guild) {\\n // Your code goes here\\n});\\n\")), mdx(\"p\", null, \"Inhibitors can take up to 3 arguments.\"), mdx(\"ul\", null, mdx(\"li\", {\n parentName: \"ul\"\n }, mdx(\"inlineCode\", {\n parentName: \"li\"\n }, \"message\"), \": The message object that triggered the command.\"), mdx(\"li\", {\n parentName: \"ul\"\n }, mdx(\"inlineCode\", {\n parentName: \"li\"\n }, \"command\"), \": The command object itself that was triggered.\"), mdx(\"li\", {\n parentName: \"ul\"\n }, mdx(\"inlineCode\", {\n parentName: \"li\"\n }, \"guild\"), \": The server guild object where this command was ran.\")), mdx(\"h2\", null, \"Understanding How Inhibitors Function\"), mdx(\"p\", null, \"To block a command you have to return a truthy value.\"), mdx(\"ul\", null, mdx(\"li\", {\n parentName: \"ul\"\n }, mdx(\"strong\", {\n parentName: \"li\"\n }, \"return true;\"), \" If you return true the inhibitor will block the execution of the command.\\nTo allow a command return a falsey value.\"), mdx(\"li\", {\n parentName: \"ul\"\n }, mdx(\"strong\", {\n parentName: \"li\"\n }, \"return false;\"), \" If you return false the inhibitor will not block the error.\")), mdx(\"pre\", null, mdx(\"code\", _extends({\n parentName: \"pre\"\n }, {\n \"className\": \"language-ts\"\n }), \"// If the command is not VIP only we can allow this command to execute\\nif (!command.vipOnly) return false;\\n\\n// Check if the user has boosted this\\nconst userIsVIP = await isUserVIP(message.author.id)\\n// The user is VIP so we can allow this command to be used\\nif (userIsVIP) return false;\\n\\n// The user is NOT VIP so we throw an error\\nthrow `The ${command.name} is only allowed for VIP users.`\\n\")));\n}\n;\nMDXContent.isMDXComponent = true;","rawMDXOutput":"/* @jsx mdx */\nimport { mdx } from '@mdx-js/react';\n/* @jsx mdx */\n\nexport const _frontmatter = {\n \"title\": \"Creating Inhibitors!\",\n \"metaTitle\": \"Creating An Inhibitor | Discordeno\",\n \"metaDescription\": \"Let's create our very own bot with Discordeno!\"\n};\n\nconst layoutProps = {\n _frontmatter\n};\nconst MDXLayout = \"wrapper\"\nexport default function MDXContent({\n components,\n ...props\n}) {\n return \n

{`Woah! You are almost half way done with understanding all of Discordeno. Amazing isn't it? Something you may have noticed in the last section was there were some options that prevented some commands from running like `}{`dmOnly`}{` or the permission options. we created a setting to prevent the monitor from running in certain channels. What if we wanted to do prevent commands from happening? How would we prevent commands from running?`}

\n

{`What is an Inhibitor?`}

\n

{`An Inhibitor is very similar to how monitors work. A monitor runs on every message but an inhibitor runs on every command. Remember all those command options like cooldown, permissions, permissionLevel, nsfw, etc... Each and every one of these options has an inhibitor in that checks commands for these settings.`}

\n

{`Let's create our own inhibitor that would prevent commands from being used if the user is not a VIP user.`}

\n
\n

{`Note:`}{` It is important to remember that everything below can be done with a simple permission level as well. We will create our own custom permission levels but for the purposes of this guide and to be able to learn about Inhibitors, we will be using an inhibitor.`}

\n
\n

{`Creating the File`}

\n

{`Let's start by creating a file inside the inhibitors folder called `}{`boosted.ts`}{` and paste the following snippet of code:`}

\n
{`import { botCache } from \"../../mod.ts\";\n\nbotCache.inhibitors.set(\"inhibitorname\", async function (message, command, guild) {\n    // Your code goes here\n});\n`}
\n

{`Inhibitors can take up to 3 arguments.`}

\n
    \n
  • {`message`}{`: The message object that triggered the command.`}
  • \n
  • {`command`}{`: The command object itself that was triggered.`}
  • \n
  • {`guild`}{`: The server guild object where this command was ran.`}
  • \n
\n

{`Understanding How Inhibitors Function`}

\n

{`To block a command you have to return a truthy value.`}

\n
    \n
  • {`return true;`}{` If you return true the inhibitor will block the execution of the command.\nTo allow a command return a falsey value.`}
  • \n
  • {`return false;`}{` If you return false the inhibitor will not block the error.`}
  • \n
\n
{`// If the command is not VIP only we can allow this command to execute\nif (!command.vipOnly) return false;\n\n// Check if the user has boosted this\nconst userIsVIP = await isUserVIP(message.author.id)\n// The user is VIP so we can allow this command to be used\nif (userIsVIP) return false;\n\n// The user is NOT VIP so we throw an error\nthrow \\`The \\${command.name} is only allowed for VIP users.\\`\n`}
\n\n
;\n}\n\n;\nMDXContent.isMDXComponent = true;"}} \ No newline at end of file diff --git a/docs/.cache/caches/gatsby-plugin-mdx/diskstore-0d2c17f1488867f2dffe5b55ad3a4316.json b/docs/.cache/caches/gatsby-plugin-mdx/diskstore-0d2c17f1488867f2dffe5b55ad3a4316.json new file mode 100644 index 000000000..e482193a6 --- /dev/null +++ b/docs/.cache/caches/gatsby-plugin-mdx/diskstore-0d2c17f1488867f2dffe5b55ad3a4316.json @@ -0,0 +1 @@ +{"expireTime":9007200851634843000,"key":"gatsby-plugin-mdx-entire-payload-acea779192442a6b1c236bb084e650dc-","val":{"mdast":{"type":"root","children":[{"type":"paragraph","children":[{"type":"text","value":"Woah! You are almost half way done with understanding all of Discordeno. Amazing isn't it? Something you may have noticed in the last section was there were some options that prevented some commands from running like ","position":{"start":{"line":2,"column":1,"offset":1},"end":{"line":2,"column":218,"offset":218},"indent":[]}},{"type":"inlineCode","value":"dmOnly","position":{"start":{"line":2,"column":218,"offset":218},"end":{"line":2,"column":226,"offset":226},"indent":[]}},{"type":"text","value":" or the permission options. we created a setting to prevent the monitor from running in certain channels. What if we wanted to do prevent commands from happening? How would we prevent commands from running?","position":{"start":{"line":2,"column":226,"offset":226},"end":{"line":2,"column":432,"offset":432},"indent":[]}}],"position":{"start":{"line":2,"column":1,"offset":1},"end":{"line":2,"column":432,"offset":432},"indent":[]}},{"type":"heading","depth":2,"children":[{"type":"text","value":"What is an Inhibitor?","position":{"start":{"line":4,"column":4,"offset":437},"end":{"line":4,"column":25,"offset":458},"indent":[]}}],"position":{"start":{"line":4,"column":1,"offset":434},"end":{"line":4,"column":25,"offset":458},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"An Inhibitor is very similar to how monitors work. A monitor runs on every message but an inhibitor runs on every command. Remember all those command options like cooldown, permissions, permissionLevel, nsfw, etc... Each and every one of these options has an inhibitor in that checks commands for these settings.","position":{"start":{"line":6,"column":1,"offset":460},"end":{"line":6,"column":313,"offset":772},"indent":[]}}],"position":{"start":{"line":6,"column":1,"offset":460},"end":{"line":6,"column":313,"offset":772},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"Let's create our own inhibitor that would prevent commands from being used if the user is not a VIP user.","position":{"start":{"line":8,"column":1,"offset":774},"end":{"line":8,"column":106,"offset":879},"indent":[]}}],"position":{"start":{"line":8,"column":1,"offset":774},"end":{"line":8,"column":106,"offset":879},"indent":[]}},{"type":"blockquote","children":[{"type":"paragraph","children":[{"type":"strong","children":[{"type":"text","value":"Note:","position":{"start":{"line":10,"column":5,"offset":885},"end":{"line":10,"column":10,"offset":890},"indent":[]}}],"position":{"start":{"line":10,"column":3,"offset":883},"end":{"line":10,"column":12,"offset":892},"indent":[]}},{"type":"text","value":" It is important to remember that everything below can be done with a simple permission level as well. We will create our own custom permission levels but for the purposes of this guide and to be able to learn about Inhibitors, we will be using an inhibitor.","position":{"start":{"line":10,"column":12,"offset":892},"end":{"line":10,"column":270,"offset":1150},"indent":[]}}],"position":{"start":{"line":10,"column":3,"offset":883},"end":{"line":10,"column":270,"offset":1150},"indent":[]}}],"position":{"start":{"line":10,"column":1,"offset":881},"end":{"line":10,"column":270,"offset":1150},"indent":[]}},{"type":"heading","depth":2,"children":[{"type":"text","value":"Creating the File","position":{"start":{"line":12,"column":4,"offset":1155},"end":{"line":12,"column":21,"offset":1172},"indent":[]}}],"position":{"start":{"line":12,"column":1,"offset":1152},"end":{"line":12,"column":21,"offset":1172},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"Let's start by creating a file inside the inhibitors folder called ","position":{"start":{"line":14,"column":1,"offset":1174},"end":{"line":14,"column":68,"offset":1241},"indent":[]}},{"type":"inlineCode","value":"boosted.ts","position":{"start":{"line":14,"column":68,"offset":1241},"end":{"line":14,"column":80,"offset":1253},"indent":[]}},{"type":"text","value":" and paste the following snippet of code:","position":{"start":{"line":14,"column":80,"offset":1253},"end":{"line":14,"column":121,"offset":1294},"indent":[]}}],"position":{"start":{"line":14,"column":1,"offset":1174},"end":{"line":14,"column":121,"offset":1294},"indent":[]}},{"type":"code","lang":"ts","meta":null,"value":"import { botCache } from \"../../mod.ts\";\n\nbotCache.inhibitors.set(\"inhibitorname\", async function (message, command, guild) {\n\t// Your code goes here\n});","position":{"start":{"line":16,"column":1,"offset":1296},"end":{"line":22,"column":4,"offset":1459},"indent":[1,1,1,1,1,1]}},{"type":"paragraph","children":[{"type":"text","value":"Inhibitors can take up to 3 arguments.","position":{"start":{"line":24,"column":1,"offset":1461},"end":{"line":24,"column":39,"offset":1499},"indent":[]}}],"position":{"start":{"line":24,"column":1,"offset":1461},"end":{"line":24,"column":39,"offset":1499},"indent":[]}},{"type":"list","ordered":false,"start":null,"spread":false,"children":[{"type":"listItem","spread":false,"checked":null,"children":[{"type":"paragraph","children":[{"type":"inlineCode","value":"message","position":{"start":{"line":26,"column":3,"offset":1503},"end":{"line":26,"column":12,"offset":1512},"indent":[]}},{"type":"text","value":": The message object that triggered the command.","position":{"start":{"line":26,"column":12,"offset":1512},"end":{"line":26,"column":60,"offset":1560},"indent":[]}}],"position":{"start":{"line":26,"column":3,"offset":1503},"end":{"line":26,"column":60,"offset":1560},"indent":[]}}],"position":{"start":{"line":26,"column":1,"offset":1501},"end":{"line":26,"column":60,"offset":1560},"indent":[]}},{"type":"listItem","spread":false,"checked":null,"children":[{"type":"paragraph","children":[{"type":"inlineCode","value":"command","position":{"start":{"line":27,"column":3,"offset":1563},"end":{"line":27,"column":12,"offset":1572},"indent":[]}},{"type":"text","value":": The command object itself that was triggered.","position":{"start":{"line":27,"column":12,"offset":1572},"end":{"line":27,"column":59,"offset":1619},"indent":[]}}],"position":{"start":{"line":27,"column":3,"offset":1563},"end":{"line":27,"column":59,"offset":1619},"indent":[]}}],"position":{"start":{"line":27,"column":1,"offset":1561},"end":{"line":27,"column":59,"offset":1619},"indent":[]}},{"type":"listItem","spread":false,"checked":null,"children":[{"type":"paragraph","children":[{"type":"inlineCode","value":"guild","position":{"start":{"line":28,"column":3,"offset":1622},"end":{"line":28,"column":10,"offset":1629},"indent":[]}},{"type":"text","value":": The server guild object where this command was ran.","position":{"start":{"line":28,"column":10,"offset":1629},"end":{"line":28,"column":63,"offset":1682},"indent":[]}}],"position":{"start":{"line":28,"column":3,"offset":1622},"end":{"line":28,"column":63,"offset":1682},"indent":[]}}],"position":{"start":{"line":28,"column":1,"offset":1620},"end":{"line":28,"column":63,"offset":1682},"indent":[]}}],"position":{"start":{"line":26,"column":1,"offset":1501},"end":{"line":28,"column":63,"offset":1682},"indent":[1,1]}},{"type":"heading","depth":2,"children":[{"type":"text","value":"Understanding How Inhibitors Function","position":{"start":{"line":30,"column":4,"offset":1687},"end":{"line":30,"column":41,"offset":1724},"indent":[]}}],"position":{"start":{"line":30,"column":1,"offset":1684},"end":{"line":30,"column":41,"offset":1724},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"To block a command you have to return a truthy value.","position":{"start":{"line":32,"column":1,"offset":1726},"end":{"line":32,"column":54,"offset":1779},"indent":[]}}],"position":{"start":{"line":32,"column":1,"offset":1726},"end":{"line":32,"column":54,"offset":1779},"indent":[]}},{"type":"list","ordered":false,"start":null,"spread":false,"children":[{"type":"listItem","spread":false,"checked":null,"children":[{"type":"paragraph","children":[{"type":"strong","children":[{"type":"text","value":"return true;","position":{"start":{"line":33,"column":5,"offset":1784},"end":{"line":33,"column":17,"offset":1796},"indent":[]}}],"position":{"start":{"line":33,"column":3,"offset":1782},"end":{"line":33,"column":19,"offset":1798},"indent":[]}},{"type":"text","value":" If you return true the inhibitor will block the execution of the command.\nTo allow a command return a falsey value.","position":{"start":{"line":33,"column":19,"offset":1798},"end":{"line":34,"column":42,"offset":1914},"indent":[1]}}],"position":{"start":{"line":33,"column":3,"offset":1782},"end":{"line":34,"column":42,"offset":1914},"indent":[1]}}],"position":{"start":{"line":33,"column":1,"offset":1780},"end":{"line":34,"column":42,"offset":1914},"indent":[1]}},{"type":"listItem","spread":false,"checked":null,"children":[{"type":"paragraph","children":[{"type":"strong","children":[{"type":"text","value":"return false;","position":{"start":{"line":35,"column":5,"offset":1919},"end":{"line":35,"column":18,"offset":1932},"indent":[]}}],"position":{"start":{"line":35,"column":3,"offset":1917},"end":{"line":35,"column":20,"offset":1934},"indent":[]}},{"type":"text","value":" If you return false the inhibitor will not block the error.","position":{"start":{"line":35,"column":20,"offset":1934},"end":{"line":35,"column":80,"offset":1994},"indent":[]}}],"position":{"start":{"line":35,"column":3,"offset":1917},"end":{"line":35,"column":80,"offset":1994},"indent":[]}}],"position":{"start":{"line":35,"column":1,"offset":1915},"end":{"line":35,"column":80,"offset":1994},"indent":[]}}],"position":{"start":{"line":33,"column":1,"offset":1780},"end":{"line":35,"column":80,"offset":1994},"indent":[1,1]}},{"type":"code","lang":"ts","meta":null,"value":"// If the command is not VIP only we can allow this command to execute\nif (!command.vipOnly) return false;\n\n// The bot's support server\nconst guild = cache.guilds.get(configs.supportServerID);\n// If the command author is not in the server they won't have the vip role\nconst member = guild.members.get(message.author.id) || await getMember(guild.id, message.author.id);\n// Member doesn't exist so cancel the command\nif (!member) {\n\tsendResponse(message, `sorry, but you can not use this command until you become VIP. **Close the IRIS!!!**`)\n\treturn true;\n}\n\n// If the user has the vip role on the support server given by patreon allow the command\nif (member.roles.includes(configs.roleIDs.patreonVIPRoleID)) return false;\n\n// Alert the user they don't have vip and can't use the command\nsendResponse(message, `sorry, but you can not use this command until you become a VIP. I'm sorry, Teal'c. We'll go to Disneyland next year. I promise.`)\n// Cancel the command since the user does not have vip\nreturn true;","position":{"start":{"line":38,"column":1,"offset":1997},"end":{"line":59,"column":4,"offset":3013},"indent":[1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1]}},{"type":"heading","depth":2,"children":[{"type":"text","value":"Challenges","position":{"start":{"line":61,"column":4,"offset":3018},"end":{"line":61,"column":14,"offset":3028},"indent":[]}}],"position":{"start":{"line":61,"column":1,"offset":3015},"end":{"line":61,"column":14,"offset":3028},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"Hell yes! We just got through the entire inhibitor section. You have now mastered everything related to inhibitors.","position":{"start":{"line":63,"column":1,"offset":3030},"end":{"line":63,"column":116,"offset":3145},"indent":[]}}],"position":{"start":{"line":63,"column":1,"offset":3030},"end":{"line":63,"column":116,"offset":3145},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"You can now try and get a little more practice with inhibitors by trying to challenge yourself and make your own inhibitors. Don't worry if you can't think of any good use cases for inhibitors.","position":{"start":{"line":65,"column":1,"offset":3147},"end":{"line":65,"column":194,"offset":3340},"indent":[]}}],"position":{"start":{"line":65,"column":1,"offset":3147},"end":{"line":65,"column":194,"offset":3340},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"Majority of Discordeno bots do not use many custom inhibitors because most of the necessary/important ones already come built for you in the inhibitors folder.","position":{"start":{"line":67,"column":1,"offset":3342},"end":{"line":67,"column":160,"offset":3501},"indent":[]}}],"position":{"start":{"line":67,"column":1,"offset":3342},"end":{"line":67,"column":160,"offset":3501},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"Next we will try our hands at creating a monitor.","position":{"start":{"line":69,"column":1,"offset":3503},"end":{"line":69,"column":50,"offset":3552},"indent":[]}}],"position":{"start":{"line":69,"column":1,"offset":3503},"end":{"line":69,"column":50,"offset":3552},"indent":[]}},{"type":"export","value":"export const _frontmatter = {\"title\":\"Creating Inhibitors!\",\"metaTitle\":\"Creating An Inhibitor | Discordeno\",\"metaDescription\":\"Let's create our very own bot with Discordeno!\"}","position":{"start":{"line":72,"column":1,"offset":3555},"end":{"line":72,"column":177,"offset":3731},"indent":[]}}],"position":{"start":{"line":1,"column":1,"offset":0},"end":{"line":72,"column":177,"offset":3731}}},"scopeImports":["import * as React from 'react'"],"scopeIdentifiers":["React"],"body":"function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }\n\nfunction _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }\n\nfunction _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }\n\n/* @jsx mdx */\nvar _frontmatter = {\n \"title\": \"Creating Inhibitors!\",\n \"metaTitle\": \"Creating An Inhibitor | Discordeno\",\n \"metaDescription\": \"Let's create our very own bot with Discordeno!\"\n};\nvar layoutProps = {\n _frontmatter: _frontmatter\n};\nvar MDXLayout = \"wrapper\";\nreturn function MDXContent(_ref) {\n var components = _ref.components,\n props = _objectWithoutProperties(_ref, [\"components\"]);\n\n return mdx(MDXLayout, _extends({}, layoutProps, props, {\n components: components,\n mdxType: \"MDXLayout\"\n }), mdx(\"p\", null, \"Woah! You are almost half way done with understanding all of Discordeno. Amazing isn't it? Something you may have noticed in the last section was there were some options that prevented some commands from running like \", mdx(\"inlineCode\", {\n parentName: \"p\"\n }, \"dmOnly\"), \" or the permission options. we created a setting to prevent the monitor from running in certain channels. What if we wanted to do prevent commands from happening? How would we prevent commands from running?\"), mdx(\"h2\", null, \"What is an Inhibitor?\"), mdx(\"p\", null, \"An Inhibitor is very similar to how monitors work. A monitor runs on every message but an inhibitor runs on every command. Remember all those command options like cooldown, permissions, permissionLevel, nsfw, etc... Each and every one of these options has an inhibitor in that checks commands for these settings.\"), mdx(\"p\", null, \"Let's create our own inhibitor that would prevent commands from being used if the user is not a VIP user.\"), mdx(\"blockquote\", null, mdx(\"p\", {\n parentName: \"blockquote\"\n }, mdx(\"strong\", {\n parentName: \"p\"\n }, \"Note:\"), \" It is important to remember that everything below can be done with a simple permission level as well. We will create our own custom permission levels but for the purposes of this guide and to be able to learn about Inhibitors, we will be using an inhibitor.\")), mdx(\"h2\", null, \"Creating the File\"), mdx(\"p\", null, \"Let's start by creating a file inside the inhibitors folder called \", mdx(\"inlineCode\", {\n parentName: \"p\"\n }, \"boosted.ts\"), \" and paste the following snippet of code:\"), mdx(\"pre\", null, mdx(\"code\", _extends({\n parentName: \"pre\"\n }, {\n \"className\": \"language-ts\"\n }), \"import { botCache } from \\\"../../mod.ts\\\";\\n\\nbotCache.inhibitors.set(\\\"inhibitorname\\\", async function (message, command, guild) {\\n // Your code goes here\\n});\\n\")), mdx(\"p\", null, \"Inhibitors can take up to 3 arguments.\"), mdx(\"ul\", null, mdx(\"li\", {\n parentName: \"ul\"\n }, mdx(\"inlineCode\", {\n parentName: \"li\"\n }, \"message\"), \": The message object that triggered the command.\"), mdx(\"li\", {\n parentName: \"ul\"\n }, mdx(\"inlineCode\", {\n parentName: \"li\"\n }, \"command\"), \": The command object itself that was triggered.\"), mdx(\"li\", {\n parentName: \"ul\"\n }, mdx(\"inlineCode\", {\n parentName: \"li\"\n }, \"guild\"), \": The server guild object where this command was ran.\")), mdx(\"h2\", null, \"Understanding How Inhibitors Function\"), mdx(\"p\", null, \"To block a command you have to return a truthy value.\"), mdx(\"ul\", null, mdx(\"li\", {\n parentName: \"ul\"\n }, mdx(\"strong\", {\n parentName: \"li\"\n }, \"return true;\"), \" If you return true the inhibitor will block the execution of the command.\\nTo allow a command return a falsey value.\"), mdx(\"li\", {\n parentName: \"ul\"\n }, mdx(\"strong\", {\n parentName: \"li\"\n }, \"return false;\"), \" If you return false the inhibitor will not block the error.\")), mdx(\"pre\", null, mdx(\"code\", _extends({\n parentName: \"pre\"\n }, {\n \"className\": \"language-ts\"\n }), \"// If the command is not VIP only we can allow this command to execute\\nif (!command.vipOnly) return false;\\n\\n// The bot's support server\\nconst guild = cache.guilds.get(configs.supportServerID);\\n// If the command author is not in the server they won't have the vip role\\nconst member = guild.members.get(message.author.id) || await getMember(guild.id, message.author.id);\\n// Member doesn't exist so cancel the command\\nif (!member) {\\n sendResponse(message, `sorry, but you can not use this command until you become VIP. **Close the IRIS!!!**`)\\n return true;\\n}\\n\\n// If the user has the vip role on the support server given by patreon allow the command\\nif (member.roles.includes(configs.roleIDs.patreonVIPRoleID)) return false;\\n\\n// Alert the user they don't have vip and can't use the command\\nsendResponse(message, `sorry, but you can not use this command until you become a VIP. I'm sorry, Teal'c. We'll go to Disneyland next year. I promise.`)\\n// Cancel the command since the user does not have vip\\nreturn true;\\n\")), mdx(\"h2\", null, \"Challenges\"), mdx(\"p\", null, \"Hell yes! We just got through the entire inhibitor section. You have now mastered everything related to inhibitors.\"), mdx(\"p\", null, \"You can now try and get a little more practice with inhibitors by trying to challenge yourself and make your own inhibitors. Don't worry if you can't think of any good use cases for inhibitors.\"), mdx(\"p\", null, \"Majority of Discordeno bots do not use many custom inhibitors because most of the necessary/important ones already come built for you in the inhibitors folder.\"), mdx(\"p\", null, \"Next we will try our hands at creating a monitor.\"));\n}\n;\nMDXContent.isMDXComponent = true;","rawMDXOutput":"/* @jsx mdx */\nimport { mdx } from '@mdx-js/react';\n/* @jsx mdx */\n\nexport const _frontmatter = {\n \"title\": \"Creating Inhibitors!\",\n \"metaTitle\": \"Creating An Inhibitor | Discordeno\",\n \"metaDescription\": \"Let's create our very own bot with Discordeno!\"\n};\n\nconst layoutProps = {\n _frontmatter\n};\nconst MDXLayout = \"wrapper\"\nexport default function MDXContent({\n components,\n ...props\n}) {\n return \n

{`Woah! You are almost half way done with understanding all of Discordeno. Amazing isn't it? Something you may have noticed in the last section was there were some options that prevented some commands from running like `}{`dmOnly`}{` or the permission options. we created a setting to prevent the monitor from running in certain channels. What if we wanted to do prevent commands from happening? How would we prevent commands from running?`}

\n

{`What is an Inhibitor?`}

\n

{`An Inhibitor is very similar to how monitors work. A monitor runs on every message but an inhibitor runs on every command. Remember all those command options like cooldown, permissions, permissionLevel, nsfw, etc... Each and every one of these options has an inhibitor in that checks commands for these settings.`}

\n

{`Let's create our own inhibitor that would prevent commands from being used if the user is not a VIP user.`}

\n
\n

{`Note:`}{` It is important to remember that everything below can be done with a simple permission level as well. We will create our own custom permission levels but for the purposes of this guide and to be able to learn about Inhibitors, we will be using an inhibitor.`}

\n
\n

{`Creating the File`}

\n

{`Let's start by creating a file inside the inhibitors folder called `}{`boosted.ts`}{` and paste the following snippet of code:`}

\n
{`import { botCache } from \"../../mod.ts\";\n\nbotCache.inhibitors.set(\"inhibitorname\", async function (message, command, guild) {\n    // Your code goes here\n});\n`}
\n

{`Inhibitors can take up to 3 arguments.`}

\n
    \n
  • {`message`}{`: The message object that triggered the command.`}
  • \n
  • {`command`}{`: The command object itself that was triggered.`}
  • \n
  • {`guild`}{`: The server guild object where this command was ran.`}
  • \n
\n

{`Understanding How Inhibitors Function`}

\n

{`To block a command you have to return a truthy value.`}

\n
    \n
  • {`return true;`}{` If you return true the inhibitor will block the execution of the command.\nTo allow a command return a falsey value.`}
  • \n
  • {`return false;`}{` If you return false the inhibitor will not block the error.`}
  • \n
\n
{`// If the command is not VIP only we can allow this command to execute\nif (!command.vipOnly) return false;\n\n// The bot's support server\nconst guild = cache.guilds.get(configs.supportServerID);\n// If the command author is not in the server they won't have the vip role\nconst member = guild.members.get(message.author.id) || await getMember(guild.id, message.author.id);\n// Member doesn't exist so cancel the command\nif (!member) {\n    sendResponse(message, \\`sorry, but you can not use this command until you become VIP. **Close the IRIS!!!**\\`)\n    return true;\n}\n\n// If the user has the vip role on the support server given by patreon allow the command\nif (member.roles.includes(configs.roleIDs.patreonVIPRoleID)) return false;\n\n// Alert the user they don't have vip and can't use the command\nsendResponse(message, \\`sorry, but you can not use this command until you become a VIP. I'm sorry, Teal'c. We'll go to Disneyland next year. I promise.\\`)\n// Cancel the command since the user does not have vip\nreturn true;\n`}
\n

{`Challenges`}

\n

{`Hell yes! We just got through the entire inhibitor section. You have now mastered everything related to inhibitors.`}

\n

{`You can now try and get a little more practice with inhibitors by trying to challenge yourself and make your own inhibitors. Don't worry if you can't think of any good use cases for inhibitors.`}

\n

{`Majority of Discordeno bots do not use many custom inhibitors because most of the necessary/important ones already come built for you in the inhibitors folder.`}

\n

{`Next we will try our hands at creating a monitor.`}

\n\n
;\n}\n\n;\nMDXContent.isMDXComponent = true;"}} \ No newline at end of file diff --git a/docs/.cache/caches/gatsby-plugin-mdx/diskstore-0eee710e93678baeabe4b3aba4bbf5f7.json b/docs/.cache/caches/gatsby-plugin-mdx/diskstore-0eee710e93678baeabe4b3aba4bbf5f7.json new file mode 100644 index 000000000..c54f2dcb5 --- /dev/null +++ b/docs/.cache/caches/gatsby-plugin-mdx/diskstore-0eee710e93678baeabe4b3aba4bbf5f7.json @@ -0,0 +1 @@ +{"expireTime":9007200851596198000,"key":"gatsby-plugin-mdx-entire-payload-5daac4bb70e47b2c99dcdb32fbff6667-","val":{"mdast":{"type":"root","children":[{"type":"paragraph","children":[{"type":"text","value":"Really great job. Now, lets dive into trying to use some of the commands and try to make our very own command.","position":{"start":{"line":2,"column":1,"offset":1},"end":{"line":2,"column":111,"offset":111},"indent":[]}}],"position":{"start":{"line":2,"column":1,"offset":1},"end":{"line":2,"column":111,"offset":111},"indent":[]}},{"type":"heading","depth":2,"children":[{"type":"text","value":"Editing Invite Command","position":{"start":{"line":4,"column":4,"offset":116},"end":{"line":4,"column":26,"offset":138},"indent":[]}}],"position":{"start":{"line":4,"column":1,"offset":113},"end":{"line":4,"column":26,"offset":138},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"Let's first start by taking an existing command and slightly modifying it to your needs. Let's use the ","position":{"start":{"line":6,"column":1,"offset":140},"end":{"line":6,"column":104,"offset":243},"indent":[]}},{"type":"inlineCode","value":"Invite","position":{"start":{"line":6,"column":104,"offset":243},"end":{"line":6,"column":112,"offset":251},"indent":[]}},{"type":"text","value":" command as our example. When you open the command, you will see something like this:","position":{"start":{"line":6,"column":112,"offset":251},"end":{"line":6,"column":197,"offset":336},"indent":[]}}],"position":{"start":{"line":6,"column":1,"offset":140},"end":{"line":6,"column":197,"offset":336},"indent":[]}},{"type":"code","lang":"ts","meta":null,"value":"import { botCache } from \"../../mod.ts\";\nimport { sendMessage } from \"https://raw.githubusercontent.com/Skillz4Killz/Discordeno/v7/src/handlers/channel.ts\";\nimport { botID } from \"https://raw.githubusercontent.com/Skillz4Killz/Discordeno/v7/src/module/client.ts\";\n\nbotCache.commands.set(\"invite\", {\n name: \"invite\",\n execute: function (message) {\n // Replace the permission number at the end to request the permissions you wish to request. By default, this will request Admin perms.\n sendMessage(\n message.channel,\n `https://discordapp.com/oauth2/authorize?client_id=${botID}&scope=bot&permissions=8`,\n );\n },\n});","position":{"start":{"line":8,"column":1,"offset":338},"end":{"line":23,"column":4,"offset":983},"indent":[1,1,1,1,1,1,1,1,1,1,1,1,1,1,1]}},{"type":"paragraph","children":[{"type":"text","value":"Let's break this down. The first three lines are importing the necessary things from their files so we can use them in this command. Don't worry if this doesn't make sense, most of the time, this will all be done automatically for you if you use a good code editor like Visual Studio Code. We create a command by doing:","position":{"start":{"line":25,"column":1,"offset":985},"end":{"line":25,"column":320,"offset":1304},"indent":[]}}],"position":{"start":{"line":25,"column":1,"offset":985},"end":{"line":25,"column":320,"offset":1304},"indent":[]}},{"type":"code","lang":"ts","meta":null,"value":"botCache.commands.set('commandname', {\n\n})","position":{"start":{"line":27,"column":1,"offset":1306},"end":{"line":31,"column":4,"offset":1358},"indent":[1,1,1,1]}},{"type":"paragraph","children":[{"type":"text","value":"The command name here must be unique. If it is not unique, your commands will not work properly as you wish. For example, you can't have 2 commands with the ","position":{"start":{"line":33,"column":1,"offset":1360},"end":{"line":33,"column":158,"offset":1517},"indent":[]}},{"type":"inlineCode","value":"ping","position":{"start":{"line":33,"column":158,"offset":1517},"end":{"line":33,"column":164,"offset":1523},"indent":[]}},{"type":"text","value":" name. In this case, our command is called ","position":{"start":{"line":33,"column":164,"offset":1523},"end":{"line":33,"column":207,"offset":1566},"indent":[]}},{"type":"inlineCode","value":"invite","position":{"start":{"line":33,"column":207,"offset":1566},"end":{"line":33,"column":215,"offset":1574},"indent":[]}},{"type":"text","value":".","position":{"start":{"line":33,"column":215,"offset":1574},"end":{"line":33,"column":216,"offset":1575},"indent":[]}}],"position":{"start":{"line":33,"column":1,"offset":1360},"end":{"line":33,"column":216,"offset":1575},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"The ","position":{"start":{"line":35,"column":1,"offset":1577},"end":{"line":35,"column":5,"offset":1581},"indent":[]}},{"type":"inlineCode","value":"name: 'invite'","position":{"start":{"line":35,"column":5,"offset":1581},"end":{"line":35,"column":21,"offset":1597},"indent":[]}},{"type":"text","value":" is also written as it is useful for our help command and inhibitors! Normally, these two things will be the same. So far it's super easy right.","position":{"start":{"line":35,"column":21,"offset":1597},"end":{"line":35,"column":165,"offset":1741},"indent":[]}}],"position":{"start":{"line":35,"column":1,"offset":1577},"end":{"line":35,"column":165,"offset":1741},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"Next is the ","position":{"start":{"line":37,"column":1,"offset":1743},"end":{"line":37,"column":13,"offset":1755},"indent":[]}},{"type":"inlineCode","value":"execute","position":{"start":{"line":37,"column":13,"offset":1755},"end":{"line":37,"column":22,"offset":1764},"indent":[]}},{"type":"text","value":". This is where the magic happens. This is the function that is triggered when the command is ran by a user. In this case, the bot simply sends a message to a channel where the command was ran and sends an invite link. Let's take a minute and optimize this for our case. We don't ","position":{"start":{"line":37,"column":22,"offset":1764},"end":{"line":37,"column":302,"offset":2044},"indent":[]}},{"type":"strong","children":[{"type":"text","value":"NEED","position":{"start":{"line":37,"column":304,"offset":2046},"end":{"line":37,"column":308,"offset":2050},"indent":[]}}],"position":{"start":{"line":37,"column":302,"offset":2044},"end":{"line":37,"column":310,"offset":2052},"indent":[]}},{"type":"text","value":" admin permissions for our bot. Let's go to the ","position":{"start":{"line":37,"column":310,"offset":2052},"end":{"line":37,"column":358,"offset":2100},"indent":[]}},{"type":"link","title":null,"url":"https://discordapi.com/permissions.html#0","children":[{"type":"text","value":"permission calculator","position":{"start":{"line":37,"column":359,"offset":2101},"end":{"line":37,"column":380,"offset":2122},"indent":[]}}],"position":{"start":{"line":37,"column":358,"offset":2100},"end":{"line":37,"column":424,"offset":2166},"indent":[]}},{"type":"text","value":" and figure out the permissions we need for our bot.","position":{"start":{"line":37,"column":424,"offset":2166},"end":{"line":37,"column":476,"offset":2218},"indent":[]}}],"position":{"start":{"line":37,"column":1,"offset":1743},"end":{"line":37,"column":476,"offset":2218},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"Once you have decided which permissions you want to request, you can copy the number and replace it here. For example, if we want ","position":{"start":{"line":39,"column":1,"offset":2220},"end":{"line":39,"column":131,"offset":2350},"indent":[]}},{"type":"inlineCode","value":"68640","position":{"start":{"line":39,"column":131,"offset":2350},"end":{"line":39,"column":138,"offset":2357},"indent":[]}},{"type":"text","value":" as our permissions. We can modify our command to be:","position":{"start":{"line":39,"column":138,"offset":2357},"end":{"line":39,"column":191,"offset":2410},"indent":[]}}],"position":{"start":{"line":39,"column":1,"offset":2220},"end":{"line":39,"column":191,"offset":2410},"indent":[]}},{"type":"code","lang":"ts","meta":null,"value":"\t`https://discordapp.com/oauth2/authorize?client_id=${botID}&scope=bot&permissions=68640`,","position":{"start":{"line":42,"column":1,"offset":2413},"end":{"line":44,"column":4,"offset":2513},"indent":[1,1]}},{"type":"paragraph","children":[{"type":"text","value":"Lastly, let's get rid of the comment there as now it is customized to our needs.","position":{"start":{"line":46,"column":1,"offset":2515},"end":{"line":46,"column":81,"offset":2595},"indent":[]}}],"position":{"start":{"line":46,"column":1,"offset":2515},"end":{"line":46,"column":81,"offset":2595},"indent":[]}},{"type":"heading","depth":3,"children":[{"type":"text","value":"Command Descriptions","position":{"start":{"line":48,"column":5,"offset":2601},"end":{"line":48,"column":25,"offset":2621},"indent":[]}}],"position":{"start":{"line":48,"column":1,"offset":2597},"end":{"line":48,"column":25,"offset":2621},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"Right now, if you were to go to Discord and type ","position":{"start":{"line":50,"column":1,"offset":2623},"end":{"line":50,"column":50,"offset":2672},"indent":[]}},{"type":"inlineCode","value":"!help invite","position":{"start":{"line":50,"column":50,"offset":2672},"end":{"line":50,"column":64,"offset":2686},"indent":[]}},{"type":"text","value":", you would see quite a bit of information. But where does all that text come from? It's not in this file. The description option tells Discordeno what to show the user when they use the help command. In that help message, each command has a small description next to it. The magic is happening because of Discordeno's translations feature.","position":{"start":{"line":50,"column":64,"offset":2686},"end":{"line":50,"column":404,"offset":3026},"indent":[]}}],"position":{"start":{"line":50,"column":1,"offset":2623},"end":{"line":50,"column":404,"offset":3026},"indent":[]}},{"type":"blockquote","children":[{"type":"paragraph","children":[{"type":"text","value":"Discordeno has built in multi-lingual support. You can support as many languages as you wish. We will learn more about languages when we create our own language but for now we just want to see how to customize the command. What we are going to do below isn't the correct way but it's the easy way to learn. We will see the correct way to do it when we get to translations.","position":{"start":{"line":52,"column":3,"offset":3030},"end":{"line":52,"column":375,"offset":3402},"indent":[]}}],"position":{"start":{"line":52,"column":3,"offset":3030},"end":{"line":52,"column":375,"offset":3402},"indent":[]}}],"position":{"start":{"line":52,"column":1,"offset":3028},"end":{"line":52,"column":375,"offset":3402},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"Let's add a custom description to our invite command.","position":{"start":{"line":54,"column":1,"offset":3404},"end":{"line":54,"column":54,"offset":3457},"indent":[]}}],"position":{"start":{"line":54,"column":1,"offset":3404},"end":{"line":54,"column":54,"offset":3457},"indent":[]}},{"type":"code","lang":"ts","meta":null,"value":"\tname: \"invite\",\n\tdescription: \"Like the bot? Use this link to add it to your server!\"","position":{"start":{"line":56,"column":1,"offset":3459},"end":{"line":59,"column":4,"offset":3555},"indent":[1,1,1]}},{"type":"paragraph","children":[{"type":"text","value":"🎉 It's that simple. So let's restart the bot and see how it changed. Use ","position":{"start":{"line":61,"column":1,"offset":3557},"end":{"line":61,"column":75,"offset":3631},"indent":[]}},{"type":"strong","children":[{"type":"text","value":"CTRL + C","position":{"start":{"line":61,"column":77,"offset":3633},"end":{"line":61,"column":85,"offset":3641},"indent":[]}}],"position":{"start":{"line":61,"column":75,"offset":3631},"end":{"line":61,"column":87,"offset":3643},"indent":[]}},{"type":"text","value":" to shut down the bot. Then run the command from earlier.","position":{"start":{"line":61,"column":87,"offset":3643},"end":{"line":61,"column":144,"offset":3700},"indent":[]}}],"position":{"start":{"line":61,"column":1,"offset":3557},"end":{"line":61,"column":144,"offset":3700},"indent":[]}},{"type":"code","lang":"shell","meta":null,"value":"deno run --allow-net --allow-read mod.ts","position":{"start":{"line":63,"column":1,"offset":3702},"end":{"line":65,"column":4,"offset":3755},"indent":[1,1]}},{"type":"paragraph","children":[{"type":"text","value":"To access this easily, most likely all you need to do is press the ","position":{"start":{"line":67,"column":1,"offset":3757},"end":{"line":67,"column":68,"offset":3824},"indent":[]}},{"type":"strong","children":[{"type":"text","value":"UP ARROW","position":{"start":{"line":67,"column":70,"offset":3826},"end":{"line":67,"column":78,"offset":3834},"indent":[]}}],"position":{"start":{"line":67,"column":68,"offset":3824},"end":{"line":67,"column":80,"offset":3836},"indent":[]}},{"type":"text","value":" key. Feel free to copy paste this if it doesn't work.","position":{"start":{"line":67,"column":80,"offset":3836},"end":{"line":67,"column":134,"offset":3890},"indent":[]}}],"position":{"start":{"line":67,"column":1,"offset":3757},"end":{"line":67,"column":134,"offset":3890},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"Once the bot is started try ","position":{"start":{"line":69,"column":1,"offset":3892},"end":{"line":69,"column":29,"offset":3920},"indent":[]}},{"type":"inlineCode","value":"!help invite","position":{"start":{"line":69,"column":29,"offset":3920},"end":{"line":69,"column":43,"offset":3934},"indent":[]}},{"type":"text","value":" again and you will see the change! 🎉","position":{"start":{"line":69,"column":43,"offset":3934},"end":{"line":69,"column":81,"offset":3972},"indent":[]}}],"position":{"start":{"line":69,"column":1,"offset":3892},"end":{"line":69,"column":81,"offset":3972},"indent":[]}},{"type":"heading","depth":2,"children":[{"type":"text","value":"Command Aliases","position":{"start":{"line":71,"column":4,"offset":3977},"end":{"line":71,"column":19,"offset":3992},"indent":[]}}],"position":{"start":{"line":71,"column":1,"offset":3974},"end":{"line":71,"column":19,"offset":3992},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"Now, let's make this a little bit easier. What if we wanted this command to also work with other names besides ","position":{"start":{"line":73,"column":1,"offset":3994},"end":{"line":73,"column":112,"offset":4105},"indent":[]}},{"type":"inlineCode","value":"invite","position":{"start":{"line":73,"column":112,"offset":4105},"end":{"line":73,"column":120,"offset":4113},"indent":[]}},{"type":"text","value":". For example, as a shortcut what if users could just type ","position":{"start":{"line":73,"column":120,"offset":4113},"end":{"line":73,"column":179,"offset":4172},"indent":[]}},{"type":"inlineCode","value":"!inv","position":{"start":{"line":73,"column":179,"offset":4172},"end":{"line":73,"column":185,"offset":4178},"indent":[]}},{"type":"text","value":" or as an alias type ","position":{"start":{"line":73,"column":185,"offset":4178},"end":{"line":73,"column":206,"offset":4199},"indent":[]}},{"type":"inlineCode","value":"!join","position":{"start":{"line":73,"column":206,"offset":4199},"end":{"line":73,"column":213,"offset":4206},"indent":[]}},{"type":"text","value":". Let's go ahead and set that up. Go to the very last line of invite command file and type in ","position":{"start":{"line":73,"column":213,"offset":4206},"end":{"line":73,"column":307,"offset":4300},"indent":[]}},{"type":"inlineCode","value":"alias","position":{"start":{"line":73,"column":307,"offset":4300},"end":{"line":73,"column":314,"offset":4307},"indent":[]}},{"type":"text","value":". You will see a popup showing you an autocompleted version of ","position":{"start":{"line":73,"column":314,"offset":4307},"end":{"line":73,"column":377,"offset":4370},"indent":[]}},{"type":"inlineCode","value":"createCommandAliases","position":{"start":{"line":73,"column":377,"offset":4370},"end":{"line":73,"column":399,"offset":4392},"indent":[]}},{"type":"text","value":". Press enter and boom the magic is happening!","position":{"start":{"line":73,"column":399,"offset":4392},"end":{"line":73,"column":445,"offset":4438},"indent":[]}}],"position":{"start":{"line":73,"column":1,"offset":3994},"end":{"line":73,"column":445,"offset":4438},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"The createCommandAliases takes in two arguments. The first argument is always the command name. In this case it is ","position":{"start":{"line":75,"column":1,"offset":4440},"end":{"line":75,"column":116,"offset":4555},"indent":[]}},{"type":"inlineCode","value":"invite","position":{"start":{"line":75,"column":116,"offset":4555},"end":{"line":75,"column":124,"offset":4563},"indent":[]}},{"type":"text","value":". The second argument is the aliases you want to provide. Let's add in the two aliases we wanted.","position":{"start":{"line":75,"column":124,"offset":4563},"end":{"line":75,"column":221,"offset":4660},"indent":[]}}],"position":{"start":{"line":75,"column":1,"offset":4440},"end":{"line":75,"column":221,"offset":4660},"indent":[]}},{"type":"code","lang":"ts","meta":null,"value":" `https://discordapp.com/oauth2/authorize?client_id=${botID}&scope=bot&permissions=68640`,\n );\n },\n});\n\ncreateCommandAliases('invite', ['inv', 'join'])","position":{"start":{"line":77,"column":1,"offset":4662},"end":{"line":84,"column":4,"offset":4827},"indent":[1,1,1,1,1,1,1]}},{"type":"blockquote","children":[{"type":"paragraph","children":[{"type":"strong","children":[{"type":"text","value":"Note:","position":{"start":{"line":86,"column":5,"offset":4833},"end":{"line":86,"column":10,"offset":4838},"indent":[]}}],"position":{"start":{"line":86,"column":3,"offset":4831},"end":{"line":86,"column":12,"offset":4840},"indent":[]}},{"type":"text","value":" If you only want to add 1 alias, you can pass in a simple string instead of an array as well as the second argument.","position":{"start":{"line":86,"column":12,"offset":4840},"end":{"line":86,"column":129,"offset":4957},"indent":[]}}],"position":{"start":{"line":86,"column":3,"offset":4831},"end":{"line":86,"column":129,"offset":4957},"indent":[]}}],"position":{"start":{"line":86,"column":1,"offset":4829},"end":{"line":86,"column":129,"offset":4957},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"Notice, I added 2 aliases here. You can add as many aliases as you like. If you see a lot of users typing it wrong by accident you can add those typos as aliases as well.","position":{"start":{"line":88,"column":1,"offset":4959},"end":{"line":88,"column":171,"offset":5129},"indent":[]}}],"position":{"start":{"line":88,"column":1,"offset":4959},"end":{"line":88,"column":171,"offset":5129},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"Let's start testing this out. But first, let's understand something important.","position":{"start":{"line":90,"column":1,"offset":5131},"end":{"line":90,"column":79,"offset":5209},"indent":[]}}],"position":{"start":{"line":90,"column":1,"offset":5131},"end":{"line":90,"column":79,"offset":5209},"indent":[]}},{"type":"heading","depth":2,"children":[{"type":"text","value":"Reloading","position":{"start":{"line":92,"column":4,"offset":5214},"end":{"line":92,"column":13,"offset":5223},"indent":[]}}],"position":{"start":{"line":92,"column":1,"offset":5211},"end":{"line":92,"column":13,"offset":5223},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"Okay, we need to first understand a core concept of developing discord bots. If you had to restart your bot every time you made a tiny change, it would get really annoying/tedious to do. Also, if you had restarted your bot 1000 times, you would be in big trouble because Discord would ban your bot for 24 hours. The bigger your bot gets, the faster it is to hit this limit of 1000 identify calls to the Discord API.","position":{"start":{"line":94,"column":1,"offset":5225},"end":{"line":94,"column":416,"offset":5640},"indent":[]}}],"position":{"start":{"line":94,"column":1,"offset":5225},"end":{"line":94,"column":416,"offset":5640},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"To solve this issue, Discordeno provides you with a really cool ","position":{"start":{"line":96,"column":1,"offset":5642},"end":{"line":96,"column":65,"offset":5706},"indent":[]}},{"type":"inlineCode","value":"reload","position":{"start":{"line":96,"column":65,"offset":5706},"end":{"line":96,"column":73,"offset":5714},"indent":[]}},{"type":"text","value":" command. Whenever you make a change to any command, event, monitor, inhibitor, task, language or argument you can simply reload it. You don't need to restart your bot every time.","position":{"start":{"line":96,"column":73,"offset":5714},"end":{"line":96,"column":252,"offset":5893},"indent":[]}}],"position":{"start":{"line":96,"column":1,"offset":5642},"end":{"line":96,"column":252,"offset":5893},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"Now since we added the aliases above, let's test it out.","position":{"start":{"line":98,"column":1,"offset":5895},"end":{"line":98,"column":57,"offset":5951},"indent":[]}}],"position":{"start":{"line":98,"column":1,"offset":5895},"end":{"line":98,"column":57,"offset":5951},"indent":[]}},{"type":"list","ordered":true,"start":1,"spread":false,"children":[{"type":"listItem","spread":false,"checked":null,"children":[{"type":"paragraph","children":[{"type":"inlineCode","value":"!inv","position":{"start":{"line":100,"column":4,"offset":5956},"end":{"line":100,"column":10,"offset":5962},"indent":[]}},{"type":"text","value":" this will not work","position":{"start":{"line":100,"column":10,"offset":5962},"end":{"line":100,"column":29,"offset":5981},"indent":[]}}],"position":{"start":{"line":100,"column":4,"offset":5956},"end":{"line":100,"column":29,"offset":5981},"indent":[]}}],"position":{"start":{"line":100,"column":1,"offset":5953},"end":{"line":100,"column":29,"offset":5981},"indent":[]}},{"type":"listItem","spread":false,"checked":null,"children":[{"type":"paragraph","children":[{"type":"inlineCode","value":"!reload commands","position":{"start":{"line":101,"column":4,"offset":5985},"end":{"line":101,"column":22,"offset":6003},"indent":[]}},{"type":"text","value":" this will reload the files and the aliases will be created.","position":{"start":{"line":101,"column":22,"offset":6003},"end":{"line":101,"column":82,"offset":6063},"indent":[]}}],"position":{"start":{"line":101,"column":4,"offset":5985},"end":{"line":101,"column":82,"offset":6063},"indent":[]}}],"position":{"start":{"line":101,"column":1,"offset":5982},"end":{"line":101,"column":82,"offset":6063},"indent":[]}},{"type":"listItem","spread":false,"checked":null,"children":[{"type":"paragraph","children":[{"type":"inlineCode","value":"!inv","position":{"start":{"line":102,"column":4,"offset":6067},"end":{"line":102,"column":10,"offset":6073},"indent":[]}},{"type":"text","value":" This will now work. 🎉","position":{"start":{"line":102,"column":10,"offset":6073},"end":{"line":102,"column":33,"offset":6096},"indent":[]}}],"position":{"start":{"line":102,"column":4,"offset":6067},"end":{"line":102,"column":33,"offset":6096},"indent":[]}}],"position":{"start":{"line":102,"column":1,"offset":6064},"end":{"line":102,"column":33,"offset":6096},"indent":[]}}],"position":{"start":{"line":100,"column":1,"offset":5953},"end":{"line":102,"column":33,"offset":6096},"indent":[1,1]}},{"type":"thematicBreak","position":{"start":{"line":104,"column":1,"offset":6098},"end":{"line":104,"column":4,"offset":6101},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"Perfect! You can take some time and customize the invite command to your needs if you wish. For example, this is my bot's invite command.","position":{"start":{"line":106,"column":1,"offset":6103},"end":{"line":106,"column":138,"offset":6240},"indent":[]}}],"position":{"start":{"line":106,"column":1,"offset":6103},"end":{"line":106,"column":138,"offset":6240},"indent":[]}},{"type":"paragraph","children":[{"type":"image","title":null,"url":"https://i.imgur.com/4WRFMtR.png","alt":"image","position":{"start":{"line":108,"column":1,"offset":6242},"end":{"line":108,"column":42,"offset":6283},"indent":[]}}],"position":{"start":{"line":108,"column":1,"offset":6242},"end":{"line":108,"column":42,"offset":6283},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"Nice! You can now customize any of the commands from Discordeno as you wish. Then we will continue to making our very own command so we can learn about all the options that Discordeno gives us when it comes to making commands. As you learn more in this guide, you can keep improving it.","position":{"start":{"line":110,"column":1,"offset":6285},"end":{"line":110,"column":287,"offset":6571},"indent":[]}}],"position":{"start":{"line":110,"column":1,"offset":6285},"end":{"line":110,"column":287,"offset":6571},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"If you get stuck, don't worry. When you are ready, let's continue to the next step.","position":{"start":{"line":112,"column":1,"offset":6573},"end":{"line":112,"column":84,"offset":6656},"indent":[]}}],"position":{"start":{"line":112,"column":1,"offset":6573},"end":{"line":112,"column":84,"offset":6656},"indent":[]}},{"type":"heading","depth":2,"children":[{"type":"text","value":"Creating A Command","position":{"start":{"line":114,"column":4,"offset":6661},"end":{"line":114,"column":22,"offset":6679},"indent":[]}}],"position":{"start":{"line":114,"column":1,"offset":6658},"end":{"line":114,"column":22,"offset":6679},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"Let's make a command that will allow guild admins to give or take roles from a member. Since, we are creating a ","position":{"start":{"line":116,"column":1,"offset":6681},"end":{"line":116,"column":113,"offset":6793},"indent":[]}},{"type":"inlineCode","value":"Moderation","position":{"start":{"line":116,"column":113,"offset":6793},"end":{"line":116,"column":125,"offset":6805},"indent":[]}},{"type":"text","value":" command to give or take roles, let's go ahead and create a Category folder called ","position":{"start":{"line":116,"column":125,"offset":6805},"end":{"line":116,"column":208,"offset":6888},"indent":[]}},{"type":"inlineCode","value":"Moderation","position":{"start":{"line":116,"column":208,"offset":6888},"end":{"line":116,"column":220,"offset":6900},"indent":[]}},{"type":"text","value":" and then create a file called ","position":{"start":{"line":116,"column":220,"offset":6900},"end":{"line":116,"column":251,"offset":6931},"indent":[]}},{"type":"inlineCode","value":"role.ts","position":{"start":{"line":116,"column":251,"offset":6931},"end":{"line":116,"column":260,"offset":6940},"indent":[]}},{"type":"text","value":". Once the file is made, you can paste this following base snippet to make our first command.","position":{"start":{"line":116,"column":260,"offset":6940},"end":{"line":116,"column":353,"offset":7033},"indent":[]}}],"position":{"start":{"line":116,"column":1,"offset":6681},"end":{"line":116,"column":353,"offset":7033},"indent":[]}},{"type":"code","lang":"ts","meta":null,"value":"import { botCache } from \"../../mod.ts\";\nimport { sendMessage } from \"https://raw.githubusercontent.com/Skillz4Killz/Discordeno/v7/src/handlers/channel.ts\";\nimport { PermissionLevels } from \"../types/commands.ts\";\nimport { createCommandAliases } from \"../utils/helpers\";\n\nbotCache.commands.set(\"commandname\", {\n name: \"commandname\",\n dmOnly: false,\n guildOnly: false,\n nsfw: false,\n permissionLevel: [PermissionLevels.MEMBER],\n botServerPermissions: [],\n botChannelPermissions: [],\n userServerPermissions: [],\n userChannelPermissions: [],\n description: string,\n cooldown: {\n seconds: 0,\n allowedUses: 0,\n },\n arguments: [],\n execute: function (message, args, guild) {\n // The code for your command goes here\n }\n});\n\n// createCommandAliases(\"commandname\", [\"alias\"])","position":{"start":{"line":118,"column":1,"offset":7035},"end":{"line":146,"column":4,"offset":7832},"indent":[1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1]}},{"type":"heading","depth":2,"children":[{"type":"text","value":"Understanding Command Options","position":{"start":{"line":148,"column":4,"offset":7837},"end":{"line":148,"column":33,"offset":7866},"indent":[]}}],"position":{"start":{"line":148,"column":1,"offset":7834},"end":{"line":148,"column":33,"offset":7866},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"Woah! We just added a massive file but most of that stuff is new to us. Don't worry, let's break everything down step by step.","position":{"start":{"line":150,"column":1,"offset":7868},"end":{"line":150,"column":127,"offset":7994},"indent":[]}}],"position":{"start":{"line":150,"column":1,"offset":7868},"end":{"line":150,"column":127,"offset":7994},"indent":[]}},{"type":"blockquote","children":[{"type":"paragraph","children":[{"type":"strong","children":[{"type":"text","value":"Note:","position":{"start":{"line":152,"column":5,"offset":8000},"end":{"line":152,"column":10,"offset":8005},"indent":[]}}],"position":{"start":{"line":152,"column":3,"offset":7998},"end":{"line":152,"column":12,"offset":8007},"indent":[]}},{"type":"text","value":" Any options that are not changed from the snippet above can actually be deleted as Discordeno will use the default option if you do not provide anything for that option. This can help keep your files cleaner.","position":{"start":{"line":152,"column":12,"offset":8007},"end":{"line":152,"column":221,"offset":8216},"indent":[]}}],"position":{"start":{"line":152,"column":3,"offset":7998},"end":{"line":152,"column":221,"offset":8216},"indent":[]}}],"position":{"start":{"line":152,"column":1,"offset":7996},"end":{"line":152,"column":221,"offset":8216},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"Before we start, quickly update the command name and description.","position":{"start":{"line":154,"column":1,"offset":8218},"end":{"line":154,"column":66,"offset":8283},"indent":[]}}],"position":{"start":{"line":154,"column":1,"offset":8218},"end":{"line":154,"column":66,"offset":8283},"indent":[]}},{"type":"blockquote","children":[{"type":"paragraph","children":[{"type":"strong","children":[{"type":"text","value":"Note:","position":{"start":{"line":156,"column":5,"offset":8289},"end":{"line":156,"column":10,"offset":8294},"indent":[]}}],"position":{"start":{"line":156,"column":3,"offset":8287},"end":{"line":156,"column":12,"offset":8296},"indent":[]}},{"type":"text","value":" Once you highlight the ","position":{"start":{"line":156,"column":12,"offset":8296},"end":{"line":156,"column":36,"offset":8320},"indent":[]}},{"type":"inlineCode","value":"commandname","position":{"start":{"line":156,"column":36,"offset":8320},"end":{"line":156,"column":49,"offset":8333},"indent":[]}},{"type":"text","value":", press ","position":{"start":{"line":156,"column":49,"offset":8333},"end":{"line":156,"column":57,"offset":8341},"indent":[]}},{"type":"strong","children":[{"type":"text","value":"CTRL + SHIFT + L","position":{"start":{"line":156,"column":59,"offset":8343},"end":{"line":156,"column":75,"offset":8359},"indent":[]}}],"position":{"start":{"line":156,"column":57,"offset":8341},"end":{"line":156,"column":77,"offset":8361},"indent":[]}},{"type":"text","value":" to select ALL the ","position":{"start":{"line":156,"column":77,"offset":8361},"end":{"line":156,"column":96,"offset":8380},"indent":[]}},{"type":"inlineCode","value":"commandname","position":{"start":{"line":156,"column":96,"offset":8380},"end":{"line":156,"column":109,"offset":8393},"indent":[]}},{"type":"text","value":" on the file and you can easily replace them at once. Another useful shortcut you may use when coding your bot is ","position":{"start":{"line":156,"column":109,"offset":8393},"end":{"line":156,"column":223,"offset":8507},"indent":[]}},{"type":"strong","children":[{"type":"text","value":"CTRL + D","position":{"start":{"line":156,"column":225,"offset":8509},"end":{"line":156,"column":233,"offset":8517},"indent":[]}}],"position":{"start":{"line":156,"column":223,"offset":8507},"end":{"line":156,"column":235,"offset":8519},"indent":[]}},{"type":"text","value":" after highlighting. This shortcut selects the next place where the same text exists as thing in the file that has the same thing as you highlighted.","position":{"start":{"line":156,"column":235,"offset":8519},"end":{"line":156,"column":385,"offset":8669},"indent":[]}}],"position":{"start":{"line":156,"column":3,"offset":8287},"end":{"line":156,"column":385,"offset":8669},"indent":[]}}],"position":{"start":{"line":156,"column":1,"offset":8285},"end":{"line":156,"column":385,"offset":8669},"indent":[]}},{"type":"heading","depth":2,"children":[{"type":"text","value":"dmOnly & guildOnly Options","position":{"start":{"line":158,"column":4,"offset":8674},"end":{"line":158,"column":30,"offset":8700},"indent":[]}}],"position":{"start":{"line":158,"column":1,"offset":8671},"end":{"line":158,"column":30,"offset":8700},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"The ","position":{"start":{"line":160,"column":1,"offset":8702},"end":{"line":160,"column":5,"offset":8706},"indent":[]}},{"type":"inlineCode","value":"dmOnly","position":{"start":{"line":160,"column":5,"offset":8706},"end":{"line":160,"column":13,"offset":8714},"indent":[]}},{"type":"text","value":" option is available if you want to make sure this command only runs in a direct message. If this command is ran in a server, the command will immediately exit out.","position":{"start":{"line":160,"column":13,"offset":8714},"end":{"line":160,"column":177,"offset":8878},"indent":[]}}],"position":{"start":{"line":160,"column":1,"offset":8702},"end":{"line":160,"column":177,"offset":8878},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"On the other hand, ","position":{"start":{"line":162,"column":1,"offset":8880},"end":{"line":162,"column":20,"offset":8899},"indent":[]}},{"type":"inlineCode","value":"guildOnly","position":{"start":{"line":162,"column":20,"offset":8899},"end":{"line":162,"column":31,"offset":8910},"indent":[]}},{"type":"text","value":" is the opposite. To easily make sure that this command is never allowed in a private message you can simple enable this.","position":{"start":{"line":162,"column":31,"offset":8910},"end":{"line":162,"column":152,"offset":9031},"indent":[]}}],"position":{"start":{"line":162,"column":1,"offset":8880},"end":{"line":162,"column":152,"offset":9031},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"If you want to allow a command to be able to run both in a server and in a direct message, simply set them both to false.","position":{"start":{"line":164,"column":1,"offset":9033},"end":{"line":164,"column":122,"offset":9154},"indent":[]}}],"position":{"start":{"line":164,"column":1,"offset":9033},"end":{"line":164,"column":122,"offset":9154},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"Remember if you want either of them as false, you can simply delete them and it will default to ","position":{"start":{"line":166,"column":1,"offset":9156},"end":{"line":166,"column":97,"offset":9252},"indent":[]}},{"type":"inlineCode","value":"false","position":{"start":{"line":166,"column":97,"offset":9252},"end":{"line":166,"column":104,"offset":9259},"indent":[]}},{"type":"text","value":" allowing your bot to be cleaner and easier to read. However, if your prefer keeping it you can.","position":{"start":{"line":166,"column":104,"offset":9259},"end":{"line":166,"column":200,"offset":9355},"indent":[]}}],"position":{"start":{"line":166,"column":1,"offset":9156},"end":{"line":166,"column":200,"offset":9355},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"For the purpose of this guide, we want our ","position":{"start":{"line":168,"column":1,"offset":9357},"end":{"line":168,"column":44,"offset":9400},"indent":[]}},{"type":"inlineCode","value":"role","position":{"start":{"line":168,"column":44,"offset":9400},"end":{"line":168,"column":50,"offset":9406},"indent":[]}},{"type":"text","value":" comamnd to only be run in a server, so we can set ","position":{"start":{"line":168,"column":50,"offset":9406},"end":{"line":168,"column":101,"offset":9457},"indent":[]}},{"type":"inlineCode","value":"guildOnly","position":{"start":{"line":168,"column":101,"offset":9457},"end":{"line":168,"column":112,"offset":9468},"indent":[]}},{"type":"text","value":" to be ","position":{"start":{"line":168,"column":112,"offset":9468},"end":{"line":168,"column":119,"offset":9475},"indent":[]}},{"type":"strong","children":[{"type":"text","value":"true","position":{"start":{"line":168,"column":121,"offset":9477},"end":{"line":168,"column":125,"offset":9481},"indent":[]}}],"position":{"start":{"line":168,"column":119,"offset":9475},"end":{"line":168,"column":127,"offset":9483},"indent":[]}},{"type":"text","value":" and delete the ","position":{"start":{"line":168,"column":127,"offset":9483},"end":{"line":168,"column":143,"offset":9499},"indent":[]}},{"type":"inlineCode","value":"dmOnly","position":{"start":{"line":168,"column":143,"offset":9499},"end":{"line":168,"column":151,"offset":9507},"indent":[]}},{"type":"text","value":" option.","position":{"start":{"line":168,"column":151,"offset":9507},"end":{"line":168,"column":159,"offset":9515},"indent":[]}}],"position":{"start":{"line":168,"column":1,"offset":9357},"end":{"line":168,"column":159,"offset":9515},"indent":[]}},{"type":"heading","depth":2,"children":[{"type":"text","value":"NSFW Option","position":{"start":{"line":170,"column":4,"offset":9520},"end":{"line":170,"column":15,"offset":9531},"indent":[]}}],"position":{"start":{"line":170,"column":1,"offset":9517},"end":{"line":170,"column":15,"offset":9531},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"NSFW stands for ","position":{"start":{"line":172,"column":1,"offset":9533},"end":{"line":172,"column":17,"offset":9549},"indent":[]}},{"type":"strong","children":[{"type":"text","value":"Not Safe For Work","position":{"start":{"line":172,"column":19,"offset":9551},"end":{"line":172,"column":36,"offset":9568},"indent":[]}}],"position":{"start":{"line":172,"column":17,"offset":9549},"end":{"line":172,"column":38,"offset":9570},"indent":[]}},{"type":"text","value":". One of Discord's rules is that you enforce that NSFW content is sent only in NSFW channels. Discordeno has this built in. You simple tell Discordeno, that you want a command to be considered ","position":{"start":{"line":172,"column":38,"offset":9570},"end":{"line":172,"column":231,"offset":9763},"indent":[]}},{"type":"inlineCode","value":"nsfw","position":{"start":{"line":172,"column":231,"offset":9763},"end":{"line":172,"column":237,"offset":9769},"indent":[]}},{"type":"text","value":" or not.","position":{"start":{"line":172,"column":237,"offset":9769},"end":{"line":172,"column":245,"offset":9777},"indent":[]}}],"position":{"start":{"line":172,"column":1,"offset":9533},"end":{"line":172,"column":245,"offset":9777},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"If this option is enabled, this command will only be able to be used in a ","position":{"start":{"line":174,"column":1,"offset":9779},"end":{"line":174,"column":75,"offset":9853},"indent":[]}},{"type":"inlineCode","value":"nsfw","position":{"start":{"line":174,"column":75,"offset":9853},"end":{"line":174,"column":81,"offset":9859},"indent":[]}},{"type":"text","value":" channel on a server. Discord does not consider Direct Messages as nsfw safe!","position":{"start":{"line":174,"column":81,"offset":9859},"end":{"line":174,"column":158,"offset":9936},"indent":[]}}],"position":{"start":{"line":174,"column":1,"offset":9779},"end":{"line":174,"column":158,"offset":9936},"indent":[]}},{"type":"heading","depth":2,"children":[{"type":"text","value":"Permission Level Option","position":{"start":{"line":176,"column":4,"offset":9941},"end":{"line":176,"column":27,"offset":9964},"indent":[]}}],"position":{"start":{"line":176,"column":1,"offset":9938},"end":{"line":176,"column":27,"offset":9964},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"Permission levels are a very powerful feature that easily allow you to set what permission is required to run a command. We will cover this in detail, in a separate section dedicated to permission levels. For now, just understand that this will restrict certain users from using a command.","position":{"start":{"line":178,"column":1,"offset":9966},"end":{"line":178,"column":290,"offset":10255},"indent":[]}}],"position":{"start":{"line":178,"column":1,"offset":9966},"end":{"line":178,"column":290,"offset":10255},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"For example, the role command we only want to be used by moderators or server admins.","position":{"start":{"line":180,"column":1,"offset":10257},"end":{"line":180,"column":86,"offset":10342},"indent":[]}}],"position":{"start":{"line":180,"column":1,"offset":10257},"end":{"line":180,"column":86,"offset":10342},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"Discordeno makes this pretty simple for us.","position":{"start":{"line":182,"column":1,"offset":10344},"end":{"line":182,"column":44,"offset":10387},"indent":[]}}],"position":{"start":{"line":182,"column":1,"offset":10344},"end":{"line":182,"column":44,"offset":10387},"indent":[]}},{"type":"code","lang":"ts","meta":null,"value":"permissionLevels: [PermissionLevels.MODERATOR, PermissionLevels.ADMIN]","position":{"start":{"line":184,"column":1,"offset":10389},"end":{"line":186,"column":4,"offset":10469},"indent":[1,1]}},{"type":"paragraph","children":[{"type":"text","value":"We're not going to cover this in detail, here because we will have an entire in depth guide for permission levels. If you want to pause and learn it now, feel free: ","position":{"start":{"line":188,"column":1,"offset":10471},"end":{"line":188,"column":166,"offset":10636},"indent":[]}},{"type":"link","title":null,"url":"https://discordeno.netlify.app/advanced/permlevels","children":[{"type":"text","value":"Permission Levels Advanced Guide","position":{"start":{"line":188,"column":167,"offset":10637},"end":{"line":188,"column":199,"offset":10669},"indent":[]}}],"position":{"start":{"line":188,"column":166,"offset":10636},"end":{"line":188,"column":252,"offset":10722},"indent":[]}}],"position":{"start":{"line":188,"column":1,"offset":10471},"end":{"line":188,"column":252,"offset":10722},"indent":[]}},{"type":"heading","depth":2,"children":[{"type":"text","value":"Permissions Check Options","position":{"start":{"line":190,"column":4,"offset":10727},"end":{"line":190,"column":29,"offset":10752},"indent":[]}}],"position":{"start":{"line":190,"column":1,"offset":10724},"end":{"line":190,"column":29,"offset":10752},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"Discordeno provides you 4 different types of permission handling that will be done before the command function is executed. This allows you to make sure that the permissions are available before running a command. For example, the role command will require the bot to have ","position":{"start":{"line":192,"column":1,"offset":10754},"end":{"line":192,"column":274,"offset":11027},"indent":[]}},{"type":"strong","children":[{"type":"text","value":"MANAGE ROLES","position":{"start":{"line":192,"column":276,"offset":11029},"end":{"line":192,"column":288,"offset":11041},"indent":[]}}],"position":{"start":{"line":192,"column":274,"offset":11027},"end":{"line":192,"column":290,"offset":11043},"indent":[]}},{"type":"text","value":" permission. This permission comes from the server settings so we can require this in the ","position":{"start":{"line":192,"column":290,"offset":11043},"end":{"line":192,"column":380,"offset":11133},"indent":[]}},{"type":"inlineCode","value":"botServerPermissions","position":{"start":{"line":192,"column":380,"offset":11133},"end":{"line":192,"column":402,"offset":11155},"indent":[]}},{"type":"text","value":".","position":{"start":{"line":192,"column":402,"offset":11155},"end":{"line":192,"column":403,"offset":11156},"indent":[]}}],"position":{"start":{"line":192,"column":1,"offset":10754},"end":{"line":192,"column":403,"offset":11156},"indent":[]}},{"type":"code","lang":"ts","meta":null,"value":"botServerPermissions: [\"MANAGE_ROLES\"],","position":{"start":{"line":194,"column":1,"offset":11158},"end":{"line":196,"column":4,"offset":11207},"indent":[1,1]}},{"type":"paragraph","children":[{"type":"text","value":"Discordeno will provide you easy to use auto-completion as soon as you type a single letter or two. This will help make it easier to use and will warn you when you make a typo and provide a wrong permission by accident.","position":{"start":{"line":198,"column":1,"offset":11209},"end":{"line":198,"column":220,"offset":11428},"indent":[]}}],"position":{"start":{"line":198,"column":1,"offset":11209},"end":{"line":198,"column":220,"offset":11428},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"We also want to make sure that the bot can send a message in this channel so that we can respond to the user. This will check the correct permission heirarchy to make sure that the bot can indeed send a message in this channel.","position":{"start":{"line":200,"column":1,"offset":11430},"end":{"line":200,"column":228,"offset":11657},"indent":[]}}],"position":{"start":{"line":200,"column":1,"offset":11430},"end":{"line":200,"column":228,"offset":11657},"indent":[]}},{"type":"code","lang":"ts","meta":null,"value":"botChannelPermissions: [\"SEND_MESSAGES\"],","position":{"start":{"line":202,"column":1,"offset":11659},"end":{"line":204,"column":4,"offset":11710},"indent":[1,1]}},{"type":"blockquote","children":[{"type":"paragraph","children":[{"type":"strong","children":[{"type":"text","value":"Note:","position":{"start":{"line":206,"column":5,"offset":11716},"end":{"line":206,"column":10,"offset":11721},"indent":[]}}],"position":{"start":{"line":206,"column":3,"offset":11714},"end":{"line":206,"column":12,"offset":11723},"indent":[]}},{"type":"text","value":" If you want to send an embed response, you should also make sure it has the ","position":{"start":{"line":206,"column":12,"offset":11723},"end":{"line":206,"column":89,"offset":11800},"indent":[]}},{"type":"inlineCode","value":"EMBED_LINKS","position":{"start":{"line":206,"column":89,"offset":11800},"end":{"line":206,"column":102,"offset":11813},"indent":[]}},{"type":"text","value":" permission.","position":{"start":{"line":206,"column":102,"offset":11813},"end":{"line":206,"column":114,"offset":11825},"indent":[]}}],"position":{"start":{"line":206,"column":3,"offset":11714},"end":{"line":206,"column":114,"offset":11825},"indent":[]}}],"position":{"start":{"line":206,"column":1,"offset":11712},"end":{"line":206,"column":114,"offset":11825},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"Already we have prevented two of the largest errors that can get our bot banned if it is not checked. Discordeno handles this internally so you don't have to worry about it.","position":{"start":{"line":208,"column":1,"offset":11827},"end":{"line":208,"column":174,"offset":12000},"indent":[]}}],"position":{"start":{"line":208,"column":1,"offset":11827},"end":{"line":208,"column":174,"offset":12000},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"Sometimes, you may also want to make sure that the user using the command has a certain permission to run the command. To do this, you can use the ","position":{"start":{"line":210,"column":1,"offset":12002},"end":{"line":210,"column":148,"offset":12149},"indent":[]}},{"type":"inlineCode","value":"userServerPermissions","position":{"start":{"line":210,"column":148,"offset":12149},"end":{"line":210,"column":171,"offset":12172},"indent":[]}},{"type":"text","value":" or the ","position":{"start":{"line":210,"column":171,"offset":12172},"end":{"line":210,"column":179,"offset":12180},"indent":[]}},{"type":"inlineCode","value":"userChannelPermissions","position":{"start":{"line":210,"column":179,"offset":12180},"end":{"line":210,"column":203,"offset":12204},"indent":[]}},{"type":"text","value":".","position":{"start":{"line":210,"column":203,"offset":12204},"end":{"line":210,"column":204,"offset":12205},"indent":[]}}],"position":{"start":{"line":210,"column":1,"offset":12002},"end":{"line":210,"column":204,"offset":12205},"indent":[]}},{"type":"heading","depth":2,"children":[{"type":"text","value":"Cooldown Options","position":{"start":{"line":212,"column":4,"offset":12210},"end":{"line":212,"column":20,"offset":12226},"indent":[]}}],"position":{"start":{"line":212,"column":1,"offset":12207},"end":{"line":212,"column":20,"offset":12226},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"The cooldown options go hand in hand together.","position":{"start":{"line":214,"column":1,"offset":12228},"end":{"line":214,"column":47,"offset":12274},"indent":[]}}],"position":{"start":{"line":214,"column":1,"offset":12228},"end":{"line":214,"column":47,"offset":12274},"indent":[]}},{"type":"list","ordered":false,"start":null,"spread":false,"children":[{"type":"listItem","spread":false,"checked":null,"children":[{"type":"paragraph","children":[{"type":"inlineCode","value":"seconds","position":{"start":{"line":216,"column":3,"offset":12278},"end":{"line":216,"column":12,"offset":12287},"indent":[]}},{"type":"text","value":" is how long to make the user wait in seconds before they can use the command again. By default, there is no wait time aka 0 seconds.","position":{"start":{"line":216,"column":12,"offset":12287},"end":{"line":216,"column":145,"offset":12420},"indent":[]}}],"position":{"start":{"line":216,"column":3,"offset":12278},"end":{"line":216,"column":145,"offset":12420},"indent":[]}}],"position":{"start":{"line":216,"column":1,"offset":12276},"end":{"line":216,"column":145,"offset":12420},"indent":[]}},{"type":"listItem","spread":false,"checked":null,"children":[{"type":"paragraph","children":[{"type":"inlineCode","value":"allowedUses","position":{"start":{"line":217,"column":3,"offset":12423},"end":{"line":217,"column":16,"offset":12436},"indent":[]}},{"type":"text","value":" is how many times a user is allowed to use a command before they are placed on cooldown.","position":{"start":{"line":217,"column":16,"offset":12436},"end":{"line":217,"column":105,"offset":12525},"indent":[]}}],"position":{"start":{"line":217,"column":3,"offset":12423},"end":{"line":217,"column":105,"offset":12525},"indent":[]}}],"position":{"start":{"line":217,"column":1,"offset":12421},"end":{"line":217,"column":105,"offset":12525},"indent":[]}},{"type":"listItem","spread":false,"checked":null,"children":[{"type":"paragraph","children":[{"type":"text","value":"Let's use our command as an example. We don't want someone to start spamming the role command so we can add a cooldown of 60 seconds. However, this would mean every time you give a role to someone, you would need to wait a whole minute to give a role to someone else. This is where ","position":{"start":{"line":219,"column":1,"offset":12528},"end":{"line":219,"column":283,"offset":12810},"indent":[]}},{"type":"inlineCode","value":"allowedUses","position":{"start":{"line":219,"column":283,"offset":12810},"end":{"line":219,"column":296,"offset":12823},"indent":[]}},{"type":"text","value":" shines! Let's set it to to 5 so that a user can use this command 5 times in a row before being asked to wait for 60 seconds.","position":{"start":{"line":219,"column":296,"offset":12823},"end":{"line":219,"column":421,"offset":12948},"indent":[]}}],"position":{"start":{"line":219,"column":1,"offset":12528},"end":{"line":219,"column":421,"offset":12948},"indent":[]}}],"position":{"start":{"line":218,"column":1,"offset":12526},"end":{"line":219,"column":421,"offset":12948},"indent":[1]}}],"position":{"start":{"line":216,"column":1,"offset":12276},"end":{"line":219,"column":421,"offset":12948},"indent":[1,1,1]}},{"type":"code","lang":"ts","meta":null,"value":"cooldown: {\n seconds: 60,\n allowedUses: 5\n},","position":{"start":{"line":221,"column":1,"offset":12950},"end":{"line":226,"column":4,"offset":13006},"indent":[1,1,1,1,1]}},{"type":"blockquote","children":[{"type":"paragraph","children":[{"type":"strong","children":[{"type":"text","value":"Note:","position":{"start":{"line":228,"column":5,"offset":13012},"end":{"line":228,"column":10,"offset":13017},"indent":[]}}],"position":{"start":{"line":228,"column":3,"offset":13010},"end":{"line":228,"column":12,"offset":13019},"indent":[]}},{"type":"text","value":" It is important to understand the way these two interact. The cooldown starts as soon as the first command is used. So, if a user uses the role command 5 times in 59 seconds, they only have to wait 1 second to do another 5 times.","position":{"start":{"line":228,"column":12,"offset":13019},"end":{"line":228,"column":242,"offset":13249},"indent":[]}}],"position":{"start":{"line":228,"column":3,"offset":13010},"end":{"line":228,"column":242,"offset":13249},"indent":[]}}],"position":{"start":{"line":228,"column":1,"offset":13008},"end":{"line":228,"column":242,"offset":13249},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"Let's give this a try shall we.","position":{"start":{"line":230,"column":1,"offset":13251},"end":{"line":230,"column":32,"offset":13282},"indent":[]}}],"position":{"start":{"line":230,"column":1,"offset":13251},"end":{"line":230,"column":32,"offset":13282},"indent":[]}},{"type":"list","ordered":true,"start":1,"spread":false,"children":[{"type":"listItem","spread":false,"checked":null,"children":[{"type":"paragraph","children":[{"type":"inlineCode","value":"!reload commands","position":{"start":{"line":232,"column":4,"offset":13287},"end":{"line":232,"column":22,"offset":13305},"indent":[]}}],"position":{"start":{"line":232,"column":4,"offset":13287},"end":{"line":232,"column":22,"offset":13305},"indent":[]}}],"position":{"start":{"line":232,"column":1,"offset":13284},"end":{"line":232,"column":22,"offset":13305},"indent":[]}},{"type":"listItem","spread":false,"checked":null,"children":[{"type":"paragraph","children":[{"type":"text","value":"Spam the ","position":{"start":{"line":233,"column":4,"offset":13309},"end":{"line":233,"column":13,"offset":13318},"indent":[]}},{"type":"inlineCode","value":"!role","position":{"start":{"line":233,"column":13,"offset":13318},"end":{"line":233,"column":20,"offset":13325},"indent":[]}},{"type":"text","value":" very quickly 6 times in under a minute.","position":{"start":{"line":233,"column":20,"offset":13325},"end":{"line":233,"column":60,"offset":13365},"indent":[]}}],"position":{"start":{"line":233,"column":4,"offset":13309},"end":{"line":233,"column":60,"offset":13365},"indent":[]}}],"position":{"start":{"line":233,"column":1,"offset":13306},"end":{"line":233,"column":60,"offset":13365},"indent":[]}}],"position":{"start":{"line":232,"column":1,"offset":13284},"end":{"line":233,"column":60,"offset":13365},"indent":[1]}},{"type":"heading","depth":2,"children":[{"type":"text","value":"Arguments","position":{"start":{"line":235,"column":4,"offset":13370},"end":{"line":235,"column":13,"offset":13379},"indent":[]}}],"position":{"start":{"line":235,"column":1,"offset":13367},"end":{"line":235,"column":13,"offset":13379},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"Arguments is an incredibly powerful feature in Discordeno. Like Permission Levels we will have an in depth look at arguments later in the guide. For now, let's try and understand this in a simple manner.","position":{"start":{"line":237,"column":1,"offset":13381},"end":{"line":237,"column":204,"offset":13584},"indent":[]}}],"position":{"start":{"line":237,"column":1,"offset":13381},"end":{"line":237,"column":204,"offset":13584},"indent":[]}},{"type":"list","ordered":false,"start":null,"spread":false,"children":[{"type":"listItem","spread":false,"checked":null,"children":[{"type":"paragraph","children":[{"type":"inlineCode","value":"name","position":{"start":{"line":239,"column":3,"offset":13588},"end":{"line":239,"column":9,"offset":13594},"indent":[]}},{"type":"text","value":": The name of the argument. Useful for when you need to alert the user X arg is missing or when you want to use the arg in your command.","position":{"start":{"line":239,"column":9,"offset":13594},"end":{"line":239,"column":145,"offset":13730},"indent":[]}}],"position":{"start":{"line":239,"column":3,"offset":13588},"end":{"line":239,"column":145,"offset":13730},"indent":[]}}],"position":{"start":{"line":239,"column":1,"offset":13586},"end":{"line":239,"column":145,"offset":13730},"indent":[]}},{"type":"listItem","spread":false,"checked":null,"children":[{"type":"paragraph","children":[{"type":"inlineCode","value":"type","position":{"start":{"line":240,"column":3,"offset":13733},"end":{"line":240,"column":9,"offset":13739},"indent":[]}},{"type":"text","value":": The type of the argument you would like. Defaults to string. Some of the ones available by default are \"number\", \"string\", \"...string\", \"boolean\", \"subcommand\", \"member\".","position":{"start":{"line":240,"column":9,"offset":13739},"end":{"line":240,"column":181,"offset":13911},"indent":[]}}],"position":{"start":{"line":240,"column":3,"offset":13733},"end":{"line":240,"column":181,"offset":13911},"indent":[]}}],"position":{"start":{"line":240,"column":1,"offset":13731},"end":{"line":240,"column":181,"offset":13911},"indent":[]}},{"type":"listItem","spread":false,"checked":null,"children":[{"type":"paragraph","children":[{"type":"inlineCode","value":"missing","position":{"start":{"line":241,"column":3,"offset":13914},"end":{"line":241,"column":12,"offset":13923},"indent":[]}},{"type":"text","value":": a function that will be run when this argument is not provided by the user or if the provided argument is not valid. By default, it does nothing.","position":{"start":{"line":241,"column":12,"offset":13923},"end":{"line":241,"column":159,"offset":14070},"indent":[]}}],"position":{"start":{"line":241,"column":3,"offset":13914},"end":{"line":241,"column":159,"offset":14070},"indent":[]}}],"position":{"start":{"line":241,"column":1,"offset":13912},"end":{"line":241,"column":159,"offset":14070},"indent":[]}},{"type":"listItem","spread":false,"checked":null,"children":[{"type":"paragraph","children":[{"type":"inlineCode","value":"required","position":{"start":{"line":242,"column":3,"offset":14073},"end":{"line":242,"column":13,"offset":14083},"indent":[]}},{"type":"text","value":": Whether this argument is required or optional. By default, this is true.","position":{"start":{"line":242,"column":13,"offset":14083},"end":{"line":242,"column":87,"offset":14157},"indent":[]}}],"position":{"start":{"line":242,"column":3,"offset":14073},"end":{"line":242,"column":87,"offset":14157},"indent":[]}}],"position":{"start":{"line":242,"column":1,"offset":14071},"end":{"line":242,"column":87,"offset":14157},"indent":[]}},{"type":"listItem","spread":false,"checked":null,"children":[{"type":"paragraph","children":[{"type":"inlineCode","value":"lowercase","position":{"start":{"line":243,"column":3,"offset":14160},"end":{"line":243,"column":14,"offset":14171},"indent":[]}},{"type":"text","value":": If the type is a string, this can forcibly lowercase the string.","position":{"start":{"line":243,"column":14,"offset":14171},"end":{"line":243,"column":80,"offset":14237},"indent":[]}}],"position":{"start":{"line":243,"column":3,"offset":14160},"end":{"line":243,"column":80,"offset":14237},"indent":[]}}],"position":{"start":{"line":243,"column":1,"offset":14158},"end":{"line":243,"column":80,"offset":14237},"indent":[]}},{"type":"listItem","spread":false,"checked":null,"children":[{"type":"paragraph","children":[{"type":"inlineCode","value":"literals","position":{"start":{"line":244,"column":3,"offset":14240},"end":{"line":244,"column":13,"offset":14250},"indent":[]}},{"type":"text","value":": If the type is string or subcommand you can provide literals. The argument MUST be exactly the same as the literals to be accepted. For example, if you want to make sure the argument is ","position":{"start":{"line":244,"column":13,"offset":14250},"end":{"line":244,"column":201,"offset":14438},"indent":[]}},{"type":"inlineCode","value":"a","position":{"start":{"line":244,"column":201,"offset":14438},"end":{"line":244,"column":204,"offset":14441},"indent":[]}},{"type":"text","value":" or ","position":{"start":{"line":244,"column":204,"offset":14441},"end":{"line":244,"column":208,"offset":14445},"indent":[]}},{"type":"inlineCode","value":"b","position":{"start":{"line":244,"column":208,"offset":14445},"end":{"line":244,"column":211,"offset":14448},"indent":[]}},{"type":"text","value":" only and not ","position":{"start":{"line":244,"column":211,"offset":14448},"end":{"line":244,"column":225,"offset":14462},"indent":[]}},{"type":"inlineCode","value":"c","position":{"start":{"line":244,"column":225,"offset":14462},"end":{"line":244,"column":228,"offset":14465},"indent":[]}},{"type":"text","value":".","position":{"start":{"line":244,"column":228,"offset":14465},"end":{"line":244,"column":229,"offset":14466},"indent":[]}}],"position":{"start":{"line":244,"column":3,"offset":14240},"end":{"line":244,"column":229,"offset":14466},"indent":[]}}],"position":{"start":{"line":244,"column":1,"offset":14238},"end":{"line":244,"column":229,"offset":14466},"indent":[]}},{"type":"listItem","spread":false,"checked":null,"children":[{"type":"paragraph","children":[{"type":"inlineCode","value":"defaultValue","position":{"start":{"line":245,"column":3,"offset":14469},"end":{"line":245,"column":17,"offset":14483},"indent":[]}},{"type":"text","value":": The default value for this argument/subcommand. If the user does not provide an argument or it is invalid, it can be defaulted to a certain value.","position":{"start":{"line":245,"column":17,"offset":14483},"end":{"line":245,"column":165,"offset":14631},"indent":[]}}],"position":{"start":{"line":245,"column":3,"offset":14469},"end":{"line":245,"column":165,"offset":14631},"indent":[]}}],"position":{"start":{"line":245,"column":1,"offset":14467},"end":{"line":245,"column":165,"offset":14631},"indent":[]}}],"position":{"start":{"line":239,"column":1,"offset":13586},"end":{"line":245,"column":165,"offset":14631},"indent":[1,1,1,1,1,1]}},{"type":"paragraph","children":[{"type":"text","value":"For our role command, we need a ","position":{"start":{"line":247,"column":1,"offset":14633},"end":{"line":247,"column":33,"offset":14665},"indent":[]}},{"type":"inlineCode","value":"member","position":{"start":{"line":247,"column":33,"offset":14665},"end":{"line":247,"column":41,"offset":14673},"indent":[]}},{"type":"text","value":" and a ","position":{"start":{"line":247,"column":41,"offset":14673},"end":{"line":247,"column":48,"offset":14680},"indent":[]}},{"type":"inlineCode","value":"role","position":{"start":{"line":247,"column":48,"offset":14680},"end":{"line":247,"column":54,"offset":14686},"indent":[]}},{"type":"text","value":".","position":{"start":{"line":247,"column":54,"offset":14686},"end":{"line":247,"column":55,"offset":14687},"indent":[]}}],"position":{"start":{"line":247,"column":1,"offset":14633},"end":{"line":247,"column":55,"offset":14687},"indent":[]}},{"type":"code","lang":"ts","meta":null,"value":"arguments: [\n {\n name: \"member\",\n type: \"member\",\n missing: (message) => {\n sendResponse(message, `you did not provide a member to give the role to. You can provide a @member mention, a member ID, or try using their nickname/username. The nickname/username will only work if they have been active in your server recently.`)\n }\n },\n {\n name: \"role\",\n type: \"role\",\n missing: (message) => {\n sendResponse(message, `you did not provide a role to give. You can provide a @role mention, a role ID, or it's name. If the role name did not work, try to use the **roleinfo** command to get the role ID.`)\n }\n }\n]","position":{"start":{"line":249,"column":1,"offset":14689},"end":{"line":266,"column":4,"offset":15340},"indent":[1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1]}},{"type":"heading","depth":2,"children":[{"type":"text","value":"Execute Option","position":{"start":{"line":268,"column":4,"offset":15345},"end":{"line":268,"column":18,"offset":15359},"indent":[]}}],"position":{"start":{"line":268,"column":1,"offset":15342},"end":{"line":268,"column":18,"offset":15359},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"The execute option is the code that will run when the command is triggered. The execute function is passed 3 parameters that you can use in your command.","position":{"start":{"line":270,"column":1,"offset":15361},"end":{"line":270,"column":154,"offset":15514},"indent":[]}}],"position":{"start":{"line":270,"column":1,"offset":15361},"end":{"line":270,"column":154,"offset":15514},"indent":[]}},{"type":"list","ordered":false,"start":null,"spread":false,"children":[{"type":"listItem","spread":false,"checked":null,"children":[{"type":"paragraph","children":[{"type":"inlineCode","value":"message","position":{"start":{"line":272,"column":3,"offset":15518},"end":{"line":272,"column":12,"offset":15527},"indent":[]}},{"type":"text","value":": The message object itself that triggered this command.","position":{"start":{"line":272,"column":12,"offset":15527},"end":{"line":272,"column":68,"offset":15583},"indent":[]}}],"position":{"start":{"line":272,"column":3,"offset":15518},"end":{"line":272,"column":68,"offset":15583},"indent":[]}}],"position":{"start":{"line":272,"column":1,"offset":15516},"end":{"line":272,"column":68,"offset":15583},"indent":[]}},{"type":"listItem","spread":false,"checked":null,"children":[{"type":"paragraph","children":[{"type":"inlineCode","value":"args","position":{"start":{"line":273,"column":3,"offset":15586},"end":{"line":273,"column":9,"offset":15592},"indent":[]}},{"type":"text","value":": The args that were provided by the user.","position":{"start":{"line":273,"column":9,"offset":15592},"end":{"line":273,"column":51,"offset":15634},"indent":[]}}],"position":{"start":{"line":273,"column":3,"offset":15586},"end":{"line":273,"column":51,"offset":15634},"indent":[]}}],"position":{"start":{"line":273,"column":1,"offset":15584},"end":{"line":273,"column":51,"offset":15634},"indent":[]}},{"type":"listItem","spread":false,"checked":null,"children":[{"type":"paragraph","children":[{"type":"inlineCode","value":"guild","position":{"start":{"line":274,"column":3,"offset":15637},"end":{"line":274,"column":10,"offset":15644},"indent":[]}},{"type":"text","value":": The server guild object where this command was run.","position":{"start":{"line":274,"column":10,"offset":15644},"end":{"line":274,"column":63,"offset":15697},"indent":[]}}],"position":{"start":{"line":274,"column":3,"offset":15637},"end":{"line":274,"column":63,"offset":15697},"indent":[]}}],"position":{"start":{"line":274,"column":1,"offset":15635},"end":{"line":274,"column":63,"offset":15697},"indent":[]}}],"position":{"start":{"line":272,"column":1,"offset":15516},"end":{"line":274,"column":63,"offset":15697},"indent":[1,1]}},{"type":"code","lang":"ts","meta":null,"value":"execute: function (message, args, guild) {\n // The code that is to be executed goes here\n}","position":{"start":{"line":276,"column":1,"offset":15699},"end":{"line":280,"column":4,"offset":15800},"indent":[1,1,1,1]}},{"type":"blockquote","children":[{"type":"paragraph","children":[{"type":"strong","children":[{"type":"text","value":"Note:","position":{"start":{"line":282,"column":5,"offset":15806},"end":{"line":282,"column":10,"offset":15811},"indent":[]}}],"position":{"start":{"line":282,"column":3,"offset":15804},"end":{"line":282,"column":12,"offset":15813},"indent":[]}},{"type":"text","value":" I prefer writing code using the function keyword, but you can easily change to the fat arrow function if you prefer.","position":{"start":{"line":282,"column":12,"offset":15813},"end":{"line":282,"column":129,"offset":15930},"indent":[]}}],"position":{"start":{"line":282,"column":3,"offset":15804},"end":{"line":282,"column":129,"offset":15930},"indent":[]}},{"type":"code","lang":"ts","meta":null,"value":"execute: (message, args, guild) => {\n // The code that is to be executed goes here\n}","position":{"start":{"line":283,"column":3,"offset":15933},"end":{"line":287,"column":6,"offset":16037},"indent":[3,3,3,3]}}],"position":{"start":{"line":282,"column":1,"offset":15802},"end":{"line":287,"column":6,"offset":16037},"indent":[1,1,1,1,1]}},{"type":"paragraph","children":[{"type":"text","value":"Let's start out by writing some pseudo-code(comments that will help us plan the code).","position":{"start":{"line":289,"column":1,"offset":16039},"end":{"line":289,"column":87,"offset":16125},"indent":[]}}],"position":{"start":{"line":289,"column":1,"offset":16039},"end":{"line":289,"column":87,"offset":16125},"indent":[]}},{"type":"code","lang":"ts","meta":null,"value":"execute: function (message, args, guild) {\n // If this was the everyone role alert with a silly error\n\n // If this is a managed role(some bots role) we can't give/remove alert with silly error\n\n // Get the bots highest role\n\n // Check if the bot has a role higher than the role that it will try to give.\n\n // If the role is too high alert the user.\n\n // If the user has this role already remove the role from them.\n\n // Check the command author's highest role\n\n // If the author does not have a role high enough to give this role alert\n\n // If the user has this role already we should remove it\n\n // Add the role to the user.\n\n // Alert the user that used the command that the user has been give the role.\n}","position":{"start":{"line":291,"column":1,"offset":16127},"end":{"line":315,"column":4,"offset":16855},"indent":[1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1]}},{"type":"paragraph","children":[{"type":"text","value":"Nice! The plan for the code is complete. Now, let's add in the code.","position":{"start":{"line":317,"column":1,"offset":16857},"end":{"line":317,"column":69,"offset":16925},"indent":[]}}],"position":{"start":{"line":317,"column":1,"offset":16857},"end":{"line":317,"column":69,"offset":16925},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"The first thing we are going to try is to check if the role the user provided is the same as the everyone role.","position":{"start":{"line":319,"column":1,"offset":16927},"end":{"line":319,"column":112,"offset":17038},"indent":[]}}],"position":{"start":{"line":319,"column":1,"offset":16927},"end":{"line":319,"column":112,"offset":17038},"indent":[]}},{"type":"blockquote","children":[{"type":"paragraph","children":[{"type":"strong","children":[{"type":"text","value":"Note:","position":{"start":{"line":321,"column":5,"offset":17044},"end":{"line":321,"column":10,"offset":17049},"indent":[]}}],"position":{"start":{"line":321,"column":3,"offset":17042},"end":{"line":321,"column":12,"offset":17051},"indent":[]}},{"type":"text","value":" The everyone role ID is the same as the server guild ID.","position":{"start":{"line":321,"column":12,"offset":17051},"end":{"line":321,"column":69,"offset":17108},"indent":[]}}],"position":{"start":{"line":321,"column":3,"offset":17042},"end":{"line":321,"column":69,"offset":17108},"indent":[]}}],"position":{"start":{"line":321,"column":1,"offset":17040},"end":{"line":321,"column":69,"offset":17108},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"To do this, we are going to want something like this:","position":{"start":{"line":323,"column":1,"offset":17110},"end":{"line":323,"column":54,"offset":17163},"indent":[]}}],"position":{"start":{"line":323,"column":1,"offset":17110},"end":{"line":323,"column":54,"offset":17163},"indent":[]}},{"type":"code","lang":"ts","meta":null,"value":"if (args.role.id === message.guildID) {\n return sendResponse(message, \"The everyone role can not be given to anyone because everyone has the everyone role already. *Keep calm and let Carter figure it out*!\");\n}","position":{"start":{"line":325,"column":1,"offset":17165},"end":{"line":329,"column":4,"offset":17386},"indent":[1,1,1,1]}},{"type":"paragraph","children":[{"type":"text","value":"You might be seeing an error since we didn't provide the accurate typings for the ","position":{"start":{"line":331,"column":1,"offset":17388},"end":{"line":331,"column":83,"offset":17470},"indent":[]}},{"type":"inlineCode","value":"args","position":{"start":{"line":331,"column":83,"offset":17470},"end":{"line":331,"column":89,"offset":17476},"indent":[]}},{"type":"text","value":" parameter. The message and guild parameter is automated but the args is dynamic depending on your ","position":{"start":{"line":331,"column":89,"offset":17476},"end":{"line":331,"column":188,"offset":17575},"indent":[]}},{"type":"inlineCode","value":"arguments","position":{"start":{"line":331,"column":188,"offset":17575},"end":{"line":331,"column":199,"offset":17586},"indent":[]}},{"type":"text","value":" option for your command. So let's do this real quick.","position":{"start":{"line":331,"column":199,"offset":17586},"end":{"line":331,"column":253,"offset":17640},"indent":[]}}],"position":{"start":{"line":331,"column":1,"offset":17388},"end":{"line":331,"column":253,"offset":17640},"indent":[]}},{"type":"code","lang":"ts","meta":null,"value":"execute: function (message, args: RoleArgs, guild) {\n // If this was the everyone role alert with a silly error\n if (args.role.id === message.guildID) {\n return sendResponse(message, \"Are you trying to make this person a super hero? Everyone has the everyone role. I can't give the everyone role to another user.\");\n }\n\n // Lots of comments here hidden so you can see the changes easily.\n}\n\ninterface RoleArgs {\n role: Role;\n member: Member;\n}","position":{"start":{"line":333,"column":1,"offset":17642},"end":{"line":347,"column":4,"offset":18104},"indent":[1,1,1,1,1,1,1,1,1,1,1,1,1,1]}},{"type":"paragraph","children":[{"type":"text","value":"Awesome! Let's keep going.","position":{"start":{"line":349,"column":1,"offset":18106},"end":{"line":349,"column":27,"offset":18132},"indent":[]}}],"position":{"start":{"line":349,"column":1,"offset":18106},"end":{"line":349,"column":27,"offset":18132},"indent":[]}},{"type":"code","lang":"ts","meta":null,"value":"execute: function (message, args: RoleArgs, guild) {\n // If this was the everyone role alert with a silly error\n if (args.role.id === message.guildID) {\n return sendResponse(message, \"I don't know if you noticed or not but I'm an extremely arrogant bot who tends to think all of his plans will work. But I can't give the everyone role to someone.\");\n }\n\n // If this is a managed role(some bots role) we can't give/remove alert with silly error\n if (args.role.managed) {\n return sendResponse(message, \"Dammit man, just 'cause I'm Scottish doesn't mean I can give your people managed roles.\")\n }\n\n // Get the bots highest role\n const botsHighestRole = highestRole(message.guildID, botID);\n\n // Check if the bot has a role higher than the role that it will try to give.\n const botIsHigher = higherRolePosition(message.guildID, botsHighestRole.id, args.role.id)\n\n // If the role is too high alert the user.\n if (!botIsHigher) {\n return sendResponse(message, \"Okay look, asking me give a role that is higher than my highest role is ridiculous! I am the first bot to admit I don't know who these people are nor do I care to. Look, if you'd like I could take you down the hall and just point at the people who annoy me more than the rest. But that's about as useful as I get.\")\n }\n\n // Check the command author's highest role\n const membersHighestRole = highestRole(message.guildID, message.author.id);\n\n // If the author does not have a role high enough to give this role alert\n if (!higherRolePosition(message.guildID, membersHighestRole.id, args.role.id)) {\n return sendResponse(message, \"In my culture, whenever someone tries to give a role that is higher than their highest role, I would be well within my rights to dismember you.\")\n }\n\n // If the user has this role already we should remove it\n if (message.member().roles.includes(args.role.id)) {\n removeRole(message.guildID, args.member.user.id, args.role.id, `${message.author.tag} used the role command to remove this role.`)\n // Alert the user that used the command that the user has lost the role.\n return sendResponse(message, `The role **${args.role.name}** has been removed from **${args.member.tag}**.`)\n }\n\n // Add the role to the user.\n addRole(guildID, memberID, roleID)\n\n // Alert the user that used the command that the user has been give the role.\n return sendResponse(message, `The role **${args.role.name}** has been added to **${args.member.tag}**.`)\n}","position":{"start":{"line":352,"column":1,"offset":18135},"end":{"line":396,"column":4,"offset":20611},"indent":[1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1]}},{"type":"paragraph","children":[{"type":"text","value":"The final version of the command should look something like this:","position":{"start":{"line":398,"column":1,"offset":20613},"end":{"line":398,"column":66,"offset":20678},"indent":[]}}],"position":{"start":{"line":398,"column":1,"offset":20613},"end":{"line":398,"column":66,"offset":20678},"indent":[]}},{"type":"code","lang":"ts","meta":null,"value":"import { highestRole, higherRolePosition, botID, removeRole, addRole, Role, Member } from \"../../deps.ts\";\nimport { botCache } from \"../../mod.ts\";\nimport { PermissionLevels } from \"../types/commands.ts\";\nimport { sendResponse } from \"../utils/helpers.ts\";\n\nbotCache.commands.set(\"role\", {\n name: \"role\",\n permissionLevel: [PermissionLevels.MODERATOR, PermissionLevels.ADMIN],\n botServerPermissions: [\"MANAGE_ROLES\"],\n botChannelPermissions: [\"SEND_MESSAGES\"],\n cooldown: {\n seconds: 60,\n allowedUses: 5,\n },\n arguments: [\n\t\t{\n\t\t\tname: \"member\",\n\t\t\ttype: \"member\",\n\t\t\tmissing: (message) => {\n\t\t\t\tsendResponse(message, `you did not provide a member to give the role to. You can provide a @member mention, a member ID, or try using their nickname/username. The nickname/username will only work if they have been active in your server recently.`)\n\t\t\t}\n\t\t},\n\t\t{\n\t\t\tname: \"role\",\n\t\t\ttype: \"role\",\n\t\t\tmissing: (message) => {\n\t\t\t\tsendResponse(message, `you did not provide a role to give. You can provide a @role mention, a role ID, or it's name. If the role name did not work, try to use the **roleinfo** command to get the role ID.`)\n\t\t\t}\n\t\t}\n\t],\n execute: function (message, args: RoleArgs) {\n // If this was the everyone role alert with a silly error\n if (args.role.id === message.guildID) {\n return sendResponse(\n message,\n \"I don't know if you noticed or not but I'm an extremely arrogant bot who tends to think all of his plans will work. But I can't give the everyone role to someone.\",\n );\n }\n\n // If this is a managed role(some bots role) we can't give/remove alert with silly error\n if (args.role.managed) {\n return sendResponse(\n message,\n \"Dammit man, just 'cause I'm Scottish doesn't mean I can give your people managed roles.\",\n );\n }\n\n // Get the bots highest role\n const botsHighestRole = highestRole(message.guildID, botID);\n\n // Check if the bot has a role higher than the role that it will try to give. If the role is too high alert the user.\n if (!botsHighestRole || !higherRolePosition(\n message.guildID,\n botsHighestRole.id,\n args.role.id,\n )) {\n return sendResponse(\n message,\n \"Okay look, asking me give a role that is higher than my highest role is ridiculous! I am the first bot to admit I don't know who these people are nor do I care to. Look, if you'd like I could take you down the hall and just point at the people who annoy me more than the rest. But that's about as useful as I get.\",\n );\n }\n\n // Check the command author's highest role\n const membersHighestRole = highestRole(message.guildID, message.author.id);\n\n // If the author does not have a role high enough to give this role alert\n if (!membersHighestRole ||\n !higherRolePosition(message.guildID, membersHighestRole.id, args.role.id)\n ) {\n return sendResponse(\n message,\n \"In my culture, whenever someone tries to give a role that is higher than their highest role, I would be well within my rights to dismember you.\",\n );\n }\n\n // If the user has this role already we should remove it\n if (message.member()?.roles.includes(args.role.id)) {\n removeRole(\n message.guildID,\n args.member.user.id,\n args.role.id,\n `${message.author.username} used the role command to remove this role.`,\n );\n // Alert the user that used the command that the user has lost the role.\n return sendResponse(\n message,\n `The role **${args.role.name}** has been removed from **${args.member.tag}**.`,\n );\n }\n\n // Add the role to the user.\n addRole(message.guildID, args.member.user.id, args.role.id, `${message.author.username} used the role command to give this role.`);\n\n // Alert the user that used the command that the user has been give the role.\n return sendResponse(\n message,\n `The role **${args.role.name}** has been added to **${args.member.tag}**.`,\n );\n },\n});\n\ninterface RoleArgs {\n role: Role;\n member: Member;\n}","position":{"start":{"line":400,"column":1,"offset":20680},"end":{"line":506,"column":4,"offset":24762},"indent":[1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1]}},{"type":"blockquote","children":[{"type":"paragraph","children":[{"type":"strong","children":[{"type":"text","value":"Note:","position":{"start":{"line":508,"column":5,"offset":24768},"end":{"line":508,"column":10,"offset":24773},"indent":[]}}],"position":{"start":{"line":508,"column":3,"offset":24766},"end":{"line":508,"column":12,"offset":24775},"indent":[]}},{"type":"text","value":" The response strings are a play on some funny Stargate(my favorite tv show) moments. Feel free to change as you wish to fit your bot's personality.","position":{"start":{"line":508,"column":12,"offset":24775},"end":{"line":508,"column":160,"offset":24923},"indent":[]}}],"position":{"start":{"line":508,"column":3,"offset":24766},"end":{"line":508,"column":160,"offset":24923},"indent":[]}}],"position":{"start":{"line":508,"column":1,"offset":24764},"end":{"line":508,"column":160,"offset":24923},"indent":[]}},{"type":"heading","depth":2,"children":[{"type":"text","value":"Dynamic(Advanced Level) Command Creation","position":{"start":{"line":510,"column":4,"offset":24928},"end":{"line":510,"column":44,"offset":24968},"indent":[]}}],"position":{"start":{"line":510,"column":1,"offset":24925},"end":{"line":510,"column":44,"offset":24968},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"This is some advanced level super magical command creation skills. Discordeno gives you the power to dynamically create commands. What that means is you can write the code for one command but dynamically create like 50 commands using that same code.","position":{"start":{"line":512,"column":1,"offset":24970},"end":{"line":512,"column":250,"offset":25219},"indent":[]}}],"position":{"start":{"line":512,"column":1,"offset":24970},"end":{"line":512,"column":250,"offset":25219},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"For example, in my main bot I have a lot of \"fun\" commands like ","position":{"start":{"line":514,"column":1,"offset":25221},"end":{"line":514,"column":65,"offset":25285},"indent":[]}},{"type":"inlineCode","value":".hug","position":{"start":{"line":514,"column":65,"offset":25285},"end":{"line":514,"column":71,"offset":25291},"indent":[]}},{"type":"text","value":" or ","position":{"start":{"line":514,"column":71,"offset":25291},"end":{"line":514,"column":75,"offset":25295},"indent":[]}},{"type":"inlineCode","value":".kiss","position":{"start":{"line":514,"column":75,"offset":25295},"end":{"line":514,"column":82,"offset":25302},"indent":[]}},{"type":"text","value":" etc... All of these files have the exact same code except for 1 word being the command name. Would it not be better to simply write the code once and dynamically create every single command. Let me show you how that works.","position":{"start":{"line":514,"column":82,"offset":25302},"end":{"line":514,"column":305,"offset":25525},"indent":[]}}],"position":{"start":{"line":514,"column":1,"offset":25221},"end":{"line":514,"column":305,"offset":25525},"indent":[]}},{"type":"list","ordered":false,"start":null,"spread":false,"children":[{"type":"listItem","spread":false,"checked":null,"children":[{"type":"paragraph","children":[{"type":"text","value":"Create a file in the commands folder called ","position":{"start":{"line":516,"column":3,"offset":25529},"end":{"line":516,"column":47,"offset":25573},"indent":[]}},{"type":"inlineCode","value":"fun.ts","position":{"start":{"line":516,"column":47,"offset":25573},"end":{"line":516,"column":55,"offset":25581},"indent":[]}},{"type":"text","value":" which will create all our fun commands.","position":{"start":{"line":516,"column":55,"offset":25581},"end":{"line":516,"column":95,"offset":25621},"indent":[]}}],"position":{"start":{"line":516,"column":3,"offset":25529},"end":{"line":516,"column":95,"offset":25621},"indent":[]}}],"position":{"start":{"line":516,"column":1,"offset":25527},"end":{"line":516,"column":95,"offset":25621},"indent":[]}}],"position":{"start":{"line":516,"column":1,"offset":25527},"end":{"line":516,"column":95,"offset":25621},"indent":[]}},{"type":"code","lang":"ts","meta":null,"value":"import { Member, sendMessage, chooseRandom, avatarURL } from \"../../deps.ts\";\nimport { botCache } from \"../../mod.ts\";\nimport { createCommandAliases, sendEmbed } from \"../utils/helpers.ts\";\nimport { configs } from \"../../configs.ts\";\nimport { Embed } from \"../utils/Embed.ts\";\nimport { translate } from \"../utils/i18next.ts\";\n\nconst funCommandData = [\n { name: \"bite\", gifs: configs.gifs.bite },\n { name: \"cuddle\", gifs: configs.gifs.cuddle },\n { name: \"dance\", gifs: configs.gifs.dance },\n { name: \"hug\", gifs: configs.gifs.hug },\n { name: \"kiss\", gifs: configs.gifs.kiss },\n { name: \"kanna\", gifs: configs.gifs.kanna },\n { name: \"kiss\", gifs: configs.gifs.kiss },\n { name: \"kitten\", gifs: configs.gifs.kitten },\n { name: \"lmao\", gifs: configs.gifs.lmao, aliases: [\"lol\"] },\n { name: \"pat\", gifs: configs.gifs.pat },\n { name: \"poke\", gifs: configs.gifs.poke },\n { name: \"pony\", gifs: configs.gifs.pony },\n { name: \"puppy\", gifs: configs.gifs.puppy },\n { name: \"raphtalia\", gifs: configs.gifs.raphtalia },\n { name: \"stargate\", gifs: configs.gifs.stargate },\n { name: \"supernatural\", gifs: configs.gifs.supernatural },\n { name: \"tickle\", gifs: configs.gifs.tickle },\n { name: \"zerotwo\", gifs: configs.gifs.zerotwo },\n];\n\nfunCommandData.forEach((data) => {\n botCache.commands.set(data.name, {\n name: data.name,\n botChannelPermissions: [\"SEND_MESSAGES\", \"EMBED_LINKS\"],\n cooldown: {\n seconds: 2,\n },\n arguments: [\n {\n name: \"member\",\n type: \"member\",\n required: false,\n },\n ],\n execute: function (message, args: FunArgs) {\n\t\t\t// If a member is provided use that otherwise set the member themself\n const member = args.member || message.member()!;\n\n const type = member.user.id === message.author.id\n // Silly response like if user tries to hug themself\n ? \"SELF\"\n // Response for when user tries to hug another user\n : \"OTHER\";\n\n\n // Create an embed\n const embed = new Embed()\n .setAuthor(member.tag, avatarURL(member))\n .setDescription(\n translate(\n message.guildID,\n `commands/fun/${data.name}:${type}`,\n { mention: message.member()!.mention, user: member.mention },\n ),\n )\n .setImage(chooseRandom(data.gifs));\n\n return sendEmbed(message.channel, embed);\n },\n });\n\n if (data.aliases?.length) {\n createCommandAliases(data.name, data.aliases);\n }\n});\n\ninterface FunArgs {\n member?: Member;\n}","position":{"start":{"line":518,"column":1,"offset":25623},"end":{"line":596,"column":4,"offset":28138},"indent":[1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1]}},{"type":"paragraph","children":[{"type":"text","value":"Take a minute to realize what just happened. This has made 18 different unique commands dynamically. In 1 file, using the same piece of code, we created so many commands. You can easily add more commands to this. For example, if you wanted to add weeb(animated) versions of these commands. Then you are at 36 commands with 1 simple command file.","position":{"start":{"line":598,"column":1,"offset":28140},"end":{"line":598,"column":346,"offset":28485},"indent":[]}}],"position":{"start":{"line":598,"column":1,"offset":28140},"end":{"line":598,"column":346,"offset":28485},"indent":[]}},{"type":"paragraph","children":[{"type":"strong","children":[{"type":"text","value":"That ladies and gentleman is the power and magic of Discordeno!","position":{"start":{"line":600,"column":3,"offset":28489},"end":{"line":600,"column":66,"offset":28552},"indent":[]}}],"position":{"start":{"line":600,"column":1,"offset":28487},"end":{"line":600,"column":68,"offset":28554},"indent":[]}}],"position":{"start":{"line":600,"column":1,"offset":28487},"end":{"line":600,"column":68,"offset":28554},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"Take a minute to stand up, step back and make some room around you. Now start dancing because you just acheived one of the most complex things in bot development. You have already created about 36 commands!!!!","position":{"start":{"line":602,"column":1,"offset":28556},"end":{"line":602,"column":210,"offset":28765},"indent":[]}}],"position":{"start":{"line":602,"column":1,"offset":28556},"end":{"line":602,"column":210,"offset":28765},"indent":[]}},{"type":"blockquote","children":[{"type":"paragraph","children":[{"type":"strong","children":[{"type":"text","value":"Note:","position":{"start":{"line":604,"column":5,"offset":28771},"end":{"line":604,"column":10,"offset":28776},"indent":[]}}],"position":{"start":{"line":604,"column":3,"offset":28769},"end":{"line":604,"column":12,"offset":28778},"indent":[]}},{"type":"text","value":" The command above uses translations which we will cover in depth in a later section of this guide.","position":{"start":{"line":604,"column":12,"offset":28778},"end":{"line":604,"column":111,"offset":28877},"indent":[]}}],"position":{"start":{"line":604,"column":3,"offset":28769},"end":{"line":604,"column":111,"offset":28877},"indent":[]}}],"position":{"start":{"line":604,"column":1,"offset":28767},"end":{"line":604,"column":111,"offset":28877},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"Once you are ready, let's proceed to making our inhibitors.","position":{"start":{"line":606,"column":1,"offset":28879},"end":{"line":606,"column":60,"offset":28938},"indent":[]}}],"position":{"start":{"line":606,"column":1,"offset":28879},"end":{"line":606,"column":60,"offset":28938},"indent":[]}},{"type":"export","value":"export const _frontmatter = {\"title\":\"Creating A Command\",\"metaTitle\":\"Creating A Command | Discordeno\",\"metaDescription\":\"Let's create our very first command with Discordeno!\"}","position":{"start":{"line":609,"column":1,"offset":28941},"end":{"line":609,"column":178,"offset":29118},"indent":[]}}],"position":{"start":{"line":1,"column":1,"offset":0},"end":{"line":609,"column":178,"offset":29118}}},"scopeImports":["import * as React from 'react'"],"scopeIdentifiers":["React"],"body":"function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }\n\nfunction _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }\n\nfunction _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }\n\n/* @jsx mdx */\nvar _frontmatter = {\n \"title\": \"Creating A Command\",\n \"metaTitle\": \"Creating A Command | Discordeno\",\n \"metaDescription\": \"Let's create our very first command with Discordeno!\"\n};\nvar layoutProps = {\n _frontmatter: _frontmatter\n};\nvar MDXLayout = \"wrapper\";\nreturn function MDXContent(_ref) {\n var components = _ref.components,\n props = _objectWithoutProperties(_ref, [\"components\"]);\n\n return mdx(MDXLayout, _extends({}, layoutProps, props, {\n components: components,\n mdxType: \"MDXLayout\"\n }), mdx(\"p\", null, \"Really great job. Now, lets dive into trying to use some of the commands and try to make our very own command.\"), mdx(\"h2\", null, \"Editing Invite Command\"), mdx(\"p\", null, \"Let's first start by taking an existing command and slightly modifying it to your needs. Let's use the \", mdx(\"inlineCode\", {\n parentName: \"p\"\n }, \"Invite\"), \" command as our example. When you open the command, you will see something like this:\"), mdx(\"pre\", null, mdx(\"code\", _extends({\n parentName: \"pre\"\n }, {\n \"className\": \"language-ts\"\n }), \"import { botCache } from \\\"../../mod.ts\\\";\\nimport { sendMessage } from \\\"https://raw.githubusercontent.com/Skillz4Killz/Discordeno/v7/src/handlers/channel.ts\\\";\\nimport { botID } from \\\"https://raw.githubusercontent.com/Skillz4Killz/Discordeno/v7/src/module/client.ts\\\";\\n\\nbotCache.commands.set(\\\"invite\\\", {\\n name: \\\"invite\\\",\\n execute: function (message) {\\n // Replace the permission number at the end to request the permissions you wish to request. By default, this will request Admin perms.\\n sendMessage(\\n message.channel,\\n `https://discordapp.com/oauth2/authorize?client_id=${botID}&scope=bot&permissions=8`,\\n );\\n },\\n});\\n\")), mdx(\"p\", null, \"Let's break this down. The first three lines are importing the necessary things from their files so we can use them in this command. Don't worry if this doesn't make sense, most of the time, this will all be done automatically for you if you use a good code editor like Visual Studio Code. We create a command by doing:\"), mdx(\"pre\", null, mdx(\"code\", _extends({\n parentName: \"pre\"\n }, {\n \"className\": \"language-ts\"\n }), \"botCache.commands.set('commandname', {\\n\\n})\\n\")), mdx(\"p\", null, \"The command name here must be unique. If it is not unique, your commands will not work properly as you wish. For example, you can't have 2 commands with the \", mdx(\"inlineCode\", {\n parentName: \"p\"\n }, \"ping\"), \" name. In this case, our command is called \", mdx(\"inlineCode\", {\n parentName: \"p\"\n }, \"invite\"), \".\"), mdx(\"p\", null, \"The \", mdx(\"inlineCode\", {\n parentName: \"p\"\n }, \"name: 'invite'\"), \" is also written as it is useful for our help command and inhibitors! Normally, these two things will be the same. So far it's super easy right.\"), mdx(\"p\", null, \"Next is the \", mdx(\"inlineCode\", {\n parentName: \"p\"\n }, \"execute\"), \". This is where the magic happens. This is the function that is triggered when the command is ran by a user. In this case, the bot simply sends a message to a channel where the command was ran and sends an invite link. Let's take a minute and optimize this for our case. We don't \", mdx(\"strong\", {\n parentName: \"p\"\n }, \"NEED\"), \" admin permissions for our bot. Let's go to the \", mdx(\"a\", _extends({\n parentName: \"p\"\n }, {\n \"href\": \"https://discordapi.com/permissions.html#0\"\n }), \"permission calculator\"), \" and figure out the permissions we need for our bot.\"), mdx(\"p\", null, \"Once you have decided which permissions you want to request, you can copy the number and replace it here. For example, if we want \", mdx(\"inlineCode\", {\n parentName: \"p\"\n }, \"68640\"), \" as our permissions. We can modify our command to be:\"), mdx(\"pre\", null, mdx(\"code\", _extends({\n parentName: \"pre\"\n }, {\n \"className\": \"language-ts\"\n }), \" `https://discordapp.com/oauth2/authorize?client_id=${botID}&scope=bot&permissions=68640`,\\n\")), mdx(\"p\", null, \"Lastly, let's get rid of the comment there as now it is customized to our needs.\"), mdx(\"h3\", null, \"Command Descriptions\"), mdx(\"p\", null, \"Right now, if you were to go to Discord and type \", mdx(\"inlineCode\", {\n parentName: \"p\"\n }, \"!help invite\"), \", you would see quite a bit of information. But where does all that text come from? It's not in this file. The description option tells Discordeno what to show the user when they use the help command. In that help message, each command has a small description next to it. The magic is happening because of Discordeno's translations feature.\"), mdx(\"blockquote\", null, mdx(\"p\", {\n parentName: \"blockquote\"\n }, \"Discordeno has built in multi-lingual support. You can support as many languages as you wish. We will learn more about languages when we create our own language but for now we just want to see how to customize the command. What we are going to do below isn't the correct way but it's the easy way to learn. We will see the correct way to do it when we get to translations.\")), mdx(\"p\", null, \"Let's add a custom description to our invite command.\"), mdx(\"pre\", null, mdx(\"code\", _extends({\n parentName: \"pre\"\n }, {\n \"className\": \"language-ts\"\n }), \" name: \\\"invite\\\",\\n description: \\\"Like the bot? Use this link to add it to your server!\\\"\\n\")), mdx(\"p\", null, \"\\uD83C\\uDF89 It's that simple. So let's restart the bot and see how it changed. Use \", mdx(\"strong\", {\n parentName: \"p\"\n }, \"CTRL + C\"), \" to shut down the bot. Then run the command from earlier.\"), mdx(\"pre\", null, mdx(\"code\", _extends({\n parentName: \"pre\"\n }, {\n \"className\": \"language-shell\"\n }), \"deno run --allow-net --allow-read mod.ts\\n\")), mdx(\"p\", null, \"To access this easily, most likely all you need to do is press the \", mdx(\"strong\", {\n parentName: \"p\"\n }, \"UP ARROW\"), \" key. Feel free to copy paste this if it doesn't work.\"), mdx(\"p\", null, \"Once the bot is started try \", mdx(\"inlineCode\", {\n parentName: \"p\"\n }, \"!help invite\"), \" again and you will see the change! \\uD83C\\uDF89\"), mdx(\"h2\", null, \"Command Aliases\"), mdx(\"p\", null, \"Now, let's make this a little bit easier. What if we wanted this command to also work with other names besides \", mdx(\"inlineCode\", {\n parentName: \"p\"\n }, \"invite\"), \". For example, as a shortcut what if users could just type \", mdx(\"inlineCode\", {\n parentName: \"p\"\n }, \"!inv\"), \" or as an alias type \", mdx(\"inlineCode\", {\n parentName: \"p\"\n }, \"!join\"), \". Let's go ahead and set that up. Go to the very last line of invite command file and type in \", mdx(\"inlineCode\", {\n parentName: \"p\"\n }, \"alias\"), \". You will see a popup showing you an autocompleted version of \", mdx(\"inlineCode\", {\n parentName: \"p\"\n }, \"createCommandAliases\"), \". Press enter and boom the magic is happening!\"), mdx(\"p\", null, \"The createCommandAliases takes in two arguments. The first argument is always the command name. In this case it is \", mdx(\"inlineCode\", {\n parentName: \"p\"\n }, \"invite\"), \". The second argument is the aliases you want to provide. Let's add in the two aliases we wanted.\"), mdx(\"pre\", null, mdx(\"code\", _extends({\n parentName: \"pre\"\n }, {\n \"className\": \"language-ts\"\n }), \" `https://discordapp.com/oauth2/authorize?client_id=${botID}&scope=bot&permissions=68640`,\\n );\\n },\\n});\\n\\ncreateCommandAliases('invite', ['inv', 'join'])\\n\")), mdx(\"blockquote\", null, mdx(\"p\", {\n parentName: \"blockquote\"\n }, mdx(\"strong\", {\n parentName: \"p\"\n }, \"Note:\"), \" If you only want to add 1 alias, you can pass in a simple string instead of an array as well as the second argument.\")), mdx(\"p\", null, \"Notice, I added 2 aliases here. You can add as many aliases as you like. If you see a lot of users typing it wrong by accident you can add those typos as aliases as well.\"), mdx(\"p\", null, \"Let's start testing this out. But first, let's understand something important.\"), mdx(\"h2\", null, \"Reloading\"), mdx(\"p\", null, \"Okay, we need to first understand a core concept of developing discord bots. If you had to restart your bot every time you made a tiny change, it would get really annoying/tedious to do. Also, if you had restarted your bot 1000 times, you would be in big trouble because Discord would ban your bot for 24 hours. The bigger your bot gets, the faster it is to hit this limit of 1000 identify calls to the Discord API.\"), mdx(\"p\", null, \"To solve this issue, Discordeno provides you with a really cool \", mdx(\"inlineCode\", {\n parentName: \"p\"\n }, \"reload\"), \" command. Whenever you make a change to any command, event, monitor, inhibitor, task, language or argument you can simply reload it. You don't need to restart your bot every time.\"), mdx(\"p\", null, \"Now since we added the aliases above, let's test it out.\"), mdx(\"ol\", null, mdx(\"li\", {\n parentName: \"ol\"\n }, mdx(\"inlineCode\", {\n parentName: \"li\"\n }, \"!inv\"), \" this will not work\"), mdx(\"li\", {\n parentName: \"ol\"\n }, mdx(\"inlineCode\", {\n parentName: \"li\"\n }, \"!reload commands\"), \" this will reload the files and the aliases will be created.\"), mdx(\"li\", {\n parentName: \"ol\"\n }, mdx(\"inlineCode\", {\n parentName: \"li\"\n }, \"!inv\"), \" This will now work. \\uD83C\\uDF89\")), mdx(\"hr\", null), mdx(\"p\", null, \"Perfect! You can take some time and customize the invite command to your needs if you wish. For example, this is my bot's invite command.\"), mdx(\"p\", null, mdx(\"img\", _extends({\n parentName: \"p\"\n }, {\n \"src\": \"https://i.imgur.com/4WRFMtR.png\",\n \"alt\": \"image\"\n }))), mdx(\"p\", null, \"Nice! You can now customize any of the commands from Discordeno as you wish. Then we will continue to making our very own command so we can learn about all the options that Discordeno gives us when it comes to making commands. As you learn more in this guide, you can keep improving it.\"), mdx(\"p\", null, \"If you get stuck, don't worry. When you are ready, let's continue to the next step.\"), mdx(\"h2\", null, \"Creating A Command\"), mdx(\"p\", null, \"Let's make a command that will allow guild admins to give or take roles from a member. Since, we are creating a \", mdx(\"inlineCode\", {\n parentName: \"p\"\n }, \"Moderation\"), \" command to give or take roles, let's go ahead and create a Category folder called \", mdx(\"inlineCode\", {\n parentName: \"p\"\n }, \"Moderation\"), \" and then create a file called \", mdx(\"inlineCode\", {\n parentName: \"p\"\n }, \"role.ts\"), \". Once the file is made, you can paste this following base snippet to make our first command.\"), mdx(\"pre\", null, mdx(\"code\", _extends({\n parentName: \"pre\"\n }, {\n \"className\": \"language-ts\"\n }), \"import { botCache } from \\\"../../mod.ts\\\";\\nimport { sendMessage } from \\\"https://raw.githubusercontent.com/Skillz4Killz/Discordeno/v7/src/handlers/channel.ts\\\";\\nimport { PermissionLevels } from \\\"../types/commands.ts\\\";\\nimport { createCommandAliases } from \\\"../utils/helpers\\\";\\n\\nbotCache.commands.set(\\\"commandname\\\", {\\n name: \\\"commandname\\\",\\n dmOnly: false,\\n guildOnly: false,\\n nsfw: false,\\n permissionLevel: [PermissionLevels.MEMBER],\\n botServerPermissions: [],\\n botChannelPermissions: [],\\n userServerPermissions: [],\\n userChannelPermissions: [],\\n description: string,\\n cooldown: {\\n seconds: 0,\\n allowedUses: 0,\\n },\\n arguments: [],\\n execute: function (message, args, guild) {\\n // The code for your command goes here\\n }\\n});\\n\\n// createCommandAliases(\\\"commandname\\\", [\\\"alias\\\"])\\n\")), mdx(\"h2\", null, \"Understanding Command Options\"), mdx(\"p\", null, \"Woah! We just added a massive file but most of that stuff is new to us. Don't worry, let's break everything down step by step.\"), mdx(\"blockquote\", null, mdx(\"p\", {\n parentName: \"blockquote\"\n }, mdx(\"strong\", {\n parentName: \"p\"\n }, \"Note:\"), \" Any options that are not changed from the snippet above can actually be deleted as Discordeno will use the default option if you do not provide anything for that option. This can help keep your files cleaner.\")), mdx(\"p\", null, \"Before we start, quickly update the command name and description.\"), mdx(\"blockquote\", null, mdx(\"p\", {\n parentName: \"blockquote\"\n }, mdx(\"strong\", {\n parentName: \"p\"\n }, \"Note:\"), \" Once you highlight the \", mdx(\"inlineCode\", {\n parentName: \"p\"\n }, \"commandname\"), \", press \", mdx(\"strong\", {\n parentName: \"p\"\n }, \"CTRL + SHIFT + L\"), \" to select ALL the \", mdx(\"inlineCode\", {\n parentName: \"p\"\n }, \"commandname\"), \" on the file and you can easily replace them at once. Another useful shortcut you may use when coding your bot is \", mdx(\"strong\", {\n parentName: \"p\"\n }, \"CTRL + D\"), \" after highlighting. This shortcut selects the next place where the same text exists as thing in the file that has the same thing as you highlighted.\")), mdx(\"h2\", null, \"dmOnly & guildOnly Options\"), mdx(\"p\", null, \"The \", mdx(\"inlineCode\", {\n parentName: \"p\"\n }, \"dmOnly\"), \" option is available if you want to make sure this command only runs in a direct message. If this command is ran in a server, the command will immediately exit out.\"), mdx(\"p\", null, \"On the other hand, \", mdx(\"inlineCode\", {\n parentName: \"p\"\n }, \"guildOnly\"), \" is the opposite. To easily make sure that this command is never allowed in a private message you can simple enable this.\"), mdx(\"p\", null, \"If you want to allow a command to be able to run both in a server and in a direct message, simply set them both to false.\"), mdx(\"p\", null, \"Remember if you want either of them as false, you can simply delete them and it will default to \", mdx(\"inlineCode\", {\n parentName: \"p\"\n }, \"false\"), \" allowing your bot to be cleaner and easier to read. However, if your prefer keeping it you can.\"), mdx(\"p\", null, \"For the purpose of this guide, we want our \", mdx(\"inlineCode\", {\n parentName: \"p\"\n }, \"role\"), \" comamnd to only be run in a server, so we can set \", mdx(\"inlineCode\", {\n parentName: \"p\"\n }, \"guildOnly\"), \" to be \", mdx(\"strong\", {\n parentName: \"p\"\n }, \"true\"), \" and delete the \", mdx(\"inlineCode\", {\n parentName: \"p\"\n }, \"dmOnly\"), \" option.\"), mdx(\"h2\", null, \"NSFW Option\"), mdx(\"p\", null, \"NSFW stands for \", mdx(\"strong\", {\n parentName: \"p\"\n }, \"Not Safe For Work\"), \". One of Discord's rules is that you enforce that NSFW content is sent only in NSFW channels. Discordeno has this built in. You simple tell Discordeno, that you want a command to be considered \", mdx(\"inlineCode\", {\n parentName: \"p\"\n }, \"nsfw\"), \" or not.\"), mdx(\"p\", null, \"If this option is enabled, this command will only be able to be used in a \", mdx(\"inlineCode\", {\n parentName: \"p\"\n }, \"nsfw\"), \" channel on a server. Discord does not consider Direct Messages as nsfw safe!\"), mdx(\"h2\", null, \"Permission Level Option\"), mdx(\"p\", null, \"Permission levels are a very powerful feature that easily allow you to set what permission is required to run a command. We will cover this in detail, in a separate section dedicated to permission levels. For now, just understand that this will restrict certain users from using a command.\"), mdx(\"p\", null, \"For example, the role command we only want to be used by moderators or server admins.\"), mdx(\"p\", null, \"Discordeno makes this pretty simple for us.\"), mdx(\"pre\", null, mdx(\"code\", _extends({\n parentName: \"pre\"\n }, {\n \"className\": \"language-ts\"\n }), \"permissionLevels: [PermissionLevels.MODERATOR, PermissionLevels.ADMIN]\\n\")), mdx(\"p\", null, \"We're not going to cover this in detail, here because we will have an entire in depth guide for permission levels. If you want to pause and learn it now, feel free: \", mdx(\"a\", _extends({\n parentName: \"p\"\n }, {\n \"href\": \"https://discordeno.netlify.app/advanced/permlevels\"\n }), \"Permission Levels Advanced Guide\")), mdx(\"h2\", null, \"Permissions Check Options\"), mdx(\"p\", null, \"Discordeno provides you 4 different types of permission handling that will be done before the command function is executed. This allows you to make sure that the permissions are available before running a command. For example, the role command will require the bot to have \", mdx(\"strong\", {\n parentName: \"p\"\n }, \"MANAGE ROLES\"), \" permission. This permission comes from the server settings so we can require this in the \", mdx(\"inlineCode\", {\n parentName: \"p\"\n }, \"botServerPermissions\"), \".\"), mdx(\"pre\", null, mdx(\"code\", _extends({\n parentName: \"pre\"\n }, {\n \"className\": \"language-ts\"\n }), \"botServerPermissions: [\\\"MANAGE_ROLES\\\"],\\n\")), mdx(\"p\", null, \"Discordeno will provide you easy to use auto-completion as soon as you type a single letter or two. This will help make it easier to use and will warn you when you make a typo and provide a wrong permission by accident.\"), mdx(\"p\", null, \"We also want to make sure that the bot can send a message in this channel so that we can respond to the user. This will check the correct permission heirarchy to make sure that the bot can indeed send a message in this channel.\"), mdx(\"pre\", null, mdx(\"code\", _extends({\n parentName: \"pre\"\n }, {\n \"className\": \"language-ts\"\n }), \"botChannelPermissions: [\\\"SEND_MESSAGES\\\"],\\n\")), mdx(\"blockquote\", null, mdx(\"p\", {\n parentName: \"blockquote\"\n }, mdx(\"strong\", {\n parentName: \"p\"\n }, \"Note:\"), \" If you want to send an embed response, you should also make sure it has the \", mdx(\"inlineCode\", {\n parentName: \"p\"\n }, \"EMBED_LINKS\"), \" permission.\")), mdx(\"p\", null, \"Already we have prevented two of the largest errors that can get our bot banned if it is not checked. Discordeno handles this internally so you don't have to worry about it.\"), mdx(\"p\", null, \"Sometimes, you may also want to make sure that the user using the command has a certain permission to run the command. To do this, you can use the \", mdx(\"inlineCode\", {\n parentName: \"p\"\n }, \"userServerPermissions\"), \" or the \", mdx(\"inlineCode\", {\n parentName: \"p\"\n }, \"userChannelPermissions\"), \".\"), mdx(\"h2\", null, \"Cooldown Options\"), mdx(\"p\", null, \"The cooldown options go hand in hand together.\"), mdx(\"ul\", null, mdx(\"li\", {\n parentName: \"ul\"\n }, mdx(\"inlineCode\", {\n parentName: \"li\"\n }, \"seconds\"), \" is how long to make the user wait in seconds before they can use the command again. By default, there is no wait time aka 0 seconds.\"), mdx(\"li\", {\n parentName: \"ul\"\n }, mdx(\"inlineCode\", {\n parentName: \"li\"\n }, \"allowedUses\"), \" is how many times a user is allowed to use a command before they are placed on cooldown.\"), mdx(\"li\", {\n parentName: \"ul\"\n }, \"Let's use our command as an example. We don't want someone to start spamming the role command so we can add a cooldown of 60 seconds. However, this would mean every time you give a role to someone, you would need to wait a whole minute to give a role to someone else. This is where \", mdx(\"inlineCode\", {\n parentName: \"li\"\n }, \"allowedUses\"), \" shines! Let's set it to to 5 so that a user can use this command 5 times in a row before being asked to wait for 60 seconds.\")), mdx(\"pre\", null, mdx(\"code\", _extends({\n parentName: \"pre\"\n }, {\n \"className\": \"language-ts\"\n }), \"cooldown: {\\n seconds: 60,\\n allowedUses: 5\\n},\\n\")), mdx(\"blockquote\", null, mdx(\"p\", {\n parentName: \"blockquote\"\n }, mdx(\"strong\", {\n parentName: \"p\"\n }, \"Note:\"), \" It is important to understand the way these two interact. The cooldown starts as soon as the first command is used. So, if a user uses the role command 5 times in 59 seconds, they only have to wait 1 second to do another 5 times.\")), mdx(\"p\", null, \"Let's give this a try shall we.\"), mdx(\"ol\", null, mdx(\"li\", {\n parentName: \"ol\"\n }, mdx(\"inlineCode\", {\n parentName: \"li\"\n }, \"!reload commands\")), mdx(\"li\", {\n parentName: \"ol\"\n }, \"Spam the \", mdx(\"inlineCode\", {\n parentName: \"li\"\n }, \"!role\"), \" very quickly 6 times in under a minute.\")), mdx(\"h2\", null, \"Arguments\"), mdx(\"p\", null, \"Arguments is an incredibly powerful feature in Discordeno. Like Permission Levels we will have an in depth look at arguments later in the guide. For now, let's try and understand this in a simple manner.\"), mdx(\"ul\", null, mdx(\"li\", {\n parentName: \"ul\"\n }, mdx(\"inlineCode\", {\n parentName: \"li\"\n }, \"name\"), \": The name of the argument. Useful for when you need to alert the user X arg is missing or when you want to use the arg in your command.\"), mdx(\"li\", {\n parentName: \"ul\"\n }, mdx(\"inlineCode\", {\n parentName: \"li\"\n }, \"type\"), \": The type of the argument you would like. Defaults to string. Some of the ones available by default are \\\"number\\\", \\\"string\\\", \\\"...string\\\", \\\"boolean\\\", \\\"subcommand\\\", \\\"member\\\".\"), mdx(\"li\", {\n parentName: \"ul\"\n }, mdx(\"inlineCode\", {\n parentName: \"li\"\n }, \"missing\"), \": a function that will be run when this argument is not provided by the user or if the provided argument is not valid. By default, it does nothing.\"), mdx(\"li\", {\n parentName: \"ul\"\n }, mdx(\"inlineCode\", {\n parentName: \"li\"\n }, \"required\"), \": Whether this argument is required or optional. By default, this is true.\"), mdx(\"li\", {\n parentName: \"ul\"\n }, mdx(\"inlineCode\", {\n parentName: \"li\"\n }, \"lowercase\"), \": If the type is a string, this can forcibly lowercase the string.\"), mdx(\"li\", {\n parentName: \"ul\"\n }, mdx(\"inlineCode\", {\n parentName: \"li\"\n }, \"literals\"), \": If the type is string or subcommand you can provide literals. The argument MUST be exactly the same as the literals to be accepted. For example, if you want to make sure the argument is \", mdx(\"inlineCode\", {\n parentName: \"li\"\n }, \"a\"), \" or \", mdx(\"inlineCode\", {\n parentName: \"li\"\n }, \"b\"), \" only and not \", mdx(\"inlineCode\", {\n parentName: \"li\"\n }, \"c\"), \".\"), mdx(\"li\", {\n parentName: \"ul\"\n }, mdx(\"inlineCode\", {\n parentName: \"li\"\n }, \"defaultValue\"), \": The default value for this argument/subcommand. If the user does not provide an argument or it is invalid, it can be defaulted to a certain value.\")), mdx(\"p\", null, \"For our role command, we need a \", mdx(\"inlineCode\", {\n parentName: \"p\"\n }, \"member\"), \" and a \", mdx(\"inlineCode\", {\n parentName: \"p\"\n }, \"role\"), \".\"), mdx(\"pre\", null, mdx(\"code\", _extends({\n parentName: \"pre\"\n }, {\n \"className\": \"language-ts\"\n }), \"arguments: [\\n {\\n name: \\\"member\\\",\\n type: \\\"member\\\",\\n missing: (message) => {\\n sendResponse(message, `you did not provide a member to give the role to. You can provide a @member mention, a member ID, or try using their nickname/username. The nickname/username will only work if they have been active in your server recently.`)\\n }\\n },\\n {\\n name: \\\"role\\\",\\n type: \\\"role\\\",\\n missing: (message) => {\\n sendResponse(message, `you did not provide a role to give. You can provide a @role mention, a role ID, or it's name. If the role name did not work, try to use the **roleinfo** command to get the role ID.`)\\n }\\n }\\n]\\n\")), mdx(\"h2\", null, \"Execute Option\"), mdx(\"p\", null, \"The execute option is the code that will run when the command is triggered. The execute function is passed 3 parameters that you can use in your command.\"), mdx(\"ul\", null, mdx(\"li\", {\n parentName: \"ul\"\n }, mdx(\"inlineCode\", {\n parentName: \"li\"\n }, \"message\"), \": The message object itself that triggered this command.\"), mdx(\"li\", {\n parentName: \"ul\"\n }, mdx(\"inlineCode\", {\n parentName: \"li\"\n }, \"args\"), \": The args that were provided by the user.\"), mdx(\"li\", {\n parentName: \"ul\"\n }, mdx(\"inlineCode\", {\n parentName: \"li\"\n }, \"guild\"), \": The server guild object where this command was run.\")), mdx(\"pre\", null, mdx(\"code\", _extends({\n parentName: \"pre\"\n }, {\n \"className\": \"language-ts\"\n }), \"execute: function (message, args, guild) {\\n // The code that is to be executed goes here\\n}\\n\")), mdx(\"blockquote\", null, mdx(\"p\", {\n parentName: \"blockquote\"\n }, mdx(\"strong\", {\n parentName: \"p\"\n }, \"Note:\"), \" I prefer writing code using the function keyword, but you can easily change to the fat arrow function if you prefer.\"), mdx(\"pre\", {\n parentName: \"blockquote\"\n }, mdx(\"code\", _extends({\n parentName: \"pre\"\n }, {\n \"className\": \"language-ts\"\n }), \"execute: (message, args, guild) => {\\n // The code that is to be executed goes here\\n}\\n\"))), mdx(\"p\", null, \"Let's start out by writing some pseudo-code(comments that will help us plan the code).\"), mdx(\"pre\", null, mdx(\"code\", _extends({\n parentName: \"pre\"\n }, {\n \"className\": \"language-ts\"\n }), \"execute: function (message, args, guild) {\\n // If this was the everyone role alert with a silly error\\n\\n // If this is a managed role(some bots role) we can't give/remove alert with silly error\\n\\n // Get the bots highest role\\n\\n // Check if the bot has a role higher than the role that it will try to give.\\n\\n // If the role is too high alert the user.\\n\\n // If the user has this role already remove the role from them.\\n\\n // Check the command author's highest role\\n\\n // If the author does not have a role high enough to give this role alert\\n\\n // If the user has this role already we should remove it\\n\\n // Add the role to the user.\\n\\n // Alert the user that used the command that the user has been give the role.\\n}\\n\")), mdx(\"p\", null, \"Nice! The plan for the code is complete. Now, let's add in the code.\"), mdx(\"p\", null, \"The first thing we are going to try is to check if the role the user provided is the same as the everyone role.\"), mdx(\"blockquote\", null, mdx(\"p\", {\n parentName: \"blockquote\"\n }, mdx(\"strong\", {\n parentName: \"p\"\n }, \"Note:\"), \" The everyone role ID is the same as the server guild ID.\")), mdx(\"p\", null, \"To do this, we are going to want something like this:\"), mdx(\"pre\", null, mdx(\"code\", _extends({\n parentName: \"pre\"\n }, {\n \"className\": \"language-ts\"\n }), \"if (args.role.id === message.guildID) {\\n return sendResponse(message, \\\"The everyone role can not be given to anyone because everyone has the everyone role already. *Keep calm and let Carter figure it out*!\\\");\\n}\\n\")), mdx(\"p\", null, \"You might be seeing an error since we didn't provide the accurate typings for the \", mdx(\"inlineCode\", {\n parentName: \"p\"\n }, \"args\"), \" parameter. The message and guild parameter is automated but the args is dynamic depending on your \", mdx(\"inlineCode\", {\n parentName: \"p\"\n }, \"arguments\"), \" option for your command. So let's do this real quick.\"), mdx(\"pre\", null, mdx(\"code\", _extends({\n parentName: \"pre\"\n }, {\n \"className\": \"language-ts\"\n }), \"execute: function (message, args: RoleArgs, guild) {\\n // If this was the everyone role alert with a silly error\\n if (args.role.id === message.guildID) {\\n return sendResponse(message, \\\"Are you trying to make this person a super hero? Everyone has the everyone role. I can't give the everyone role to another user.\\\");\\n }\\n\\n // Lots of comments here hidden so you can see the changes easily.\\n}\\n\\ninterface RoleArgs {\\n role: Role;\\n member: Member;\\n}\\n\")), mdx(\"p\", null, \"Awesome! Let's keep going.\"), mdx(\"pre\", null, mdx(\"code\", _extends({\n parentName: \"pre\"\n }, {\n \"className\": \"language-ts\"\n }), \"execute: function (message, args: RoleArgs, guild) {\\n // If this was the everyone role alert with a silly error\\n if (args.role.id === message.guildID) {\\n return sendResponse(message, \\\"I don't know if you noticed or not but I'm an extremely arrogant bot who tends to think all of his plans will work. But I can't give the everyone role to someone.\\\");\\n }\\n\\n // If this is a managed role(some bots role) we can't give/remove alert with silly error\\n if (args.role.managed) {\\n return sendResponse(message, \\\"Dammit man, just 'cause I'm Scottish doesn't mean I can give your people managed roles.\\\")\\n }\\n\\n // Get the bots highest role\\n const botsHighestRole = highestRole(message.guildID, botID);\\n\\n // Check if the bot has a role higher than the role that it will try to give.\\n const botIsHigher = higherRolePosition(message.guildID, botsHighestRole.id, args.role.id)\\n\\n // If the role is too high alert the user.\\n if (!botIsHigher) {\\n return sendResponse(message, \\\"Okay look, asking me give a role that is higher than my highest role is ridiculous! I am the first bot to admit I don't know who these people are nor do I care to. Look, if you'd like I could take you down the hall and just point at the people who annoy me more than the rest. But that's about as useful as I get.\\\")\\n }\\n\\n // Check the command author's highest role\\n const membersHighestRole = highestRole(message.guildID, message.author.id);\\n\\n // If the author does not have a role high enough to give this role alert\\n if (!higherRolePosition(message.guildID, membersHighestRole.id, args.role.id)) {\\n return sendResponse(message, \\\"In my culture, whenever someone tries to give a role that is higher than their highest role, I would be well within my rights to dismember you.\\\")\\n }\\n\\n // If the user has this role already we should remove it\\n if (message.member().roles.includes(args.role.id)) {\\n removeRole(message.guildID, args.member.user.id, args.role.id, `${message.author.tag} used the role command to remove this role.`)\\n // Alert the user that used the command that the user has lost the role.\\n return sendResponse(message, `The role **${args.role.name}** has been removed from **${args.member.tag}**.`)\\n }\\n\\n // Add the role to the user.\\n addRole(guildID, memberID, roleID)\\n\\n // Alert the user that used the command that the user has been give the role.\\n return sendResponse(message, `The role **${args.role.name}** has been added to **${args.member.tag}**.`)\\n}\\n\")), mdx(\"p\", null, \"The final version of the command should look something like this:\"), mdx(\"pre\", null, mdx(\"code\", _extends({\n parentName: \"pre\"\n }, {\n \"className\": \"language-ts\"\n }), \"import { highestRole, higherRolePosition, botID, removeRole, addRole, Role, Member } from \\\"../../deps.ts\\\";\\nimport { botCache } from \\\"../../mod.ts\\\";\\nimport { PermissionLevels } from \\\"../types/commands.ts\\\";\\nimport { sendResponse } from \\\"../utils/helpers.ts\\\";\\n\\nbotCache.commands.set(\\\"role\\\", {\\n name: \\\"role\\\",\\n permissionLevel: [PermissionLevels.MODERATOR, PermissionLevels.ADMIN],\\n botServerPermissions: [\\\"MANAGE_ROLES\\\"],\\n botChannelPermissions: [\\\"SEND_MESSAGES\\\"],\\n cooldown: {\\n seconds: 60,\\n allowedUses: 5,\\n },\\n arguments: [\\n {\\n name: \\\"member\\\",\\n type: \\\"member\\\",\\n missing: (message) => {\\n sendResponse(message, `you did not provide a member to give the role to. You can provide a @member mention, a member ID, or try using their nickname/username. The nickname/username will only work if they have been active in your server recently.`)\\n }\\n },\\n {\\n name: \\\"role\\\",\\n type: \\\"role\\\",\\n missing: (message) => {\\n sendResponse(message, `you did not provide a role to give. You can provide a @role mention, a role ID, or it's name. If the role name did not work, try to use the **roleinfo** command to get the role ID.`)\\n }\\n }\\n ],\\n execute: function (message, args: RoleArgs) {\\n // If this was the everyone role alert with a silly error\\n if (args.role.id === message.guildID) {\\n return sendResponse(\\n message,\\n \\\"I don't know if you noticed or not but I'm an extremely arrogant bot who tends to think all of his plans will work. But I can't give the everyone role to someone.\\\",\\n );\\n }\\n\\n // If this is a managed role(some bots role) we can't give/remove alert with silly error\\n if (args.role.managed) {\\n return sendResponse(\\n message,\\n \\\"Dammit man, just 'cause I'm Scottish doesn't mean I can give your people managed roles.\\\",\\n );\\n }\\n\\n // Get the bots highest role\\n const botsHighestRole = highestRole(message.guildID, botID);\\n\\n // Check if the bot has a role higher than the role that it will try to give. If the role is too high alert the user.\\n if (!botsHighestRole || !higherRolePosition(\\n message.guildID,\\n botsHighestRole.id,\\n args.role.id,\\n )) {\\n return sendResponse(\\n message,\\n \\\"Okay look, asking me give a role that is higher than my highest role is ridiculous! I am the first bot to admit I don't know who these people are nor do I care to. Look, if you'd like I could take you down the hall and just point at the people who annoy me more than the rest. But that's about as useful as I get.\\\",\\n );\\n }\\n\\n // Check the command author's highest role\\n const membersHighestRole = highestRole(message.guildID, message.author.id);\\n\\n // If the author does not have a role high enough to give this role alert\\n if (!membersHighestRole ||\\n !higherRolePosition(message.guildID, membersHighestRole.id, args.role.id)\\n ) {\\n return sendResponse(\\n message,\\n \\\"In my culture, whenever someone tries to give a role that is higher than their highest role, I would be well within my rights to dismember you.\\\",\\n );\\n }\\n\\n // If the user has this role already we should remove it\\n if (message.member()?.roles.includes(args.role.id)) {\\n removeRole(\\n message.guildID,\\n args.member.user.id,\\n args.role.id,\\n `${message.author.username} used the role command to remove this role.`,\\n );\\n // Alert the user that used the command that the user has lost the role.\\n return sendResponse(\\n message,\\n `The role **${args.role.name}** has been removed from **${args.member.tag}**.`,\\n );\\n }\\n\\n // Add the role to the user.\\n addRole(message.guildID, args.member.user.id, args.role.id, `${message.author.username} used the role command to give this role.`);\\n\\n // Alert the user that used the command that the user has been give the role.\\n return sendResponse(\\n message,\\n `The role **${args.role.name}** has been added to **${args.member.tag}**.`,\\n );\\n },\\n});\\n\\ninterface RoleArgs {\\n role: Role;\\n member: Member;\\n}\\n\")), mdx(\"blockquote\", null, mdx(\"p\", {\n parentName: \"blockquote\"\n }, mdx(\"strong\", {\n parentName: \"p\"\n }, \"Note:\"), \" The response strings are a play on some funny Stargate(my favorite tv show) moments. Feel free to change as you wish to fit your bot's personality.\")), mdx(\"h2\", null, \"Dynamic(Advanced Level) Command Creation\"), mdx(\"p\", null, \"This is some advanced level super magical command creation skills. Discordeno gives you the power to dynamically create commands. What that means is you can write the code for one command but dynamically create like 50 commands using that same code.\"), mdx(\"p\", null, \"For example, in my main bot I have a lot of \\\"fun\\\" commands like \", mdx(\"inlineCode\", {\n parentName: \"p\"\n }, \".hug\"), \" or \", mdx(\"inlineCode\", {\n parentName: \"p\"\n }, \".kiss\"), \" etc... All of these files have the exact same code except for 1 word being the command name. Would it not be better to simply write the code once and dynamically create every single command. Let me show you how that works.\"), mdx(\"ul\", null, mdx(\"li\", {\n parentName: \"ul\"\n }, \"Create a file in the commands folder called \", mdx(\"inlineCode\", {\n parentName: \"li\"\n }, \"fun.ts\"), \" which will create all our fun commands.\")), mdx(\"pre\", null, mdx(\"code\", _extends({\n parentName: \"pre\"\n }, {\n \"className\": \"language-ts\"\n }), \"import { Member, sendMessage, chooseRandom, avatarURL } from \\\"../../deps.ts\\\";\\nimport { botCache } from \\\"../../mod.ts\\\";\\nimport { createCommandAliases, sendEmbed } from \\\"../utils/helpers.ts\\\";\\nimport { configs } from \\\"../../configs.ts\\\";\\nimport { Embed } from \\\"../utils/Embed.ts\\\";\\nimport { translate } from \\\"../utils/i18next.ts\\\";\\n\\nconst funCommandData = [\\n { name: \\\"bite\\\", gifs: configs.gifs.bite },\\n { name: \\\"cuddle\\\", gifs: configs.gifs.cuddle },\\n { name: \\\"dance\\\", gifs: configs.gifs.dance },\\n { name: \\\"hug\\\", gifs: configs.gifs.hug },\\n { name: \\\"kiss\\\", gifs: configs.gifs.kiss },\\n { name: \\\"kanna\\\", gifs: configs.gifs.kanna },\\n { name: \\\"kiss\\\", gifs: configs.gifs.kiss },\\n { name: \\\"kitten\\\", gifs: configs.gifs.kitten },\\n { name: \\\"lmao\\\", gifs: configs.gifs.lmao, aliases: [\\\"lol\\\"] },\\n { name: \\\"pat\\\", gifs: configs.gifs.pat },\\n { name: \\\"poke\\\", gifs: configs.gifs.poke },\\n { name: \\\"pony\\\", gifs: configs.gifs.pony },\\n { name: \\\"puppy\\\", gifs: configs.gifs.puppy },\\n { name: \\\"raphtalia\\\", gifs: configs.gifs.raphtalia },\\n { name: \\\"stargate\\\", gifs: configs.gifs.stargate },\\n { name: \\\"supernatural\\\", gifs: configs.gifs.supernatural },\\n { name: \\\"tickle\\\", gifs: configs.gifs.tickle },\\n { name: \\\"zerotwo\\\", gifs: configs.gifs.zerotwo },\\n];\\n\\nfunCommandData.forEach((data) => {\\n botCache.commands.set(data.name, {\\n name: data.name,\\n botChannelPermissions: [\\\"SEND_MESSAGES\\\", \\\"EMBED_LINKS\\\"],\\n cooldown: {\\n seconds: 2,\\n },\\n arguments: [\\n {\\n name: \\\"member\\\",\\n type: \\\"member\\\",\\n required: false,\\n },\\n ],\\n execute: function (message, args: FunArgs) {\\n // If a member is provided use that otherwise set the member themself\\n const member = args.member || message.member()!;\\n\\n const type = member.user.id === message.author.id\\n // Silly response like if user tries to hug themself\\n ? \\\"SELF\\\"\\n // Response for when user tries to hug another user\\n : \\\"OTHER\\\";\\n\\n\\n // Create an embed\\n const embed = new Embed()\\n .setAuthor(member.tag, avatarURL(member))\\n .setDescription(\\n translate(\\n message.guildID,\\n `commands/fun/${data.name}:${type}`,\\n { mention: message.member()!.mention, user: member.mention },\\n ),\\n )\\n .setImage(chooseRandom(data.gifs));\\n\\n return sendEmbed(message.channel, embed);\\n },\\n });\\n\\n if (data.aliases?.length) {\\n createCommandAliases(data.name, data.aliases);\\n }\\n});\\n\\ninterface FunArgs {\\n member?: Member;\\n}\\n\")), mdx(\"p\", null, \"Take a minute to realize what just happened. This has made 18 different unique commands dynamically. In 1 file, using the same piece of code, we created so many commands. You can easily add more commands to this. For example, if you wanted to add weeb(animated) versions of these commands. Then you are at 36 commands with 1 simple command file.\"), mdx(\"p\", null, mdx(\"strong\", {\n parentName: \"p\"\n }, \"That ladies and gentleman is the power and magic of Discordeno!\")), mdx(\"p\", null, \"Take a minute to stand up, step back and make some room around you. Now start dancing because you just acheived one of the most complex things in bot development. You have already created about 36 commands!!!!\"), mdx(\"blockquote\", null, mdx(\"p\", {\n parentName: \"blockquote\"\n }, mdx(\"strong\", {\n parentName: \"p\"\n }, \"Note:\"), \" The command above uses translations which we will cover in depth in a later section of this guide.\")), mdx(\"p\", null, \"Once you are ready, let's proceed to making our inhibitors.\"));\n}\n;\nMDXContent.isMDXComponent = true;","rawMDXOutput":"/* @jsx mdx */\nimport { mdx } from '@mdx-js/react';\n/* @jsx mdx */\n\nexport const _frontmatter = {\n \"title\": \"Creating A Command\",\n \"metaTitle\": \"Creating A Command | Discordeno\",\n \"metaDescription\": \"Let's create our very first command with Discordeno!\"\n};\n\nconst layoutProps = {\n _frontmatter\n};\nconst MDXLayout = \"wrapper\"\nexport default function MDXContent({\n components,\n ...props\n}) {\n return \n

{`Really great job. Now, lets dive into trying to use some of the commands and try to make our very own command.`}

\n

{`Editing Invite Command`}

\n

{`Let's first start by taking an existing command and slightly modifying it to your needs. Let's use the `}{`Invite`}{` command as our example. When you open the command, you will see something like this:`}

\n
{`import { botCache } from \"../../mod.ts\";\nimport { sendMessage } from \"https://raw.githubusercontent.com/Skillz4Killz/Discordeno/v7/src/handlers/channel.ts\";\nimport { botID } from \"https://raw.githubusercontent.com/Skillz4Killz/Discordeno/v7/src/module/client.ts\";\n\nbotCache.commands.set(\"invite\", {\n  name: \"invite\",\n  execute: function (message) {\n    // Replace the permission number at the end to request the permissions you wish to request. By default, this will request Admin perms.\n    sendMessage(\n      message.channel,\n      \\`https://discordapp.com/oauth2/authorize?client_id=\\${botID}&scope=bot&permissions=8\\`,\n    );\n  },\n});\n`}
\n

{`Let's break this down. The first three lines are importing the necessary things from their files so we can use them in this command. Don't worry if this doesn't make sense, most of the time, this will all be done automatically for you if you use a good code editor like Visual Studio Code. We create a command by doing:`}

\n
{`botCache.commands.set('commandname', {\n\n})\n`}
\n

{`The command name here must be unique. If it is not unique, your commands will not work properly as you wish. For example, you can't have 2 commands with the `}{`ping`}{` name. In this case, our command is called `}{`invite`}{`.`}

\n

{`The `}{`name: 'invite'`}{` is also written as it is useful for our help command and inhibitors! Normally, these two things will be the same. So far it's super easy right.`}

\n

{`Next is the `}{`execute`}{`. This is where the magic happens. This is the function that is triggered when the command is ran by a user. In this case, the bot simply sends a message to a channel where the command was ran and sends an invite link. Let's take a minute and optimize this for our case. We don't `}{`NEED`}{` admin permissions for our bot. Let's go to the `}{`permission calculator`}{` and figure out the permissions we need for our bot.`}

\n

{`Once you have decided which permissions you want to request, you can copy the number and replace it here. For example, if we want `}{`68640`}{` as our permissions. We can modify our command to be:`}

\n
{`    \\`https://discordapp.com/oauth2/authorize?client_id=\\${botID}&scope=bot&permissions=68640\\`,\n`}
\n

{`Lastly, let's get rid of the comment there as now it is customized to our needs.`}

\n

{`Command Descriptions`}

\n

{`Right now, if you were to go to Discord and type `}{`!help invite`}{`, you would see quite a bit of information. But where does all that text come from? It's not in this file. The description option tells Discordeno what to show the user when they use the help command. In that help message, each command has a small description next to it. The magic is happening because of Discordeno's translations feature.`}

\n
\n

{`Discordeno has built in multi-lingual support. You can support as many languages as you wish. We will learn more about languages when we create our own language but for now we just want to see how to customize the command. What we are going to do below isn't the correct way but it's the easy way to learn. We will see the correct way to do it when we get to translations.`}

\n
\n

{`Let's add a custom description to our invite command.`}

\n
{`    name: \"invite\",\n    description: \"Like the bot? Use this link to add it to your server!\"\n`}
\n

{`🎉 It's that simple. So let's restart the bot and see how it changed. Use `}{`CTRL + C`}{` to shut down the bot. Then run the command from earlier.`}

\n
{`deno run --allow-net --allow-read mod.ts\n`}
\n

{`To access this easily, most likely all you need to do is press the `}{`UP ARROW`}{` key. Feel free to copy paste this if it doesn't work.`}

\n

{`Once the bot is started try `}{`!help invite`}{` again and you will see the change! 🎉`}

\n

{`Command Aliases`}

\n

{`Now, let's make this a little bit easier. What if we wanted this command to also work with other names besides `}{`invite`}{`. For example, as a shortcut what if users could just type `}{`!inv`}{` or as an alias type `}{`!join`}{`. Let's go ahead and set that up. Go to the very last line of invite command file and type in `}{`alias`}{`. You will see a popup showing you an autocompleted version of `}{`createCommandAliases`}{`. Press enter and boom the magic is happening!`}

\n

{`The createCommandAliases takes in two arguments. The first argument is always the command name. In this case it is `}{`invite`}{`. The second argument is the aliases you want to provide. Let's add in the two aliases we wanted.`}

\n
{` \\`https://discordapp.com/oauth2/authorize?client_id=\\${botID}&scope=bot&permissions=68640\\`,\n    );\n  },\n});\n\ncreateCommandAliases('invite', ['inv', 'join'])\n`}
\n
\n

{`Note:`}{` If you only want to add 1 alias, you can pass in a simple string instead of an array as well as the second argument.`}

\n
\n

{`Notice, I added 2 aliases here. You can add as many aliases as you like. If you see a lot of users typing it wrong by accident you can add those typos as aliases as well.`}

\n

{`Let's start testing this out. But first, let's understand something important.`}

\n

{`Reloading`}

\n

{`Okay, we need to first understand a core concept of developing discord bots. If you had to restart your bot every time you made a tiny change, it would get really annoying/tedious to do. Also, if you had restarted your bot 1000 times, you would be in big trouble because Discord would ban your bot for 24 hours. The bigger your bot gets, the faster it is to hit this limit of 1000 identify calls to the Discord API.`}

\n

{`To solve this issue, Discordeno provides you with a really cool `}{`reload`}{` command. Whenever you make a change to any command, event, monitor, inhibitor, task, language or argument you can simply reload it. You don't need to restart your bot every time.`}

\n

{`Now since we added the aliases above, let's test it out.`}

\n
    \n
  1. {`!inv`}{` this will not work`}
  2. \n
  3. {`!reload commands`}{` this will reload the files and the aliases will be created.`}
  4. \n
  5. {`!inv`}{` This will now work. 🎉`}
  6. \n
\n
\n

{`Perfect! You can take some time and customize the invite command to your needs if you wish. For example, this is my bot's invite command.`}

\n

\n

{`Nice! You can now customize any of the commands from Discordeno as you wish. Then we will continue to making our very own command so we can learn about all the options that Discordeno gives us when it comes to making commands. As you learn more in this guide, you can keep improving it.`}

\n

{`If you get stuck, don't worry. When you are ready, let's continue to the next step.`}

\n

{`Creating A Command`}

\n

{`Let's make a command that will allow guild admins to give or take roles from a member. Since, we are creating a `}{`Moderation`}{` command to give or take roles, let's go ahead and create a Category folder called `}{`Moderation`}{` and then create a file called `}{`role.ts`}{`. Once the file is made, you can paste this following base snippet to make our first command.`}

\n
{`import { botCache } from \"../../mod.ts\";\nimport { sendMessage } from \"https://raw.githubusercontent.com/Skillz4Killz/Discordeno/v7/src/handlers/channel.ts\";\nimport { PermissionLevels } from \"../types/commands.ts\";\nimport { createCommandAliases } from \"../utils/helpers\";\n\nbotCache.commands.set(\"commandname\", {\n  name: \"commandname\",\n  dmOnly: false,\n  guildOnly: false,\n  nsfw: false,\n  permissionLevel: [PermissionLevels.MEMBER],\n  botServerPermissions: [],\n  botChannelPermissions: [],\n  userServerPermissions: [],\n  userChannelPermissions: [],\n  description: string,\n  cooldown: {\n    seconds: 0,\n    allowedUses: 0,\n  },\n  arguments: [],\n  execute: function (message, args, guild) {\n  // The code for your command goes here\n  }\n});\n\n// createCommandAliases(\"commandname\", [\"alias\"])\n`}
\n

{`Understanding Command Options`}

\n

{`Woah! We just added a massive file but most of that stuff is new to us. Don't worry, let's break everything down step by step.`}

\n
\n

{`Note:`}{` Any options that are not changed from the snippet above can actually be deleted as Discordeno will use the default option if you do not provide anything for that option. This can help keep your files cleaner.`}

\n
\n

{`Before we start, quickly update the command name and description.`}

\n
\n

{`Note:`}{` Once you highlight the `}{`commandname`}{`, press `}{`CTRL + SHIFT + L`}{` to select ALL the `}{`commandname`}{` on the file and you can easily replace them at once. Another useful shortcut you may use when coding your bot is `}{`CTRL + D`}{` after highlighting. This shortcut selects the next place where the same text exists as thing in the file that has the same thing as you highlighted.`}

\n
\n

{`dmOnly & guildOnly Options`}

\n

{`The `}{`dmOnly`}{` option is available if you want to make sure this command only runs in a direct message. If this command is ran in a server, the command will immediately exit out.`}

\n

{`On the other hand, `}{`guildOnly`}{` is the opposite. To easily make sure that this command is never allowed in a private message you can simple enable this.`}

\n

{`If you want to allow a command to be able to run both in a server and in a direct message, simply set them both to false.`}

\n

{`Remember if you want either of them as false, you can simply delete them and it will default to `}{`false`}{` allowing your bot to be cleaner and easier to read. However, if your prefer keeping it you can.`}

\n

{`For the purpose of this guide, we want our `}{`role`}{` comamnd to only be run in a server, so we can set `}{`guildOnly`}{` to be `}{`true`}{` and delete the `}{`dmOnly`}{` option.`}

\n

{`NSFW Option`}

\n

{`NSFW stands for `}{`Not Safe For Work`}{`. One of Discord's rules is that you enforce that NSFW content is sent only in NSFW channels. Discordeno has this built in. You simple tell Discordeno, that you want a command to be considered `}{`nsfw`}{` or not.`}

\n

{`If this option is enabled, this command will only be able to be used in a `}{`nsfw`}{` channel on a server. Discord does not consider Direct Messages as nsfw safe!`}

\n

{`Permission Level Option`}

\n

{`Permission levels are a very powerful feature that easily allow you to set what permission is required to run a command. We will cover this in detail, in a separate section dedicated to permission levels. For now, just understand that this will restrict certain users from using a command.`}

\n

{`For example, the role command we only want to be used by moderators or server admins.`}

\n

{`Discordeno makes this pretty simple for us.`}

\n
{`permissionLevels: [PermissionLevels.MODERATOR, PermissionLevels.ADMIN]\n`}
\n

{`We're not going to cover this in detail, here because we will have an entire in depth guide for permission levels. If you want to pause and learn it now, feel free: `}{`Permission Levels Advanced Guide`}

\n

{`Permissions Check Options`}

\n

{`Discordeno provides you 4 different types of permission handling that will be done before the command function is executed. This allows you to make sure that the permissions are available before running a command. For example, the role command will require the bot to have `}{`MANAGE ROLES`}{` permission. This permission comes from the server settings so we can require this in the `}{`botServerPermissions`}{`.`}

\n
{`botServerPermissions: [\"MANAGE_ROLES\"],\n`}
\n

{`Discordeno will provide you easy to use auto-completion as soon as you type a single letter or two. This will help make it easier to use and will warn you when you make a typo and provide a wrong permission by accident.`}

\n

{`We also want to make sure that the bot can send a message in this channel so that we can respond to the user. This will check the correct permission heirarchy to make sure that the bot can indeed send a message in this channel.`}

\n
{`botChannelPermissions: [\"SEND_MESSAGES\"],\n`}
\n
\n

{`Note:`}{` If you want to send an embed response, you should also make sure it has the `}{`EMBED_LINKS`}{` permission.`}

\n
\n

{`Already we have prevented two of the largest errors that can get our bot banned if it is not checked. Discordeno handles this internally so you don't have to worry about it.`}

\n

{`Sometimes, you may also want to make sure that the user using the command has a certain permission to run the command. To do this, you can use the `}{`userServerPermissions`}{` or the `}{`userChannelPermissions`}{`.`}

\n

{`Cooldown Options`}

\n

{`The cooldown options go hand in hand together.`}

\n
    \n
  • {`seconds`}{` is how long to make the user wait in seconds before they can use the command again. By default, there is no wait time aka 0 seconds.`}
  • \n
  • {`allowedUses`}{` is how many times a user is allowed to use a command before they are placed on cooldown.`}
  • \n
  • {`Let's use our command as an example. We don't want someone to start spamming the role command so we can add a cooldown of 60 seconds. However, this would mean every time you give a role to someone, you would need to wait a whole minute to give a role to someone else. This is where `}{`allowedUses`}{` shines! Let's set it to to 5 so that a user can use this command 5 times in a row before being asked to wait for 60 seconds.`}
  • \n
\n
{`cooldown: {\n  seconds: 60,\n  allowedUses: 5\n},\n`}
\n
\n

{`Note:`}{` It is important to understand the way these two interact. The cooldown starts as soon as the first command is used. So, if a user uses the role command 5 times in 59 seconds, they only have to wait 1 second to do another 5 times.`}

\n
\n

{`Let's give this a try shall we.`}

\n
    \n
  1. {`!reload commands`}
  2. \n
  3. {`Spam the `}{`!role`}{` very quickly 6 times in under a minute.`}
  4. \n
\n

{`Arguments`}

\n

{`Arguments is an incredibly powerful feature in Discordeno. Like Permission Levels we will have an in depth look at arguments later in the guide. For now, let's try and understand this in a simple manner.`}

\n
    \n
  • {`name`}{`: The name of the argument. Useful for when you need to alert the user X arg is missing or when you want to use the arg in your command.`}
  • \n
  • {`type`}{`: The type of the argument you would like. Defaults to string. Some of the ones available by default are \"number\", \"string\", \"...string\", \"boolean\", \"subcommand\", \"member\".`}
  • \n
  • {`missing`}{`: a function that will be run when this argument is not provided by the user or if the provided argument is not valid. By default, it does nothing.`}
  • \n
  • {`required`}{`: Whether this argument is required or optional. By default, this is true.`}
  • \n
  • {`lowercase`}{`: If the type is a string, this can forcibly lowercase the string.`}
  • \n
  • {`literals`}{`: If the type is string or subcommand you can provide literals. The argument MUST be exactly the same as the literals to be accepted. For example, if you want to make sure the argument is `}{`a`}{` or `}{`b`}{` only and not `}{`c`}{`.`}
  • \n
  • {`defaultValue`}{`: The default value for this argument/subcommand. If the user does not provide an argument or it is invalid, it can be defaulted to a certain value.`}
  • \n
\n

{`For our role command, we need a `}{`member`}{` and a `}{`role`}{`.`}

\n
{`arguments: [\n  {\n    name: \"member\",\n    type: \"member\",\n    missing: (message) => {\n      sendResponse(message, \\`you did not provide a member to give the role to. You can provide a @member mention, a member ID, or try using their nickname/username. The nickname/username will only work if they have been active in your server recently.\\`)\n    }\n  },\n  {\n    name: \"role\",\n    type: \"role\",\n    missing: (message) => {\n      sendResponse(message, \\`you did not provide a role to give. You can provide a @role mention, a role ID, or it's name. If the role name did not work, try to use the **roleinfo** command to get the role ID.\\`)\n    }\n  }\n]\n`}
\n

{`Execute Option`}

\n

{`The execute option is the code that will run when the command is triggered. The execute function is passed 3 parameters that you can use in your command.`}

\n
    \n
  • {`message`}{`: The message object itself that triggered this command.`}
  • \n
  • {`args`}{`: The args that were provided by the user.`}
  • \n
  • {`guild`}{`: The server guild object where this command was run.`}
  • \n
\n
{`execute: function (message, args, guild) {\n  // The code that is to be executed goes here\n}\n`}
\n
\n

{`Note:`}{` I prefer writing code using the function keyword, but you can easily change to the fat arrow function if you prefer.`}

\n
{`execute: (message, args, guild) => {\n   // The code that is to be executed goes here\n}\n`}
\n
\n

{`Let's start out by writing some pseudo-code(comments that will help us plan the code).`}

\n
{`execute: function (message, args, guild) {\n  // If this was the everyone role alert with a silly error\n\n  // If this is a managed role(some bots role) we can't give/remove alert with silly error\n\n  // Get the bots highest role\n\n  // Check if the bot has a role higher than the role that it will try to give.\n\n  // If the role is too high alert the user.\n\n  // If the user has this role already remove the role from them.\n\n  // Check the command author's highest role\n\n  // If the author does not have a role high enough to give this role alert\n\n  // If the user has this role already we should remove it\n\n  // Add the role to the user.\n\n  // Alert the user that used the command that the user has been give the role.\n}\n`}
\n

{`Nice! The plan for the code is complete. Now, let's add in the code.`}

\n

{`The first thing we are going to try is to check if the role the user provided is the same as the everyone role.`}

\n
\n

{`Note:`}{` The everyone role ID is the same as the server guild ID.`}

\n
\n

{`To do this, we are going to want something like this:`}

\n
{`if (args.role.id === message.guildID) {\n  return sendResponse(message, \"The everyone role can not be given to anyone because everyone has the everyone role already. *Keep calm and let Carter figure it out*!\");\n}\n`}
\n

{`You might be seeing an error since we didn't provide the accurate typings for the `}{`args`}{` parameter. The message and guild parameter is automated but the args is dynamic depending on your `}{`arguments`}{` option for your command. So let's do this real quick.`}

\n
{`execute: function (message, args: RoleArgs, guild) {\n  // If this was the everyone role alert with a silly error\n  if (args.role.id === message.guildID) {\n    return sendResponse(message, \"Are you trying to make this person a super hero? Everyone has the everyone role. I can't give the everyone role to another user.\");\n  }\n\n  // Lots of comments here hidden so you can see the changes easily.\n}\n\ninterface RoleArgs {\n  role: Role;\n  member: Member;\n}\n`}
\n

{`Awesome! Let's keep going.`}

\n
{`execute: function (message, args: RoleArgs, guild) {\n  // If this was the everyone role alert with a silly error\n  if (args.role.id === message.guildID) {\n    return sendResponse(message, \"I don't know if you noticed or not but I'm an extremely arrogant bot who tends to think all of his plans will work. But I can't give the everyone role to someone.\");\n  }\n\n  // If this is a managed role(some bots role) we can't give/remove alert with silly error\n  if (args.role.managed) {\n    return sendResponse(message, \"Dammit man, just 'cause I'm Scottish doesn't mean I can give your people managed roles.\")\n  }\n\n  // Get the bots highest role\n  const botsHighestRole = highestRole(message.guildID, botID);\n\n  // Check if the bot has a role higher than the role that it will try to give.\n  const botIsHigher = higherRolePosition(message.guildID, botsHighestRole.id, args.role.id)\n\n  // If the role is too high alert the user.\n  if (!botIsHigher) {\n    return sendResponse(message, \"Okay look, asking me give a role that is higher than my highest role is ridiculous! I am the first bot to admit I don't know who these people are nor do I care to. Look, if you'd like I could take you down the hall and just point at the people who annoy me more than the rest. But that's about as useful as I get.\")\n  }\n\n  // Check the command author's highest role\n  const membersHighestRole = highestRole(message.guildID, message.author.id);\n\n  // If the author does not have a role high enough to give this role alert\n  if (!higherRolePosition(message.guildID, membersHighestRole.id, args.role.id)) {\n    return sendResponse(message, \"In my culture, whenever someone tries to give a role that is higher than their highest role, I would be well within my rights to dismember you.\")\n  }\n\n  // If the user has this role already we should remove it\n  if (message.member().roles.includes(args.role.id)) {\n    removeRole(message.guildID, args.member.user.id, args.role.id, \\`\\${message.author.tag} used the role command to remove this role.\\`)\n    // Alert the user that used the command that the user has lost the role.\n    return sendResponse(message, \\`The role **\\${args.role.name}** has been removed from **\\${args.member.tag}**.\\`)\n  }\n\n  // Add the role to the user.\n  addRole(guildID, memberID, roleID)\n\n  // Alert the user that used the command that the user has been give the role.\n  return sendResponse(message, \\`The role **\\${args.role.name}** has been added to **\\${args.member.tag}**.\\`)\n}\n`}
\n

{`The final version of the command should look something like this:`}

\n
{`import { highestRole, higherRolePosition, botID, removeRole, addRole, Role, Member } from \"../../deps.ts\";\nimport { botCache } from \"../../mod.ts\";\nimport { PermissionLevels } from \"../types/commands.ts\";\nimport { sendResponse } from \"../utils/helpers.ts\";\n\nbotCache.commands.set(\"role\", {\n  name: \"role\",\n  permissionLevel: [PermissionLevels.MODERATOR, PermissionLevels.ADMIN],\n  botServerPermissions: [\"MANAGE_ROLES\"],\n  botChannelPermissions: [\"SEND_MESSAGES\"],\n  cooldown: {\n    seconds: 60,\n    allowedUses: 5,\n  },\n  arguments: [\n        {\n            name: \"member\",\n            type: \"member\",\n            missing: (message) => {\n                sendResponse(message, \\`you did not provide a member to give the role to. You can provide a @member mention, a member ID, or try using their nickname/username. The nickname/username will only work if they have been active in your server recently.\\`)\n            }\n        },\n        {\n            name: \"role\",\n            type: \"role\",\n            missing: (message) => {\n                sendResponse(message, \\`you did not provide a role to give. You can provide a @role mention, a role ID, or it's name. If the role name did not work, try to use the **roleinfo** command to get the role ID.\\`)\n            }\n        }\n    ],\n  execute: function (message, args: RoleArgs) {\n    // If this was the everyone role alert with a silly error\n    if (args.role.id === message.guildID) {\n      return sendResponse(\n        message,\n        \"I don't know if you noticed or not but I'm an extremely arrogant bot who tends to think all of his plans will work. But I can't give the everyone role to someone.\",\n      );\n    }\n\n    // If this is a managed role(some bots role) we can't give/remove alert with silly error\n    if (args.role.managed) {\n      return sendResponse(\n        message,\n        \"Dammit man, just 'cause I'm Scottish doesn't mean I can give your people managed roles.\",\n      );\n    }\n\n    // Get the bots highest role\n    const botsHighestRole = highestRole(message.guildID, botID);\n\n    // Check if the bot has a role higher than the role that it will try to give. If the role is too high alert the user.\n    if (!botsHighestRole || !higherRolePosition(\n      message.guildID,\n      botsHighestRole.id,\n      args.role.id,\n    )) {\n      return sendResponse(\n        message,\n        \"Okay look, asking me give a role that is higher than my highest role is ridiculous! I am the first bot to admit I don't know who these people are nor do I care to. Look, if you'd like I could take you down the hall and just point at the people who annoy me more than the rest. But that's about as useful as I get.\",\n      );\n    }\n\n    // Check the command author's highest role\n    const membersHighestRole = highestRole(message.guildID, message.author.id);\n\n    // If the author does not have a role high enough to give this role alert\n    if (!membersHighestRole ||\n      !higherRolePosition(message.guildID, membersHighestRole.id, args.role.id)\n    ) {\n      return sendResponse(\n        message,\n        \"In my culture, whenever someone tries to give a role that is higher than their highest role, I would be well within my rights to dismember you.\",\n      );\n    }\n\n    // If the user has this role already we should remove it\n    if (message.member()?.roles.includes(args.role.id)) {\n      removeRole(\n        message.guildID,\n        args.member.user.id,\n        args.role.id,\n        \\`\\${message.author.username} used the role command to remove this role.\\`,\n      );\n      // Alert the user that used the command that the user has lost the role.\n      return sendResponse(\n        message,\n        \\`The role **\\${args.role.name}** has been removed from **\\${args.member.tag}**.\\`,\n      );\n    }\n\n    // Add the role to the user.\n    addRole(message.guildID, args.member.user.id, args.role.id, \\`\\${message.author.username} used the role command to give this role.\\`);\n\n    // Alert the user that used the command that the user has been give the role.\n    return sendResponse(\n      message,\n      \\`The role **\\${args.role.name}** has been added to **\\${args.member.tag}**.\\`,\n    );\n  },\n});\n\ninterface RoleArgs {\n  role: Role;\n  member: Member;\n}\n`}
\n
\n

{`Note:`}{` The response strings are a play on some funny Stargate(my favorite tv show) moments. Feel free to change as you wish to fit your bot's personality.`}

\n
\n

{`Dynamic(Advanced Level) Command Creation`}

\n

{`This is some advanced level super magical command creation skills. Discordeno gives you the power to dynamically create commands. What that means is you can write the code for one command but dynamically create like 50 commands using that same code.`}

\n

{`For example, in my main bot I have a lot of \"fun\" commands like `}{`.hug`}{` or `}{`.kiss`}{` etc... All of these files have the exact same code except for 1 word being the command name. Would it not be better to simply write the code once and dynamically create every single command. Let me show you how that works.`}

\n
    \n
  • {`Create a file in the commands folder called `}{`fun.ts`}{` which will create all our fun commands.`}
  • \n
\n
{`import { Member, sendMessage, chooseRandom, avatarURL } from \"../../deps.ts\";\nimport { botCache } from \"../../mod.ts\";\nimport { createCommandAliases, sendEmbed } from \"../utils/helpers.ts\";\nimport { configs } from \"../../configs.ts\";\nimport { Embed } from \"../utils/Embed.ts\";\nimport { translate } from \"../utils/i18next.ts\";\n\nconst funCommandData = [\n  { name: \"bite\", gifs: configs.gifs.bite },\n  { name: \"cuddle\", gifs: configs.gifs.cuddle },\n  { name: \"dance\", gifs: configs.gifs.dance },\n  { name: \"hug\", gifs: configs.gifs.hug },\n  { name: \"kiss\", gifs: configs.gifs.kiss },\n  { name: \"kanna\", gifs: configs.gifs.kanna },\n  { name: \"kiss\", gifs: configs.gifs.kiss },\n  { name: \"kitten\", gifs: configs.gifs.kitten },\n  { name: \"lmao\", gifs: configs.gifs.lmao, aliases: [\"lol\"] },\n  { name: \"pat\", gifs: configs.gifs.pat },\n  { name: \"poke\", gifs: configs.gifs.poke },\n  { name: \"pony\", gifs: configs.gifs.pony },\n  { name: \"puppy\", gifs: configs.gifs.puppy },\n  { name: \"raphtalia\", gifs: configs.gifs.raphtalia },\n  { name: \"stargate\", gifs: configs.gifs.stargate },\n  { name: \"supernatural\", gifs: configs.gifs.supernatural },\n  { name: \"tickle\", gifs: configs.gifs.tickle },\n  { name: \"zerotwo\", gifs: configs.gifs.zerotwo },\n];\n\nfunCommandData.forEach((data) => {\n  botCache.commands.set(data.name, {\n    name: data.name,\n    botChannelPermissions: [\"SEND_MESSAGES\", \"EMBED_LINKS\"],\n    cooldown: {\n      seconds: 2,\n    },\n    arguments: [\n      {\n        name: \"member\",\n        type: \"member\",\n        required: false,\n      },\n    ],\n    execute: function (message, args: FunArgs) {\n            // If a member is provided use that otherwise set the member themself\n      const member = args.member || message.member()!;\n\n      const type = member.user.id === message.author.id\n        // Silly response like if user tries to hug themself\n        ? \"SELF\"\n        // Response for when user tries to hug another user\n        : \"OTHER\";\n\n\n      // Create an embed\n      const embed = new Embed()\n        .setAuthor(member.tag, avatarURL(member))\n        .setDescription(\n          translate(\n            message.guildID,\n            \\`commands/fun/\\${data.name}:\\${type}\\`,\n            { mention: message.member()!.mention, user: member.mention },\n          ),\n        )\n        .setImage(chooseRandom(data.gifs));\n\n      return sendEmbed(message.channel, embed);\n    },\n  });\n\n  if (data.aliases?.length) {\n    createCommandAliases(data.name, data.aliases);\n  }\n});\n\ninterface FunArgs {\n  member?: Member;\n}\n`}
\n

{`Take a minute to realize what just happened. This has made 18 different unique commands dynamically. In 1 file, using the same piece of code, we created so many commands. You can easily add more commands to this. For example, if you wanted to add weeb(animated) versions of these commands. Then you are at 36 commands with 1 simple command file.`}

\n

{`That ladies and gentleman is the power and magic of Discordeno!`}

\n

{`Take a minute to stand up, step back and make some room around you. Now start dancing because you just acheived one of the most complex things in bot development. You have already created about 36 commands!!!!`}

\n
\n

{`Note:`}{` The command above uses translations which we will cover in depth in a later section of this guide.`}

\n
\n

{`Once you are ready, let's proceed to making our inhibitors.`}

\n\n
;\n}\n\n;\nMDXContent.isMDXComponent = true;"}} \ No newline at end of file diff --git a/docs/.cache/caches/gatsby-plugin-mdx/diskstore-0fb27743948f516aa90e985c5052f9ae.json b/docs/.cache/caches/gatsby-plugin-mdx/diskstore-0fb27743948f516aa90e985c5052f9ae.json new file mode 100644 index 000000000..8ccab4abc --- /dev/null +++ b/docs/.cache/caches/gatsby-plugin-mdx/diskstore-0fb27743948f516aa90e985c5052f9ae.json @@ -0,0 +1 @@ +{"expireTime":9007200851632792000,"key":"gatsby-plugin-mdx-entire-payload-5b75945633b8e0d28ca42aa7fb323d78-","val":{"mdast":{"type":"root","children":[{"type":"paragraph","children":[{"type":"text","value":"Woah! You are almost half way done with understanding all of Discordeno. Amazing isn't it? Something you may have noticed in the last section was there were some options that prevented some commands from running like ","position":{"start":{"line":2,"column":1,"offset":1},"end":{"line":2,"column":218,"offset":218},"indent":[]}},{"type":"inlineCode","value":"dmOnly","position":{"start":{"line":2,"column":218,"offset":218},"end":{"line":2,"column":226,"offset":226},"indent":[]}},{"type":"text","value":" or the permission options. we created a setting to prevent the monitor from running in certain channels. What if we wanted to do prevent commands from happening? How would we prevent commands from running?","position":{"start":{"line":2,"column":226,"offset":226},"end":{"line":2,"column":432,"offset":432},"indent":[]}}],"position":{"start":{"line":2,"column":1,"offset":1},"end":{"line":2,"column":432,"offset":432},"indent":[]}},{"type":"heading","depth":2,"children":[{"type":"text","value":"What is an Inhibitor?","position":{"start":{"line":4,"column":4,"offset":437},"end":{"line":4,"column":25,"offset":458},"indent":[]}}],"position":{"start":{"line":4,"column":1,"offset":434},"end":{"line":4,"column":25,"offset":458},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"An Inhibitor is very similar to how monitors work. A monitor runs on every message but an inhibitor runs on every command. Remember all those command options like cooldown, permissions, permissionLevel, nsfw, etc... Each and every one of these options has an inhibitor in that checks commands for these settings.","position":{"start":{"line":6,"column":1,"offset":460},"end":{"line":6,"column":313,"offset":772},"indent":[]}}],"position":{"start":{"line":6,"column":1,"offset":460},"end":{"line":6,"column":313,"offset":772},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"Let's create our own inhibitor that would prevent commands from being used if the user is not a VIP user.","position":{"start":{"line":8,"column":1,"offset":774},"end":{"line":8,"column":106,"offset":879},"indent":[]}}],"position":{"start":{"line":8,"column":1,"offset":774},"end":{"line":8,"column":106,"offset":879},"indent":[]}},{"type":"blockquote","children":[{"type":"paragraph","children":[{"type":"strong","children":[{"type":"text","value":"Note:","position":{"start":{"line":10,"column":5,"offset":885},"end":{"line":10,"column":10,"offset":890},"indent":[]}}],"position":{"start":{"line":10,"column":3,"offset":883},"end":{"line":10,"column":12,"offset":892},"indent":[]}},{"type":"text","value":" It is important to remember that everything below can be done with a simple permission level as well. We will create our own custom permission levels but for the purposes of this guide and to be able to learn about Inhibitors, we will be using an inhibitor.","position":{"start":{"line":10,"column":12,"offset":892},"end":{"line":10,"column":270,"offset":1150},"indent":[]}}],"position":{"start":{"line":10,"column":3,"offset":883},"end":{"line":10,"column":270,"offset":1150},"indent":[]}}],"position":{"start":{"line":10,"column":1,"offset":881},"end":{"line":10,"column":270,"offset":1150},"indent":[]}},{"type":"heading","depth":2,"children":[{"type":"text","value":"Creating the File","position":{"start":{"line":12,"column":4,"offset":1155},"end":{"line":12,"column":21,"offset":1172},"indent":[]}}],"position":{"start":{"line":12,"column":1,"offset":1152},"end":{"line":12,"column":21,"offset":1172},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"Let's start by creating a file inside the inhibitors folder called ","position":{"start":{"line":14,"column":1,"offset":1174},"end":{"line":14,"column":68,"offset":1241},"indent":[]}},{"type":"inlineCode","value":"vipOnly.ts","position":{"start":{"line":14,"column":68,"offset":1241},"end":{"line":14,"column":80,"offset":1253},"indent":[]}},{"type":"text","value":" and paste the following snippet of code:","position":{"start":{"line":14,"column":80,"offset":1253},"end":{"line":14,"column":121,"offset":1294},"indent":[]}}],"position":{"start":{"line":14,"column":1,"offset":1174},"end":{"line":14,"column":121,"offset":1294},"indent":[]}},{"type":"code","lang":"ts","meta":null,"value":"import { botCache } from \"../../mod.ts\";\n\nbotCache.inhibitors.set(\"inhibitorname\", async function (message, command, guild) {\n\t// Your code goes here\n});","position":{"start":{"line":16,"column":1,"offset":1296},"end":{"line":22,"column":4,"offset":1459},"indent":[1,1,1,1,1,1]}},{"type":"paragraph","children":[{"type":"text","value":"Inhibitors can take up to 3 arguments.","position":{"start":{"line":24,"column":1,"offset":1461},"end":{"line":24,"column":39,"offset":1499},"indent":[]}}],"position":{"start":{"line":24,"column":1,"offset":1461},"end":{"line":24,"column":39,"offset":1499},"indent":[]}},{"type":"list","ordered":false,"start":null,"spread":false,"children":[{"type":"listItem","spread":false,"checked":null,"children":[{"type":"paragraph","children":[{"type":"inlineCode","value":"message","position":{"start":{"line":26,"column":3,"offset":1503},"end":{"line":26,"column":12,"offset":1512},"indent":[]}},{"type":"text","value":": The message object that triggered the command.","position":{"start":{"line":26,"column":12,"offset":1512},"end":{"line":26,"column":60,"offset":1560},"indent":[]}}],"position":{"start":{"line":26,"column":3,"offset":1503},"end":{"line":26,"column":60,"offset":1560},"indent":[]}}],"position":{"start":{"line":26,"column":1,"offset":1501},"end":{"line":26,"column":60,"offset":1560},"indent":[]}},{"type":"listItem","spread":false,"checked":null,"children":[{"type":"paragraph","children":[{"type":"inlineCode","value":"command","position":{"start":{"line":27,"column":3,"offset":1563},"end":{"line":27,"column":12,"offset":1572},"indent":[]}},{"type":"text","value":": The command object itself that was triggered.","position":{"start":{"line":27,"column":12,"offset":1572},"end":{"line":27,"column":59,"offset":1619},"indent":[]}}],"position":{"start":{"line":27,"column":3,"offset":1563},"end":{"line":27,"column":59,"offset":1619},"indent":[]}}],"position":{"start":{"line":27,"column":1,"offset":1561},"end":{"line":27,"column":59,"offset":1619},"indent":[]}},{"type":"listItem","spread":false,"checked":null,"children":[{"type":"paragraph","children":[{"type":"inlineCode","value":"guild","position":{"start":{"line":28,"column":3,"offset":1622},"end":{"line":28,"column":10,"offset":1629},"indent":[]}},{"type":"text","value":": The server guild object where this command was ran.","position":{"start":{"line":28,"column":10,"offset":1629},"end":{"line":28,"column":63,"offset":1682},"indent":[]}}],"position":{"start":{"line":28,"column":3,"offset":1622},"end":{"line":28,"column":63,"offset":1682},"indent":[]}}],"position":{"start":{"line":28,"column":1,"offset":1620},"end":{"line":28,"column":63,"offset":1682},"indent":[]}}],"position":{"start":{"line":26,"column":1,"offset":1501},"end":{"line":28,"column":63,"offset":1682},"indent":[1,1]}},{"type":"heading","depth":2,"children":[{"type":"text","value":"Understanding How Inhibitors Function","position":{"start":{"line":30,"column":4,"offset":1687},"end":{"line":30,"column":41,"offset":1724},"indent":[]}}],"position":{"start":{"line":30,"column":1,"offset":1684},"end":{"line":30,"column":41,"offset":1724},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"To block a command you have to return a truthy value.","position":{"start":{"line":32,"column":1,"offset":1726},"end":{"line":32,"column":54,"offset":1779},"indent":[]}}],"position":{"start":{"line":32,"column":1,"offset":1726},"end":{"line":32,"column":54,"offset":1779},"indent":[]}},{"type":"code","lang":null,"meta":null,"value":"- **return true;** If you return true the inhibitor will block the execution of the command.","position":{"start":{"line":33,"column":1,"offset":1780},"end":{"line":33,"column":94,"offset":1873},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"To allow a command return a falsey value.","position":{"start":{"line":34,"column":1,"offset":1874},"end":{"line":34,"column":42,"offset":1915},"indent":[]}}],"position":{"start":{"line":34,"column":1,"offset":1874},"end":{"line":34,"column":42,"offset":1915},"indent":[]}},{"type":"code","lang":null,"meta":null,"value":"- **return false;** If you return false the inhibitor will not block the error.","position":{"start":{"line":35,"column":1,"offset":1916},"end":{"line":35,"column":81,"offset":1996},"indent":[]}},{"type":"export","value":"export const _frontmatter = {\"title\":\"Creating Inhibitors!\",\"metaTitle\":\"Creating An Inhibitor | Discordeno\",\"metaDescription\":\"Let's create our very own bot with Discordeno!\"}","position":{"start":{"line":40,"column":1,"offset":2001},"end":{"line":40,"column":177,"offset":2177},"indent":[]}}],"position":{"start":{"line":1,"column":1,"offset":0},"end":{"line":40,"column":177,"offset":2177}}},"scopeImports":["import * as React from 'react'"],"scopeIdentifiers":["React"],"body":"function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }\n\nfunction _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }\n\nfunction _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }\n\n/* @jsx mdx */\nvar _frontmatter = {\n \"title\": \"Creating Inhibitors!\",\n \"metaTitle\": \"Creating An Inhibitor | Discordeno\",\n \"metaDescription\": \"Let's create our very own bot with Discordeno!\"\n};\nvar layoutProps = {\n _frontmatter: _frontmatter\n};\nvar MDXLayout = \"wrapper\";\nreturn function MDXContent(_ref) {\n var components = _ref.components,\n props = _objectWithoutProperties(_ref, [\"components\"]);\n\n return mdx(MDXLayout, _extends({}, layoutProps, props, {\n components: components,\n mdxType: \"MDXLayout\"\n }), mdx(\"p\", null, \"Woah! You are almost half way done with understanding all of Discordeno. Amazing isn't it? Something you may have noticed in the last section was there were some options that prevented some commands from running like \", mdx(\"inlineCode\", {\n parentName: \"p\"\n }, \"dmOnly\"), \" or the permission options. we created a setting to prevent the monitor from running in certain channels. What if we wanted to do prevent commands from happening? How would we prevent commands from running?\"), mdx(\"h2\", null, \"What is an Inhibitor?\"), mdx(\"p\", null, \"An Inhibitor is very similar to how monitors work. A monitor runs on every message but an inhibitor runs on every command. Remember all those command options like cooldown, permissions, permissionLevel, nsfw, etc... Each and every one of these options has an inhibitor in that checks commands for these settings.\"), mdx(\"p\", null, \"Let's create our own inhibitor that would prevent commands from being used if the user is not a VIP user.\"), mdx(\"blockquote\", null, mdx(\"p\", {\n parentName: \"blockquote\"\n }, mdx(\"strong\", {\n parentName: \"p\"\n }, \"Note:\"), \" It is important to remember that everything below can be done with a simple permission level as well. We will create our own custom permission levels but for the purposes of this guide and to be able to learn about Inhibitors, we will be using an inhibitor.\")), mdx(\"h2\", null, \"Creating the File\"), mdx(\"p\", null, \"Let's start by creating a file inside the inhibitors folder called \", mdx(\"inlineCode\", {\n parentName: \"p\"\n }, \"vipOnly.ts\"), \" and paste the following snippet of code:\"), mdx(\"pre\", null, mdx(\"code\", _extends({\n parentName: \"pre\"\n }, {\n \"className\": \"language-ts\"\n }), \"import { botCache } from \\\"../../mod.ts\\\";\\n\\nbotCache.inhibitors.set(\\\"inhibitorname\\\", async function (message, command, guild) {\\n // Your code goes here\\n});\\n\")), mdx(\"p\", null, \"Inhibitors can take up to 3 arguments.\"), mdx(\"ul\", null, mdx(\"li\", {\n parentName: \"ul\"\n }, mdx(\"inlineCode\", {\n parentName: \"li\"\n }, \"message\"), \": The message object that triggered the command.\"), mdx(\"li\", {\n parentName: \"ul\"\n }, mdx(\"inlineCode\", {\n parentName: \"li\"\n }, \"command\"), \": The command object itself that was triggered.\"), mdx(\"li\", {\n parentName: \"ul\"\n }, mdx(\"inlineCode\", {\n parentName: \"li\"\n }, \"guild\"), \": The server guild object where this command was ran.\")), mdx(\"h2\", null, \"Understanding How Inhibitors Function\"), mdx(\"p\", null, \"To block a command you have to return a truthy value.\"), mdx(\"pre\", null, mdx(\"code\", _extends({\n parentName: \"pre\"\n }, {}), \"- **return true;** If you return true the inhibitor will block the execution of the command.\\n\")), mdx(\"p\", null, \"To allow a command return a falsey value.\"), mdx(\"pre\", null, mdx(\"code\", _extends({\n parentName: \"pre\"\n }, {}), \"- **return false;** If you return false the inhibitor will not block the error.\\n\")));\n}\n;\nMDXContent.isMDXComponent = true;","rawMDXOutput":"/* @jsx mdx */\nimport { mdx } from '@mdx-js/react';\n/* @jsx mdx */\n\nexport const _frontmatter = {\n \"title\": \"Creating Inhibitors!\",\n \"metaTitle\": \"Creating An Inhibitor | Discordeno\",\n \"metaDescription\": \"Let's create our very own bot with Discordeno!\"\n};\n\nconst layoutProps = {\n _frontmatter\n};\nconst MDXLayout = \"wrapper\"\nexport default function MDXContent({\n components,\n ...props\n}) {\n return \n

{`Woah! You are almost half way done with understanding all of Discordeno. Amazing isn't it? Something you may have noticed in the last section was there were some options that prevented some commands from running like `}{`dmOnly`}{` or the permission options. we created a setting to prevent the monitor from running in certain channels. What if we wanted to do prevent commands from happening? How would we prevent commands from running?`}

\n

{`What is an Inhibitor?`}

\n

{`An Inhibitor is very similar to how monitors work. A monitor runs on every message but an inhibitor runs on every command. Remember all those command options like cooldown, permissions, permissionLevel, nsfw, etc... Each and every one of these options has an inhibitor in that checks commands for these settings.`}

\n

{`Let's create our own inhibitor that would prevent commands from being used if the user is not a VIP user.`}

\n
\n

{`Note:`}{` It is important to remember that everything below can be done with a simple permission level as well. We will create our own custom permission levels but for the purposes of this guide and to be able to learn about Inhibitors, we will be using an inhibitor.`}

\n
\n

{`Creating the File`}

\n

{`Let's start by creating a file inside the inhibitors folder called `}{`vipOnly.ts`}{` and paste the following snippet of code:`}

\n
{`import { botCache } from \"../../mod.ts\";\n\nbotCache.inhibitors.set(\"inhibitorname\", async function (message, command, guild) {\n    // Your code goes here\n});\n`}
\n

{`Inhibitors can take up to 3 arguments.`}

\n
    \n
  • {`message`}{`: The message object that triggered the command.`}
  • \n
  • {`command`}{`: The command object itself that was triggered.`}
  • \n
  • {`guild`}{`: The server guild object where this command was ran.`}
  • \n
\n

{`Understanding How Inhibitors Function`}

\n

{`To block a command you have to return a truthy value.`}

\n
{`- **return true;** If you return true the inhibitor will block the execution of the command.\n`}
\n

{`To allow a command return a falsey value.`}

\n
{`- **return false;** If you return false the inhibitor will not block the error.\n`}
\n\n
;\n}\n\n;\nMDXContent.isMDXComponent = true;"}} \ No newline at end of file diff --git a/docs/.cache/caches/gatsby-plugin-mdx/diskstore-113a31d4b6cbf7e91d13a23bcc388165.json b/docs/.cache/caches/gatsby-plugin-mdx/diskstore-113a31d4b6cbf7e91d13a23bcc388165.json new file mode 100644 index 000000000..95b507b6d --- /dev/null +++ b/docs/.cache/caches/gatsby-plugin-mdx/diskstore-113a31d4b6cbf7e91d13a23bcc388165.json @@ -0,0 +1 @@ +{"expireTime":9007200851644219000,"key":"gatsby-plugin-mdx-entire-payload-32c4cffbe361871735dda5c8272773b7-","val":{"mdast":{"type":"root","children":[{"type":"paragraph","children":[{"type":"text","value":"Discordeno will help make Discord bot development much easier. Don't worry, as you go through this guide it will make a lot more sense.","position":{"start":{"line":2,"column":1,"offset":1},"end":{"line":2,"column":136,"offset":136},"indent":[]}}],"position":{"start":{"line":2,"column":1,"offset":1},"end":{"line":2,"column":136,"offset":136},"indent":[]}},{"type":"heading","depth":2,"children":[{"type":"text","value":"Creating The Bot!","position":{"start":{"line":4,"column":4,"offset":141},"end":{"line":4,"column":21,"offset":158},"indent":[]}}],"position":{"start":{"line":4,"column":1,"offset":138},"end":{"line":4,"column":21,"offset":158},"indent":[]}},{"type":"blockquote","children":[{"type":"paragraph","children":[{"type":"text","value":"This guide is going to assume you already have the basic requirements to make a bot ready. This includes github, git, a code editor like Visual Studio Code. If you don't have these yet please prepare them first before going forward.","position":{"start":{"line":6,"column":3,"offset":162},"end":{"line":6,"column":235,"offset":394},"indent":[]}}],"position":{"start":{"line":6,"column":3,"offset":162},"end":{"line":6,"column":235,"offset":394},"indent":[]}}],"position":{"start":{"line":6,"column":1,"offset":160},"end":{"line":6,"column":235,"offset":394},"indent":[]}},{"type":"list","ordered":false,"start":null,"spread":true,"children":[{"type":"listItem","spread":false,"checked":null,"children":[{"type":"paragraph","children":[{"type":"text","value":"First, create a Discordeno Bot using the ","position":{"start":{"line":8,"column":3,"offset":398},"end":{"line":8,"column":44,"offset":439},"indent":[]}},{"type":"link","title":null,"url":"https://github.com/Skillz4Killz/Discordeno-bot-template","children":[{"type":"text","value":"Generator Boilerplate","position":{"start":{"line":8,"column":45,"offset":440},"end":{"line":8,"column":66,"offset":461},"indent":[]}}],"position":{"start":{"line":8,"column":44,"offset":439},"end":{"line":8,"column":124,"offset":519},"indent":[]}},{"type":"text","value":". Give it any name you like. For the purpose of this guide we will call it, Stargate.","position":{"start":{"line":8,"column":124,"offset":519},"end":{"line":8,"column":209,"offset":604},"indent":[]}}],"position":{"start":{"line":8,"column":3,"offset":398},"end":{"line":8,"column":209,"offset":604},"indent":[]}}],"position":{"start":{"line":8,"column":1,"offset":396},"end":{"line":9,"column":1,"offset":605},"indent":[1]}},{"type":"listItem","spread":false,"checked":null,"children":[{"type":"paragraph","children":[{"type":"text","value":"Then ","position":{"start":{"line":10,"column":3,"offset":608},"end":{"line":10,"column":8,"offset":613},"indent":[]}},{"type":"inlineCode","value":"git clone https://github.com/Skillz4Killz/Stargate.git","position":{"start":{"line":10,"column":8,"offset":613},"end":{"line":10,"column":64,"offset":669},"indent":[]}}],"position":{"start":{"line":10,"column":3,"offset":608},"end":{"line":10,"column":64,"offset":669},"indent":[]}}],"position":{"start":{"line":10,"column":1,"offset":606},"end":{"line":11,"column":1,"offset":670},"indent":[1]}},{"type":"listItem","spread":false,"checked":null,"children":[{"type":"paragraph","children":[{"type":"text","value":"When that is done, go ahead and open up the folder with VSC.","position":{"start":{"line":12,"column":3,"offset":673},"end":{"line":12,"column":63,"offset":733},"indent":[]}}],"position":{"start":{"line":12,"column":3,"offset":673},"end":{"line":12,"column":63,"offset":733},"indent":[]}}],"position":{"start":{"line":12,"column":1,"offset":671},"end":{"line":12,"column":63,"offset":733},"indent":[]}},{"type":"listItem","spread":false,"checked":null,"children":[{"type":"paragraph","children":[{"type":"text","value":"Create a new file called ","position":{"start":{"line":13,"column":3,"offset":736},"end":{"line":13,"column":28,"offset":761},"indent":[]}},{"type":"inlineCode","value":"configs.ts","position":{"start":{"line":13,"column":28,"offset":761},"end":{"line":13,"column":40,"offset":773},"indent":[]}},{"type":"text","value":". Open the ","position":{"start":{"line":13,"column":40,"offset":773},"end":{"line":13,"column":51,"offset":784},"indent":[]}},{"type":"inlineCode","value":"configs.example.ts","position":{"start":{"line":13,"column":51,"offset":784},"end":{"line":13,"column":71,"offset":804},"indent":[]}},{"type":"text","value":" file and copy everything over.","position":{"start":{"line":13,"column":71,"offset":804},"end":{"line":13,"column":102,"offset":835},"indent":[]}}],"position":{"start":{"line":13,"column":3,"offset":736},"end":{"line":13,"column":102,"offset":835},"indent":[]}}],"position":{"start":{"line":13,"column":1,"offset":734},"end":{"line":13,"column":102,"offset":835},"indent":[]}}],"position":{"start":{"line":8,"column":1,"offset":396},"end":{"line":13,"column":102,"offset":835},"indent":[1,1,1,1,1]}},{"type":"paragraph","children":[{"type":"text","value":"Let's take a minute to review all the options we have available to us.","position":{"start":{"line":15,"column":1,"offset":837},"end":{"line":15,"column":71,"offset":907},"indent":[]}}],"position":{"start":{"line":15,"column":1,"offset":837},"end":{"line":15,"column":71,"offset":907},"indent":[]}},{"type":"heading","depth":3,"children":[{"type":"text","value":"Configs File","position":{"start":{"line":17,"column":5,"offset":913},"end":{"line":17,"column":17,"offset":925},"indent":[]}}],"position":{"start":{"line":17,"column":1,"offset":909},"end":{"line":17,"column":17,"offset":925},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"The ","position":{"start":{"line":19,"column":1,"offset":927},"end":{"line":19,"column":5,"offset":931},"indent":[]}},{"type":"inlineCode","value":"configs.ts","position":{"start":{"line":19,"column":5,"offset":931},"end":{"line":19,"column":17,"offset":943},"indent":[]}},{"type":"text","value":" file is where you will keep all your secret info you don't want to share with anyone else. As long as ","position":{"start":{"line":19,"column":17,"offset":943},"end":{"line":19,"column":120,"offset":1046},"indent":[]}},{"type":"inlineCode","value":".gitignore","position":{"start":{"line":19,"column":120,"offset":1046},"end":{"line":19,"column":132,"offset":1058},"indent":[]}},{"type":"text","value":" file is ignoring configs.ts your configurations will be kept private!","position":{"start":{"line":19,"column":132,"offset":1058},"end":{"line":19,"column":202,"offset":1128},"indent":[]}}],"position":{"start":{"line":19,"column":1,"offset":927},"end":{"line":19,"column":202,"offset":1128},"indent":[]}},{"type":"code","lang":"ts","meta":null,"value":"// Step 1: Remove the `.example` from this file name so it is called `configs.ts`\n// Step 2: Add all your bot's information below. The only required one is token and prefix. NOTE: As long as `.gitignore` file is ignoring configs.ts your configurations will be kept private!\n// Step 3: Remove these comments if you like.\n\nexport const configs = {\n // Your bot token goes here\n token: \"\",\n // The default prefix for your bot. Don't worry guilds can change this later.\n prefix: \"!\",\n // This isn't required but you can add bot list api keys here.\n botListTokens: {\n DISCORD_BOT_ORG: \"\",\n BOTS_ON_DISCORD: \"\",\n DISCORD_BOT_LIST: \"\",\n BOTS_FOR_DISCORD: \"\",\n DISCORD_BOATS: \"\",\n DISCORD_BOTS_GG: \"\",\n DISCORD_BOTS_GROUP: \"\",\n },\n // This is the server id for your bot's main server where users can get help/support\n supportServerID: \"\",\n // These are channel ids that will enable some functionality\n channelIDs: {\n // When a translation is missing this is the channel you will be alerted in.\n missingTranslation: \"\",\n // When an error occurs, we will try and log it to this channel\n errorChannelID: \"\"\n },\n // These are the role ids that will enable some functionality.\n roleIDs: {\n // If you have a patreon set up you can add the patreon vip role id here.\n patreonVIPRoleID: \"\",\n },\n // These are the user ids that will enable some functionality.\n userIDs: {\n // The user ids for the support team\n botSupporters: [],\n // The user ids for the other devs on your team\n botDevs: [],\n // The user ids who have complete 100% access to your bot\n botOwners: []\n }\n};\n","position":{"start":{"line":21,"column":1,"offset":1130},"end":{"line":66,"column":4,"offset":2770},"indent":[1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1]}},{"type":"heading","depth":4,"children":[{"type":"text","value":"Token","position":{"start":{"line":68,"column":6,"offset":2777},"end":{"line":68,"column":11,"offset":2782},"indent":[]}}],"position":{"start":{"line":68,"column":1,"offset":2772},"end":{"line":68,"column":11,"offset":2782},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"First, add your bot token. This is ","position":{"start":{"line":70,"column":1,"offset":2784},"end":{"line":70,"column":36,"offset":2819},"indent":[]}},{"type":"strong","children":[{"type":"text","value":"required","position":{"start":{"line":70,"column":38,"offset":2821},"end":{"line":70,"column":46,"offset":2829},"indent":[]}}],"position":{"start":{"line":70,"column":36,"offset":2819},"end":{"line":70,"column":48,"offset":2831},"indent":[]}},{"type":"text","value":" for the bot to start. Review the ","position":{"start":{"line":70,"column":48,"offset":2831},"end":{"line":70,"column":82,"offset":2865},"indent":[]}},{"type":"link","title":null,"url":"https://discordeno.netlify.app/gettingstarted#creatingyourfirstdiscordbotapplication","children":[{"type":"text","value":"instructions","position":{"start":{"line":70,"column":83,"offset":2866},"end":{"line":70,"column":95,"offset":2878},"indent":[]}}],"position":{"start":{"line":70,"column":82,"offset":2865},"end":{"line":70,"column":182,"offset":2965},"indent":[]}},{"type":"text","value":" if you have not made your token yet.","position":{"start":{"line":70,"column":182,"offset":2965},"end":{"line":70,"column":219,"offset":3002},"indent":[]}}],"position":{"start":{"line":70,"column":1,"offset":2784},"end":{"line":70,"column":219,"offset":3002},"indent":[]}},{"type":"heading","depth":4,"children":[{"type":"text","value":"Prefix","position":{"start":{"line":72,"column":6,"offset":3009},"end":{"line":72,"column":12,"offset":3015},"indent":[]}}],"position":{"start":{"line":72,"column":1,"offset":3004},"end":{"line":72,"column":12,"offset":3015},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"The prefix is where you will set the default prefix for your bot. Don't worry, every server will be able to choose their own prefix but we need a default prefix to start.","position":{"start":{"line":74,"column":1,"offset":3017},"end":{"line":74,"column":171,"offset":3187},"indent":[]}}],"position":{"start":{"line":74,"column":1,"offset":3017},"end":{"line":74,"column":171,"offset":3187},"indent":[]}},{"type":"heading","depth":4,"children":[{"type":"text","value":"Bot Lists Tokens","position":{"start":{"line":76,"column":6,"offset":3194},"end":{"line":76,"column":22,"offset":3210},"indent":[]}}],"position":{"start":{"line":76,"column":1,"offset":3189},"end":{"line":76,"column":22,"offset":3210},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"This section of the file is so you can easily have your bot's statistics updated on all the bot lists out there to help you grow your bot. The code is already written to handle this but you will need to do 3 things for each bot list.","position":{"start":{"line":78,"column":1,"offset":3212},"end":{"line":78,"column":234,"offset":3445},"indent":[]}}],"position":{"start":{"line":78,"column":1,"offset":3212},"end":{"line":78,"column":234,"offset":3445},"indent":[]}},{"type":"list","ordered":true,"start":1,"spread":false,"children":[{"type":"listItem","spread":false,"checked":null,"children":[{"type":"paragraph","children":[{"type":"text","value":"Go to the bot list and add your bot to their website. (Each site has it's own instructions)","position":{"start":{"line":80,"column":4,"offset":3450},"end":{"line":80,"column":95,"offset":3541},"indent":[]}}],"position":{"start":{"line":80,"column":4,"offset":3450},"end":{"line":80,"column":95,"offset":3541},"indent":[]}}],"position":{"start":{"line":80,"column":1,"offset":3447},"end":{"line":80,"column":95,"offset":3541},"indent":[]}},{"type":"listItem","spread":false,"checked":null,"children":[{"type":"paragraph","children":[{"type":"text","value":"Create a token for yourself on each website and paste it in your configs.","position":{"start":{"line":81,"column":4,"offset":3545},"end":{"line":81,"column":77,"offset":3618},"indent":[]}}],"position":{"start":{"line":81,"column":4,"offset":3545},"end":{"line":81,"column":77,"offset":3618},"indent":[]}}],"position":{"start":{"line":81,"column":1,"offset":3542},"end":{"line":81,"column":77,"offset":3618},"indent":[]}},{"type":"listItem","spread":false,"checked":null,"children":[{"type":"paragraph","children":[{"type":"text","value":"Enjoy!","position":{"start":{"line":82,"column":4,"offset":3622},"end":{"line":82,"column":10,"offset":3628},"indent":[]}}],"position":{"start":{"line":82,"column":4,"offset":3622},"end":{"line":82,"column":10,"offset":3628},"indent":[]}}],"position":{"start":{"line":82,"column":1,"offset":3619},"end":{"line":82,"column":10,"offset":3628},"indent":[]}}],"position":{"start":{"line":80,"column":1,"offset":3447},"end":{"line":82,"column":10,"offset":3628},"indent":[1,1]}},{"type":"paragraph","children":[{"type":"text","value":"If you wish to customize the code, you will find the bot list tasks in the tasks folder. Don't worry we will discuss this when we get to the tasks section of the guide.","position":{"start":{"line":84,"column":1,"offset":3630},"end":{"line":84,"column":169,"offset":3798},"indent":[]}}],"position":{"start":{"line":84,"column":1,"offset":3630},"end":{"line":84,"column":169,"offset":3798},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"For now just remember, that Discordeno provides you a built in way to update most discord bot lists.","position":{"start":{"line":86,"column":1,"offset":3800},"end":{"line":86,"column":101,"offset":3900},"indent":[]}}],"position":{"start":{"line":86,"column":1,"offset":3800},"end":{"line":86,"column":101,"offset":3900},"indent":[]}},{"type":"heading","depth":4,"children":[{"type":"text","value":"Channel IDs","position":{"start":{"line":88,"column":6,"offset":3907},"end":{"line":88,"column":17,"offset":3918},"indent":[]}}],"position":{"start":{"line":88,"column":1,"offset":3902},"end":{"line":88,"column":17,"offset":3918},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"The channelIDs section holds the channel IDs that are useful for specific features to help give you alerts/notifications. For example, the ","position":{"start":{"line":90,"column":1,"offset":3920},"end":{"line":90,"column":140,"offset":4059},"indent":[]}},{"type":"inlineCode","value":"missingTranslation","position":{"start":{"line":90,"column":140,"offset":4059},"end":{"line":90,"column":160,"offset":4079},"indent":[]}},{"type":"text","value":" channel will be where messages are sent alerting you that somewhere in your code you are trying to use a translation key that you never created.","position":{"start":{"line":90,"column":160,"offset":4079},"end":{"line":90,"column":305,"offset":4224},"indent":[]}}],"position":{"start":{"line":90,"column":1,"offset":3920},"end":{"line":90,"column":305,"offset":4224},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"When you get to around 25,000 Discord servers on your bot, you may want to convert these channel IDs to webhooks.","position":{"start":{"line":92,"column":1,"offset":4226},"end":{"line":92,"column":114,"offset":4339},"indent":[]}}],"position":{"start":{"line":92,"column":1,"offset":4226},"end":{"line":92,"column":114,"offset":4339},"indent":[]}},{"type":"heading","depth":4,"children":[{"type":"text","value":"Role IDs","position":{"start":{"line":94,"column":6,"offset":4346},"end":{"line":94,"column":14,"offset":4354},"indent":[]}}],"position":{"start":{"line":94,"column":1,"offset":4341},"end":{"line":94,"column":14,"offset":4354},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"The roleIDs section holds the role IDs that are useful for specific features. For example, the ","position":{"start":{"line":96,"column":1,"offset":4356},"end":{"line":96,"column":96,"offset":4451},"indent":[]}},{"type":"inlineCode","value":"missingTranslation","position":{"start":{"line":96,"column":96,"offset":4451},"end":{"line":96,"column":116,"offset":4471},"indent":[]}},{"type":"text","value":" channel will be where messages are sent alerting you that somewhere in your code you are trying to use a translation key that you never created.","position":{"start":{"line":96,"column":116,"offset":4471},"end":{"line":96,"column":261,"offset":4616},"indent":[]}}],"position":{"start":{"line":96,"column":1,"offset":4356},"end":{"line":96,"column":261,"offset":4616},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"When you get to around 25,000 Discord servers on your bot, you may want to convert these channel IDs to webhooks.","position":{"start":{"line":98,"column":1,"offset":4618},"end":{"line":98,"column":114,"offset":4731},"indent":[]}}],"position":{"start":{"line":98,"column":1,"offset":4618},"end":{"line":98,"column":114,"offset":4731},"indent":[]}},{"type":"heading","depth":2,"children":[{"type":"text","value":"It's Alive!","position":{"start":{"line":100,"column":4,"offset":4736},"end":{"line":100,"column":15,"offset":4747},"indent":[]}}],"position":{"start":{"line":100,"column":1,"offset":4733},"end":{"line":100,"column":15,"offset":4747},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"Oh my god! You now have a bot with a bunch of features already! You don't believe me? Well, seeing is believing, so start the bot.","position":{"start":{"line":102,"column":1,"offset":4749},"end":{"line":102,"column":131,"offset":4879},"indent":[]}}],"position":{"start":{"line":102,"column":1,"offset":4749},"end":{"line":102,"column":131,"offset":4879},"indent":[]}},{"type":"list","ordered":true,"start":1,"spread":false,"children":[{"type":"listItem","spread":false,"checked":null,"children":[{"type":"paragraph","children":[{"type":"text","value":"Invite your bot to a discord server.","position":{"start":{"line":104,"column":4,"offset":4884},"end":{"line":104,"column":40,"offset":4920},"indent":[]}}],"position":{"start":{"line":104,"column":4,"offset":4884},"end":{"line":104,"column":40,"offset":4920},"indent":[]}}],"position":{"start":{"line":104,"column":1,"offset":4881},"end":{"line":104,"column":40,"offset":4920},"indent":[]}},{"type":"listItem","spread":false,"checked":null,"children":[{"type":"paragraph","children":[{"type":"text","value":"Open up the integrated terminal in VSC using ","position":{"start":{"line":105,"column":4,"offset":4924},"end":{"line":105,"column":49,"offset":4969},"indent":[]}},{"type":"strong","children":[{"type":"text","value":"CTRL + `","position":{"start":{"line":105,"column":51,"offset":4971},"end":{"line":105,"column":59,"offset":4979},"indent":[]}}],"position":{"start":{"line":105,"column":49,"offset":4969},"end":{"line":105,"column":61,"offset":4981},"indent":[]}},{"type":"text","value":". If you use a Mac, replace CTRL with CMD.","position":{"start":{"line":105,"column":61,"offset":4981},"end":{"line":105,"column":103,"offset":5023},"indent":[]}}],"position":{"start":{"line":105,"column":4,"offset":4924},"end":{"line":105,"column":103,"offset":5023},"indent":[]}}],"position":{"start":{"line":105,"column":1,"offset":4921},"end":{"line":105,"column":103,"offset":5023},"indent":[]}},{"type":"listItem","spread":false,"checked":null,"children":[{"type":"paragraph","children":[{"type":"text","value":"Run the script below:","position":{"start":{"line":106,"column":4,"offset":5027},"end":{"line":106,"column":25,"offset":5048},"indent":[]}}],"position":{"start":{"line":106,"column":4,"offset":5027},"end":{"line":106,"column":25,"offset":5048},"indent":[]}}],"position":{"start":{"line":106,"column":1,"offset":5024},"end":{"line":106,"column":25,"offset":5048},"indent":[]}}],"position":{"start":{"line":104,"column":1,"offset":4881},"end":{"line":106,"column":25,"offset":5048},"indent":[1,1]}},{"type":"code","lang":"shell","meta":null,"value":"deno run --allow-net --allow-read mod.ts","position":{"start":{"line":108,"column":1,"offset":5050},"end":{"line":110,"column":4,"offset":5103},"indent":[1,1]}},{"type":"paragraph","children":[{"type":"text","value":"The first time you run it, you may see a lot of files being loaded. This is preparing all the magic behind the scene. Once it is ready, you will see something like this:","position":{"start":{"line":112,"column":1,"offset":5105},"end":{"line":112,"column":170,"offset":5274},"indent":[]}}],"position":{"start":{"line":112,"column":1,"offset":5105},"end":{"line":112,"column":170,"offset":5274},"indent":[]}},{"type":"paragraph","children":[{"type":"image","title":null,"url":"https://i.imgur.com/TOXjLgh.png","alt":"image","position":{"start":{"line":114,"column":1,"offset":5276},"end":{"line":114,"column":42,"offset":5317},"indent":[]}}],"position":{"start":{"line":114,"column":1,"offset":5276},"end":{"line":114,"column":42,"offset":5317},"indent":[]}},{"type":"heading","depth":2,"children":[{"type":"text","value":"Understanding What Discordeno Did","position":{"start":{"line":116,"column":4,"offset":5322},"end":{"line":116,"column":37,"offset":5355},"indent":[]}}],"position":{"start":{"line":116,"column":1,"offset":5319},"end":{"line":116,"column":37,"offset":5355},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"Discordeno includes these commands/folders as they are essential for any discord bot to have in order to meet the Discord Bot Best Practices. It also adds a few things that will help make some things easier to build a bot.","position":{"start":{"line":118,"column":1,"offset":5357},"end":{"line":118,"column":223,"offset":5579},"indent":[]}}],"position":{"start":{"line":118,"column":1,"offset":5357},"end":{"line":118,"column":223,"offset":5579},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"We will dive into these deeper in this guide. Let's take it step by step.","position":{"start":{"line":120,"column":1,"offset":5581},"end":{"line":120,"column":74,"offset":5654},"indent":[]}}],"position":{"start":{"line":120,"column":1,"offset":5581},"end":{"line":120,"column":74,"offset":5654},"indent":[]}},{"type":"export","value":"export const _frontmatter = {\"title\":\"Creating The Bot!\",\"metaTitle\":\"Creating A Bot | Discordeno\",\"metaDescription\":\"Let's create our very own bot with Discordeno!\"}","position":{"start":{"line":123,"column":1,"offset":5657},"end":{"line":123,"column":167,"offset":5823},"indent":[]}}],"position":{"start":{"line":1,"column":1,"offset":0},"end":{"line":123,"column":167,"offset":5823}}},"scopeImports":["import * as React from 'react'"],"scopeIdentifiers":["React"],"body":"function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }\n\nfunction _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }\n\nfunction _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }\n\n/* @jsx mdx */\nvar _frontmatter = {\n \"title\": \"Creating The Bot!\",\n \"metaTitle\": \"Creating A Bot | Discordeno\",\n \"metaDescription\": \"Let's create our very own bot with Discordeno!\"\n};\nvar layoutProps = {\n _frontmatter: _frontmatter\n};\nvar MDXLayout = \"wrapper\";\nreturn function MDXContent(_ref) {\n var components = _ref.components,\n props = _objectWithoutProperties(_ref, [\"components\"]);\n\n return mdx(MDXLayout, _extends({}, layoutProps, props, {\n components: components,\n mdxType: \"MDXLayout\"\n }), mdx(\"p\", null, \"Discordeno will help make Discord bot development much easier. Don't worry, as you go through this guide it will make a lot more sense.\"), mdx(\"h2\", null, \"Creating The Bot!\"), mdx(\"blockquote\", null, mdx(\"p\", {\n parentName: \"blockquote\"\n }, \"This guide is going to assume you already have the basic requirements to make a bot ready. This includes github, git, a code editor like Visual Studio Code. If you don't have these yet please prepare them first before going forward.\")), mdx(\"ul\", null, mdx(\"li\", {\n parentName: \"ul\"\n }, mdx(\"p\", {\n parentName: \"li\"\n }, \"First, create a Discordeno Bot using the \", mdx(\"a\", _extends({\n parentName: \"p\"\n }, {\n \"href\": \"https://github.com/Skillz4Killz/Discordeno-bot-template\"\n }), \"Generator Boilerplate\"), \". Give it any name you like. For the purpose of this guide we will call it, Stargate.\")), mdx(\"li\", {\n parentName: \"ul\"\n }, mdx(\"p\", {\n parentName: \"li\"\n }, \"Then \", mdx(\"inlineCode\", {\n parentName: \"p\"\n }, \"git clone https://github.com/Skillz4Killz/Stargate.git\"))), mdx(\"li\", {\n parentName: \"ul\"\n }, mdx(\"p\", {\n parentName: \"li\"\n }, \"When that is done, go ahead and open up the folder with VSC.\")), mdx(\"li\", {\n parentName: \"ul\"\n }, mdx(\"p\", {\n parentName: \"li\"\n }, \"Create a new file called \", mdx(\"inlineCode\", {\n parentName: \"p\"\n }, \"configs.ts\"), \". Open the \", mdx(\"inlineCode\", {\n parentName: \"p\"\n }, \"configs.example.ts\"), \" file and copy everything over.\"))), mdx(\"p\", null, \"Let's take a minute to review all the options we have available to us.\"), mdx(\"h3\", null, \"Configs File\"), mdx(\"p\", null, \"The \", mdx(\"inlineCode\", {\n parentName: \"p\"\n }, \"configs.ts\"), \" file is where you will keep all your secret info you don't want to share with anyone else. As long as \", mdx(\"inlineCode\", {\n parentName: \"p\"\n }, \".gitignore\"), \" file is ignoring configs.ts your configurations will be kept private!\"), mdx(\"pre\", null, mdx(\"code\", _extends({\n parentName: \"pre\"\n }, {\n \"className\": \"language-ts\"\n }), \"// Step 1: Remove the `.example` from this file name so it is called `configs.ts`\\n// Step 2: Add all your bot's information below. The only required one is token and prefix. NOTE: As long as `.gitignore` file is ignoring configs.ts your configurations will be kept private!\\n// Step 3: Remove these comments if you like.\\n\\nexport const configs = {\\n // Your bot token goes here\\n token: \\\"\\\",\\n // The default prefix for your bot. Don't worry guilds can change this later.\\n prefix: \\\"!\\\",\\n // This isn't required but you can add bot list api keys here.\\n botListTokens: {\\n DISCORD_BOT_ORG: \\\"\\\",\\n BOTS_ON_DISCORD: \\\"\\\",\\n DISCORD_BOT_LIST: \\\"\\\",\\n BOTS_FOR_DISCORD: \\\"\\\",\\n DISCORD_BOATS: \\\"\\\",\\n DISCORD_BOTS_GG: \\\"\\\",\\n DISCORD_BOTS_GROUP: \\\"\\\",\\n },\\n // This is the server id for your bot's main server where users can get help/support\\n supportServerID: \\\"\\\",\\n // These are channel ids that will enable some functionality\\n channelIDs: {\\n // When a translation is missing this is the channel you will be alerted in.\\n missingTranslation: \\\"\\\",\\n // When an error occurs, we will try and log it to this channel\\n errorChannelID: \\\"\\\"\\n },\\n // These are the role ids that will enable some functionality.\\n roleIDs: {\\n // If you have a patreon set up you can add the patreon vip role id here.\\n patreonVIPRoleID: \\\"\\\",\\n },\\n // These are the user ids that will enable some functionality.\\n userIDs: {\\n // The user ids for the support team\\n botSupporters: [],\\n // The user ids for the other devs on your team\\n botDevs: [],\\n // The user ids who have complete 100% access to your bot\\n botOwners: []\\n }\\n};\\n\\n\")), mdx(\"h4\", null, \"Token\"), mdx(\"p\", null, \"First, add your bot token. This is \", mdx(\"strong\", {\n parentName: \"p\"\n }, \"required\"), \" for the bot to start. Review the \", mdx(\"a\", _extends({\n parentName: \"p\"\n }, {\n \"href\": \"https://discordeno.netlify.app/gettingstarted#creatingyourfirstdiscordbotapplication\"\n }), \"instructions\"), \" if you have not made your token yet.\"), mdx(\"h4\", null, \"Prefix\"), mdx(\"p\", null, \"The prefix is where you will set the default prefix for your bot. Don't worry, every server will be able to choose their own prefix but we need a default prefix to start.\"), mdx(\"h4\", null, \"Bot Lists Tokens\"), mdx(\"p\", null, \"This section of the file is so you can easily have your bot's statistics updated on all the bot lists out there to help you grow your bot. The code is already written to handle this but you will need to do 3 things for each bot list.\"), mdx(\"ol\", null, mdx(\"li\", {\n parentName: \"ol\"\n }, \"Go to the bot list and add your bot to their website. (Each site has it's own instructions)\"), mdx(\"li\", {\n parentName: \"ol\"\n }, \"Create a token for yourself on each website and paste it in your configs.\"), mdx(\"li\", {\n parentName: \"ol\"\n }, \"Enjoy!\")), mdx(\"p\", null, \"If you wish to customize the code, you will find the bot list tasks in the tasks folder. Don't worry we will discuss this when we get to the tasks section of the guide.\"), mdx(\"p\", null, \"For now just remember, that Discordeno provides you a built in way to update most discord bot lists.\"), mdx(\"h4\", null, \"Channel IDs\"), mdx(\"p\", null, \"The channelIDs section holds the channel IDs that are useful for specific features to help give you alerts/notifications. For example, the \", mdx(\"inlineCode\", {\n parentName: \"p\"\n }, \"missingTranslation\"), \" channel will be where messages are sent alerting you that somewhere in your code you are trying to use a translation key that you never created.\"), mdx(\"p\", null, \"When you get to around 25,000 Discord servers on your bot, you may want to convert these channel IDs to webhooks.\"), mdx(\"h4\", null, \"Role IDs\"), mdx(\"p\", null, \"The roleIDs section holds the role IDs that are useful for specific features. For example, the \", mdx(\"inlineCode\", {\n parentName: \"p\"\n }, \"missingTranslation\"), \" channel will be where messages are sent alerting you that somewhere in your code you are trying to use a translation key that you never created.\"), mdx(\"p\", null, \"When you get to around 25,000 Discord servers on your bot, you may want to convert these channel IDs to webhooks.\"), mdx(\"h2\", null, \"It's Alive!\"), mdx(\"p\", null, \"Oh my god! You now have a bot with a bunch of features already! You don't believe me? Well, seeing is believing, so start the bot.\"), mdx(\"ol\", null, mdx(\"li\", {\n parentName: \"ol\"\n }, \"Invite your bot to a discord server.\"), mdx(\"li\", {\n parentName: \"ol\"\n }, \"Open up the integrated terminal in VSC using \", mdx(\"strong\", {\n parentName: \"li\"\n }, \"CTRL + `\"), \". If you use a Mac, replace CTRL with CMD.\"), mdx(\"li\", {\n parentName: \"ol\"\n }, \"Run the script below:\")), mdx(\"pre\", null, mdx(\"code\", _extends({\n parentName: \"pre\"\n }, {\n \"className\": \"language-shell\"\n }), \"deno run --allow-net --allow-read mod.ts\\n\")), mdx(\"p\", null, \"The first time you run it, you may see a lot of files being loaded. This is preparing all the magic behind the scene. Once it is ready, you will see something like this:\"), mdx(\"p\", null, mdx(\"img\", _extends({\n parentName: \"p\"\n }, {\n \"src\": \"https://i.imgur.com/TOXjLgh.png\",\n \"alt\": \"image\"\n }))), mdx(\"h2\", null, \"Understanding What Discordeno Did\"), mdx(\"p\", null, \"Discordeno includes these commands/folders as they are essential for any discord bot to have in order to meet the Discord Bot Best Practices. It also adds a few things that will help make some things easier to build a bot.\"), mdx(\"p\", null, \"We will dive into these deeper in this guide. Let's take it step by step.\"));\n}\n;\nMDXContent.isMDXComponent = true;","rawMDXOutput":"/* @jsx mdx */\nimport { mdx } from '@mdx-js/react';\n/* @jsx mdx */\n\nexport const _frontmatter = {\n \"title\": \"Creating The Bot!\",\n \"metaTitle\": \"Creating A Bot | Discordeno\",\n \"metaDescription\": \"Let's create our very own bot with Discordeno!\"\n};\n\nconst layoutProps = {\n _frontmatter\n};\nconst MDXLayout = \"wrapper\"\nexport default function MDXContent({\n components,\n ...props\n}) {\n return \n

{`Discordeno will help make Discord bot development much easier. Don't worry, as you go through this guide it will make a lot more sense.`}

\n

{`Creating The Bot!`}

\n
\n

{`This guide is going to assume you already have the basic requirements to make a bot ready. This includes github, git, a code editor like Visual Studio Code. If you don't have these yet please prepare them first before going forward.`}

\n
\n
    \n
  • \n

    {`First, create a Discordeno Bot using the `}{`Generator Boilerplate`}{`. Give it any name you like. For the purpose of this guide we will call it, Stargate.`}

    \n
  • \n
  • \n

    {`Then `}{`git clone https://github.com/Skillz4Killz/Stargate.git`}

    \n
  • \n
  • \n

    {`When that is done, go ahead and open up the folder with VSC.`}

    \n
  • \n
  • \n

    {`Create a new file called `}{`configs.ts`}{`. Open the `}{`configs.example.ts`}{` file and copy everything over.`}

    \n
  • \n
\n

{`Let's take a minute to review all the options we have available to us.`}

\n

{`Configs File`}

\n

{`The `}{`configs.ts`}{` file is where you will keep all your secret info you don't want to share with anyone else. As long as `}{`.gitignore`}{` file is ignoring configs.ts your configurations will be kept private!`}

\n
{`// Step 1: Remove the \\`.example\\` from this file name so it is called \\`configs.ts\\`\n// Step 2: Add all your bot's information below. The only required one is token and prefix. NOTE: As long as \\`.gitignore\\` file is ignoring configs.ts your configurations will be kept private!\n// Step 3: Remove these comments if you like.\n\nexport const configs = {\n  // Your bot token goes here\n  token: \"\",\n  // The default prefix for your bot. Don't worry guilds can change this later.\n  prefix: \"!\",\n  // This isn't required but you can add bot list api keys here.\n  botListTokens: {\n    DISCORD_BOT_ORG: \"\",\n    BOTS_ON_DISCORD: \"\",\n    DISCORD_BOT_LIST: \"\",\n    BOTS_FOR_DISCORD: \"\",\n    DISCORD_BOATS: \"\",\n    DISCORD_BOTS_GG: \"\",\n    DISCORD_BOTS_GROUP: \"\",\n  },\n  // This is the server id for your bot's main server where users can get help/support\n  supportServerID: \"\",\n  // These are channel ids that will enable some functionality\n  channelIDs: {\n    // When a translation is missing this is the channel you will be alerted in.\n    missingTranslation: \"\",\n    // When an error occurs, we will try and log it to this channel\n    errorChannelID: \"\"\n  },\n  // These are the role ids that will enable some functionality.\n  roleIDs: {\n    // If you have a patreon set up you can add the patreon vip role id here.\n    patreonVIPRoleID: \"\",\n  },\n  // These are the user ids that will enable some functionality.\n  userIDs: {\n    // The user ids for the support team\n    botSupporters: [],\n    // The user ids for the other devs on your team\n    botDevs: [],\n    // The user ids who have complete 100% access to your bot\n    botOwners: []\n  }\n};\n\n`}
\n

{`Token`}

\n

{`First, add your bot token. This is `}{`required`}{` for the bot to start. Review the `}{`instructions`}{` if you have not made your token yet.`}

\n

{`Prefix`}

\n

{`The prefix is where you will set the default prefix for your bot. Don't worry, every server will be able to choose their own prefix but we need a default prefix to start.`}

\n

{`Bot Lists Tokens`}

\n

{`This section of the file is so you can easily have your bot's statistics updated on all the bot lists out there to help you grow your bot. The code is already written to handle this but you will need to do 3 things for each bot list.`}

\n
    \n
  1. {`Go to the bot list and add your bot to their website. (Each site has it's own instructions)`}
  2. \n
  3. {`Create a token for yourself on each website and paste it in your configs.`}
  4. \n
  5. {`Enjoy!`}
  6. \n
\n

{`If you wish to customize the code, you will find the bot list tasks in the tasks folder. Don't worry we will discuss this when we get to the tasks section of the guide.`}

\n

{`For now just remember, that Discordeno provides you a built in way to update most discord bot lists.`}

\n

{`Channel IDs`}

\n

{`The channelIDs section holds the channel IDs that are useful for specific features to help give you alerts/notifications. For example, the `}{`missingTranslation`}{` channel will be where messages are sent alerting you that somewhere in your code you are trying to use a translation key that you never created.`}

\n

{`When you get to around 25,000 Discord servers on your bot, you may want to convert these channel IDs to webhooks.`}

\n

{`Role IDs`}

\n

{`The roleIDs section holds the role IDs that are useful for specific features. For example, the `}{`missingTranslation`}{` channel will be where messages are sent alerting you that somewhere in your code you are trying to use a translation key that you never created.`}

\n

{`When you get to around 25,000 Discord servers on your bot, you may want to convert these channel IDs to webhooks.`}

\n

{`It's Alive!`}

\n

{`Oh my god! You now have a bot with a bunch of features already! You don't believe me? Well, seeing is believing, so start the bot.`}

\n
    \n
  1. {`Invite your bot to a discord server.`}
  2. \n
  3. {`Open up the integrated terminal in VSC using `}{`CTRL + \\``}{`. If you use a Mac, replace CTRL with CMD.`}
  4. \n
  5. {`Run the script below:`}
  6. \n
\n
{`deno run --allow-net --allow-read mod.ts\n`}
\n

{`The first time you run it, you may see a lot of files being loaded. This is preparing all the magic behind the scene. Once it is ready, you will see something like this:`}

\n

\n

{`Understanding What Discordeno Did`}

\n

{`Discordeno includes these commands/folders as they are essential for any discord bot to have in order to meet the Discord Bot Best Practices. It also adds a few things that will help make some things easier to build a bot.`}

\n

{`We will dive into these deeper in this guide. Let's take it step by step.`}

\n\n
;\n}\n\n;\nMDXContent.isMDXComponent = true;"}} \ No newline at end of file diff --git a/docs/.cache/caches/gatsby-plugin-mdx/diskstore-149d68ad6d5c452536cd7471bcda8a26.json b/docs/.cache/caches/gatsby-plugin-mdx/diskstore-149d68ad6d5c452536cd7471bcda8a26.json new file mode 100644 index 000000000..f0751ef76 --- /dev/null +++ b/docs/.cache/caches/gatsby-plugin-mdx/diskstore-149d68ad6d5c452536cd7471bcda8a26.json @@ -0,0 +1 @@ +{"expireTime":9007200851635132000,"key":"gatsby-plugin-mdx-entire-payload-0219ad052cb8cfc851ab78b35b33f036-","val":{"mdast":{"type":"root","children":[{"type":"paragraph","children":[{"type":"text","value":"Woah! You are almost half way done with understanding all of Discordeno. Amazing isn't it? Something you may have noticed in the last section was when the bot started up you could see a bunch of messages like ","position":{"start":{"line":2,"column":1,"offset":1},"end":{"line":2,"column":210,"offset":210},"indent":[]}},{"type":"inlineCode","value":"Loaded X Commands","position":{"start":{"line":2,"column":210,"offset":210},"end":{"line":2,"column":229,"offset":229},"indent":[]}},{"type":"text","value":" and such. This ","position":{"start":{"line":2,"column":229,"offset":229},"end":{"line":2,"column":245,"offset":245},"indent":[]}}],"position":{"start":{"line":2,"column":1,"offset":1},"end":{"line":2,"column":245,"offset":245},"indent":[]}},{"type":"heading","depth":2,"children":[{"type":"text","value":"What Is An Event?","position":{"start":{"line":4,"column":4,"offset":250},"end":{"line":4,"column":21,"offset":267},"indent":[]}}],"position":{"start":{"line":4,"column":1,"offset":247},"end":{"line":4,"column":21,"offset":267},"indent":[]}},{"type":"export","value":"export const _frontmatter = {\"title\":\"Creating Events!\",\"metaTitle\":\"Creating An Event | Discordeno\",\"metaDescription\":\"Let's create our very own bot with Discordeno!\"}","position":{"start":{"line":8,"column":1,"offset":271},"end":{"line":8,"column":169,"offset":439},"indent":[]}}],"position":{"start":{"line":1,"column":1,"offset":0},"end":{"line":8,"column":169,"offset":439}}},"scopeImports":["import * as React from 'react'"],"scopeIdentifiers":["React"],"body":"function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }\n\nfunction _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }\n\nfunction _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }\n\n/* @jsx mdx */\nvar _frontmatter = {\n \"title\": \"Creating Events!\",\n \"metaTitle\": \"Creating An Event | Discordeno\",\n \"metaDescription\": \"Let's create our very own bot with Discordeno!\"\n};\nvar layoutProps = {\n _frontmatter: _frontmatter\n};\nvar MDXLayout = \"wrapper\";\nreturn function MDXContent(_ref) {\n var components = _ref.components,\n props = _objectWithoutProperties(_ref, [\"components\"]);\n\n return mdx(MDXLayout, _extends({}, layoutProps, props, {\n components: components,\n mdxType: \"MDXLayout\"\n }), mdx(\"p\", null, \"Woah! You are almost half way done with understanding all of Discordeno. Amazing isn't it? Something you may have noticed in the last section was when the bot started up you could see a bunch of messages like \", mdx(\"inlineCode\", {\n parentName: \"p\"\n }, \"Loaded X Commands\"), \" and such. This \"), mdx(\"h2\", null, \"What Is An Event?\"));\n}\n;\nMDXContent.isMDXComponent = true;","rawMDXOutput":"/* @jsx mdx */\nimport { mdx } from '@mdx-js/react';\n/* @jsx mdx */\n\nexport const _frontmatter = {\n \"title\": \"Creating Events!\",\n \"metaTitle\": \"Creating An Event | Discordeno\",\n \"metaDescription\": \"Let's create our very own bot with Discordeno!\"\n};\n\nconst layoutProps = {\n _frontmatter\n};\nconst MDXLayout = \"wrapper\"\nexport default function MDXContent({\n components,\n ...props\n}) {\n return \n

{`Woah! You are almost half way done with understanding all of Discordeno. Amazing isn't it? Something you may have noticed in the last section was when the bot started up you could see a bunch of messages like `}{`Loaded X Commands`}{` and such. This `}

\n

{`What Is An Event?`}

\n\n
;\n}\n\n;\nMDXContent.isMDXComponent = true;"}} \ No newline at end of file diff --git a/docs/.cache/caches/gatsby-plugin-mdx/diskstore-197303de8e8c05c6067f92a342669add.json b/docs/.cache/caches/gatsby-plugin-mdx/diskstore-197303de8e8c05c6067f92a342669add.json new file mode 100644 index 000000000..9c3fb9273 --- /dev/null +++ b/docs/.cache/caches/gatsby-plugin-mdx/diskstore-197303de8e8c05c6067f92a342669add.json @@ -0,0 +1 @@ +{"expireTime":9007200851635104000,"key":"gatsby-plugin-mdx-entire-payload-45a9e0e70b7535b9ac846053d4de76b0-","val":{"mdast":{"type":"root","children":[{"type":"paragraph","children":[{"type":"text","value":"Woah! You are almost half way done with understanding all of Discordeno. Amazing isn't it? Something you may have noticed in the last section ","position":{"start":{"line":2,"column":1,"offset":1},"end":{"line":2,"column":143,"offset":143},"indent":[]}}],"position":{"start":{"line":2,"column":1,"offset":1},"end":{"line":2,"column":143,"offset":143},"indent":[]}},{"type":"heading","depth":2,"children":[{"type":"text","value":"What Is An Event?","position":{"start":{"line":4,"column":4,"offset":148},"end":{"line":4,"column":21,"offset":165},"indent":[]}}],"position":{"start":{"line":4,"column":1,"offset":145},"end":{"line":4,"column":21,"offset":165},"indent":[]}},{"type":"export","value":"export const _frontmatter = {\"title\":\"Creating Events!\",\"metaTitle\":\"Creating An Event | Discordeno\",\"metaDescription\":\"Let's create our very own bot with Discordeno!\"}","position":{"start":{"line":8,"column":1,"offset":169},"end":{"line":8,"column":169,"offset":337},"indent":[]}}],"position":{"start":{"line":1,"column":1,"offset":0},"end":{"line":8,"column":169,"offset":337}}},"scopeImports":["import * as React from 'react'"],"scopeIdentifiers":["React"],"body":"function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }\n\nfunction _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }\n\nfunction _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }\n\n/* @jsx mdx */\nvar _frontmatter = {\n \"title\": \"Creating Events!\",\n \"metaTitle\": \"Creating An Event | Discordeno\",\n \"metaDescription\": \"Let's create our very own bot with Discordeno!\"\n};\nvar layoutProps = {\n _frontmatter: _frontmatter\n};\nvar MDXLayout = \"wrapper\";\nreturn function MDXContent(_ref) {\n var components = _ref.components,\n props = _objectWithoutProperties(_ref, [\"components\"]);\n\n return mdx(MDXLayout, _extends({}, layoutProps, props, {\n components: components,\n mdxType: \"MDXLayout\"\n }), mdx(\"p\", null, \"Woah! You are almost half way done with understanding all of Discordeno. Amazing isn't it? Something you may have noticed in the last section \"), mdx(\"h2\", null, \"What Is An Event?\"));\n}\n;\nMDXContent.isMDXComponent = true;","rawMDXOutput":"/* @jsx mdx */\nimport { mdx } from '@mdx-js/react';\n/* @jsx mdx */\n\nexport const _frontmatter = {\n \"title\": \"Creating Events!\",\n \"metaTitle\": \"Creating An Event | Discordeno\",\n \"metaDescription\": \"Let's create our very own bot with Discordeno!\"\n};\n\nconst layoutProps = {\n _frontmatter\n};\nconst MDXLayout = \"wrapper\"\nexport default function MDXContent({\n components,\n ...props\n}) {\n return \n

{`Woah! You are almost half way done with understanding all of Discordeno. Amazing isn't it? Something you may have noticed in the last section `}

\n

{`What Is An Event?`}

\n\n
;\n}\n\n;\nMDXContent.isMDXComponent = true;"}} \ No newline at end of file diff --git a/docs/.cache/caches/gatsby-plugin-mdx/diskstore-1a299f58c275aa4ccca1c63ed73af141.json b/docs/.cache/caches/gatsby-plugin-mdx/diskstore-1a299f58c275aa4ccca1c63ed73af141.json new file mode 100644 index 000000000..7f8ace590 --- /dev/null +++ b/docs/.cache/caches/gatsby-plugin-mdx/diskstore-1a299f58c275aa4ccca1c63ed73af141.json @@ -0,0 +1 @@ +{"expireTime":9007200851634901000,"key":"gatsby-plugin-mdx-entire-payload-9100a04199cc1975dccb401bd5b114a8-","val":{"mdast":{"type":"root","children":[{"type":"paragraph","children":[{"type":"text","value":"Woah! You are almost half way done with understanding all of Discordeno. Amazing isn't it? Something you may have noticed in the last section was there were some options that prevented some commands from running like ","position":{"start":{"line":2,"column":1,"offset":1},"end":{"line":2,"column":218,"offset":218},"indent":[]}},{"type":"inlineCode","value":"dmOnly","position":{"start":{"line":2,"column":218,"offset":218},"end":{"line":2,"column":226,"offset":226},"indent":[]}},{"type":"text","value":" or the permission options. we created a setting to prevent the monitor from running in certain channels. What if we wanted to do prevent commands from happening? How would we prevent commands from running?","position":{"start":{"line":2,"column":226,"offset":226},"end":{"line":2,"column":432,"offset":432},"indent":[]}}],"position":{"start":{"line":2,"column":1,"offset":1},"end":{"line":2,"column":432,"offset":432},"indent":[]}},{"type":"heading","depth":2,"children":[{"type":"text","value":"What is an Inhibitor?","position":{"start":{"line":4,"column":4,"offset":437},"end":{"line":4,"column":25,"offset":458},"indent":[]}}],"position":{"start":{"line":4,"column":1,"offset":434},"end":{"line":4,"column":25,"offset":458},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"An Inhibitor is very similar to how monitors work. A monitor runs on every message but an inhibitor runs on every command. Remember all those command options like cooldown, permissions, permissionLevel, nsfw, etc... Each and every one of these options has an inhibitor in that checks commands for these settings.","position":{"start":{"line":6,"column":1,"offset":460},"end":{"line":6,"column":313,"offset":772},"indent":[]}}],"position":{"start":{"line":6,"column":1,"offset":460},"end":{"line":6,"column":313,"offset":772},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"Let's create our own inhibitor that would prevent commands from being used if the user is not a VIP user.","position":{"start":{"line":8,"column":1,"offset":774},"end":{"line":8,"column":106,"offset":879},"indent":[]}}],"position":{"start":{"line":8,"column":1,"offset":774},"end":{"line":8,"column":106,"offset":879},"indent":[]}},{"type":"blockquote","children":[{"type":"paragraph","children":[{"type":"strong","children":[{"type":"text","value":"Note:","position":{"start":{"line":10,"column":5,"offset":885},"end":{"line":10,"column":10,"offset":890},"indent":[]}}],"position":{"start":{"line":10,"column":3,"offset":883},"end":{"line":10,"column":12,"offset":892},"indent":[]}},{"type":"text","value":" It is important to remember that everything below can be done with a simple permission level as well. We will create our own custom permission levels but for the purposes of this guide and to be able to learn about Inhibitors, we will be using an inhibitor.","position":{"start":{"line":10,"column":12,"offset":892},"end":{"line":10,"column":270,"offset":1150},"indent":[]}}],"position":{"start":{"line":10,"column":3,"offset":883},"end":{"line":10,"column":270,"offset":1150},"indent":[]}}],"position":{"start":{"line":10,"column":1,"offset":881},"end":{"line":10,"column":270,"offset":1150},"indent":[]}},{"type":"heading","depth":2,"children":[{"type":"text","value":"Creating the File","position":{"start":{"line":12,"column":4,"offset":1155},"end":{"line":12,"column":21,"offset":1172},"indent":[]}}],"position":{"start":{"line":12,"column":1,"offset":1152},"end":{"line":12,"column":21,"offset":1172},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"Let's start by creating a file inside the inhibitors folder called ","position":{"start":{"line":14,"column":1,"offset":1174},"end":{"line":14,"column":68,"offset":1241},"indent":[]}},{"type":"inlineCode","value":"boosted.ts","position":{"start":{"line":14,"column":68,"offset":1241},"end":{"line":14,"column":80,"offset":1253},"indent":[]}},{"type":"text","value":" and paste the following snippet of code:","position":{"start":{"line":14,"column":80,"offset":1253},"end":{"line":14,"column":121,"offset":1294},"indent":[]}}],"position":{"start":{"line":14,"column":1,"offset":1174},"end":{"line":14,"column":121,"offset":1294},"indent":[]}},{"type":"code","lang":"ts","meta":null,"value":"import { botCache } from \"../../mod.ts\";\n\nbotCache.inhibitors.set(\"inhibitorname\", async function (message, command, guild) {\n\t// Your code goes here\n});","position":{"start":{"line":16,"column":1,"offset":1296},"end":{"line":22,"column":4,"offset":1459},"indent":[1,1,1,1,1,1]}},{"type":"paragraph","children":[{"type":"text","value":"Inhibitors can take up to 3 arguments.","position":{"start":{"line":24,"column":1,"offset":1461},"end":{"line":24,"column":39,"offset":1499},"indent":[]}}],"position":{"start":{"line":24,"column":1,"offset":1461},"end":{"line":24,"column":39,"offset":1499},"indent":[]}},{"type":"list","ordered":false,"start":null,"spread":false,"children":[{"type":"listItem","spread":false,"checked":null,"children":[{"type":"paragraph","children":[{"type":"inlineCode","value":"message","position":{"start":{"line":26,"column":3,"offset":1503},"end":{"line":26,"column":12,"offset":1512},"indent":[]}},{"type":"text","value":": The message object that triggered the command.","position":{"start":{"line":26,"column":12,"offset":1512},"end":{"line":26,"column":60,"offset":1560},"indent":[]}}],"position":{"start":{"line":26,"column":3,"offset":1503},"end":{"line":26,"column":60,"offset":1560},"indent":[]}}],"position":{"start":{"line":26,"column":1,"offset":1501},"end":{"line":26,"column":60,"offset":1560},"indent":[]}},{"type":"listItem","spread":false,"checked":null,"children":[{"type":"paragraph","children":[{"type":"inlineCode","value":"command","position":{"start":{"line":27,"column":3,"offset":1563},"end":{"line":27,"column":12,"offset":1572},"indent":[]}},{"type":"text","value":": The command object itself that was triggered.","position":{"start":{"line":27,"column":12,"offset":1572},"end":{"line":27,"column":59,"offset":1619},"indent":[]}}],"position":{"start":{"line":27,"column":3,"offset":1563},"end":{"line":27,"column":59,"offset":1619},"indent":[]}}],"position":{"start":{"line":27,"column":1,"offset":1561},"end":{"line":27,"column":59,"offset":1619},"indent":[]}},{"type":"listItem","spread":false,"checked":null,"children":[{"type":"paragraph","children":[{"type":"inlineCode","value":"guild","position":{"start":{"line":28,"column":3,"offset":1622},"end":{"line":28,"column":10,"offset":1629},"indent":[]}},{"type":"text","value":": The server guild object where this command was ran.","position":{"start":{"line":28,"column":10,"offset":1629},"end":{"line":28,"column":63,"offset":1682},"indent":[]}}],"position":{"start":{"line":28,"column":3,"offset":1622},"end":{"line":28,"column":63,"offset":1682},"indent":[]}}],"position":{"start":{"line":28,"column":1,"offset":1620},"end":{"line":28,"column":63,"offset":1682},"indent":[]}}],"position":{"start":{"line":26,"column":1,"offset":1501},"end":{"line":28,"column":63,"offset":1682},"indent":[1,1]}},{"type":"heading","depth":2,"children":[{"type":"text","value":"Understanding How Inhibitors Function","position":{"start":{"line":30,"column":4,"offset":1687},"end":{"line":30,"column":41,"offset":1724},"indent":[]}}],"position":{"start":{"line":30,"column":1,"offset":1684},"end":{"line":30,"column":41,"offset":1724},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"To block a command you have to return a truthy value.","position":{"start":{"line":32,"column":1,"offset":1726},"end":{"line":32,"column":54,"offset":1779},"indent":[]}}],"position":{"start":{"line":32,"column":1,"offset":1726},"end":{"line":32,"column":54,"offset":1779},"indent":[]}},{"type":"list","ordered":false,"start":null,"spread":false,"children":[{"type":"listItem","spread":false,"checked":null,"children":[{"type":"paragraph","children":[{"type":"strong","children":[{"type":"text","value":"return true;","position":{"start":{"line":33,"column":5,"offset":1784},"end":{"line":33,"column":17,"offset":1796},"indent":[]}}],"position":{"start":{"line":33,"column":3,"offset":1782},"end":{"line":33,"column":19,"offset":1798},"indent":[]}},{"type":"text","value":" If you return true the inhibitor will block the execution of the command.\nTo allow a command return a falsey value.","position":{"start":{"line":33,"column":19,"offset":1798},"end":{"line":34,"column":42,"offset":1914},"indent":[1]}}],"position":{"start":{"line":33,"column":3,"offset":1782},"end":{"line":34,"column":42,"offset":1914},"indent":[1]}}],"position":{"start":{"line":33,"column":1,"offset":1780},"end":{"line":34,"column":42,"offset":1914},"indent":[1]}},{"type":"listItem","spread":false,"checked":null,"children":[{"type":"paragraph","children":[{"type":"strong","children":[{"type":"text","value":"return false;","position":{"start":{"line":35,"column":5,"offset":1919},"end":{"line":35,"column":18,"offset":1932},"indent":[]}}],"position":{"start":{"line":35,"column":3,"offset":1917},"end":{"line":35,"column":20,"offset":1934},"indent":[]}},{"type":"text","value":" If you return false the inhibitor will not block the error.","position":{"start":{"line":35,"column":20,"offset":1934},"end":{"line":35,"column":80,"offset":1994},"indent":[]}}],"position":{"start":{"line":35,"column":3,"offset":1917},"end":{"line":35,"column":80,"offset":1994},"indent":[]}}],"position":{"start":{"line":35,"column":1,"offset":1915},"end":{"line":35,"column":80,"offset":1994},"indent":[]}}],"position":{"start":{"line":33,"column":1,"offset":1780},"end":{"line":35,"column":80,"offset":1994},"indent":[1,1]}},{"type":"code","lang":"ts","meta":null,"value":"// If the command is not VIP only we can allow this command to execute\nif (!command.vipOnly) return false;\n\n// The bot's support server\nconst guild = cache.guilds.get(configs.supportServerID);\n// If the command author is not in the server they won't have the vip role\nconst member = guild.members.get(message.author.id) || await getMember(guild.id, message.author.id);\n// Member doesn't exist so cancel the command\nif (!member) {\n\tsendResponse(message, `sorry, but you can not use this command until you become VIP. **Close the IRIS!!!**`)\n\treturn true;\n}\n\n// If the user has the vip role on the support server given by patreon allow the command\nif (member.roles.includes(configs.roleIDs.patreonVIPRoleID)) return false;\n\n// Alert the user they don't have vip and can't use the command\nsendResponse(message, `sorry, but you can not use this command until you become a VIP. I'm sorry, Teal'c. We'll go to Disneyland next year. I promise.`)\n// Cancel the command since the user does not have vip\nreturn true;","position":{"start":{"line":38,"column":1,"offset":1997},"end":{"line":59,"column":4,"offset":3013},"indent":[1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1]}},{"type":"heading","depth":2,"children":[{"type":"text","value":"Updating Command Typings","position":{"start":{"line":61,"column":4,"offset":3018},"end":{"line":61,"column":28,"offset":3042},"indent":[]}}],"position":{"start":{"line":61,"column":1,"offset":3015},"end":{"line":61,"column":28,"offset":3042},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"Since we need a new option on our commands we need to add that. Open the `src/types/","position":{"start":{"line":63,"column":1,"offset":3044},"end":{"line":63,"column":85,"offset":3128},"indent":[]}}],"position":{"start":{"line":63,"column":1,"offset":3044},"end":{"line":63,"column":85,"offset":3128},"indent":[]}},{"type":"heading","depth":2,"children":[{"type":"text","value":"Challenges","position":{"start":{"line":65,"column":4,"offset":3133},"end":{"line":65,"column":14,"offset":3143},"indent":[]}}],"position":{"start":{"line":65,"column":1,"offset":3130},"end":{"line":65,"column":14,"offset":3143},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"Hell yes! We just got through the entire inhibitor section. You have now mastered everything related to inhibitors.","position":{"start":{"line":67,"column":1,"offset":3145},"end":{"line":67,"column":116,"offset":3260},"indent":[]}}],"position":{"start":{"line":67,"column":1,"offset":3145},"end":{"line":67,"column":116,"offset":3260},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"You can now try and get a little more practice with inhibitors by trying to challenge yourself and make your own inhibitors. Don't worry if you can't think of any good use cases for inhibitors.","position":{"start":{"line":69,"column":1,"offset":3262},"end":{"line":69,"column":194,"offset":3455},"indent":[]}}],"position":{"start":{"line":69,"column":1,"offset":3262},"end":{"line":69,"column":194,"offset":3455},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"Majority of Discordeno bots do not use many custom inhibitors because most of the necessary/important ones already come built for you in the inhibitors folder.","position":{"start":{"line":71,"column":1,"offset":3457},"end":{"line":71,"column":160,"offset":3616},"indent":[]}}],"position":{"start":{"line":71,"column":1,"offset":3457},"end":{"line":71,"column":160,"offset":3616},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"Next we will try our hands at creating a monitor.","position":{"start":{"line":73,"column":1,"offset":3618},"end":{"line":73,"column":50,"offset":3667},"indent":[]}}],"position":{"start":{"line":73,"column":1,"offset":3618},"end":{"line":73,"column":50,"offset":3667},"indent":[]}},{"type":"export","value":"export const _frontmatter = {\"title\":\"Creating Inhibitors!\",\"metaTitle\":\"Creating An Inhibitor | Discordeno\",\"metaDescription\":\"Let's create our very own bot with Discordeno!\"}","position":{"start":{"line":76,"column":1,"offset":3670},"end":{"line":76,"column":177,"offset":3846},"indent":[]}}],"position":{"start":{"line":1,"column":1,"offset":0},"end":{"line":76,"column":177,"offset":3846}}},"scopeImports":["import * as React from 'react'"],"scopeIdentifiers":["React"],"body":"function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }\n\nfunction _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }\n\nfunction _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }\n\n/* @jsx mdx */\nvar _frontmatter = {\n \"title\": \"Creating Inhibitors!\",\n \"metaTitle\": \"Creating An Inhibitor | Discordeno\",\n \"metaDescription\": \"Let's create our very own bot with Discordeno!\"\n};\nvar layoutProps = {\n _frontmatter: _frontmatter\n};\nvar MDXLayout = \"wrapper\";\nreturn function MDXContent(_ref) {\n var components = _ref.components,\n props = _objectWithoutProperties(_ref, [\"components\"]);\n\n return mdx(MDXLayout, _extends({}, layoutProps, props, {\n components: components,\n mdxType: \"MDXLayout\"\n }), mdx(\"p\", null, \"Woah! You are almost half way done with understanding all of Discordeno. Amazing isn't it? Something you may have noticed in the last section was there were some options that prevented some commands from running like \", mdx(\"inlineCode\", {\n parentName: \"p\"\n }, \"dmOnly\"), \" or the permission options. we created a setting to prevent the monitor from running in certain channels. What if we wanted to do prevent commands from happening? How would we prevent commands from running?\"), mdx(\"h2\", null, \"What is an Inhibitor?\"), mdx(\"p\", null, \"An Inhibitor is very similar to how monitors work. A monitor runs on every message but an inhibitor runs on every command. Remember all those command options like cooldown, permissions, permissionLevel, nsfw, etc... Each and every one of these options has an inhibitor in that checks commands for these settings.\"), mdx(\"p\", null, \"Let's create our own inhibitor that would prevent commands from being used if the user is not a VIP user.\"), mdx(\"blockquote\", null, mdx(\"p\", {\n parentName: \"blockquote\"\n }, mdx(\"strong\", {\n parentName: \"p\"\n }, \"Note:\"), \" It is important to remember that everything below can be done with a simple permission level as well. We will create our own custom permission levels but for the purposes of this guide and to be able to learn about Inhibitors, we will be using an inhibitor.\")), mdx(\"h2\", null, \"Creating the File\"), mdx(\"p\", null, \"Let's start by creating a file inside the inhibitors folder called \", mdx(\"inlineCode\", {\n parentName: \"p\"\n }, \"boosted.ts\"), \" and paste the following snippet of code:\"), mdx(\"pre\", null, mdx(\"code\", _extends({\n parentName: \"pre\"\n }, {\n \"className\": \"language-ts\"\n }), \"import { botCache } from \\\"../../mod.ts\\\";\\n\\nbotCache.inhibitors.set(\\\"inhibitorname\\\", async function (message, command, guild) {\\n // Your code goes here\\n});\\n\")), mdx(\"p\", null, \"Inhibitors can take up to 3 arguments.\"), mdx(\"ul\", null, mdx(\"li\", {\n parentName: \"ul\"\n }, mdx(\"inlineCode\", {\n parentName: \"li\"\n }, \"message\"), \": The message object that triggered the command.\"), mdx(\"li\", {\n parentName: \"ul\"\n }, mdx(\"inlineCode\", {\n parentName: \"li\"\n }, \"command\"), \": The command object itself that was triggered.\"), mdx(\"li\", {\n parentName: \"ul\"\n }, mdx(\"inlineCode\", {\n parentName: \"li\"\n }, \"guild\"), \": The server guild object where this command was ran.\")), mdx(\"h2\", null, \"Understanding How Inhibitors Function\"), mdx(\"p\", null, \"To block a command you have to return a truthy value.\"), mdx(\"ul\", null, mdx(\"li\", {\n parentName: \"ul\"\n }, mdx(\"strong\", {\n parentName: \"li\"\n }, \"return true;\"), \" If you return true the inhibitor will block the execution of the command.\\nTo allow a command return a falsey value.\"), mdx(\"li\", {\n parentName: \"ul\"\n }, mdx(\"strong\", {\n parentName: \"li\"\n }, \"return false;\"), \" If you return false the inhibitor will not block the error.\")), mdx(\"pre\", null, mdx(\"code\", _extends({\n parentName: \"pre\"\n }, {\n \"className\": \"language-ts\"\n }), \"// If the command is not VIP only we can allow this command to execute\\nif (!command.vipOnly) return false;\\n\\n// The bot's support server\\nconst guild = cache.guilds.get(configs.supportServerID);\\n// If the command author is not in the server they won't have the vip role\\nconst member = guild.members.get(message.author.id) || await getMember(guild.id, message.author.id);\\n// Member doesn't exist so cancel the command\\nif (!member) {\\n sendResponse(message, `sorry, but you can not use this command until you become VIP. **Close the IRIS!!!**`)\\n return true;\\n}\\n\\n// If the user has the vip role on the support server given by patreon allow the command\\nif (member.roles.includes(configs.roleIDs.patreonVIPRoleID)) return false;\\n\\n// Alert the user they don't have vip and can't use the command\\nsendResponse(message, `sorry, but you can not use this command until you become a VIP. I'm sorry, Teal'c. We'll go to Disneyland next year. I promise.`)\\n// Cancel the command since the user does not have vip\\nreturn true;\\n\")), mdx(\"h2\", null, \"Updating Command Typings\"), mdx(\"p\", null, \"Since we need a new option on our commands we need to add that. Open the `src/types/\"), mdx(\"h2\", null, \"Challenges\"), mdx(\"p\", null, \"Hell yes! We just got through the entire inhibitor section. You have now mastered everything related to inhibitors.\"), mdx(\"p\", null, \"You can now try and get a little more practice with inhibitors by trying to challenge yourself and make your own inhibitors. Don't worry if you can't think of any good use cases for inhibitors.\"), mdx(\"p\", null, \"Majority of Discordeno bots do not use many custom inhibitors because most of the necessary/important ones already come built for you in the inhibitors folder.\"), mdx(\"p\", null, \"Next we will try our hands at creating a monitor.\"));\n}\n;\nMDXContent.isMDXComponent = true;","rawMDXOutput":"/* @jsx mdx */\nimport { mdx } from '@mdx-js/react';\n/* @jsx mdx */\n\nexport const _frontmatter = {\n \"title\": \"Creating Inhibitors!\",\n \"metaTitle\": \"Creating An Inhibitor | Discordeno\",\n \"metaDescription\": \"Let's create our very own bot with Discordeno!\"\n};\n\nconst layoutProps = {\n _frontmatter\n};\nconst MDXLayout = \"wrapper\"\nexport default function MDXContent({\n components,\n ...props\n}) {\n return \n

{`Woah! You are almost half way done with understanding all of Discordeno. Amazing isn't it? Something you may have noticed in the last section was there were some options that prevented some commands from running like `}{`dmOnly`}{` or the permission options. we created a setting to prevent the monitor from running in certain channels. What if we wanted to do prevent commands from happening? How would we prevent commands from running?`}

\n

{`What is an Inhibitor?`}

\n

{`An Inhibitor is very similar to how monitors work. A monitor runs on every message but an inhibitor runs on every command. Remember all those command options like cooldown, permissions, permissionLevel, nsfw, etc... Each and every one of these options has an inhibitor in that checks commands for these settings.`}

\n

{`Let's create our own inhibitor that would prevent commands from being used if the user is not a VIP user.`}

\n
\n

{`Note:`}{` It is important to remember that everything below can be done with a simple permission level as well. We will create our own custom permission levels but for the purposes of this guide and to be able to learn about Inhibitors, we will be using an inhibitor.`}

\n
\n

{`Creating the File`}

\n

{`Let's start by creating a file inside the inhibitors folder called `}{`boosted.ts`}{` and paste the following snippet of code:`}

\n
{`import { botCache } from \"../../mod.ts\";\n\nbotCache.inhibitors.set(\"inhibitorname\", async function (message, command, guild) {\n    // Your code goes here\n});\n`}
\n

{`Inhibitors can take up to 3 arguments.`}

\n
    \n
  • {`message`}{`: The message object that triggered the command.`}
  • \n
  • {`command`}{`: The command object itself that was triggered.`}
  • \n
  • {`guild`}{`: The server guild object where this command was ran.`}
  • \n
\n

{`Understanding How Inhibitors Function`}

\n

{`To block a command you have to return a truthy value.`}

\n
    \n
  • {`return true;`}{` If you return true the inhibitor will block the execution of the command.\nTo allow a command return a falsey value.`}
  • \n
  • {`return false;`}{` If you return false the inhibitor will not block the error.`}
  • \n
\n
{`// If the command is not VIP only we can allow this command to execute\nif (!command.vipOnly) return false;\n\n// The bot's support server\nconst guild = cache.guilds.get(configs.supportServerID);\n// If the command author is not in the server they won't have the vip role\nconst member = guild.members.get(message.author.id) || await getMember(guild.id, message.author.id);\n// Member doesn't exist so cancel the command\nif (!member) {\n    sendResponse(message, \\`sorry, but you can not use this command until you become VIP. **Close the IRIS!!!**\\`)\n    return true;\n}\n\n// If the user has the vip role on the support server given by patreon allow the command\nif (member.roles.includes(configs.roleIDs.patreonVIPRoleID)) return false;\n\n// Alert the user they don't have vip and can't use the command\nsendResponse(message, \\`sorry, but you can not use this command until you become a VIP. I'm sorry, Teal'c. We'll go to Disneyland next year. I promise.\\`)\n// Cancel the command since the user does not have vip\nreturn true;\n`}
\n

{`Updating Command Typings`}

\n

{`Since we need a new option on our commands we need to add that. Open the \\`src/types/`}

\n

{`Challenges`}

\n

{`Hell yes! We just got through the entire inhibitor section. You have now mastered everything related to inhibitors.`}

\n

{`You can now try and get a little more practice with inhibitors by trying to challenge yourself and make your own inhibitors. Don't worry if you can't think of any good use cases for inhibitors.`}

\n

{`Majority of Discordeno bots do not use many custom inhibitors because most of the necessary/important ones already come built for you in the inhibitors folder.`}

\n

{`Next we will try our hands at creating a monitor.`}

\n\n
;\n}\n\n;\nMDXContent.isMDXComponent = true;"}} \ No newline at end of file diff --git a/docs/.cache/caches/gatsby-plugin-mdx/diskstore-1b75a1da0a207c608314560357c0ffcc.json b/docs/.cache/caches/gatsby-plugin-mdx/diskstore-1b75a1da0a207c608314560357c0ffcc.json new file mode 100644 index 000000000..f60293780 --- /dev/null +++ b/docs/.cache/caches/gatsby-plugin-mdx/diskstore-1b75a1da0a207c608314560357c0ffcc.json @@ -0,0 +1 @@ +{"expireTime":9007200851635148000,"key":"gatsby-plugin-mdx-entire-payload-e7dcf2991afc5b28cda57b28e5667c7b-","val":{"mdast":{"type":"root","children":[{"type":"paragraph","children":[{"type":"text","value":"Woah! You are almost half way done with understanding all of Discordeno. Amazing isn't it? Something you may have noticed in the last section was when the bot started up you could see a bunch of messages like ","position":{"start":{"line":2,"column":1,"offset":1},"end":{"line":2,"column":210,"offset":210},"indent":[]}},{"type":"inlineCode","value":"Loaded X Commands","position":{"start":{"line":2,"column":210,"offset":210},"end":{"line":2,"column":229,"offset":229},"indent":[]}},{"type":"text","value":" and such. Let's jump into this part now and understand how event handling works in Discordeno.","position":{"start":{"line":2,"column":229,"offset":229},"end":{"line":2,"column":324,"offset":324},"indent":[]}}],"position":{"start":{"line":2,"column":1,"offset":1},"end":{"line":2,"column":324,"offset":324},"indent":[]}},{"type":"heading","depth":2,"children":[{"type":"text","value":"What Is An Event?","position":{"start":{"line":4,"column":4,"offset":329},"end":{"line":4,"column":21,"offset":346},"indent":[]}}],"position":{"start":{"line":4,"column":1,"offset":326},"end":{"line":4,"column":21,"offset":346},"indent":[]}},{"type":"export","value":"export const _frontmatter = {\"title\":\"Creating Events!\",\"metaTitle\":\"Creating An Event | Discordeno\",\"metaDescription\":\"Let's create our very own bot with Discordeno!\"}","position":{"start":{"line":8,"column":1,"offset":350},"end":{"line":8,"column":169,"offset":518},"indent":[]}}],"position":{"start":{"line":1,"column":1,"offset":0},"end":{"line":8,"column":169,"offset":518}}},"scopeImports":["import * as React from 'react'"],"scopeIdentifiers":["React"],"body":"function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }\n\nfunction _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }\n\nfunction _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }\n\n/* @jsx mdx */\nvar _frontmatter = {\n \"title\": \"Creating Events!\",\n \"metaTitle\": \"Creating An Event | Discordeno\",\n \"metaDescription\": \"Let's create our very own bot with Discordeno!\"\n};\nvar layoutProps = {\n _frontmatter: _frontmatter\n};\nvar MDXLayout = \"wrapper\";\nreturn function MDXContent(_ref) {\n var components = _ref.components,\n props = _objectWithoutProperties(_ref, [\"components\"]);\n\n return mdx(MDXLayout, _extends({}, layoutProps, props, {\n components: components,\n mdxType: \"MDXLayout\"\n }), mdx(\"p\", null, \"Woah! You are almost half way done with understanding all of Discordeno. Amazing isn't it? Something you may have noticed in the last section was when the bot started up you could see a bunch of messages like \", mdx(\"inlineCode\", {\n parentName: \"p\"\n }, \"Loaded X Commands\"), \" and such. Let's jump into this part now and understand how event handling works in Discordeno.\"), mdx(\"h2\", null, \"What Is An Event?\"));\n}\n;\nMDXContent.isMDXComponent = true;","rawMDXOutput":"/* @jsx mdx */\nimport { mdx } from '@mdx-js/react';\n/* @jsx mdx */\n\nexport const _frontmatter = {\n \"title\": \"Creating Events!\",\n \"metaTitle\": \"Creating An Event | Discordeno\",\n \"metaDescription\": \"Let's create our very own bot with Discordeno!\"\n};\n\nconst layoutProps = {\n _frontmatter\n};\nconst MDXLayout = \"wrapper\"\nexport default function MDXContent({\n components,\n ...props\n}) {\n return \n

{`Woah! You are almost half way done with understanding all of Discordeno. Amazing isn't it? Something you may have noticed in the last section was when the bot started up you could see a bunch of messages like `}{`Loaded X Commands`}{` and such. Let's jump into this part now and understand how event handling works in Discordeno.`}

\n

{`What Is An Event?`}

\n\n
;\n}\n\n;\nMDXContent.isMDXComponent = true;"}} \ No newline at end of file diff --git a/docs/.cache/caches/gatsby-plugin-mdx/diskstore-1e05ce69417e6e39cf47210dff5c520a.json b/docs/.cache/caches/gatsby-plugin-mdx/diskstore-1e05ce69417e6e39cf47210dff5c520a.json new file mode 100644 index 000000000..1613d9a60 --- /dev/null +++ b/docs/.cache/caches/gatsby-plugin-mdx/diskstore-1e05ce69417e6e39cf47210dff5c520a.json @@ -0,0 +1 @@ +{"expireTime":9007200851634172000,"key":"gatsby-plugin-mdx-entire-payload-1cd53955ef6fbe241b67fa0941560f8a-","val":{"mdast":{"type":"root","children":[{"type":"paragraph","children":[{"type":"text","value":"Woah! You are almost half way done with understanding all of Discordeno. Amazing isn't it? Something you may have noticed in the last section was there were some options that prevented some commands from running like ","position":{"start":{"line":2,"column":1,"offset":1},"end":{"line":2,"column":218,"offset":218},"indent":[]}},{"type":"inlineCode","value":"dmOnly","position":{"start":{"line":2,"column":218,"offset":218},"end":{"line":2,"column":226,"offset":226},"indent":[]}},{"type":"text","value":" or the permission options. we created a setting to prevent the monitor from running in certain channels. What if we wanted to do prevent commands from happening? How would we prevent commands from running?","position":{"start":{"line":2,"column":226,"offset":226},"end":{"line":2,"column":432,"offset":432},"indent":[]}}],"position":{"start":{"line":2,"column":1,"offset":1},"end":{"line":2,"column":432,"offset":432},"indent":[]}},{"type":"heading","depth":2,"children":[{"type":"text","value":"What is an Inhibitor?","position":{"start":{"line":4,"column":4,"offset":437},"end":{"line":4,"column":25,"offset":458},"indent":[]}}],"position":{"start":{"line":4,"column":1,"offset":434},"end":{"line":4,"column":25,"offset":458},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"An Inhibitor is very similar to how monitors work. A monitor runs on every message but an inhibitor runs on every command. Remember all those command options like cooldown, permissions, permissionLevel, nsfw, etc... Each and every one of these options has an inhibitor in that checks commands for these settings.","position":{"start":{"line":6,"column":1,"offset":460},"end":{"line":6,"column":313,"offset":772},"indent":[]}}],"position":{"start":{"line":6,"column":1,"offset":460},"end":{"line":6,"column":313,"offset":772},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"Let's create our own inhibitor that would prevent commands from being used if the user is not a VIP user.","position":{"start":{"line":8,"column":1,"offset":774},"end":{"line":8,"column":106,"offset":879},"indent":[]}}],"position":{"start":{"line":8,"column":1,"offset":774},"end":{"line":8,"column":106,"offset":879},"indent":[]}},{"type":"blockquote","children":[{"type":"paragraph","children":[{"type":"strong","children":[{"type":"text","value":"Note:","position":{"start":{"line":10,"column":5,"offset":885},"end":{"line":10,"column":10,"offset":890},"indent":[]}}],"position":{"start":{"line":10,"column":3,"offset":883},"end":{"line":10,"column":12,"offset":892},"indent":[]}},{"type":"text","value":" It is important to remember that everything below can be done with a simple permission level as well. We will create our own custom permission levels but for the purposes of this guide and to be able to learn about Inhibitors, we will be using an inhibitor.","position":{"start":{"line":10,"column":12,"offset":892},"end":{"line":10,"column":270,"offset":1150},"indent":[]}}],"position":{"start":{"line":10,"column":3,"offset":883},"end":{"line":10,"column":270,"offset":1150},"indent":[]}}],"position":{"start":{"line":10,"column":1,"offset":881},"end":{"line":10,"column":270,"offset":1150},"indent":[]}},{"type":"heading","depth":2,"children":[{"type":"text","value":"Creating the File","position":{"start":{"line":12,"column":4,"offset":1155},"end":{"line":12,"column":21,"offset":1172},"indent":[]}}],"position":{"start":{"line":12,"column":1,"offset":1152},"end":{"line":12,"column":21,"offset":1172},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"Let's start by creating a file inside the inhibitors folder called ","position":{"start":{"line":14,"column":1,"offset":1174},"end":{"line":14,"column":68,"offset":1241},"indent":[]}},{"type":"inlineCode","value":"boosted.ts","position":{"start":{"line":14,"column":68,"offset":1241},"end":{"line":14,"column":80,"offset":1253},"indent":[]}},{"type":"text","value":" and paste the following snippet of code:","position":{"start":{"line":14,"column":80,"offset":1253},"end":{"line":14,"column":121,"offset":1294},"indent":[]}}],"position":{"start":{"line":14,"column":1,"offset":1174},"end":{"line":14,"column":121,"offset":1294},"indent":[]}},{"type":"code","lang":"ts","meta":null,"value":"import { botCache } from \"../../mod.ts\";\n\nbotCache.inhibitors.set(\"inhibitorname\", async function (message, command, guild) {\n\t// Your code goes here\n});","position":{"start":{"line":16,"column":1,"offset":1296},"end":{"line":22,"column":4,"offset":1459},"indent":[1,1,1,1,1,1]}},{"type":"paragraph","children":[{"type":"text","value":"Inhibitors can take up to 3 arguments.","position":{"start":{"line":24,"column":1,"offset":1461},"end":{"line":24,"column":39,"offset":1499},"indent":[]}}],"position":{"start":{"line":24,"column":1,"offset":1461},"end":{"line":24,"column":39,"offset":1499},"indent":[]}},{"type":"list","ordered":false,"start":null,"spread":false,"children":[{"type":"listItem","spread":false,"checked":null,"children":[{"type":"paragraph","children":[{"type":"inlineCode","value":"message","position":{"start":{"line":26,"column":3,"offset":1503},"end":{"line":26,"column":12,"offset":1512},"indent":[]}},{"type":"text","value":": The message object that triggered the command.","position":{"start":{"line":26,"column":12,"offset":1512},"end":{"line":26,"column":60,"offset":1560},"indent":[]}}],"position":{"start":{"line":26,"column":3,"offset":1503},"end":{"line":26,"column":60,"offset":1560},"indent":[]}}],"position":{"start":{"line":26,"column":1,"offset":1501},"end":{"line":26,"column":60,"offset":1560},"indent":[]}},{"type":"listItem","spread":false,"checked":null,"children":[{"type":"paragraph","children":[{"type":"inlineCode","value":"command","position":{"start":{"line":27,"column":3,"offset":1563},"end":{"line":27,"column":12,"offset":1572},"indent":[]}},{"type":"text","value":": The command object itself that was triggered.","position":{"start":{"line":27,"column":12,"offset":1572},"end":{"line":27,"column":59,"offset":1619},"indent":[]}}],"position":{"start":{"line":27,"column":3,"offset":1563},"end":{"line":27,"column":59,"offset":1619},"indent":[]}}],"position":{"start":{"line":27,"column":1,"offset":1561},"end":{"line":27,"column":59,"offset":1619},"indent":[]}},{"type":"listItem","spread":false,"checked":null,"children":[{"type":"paragraph","children":[{"type":"inlineCode","value":"guild","position":{"start":{"line":28,"column":3,"offset":1622},"end":{"line":28,"column":10,"offset":1629},"indent":[]}},{"type":"text","value":": The server guild object where this command was ran.","position":{"start":{"line":28,"column":10,"offset":1629},"end":{"line":28,"column":63,"offset":1682},"indent":[]}}],"position":{"start":{"line":28,"column":3,"offset":1622},"end":{"line":28,"column":63,"offset":1682},"indent":[]}}],"position":{"start":{"line":28,"column":1,"offset":1620},"end":{"line":28,"column":63,"offset":1682},"indent":[]}}],"position":{"start":{"line":26,"column":1,"offset":1501},"end":{"line":28,"column":63,"offset":1682},"indent":[1,1]}},{"type":"heading","depth":2,"children":[{"type":"text","value":"Understanding How Inhibitors Function","position":{"start":{"line":30,"column":4,"offset":1687},"end":{"line":30,"column":41,"offset":1724},"indent":[]}}],"position":{"start":{"line":30,"column":1,"offset":1684},"end":{"line":30,"column":41,"offset":1724},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"To block a command you have to return a truthy value.","position":{"start":{"line":32,"column":1,"offset":1726},"end":{"line":32,"column":54,"offset":1779},"indent":[]}}],"position":{"start":{"line":32,"column":1,"offset":1726},"end":{"line":32,"column":54,"offset":1779},"indent":[]}},{"type":"list","ordered":false,"start":null,"spread":false,"children":[{"type":"listItem","spread":false,"checked":null,"children":[{"type":"paragraph","children":[{"type":"strong","children":[{"type":"text","value":"return true;","position":{"start":{"line":33,"column":5,"offset":1784},"end":{"line":33,"column":17,"offset":1796},"indent":[]}}],"position":{"start":{"line":33,"column":3,"offset":1782},"end":{"line":33,"column":19,"offset":1798},"indent":[]}},{"type":"text","value":" If you return true the inhibitor will block the execution of the command.\nTo allow a command return a falsey value.","position":{"start":{"line":33,"column":19,"offset":1798},"end":{"line":34,"column":42,"offset":1914},"indent":[1]}}],"position":{"start":{"line":33,"column":3,"offset":1782},"end":{"line":34,"column":42,"offset":1914},"indent":[1]}}],"position":{"start":{"line":33,"column":1,"offset":1780},"end":{"line":34,"column":42,"offset":1914},"indent":[1]}},{"type":"listItem","spread":false,"checked":null,"children":[{"type":"paragraph","children":[{"type":"strong","children":[{"type":"text","value":"return false;","position":{"start":{"line":35,"column":5,"offset":1919},"end":{"line":35,"column":18,"offset":1932},"indent":[]}}],"position":{"start":{"line":35,"column":3,"offset":1917},"end":{"line":35,"column":20,"offset":1934},"indent":[]}},{"type":"text","value":" If you return false the inhibitor will not block the error.","position":{"start":{"line":35,"column":20,"offset":1934},"end":{"line":35,"column":80,"offset":1994},"indent":[]}}],"position":{"start":{"line":35,"column":3,"offset":1917},"end":{"line":35,"column":80,"offset":1994},"indent":[]}}],"position":{"start":{"line":35,"column":1,"offset":1915},"end":{"line":35,"column":80,"offset":1994},"indent":[]}}],"position":{"start":{"line":33,"column":1,"offset":1780},"end":{"line":35,"column":80,"offset":1994},"indent":[1,1]}},{"type":"code","lang":"ts","meta":null,"value":"// If the command is not VIP only we can allow this command to execute\nif (!command.vipOnly) return false;\n\n// The bot's support server\nconst guild = cache.guilds.get(configs.supportServerID);\n// If the command author is not in the server they won't have the vip role so cancel the command\nconst member = guild.members.get(message.author.id);\n\n// Check if the user has the vip role on the support server given by patreon\nconst userIsVIP = await isUserVIP(message.author.id)\n// The user is VIP so we can allow this command to be used\nif (userIsVIP) return false;\n\n// The user is NOT VIP so we throw an error\nthrow `The ${command.name} is only allowed for VIP users.`","position":{"start":{"line":38,"column":1,"offset":1997},"end":{"line":54,"column":4,"offset":2672},"indent":[1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1]}},{"type":"export","value":"export const _frontmatter = {\"title\":\"Creating Inhibitors!\",\"metaTitle\":\"Creating An Inhibitor | Discordeno\",\"metaDescription\":\"Let's create our very own bot with Discordeno!\"}","position":{"start":{"line":57,"column":1,"offset":2675},"end":{"line":57,"column":177,"offset":2851},"indent":[]}}],"position":{"start":{"line":1,"column":1,"offset":0},"end":{"line":57,"column":177,"offset":2851}}},"scopeImports":["import * as React from 'react'"],"scopeIdentifiers":["React"],"body":"function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }\n\nfunction _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }\n\nfunction _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }\n\n/* @jsx mdx */\nvar _frontmatter = {\n \"title\": \"Creating Inhibitors!\",\n \"metaTitle\": \"Creating An Inhibitor | Discordeno\",\n \"metaDescription\": \"Let's create our very own bot with Discordeno!\"\n};\nvar layoutProps = {\n _frontmatter: _frontmatter\n};\nvar MDXLayout = \"wrapper\";\nreturn function MDXContent(_ref) {\n var components = _ref.components,\n props = _objectWithoutProperties(_ref, [\"components\"]);\n\n return mdx(MDXLayout, _extends({}, layoutProps, props, {\n components: components,\n mdxType: \"MDXLayout\"\n }), mdx(\"p\", null, \"Woah! You are almost half way done with understanding all of Discordeno. Amazing isn't it? Something you may have noticed in the last section was there were some options that prevented some commands from running like \", mdx(\"inlineCode\", {\n parentName: \"p\"\n }, \"dmOnly\"), \" or the permission options. we created a setting to prevent the monitor from running in certain channels. What if we wanted to do prevent commands from happening? How would we prevent commands from running?\"), mdx(\"h2\", null, \"What is an Inhibitor?\"), mdx(\"p\", null, \"An Inhibitor is very similar to how monitors work. A monitor runs on every message but an inhibitor runs on every command. Remember all those command options like cooldown, permissions, permissionLevel, nsfw, etc... Each and every one of these options has an inhibitor in that checks commands for these settings.\"), mdx(\"p\", null, \"Let's create our own inhibitor that would prevent commands from being used if the user is not a VIP user.\"), mdx(\"blockquote\", null, mdx(\"p\", {\n parentName: \"blockquote\"\n }, mdx(\"strong\", {\n parentName: \"p\"\n }, \"Note:\"), \" It is important to remember that everything below can be done with a simple permission level as well. We will create our own custom permission levels but for the purposes of this guide and to be able to learn about Inhibitors, we will be using an inhibitor.\")), mdx(\"h2\", null, \"Creating the File\"), mdx(\"p\", null, \"Let's start by creating a file inside the inhibitors folder called \", mdx(\"inlineCode\", {\n parentName: \"p\"\n }, \"boosted.ts\"), \" and paste the following snippet of code:\"), mdx(\"pre\", null, mdx(\"code\", _extends({\n parentName: \"pre\"\n }, {\n \"className\": \"language-ts\"\n }), \"import { botCache } from \\\"../../mod.ts\\\";\\n\\nbotCache.inhibitors.set(\\\"inhibitorname\\\", async function (message, command, guild) {\\n // Your code goes here\\n});\\n\")), mdx(\"p\", null, \"Inhibitors can take up to 3 arguments.\"), mdx(\"ul\", null, mdx(\"li\", {\n parentName: \"ul\"\n }, mdx(\"inlineCode\", {\n parentName: \"li\"\n }, \"message\"), \": The message object that triggered the command.\"), mdx(\"li\", {\n parentName: \"ul\"\n }, mdx(\"inlineCode\", {\n parentName: \"li\"\n }, \"command\"), \": The command object itself that was triggered.\"), mdx(\"li\", {\n parentName: \"ul\"\n }, mdx(\"inlineCode\", {\n parentName: \"li\"\n }, \"guild\"), \": The server guild object where this command was ran.\")), mdx(\"h2\", null, \"Understanding How Inhibitors Function\"), mdx(\"p\", null, \"To block a command you have to return a truthy value.\"), mdx(\"ul\", null, mdx(\"li\", {\n parentName: \"ul\"\n }, mdx(\"strong\", {\n parentName: \"li\"\n }, \"return true;\"), \" If you return true the inhibitor will block the execution of the command.\\nTo allow a command return a falsey value.\"), mdx(\"li\", {\n parentName: \"ul\"\n }, mdx(\"strong\", {\n parentName: \"li\"\n }, \"return false;\"), \" If you return false the inhibitor will not block the error.\")), mdx(\"pre\", null, mdx(\"code\", _extends({\n parentName: \"pre\"\n }, {\n \"className\": \"language-ts\"\n }), \"// If the command is not VIP only we can allow this command to execute\\nif (!command.vipOnly) return false;\\n\\n// The bot's support server\\nconst guild = cache.guilds.get(configs.supportServerID);\\n// If the command author is not in the server they won't have the vip role so cancel the command\\nconst member = guild.members.get(message.author.id);\\n\\n// Check if the user has the vip role on the support server given by patreon\\nconst userIsVIP = await isUserVIP(message.author.id)\\n// The user is VIP so we can allow this command to be used\\nif (userIsVIP) return false;\\n\\n// The user is NOT VIP so we throw an error\\nthrow `The ${command.name} is only allowed for VIP users.`\\n\")));\n}\n;\nMDXContent.isMDXComponent = true;","rawMDXOutput":"/* @jsx mdx */\nimport { mdx } from '@mdx-js/react';\n/* @jsx mdx */\n\nexport const _frontmatter = {\n \"title\": \"Creating Inhibitors!\",\n \"metaTitle\": \"Creating An Inhibitor | Discordeno\",\n \"metaDescription\": \"Let's create our very own bot with Discordeno!\"\n};\n\nconst layoutProps = {\n _frontmatter\n};\nconst MDXLayout = \"wrapper\"\nexport default function MDXContent({\n components,\n ...props\n}) {\n return \n

{`Woah! You are almost half way done with understanding all of Discordeno. Amazing isn't it? Something you may have noticed in the last section was there were some options that prevented some commands from running like `}{`dmOnly`}{` or the permission options. we created a setting to prevent the monitor from running in certain channels. What if we wanted to do prevent commands from happening? How would we prevent commands from running?`}

\n

{`What is an Inhibitor?`}

\n

{`An Inhibitor is very similar to how monitors work. A monitor runs on every message but an inhibitor runs on every command. Remember all those command options like cooldown, permissions, permissionLevel, nsfw, etc... Each and every one of these options has an inhibitor in that checks commands for these settings.`}

\n

{`Let's create our own inhibitor that would prevent commands from being used if the user is not a VIP user.`}

\n
\n

{`Note:`}{` It is important to remember that everything below can be done with a simple permission level as well. We will create our own custom permission levels but for the purposes of this guide and to be able to learn about Inhibitors, we will be using an inhibitor.`}

\n
\n

{`Creating the File`}

\n

{`Let's start by creating a file inside the inhibitors folder called `}{`boosted.ts`}{` and paste the following snippet of code:`}

\n
{`import { botCache } from \"../../mod.ts\";\n\nbotCache.inhibitors.set(\"inhibitorname\", async function (message, command, guild) {\n    // Your code goes here\n});\n`}
\n

{`Inhibitors can take up to 3 arguments.`}

\n
    \n
  • {`message`}{`: The message object that triggered the command.`}
  • \n
  • {`command`}{`: The command object itself that was triggered.`}
  • \n
  • {`guild`}{`: The server guild object where this command was ran.`}
  • \n
\n

{`Understanding How Inhibitors Function`}

\n

{`To block a command you have to return a truthy value.`}

\n
    \n
  • {`return true;`}{` If you return true the inhibitor will block the execution of the command.\nTo allow a command return a falsey value.`}
  • \n
  • {`return false;`}{` If you return false the inhibitor will not block the error.`}
  • \n
\n
{`// If the command is not VIP only we can allow this command to execute\nif (!command.vipOnly) return false;\n\n// The bot's support server\nconst guild = cache.guilds.get(configs.supportServerID);\n// If the command author is not in the server they won't have the vip role so cancel the command\nconst member = guild.members.get(message.author.id);\n\n// Check if the user has the vip role on the support server given by patreon\nconst userIsVIP = await isUserVIP(message.author.id)\n// The user is VIP so we can allow this command to be used\nif (userIsVIP) return false;\n\n// The user is NOT VIP so we throw an error\nthrow \\`The \\${command.name} is only allowed for VIP users.\\`\n`}
\n\n
;\n}\n\n;\nMDXContent.isMDXComponent = true;"}} \ No newline at end of file diff --git a/docs/.cache/caches/gatsby-plugin-mdx/diskstore-1ecfdc79509821bb67ad0139242eb020.json b/docs/.cache/caches/gatsby-plugin-mdx/diskstore-1ecfdc79509821bb67ad0139242eb020.json new file mode 100644 index 000000000..b7e5003b5 --- /dev/null +++ b/docs/.cache/caches/gatsby-plugin-mdx/diskstore-1ecfdc79509821bb67ad0139242eb020.json @@ -0,0 +1 @@ +{"expireTime":9007200851644229000,"key":"gatsby-plugin-mdx-entire-payload-919428613e8f0f3b7cbade8d094599ad-","val":{"mdast":{"type":"root","children":[{"type":"paragraph","children":[{"type":"text","value":"Discordeno will help make Discord bot development much easier. Don't worry, as you go through this guide it will make a lot more sense.","position":{"start":{"line":2,"column":1,"offset":1},"end":{"line":2,"column":136,"offset":136},"indent":[]}}],"position":{"start":{"line":2,"column":1,"offset":1},"end":{"line":2,"column":136,"offset":136},"indent":[]}},{"type":"heading","depth":2,"children":[{"type":"text","value":"Creating The Bot!","position":{"start":{"line":4,"column":4,"offset":141},"end":{"line":4,"column":21,"offset":158},"indent":[]}}],"position":{"start":{"line":4,"column":1,"offset":138},"end":{"line":4,"column":21,"offset":158},"indent":[]}},{"type":"blockquote","children":[{"type":"paragraph","children":[{"type":"text","value":"This guide is going to assume you already have the basic requirements to make a bot ready. This includes github, git, a code editor like Visual Studio Code. If you don't have these yet please prepare them first before going forward.","position":{"start":{"line":6,"column":3,"offset":162},"end":{"line":6,"column":235,"offset":394},"indent":[]}}],"position":{"start":{"line":6,"column":3,"offset":162},"end":{"line":6,"column":235,"offset":394},"indent":[]}}],"position":{"start":{"line":6,"column":1,"offset":160},"end":{"line":6,"column":235,"offset":394},"indent":[]}},{"type":"list","ordered":false,"start":null,"spread":true,"children":[{"type":"listItem","spread":false,"checked":null,"children":[{"type":"paragraph","children":[{"type":"text","value":"First, create a Discordeno Bot using the ","position":{"start":{"line":8,"column":3,"offset":398},"end":{"line":8,"column":44,"offset":439},"indent":[]}},{"type":"link","title":null,"url":"https://github.com/Skillz4Killz/Discordeno-bot-template","children":[{"type":"text","value":"Generator Boilerplate","position":{"start":{"line":8,"column":45,"offset":440},"end":{"line":8,"column":66,"offset":461},"indent":[]}}],"position":{"start":{"line":8,"column":44,"offset":439},"end":{"line":8,"column":124,"offset":519},"indent":[]}},{"type":"text","value":". Give it any name you like. For the purpose of this guide we will call it, Stargate.","position":{"start":{"line":8,"column":124,"offset":519},"end":{"line":8,"column":209,"offset":604},"indent":[]}}],"position":{"start":{"line":8,"column":3,"offset":398},"end":{"line":8,"column":209,"offset":604},"indent":[]}}],"position":{"start":{"line":8,"column":1,"offset":396},"end":{"line":9,"column":1,"offset":605},"indent":[1]}},{"type":"listItem","spread":false,"checked":null,"children":[{"type":"paragraph","children":[{"type":"text","value":"Then ","position":{"start":{"line":10,"column":3,"offset":608},"end":{"line":10,"column":8,"offset":613},"indent":[]}},{"type":"inlineCode","value":"git clone https://github.com/Skillz4Killz/Stargate.git","position":{"start":{"line":10,"column":8,"offset":613},"end":{"line":10,"column":64,"offset":669},"indent":[]}}],"position":{"start":{"line":10,"column":3,"offset":608},"end":{"line":10,"column":64,"offset":669},"indent":[]}}],"position":{"start":{"line":10,"column":1,"offset":606},"end":{"line":11,"column":1,"offset":670},"indent":[1]}},{"type":"listItem","spread":false,"checked":null,"children":[{"type":"paragraph","children":[{"type":"text","value":"When that is done, go ahead and open up the folder with VSC.","position":{"start":{"line":12,"column":3,"offset":673},"end":{"line":12,"column":63,"offset":733},"indent":[]}}],"position":{"start":{"line":12,"column":3,"offset":673},"end":{"line":12,"column":63,"offset":733},"indent":[]}}],"position":{"start":{"line":12,"column":1,"offset":671},"end":{"line":12,"column":63,"offset":733},"indent":[]}},{"type":"listItem","spread":false,"checked":null,"children":[{"type":"paragraph","children":[{"type":"text","value":"Create a new file called ","position":{"start":{"line":13,"column":3,"offset":736},"end":{"line":13,"column":28,"offset":761},"indent":[]}},{"type":"inlineCode","value":"configs.ts","position":{"start":{"line":13,"column":28,"offset":761},"end":{"line":13,"column":40,"offset":773},"indent":[]}},{"type":"text","value":". Open the ","position":{"start":{"line":13,"column":40,"offset":773},"end":{"line":13,"column":51,"offset":784},"indent":[]}},{"type":"inlineCode","value":"configs.example.ts","position":{"start":{"line":13,"column":51,"offset":784},"end":{"line":13,"column":71,"offset":804},"indent":[]}},{"type":"text","value":" file and copy everything over.","position":{"start":{"line":13,"column":71,"offset":804},"end":{"line":13,"column":102,"offset":835},"indent":[]}}],"position":{"start":{"line":13,"column":3,"offset":736},"end":{"line":13,"column":102,"offset":835},"indent":[]}}],"position":{"start":{"line":13,"column":1,"offset":734},"end":{"line":13,"column":102,"offset":835},"indent":[]}}],"position":{"start":{"line":8,"column":1,"offset":396},"end":{"line":13,"column":102,"offset":835},"indent":[1,1,1,1,1]}},{"type":"paragraph","children":[{"type":"text","value":"Let's take a minute to review all the options we have available to us.","position":{"start":{"line":15,"column":1,"offset":837},"end":{"line":15,"column":71,"offset":907},"indent":[]}}],"position":{"start":{"line":15,"column":1,"offset":837},"end":{"line":15,"column":71,"offset":907},"indent":[]}},{"type":"heading","depth":3,"children":[{"type":"text","value":"Configs File","position":{"start":{"line":17,"column":5,"offset":913},"end":{"line":17,"column":17,"offset":925},"indent":[]}}],"position":{"start":{"line":17,"column":1,"offset":909},"end":{"line":17,"column":17,"offset":925},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"The ","position":{"start":{"line":19,"column":1,"offset":927},"end":{"line":19,"column":5,"offset":931},"indent":[]}},{"type":"inlineCode","value":"configs.ts","position":{"start":{"line":19,"column":5,"offset":931},"end":{"line":19,"column":17,"offset":943},"indent":[]}},{"type":"text","value":" file is where you will keep all your secret info you don't want to share with anyone else. As long as ","position":{"start":{"line":19,"column":17,"offset":943},"end":{"line":19,"column":120,"offset":1046},"indent":[]}},{"type":"inlineCode","value":".gitignore","position":{"start":{"line":19,"column":120,"offset":1046},"end":{"line":19,"column":132,"offset":1058},"indent":[]}},{"type":"text","value":" file is ignoring configs.ts your configurations will be kept private!","position":{"start":{"line":19,"column":132,"offset":1058},"end":{"line":19,"column":202,"offset":1128},"indent":[]}}],"position":{"start":{"line":19,"column":1,"offset":927},"end":{"line":19,"column":202,"offset":1128},"indent":[]}},{"type":"code","lang":"ts","meta":null,"value":"// Step 1: Remove the `.example` from this file name so it is called `configs.ts`\n// Step 2: Add all your bot's information below. The only required one is token and prefix. NOTE: As long as `.gitignore` file is ignoring configs.ts your configurations will be kept private!\n// Step 3: Remove these comments if you like.\n\nexport const configs = {\n // Your bot token goes here\n token: \"\",\n // The default prefix for your bot. Don't worry guilds can change this later.\n prefix: \"!\",\n // This isn't required but you can add bot list api keys here.\n botListTokens: {\n DISCORD_BOT_ORG: \"\",\n BOTS_ON_DISCORD: \"\",\n DISCORD_BOT_LIST: \"\",\n BOTS_FOR_DISCORD: \"\",\n DISCORD_BOATS: \"\",\n DISCORD_BOTS_GG: \"\",\n DISCORD_BOTS_GROUP: \"\",\n },\n // This is the server id for your bot's main server where users can get help/support\n supportServerID: \"\",\n // These are channel ids that will enable some functionality\n channelIDs: {\n // When a translation is missing this is the channel you will be alerted in.\n missingTranslation: \"\",\n // When an error occurs, we will try and log it to this channel\n errorChannelID: \"\"\n },\n // These are the role ids that will enable some functionality.\n roleIDs: {\n // If you have a patreon set up you can add the patreon vip role id here.\n patreonVIPRoleID: \"\",\n },\n // These are the user ids that will enable some functionality.\n userIDs: {\n // The user ids for the support team\n botSupporters: [],\n // The user ids for the other devs on your team\n botDevs: [],\n // The user ids who have complete 100% access to your bot\n botOwners: []\n }\n};\n","position":{"start":{"line":21,"column":1,"offset":1130},"end":{"line":66,"column":4,"offset":2770},"indent":[1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1]}},{"type":"heading","depth":4,"children":[{"type":"text","value":"Token","position":{"start":{"line":68,"column":6,"offset":2777},"end":{"line":68,"column":11,"offset":2782},"indent":[]}}],"position":{"start":{"line":68,"column":1,"offset":2772},"end":{"line":68,"column":11,"offset":2782},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"First, add your bot token. This is ","position":{"start":{"line":70,"column":1,"offset":2784},"end":{"line":70,"column":36,"offset":2819},"indent":[]}},{"type":"strong","children":[{"type":"text","value":"required","position":{"start":{"line":70,"column":38,"offset":2821},"end":{"line":70,"column":46,"offset":2829},"indent":[]}}],"position":{"start":{"line":70,"column":36,"offset":2819},"end":{"line":70,"column":48,"offset":2831},"indent":[]}},{"type":"text","value":" for the bot to start. Review the ","position":{"start":{"line":70,"column":48,"offset":2831},"end":{"line":70,"column":82,"offset":2865},"indent":[]}},{"type":"link","title":null,"url":"https://discordeno.netlify.app/gettingstarted#creatingyourfirstdiscordbotapplication","children":[{"type":"text","value":"instructions","position":{"start":{"line":70,"column":83,"offset":2866},"end":{"line":70,"column":95,"offset":2878},"indent":[]}}],"position":{"start":{"line":70,"column":82,"offset":2865},"end":{"line":70,"column":182,"offset":2965},"indent":[]}},{"type":"text","value":" if you have not made your token yet.","position":{"start":{"line":70,"column":182,"offset":2965},"end":{"line":70,"column":219,"offset":3002},"indent":[]}}],"position":{"start":{"line":70,"column":1,"offset":2784},"end":{"line":70,"column":219,"offset":3002},"indent":[]}},{"type":"heading","depth":4,"children":[{"type":"text","value":"Prefix","position":{"start":{"line":72,"column":6,"offset":3009},"end":{"line":72,"column":12,"offset":3015},"indent":[]}}],"position":{"start":{"line":72,"column":1,"offset":3004},"end":{"line":72,"column":12,"offset":3015},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"The prefix is where you will set the default prefix for your bot. Don't worry, every server will be able to choose their own prefix but we need a default prefix to start.","position":{"start":{"line":74,"column":1,"offset":3017},"end":{"line":74,"column":171,"offset":3187},"indent":[]}}],"position":{"start":{"line":74,"column":1,"offset":3017},"end":{"line":74,"column":171,"offset":3187},"indent":[]}},{"type":"heading","depth":4,"children":[{"type":"text","value":"Bot Lists Tokens","position":{"start":{"line":76,"column":6,"offset":3194},"end":{"line":76,"column":22,"offset":3210},"indent":[]}}],"position":{"start":{"line":76,"column":1,"offset":3189},"end":{"line":76,"column":22,"offset":3210},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"This section of the file is so you can easily have your bot's statistics updated on all the bot lists out there to help you grow your bot. The code is already written to handle this but you will need to do 3 things for each bot list.","position":{"start":{"line":78,"column":1,"offset":3212},"end":{"line":78,"column":234,"offset":3445},"indent":[]}}],"position":{"start":{"line":78,"column":1,"offset":3212},"end":{"line":78,"column":234,"offset":3445},"indent":[]}},{"type":"list","ordered":true,"start":1,"spread":false,"children":[{"type":"listItem","spread":false,"checked":null,"children":[{"type":"paragraph","children":[{"type":"text","value":"Go to the bot list and add your bot to their website. (Each site has it's own instructions)","position":{"start":{"line":80,"column":4,"offset":3450},"end":{"line":80,"column":95,"offset":3541},"indent":[]}}],"position":{"start":{"line":80,"column":4,"offset":3450},"end":{"line":80,"column":95,"offset":3541},"indent":[]}}],"position":{"start":{"line":80,"column":1,"offset":3447},"end":{"line":80,"column":95,"offset":3541},"indent":[]}},{"type":"listItem","spread":false,"checked":null,"children":[{"type":"paragraph","children":[{"type":"text","value":"Create a token for yourself on each website and paste it in your configs.","position":{"start":{"line":81,"column":4,"offset":3545},"end":{"line":81,"column":77,"offset":3618},"indent":[]}}],"position":{"start":{"line":81,"column":4,"offset":3545},"end":{"line":81,"column":77,"offset":3618},"indent":[]}}],"position":{"start":{"line":81,"column":1,"offset":3542},"end":{"line":81,"column":77,"offset":3618},"indent":[]}},{"type":"listItem","spread":false,"checked":null,"children":[{"type":"paragraph","children":[{"type":"text","value":"Enjoy!","position":{"start":{"line":82,"column":4,"offset":3622},"end":{"line":82,"column":10,"offset":3628},"indent":[]}}],"position":{"start":{"line":82,"column":4,"offset":3622},"end":{"line":82,"column":10,"offset":3628},"indent":[]}}],"position":{"start":{"line":82,"column":1,"offset":3619},"end":{"line":82,"column":10,"offset":3628},"indent":[]}}],"position":{"start":{"line":80,"column":1,"offset":3447},"end":{"line":82,"column":10,"offset":3628},"indent":[1,1]}},{"type":"paragraph","children":[{"type":"text","value":"If you wish to customize the code, you will find the bot list tasks in the tasks folder. Don't worry we will discuss this when we get to the tasks section of the guide.","position":{"start":{"line":84,"column":1,"offset":3630},"end":{"line":84,"column":169,"offset":3798},"indent":[]}}],"position":{"start":{"line":84,"column":1,"offset":3630},"end":{"line":84,"column":169,"offset":3798},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"For now just remember, that Discordeno provides you a built in way to update most discord bot lists.","position":{"start":{"line":86,"column":1,"offset":3800},"end":{"line":86,"column":101,"offset":3900},"indent":[]}}],"position":{"start":{"line":86,"column":1,"offset":3800},"end":{"line":86,"column":101,"offset":3900},"indent":[]}},{"type":"heading","depth":4,"children":[{"type":"text","value":"Channel IDs","position":{"start":{"line":88,"column":6,"offset":3907},"end":{"line":88,"column":17,"offset":3918},"indent":[]}}],"position":{"start":{"line":88,"column":1,"offset":3902},"end":{"line":88,"column":17,"offset":3918},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"The channelIDs section holds the channel IDs that are useful for specific features to help give you alerts/notifications. For example, the ","position":{"start":{"line":90,"column":1,"offset":3920},"end":{"line":90,"column":140,"offset":4059},"indent":[]}},{"type":"inlineCode","value":"missingTranslation","position":{"start":{"line":90,"column":140,"offset":4059},"end":{"line":90,"column":160,"offset":4079},"indent":[]}},{"type":"text","value":" channel will be where messages are sent alerting you that somewhere in your code you are trying to use a translation key that you never created.","position":{"start":{"line":90,"column":160,"offset":4079},"end":{"line":90,"column":305,"offset":4224},"indent":[]}}],"position":{"start":{"line":90,"column":1,"offset":3920},"end":{"line":90,"column":305,"offset":4224},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"When you get to around 25,000 Discord servers on your bot, you may want to convert these channel IDs to webhooks.","position":{"start":{"line":92,"column":1,"offset":4226},"end":{"line":92,"column":114,"offset":4339},"indent":[]}}],"position":{"start":{"line":92,"column":1,"offset":4226},"end":{"line":92,"column":114,"offset":4339},"indent":[]}},{"type":"heading","depth":4,"children":[{"type":"text","value":"Role IDs","position":{"start":{"line":94,"column":6,"offset":4346},"end":{"line":94,"column":14,"offset":4354},"indent":[]}}],"position":{"start":{"line":94,"column":1,"offset":4341},"end":{"line":94,"column":14,"offset":4354},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"The roleIDs section holds the role IDs that are useful for specific features. For example, the ","position":{"start":{"line":96,"column":1,"offset":4356},"end":{"line":96,"column":96,"offset":4451},"indent":[]}},{"type":"inlineCode","value":"patreonVIPRoleID","position":{"start":{"line":96,"column":96,"offset":4451},"end":{"line":96,"column":114,"offset":4469},"indent":[]}},{"type":"text","value":" channel will be where messages are sent alerting you that somewhere in your code you are trying to use a translation key that you never created.","position":{"start":{"line":96,"column":114,"offset":4469},"end":{"line":96,"column":259,"offset":4614},"indent":[]}}],"position":{"start":{"line":96,"column":1,"offset":4356},"end":{"line":96,"column":259,"offset":4614},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"When you get to around 25,000 Discord servers on your bot, you may want to convert these channel IDs to webhooks.","position":{"start":{"line":98,"column":1,"offset":4616},"end":{"line":98,"column":114,"offset":4729},"indent":[]}}],"position":{"start":{"line":98,"column":1,"offset":4616},"end":{"line":98,"column":114,"offset":4729},"indent":[]}},{"type":"heading","depth":2,"children":[{"type":"text","value":"It's Alive!","position":{"start":{"line":100,"column":4,"offset":4734},"end":{"line":100,"column":15,"offset":4745},"indent":[]}}],"position":{"start":{"line":100,"column":1,"offset":4731},"end":{"line":100,"column":15,"offset":4745},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"Oh my god! You now have a bot with a bunch of features already! You don't believe me? Well, seeing is believing, so start the bot.","position":{"start":{"line":102,"column":1,"offset":4747},"end":{"line":102,"column":131,"offset":4877},"indent":[]}}],"position":{"start":{"line":102,"column":1,"offset":4747},"end":{"line":102,"column":131,"offset":4877},"indent":[]}},{"type":"list","ordered":true,"start":1,"spread":false,"children":[{"type":"listItem","spread":false,"checked":null,"children":[{"type":"paragraph","children":[{"type":"text","value":"Invite your bot to a discord server.","position":{"start":{"line":104,"column":4,"offset":4882},"end":{"line":104,"column":40,"offset":4918},"indent":[]}}],"position":{"start":{"line":104,"column":4,"offset":4882},"end":{"line":104,"column":40,"offset":4918},"indent":[]}}],"position":{"start":{"line":104,"column":1,"offset":4879},"end":{"line":104,"column":40,"offset":4918},"indent":[]}},{"type":"listItem","spread":false,"checked":null,"children":[{"type":"paragraph","children":[{"type":"text","value":"Open up the integrated terminal in VSC using ","position":{"start":{"line":105,"column":4,"offset":4922},"end":{"line":105,"column":49,"offset":4967},"indent":[]}},{"type":"strong","children":[{"type":"text","value":"CTRL + `","position":{"start":{"line":105,"column":51,"offset":4969},"end":{"line":105,"column":59,"offset":4977},"indent":[]}}],"position":{"start":{"line":105,"column":49,"offset":4967},"end":{"line":105,"column":61,"offset":4979},"indent":[]}},{"type":"text","value":". If you use a Mac, replace CTRL with CMD.","position":{"start":{"line":105,"column":61,"offset":4979},"end":{"line":105,"column":103,"offset":5021},"indent":[]}}],"position":{"start":{"line":105,"column":4,"offset":4922},"end":{"line":105,"column":103,"offset":5021},"indent":[]}}],"position":{"start":{"line":105,"column":1,"offset":4919},"end":{"line":105,"column":103,"offset":5021},"indent":[]}},{"type":"listItem","spread":false,"checked":null,"children":[{"type":"paragraph","children":[{"type":"text","value":"Run the script below:","position":{"start":{"line":106,"column":4,"offset":5025},"end":{"line":106,"column":25,"offset":5046},"indent":[]}}],"position":{"start":{"line":106,"column":4,"offset":5025},"end":{"line":106,"column":25,"offset":5046},"indent":[]}}],"position":{"start":{"line":106,"column":1,"offset":5022},"end":{"line":106,"column":25,"offset":5046},"indent":[]}}],"position":{"start":{"line":104,"column":1,"offset":4879},"end":{"line":106,"column":25,"offset":5046},"indent":[1,1]}},{"type":"code","lang":"shell","meta":null,"value":"deno run --allow-net --allow-read mod.ts","position":{"start":{"line":108,"column":1,"offset":5048},"end":{"line":110,"column":4,"offset":5101},"indent":[1,1]}},{"type":"paragraph","children":[{"type":"text","value":"The first time you run it, you may see a lot of files being loaded. This is preparing all the magic behind the scene. Once it is ready, you will see something like this:","position":{"start":{"line":112,"column":1,"offset":5103},"end":{"line":112,"column":170,"offset":5272},"indent":[]}}],"position":{"start":{"line":112,"column":1,"offset":5103},"end":{"line":112,"column":170,"offset":5272},"indent":[]}},{"type":"paragraph","children":[{"type":"image","title":null,"url":"https://i.imgur.com/TOXjLgh.png","alt":"image","position":{"start":{"line":114,"column":1,"offset":5274},"end":{"line":114,"column":42,"offset":5315},"indent":[]}}],"position":{"start":{"line":114,"column":1,"offset":5274},"end":{"line":114,"column":42,"offset":5315},"indent":[]}},{"type":"heading","depth":2,"children":[{"type":"text","value":"Understanding What Discordeno Did","position":{"start":{"line":116,"column":4,"offset":5320},"end":{"line":116,"column":37,"offset":5353},"indent":[]}}],"position":{"start":{"line":116,"column":1,"offset":5317},"end":{"line":116,"column":37,"offset":5353},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"Discordeno includes these commands/folders as they are essential for any discord bot to have in order to meet the Discord Bot Best Practices. It also adds a few things that will help make some things easier to build a bot.","position":{"start":{"line":118,"column":1,"offset":5355},"end":{"line":118,"column":223,"offset":5577},"indent":[]}}],"position":{"start":{"line":118,"column":1,"offset":5355},"end":{"line":118,"column":223,"offset":5577},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"We will dive into these deeper in this guide. Let's take it step by step.","position":{"start":{"line":120,"column":1,"offset":5579},"end":{"line":120,"column":74,"offset":5652},"indent":[]}}],"position":{"start":{"line":120,"column":1,"offset":5579},"end":{"line":120,"column":74,"offset":5652},"indent":[]}},{"type":"export","value":"export const _frontmatter = {\"title\":\"Creating The Bot!\",\"metaTitle\":\"Creating A Bot | Discordeno\",\"metaDescription\":\"Let's create our very own bot with Discordeno!\"}","position":{"start":{"line":123,"column":1,"offset":5655},"end":{"line":123,"column":167,"offset":5821},"indent":[]}}],"position":{"start":{"line":1,"column":1,"offset":0},"end":{"line":123,"column":167,"offset":5821}}},"scopeImports":["import * as React from 'react'"],"scopeIdentifiers":["React"],"body":"function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }\n\nfunction _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }\n\nfunction _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }\n\n/* @jsx mdx */\nvar _frontmatter = {\n \"title\": \"Creating The Bot!\",\n \"metaTitle\": \"Creating A Bot | Discordeno\",\n \"metaDescription\": \"Let's create our very own bot with Discordeno!\"\n};\nvar layoutProps = {\n _frontmatter: _frontmatter\n};\nvar MDXLayout = \"wrapper\";\nreturn function MDXContent(_ref) {\n var components = _ref.components,\n props = _objectWithoutProperties(_ref, [\"components\"]);\n\n return mdx(MDXLayout, _extends({}, layoutProps, props, {\n components: components,\n mdxType: \"MDXLayout\"\n }), mdx(\"p\", null, \"Discordeno will help make Discord bot development much easier. Don't worry, as you go through this guide it will make a lot more sense.\"), mdx(\"h2\", null, \"Creating The Bot!\"), mdx(\"blockquote\", null, mdx(\"p\", {\n parentName: \"blockquote\"\n }, \"This guide is going to assume you already have the basic requirements to make a bot ready. This includes github, git, a code editor like Visual Studio Code. If you don't have these yet please prepare them first before going forward.\")), mdx(\"ul\", null, mdx(\"li\", {\n parentName: \"ul\"\n }, mdx(\"p\", {\n parentName: \"li\"\n }, \"First, create a Discordeno Bot using the \", mdx(\"a\", _extends({\n parentName: \"p\"\n }, {\n \"href\": \"https://github.com/Skillz4Killz/Discordeno-bot-template\"\n }), \"Generator Boilerplate\"), \". Give it any name you like. For the purpose of this guide we will call it, Stargate.\")), mdx(\"li\", {\n parentName: \"ul\"\n }, mdx(\"p\", {\n parentName: \"li\"\n }, \"Then \", mdx(\"inlineCode\", {\n parentName: \"p\"\n }, \"git clone https://github.com/Skillz4Killz/Stargate.git\"))), mdx(\"li\", {\n parentName: \"ul\"\n }, mdx(\"p\", {\n parentName: \"li\"\n }, \"When that is done, go ahead and open up the folder with VSC.\")), mdx(\"li\", {\n parentName: \"ul\"\n }, mdx(\"p\", {\n parentName: \"li\"\n }, \"Create a new file called \", mdx(\"inlineCode\", {\n parentName: \"p\"\n }, \"configs.ts\"), \". Open the \", mdx(\"inlineCode\", {\n parentName: \"p\"\n }, \"configs.example.ts\"), \" file and copy everything over.\"))), mdx(\"p\", null, \"Let's take a minute to review all the options we have available to us.\"), mdx(\"h3\", null, \"Configs File\"), mdx(\"p\", null, \"The \", mdx(\"inlineCode\", {\n parentName: \"p\"\n }, \"configs.ts\"), \" file is where you will keep all your secret info you don't want to share with anyone else. As long as \", mdx(\"inlineCode\", {\n parentName: \"p\"\n }, \".gitignore\"), \" file is ignoring configs.ts your configurations will be kept private!\"), mdx(\"pre\", null, mdx(\"code\", _extends({\n parentName: \"pre\"\n }, {\n \"className\": \"language-ts\"\n }), \"// Step 1: Remove the `.example` from this file name so it is called `configs.ts`\\n// Step 2: Add all your bot's information below. The only required one is token and prefix. NOTE: As long as `.gitignore` file is ignoring configs.ts your configurations will be kept private!\\n// Step 3: Remove these comments if you like.\\n\\nexport const configs = {\\n // Your bot token goes here\\n token: \\\"\\\",\\n // The default prefix for your bot. Don't worry guilds can change this later.\\n prefix: \\\"!\\\",\\n // This isn't required but you can add bot list api keys here.\\n botListTokens: {\\n DISCORD_BOT_ORG: \\\"\\\",\\n BOTS_ON_DISCORD: \\\"\\\",\\n DISCORD_BOT_LIST: \\\"\\\",\\n BOTS_FOR_DISCORD: \\\"\\\",\\n DISCORD_BOATS: \\\"\\\",\\n DISCORD_BOTS_GG: \\\"\\\",\\n DISCORD_BOTS_GROUP: \\\"\\\",\\n },\\n // This is the server id for your bot's main server where users can get help/support\\n supportServerID: \\\"\\\",\\n // These are channel ids that will enable some functionality\\n channelIDs: {\\n // When a translation is missing this is the channel you will be alerted in.\\n missingTranslation: \\\"\\\",\\n // When an error occurs, we will try and log it to this channel\\n errorChannelID: \\\"\\\"\\n },\\n // These are the role ids that will enable some functionality.\\n roleIDs: {\\n // If you have a patreon set up you can add the patreon vip role id here.\\n patreonVIPRoleID: \\\"\\\",\\n },\\n // These are the user ids that will enable some functionality.\\n userIDs: {\\n // The user ids for the support team\\n botSupporters: [],\\n // The user ids for the other devs on your team\\n botDevs: [],\\n // The user ids who have complete 100% access to your bot\\n botOwners: []\\n }\\n};\\n\\n\")), mdx(\"h4\", null, \"Token\"), mdx(\"p\", null, \"First, add your bot token. This is \", mdx(\"strong\", {\n parentName: \"p\"\n }, \"required\"), \" for the bot to start. Review the \", mdx(\"a\", _extends({\n parentName: \"p\"\n }, {\n \"href\": \"https://discordeno.netlify.app/gettingstarted#creatingyourfirstdiscordbotapplication\"\n }), \"instructions\"), \" if you have not made your token yet.\"), mdx(\"h4\", null, \"Prefix\"), mdx(\"p\", null, \"The prefix is where you will set the default prefix for your bot. Don't worry, every server will be able to choose their own prefix but we need a default prefix to start.\"), mdx(\"h4\", null, \"Bot Lists Tokens\"), mdx(\"p\", null, \"This section of the file is so you can easily have your bot's statistics updated on all the bot lists out there to help you grow your bot. The code is already written to handle this but you will need to do 3 things for each bot list.\"), mdx(\"ol\", null, mdx(\"li\", {\n parentName: \"ol\"\n }, \"Go to the bot list and add your bot to their website. (Each site has it's own instructions)\"), mdx(\"li\", {\n parentName: \"ol\"\n }, \"Create a token for yourself on each website and paste it in your configs.\"), mdx(\"li\", {\n parentName: \"ol\"\n }, \"Enjoy!\")), mdx(\"p\", null, \"If you wish to customize the code, you will find the bot list tasks in the tasks folder. Don't worry we will discuss this when we get to the tasks section of the guide.\"), mdx(\"p\", null, \"For now just remember, that Discordeno provides you a built in way to update most discord bot lists.\"), mdx(\"h4\", null, \"Channel IDs\"), mdx(\"p\", null, \"The channelIDs section holds the channel IDs that are useful for specific features to help give you alerts/notifications. For example, the \", mdx(\"inlineCode\", {\n parentName: \"p\"\n }, \"missingTranslation\"), \" channel will be where messages are sent alerting you that somewhere in your code you are trying to use a translation key that you never created.\"), mdx(\"p\", null, \"When you get to around 25,000 Discord servers on your bot, you may want to convert these channel IDs to webhooks.\"), mdx(\"h4\", null, \"Role IDs\"), mdx(\"p\", null, \"The roleIDs section holds the role IDs that are useful for specific features. For example, the \", mdx(\"inlineCode\", {\n parentName: \"p\"\n }, \"patreonVIPRoleID\"), \" channel will be where messages are sent alerting you that somewhere in your code you are trying to use a translation key that you never created.\"), mdx(\"p\", null, \"When you get to around 25,000 Discord servers on your bot, you may want to convert these channel IDs to webhooks.\"), mdx(\"h2\", null, \"It's Alive!\"), mdx(\"p\", null, \"Oh my god! You now have a bot with a bunch of features already! You don't believe me? Well, seeing is believing, so start the bot.\"), mdx(\"ol\", null, mdx(\"li\", {\n parentName: \"ol\"\n }, \"Invite your bot to a discord server.\"), mdx(\"li\", {\n parentName: \"ol\"\n }, \"Open up the integrated terminal in VSC using \", mdx(\"strong\", {\n parentName: \"li\"\n }, \"CTRL + `\"), \". If you use a Mac, replace CTRL with CMD.\"), mdx(\"li\", {\n parentName: \"ol\"\n }, \"Run the script below:\")), mdx(\"pre\", null, mdx(\"code\", _extends({\n parentName: \"pre\"\n }, {\n \"className\": \"language-shell\"\n }), \"deno run --allow-net --allow-read mod.ts\\n\")), mdx(\"p\", null, \"The first time you run it, you may see a lot of files being loaded. This is preparing all the magic behind the scene. Once it is ready, you will see something like this:\"), mdx(\"p\", null, mdx(\"img\", _extends({\n parentName: \"p\"\n }, {\n \"src\": \"https://i.imgur.com/TOXjLgh.png\",\n \"alt\": \"image\"\n }))), mdx(\"h2\", null, \"Understanding What Discordeno Did\"), mdx(\"p\", null, \"Discordeno includes these commands/folders as they are essential for any discord bot to have in order to meet the Discord Bot Best Practices. It also adds a few things that will help make some things easier to build a bot.\"), mdx(\"p\", null, \"We will dive into these deeper in this guide. Let's take it step by step.\"));\n}\n;\nMDXContent.isMDXComponent = true;","rawMDXOutput":"/* @jsx mdx */\nimport { mdx } from '@mdx-js/react';\n/* @jsx mdx */\n\nexport const _frontmatter = {\n \"title\": \"Creating The Bot!\",\n \"metaTitle\": \"Creating A Bot | Discordeno\",\n \"metaDescription\": \"Let's create our very own bot with Discordeno!\"\n};\n\nconst layoutProps = {\n _frontmatter\n};\nconst MDXLayout = \"wrapper\"\nexport default function MDXContent({\n components,\n ...props\n}) {\n return \n

{`Discordeno will help make Discord bot development much easier. Don't worry, as you go through this guide it will make a lot more sense.`}

\n

{`Creating The Bot!`}

\n
\n

{`This guide is going to assume you already have the basic requirements to make a bot ready. This includes github, git, a code editor like Visual Studio Code. If you don't have these yet please prepare them first before going forward.`}

\n
\n
    \n
  • \n

    {`First, create a Discordeno Bot using the `}{`Generator Boilerplate`}{`. Give it any name you like. For the purpose of this guide we will call it, Stargate.`}

    \n
  • \n
  • \n

    {`Then `}{`git clone https://github.com/Skillz4Killz/Stargate.git`}

    \n
  • \n
  • \n

    {`When that is done, go ahead and open up the folder with VSC.`}

    \n
  • \n
  • \n

    {`Create a new file called `}{`configs.ts`}{`. Open the `}{`configs.example.ts`}{` file and copy everything over.`}

    \n
  • \n
\n

{`Let's take a minute to review all the options we have available to us.`}

\n

{`Configs File`}

\n

{`The `}{`configs.ts`}{` file is where you will keep all your secret info you don't want to share with anyone else. As long as `}{`.gitignore`}{` file is ignoring configs.ts your configurations will be kept private!`}

\n
{`// Step 1: Remove the \\`.example\\` from this file name so it is called \\`configs.ts\\`\n// Step 2: Add all your bot's information below. The only required one is token and prefix. NOTE: As long as \\`.gitignore\\` file is ignoring configs.ts your configurations will be kept private!\n// Step 3: Remove these comments if you like.\n\nexport const configs = {\n  // Your bot token goes here\n  token: \"\",\n  // The default prefix for your bot. Don't worry guilds can change this later.\n  prefix: \"!\",\n  // This isn't required but you can add bot list api keys here.\n  botListTokens: {\n    DISCORD_BOT_ORG: \"\",\n    BOTS_ON_DISCORD: \"\",\n    DISCORD_BOT_LIST: \"\",\n    BOTS_FOR_DISCORD: \"\",\n    DISCORD_BOATS: \"\",\n    DISCORD_BOTS_GG: \"\",\n    DISCORD_BOTS_GROUP: \"\",\n  },\n  // This is the server id for your bot's main server where users can get help/support\n  supportServerID: \"\",\n  // These are channel ids that will enable some functionality\n  channelIDs: {\n    // When a translation is missing this is the channel you will be alerted in.\n    missingTranslation: \"\",\n    // When an error occurs, we will try and log it to this channel\n    errorChannelID: \"\"\n  },\n  // These are the role ids that will enable some functionality.\n  roleIDs: {\n    // If you have a patreon set up you can add the patreon vip role id here.\n    patreonVIPRoleID: \"\",\n  },\n  // These are the user ids that will enable some functionality.\n  userIDs: {\n    // The user ids for the support team\n    botSupporters: [],\n    // The user ids for the other devs on your team\n    botDevs: [],\n    // The user ids who have complete 100% access to your bot\n    botOwners: []\n  }\n};\n\n`}
\n

{`Token`}

\n

{`First, add your bot token. This is `}{`required`}{` for the bot to start. Review the `}{`instructions`}{` if you have not made your token yet.`}

\n

{`Prefix`}

\n

{`The prefix is where you will set the default prefix for your bot. Don't worry, every server will be able to choose their own prefix but we need a default prefix to start.`}

\n

{`Bot Lists Tokens`}

\n

{`This section of the file is so you can easily have your bot's statistics updated on all the bot lists out there to help you grow your bot. The code is already written to handle this but you will need to do 3 things for each bot list.`}

\n
    \n
  1. {`Go to the bot list and add your bot to their website. (Each site has it's own instructions)`}
  2. \n
  3. {`Create a token for yourself on each website and paste it in your configs.`}
  4. \n
  5. {`Enjoy!`}
  6. \n
\n

{`If you wish to customize the code, you will find the bot list tasks in the tasks folder. Don't worry we will discuss this when we get to the tasks section of the guide.`}

\n

{`For now just remember, that Discordeno provides you a built in way to update most discord bot lists.`}

\n

{`Channel IDs`}

\n

{`The channelIDs section holds the channel IDs that are useful for specific features to help give you alerts/notifications. For example, the `}{`missingTranslation`}{` channel will be where messages are sent alerting you that somewhere in your code you are trying to use a translation key that you never created.`}

\n

{`When you get to around 25,000 Discord servers on your bot, you may want to convert these channel IDs to webhooks.`}

\n

{`Role IDs`}

\n

{`The roleIDs section holds the role IDs that are useful for specific features. For example, the `}{`patreonVIPRoleID`}{` channel will be where messages are sent alerting you that somewhere in your code you are trying to use a translation key that you never created.`}

\n

{`When you get to around 25,000 Discord servers on your bot, you may want to convert these channel IDs to webhooks.`}

\n

{`It's Alive!`}

\n

{`Oh my god! You now have a bot with a bunch of features already! You don't believe me? Well, seeing is believing, so start the bot.`}

\n
    \n
  1. {`Invite your bot to a discord server.`}
  2. \n
  3. {`Open up the integrated terminal in VSC using `}{`CTRL + \\``}{`. If you use a Mac, replace CTRL with CMD.`}
  4. \n
  5. {`Run the script below:`}
  6. \n
\n
{`deno run --allow-net --allow-read mod.ts\n`}
\n

{`The first time you run it, you may see a lot of files being loaded. This is preparing all the magic behind the scene. Once it is ready, you will see something like this:`}

\n

\n

{`Understanding What Discordeno Did`}

\n

{`Discordeno includes these commands/folders as they are essential for any discord bot to have in order to meet the Discord Bot Best Practices. It also adds a few things that will help make some things easier to build a bot.`}

\n

{`We will dive into these deeper in this guide. Let's take it step by step.`}

\n\n
;\n}\n\n;\nMDXContent.isMDXComponent = true;"}} \ No newline at end of file diff --git a/docs/.cache/caches/gatsby-plugin-mdx/diskstore-20b82ce0c38da297167503a0689e79eb.json b/docs/.cache/caches/gatsby-plugin-mdx/diskstore-20b82ce0c38da297167503a0689e79eb.json new file mode 100644 index 000000000..4ddd0ab9e --- /dev/null +++ b/docs/.cache/caches/gatsby-plugin-mdx/diskstore-20b82ce0c38da297167503a0689e79eb.json @@ -0,0 +1 @@ +{"expireTime":9007200851634095000,"key":"gatsby-plugin-mdx-entire-payload-ca66f77b9397f0b9279176db76db5eb9-","val":{"mdast":{"type":"root","children":[{"type":"paragraph","children":[{"type":"text","value":"Woah! You are almost half way done with understanding all of Discordeno. Amazing isn't it? Something you may have noticed in the last section was there were some options that prevented some commands from running like ","position":{"start":{"line":2,"column":1,"offset":1},"end":{"line":2,"column":218,"offset":218},"indent":[]}},{"type":"inlineCode","value":"dmOnly","position":{"start":{"line":2,"column":218,"offset":218},"end":{"line":2,"column":226,"offset":226},"indent":[]}},{"type":"text","value":" or the permission options. we created a setting to prevent the monitor from running in certain channels. What if we wanted to do prevent commands from happening? How would we prevent commands from running?","position":{"start":{"line":2,"column":226,"offset":226},"end":{"line":2,"column":432,"offset":432},"indent":[]}}],"position":{"start":{"line":2,"column":1,"offset":1},"end":{"line":2,"column":432,"offset":432},"indent":[]}},{"type":"heading","depth":2,"children":[{"type":"text","value":"What is an Inhibitor?","position":{"start":{"line":4,"column":4,"offset":437},"end":{"line":4,"column":25,"offset":458},"indent":[]}}],"position":{"start":{"line":4,"column":1,"offset":434},"end":{"line":4,"column":25,"offset":458},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"An Inhibitor is very similar to how monitors work. A monitor runs on every message but an inhibitor runs on every command. Remember all those command options like cooldown, permissions, permissionLevel, nsfw, etc... Each and every one of these options has an inhibitor in that checks commands for these settings.","position":{"start":{"line":6,"column":1,"offset":460},"end":{"line":6,"column":313,"offset":772},"indent":[]}}],"position":{"start":{"line":6,"column":1,"offset":460},"end":{"line":6,"column":313,"offset":772},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"Let's create our own inhibitor that would prevent commands from being used if the user is not a VIP user.","position":{"start":{"line":8,"column":1,"offset":774},"end":{"line":8,"column":106,"offset":879},"indent":[]}}],"position":{"start":{"line":8,"column":1,"offset":774},"end":{"line":8,"column":106,"offset":879},"indent":[]}},{"type":"blockquote","children":[{"type":"paragraph","children":[{"type":"strong","children":[{"type":"text","value":"Note:","position":{"start":{"line":10,"column":5,"offset":885},"end":{"line":10,"column":10,"offset":890},"indent":[]}}],"position":{"start":{"line":10,"column":3,"offset":883},"end":{"line":10,"column":12,"offset":892},"indent":[]}},{"type":"text","value":" It is important to remember that everything below can be done with a simple permission level as well. We will create our own custom permission levels but for the purposes of this guide and to be able to learn about Inhibitors, we will be using an inhibitor.","position":{"start":{"line":10,"column":12,"offset":892},"end":{"line":10,"column":270,"offset":1150},"indent":[]}}],"position":{"start":{"line":10,"column":3,"offset":883},"end":{"line":10,"column":270,"offset":1150},"indent":[]}}],"position":{"start":{"line":10,"column":1,"offset":881},"end":{"line":10,"column":270,"offset":1150},"indent":[]}},{"type":"heading","depth":2,"children":[{"type":"text","value":"Creating the File","position":{"start":{"line":12,"column":4,"offset":1155},"end":{"line":12,"column":21,"offset":1172},"indent":[]}}],"position":{"start":{"line":12,"column":1,"offset":1152},"end":{"line":12,"column":21,"offset":1172},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"Let's start by creating a file inside the inhibitors folder called ","position":{"start":{"line":14,"column":1,"offset":1174},"end":{"line":14,"column":68,"offset":1241},"indent":[]}},{"type":"inlineCode","value":"boosted.ts","position":{"start":{"line":14,"column":68,"offset":1241},"end":{"line":14,"column":80,"offset":1253},"indent":[]}},{"type":"text","value":" and paste the following snippet of code:","position":{"start":{"line":14,"column":80,"offset":1253},"end":{"line":14,"column":121,"offset":1294},"indent":[]}}],"position":{"start":{"line":14,"column":1,"offset":1174},"end":{"line":14,"column":121,"offset":1294},"indent":[]}},{"type":"code","lang":"ts","meta":null,"value":"import { botCache } from \"../../mod.ts\";\n\nbotCache.inhibitors.set(\"inhibitorname\", async function (message, command, guild) {\n\t// Your code goes here\n});","position":{"start":{"line":16,"column":1,"offset":1296},"end":{"line":22,"column":4,"offset":1459},"indent":[1,1,1,1,1,1]}},{"type":"paragraph","children":[{"type":"text","value":"Inhibitors can take up to 3 arguments.","position":{"start":{"line":24,"column":1,"offset":1461},"end":{"line":24,"column":39,"offset":1499},"indent":[]}}],"position":{"start":{"line":24,"column":1,"offset":1461},"end":{"line":24,"column":39,"offset":1499},"indent":[]}},{"type":"list","ordered":false,"start":null,"spread":false,"children":[{"type":"listItem","spread":false,"checked":null,"children":[{"type":"paragraph","children":[{"type":"inlineCode","value":"message","position":{"start":{"line":26,"column":3,"offset":1503},"end":{"line":26,"column":12,"offset":1512},"indent":[]}},{"type":"text","value":": The message object that triggered the command.","position":{"start":{"line":26,"column":12,"offset":1512},"end":{"line":26,"column":60,"offset":1560},"indent":[]}}],"position":{"start":{"line":26,"column":3,"offset":1503},"end":{"line":26,"column":60,"offset":1560},"indent":[]}}],"position":{"start":{"line":26,"column":1,"offset":1501},"end":{"line":26,"column":60,"offset":1560},"indent":[]}},{"type":"listItem","spread":false,"checked":null,"children":[{"type":"paragraph","children":[{"type":"inlineCode","value":"command","position":{"start":{"line":27,"column":3,"offset":1563},"end":{"line":27,"column":12,"offset":1572},"indent":[]}},{"type":"text","value":": The command object itself that was triggered.","position":{"start":{"line":27,"column":12,"offset":1572},"end":{"line":27,"column":59,"offset":1619},"indent":[]}}],"position":{"start":{"line":27,"column":3,"offset":1563},"end":{"line":27,"column":59,"offset":1619},"indent":[]}}],"position":{"start":{"line":27,"column":1,"offset":1561},"end":{"line":27,"column":59,"offset":1619},"indent":[]}},{"type":"listItem","spread":false,"checked":null,"children":[{"type":"paragraph","children":[{"type":"inlineCode","value":"guild","position":{"start":{"line":28,"column":3,"offset":1622},"end":{"line":28,"column":10,"offset":1629},"indent":[]}},{"type":"text","value":": The server guild object where this command was ran.","position":{"start":{"line":28,"column":10,"offset":1629},"end":{"line":28,"column":63,"offset":1682},"indent":[]}}],"position":{"start":{"line":28,"column":3,"offset":1622},"end":{"line":28,"column":63,"offset":1682},"indent":[]}}],"position":{"start":{"line":28,"column":1,"offset":1620},"end":{"line":28,"column":63,"offset":1682},"indent":[]}}],"position":{"start":{"line":26,"column":1,"offset":1501},"end":{"line":28,"column":63,"offset":1682},"indent":[1,1]}},{"type":"heading","depth":2,"children":[{"type":"text","value":"Understanding How Inhibitors Function","position":{"start":{"line":30,"column":4,"offset":1687},"end":{"line":30,"column":41,"offset":1724},"indent":[]}}],"position":{"start":{"line":30,"column":1,"offset":1684},"end":{"line":30,"column":41,"offset":1724},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"To block a command you have to return a truthy value.","position":{"start":{"line":32,"column":1,"offset":1726},"end":{"line":32,"column":54,"offset":1779},"indent":[]}}],"position":{"start":{"line":32,"column":1,"offset":1726},"end":{"line":32,"column":54,"offset":1779},"indent":[]}},{"type":"list","ordered":false,"start":null,"spread":false,"children":[{"type":"listItem","spread":false,"checked":null,"children":[{"type":"paragraph","children":[{"type":"strong","children":[{"type":"text","value":"return true;","position":{"start":{"line":33,"column":5,"offset":1784},"end":{"line":33,"column":17,"offset":1796},"indent":[]}}],"position":{"start":{"line":33,"column":3,"offset":1782},"end":{"line":33,"column":19,"offset":1798},"indent":[]}},{"type":"text","value":" If you return true the inhibitor will block the execution of the command.\nTo allow a command return a falsey value.","position":{"start":{"line":33,"column":19,"offset":1798},"end":{"line":34,"column":42,"offset":1914},"indent":[1]}}],"position":{"start":{"line":33,"column":3,"offset":1782},"end":{"line":34,"column":42,"offset":1914},"indent":[1]}}],"position":{"start":{"line":33,"column":1,"offset":1780},"end":{"line":34,"column":42,"offset":1914},"indent":[1]}},{"type":"listItem","spread":false,"checked":null,"children":[{"type":"paragraph","children":[{"type":"strong","children":[{"type":"text","value":"return false;","position":{"start":{"line":35,"column":5,"offset":1919},"end":{"line":35,"column":18,"offset":1932},"indent":[]}}],"position":{"start":{"line":35,"column":3,"offset":1917},"end":{"line":35,"column":20,"offset":1934},"indent":[]}},{"type":"text","value":" If you return false the inhibitor will not block the error.","position":{"start":{"line":35,"column":20,"offset":1934},"end":{"line":35,"column":80,"offset":1994},"indent":[]}}],"position":{"start":{"line":35,"column":3,"offset":1917},"end":{"line":35,"column":80,"offset":1994},"indent":[]}}],"position":{"start":{"line":35,"column":1,"offset":1915},"end":{"line":35,"column":80,"offset":1994},"indent":[]}}],"position":{"start":{"line":33,"column":1,"offset":1780},"end":{"line":35,"column":80,"offset":1994},"indent":[1,1]}},{"type":"code","lang":"ts","meta":null,"value":"// If the command is not VIP only we can allow this command to execute\nif (!command.vipOnly) return false;\n\n// Check if the user has the vip role on the support server given by patreon\nconst guild \nconst userIsVIP = await isUserVIP(message.author.id)\n// The user is VIP so we can allow this command to be used\nif (userIsVIP) return false;\n\n// The user is NOT VIP so we throw an error\nthrow `The ${command.name} is only allowed for VIP users.`","position":{"start":{"line":38,"column":1,"offset":1997},"end":{"line":50,"column":4,"offset":2449},"indent":[1,1,1,1,1,1,1,1,1,1,1,1]}},{"type":"export","value":"export const _frontmatter = {\"title\":\"Creating Inhibitors!\",\"metaTitle\":\"Creating An Inhibitor | Discordeno\",\"metaDescription\":\"Let's create our very own bot with Discordeno!\"}","position":{"start":{"line":53,"column":1,"offset":2452},"end":{"line":53,"column":177,"offset":2628},"indent":[]}}],"position":{"start":{"line":1,"column":1,"offset":0},"end":{"line":53,"column":177,"offset":2628}}},"scopeImports":["import * as React from 'react'"],"scopeIdentifiers":["React"],"body":"function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }\n\nfunction _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }\n\nfunction _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }\n\n/* @jsx mdx */\nvar _frontmatter = {\n \"title\": \"Creating Inhibitors!\",\n \"metaTitle\": \"Creating An Inhibitor | Discordeno\",\n \"metaDescription\": \"Let's create our very own bot with Discordeno!\"\n};\nvar layoutProps = {\n _frontmatter: _frontmatter\n};\nvar MDXLayout = \"wrapper\";\nreturn function MDXContent(_ref) {\n var components = _ref.components,\n props = _objectWithoutProperties(_ref, [\"components\"]);\n\n return mdx(MDXLayout, _extends({}, layoutProps, props, {\n components: components,\n mdxType: \"MDXLayout\"\n }), mdx(\"p\", null, \"Woah! You are almost half way done with understanding all of Discordeno. Amazing isn't it? Something you may have noticed in the last section was there were some options that prevented some commands from running like \", mdx(\"inlineCode\", {\n parentName: \"p\"\n }, \"dmOnly\"), \" or the permission options. we created a setting to prevent the monitor from running in certain channels. What if we wanted to do prevent commands from happening? How would we prevent commands from running?\"), mdx(\"h2\", null, \"What is an Inhibitor?\"), mdx(\"p\", null, \"An Inhibitor is very similar to how monitors work. A monitor runs on every message but an inhibitor runs on every command. Remember all those command options like cooldown, permissions, permissionLevel, nsfw, etc... Each and every one of these options has an inhibitor in that checks commands for these settings.\"), mdx(\"p\", null, \"Let's create our own inhibitor that would prevent commands from being used if the user is not a VIP user.\"), mdx(\"blockquote\", null, mdx(\"p\", {\n parentName: \"blockquote\"\n }, mdx(\"strong\", {\n parentName: \"p\"\n }, \"Note:\"), \" It is important to remember that everything below can be done with a simple permission level as well. We will create our own custom permission levels but for the purposes of this guide and to be able to learn about Inhibitors, we will be using an inhibitor.\")), mdx(\"h2\", null, \"Creating the File\"), mdx(\"p\", null, \"Let's start by creating a file inside the inhibitors folder called \", mdx(\"inlineCode\", {\n parentName: \"p\"\n }, \"boosted.ts\"), \" and paste the following snippet of code:\"), mdx(\"pre\", null, mdx(\"code\", _extends({\n parentName: \"pre\"\n }, {\n \"className\": \"language-ts\"\n }), \"import { botCache } from \\\"../../mod.ts\\\";\\n\\nbotCache.inhibitors.set(\\\"inhibitorname\\\", async function (message, command, guild) {\\n // Your code goes here\\n});\\n\")), mdx(\"p\", null, \"Inhibitors can take up to 3 arguments.\"), mdx(\"ul\", null, mdx(\"li\", {\n parentName: \"ul\"\n }, mdx(\"inlineCode\", {\n parentName: \"li\"\n }, \"message\"), \": The message object that triggered the command.\"), mdx(\"li\", {\n parentName: \"ul\"\n }, mdx(\"inlineCode\", {\n parentName: \"li\"\n }, \"command\"), \": The command object itself that was triggered.\"), mdx(\"li\", {\n parentName: \"ul\"\n }, mdx(\"inlineCode\", {\n parentName: \"li\"\n }, \"guild\"), \": The server guild object where this command was ran.\")), mdx(\"h2\", null, \"Understanding How Inhibitors Function\"), mdx(\"p\", null, \"To block a command you have to return a truthy value.\"), mdx(\"ul\", null, mdx(\"li\", {\n parentName: \"ul\"\n }, mdx(\"strong\", {\n parentName: \"li\"\n }, \"return true;\"), \" If you return true the inhibitor will block the execution of the command.\\nTo allow a command return a falsey value.\"), mdx(\"li\", {\n parentName: \"ul\"\n }, mdx(\"strong\", {\n parentName: \"li\"\n }, \"return false;\"), \" If you return false the inhibitor will not block the error.\")), mdx(\"pre\", null, mdx(\"code\", _extends({\n parentName: \"pre\"\n }, {\n \"className\": \"language-ts\"\n }), \"// If the command is not VIP only we can allow this command to execute\\nif (!command.vipOnly) return false;\\n\\n// Check if the user has the vip role on the support server given by patreon\\nconst guild \\nconst userIsVIP = await isUserVIP(message.author.id)\\n// The user is VIP so we can allow this command to be used\\nif (userIsVIP) return false;\\n\\n// The user is NOT VIP so we throw an error\\nthrow `The ${command.name} is only allowed for VIP users.`\\n\")));\n}\n;\nMDXContent.isMDXComponent = true;","rawMDXOutput":"/* @jsx mdx */\nimport { mdx } from '@mdx-js/react';\n/* @jsx mdx */\n\nexport const _frontmatter = {\n \"title\": \"Creating Inhibitors!\",\n \"metaTitle\": \"Creating An Inhibitor | Discordeno\",\n \"metaDescription\": \"Let's create our very own bot with Discordeno!\"\n};\n\nconst layoutProps = {\n _frontmatter\n};\nconst MDXLayout = \"wrapper\"\nexport default function MDXContent({\n components,\n ...props\n}) {\n return \n

{`Woah! You are almost half way done with understanding all of Discordeno. Amazing isn't it? Something you may have noticed in the last section was there were some options that prevented some commands from running like `}{`dmOnly`}{` or the permission options. we created a setting to prevent the monitor from running in certain channels. What if we wanted to do prevent commands from happening? How would we prevent commands from running?`}

\n

{`What is an Inhibitor?`}

\n

{`An Inhibitor is very similar to how monitors work. A monitor runs on every message but an inhibitor runs on every command. Remember all those command options like cooldown, permissions, permissionLevel, nsfw, etc... Each and every one of these options has an inhibitor in that checks commands for these settings.`}

\n

{`Let's create our own inhibitor that would prevent commands from being used if the user is not a VIP user.`}

\n
\n

{`Note:`}{` It is important to remember that everything below can be done with a simple permission level as well. We will create our own custom permission levels but for the purposes of this guide and to be able to learn about Inhibitors, we will be using an inhibitor.`}

\n
\n

{`Creating the File`}

\n

{`Let's start by creating a file inside the inhibitors folder called `}{`boosted.ts`}{` and paste the following snippet of code:`}

\n
{`import { botCache } from \"../../mod.ts\";\n\nbotCache.inhibitors.set(\"inhibitorname\", async function (message, command, guild) {\n    // Your code goes here\n});\n`}
\n

{`Inhibitors can take up to 3 arguments.`}

\n
    \n
  • {`message`}{`: The message object that triggered the command.`}
  • \n
  • {`command`}{`: The command object itself that was triggered.`}
  • \n
  • {`guild`}{`: The server guild object where this command was ran.`}
  • \n
\n

{`Understanding How Inhibitors Function`}

\n

{`To block a command you have to return a truthy value.`}

\n
    \n
  • {`return true;`}{` If you return true the inhibitor will block the execution of the command.\nTo allow a command return a falsey value.`}
  • \n
  • {`return false;`}{` If you return false the inhibitor will not block the error.`}
  • \n
\n
{`// If the command is not VIP only we can allow this command to execute\nif (!command.vipOnly) return false;\n\n// Check if the user has the vip role on the support server given by patreon\nconst guild \nconst userIsVIP = await isUserVIP(message.author.id)\n// The user is VIP so we can allow this command to be used\nif (userIsVIP) return false;\n\n// The user is NOT VIP so we throw an error\nthrow \\`The \\${command.name} is only allowed for VIP users.\\`\n`}
\n\n
;\n}\n\n;\nMDXContent.isMDXComponent = true;"}} \ No newline at end of file diff --git a/docs/.cache/caches/gatsby-plugin-mdx/diskstore-2133e165ca6c909f24ebf19b6ab5a6c6.json b/docs/.cache/caches/gatsby-plugin-mdx/diskstore-2133e165ca6c909f24ebf19b6ab5a6c6.json new file mode 100644 index 000000000..8b50cfdfa --- /dev/null +++ b/docs/.cache/caches/gatsby-plugin-mdx/diskstore-2133e165ca6c909f24ebf19b6ab5a6c6.json @@ -0,0 +1 @@ +{"expireTime":9007200851596648000,"key":"gatsby-plugin-mdx-entire-payload-df86f8c91dd3c682eea685504e7a9499-","val":{"mdast":{"type":"root","children":[{"type":"heading","depth":2,"children":[{"type":"text","value":"Understanding The Goals of This Guide","position":{"start":{"line":2,"column":4,"offset":4},"end":{"line":2,"column":41,"offset":41},"indent":[]}}],"position":{"start":{"line":2,"column":1,"offset":1},"end":{"line":2,"column":41,"offset":41},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"This guide is for advanced Discordeno features.","position":{"start":{"line":4,"column":1,"offset":43},"end":{"line":4,"column":48,"offset":90},"indent":[]}}],"position":{"start":{"line":4,"column":1,"offset":43},"end":{"line":4,"column":48,"offset":90},"indent":[]}},{"type":"export","value":"export const _frontmatter = {\"title\":\"Step By Step Guide\",\"metaTitle\":\"Step By Step Guide | Discordeno\",\"metaDescription\":\"This guide will help you learn every part of Discordeno, step by step to create your own bot as you wish.\"}","position":{"start":{"line":7,"column":1,"offset":93},"end":{"line":7,"column":231,"offset":323},"indent":[]}}],"position":{"start":{"line":1,"column":1,"offset":0},"end":{"line":7,"column":231,"offset":323}}},"scopeImports":["import * as React from 'react'"],"scopeIdentifiers":["React"],"body":"function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }\n\nfunction _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }\n\nfunction _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }\n\n/* @jsx mdx */\nvar _frontmatter = {\n \"title\": \"Step By Step Guide\",\n \"metaTitle\": \"Step By Step Guide | Discordeno\",\n \"metaDescription\": \"This guide will help you learn every part of Discordeno, step by step to create your own bot as you wish.\"\n};\nvar layoutProps = {\n _frontmatter: _frontmatter\n};\nvar MDXLayout = \"wrapper\";\nreturn function MDXContent(_ref) {\n var components = _ref.components,\n props = _objectWithoutProperties(_ref, [\"components\"]);\n\n return mdx(MDXLayout, _extends({}, layoutProps, props, {\n components: components,\n mdxType: \"MDXLayout\"\n }), mdx(\"h2\", null, \"Understanding The Goals of This Guide\"), mdx(\"p\", null, \"This guide is for advanced Discordeno features.\"));\n}\n;\nMDXContent.isMDXComponent = true;","rawMDXOutput":"/* @jsx mdx */\nimport { mdx } from '@mdx-js/react';\n/* @jsx mdx */\n\nexport const _frontmatter = {\n \"title\": \"Step By Step Guide\",\n \"metaTitle\": \"Step By Step Guide | Discordeno\",\n \"metaDescription\": \"This guide will help you learn every part of Discordeno, step by step to create your own bot as you wish.\"\n};\n\nconst layoutProps = {\n _frontmatter\n};\nconst MDXLayout = \"wrapper\"\nexport default function MDXContent({\n components,\n ...props\n}) {\n return \n

{`Understanding The Goals of This Guide`}

\n

{`This guide is for advanced Discordeno features.`}

\n\n
;\n}\n\n;\nMDXContent.isMDXComponent = true;"}} \ No newline at end of file diff --git a/docs/.cache/caches/gatsby-plugin-mdx/diskstore-215396216730f0a74d19163a8b790ed5.json b/docs/.cache/caches/gatsby-plugin-mdx/diskstore-215396216730f0a74d19163a8b790ed5.json new file mode 100644 index 000000000..34c285e8a --- /dev/null +++ b/docs/.cache/caches/gatsby-plugin-mdx/diskstore-215396216730f0a74d19163a8b790ed5.json @@ -0,0 +1 @@ +{"expireTime":9007200851631694000,"key":"gatsby-plugin-mdx-entire-payload-6c517b44c6ef8c9e9bdeffee9e5a58da-","val":{"mdast":{"type":"root","children":[{"type":"paragraph","children":[{"type":"text","value":"Really great job. Now, lets dive into trying to use some of the commands and try to make our very own command.","position":{"start":{"line":2,"column":1,"offset":1},"end":{"line":2,"column":111,"offset":111},"indent":[]}}],"position":{"start":{"line":2,"column":1,"offset":1},"end":{"line":2,"column":111,"offset":111},"indent":[]}},{"type":"heading","depth":2,"children":[{"type":"text","value":"Editing Invite Command","position":{"start":{"line":4,"column":4,"offset":116},"end":{"line":4,"column":26,"offset":138},"indent":[]}}],"position":{"start":{"line":4,"column":1,"offset":113},"end":{"line":4,"column":26,"offset":138},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"Let's first start by taking an existing command and slightly modifying it to your needs. Let's use the ","position":{"start":{"line":6,"column":1,"offset":140},"end":{"line":6,"column":104,"offset":243},"indent":[]}},{"type":"inlineCode","value":"Invite","position":{"start":{"line":6,"column":104,"offset":243},"end":{"line":6,"column":112,"offset":251},"indent":[]}},{"type":"text","value":" command as our example. When you open the command, you will see something like this:","position":{"start":{"line":6,"column":112,"offset":251},"end":{"line":6,"column":197,"offset":336},"indent":[]}}],"position":{"start":{"line":6,"column":1,"offset":140},"end":{"line":6,"column":197,"offset":336},"indent":[]}},{"type":"code","lang":"ts","meta":null,"value":"import { botCache } from \"../../mod.ts\";\nimport { sendMessage } from \"https://raw.githubusercontent.com/Skillz4Killz/Discordeno/v7/src/handlers/channel.ts\";\nimport { botID } from \"https://raw.githubusercontent.com/Skillz4Killz/Discordeno/v7/src/module/client.ts\";\n\nbotCache.commands.set(\"invite\", {\n name: \"invite\",\n execute: function (message) {\n // Replace the permission number at the end to request the permissions you wish to request. By default, this will request Admin perms.\n sendMessage(\n message.channel,\n `https://discordapp.com/oauth2/authorize?client_id=${botID}&scope=bot&permissions=8`,\n );\n },\n});","position":{"start":{"line":8,"column":1,"offset":338},"end":{"line":23,"column":4,"offset":983},"indent":[1,1,1,1,1,1,1,1,1,1,1,1,1,1,1]}},{"type":"paragraph","children":[{"type":"text","value":"Let's break this down. The first three lines are importing the necessary things from their files so we can use them in this command. Don't worry if this doesn't make sense, most of the time, this will all be done automatically for you if you use a good code editor like Visual Studio Code. We create a command by doing:","position":{"start":{"line":25,"column":1,"offset":985},"end":{"line":25,"column":320,"offset":1304},"indent":[]}}],"position":{"start":{"line":25,"column":1,"offset":985},"end":{"line":25,"column":320,"offset":1304},"indent":[]}},{"type":"code","lang":"ts","meta":null,"value":"botCache.commands.set('commandname', {\n\n})","position":{"start":{"line":27,"column":1,"offset":1306},"end":{"line":31,"column":4,"offset":1358},"indent":[1,1,1,1]}},{"type":"paragraph","children":[{"type":"text","value":"The command name here must be unique. If it is not unique, your commands will not work properly as you wish. For example, you can't have 2 commands with the ","position":{"start":{"line":33,"column":1,"offset":1360},"end":{"line":33,"column":158,"offset":1517},"indent":[]}},{"type":"inlineCode","value":"ping","position":{"start":{"line":33,"column":158,"offset":1517},"end":{"line":33,"column":164,"offset":1523},"indent":[]}},{"type":"text","value":" name. In this case, our command is called ","position":{"start":{"line":33,"column":164,"offset":1523},"end":{"line":33,"column":207,"offset":1566},"indent":[]}},{"type":"inlineCode","value":"invite","position":{"start":{"line":33,"column":207,"offset":1566},"end":{"line":33,"column":215,"offset":1574},"indent":[]}},{"type":"text","value":".","position":{"start":{"line":33,"column":215,"offset":1574},"end":{"line":33,"column":216,"offset":1575},"indent":[]}}],"position":{"start":{"line":33,"column":1,"offset":1360},"end":{"line":33,"column":216,"offset":1575},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"The ","position":{"start":{"line":35,"column":1,"offset":1577},"end":{"line":35,"column":5,"offset":1581},"indent":[]}},{"type":"inlineCode","value":"name: 'invite'","position":{"start":{"line":35,"column":5,"offset":1581},"end":{"line":35,"column":21,"offset":1597},"indent":[]}},{"type":"text","value":" is also written as it is useful for our help command and inhibitors! Normally, these two things will be the same. So far it's super easy right.","position":{"start":{"line":35,"column":21,"offset":1597},"end":{"line":35,"column":165,"offset":1741},"indent":[]}}],"position":{"start":{"line":35,"column":1,"offset":1577},"end":{"line":35,"column":165,"offset":1741},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"Next is the ","position":{"start":{"line":37,"column":1,"offset":1743},"end":{"line":37,"column":13,"offset":1755},"indent":[]}},{"type":"inlineCode","value":"execute","position":{"start":{"line":37,"column":13,"offset":1755},"end":{"line":37,"column":22,"offset":1764},"indent":[]}},{"type":"text","value":". This is where the magic happens. This is the function that is triggered when the command is ran by a user. In this case, the bot simply sends a message to a channel where the command was ran and sends an invite link. Let's take a minute and optimize this for our case. We don't ","position":{"start":{"line":37,"column":22,"offset":1764},"end":{"line":37,"column":302,"offset":2044},"indent":[]}},{"type":"strong","children":[{"type":"text","value":"NEED","position":{"start":{"line":37,"column":304,"offset":2046},"end":{"line":37,"column":308,"offset":2050},"indent":[]}}],"position":{"start":{"line":37,"column":302,"offset":2044},"end":{"line":37,"column":310,"offset":2052},"indent":[]}},{"type":"text","value":" admin permissions for our bot. Let's go to the ","position":{"start":{"line":37,"column":310,"offset":2052},"end":{"line":37,"column":358,"offset":2100},"indent":[]}},{"type":"link","title":null,"url":"https://discordapi.com/permissions.html#0","children":[{"type":"text","value":"permission calculator","position":{"start":{"line":37,"column":359,"offset":2101},"end":{"line":37,"column":380,"offset":2122},"indent":[]}}],"position":{"start":{"line":37,"column":358,"offset":2100},"end":{"line":37,"column":424,"offset":2166},"indent":[]}},{"type":"text","value":" and figure out the permissions we need for our bot.","position":{"start":{"line":37,"column":424,"offset":2166},"end":{"line":37,"column":476,"offset":2218},"indent":[]}}],"position":{"start":{"line":37,"column":1,"offset":1743},"end":{"line":37,"column":476,"offset":2218},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"Once you have decided which permissions you want to request, you can copy the number and replace it here. For example, if we want ","position":{"start":{"line":39,"column":1,"offset":2220},"end":{"line":39,"column":131,"offset":2350},"indent":[]}},{"type":"inlineCode","value":"68640","position":{"start":{"line":39,"column":131,"offset":2350},"end":{"line":39,"column":138,"offset":2357},"indent":[]}},{"type":"text","value":" as our permissions. We can modify our command to be:","position":{"start":{"line":39,"column":138,"offset":2357},"end":{"line":39,"column":191,"offset":2410},"indent":[]}}],"position":{"start":{"line":39,"column":1,"offset":2220},"end":{"line":39,"column":191,"offset":2410},"indent":[]}},{"type":"code","lang":"ts","meta":null,"value":"\t`https://discordapp.com/oauth2/authorize?client_id=${botID}&scope=bot&permissions=68640`,","position":{"start":{"line":42,"column":1,"offset":2413},"end":{"line":44,"column":4,"offset":2513},"indent":[1,1]}},{"type":"paragraph","children":[{"type":"text","value":"Lastly, let's get rid of the comment there as now it is customized to our needs.","position":{"start":{"line":46,"column":1,"offset":2515},"end":{"line":46,"column":81,"offset":2595},"indent":[]}}],"position":{"start":{"line":46,"column":1,"offset":2515},"end":{"line":46,"column":81,"offset":2595},"indent":[]}},{"type":"heading","depth":3,"children":[{"type":"text","value":"Command Descriptions","position":{"start":{"line":48,"column":5,"offset":2601},"end":{"line":48,"column":25,"offset":2621},"indent":[]}}],"position":{"start":{"line":48,"column":1,"offset":2597},"end":{"line":48,"column":25,"offset":2621},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"Right now, if you were to go to Discord and type ","position":{"start":{"line":50,"column":1,"offset":2623},"end":{"line":50,"column":50,"offset":2672},"indent":[]}},{"type":"inlineCode","value":"!help invite","position":{"start":{"line":50,"column":50,"offset":2672},"end":{"line":50,"column":64,"offset":2686},"indent":[]}},{"type":"text","value":", you would see quite a bit of information. But where does all that text come from? It's not in this file. The description option tells Discordeno what to show the user when they use the help command. In that help message, each command has a small description next to it. The magic is happening because of Discordeno's translations feature.","position":{"start":{"line":50,"column":64,"offset":2686},"end":{"line":50,"column":404,"offset":3026},"indent":[]}}],"position":{"start":{"line":50,"column":1,"offset":2623},"end":{"line":50,"column":404,"offset":3026},"indent":[]}},{"type":"blockquote","children":[{"type":"paragraph","children":[{"type":"text","value":"Discordeno has built in multi-lingual support. You can support as many languages as you wish. We will learn more about languages when we create our own language but for now we just want to see how to customize the command. What we are going to do below isn't the correct way but it's the easy way to learn. We will see the correct way to do it when we get to translations.","position":{"start":{"line":52,"column":3,"offset":3030},"end":{"line":52,"column":375,"offset":3402},"indent":[]}}],"position":{"start":{"line":52,"column":3,"offset":3030},"end":{"line":52,"column":375,"offset":3402},"indent":[]}}],"position":{"start":{"line":52,"column":1,"offset":3028},"end":{"line":52,"column":375,"offset":3402},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"Let's add a custom description to our invite command.","position":{"start":{"line":54,"column":1,"offset":3404},"end":{"line":54,"column":54,"offset":3457},"indent":[]}}],"position":{"start":{"line":54,"column":1,"offset":3404},"end":{"line":54,"column":54,"offset":3457},"indent":[]}},{"type":"code","lang":"ts","meta":null,"value":"\tname: \"invite\",\n\tdescription: \"Like the bot? Use this link to add it to your server!\"","position":{"start":{"line":56,"column":1,"offset":3459},"end":{"line":59,"column":4,"offset":3555},"indent":[1,1,1]}},{"type":"paragraph","children":[{"type":"text","value":"🎉 It's that simple. So let's restart the bot and see how it changed. Use ","position":{"start":{"line":61,"column":1,"offset":3557},"end":{"line":61,"column":75,"offset":3631},"indent":[]}},{"type":"strong","children":[{"type":"text","value":"CTRL + C","position":{"start":{"line":61,"column":77,"offset":3633},"end":{"line":61,"column":85,"offset":3641},"indent":[]}}],"position":{"start":{"line":61,"column":75,"offset":3631},"end":{"line":61,"column":87,"offset":3643},"indent":[]}},{"type":"text","value":" to shut down the bot. Then run the command from earlier.","position":{"start":{"line":61,"column":87,"offset":3643},"end":{"line":61,"column":144,"offset":3700},"indent":[]}}],"position":{"start":{"line":61,"column":1,"offset":3557},"end":{"line":61,"column":144,"offset":3700},"indent":[]}},{"type":"code","lang":"shell","meta":null,"value":"deno run --allow-net --allow-read mod.ts","position":{"start":{"line":63,"column":1,"offset":3702},"end":{"line":65,"column":4,"offset":3755},"indent":[1,1]}},{"type":"paragraph","children":[{"type":"text","value":"To access this easily, most likely all you need to do is press the ","position":{"start":{"line":67,"column":1,"offset":3757},"end":{"line":67,"column":68,"offset":3824},"indent":[]}},{"type":"strong","children":[{"type":"text","value":"UP ARROW","position":{"start":{"line":67,"column":70,"offset":3826},"end":{"line":67,"column":78,"offset":3834},"indent":[]}}],"position":{"start":{"line":67,"column":68,"offset":3824},"end":{"line":67,"column":80,"offset":3836},"indent":[]}},{"type":"text","value":" key. Feel free to copy paste this if it doesn't work.","position":{"start":{"line":67,"column":80,"offset":3836},"end":{"line":67,"column":134,"offset":3890},"indent":[]}}],"position":{"start":{"line":67,"column":1,"offset":3757},"end":{"line":67,"column":134,"offset":3890},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"Once the bot is started try ","position":{"start":{"line":69,"column":1,"offset":3892},"end":{"line":69,"column":29,"offset":3920},"indent":[]}},{"type":"inlineCode","value":"!help invite","position":{"start":{"line":69,"column":29,"offset":3920},"end":{"line":69,"column":43,"offset":3934},"indent":[]}},{"type":"text","value":" again and you will see the change! 🎉","position":{"start":{"line":69,"column":43,"offset":3934},"end":{"line":69,"column":81,"offset":3972},"indent":[]}}],"position":{"start":{"line":69,"column":1,"offset":3892},"end":{"line":69,"column":81,"offset":3972},"indent":[]}},{"type":"heading","depth":2,"children":[{"type":"text","value":"Command Aliases","position":{"start":{"line":71,"column":4,"offset":3977},"end":{"line":71,"column":19,"offset":3992},"indent":[]}}],"position":{"start":{"line":71,"column":1,"offset":3974},"end":{"line":71,"column":19,"offset":3992},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"Now, let's make this a little bit easier. What if we wanted this command to also work with other names besides ","position":{"start":{"line":73,"column":1,"offset":3994},"end":{"line":73,"column":112,"offset":4105},"indent":[]}},{"type":"inlineCode","value":"invite","position":{"start":{"line":73,"column":112,"offset":4105},"end":{"line":73,"column":120,"offset":4113},"indent":[]}},{"type":"text","value":". For example, as a shortcut what if users could just type ","position":{"start":{"line":73,"column":120,"offset":4113},"end":{"line":73,"column":179,"offset":4172},"indent":[]}},{"type":"inlineCode","value":"!inv","position":{"start":{"line":73,"column":179,"offset":4172},"end":{"line":73,"column":185,"offset":4178},"indent":[]}},{"type":"text","value":" or as an alias type ","position":{"start":{"line":73,"column":185,"offset":4178},"end":{"line":73,"column":206,"offset":4199},"indent":[]}},{"type":"inlineCode","value":"!join","position":{"start":{"line":73,"column":206,"offset":4199},"end":{"line":73,"column":213,"offset":4206},"indent":[]}},{"type":"text","value":". Let's go ahead and set that up. Go to the very last line of invite command file and type in ","position":{"start":{"line":73,"column":213,"offset":4206},"end":{"line":73,"column":307,"offset":4300},"indent":[]}},{"type":"inlineCode","value":"alias","position":{"start":{"line":73,"column":307,"offset":4300},"end":{"line":73,"column":314,"offset":4307},"indent":[]}},{"type":"text","value":". You will see a popup showing you an autocompleted version of ","position":{"start":{"line":73,"column":314,"offset":4307},"end":{"line":73,"column":377,"offset":4370},"indent":[]}},{"type":"inlineCode","value":"createCommandAliases","position":{"start":{"line":73,"column":377,"offset":4370},"end":{"line":73,"column":399,"offset":4392},"indent":[]}},{"type":"text","value":". Press enter and boom the magic is happening!","position":{"start":{"line":73,"column":399,"offset":4392},"end":{"line":73,"column":445,"offset":4438},"indent":[]}}],"position":{"start":{"line":73,"column":1,"offset":3994},"end":{"line":73,"column":445,"offset":4438},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"The createCommandAliases takes in two arguments. The first argument is always the command name. In this case it is ","position":{"start":{"line":75,"column":1,"offset":4440},"end":{"line":75,"column":116,"offset":4555},"indent":[]}},{"type":"inlineCode","value":"invite","position":{"start":{"line":75,"column":116,"offset":4555},"end":{"line":75,"column":124,"offset":4563},"indent":[]}},{"type":"text","value":". The second argument is the aliases you want to provide. Let's add in the two aliases we wanted.","position":{"start":{"line":75,"column":124,"offset":4563},"end":{"line":75,"column":221,"offset":4660},"indent":[]}}],"position":{"start":{"line":75,"column":1,"offset":4440},"end":{"line":75,"column":221,"offset":4660},"indent":[]}},{"type":"code","lang":"ts","meta":null,"value":" `https://discordapp.com/oauth2/authorize?client_id=${botID}&scope=bot&permissions=68640`,\n );\n },\n});\n\ncreateCommandAliases('invite', ['inv', 'join'])","position":{"start":{"line":77,"column":1,"offset":4662},"end":{"line":84,"column":4,"offset":4827},"indent":[1,1,1,1,1,1,1]}},{"type":"blockquote","children":[{"type":"paragraph","children":[{"type":"strong","children":[{"type":"text","value":"Note:","position":{"start":{"line":86,"column":5,"offset":4833},"end":{"line":86,"column":10,"offset":4838},"indent":[]}}],"position":{"start":{"line":86,"column":3,"offset":4831},"end":{"line":86,"column":12,"offset":4840},"indent":[]}},{"type":"text","value":" If you only want to add 1 alias, you can pass in a simple string instead of an array as well as the second argument.","position":{"start":{"line":86,"column":12,"offset":4840},"end":{"line":86,"column":129,"offset":4957},"indent":[]}}],"position":{"start":{"line":86,"column":3,"offset":4831},"end":{"line":86,"column":129,"offset":4957},"indent":[]}}],"position":{"start":{"line":86,"column":1,"offset":4829},"end":{"line":86,"column":129,"offset":4957},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"Notice, I added 2 aliases here. You can add as many aliases as you like. If you see a lot of users typing it wrong by accident you can add those typos as aliases as well.","position":{"start":{"line":88,"column":1,"offset":4959},"end":{"line":88,"column":171,"offset":5129},"indent":[]}}],"position":{"start":{"line":88,"column":1,"offset":4959},"end":{"line":88,"column":171,"offset":5129},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"Let's start testing this out. But first, let's understand something important.","position":{"start":{"line":90,"column":1,"offset":5131},"end":{"line":90,"column":79,"offset":5209},"indent":[]}}],"position":{"start":{"line":90,"column":1,"offset":5131},"end":{"line":90,"column":79,"offset":5209},"indent":[]}},{"type":"heading","depth":2,"children":[{"type":"text","value":"Reloading","position":{"start":{"line":92,"column":4,"offset":5214},"end":{"line":92,"column":13,"offset":5223},"indent":[]}}],"position":{"start":{"line":92,"column":1,"offset":5211},"end":{"line":92,"column":13,"offset":5223},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"Okay, we need to first understand a core concept of developing discord bots. If you had to restart your bot every time you made a tiny change, it would get really annoying/tedious to do. Also, if you had restarted your bot 1000 times, you would be in big trouble because Discord would ban your bot for 24 hours. The bigger your bot gets, the faster it is to hit this limit of 1000 identify calls to the Discord API.","position":{"start":{"line":94,"column":1,"offset":5225},"end":{"line":94,"column":416,"offset":5640},"indent":[]}}],"position":{"start":{"line":94,"column":1,"offset":5225},"end":{"line":94,"column":416,"offset":5640},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"To solve this issue, Discordeno provides you with a really cool ","position":{"start":{"line":96,"column":1,"offset":5642},"end":{"line":96,"column":65,"offset":5706},"indent":[]}},{"type":"inlineCode","value":"reload","position":{"start":{"line":96,"column":65,"offset":5706},"end":{"line":96,"column":73,"offset":5714},"indent":[]}},{"type":"text","value":" command. Whenever you make a change to any command, event, monitor, inhibitor, task, language or argument you can simply reload it. You don't need to restart your bot every time.","position":{"start":{"line":96,"column":73,"offset":5714},"end":{"line":96,"column":252,"offset":5893},"indent":[]}}],"position":{"start":{"line":96,"column":1,"offset":5642},"end":{"line":96,"column":252,"offset":5893},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"Now since we added the aliases above, let's test it out.","position":{"start":{"line":98,"column":1,"offset":5895},"end":{"line":98,"column":57,"offset":5951},"indent":[]}}],"position":{"start":{"line":98,"column":1,"offset":5895},"end":{"line":98,"column":57,"offset":5951},"indent":[]}},{"type":"list","ordered":true,"start":1,"spread":false,"children":[{"type":"listItem","spread":false,"checked":null,"children":[{"type":"paragraph","children":[{"type":"inlineCode","value":"!inv","position":{"start":{"line":100,"column":4,"offset":5956},"end":{"line":100,"column":10,"offset":5962},"indent":[]}},{"type":"text","value":" this will not work","position":{"start":{"line":100,"column":10,"offset":5962},"end":{"line":100,"column":29,"offset":5981},"indent":[]}}],"position":{"start":{"line":100,"column":4,"offset":5956},"end":{"line":100,"column":29,"offset":5981},"indent":[]}}],"position":{"start":{"line":100,"column":1,"offset":5953},"end":{"line":100,"column":29,"offset":5981},"indent":[]}},{"type":"listItem","spread":false,"checked":null,"children":[{"type":"paragraph","children":[{"type":"inlineCode","value":"!reload commands","position":{"start":{"line":101,"column":4,"offset":5985},"end":{"line":101,"column":22,"offset":6003},"indent":[]}},{"type":"text","value":" this will reload the files and the aliases will be created.","position":{"start":{"line":101,"column":22,"offset":6003},"end":{"line":101,"column":82,"offset":6063},"indent":[]}}],"position":{"start":{"line":101,"column":4,"offset":5985},"end":{"line":101,"column":82,"offset":6063},"indent":[]}}],"position":{"start":{"line":101,"column":1,"offset":5982},"end":{"line":101,"column":82,"offset":6063},"indent":[]}},{"type":"listItem","spread":false,"checked":null,"children":[{"type":"paragraph","children":[{"type":"inlineCode","value":"!inv","position":{"start":{"line":102,"column":4,"offset":6067},"end":{"line":102,"column":10,"offset":6073},"indent":[]}},{"type":"text","value":" This will now work. 🎉","position":{"start":{"line":102,"column":10,"offset":6073},"end":{"line":102,"column":33,"offset":6096},"indent":[]}}],"position":{"start":{"line":102,"column":4,"offset":6067},"end":{"line":102,"column":33,"offset":6096},"indent":[]}}],"position":{"start":{"line":102,"column":1,"offset":6064},"end":{"line":102,"column":33,"offset":6096},"indent":[]}}],"position":{"start":{"line":100,"column":1,"offset":5953},"end":{"line":102,"column":33,"offset":6096},"indent":[1,1]}},{"type":"thematicBreak","position":{"start":{"line":104,"column":1,"offset":6098},"end":{"line":104,"column":4,"offset":6101},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"Perfect! You can take some time and customize the invite command to your needs if you wish. For example, this is my bot's invite command.","position":{"start":{"line":106,"column":1,"offset":6103},"end":{"line":106,"column":138,"offset":6240},"indent":[]}}],"position":{"start":{"line":106,"column":1,"offset":6103},"end":{"line":106,"column":138,"offset":6240},"indent":[]}},{"type":"paragraph","children":[{"type":"image","title":null,"url":"https://i.imgur.com/4WRFMtR.png","alt":"image","position":{"start":{"line":108,"column":1,"offset":6242},"end":{"line":108,"column":42,"offset":6283},"indent":[]}}],"position":{"start":{"line":108,"column":1,"offset":6242},"end":{"line":108,"column":42,"offset":6283},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"Nice! You can now customize any of the commands from Discordeno as you wish. Then we will continue to making our very own command so we can learn about all the options that Discordeno gives us when it comes to making commands. As you learn more in this guide, you can keep improving it.","position":{"start":{"line":110,"column":1,"offset":6285},"end":{"line":110,"column":287,"offset":6571},"indent":[]}}],"position":{"start":{"line":110,"column":1,"offset":6285},"end":{"line":110,"column":287,"offset":6571},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"If you get stuck, don't worry. When you are ready, let's continue to the next step.","position":{"start":{"line":112,"column":1,"offset":6573},"end":{"line":112,"column":84,"offset":6656},"indent":[]}}],"position":{"start":{"line":112,"column":1,"offset":6573},"end":{"line":112,"column":84,"offset":6656},"indent":[]}},{"type":"heading","depth":2,"children":[{"type":"text","value":"Creating A Command","position":{"start":{"line":114,"column":4,"offset":6661},"end":{"line":114,"column":22,"offset":6679},"indent":[]}}],"position":{"start":{"line":114,"column":1,"offset":6658},"end":{"line":114,"column":22,"offset":6679},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"Let's make a command that will allow guild admins to give or take roles from a member. Since, we are creating a ","position":{"start":{"line":116,"column":1,"offset":6681},"end":{"line":116,"column":113,"offset":6793},"indent":[]}},{"type":"inlineCode","value":"Moderation","position":{"start":{"line":116,"column":113,"offset":6793},"end":{"line":116,"column":125,"offset":6805},"indent":[]}},{"type":"text","value":" command to give or take roles, let's go ahead and create a Category folder called ","position":{"start":{"line":116,"column":125,"offset":6805},"end":{"line":116,"column":208,"offset":6888},"indent":[]}},{"type":"inlineCode","value":"Moderation","position":{"start":{"line":116,"column":208,"offset":6888},"end":{"line":116,"column":220,"offset":6900},"indent":[]}},{"type":"text","value":" and then create a file called ","position":{"start":{"line":116,"column":220,"offset":6900},"end":{"line":116,"column":251,"offset":6931},"indent":[]}},{"type":"inlineCode","value":"role.ts","position":{"start":{"line":116,"column":251,"offset":6931},"end":{"line":116,"column":260,"offset":6940},"indent":[]}},{"type":"text","value":". Once the file is made, you can paste this following base snippet to make our first command.","position":{"start":{"line":116,"column":260,"offset":6940},"end":{"line":116,"column":353,"offset":7033},"indent":[]}}],"position":{"start":{"line":116,"column":1,"offset":6681},"end":{"line":116,"column":353,"offset":7033},"indent":[]}},{"type":"code","lang":"ts","meta":null,"value":"import { botCache } from \"../../mod.ts\";\nimport { sendMessage } from \"https://raw.githubusercontent.com/Skillz4Killz/Discordeno/v7/src/handlers/channel.ts\";\nimport { PermissionLevels } from \"../types/commands.ts\";\nimport { createCommandAliases } from \"../utils/helpers\";\n\nbotCache.commands.set(\"commandname\", {\n name: \"commandname\",\n dmOnly: false,\n guildOnly: false,\n nsfw: false,\n permissionLevel: [PermissionLevels.MEMBER],\n botServerPermissions: [],\n botChannelPermissions: [],\n userServerPermissions: [],\n userChannelPermissions: [],\n description: string,\n cooldown: {\n seconds: 0,\n allowedUses: 0,\n },\n arguments: [],\n execute: function (message, args, guild) {\n // The code for your command goes here\n }\n});\n\n// createCommandAliases(\"commandname\", [\"alias\"])","position":{"start":{"line":118,"column":1,"offset":7035},"end":{"line":146,"column":4,"offset":7832},"indent":[1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1]}},{"type":"heading","depth":2,"children":[{"type":"text","value":"Understanding Command Options","position":{"start":{"line":148,"column":4,"offset":7837},"end":{"line":148,"column":33,"offset":7866},"indent":[]}}],"position":{"start":{"line":148,"column":1,"offset":7834},"end":{"line":148,"column":33,"offset":7866},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"Woah! We just added a massive file but most of that stuff is new to us. Don't worry, let's break everything down step by step.","position":{"start":{"line":150,"column":1,"offset":7868},"end":{"line":150,"column":127,"offset":7994},"indent":[]}}],"position":{"start":{"line":150,"column":1,"offset":7868},"end":{"line":150,"column":127,"offset":7994},"indent":[]}},{"type":"blockquote","children":[{"type":"paragraph","children":[{"type":"strong","children":[{"type":"text","value":"Note:","position":{"start":{"line":152,"column":5,"offset":8000},"end":{"line":152,"column":10,"offset":8005},"indent":[]}}],"position":{"start":{"line":152,"column":3,"offset":7998},"end":{"line":152,"column":12,"offset":8007},"indent":[]}},{"type":"text","value":" Any options that are not changed from the snippet above can actually be deleted as Discordeno will use the default option if you do not provide anything for that option. This can help keep your files cleaner.","position":{"start":{"line":152,"column":12,"offset":8007},"end":{"line":152,"column":221,"offset":8216},"indent":[]}}],"position":{"start":{"line":152,"column":3,"offset":7998},"end":{"line":152,"column":221,"offset":8216},"indent":[]}}],"position":{"start":{"line":152,"column":1,"offset":7996},"end":{"line":152,"column":221,"offset":8216},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"Before we start, quickly update the command name and description.","position":{"start":{"line":154,"column":1,"offset":8218},"end":{"line":154,"column":66,"offset":8283},"indent":[]}}],"position":{"start":{"line":154,"column":1,"offset":8218},"end":{"line":154,"column":66,"offset":8283},"indent":[]}},{"type":"blockquote","children":[{"type":"paragraph","children":[{"type":"strong","children":[{"type":"text","value":"Note:","position":{"start":{"line":156,"column":5,"offset":8289},"end":{"line":156,"column":10,"offset":8294},"indent":[]}}],"position":{"start":{"line":156,"column":3,"offset":8287},"end":{"line":156,"column":12,"offset":8296},"indent":[]}},{"type":"text","value":" Once you highlight the ","position":{"start":{"line":156,"column":12,"offset":8296},"end":{"line":156,"column":36,"offset":8320},"indent":[]}},{"type":"inlineCode","value":"commandname","position":{"start":{"line":156,"column":36,"offset":8320},"end":{"line":156,"column":49,"offset":8333},"indent":[]}},{"type":"text","value":", press ","position":{"start":{"line":156,"column":49,"offset":8333},"end":{"line":156,"column":57,"offset":8341},"indent":[]}},{"type":"strong","children":[{"type":"text","value":"CTRL + SHIFT + L","position":{"start":{"line":156,"column":59,"offset":8343},"end":{"line":156,"column":75,"offset":8359},"indent":[]}}],"position":{"start":{"line":156,"column":57,"offset":8341},"end":{"line":156,"column":77,"offset":8361},"indent":[]}},{"type":"text","value":" to select ALL the ","position":{"start":{"line":156,"column":77,"offset":8361},"end":{"line":156,"column":96,"offset":8380},"indent":[]}},{"type":"inlineCode","value":"commandname","position":{"start":{"line":156,"column":96,"offset":8380},"end":{"line":156,"column":109,"offset":8393},"indent":[]}},{"type":"text","value":" on the file and you can easily replace them at once. Another useful shortcut you may use when coding your bot is ","position":{"start":{"line":156,"column":109,"offset":8393},"end":{"line":156,"column":223,"offset":8507},"indent":[]}},{"type":"strong","children":[{"type":"text","value":"CTRL + D","position":{"start":{"line":156,"column":225,"offset":8509},"end":{"line":156,"column":233,"offset":8517},"indent":[]}}],"position":{"start":{"line":156,"column":223,"offset":8507},"end":{"line":156,"column":235,"offset":8519},"indent":[]}},{"type":"text","value":" after highlighting. This shortcut selects the next place where the same text exists as thing in the file that has the same thing as you highlighted.","position":{"start":{"line":156,"column":235,"offset":8519},"end":{"line":156,"column":385,"offset":8669},"indent":[]}}],"position":{"start":{"line":156,"column":3,"offset":8287},"end":{"line":156,"column":385,"offset":8669},"indent":[]}}],"position":{"start":{"line":156,"column":1,"offset":8285},"end":{"line":156,"column":385,"offset":8669},"indent":[]}},{"type":"heading","depth":2,"children":[{"type":"text","value":"dmOnly & guildOnly Options","position":{"start":{"line":158,"column":4,"offset":8674},"end":{"line":158,"column":30,"offset":8700},"indent":[]}}],"position":{"start":{"line":158,"column":1,"offset":8671},"end":{"line":158,"column":30,"offset":8700},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"The ","position":{"start":{"line":160,"column":1,"offset":8702},"end":{"line":160,"column":5,"offset":8706},"indent":[]}},{"type":"inlineCode","value":"dmOnly","position":{"start":{"line":160,"column":5,"offset":8706},"end":{"line":160,"column":13,"offset":8714},"indent":[]}},{"type":"text","value":" option is available if you want to make sure this command only runs in a direct message. If this command is ran in a server, the command will immediately exit out.","position":{"start":{"line":160,"column":13,"offset":8714},"end":{"line":160,"column":177,"offset":8878},"indent":[]}}],"position":{"start":{"line":160,"column":1,"offset":8702},"end":{"line":160,"column":177,"offset":8878},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"On the other hand, ","position":{"start":{"line":162,"column":1,"offset":8880},"end":{"line":162,"column":20,"offset":8899},"indent":[]}},{"type":"inlineCode","value":"guildOnly","position":{"start":{"line":162,"column":20,"offset":8899},"end":{"line":162,"column":31,"offset":8910},"indent":[]}},{"type":"text","value":" is the opposite. To easily make sure that this command is never allowed in a private message you can simple enable this.","position":{"start":{"line":162,"column":31,"offset":8910},"end":{"line":162,"column":152,"offset":9031},"indent":[]}}],"position":{"start":{"line":162,"column":1,"offset":8880},"end":{"line":162,"column":152,"offset":9031},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"If you want to allow a command to be able to run both in a server and in a direct message, simply set them both to false.","position":{"start":{"line":164,"column":1,"offset":9033},"end":{"line":164,"column":122,"offset":9154},"indent":[]}}],"position":{"start":{"line":164,"column":1,"offset":9033},"end":{"line":164,"column":122,"offset":9154},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"Remember if you want either of them as false, you can simply delete them and it will default to ","position":{"start":{"line":166,"column":1,"offset":9156},"end":{"line":166,"column":97,"offset":9252},"indent":[]}},{"type":"inlineCode","value":"false","position":{"start":{"line":166,"column":97,"offset":9252},"end":{"line":166,"column":104,"offset":9259},"indent":[]}},{"type":"text","value":" allowing your bot to be cleaner and easier to read. However, if your prefer keeping it you can.","position":{"start":{"line":166,"column":104,"offset":9259},"end":{"line":166,"column":200,"offset":9355},"indent":[]}}],"position":{"start":{"line":166,"column":1,"offset":9156},"end":{"line":166,"column":200,"offset":9355},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"For the purpose of this guide, we want our ","position":{"start":{"line":168,"column":1,"offset":9357},"end":{"line":168,"column":44,"offset":9400},"indent":[]}},{"type":"inlineCode","value":"role","position":{"start":{"line":168,"column":44,"offset":9400},"end":{"line":168,"column":50,"offset":9406},"indent":[]}},{"type":"text","value":" comamnd to only be run in a server, so we can set ","position":{"start":{"line":168,"column":50,"offset":9406},"end":{"line":168,"column":101,"offset":9457},"indent":[]}},{"type":"inlineCode","value":"guildOnly","position":{"start":{"line":168,"column":101,"offset":9457},"end":{"line":168,"column":112,"offset":9468},"indent":[]}},{"type":"text","value":" to be ","position":{"start":{"line":168,"column":112,"offset":9468},"end":{"line":168,"column":119,"offset":9475},"indent":[]}},{"type":"strong","children":[{"type":"text","value":"true","position":{"start":{"line":168,"column":121,"offset":9477},"end":{"line":168,"column":125,"offset":9481},"indent":[]}}],"position":{"start":{"line":168,"column":119,"offset":9475},"end":{"line":168,"column":127,"offset":9483},"indent":[]}},{"type":"text","value":" and delete the ","position":{"start":{"line":168,"column":127,"offset":9483},"end":{"line":168,"column":143,"offset":9499},"indent":[]}},{"type":"inlineCode","value":"dmOnly","position":{"start":{"line":168,"column":143,"offset":9499},"end":{"line":168,"column":151,"offset":9507},"indent":[]}},{"type":"text","value":" option.","position":{"start":{"line":168,"column":151,"offset":9507},"end":{"line":168,"column":159,"offset":9515},"indent":[]}}],"position":{"start":{"line":168,"column":1,"offset":9357},"end":{"line":168,"column":159,"offset":9515},"indent":[]}},{"type":"heading","depth":2,"children":[{"type":"text","value":"NSFW Option","position":{"start":{"line":170,"column":4,"offset":9520},"end":{"line":170,"column":15,"offset":9531},"indent":[]}}],"position":{"start":{"line":170,"column":1,"offset":9517},"end":{"line":170,"column":15,"offset":9531},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"NSFW stands for ","position":{"start":{"line":172,"column":1,"offset":9533},"end":{"line":172,"column":17,"offset":9549},"indent":[]}},{"type":"strong","children":[{"type":"text","value":"Not Safe For Work","position":{"start":{"line":172,"column":19,"offset":9551},"end":{"line":172,"column":36,"offset":9568},"indent":[]}}],"position":{"start":{"line":172,"column":17,"offset":9549},"end":{"line":172,"column":38,"offset":9570},"indent":[]}},{"type":"text","value":". One of Discord's rules is that you enforce that NSFW content is sent only in NSFW channels. Discordeno has this built in. You simple tell Discordeno, that you want a command to be considered ","position":{"start":{"line":172,"column":38,"offset":9570},"end":{"line":172,"column":231,"offset":9763},"indent":[]}},{"type":"inlineCode","value":"nsfw","position":{"start":{"line":172,"column":231,"offset":9763},"end":{"line":172,"column":237,"offset":9769},"indent":[]}},{"type":"text","value":" or not.","position":{"start":{"line":172,"column":237,"offset":9769},"end":{"line":172,"column":245,"offset":9777},"indent":[]}}],"position":{"start":{"line":172,"column":1,"offset":9533},"end":{"line":172,"column":245,"offset":9777},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"If this option is enabled, this command will only be able to be used in a ","position":{"start":{"line":174,"column":1,"offset":9779},"end":{"line":174,"column":75,"offset":9853},"indent":[]}},{"type":"inlineCode","value":"nsfw","position":{"start":{"line":174,"column":75,"offset":9853},"end":{"line":174,"column":81,"offset":9859},"indent":[]}},{"type":"text","value":" channel on a server. Discord does not consider Direct Messages as nsfw safe!","position":{"start":{"line":174,"column":81,"offset":9859},"end":{"line":174,"column":158,"offset":9936},"indent":[]}}],"position":{"start":{"line":174,"column":1,"offset":9779},"end":{"line":174,"column":158,"offset":9936},"indent":[]}},{"type":"heading","depth":2,"children":[{"type":"text","value":"Permission Level Option","position":{"start":{"line":176,"column":4,"offset":9941},"end":{"line":176,"column":27,"offset":9964},"indent":[]}}],"position":{"start":{"line":176,"column":1,"offset":9938},"end":{"line":176,"column":27,"offset":9964},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"Permission levels are a very powerful feature that easily allow you to set what permission is required to run a command. We will cover this in detail, in a separate section dedicated to permission levels. For now, just understand that this will restrict certain users from using a command.","position":{"start":{"line":178,"column":1,"offset":9966},"end":{"line":178,"column":290,"offset":10255},"indent":[]}}],"position":{"start":{"line":178,"column":1,"offset":9966},"end":{"line":178,"column":290,"offset":10255},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"For example, the role command we only want to be used by moderators or server admins.","position":{"start":{"line":180,"column":1,"offset":10257},"end":{"line":180,"column":86,"offset":10342},"indent":[]}}],"position":{"start":{"line":180,"column":1,"offset":10257},"end":{"line":180,"column":86,"offset":10342},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"Discordeno makes this pretty simple for us.","position":{"start":{"line":182,"column":1,"offset":10344},"end":{"line":182,"column":44,"offset":10387},"indent":[]}}],"position":{"start":{"line":182,"column":1,"offset":10344},"end":{"line":182,"column":44,"offset":10387},"indent":[]}},{"type":"code","lang":"ts","meta":null,"value":"permissionLevels: [PermissionLevels.MODERATOR, PermissionLevels.ADMIN]","position":{"start":{"line":184,"column":1,"offset":10389},"end":{"line":186,"column":4,"offset":10469},"indent":[1,1]}},{"type":"paragraph","children":[{"type":"text","value":"We're not going to cover this in detail, here because we will have an entire in depth guide for permission levels. If you want to pause and learn it now, feel free: ","position":{"start":{"line":188,"column":1,"offset":10471},"end":{"line":188,"column":166,"offset":10636},"indent":[]}},{"type":"link","title":null,"url":"https://discordeno.netlify.app/advanced/permlevels","children":[{"type":"text","value":"Permission Levels Advanced Guide","position":{"start":{"line":188,"column":167,"offset":10637},"end":{"line":188,"column":199,"offset":10669},"indent":[]}}],"position":{"start":{"line":188,"column":166,"offset":10636},"end":{"line":188,"column":252,"offset":10722},"indent":[]}}],"position":{"start":{"line":188,"column":1,"offset":10471},"end":{"line":188,"column":252,"offset":10722},"indent":[]}},{"type":"heading","depth":2,"children":[{"type":"text","value":"Permissions Check Options","position":{"start":{"line":190,"column":4,"offset":10727},"end":{"line":190,"column":29,"offset":10752},"indent":[]}}],"position":{"start":{"line":190,"column":1,"offset":10724},"end":{"line":190,"column":29,"offset":10752},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"Discordeno provides you 4 different types of permission handling that will be done before the command function is executed. This allows you to make sure that the permissions are available before running a command. For example, the role command will require the bot to have ","position":{"start":{"line":192,"column":1,"offset":10754},"end":{"line":192,"column":274,"offset":11027},"indent":[]}},{"type":"strong","children":[{"type":"text","value":"MANAGE ROLES","position":{"start":{"line":192,"column":276,"offset":11029},"end":{"line":192,"column":288,"offset":11041},"indent":[]}}],"position":{"start":{"line":192,"column":274,"offset":11027},"end":{"line":192,"column":290,"offset":11043},"indent":[]}},{"type":"text","value":" permission. This permission comes from the server settings so we can require this in the ","position":{"start":{"line":192,"column":290,"offset":11043},"end":{"line":192,"column":380,"offset":11133},"indent":[]}},{"type":"inlineCode","value":"botServerPermissions","position":{"start":{"line":192,"column":380,"offset":11133},"end":{"line":192,"column":402,"offset":11155},"indent":[]}},{"type":"text","value":".","position":{"start":{"line":192,"column":402,"offset":11155},"end":{"line":192,"column":403,"offset":11156},"indent":[]}}],"position":{"start":{"line":192,"column":1,"offset":10754},"end":{"line":192,"column":403,"offset":11156},"indent":[]}},{"type":"code","lang":"ts","meta":null,"value":"botServerPermissions: [\"MANAGE_ROLES\"],","position":{"start":{"line":194,"column":1,"offset":11158},"end":{"line":196,"column":4,"offset":11207},"indent":[1,1]}},{"type":"paragraph","children":[{"type":"text","value":"Discordeno will provide you easy to use auto-completion as soon as you type a single letter or two. This will help make it easier to use and will warn you when you make a typo and provide a wrong permission by accident.","position":{"start":{"line":198,"column":1,"offset":11209},"end":{"line":198,"column":220,"offset":11428},"indent":[]}}],"position":{"start":{"line":198,"column":1,"offset":11209},"end":{"line":198,"column":220,"offset":11428},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"We also want to make sure that the bot can send a message in this channel so that we can respond to the user. This will check the correct permission heirarchy to make sure that the bot can indeed send a message in this channel.","position":{"start":{"line":200,"column":1,"offset":11430},"end":{"line":200,"column":228,"offset":11657},"indent":[]}}],"position":{"start":{"line":200,"column":1,"offset":11430},"end":{"line":200,"column":228,"offset":11657},"indent":[]}},{"type":"code","lang":"ts","meta":null,"value":"botChannelPermissions: [\"SEND_MESSAGES\"],","position":{"start":{"line":202,"column":1,"offset":11659},"end":{"line":204,"column":4,"offset":11710},"indent":[1,1]}},{"type":"blockquote","children":[{"type":"paragraph","children":[{"type":"strong","children":[{"type":"text","value":"Note:","position":{"start":{"line":206,"column":5,"offset":11716},"end":{"line":206,"column":10,"offset":11721},"indent":[]}}],"position":{"start":{"line":206,"column":3,"offset":11714},"end":{"line":206,"column":12,"offset":11723},"indent":[]}},{"type":"text","value":" If you want to send an embed response, you should also make sure it has the ","position":{"start":{"line":206,"column":12,"offset":11723},"end":{"line":206,"column":89,"offset":11800},"indent":[]}},{"type":"inlineCode","value":"EMBED_LINKS","position":{"start":{"line":206,"column":89,"offset":11800},"end":{"line":206,"column":102,"offset":11813},"indent":[]}},{"type":"text","value":" permission.","position":{"start":{"line":206,"column":102,"offset":11813},"end":{"line":206,"column":114,"offset":11825},"indent":[]}}],"position":{"start":{"line":206,"column":3,"offset":11714},"end":{"line":206,"column":114,"offset":11825},"indent":[]}}],"position":{"start":{"line":206,"column":1,"offset":11712},"end":{"line":206,"column":114,"offset":11825},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"Already we have prevented two of the largest errors that can get our bot banned if it is not checked. Discordeno handles this internally so you don't have to worry about it.","position":{"start":{"line":208,"column":1,"offset":11827},"end":{"line":208,"column":174,"offset":12000},"indent":[]}}],"position":{"start":{"line":208,"column":1,"offset":11827},"end":{"line":208,"column":174,"offset":12000},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"Sometimes, you may also want to make sure that the user using the command has a certain permission to run the command. To do this, you can use the ","position":{"start":{"line":210,"column":1,"offset":12002},"end":{"line":210,"column":148,"offset":12149},"indent":[]}},{"type":"inlineCode","value":"userServerPermissions","position":{"start":{"line":210,"column":148,"offset":12149},"end":{"line":210,"column":171,"offset":12172},"indent":[]}},{"type":"text","value":" or the ","position":{"start":{"line":210,"column":171,"offset":12172},"end":{"line":210,"column":179,"offset":12180},"indent":[]}},{"type":"inlineCode","value":"userChannelPermissions","position":{"start":{"line":210,"column":179,"offset":12180},"end":{"line":210,"column":203,"offset":12204},"indent":[]}},{"type":"text","value":".","position":{"start":{"line":210,"column":203,"offset":12204},"end":{"line":210,"column":204,"offset":12205},"indent":[]}}],"position":{"start":{"line":210,"column":1,"offset":12002},"end":{"line":210,"column":204,"offset":12205},"indent":[]}},{"type":"heading","depth":2,"children":[{"type":"text","value":"Cooldown Options","position":{"start":{"line":212,"column":4,"offset":12210},"end":{"line":212,"column":20,"offset":12226},"indent":[]}}],"position":{"start":{"line":212,"column":1,"offset":12207},"end":{"line":212,"column":20,"offset":12226},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"The cooldown options go hand in hand together.","position":{"start":{"line":214,"column":1,"offset":12228},"end":{"line":214,"column":47,"offset":12274},"indent":[]}}],"position":{"start":{"line":214,"column":1,"offset":12228},"end":{"line":214,"column":47,"offset":12274},"indent":[]}},{"type":"list","ordered":false,"start":null,"spread":false,"children":[{"type":"listItem","spread":false,"checked":null,"children":[{"type":"paragraph","children":[{"type":"inlineCode","value":"seconds","position":{"start":{"line":216,"column":3,"offset":12278},"end":{"line":216,"column":12,"offset":12287},"indent":[]}},{"type":"text","value":" is how long to make the user wait in seconds before they can use the command again. By default, there is no wait time aka 0 seconds.","position":{"start":{"line":216,"column":12,"offset":12287},"end":{"line":216,"column":145,"offset":12420},"indent":[]}}],"position":{"start":{"line":216,"column":3,"offset":12278},"end":{"line":216,"column":145,"offset":12420},"indent":[]}}],"position":{"start":{"line":216,"column":1,"offset":12276},"end":{"line":216,"column":145,"offset":12420},"indent":[]}},{"type":"listItem","spread":false,"checked":null,"children":[{"type":"paragraph","children":[{"type":"inlineCode","value":"allowedUses","position":{"start":{"line":217,"column":3,"offset":12423},"end":{"line":217,"column":16,"offset":12436},"indent":[]}},{"type":"text","value":" is how many times a user is allowed to use a command before they are placed on cooldown.","position":{"start":{"line":217,"column":16,"offset":12436},"end":{"line":217,"column":105,"offset":12525},"indent":[]}}],"position":{"start":{"line":217,"column":3,"offset":12423},"end":{"line":217,"column":105,"offset":12525},"indent":[]}}],"position":{"start":{"line":217,"column":1,"offset":12421},"end":{"line":217,"column":105,"offset":12525},"indent":[]}},{"type":"listItem","spread":false,"checked":null,"children":[{"type":"paragraph","children":[{"type":"text","value":"Let's use our command as an example. We don't want someone to start spamming the role command so we can add a cooldown of 60 seconds. However, this would mean every time you give a role to someone, you would need to wait a whole minute to give a role to someone else. This is where ","position":{"start":{"line":219,"column":1,"offset":12528},"end":{"line":219,"column":283,"offset":12810},"indent":[]}},{"type":"inlineCode","value":"allowedUses","position":{"start":{"line":219,"column":283,"offset":12810},"end":{"line":219,"column":296,"offset":12823},"indent":[]}},{"type":"text","value":" shines! Let's set it to to 5 so that a user can use this command 5 times in a row before being asked to wait for 60 seconds.","position":{"start":{"line":219,"column":296,"offset":12823},"end":{"line":219,"column":421,"offset":12948},"indent":[]}}],"position":{"start":{"line":219,"column":1,"offset":12528},"end":{"line":219,"column":421,"offset":12948},"indent":[]}}],"position":{"start":{"line":218,"column":1,"offset":12526},"end":{"line":219,"column":421,"offset":12948},"indent":[1]}}],"position":{"start":{"line":216,"column":1,"offset":12276},"end":{"line":219,"column":421,"offset":12948},"indent":[1,1,1]}},{"type":"code","lang":"ts","meta":null,"value":"cooldown: {\n seconds: 60,\n allowedUses: 5\n},","position":{"start":{"line":221,"column":1,"offset":12950},"end":{"line":226,"column":4,"offset":13006},"indent":[1,1,1,1,1]}},{"type":"blockquote","children":[{"type":"paragraph","children":[{"type":"strong","children":[{"type":"text","value":"Note:","position":{"start":{"line":228,"column":5,"offset":13012},"end":{"line":228,"column":10,"offset":13017},"indent":[]}}],"position":{"start":{"line":228,"column":3,"offset":13010},"end":{"line":228,"column":12,"offset":13019},"indent":[]}},{"type":"text","value":" It is important to understand the way these two interact. The cooldown starts as soon as the first command is used. So, if a user uses the role command 5 times in 59 seconds, they only have to wait 1 second to do another 5 times.","position":{"start":{"line":228,"column":12,"offset":13019},"end":{"line":228,"column":242,"offset":13249},"indent":[]}}],"position":{"start":{"line":228,"column":3,"offset":13010},"end":{"line":228,"column":242,"offset":13249},"indent":[]}}],"position":{"start":{"line":228,"column":1,"offset":13008},"end":{"line":228,"column":242,"offset":13249},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"Let's give this a try shall we.","position":{"start":{"line":230,"column":1,"offset":13251},"end":{"line":230,"column":32,"offset":13282},"indent":[]}}],"position":{"start":{"line":230,"column":1,"offset":13251},"end":{"line":230,"column":32,"offset":13282},"indent":[]}},{"type":"list","ordered":true,"start":1,"spread":false,"children":[{"type":"listItem","spread":false,"checked":null,"children":[{"type":"paragraph","children":[{"type":"inlineCode","value":"!reload commands","position":{"start":{"line":232,"column":4,"offset":13287},"end":{"line":232,"column":22,"offset":13305},"indent":[]}}],"position":{"start":{"line":232,"column":4,"offset":13287},"end":{"line":232,"column":22,"offset":13305},"indent":[]}}],"position":{"start":{"line":232,"column":1,"offset":13284},"end":{"line":232,"column":22,"offset":13305},"indent":[]}},{"type":"listItem","spread":false,"checked":null,"children":[{"type":"paragraph","children":[{"type":"text","value":"Spam the ","position":{"start":{"line":233,"column":4,"offset":13309},"end":{"line":233,"column":13,"offset":13318},"indent":[]}},{"type":"inlineCode","value":"!role","position":{"start":{"line":233,"column":13,"offset":13318},"end":{"line":233,"column":20,"offset":13325},"indent":[]}},{"type":"text","value":" very quickly 6 times in under a minute.","position":{"start":{"line":233,"column":20,"offset":13325},"end":{"line":233,"column":60,"offset":13365},"indent":[]}}],"position":{"start":{"line":233,"column":4,"offset":13309},"end":{"line":233,"column":60,"offset":13365},"indent":[]}}],"position":{"start":{"line":233,"column":1,"offset":13306},"end":{"line":233,"column":60,"offset":13365},"indent":[]}}],"position":{"start":{"line":232,"column":1,"offset":13284},"end":{"line":233,"column":60,"offset":13365},"indent":[1]}},{"type":"heading","depth":2,"children":[{"type":"text","value":"Arguments","position":{"start":{"line":235,"column":4,"offset":13370},"end":{"line":235,"column":13,"offset":13379},"indent":[]}}],"position":{"start":{"line":235,"column":1,"offset":13367},"end":{"line":235,"column":13,"offset":13379},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"Arguments is an incredibly powerful feature in Discordeno. Like Permission Levels we will have an in depth look at arguments later in the guide. For now, let's try and understand this in a simple manner.","position":{"start":{"line":237,"column":1,"offset":13381},"end":{"line":237,"column":204,"offset":13584},"indent":[]}}],"position":{"start":{"line":237,"column":1,"offset":13381},"end":{"line":237,"column":204,"offset":13584},"indent":[]}},{"type":"list","ordered":false,"start":null,"spread":false,"children":[{"type":"listItem","spread":false,"checked":null,"children":[{"type":"paragraph","children":[{"type":"inlineCode","value":"name","position":{"start":{"line":239,"column":3,"offset":13588},"end":{"line":239,"column":9,"offset":13594},"indent":[]}},{"type":"text","value":": The name of the argument. Useful for when you need to alert the user X arg is missing or when you want to use the arg in your command.","position":{"start":{"line":239,"column":9,"offset":13594},"end":{"line":239,"column":145,"offset":13730},"indent":[]}}],"position":{"start":{"line":239,"column":3,"offset":13588},"end":{"line":239,"column":145,"offset":13730},"indent":[]}}],"position":{"start":{"line":239,"column":1,"offset":13586},"end":{"line":239,"column":145,"offset":13730},"indent":[]}},{"type":"listItem","spread":false,"checked":null,"children":[{"type":"paragraph","children":[{"type":"inlineCode","value":"type","position":{"start":{"line":240,"column":3,"offset":13733},"end":{"line":240,"column":9,"offset":13739},"indent":[]}},{"type":"text","value":": The type of the argument you would like. Defaults to string. Some of the ones available by default are \"number\", \"string\", \"...string\", \"boolean\", \"subcommand\", \"member\".","position":{"start":{"line":240,"column":9,"offset":13739},"end":{"line":240,"column":181,"offset":13911},"indent":[]}}],"position":{"start":{"line":240,"column":3,"offset":13733},"end":{"line":240,"column":181,"offset":13911},"indent":[]}}],"position":{"start":{"line":240,"column":1,"offset":13731},"end":{"line":240,"column":181,"offset":13911},"indent":[]}},{"type":"listItem","spread":false,"checked":null,"children":[{"type":"paragraph","children":[{"type":"inlineCode","value":"missing","position":{"start":{"line":241,"column":3,"offset":13914},"end":{"line":241,"column":12,"offset":13923},"indent":[]}},{"type":"text","value":": a function that will be run when this argument is not provided by the user or if the provided argument is not valid. By default, it does nothing.","position":{"start":{"line":241,"column":12,"offset":13923},"end":{"line":241,"column":159,"offset":14070},"indent":[]}}],"position":{"start":{"line":241,"column":3,"offset":13914},"end":{"line":241,"column":159,"offset":14070},"indent":[]}}],"position":{"start":{"line":241,"column":1,"offset":13912},"end":{"line":241,"column":159,"offset":14070},"indent":[]}},{"type":"listItem","spread":false,"checked":null,"children":[{"type":"paragraph","children":[{"type":"inlineCode","value":"required","position":{"start":{"line":242,"column":3,"offset":14073},"end":{"line":242,"column":13,"offset":14083},"indent":[]}},{"type":"text","value":": Whether this argument is required or optional. By default, this is true.","position":{"start":{"line":242,"column":13,"offset":14083},"end":{"line":242,"column":87,"offset":14157},"indent":[]}}],"position":{"start":{"line":242,"column":3,"offset":14073},"end":{"line":242,"column":87,"offset":14157},"indent":[]}}],"position":{"start":{"line":242,"column":1,"offset":14071},"end":{"line":242,"column":87,"offset":14157},"indent":[]}},{"type":"listItem","spread":false,"checked":null,"children":[{"type":"paragraph","children":[{"type":"inlineCode","value":"lowercase","position":{"start":{"line":243,"column":3,"offset":14160},"end":{"line":243,"column":14,"offset":14171},"indent":[]}},{"type":"text","value":": If the type is a string, this can forcibly lowercase the string.","position":{"start":{"line":243,"column":14,"offset":14171},"end":{"line":243,"column":80,"offset":14237},"indent":[]}}],"position":{"start":{"line":243,"column":3,"offset":14160},"end":{"line":243,"column":80,"offset":14237},"indent":[]}}],"position":{"start":{"line":243,"column":1,"offset":14158},"end":{"line":243,"column":80,"offset":14237},"indent":[]}},{"type":"listItem","spread":false,"checked":null,"children":[{"type":"paragraph","children":[{"type":"inlineCode","value":"literals","position":{"start":{"line":244,"column":3,"offset":14240},"end":{"line":244,"column":13,"offset":14250},"indent":[]}},{"type":"text","value":": If the type is string or subcommand you can provide literals. The argument MUST be exactly the same as the literals to be accepted. For example, if you want to make sure the argument is ","position":{"start":{"line":244,"column":13,"offset":14250},"end":{"line":244,"column":201,"offset":14438},"indent":[]}},{"type":"inlineCode","value":"a","position":{"start":{"line":244,"column":201,"offset":14438},"end":{"line":244,"column":204,"offset":14441},"indent":[]}},{"type":"text","value":" or ","position":{"start":{"line":244,"column":204,"offset":14441},"end":{"line":244,"column":208,"offset":14445},"indent":[]}},{"type":"inlineCode","value":"b","position":{"start":{"line":244,"column":208,"offset":14445},"end":{"line":244,"column":211,"offset":14448},"indent":[]}},{"type":"text","value":" only and not ","position":{"start":{"line":244,"column":211,"offset":14448},"end":{"line":244,"column":225,"offset":14462},"indent":[]}},{"type":"inlineCode","value":"c","position":{"start":{"line":244,"column":225,"offset":14462},"end":{"line":244,"column":228,"offset":14465},"indent":[]}},{"type":"text","value":".","position":{"start":{"line":244,"column":228,"offset":14465},"end":{"line":244,"column":229,"offset":14466},"indent":[]}}],"position":{"start":{"line":244,"column":3,"offset":14240},"end":{"line":244,"column":229,"offset":14466},"indent":[]}}],"position":{"start":{"line":244,"column":1,"offset":14238},"end":{"line":244,"column":229,"offset":14466},"indent":[]}},{"type":"listItem","spread":false,"checked":null,"children":[{"type":"paragraph","children":[{"type":"inlineCode","value":"defaultValue","position":{"start":{"line":245,"column":3,"offset":14469},"end":{"line":245,"column":17,"offset":14483},"indent":[]}},{"type":"text","value":": The default value for this argument/subcommand. If the user does not provide an argument or it is invalid, it can be defaulted to a certain value.","position":{"start":{"line":245,"column":17,"offset":14483},"end":{"line":245,"column":165,"offset":14631},"indent":[]}}],"position":{"start":{"line":245,"column":3,"offset":14469},"end":{"line":245,"column":165,"offset":14631},"indent":[]}}],"position":{"start":{"line":245,"column":1,"offset":14467},"end":{"line":245,"column":165,"offset":14631},"indent":[]}}],"position":{"start":{"line":239,"column":1,"offset":13586},"end":{"line":245,"column":165,"offset":14631},"indent":[1,1,1,1,1,1]}},{"type":"paragraph","children":[{"type":"text","value":"For our role command, we need a ","position":{"start":{"line":247,"column":1,"offset":14633},"end":{"line":247,"column":33,"offset":14665},"indent":[]}},{"type":"inlineCode","value":"member","position":{"start":{"line":247,"column":33,"offset":14665},"end":{"line":247,"column":41,"offset":14673},"indent":[]}},{"type":"text","value":" and a ","position":{"start":{"line":247,"column":41,"offset":14673},"end":{"line":247,"column":48,"offset":14680},"indent":[]}},{"type":"inlineCode","value":"role","position":{"start":{"line":247,"column":48,"offset":14680},"end":{"line":247,"column":54,"offset":14686},"indent":[]}},{"type":"text","value":".","position":{"start":{"line":247,"column":54,"offset":14686},"end":{"line":247,"column":55,"offset":14687},"indent":[]}}],"position":{"start":{"line":247,"column":1,"offset":14633},"end":{"line":247,"column":55,"offset":14687},"indent":[]}},{"type":"code","lang":"ts","meta":null,"value":"arguments: [\n {\n name: \"member\",\n type: \"member\",\n missing: (message) => {\n sendResponse(message, `you did not provide a member to give the role to. You can provide a @member mention, a member ID, or try using their nickname/username. The nickname/username will only work if they have been active in your server recently.`)\n }\n },\n {\n name: \"role\",\n type: \"role\",\n missing: (message) => {\n sendResponse(message, `you did not provide a role to give. You can provide a @role mention, a role ID, or it's name. If the role name did not work, try to use the **roleinfo** command to get the role ID.`)\n }\n }\n]","position":{"start":{"line":249,"column":1,"offset":14689},"end":{"line":266,"column":4,"offset":15340},"indent":[1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1]}},{"type":"heading","depth":2,"children":[{"type":"text","value":"Execute Option","position":{"start":{"line":268,"column":4,"offset":15345},"end":{"line":268,"column":18,"offset":15359},"indent":[]}}],"position":{"start":{"line":268,"column":1,"offset":15342},"end":{"line":268,"column":18,"offset":15359},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"The execute option is the code that will run when the command is triggered. The execute function is passed 3 parameters that you can use in your command.","position":{"start":{"line":270,"column":1,"offset":15361},"end":{"line":270,"column":154,"offset":15514},"indent":[]}}],"position":{"start":{"line":270,"column":1,"offset":15361},"end":{"line":270,"column":154,"offset":15514},"indent":[]}},{"type":"list","ordered":false,"start":null,"spread":false,"children":[{"type":"listItem","spread":false,"checked":null,"children":[{"type":"paragraph","children":[{"type":"inlineCode","value":"message","position":{"start":{"line":272,"column":3,"offset":15518},"end":{"line":272,"column":12,"offset":15527},"indent":[]}},{"type":"text","value":": The message object itself that triggered this command.","position":{"start":{"line":272,"column":12,"offset":15527},"end":{"line":272,"column":68,"offset":15583},"indent":[]}}],"position":{"start":{"line":272,"column":3,"offset":15518},"end":{"line":272,"column":68,"offset":15583},"indent":[]}}],"position":{"start":{"line":272,"column":1,"offset":15516},"end":{"line":272,"column":68,"offset":15583},"indent":[]}},{"type":"listItem","spread":false,"checked":null,"children":[{"type":"paragraph","children":[{"type":"inlineCode","value":"args","position":{"start":{"line":273,"column":3,"offset":15586},"end":{"line":273,"column":9,"offset":15592},"indent":[]}},{"type":"text","value":": The args that were provided by the user.","position":{"start":{"line":273,"column":9,"offset":15592},"end":{"line":273,"column":51,"offset":15634},"indent":[]}}],"position":{"start":{"line":273,"column":3,"offset":15586},"end":{"line":273,"column":51,"offset":15634},"indent":[]}}],"position":{"start":{"line":273,"column":1,"offset":15584},"end":{"line":273,"column":51,"offset":15634},"indent":[]}},{"type":"listItem","spread":false,"checked":null,"children":[{"type":"paragraph","children":[{"type":"inlineCode","value":"guild","position":{"start":{"line":274,"column":3,"offset":15637},"end":{"line":274,"column":10,"offset":15644},"indent":[]}},{"type":"text","value":": The server guild object where this command was run.","position":{"start":{"line":274,"column":10,"offset":15644},"end":{"line":274,"column":63,"offset":15697},"indent":[]}}],"position":{"start":{"line":274,"column":3,"offset":15637},"end":{"line":274,"column":63,"offset":15697},"indent":[]}}],"position":{"start":{"line":274,"column":1,"offset":15635},"end":{"line":274,"column":63,"offset":15697},"indent":[]}}],"position":{"start":{"line":272,"column":1,"offset":15516},"end":{"line":274,"column":63,"offset":15697},"indent":[1,1]}},{"type":"code","lang":"ts","meta":null,"value":"execute: function (message, args, guild) {\n // The code that is to be executed goes here\n}","position":{"start":{"line":276,"column":1,"offset":15699},"end":{"line":280,"column":4,"offset":15800},"indent":[1,1,1,1]}},{"type":"blockquote","children":[{"type":"paragraph","children":[{"type":"strong","children":[{"type":"text","value":"Note:","position":{"start":{"line":282,"column":5,"offset":15806},"end":{"line":282,"column":10,"offset":15811},"indent":[]}}],"position":{"start":{"line":282,"column":3,"offset":15804},"end":{"line":282,"column":12,"offset":15813},"indent":[]}},{"type":"text","value":" I prefer writing code using the function keyword, but you can easily change to the fat arrow function if you prefer.","position":{"start":{"line":282,"column":12,"offset":15813},"end":{"line":282,"column":129,"offset":15930},"indent":[]}}],"position":{"start":{"line":282,"column":3,"offset":15804},"end":{"line":282,"column":129,"offset":15930},"indent":[]}},{"type":"code","lang":"ts","meta":null,"value":"execute: (message, args, guild) => {\n // The code that is to be executed goes here\n}","position":{"start":{"line":283,"column":3,"offset":15933},"end":{"line":287,"column":6,"offset":16037},"indent":[3,3,3,3]}}],"position":{"start":{"line":282,"column":1,"offset":15802},"end":{"line":287,"column":6,"offset":16037},"indent":[1,1,1,1,1]}},{"type":"paragraph","children":[{"type":"text","value":"Let's start out by writing some pseudo-code(comments that will help us plan the code).","position":{"start":{"line":289,"column":1,"offset":16039},"end":{"line":289,"column":87,"offset":16125},"indent":[]}}],"position":{"start":{"line":289,"column":1,"offset":16039},"end":{"line":289,"column":87,"offset":16125},"indent":[]}},{"type":"code","lang":"ts","meta":null,"value":"execute: function (message, args, guild) {\n // If this was the everyone role alert with a silly error\n\n // If this is a managed role(some bots role) we can't give/remove alert with silly error\n\n // Get the bots highest role\n\n // Check if the bot has a role higher than the role that it will try to give.\n\n // If the role is too high alert the user.\n\n // If the user has this role already remove the role from them.\n\n // Check the command author's highest role\n\n // If the author does not have a role high enough to give this role alert\n\n // If the user has this role already we should remove it\n\n // Add the role to the user.\n\n // Alert the user that used the command that the user has been give the role.\n}","position":{"start":{"line":291,"column":1,"offset":16127},"end":{"line":315,"column":4,"offset":16855},"indent":[1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1]}},{"type":"paragraph","children":[{"type":"text","value":"Nice! The plan for the code is complete. Now, let's add in the code.","position":{"start":{"line":317,"column":1,"offset":16857},"end":{"line":317,"column":69,"offset":16925},"indent":[]}}],"position":{"start":{"line":317,"column":1,"offset":16857},"end":{"line":317,"column":69,"offset":16925},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"The first thing we are going to try is to check if the role the user provided is the same as the everyone role.","position":{"start":{"line":319,"column":1,"offset":16927},"end":{"line":319,"column":112,"offset":17038},"indent":[]}}],"position":{"start":{"line":319,"column":1,"offset":16927},"end":{"line":319,"column":112,"offset":17038},"indent":[]}},{"type":"blockquote","children":[{"type":"paragraph","children":[{"type":"strong","children":[{"type":"text","value":"Note:","position":{"start":{"line":321,"column":5,"offset":17044},"end":{"line":321,"column":10,"offset":17049},"indent":[]}}],"position":{"start":{"line":321,"column":3,"offset":17042},"end":{"line":321,"column":12,"offset":17051},"indent":[]}},{"type":"text","value":" The everyone role ID is the same as the server guild ID.","position":{"start":{"line":321,"column":12,"offset":17051},"end":{"line":321,"column":69,"offset":17108},"indent":[]}}],"position":{"start":{"line":321,"column":3,"offset":17042},"end":{"line":321,"column":69,"offset":17108},"indent":[]}}],"position":{"start":{"line":321,"column":1,"offset":17040},"end":{"line":321,"column":69,"offset":17108},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"To do this, we are going to want something like this:","position":{"start":{"line":323,"column":1,"offset":17110},"end":{"line":323,"column":54,"offset":17163},"indent":[]}}],"position":{"start":{"line":323,"column":1,"offset":17110},"end":{"line":323,"column":54,"offset":17163},"indent":[]}},{"type":"code","lang":"ts","meta":null,"value":"if (args.role.id === message.guildID) {\n return sendResponse(message, \"The everyone role can not be given to anyone because everyone has the everyone role already. *Keep calm and let Carter figure it out*!\");\n}","position":{"start":{"line":325,"column":1,"offset":17165},"end":{"line":329,"column":4,"offset":17386},"indent":[1,1,1,1]}},{"type":"paragraph","children":[{"type":"text","value":"You might be seeing an error since we didn't provide the accurate typings for the ","position":{"start":{"line":331,"column":1,"offset":17388},"end":{"line":331,"column":83,"offset":17470},"indent":[]}},{"type":"inlineCode","value":"args","position":{"start":{"line":331,"column":83,"offset":17470},"end":{"line":331,"column":89,"offset":17476},"indent":[]}},{"type":"text","value":" parameter. The message and guild parameter is automated but the args is dynamic depending on your ","position":{"start":{"line":331,"column":89,"offset":17476},"end":{"line":331,"column":188,"offset":17575},"indent":[]}},{"type":"inlineCode","value":"arguments","position":{"start":{"line":331,"column":188,"offset":17575},"end":{"line":331,"column":199,"offset":17586},"indent":[]}},{"type":"text","value":" option for your command. So let's do this real quick.","position":{"start":{"line":331,"column":199,"offset":17586},"end":{"line":331,"column":253,"offset":17640},"indent":[]}}],"position":{"start":{"line":331,"column":1,"offset":17388},"end":{"line":331,"column":253,"offset":17640},"indent":[]}},{"type":"code","lang":"ts","meta":null,"value":"execute: function (message, args: RoleArgs, guild) {\n // If this was the everyone role alert with a silly error\n if (args.role.id === message.guildID) {\n return sendResponse(message, \"Are you trying to make this person a super hero? Everyone has the everyone role. I can't give the everyone role to another user.\");\n }\n\n // Lots of comments here hidden so you can see the changes easily.\n}\n\ninterface RoleArgs {\n role: Role;\n member: Member;\n}","position":{"start":{"line":333,"column":1,"offset":17642},"end":{"line":347,"column":4,"offset":18104},"indent":[1,1,1,1,1,1,1,1,1,1,1,1,1,1]}},{"type":"paragraph","children":[{"type":"text","value":"Awesome! Let's keep going.","position":{"start":{"line":349,"column":1,"offset":18106},"end":{"line":349,"column":27,"offset":18132},"indent":[]}}],"position":{"start":{"line":349,"column":1,"offset":18106},"end":{"line":349,"column":27,"offset":18132},"indent":[]}},{"type":"code","lang":"ts","meta":null,"value":"execute: function (message, args: RoleArgs, guild) {\n // If this was the everyone role alert with a silly error\n if (args.role.id === message.guildID) {\n return sendResponse(message, \"I don't know if you noticed or not but I'm an extremely arrogant bot who tends to think all of his plans will work. But I can't give the everyone role to someone.\");\n }\n\n // If this is a managed role(some bots role) we can't give/remove alert with silly error\n if (args.role.managed) {\n return sendResponse(message, \"Dammit man, just 'cause I'm Scottish doesn't mean I can give your people managed roles.\")\n }\n\n // Get the bots highest role\n const botsHighestRole = highestRole(message.guildID, botID);\n\n // Check if the bot has a role higher than the role that it will try to give.\n const botIsHigher = higherRolePosition(message.guildID, botsHighestRole.id, args.role.id)\n\n // If the role is too high alert the user.\n if (!botIsHigher) {\n return sendResponse(message, \"Okay look, asking me give a role that is higher than my highest role is ridiculous! I am the first bot to admit I don't know who these people are nor do I care to. Look, if you'd like I could take you down the hall and just point at the people who annoy me more than the rest. But that's about as useful as I get.\")\n }\n\n // Check the command author's highest role\n const membersHighestRole = highestRole(message.guildID, message.author.id);\n\n // If the author does not have a role high enough to give this role alert\n if (!higherRolePosition(message.guildID, membersHighestRole.id, args.role.id)) {\n return sendResponse(message, \"In my culture, whenever someone tries to give a role that is higher than their highest role, I would be well within my rights to dismember you.\")\n }\n\n // If the user has this role already we should remove it\n if (message.member().roles.includes(args.role.id)) {\n removeRole(message.guildID, args.member.user.id, args.role.id, `${message.author.tag} used the role command to remove this role.`)\n // Alert the user that used the command that the user has lost the role.\n return sendResponse(message, `The role **${args.role.name}** has been removed from **${args.member.tag}**.`)\n }\n\n // Add the role to the user.\n addRole(guildID, memberID, roleID)\n\n // Alert the user that used the command that the user has been give the role.\n return sendResponse(message, `The role **${args.role.name}** has been added to **${args.member.tag}**.`)\n}","position":{"start":{"line":352,"column":1,"offset":18135},"end":{"line":396,"column":4,"offset":20611},"indent":[1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1]}},{"type":"paragraph","children":[{"type":"text","value":"The final version of the command should look something like this:","position":{"start":{"line":398,"column":1,"offset":20613},"end":{"line":398,"column":66,"offset":20678},"indent":[]}}],"position":{"start":{"line":398,"column":1,"offset":20613},"end":{"line":398,"column":66,"offset":20678},"indent":[]}},{"type":"code","lang":"ts","meta":null,"value":"import { highestRole, higherRolePosition, botID, removeRole, addRole, Role, Member } from \"../../deps.ts\";\nimport { botCache } from \"../../mod.ts\";\nimport { PermissionLevels } from \"../types/commands.ts\";\nimport { sendResponse } from \"../utils/helpers.ts\";\n\nbotCache.commands.set(\"role\", {\n name: \"role\",\n permissionLevel: [PermissionLevels.MODERATOR, PermissionLevels.ADMIN],\n botServerPermissions: [\"MANAGE_ROLES\"],\n botChannelPermissions: [\"SEND_MESSAGES\"],\n cooldown: {\n seconds: 60,\n allowedUses: 5,\n },\n arguments: [\n\t\t{\n\t\t\tname: \"member\",\n\t\t\ttype: \"member\",\n\t\t\tmissing: (message) => {\n\t\t\t\tsendResponse(message, `you did not provide a member to give the role to. You can provide a @member mention, a member ID, or try using their nickname/username. The nickname/username will only work if they have been active in your server recently.`)\n\t\t\t}\n\t\t},\n\t\t{\n\t\t\tname: \"role\",\n\t\t\ttype: \"role\",\n\t\t\tmissing: (message) => {\n\t\t\t\tsendResponse(message, `you did not provide a role to give. You can provide a @role mention, a role ID, or it's name. If the role name did not work, try to use the **roleinfo** command to get the role ID.`)\n\t\t\t}\n\t\t}\n\t],\n execute: function (message, args: RoleArgs) {\n // If this was the everyone role alert with a silly error\n if (args.role.id === message.guildID) {\n return sendResponse(\n message,\n \"I don't know if you noticed or not but I'm an extremely arrogant bot who tends to think all of his plans will work. But I can't give the everyone role to someone.\",\n );\n }\n\n // If this is a managed role(some bots role) we can't give/remove alert with silly error\n if (args.role.managed) {\n return sendResponse(\n message,\n \"Dammit man, just 'cause I'm Scottish doesn't mean I can give your people managed roles.\",\n );\n }\n\n // Get the bots highest role\n const botsHighestRole = highestRole(message.guildID, botID);\n\n // Check if the bot has a role higher than the role that it will try to give. If the role is too high alert the user.\n if (!botsHighestRole || !higherRolePosition(\n message.guildID,\n botsHighestRole.id,\n args.role.id,\n )) {\n return sendResponse(\n message,\n \"Okay look, asking me give a role that is higher than my highest role is ridiculous! I am the first bot to admit I don't know who these people are nor do I care to. Look, if you'd like I could take you down the hall and just point at the people who annoy me more than the rest. But that's about as useful as I get.\",\n );\n }\n\n // Check the command author's highest role\n const membersHighestRole = highestRole(message.guildID, message.author.id);\n\n // If the author does not have a role high enough to give this role alert\n if (!membersHighestRole ||\n !higherRolePosition(message.guildID, membersHighestRole.id, args.role.id)\n ) {\n return sendResponse(\n message,\n \"In my culture, whenever someone tries to give a role that is higher than their highest role, I would be well within my rights to dismember you.\",\n );\n }\n\n // If the user has this role already we should remove it\n if (message.member()?.roles.includes(args.role.id)) {\n removeRole(\n message.guildID,\n args.member.user.id,\n args.role.id,\n `${message.author.username} used the role command to remove this role.`,\n );\n // Alert the user that used the command that the user has lost the role.\n return sendResponse(\n message,\n `The role **${args.role.name}** has been removed from **${args.member.tag}**.`,\n );\n }\n\n // Add the role to the user.\n addRole(message.guildID, args.member.user.id, args.role.id, `${message.author.username} used the role command to give this role.`);\n\n // Alert the user that used the command that the user has been give the role.\n return sendResponse(\n message,\n `The role **${args.role.name}** has been added to **${args.member.tag}**.`,\n );\n },\n});\n\ninterface RoleArgs {\n role: Role;\n member: Member;\n}","position":{"start":{"line":400,"column":1,"offset":20680},"end":{"line":506,"column":4,"offset":24762},"indent":[1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1]}},{"type":"blockquote","children":[{"type":"paragraph","children":[{"type":"strong","children":[{"type":"text","value":"Note:","position":{"start":{"line":508,"column":5,"offset":24768},"end":{"line":508,"column":10,"offset":24773},"indent":[]}}],"position":{"start":{"line":508,"column":3,"offset":24766},"end":{"line":508,"column":12,"offset":24775},"indent":[]}},{"type":"text","value":" The response strings are a play on some funny Stargate(my favorite tv show) moments. Feel free to change as you wish to fit your bot's personality.","position":{"start":{"line":508,"column":12,"offset":24775},"end":{"line":508,"column":160,"offset":24923},"indent":[]}}],"position":{"start":{"line":508,"column":3,"offset":24766},"end":{"line":508,"column":160,"offset":24923},"indent":[]}}],"position":{"start":{"line":508,"column":1,"offset":24764},"end":{"line":508,"column":160,"offset":24923},"indent":[]}},{"type":"heading","depth":2,"children":[{"type":"text","value":"Dynamic(Advanced Level) Command Creation","position":{"start":{"line":510,"column":4,"offset":24928},"end":{"line":510,"column":44,"offset":24968},"indent":[]}}],"position":{"start":{"line":510,"column":1,"offset":24925},"end":{"line":510,"column":44,"offset":24968},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"This is some advanced level super magical command creation skills. Discordeno gives you the power to dynamically create commands. What that means is you can write the code for one command but dynamically create like 50 commands using that same code.","position":{"start":{"line":512,"column":1,"offset":24970},"end":{"line":512,"column":250,"offset":25219},"indent":[]}}],"position":{"start":{"line":512,"column":1,"offset":24970},"end":{"line":512,"column":250,"offset":25219},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"For example, in my main bot I have a lot of \"fun\" commands like ","position":{"start":{"line":514,"column":1,"offset":25221},"end":{"line":514,"column":65,"offset":25285},"indent":[]}},{"type":"inlineCode","value":".hug","position":{"start":{"line":514,"column":65,"offset":25285},"end":{"line":514,"column":71,"offset":25291},"indent":[]}},{"type":"text","value":" or ","position":{"start":{"line":514,"column":71,"offset":25291},"end":{"line":514,"column":75,"offset":25295},"indent":[]}},{"type":"inlineCode","value":".kiss","position":{"start":{"line":514,"column":75,"offset":25295},"end":{"line":514,"column":82,"offset":25302},"indent":[]}},{"type":"text","value":" etc... All of these files have the exact same code except for 1 word being the command name. Would it not be better to simply write the code once and dynamically create every single command. Let me show you how that works.","position":{"start":{"line":514,"column":82,"offset":25302},"end":{"line":514,"column":305,"offset":25525},"indent":[]}}],"position":{"start":{"line":514,"column":1,"offset":25221},"end":{"line":514,"column":305,"offset":25525},"indent":[]}},{"type":"list","ordered":false,"start":null,"spread":false,"children":[{"type":"listItem","spread":false,"checked":null,"children":[{"type":"paragraph","children":[{"type":"text","value":"Create a file in the commands folder called ","position":{"start":{"line":516,"column":3,"offset":25529},"end":{"line":516,"column":47,"offset":25573},"indent":[]}},{"type":"inlineCode","value":"fun.ts","position":{"start":{"line":516,"column":47,"offset":25573},"end":{"line":516,"column":55,"offset":25581},"indent":[]}},{"type":"text","value":" which will create all our fun commands.","position":{"start":{"line":516,"column":55,"offset":25581},"end":{"line":516,"column":95,"offset":25621},"indent":[]}}],"position":{"start":{"line":516,"column":3,"offset":25529},"end":{"line":516,"column":95,"offset":25621},"indent":[]}}],"position":{"start":{"line":516,"column":1,"offset":25527},"end":{"line":516,"column":95,"offset":25621},"indent":[]}}],"position":{"start":{"line":516,"column":1,"offset":25527},"end":{"line":516,"column":95,"offset":25621},"indent":[]}},{"type":"code","lang":"ts","meta":null,"value":"import { Member, sendMessage, chooseRandom, avatarURL } from \"../../deps.ts\";\nimport { botCache } from \"../../mod.ts\";\nimport { createCommandAliases, sendEmbed } from \"../utils/helpers.ts\";\nimport { configs } from \"../../configs.ts\";\nimport { Embed } from \"../utils/Embed.ts\";\nimport { translate } from \"../utils/i18next.ts\";\n\nconst funCommandData = [\n { name: \"bite\", gifs: configs.gifs.bite },\n { name: \"cuddle\", gifs: configs.gifs.cuddle },\n { name: \"dance\", gifs: configs.gifs.dance },\n { name: \"hug\", gifs: configs.gifs.hug },\n { name: \"kiss\", gifs: configs.gifs.kiss },\n { name: \"kanna\", gifs: configs.gifs.kanna },\n { name: \"kiss\", gifs: configs.gifs.kiss },\n { name: \"kitten\", gifs: configs.gifs.kitten },\n { name: \"lmao\", gifs: configs.gifs.lmao, aliases: [\"lol\"] },\n { name: \"pat\", gifs: configs.gifs.pat },\n { name: \"poke\", gifs: configs.gifs.poke },\n { name: \"pony\", gifs: configs.gifs.pony },\n { name: \"puppy\", gifs: configs.gifs.puppy },\n { name: \"raphtalia\", gifs: configs.gifs.raphtalia },\n { name: \"stargate\", gifs: configs.gifs.stargate },\n { name: \"supernatural\", gifs: configs.gifs.supernatural },\n { name: \"tickle\", gifs: configs.gifs.tickle },\n { name: \"zerotwo\", gifs: configs.gifs.zerotwo },\n];\n\nfunCommandData.forEach((data) => {\n botCache.commands.set(data.name, {\n name: data.name,\n botChannelPermissions: [\"SEND_MESSAGES\", \"EMBED_LINKS\"],\n cooldown: {\n seconds: 2,\n },\n arguments: [\n {\n name: \"member\",\n type: \"member\",\n required: false,\n },\n ],\n execute: function (message, args: FunArgs) {\n\t\t\t// If a member is provided use that otherwise set the member themself\n const member = args.member || message.member()!;\n\n const type = member.user.id === message.author.id\n // Silly response like if user tries to hug themself\n ? \"SELF\"\n // Response for when user tries to hug another user\n : \"OTHER\";\n\n\n // Create an embed\n const embed = new Embed()\n .setAuthor(member.tag, avatarURL(member))\n .setDescription(\n translate(\n message.guildID,\n `commands/fun/${data.name}:${type}`,\n { mention: message.member()!.mention, user: member.mention },\n ),\n )\n .setImage(chooseRandom(data.gifs));\n\n return sendEmbed(message.channel, embed);\n },\n });\n\n if (data.aliases?.length) {\n createCommandAliases(data.name, data.aliases);\n }\n});\n\ninterface FunArgs {\n member?: Member;\n}","position":{"start":{"line":518,"column":1,"offset":25623},"end":{"line":596,"column":4,"offset":28138},"indent":[1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1]}},{"type":"blockquote","children":[{"type":"paragraph","children":[{"type":"strong","children":[{"type":"text","value":"Note:","position":{"start":{"line":598,"column":5,"offset":28144},"end":{"line":598,"column":10,"offset":28149},"indent":[]}}],"position":{"start":{"line":598,"column":3,"offset":28142},"end":{"line":598,"column":12,"offset":28151},"indent":[]}},{"type":"text","value":" The imports in this are a bit different. I did this to show you that you can also import everything grouped like this through the ","position":{"start":{"line":598,"column":12,"offset":28151},"end":{"line":598,"column":143,"offset":28282},"indent":[]}},{"type":"inlineCode","value":"deps.ts","position":{"start":{"line":598,"column":143,"offset":28282},"end":{"line":598,"column":152,"offset":28291},"indent":[]}},{"type":"text","value":" which will make everything available to you at ease.","position":{"start":{"line":598,"column":152,"offset":28291},"end":{"line":598,"column":205,"offset":28344},"indent":[]}}],"position":{"start":{"line":598,"column":3,"offset":28142},"end":{"line":598,"column":205,"offset":28344},"indent":[]}}],"position":{"start":{"line":598,"column":1,"offset":28140},"end":{"line":598,"column":205,"offset":28344},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"Take a minute to realize what just happened. This has made 18 different unique commands dynamically. In 1 file, using the same piece of code, we created so many commands. You can easily add more commands to this. For example, if you wanted to add weeb(animated) versions of these commands. Then you are at 36 commands with 1 simple command file.","position":{"start":{"line":600,"column":1,"offset":28346},"end":{"line":600,"column":346,"offset":28691},"indent":[]}}],"position":{"start":{"line":600,"column":1,"offset":28346},"end":{"line":600,"column":346,"offset":28691},"indent":[]}},{"type":"paragraph","children":[{"type":"strong","children":[{"type":"text","value":"That ladies and gentleman is the power and magic of Discordeno!","position":{"start":{"line":602,"column":3,"offset":28695},"end":{"line":602,"column":66,"offset":28758},"indent":[]}}],"position":{"start":{"line":602,"column":1,"offset":28693},"end":{"line":602,"column":68,"offset":28760},"indent":[]}}],"position":{"start":{"line":602,"column":1,"offset":28693},"end":{"line":602,"column":68,"offset":28760},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"Take a minute to stand up, step back and make some room around you. Now start dancing because you just acheived one of the most complex things in bot development. You have already created about 36 commands!!!!","position":{"start":{"line":604,"column":1,"offset":28762},"end":{"line":604,"column":210,"offset":28971},"indent":[]}}],"position":{"start":{"line":604,"column":1,"offset":28762},"end":{"line":604,"column":210,"offset":28971},"indent":[]}},{"type":"blockquote","children":[{"type":"paragraph","children":[{"type":"strong","children":[{"type":"text","value":"Note:","position":{"start":{"line":606,"column":5,"offset":28977},"end":{"line":606,"column":10,"offset":28982},"indent":[]}}],"position":{"start":{"line":606,"column":3,"offset":28975},"end":{"line":606,"column":12,"offset":28984},"indent":[]}},{"type":"text","value":" The command above uses translations which we will cover in depth in a later section of this guide.","position":{"start":{"line":606,"column":12,"offset":28984},"end":{"line":606,"column":111,"offset":29083},"indent":[]}}],"position":{"start":{"line":606,"column":3,"offset":28975},"end":{"line":606,"column":111,"offset":29083},"indent":[]}}],"position":{"start":{"line":606,"column":1,"offset":28973},"end":{"line":606,"column":111,"offset":29083},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"Once you are ready, let's proceed to making our inhibitors.","position":{"start":{"line":608,"column":1,"offset":29085},"end":{"line":608,"column":60,"offset":29144},"indent":[]}}],"position":{"start":{"line":608,"column":1,"offset":29085},"end":{"line":608,"column":60,"offset":29144},"indent":[]}},{"type":"export","value":"export const _frontmatter = {\"title\":\"Creating A Command\",\"metaTitle\":\"Creating A Command | Discordeno\",\"metaDescription\":\"Let's create our very first command with Discordeno!\"}","position":{"start":{"line":611,"column":1,"offset":29147},"end":{"line":611,"column":178,"offset":29324},"indent":[]}}],"position":{"start":{"line":1,"column":1,"offset":0},"end":{"line":611,"column":178,"offset":29324}}},"scopeImports":["import * as React from 'react'"],"scopeIdentifiers":["React"],"body":"function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }\n\nfunction _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }\n\nfunction _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }\n\n/* @jsx mdx */\nvar _frontmatter = {\n \"title\": \"Creating A Command\",\n \"metaTitle\": \"Creating A Command | Discordeno\",\n \"metaDescription\": \"Let's create our very first command with Discordeno!\"\n};\nvar layoutProps = {\n _frontmatter: _frontmatter\n};\nvar MDXLayout = \"wrapper\";\nreturn function MDXContent(_ref) {\n var components = _ref.components,\n props = _objectWithoutProperties(_ref, [\"components\"]);\n\n return mdx(MDXLayout, _extends({}, layoutProps, props, {\n components: components,\n mdxType: \"MDXLayout\"\n }), mdx(\"p\", null, \"Really great job. Now, lets dive into trying to use some of the commands and try to make our very own command.\"), mdx(\"h2\", null, \"Editing Invite Command\"), mdx(\"p\", null, \"Let's first start by taking an existing command and slightly modifying it to your needs. Let's use the \", mdx(\"inlineCode\", {\n parentName: \"p\"\n }, \"Invite\"), \" command as our example. When you open the command, you will see something like this:\"), mdx(\"pre\", null, mdx(\"code\", _extends({\n parentName: \"pre\"\n }, {\n \"className\": \"language-ts\"\n }), \"import { botCache } from \\\"../../mod.ts\\\";\\nimport { sendMessage } from \\\"https://raw.githubusercontent.com/Skillz4Killz/Discordeno/v7/src/handlers/channel.ts\\\";\\nimport { botID } from \\\"https://raw.githubusercontent.com/Skillz4Killz/Discordeno/v7/src/module/client.ts\\\";\\n\\nbotCache.commands.set(\\\"invite\\\", {\\n name: \\\"invite\\\",\\n execute: function (message) {\\n // Replace the permission number at the end to request the permissions you wish to request. By default, this will request Admin perms.\\n sendMessage(\\n message.channel,\\n `https://discordapp.com/oauth2/authorize?client_id=${botID}&scope=bot&permissions=8`,\\n );\\n },\\n});\\n\")), mdx(\"p\", null, \"Let's break this down. The first three lines are importing the necessary things from their files so we can use them in this command. Don't worry if this doesn't make sense, most of the time, this will all be done automatically for you if you use a good code editor like Visual Studio Code. We create a command by doing:\"), mdx(\"pre\", null, mdx(\"code\", _extends({\n parentName: \"pre\"\n }, {\n \"className\": \"language-ts\"\n }), \"botCache.commands.set('commandname', {\\n\\n})\\n\")), mdx(\"p\", null, \"The command name here must be unique. If it is not unique, your commands will not work properly as you wish. For example, you can't have 2 commands with the \", mdx(\"inlineCode\", {\n parentName: \"p\"\n }, \"ping\"), \" name. In this case, our command is called \", mdx(\"inlineCode\", {\n parentName: \"p\"\n }, \"invite\"), \".\"), mdx(\"p\", null, \"The \", mdx(\"inlineCode\", {\n parentName: \"p\"\n }, \"name: 'invite'\"), \" is also written as it is useful for our help command and inhibitors! Normally, these two things will be the same. So far it's super easy right.\"), mdx(\"p\", null, \"Next is the \", mdx(\"inlineCode\", {\n parentName: \"p\"\n }, \"execute\"), \". This is where the magic happens. This is the function that is triggered when the command is ran by a user. In this case, the bot simply sends a message to a channel where the command was ran and sends an invite link. Let's take a minute and optimize this for our case. We don't \", mdx(\"strong\", {\n parentName: \"p\"\n }, \"NEED\"), \" admin permissions for our bot. Let's go to the \", mdx(\"a\", _extends({\n parentName: \"p\"\n }, {\n \"href\": \"https://discordapi.com/permissions.html#0\"\n }), \"permission calculator\"), \" and figure out the permissions we need for our bot.\"), mdx(\"p\", null, \"Once you have decided which permissions you want to request, you can copy the number and replace it here. For example, if we want \", mdx(\"inlineCode\", {\n parentName: \"p\"\n }, \"68640\"), \" as our permissions. We can modify our command to be:\"), mdx(\"pre\", null, mdx(\"code\", _extends({\n parentName: \"pre\"\n }, {\n \"className\": \"language-ts\"\n }), \" `https://discordapp.com/oauth2/authorize?client_id=${botID}&scope=bot&permissions=68640`,\\n\")), mdx(\"p\", null, \"Lastly, let's get rid of the comment there as now it is customized to our needs.\"), mdx(\"h3\", null, \"Command Descriptions\"), mdx(\"p\", null, \"Right now, if you were to go to Discord and type \", mdx(\"inlineCode\", {\n parentName: \"p\"\n }, \"!help invite\"), \", you would see quite a bit of information. But where does all that text come from? It's not in this file. The description option tells Discordeno what to show the user when they use the help command. In that help message, each command has a small description next to it. The magic is happening because of Discordeno's translations feature.\"), mdx(\"blockquote\", null, mdx(\"p\", {\n parentName: \"blockquote\"\n }, \"Discordeno has built in multi-lingual support. You can support as many languages as you wish. We will learn more about languages when we create our own language but for now we just want to see how to customize the command. What we are going to do below isn't the correct way but it's the easy way to learn. We will see the correct way to do it when we get to translations.\")), mdx(\"p\", null, \"Let's add a custom description to our invite command.\"), mdx(\"pre\", null, mdx(\"code\", _extends({\n parentName: \"pre\"\n }, {\n \"className\": \"language-ts\"\n }), \" name: \\\"invite\\\",\\n description: \\\"Like the bot? Use this link to add it to your server!\\\"\\n\")), mdx(\"p\", null, \"\\uD83C\\uDF89 It's that simple. So let's restart the bot and see how it changed. Use \", mdx(\"strong\", {\n parentName: \"p\"\n }, \"CTRL + C\"), \" to shut down the bot. Then run the command from earlier.\"), mdx(\"pre\", null, mdx(\"code\", _extends({\n parentName: \"pre\"\n }, {\n \"className\": \"language-shell\"\n }), \"deno run --allow-net --allow-read mod.ts\\n\")), mdx(\"p\", null, \"To access this easily, most likely all you need to do is press the \", mdx(\"strong\", {\n parentName: \"p\"\n }, \"UP ARROW\"), \" key. Feel free to copy paste this if it doesn't work.\"), mdx(\"p\", null, \"Once the bot is started try \", mdx(\"inlineCode\", {\n parentName: \"p\"\n }, \"!help invite\"), \" again and you will see the change! \\uD83C\\uDF89\"), mdx(\"h2\", null, \"Command Aliases\"), mdx(\"p\", null, \"Now, let's make this a little bit easier. What if we wanted this command to also work with other names besides \", mdx(\"inlineCode\", {\n parentName: \"p\"\n }, \"invite\"), \". For example, as a shortcut what if users could just type \", mdx(\"inlineCode\", {\n parentName: \"p\"\n }, \"!inv\"), \" or as an alias type \", mdx(\"inlineCode\", {\n parentName: \"p\"\n }, \"!join\"), \". Let's go ahead and set that up. Go to the very last line of invite command file and type in \", mdx(\"inlineCode\", {\n parentName: \"p\"\n }, \"alias\"), \". You will see a popup showing you an autocompleted version of \", mdx(\"inlineCode\", {\n parentName: \"p\"\n }, \"createCommandAliases\"), \". Press enter and boom the magic is happening!\"), mdx(\"p\", null, \"The createCommandAliases takes in two arguments. The first argument is always the command name. In this case it is \", mdx(\"inlineCode\", {\n parentName: \"p\"\n }, \"invite\"), \". The second argument is the aliases you want to provide. Let's add in the two aliases we wanted.\"), mdx(\"pre\", null, mdx(\"code\", _extends({\n parentName: \"pre\"\n }, {\n \"className\": \"language-ts\"\n }), \" `https://discordapp.com/oauth2/authorize?client_id=${botID}&scope=bot&permissions=68640`,\\n );\\n },\\n});\\n\\ncreateCommandAliases('invite', ['inv', 'join'])\\n\")), mdx(\"blockquote\", null, mdx(\"p\", {\n parentName: \"blockquote\"\n }, mdx(\"strong\", {\n parentName: \"p\"\n }, \"Note:\"), \" If you only want to add 1 alias, you can pass in a simple string instead of an array as well as the second argument.\")), mdx(\"p\", null, \"Notice, I added 2 aliases here. You can add as many aliases as you like. If you see a lot of users typing it wrong by accident you can add those typos as aliases as well.\"), mdx(\"p\", null, \"Let's start testing this out. But first, let's understand something important.\"), mdx(\"h2\", null, \"Reloading\"), mdx(\"p\", null, \"Okay, we need to first understand a core concept of developing discord bots. If you had to restart your bot every time you made a tiny change, it would get really annoying/tedious to do. Also, if you had restarted your bot 1000 times, you would be in big trouble because Discord would ban your bot for 24 hours. The bigger your bot gets, the faster it is to hit this limit of 1000 identify calls to the Discord API.\"), mdx(\"p\", null, \"To solve this issue, Discordeno provides you with a really cool \", mdx(\"inlineCode\", {\n parentName: \"p\"\n }, \"reload\"), \" command. Whenever you make a change to any command, event, monitor, inhibitor, task, language or argument you can simply reload it. You don't need to restart your bot every time.\"), mdx(\"p\", null, \"Now since we added the aliases above, let's test it out.\"), mdx(\"ol\", null, mdx(\"li\", {\n parentName: \"ol\"\n }, mdx(\"inlineCode\", {\n parentName: \"li\"\n }, \"!inv\"), \" this will not work\"), mdx(\"li\", {\n parentName: \"ol\"\n }, mdx(\"inlineCode\", {\n parentName: \"li\"\n }, \"!reload commands\"), \" this will reload the files and the aliases will be created.\"), mdx(\"li\", {\n parentName: \"ol\"\n }, mdx(\"inlineCode\", {\n parentName: \"li\"\n }, \"!inv\"), \" This will now work. \\uD83C\\uDF89\")), mdx(\"hr\", null), mdx(\"p\", null, \"Perfect! You can take some time and customize the invite command to your needs if you wish. For example, this is my bot's invite command.\"), mdx(\"p\", null, mdx(\"img\", _extends({\n parentName: \"p\"\n }, {\n \"src\": \"https://i.imgur.com/4WRFMtR.png\",\n \"alt\": \"image\"\n }))), mdx(\"p\", null, \"Nice! You can now customize any of the commands from Discordeno as you wish. Then we will continue to making our very own command so we can learn about all the options that Discordeno gives us when it comes to making commands. As you learn more in this guide, you can keep improving it.\"), mdx(\"p\", null, \"If you get stuck, don't worry. When you are ready, let's continue to the next step.\"), mdx(\"h2\", null, \"Creating A Command\"), mdx(\"p\", null, \"Let's make a command that will allow guild admins to give or take roles from a member. Since, we are creating a \", mdx(\"inlineCode\", {\n parentName: \"p\"\n }, \"Moderation\"), \" command to give or take roles, let's go ahead and create a Category folder called \", mdx(\"inlineCode\", {\n parentName: \"p\"\n }, \"Moderation\"), \" and then create a file called \", mdx(\"inlineCode\", {\n parentName: \"p\"\n }, \"role.ts\"), \". Once the file is made, you can paste this following base snippet to make our first command.\"), mdx(\"pre\", null, mdx(\"code\", _extends({\n parentName: \"pre\"\n }, {\n \"className\": \"language-ts\"\n }), \"import { botCache } from \\\"../../mod.ts\\\";\\nimport { sendMessage } from \\\"https://raw.githubusercontent.com/Skillz4Killz/Discordeno/v7/src/handlers/channel.ts\\\";\\nimport { PermissionLevels } from \\\"../types/commands.ts\\\";\\nimport { createCommandAliases } from \\\"../utils/helpers\\\";\\n\\nbotCache.commands.set(\\\"commandname\\\", {\\n name: \\\"commandname\\\",\\n dmOnly: false,\\n guildOnly: false,\\n nsfw: false,\\n permissionLevel: [PermissionLevels.MEMBER],\\n botServerPermissions: [],\\n botChannelPermissions: [],\\n userServerPermissions: [],\\n userChannelPermissions: [],\\n description: string,\\n cooldown: {\\n seconds: 0,\\n allowedUses: 0,\\n },\\n arguments: [],\\n execute: function (message, args, guild) {\\n // The code for your command goes here\\n }\\n});\\n\\n// createCommandAliases(\\\"commandname\\\", [\\\"alias\\\"])\\n\")), mdx(\"h2\", null, \"Understanding Command Options\"), mdx(\"p\", null, \"Woah! We just added a massive file but most of that stuff is new to us. Don't worry, let's break everything down step by step.\"), mdx(\"blockquote\", null, mdx(\"p\", {\n parentName: \"blockquote\"\n }, mdx(\"strong\", {\n parentName: \"p\"\n }, \"Note:\"), \" Any options that are not changed from the snippet above can actually be deleted as Discordeno will use the default option if you do not provide anything for that option. This can help keep your files cleaner.\")), mdx(\"p\", null, \"Before we start, quickly update the command name and description.\"), mdx(\"blockquote\", null, mdx(\"p\", {\n parentName: \"blockquote\"\n }, mdx(\"strong\", {\n parentName: \"p\"\n }, \"Note:\"), \" Once you highlight the \", mdx(\"inlineCode\", {\n parentName: \"p\"\n }, \"commandname\"), \", press \", mdx(\"strong\", {\n parentName: \"p\"\n }, \"CTRL + SHIFT + L\"), \" to select ALL the \", mdx(\"inlineCode\", {\n parentName: \"p\"\n }, \"commandname\"), \" on the file and you can easily replace them at once. Another useful shortcut you may use when coding your bot is \", mdx(\"strong\", {\n parentName: \"p\"\n }, \"CTRL + D\"), \" after highlighting. This shortcut selects the next place where the same text exists as thing in the file that has the same thing as you highlighted.\")), mdx(\"h2\", null, \"dmOnly & guildOnly Options\"), mdx(\"p\", null, \"The \", mdx(\"inlineCode\", {\n parentName: \"p\"\n }, \"dmOnly\"), \" option is available if you want to make sure this command only runs in a direct message. If this command is ran in a server, the command will immediately exit out.\"), mdx(\"p\", null, \"On the other hand, \", mdx(\"inlineCode\", {\n parentName: \"p\"\n }, \"guildOnly\"), \" is the opposite. To easily make sure that this command is never allowed in a private message you can simple enable this.\"), mdx(\"p\", null, \"If you want to allow a command to be able to run both in a server and in a direct message, simply set them both to false.\"), mdx(\"p\", null, \"Remember if you want either of them as false, you can simply delete them and it will default to \", mdx(\"inlineCode\", {\n parentName: \"p\"\n }, \"false\"), \" allowing your bot to be cleaner and easier to read. However, if your prefer keeping it you can.\"), mdx(\"p\", null, \"For the purpose of this guide, we want our \", mdx(\"inlineCode\", {\n parentName: \"p\"\n }, \"role\"), \" comamnd to only be run in a server, so we can set \", mdx(\"inlineCode\", {\n parentName: \"p\"\n }, \"guildOnly\"), \" to be \", mdx(\"strong\", {\n parentName: \"p\"\n }, \"true\"), \" and delete the \", mdx(\"inlineCode\", {\n parentName: \"p\"\n }, \"dmOnly\"), \" option.\"), mdx(\"h2\", null, \"NSFW Option\"), mdx(\"p\", null, \"NSFW stands for \", mdx(\"strong\", {\n parentName: \"p\"\n }, \"Not Safe For Work\"), \". One of Discord's rules is that you enforce that NSFW content is sent only in NSFW channels. Discordeno has this built in. You simple tell Discordeno, that you want a command to be considered \", mdx(\"inlineCode\", {\n parentName: \"p\"\n }, \"nsfw\"), \" or not.\"), mdx(\"p\", null, \"If this option is enabled, this command will only be able to be used in a \", mdx(\"inlineCode\", {\n parentName: \"p\"\n }, \"nsfw\"), \" channel on a server. Discord does not consider Direct Messages as nsfw safe!\"), mdx(\"h2\", null, \"Permission Level Option\"), mdx(\"p\", null, \"Permission levels are a very powerful feature that easily allow you to set what permission is required to run a command. We will cover this in detail, in a separate section dedicated to permission levels. For now, just understand that this will restrict certain users from using a command.\"), mdx(\"p\", null, \"For example, the role command we only want to be used by moderators or server admins.\"), mdx(\"p\", null, \"Discordeno makes this pretty simple for us.\"), mdx(\"pre\", null, mdx(\"code\", _extends({\n parentName: \"pre\"\n }, {\n \"className\": \"language-ts\"\n }), \"permissionLevels: [PermissionLevels.MODERATOR, PermissionLevels.ADMIN]\\n\")), mdx(\"p\", null, \"We're not going to cover this in detail, here because we will have an entire in depth guide for permission levels. If you want to pause and learn it now, feel free: \", mdx(\"a\", _extends({\n parentName: \"p\"\n }, {\n \"href\": \"https://discordeno.netlify.app/advanced/permlevels\"\n }), \"Permission Levels Advanced Guide\")), mdx(\"h2\", null, \"Permissions Check Options\"), mdx(\"p\", null, \"Discordeno provides you 4 different types of permission handling that will be done before the command function is executed. This allows you to make sure that the permissions are available before running a command. For example, the role command will require the bot to have \", mdx(\"strong\", {\n parentName: \"p\"\n }, \"MANAGE ROLES\"), \" permission. This permission comes from the server settings so we can require this in the \", mdx(\"inlineCode\", {\n parentName: \"p\"\n }, \"botServerPermissions\"), \".\"), mdx(\"pre\", null, mdx(\"code\", _extends({\n parentName: \"pre\"\n }, {\n \"className\": \"language-ts\"\n }), \"botServerPermissions: [\\\"MANAGE_ROLES\\\"],\\n\")), mdx(\"p\", null, \"Discordeno will provide you easy to use auto-completion as soon as you type a single letter or two. This will help make it easier to use and will warn you when you make a typo and provide a wrong permission by accident.\"), mdx(\"p\", null, \"We also want to make sure that the bot can send a message in this channel so that we can respond to the user. This will check the correct permission heirarchy to make sure that the bot can indeed send a message in this channel.\"), mdx(\"pre\", null, mdx(\"code\", _extends({\n parentName: \"pre\"\n }, {\n \"className\": \"language-ts\"\n }), \"botChannelPermissions: [\\\"SEND_MESSAGES\\\"],\\n\")), mdx(\"blockquote\", null, mdx(\"p\", {\n parentName: \"blockquote\"\n }, mdx(\"strong\", {\n parentName: \"p\"\n }, \"Note:\"), \" If you want to send an embed response, you should also make sure it has the \", mdx(\"inlineCode\", {\n parentName: \"p\"\n }, \"EMBED_LINKS\"), \" permission.\")), mdx(\"p\", null, \"Already we have prevented two of the largest errors that can get our bot banned if it is not checked. Discordeno handles this internally so you don't have to worry about it.\"), mdx(\"p\", null, \"Sometimes, you may also want to make sure that the user using the command has a certain permission to run the command. To do this, you can use the \", mdx(\"inlineCode\", {\n parentName: \"p\"\n }, \"userServerPermissions\"), \" or the \", mdx(\"inlineCode\", {\n parentName: \"p\"\n }, \"userChannelPermissions\"), \".\"), mdx(\"h2\", null, \"Cooldown Options\"), mdx(\"p\", null, \"The cooldown options go hand in hand together.\"), mdx(\"ul\", null, mdx(\"li\", {\n parentName: \"ul\"\n }, mdx(\"inlineCode\", {\n parentName: \"li\"\n }, \"seconds\"), \" is how long to make the user wait in seconds before they can use the command again. By default, there is no wait time aka 0 seconds.\"), mdx(\"li\", {\n parentName: \"ul\"\n }, mdx(\"inlineCode\", {\n parentName: \"li\"\n }, \"allowedUses\"), \" is how many times a user is allowed to use a command before they are placed on cooldown.\"), mdx(\"li\", {\n parentName: \"ul\"\n }, \"Let's use our command as an example. We don't want someone to start spamming the role command so we can add a cooldown of 60 seconds. However, this would mean every time you give a role to someone, you would need to wait a whole minute to give a role to someone else. This is where \", mdx(\"inlineCode\", {\n parentName: \"li\"\n }, \"allowedUses\"), \" shines! Let's set it to to 5 so that a user can use this command 5 times in a row before being asked to wait for 60 seconds.\")), mdx(\"pre\", null, mdx(\"code\", _extends({\n parentName: \"pre\"\n }, {\n \"className\": \"language-ts\"\n }), \"cooldown: {\\n seconds: 60,\\n allowedUses: 5\\n},\\n\")), mdx(\"blockquote\", null, mdx(\"p\", {\n parentName: \"blockquote\"\n }, mdx(\"strong\", {\n parentName: \"p\"\n }, \"Note:\"), \" It is important to understand the way these two interact. The cooldown starts as soon as the first command is used. So, if a user uses the role command 5 times in 59 seconds, they only have to wait 1 second to do another 5 times.\")), mdx(\"p\", null, \"Let's give this a try shall we.\"), mdx(\"ol\", null, mdx(\"li\", {\n parentName: \"ol\"\n }, mdx(\"inlineCode\", {\n parentName: \"li\"\n }, \"!reload commands\")), mdx(\"li\", {\n parentName: \"ol\"\n }, \"Spam the \", mdx(\"inlineCode\", {\n parentName: \"li\"\n }, \"!role\"), \" very quickly 6 times in under a minute.\")), mdx(\"h2\", null, \"Arguments\"), mdx(\"p\", null, \"Arguments is an incredibly powerful feature in Discordeno. Like Permission Levels we will have an in depth look at arguments later in the guide. For now, let's try and understand this in a simple manner.\"), mdx(\"ul\", null, mdx(\"li\", {\n parentName: \"ul\"\n }, mdx(\"inlineCode\", {\n parentName: \"li\"\n }, \"name\"), \": The name of the argument. Useful for when you need to alert the user X arg is missing or when you want to use the arg in your command.\"), mdx(\"li\", {\n parentName: \"ul\"\n }, mdx(\"inlineCode\", {\n parentName: \"li\"\n }, \"type\"), \": The type of the argument you would like. Defaults to string. Some of the ones available by default are \\\"number\\\", \\\"string\\\", \\\"...string\\\", \\\"boolean\\\", \\\"subcommand\\\", \\\"member\\\".\"), mdx(\"li\", {\n parentName: \"ul\"\n }, mdx(\"inlineCode\", {\n parentName: \"li\"\n }, \"missing\"), \": a function that will be run when this argument is not provided by the user or if the provided argument is not valid. By default, it does nothing.\"), mdx(\"li\", {\n parentName: \"ul\"\n }, mdx(\"inlineCode\", {\n parentName: \"li\"\n }, \"required\"), \": Whether this argument is required or optional. By default, this is true.\"), mdx(\"li\", {\n parentName: \"ul\"\n }, mdx(\"inlineCode\", {\n parentName: \"li\"\n }, \"lowercase\"), \": If the type is a string, this can forcibly lowercase the string.\"), mdx(\"li\", {\n parentName: \"ul\"\n }, mdx(\"inlineCode\", {\n parentName: \"li\"\n }, \"literals\"), \": If the type is string or subcommand you can provide literals. The argument MUST be exactly the same as the literals to be accepted. For example, if you want to make sure the argument is \", mdx(\"inlineCode\", {\n parentName: \"li\"\n }, \"a\"), \" or \", mdx(\"inlineCode\", {\n parentName: \"li\"\n }, \"b\"), \" only and not \", mdx(\"inlineCode\", {\n parentName: \"li\"\n }, \"c\"), \".\"), mdx(\"li\", {\n parentName: \"ul\"\n }, mdx(\"inlineCode\", {\n parentName: \"li\"\n }, \"defaultValue\"), \": The default value for this argument/subcommand. If the user does not provide an argument or it is invalid, it can be defaulted to a certain value.\")), mdx(\"p\", null, \"For our role command, we need a \", mdx(\"inlineCode\", {\n parentName: \"p\"\n }, \"member\"), \" and a \", mdx(\"inlineCode\", {\n parentName: \"p\"\n }, \"role\"), \".\"), mdx(\"pre\", null, mdx(\"code\", _extends({\n parentName: \"pre\"\n }, {\n \"className\": \"language-ts\"\n }), \"arguments: [\\n {\\n name: \\\"member\\\",\\n type: \\\"member\\\",\\n missing: (message) => {\\n sendResponse(message, `you did not provide a member to give the role to. You can provide a @member mention, a member ID, or try using their nickname/username. The nickname/username will only work if they have been active in your server recently.`)\\n }\\n },\\n {\\n name: \\\"role\\\",\\n type: \\\"role\\\",\\n missing: (message) => {\\n sendResponse(message, `you did not provide a role to give. You can provide a @role mention, a role ID, or it's name. If the role name did not work, try to use the **roleinfo** command to get the role ID.`)\\n }\\n }\\n]\\n\")), mdx(\"h2\", null, \"Execute Option\"), mdx(\"p\", null, \"The execute option is the code that will run when the command is triggered. The execute function is passed 3 parameters that you can use in your command.\"), mdx(\"ul\", null, mdx(\"li\", {\n parentName: \"ul\"\n }, mdx(\"inlineCode\", {\n parentName: \"li\"\n }, \"message\"), \": The message object itself that triggered this command.\"), mdx(\"li\", {\n parentName: \"ul\"\n }, mdx(\"inlineCode\", {\n parentName: \"li\"\n }, \"args\"), \": The args that were provided by the user.\"), mdx(\"li\", {\n parentName: \"ul\"\n }, mdx(\"inlineCode\", {\n parentName: \"li\"\n }, \"guild\"), \": The server guild object where this command was run.\")), mdx(\"pre\", null, mdx(\"code\", _extends({\n parentName: \"pre\"\n }, {\n \"className\": \"language-ts\"\n }), \"execute: function (message, args, guild) {\\n // The code that is to be executed goes here\\n}\\n\")), mdx(\"blockquote\", null, mdx(\"p\", {\n parentName: \"blockquote\"\n }, mdx(\"strong\", {\n parentName: \"p\"\n }, \"Note:\"), \" I prefer writing code using the function keyword, but you can easily change to the fat arrow function if you prefer.\"), mdx(\"pre\", {\n parentName: \"blockquote\"\n }, mdx(\"code\", _extends({\n parentName: \"pre\"\n }, {\n \"className\": \"language-ts\"\n }), \"execute: (message, args, guild) => {\\n // The code that is to be executed goes here\\n}\\n\"))), mdx(\"p\", null, \"Let's start out by writing some pseudo-code(comments that will help us plan the code).\"), mdx(\"pre\", null, mdx(\"code\", _extends({\n parentName: \"pre\"\n }, {\n \"className\": \"language-ts\"\n }), \"execute: function (message, args, guild) {\\n // If this was the everyone role alert with a silly error\\n\\n // If this is a managed role(some bots role) we can't give/remove alert with silly error\\n\\n // Get the bots highest role\\n\\n // Check if the bot has a role higher than the role that it will try to give.\\n\\n // If the role is too high alert the user.\\n\\n // If the user has this role already remove the role from them.\\n\\n // Check the command author's highest role\\n\\n // If the author does not have a role high enough to give this role alert\\n\\n // If the user has this role already we should remove it\\n\\n // Add the role to the user.\\n\\n // Alert the user that used the command that the user has been give the role.\\n}\\n\")), mdx(\"p\", null, \"Nice! The plan for the code is complete. Now, let's add in the code.\"), mdx(\"p\", null, \"The first thing we are going to try is to check if the role the user provided is the same as the everyone role.\"), mdx(\"blockquote\", null, mdx(\"p\", {\n parentName: \"blockquote\"\n }, mdx(\"strong\", {\n parentName: \"p\"\n }, \"Note:\"), \" The everyone role ID is the same as the server guild ID.\")), mdx(\"p\", null, \"To do this, we are going to want something like this:\"), mdx(\"pre\", null, mdx(\"code\", _extends({\n parentName: \"pre\"\n }, {\n \"className\": \"language-ts\"\n }), \"if (args.role.id === message.guildID) {\\n return sendResponse(message, \\\"The everyone role can not be given to anyone because everyone has the everyone role already. *Keep calm and let Carter figure it out*!\\\");\\n}\\n\")), mdx(\"p\", null, \"You might be seeing an error since we didn't provide the accurate typings for the \", mdx(\"inlineCode\", {\n parentName: \"p\"\n }, \"args\"), \" parameter. The message and guild parameter is automated but the args is dynamic depending on your \", mdx(\"inlineCode\", {\n parentName: \"p\"\n }, \"arguments\"), \" option for your command. So let's do this real quick.\"), mdx(\"pre\", null, mdx(\"code\", _extends({\n parentName: \"pre\"\n }, {\n \"className\": \"language-ts\"\n }), \"execute: function (message, args: RoleArgs, guild) {\\n // If this was the everyone role alert with a silly error\\n if (args.role.id === message.guildID) {\\n return sendResponse(message, \\\"Are you trying to make this person a super hero? Everyone has the everyone role. I can't give the everyone role to another user.\\\");\\n }\\n\\n // Lots of comments here hidden so you can see the changes easily.\\n}\\n\\ninterface RoleArgs {\\n role: Role;\\n member: Member;\\n}\\n\")), mdx(\"p\", null, \"Awesome! Let's keep going.\"), mdx(\"pre\", null, mdx(\"code\", _extends({\n parentName: \"pre\"\n }, {\n \"className\": \"language-ts\"\n }), \"execute: function (message, args: RoleArgs, guild) {\\n // If this was the everyone role alert with a silly error\\n if (args.role.id === message.guildID) {\\n return sendResponse(message, \\\"I don't know if you noticed or not but I'm an extremely arrogant bot who tends to think all of his plans will work. But I can't give the everyone role to someone.\\\");\\n }\\n\\n // If this is a managed role(some bots role) we can't give/remove alert with silly error\\n if (args.role.managed) {\\n return sendResponse(message, \\\"Dammit man, just 'cause I'm Scottish doesn't mean I can give your people managed roles.\\\")\\n }\\n\\n // Get the bots highest role\\n const botsHighestRole = highestRole(message.guildID, botID);\\n\\n // Check if the bot has a role higher than the role that it will try to give.\\n const botIsHigher = higherRolePosition(message.guildID, botsHighestRole.id, args.role.id)\\n\\n // If the role is too high alert the user.\\n if (!botIsHigher) {\\n return sendResponse(message, \\\"Okay look, asking me give a role that is higher than my highest role is ridiculous! I am the first bot to admit I don't know who these people are nor do I care to. Look, if you'd like I could take you down the hall and just point at the people who annoy me more than the rest. But that's about as useful as I get.\\\")\\n }\\n\\n // Check the command author's highest role\\n const membersHighestRole = highestRole(message.guildID, message.author.id);\\n\\n // If the author does not have a role high enough to give this role alert\\n if (!higherRolePosition(message.guildID, membersHighestRole.id, args.role.id)) {\\n return sendResponse(message, \\\"In my culture, whenever someone tries to give a role that is higher than their highest role, I would be well within my rights to dismember you.\\\")\\n }\\n\\n // If the user has this role already we should remove it\\n if (message.member().roles.includes(args.role.id)) {\\n removeRole(message.guildID, args.member.user.id, args.role.id, `${message.author.tag} used the role command to remove this role.`)\\n // Alert the user that used the command that the user has lost the role.\\n return sendResponse(message, `The role **${args.role.name}** has been removed from **${args.member.tag}**.`)\\n }\\n\\n // Add the role to the user.\\n addRole(guildID, memberID, roleID)\\n\\n // Alert the user that used the command that the user has been give the role.\\n return sendResponse(message, `The role **${args.role.name}** has been added to **${args.member.tag}**.`)\\n}\\n\")), mdx(\"p\", null, \"The final version of the command should look something like this:\"), mdx(\"pre\", null, mdx(\"code\", _extends({\n parentName: \"pre\"\n }, {\n \"className\": \"language-ts\"\n }), \"import { highestRole, higherRolePosition, botID, removeRole, addRole, Role, Member } from \\\"../../deps.ts\\\";\\nimport { botCache } from \\\"../../mod.ts\\\";\\nimport { PermissionLevels } from \\\"../types/commands.ts\\\";\\nimport { sendResponse } from \\\"../utils/helpers.ts\\\";\\n\\nbotCache.commands.set(\\\"role\\\", {\\n name: \\\"role\\\",\\n permissionLevel: [PermissionLevels.MODERATOR, PermissionLevels.ADMIN],\\n botServerPermissions: [\\\"MANAGE_ROLES\\\"],\\n botChannelPermissions: [\\\"SEND_MESSAGES\\\"],\\n cooldown: {\\n seconds: 60,\\n allowedUses: 5,\\n },\\n arguments: [\\n {\\n name: \\\"member\\\",\\n type: \\\"member\\\",\\n missing: (message) => {\\n sendResponse(message, `you did not provide a member to give the role to. You can provide a @member mention, a member ID, or try using their nickname/username. The nickname/username will only work if they have been active in your server recently.`)\\n }\\n },\\n {\\n name: \\\"role\\\",\\n type: \\\"role\\\",\\n missing: (message) => {\\n sendResponse(message, `you did not provide a role to give. You can provide a @role mention, a role ID, or it's name. If the role name did not work, try to use the **roleinfo** command to get the role ID.`)\\n }\\n }\\n ],\\n execute: function (message, args: RoleArgs) {\\n // If this was the everyone role alert with a silly error\\n if (args.role.id === message.guildID) {\\n return sendResponse(\\n message,\\n \\\"I don't know if you noticed or not but I'm an extremely arrogant bot who tends to think all of his plans will work. But I can't give the everyone role to someone.\\\",\\n );\\n }\\n\\n // If this is a managed role(some bots role) we can't give/remove alert with silly error\\n if (args.role.managed) {\\n return sendResponse(\\n message,\\n \\\"Dammit man, just 'cause I'm Scottish doesn't mean I can give your people managed roles.\\\",\\n );\\n }\\n\\n // Get the bots highest role\\n const botsHighestRole = highestRole(message.guildID, botID);\\n\\n // Check if the bot has a role higher than the role that it will try to give. If the role is too high alert the user.\\n if (!botsHighestRole || !higherRolePosition(\\n message.guildID,\\n botsHighestRole.id,\\n args.role.id,\\n )) {\\n return sendResponse(\\n message,\\n \\\"Okay look, asking me give a role that is higher than my highest role is ridiculous! I am the first bot to admit I don't know who these people are nor do I care to. Look, if you'd like I could take you down the hall and just point at the people who annoy me more than the rest. But that's about as useful as I get.\\\",\\n );\\n }\\n\\n // Check the command author's highest role\\n const membersHighestRole = highestRole(message.guildID, message.author.id);\\n\\n // If the author does not have a role high enough to give this role alert\\n if (!membersHighestRole ||\\n !higherRolePosition(message.guildID, membersHighestRole.id, args.role.id)\\n ) {\\n return sendResponse(\\n message,\\n \\\"In my culture, whenever someone tries to give a role that is higher than their highest role, I would be well within my rights to dismember you.\\\",\\n );\\n }\\n\\n // If the user has this role already we should remove it\\n if (message.member()?.roles.includes(args.role.id)) {\\n removeRole(\\n message.guildID,\\n args.member.user.id,\\n args.role.id,\\n `${message.author.username} used the role command to remove this role.`,\\n );\\n // Alert the user that used the command that the user has lost the role.\\n return sendResponse(\\n message,\\n `The role **${args.role.name}** has been removed from **${args.member.tag}**.`,\\n );\\n }\\n\\n // Add the role to the user.\\n addRole(message.guildID, args.member.user.id, args.role.id, `${message.author.username} used the role command to give this role.`);\\n\\n // Alert the user that used the command that the user has been give the role.\\n return sendResponse(\\n message,\\n `The role **${args.role.name}** has been added to **${args.member.tag}**.`,\\n );\\n },\\n});\\n\\ninterface RoleArgs {\\n role: Role;\\n member: Member;\\n}\\n\")), mdx(\"blockquote\", null, mdx(\"p\", {\n parentName: \"blockquote\"\n }, mdx(\"strong\", {\n parentName: \"p\"\n }, \"Note:\"), \" The response strings are a play on some funny Stargate(my favorite tv show) moments. Feel free to change as you wish to fit your bot's personality.\")), mdx(\"h2\", null, \"Dynamic(Advanced Level) Command Creation\"), mdx(\"p\", null, \"This is some advanced level super magical command creation skills. Discordeno gives you the power to dynamically create commands. What that means is you can write the code for one command but dynamically create like 50 commands using that same code.\"), mdx(\"p\", null, \"For example, in my main bot I have a lot of \\\"fun\\\" commands like \", mdx(\"inlineCode\", {\n parentName: \"p\"\n }, \".hug\"), \" or \", mdx(\"inlineCode\", {\n parentName: \"p\"\n }, \".kiss\"), \" etc... All of these files have the exact same code except for 1 word being the command name. Would it not be better to simply write the code once and dynamically create every single command. Let me show you how that works.\"), mdx(\"ul\", null, mdx(\"li\", {\n parentName: \"ul\"\n }, \"Create a file in the commands folder called \", mdx(\"inlineCode\", {\n parentName: \"li\"\n }, \"fun.ts\"), \" which will create all our fun commands.\")), mdx(\"pre\", null, mdx(\"code\", _extends({\n parentName: \"pre\"\n }, {\n \"className\": \"language-ts\"\n }), \"import { Member, sendMessage, chooseRandom, avatarURL } from \\\"../../deps.ts\\\";\\nimport { botCache } from \\\"../../mod.ts\\\";\\nimport { createCommandAliases, sendEmbed } from \\\"../utils/helpers.ts\\\";\\nimport { configs } from \\\"../../configs.ts\\\";\\nimport { Embed } from \\\"../utils/Embed.ts\\\";\\nimport { translate } from \\\"../utils/i18next.ts\\\";\\n\\nconst funCommandData = [\\n { name: \\\"bite\\\", gifs: configs.gifs.bite },\\n { name: \\\"cuddle\\\", gifs: configs.gifs.cuddle },\\n { name: \\\"dance\\\", gifs: configs.gifs.dance },\\n { name: \\\"hug\\\", gifs: configs.gifs.hug },\\n { name: \\\"kiss\\\", gifs: configs.gifs.kiss },\\n { name: \\\"kanna\\\", gifs: configs.gifs.kanna },\\n { name: \\\"kiss\\\", gifs: configs.gifs.kiss },\\n { name: \\\"kitten\\\", gifs: configs.gifs.kitten },\\n { name: \\\"lmao\\\", gifs: configs.gifs.lmao, aliases: [\\\"lol\\\"] },\\n { name: \\\"pat\\\", gifs: configs.gifs.pat },\\n { name: \\\"poke\\\", gifs: configs.gifs.poke },\\n { name: \\\"pony\\\", gifs: configs.gifs.pony },\\n { name: \\\"puppy\\\", gifs: configs.gifs.puppy },\\n { name: \\\"raphtalia\\\", gifs: configs.gifs.raphtalia },\\n { name: \\\"stargate\\\", gifs: configs.gifs.stargate },\\n { name: \\\"supernatural\\\", gifs: configs.gifs.supernatural },\\n { name: \\\"tickle\\\", gifs: configs.gifs.tickle },\\n { name: \\\"zerotwo\\\", gifs: configs.gifs.zerotwo },\\n];\\n\\nfunCommandData.forEach((data) => {\\n botCache.commands.set(data.name, {\\n name: data.name,\\n botChannelPermissions: [\\\"SEND_MESSAGES\\\", \\\"EMBED_LINKS\\\"],\\n cooldown: {\\n seconds: 2,\\n },\\n arguments: [\\n {\\n name: \\\"member\\\",\\n type: \\\"member\\\",\\n required: false,\\n },\\n ],\\n execute: function (message, args: FunArgs) {\\n // If a member is provided use that otherwise set the member themself\\n const member = args.member || message.member()!;\\n\\n const type = member.user.id === message.author.id\\n // Silly response like if user tries to hug themself\\n ? \\\"SELF\\\"\\n // Response for when user tries to hug another user\\n : \\\"OTHER\\\";\\n\\n\\n // Create an embed\\n const embed = new Embed()\\n .setAuthor(member.tag, avatarURL(member))\\n .setDescription(\\n translate(\\n message.guildID,\\n `commands/fun/${data.name}:${type}`,\\n { mention: message.member()!.mention, user: member.mention },\\n ),\\n )\\n .setImage(chooseRandom(data.gifs));\\n\\n return sendEmbed(message.channel, embed);\\n },\\n });\\n\\n if (data.aliases?.length) {\\n createCommandAliases(data.name, data.aliases);\\n }\\n});\\n\\ninterface FunArgs {\\n member?: Member;\\n}\\n\")), mdx(\"blockquote\", null, mdx(\"p\", {\n parentName: \"blockquote\"\n }, mdx(\"strong\", {\n parentName: \"p\"\n }, \"Note:\"), \" The imports in this are a bit different. I did this to show you that you can also import everything grouped like this through the \", mdx(\"inlineCode\", {\n parentName: \"p\"\n }, \"deps.ts\"), \" which will make everything available to you at ease.\")), mdx(\"p\", null, \"Take a minute to realize what just happened. This has made 18 different unique commands dynamically. In 1 file, using the same piece of code, we created so many commands. You can easily add more commands to this. For example, if you wanted to add weeb(animated) versions of these commands. Then you are at 36 commands with 1 simple command file.\"), mdx(\"p\", null, mdx(\"strong\", {\n parentName: \"p\"\n }, \"That ladies and gentleman is the power and magic of Discordeno!\")), mdx(\"p\", null, \"Take a minute to stand up, step back and make some room around you. Now start dancing because you just acheived one of the most complex things in bot development. You have already created about 36 commands!!!!\"), mdx(\"blockquote\", null, mdx(\"p\", {\n parentName: \"blockquote\"\n }, mdx(\"strong\", {\n parentName: \"p\"\n }, \"Note:\"), \" The command above uses translations which we will cover in depth in a later section of this guide.\")), mdx(\"p\", null, \"Once you are ready, let's proceed to making our inhibitors.\"));\n}\n;\nMDXContent.isMDXComponent = true;","rawMDXOutput":"/* @jsx mdx */\nimport { mdx } from '@mdx-js/react';\n/* @jsx mdx */\n\nexport const _frontmatter = {\n \"title\": \"Creating A Command\",\n \"metaTitle\": \"Creating A Command | Discordeno\",\n \"metaDescription\": \"Let's create our very first command with Discordeno!\"\n};\n\nconst layoutProps = {\n _frontmatter\n};\nconst MDXLayout = \"wrapper\"\nexport default function MDXContent({\n components,\n ...props\n}) {\n return \n

{`Really great job. Now, lets dive into trying to use some of the commands and try to make our very own command.`}

\n

{`Editing Invite Command`}

\n

{`Let's first start by taking an existing command and slightly modifying it to your needs. Let's use the `}{`Invite`}{` command as our example. When you open the command, you will see something like this:`}

\n
{`import { botCache } from \"../../mod.ts\";\nimport { sendMessage } from \"https://raw.githubusercontent.com/Skillz4Killz/Discordeno/v7/src/handlers/channel.ts\";\nimport { botID } from \"https://raw.githubusercontent.com/Skillz4Killz/Discordeno/v7/src/module/client.ts\";\n\nbotCache.commands.set(\"invite\", {\n  name: \"invite\",\n  execute: function (message) {\n    // Replace the permission number at the end to request the permissions you wish to request. By default, this will request Admin perms.\n    sendMessage(\n      message.channel,\n      \\`https://discordapp.com/oauth2/authorize?client_id=\\${botID}&scope=bot&permissions=8\\`,\n    );\n  },\n});\n`}
\n

{`Let's break this down. The first three lines are importing the necessary things from their files so we can use them in this command. Don't worry if this doesn't make sense, most of the time, this will all be done automatically for you if you use a good code editor like Visual Studio Code. We create a command by doing:`}

\n
{`botCache.commands.set('commandname', {\n\n})\n`}
\n

{`The command name here must be unique. If it is not unique, your commands will not work properly as you wish. For example, you can't have 2 commands with the `}{`ping`}{` name. In this case, our command is called `}{`invite`}{`.`}

\n

{`The `}{`name: 'invite'`}{` is also written as it is useful for our help command and inhibitors! Normally, these two things will be the same. So far it's super easy right.`}

\n

{`Next is the `}{`execute`}{`. This is where the magic happens. This is the function that is triggered when the command is ran by a user. In this case, the bot simply sends a message to a channel where the command was ran and sends an invite link. Let's take a minute and optimize this for our case. We don't `}{`NEED`}{` admin permissions for our bot. Let's go to the `}{`permission calculator`}{` and figure out the permissions we need for our bot.`}

\n

{`Once you have decided which permissions you want to request, you can copy the number and replace it here. For example, if we want `}{`68640`}{` as our permissions. We can modify our command to be:`}

\n
{`    \\`https://discordapp.com/oauth2/authorize?client_id=\\${botID}&scope=bot&permissions=68640\\`,\n`}
\n

{`Lastly, let's get rid of the comment there as now it is customized to our needs.`}

\n

{`Command Descriptions`}

\n

{`Right now, if you were to go to Discord and type `}{`!help invite`}{`, you would see quite a bit of information. But where does all that text come from? It's not in this file. The description option tells Discordeno what to show the user when they use the help command. In that help message, each command has a small description next to it. The magic is happening because of Discordeno's translations feature.`}

\n
\n

{`Discordeno has built in multi-lingual support. You can support as many languages as you wish. We will learn more about languages when we create our own language but for now we just want to see how to customize the command. What we are going to do below isn't the correct way but it's the easy way to learn. We will see the correct way to do it when we get to translations.`}

\n
\n

{`Let's add a custom description to our invite command.`}

\n
{`    name: \"invite\",\n    description: \"Like the bot? Use this link to add it to your server!\"\n`}
\n

{`🎉 It's that simple. So let's restart the bot and see how it changed. Use `}{`CTRL + C`}{` to shut down the bot. Then run the command from earlier.`}

\n
{`deno run --allow-net --allow-read mod.ts\n`}
\n

{`To access this easily, most likely all you need to do is press the `}{`UP ARROW`}{` key. Feel free to copy paste this if it doesn't work.`}

\n

{`Once the bot is started try `}{`!help invite`}{` again and you will see the change! 🎉`}

\n

{`Command Aliases`}

\n

{`Now, let's make this a little bit easier. What if we wanted this command to also work with other names besides `}{`invite`}{`. For example, as a shortcut what if users could just type `}{`!inv`}{` or as an alias type `}{`!join`}{`. Let's go ahead and set that up. Go to the very last line of invite command file and type in `}{`alias`}{`. You will see a popup showing you an autocompleted version of `}{`createCommandAliases`}{`. Press enter and boom the magic is happening!`}

\n

{`The createCommandAliases takes in two arguments. The first argument is always the command name. In this case it is `}{`invite`}{`. The second argument is the aliases you want to provide. Let's add in the two aliases we wanted.`}

\n
{` \\`https://discordapp.com/oauth2/authorize?client_id=\\${botID}&scope=bot&permissions=68640\\`,\n    );\n  },\n});\n\ncreateCommandAliases('invite', ['inv', 'join'])\n`}
\n
\n

{`Note:`}{` If you only want to add 1 alias, you can pass in a simple string instead of an array as well as the second argument.`}

\n
\n

{`Notice, I added 2 aliases here. You can add as many aliases as you like. If you see a lot of users typing it wrong by accident you can add those typos as aliases as well.`}

\n

{`Let's start testing this out. But first, let's understand something important.`}

\n

{`Reloading`}

\n

{`Okay, we need to first understand a core concept of developing discord bots. If you had to restart your bot every time you made a tiny change, it would get really annoying/tedious to do. Also, if you had restarted your bot 1000 times, you would be in big trouble because Discord would ban your bot for 24 hours. The bigger your bot gets, the faster it is to hit this limit of 1000 identify calls to the Discord API.`}

\n

{`To solve this issue, Discordeno provides you with a really cool `}{`reload`}{` command. Whenever you make a change to any command, event, monitor, inhibitor, task, language or argument you can simply reload it. You don't need to restart your bot every time.`}

\n

{`Now since we added the aliases above, let's test it out.`}

\n
    \n
  1. {`!inv`}{` this will not work`}
  2. \n
  3. {`!reload commands`}{` this will reload the files and the aliases will be created.`}
  4. \n
  5. {`!inv`}{` This will now work. 🎉`}
  6. \n
\n
\n

{`Perfect! You can take some time and customize the invite command to your needs if you wish. For example, this is my bot's invite command.`}

\n

\n

{`Nice! You can now customize any of the commands from Discordeno as you wish. Then we will continue to making our very own command so we can learn about all the options that Discordeno gives us when it comes to making commands. As you learn more in this guide, you can keep improving it.`}

\n

{`If you get stuck, don't worry. When you are ready, let's continue to the next step.`}

\n

{`Creating A Command`}

\n

{`Let's make a command that will allow guild admins to give or take roles from a member. Since, we are creating a `}{`Moderation`}{` command to give or take roles, let's go ahead and create a Category folder called `}{`Moderation`}{` and then create a file called `}{`role.ts`}{`. Once the file is made, you can paste this following base snippet to make our first command.`}

\n
{`import { botCache } from \"../../mod.ts\";\nimport { sendMessage } from \"https://raw.githubusercontent.com/Skillz4Killz/Discordeno/v7/src/handlers/channel.ts\";\nimport { PermissionLevels } from \"../types/commands.ts\";\nimport { createCommandAliases } from \"../utils/helpers\";\n\nbotCache.commands.set(\"commandname\", {\n  name: \"commandname\",\n  dmOnly: false,\n  guildOnly: false,\n  nsfw: false,\n  permissionLevel: [PermissionLevels.MEMBER],\n  botServerPermissions: [],\n  botChannelPermissions: [],\n  userServerPermissions: [],\n  userChannelPermissions: [],\n  description: string,\n  cooldown: {\n    seconds: 0,\n    allowedUses: 0,\n  },\n  arguments: [],\n  execute: function (message, args, guild) {\n  // The code for your command goes here\n  }\n});\n\n// createCommandAliases(\"commandname\", [\"alias\"])\n`}
\n

{`Understanding Command Options`}

\n

{`Woah! We just added a massive file but most of that stuff is new to us. Don't worry, let's break everything down step by step.`}

\n
\n

{`Note:`}{` Any options that are not changed from the snippet above can actually be deleted as Discordeno will use the default option if you do not provide anything for that option. This can help keep your files cleaner.`}

\n
\n

{`Before we start, quickly update the command name and description.`}

\n
\n

{`Note:`}{` Once you highlight the `}{`commandname`}{`, press `}{`CTRL + SHIFT + L`}{` to select ALL the `}{`commandname`}{` on the file and you can easily replace them at once. Another useful shortcut you may use when coding your bot is `}{`CTRL + D`}{` after highlighting. This shortcut selects the next place where the same text exists as thing in the file that has the same thing as you highlighted.`}

\n
\n

{`dmOnly & guildOnly Options`}

\n

{`The `}{`dmOnly`}{` option is available if you want to make sure this command only runs in a direct message. If this command is ran in a server, the command will immediately exit out.`}

\n

{`On the other hand, `}{`guildOnly`}{` is the opposite. To easily make sure that this command is never allowed in a private message you can simple enable this.`}

\n

{`If you want to allow a command to be able to run both in a server and in a direct message, simply set them both to false.`}

\n

{`Remember if you want either of them as false, you can simply delete them and it will default to `}{`false`}{` allowing your bot to be cleaner and easier to read. However, if your prefer keeping it you can.`}

\n

{`For the purpose of this guide, we want our `}{`role`}{` comamnd to only be run in a server, so we can set `}{`guildOnly`}{` to be `}{`true`}{` and delete the `}{`dmOnly`}{` option.`}

\n

{`NSFW Option`}

\n

{`NSFW stands for `}{`Not Safe For Work`}{`. One of Discord's rules is that you enforce that NSFW content is sent only in NSFW channels. Discordeno has this built in. You simple tell Discordeno, that you want a command to be considered `}{`nsfw`}{` or not.`}

\n

{`If this option is enabled, this command will only be able to be used in a `}{`nsfw`}{` channel on a server. Discord does not consider Direct Messages as nsfw safe!`}

\n

{`Permission Level Option`}

\n

{`Permission levels are a very powerful feature that easily allow you to set what permission is required to run a command. We will cover this in detail, in a separate section dedicated to permission levels. For now, just understand that this will restrict certain users from using a command.`}

\n

{`For example, the role command we only want to be used by moderators or server admins.`}

\n

{`Discordeno makes this pretty simple for us.`}

\n
{`permissionLevels: [PermissionLevels.MODERATOR, PermissionLevels.ADMIN]\n`}
\n

{`We're not going to cover this in detail, here because we will have an entire in depth guide for permission levels. If you want to pause and learn it now, feel free: `}{`Permission Levels Advanced Guide`}

\n

{`Permissions Check Options`}

\n

{`Discordeno provides you 4 different types of permission handling that will be done before the command function is executed. This allows you to make sure that the permissions are available before running a command. For example, the role command will require the bot to have `}{`MANAGE ROLES`}{` permission. This permission comes from the server settings so we can require this in the `}{`botServerPermissions`}{`.`}

\n
{`botServerPermissions: [\"MANAGE_ROLES\"],\n`}
\n

{`Discordeno will provide you easy to use auto-completion as soon as you type a single letter or two. This will help make it easier to use and will warn you when you make a typo and provide a wrong permission by accident.`}

\n

{`We also want to make sure that the bot can send a message in this channel so that we can respond to the user. This will check the correct permission heirarchy to make sure that the bot can indeed send a message in this channel.`}

\n
{`botChannelPermissions: [\"SEND_MESSAGES\"],\n`}
\n
\n

{`Note:`}{` If you want to send an embed response, you should also make sure it has the `}{`EMBED_LINKS`}{` permission.`}

\n
\n

{`Already we have prevented two of the largest errors that can get our bot banned if it is not checked. Discordeno handles this internally so you don't have to worry about it.`}

\n

{`Sometimes, you may also want to make sure that the user using the command has a certain permission to run the command. To do this, you can use the `}{`userServerPermissions`}{` or the `}{`userChannelPermissions`}{`.`}

\n

{`Cooldown Options`}

\n

{`The cooldown options go hand in hand together.`}

\n
    \n
  • {`seconds`}{` is how long to make the user wait in seconds before they can use the command again. By default, there is no wait time aka 0 seconds.`}
  • \n
  • {`allowedUses`}{` is how many times a user is allowed to use a command before they are placed on cooldown.`}
  • \n
  • {`Let's use our command as an example. We don't want someone to start spamming the role command so we can add a cooldown of 60 seconds. However, this would mean every time you give a role to someone, you would need to wait a whole minute to give a role to someone else. This is where `}{`allowedUses`}{` shines! Let's set it to to 5 so that a user can use this command 5 times in a row before being asked to wait for 60 seconds.`}
  • \n
\n
{`cooldown: {\n  seconds: 60,\n  allowedUses: 5\n},\n`}
\n
\n

{`Note:`}{` It is important to understand the way these two interact. The cooldown starts as soon as the first command is used. So, if a user uses the role command 5 times in 59 seconds, they only have to wait 1 second to do another 5 times.`}

\n
\n

{`Let's give this a try shall we.`}

\n
    \n
  1. {`!reload commands`}
  2. \n
  3. {`Spam the `}{`!role`}{` very quickly 6 times in under a minute.`}
  4. \n
\n

{`Arguments`}

\n

{`Arguments is an incredibly powerful feature in Discordeno. Like Permission Levels we will have an in depth look at arguments later in the guide. For now, let's try and understand this in a simple manner.`}

\n
    \n
  • {`name`}{`: The name of the argument. Useful for when you need to alert the user X arg is missing or when you want to use the arg in your command.`}
  • \n
  • {`type`}{`: The type of the argument you would like. Defaults to string. Some of the ones available by default are \"number\", \"string\", \"...string\", \"boolean\", \"subcommand\", \"member\".`}
  • \n
  • {`missing`}{`: a function that will be run when this argument is not provided by the user or if the provided argument is not valid. By default, it does nothing.`}
  • \n
  • {`required`}{`: Whether this argument is required or optional. By default, this is true.`}
  • \n
  • {`lowercase`}{`: If the type is a string, this can forcibly lowercase the string.`}
  • \n
  • {`literals`}{`: If the type is string or subcommand you can provide literals. The argument MUST be exactly the same as the literals to be accepted. For example, if you want to make sure the argument is `}{`a`}{` or `}{`b`}{` only and not `}{`c`}{`.`}
  • \n
  • {`defaultValue`}{`: The default value for this argument/subcommand. If the user does not provide an argument or it is invalid, it can be defaulted to a certain value.`}
  • \n
\n

{`For our role command, we need a `}{`member`}{` and a `}{`role`}{`.`}

\n
{`arguments: [\n  {\n    name: \"member\",\n    type: \"member\",\n    missing: (message) => {\n      sendResponse(message, \\`you did not provide a member to give the role to. You can provide a @member mention, a member ID, or try using their nickname/username. The nickname/username will only work if they have been active in your server recently.\\`)\n    }\n  },\n  {\n    name: \"role\",\n    type: \"role\",\n    missing: (message) => {\n      sendResponse(message, \\`you did not provide a role to give. You can provide a @role mention, a role ID, or it's name. If the role name did not work, try to use the **roleinfo** command to get the role ID.\\`)\n    }\n  }\n]\n`}
\n

{`Execute Option`}

\n

{`The execute option is the code that will run when the command is triggered. The execute function is passed 3 parameters that you can use in your command.`}

\n
    \n
  • {`message`}{`: The message object itself that triggered this command.`}
  • \n
  • {`args`}{`: The args that were provided by the user.`}
  • \n
  • {`guild`}{`: The server guild object where this command was run.`}
  • \n
\n
{`execute: function (message, args, guild) {\n  // The code that is to be executed goes here\n}\n`}
\n
\n

{`Note:`}{` I prefer writing code using the function keyword, but you can easily change to the fat arrow function if you prefer.`}

\n
{`execute: (message, args, guild) => {\n   // The code that is to be executed goes here\n}\n`}
\n
\n

{`Let's start out by writing some pseudo-code(comments that will help us plan the code).`}

\n
{`execute: function (message, args, guild) {\n  // If this was the everyone role alert with a silly error\n\n  // If this is a managed role(some bots role) we can't give/remove alert with silly error\n\n  // Get the bots highest role\n\n  // Check if the bot has a role higher than the role that it will try to give.\n\n  // If the role is too high alert the user.\n\n  // If the user has this role already remove the role from them.\n\n  // Check the command author's highest role\n\n  // If the author does not have a role high enough to give this role alert\n\n  // If the user has this role already we should remove it\n\n  // Add the role to the user.\n\n  // Alert the user that used the command that the user has been give the role.\n}\n`}
\n

{`Nice! The plan for the code is complete. Now, let's add in the code.`}

\n

{`The first thing we are going to try is to check if the role the user provided is the same as the everyone role.`}

\n
\n

{`Note:`}{` The everyone role ID is the same as the server guild ID.`}

\n
\n

{`To do this, we are going to want something like this:`}

\n
{`if (args.role.id === message.guildID) {\n  return sendResponse(message, \"The everyone role can not be given to anyone because everyone has the everyone role already. *Keep calm and let Carter figure it out*!\");\n}\n`}
\n

{`You might be seeing an error since we didn't provide the accurate typings for the `}{`args`}{` parameter. The message and guild parameter is automated but the args is dynamic depending on your `}{`arguments`}{` option for your command. So let's do this real quick.`}

\n
{`execute: function (message, args: RoleArgs, guild) {\n  // If this was the everyone role alert with a silly error\n  if (args.role.id === message.guildID) {\n    return sendResponse(message, \"Are you trying to make this person a super hero? Everyone has the everyone role. I can't give the everyone role to another user.\");\n  }\n\n  // Lots of comments here hidden so you can see the changes easily.\n}\n\ninterface RoleArgs {\n  role: Role;\n  member: Member;\n}\n`}
\n

{`Awesome! Let's keep going.`}

\n
{`execute: function (message, args: RoleArgs, guild) {\n  // If this was the everyone role alert with a silly error\n  if (args.role.id === message.guildID) {\n    return sendResponse(message, \"I don't know if you noticed or not but I'm an extremely arrogant bot who tends to think all of his plans will work. But I can't give the everyone role to someone.\");\n  }\n\n  // If this is a managed role(some bots role) we can't give/remove alert with silly error\n  if (args.role.managed) {\n    return sendResponse(message, \"Dammit man, just 'cause I'm Scottish doesn't mean I can give your people managed roles.\")\n  }\n\n  // Get the bots highest role\n  const botsHighestRole = highestRole(message.guildID, botID);\n\n  // Check if the bot has a role higher than the role that it will try to give.\n  const botIsHigher = higherRolePosition(message.guildID, botsHighestRole.id, args.role.id)\n\n  // If the role is too high alert the user.\n  if (!botIsHigher) {\n    return sendResponse(message, \"Okay look, asking me give a role that is higher than my highest role is ridiculous! I am the first bot to admit I don't know who these people are nor do I care to. Look, if you'd like I could take you down the hall and just point at the people who annoy me more than the rest. But that's about as useful as I get.\")\n  }\n\n  // Check the command author's highest role\n  const membersHighestRole = highestRole(message.guildID, message.author.id);\n\n  // If the author does not have a role high enough to give this role alert\n  if (!higherRolePosition(message.guildID, membersHighestRole.id, args.role.id)) {\n    return sendResponse(message, \"In my culture, whenever someone tries to give a role that is higher than their highest role, I would be well within my rights to dismember you.\")\n  }\n\n  // If the user has this role already we should remove it\n  if (message.member().roles.includes(args.role.id)) {\n    removeRole(message.guildID, args.member.user.id, args.role.id, \\`\\${message.author.tag} used the role command to remove this role.\\`)\n    // Alert the user that used the command that the user has lost the role.\n    return sendResponse(message, \\`The role **\\${args.role.name}** has been removed from **\\${args.member.tag}**.\\`)\n  }\n\n  // Add the role to the user.\n  addRole(guildID, memberID, roleID)\n\n  // Alert the user that used the command that the user has been give the role.\n  return sendResponse(message, \\`The role **\\${args.role.name}** has been added to **\\${args.member.tag}**.\\`)\n}\n`}
\n

{`The final version of the command should look something like this:`}

\n
{`import { highestRole, higherRolePosition, botID, removeRole, addRole, Role, Member } from \"../../deps.ts\";\nimport { botCache } from \"../../mod.ts\";\nimport { PermissionLevels } from \"../types/commands.ts\";\nimport { sendResponse } from \"../utils/helpers.ts\";\n\nbotCache.commands.set(\"role\", {\n  name: \"role\",\n  permissionLevel: [PermissionLevels.MODERATOR, PermissionLevels.ADMIN],\n  botServerPermissions: [\"MANAGE_ROLES\"],\n  botChannelPermissions: [\"SEND_MESSAGES\"],\n  cooldown: {\n    seconds: 60,\n    allowedUses: 5,\n  },\n  arguments: [\n        {\n            name: \"member\",\n            type: \"member\",\n            missing: (message) => {\n                sendResponse(message, \\`you did not provide a member to give the role to. You can provide a @member mention, a member ID, or try using their nickname/username. The nickname/username will only work if they have been active in your server recently.\\`)\n            }\n        },\n        {\n            name: \"role\",\n            type: \"role\",\n            missing: (message) => {\n                sendResponse(message, \\`you did not provide a role to give. You can provide a @role mention, a role ID, or it's name. If the role name did not work, try to use the **roleinfo** command to get the role ID.\\`)\n            }\n        }\n    ],\n  execute: function (message, args: RoleArgs) {\n    // If this was the everyone role alert with a silly error\n    if (args.role.id === message.guildID) {\n      return sendResponse(\n        message,\n        \"I don't know if you noticed or not but I'm an extremely arrogant bot who tends to think all of his plans will work. But I can't give the everyone role to someone.\",\n      );\n    }\n\n    // If this is a managed role(some bots role) we can't give/remove alert with silly error\n    if (args.role.managed) {\n      return sendResponse(\n        message,\n        \"Dammit man, just 'cause I'm Scottish doesn't mean I can give your people managed roles.\",\n      );\n    }\n\n    // Get the bots highest role\n    const botsHighestRole = highestRole(message.guildID, botID);\n\n    // Check if the bot has a role higher than the role that it will try to give. If the role is too high alert the user.\n    if (!botsHighestRole || !higherRolePosition(\n      message.guildID,\n      botsHighestRole.id,\n      args.role.id,\n    )) {\n      return sendResponse(\n        message,\n        \"Okay look, asking me give a role that is higher than my highest role is ridiculous! I am the first bot to admit I don't know who these people are nor do I care to. Look, if you'd like I could take you down the hall and just point at the people who annoy me more than the rest. But that's about as useful as I get.\",\n      );\n    }\n\n    // Check the command author's highest role\n    const membersHighestRole = highestRole(message.guildID, message.author.id);\n\n    // If the author does not have a role high enough to give this role alert\n    if (!membersHighestRole ||\n      !higherRolePosition(message.guildID, membersHighestRole.id, args.role.id)\n    ) {\n      return sendResponse(\n        message,\n        \"In my culture, whenever someone tries to give a role that is higher than their highest role, I would be well within my rights to dismember you.\",\n      );\n    }\n\n    // If the user has this role already we should remove it\n    if (message.member()?.roles.includes(args.role.id)) {\n      removeRole(\n        message.guildID,\n        args.member.user.id,\n        args.role.id,\n        \\`\\${message.author.username} used the role command to remove this role.\\`,\n      );\n      // Alert the user that used the command that the user has lost the role.\n      return sendResponse(\n        message,\n        \\`The role **\\${args.role.name}** has been removed from **\\${args.member.tag}**.\\`,\n      );\n    }\n\n    // Add the role to the user.\n    addRole(message.guildID, args.member.user.id, args.role.id, \\`\\${message.author.username} used the role command to give this role.\\`);\n\n    // Alert the user that used the command that the user has been give the role.\n    return sendResponse(\n      message,\n      \\`The role **\\${args.role.name}** has been added to **\\${args.member.tag}**.\\`,\n    );\n  },\n});\n\ninterface RoleArgs {\n  role: Role;\n  member: Member;\n}\n`}
\n
\n

{`Note:`}{` The response strings are a play on some funny Stargate(my favorite tv show) moments. Feel free to change as you wish to fit your bot's personality.`}

\n
\n

{`Dynamic(Advanced Level) Command Creation`}

\n

{`This is some advanced level super magical command creation skills. Discordeno gives you the power to dynamically create commands. What that means is you can write the code for one command but dynamically create like 50 commands using that same code.`}

\n

{`For example, in my main bot I have a lot of \"fun\" commands like `}{`.hug`}{` or `}{`.kiss`}{` etc... All of these files have the exact same code except for 1 word being the command name. Would it not be better to simply write the code once and dynamically create every single command. Let me show you how that works.`}

\n
    \n
  • {`Create a file in the commands folder called `}{`fun.ts`}{` which will create all our fun commands.`}
  • \n
\n
{`import { Member, sendMessage, chooseRandom, avatarURL } from \"../../deps.ts\";\nimport { botCache } from \"../../mod.ts\";\nimport { createCommandAliases, sendEmbed } from \"../utils/helpers.ts\";\nimport { configs } from \"../../configs.ts\";\nimport { Embed } from \"../utils/Embed.ts\";\nimport { translate } from \"../utils/i18next.ts\";\n\nconst funCommandData = [\n  { name: \"bite\", gifs: configs.gifs.bite },\n  { name: \"cuddle\", gifs: configs.gifs.cuddle },\n  { name: \"dance\", gifs: configs.gifs.dance },\n  { name: \"hug\", gifs: configs.gifs.hug },\n  { name: \"kiss\", gifs: configs.gifs.kiss },\n  { name: \"kanna\", gifs: configs.gifs.kanna },\n  { name: \"kiss\", gifs: configs.gifs.kiss },\n  { name: \"kitten\", gifs: configs.gifs.kitten },\n  { name: \"lmao\", gifs: configs.gifs.lmao, aliases: [\"lol\"] },\n  { name: \"pat\", gifs: configs.gifs.pat },\n  { name: \"poke\", gifs: configs.gifs.poke },\n  { name: \"pony\", gifs: configs.gifs.pony },\n  { name: \"puppy\", gifs: configs.gifs.puppy },\n  { name: \"raphtalia\", gifs: configs.gifs.raphtalia },\n  { name: \"stargate\", gifs: configs.gifs.stargate },\n  { name: \"supernatural\", gifs: configs.gifs.supernatural },\n  { name: \"tickle\", gifs: configs.gifs.tickle },\n  { name: \"zerotwo\", gifs: configs.gifs.zerotwo },\n];\n\nfunCommandData.forEach((data) => {\n  botCache.commands.set(data.name, {\n    name: data.name,\n    botChannelPermissions: [\"SEND_MESSAGES\", \"EMBED_LINKS\"],\n    cooldown: {\n      seconds: 2,\n    },\n    arguments: [\n      {\n        name: \"member\",\n        type: \"member\",\n        required: false,\n      },\n    ],\n    execute: function (message, args: FunArgs) {\n            // If a member is provided use that otherwise set the member themself\n      const member = args.member || message.member()!;\n\n      const type = member.user.id === message.author.id\n        // Silly response like if user tries to hug themself\n        ? \"SELF\"\n        // Response for when user tries to hug another user\n        : \"OTHER\";\n\n\n      // Create an embed\n      const embed = new Embed()\n        .setAuthor(member.tag, avatarURL(member))\n        .setDescription(\n          translate(\n            message.guildID,\n            \\`commands/fun/\\${data.name}:\\${type}\\`,\n            { mention: message.member()!.mention, user: member.mention },\n          ),\n        )\n        .setImage(chooseRandom(data.gifs));\n\n      return sendEmbed(message.channel, embed);\n    },\n  });\n\n  if (data.aliases?.length) {\n    createCommandAliases(data.name, data.aliases);\n  }\n});\n\ninterface FunArgs {\n  member?: Member;\n}\n`}
\n
\n

{`Note:`}{` The imports in this are a bit different. I did this to show you that you can also import everything grouped like this through the `}{`deps.ts`}{` which will make everything available to you at ease.`}

\n
\n

{`Take a minute to realize what just happened. This has made 18 different unique commands dynamically. In 1 file, using the same piece of code, we created so many commands. You can easily add more commands to this. For example, if you wanted to add weeb(animated) versions of these commands. Then you are at 36 commands with 1 simple command file.`}

\n

{`That ladies and gentleman is the power and magic of Discordeno!`}

\n

{`Take a minute to stand up, step back and make some room around you. Now start dancing because you just acheived one of the most complex things in bot development. You have already created about 36 commands!!!!`}

\n
\n

{`Note:`}{` The command above uses translations which we will cover in depth in a later section of this guide.`}

\n
\n

{`Once you are ready, let's proceed to making our inhibitors.`}

\n\n
;\n}\n\n;\nMDXContent.isMDXComponent = true;"}} \ No newline at end of file diff --git a/docs/.cache/caches/gatsby-plugin-mdx/diskstore-22903bb47406f19dea194b0bdca29de3.json b/docs/.cache/caches/gatsby-plugin-mdx/diskstore-22903bb47406f19dea194b0bdca29de3.json new file mode 100644 index 000000000..6a7590cc6 --- /dev/null +++ b/docs/.cache/caches/gatsby-plugin-mdx/diskstore-22903bb47406f19dea194b0bdca29de3.json @@ -0,0 +1 @@ +{"expireTime":9007200851596500000,"key":"gatsby-plugin-mdx-entire-payload-36049e4a0b49085caed11a14c8b72424-","val":{"mdast":{"type":"root","children":[{"type":"heading","depth":2,"children":[{"type":"text","value":"Understanding The Goals of This Guide","position":{"start":{"line":2,"column":4,"offset":4},"end":{"line":2,"column":41,"offset":41},"indent":[]}}],"position":{"start":{"line":2,"column":1,"offset":1},"end":{"line":2,"column":41,"offset":41},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"This guide is a step by step simple walkthrough meant for beginner developers but also can be quite useful for advanced developers to learn about Discordeno.","position":{"start":{"line":4,"column":1,"offset":43},"end":{"line":4,"column":158,"offset":200},"indent":[]}}],"position":{"start":{"line":4,"column":1,"offset":43},"end":{"line":4,"column":158,"offset":200},"indent":[]}},{"type":"heading","depth":2,"children":[{"type":"text","value":"Who Made Discordeno?","position":{"start":{"line":6,"column":4,"offset":205},"end":{"line":6,"column":24,"offset":225},"indent":[]}}],"position":{"start":{"line":6,"column":1,"offset":202},"end":{"line":6,"column":24,"offset":225},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"Skillz4Killz. However, there are a lot of other contributors to the project as well. Join the discord server to meet and learn more about the wonderful team!","position":{"start":{"line":8,"column":1,"offset":227},"end":{"line":8,"column":158,"offset":384},"indent":[]}}],"position":{"start":{"line":8,"column":1,"offset":227},"end":{"line":8,"column":158,"offset":384},"indent":[]}},{"type":"heading","depth":2,"children":[{"type":"text","value":"Why You Should Use Discordeno?","position":{"start":{"line":10,"column":4,"offset":389},"end":{"line":10,"column":34,"offset":419},"indent":[]}}],"position":{"start":{"line":10,"column":1,"offset":386},"end":{"line":10,"column":34,"offset":419},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"Discordeno provides you all the tools that you need to make bot development really easy. All the tools are already made for you to just simply copy and use for yourself. We will go through each and every tool in other sections of this guide.","position":{"start":{"line":12,"column":1,"offset":421},"end":{"line":12,"column":242,"offset":662},"indent":[]}}],"position":{"start":{"line":12,"column":1,"offset":421},"end":{"line":12,"column":242,"offset":662},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"As the old saying goes, the best way to learn to ride a bicycle is to actually try riding a bicycle. So let's try out Discordeno.","position":{"start":{"line":14,"column":1,"offset":664},"end":{"line":14,"column":130,"offset":793},"indent":[]}}],"position":{"start":{"line":14,"column":1,"offset":664},"end":{"line":14,"column":130,"offset":793},"indent":[]}},{"type":"export","value":"export const _frontmatter = {\"title\":\"Step By Step Guide\",\"metaTitle\":\"Step By Step Guide | Discordeno\",\"metaDescription\":\"This guide will help you learn every part of Discordeno, step by step to create your own bot as you wish.\"}","position":{"start":{"line":17,"column":1,"offset":796},"end":{"line":17,"column":231,"offset":1026},"indent":[]}}],"position":{"start":{"line":1,"column":1,"offset":0},"end":{"line":17,"column":231,"offset":1026}}},"scopeImports":["import * as React from 'react'"],"scopeIdentifiers":["React"],"body":"function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }\n\nfunction _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }\n\nfunction _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }\n\n/* @jsx mdx */\nvar _frontmatter = {\n \"title\": \"Step By Step Guide\",\n \"metaTitle\": \"Step By Step Guide | Discordeno\",\n \"metaDescription\": \"This guide will help you learn every part of Discordeno, step by step to create your own bot as you wish.\"\n};\nvar layoutProps = {\n _frontmatter: _frontmatter\n};\nvar MDXLayout = \"wrapper\";\nreturn function MDXContent(_ref) {\n var components = _ref.components,\n props = _objectWithoutProperties(_ref, [\"components\"]);\n\n return mdx(MDXLayout, _extends({}, layoutProps, props, {\n components: components,\n mdxType: \"MDXLayout\"\n }), mdx(\"h2\", null, \"Understanding The Goals of This Guide\"), mdx(\"p\", null, \"This guide is a step by step simple walkthrough meant for beginner developers but also can be quite useful for advanced developers to learn about Discordeno.\"), mdx(\"h2\", null, \"Who Made Discordeno?\"), mdx(\"p\", null, \"Skillz4Killz. However, there are a lot of other contributors to the project as well. Join the discord server to meet and learn more about the wonderful team!\"), mdx(\"h2\", null, \"Why You Should Use Discordeno?\"), mdx(\"p\", null, \"Discordeno provides you all the tools that you need to make bot development really easy. All the tools are already made for you to just simply copy and use for yourself. We will go through each and every tool in other sections of this guide.\"), mdx(\"p\", null, \"As the old saying goes, the best way to learn to ride a bicycle is to actually try riding a bicycle. So let's try out Discordeno.\"));\n}\n;\nMDXContent.isMDXComponent = true;","rawMDXOutput":"/* @jsx mdx */\nimport { mdx } from '@mdx-js/react';\n/* @jsx mdx */\n\nexport const _frontmatter = {\n \"title\": \"Step By Step Guide\",\n \"metaTitle\": \"Step By Step Guide | Discordeno\",\n \"metaDescription\": \"This guide will help you learn every part of Discordeno, step by step to create your own bot as you wish.\"\n};\n\nconst layoutProps = {\n _frontmatter\n};\nconst MDXLayout = \"wrapper\"\nexport default function MDXContent({\n components,\n ...props\n}) {\n return \n

{`Understanding The Goals of This Guide`}

\n

{`This guide is a step by step simple walkthrough meant for beginner developers but also can be quite useful for advanced developers to learn about Discordeno.`}

\n

{`Who Made Discordeno?`}

\n

{`Skillz4Killz. However, there are a lot of other contributors to the project as well. Join the discord server to meet and learn more about the wonderful team!`}

\n

{`Why You Should Use Discordeno?`}

\n

{`Discordeno provides you all the tools that you need to make bot development really easy. All the tools are already made for you to just simply copy and use for yourself. We will go through each and every tool in other sections of this guide.`}

\n

{`As the old saying goes, the best way to learn to ride a bicycle is to actually try riding a bicycle. So let's try out Discordeno.`}

\n\n
;\n}\n\n;\nMDXContent.isMDXComponent = true;"}} \ No newline at end of file diff --git a/docs/.cache/caches/gatsby-plugin-mdx/diskstore-24ad22243e43177255b836d98838e179.json b/docs/.cache/caches/gatsby-plugin-mdx/diskstore-24ad22243e43177255b836d98838e179.json new file mode 100644 index 000000000..1af049ff0 --- /dev/null +++ b/docs/.cache/caches/gatsby-plugin-mdx/diskstore-24ad22243e43177255b836d98838e179.json @@ -0,0 +1 @@ +{"expireTime":9007200851632118000,"key":"gatsby-plugin-mdx-entire-payload-84439c2e4c04c6dc059924f62f17a62d-","val":{"mdast":{"type":"root","children":[{"type":"paragraph","children":[{"type":"text","value":"Woah! You are almost half way done with understanding all of Discordeno. Amazing isn't it? Something you may have noticed in the last section was there were some options that prevented some commands from running like ","position":{"start":{"line":2,"column":1,"offset":1},"end":{"line":2,"column":218,"offset":218},"indent":[]}},{"type":"inlineCode","value":"dmOnly","position":{"start":{"line":2,"column":218,"offset":218},"end":{"line":2,"column":226,"offset":226},"indent":[]}},{"type":"text","value":" or the permission options. we created a setting to prevent the monitor from running in certain channels. What if we wanted to do prevent commands from happening? How would we prevent commands from running?","position":{"start":{"line":2,"column":226,"offset":226},"end":{"line":2,"column":432,"offset":432},"indent":[]}}],"position":{"start":{"line":2,"column":1,"offset":1},"end":{"line":2,"column":432,"offset":432},"indent":[]}},{"type":"heading","depth":2,"children":[{"type":"text","value":"What is an Inhibitor?","position":{"start":{"line":4,"column":4,"offset":437},"end":{"line":4,"column":25,"offset":458},"indent":[]}}],"position":{"start":{"line":4,"column":1,"offset":434},"end":{"line":4,"column":25,"offset":458},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"An Inhibitor is very similar to how monitors work. A monitor runs on every message but an inhibitor runs on every command. Remember all those command options like cooldown, permissions, permissionLevel, nsfw, etc... Each and every one of these options has an inhibitor in Klasa core that checks commands for these settings.\nLet's create our own inhibitor that would prevent commands from being used if the user is not a VIP user.","position":{"start":{"line":6,"column":1,"offset":460},"end":{"line":7,"column":106,"offset":889},"indent":[1]}}],"position":{"start":{"line":6,"column":1,"offset":460},"end":{"line":7,"column":106,"offset":889},"indent":[1]}},{"type":"blockquote","children":[{"type":"paragraph","children":[{"type":"strong","children":[{"type":"text","value":"Note:","position":{"start":{"line":9,"column":5,"offset":895},"end":{"line":9,"column":10,"offset":900},"indent":[]}}],"position":{"start":{"line":9,"column":3,"offset":893},"end":{"line":9,"column":12,"offset":902},"indent":[]}},{"type":"text","value":" It is important to remember that everything below can be done with a simple permission level as well. We will create our own custom permission levels but for the purposes of this guide and to be able to learn about Inhibitors, we will be using an inhibitor.","position":{"start":{"line":9,"column":12,"offset":902},"end":{"line":9,"column":270,"offset":1160},"indent":[]}}],"position":{"start":{"line":9,"column":3,"offset":893},"end":{"line":9,"column":270,"offset":1160},"indent":[]}}],"position":{"start":{"line":9,"column":1,"offset":891},"end":{"line":9,"column":270,"offset":1160},"indent":[]}},{"type":"export","value":"export const _frontmatter = {\"title\":\"Creating Inhibitors!\",\"metaTitle\":\"Creating An Inhibitor | Discordeno\",\"metaDescription\":\"Let's create our very own bot with Discordeno!\"}","position":{"start":{"line":12,"column":1,"offset":1163},"end":{"line":12,"column":177,"offset":1339},"indent":[]}}],"position":{"start":{"line":1,"column":1,"offset":0},"end":{"line":12,"column":177,"offset":1339}}},"scopeImports":["import * as React from 'react'"],"scopeIdentifiers":["React"],"body":"function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }\n\nfunction _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }\n\nfunction _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }\n\n/* @jsx mdx */\nvar _frontmatter = {\n \"title\": \"Creating Inhibitors!\",\n \"metaTitle\": \"Creating An Inhibitor | Discordeno\",\n \"metaDescription\": \"Let's create our very own bot with Discordeno!\"\n};\nvar layoutProps = {\n _frontmatter: _frontmatter\n};\nvar MDXLayout = \"wrapper\";\nreturn function MDXContent(_ref) {\n var components = _ref.components,\n props = _objectWithoutProperties(_ref, [\"components\"]);\n\n return mdx(MDXLayout, _extends({}, layoutProps, props, {\n components: components,\n mdxType: \"MDXLayout\"\n }), mdx(\"p\", null, \"Woah! You are almost half way done with understanding all of Discordeno. Amazing isn't it? Something you may have noticed in the last section was there were some options that prevented some commands from running like \", mdx(\"inlineCode\", {\n parentName: \"p\"\n }, \"dmOnly\"), \" or the permission options. we created a setting to prevent the monitor from running in certain channels. What if we wanted to do prevent commands from happening? How would we prevent commands from running?\"), mdx(\"h2\", null, \"What is an Inhibitor?\"), mdx(\"p\", null, \"An Inhibitor is very similar to how monitors work. A monitor runs on every message but an inhibitor runs on every command. Remember all those command options like cooldown, permissions, permissionLevel, nsfw, etc... Each and every one of these options has an inhibitor in Klasa core that checks commands for these settings.\\nLet's create our own inhibitor that would prevent commands from being used if the user is not a VIP user.\"), mdx(\"blockquote\", null, mdx(\"p\", {\n parentName: \"blockquote\"\n }, mdx(\"strong\", {\n parentName: \"p\"\n }, \"Note:\"), \" It is important to remember that everything below can be done with a simple permission level as well. We will create our own custom permission levels but for the purposes of this guide and to be able to learn about Inhibitors, we will be using an inhibitor.\")));\n}\n;\nMDXContent.isMDXComponent = true;","rawMDXOutput":"/* @jsx mdx */\nimport { mdx } from '@mdx-js/react';\n/* @jsx mdx */\n\nexport const _frontmatter = {\n \"title\": \"Creating Inhibitors!\",\n \"metaTitle\": \"Creating An Inhibitor | Discordeno\",\n \"metaDescription\": \"Let's create our very own bot with Discordeno!\"\n};\n\nconst layoutProps = {\n _frontmatter\n};\nconst MDXLayout = \"wrapper\"\nexport default function MDXContent({\n components,\n ...props\n}) {\n return \n

{`Woah! You are almost half way done with understanding all of Discordeno. Amazing isn't it? Something you may have noticed in the last section was there were some options that prevented some commands from running like `}{`dmOnly`}{` or the permission options. we created a setting to prevent the monitor from running in certain channels. What if we wanted to do prevent commands from happening? How would we prevent commands from running?`}

\n

{`What is an Inhibitor?`}

\n

{`An Inhibitor is very similar to how monitors work. A monitor runs on every message but an inhibitor runs on every command. Remember all those command options like cooldown, permissions, permissionLevel, nsfw, etc... Each and every one of these options has an inhibitor in Klasa core that checks commands for these settings.\nLet's create our own inhibitor that would prevent commands from being used if the user is not a VIP user.`}

\n
\n

{`Note:`}{` It is important to remember that everything below can be done with a simple permission level as well. We will create our own custom permission levels but for the purposes of this guide and to be able to learn about Inhibitors, we will be using an inhibitor.`}

\n
\n\n
;\n}\n\n;\nMDXContent.isMDXComponent = true;"}} \ No newline at end of file diff --git a/docs/.cache/caches/gatsby-plugin-mdx/diskstore-255969f006670bdb650251db3cb562ab.json b/docs/.cache/caches/gatsby-plugin-mdx/diskstore-255969f006670bdb650251db3cb562ab.json new file mode 100644 index 000000000..1e8f4fcb1 --- /dev/null +++ b/docs/.cache/caches/gatsby-plugin-mdx/diskstore-255969f006670bdb650251db3cb562ab.json @@ -0,0 +1 @@ +{"expireTime":9007200851635088000,"key":"gatsby-plugin-mdx-entire-payload-6891839ecd26f79ab75d65700eaf2771-","val":{"mdast":{"type":"root","children":[{"type":"paragraph","children":[{"type":"text","value":"Woah! You are almost half way done with understanding all of Discordeno. Amazing isn't it? Something you may have noticed in the last section was there were some options that prevented some commands from running like ","position":{"start":{"line":2,"column":1,"offset":1},"end":{"line":2,"column":218,"offset":218},"indent":[]}},{"type":"inlineCode","value":"dmOnly","position":{"start":{"line":2,"column":218,"offset":218},"end":{"line":2,"column":226,"offset":226},"indent":[]}},{"type":"text","value":" or the permission options. we created a setting to prevent the monitor from running in certain channels. What if we wanted to do prevent commands from happening? How would we prevent commands from running?","position":{"start":{"line":2,"column":226,"offset":226},"end":{"line":2,"column":432,"offset":432},"indent":[]}}],"position":{"start":{"line":2,"column":1,"offset":1},"end":{"line":2,"column":432,"offset":432},"indent":[]}},{"type":"heading","depth":2,"children":[{"type":"text","value":"What Is An Event??","position":{"start":{"line":4,"column":4,"offset":437},"end":{"line":4,"column":22,"offset":455},"indent":[]}}],"position":{"start":{"line":4,"column":1,"offset":434},"end":{"line":4,"column":22,"offset":455},"indent":[]}},{"type":"export","value":"export const _frontmatter = {\"title\":\"Creating Events!\",\"metaTitle\":\"Creating An Event | Discordeno\",\"metaDescription\":\"Let's create our very own bot with Discordeno!\"}","position":{"start":{"line":8,"column":1,"offset":459},"end":{"line":8,"column":169,"offset":627},"indent":[]}}],"position":{"start":{"line":1,"column":1,"offset":0},"end":{"line":8,"column":169,"offset":627}}},"scopeImports":["import * as React from 'react'"],"scopeIdentifiers":["React"],"body":"function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }\n\nfunction _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }\n\nfunction _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }\n\n/* @jsx mdx */\nvar _frontmatter = {\n \"title\": \"Creating Events!\",\n \"metaTitle\": \"Creating An Event | Discordeno\",\n \"metaDescription\": \"Let's create our very own bot with Discordeno!\"\n};\nvar layoutProps = {\n _frontmatter: _frontmatter\n};\nvar MDXLayout = \"wrapper\";\nreturn function MDXContent(_ref) {\n var components = _ref.components,\n props = _objectWithoutProperties(_ref, [\"components\"]);\n\n return mdx(MDXLayout, _extends({}, layoutProps, props, {\n components: components,\n mdxType: \"MDXLayout\"\n }), mdx(\"p\", null, \"Woah! You are almost half way done with understanding all of Discordeno. Amazing isn't it? Something you may have noticed in the last section was there were some options that prevented some commands from running like \", mdx(\"inlineCode\", {\n parentName: \"p\"\n }, \"dmOnly\"), \" or the permission options. we created a setting to prevent the monitor from running in certain channels. What if we wanted to do prevent commands from happening? How would we prevent commands from running?\"), mdx(\"h2\", null, \"What Is An Event??\"));\n}\n;\nMDXContent.isMDXComponent = true;","rawMDXOutput":"/* @jsx mdx */\nimport { mdx } from '@mdx-js/react';\n/* @jsx mdx */\n\nexport const _frontmatter = {\n \"title\": \"Creating Events!\",\n \"metaTitle\": \"Creating An Event | Discordeno\",\n \"metaDescription\": \"Let's create our very own bot with Discordeno!\"\n};\n\nconst layoutProps = {\n _frontmatter\n};\nconst MDXLayout = \"wrapper\"\nexport default function MDXContent({\n components,\n ...props\n}) {\n return \n

{`Woah! You are almost half way done with understanding all of Discordeno. Amazing isn't it? Something you may have noticed in the last section was there were some options that prevented some commands from running like `}{`dmOnly`}{` or the permission options. we created a setting to prevent the monitor from running in certain channels. What if we wanted to do prevent commands from happening? How would we prevent commands from running?`}

\n

{`What Is An Event??`}

\n\n
;\n}\n\n;\nMDXContent.isMDXComponent = true;"}} \ No newline at end of file diff --git a/docs/.cache/caches/gatsby-plugin-mdx/diskstore-26431506f956ca87374159b7b0df7424.json b/docs/.cache/caches/gatsby-plugin-mdx/diskstore-26431506f956ca87374159b7b0df7424.json new file mode 100644 index 000000000..cb4ef3596 --- /dev/null +++ b/docs/.cache/caches/gatsby-plugin-mdx/diskstore-26431506f956ca87374159b7b0df7424.json @@ -0,0 +1 @@ +{"expireTime":9007200851635184000,"key":"gatsby-plugin-mdx-entire-payload-8b3627c4255534907b1e1b4a3e960d13-","val":{"mdast":{"type":"root","children":[{"type":"paragraph","children":[{"type":"text","value":"Woah! You are almost half way done with understanding all of Discordeno. Amazing isn't it? Something you may have noticed in the last section was when the bot started up you could see a bunch of messages like ","position":{"start":{"line":2,"column":1,"offset":1},"end":{"line":2,"column":210,"offset":210},"indent":[]}},{"type":"inlineCode","value":"Loaded X Commands","position":{"start":{"line":2,"column":210,"offset":210},"end":{"line":2,"column":229,"offset":229},"indent":[]}},{"type":"text","value":" and such. Let's jump into this part now and understand how event handling works in Discordeno.","position":{"start":{"line":2,"column":229,"offset":229},"end":{"line":2,"column":324,"offset":324},"indent":[]}}],"position":{"start":{"line":2,"column":1,"offset":1},"end":{"line":2,"column":324,"offset":324},"indent":[]}},{"type":"heading","depth":2,"children":[{"type":"text","value":"What Is An Event?","position":{"start":{"line":4,"column":4,"offset":329},"end":{"line":4,"column":21,"offset":346},"indent":[]}}],"position":{"start":{"line":4,"column":1,"offset":326},"end":{"line":4,"column":21,"offset":346},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"An event in Discordeno is a function that can be called when a specific event occurs. This function will run ","position":{"start":{"line":6,"column":1,"offset":348},"end":{"line":6,"column":110,"offset":457},"indent":[]}}],"position":{"start":{"line":6,"column":1,"offset":348},"end":{"line":6,"column":110,"offset":457},"indent":[]}},{"type":"export","value":"export const _frontmatter = {\"title\":\"Creating Events!\",\"metaTitle\":\"Creating An Event | Discordeno\",\"metaDescription\":\"Let's create our very own bot with Discordeno!\"}","position":{"start":{"line":9,"column":1,"offset":460},"end":{"line":9,"column":169,"offset":628},"indent":[]}}],"position":{"start":{"line":1,"column":1,"offset":0},"end":{"line":9,"column":169,"offset":628}}},"scopeImports":["import * as React from 'react'"],"scopeIdentifiers":["React"],"body":"function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }\n\nfunction _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }\n\nfunction _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }\n\n/* @jsx mdx */\nvar _frontmatter = {\n \"title\": \"Creating Events!\",\n \"metaTitle\": \"Creating An Event | Discordeno\",\n \"metaDescription\": \"Let's create our very own bot with Discordeno!\"\n};\nvar layoutProps = {\n _frontmatter: _frontmatter\n};\nvar MDXLayout = \"wrapper\";\nreturn function MDXContent(_ref) {\n var components = _ref.components,\n props = _objectWithoutProperties(_ref, [\"components\"]);\n\n return mdx(MDXLayout, _extends({}, layoutProps, props, {\n components: components,\n mdxType: \"MDXLayout\"\n }), mdx(\"p\", null, \"Woah! You are almost half way done with understanding all of Discordeno. Amazing isn't it? Something you may have noticed in the last section was when the bot started up you could see a bunch of messages like \", mdx(\"inlineCode\", {\n parentName: \"p\"\n }, \"Loaded X Commands\"), \" and such. Let's jump into this part now and understand how event handling works in Discordeno.\"), mdx(\"h2\", null, \"What Is An Event?\"), mdx(\"p\", null, \"An event in Discordeno is a function that can be called when a specific event occurs. This function will run \"));\n}\n;\nMDXContent.isMDXComponent = true;","rawMDXOutput":"/* @jsx mdx */\nimport { mdx } from '@mdx-js/react';\n/* @jsx mdx */\n\nexport const _frontmatter = {\n \"title\": \"Creating Events!\",\n \"metaTitle\": \"Creating An Event | Discordeno\",\n \"metaDescription\": \"Let's create our very own bot with Discordeno!\"\n};\n\nconst layoutProps = {\n _frontmatter\n};\nconst MDXLayout = \"wrapper\"\nexport default function MDXContent({\n components,\n ...props\n}) {\n return \n

{`Woah! You are almost half way done with understanding all of Discordeno. Amazing isn't it? Something you may have noticed in the last section was when the bot started up you could see a bunch of messages like `}{`Loaded X Commands`}{` and such. Let's jump into this part now and understand how event handling works in Discordeno.`}

\n

{`What Is An Event?`}

\n

{`An event in Discordeno is a function that can be called when a specific event occurs. This function will run `}

\n\n
;\n}\n\n;\nMDXContent.isMDXComponent = true;"}} \ No newline at end of file diff --git a/docs/.cache/caches/gatsby-plugin-mdx/diskstore-26b8b6c7688485c8887043a9ad28fae4.json b/docs/.cache/caches/gatsby-plugin-mdx/diskstore-26b8b6c7688485c8887043a9ad28fae4.json new file mode 100644 index 000000000..7a504bf70 --- /dev/null +++ b/docs/.cache/caches/gatsby-plugin-mdx/diskstore-26b8b6c7688485c8887043a9ad28fae4.json @@ -0,0 +1 @@ +{"expireTime":9007200851632109000,"key":"gatsby-plugin-mdx-entire-payload-766d93e4c933c63c646a2a2090574733-","val":{"mdast":{"type":"root","children":[{"type":"paragraph","children":[{"type":"text","value":"Woah! You are almost half way done with understanding all of Discordeno. Amazing isn't it? Something you may have noticed in the last section was there were some options that prevented some commands from running like ","position":{"start":{"line":2,"column":1,"offset":1},"end":{"line":2,"column":218,"offset":218},"indent":[]}},{"type":"inlineCode","value":"dmOnly","position":{"start":{"line":2,"column":218,"offset":218},"end":{"line":2,"column":226,"offset":226},"indent":[]}},{"type":"text","value":" or the permission options. we created a setting to prevent the monitor from running in certain channels. What if we wanted to do prevent commands from happening? How would we prevent commands from running?","position":{"start":{"line":2,"column":226,"offset":226},"end":{"line":2,"column":432,"offset":432},"indent":[]}}],"position":{"start":{"line":2,"column":1,"offset":1},"end":{"line":2,"column":432,"offset":432},"indent":[]}},{"type":"heading","depth":2,"children":[{"type":"text","value":"What is an Inhibitor?","position":{"start":{"line":4,"column":4,"offset":437},"end":{"line":4,"column":25,"offset":458},"indent":[]}}],"position":{"start":{"line":4,"column":1,"offset":434},"end":{"line":4,"column":25,"offset":458},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"An Inhibitor is very similar to how monitors work. A monitor runs on every message but an inhibitor runs on every command. Remember all those command options like cooldown, permissions, permissionLevel, nsfw, , runIn. Each and every one of these options has an inhibitor in Klasa core that checks commands for these settings.\nLet's create our own inhibitor that would prevent commands from being used if the user is not a VIP user.","position":{"start":{"line":6,"column":1,"offset":460},"end":{"line":7,"column":106,"offset":891},"indent":[1]}}],"position":{"start":{"line":6,"column":1,"offset":460},"end":{"line":7,"column":106,"offset":891},"indent":[1]}},{"type":"blockquote","children":[{"type":"paragraph","children":[{"type":"strong","children":[{"type":"text","value":"Note:","position":{"start":{"line":9,"column":5,"offset":897},"end":{"line":9,"column":10,"offset":902},"indent":[]}}],"position":{"start":{"line":9,"column":3,"offset":895},"end":{"line":9,"column":12,"offset":904},"indent":[]}},{"type":"text","value":" It is important to remember that everything below can be done with a simple permission level as well. We will create our own custom permission levels but for the purposes of this guide and to be able to learn about Inhibitors, we will be using an inhibitor.","position":{"start":{"line":9,"column":12,"offset":904},"end":{"line":9,"column":270,"offset":1162},"indent":[]}}],"position":{"start":{"line":9,"column":3,"offset":895},"end":{"line":9,"column":270,"offset":1162},"indent":[]}}],"position":{"start":{"line":9,"column":1,"offset":893},"end":{"line":9,"column":270,"offset":1162},"indent":[]}},{"type":"export","value":"export const _frontmatter = {\"title\":\"Creating Inhibitors!\",\"metaTitle\":\"Creating An Inhibitor | Discordeno\",\"metaDescription\":\"Let's create our very own bot with Discordeno!\"}","position":{"start":{"line":12,"column":1,"offset":1165},"end":{"line":12,"column":177,"offset":1341},"indent":[]}}],"position":{"start":{"line":1,"column":1,"offset":0},"end":{"line":12,"column":177,"offset":1341}}},"scopeImports":["import * as React from 'react'"],"scopeIdentifiers":["React"],"body":"function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }\n\nfunction _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }\n\nfunction _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }\n\n/* @jsx mdx */\nvar _frontmatter = {\n \"title\": \"Creating Inhibitors!\",\n \"metaTitle\": \"Creating An Inhibitor | Discordeno\",\n \"metaDescription\": \"Let's create our very own bot with Discordeno!\"\n};\nvar layoutProps = {\n _frontmatter: _frontmatter\n};\nvar MDXLayout = \"wrapper\";\nreturn function MDXContent(_ref) {\n var components = _ref.components,\n props = _objectWithoutProperties(_ref, [\"components\"]);\n\n return mdx(MDXLayout, _extends({}, layoutProps, props, {\n components: components,\n mdxType: \"MDXLayout\"\n }), mdx(\"p\", null, \"Woah! You are almost half way done with understanding all of Discordeno. Amazing isn't it? Something you may have noticed in the last section was there were some options that prevented some commands from running like \", mdx(\"inlineCode\", {\n parentName: \"p\"\n }, \"dmOnly\"), \" or the permission options. we created a setting to prevent the monitor from running in certain channels. What if we wanted to do prevent commands from happening? How would we prevent commands from running?\"), mdx(\"h2\", null, \"What is an Inhibitor?\"), mdx(\"p\", null, \"An Inhibitor is very similar to how monitors work. A monitor runs on every message but an inhibitor runs on every command. Remember all those command options like cooldown, permissions, permissionLevel, nsfw, , runIn. Each and every one of these options has an inhibitor in Klasa core that checks commands for these settings.\\nLet's create our own inhibitor that would prevent commands from being used if the user is not a VIP user.\"), mdx(\"blockquote\", null, mdx(\"p\", {\n parentName: \"blockquote\"\n }, mdx(\"strong\", {\n parentName: \"p\"\n }, \"Note:\"), \" It is important to remember that everything below can be done with a simple permission level as well. We will create our own custom permission levels but for the purposes of this guide and to be able to learn about Inhibitors, we will be using an inhibitor.\")));\n}\n;\nMDXContent.isMDXComponent = true;","rawMDXOutput":"/* @jsx mdx */\nimport { mdx } from '@mdx-js/react';\n/* @jsx mdx */\n\nexport const _frontmatter = {\n \"title\": \"Creating Inhibitors!\",\n \"metaTitle\": \"Creating An Inhibitor | Discordeno\",\n \"metaDescription\": \"Let's create our very own bot with Discordeno!\"\n};\n\nconst layoutProps = {\n _frontmatter\n};\nconst MDXLayout = \"wrapper\"\nexport default function MDXContent({\n components,\n ...props\n}) {\n return \n

{`Woah! You are almost half way done with understanding all of Discordeno. Amazing isn't it? Something you may have noticed in the last section was there were some options that prevented some commands from running like `}{`dmOnly`}{` or the permission options. we created a setting to prevent the monitor from running in certain channels. What if we wanted to do prevent commands from happening? How would we prevent commands from running?`}

\n

{`What is an Inhibitor?`}

\n

{`An Inhibitor is very similar to how monitors work. A monitor runs on every message but an inhibitor runs on every command. Remember all those command options like cooldown, permissions, permissionLevel, nsfw, , runIn. Each and every one of these options has an inhibitor in Klasa core that checks commands for these settings.\nLet's create our own inhibitor that would prevent commands from being used if the user is not a VIP user.`}

\n
\n

{`Note:`}{` It is important to remember that everything below can be done with a simple permission level as well. We will create our own custom permission levels but for the purposes of this guide and to be able to learn about Inhibitors, we will be using an inhibitor.`}

\n
\n\n
;\n}\n\n;\nMDXContent.isMDXComponent = true;"}} \ No newline at end of file diff --git a/docs/.cache/caches/gatsby-plugin-mdx/diskstore-279e940a043d93d0cc4ef6f739569883.json b/docs/.cache/caches/gatsby-plugin-mdx/diskstore-279e940a043d93d0cc4ef6f739569883.json new file mode 100644 index 000000000..e0e84eadb --- /dev/null +++ b/docs/.cache/caches/gatsby-plugin-mdx/diskstore-279e940a043d93d0cc4ef6f739569883.json @@ -0,0 +1 @@ +{"expireTime":9007200851634106000,"key":"gatsby-plugin-mdx-entire-payload-89f382b181a740156347e3e32c1c3b30-","val":{"mdast":{"type":"root","children":[{"type":"paragraph","children":[{"type":"text","value":"Woah! You are almost half way done with understanding all of Discordeno. Amazing isn't it? Something you may have noticed in the last section was there were some options that prevented some commands from running like ","position":{"start":{"line":2,"column":1,"offset":1},"end":{"line":2,"column":218,"offset":218},"indent":[]}},{"type":"inlineCode","value":"dmOnly","position":{"start":{"line":2,"column":218,"offset":218},"end":{"line":2,"column":226,"offset":226},"indent":[]}},{"type":"text","value":" or the permission options. we created a setting to prevent the monitor from running in certain channels. What if we wanted to do prevent commands from happening? How would we prevent commands from running?","position":{"start":{"line":2,"column":226,"offset":226},"end":{"line":2,"column":432,"offset":432},"indent":[]}}],"position":{"start":{"line":2,"column":1,"offset":1},"end":{"line":2,"column":432,"offset":432},"indent":[]}},{"type":"heading","depth":2,"children":[{"type":"text","value":"What is an Inhibitor?","position":{"start":{"line":4,"column":4,"offset":437},"end":{"line":4,"column":25,"offset":458},"indent":[]}}],"position":{"start":{"line":4,"column":1,"offset":434},"end":{"line":4,"column":25,"offset":458},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"An Inhibitor is very similar to how monitors work. A monitor runs on every message but an inhibitor runs on every command. Remember all those command options like cooldown, permissions, permissionLevel, nsfw, etc... Each and every one of these options has an inhibitor in that checks commands for these settings.","position":{"start":{"line":6,"column":1,"offset":460},"end":{"line":6,"column":313,"offset":772},"indent":[]}}],"position":{"start":{"line":6,"column":1,"offset":460},"end":{"line":6,"column":313,"offset":772},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"Let's create our own inhibitor that would prevent commands from being used if the user is not a VIP user.","position":{"start":{"line":8,"column":1,"offset":774},"end":{"line":8,"column":106,"offset":879},"indent":[]}}],"position":{"start":{"line":8,"column":1,"offset":774},"end":{"line":8,"column":106,"offset":879},"indent":[]}},{"type":"blockquote","children":[{"type":"paragraph","children":[{"type":"strong","children":[{"type":"text","value":"Note:","position":{"start":{"line":10,"column":5,"offset":885},"end":{"line":10,"column":10,"offset":890},"indent":[]}}],"position":{"start":{"line":10,"column":3,"offset":883},"end":{"line":10,"column":12,"offset":892},"indent":[]}},{"type":"text","value":" It is important to remember that everything below can be done with a simple permission level as well. We will create our own custom permission levels but for the purposes of this guide and to be able to learn about Inhibitors, we will be using an inhibitor.","position":{"start":{"line":10,"column":12,"offset":892},"end":{"line":10,"column":270,"offset":1150},"indent":[]}}],"position":{"start":{"line":10,"column":3,"offset":883},"end":{"line":10,"column":270,"offset":1150},"indent":[]}}],"position":{"start":{"line":10,"column":1,"offset":881},"end":{"line":10,"column":270,"offset":1150},"indent":[]}},{"type":"heading","depth":2,"children":[{"type":"text","value":"Creating the File","position":{"start":{"line":12,"column":4,"offset":1155},"end":{"line":12,"column":21,"offset":1172},"indent":[]}}],"position":{"start":{"line":12,"column":1,"offset":1152},"end":{"line":12,"column":21,"offset":1172},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"Let's start by creating a file inside the inhibitors folder called ","position":{"start":{"line":14,"column":1,"offset":1174},"end":{"line":14,"column":68,"offset":1241},"indent":[]}},{"type":"inlineCode","value":"boosted.ts","position":{"start":{"line":14,"column":68,"offset":1241},"end":{"line":14,"column":80,"offset":1253},"indent":[]}},{"type":"text","value":" and paste the following snippet of code:","position":{"start":{"line":14,"column":80,"offset":1253},"end":{"line":14,"column":121,"offset":1294},"indent":[]}}],"position":{"start":{"line":14,"column":1,"offset":1174},"end":{"line":14,"column":121,"offset":1294},"indent":[]}},{"type":"code","lang":"ts","meta":null,"value":"import { botCache } from \"../../mod.ts\";\n\nbotCache.inhibitors.set(\"inhibitorname\", async function (message, command, guild) {\n\t// Your code goes here\n});","position":{"start":{"line":16,"column":1,"offset":1296},"end":{"line":22,"column":4,"offset":1459},"indent":[1,1,1,1,1,1]}},{"type":"paragraph","children":[{"type":"text","value":"Inhibitors can take up to 3 arguments.","position":{"start":{"line":24,"column":1,"offset":1461},"end":{"line":24,"column":39,"offset":1499},"indent":[]}}],"position":{"start":{"line":24,"column":1,"offset":1461},"end":{"line":24,"column":39,"offset":1499},"indent":[]}},{"type":"list","ordered":false,"start":null,"spread":false,"children":[{"type":"listItem","spread":false,"checked":null,"children":[{"type":"paragraph","children":[{"type":"inlineCode","value":"message","position":{"start":{"line":26,"column":3,"offset":1503},"end":{"line":26,"column":12,"offset":1512},"indent":[]}},{"type":"text","value":": The message object that triggered the command.","position":{"start":{"line":26,"column":12,"offset":1512},"end":{"line":26,"column":60,"offset":1560},"indent":[]}}],"position":{"start":{"line":26,"column":3,"offset":1503},"end":{"line":26,"column":60,"offset":1560},"indent":[]}}],"position":{"start":{"line":26,"column":1,"offset":1501},"end":{"line":26,"column":60,"offset":1560},"indent":[]}},{"type":"listItem","spread":false,"checked":null,"children":[{"type":"paragraph","children":[{"type":"inlineCode","value":"command","position":{"start":{"line":27,"column":3,"offset":1563},"end":{"line":27,"column":12,"offset":1572},"indent":[]}},{"type":"text","value":": The command object itself that was triggered.","position":{"start":{"line":27,"column":12,"offset":1572},"end":{"line":27,"column":59,"offset":1619},"indent":[]}}],"position":{"start":{"line":27,"column":3,"offset":1563},"end":{"line":27,"column":59,"offset":1619},"indent":[]}}],"position":{"start":{"line":27,"column":1,"offset":1561},"end":{"line":27,"column":59,"offset":1619},"indent":[]}},{"type":"listItem","spread":false,"checked":null,"children":[{"type":"paragraph","children":[{"type":"inlineCode","value":"guild","position":{"start":{"line":28,"column":3,"offset":1622},"end":{"line":28,"column":10,"offset":1629},"indent":[]}},{"type":"text","value":": The server guild object where this command was ran.","position":{"start":{"line":28,"column":10,"offset":1629},"end":{"line":28,"column":63,"offset":1682},"indent":[]}}],"position":{"start":{"line":28,"column":3,"offset":1622},"end":{"line":28,"column":63,"offset":1682},"indent":[]}}],"position":{"start":{"line":28,"column":1,"offset":1620},"end":{"line":28,"column":63,"offset":1682},"indent":[]}}],"position":{"start":{"line":26,"column":1,"offset":1501},"end":{"line":28,"column":63,"offset":1682},"indent":[1,1]}},{"type":"heading","depth":2,"children":[{"type":"text","value":"Understanding How Inhibitors Function","position":{"start":{"line":30,"column":4,"offset":1687},"end":{"line":30,"column":41,"offset":1724},"indent":[]}}],"position":{"start":{"line":30,"column":1,"offset":1684},"end":{"line":30,"column":41,"offset":1724},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"To block a command you have to return a truthy value.","position":{"start":{"line":32,"column":1,"offset":1726},"end":{"line":32,"column":54,"offset":1779},"indent":[]}}],"position":{"start":{"line":32,"column":1,"offset":1726},"end":{"line":32,"column":54,"offset":1779},"indent":[]}},{"type":"list","ordered":false,"start":null,"spread":false,"children":[{"type":"listItem","spread":false,"checked":null,"children":[{"type":"paragraph","children":[{"type":"strong","children":[{"type":"text","value":"return true;","position":{"start":{"line":33,"column":5,"offset":1784},"end":{"line":33,"column":17,"offset":1796},"indent":[]}}],"position":{"start":{"line":33,"column":3,"offset":1782},"end":{"line":33,"column":19,"offset":1798},"indent":[]}},{"type":"text","value":" If you return true the inhibitor will block the execution of the command.\nTo allow a command return a falsey value.","position":{"start":{"line":33,"column":19,"offset":1798},"end":{"line":34,"column":42,"offset":1914},"indent":[1]}}],"position":{"start":{"line":33,"column":3,"offset":1782},"end":{"line":34,"column":42,"offset":1914},"indent":[1]}}],"position":{"start":{"line":33,"column":1,"offset":1780},"end":{"line":34,"column":42,"offset":1914},"indent":[1]}},{"type":"listItem","spread":false,"checked":null,"children":[{"type":"paragraph","children":[{"type":"strong","children":[{"type":"text","value":"return false;","position":{"start":{"line":35,"column":5,"offset":1919},"end":{"line":35,"column":18,"offset":1932},"indent":[]}}],"position":{"start":{"line":35,"column":3,"offset":1917},"end":{"line":35,"column":20,"offset":1934},"indent":[]}},{"type":"text","value":" If you return false the inhibitor will not block the error.","position":{"start":{"line":35,"column":20,"offset":1934},"end":{"line":35,"column":80,"offset":1994},"indent":[]}}],"position":{"start":{"line":35,"column":3,"offset":1917},"end":{"line":35,"column":80,"offset":1994},"indent":[]}}],"position":{"start":{"line":35,"column":1,"offset":1915},"end":{"line":35,"column":80,"offset":1994},"indent":[]}}],"position":{"start":{"line":33,"column":1,"offset":1780},"end":{"line":35,"column":80,"offset":1994},"indent":[1,1]}},{"type":"code","lang":"ts","meta":null,"value":"// If the command is not VIP only we can allow this command to execute\nif (!command.vipOnly) return false;\n\n// The bot's support server\nconst guild =\n// Check if the user has the vip role on the support server given by patreon\nconst userIsVIP = await isUserVIP(message.author.id)\n// The user is VIP so we can allow this command to be used\nif (userIsVIP) return false;\n\n// The user is NOT VIP so we throw an error\nthrow `The ${command.name} is only allowed for VIP users.`","position":{"start":{"line":38,"column":1,"offset":1997},"end":{"line":51,"column":4,"offset":2478},"indent":[1,1,1,1,1,1,1,1,1,1,1,1,1]}},{"type":"export","value":"export const _frontmatter = {\"title\":\"Creating Inhibitors!\",\"metaTitle\":\"Creating An Inhibitor | Discordeno\",\"metaDescription\":\"Let's create our very own bot with Discordeno!\"}","position":{"start":{"line":54,"column":1,"offset":2481},"end":{"line":54,"column":177,"offset":2657},"indent":[]}}],"position":{"start":{"line":1,"column":1,"offset":0},"end":{"line":54,"column":177,"offset":2657}}},"scopeImports":["import * as React from 'react'"],"scopeIdentifiers":["React"],"body":"function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }\n\nfunction _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }\n\nfunction _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }\n\n/* @jsx mdx */\nvar _frontmatter = {\n \"title\": \"Creating Inhibitors!\",\n \"metaTitle\": \"Creating An Inhibitor | Discordeno\",\n \"metaDescription\": \"Let's create our very own bot with Discordeno!\"\n};\nvar layoutProps = {\n _frontmatter: _frontmatter\n};\nvar MDXLayout = \"wrapper\";\nreturn function MDXContent(_ref) {\n var components = _ref.components,\n props = _objectWithoutProperties(_ref, [\"components\"]);\n\n return mdx(MDXLayout, _extends({}, layoutProps, props, {\n components: components,\n mdxType: \"MDXLayout\"\n }), mdx(\"p\", null, \"Woah! You are almost half way done with understanding all of Discordeno. Amazing isn't it? Something you may have noticed in the last section was there were some options that prevented some commands from running like \", mdx(\"inlineCode\", {\n parentName: \"p\"\n }, \"dmOnly\"), \" or the permission options. we created a setting to prevent the monitor from running in certain channels. What if we wanted to do prevent commands from happening? How would we prevent commands from running?\"), mdx(\"h2\", null, \"What is an Inhibitor?\"), mdx(\"p\", null, \"An Inhibitor is very similar to how monitors work. A monitor runs on every message but an inhibitor runs on every command. Remember all those command options like cooldown, permissions, permissionLevel, nsfw, etc... Each and every one of these options has an inhibitor in that checks commands for these settings.\"), mdx(\"p\", null, \"Let's create our own inhibitor that would prevent commands from being used if the user is not a VIP user.\"), mdx(\"blockquote\", null, mdx(\"p\", {\n parentName: \"blockquote\"\n }, mdx(\"strong\", {\n parentName: \"p\"\n }, \"Note:\"), \" It is important to remember that everything below can be done with a simple permission level as well. We will create our own custom permission levels but for the purposes of this guide and to be able to learn about Inhibitors, we will be using an inhibitor.\")), mdx(\"h2\", null, \"Creating the File\"), mdx(\"p\", null, \"Let's start by creating a file inside the inhibitors folder called \", mdx(\"inlineCode\", {\n parentName: \"p\"\n }, \"boosted.ts\"), \" and paste the following snippet of code:\"), mdx(\"pre\", null, mdx(\"code\", _extends({\n parentName: \"pre\"\n }, {\n \"className\": \"language-ts\"\n }), \"import { botCache } from \\\"../../mod.ts\\\";\\n\\nbotCache.inhibitors.set(\\\"inhibitorname\\\", async function (message, command, guild) {\\n // Your code goes here\\n});\\n\")), mdx(\"p\", null, \"Inhibitors can take up to 3 arguments.\"), mdx(\"ul\", null, mdx(\"li\", {\n parentName: \"ul\"\n }, mdx(\"inlineCode\", {\n parentName: \"li\"\n }, \"message\"), \": The message object that triggered the command.\"), mdx(\"li\", {\n parentName: \"ul\"\n }, mdx(\"inlineCode\", {\n parentName: \"li\"\n }, \"command\"), \": The command object itself that was triggered.\"), mdx(\"li\", {\n parentName: \"ul\"\n }, mdx(\"inlineCode\", {\n parentName: \"li\"\n }, \"guild\"), \": The server guild object where this command was ran.\")), mdx(\"h2\", null, \"Understanding How Inhibitors Function\"), mdx(\"p\", null, \"To block a command you have to return a truthy value.\"), mdx(\"ul\", null, mdx(\"li\", {\n parentName: \"ul\"\n }, mdx(\"strong\", {\n parentName: \"li\"\n }, \"return true;\"), \" If you return true the inhibitor will block the execution of the command.\\nTo allow a command return a falsey value.\"), mdx(\"li\", {\n parentName: \"ul\"\n }, mdx(\"strong\", {\n parentName: \"li\"\n }, \"return false;\"), \" If you return false the inhibitor will not block the error.\")), mdx(\"pre\", null, mdx(\"code\", _extends({\n parentName: \"pre\"\n }, {\n \"className\": \"language-ts\"\n }), \"// If the command is not VIP only we can allow this command to execute\\nif (!command.vipOnly) return false;\\n\\n// The bot's support server\\nconst guild =\\n// Check if the user has the vip role on the support server given by patreon\\nconst userIsVIP = await isUserVIP(message.author.id)\\n// The user is VIP so we can allow this command to be used\\nif (userIsVIP) return false;\\n\\n// The user is NOT VIP so we throw an error\\nthrow `The ${command.name} is only allowed for VIP users.`\\n\")));\n}\n;\nMDXContent.isMDXComponent = true;","rawMDXOutput":"/* @jsx mdx */\nimport { mdx } from '@mdx-js/react';\n/* @jsx mdx */\n\nexport const _frontmatter = {\n \"title\": \"Creating Inhibitors!\",\n \"metaTitle\": \"Creating An Inhibitor | Discordeno\",\n \"metaDescription\": \"Let's create our very own bot with Discordeno!\"\n};\n\nconst layoutProps = {\n _frontmatter\n};\nconst MDXLayout = \"wrapper\"\nexport default function MDXContent({\n components,\n ...props\n}) {\n return \n

{`Woah! You are almost half way done with understanding all of Discordeno. Amazing isn't it? Something you may have noticed in the last section was there were some options that prevented some commands from running like `}{`dmOnly`}{` or the permission options. we created a setting to prevent the monitor from running in certain channels. What if we wanted to do prevent commands from happening? How would we prevent commands from running?`}

\n

{`What is an Inhibitor?`}

\n

{`An Inhibitor is very similar to how monitors work. A monitor runs on every message but an inhibitor runs on every command. Remember all those command options like cooldown, permissions, permissionLevel, nsfw, etc... Each and every one of these options has an inhibitor in that checks commands for these settings.`}

\n

{`Let's create our own inhibitor that would prevent commands from being used if the user is not a VIP user.`}

\n
\n

{`Note:`}{` It is important to remember that everything below can be done with a simple permission level as well. We will create our own custom permission levels but for the purposes of this guide and to be able to learn about Inhibitors, we will be using an inhibitor.`}

\n
\n

{`Creating the File`}

\n

{`Let's start by creating a file inside the inhibitors folder called `}{`boosted.ts`}{` and paste the following snippet of code:`}

\n
{`import { botCache } from \"../../mod.ts\";\n\nbotCache.inhibitors.set(\"inhibitorname\", async function (message, command, guild) {\n    // Your code goes here\n});\n`}
\n

{`Inhibitors can take up to 3 arguments.`}

\n
    \n
  • {`message`}{`: The message object that triggered the command.`}
  • \n
  • {`command`}{`: The command object itself that was triggered.`}
  • \n
  • {`guild`}{`: The server guild object where this command was ran.`}
  • \n
\n

{`Understanding How Inhibitors Function`}

\n

{`To block a command you have to return a truthy value.`}

\n
    \n
  • {`return true;`}{` If you return true the inhibitor will block the execution of the command.\nTo allow a command return a falsey value.`}
  • \n
  • {`return false;`}{` If you return false the inhibitor will not block the error.`}
  • \n
\n
{`// If the command is not VIP only we can allow this command to execute\nif (!command.vipOnly) return false;\n\n// The bot's support server\nconst guild =\n// Check if the user has the vip role on the support server given by patreon\nconst userIsVIP = await isUserVIP(message.author.id)\n// The user is VIP so we can allow this command to be used\nif (userIsVIP) return false;\n\n// The user is NOT VIP so we throw an error\nthrow \\`The \\${command.name} is only allowed for VIP users.\\`\n`}
\n\n
;\n}\n\n;\nMDXContent.isMDXComponent = true;"}} \ No newline at end of file diff --git a/docs/.cache/caches/gatsby-plugin-mdx/diskstore-2bbdee6f6981626b803c1a89697d92a7.json b/docs/.cache/caches/gatsby-plugin-mdx/diskstore-2bbdee6f6981626b803c1a89697d92a7.json new file mode 100644 index 000000000..0172bb616 --- /dev/null +++ b/docs/.cache/caches/gatsby-plugin-mdx/diskstore-2bbdee6f6981626b803c1a89697d92a7.json @@ -0,0 +1 @@ +{"expireTime":9007200851632821000,"key":"gatsby-plugin-mdx-entire-payload-cd7ef05d0612693f5539401523a4132c-","val":{"mdast":{"type":"root","children":[{"type":"paragraph","children":[{"type":"text","value":"Woah! You are almost half way done with understanding all of Discordeno. Amazing isn't it? Something you may have noticed in the last section was there were some options that prevented some commands from running like ","position":{"start":{"line":2,"column":1,"offset":1},"end":{"line":2,"column":218,"offset":218},"indent":[]}},{"type":"inlineCode","value":"dmOnly","position":{"start":{"line":2,"column":218,"offset":218},"end":{"line":2,"column":226,"offset":226},"indent":[]}},{"type":"text","value":" or the permission options. we created a setting to prevent the monitor from running in certain channels. What if we wanted to do prevent commands from happening? How would we prevent commands from running?","position":{"start":{"line":2,"column":226,"offset":226},"end":{"line":2,"column":432,"offset":432},"indent":[]}}],"position":{"start":{"line":2,"column":1,"offset":1},"end":{"line":2,"column":432,"offset":432},"indent":[]}},{"type":"heading","depth":2,"children":[{"type":"text","value":"What is an Inhibitor?","position":{"start":{"line":4,"column":4,"offset":437},"end":{"line":4,"column":25,"offset":458},"indent":[]}}],"position":{"start":{"line":4,"column":1,"offset":434},"end":{"line":4,"column":25,"offset":458},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"An Inhibitor is very similar to how monitors work. A monitor runs on every message but an inhibitor runs on every command. Remember all those command options like cooldown, permissions, permissionLevel, nsfw, etc... Each and every one of these options has an inhibitor in that checks commands for these settings.","position":{"start":{"line":6,"column":1,"offset":460},"end":{"line":6,"column":313,"offset":772},"indent":[]}}],"position":{"start":{"line":6,"column":1,"offset":460},"end":{"line":6,"column":313,"offset":772},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"Let's create our own inhibitor that would prevent commands from being used if the user is not a VIP user.","position":{"start":{"line":8,"column":1,"offset":774},"end":{"line":8,"column":106,"offset":879},"indent":[]}}],"position":{"start":{"line":8,"column":1,"offset":774},"end":{"line":8,"column":106,"offset":879},"indent":[]}},{"type":"blockquote","children":[{"type":"paragraph","children":[{"type":"strong","children":[{"type":"text","value":"Note:","position":{"start":{"line":10,"column":5,"offset":885},"end":{"line":10,"column":10,"offset":890},"indent":[]}}],"position":{"start":{"line":10,"column":3,"offset":883},"end":{"line":10,"column":12,"offset":892},"indent":[]}},{"type":"text","value":" It is important to remember that everything below can be done with a simple permission level as well. We will create our own custom permission levels but for the purposes of this guide and to be able to learn about Inhibitors, we will be using an inhibitor.","position":{"start":{"line":10,"column":12,"offset":892},"end":{"line":10,"column":270,"offset":1150},"indent":[]}}],"position":{"start":{"line":10,"column":3,"offset":883},"end":{"line":10,"column":270,"offset":1150},"indent":[]}}],"position":{"start":{"line":10,"column":1,"offset":881},"end":{"line":10,"column":270,"offset":1150},"indent":[]}},{"type":"heading","depth":2,"children":[{"type":"text","value":"Creating the File","position":{"start":{"line":12,"column":4,"offset":1155},"end":{"line":12,"column":21,"offset":1172},"indent":[]}}],"position":{"start":{"line":12,"column":1,"offset":1152},"end":{"line":12,"column":21,"offset":1172},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"Let's start by creating a file inside the inhibitors folder called ","position":{"start":{"line":14,"column":1,"offset":1174},"end":{"line":14,"column":68,"offset":1241},"indent":[]}},{"type":"inlineCode","value":"vipOnly.ts","position":{"start":{"line":14,"column":68,"offset":1241},"end":{"line":14,"column":80,"offset":1253},"indent":[]}},{"type":"text","value":" and paste the following snippet of code:","position":{"start":{"line":14,"column":80,"offset":1253},"end":{"line":14,"column":121,"offset":1294},"indent":[]}}],"position":{"start":{"line":14,"column":1,"offset":1174},"end":{"line":14,"column":121,"offset":1294},"indent":[]}},{"type":"code","lang":"ts","meta":null,"value":"import { botCache } from \"../../mod.ts\";\n\nbotCache.inhibitors.set(\"inhibitorname\", async function (message, command, guild) {\n\t// Your code goes here\n});","position":{"start":{"line":16,"column":1,"offset":1296},"end":{"line":22,"column":4,"offset":1459},"indent":[1,1,1,1,1,1]}},{"type":"paragraph","children":[{"type":"text","value":"Inhibitors can take up to 3 arguments.","position":{"start":{"line":24,"column":1,"offset":1461},"end":{"line":24,"column":39,"offset":1499},"indent":[]}}],"position":{"start":{"line":24,"column":1,"offset":1461},"end":{"line":24,"column":39,"offset":1499},"indent":[]}},{"type":"list","ordered":false,"start":null,"spread":false,"children":[{"type":"listItem","spread":false,"checked":null,"children":[{"type":"paragraph","children":[{"type":"inlineCode","value":"message","position":{"start":{"line":26,"column":3,"offset":1503},"end":{"line":26,"column":12,"offset":1512},"indent":[]}},{"type":"text","value":": The message object that triggered the command.","position":{"start":{"line":26,"column":12,"offset":1512},"end":{"line":26,"column":60,"offset":1560},"indent":[]}}],"position":{"start":{"line":26,"column":3,"offset":1503},"end":{"line":26,"column":60,"offset":1560},"indent":[]}}],"position":{"start":{"line":26,"column":1,"offset":1501},"end":{"line":26,"column":60,"offset":1560},"indent":[]}},{"type":"listItem","spread":false,"checked":null,"children":[{"type":"paragraph","children":[{"type":"inlineCode","value":"command","position":{"start":{"line":27,"column":3,"offset":1563},"end":{"line":27,"column":12,"offset":1572},"indent":[]}},{"type":"text","value":": The command object itself that was triggered.","position":{"start":{"line":27,"column":12,"offset":1572},"end":{"line":27,"column":59,"offset":1619},"indent":[]}}],"position":{"start":{"line":27,"column":3,"offset":1563},"end":{"line":27,"column":59,"offset":1619},"indent":[]}}],"position":{"start":{"line":27,"column":1,"offset":1561},"end":{"line":27,"column":59,"offset":1619},"indent":[]}},{"type":"listItem","spread":false,"checked":null,"children":[{"type":"paragraph","children":[{"type":"inlineCode","value":"guild","position":{"start":{"line":28,"column":3,"offset":1622},"end":{"line":28,"column":10,"offset":1629},"indent":[]}},{"type":"text","value":": The server guild object where this command was ran.","position":{"start":{"line":28,"column":10,"offset":1629},"end":{"line":28,"column":63,"offset":1682},"indent":[]}}],"position":{"start":{"line":28,"column":3,"offset":1622},"end":{"line":28,"column":63,"offset":1682},"indent":[]}}],"position":{"start":{"line":28,"column":1,"offset":1620},"end":{"line":28,"column":63,"offset":1682},"indent":[]}}],"position":{"start":{"line":26,"column":1,"offset":1501},"end":{"line":28,"column":63,"offset":1682},"indent":[1,1]}},{"type":"heading","depth":2,"children":[{"type":"text","value":"Understanding How Inhibitors Function","position":{"start":{"line":30,"column":4,"offset":1687},"end":{"line":30,"column":41,"offset":1724},"indent":[]}}],"position":{"start":{"line":30,"column":1,"offset":1684},"end":{"line":30,"column":41,"offset":1724},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"To block a command you have to return a truthy value.","position":{"start":{"line":32,"column":1,"offset":1726},"end":{"line":32,"column":54,"offset":1779},"indent":[]}}],"position":{"start":{"line":32,"column":1,"offset":1726},"end":{"line":32,"column":54,"offset":1779},"indent":[]}},{"type":"code","lang":null,"meta":null,"value":"- **return true;** If you return true the inhibitor will block the execution of the command.","position":{"start":{"line":33,"column":1,"offset":1780},"end":{"line":33,"column":94,"offset":1873},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"To allow a command return a falsey value.","position":{"start":{"line":34,"column":1,"offset":1874},"end":{"line":34,"column":42,"offset":1915},"indent":[]}}],"position":{"start":{"line":34,"column":1,"offset":1874},"end":{"line":34,"column":42,"offset":1915},"indent":[]}},{"type":"code","lang":null,"meta":null,"value":"- **return false;** If you return false the inhibitor will not block the error.","position":{"start":{"line":35,"column":1,"offset":1916},"end":{"line":35,"column":81,"offset":1996},"indent":[]}},{"type":"code","lang":"ts","meta":null,"value":"// If the command is not VIP only we can allow this command\nif (!command.vipOnly) return false\n// Check if the user is VIP\nconst userIsVIP = message.author.settings.get(`isVIP`)\n// The user is VIP so we can allow this command to be used\nif (userIsVIP) return false\n// The user is NOT VIP so we throw an error\nthrow `The ${command.name} is only allowed for VIP users.`","position":{"start":{"line":38,"column":1,"offset":1999},"end":{"line":47,"column":4,"offset":2376},"indent":[1,1,1,1,1,1,1,1,1]}},{"type":"export","value":"export const _frontmatter = {\"title\":\"Creating Inhibitors!\",\"metaTitle\":\"Creating An Inhibitor | Discordeno\",\"metaDescription\":\"Let's create our very own bot with Discordeno!\"}","position":{"start":{"line":50,"column":1,"offset":2379},"end":{"line":50,"column":177,"offset":2555},"indent":[]}}],"position":{"start":{"line":1,"column":1,"offset":0},"end":{"line":50,"column":177,"offset":2555}}},"scopeImports":["import * as React from 'react'"],"scopeIdentifiers":["React"],"body":"function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }\n\nfunction _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }\n\nfunction _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }\n\n/* @jsx mdx */\nvar _frontmatter = {\n \"title\": \"Creating Inhibitors!\",\n \"metaTitle\": \"Creating An Inhibitor | Discordeno\",\n \"metaDescription\": \"Let's create our very own bot with Discordeno!\"\n};\nvar layoutProps = {\n _frontmatter: _frontmatter\n};\nvar MDXLayout = \"wrapper\";\nreturn function MDXContent(_ref) {\n var components = _ref.components,\n props = _objectWithoutProperties(_ref, [\"components\"]);\n\n return mdx(MDXLayout, _extends({}, layoutProps, props, {\n components: components,\n mdxType: \"MDXLayout\"\n }), mdx(\"p\", null, \"Woah! You are almost half way done with understanding all of Discordeno. Amazing isn't it? Something you may have noticed in the last section was there were some options that prevented some commands from running like \", mdx(\"inlineCode\", {\n parentName: \"p\"\n }, \"dmOnly\"), \" or the permission options. we created a setting to prevent the monitor from running in certain channels. What if we wanted to do prevent commands from happening? How would we prevent commands from running?\"), mdx(\"h2\", null, \"What is an Inhibitor?\"), mdx(\"p\", null, \"An Inhibitor is very similar to how monitors work. A monitor runs on every message but an inhibitor runs on every command. Remember all those command options like cooldown, permissions, permissionLevel, nsfw, etc... Each and every one of these options has an inhibitor in that checks commands for these settings.\"), mdx(\"p\", null, \"Let's create our own inhibitor that would prevent commands from being used if the user is not a VIP user.\"), mdx(\"blockquote\", null, mdx(\"p\", {\n parentName: \"blockquote\"\n }, mdx(\"strong\", {\n parentName: \"p\"\n }, \"Note:\"), \" It is important to remember that everything below can be done with a simple permission level as well. We will create our own custom permission levels but for the purposes of this guide and to be able to learn about Inhibitors, we will be using an inhibitor.\")), mdx(\"h2\", null, \"Creating the File\"), mdx(\"p\", null, \"Let's start by creating a file inside the inhibitors folder called \", mdx(\"inlineCode\", {\n parentName: \"p\"\n }, \"vipOnly.ts\"), \" and paste the following snippet of code:\"), mdx(\"pre\", null, mdx(\"code\", _extends({\n parentName: \"pre\"\n }, {\n \"className\": \"language-ts\"\n }), \"import { botCache } from \\\"../../mod.ts\\\";\\n\\nbotCache.inhibitors.set(\\\"inhibitorname\\\", async function (message, command, guild) {\\n // Your code goes here\\n});\\n\")), mdx(\"p\", null, \"Inhibitors can take up to 3 arguments.\"), mdx(\"ul\", null, mdx(\"li\", {\n parentName: \"ul\"\n }, mdx(\"inlineCode\", {\n parentName: \"li\"\n }, \"message\"), \": The message object that triggered the command.\"), mdx(\"li\", {\n parentName: \"ul\"\n }, mdx(\"inlineCode\", {\n parentName: \"li\"\n }, \"command\"), \": The command object itself that was triggered.\"), mdx(\"li\", {\n parentName: \"ul\"\n }, mdx(\"inlineCode\", {\n parentName: \"li\"\n }, \"guild\"), \": The server guild object where this command was ran.\")), mdx(\"h2\", null, \"Understanding How Inhibitors Function\"), mdx(\"p\", null, \"To block a command you have to return a truthy value.\"), mdx(\"pre\", null, mdx(\"code\", _extends({\n parentName: \"pre\"\n }, {}), \"- **return true;** If you return true the inhibitor will block the execution of the command.\\n\")), mdx(\"p\", null, \"To allow a command return a falsey value.\"), mdx(\"pre\", null, mdx(\"code\", _extends({\n parentName: \"pre\"\n }, {}), \"- **return false;** If you return false the inhibitor will not block the error.\\n\")), mdx(\"pre\", null, mdx(\"code\", _extends({\n parentName: \"pre\"\n }, {\n \"className\": \"language-ts\"\n }), \"// If the command is not VIP only we can allow this command\\nif (!command.vipOnly) return false\\n// Check if the user is VIP\\nconst userIsVIP = message.author.settings.get(`isVIP`)\\n// The user is VIP so we can allow this command to be used\\nif (userIsVIP) return false\\n// The user is NOT VIP so we throw an error\\nthrow `The ${command.name} is only allowed for VIP users.`\\n\")));\n}\n;\nMDXContent.isMDXComponent = true;","rawMDXOutput":"/* @jsx mdx */\nimport { mdx } from '@mdx-js/react';\n/* @jsx mdx */\n\nexport const _frontmatter = {\n \"title\": \"Creating Inhibitors!\",\n \"metaTitle\": \"Creating An Inhibitor | Discordeno\",\n \"metaDescription\": \"Let's create our very own bot with Discordeno!\"\n};\n\nconst layoutProps = {\n _frontmatter\n};\nconst MDXLayout = \"wrapper\"\nexport default function MDXContent({\n components,\n ...props\n}) {\n return \n

{`Woah! You are almost half way done with understanding all of Discordeno. Amazing isn't it? Something you may have noticed in the last section was there were some options that prevented some commands from running like `}{`dmOnly`}{` or the permission options. we created a setting to prevent the monitor from running in certain channels. What if we wanted to do prevent commands from happening? How would we prevent commands from running?`}

\n

{`What is an Inhibitor?`}

\n

{`An Inhibitor is very similar to how monitors work. A monitor runs on every message but an inhibitor runs on every command. Remember all those command options like cooldown, permissions, permissionLevel, nsfw, etc... Each and every one of these options has an inhibitor in that checks commands for these settings.`}

\n

{`Let's create our own inhibitor that would prevent commands from being used if the user is not a VIP user.`}

\n
\n

{`Note:`}{` It is important to remember that everything below can be done with a simple permission level as well. We will create our own custom permission levels but for the purposes of this guide and to be able to learn about Inhibitors, we will be using an inhibitor.`}

\n
\n

{`Creating the File`}

\n

{`Let's start by creating a file inside the inhibitors folder called `}{`vipOnly.ts`}{` and paste the following snippet of code:`}

\n
{`import { botCache } from \"../../mod.ts\";\n\nbotCache.inhibitors.set(\"inhibitorname\", async function (message, command, guild) {\n    // Your code goes here\n});\n`}
\n

{`Inhibitors can take up to 3 arguments.`}

\n
    \n
  • {`message`}{`: The message object that triggered the command.`}
  • \n
  • {`command`}{`: The command object itself that was triggered.`}
  • \n
  • {`guild`}{`: The server guild object where this command was ran.`}
  • \n
\n

{`Understanding How Inhibitors Function`}

\n

{`To block a command you have to return a truthy value.`}

\n
{`- **return true;** If you return true the inhibitor will block the execution of the command.\n`}
\n

{`To allow a command return a falsey value.`}

\n
{`- **return false;** If you return false the inhibitor will not block the error.\n`}
\n
{`// If the command is not VIP only we can allow this command\nif (!command.vipOnly) return false\n// Check if the user is VIP\nconst userIsVIP = message.author.settings.get(\\`isVIP\\`)\n// The user is VIP so we can allow this command to be used\nif (userIsVIP) return false\n// The user is NOT VIP so we throw an error\nthrow \\`The \\${command.name} is only allowed for VIP users.\\`\n`}
\n\n
;\n}\n\n;\nMDXContent.isMDXComponent = true;"}} \ No newline at end of file diff --git a/docs/.cache/caches/gatsby-plugin-mdx/diskstore-2d0cc7b68095d91c7a5e7020fec9ede1.json b/docs/.cache/caches/gatsby-plugin-mdx/diskstore-2d0cc7b68095d91c7a5e7020fec9ede1.json new file mode 100644 index 000000000..6a4c4ed98 --- /dev/null +++ b/docs/.cache/caches/gatsby-plugin-mdx/diskstore-2d0cc7b68095d91c7a5e7020fec9ede1.json @@ -0,0 +1 @@ +{"expireTime":9007200851634812000,"key":"gatsby-plugin-mdx-entire-payload-c7912cf6ab0e9ae040d1a0ddbaa54def-","val":{"mdast":{"type":"root","children":[{"type":"paragraph","children":[{"type":"text","value":"Woah! You are almost half way done with understanding all of Discordeno. Amazing isn't it? Something you may have noticed in the last section was there were some options that prevented some commands from running like ","position":{"start":{"line":2,"column":1,"offset":1},"end":{"line":2,"column":218,"offset":218},"indent":[]}},{"type":"inlineCode","value":"dmOnly","position":{"start":{"line":2,"column":218,"offset":218},"end":{"line":2,"column":226,"offset":226},"indent":[]}},{"type":"text","value":" or the permission options. we created a setting to prevent the monitor from running in certain channels. What if we wanted to do prevent commands from happening? How would we prevent commands from running?","position":{"start":{"line":2,"column":226,"offset":226},"end":{"line":2,"column":432,"offset":432},"indent":[]}}],"position":{"start":{"line":2,"column":1,"offset":1},"end":{"line":2,"column":432,"offset":432},"indent":[]}},{"type":"heading","depth":2,"children":[{"type":"text","value":"What is an Inhibitor?","position":{"start":{"line":4,"column":4,"offset":437},"end":{"line":4,"column":25,"offset":458},"indent":[]}}],"position":{"start":{"line":4,"column":1,"offset":434},"end":{"line":4,"column":25,"offset":458},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"An Inhibitor is very similar to how monitors work. A monitor runs on every message but an inhibitor runs on every command. Remember all those command options like cooldown, permissions, permissionLevel, nsfw, etc... Each and every one of these options has an inhibitor in that checks commands for these settings.","position":{"start":{"line":6,"column":1,"offset":460},"end":{"line":6,"column":313,"offset":772},"indent":[]}}],"position":{"start":{"line":6,"column":1,"offset":460},"end":{"line":6,"column":313,"offset":772},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"Let's create our own inhibitor that would prevent commands from being used if the user is not a VIP user.","position":{"start":{"line":8,"column":1,"offset":774},"end":{"line":8,"column":106,"offset":879},"indent":[]}}],"position":{"start":{"line":8,"column":1,"offset":774},"end":{"line":8,"column":106,"offset":879},"indent":[]}},{"type":"blockquote","children":[{"type":"paragraph","children":[{"type":"strong","children":[{"type":"text","value":"Note:","position":{"start":{"line":10,"column":5,"offset":885},"end":{"line":10,"column":10,"offset":890},"indent":[]}}],"position":{"start":{"line":10,"column":3,"offset":883},"end":{"line":10,"column":12,"offset":892},"indent":[]}},{"type":"text","value":" It is important to remember that everything below can be done with a simple permission level as well. We will create our own custom permission levels but for the purposes of this guide and to be able to learn about Inhibitors, we will be using an inhibitor.","position":{"start":{"line":10,"column":12,"offset":892},"end":{"line":10,"column":270,"offset":1150},"indent":[]}}],"position":{"start":{"line":10,"column":3,"offset":883},"end":{"line":10,"column":270,"offset":1150},"indent":[]}}],"position":{"start":{"line":10,"column":1,"offset":881},"end":{"line":10,"column":270,"offset":1150},"indent":[]}},{"type":"heading","depth":2,"children":[{"type":"text","value":"Creating the File","position":{"start":{"line":12,"column":4,"offset":1155},"end":{"line":12,"column":21,"offset":1172},"indent":[]}}],"position":{"start":{"line":12,"column":1,"offset":1152},"end":{"line":12,"column":21,"offset":1172},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"Let's start by creating a file inside the inhibitors folder called ","position":{"start":{"line":14,"column":1,"offset":1174},"end":{"line":14,"column":68,"offset":1241},"indent":[]}},{"type":"inlineCode","value":"boosted.ts","position":{"start":{"line":14,"column":68,"offset":1241},"end":{"line":14,"column":80,"offset":1253},"indent":[]}},{"type":"text","value":" and paste the following snippet of code:","position":{"start":{"line":14,"column":80,"offset":1253},"end":{"line":14,"column":121,"offset":1294},"indent":[]}}],"position":{"start":{"line":14,"column":1,"offset":1174},"end":{"line":14,"column":121,"offset":1294},"indent":[]}},{"type":"code","lang":"ts","meta":null,"value":"import { botCache } from \"../../mod.ts\";\n\nbotCache.inhibitors.set(\"inhibitorname\", async function (message, command, guild) {\n\t// Your code goes here\n});","position":{"start":{"line":16,"column":1,"offset":1296},"end":{"line":22,"column":4,"offset":1459},"indent":[1,1,1,1,1,1]}},{"type":"paragraph","children":[{"type":"text","value":"Inhibitors can take up to 3 arguments.","position":{"start":{"line":24,"column":1,"offset":1461},"end":{"line":24,"column":39,"offset":1499},"indent":[]}}],"position":{"start":{"line":24,"column":1,"offset":1461},"end":{"line":24,"column":39,"offset":1499},"indent":[]}},{"type":"list","ordered":false,"start":null,"spread":false,"children":[{"type":"listItem","spread":false,"checked":null,"children":[{"type":"paragraph","children":[{"type":"inlineCode","value":"message","position":{"start":{"line":26,"column":3,"offset":1503},"end":{"line":26,"column":12,"offset":1512},"indent":[]}},{"type":"text","value":": The message object that triggered the command.","position":{"start":{"line":26,"column":12,"offset":1512},"end":{"line":26,"column":60,"offset":1560},"indent":[]}}],"position":{"start":{"line":26,"column":3,"offset":1503},"end":{"line":26,"column":60,"offset":1560},"indent":[]}}],"position":{"start":{"line":26,"column":1,"offset":1501},"end":{"line":26,"column":60,"offset":1560},"indent":[]}},{"type":"listItem","spread":false,"checked":null,"children":[{"type":"paragraph","children":[{"type":"inlineCode","value":"command","position":{"start":{"line":27,"column":3,"offset":1563},"end":{"line":27,"column":12,"offset":1572},"indent":[]}},{"type":"text","value":": The command object itself that was triggered.","position":{"start":{"line":27,"column":12,"offset":1572},"end":{"line":27,"column":59,"offset":1619},"indent":[]}}],"position":{"start":{"line":27,"column":3,"offset":1563},"end":{"line":27,"column":59,"offset":1619},"indent":[]}}],"position":{"start":{"line":27,"column":1,"offset":1561},"end":{"line":27,"column":59,"offset":1619},"indent":[]}},{"type":"listItem","spread":false,"checked":null,"children":[{"type":"paragraph","children":[{"type":"inlineCode","value":"guild","position":{"start":{"line":28,"column":3,"offset":1622},"end":{"line":28,"column":10,"offset":1629},"indent":[]}},{"type":"text","value":": The server guild object where this command was ran.","position":{"start":{"line":28,"column":10,"offset":1629},"end":{"line":28,"column":63,"offset":1682},"indent":[]}}],"position":{"start":{"line":28,"column":3,"offset":1622},"end":{"line":28,"column":63,"offset":1682},"indent":[]}}],"position":{"start":{"line":28,"column":1,"offset":1620},"end":{"line":28,"column":63,"offset":1682},"indent":[]}}],"position":{"start":{"line":26,"column":1,"offset":1501},"end":{"line":28,"column":63,"offset":1682},"indent":[1,1]}},{"type":"heading","depth":2,"children":[{"type":"text","value":"Understanding How Inhibitors Function","position":{"start":{"line":30,"column":4,"offset":1687},"end":{"line":30,"column":41,"offset":1724},"indent":[]}}],"position":{"start":{"line":30,"column":1,"offset":1684},"end":{"line":30,"column":41,"offset":1724},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"To block a command you have to return a truthy value.","position":{"start":{"line":32,"column":1,"offset":1726},"end":{"line":32,"column":54,"offset":1779},"indent":[]}}],"position":{"start":{"line":32,"column":1,"offset":1726},"end":{"line":32,"column":54,"offset":1779},"indent":[]}},{"type":"list","ordered":false,"start":null,"spread":false,"children":[{"type":"listItem","spread":false,"checked":null,"children":[{"type":"paragraph","children":[{"type":"strong","children":[{"type":"text","value":"return true;","position":{"start":{"line":33,"column":5,"offset":1784},"end":{"line":33,"column":17,"offset":1796},"indent":[]}}],"position":{"start":{"line":33,"column":3,"offset":1782},"end":{"line":33,"column":19,"offset":1798},"indent":[]}},{"type":"text","value":" If you return true the inhibitor will block the execution of the command.\nTo allow a command return a falsey value.","position":{"start":{"line":33,"column":19,"offset":1798},"end":{"line":34,"column":42,"offset":1914},"indent":[1]}}],"position":{"start":{"line":33,"column":3,"offset":1782},"end":{"line":34,"column":42,"offset":1914},"indent":[1]}}],"position":{"start":{"line":33,"column":1,"offset":1780},"end":{"line":34,"column":42,"offset":1914},"indent":[1]}},{"type":"listItem","spread":false,"checked":null,"children":[{"type":"paragraph","children":[{"type":"strong","children":[{"type":"text","value":"return false;","position":{"start":{"line":35,"column":5,"offset":1919},"end":{"line":35,"column":18,"offset":1932},"indent":[]}}],"position":{"start":{"line":35,"column":3,"offset":1917},"end":{"line":35,"column":20,"offset":1934},"indent":[]}},{"type":"text","value":" If you return false the inhibitor will not block the error.","position":{"start":{"line":35,"column":20,"offset":1934},"end":{"line":35,"column":80,"offset":1994},"indent":[]}}],"position":{"start":{"line":35,"column":3,"offset":1917},"end":{"line":35,"column":80,"offset":1994},"indent":[]}}],"position":{"start":{"line":35,"column":1,"offset":1915},"end":{"line":35,"column":80,"offset":1994},"indent":[]}}],"position":{"start":{"line":33,"column":1,"offset":1780},"end":{"line":35,"column":80,"offset":1994},"indent":[1,1]}},{"type":"code","lang":"ts","meta":null,"value":"// If the command is not VIP only we can allow this command to execute\nif (!command.vipOnly) return false;\n\n// The bot's support server\nconst guild = cache.guilds.get(configs.supportServerID);\n// If the command author is not in the server they won't have the vip role\nconst member = guild.members.get(message.author.id) || await getMember(guild.id, message.author.id);\n// Member doesn't exist so cancel the command\nif (!member) {\n\tsendResponse(message, `sorry, but you can not use this command until you become VIP. **Close the IRIS!!!**`)\n\treturn true;\n}\n\n// If the user has the vip role on the support server given by patreon allow the command\nif (member.roles.includes(configs.roleIDs.patreonVIPRoleID)) return false;\n\n// Alert the user they don't have vip and can't use the command\nsendResponse(message, `sorry, but you can not use this command until you become a VIP. I'm sorry, Teal'c. We'll go to Disneyland next year. I promise.`)\n// Cancel the command since the user does not have vip\nreturn true;","position":{"start":{"line":38,"column":1,"offset":1997},"end":{"line":59,"column":4,"offset":3013},"indent":[1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1]}},{"type":"heading","depth":2,"children":[{"type":"text","value":"Challenges","position":{"start":{"line":61,"column":4,"offset":3018},"end":{"line":61,"column":14,"offset":3028},"indent":[]}}],"position":{"start":{"line":61,"column":1,"offset":3015},"end":{"line":61,"column":14,"offset":3028},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"Hell yes! We just got through the entire inhibitor section. You have now mastered everything related to inhibitors.","position":{"start":{"line":63,"column":1,"offset":3030},"end":{"line":63,"column":116,"offset":3145},"indent":[]}}],"position":{"start":{"line":63,"column":1,"offset":3030},"end":{"line":63,"column":116,"offset":3145},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"You can now try and get a little more practice with inhibitors by trying to challenge yourself and make your own inhibitors. Don't worry if you can't think of any good use cases for inhibitors.","position":{"start":{"line":65,"column":1,"offset":3147},"end":{"line":65,"column":194,"offset":3340},"indent":[]}}],"position":{"start":{"line":65,"column":1,"offset":3147},"end":{"line":65,"column":194,"offset":3340},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"Majority of Discordeno bots do not use many custom inhibitors because most of the necessary/important","position":{"start":{"line":67,"column":1,"offset":3342},"end":{"line":67,"column":102,"offset":3443},"indent":[]}}],"position":{"start":{"line":67,"column":1,"offset":3342},"end":{"line":67,"column":102,"offset":3443},"indent":[]}},{"type":"export","value":"export const _frontmatter = {\"title\":\"Creating Inhibitors!\",\"metaTitle\":\"Creating An Inhibitor | Discordeno\",\"metaDescription\":\"Let's create our very own bot with Discordeno!\"}","position":{"start":{"line":70,"column":1,"offset":3446},"end":{"line":70,"column":177,"offset":3622},"indent":[]}}],"position":{"start":{"line":1,"column":1,"offset":0},"end":{"line":70,"column":177,"offset":3622}}},"scopeImports":["import * as React from 'react'"],"scopeIdentifiers":["React"],"body":"function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }\n\nfunction _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }\n\nfunction _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }\n\n/* @jsx mdx */\nvar _frontmatter = {\n \"title\": \"Creating Inhibitors!\",\n \"metaTitle\": \"Creating An Inhibitor | Discordeno\",\n \"metaDescription\": \"Let's create our very own bot with Discordeno!\"\n};\nvar layoutProps = {\n _frontmatter: _frontmatter\n};\nvar MDXLayout = \"wrapper\";\nreturn function MDXContent(_ref) {\n var components = _ref.components,\n props = _objectWithoutProperties(_ref, [\"components\"]);\n\n return mdx(MDXLayout, _extends({}, layoutProps, props, {\n components: components,\n mdxType: \"MDXLayout\"\n }), mdx(\"p\", null, \"Woah! You are almost half way done with understanding all of Discordeno. Amazing isn't it? Something you may have noticed in the last section was there were some options that prevented some commands from running like \", mdx(\"inlineCode\", {\n parentName: \"p\"\n }, \"dmOnly\"), \" or the permission options. we created a setting to prevent the monitor from running in certain channels. What if we wanted to do prevent commands from happening? How would we prevent commands from running?\"), mdx(\"h2\", null, \"What is an Inhibitor?\"), mdx(\"p\", null, \"An Inhibitor is very similar to how monitors work. A monitor runs on every message but an inhibitor runs on every command. Remember all those command options like cooldown, permissions, permissionLevel, nsfw, etc... Each and every one of these options has an inhibitor in that checks commands for these settings.\"), mdx(\"p\", null, \"Let's create our own inhibitor that would prevent commands from being used if the user is not a VIP user.\"), mdx(\"blockquote\", null, mdx(\"p\", {\n parentName: \"blockquote\"\n }, mdx(\"strong\", {\n parentName: \"p\"\n }, \"Note:\"), \" It is important to remember that everything below can be done with a simple permission level as well. We will create our own custom permission levels but for the purposes of this guide and to be able to learn about Inhibitors, we will be using an inhibitor.\")), mdx(\"h2\", null, \"Creating the File\"), mdx(\"p\", null, \"Let's start by creating a file inside the inhibitors folder called \", mdx(\"inlineCode\", {\n parentName: \"p\"\n }, \"boosted.ts\"), \" and paste the following snippet of code:\"), mdx(\"pre\", null, mdx(\"code\", _extends({\n parentName: \"pre\"\n }, {\n \"className\": \"language-ts\"\n }), \"import { botCache } from \\\"../../mod.ts\\\";\\n\\nbotCache.inhibitors.set(\\\"inhibitorname\\\", async function (message, command, guild) {\\n // Your code goes here\\n});\\n\")), mdx(\"p\", null, \"Inhibitors can take up to 3 arguments.\"), mdx(\"ul\", null, mdx(\"li\", {\n parentName: \"ul\"\n }, mdx(\"inlineCode\", {\n parentName: \"li\"\n }, \"message\"), \": The message object that triggered the command.\"), mdx(\"li\", {\n parentName: \"ul\"\n }, mdx(\"inlineCode\", {\n parentName: \"li\"\n }, \"command\"), \": The command object itself that was triggered.\"), mdx(\"li\", {\n parentName: \"ul\"\n }, mdx(\"inlineCode\", {\n parentName: \"li\"\n }, \"guild\"), \": The server guild object where this command was ran.\")), mdx(\"h2\", null, \"Understanding How Inhibitors Function\"), mdx(\"p\", null, \"To block a command you have to return a truthy value.\"), mdx(\"ul\", null, mdx(\"li\", {\n parentName: \"ul\"\n }, mdx(\"strong\", {\n parentName: \"li\"\n }, \"return true;\"), \" If you return true the inhibitor will block the execution of the command.\\nTo allow a command return a falsey value.\"), mdx(\"li\", {\n parentName: \"ul\"\n }, mdx(\"strong\", {\n parentName: \"li\"\n }, \"return false;\"), \" If you return false the inhibitor will not block the error.\")), mdx(\"pre\", null, mdx(\"code\", _extends({\n parentName: \"pre\"\n }, {\n \"className\": \"language-ts\"\n }), \"// If the command is not VIP only we can allow this command to execute\\nif (!command.vipOnly) return false;\\n\\n// The bot's support server\\nconst guild = cache.guilds.get(configs.supportServerID);\\n// If the command author is not in the server they won't have the vip role\\nconst member = guild.members.get(message.author.id) || await getMember(guild.id, message.author.id);\\n// Member doesn't exist so cancel the command\\nif (!member) {\\n sendResponse(message, `sorry, but you can not use this command until you become VIP. **Close the IRIS!!!**`)\\n return true;\\n}\\n\\n// If the user has the vip role on the support server given by patreon allow the command\\nif (member.roles.includes(configs.roleIDs.patreonVIPRoleID)) return false;\\n\\n// Alert the user they don't have vip and can't use the command\\nsendResponse(message, `sorry, but you can not use this command until you become a VIP. I'm sorry, Teal'c. We'll go to Disneyland next year. I promise.`)\\n// Cancel the command since the user does not have vip\\nreturn true;\\n\")), mdx(\"h2\", null, \"Challenges\"), mdx(\"p\", null, \"Hell yes! We just got through the entire inhibitor section. You have now mastered everything related to inhibitors.\"), mdx(\"p\", null, \"You can now try and get a little more practice with inhibitors by trying to challenge yourself and make your own inhibitors. Don't worry if you can't think of any good use cases for inhibitors.\"), mdx(\"p\", null, \"Majority of Discordeno bots do not use many custom inhibitors because most of the necessary/important\"));\n}\n;\nMDXContent.isMDXComponent = true;","rawMDXOutput":"/* @jsx mdx */\nimport { mdx } from '@mdx-js/react';\n/* @jsx mdx */\n\nexport const _frontmatter = {\n \"title\": \"Creating Inhibitors!\",\n \"metaTitle\": \"Creating An Inhibitor | Discordeno\",\n \"metaDescription\": \"Let's create our very own bot with Discordeno!\"\n};\n\nconst layoutProps = {\n _frontmatter\n};\nconst MDXLayout = \"wrapper\"\nexport default function MDXContent({\n components,\n ...props\n}) {\n return \n

{`Woah! You are almost half way done with understanding all of Discordeno. Amazing isn't it? Something you may have noticed in the last section was there were some options that prevented some commands from running like `}{`dmOnly`}{` or the permission options. we created a setting to prevent the monitor from running in certain channels. What if we wanted to do prevent commands from happening? How would we prevent commands from running?`}

\n

{`What is an Inhibitor?`}

\n

{`An Inhibitor is very similar to how monitors work. A monitor runs on every message but an inhibitor runs on every command. Remember all those command options like cooldown, permissions, permissionLevel, nsfw, etc... Each and every one of these options has an inhibitor in that checks commands for these settings.`}

\n

{`Let's create our own inhibitor that would prevent commands from being used if the user is not a VIP user.`}

\n
\n

{`Note:`}{` It is important to remember that everything below can be done with a simple permission level as well. We will create our own custom permission levels but for the purposes of this guide and to be able to learn about Inhibitors, we will be using an inhibitor.`}

\n
\n

{`Creating the File`}

\n

{`Let's start by creating a file inside the inhibitors folder called `}{`boosted.ts`}{` and paste the following snippet of code:`}

\n
{`import { botCache } from \"../../mod.ts\";\n\nbotCache.inhibitors.set(\"inhibitorname\", async function (message, command, guild) {\n    // Your code goes here\n});\n`}
\n

{`Inhibitors can take up to 3 arguments.`}

\n
    \n
  • {`message`}{`: The message object that triggered the command.`}
  • \n
  • {`command`}{`: The command object itself that was triggered.`}
  • \n
  • {`guild`}{`: The server guild object where this command was ran.`}
  • \n
\n

{`Understanding How Inhibitors Function`}

\n

{`To block a command you have to return a truthy value.`}

\n
    \n
  • {`return true;`}{` If you return true the inhibitor will block the execution of the command.\nTo allow a command return a falsey value.`}
  • \n
  • {`return false;`}{` If you return false the inhibitor will not block the error.`}
  • \n
\n
{`// If the command is not VIP only we can allow this command to execute\nif (!command.vipOnly) return false;\n\n// The bot's support server\nconst guild = cache.guilds.get(configs.supportServerID);\n// If the command author is not in the server they won't have the vip role\nconst member = guild.members.get(message.author.id) || await getMember(guild.id, message.author.id);\n// Member doesn't exist so cancel the command\nif (!member) {\n    sendResponse(message, \\`sorry, but you can not use this command until you become VIP. **Close the IRIS!!!**\\`)\n    return true;\n}\n\n// If the user has the vip role on the support server given by patreon allow the command\nif (member.roles.includes(configs.roleIDs.patreonVIPRoleID)) return false;\n\n// Alert the user they don't have vip and can't use the command\nsendResponse(message, \\`sorry, but you can not use this command until you become a VIP. I'm sorry, Teal'c. We'll go to Disneyland next year. I promise.\\`)\n// Cancel the command since the user does not have vip\nreturn true;\n`}
\n

{`Challenges`}

\n

{`Hell yes! We just got through the entire inhibitor section. You have now mastered everything related to inhibitors.`}

\n

{`You can now try and get a little more practice with inhibitors by trying to challenge yourself and make your own inhibitors. Don't worry if you can't think of any good use cases for inhibitors.`}

\n

{`Majority of Discordeno bots do not use many custom inhibitors because most of the necessary/important`}

\n\n
;\n}\n\n;\nMDXContent.isMDXComponent = true;"}} \ No newline at end of file diff --git a/docs/.cache/caches/gatsby-plugin-mdx/diskstore-2d893a36201ea8c27ca177dd70cc50dc.json b/docs/.cache/caches/gatsby-plugin-mdx/diskstore-2d893a36201ea8c27ca177dd70cc50dc.json new file mode 100644 index 000000000..c1d621419 --- /dev/null +++ b/docs/.cache/caches/gatsby-plugin-mdx/diskstore-2d893a36201ea8c27ca177dd70cc50dc.json @@ -0,0 +1 @@ +{"expireTime":9007200851644287000,"key":"gatsby-plugin-mdx-entire-payload-30b0e5464b70d751a9d65c5c3c507c6c-","val":{"mdast":{"type":"root","children":[{"type":"paragraph","children":[{"type":"text","value":"Discordeno will help make Discord bot development much easier. Don't worry, as you go through this guide it will make a lot more sense.","position":{"start":{"line":2,"column":1,"offset":1},"end":{"line":2,"column":136,"offset":136},"indent":[]}}],"position":{"start":{"line":2,"column":1,"offset":1},"end":{"line":2,"column":136,"offset":136},"indent":[]}},{"type":"heading","depth":2,"children":[{"type":"text","value":"Creating The Bot!","position":{"start":{"line":4,"column":4,"offset":141},"end":{"line":4,"column":21,"offset":158},"indent":[]}}],"position":{"start":{"line":4,"column":1,"offset":138},"end":{"line":4,"column":21,"offset":158},"indent":[]}},{"type":"blockquote","children":[{"type":"paragraph","children":[{"type":"text","value":"This guide is going to assume you already have the basic requirements to make a bot ready. This includes github, git, a code editor like Visual Studio Code. If you don't have these yet please prepare them first before going forward.","position":{"start":{"line":6,"column":3,"offset":162},"end":{"line":6,"column":235,"offset":394},"indent":[]}}],"position":{"start":{"line":6,"column":3,"offset":162},"end":{"line":6,"column":235,"offset":394},"indent":[]}}],"position":{"start":{"line":6,"column":1,"offset":160},"end":{"line":6,"column":235,"offset":394},"indent":[]}},{"type":"list","ordered":false,"start":null,"spread":true,"children":[{"type":"listItem","spread":false,"checked":null,"children":[{"type":"paragraph","children":[{"type":"text","value":"First, create a Discordeno Bot using the ","position":{"start":{"line":8,"column":3,"offset":398},"end":{"line":8,"column":44,"offset":439},"indent":[]}},{"type":"link","title":null,"url":"https://github.com/Skillz4Killz/Discordeno-bot-template","children":[{"type":"text","value":"Generator Boilerplate","position":{"start":{"line":8,"column":45,"offset":440},"end":{"line":8,"column":66,"offset":461},"indent":[]}}],"position":{"start":{"line":8,"column":44,"offset":439},"end":{"line":8,"column":124,"offset":519},"indent":[]}},{"type":"text","value":". Give it any name you like. For the purpose of this guide we will call it, Stargate.","position":{"start":{"line":8,"column":124,"offset":519},"end":{"line":8,"column":209,"offset":604},"indent":[]}}],"position":{"start":{"line":8,"column":3,"offset":398},"end":{"line":8,"column":209,"offset":604},"indent":[]}}],"position":{"start":{"line":8,"column":1,"offset":396},"end":{"line":9,"column":1,"offset":605},"indent":[1]}},{"type":"listItem","spread":false,"checked":null,"children":[{"type":"paragraph","children":[{"type":"text","value":"Then ","position":{"start":{"line":10,"column":3,"offset":608},"end":{"line":10,"column":8,"offset":613},"indent":[]}},{"type":"inlineCode","value":"git clone https://github.com/Skillz4Killz/Stargate.git","position":{"start":{"line":10,"column":8,"offset":613},"end":{"line":10,"column":64,"offset":669},"indent":[]}}],"position":{"start":{"line":10,"column":3,"offset":608},"end":{"line":10,"column":64,"offset":669},"indent":[]}}],"position":{"start":{"line":10,"column":1,"offset":606},"end":{"line":11,"column":1,"offset":670},"indent":[1]}},{"type":"listItem","spread":false,"checked":null,"children":[{"type":"paragraph","children":[{"type":"text","value":"When that is done, go ahead and open up the folder with VSC.","position":{"start":{"line":12,"column":3,"offset":673},"end":{"line":12,"column":63,"offset":733},"indent":[]}}],"position":{"start":{"line":12,"column":3,"offset":673},"end":{"line":12,"column":63,"offset":733},"indent":[]}}],"position":{"start":{"line":12,"column":1,"offset":671},"end":{"line":12,"column":63,"offset":733},"indent":[]}},{"type":"listItem","spread":false,"checked":null,"children":[{"type":"paragraph","children":[{"type":"text","value":"Create a new file called ","position":{"start":{"line":13,"column":3,"offset":736},"end":{"line":13,"column":28,"offset":761},"indent":[]}},{"type":"inlineCode","value":"configs.ts","position":{"start":{"line":13,"column":28,"offset":761},"end":{"line":13,"column":40,"offset":773},"indent":[]}},{"type":"text","value":". Open the ","position":{"start":{"line":13,"column":40,"offset":773},"end":{"line":13,"column":51,"offset":784},"indent":[]}},{"type":"inlineCode","value":"configs.example.ts","position":{"start":{"line":13,"column":51,"offset":784},"end":{"line":13,"column":71,"offset":804},"indent":[]}},{"type":"text","value":" file and copy everything over.","position":{"start":{"line":13,"column":71,"offset":804},"end":{"line":13,"column":102,"offset":835},"indent":[]}}],"position":{"start":{"line":13,"column":3,"offset":736},"end":{"line":13,"column":102,"offset":835},"indent":[]}}],"position":{"start":{"line":13,"column":1,"offset":734},"end":{"line":13,"column":102,"offset":835},"indent":[]}}],"position":{"start":{"line":8,"column":1,"offset":396},"end":{"line":13,"column":102,"offset":835},"indent":[1,1,1,1,1]}},{"type":"paragraph","children":[{"type":"text","value":"Let's take a minute to review all the options we have available to us.","position":{"start":{"line":15,"column":1,"offset":837},"end":{"line":15,"column":71,"offset":907},"indent":[]}}],"position":{"start":{"line":15,"column":1,"offset":837},"end":{"line":15,"column":71,"offset":907},"indent":[]}},{"type":"heading","depth":3,"children":[{"type":"text","value":"Configs File","position":{"start":{"line":17,"column":5,"offset":913},"end":{"line":17,"column":17,"offset":925},"indent":[]}}],"position":{"start":{"line":17,"column":1,"offset":909},"end":{"line":17,"column":17,"offset":925},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"The ","position":{"start":{"line":19,"column":1,"offset":927},"end":{"line":19,"column":5,"offset":931},"indent":[]}},{"type":"inlineCode","value":"configs.ts","position":{"start":{"line":19,"column":5,"offset":931},"end":{"line":19,"column":17,"offset":943},"indent":[]}},{"type":"text","value":" file is where you will keep all your secret info you don't want to share with anyone else. As long as ","position":{"start":{"line":19,"column":17,"offset":943},"end":{"line":19,"column":120,"offset":1046},"indent":[]}},{"type":"inlineCode","value":".gitignore","position":{"start":{"line":19,"column":120,"offset":1046},"end":{"line":19,"column":132,"offset":1058},"indent":[]}},{"type":"text","value":" file is ignoring configs.ts your configurations will be kept private!","position":{"start":{"line":19,"column":132,"offset":1058},"end":{"line":19,"column":202,"offset":1128},"indent":[]}}],"position":{"start":{"line":19,"column":1,"offset":927},"end":{"line":19,"column":202,"offset":1128},"indent":[]}},{"type":"code","lang":"ts","meta":null,"value":"// Step 1: Remove the `.example` from this file name so it is called `configs.ts`\n// Step 2: Add all your bot's information below. The only required one is token and prefix. NOTE: As long as `.gitignore` file is ignoring configs.ts your configurations will be kept private!\n// Step 3: Remove these comments if you like.\n\nexport const configs = {\n // Your bot token goes here\n token: \"\",\n // The default prefix for your bot. Don't worry guilds can change this later.\n prefix: \"!\",\n // This isn't required but you can add bot list api keys here.\n botListTokens: {\n DISCORD_BOT_ORG: \"\",\n BOTS_ON_DISCORD: \"\",\n DISCORD_BOT_LIST: \"\",\n BOTS_FOR_DISCORD: \"\",\n DISCORD_BOATS: \"\",\n DISCORD_BOTS_GG: \"\",\n DISCORD_BOTS_GROUP: \"\",\n },\n // This is the server id for your bot's main server where users can get help/support\n supportServerID: \"\",\n // These are channel ids that will enable some functionality\n channelIDs: {\n // When a translation is missing this is the channel you will be alerted in.\n missingTranslation: \"\",\n // When an error occurs, we will try and log it to this channel\n errorChannelID: \"\"\n },\n // These are the role ids that will enable some functionality.\n roleIDs: {\n // If you have a patreon set up you can add the patreon vip role id here.\n patreonVIPRoleID: \"\",\n },\n // These are the user ids that will enable some functionality.\n userIDs: {\n // The user ids for the support team\n botSupporters: [],\n // The user ids for the other devs on your team\n botDevs: [],\n // The user ids who have complete 100% access to your bot\n botOwners: []\n }\n};\n","position":{"start":{"line":21,"column":1,"offset":1130},"end":{"line":66,"column":4,"offset":2770},"indent":[1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1]}},{"type":"heading","depth":4,"children":[{"type":"text","value":"Token","position":{"start":{"line":68,"column":6,"offset":2777},"end":{"line":68,"column":11,"offset":2782},"indent":[]}}],"position":{"start":{"line":68,"column":1,"offset":2772},"end":{"line":68,"column":11,"offset":2782},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"First, add your bot token. This is ","position":{"start":{"line":70,"column":1,"offset":2784},"end":{"line":70,"column":36,"offset":2819},"indent":[]}},{"type":"strong","children":[{"type":"text","value":"required","position":{"start":{"line":70,"column":38,"offset":2821},"end":{"line":70,"column":46,"offset":2829},"indent":[]}}],"position":{"start":{"line":70,"column":36,"offset":2819},"end":{"line":70,"column":48,"offset":2831},"indent":[]}},{"type":"text","value":" for the bot to start. Review the ","position":{"start":{"line":70,"column":48,"offset":2831},"end":{"line":70,"column":82,"offset":2865},"indent":[]}},{"type":"link","title":null,"url":"https://discordeno.netlify.app/gettingstarted#creatingyourfirstdiscordbotapplication","children":[{"type":"text","value":"instructions","position":{"start":{"line":70,"column":83,"offset":2866},"end":{"line":70,"column":95,"offset":2878},"indent":[]}}],"position":{"start":{"line":70,"column":82,"offset":2865},"end":{"line":70,"column":182,"offset":2965},"indent":[]}},{"type":"text","value":" if you have not made your token yet.","position":{"start":{"line":70,"column":182,"offset":2965},"end":{"line":70,"column":219,"offset":3002},"indent":[]}}],"position":{"start":{"line":70,"column":1,"offset":2784},"end":{"line":70,"column":219,"offset":3002},"indent":[]}},{"type":"heading","depth":4,"children":[{"type":"text","value":"Prefix","position":{"start":{"line":72,"column":6,"offset":3009},"end":{"line":72,"column":12,"offset":3015},"indent":[]}}],"position":{"start":{"line":72,"column":1,"offset":3004},"end":{"line":72,"column":12,"offset":3015},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"The prefix is where you will set the default prefix for your bot. Don't worry, every server will be able to choose their own prefix but we need a default prefix to start.","position":{"start":{"line":74,"column":1,"offset":3017},"end":{"line":74,"column":171,"offset":3187},"indent":[]}}],"position":{"start":{"line":74,"column":1,"offset":3017},"end":{"line":74,"column":171,"offset":3187},"indent":[]}},{"type":"heading","depth":4,"children":[{"type":"text","value":"Bot Lists Tokens","position":{"start":{"line":76,"column":6,"offset":3194},"end":{"line":76,"column":22,"offset":3210},"indent":[]}}],"position":{"start":{"line":76,"column":1,"offset":3189},"end":{"line":76,"column":22,"offset":3210},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"This section of the file is so you can easily have your bot's statistics updated on all the bot lists out there to help you grow your bot. The code is already written to handle this but you will need to do 3 things for each bot list.","position":{"start":{"line":78,"column":1,"offset":3212},"end":{"line":78,"column":234,"offset":3445},"indent":[]}}],"position":{"start":{"line":78,"column":1,"offset":3212},"end":{"line":78,"column":234,"offset":3445},"indent":[]}},{"type":"list","ordered":true,"start":1,"spread":false,"children":[{"type":"listItem","spread":false,"checked":null,"children":[{"type":"paragraph","children":[{"type":"text","value":"Go to the bot list and add your bot to their website. (Each site has it's own instructions)","position":{"start":{"line":80,"column":4,"offset":3450},"end":{"line":80,"column":95,"offset":3541},"indent":[]}}],"position":{"start":{"line":80,"column":4,"offset":3450},"end":{"line":80,"column":95,"offset":3541},"indent":[]}}],"position":{"start":{"line":80,"column":1,"offset":3447},"end":{"line":80,"column":95,"offset":3541},"indent":[]}},{"type":"listItem","spread":false,"checked":null,"children":[{"type":"paragraph","children":[{"type":"text","value":"Create a token for yourself on each website and paste it in your configs.","position":{"start":{"line":81,"column":4,"offset":3545},"end":{"line":81,"column":77,"offset":3618},"indent":[]}}],"position":{"start":{"line":81,"column":4,"offset":3545},"end":{"line":81,"column":77,"offset":3618},"indent":[]}}],"position":{"start":{"line":81,"column":1,"offset":3542},"end":{"line":81,"column":77,"offset":3618},"indent":[]}},{"type":"listItem","spread":false,"checked":null,"children":[{"type":"paragraph","children":[{"type":"text","value":"Enjoy!","position":{"start":{"line":82,"column":4,"offset":3622},"end":{"line":82,"column":10,"offset":3628},"indent":[]}}],"position":{"start":{"line":82,"column":4,"offset":3622},"end":{"line":82,"column":10,"offset":3628},"indent":[]}}],"position":{"start":{"line":82,"column":1,"offset":3619},"end":{"line":82,"column":10,"offset":3628},"indent":[]}}],"position":{"start":{"line":80,"column":1,"offset":3447},"end":{"line":82,"column":10,"offset":3628},"indent":[1,1]}},{"type":"paragraph","children":[{"type":"text","value":"If you wish to customize the code, you will find the bot list tasks in the tasks folder. Don't worry we will discuss this when we get to the tasks section of the guide.","position":{"start":{"line":84,"column":1,"offset":3630},"end":{"line":84,"column":169,"offset":3798},"indent":[]}}],"position":{"start":{"line":84,"column":1,"offset":3630},"end":{"line":84,"column":169,"offset":3798},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"For now just remember, that Discordeno provides you a built in way to update most discord bot lists.","position":{"start":{"line":86,"column":1,"offset":3800},"end":{"line":86,"column":101,"offset":3900},"indent":[]}}],"position":{"start":{"line":86,"column":1,"offset":3800},"end":{"line":86,"column":101,"offset":3900},"indent":[]}},{"type":"heading","depth":4,"children":[{"type":"text","value":"Channel IDs","position":{"start":{"line":88,"column":6,"offset":3907},"end":{"line":88,"column":17,"offset":3918},"indent":[]}}],"position":{"start":{"line":88,"column":1,"offset":3902},"end":{"line":88,"column":17,"offset":3918},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"The channelIDs section holds the channel IDs that are useful for specific features to help give you alerts/notifications. For example, the ","position":{"start":{"line":90,"column":1,"offset":3920},"end":{"line":90,"column":140,"offset":4059},"indent":[]}},{"type":"inlineCode","value":"missingTranslation","position":{"start":{"line":90,"column":140,"offset":4059},"end":{"line":90,"column":160,"offset":4079},"indent":[]}},{"type":"text","value":" channel will be where messages are sent alerting you that somewhere in your code you are trying to use a translation key that you never created.","position":{"start":{"line":90,"column":160,"offset":4079},"end":{"line":90,"column":305,"offset":4224},"indent":[]}}],"position":{"start":{"line":90,"column":1,"offset":3920},"end":{"line":90,"column":305,"offset":4224},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"When you get to around 25,000 Discord servers on your bot, you may want to convert these channel IDs to webhooks.","position":{"start":{"line":92,"column":1,"offset":4226},"end":{"line":92,"column":114,"offset":4339},"indent":[]}}],"position":{"start":{"line":92,"column":1,"offset":4226},"end":{"line":92,"column":114,"offset":4339},"indent":[]}},{"type":"heading","depth":4,"children":[{"type":"text","value":"Role IDs","position":{"start":{"line":94,"column":6,"offset":4346},"end":{"line":94,"column":14,"offset":4354},"indent":[]}}],"position":{"start":{"line":94,"column":1,"offset":4341},"end":{"line":94,"column":14,"offset":4354},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"The roleIDs section holds the role IDs that are useful for specific features. For example, the ","position":{"start":{"line":96,"column":1,"offset":4356},"end":{"line":96,"column":96,"offset":4451},"indent":[]}},{"type":"inlineCode","value":"patreonVIPRoleID","position":{"start":{"line":96,"column":96,"offset":4451},"end":{"line":96,"column":114,"offset":4469},"indent":[]}},{"type":"text","value":" role can be used easily to enable vip features later in this guide.","position":{"start":{"line":96,"column":114,"offset":4469},"end":{"line":96,"column":182,"offset":4537},"indent":[]}}],"position":{"start":{"line":96,"column":1,"offset":4356},"end":{"line":96,"column":182,"offset":4537},"indent":[]}},{"type":"heading","depth":4,"children":[{"type":"text","value":"User IDs","position":{"start":{"line":98,"column":6,"offset":4544},"end":{"line":98,"column":14,"offset":4552},"indent":[]}}],"position":{"start":{"line":98,"column":1,"offset":4539},"end":{"line":98,"column":14,"offset":4552},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"The userIDs section holds the user IDs that are useful for specific features. For example, the ","position":{"start":{"line":100,"column":1,"offset":4554},"end":{"line":100,"column":96,"offset":4649},"indent":[]}},{"type":"inlineCode","value":"botDevs","position":{"start":{"line":100,"column":96,"offset":4649},"end":{"line":100,"column":105,"offset":4658},"indent":[]}},{"type":"text","value":" and such are useful for permission levels as you will see in the Permission Level part of the guide.user will be where messages are sent alerting you that somewhere in your code you are trying to use a translation key that you never created.","position":{"start":{"line":100,"column":105,"offset":4658},"end":{"line":100,"column":347,"offset":4900},"indent":[]}}],"position":{"start":{"line":100,"column":1,"offset":4554},"end":{"line":100,"column":347,"offset":4900},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"When you get to around 25,000 Discord servers on your bot, you may want to convert these user IDs to webhooks.","position":{"start":{"line":102,"column":1,"offset":4902},"end":{"line":102,"column":111,"offset":5012},"indent":[]}}],"position":{"start":{"line":102,"column":1,"offset":4902},"end":{"line":102,"column":111,"offset":5012},"indent":[]}},{"type":"heading","depth":2,"children":[{"type":"text","value":"It's Alive!","position":{"start":{"line":104,"column":4,"offset":5017},"end":{"line":104,"column":15,"offset":5028},"indent":[]}}],"position":{"start":{"line":104,"column":1,"offset":5014},"end":{"line":104,"column":15,"offset":5028},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"Oh my god! You now have a bot with a bunch of features already! You don't believe me? Well, seeing is believing, so start the bot.","position":{"start":{"line":106,"column":1,"offset":5030},"end":{"line":106,"column":131,"offset":5160},"indent":[]}}],"position":{"start":{"line":106,"column":1,"offset":5030},"end":{"line":106,"column":131,"offset":5160},"indent":[]}},{"type":"list","ordered":true,"start":1,"spread":false,"children":[{"type":"listItem","spread":false,"checked":null,"children":[{"type":"paragraph","children":[{"type":"text","value":"Invite your bot to a discord server.","position":{"start":{"line":108,"column":4,"offset":5165},"end":{"line":108,"column":40,"offset":5201},"indent":[]}}],"position":{"start":{"line":108,"column":4,"offset":5165},"end":{"line":108,"column":40,"offset":5201},"indent":[]}}],"position":{"start":{"line":108,"column":1,"offset":5162},"end":{"line":108,"column":40,"offset":5201},"indent":[]}},{"type":"listItem","spread":false,"checked":null,"children":[{"type":"paragraph","children":[{"type":"text","value":"Open up the integrated terminal in VSC using ","position":{"start":{"line":109,"column":4,"offset":5205},"end":{"line":109,"column":49,"offset":5250},"indent":[]}},{"type":"strong","children":[{"type":"text","value":"CTRL + `","position":{"start":{"line":109,"column":51,"offset":5252},"end":{"line":109,"column":59,"offset":5260},"indent":[]}}],"position":{"start":{"line":109,"column":49,"offset":5250},"end":{"line":109,"column":61,"offset":5262},"indent":[]}},{"type":"text","value":". If you use a Mac, replace CTRL with CMD.","position":{"start":{"line":109,"column":61,"offset":5262},"end":{"line":109,"column":103,"offset":5304},"indent":[]}}],"position":{"start":{"line":109,"column":4,"offset":5205},"end":{"line":109,"column":103,"offset":5304},"indent":[]}}],"position":{"start":{"line":109,"column":1,"offset":5202},"end":{"line":109,"column":103,"offset":5304},"indent":[]}},{"type":"listItem","spread":false,"checked":null,"children":[{"type":"paragraph","children":[{"type":"text","value":"Run the script below:","position":{"start":{"line":110,"column":4,"offset":5308},"end":{"line":110,"column":25,"offset":5329},"indent":[]}}],"position":{"start":{"line":110,"column":4,"offset":5308},"end":{"line":110,"column":25,"offset":5329},"indent":[]}}],"position":{"start":{"line":110,"column":1,"offset":5305},"end":{"line":110,"column":25,"offset":5329},"indent":[]}}],"position":{"start":{"line":108,"column":1,"offset":5162},"end":{"line":110,"column":25,"offset":5329},"indent":[1,1]}},{"type":"code","lang":"shell","meta":null,"value":"deno run --allow-net --allow-read mod.ts","position":{"start":{"line":112,"column":1,"offset":5331},"end":{"line":114,"column":4,"offset":5384},"indent":[1,1]}},{"type":"paragraph","children":[{"type":"text","value":"The first time you run it, you may see a lot of files being loaded. This is preparing all the magic behind the scene. Once it is ready, you will see something like this:","position":{"start":{"line":116,"column":1,"offset":5386},"end":{"line":116,"column":170,"offset":5555},"indent":[]}}],"position":{"start":{"line":116,"column":1,"offset":5386},"end":{"line":116,"column":170,"offset":5555},"indent":[]}},{"type":"paragraph","children":[{"type":"image","title":null,"url":"https://i.imgur.com/TOXjLgh.png","alt":"image","position":{"start":{"line":118,"column":1,"offset":5557},"end":{"line":118,"column":42,"offset":5598},"indent":[]}}],"position":{"start":{"line":118,"column":1,"offset":5557},"end":{"line":118,"column":42,"offset":5598},"indent":[]}},{"type":"heading","depth":2,"children":[{"type":"text","value":"Understanding What Discordeno Did","position":{"start":{"line":120,"column":4,"offset":5603},"end":{"line":120,"column":37,"offset":5636},"indent":[]}}],"position":{"start":{"line":120,"column":1,"offset":5600},"end":{"line":120,"column":37,"offset":5636},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"Discordeno includes these commands/folders as they are essential for any discord bot to have in order to meet the Discord Bot Best Practices. It also adds a few things that will help make some things easier to build a bot.","position":{"start":{"line":122,"column":1,"offset":5638},"end":{"line":122,"column":223,"offset":5860},"indent":[]}}],"position":{"start":{"line":122,"column":1,"offset":5638},"end":{"line":122,"column":223,"offset":5860},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"We will dive into these deeper in this guide. Let's take it step by step.","position":{"start":{"line":124,"column":1,"offset":5862},"end":{"line":124,"column":74,"offset":5935},"indent":[]}}],"position":{"start":{"line":124,"column":1,"offset":5862},"end":{"line":124,"column":74,"offset":5935},"indent":[]}},{"type":"export","value":"export const _frontmatter = {\"title\":\"Creating The Bot!\",\"metaTitle\":\"Creating A Bot | Discordeno\",\"metaDescription\":\"Let's create our very own bot with Discordeno!\"}","position":{"start":{"line":127,"column":1,"offset":5938},"end":{"line":127,"column":167,"offset":6104},"indent":[]}}],"position":{"start":{"line":1,"column":1,"offset":0},"end":{"line":127,"column":167,"offset":6104}}},"scopeImports":["import * as React from 'react'"],"scopeIdentifiers":["React"],"body":"function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }\n\nfunction _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }\n\nfunction _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }\n\n/* @jsx mdx */\nvar _frontmatter = {\n \"title\": \"Creating The Bot!\",\n \"metaTitle\": \"Creating A Bot | Discordeno\",\n \"metaDescription\": \"Let's create our very own bot with Discordeno!\"\n};\nvar layoutProps = {\n _frontmatter: _frontmatter\n};\nvar MDXLayout = \"wrapper\";\nreturn function MDXContent(_ref) {\n var components = _ref.components,\n props = _objectWithoutProperties(_ref, [\"components\"]);\n\n return mdx(MDXLayout, _extends({}, layoutProps, props, {\n components: components,\n mdxType: \"MDXLayout\"\n }), mdx(\"p\", null, \"Discordeno will help make Discord bot development much easier. Don't worry, as you go through this guide it will make a lot more sense.\"), mdx(\"h2\", null, \"Creating The Bot!\"), mdx(\"blockquote\", null, mdx(\"p\", {\n parentName: \"blockquote\"\n }, \"This guide is going to assume you already have the basic requirements to make a bot ready. This includes github, git, a code editor like Visual Studio Code. If you don't have these yet please prepare them first before going forward.\")), mdx(\"ul\", null, mdx(\"li\", {\n parentName: \"ul\"\n }, mdx(\"p\", {\n parentName: \"li\"\n }, \"First, create a Discordeno Bot using the \", mdx(\"a\", _extends({\n parentName: \"p\"\n }, {\n \"href\": \"https://github.com/Skillz4Killz/Discordeno-bot-template\"\n }), \"Generator Boilerplate\"), \". Give it any name you like. For the purpose of this guide we will call it, Stargate.\")), mdx(\"li\", {\n parentName: \"ul\"\n }, mdx(\"p\", {\n parentName: \"li\"\n }, \"Then \", mdx(\"inlineCode\", {\n parentName: \"p\"\n }, \"git clone https://github.com/Skillz4Killz/Stargate.git\"))), mdx(\"li\", {\n parentName: \"ul\"\n }, mdx(\"p\", {\n parentName: \"li\"\n }, \"When that is done, go ahead and open up the folder with VSC.\")), mdx(\"li\", {\n parentName: \"ul\"\n }, mdx(\"p\", {\n parentName: \"li\"\n }, \"Create a new file called \", mdx(\"inlineCode\", {\n parentName: \"p\"\n }, \"configs.ts\"), \". Open the \", mdx(\"inlineCode\", {\n parentName: \"p\"\n }, \"configs.example.ts\"), \" file and copy everything over.\"))), mdx(\"p\", null, \"Let's take a minute to review all the options we have available to us.\"), mdx(\"h3\", null, \"Configs File\"), mdx(\"p\", null, \"The \", mdx(\"inlineCode\", {\n parentName: \"p\"\n }, \"configs.ts\"), \" file is where you will keep all your secret info you don't want to share with anyone else. As long as \", mdx(\"inlineCode\", {\n parentName: \"p\"\n }, \".gitignore\"), \" file is ignoring configs.ts your configurations will be kept private!\"), mdx(\"pre\", null, mdx(\"code\", _extends({\n parentName: \"pre\"\n }, {\n \"className\": \"language-ts\"\n }), \"// Step 1: Remove the `.example` from this file name so it is called `configs.ts`\\n// Step 2: Add all your bot's information below. The only required one is token and prefix. NOTE: As long as `.gitignore` file is ignoring configs.ts your configurations will be kept private!\\n// Step 3: Remove these comments if you like.\\n\\nexport const configs = {\\n // Your bot token goes here\\n token: \\\"\\\",\\n // The default prefix for your bot. Don't worry guilds can change this later.\\n prefix: \\\"!\\\",\\n // This isn't required but you can add bot list api keys here.\\n botListTokens: {\\n DISCORD_BOT_ORG: \\\"\\\",\\n BOTS_ON_DISCORD: \\\"\\\",\\n DISCORD_BOT_LIST: \\\"\\\",\\n BOTS_FOR_DISCORD: \\\"\\\",\\n DISCORD_BOATS: \\\"\\\",\\n DISCORD_BOTS_GG: \\\"\\\",\\n DISCORD_BOTS_GROUP: \\\"\\\",\\n },\\n // This is the server id for your bot's main server where users can get help/support\\n supportServerID: \\\"\\\",\\n // These are channel ids that will enable some functionality\\n channelIDs: {\\n // When a translation is missing this is the channel you will be alerted in.\\n missingTranslation: \\\"\\\",\\n // When an error occurs, we will try and log it to this channel\\n errorChannelID: \\\"\\\"\\n },\\n // These are the role ids that will enable some functionality.\\n roleIDs: {\\n // If you have a patreon set up you can add the patreon vip role id here.\\n patreonVIPRoleID: \\\"\\\",\\n },\\n // These are the user ids that will enable some functionality.\\n userIDs: {\\n // The user ids for the support team\\n botSupporters: [],\\n // The user ids for the other devs on your team\\n botDevs: [],\\n // The user ids who have complete 100% access to your bot\\n botOwners: []\\n }\\n};\\n\\n\")), mdx(\"h4\", null, \"Token\"), mdx(\"p\", null, \"First, add your bot token. This is \", mdx(\"strong\", {\n parentName: \"p\"\n }, \"required\"), \" for the bot to start. Review the \", mdx(\"a\", _extends({\n parentName: \"p\"\n }, {\n \"href\": \"https://discordeno.netlify.app/gettingstarted#creatingyourfirstdiscordbotapplication\"\n }), \"instructions\"), \" if you have not made your token yet.\"), mdx(\"h4\", null, \"Prefix\"), mdx(\"p\", null, \"The prefix is where you will set the default prefix for your bot. Don't worry, every server will be able to choose their own prefix but we need a default prefix to start.\"), mdx(\"h4\", null, \"Bot Lists Tokens\"), mdx(\"p\", null, \"This section of the file is so you can easily have your bot's statistics updated on all the bot lists out there to help you grow your bot. The code is already written to handle this but you will need to do 3 things for each bot list.\"), mdx(\"ol\", null, mdx(\"li\", {\n parentName: \"ol\"\n }, \"Go to the bot list and add your bot to their website. (Each site has it's own instructions)\"), mdx(\"li\", {\n parentName: \"ol\"\n }, \"Create a token for yourself on each website and paste it in your configs.\"), mdx(\"li\", {\n parentName: \"ol\"\n }, \"Enjoy!\")), mdx(\"p\", null, \"If you wish to customize the code, you will find the bot list tasks in the tasks folder. Don't worry we will discuss this when we get to the tasks section of the guide.\"), mdx(\"p\", null, \"For now just remember, that Discordeno provides you a built in way to update most discord bot lists.\"), mdx(\"h4\", null, \"Channel IDs\"), mdx(\"p\", null, \"The channelIDs section holds the channel IDs that are useful for specific features to help give you alerts/notifications. For example, the \", mdx(\"inlineCode\", {\n parentName: \"p\"\n }, \"missingTranslation\"), \" channel will be where messages are sent alerting you that somewhere in your code you are trying to use a translation key that you never created.\"), mdx(\"p\", null, \"When you get to around 25,000 Discord servers on your bot, you may want to convert these channel IDs to webhooks.\"), mdx(\"h4\", null, \"Role IDs\"), mdx(\"p\", null, \"The roleIDs section holds the role IDs that are useful for specific features. For example, the \", mdx(\"inlineCode\", {\n parentName: \"p\"\n }, \"patreonVIPRoleID\"), \" role can be used easily to enable vip features later in this guide.\"), mdx(\"h4\", null, \"User IDs\"), mdx(\"p\", null, \"The userIDs section holds the user IDs that are useful for specific features. For example, the \", mdx(\"inlineCode\", {\n parentName: \"p\"\n }, \"botDevs\"), \" and such are useful for permission levels as you will see in the Permission Level part of the guide.user will be where messages are sent alerting you that somewhere in your code you are trying to use a translation key that you never created.\"), mdx(\"p\", null, \"When you get to around 25,000 Discord servers on your bot, you may want to convert these user IDs to webhooks.\"), mdx(\"h2\", null, \"It's Alive!\"), mdx(\"p\", null, \"Oh my god! You now have a bot with a bunch of features already! You don't believe me? Well, seeing is believing, so start the bot.\"), mdx(\"ol\", null, mdx(\"li\", {\n parentName: \"ol\"\n }, \"Invite your bot to a discord server.\"), mdx(\"li\", {\n parentName: \"ol\"\n }, \"Open up the integrated terminal in VSC using \", mdx(\"strong\", {\n parentName: \"li\"\n }, \"CTRL + `\"), \". If you use a Mac, replace CTRL with CMD.\"), mdx(\"li\", {\n parentName: \"ol\"\n }, \"Run the script below:\")), mdx(\"pre\", null, mdx(\"code\", _extends({\n parentName: \"pre\"\n }, {\n \"className\": \"language-shell\"\n }), \"deno run --allow-net --allow-read mod.ts\\n\")), mdx(\"p\", null, \"The first time you run it, you may see a lot of files being loaded. This is preparing all the magic behind the scene. Once it is ready, you will see something like this:\"), mdx(\"p\", null, mdx(\"img\", _extends({\n parentName: \"p\"\n }, {\n \"src\": \"https://i.imgur.com/TOXjLgh.png\",\n \"alt\": \"image\"\n }))), mdx(\"h2\", null, \"Understanding What Discordeno Did\"), mdx(\"p\", null, \"Discordeno includes these commands/folders as they are essential for any discord bot to have in order to meet the Discord Bot Best Practices. It also adds a few things that will help make some things easier to build a bot.\"), mdx(\"p\", null, \"We will dive into these deeper in this guide. Let's take it step by step.\"));\n}\n;\nMDXContent.isMDXComponent = true;","rawMDXOutput":"/* @jsx mdx */\nimport { mdx } from '@mdx-js/react';\n/* @jsx mdx */\n\nexport const _frontmatter = {\n \"title\": \"Creating The Bot!\",\n \"metaTitle\": \"Creating A Bot | Discordeno\",\n \"metaDescription\": \"Let's create our very own bot with Discordeno!\"\n};\n\nconst layoutProps = {\n _frontmatter\n};\nconst MDXLayout = \"wrapper\"\nexport default function MDXContent({\n components,\n ...props\n}) {\n return \n

{`Discordeno will help make Discord bot development much easier. Don't worry, as you go through this guide it will make a lot more sense.`}

\n

{`Creating The Bot!`}

\n
\n

{`This guide is going to assume you already have the basic requirements to make a bot ready. This includes github, git, a code editor like Visual Studio Code. If you don't have these yet please prepare them first before going forward.`}

\n
\n
    \n
  • \n

    {`First, create a Discordeno Bot using the `}{`Generator Boilerplate`}{`. Give it any name you like. For the purpose of this guide we will call it, Stargate.`}

    \n
  • \n
  • \n

    {`Then `}{`git clone https://github.com/Skillz4Killz/Stargate.git`}

    \n
  • \n
  • \n

    {`When that is done, go ahead and open up the folder with VSC.`}

    \n
  • \n
  • \n

    {`Create a new file called `}{`configs.ts`}{`. Open the `}{`configs.example.ts`}{` file and copy everything over.`}

    \n
  • \n
\n

{`Let's take a minute to review all the options we have available to us.`}

\n

{`Configs File`}

\n

{`The `}{`configs.ts`}{` file is where you will keep all your secret info you don't want to share with anyone else. As long as `}{`.gitignore`}{` file is ignoring configs.ts your configurations will be kept private!`}

\n
{`// Step 1: Remove the \\`.example\\` from this file name so it is called \\`configs.ts\\`\n// Step 2: Add all your bot's information below. The only required one is token and prefix. NOTE: As long as \\`.gitignore\\` file is ignoring configs.ts your configurations will be kept private!\n// Step 3: Remove these comments if you like.\n\nexport const configs = {\n  // Your bot token goes here\n  token: \"\",\n  // The default prefix for your bot. Don't worry guilds can change this later.\n  prefix: \"!\",\n  // This isn't required but you can add bot list api keys here.\n  botListTokens: {\n    DISCORD_BOT_ORG: \"\",\n    BOTS_ON_DISCORD: \"\",\n    DISCORD_BOT_LIST: \"\",\n    BOTS_FOR_DISCORD: \"\",\n    DISCORD_BOATS: \"\",\n    DISCORD_BOTS_GG: \"\",\n    DISCORD_BOTS_GROUP: \"\",\n  },\n  // This is the server id for your bot's main server where users can get help/support\n  supportServerID: \"\",\n  // These are channel ids that will enable some functionality\n  channelIDs: {\n    // When a translation is missing this is the channel you will be alerted in.\n    missingTranslation: \"\",\n    // When an error occurs, we will try and log it to this channel\n    errorChannelID: \"\"\n  },\n  // These are the role ids that will enable some functionality.\n  roleIDs: {\n    // If you have a patreon set up you can add the patreon vip role id here.\n    patreonVIPRoleID: \"\",\n  },\n  // These are the user ids that will enable some functionality.\n  userIDs: {\n    // The user ids for the support team\n    botSupporters: [],\n    // The user ids for the other devs on your team\n    botDevs: [],\n    // The user ids who have complete 100% access to your bot\n    botOwners: []\n  }\n};\n\n`}
\n

{`Token`}

\n

{`First, add your bot token. This is `}{`required`}{` for the bot to start. Review the `}{`instructions`}{` if you have not made your token yet.`}

\n

{`Prefix`}

\n

{`The prefix is where you will set the default prefix for your bot. Don't worry, every server will be able to choose their own prefix but we need a default prefix to start.`}

\n

{`Bot Lists Tokens`}

\n

{`This section of the file is so you can easily have your bot's statistics updated on all the bot lists out there to help you grow your bot. The code is already written to handle this but you will need to do 3 things for each bot list.`}

\n
    \n
  1. {`Go to the bot list and add your bot to their website. (Each site has it's own instructions)`}
  2. \n
  3. {`Create a token for yourself on each website and paste it in your configs.`}
  4. \n
  5. {`Enjoy!`}
  6. \n
\n

{`If you wish to customize the code, you will find the bot list tasks in the tasks folder. Don't worry we will discuss this when we get to the tasks section of the guide.`}

\n

{`For now just remember, that Discordeno provides you a built in way to update most discord bot lists.`}

\n

{`Channel IDs`}

\n

{`The channelIDs section holds the channel IDs that are useful for specific features to help give you alerts/notifications. For example, the `}{`missingTranslation`}{` channel will be where messages are sent alerting you that somewhere in your code you are trying to use a translation key that you never created.`}

\n

{`When you get to around 25,000 Discord servers on your bot, you may want to convert these channel IDs to webhooks.`}

\n

{`Role IDs`}

\n

{`The roleIDs section holds the role IDs that are useful for specific features. For example, the `}{`patreonVIPRoleID`}{` role can be used easily to enable vip features later in this guide.`}

\n

{`User IDs`}

\n

{`The userIDs section holds the user IDs that are useful for specific features. For example, the `}{`botDevs`}{` and such are useful for permission levels as you will see in the Permission Level part of the guide.user will be where messages are sent alerting you that somewhere in your code you are trying to use a translation key that you never created.`}

\n

{`When you get to around 25,000 Discord servers on your bot, you may want to convert these user IDs to webhooks.`}

\n

{`It's Alive!`}

\n

{`Oh my god! You now have a bot with a bunch of features already! You don't believe me? Well, seeing is believing, so start the bot.`}

\n
    \n
  1. {`Invite your bot to a discord server.`}
  2. \n
  3. {`Open up the integrated terminal in VSC using `}{`CTRL + \\``}{`. If you use a Mac, replace CTRL with CMD.`}
  4. \n
  5. {`Run the script below:`}
  6. \n
\n
{`deno run --allow-net --allow-read mod.ts\n`}
\n

{`The first time you run it, you may see a lot of files being loaded. This is preparing all the magic behind the scene. Once it is ready, you will see something like this:`}

\n

\n

{`Understanding What Discordeno Did`}

\n

{`Discordeno includes these commands/folders as they are essential for any discord bot to have in order to meet the Discord Bot Best Practices. It also adds a few things that will help make some things easier to build a bot.`}

\n

{`We will dive into these deeper in this guide. Let's take it step by step.`}

\n\n
;\n}\n\n;\nMDXContent.isMDXComponent = true;"}} \ No newline at end of file diff --git a/docs/.cache/caches/gatsby-plugin-mdx/diskstore-2e96b20f1fe2f4a29580a271de978a28.json b/docs/.cache/caches/gatsby-plugin-mdx/diskstore-2e96b20f1fe2f4a29580a271de978a28.json new file mode 100644 index 000000000..5cdd588b2 --- /dev/null +++ b/docs/.cache/caches/gatsby-plugin-mdx/diskstore-2e96b20f1fe2f4a29580a271de978a28.json @@ -0,0 +1 @@ +{"expireTime":9007200851634225000,"key":"gatsby-plugin-mdx-entire-payload-4efc9f5bc930d415ac3c270f925d6ea3-","val":{"mdast":{"type":"root","children":[{"type":"paragraph","children":[{"type":"text","value":"Woah! You are almost half way done with understanding all of Discordeno. Amazing isn't it? Something you may have noticed in the last section was there were some options that prevented some commands from running like ","position":{"start":{"line":2,"column":1,"offset":1},"end":{"line":2,"column":218,"offset":218},"indent":[]}},{"type":"inlineCode","value":"dmOnly","position":{"start":{"line":2,"column":218,"offset":218},"end":{"line":2,"column":226,"offset":226},"indent":[]}},{"type":"text","value":" or the permission options. we created a setting to prevent the monitor from running in certain channels. What if we wanted to do prevent commands from happening? How would we prevent commands from running?","position":{"start":{"line":2,"column":226,"offset":226},"end":{"line":2,"column":432,"offset":432},"indent":[]}}],"position":{"start":{"line":2,"column":1,"offset":1},"end":{"line":2,"column":432,"offset":432},"indent":[]}},{"type":"heading","depth":2,"children":[{"type":"text","value":"What is an Inhibitor?","position":{"start":{"line":4,"column":4,"offset":437},"end":{"line":4,"column":25,"offset":458},"indent":[]}}],"position":{"start":{"line":4,"column":1,"offset":434},"end":{"line":4,"column":25,"offset":458},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"An Inhibitor is very similar to how monitors work. A monitor runs on every message but an inhibitor runs on every command. Remember all those command options like cooldown, permissions, permissionLevel, nsfw, etc... Each and every one of these options has an inhibitor in that checks commands for these settings.","position":{"start":{"line":6,"column":1,"offset":460},"end":{"line":6,"column":313,"offset":772},"indent":[]}}],"position":{"start":{"line":6,"column":1,"offset":460},"end":{"line":6,"column":313,"offset":772},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"Let's create our own inhibitor that would prevent commands from being used if the user is not a VIP user.","position":{"start":{"line":8,"column":1,"offset":774},"end":{"line":8,"column":106,"offset":879},"indent":[]}}],"position":{"start":{"line":8,"column":1,"offset":774},"end":{"line":8,"column":106,"offset":879},"indent":[]}},{"type":"blockquote","children":[{"type":"paragraph","children":[{"type":"strong","children":[{"type":"text","value":"Note:","position":{"start":{"line":10,"column":5,"offset":885},"end":{"line":10,"column":10,"offset":890},"indent":[]}}],"position":{"start":{"line":10,"column":3,"offset":883},"end":{"line":10,"column":12,"offset":892},"indent":[]}},{"type":"text","value":" It is important to remember that everything below can be done with a simple permission level as well. We will create our own custom permission levels but for the purposes of this guide and to be able to learn about Inhibitors, we will be using an inhibitor.","position":{"start":{"line":10,"column":12,"offset":892},"end":{"line":10,"column":270,"offset":1150},"indent":[]}}],"position":{"start":{"line":10,"column":3,"offset":883},"end":{"line":10,"column":270,"offset":1150},"indent":[]}}],"position":{"start":{"line":10,"column":1,"offset":881},"end":{"line":10,"column":270,"offset":1150},"indent":[]}},{"type":"heading","depth":2,"children":[{"type":"text","value":"Creating the File","position":{"start":{"line":12,"column":4,"offset":1155},"end":{"line":12,"column":21,"offset":1172},"indent":[]}}],"position":{"start":{"line":12,"column":1,"offset":1152},"end":{"line":12,"column":21,"offset":1172},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"Let's start by creating a file inside the inhibitors folder called ","position":{"start":{"line":14,"column":1,"offset":1174},"end":{"line":14,"column":68,"offset":1241},"indent":[]}},{"type":"inlineCode","value":"boosted.ts","position":{"start":{"line":14,"column":68,"offset":1241},"end":{"line":14,"column":80,"offset":1253},"indent":[]}},{"type":"text","value":" and paste the following snippet of code:","position":{"start":{"line":14,"column":80,"offset":1253},"end":{"line":14,"column":121,"offset":1294},"indent":[]}}],"position":{"start":{"line":14,"column":1,"offset":1174},"end":{"line":14,"column":121,"offset":1294},"indent":[]}},{"type":"code","lang":"ts","meta":null,"value":"import { botCache } from \"../../mod.ts\";\n\nbotCache.inhibitors.set(\"inhibitorname\", async function (message, command, guild) {\n\t// Your code goes here\n});","position":{"start":{"line":16,"column":1,"offset":1296},"end":{"line":22,"column":4,"offset":1459},"indent":[1,1,1,1,1,1]}},{"type":"paragraph","children":[{"type":"text","value":"Inhibitors can take up to 3 arguments.","position":{"start":{"line":24,"column":1,"offset":1461},"end":{"line":24,"column":39,"offset":1499},"indent":[]}}],"position":{"start":{"line":24,"column":1,"offset":1461},"end":{"line":24,"column":39,"offset":1499},"indent":[]}},{"type":"list","ordered":false,"start":null,"spread":false,"children":[{"type":"listItem","spread":false,"checked":null,"children":[{"type":"paragraph","children":[{"type":"inlineCode","value":"message","position":{"start":{"line":26,"column":3,"offset":1503},"end":{"line":26,"column":12,"offset":1512},"indent":[]}},{"type":"text","value":": The message object that triggered the command.","position":{"start":{"line":26,"column":12,"offset":1512},"end":{"line":26,"column":60,"offset":1560},"indent":[]}}],"position":{"start":{"line":26,"column":3,"offset":1503},"end":{"line":26,"column":60,"offset":1560},"indent":[]}}],"position":{"start":{"line":26,"column":1,"offset":1501},"end":{"line":26,"column":60,"offset":1560},"indent":[]}},{"type":"listItem","spread":false,"checked":null,"children":[{"type":"paragraph","children":[{"type":"inlineCode","value":"command","position":{"start":{"line":27,"column":3,"offset":1563},"end":{"line":27,"column":12,"offset":1572},"indent":[]}},{"type":"text","value":": The command object itself that was triggered.","position":{"start":{"line":27,"column":12,"offset":1572},"end":{"line":27,"column":59,"offset":1619},"indent":[]}}],"position":{"start":{"line":27,"column":3,"offset":1563},"end":{"line":27,"column":59,"offset":1619},"indent":[]}}],"position":{"start":{"line":27,"column":1,"offset":1561},"end":{"line":27,"column":59,"offset":1619},"indent":[]}},{"type":"listItem","spread":false,"checked":null,"children":[{"type":"paragraph","children":[{"type":"inlineCode","value":"guild","position":{"start":{"line":28,"column":3,"offset":1622},"end":{"line":28,"column":10,"offset":1629},"indent":[]}},{"type":"text","value":": The server guild object where this command was ran.","position":{"start":{"line":28,"column":10,"offset":1629},"end":{"line":28,"column":63,"offset":1682},"indent":[]}}],"position":{"start":{"line":28,"column":3,"offset":1622},"end":{"line":28,"column":63,"offset":1682},"indent":[]}}],"position":{"start":{"line":28,"column":1,"offset":1620},"end":{"line":28,"column":63,"offset":1682},"indent":[]}}],"position":{"start":{"line":26,"column":1,"offset":1501},"end":{"line":28,"column":63,"offset":1682},"indent":[1,1]}},{"type":"heading","depth":2,"children":[{"type":"text","value":"Understanding How Inhibitors Function","position":{"start":{"line":30,"column":4,"offset":1687},"end":{"line":30,"column":41,"offset":1724},"indent":[]}}],"position":{"start":{"line":30,"column":1,"offset":1684},"end":{"line":30,"column":41,"offset":1724},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"To block a command you have to return a truthy value.","position":{"start":{"line":32,"column":1,"offset":1726},"end":{"line":32,"column":54,"offset":1779},"indent":[]}}],"position":{"start":{"line":32,"column":1,"offset":1726},"end":{"line":32,"column":54,"offset":1779},"indent":[]}},{"type":"list","ordered":false,"start":null,"spread":false,"children":[{"type":"listItem","spread":false,"checked":null,"children":[{"type":"paragraph","children":[{"type":"strong","children":[{"type":"text","value":"return true;","position":{"start":{"line":33,"column":5,"offset":1784},"end":{"line":33,"column":17,"offset":1796},"indent":[]}}],"position":{"start":{"line":33,"column":3,"offset":1782},"end":{"line":33,"column":19,"offset":1798},"indent":[]}},{"type":"text","value":" If you return true the inhibitor will block the execution of the command.\nTo allow a command return a falsey value.","position":{"start":{"line":33,"column":19,"offset":1798},"end":{"line":34,"column":42,"offset":1914},"indent":[1]}}],"position":{"start":{"line":33,"column":3,"offset":1782},"end":{"line":34,"column":42,"offset":1914},"indent":[1]}}],"position":{"start":{"line":33,"column":1,"offset":1780},"end":{"line":34,"column":42,"offset":1914},"indent":[1]}},{"type":"listItem","spread":false,"checked":null,"children":[{"type":"paragraph","children":[{"type":"strong","children":[{"type":"text","value":"return false;","position":{"start":{"line":35,"column":5,"offset":1919},"end":{"line":35,"column":18,"offset":1932},"indent":[]}}],"position":{"start":{"line":35,"column":3,"offset":1917},"end":{"line":35,"column":20,"offset":1934},"indent":[]}},{"type":"text","value":" If you return false the inhibitor will not block the error.","position":{"start":{"line":35,"column":20,"offset":1934},"end":{"line":35,"column":80,"offset":1994},"indent":[]}}],"position":{"start":{"line":35,"column":3,"offset":1917},"end":{"line":35,"column":80,"offset":1994},"indent":[]}}],"position":{"start":{"line":35,"column":1,"offset":1915},"end":{"line":35,"column":80,"offset":1994},"indent":[]}}],"position":{"start":{"line":33,"column":1,"offset":1780},"end":{"line":35,"column":80,"offset":1994},"indent":[1,1]}},{"type":"code","lang":"ts","meta":null,"value":"// If the command is not VIP only we can allow this command to execute\nif (!command.vipOnly) return false;\n\n// The bot's support server\nconst guild = cache.guilds.get(configs.supportServerID);\n// If the command author is not in the server they won't have the vip role\nconst member = guild.members.get(message.author.id) || await getMember(guild.id, message.author.id);\n// Member doesn't exist so cancel the command\nif (!member) return true;\n\n// Check if the user has the vip role on the support server given by patreon\nconst userIsVIP = await isUserVIP(message.author.id)\n// The user is VIP so we can allow this command to be used\nif (userIsVIP) return false;\n\n// The user is NOT VIP so we throw an error\nthrow `The ${command.name} is only allowed for VIP users.`","position":{"start":{"line":38,"column":1,"offset":1997},"end":{"line":56,"column":4,"offset":2770},"indent":[1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1]}},{"type":"export","value":"export const _frontmatter = {\"title\":\"Creating Inhibitors!\",\"metaTitle\":\"Creating An Inhibitor | Discordeno\",\"metaDescription\":\"Let's create our very own bot with Discordeno!\"}","position":{"start":{"line":59,"column":1,"offset":2773},"end":{"line":59,"column":177,"offset":2949},"indent":[]}}],"position":{"start":{"line":1,"column":1,"offset":0},"end":{"line":59,"column":177,"offset":2949}}},"scopeImports":["import * as React from 'react'"],"scopeIdentifiers":["React"],"body":"function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }\n\nfunction _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }\n\nfunction _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }\n\n/* @jsx mdx */\nvar _frontmatter = {\n \"title\": \"Creating Inhibitors!\",\n \"metaTitle\": \"Creating An Inhibitor | Discordeno\",\n \"metaDescription\": \"Let's create our very own bot with Discordeno!\"\n};\nvar layoutProps = {\n _frontmatter: _frontmatter\n};\nvar MDXLayout = \"wrapper\";\nreturn function MDXContent(_ref) {\n var components = _ref.components,\n props = _objectWithoutProperties(_ref, [\"components\"]);\n\n return mdx(MDXLayout, _extends({}, layoutProps, props, {\n components: components,\n mdxType: \"MDXLayout\"\n }), mdx(\"p\", null, \"Woah! You are almost half way done with understanding all of Discordeno. Amazing isn't it? Something you may have noticed in the last section was there were some options that prevented some commands from running like \", mdx(\"inlineCode\", {\n parentName: \"p\"\n }, \"dmOnly\"), \" or the permission options. we created a setting to prevent the monitor from running in certain channels. What if we wanted to do prevent commands from happening? How would we prevent commands from running?\"), mdx(\"h2\", null, \"What is an Inhibitor?\"), mdx(\"p\", null, \"An Inhibitor is very similar to how monitors work. A monitor runs on every message but an inhibitor runs on every command. Remember all those command options like cooldown, permissions, permissionLevel, nsfw, etc... Each and every one of these options has an inhibitor in that checks commands for these settings.\"), mdx(\"p\", null, \"Let's create our own inhibitor that would prevent commands from being used if the user is not a VIP user.\"), mdx(\"blockquote\", null, mdx(\"p\", {\n parentName: \"blockquote\"\n }, mdx(\"strong\", {\n parentName: \"p\"\n }, \"Note:\"), \" It is important to remember that everything below can be done with a simple permission level as well. We will create our own custom permission levels but for the purposes of this guide and to be able to learn about Inhibitors, we will be using an inhibitor.\")), mdx(\"h2\", null, \"Creating the File\"), mdx(\"p\", null, \"Let's start by creating a file inside the inhibitors folder called \", mdx(\"inlineCode\", {\n parentName: \"p\"\n }, \"boosted.ts\"), \" and paste the following snippet of code:\"), mdx(\"pre\", null, mdx(\"code\", _extends({\n parentName: \"pre\"\n }, {\n \"className\": \"language-ts\"\n }), \"import { botCache } from \\\"../../mod.ts\\\";\\n\\nbotCache.inhibitors.set(\\\"inhibitorname\\\", async function (message, command, guild) {\\n // Your code goes here\\n});\\n\")), mdx(\"p\", null, \"Inhibitors can take up to 3 arguments.\"), mdx(\"ul\", null, mdx(\"li\", {\n parentName: \"ul\"\n }, mdx(\"inlineCode\", {\n parentName: \"li\"\n }, \"message\"), \": The message object that triggered the command.\"), mdx(\"li\", {\n parentName: \"ul\"\n }, mdx(\"inlineCode\", {\n parentName: \"li\"\n }, \"command\"), \": The command object itself that was triggered.\"), mdx(\"li\", {\n parentName: \"ul\"\n }, mdx(\"inlineCode\", {\n parentName: \"li\"\n }, \"guild\"), \": The server guild object where this command was ran.\")), mdx(\"h2\", null, \"Understanding How Inhibitors Function\"), mdx(\"p\", null, \"To block a command you have to return a truthy value.\"), mdx(\"ul\", null, mdx(\"li\", {\n parentName: \"ul\"\n }, mdx(\"strong\", {\n parentName: \"li\"\n }, \"return true;\"), \" If you return true the inhibitor will block the execution of the command.\\nTo allow a command return a falsey value.\"), mdx(\"li\", {\n parentName: \"ul\"\n }, mdx(\"strong\", {\n parentName: \"li\"\n }, \"return false;\"), \" If you return false the inhibitor will not block the error.\")), mdx(\"pre\", null, mdx(\"code\", _extends({\n parentName: \"pre\"\n }, {\n \"className\": \"language-ts\"\n }), \"// If the command is not VIP only we can allow this command to execute\\nif (!command.vipOnly) return false;\\n\\n// The bot's support server\\nconst guild = cache.guilds.get(configs.supportServerID);\\n// If the command author is not in the server they won't have the vip role\\nconst member = guild.members.get(message.author.id) || await getMember(guild.id, message.author.id);\\n// Member doesn't exist so cancel the command\\nif (!member) return true;\\n\\n// Check if the user has the vip role on the support server given by patreon\\nconst userIsVIP = await isUserVIP(message.author.id)\\n// The user is VIP so we can allow this command to be used\\nif (userIsVIP) return false;\\n\\n// The user is NOT VIP so we throw an error\\nthrow `The ${command.name} is only allowed for VIP users.`\\n\")));\n}\n;\nMDXContent.isMDXComponent = true;","rawMDXOutput":"/* @jsx mdx */\nimport { mdx } from '@mdx-js/react';\n/* @jsx mdx */\n\nexport const _frontmatter = {\n \"title\": \"Creating Inhibitors!\",\n \"metaTitle\": \"Creating An Inhibitor | Discordeno\",\n \"metaDescription\": \"Let's create our very own bot with Discordeno!\"\n};\n\nconst layoutProps = {\n _frontmatter\n};\nconst MDXLayout = \"wrapper\"\nexport default function MDXContent({\n components,\n ...props\n}) {\n return \n

{`Woah! You are almost half way done with understanding all of Discordeno. Amazing isn't it? Something you may have noticed in the last section was there were some options that prevented some commands from running like `}{`dmOnly`}{` or the permission options. we created a setting to prevent the monitor from running in certain channels. What if we wanted to do prevent commands from happening? How would we prevent commands from running?`}

\n

{`What is an Inhibitor?`}

\n

{`An Inhibitor is very similar to how monitors work. A monitor runs on every message but an inhibitor runs on every command. Remember all those command options like cooldown, permissions, permissionLevel, nsfw, etc... Each and every one of these options has an inhibitor in that checks commands for these settings.`}

\n

{`Let's create our own inhibitor that would prevent commands from being used if the user is not a VIP user.`}

\n
\n

{`Note:`}{` It is important to remember that everything below can be done with a simple permission level as well. We will create our own custom permission levels but for the purposes of this guide and to be able to learn about Inhibitors, we will be using an inhibitor.`}

\n
\n

{`Creating the File`}

\n

{`Let's start by creating a file inside the inhibitors folder called `}{`boosted.ts`}{` and paste the following snippet of code:`}

\n
{`import { botCache } from \"../../mod.ts\";\n\nbotCache.inhibitors.set(\"inhibitorname\", async function (message, command, guild) {\n    // Your code goes here\n});\n`}
\n

{`Inhibitors can take up to 3 arguments.`}

\n
    \n
  • {`message`}{`: The message object that triggered the command.`}
  • \n
  • {`command`}{`: The command object itself that was triggered.`}
  • \n
  • {`guild`}{`: The server guild object where this command was ran.`}
  • \n
\n

{`Understanding How Inhibitors Function`}

\n

{`To block a command you have to return a truthy value.`}

\n
    \n
  • {`return true;`}{` If you return true the inhibitor will block the execution of the command.\nTo allow a command return a falsey value.`}
  • \n
  • {`return false;`}{` If you return false the inhibitor will not block the error.`}
  • \n
\n
{`// If the command is not VIP only we can allow this command to execute\nif (!command.vipOnly) return false;\n\n// The bot's support server\nconst guild = cache.guilds.get(configs.supportServerID);\n// If the command author is not in the server they won't have the vip role\nconst member = guild.members.get(message.author.id) || await getMember(guild.id, message.author.id);\n// Member doesn't exist so cancel the command\nif (!member) return true;\n\n// Check if the user has the vip role on the support server given by patreon\nconst userIsVIP = await isUserVIP(message.author.id)\n// The user is VIP so we can allow this command to be used\nif (userIsVIP) return false;\n\n// The user is NOT VIP so we throw an error\nthrow \\`The \\${command.name} is only allowed for VIP users.\\`\n`}
\n\n
;\n}\n\n;\nMDXContent.isMDXComponent = true;"}} \ No newline at end of file diff --git a/docs/.cache/caches/gatsby-plugin-mdx/diskstore-2ed4a8660238fa0843129437135cce8b.json b/docs/.cache/caches/gatsby-plugin-mdx/diskstore-2ed4a8660238fa0843129437135cce8b.json new file mode 100644 index 000000000..33badef41 --- /dev/null +++ b/docs/.cache/caches/gatsby-plugin-mdx/diskstore-2ed4a8660238fa0843129437135cce8b.json @@ -0,0 +1 @@ +{"expireTime":9007200851634168000,"key":"gatsby-plugin-mdx-entire-payload-5ee838db0b52006769d19d6b457d60ab-","val":{"mdast":{"type":"root","children":[{"type":"paragraph","children":[{"type":"text","value":"Woah! You are almost half way done with understanding all of Discordeno. Amazing isn't it? Something you may have noticed in the last section was there were some options that prevented some commands from running like ","position":{"start":{"line":2,"column":1,"offset":1},"end":{"line":2,"column":218,"offset":218},"indent":[]}},{"type":"inlineCode","value":"dmOnly","position":{"start":{"line":2,"column":218,"offset":218},"end":{"line":2,"column":226,"offset":226},"indent":[]}},{"type":"text","value":" or the permission options. we created a setting to prevent the monitor from running in certain channels. What if we wanted to do prevent commands from happening? How would we prevent commands from running?","position":{"start":{"line":2,"column":226,"offset":226},"end":{"line":2,"column":432,"offset":432},"indent":[]}}],"position":{"start":{"line":2,"column":1,"offset":1},"end":{"line":2,"column":432,"offset":432},"indent":[]}},{"type":"heading","depth":2,"children":[{"type":"text","value":"What is an Inhibitor?","position":{"start":{"line":4,"column":4,"offset":437},"end":{"line":4,"column":25,"offset":458},"indent":[]}}],"position":{"start":{"line":4,"column":1,"offset":434},"end":{"line":4,"column":25,"offset":458},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"An Inhibitor is very similar to how monitors work. A monitor runs on every message but an inhibitor runs on every command. Remember all those command options like cooldown, permissions, permissionLevel, nsfw, etc... Each and every one of these options has an inhibitor in that checks commands for these settings.","position":{"start":{"line":6,"column":1,"offset":460},"end":{"line":6,"column":313,"offset":772},"indent":[]}}],"position":{"start":{"line":6,"column":1,"offset":460},"end":{"line":6,"column":313,"offset":772},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"Let's create our own inhibitor that would prevent commands from being used if the user is not a VIP user.","position":{"start":{"line":8,"column":1,"offset":774},"end":{"line":8,"column":106,"offset":879},"indent":[]}}],"position":{"start":{"line":8,"column":1,"offset":774},"end":{"line":8,"column":106,"offset":879},"indent":[]}},{"type":"blockquote","children":[{"type":"paragraph","children":[{"type":"strong","children":[{"type":"text","value":"Note:","position":{"start":{"line":10,"column":5,"offset":885},"end":{"line":10,"column":10,"offset":890},"indent":[]}}],"position":{"start":{"line":10,"column":3,"offset":883},"end":{"line":10,"column":12,"offset":892},"indent":[]}},{"type":"text","value":" It is important to remember that everything below can be done with a simple permission level as well. We will create our own custom permission levels but for the purposes of this guide and to be able to learn about Inhibitors, we will be using an inhibitor.","position":{"start":{"line":10,"column":12,"offset":892},"end":{"line":10,"column":270,"offset":1150},"indent":[]}}],"position":{"start":{"line":10,"column":3,"offset":883},"end":{"line":10,"column":270,"offset":1150},"indent":[]}}],"position":{"start":{"line":10,"column":1,"offset":881},"end":{"line":10,"column":270,"offset":1150},"indent":[]}},{"type":"heading","depth":2,"children":[{"type":"text","value":"Creating the File","position":{"start":{"line":12,"column":4,"offset":1155},"end":{"line":12,"column":21,"offset":1172},"indent":[]}}],"position":{"start":{"line":12,"column":1,"offset":1152},"end":{"line":12,"column":21,"offset":1172},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"Let's start by creating a file inside the inhibitors folder called ","position":{"start":{"line":14,"column":1,"offset":1174},"end":{"line":14,"column":68,"offset":1241},"indent":[]}},{"type":"inlineCode","value":"boosted.ts","position":{"start":{"line":14,"column":68,"offset":1241},"end":{"line":14,"column":80,"offset":1253},"indent":[]}},{"type":"text","value":" and paste the following snippet of code:","position":{"start":{"line":14,"column":80,"offset":1253},"end":{"line":14,"column":121,"offset":1294},"indent":[]}}],"position":{"start":{"line":14,"column":1,"offset":1174},"end":{"line":14,"column":121,"offset":1294},"indent":[]}},{"type":"code","lang":"ts","meta":null,"value":"import { botCache } from \"../../mod.ts\";\n\nbotCache.inhibitors.set(\"inhibitorname\", async function (message, command, guild) {\n\t// Your code goes here\n});","position":{"start":{"line":16,"column":1,"offset":1296},"end":{"line":22,"column":4,"offset":1459},"indent":[1,1,1,1,1,1]}},{"type":"paragraph","children":[{"type":"text","value":"Inhibitors can take up to 3 arguments.","position":{"start":{"line":24,"column":1,"offset":1461},"end":{"line":24,"column":39,"offset":1499},"indent":[]}}],"position":{"start":{"line":24,"column":1,"offset":1461},"end":{"line":24,"column":39,"offset":1499},"indent":[]}},{"type":"list","ordered":false,"start":null,"spread":false,"children":[{"type":"listItem","spread":false,"checked":null,"children":[{"type":"paragraph","children":[{"type":"inlineCode","value":"message","position":{"start":{"line":26,"column":3,"offset":1503},"end":{"line":26,"column":12,"offset":1512},"indent":[]}},{"type":"text","value":": The message object that triggered the command.","position":{"start":{"line":26,"column":12,"offset":1512},"end":{"line":26,"column":60,"offset":1560},"indent":[]}}],"position":{"start":{"line":26,"column":3,"offset":1503},"end":{"line":26,"column":60,"offset":1560},"indent":[]}}],"position":{"start":{"line":26,"column":1,"offset":1501},"end":{"line":26,"column":60,"offset":1560},"indent":[]}},{"type":"listItem","spread":false,"checked":null,"children":[{"type":"paragraph","children":[{"type":"inlineCode","value":"command","position":{"start":{"line":27,"column":3,"offset":1563},"end":{"line":27,"column":12,"offset":1572},"indent":[]}},{"type":"text","value":": The command object itself that was triggered.","position":{"start":{"line":27,"column":12,"offset":1572},"end":{"line":27,"column":59,"offset":1619},"indent":[]}}],"position":{"start":{"line":27,"column":3,"offset":1563},"end":{"line":27,"column":59,"offset":1619},"indent":[]}}],"position":{"start":{"line":27,"column":1,"offset":1561},"end":{"line":27,"column":59,"offset":1619},"indent":[]}},{"type":"listItem","spread":false,"checked":null,"children":[{"type":"paragraph","children":[{"type":"inlineCode","value":"guild","position":{"start":{"line":28,"column":3,"offset":1622},"end":{"line":28,"column":10,"offset":1629},"indent":[]}},{"type":"text","value":": The server guild object where this command was ran.","position":{"start":{"line":28,"column":10,"offset":1629},"end":{"line":28,"column":63,"offset":1682},"indent":[]}}],"position":{"start":{"line":28,"column":3,"offset":1622},"end":{"line":28,"column":63,"offset":1682},"indent":[]}}],"position":{"start":{"line":28,"column":1,"offset":1620},"end":{"line":28,"column":63,"offset":1682},"indent":[]}}],"position":{"start":{"line":26,"column":1,"offset":1501},"end":{"line":28,"column":63,"offset":1682},"indent":[1,1]}},{"type":"heading","depth":2,"children":[{"type":"text","value":"Understanding How Inhibitors Function","position":{"start":{"line":30,"column":4,"offset":1687},"end":{"line":30,"column":41,"offset":1724},"indent":[]}}],"position":{"start":{"line":30,"column":1,"offset":1684},"end":{"line":30,"column":41,"offset":1724},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"To block a command you have to return a truthy value.","position":{"start":{"line":32,"column":1,"offset":1726},"end":{"line":32,"column":54,"offset":1779},"indent":[]}}],"position":{"start":{"line":32,"column":1,"offset":1726},"end":{"line":32,"column":54,"offset":1779},"indent":[]}},{"type":"list","ordered":false,"start":null,"spread":false,"children":[{"type":"listItem","spread":false,"checked":null,"children":[{"type":"paragraph","children":[{"type":"strong","children":[{"type":"text","value":"return true;","position":{"start":{"line":33,"column":5,"offset":1784},"end":{"line":33,"column":17,"offset":1796},"indent":[]}}],"position":{"start":{"line":33,"column":3,"offset":1782},"end":{"line":33,"column":19,"offset":1798},"indent":[]}},{"type":"text","value":" If you return true the inhibitor will block the execution of the command.\nTo allow a command return a falsey value.","position":{"start":{"line":33,"column":19,"offset":1798},"end":{"line":34,"column":42,"offset":1914},"indent":[1]}}],"position":{"start":{"line":33,"column":3,"offset":1782},"end":{"line":34,"column":42,"offset":1914},"indent":[1]}}],"position":{"start":{"line":33,"column":1,"offset":1780},"end":{"line":34,"column":42,"offset":1914},"indent":[1]}},{"type":"listItem","spread":false,"checked":null,"children":[{"type":"paragraph","children":[{"type":"strong","children":[{"type":"text","value":"return false;","position":{"start":{"line":35,"column":5,"offset":1919},"end":{"line":35,"column":18,"offset":1932},"indent":[]}}],"position":{"start":{"line":35,"column":3,"offset":1917},"end":{"line":35,"column":20,"offset":1934},"indent":[]}},{"type":"text","value":" If you return false the inhibitor will not block the error.","position":{"start":{"line":35,"column":20,"offset":1934},"end":{"line":35,"column":80,"offset":1994},"indent":[]}}],"position":{"start":{"line":35,"column":3,"offset":1917},"end":{"line":35,"column":80,"offset":1994},"indent":[]}}],"position":{"start":{"line":35,"column":1,"offset":1915},"end":{"line":35,"column":80,"offset":1994},"indent":[]}}],"position":{"start":{"line":33,"column":1,"offset":1780},"end":{"line":35,"column":80,"offset":1994},"indent":[1,1]}},{"type":"code","lang":"ts","meta":null,"value":"// If the command is not VIP only we can allow this command to execute\nif (!command.vipOnly) return false;\n\n// The bot's support server\nconst guild = cache.guilds.get(configs.supportServerID);\n// If the command author is not in the server they won't have the vip role so cancel the command\nconst member = guild.members.get()\n// Check if the user has the vip role on the support server given by patreon\nconst userIsVIP = await isUserVIP(message.author.id)\n// The user is VIP so we can allow this command to be used\nif (userIsVIP) return false;\n\n// The user is NOT VIP so we throw an error\nthrow `The ${command.name} is only allowed for VIP users.`","position":{"start":{"line":38,"column":1,"offset":1997},"end":{"line":53,"column":4,"offset":2653},"indent":[1,1,1,1,1,1,1,1,1,1,1,1,1,1,1]}},{"type":"export","value":"export const _frontmatter = {\"title\":\"Creating Inhibitors!\",\"metaTitle\":\"Creating An Inhibitor | Discordeno\",\"metaDescription\":\"Let's create our very own bot with Discordeno!\"}","position":{"start":{"line":56,"column":1,"offset":2656},"end":{"line":56,"column":177,"offset":2832},"indent":[]}}],"position":{"start":{"line":1,"column":1,"offset":0},"end":{"line":56,"column":177,"offset":2832}}},"scopeImports":["import * as React from 'react'"],"scopeIdentifiers":["React"],"body":"function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }\n\nfunction _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }\n\nfunction _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }\n\n/* @jsx mdx */\nvar _frontmatter = {\n \"title\": \"Creating Inhibitors!\",\n \"metaTitle\": \"Creating An Inhibitor | Discordeno\",\n \"metaDescription\": \"Let's create our very own bot with Discordeno!\"\n};\nvar layoutProps = {\n _frontmatter: _frontmatter\n};\nvar MDXLayout = \"wrapper\";\nreturn function MDXContent(_ref) {\n var components = _ref.components,\n props = _objectWithoutProperties(_ref, [\"components\"]);\n\n return mdx(MDXLayout, _extends({}, layoutProps, props, {\n components: components,\n mdxType: \"MDXLayout\"\n }), mdx(\"p\", null, \"Woah! You are almost half way done with understanding all of Discordeno. Amazing isn't it? Something you may have noticed in the last section was there were some options that prevented some commands from running like \", mdx(\"inlineCode\", {\n parentName: \"p\"\n }, \"dmOnly\"), \" or the permission options. we created a setting to prevent the monitor from running in certain channels. What if we wanted to do prevent commands from happening? How would we prevent commands from running?\"), mdx(\"h2\", null, \"What is an Inhibitor?\"), mdx(\"p\", null, \"An Inhibitor is very similar to how monitors work. A monitor runs on every message but an inhibitor runs on every command. Remember all those command options like cooldown, permissions, permissionLevel, nsfw, etc... Each and every one of these options has an inhibitor in that checks commands for these settings.\"), mdx(\"p\", null, \"Let's create our own inhibitor that would prevent commands from being used if the user is not a VIP user.\"), mdx(\"blockquote\", null, mdx(\"p\", {\n parentName: \"blockquote\"\n }, mdx(\"strong\", {\n parentName: \"p\"\n }, \"Note:\"), \" It is important to remember that everything below can be done with a simple permission level as well. We will create our own custom permission levels but for the purposes of this guide and to be able to learn about Inhibitors, we will be using an inhibitor.\")), mdx(\"h2\", null, \"Creating the File\"), mdx(\"p\", null, \"Let's start by creating a file inside the inhibitors folder called \", mdx(\"inlineCode\", {\n parentName: \"p\"\n }, \"boosted.ts\"), \" and paste the following snippet of code:\"), mdx(\"pre\", null, mdx(\"code\", _extends({\n parentName: \"pre\"\n }, {\n \"className\": \"language-ts\"\n }), \"import { botCache } from \\\"../../mod.ts\\\";\\n\\nbotCache.inhibitors.set(\\\"inhibitorname\\\", async function (message, command, guild) {\\n // Your code goes here\\n});\\n\")), mdx(\"p\", null, \"Inhibitors can take up to 3 arguments.\"), mdx(\"ul\", null, mdx(\"li\", {\n parentName: \"ul\"\n }, mdx(\"inlineCode\", {\n parentName: \"li\"\n }, \"message\"), \": The message object that triggered the command.\"), mdx(\"li\", {\n parentName: \"ul\"\n }, mdx(\"inlineCode\", {\n parentName: \"li\"\n }, \"command\"), \": The command object itself that was triggered.\"), mdx(\"li\", {\n parentName: \"ul\"\n }, mdx(\"inlineCode\", {\n parentName: \"li\"\n }, \"guild\"), \": The server guild object where this command was ran.\")), mdx(\"h2\", null, \"Understanding How Inhibitors Function\"), mdx(\"p\", null, \"To block a command you have to return a truthy value.\"), mdx(\"ul\", null, mdx(\"li\", {\n parentName: \"ul\"\n }, mdx(\"strong\", {\n parentName: \"li\"\n }, \"return true;\"), \" If you return true the inhibitor will block the execution of the command.\\nTo allow a command return a falsey value.\"), mdx(\"li\", {\n parentName: \"ul\"\n }, mdx(\"strong\", {\n parentName: \"li\"\n }, \"return false;\"), \" If you return false the inhibitor will not block the error.\")), mdx(\"pre\", null, mdx(\"code\", _extends({\n parentName: \"pre\"\n }, {\n \"className\": \"language-ts\"\n }), \"// If the command is not VIP only we can allow this command to execute\\nif (!command.vipOnly) return false;\\n\\n// The bot's support server\\nconst guild = cache.guilds.get(configs.supportServerID);\\n// If the command author is not in the server they won't have the vip role so cancel the command\\nconst member = guild.members.get()\\n// Check if the user has the vip role on the support server given by patreon\\nconst userIsVIP = await isUserVIP(message.author.id)\\n// The user is VIP so we can allow this command to be used\\nif (userIsVIP) return false;\\n\\n// The user is NOT VIP so we throw an error\\nthrow `The ${command.name} is only allowed for VIP users.`\\n\")));\n}\n;\nMDXContent.isMDXComponent = true;","rawMDXOutput":"/* @jsx mdx */\nimport { mdx } from '@mdx-js/react';\n/* @jsx mdx */\n\nexport const _frontmatter = {\n \"title\": \"Creating Inhibitors!\",\n \"metaTitle\": \"Creating An Inhibitor | Discordeno\",\n \"metaDescription\": \"Let's create our very own bot with Discordeno!\"\n};\n\nconst layoutProps = {\n _frontmatter\n};\nconst MDXLayout = \"wrapper\"\nexport default function MDXContent({\n components,\n ...props\n}) {\n return \n

{`Woah! You are almost half way done with understanding all of Discordeno. Amazing isn't it? Something you may have noticed in the last section was there were some options that prevented some commands from running like `}{`dmOnly`}{` or the permission options. we created a setting to prevent the monitor from running in certain channels. What if we wanted to do prevent commands from happening? How would we prevent commands from running?`}

\n

{`What is an Inhibitor?`}

\n

{`An Inhibitor is very similar to how monitors work. A monitor runs on every message but an inhibitor runs on every command. Remember all those command options like cooldown, permissions, permissionLevel, nsfw, etc... Each and every one of these options has an inhibitor in that checks commands for these settings.`}

\n

{`Let's create our own inhibitor that would prevent commands from being used if the user is not a VIP user.`}

\n
\n

{`Note:`}{` It is important to remember that everything below can be done with a simple permission level as well. We will create our own custom permission levels but for the purposes of this guide and to be able to learn about Inhibitors, we will be using an inhibitor.`}

\n
\n

{`Creating the File`}

\n

{`Let's start by creating a file inside the inhibitors folder called `}{`boosted.ts`}{` and paste the following snippet of code:`}

\n
{`import { botCache } from \"../../mod.ts\";\n\nbotCache.inhibitors.set(\"inhibitorname\", async function (message, command, guild) {\n    // Your code goes here\n});\n`}
\n

{`Inhibitors can take up to 3 arguments.`}

\n
    \n
  • {`message`}{`: The message object that triggered the command.`}
  • \n
  • {`command`}{`: The command object itself that was triggered.`}
  • \n
  • {`guild`}{`: The server guild object where this command was ran.`}
  • \n
\n

{`Understanding How Inhibitors Function`}

\n

{`To block a command you have to return a truthy value.`}

\n
    \n
  • {`return true;`}{` If you return true the inhibitor will block the execution of the command.\nTo allow a command return a falsey value.`}
  • \n
  • {`return false;`}{` If you return false the inhibitor will not block the error.`}
  • \n
\n
{`// If the command is not VIP only we can allow this command to execute\nif (!command.vipOnly) return false;\n\n// The bot's support server\nconst guild = cache.guilds.get(configs.supportServerID);\n// If the command author is not in the server they won't have the vip role so cancel the command\nconst member = guild.members.get()\n// Check if the user has the vip role on the support server given by patreon\nconst userIsVIP = await isUserVIP(message.author.id)\n// The user is VIP so we can allow this command to be used\nif (userIsVIP) return false;\n\n// The user is NOT VIP so we throw an error\nthrow \\`The \\${command.name} is only allowed for VIP users.\\`\n`}
\n\n
;\n}\n\n;\nMDXContent.isMDXComponent = true;"}} \ No newline at end of file diff --git a/docs/.cache/caches/gatsby-plugin-mdx/diskstore-2f6d2f3521d2b2827e6ecd2246216688.json b/docs/.cache/caches/gatsby-plugin-mdx/diskstore-2f6d2f3521d2b2827e6ecd2246216688.json new file mode 100644 index 000000000..300b42908 --- /dev/null +++ b/docs/.cache/caches/gatsby-plugin-mdx/diskstore-2f6d2f3521d2b2827e6ecd2246216688.json @@ -0,0 +1 @@ +{"expireTime":9007200851635016000,"key":"gatsby-plugin-mdx-entire-payload-459e0525608ddfffd0969e858d2d5d17-","val":{"mdast":{"type":"root","children":[{"type":"paragraph","children":[{"type":"text","value":"Really great job. Now, lets dive into trying to use some of the commands and try to make our very own command.","position":{"start":{"line":2,"column":1,"offset":1},"end":{"line":2,"column":111,"offset":111},"indent":[]}}],"position":{"start":{"line":2,"column":1,"offset":1},"end":{"line":2,"column":111,"offset":111},"indent":[]}},{"type":"heading","depth":2,"children":[{"type":"text","value":"Editing Invite Command","position":{"start":{"line":4,"column":4,"offset":116},"end":{"line":4,"column":26,"offset":138},"indent":[]}}],"position":{"start":{"line":4,"column":1,"offset":113},"end":{"line":4,"column":26,"offset":138},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"Let's first start by taking an existing command and slightly modifying it to your needs. Let's use the ","position":{"start":{"line":6,"column":1,"offset":140},"end":{"line":6,"column":104,"offset":243},"indent":[]}},{"type":"inlineCode","value":"Invite","position":{"start":{"line":6,"column":104,"offset":243},"end":{"line":6,"column":112,"offset":251},"indent":[]}},{"type":"text","value":" command as our example. When you open the command, you will see something like this:","position":{"start":{"line":6,"column":112,"offset":251},"end":{"line":6,"column":197,"offset":336},"indent":[]}}],"position":{"start":{"line":6,"column":1,"offset":140},"end":{"line":6,"column":197,"offset":336},"indent":[]}},{"type":"code","lang":"ts","meta":null,"value":"import { botCache } from \"../../mod.ts\";\nimport { sendMessage } from \"https://raw.githubusercontent.com/Skillz4Killz/Discordeno/v7/src/handlers/channel.ts\";\nimport { botID } from \"https://raw.githubusercontent.com/Skillz4Killz/Discordeno/v7/src/module/client.ts\";\n\nbotCache.commands.set(\"invite\", {\n name: \"invite\",\n execute: function (message) {\n // Replace the permission number at the end to request the permissions you wish to request. By default, this will request Admin perms.\n sendMessage(\n message.channel,\n `https://discordapp.com/oauth2/authorize?client_id=${botID}&scope=bot&permissions=8`,\n );\n },\n});","position":{"start":{"line":8,"column":1,"offset":338},"end":{"line":23,"column":4,"offset":983},"indent":[1,1,1,1,1,1,1,1,1,1,1,1,1,1,1]}},{"type":"paragraph","children":[{"type":"text","value":"Let's break this down. The first three lines are importing the necessary things from their files so we can use them in this command. Don't worry if this doesn't make sense, most of the time, this will all be done automatically for you if you use a good code editor like Visual Studio Code. We create a command by doing:","position":{"start":{"line":25,"column":1,"offset":985},"end":{"line":25,"column":320,"offset":1304},"indent":[]}}],"position":{"start":{"line":25,"column":1,"offset":985},"end":{"line":25,"column":320,"offset":1304},"indent":[]}},{"type":"code","lang":"ts","meta":null,"value":"botCache.commands.set('commandname', {\n\n})","position":{"start":{"line":27,"column":1,"offset":1306},"end":{"line":31,"column":4,"offset":1358},"indent":[1,1,1,1]}},{"type":"paragraph","children":[{"type":"text","value":"The command name here must be unique. If it is not unique, your commands will not work properly as you wish. For example, you can't have 2 commands with the ","position":{"start":{"line":33,"column":1,"offset":1360},"end":{"line":33,"column":158,"offset":1517},"indent":[]}},{"type":"inlineCode","value":"ping","position":{"start":{"line":33,"column":158,"offset":1517},"end":{"line":33,"column":164,"offset":1523},"indent":[]}},{"type":"text","value":" name. In this case, our command is called ","position":{"start":{"line":33,"column":164,"offset":1523},"end":{"line":33,"column":207,"offset":1566},"indent":[]}},{"type":"inlineCode","value":"invite","position":{"start":{"line":33,"column":207,"offset":1566},"end":{"line":33,"column":215,"offset":1574},"indent":[]}},{"type":"text","value":".","position":{"start":{"line":33,"column":215,"offset":1574},"end":{"line":33,"column":216,"offset":1575},"indent":[]}}],"position":{"start":{"line":33,"column":1,"offset":1360},"end":{"line":33,"column":216,"offset":1575},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"The ","position":{"start":{"line":35,"column":1,"offset":1577},"end":{"line":35,"column":5,"offset":1581},"indent":[]}},{"type":"inlineCode","value":"name: 'invite'","position":{"start":{"line":35,"column":5,"offset":1581},"end":{"line":35,"column":21,"offset":1597},"indent":[]}},{"type":"text","value":" is also written as it is useful for our help command and inhibitors! Normally, these two things will be the same. So far it's super easy right.","position":{"start":{"line":35,"column":21,"offset":1597},"end":{"line":35,"column":165,"offset":1741},"indent":[]}}],"position":{"start":{"line":35,"column":1,"offset":1577},"end":{"line":35,"column":165,"offset":1741},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"Next is the ","position":{"start":{"line":37,"column":1,"offset":1743},"end":{"line":37,"column":13,"offset":1755},"indent":[]}},{"type":"inlineCode","value":"execute","position":{"start":{"line":37,"column":13,"offset":1755},"end":{"line":37,"column":22,"offset":1764},"indent":[]}},{"type":"text","value":". This is where the magic happens. This is the function that is triggered when the command is ran by a user. In this case, the bot simply sends a message to a channel where the command was ran and sends an invite link. Let's take a minute and optimize this for our case. We don't ","position":{"start":{"line":37,"column":22,"offset":1764},"end":{"line":37,"column":302,"offset":2044},"indent":[]}},{"type":"strong","children":[{"type":"text","value":"NEED","position":{"start":{"line":37,"column":304,"offset":2046},"end":{"line":37,"column":308,"offset":2050},"indent":[]}}],"position":{"start":{"line":37,"column":302,"offset":2044},"end":{"line":37,"column":310,"offset":2052},"indent":[]}},{"type":"text","value":" admin permissions for our bot. Let's go to the ","position":{"start":{"line":37,"column":310,"offset":2052},"end":{"line":37,"column":358,"offset":2100},"indent":[]}},{"type":"link","title":null,"url":"https://discordapi.com/permissions.html#0","children":[{"type":"text","value":"permission calculator","position":{"start":{"line":37,"column":359,"offset":2101},"end":{"line":37,"column":380,"offset":2122},"indent":[]}}],"position":{"start":{"line":37,"column":358,"offset":2100},"end":{"line":37,"column":424,"offset":2166},"indent":[]}},{"type":"text","value":" and figure out the permissions we need for our bot.","position":{"start":{"line":37,"column":424,"offset":2166},"end":{"line":37,"column":476,"offset":2218},"indent":[]}}],"position":{"start":{"line":37,"column":1,"offset":1743},"end":{"line":37,"column":476,"offset":2218},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"Once you have decided which permissions you want to request, you can copy the number and replace it here. For example, if we want ","position":{"start":{"line":39,"column":1,"offset":2220},"end":{"line":39,"column":131,"offset":2350},"indent":[]}},{"type":"inlineCode","value":"68640","position":{"start":{"line":39,"column":131,"offset":2350},"end":{"line":39,"column":138,"offset":2357},"indent":[]}},{"type":"text","value":" as our permissions. We can modify our command to be:","position":{"start":{"line":39,"column":138,"offset":2357},"end":{"line":39,"column":191,"offset":2410},"indent":[]}}],"position":{"start":{"line":39,"column":1,"offset":2220},"end":{"line":39,"column":191,"offset":2410},"indent":[]}},{"type":"code","lang":"ts","meta":null,"value":"\t`https://discordapp.com/oauth2/authorize?client_id=${botID}&scope=bot&permissions=68640`,","position":{"start":{"line":42,"column":1,"offset":2413},"end":{"line":44,"column":4,"offset":2513},"indent":[1,1]}},{"type":"paragraph","children":[{"type":"text","value":"Lastly, let's get rid of the comment there as now it is customized to our needs.","position":{"start":{"line":46,"column":1,"offset":2515},"end":{"line":46,"column":81,"offset":2595},"indent":[]}}],"position":{"start":{"line":46,"column":1,"offset":2515},"end":{"line":46,"column":81,"offset":2595},"indent":[]}},{"type":"heading","depth":3,"children":[{"type":"text","value":"Command Descriptions","position":{"start":{"line":48,"column":5,"offset":2601},"end":{"line":48,"column":25,"offset":2621},"indent":[]}}],"position":{"start":{"line":48,"column":1,"offset":2597},"end":{"line":48,"column":25,"offset":2621},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"Right now, if you were to go to Discord and type ","position":{"start":{"line":50,"column":1,"offset":2623},"end":{"line":50,"column":50,"offset":2672},"indent":[]}},{"type":"inlineCode","value":"!help invite","position":{"start":{"line":50,"column":50,"offset":2672},"end":{"line":50,"column":64,"offset":2686},"indent":[]}},{"type":"text","value":", you would see quite a bit of information. But where does all that text come from? It's not in this file. The description option tells Discordeno what to show the user when they use the help command. In that help message, each command has a small description next to it. The magic is happening because of Discordeno's translations feature.","position":{"start":{"line":50,"column":64,"offset":2686},"end":{"line":50,"column":404,"offset":3026},"indent":[]}}],"position":{"start":{"line":50,"column":1,"offset":2623},"end":{"line":50,"column":404,"offset":3026},"indent":[]}},{"type":"blockquote","children":[{"type":"paragraph","children":[{"type":"text","value":"Discordeno has built in multi-lingual support. You can support as many languages as you wish. We will learn more about languages when we create our own language but for now we just want to see how to customize the command. What we are going to do below isn't the correct way but it's the easy way to learn. We will see the correct way to do it when we get to translations.","position":{"start":{"line":52,"column":3,"offset":3030},"end":{"line":52,"column":375,"offset":3402},"indent":[]}}],"position":{"start":{"line":52,"column":3,"offset":3030},"end":{"line":52,"column":375,"offset":3402},"indent":[]}}],"position":{"start":{"line":52,"column":1,"offset":3028},"end":{"line":52,"column":375,"offset":3402},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"Let's add a custom description to our invite command.","position":{"start":{"line":54,"column":1,"offset":3404},"end":{"line":54,"column":54,"offset":3457},"indent":[]}}],"position":{"start":{"line":54,"column":1,"offset":3404},"end":{"line":54,"column":54,"offset":3457},"indent":[]}},{"type":"code","lang":"ts","meta":null,"value":"\tname: \"invite\",\n\tdescription: \"Like the bot? Use this link to add it to your server!\"","position":{"start":{"line":56,"column":1,"offset":3459},"end":{"line":59,"column":4,"offset":3555},"indent":[1,1,1]}},{"type":"paragraph","children":[{"type":"text","value":"🎉 It's that simple. So let's restart the bot and see how it changed. Use ","position":{"start":{"line":61,"column":1,"offset":3557},"end":{"line":61,"column":75,"offset":3631},"indent":[]}},{"type":"strong","children":[{"type":"text","value":"CTRL + C","position":{"start":{"line":61,"column":77,"offset":3633},"end":{"line":61,"column":85,"offset":3641},"indent":[]}}],"position":{"start":{"line":61,"column":75,"offset":3631},"end":{"line":61,"column":87,"offset":3643},"indent":[]}},{"type":"text","value":" to shut down the bot. Then run the command from earlier.","position":{"start":{"line":61,"column":87,"offset":3643},"end":{"line":61,"column":144,"offset":3700},"indent":[]}}],"position":{"start":{"line":61,"column":1,"offset":3557},"end":{"line":61,"column":144,"offset":3700},"indent":[]}},{"type":"code","lang":"shell","meta":null,"value":"deno run --allow-net --allow-read mod.ts","position":{"start":{"line":63,"column":1,"offset":3702},"end":{"line":65,"column":4,"offset":3755},"indent":[1,1]}},{"type":"paragraph","children":[{"type":"text","value":"To access this easily, most likely all you need to do is press the ","position":{"start":{"line":67,"column":1,"offset":3757},"end":{"line":67,"column":68,"offset":3824},"indent":[]}},{"type":"strong","children":[{"type":"text","value":"UP ARROW","position":{"start":{"line":67,"column":70,"offset":3826},"end":{"line":67,"column":78,"offset":3834},"indent":[]}}],"position":{"start":{"line":67,"column":68,"offset":3824},"end":{"line":67,"column":80,"offset":3836},"indent":[]}},{"type":"text","value":" key. Feel free to copy paste this if it doesn't work.","position":{"start":{"line":67,"column":80,"offset":3836},"end":{"line":67,"column":134,"offset":3890},"indent":[]}}],"position":{"start":{"line":67,"column":1,"offset":3757},"end":{"line":67,"column":134,"offset":3890},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"Once the bot is started try ","position":{"start":{"line":69,"column":1,"offset":3892},"end":{"line":69,"column":29,"offset":3920},"indent":[]}},{"type":"inlineCode","value":"!help invite","position":{"start":{"line":69,"column":29,"offset":3920},"end":{"line":69,"column":43,"offset":3934},"indent":[]}},{"type":"text","value":" again and you will see the change! 🎉","position":{"start":{"line":69,"column":43,"offset":3934},"end":{"line":69,"column":81,"offset":3972},"indent":[]}}],"position":{"start":{"line":69,"column":1,"offset":3892},"end":{"line":69,"column":81,"offset":3972},"indent":[]}},{"type":"heading","depth":2,"children":[{"type":"text","value":"Command Aliases","position":{"start":{"line":71,"column":4,"offset":3977},"end":{"line":71,"column":19,"offset":3992},"indent":[]}}],"position":{"start":{"line":71,"column":1,"offset":3974},"end":{"line":71,"column":19,"offset":3992},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"Now, let's make this a little bit easier. What if we wanted this command to also work with other names besides ","position":{"start":{"line":73,"column":1,"offset":3994},"end":{"line":73,"column":112,"offset":4105},"indent":[]}},{"type":"inlineCode","value":"invite","position":{"start":{"line":73,"column":112,"offset":4105},"end":{"line":73,"column":120,"offset":4113},"indent":[]}},{"type":"text","value":". For example, as a shortcut what if users could just type ","position":{"start":{"line":73,"column":120,"offset":4113},"end":{"line":73,"column":179,"offset":4172},"indent":[]}},{"type":"inlineCode","value":"!inv","position":{"start":{"line":73,"column":179,"offset":4172},"end":{"line":73,"column":185,"offset":4178},"indent":[]}},{"type":"text","value":" or as an alias type ","position":{"start":{"line":73,"column":185,"offset":4178},"end":{"line":73,"column":206,"offset":4199},"indent":[]}},{"type":"inlineCode","value":"!join","position":{"start":{"line":73,"column":206,"offset":4199},"end":{"line":73,"column":213,"offset":4206},"indent":[]}},{"type":"text","value":". Let's go ahead and set that up. Go to the very last line of invite command file and type in ","position":{"start":{"line":73,"column":213,"offset":4206},"end":{"line":73,"column":307,"offset":4300},"indent":[]}},{"type":"inlineCode","value":"alias","position":{"start":{"line":73,"column":307,"offset":4300},"end":{"line":73,"column":314,"offset":4307},"indent":[]}},{"type":"text","value":". You will see a popup showing you an autocompleted version of ","position":{"start":{"line":73,"column":314,"offset":4307},"end":{"line":73,"column":377,"offset":4370},"indent":[]}},{"type":"inlineCode","value":"createCommandAliases","position":{"start":{"line":73,"column":377,"offset":4370},"end":{"line":73,"column":399,"offset":4392},"indent":[]}},{"type":"text","value":". Press enter and boom the magic is happening!","position":{"start":{"line":73,"column":399,"offset":4392},"end":{"line":73,"column":445,"offset":4438},"indent":[]}}],"position":{"start":{"line":73,"column":1,"offset":3994},"end":{"line":73,"column":445,"offset":4438},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"The createCommandAliases takes in two arguments. The first argument is always the command name. In this case it is ","position":{"start":{"line":75,"column":1,"offset":4440},"end":{"line":75,"column":116,"offset":4555},"indent":[]}},{"type":"inlineCode","value":"invite","position":{"start":{"line":75,"column":116,"offset":4555},"end":{"line":75,"column":124,"offset":4563},"indent":[]}},{"type":"text","value":". The second argument is the aliases you want to provide. Let's add in the two aliases we wanted.","position":{"start":{"line":75,"column":124,"offset":4563},"end":{"line":75,"column":221,"offset":4660},"indent":[]}}],"position":{"start":{"line":75,"column":1,"offset":4440},"end":{"line":75,"column":221,"offset":4660},"indent":[]}},{"type":"code","lang":"ts","meta":null,"value":" `https://discordapp.com/oauth2/authorize?client_id=${botID}&scope=bot&permissions=68640`,\n );\n },\n});\n\ncreateCommandAliases('invite', ['inv', 'join'])","position":{"start":{"line":77,"column":1,"offset":4662},"end":{"line":84,"column":4,"offset":4827},"indent":[1,1,1,1,1,1,1]}},{"type":"blockquote","children":[{"type":"paragraph","children":[{"type":"strong","children":[{"type":"text","value":"Note:","position":{"start":{"line":86,"column":5,"offset":4833},"end":{"line":86,"column":10,"offset":4838},"indent":[]}}],"position":{"start":{"line":86,"column":3,"offset":4831},"end":{"line":86,"column":12,"offset":4840},"indent":[]}},{"type":"text","value":" If you only want to add 1 alias, you can pass in a simple string instead of an array as well as the second argument.","position":{"start":{"line":86,"column":12,"offset":4840},"end":{"line":86,"column":129,"offset":4957},"indent":[]}}],"position":{"start":{"line":86,"column":3,"offset":4831},"end":{"line":86,"column":129,"offset":4957},"indent":[]}}],"position":{"start":{"line":86,"column":1,"offset":4829},"end":{"line":86,"column":129,"offset":4957},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"Notice, I added 2 aliases here. You can add as many aliases as you like. If you see a lot of users typing it wrong by accident you can add those typos as aliases as well.","position":{"start":{"line":88,"column":1,"offset":4959},"end":{"line":88,"column":171,"offset":5129},"indent":[]}}],"position":{"start":{"line":88,"column":1,"offset":4959},"end":{"line":88,"column":171,"offset":5129},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"Let's start testing this out. But first, let's understand something important.","position":{"start":{"line":90,"column":1,"offset":5131},"end":{"line":90,"column":79,"offset":5209},"indent":[]}}],"position":{"start":{"line":90,"column":1,"offset":5131},"end":{"line":90,"column":79,"offset":5209},"indent":[]}},{"type":"heading","depth":2,"children":[{"type":"text","value":"Reloading","position":{"start":{"line":92,"column":4,"offset":5214},"end":{"line":92,"column":13,"offset":5223},"indent":[]}}],"position":{"start":{"line":92,"column":1,"offset":5211},"end":{"line":92,"column":13,"offset":5223},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"Okay, we need to first understand a core concept of developing discord bots. If you had to restart your bot every time you made a tiny change, it would get really annoying/tedious to do. Also, if you had restarted your bot 1000 times, you would be in big trouble because Discord would ban your bot for 24 hours. The bigger your bot gets, the faster it is to hit this limit of 1000 identify calls to the Discord API.","position":{"start":{"line":94,"column":1,"offset":5225},"end":{"line":94,"column":416,"offset":5640},"indent":[]}}],"position":{"start":{"line":94,"column":1,"offset":5225},"end":{"line":94,"column":416,"offset":5640},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"To solve this issue, Discordeno provides you with a really cool ","position":{"start":{"line":96,"column":1,"offset":5642},"end":{"line":96,"column":65,"offset":5706},"indent":[]}},{"type":"inlineCode","value":"reload","position":{"start":{"line":96,"column":65,"offset":5706},"end":{"line":96,"column":73,"offset":5714},"indent":[]}},{"type":"text","value":" command. Whenever you make a change to any command, event, monitor, inhibitor, task, language or argument you can simply reload it. You don't need to restart your bot every time.","position":{"start":{"line":96,"column":73,"offset":5714},"end":{"line":96,"column":252,"offset":5893},"indent":[]}}],"position":{"start":{"line":96,"column":1,"offset":5642},"end":{"line":96,"column":252,"offset":5893},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"Now since we added the aliases above, let's test it out.","position":{"start":{"line":98,"column":1,"offset":5895},"end":{"line":98,"column":57,"offset":5951},"indent":[]}}],"position":{"start":{"line":98,"column":1,"offset":5895},"end":{"line":98,"column":57,"offset":5951},"indent":[]}},{"type":"list","ordered":true,"start":1,"spread":false,"children":[{"type":"listItem","spread":false,"checked":null,"children":[{"type":"paragraph","children":[{"type":"inlineCode","value":"!inv","position":{"start":{"line":100,"column":4,"offset":5956},"end":{"line":100,"column":10,"offset":5962},"indent":[]}},{"type":"text","value":" this will not work","position":{"start":{"line":100,"column":10,"offset":5962},"end":{"line":100,"column":29,"offset":5981},"indent":[]}}],"position":{"start":{"line":100,"column":4,"offset":5956},"end":{"line":100,"column":29,"offset":5981},"indent":[]}}],"position":{"start":{"line":100,"column":1,"offset":5953},"end":{"line":100,"column":29,"offset":5981},"indent":[]}},{"type":"listItem","spread":false,"checked":null,"children":[{"type":"paragraph","children":[{"type":"inlineCode","value":"!reload commands","position":{"start":{"line":101,"column":4,"offset":5985},"end":{"line":101,"column":22,"offset":6003},"indent":[]}},{"type":"text","value":" this will reload the files and the aliases will be created.","position":{"start":{"line":101,"column":22,"offset":6003},"end":{"line":101,"column":82,"offset":6063},"indent":[]}}],"position":{"start":{"line":101,"column":4,"offset":5985},"end":{"line":101,"column":82,"offset":6063},"indent":[]}}],"position":{"start":{"line":101,"column":1,"offset":5982},"end":{"line":101,"column":82,"offset":6063},"indent":[]}},{"type":"listItem","spread":false,"checked":null,"children":[{"type":"paragraph","children":[{"type":"inlineCode","value":"!inv","position":{"start":{"line":102,"column":4,"offset":6067},"end":{"line":102,"column":10,"offset":6073},"indent":[]}},{"type":"text","value":" This will now work. 🎉","position":{"start":{"line":102,"column":10,"offset":6073},"end":{"line":102,"column":33,"offset":6096},"indent":[]}}],"position":{"start":{"line":102,"column":4,"offset":6067},"end":{"line":102,"column":33,"offset":6096},"indent":[]}}],"position":{"start":{"line":102,"column":1,"offset":6064},"end":{"line":102,"column":33,"offset":6096},"indent":[]}}],"position":{"start":{"line":100,"column":1,"offset":5953},"end":{"line":102,"column":33,"offset":6096},"indent":[1,1]}},{"type":"thematicBreak","position":{"start":{"line":104,"column":1,"offset":6098},"end":{"line":104,"column":4,"offset":6101},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"Perfect! You can take some time and customize the invite command to your needs if you wish. For example, this is my bot's invite command.","position":{"start":{"line":106,"column":1,"offset":6103},"end":{"line":106,"column":138,"offset":6240},"indent":[]}}],"position":{"start":{"line":106,"column":1,"offset":6103},"end":{"line":106,"column":138,"offset":6240},"indent":[]}},{"type":"paragraph","children":[{"type":"image","title":null,"url":"https://i.imgur.com/4WRFMtR.png","alt":"image","position":{"start":{"line":108,"column":1,"offset":6242},"end":{"line":108,"column":42,"offset":6283},"indent":[]}}],"position":{"start":{"line":108,"column":1,"offset":6242},"end":{"line":108,"column":42,"offset":6283},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"Nice! You can now customize any of the commands from Discordeno as you wish. Then we will continue to making our very own command so we can learn about all the options that Discordeno gives us when it comes to making commands. As you learn more in this guide, you can keep improving it.","position":{"start":{"line":110,"column":1,"offset":6285},"end":{"line":110,"column":287,"offset":6571},"indent":[]}}],"position":{"start":{"line":110,"column":1,"offset":6285},"end":{"line":110,"column":287,"offset":6571},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"If you get stuck, don't worry. When you are ready, let's continue to the next step.","position":{"start":{"line":112,"column":1,"offset":6573},"end":{"line":112,"column":84,"offset":6656},"indent":[]}}],"position":{"start":{"line":112,"column":1,"offset":6573},"end":{"line":112,"column":84,"offset":6656},"indent":[]}},{"type":"heading","depth":2,"children":[{"type":"text","value":"Creating A Command","position":{"start":{"line":114,"column":4,"offset":6661},"end":{"line":114,"column":22,"offset":6679},"indent":[]}}],"position":{"start":{"line":114,"column":1,"offset":6658},"end":{"line":114,"column":22,"offset":6679},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"Let's make a command that will allow guild admins to give or take roles from a member. Since, we are creating a ","position":{"start":{"line":116,"column":1,"offset":6681},"end":{"line":116,"column":113,"offset":6793},"indent":[]}},{"type":"inlineCode","value":"Moderation","position":{"start":{"line":116,"column":113,"offset":6793},"end":{"line":116,"column":125,"offset":6805},"indent":[]}},{"type":"text","value":" command to give or take roles, let's go ahead and create a Category folder called ","position":{"start":{"line":116,"column":125,"offset":6805},"end":{"line":116,"column":208,"offset":6888},"indent":[]}},{"type":"inlineCode","value":"Moderation","position":{"start":{"line":116,"column":208,"offset":6888},"end":{"line":116,"column":220,"offset":6900},"indent":[]}},{"type":"text","value":" and then create a file called ","position":{"start":{"line":116,"column":220,"offset":6900},"end":{"line":116,"column":251,"offset":6931},"indent":[]}},{"type":"inlineCode","value":"role.ts","position":{"start":{"line":116,"column":251,"offset":6931},"end":{"line":116,"column":260,"offset":6940},"indent":[]}},{"type":"text","value":". Once the file is made, you can paste this following base snippet to make our first command.","position":{"start":{"line":116,"column":260,"offset":6940},"end":{"line":116,"column":353,"offset":7033},"indent":[]}}],"position":{"start":{"line":116,"column":1,"offset":6681},"end":{"line":116,"column":353,"offset":7033},"indent":[]}},{"type":"code","lang":"ts","meta":null,"value":"import { botCache } from \"../../mod.ts\";\nimport { sendMessage } from \"https://raw.githubusercontent.com/Skillz4Killz/Discordeno/v7/src/handlers/channel.ts\";\nimport { PermissionLevels } from \"../types/commands.ts\";\nimport { createCommandAliases } from \"../utils/helpers\";\n\nbotCache.commands.set(\"commandname\", {\n name: \"commandname\",\n dmOnly: false,\n guildOnly: false,\n nsfw: false,\n permissionLevel: [PermissionLevels.MEMBER],\n botServerPermissions: [],\n botChannelPermissions: [],\n userServerPermissions: [],\n userChannelPermissions: [],\n description: string,\n cooldown: {\n seconds: 0,\n allowedUses: 0,\n },\n arguments: [],\n execute: function (message, args, guild) {\n // The code for your command goes here\n }\n});\n\n// createCommandAliases(\"commandname\", [\"alias\"])","position":{"start":{"line":118,"column":1,"offset":7035},"end":{"line":146,"column":4,"offset":7832},"indent":[1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1]}},{"type":"heading","depth":2,"children":[{"type":"text","value":"Understanding Command Options","position":{"start":{"line":148,"column":4,"offset":7837},"end":{"line":148,"column":33,"offset":7866},"indent":[]}}],"position":{"start":{"line":148,"column":1,"offset":7834},"end":{"line":148,"column":33,"offset":7866},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"Woah! We just added a massive file but most of that stuff is new to us. Don't worry, let's break everything down step by step.","position":{"start":{"line":150,"column":1,"offset":7868},"end":{"line":150,"column":127,"offset":7994},"indent":[]}}],"position":{"start":{"line":150,"column":1,"offset":7868},"end":{"line":150,"column":127,"offset":7994},"indent":[]}},{"type":"blockquote","children":[{"type":"paragraph","children":[{"type":"strong","children":[{"type":"text","value":"Note:","position":{"start":{"line":152,"column":5,"offset":8000},"end":{"line":152,"column":10,"offset":8005},"indent":[]}}],"position":{"start":{"line":152,"column":3,"offset":7998},"end":{"line":152,"column":12,"offset":8007},"indent":[]}},{"type":"text","value":" Any options that are not changed from the snippet above can actually be deleted as Discordeno will use the default option if you do not provide anything for that option. This can help keep your files cleaner.","position":{"start":{"line":152,"column":12,"offset":8007},"end":{"line":152,"column":221,"offset":8216},"indent":[]}}],"position":{"start":{"line":152,"column":3,"offset":7998},"end":{"line":152,"column":221,"offset":8216},"indent":[]}}],"position":{"start":{"line":152,"column":1,"offset":7996},"end":{"line":152,"column":221,"offset":8216},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"Before we start, quickly update the command name and description.","position":{"start":{"line":154,"column":1,"offset":8218},"end":{"line":154,"column":66,"offset":8283},"indent":[]}}],"position":{"start":{"line":154,"column":1,"offset":8218},"end":{"line":154,"column":66,"offset":8283},"indent":[]}},{"type":"blockquote","children":[{"type":"paragraph","children":[{"type":"strong","children":[{"type":"text","value":"Note:","position":{"start":{"line":156,"column":5,"offset":8289},"end":{"line":156,"column":10,"offset":8294},"indent":[]}}],"position":{"start":{"line":156,"column":3,"offset":8287},"end":{"line":156,"column":12,"offset":8296},"indent":[]}},{"type":"text","value":" Once you highlight the ","position":{"start":{"line":156,"column":12,"offset":8296},"end":{"line":156,"column":36,"offset":8320},"indent":[]}},{"type":"inlineCode","value":"commandname","position":{"start":{"line":156,"column":36,"offset":8320},"end":{"line":156,"column":49,"offset":8333},"indent":[]}},{"type":"text","value":", press ","position":{"start":{"line":156,"column":49,"offset":8333},"end":{"line":156,"column":57,"offset":8341},"indent":[]}},{"type":"strong","children":[{"type":"text","value":"CTRL + SHIFT + L","position":{"start":{"line":156,"column":59,"offset":8343},"end":{"line":156,"column":75,"offset":8359},"indent":[]}}],"position":{"start":{"line":156,"column":57,"offset":8341},"end":{"line":156,"column":77,"offset":8361},"indent":[]}},{"type":"text","value":" to select ALL the ","position":{"start":{"line":156,"column":77,"offset":8361},"end":{"line":156,"column":96,"offset":8380},"indent":[]}},{"type":"inlineCode","value":"commandname","position":{"start":{"line":156,"column":96,"offset":8380},"end":{"line":156,"column":109,"offset":8393},"indent":[]}},{"type":"text","value":" on the file and you can easily replace them at once. Another useful shortcut you may use when coding your bot is ","position":{"start":{"line":156,"column":109,"offset":8393},"end":{"line":156,"column":223,"offset":8507},"indent":[]}},{"type":"strong","children":[{"type":"text","value":"CTRL + D","position":{"start":{"line":156,"column":225,"offset":8509},"end":{"line":156,"column":233,"offset":8517},"indent":[]}}],"position":{"start":{"line":156,"column":223,"offset":8507},"end":{"line":156,"column":235,"offset":8519},"indent":[]}},{"type":"text","value":" after highlighting. This shortcut selects the next place where the same text exists as thing in the file that has the same thing as you highlighted.","position":{"start":{"line":156,"column":235,"offset":8519},"end":{"line":156,"column":385,"offset":8669},"indent":[]}}],"position":{"start":{"line":156,"column":3,"offset":8287},"end":{"line":156,"column":385,"offset":8669},"indent":[]}}],"position":{"start":{"line":156,"column":1,"offset":8285},"end":{"line":156,"column":385,"offset":8669},"indent":[]}},{"type":"heading","depth":2,"children":[{"type":"text","value":"dmOnly & guildOnly Options","position":{"start":{"line":158,"column":4,"offset":8674},"end":{"line":158,"column":30,"offset":8700},"indent":[]}}],"position":{"start":{"line":158,"column":1,"offset":8671},"end":{"line":158,"column":30,"offset":8700},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"The ","position":{"start":{"line":160,"column":1,"offset":8702},"end":{"line":160,"column":5,"offset":8706},"indent":[]}},{"type":"inlineCode","value":"dmOnly","position":{"start":{"line":160,"column":5,"offset":8706},"end":{"line":160,"column":13,"offset":8714},"indent":[]}},{"type":"text","value":" option is available if you want to make sure this command only runs in a direct message. If this command is ran in a server, the command will immediately exit out.","position":{"start":{"line":160,"column":13,"offset":8714},"end":{"line":160,"column":177,"offset":8878},"indent":[]}}],"position":{"start":{"line":160,"column":1,"offset":8702},"end":{"line":160,"column":177,"offset":8878},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"On the other hand, ","position":{"start":{"line":162,"column":1,"offset":8880},"end":{"line":162,"column":20,"offset":8899},"indent":[]}},{"type":"inlineCode","value":"guildOnly","position":{"start":{"line":162,"column":20,"offset":8899},"end":{"line":162,"column":31,"offset":8910},"indent":[]}},{"type":"text","value":" is the opposite. To easily make sure that this command is never allowed in a private message you can simple enable this.","position":{"start":{"line":162,"column":31,"offset":8910},"end":{"line":162,"column":152,"offset":9031},"indent":[]}}],"position":{"start":{"line":162,"column":1,"offset":8880},"end":{"line":162,"column":152,"offset":9031},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"If you want to allow a command to be able to run both in a server and in a direct message, simply set them both to false.","position":{"start":{"line":164,"column":1,"offset":9033},"end":{"line":164,"column":122,"offset":9154},"indent":[]}}],"position":{"start":{"line":164,"column":1,"offset":9033},"end":{"line":164,"column":122,"offset":9154},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"Remember if you want either of them as false, you can simply delete them and it will default to ","position":{"start":{"line":166,"column":1,"offset":9156},"end":{"line":166,"column":97,"offset":9252},"indent":[]}},{"type":"inlineCode","value":"false","position":{"start":{"line":166,"column":97,"offset":9252},"end":{"line":166,"column":104,"offset":9259},"indent":[]}},{"type":"text","value":" allowing your bot to be cleaner and easier to read. However, if your prefer keeping it you can.","position":{"start":{"line":166,"column":104,"offset":9259},"end":{"line":166,"column":200,"offset":9355},"indent":[]}}],"position":{"start":{"line":166,"column":1,"offset":9156},"end":{"line":166,"column":200,"offset":9355},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"For the purpose of this guide, we want our ","position":{"start":{"line":168,"column":1,"offset":9357},"end":{"line":168,"column":44,"offset":9400},"indent":[]}},{"type":"inlineCode","value":"role","position":{"start":{"line":168,"column":44,"offset":9400},"end":{"line":168,"column":50,"offset":9406},"indent":[]}},{"type":"text","value":" comamnd to only be run in a server, so we can set ","position":{"start":{"line":168,"column":50,"offset":9406},"end":{"line":168,"column":101,"offset":9457},"indent":[]}},{"type":"inlineCode","value":"guildOnly","position":{"start":{"line":168,"column":101,"offset":9457},"end":{"line":168,"column":112,"offset":9468},"indent":[]}},{"type":"text","value":" to be ","position":{"start":{"line":168,"column":112,"offset":9468},"end":{"line":168,"column":119,"offset":9475},"indent":[]}},{"type":"strong","children":[{"type":"text","value":"true","position":{"start":{"line":168,"column":121,"offset":9477},"end":{"line":168,"column":125,"offset":9481},"indent":[]}}],"position":{"start":{"line":168,"column":119,"offset":9475},"end":{"line":168,"column":127,"offset":9483},"indent":[]}},{"type":"text","value":" and delete the ","position":{"start":{"line":168,"column":127,"offset":9483},"end":{"line":168,"column":143,"offset":9499},"indent":[]}},{"type":"inlineCode","value":"dmOnly","position":{"start":{"line":168,"column":143,"offset":9499},"end":{"line":168,"column":151,"offset":9507},"indent":[]}},{"type":"text","value":" option.","position":{"start":{"line":168,"column":151,"offset":9507},"end":{"line":168,"column":159,"offset":9515},"indent":[]}}],"position":{"start":{"line":168,"column":1,"offset":9357},"end":{"line":168,"column":159,"offset":9515},"indent":[]}},{"type":"heading","depth":2,"children":[{"type":"text","value":"NSFW Option","position":{"start":{"line":170,"column":4,"offset":9520},"end":{"line":170,"column":15,"offset":9531},"indent":[]}}],"position":{"start":{"line":170,"column":1,"offset":9517},"end":{"line":170,"column":15,"offset":9531},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"NSFW stands for ","position":{"start":{"line":172,"column":1,"offset":9533},"end":{"line":172,"column":17,"offset":9549},"indent":[]}},{"type":"strong","children":[{"type":"text","value":"Not Safe For Work","position":{"start":{"line":172,"column":19,"offset":9551},"end":{"line":172,"column":36,"offset":9568},"indent":[]}}],"position":{"start":{"line":172,"column":17,"offset":9549},"end":{"line":172,"column":38,"offset":9570},"indent":[]}},{"type":"text","value":". One of Discord's rules is that you enforce that NSFW content is sent only in NSFW channels. Discordeno has this built in. You simple tell Discordeno, that you want a command to be considered ","position":{"start":{"line":172,"column":38,"offset":9570},"end":{"line":172,"column":231,"offset":9763},"indent":[]}},{"type":"inlineCode","value":"nsfw","position":{"start":{"line":172,"column":231,"offset":9763},"end":{"line":172,"column":237,"offset":9769},"indent":[]}},{"type":"text","value":" or not.","position":{"start":{"line":172,"column":237,"offset":9769},"end":{"line":172,"column":245,"offset":9777},"indent":[]}}],"position":{"start":{"line":172,"column":1,"offset":9533},"end":{"line":172,"column":245,"offset":9777},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"If this option is enabled, this command will only be able to be used in a ","position":{"start":{"line":174,"column":1,"offset":9779},"end":{"line":174,"column":75,"offset":9853},"indent":[]}},{"type":"inlineCode","value":"nsfw","position":{"start":{"line":174,"column":75,"offset":9853},"end":{"line":174,"column":81,"offset":9859},"indent":[]}},{"type":"text","value":" channel on a server. Discord does not consider Direct Messages as nsfw safe!","position":{"start":{"line":174,"column":81,"offset":9859},"end":{"line":174,"column":158,"offset":9936},"indent":[]}}],"position":{"start":{"line":174,"column":1,"offset":9779},"end":{"line":174,"column":158,"offset":9936},"indent":[]}},{"type":"heading","depth":2,"children":[{"type":"text","value":"Permission Level Option","position":{"start":{"line":176,"column":4,"offset":9941},"end":{"line":176,"column":27,"offset":9964},"indent":[]}}],"position":{"start":{"line":176,"column":1,"offset":9938},"end":{"line":176,"column":27,"offset":9964},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"Permission levels are a very powerful feature that easily allow you to set what permission is required to run a command. We will cover this in detail, in a separate section dedicated to permission levels. For now, just understand that this will restrict certain users from using a command.","position":{"start":{"line":178,"column":1,"offset":9966},"end":{"line":178,"column":290,"offset":10255},"indent":[]}}],"position":{"start":{"line":178,"column":1,"offset":9966},"end":{"line":178,"column":290,"offset":10255},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"For example, the role command we only want to be used by moderators or server admins.","position":{"start":{"line":180,"column":1,"offset":10257},"end":{"line":180,"column":86,"offset":10342},"indent":[]}}],"position":{"start":{"line":180,"column":1,"offset":10257},"end":{"line":180,"column":86,"offset":10342},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"Discordeno makes this pretty simple for us.","position":{"start":{"line":182,"column":1,"offset":10344},"end":{"line":182,"column":44,"offset":10387},"indent":[]}}],"position":{"start":{"line":182,"column":1,"offset":10344},"end":{"line":182,"column":44,"offset":10387},"indent":[]}},{"type":"code","lang":"ts","meta":null,"value":"permissionLevels: [PermissionLevels.MODERATOR, PermissionLevels.ADMIN]","position":{"start":{"line":184,"column":1,"offset":10389},"end":{"line":186,"column":4,"offset":10469},"indent":[1,1]}},{"type":"paragraph","children":[{"type":"text","value":"We're not going to cover this in detail, here because we will have an entire in depth guide for permission levels. If you want to pause and learn it now, feel free: ","position":{"start":{"line":188,"column":1,"offset":10471},"end":{"line":188,"column":166,"offset":10636},"indent":[]}},{"type":"link","title":null,"url":"https://discordeno.netlify.app/advanced/permlevels","children":[{"type":"text","value":"Permission Levels Advanced Guide","position":{"start":{"line":188,"column":167,"offset":10637},"end":{"line":188,"column":199,"offset":10669},"indent":[]}}],"position":{"start":{"line":188,"column":166,"offset":10636},"end":{"line":188,"column":252,"offset":10722},"indent":[]}}],"position":{"start":{"line":188,"column":1,"offset":10471},"end":{"line":188,"column":252,"offset":10722},"indent":[]}},{"type":"heading","depth":2,"children":[{"type":"text","value":"Permissions Check Options","position":{"start":{"line":190,"column":4,"offset":10727},"end":{"line":190,"column":29,"offset":10752},"indent":[]}}],"position":{"start":{"line":190,"column":1,"offset":10724},"end":{"line":190,"column":29,"offset":10752},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"Discordeno provides you 4 different types of permission handling that will be done before the command function is executed. This allows you to make sure that the permissions are available before running a command. For example, the role command will require the bot to have ","position":{"start":{"line":192,"column":1,"offset":10754},"end":{"line":192,"column":274,"offset":11027},"indent":[]}},{"type":"strong","children":[{"type":"text","value":"MANAGE ROLES","position":{"start":{"line":192,"column":276,"offset":11029},"end":{"line":192,"column":288,"offset":11041},"indent":[]}}],"position":{"start":{"line":192,"column":274,"offset":11027},"end":{"line":192,"column":290,"offset":11043},"indent":[]}},{"type":"text","value":" permission. This permission comes from the server settings so we can require this in the ","position":{"start":{"line":192,"column":290,"offset":11043},"end":{"line":192,"column":380,"offset":11133},"indent":[]}},{"type":"inlineCode","value":"botServerPermissions","position":{"start":{"line":192,"column":380,"offset":11133},"end":{"line":192,"column":402,"offset":11155},"indent":[]}},{"type":"text","value":".","position":{"start":{"line":192,"column":402,"offset":11155},"end":{"line":192,"column":403,"offset":11156},"indent":[]}}],"position":{"start":{"line":192,"column":1,"offset":10754},"end":{"line":192,"column":403,"offset":11156},"indent":[]}},{"type":"code","lang":"ts","meta":null,"value":"botServerPermissions: [\"MANAGE_ROLES\"],","position":{"start":{"line":194,"column":1,"offset":11158},"end":{"line":196,"column":4,"offset":11207},"indent":[1,1]}},{"type":"paragraph","children":[{"type":"text","value":"Discordeno will provide you easy to use auto-completion as soon as you type a single letter or two. This will help make it easier to use and will warn you when you make a typo and provide a wrong permission by accident.","position":{"start":{"line":198,"column":1,"offset":11209},"end":{"line":198,"column":220,"offset":11428},"indent":[]}}],"position":{"start":{"line":198,"column":1,"offset":11209},"end":{"line":198,"column":220,"offset":11428},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"We also want to make sure that the bot can send a message in this channel so that we can respond to the user. This will check the correct permission heirarchy to make sure that the bot can indeed send a message in this channel.","position":{"start":{"line":200,"column":1,"offset":11430},"end":{"line":200,"column":228,"offset":11657},"indent":[]}}],"position":{"start":{"line":200,"column":1,"offset":11430},"end":{"line":200,"column":228,"offset":11657},"indent":[]}},{"type":"code","lang":"ts","meta":null,"value":"botChannelPermissions: [\"SEND_MESSAGES\"],","position":{"start":{"line":202,"column":1,"offset":11659},"end":{"line":204,"column":4,"offset":11710},"indent":[1,1]}},{"type":"blockquote","children":[{"type":"paragraph","children":[{"type":"strong","children":[{"type":"text","value":"Note:","position":{"start":{"line":206,"column":5,"offset":11716},"end":{"line":206,"column":10,"offset":11721},"indent":[]}}],"position":{"start":{"line":206,"column":3,"offset":11714},"end":{"line":206,"column":12,"offset":11723},"indent":[]}},{"type":"text","value":" If you want to send an embed response, you should also make sure it has the ","position":{"start":{"line":206,"column":12,"offset":11723},"end":{"line":206,"column":89,"offset":11800},"indent":[]}},{"type":"inlineCode","value":"EMBED_LINKS","position":{"start":{"line":206,"column":89,"offset":11800},"end":{"line":206,"column":102,"offset":11813},"indent":[]}},{"type":"text","value":" permission.","position":{"start":{"line":206,"column":102,"offset":11813},"end":{"line":206,"column":114,"offset":11825},"indent":[]}}],"position":{"start":{"line":206,"column":3,"offset":11714},"end":{"line":206,"column":114,"offset":11825},"indent":[]}}],"position":{"start":{"line":206,"column":1,"offset":11712},"end":{"line":206,"column":114,"offset":11825},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"Already we have prevented two of the largest errors that can get our bot banned if it is not checked. Discordeno handles this internally so you don't have to worry about it.","position":{"start":{"line":208,"column":1,"offset":11827},"end":{"line":208,"column":174,"offset":12000},"indent":[]}}],"position":{"start":{"line":208,"column":1,"offset":11827},"end":{"line":208,"column":174,"offset":12000},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"Sometimes, you may also want to make sure that the user using the command has a certain permission to run the command. To do this, you can use the ","position":{"start":{"line":210,"column":1,"offset":12002},"end":{"line":210,"column":148,"offset":12149},"indent":[]}},{"type":"inlineCode","value":"userServerPermissions","position":{"start":{"line":210,"column":148,"offset":12149},"end":{"line":210,"column":171,"offset":12172},"indent":[]}},{"type":"text","value":" or the ","position":{"start":{"line":210,"column":171,"offset":12172},"end":{"line":210,"column":179,"offset":12180},"indent":[]}},{"type":"inlineCode","value":"userChannelPermissions","position":{"start":{"line":210,"column":179,"offset":12180},"end":{"line":210,"column":203,"offset":12204},"indent":[]}},{"type":"text","value":".","position":{"start":{"line":210,"column":203,"offset":12204},"end":{"line":210,"column":204,"offset":12205},"indent":[]}}],"position":{"start":{"line":210,"column":1,"offset":12002},"end":{"line":210,"column":204,"offset":12205},"indent":[]}},{"type":"heading","depth":2,"children":[{"type":"text","value":"Cooldown Options","position":{"start":{"line":212,"column":4,"offset":12210},"end":{"line":212,"column":20,"offset":12226},"indent":[]}}],"position":{"start":{"line":212,"column":1,"offset":12207},"end":{"line":212,"column":20,"offset":12226},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"The cooldown options go hand in hand together.","position":{"start":{"line":214,"column":1,"offset":12228},"end":{"line":214,"column":47,"offset":12274},"indent":[]}}],"position":{"start":{"line":214,"column":1,"offset":12228},"end":{"line":214,"column":47,"offset":12274},"indent":[]}},{"type":"list","ordered":false,"start":null,"spread":false,"children":[{"type":"listItem","spread":false,"checked":null,"children":[{"type":"paragraph","children":[{"type":"inlineCode","value":"seconds","position":{"start":{"line":216,"column":3,"offset":12278},"end":{"line":216,"column":12,"offset":12287},"indent":[]}},{"type":"text","value":" is how long to make the user wait in seconds before they can use the command again. By default, there is no wait time aka 0 seconds.","position":{"start":{"line":216,"column":12,"offset":12287},"end":{"line":216,"column":145,"offset":12420},"indent":[]}}],"position":{"start":{"line":216,"column":3,"offset":12278},"end":{"line":216,"column":145,"offset":12420},"indent":[]}}],"position":{"start":{"line":216,"column":1,"offset":12276},"end":{"line":216,"column":145,"offset":12420},"indent":[]}},{"type":"listItem","spread":false,"checked":null,"children":[{"type":"paragraph","children":[{"type":"inlineCode","value":"allowedUses","position":{"start":{"line":217,"column":3,"offset":12423},"end":{"line":217,"column":16,"offset":12436},"indent":[]}},{"type":"text","value":" is how many times a user is allowed to use a command before they are placed on cooldown.","position":{"start":{"line":217,"column":16,"offset":12436},"end":{"line":217,"column":105,"offset":12525},"indent":[]}}],"position":{"start":{"line":217,"column":3,"offset":12423},"end":{"line":217,"column":105,"offset":12525},"indent":[]}}],"position":{"start":{"line":217,"column":1,"offset":12421},"end":{"line":217,"column":105,"offset":12525},"indent":[]}},{"type":"listItem","spread":false,"checked":null,"children":[{"type":"paragraph","children":[{"type":"text","value":"Let's use our command as an example. We don't want someone to start spamming the role command so we can add a cooldown of 60 seconds. However, this would mean every time you give a role to someone, you would need to wait a whole minute to give a role to someone else. This is where ","position":{"start":{"line":219,"column":1,"offset":12528},"end":{"line":219,"column":283,"offset":12810},"indent":[]}},{"type":"inlineCode","value":"allowedUses","position":{"start":{"line":219,"column":283,"offset":12810},"end":{"line":219,"column":296,"offset":12823},"indent":[]}},{"type":"text","value":" shines! Let's set it to to 5 so that a user can use this command 5 times in a row before being asked to wait for 60 seconds.","position":{"start":{"line":219,"column":296,"offset":12823},"end":{"line":219,"column":421,"offset":12948},"indent":[]}}],"position":{"start":{"line":219,"column":1,"offset":12528},"end":{"line":219,"column":421,"offset":12948},"indent":[]}}],"position":{"start":{"line":218,"column":1,"offset":12526},"end":{"line":219,"column":421,"offset":12948},"indent":[1]}}],"position":{"start":{"line":216,"column":1,"offset":12276},"end":{"line":219,"column":421,"offset":12948},"indent":[1,1,1]}},{"type":"code","lang":"ts","meta":null,"value":"cooldown: {\n seconds: 60,\n allowedUses: 5\n},","position":{"start":{"line":221,"column":1,"offset":12950},"end":{"line":226,"column":4,"offset":13006},"indent":[1,1,1,1,1]}},{"type":"blockquote","children":[{"type":"paragraph","children":[{"type":"strong","children":[{"type":"text","value":"Note:","position":{"start":{"line":228,"column":5,"offset":13012},"end":{"line":228,"column":10,"offset":13017},"indent":[]}}],"position":{"start":{"line":228,"column":3,"offset":13010},"end":{"line":228,"column":12,"offset":13019},"indent":[]}},{"type":"text","value":" It is important to understand the way these two interact. The cooldown starts as soon as the first command is used. So, if a user uses the role command 5 times in 59 seconds, they only have to wait 1 second to do another 5 times.","position":{"start":{"line":228,"column":12,"offset":13019},"end":{"line":228,"column":242,"offset":13249},"indent":[]}}],"position":{"start":{"line":228,"column":3,"offset":13010},"end":{"line":228,"column":242,"offset":13249},"indent":[]}}],"position":{"start":{"line":228,"column":1,"offset":13008},"end":{"line":228,"column":242,"offset":13249},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"Let's give this a try shall we.","position":{"start":{"line":230,"column":1,"offset":13251},"end":{"line":230,"column":32,"offset":13282},"indent":[]}}],"position":{"start":{"line":230,"column":1,"offset":13251},"end":{"line":230,"column":32,"offset":13282},"indent":[]}},{"type":"list","ordered":true,"start":1,"spread":false,"children":[{"type":"listItem","spread":false,"checked":null,"children":[{"type":"paragraph","children":[{"type":"inlineCode","value":"!reload commands","position":{"start":{"line":232,"column":4,"offset":13287},"end":{"line":232,"column":22,"offset":13305},"indent":[]}}],"position":{"start":{"line":232,"column":4,"offset":13287},"end":{"line":232,"column":22,"offset":13305},"indent":[]}}],"position":{"start":{"line":232,"column":1,"offset":13284},"end":{"line":232,"column":22,"offset":13305},"indent":[]}},{"type":"listItem","spread":false,"checked":null,"children":[{"type":"paragraph","children":[{"type":"text","value":"Spam the ","position":{"start":{"line":233,"column":4,"offset":13309},"end":{"line":233,"column":13,"offset":13318},"indent":[]}},{"type":"inlineCode","value":"!role","position":{"start":{"line":233,"column":13,"offset":13318},"end":{"line":233,"column":20,"offset":13325},"indent":[]}},{"type":"text","value":" very quickly 6 times in under a minute.","position":{"start":{"line":233,"column":20,"offset":13325},"end":{"line":233,"column":60,"offset":13365},"indent":[]}}],"position":{"start":{"line":233,"column":4,"offset":13309},"end":{"line":233,"column":60,"offset":13365},"indent":[]}}],"position":{"start":{"line":233,"column":1,"offset":13306},"end":{"line":233,"column":60,"offset":13365},"indent":[]}}],"position":{"start":{"line":232,"column":1,"offset":13284},"end":{"line":233,"column":60,"offset":13365},"indent":[1]}},{"type":"heading","depth":2,"children":[{"type":"text","value":"Arguments","position":{"start":{"line":235,"column":4,"offset":13370},"end":{"line":235,"column":13,"offset":13379},"indent":[]}}],"position":{"start":{"line":235,"column":1,"offset":13367},"end":{"line":235,"column":13,"offset":13379},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"Arguments is an incredibly powerful feature in Discordeno. Like Permission Levels we will have an in depth look at arguments later in the guide. For now, let's try and understand this in a simple manner.","position":{"start":{"line":237,"column":1,"offset":13381},"end":{"line":237,"column":204,"offset":13584},"indent":[]}}],"position":{"start":{"line":237,"column":1,"offset":13381},"end":{"line":237,"column":204,"offset":13584},"indent":[]}},{"type":"list","ordered":false,"start":null,"spread":false,"children":[{"type":"listItem","spread":false,"checked":null,"children":[{"type":"paragraph","children":[{"type":"inlineCode","value":"name","position":{"start":{"line":239,"column":3,"offset":13588},"end":{"line":239,"column":9,"offset":13594},"indent":[]}},{"type":"text","value":": The name of the argument. Useful for when you need to alert the user X arg is missing or when you want to use the arg in your command.","position":{"start":{"line":239,"column":9,"offset":13594},"end":{"line":239,"column":145,"offset":13730},"indent":[]}}],"position":{"start":{"line":239,"column":3,"offset":13588},"end":{"line":239,"column":145,"offset":13730},"indent":[]}}],"position":{"start":{"line":239,"column":1,"offset":13586},"end":{"line":239,"column":145,"offset":13730},"indent":[]}},{"type":"listItem","spread":false,"checked":null,"children":[{"type":"paragraph","children":[{"type":"inlineCode","value":"type","position":{"start":{"line":240,"column":3,"offset":13733},"end":{"line":240,"column":9,"offset":13739},"indent":[]}},{"type":"text","value":": The type of the argument you would like. Defaults to string. Some of the ones available by default are \"number\", \"string\", \"...string\", \"boolean\", \"subcommand\", \"member\".","position":{"start":{"line":240,"column":9,"offset":13739},"end":{"line":240,"column":181,"offset":13911},"indent":[]}}],"position":{"start":{"line":240,"column":3,"offset":13733},"end":{"line":240,"column":181,"offset":13911},"indent":[]}}],"position":{"start":{"line":240,"column":1,"offset":13731},"end":{"line":240,"column":181,"offset":13911},"indent":[]}},{"type":"listItem","spread":false,"checked":null,"children":[{"type":"paragraph","children":[{"type":"inlineCode","value":"missing","position":{"start":{"line":241,"column":3,"offset":13914},"end":{"line":241,"column":12,"offset":13923},"indent":[]}},{"type":"text","value":": a function that will be run when this argument is not provided by the user or if the provided argument is not valid. By default, it does nothing.","position":{"start":{"line":241,"column":12,"offset":13923},"end":{"line":241,"column":159,"offset":14070},"indent":[]}}],"position":{"start":{"line":241,"column":3,"offset":13914},"end":{"line":241,"column":159,"offset":14070},"indent":[]}}],"position":{"start":{"line":241,"column":1,"offset":13912},"end":{"line":241,"column":159,"offset":14070},"indent":[]}},{"type":"listItem","spread":false,"checked":null,"children":[{"type":"paragraph","children":[{"type":"inlineCode","value":"required","position":{"start":{"line":242,"column":3,"offset":14073},"end":{"line":242,"column":13,"offset":14083},"indent":[]}},{"type":"text","value":": Whether this argument is required or optional. By default, this is true.","position":{"start":{"line":242,"column":13,"offset":14083},"end":{"line":242,"column":87,"offset":14157},"indent":[]}}],"position":{"start":{"line":242,"column":3,"offset":14073},"end":{"line":242,"column":87,"offset":14157},"indent":[]}}],"position":{"start":{"line":242,"column":1,"offset":14071},"end":{"line":242,"column":87,"offset":14157},"indent":[]}},{"type":"listItem","spread":false,"checked":null,"children":[{"type":"paragraph","children":[{"type":"inlineCode","value":"lowercase","position":{"start":{"line":243,"column":3,"offset":14160},"end":{"line":243,"column":14,"offset":14171},"indent":[]}},{"type":"text","value":": If the type is a string, this can forcibly lowercase the string.","position":{"start":{"line":243,"column":14,"offset":14171},"end":{"line":243,"column":80,"offset":14237},"indent":[]}}],"position":{"start":{"line":243,"column":3,"offset":14160},"end":{"line":243,"column":80,"offset":14237},"indent":[]}}],"position":{"start":{"line":243,"column":1,"offset":14158},"end":{"line":243,"column":80,"offset":14237},"indent":[]}},{"type":"listItem","spread":false,"checked":null,"children":[{"type":"paragraph","children":[{"type":"inlineCode","value":"literals","position":{"start":{"line":244,"column":3,"offset":14240},"end":{"line":244,"column":13,"offset":14250},"indent":[]}},{"type":"text","value":": If the type is string or subcommand you can provide literals. The argument MUST be exactly the same as the literals to be accepted. For example, if you want to make sure the argument is ","position":{"start":{"line":244,"column":13,"offset":14250},"end":{"line":244,"column":201,"offset":14438},"indent":[]}},{"type":"inlineCode","value":"a","position":{"start":{"line":244,"column":201,"offset":14438},"end":{"line":244,"column":204,"offset":14441},"indent":[]}},{"type":"text","value":" or ","position":{"start":{"line":244,"column":204,"offset":14441},"end":{"line":244,"column":208,"offset":14445},"indent":[]}},{"type":"inlineCode","value":"b","position":{"start":{"line":244,"column":208,"offset":14445},"end":{"line":244,"column":211,"offset":14448},"indent":[]}},{"type":"text","value":" only and not ","position":{"start":{"line":244,"column":211,"offset":14448},"end":{"line":244,"column":225,"offset":14462},"indent":[]}},{"type":"inlineCode","value":"c","position":{"start":{"line":244,"column":225,"offset":14462},"end":{"line":244,"column":228,"offset":14465},"indent":[]}},{"type":"text","value":".","position":{"start":{"line":244,"column":228,"offset":14465},"end":{"line":244,"column":229,"offset":14466},"indent":[]}}],"position":{"start":{"line":244,"column":3,"offset":14240},"end":{"line":244,"column":229,"offset":14466},"indent":[]}}],"position":{"start":{"line":244,"column":1,"offset":14238},"end":{"line":244,"column":229,"offset":14466},"indent":[]}},{"type":"listItem","spread":false,"checked":null,"children":[{"type":"paragraph","children":[{"type":"inlineCode","value":"defaultValue","position":{"start":{"line":245,"column":3,"offset":14469},"end":{"line":245,"column":17,"offset":14483},"indent":[]}},{"type":"text","value":": The default value for this argument/subcommand. If the user does not provide an argument or it is invalid, it can be defaulted to a certain value.","position":{"start":{"line":245,"column":17,"offset":14483},"end":{"line":245,"column":165,"offset":14631},"indent":[]}}],"position":{"start":{"line":245,"column":3,"offset":14469},"end":{"line":245,"column":165,"offset":14631},"indent":[]}}],"position":{"start":{"line":245,"column":1,"offset":14467},"end":{"line":245,"column":165,"offset":14631},"indent":[]}}],"position":{"start":{"line":239,"column":1,"offset":13586},"end":{"line":245,"column":165,"offset":14631},"indent":[1,1,1,1,1,1]}},{"type":"paragraph","children":[{"type":"text","value":"For our role command, we need a ","position":{"start":{"line":247,"column":1,"offset":14633},"end":{"line":247,"column":33,"offset":14665},"indent":[]}},{"type":"inlineCode","value":"member","position":{"start":{"line":247,"column":33,"offset":14665},"end":{"line":247,"column":41,"offset":14673},"indent":[]}},{"type":"text","value":" and a ","position":{"start":{"line":247,"column":41,"offset":14673},"end":{"line":247,"column":48,"offset":14680},"indent":[]}},{"type":"inlineCode","value":"role","position":{"start":{"line":247,"column":48,"offset":14680},"end":{"line":247,"column":54,"offset":14686},"indent":[]}},{"type":"text","value":".","position":{"start":{"line":247,"column":54,"offset":14686},"end":{"line":247,"column":55,"offset":14687},"indent":[]}}],"position":{"start":{"line":247,"column":1,"offset":14633},"end":{"line":247,"column":55,"offset":14687},"indent":[]}},{"type":"code","lang":"ts","meta":null,"value":"arguments: [\n {\n name: \"member\",\n type: \"member\",\n missing: (message) => {\n sendResponse(message, `you did not provide a member to give the role to. You can provide a @member mention, a member ID, or try using their nickname/username. The nickname/username will only work if they have been active in your server recently.`)\n }\n },\n {\n name: \"role\",\n type: \"role\",\n missing: (message) => {\n sendResponse(message, `you did not provide a role to give. You can provide a @role mention, a role ID, or it's name. If the role name did not work, try to use the **roleinfo** command to get the role ID.`)\n }\n }\n]","position":{"start":{"line":249,"column":1,"offset":14689},"end":{"line":266,"column":4,"offset":15340},"indent":[1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1]}},{"type":"heading","depth":2,"children":[{"type":"text","value":"Execute Option","position":{"start":{"line":268,"column":4,"offset":15345},"end":{"line":268,"column":18,"offset":15359},"indent":[]}}],"position":{"start":{"line":268,"column":1,"offset":15342},"end":{"line":268,"column":18,"offset":15359},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"The execute option is the code that will run when the command is triggered. The execute function is passed 3 parameters that you can use in your command.","position":{"start":{"line":270,"column":1,"offset":15361},"end":{"line":270,"column":154,"offset":15514},"indent":[]}}],"position":{"start":{"line":270,"column":1,"offset":15361},"end":{"line":270,"column":154,"offset":15514},"indent":[]}},{"type":"list","ordered":false,"start":null,"spread":false,"children":[{"type":"listItem","spread":false,"checked":null,"children":[{"type":"paragraph","children":[{"type":"inlineCode","value":"message","position":{"start":{"line":272,"column":3,"offset":15518},"end":{"line":272,"column":12,"offset":15527},"indent":[]}},{"type":"text","value":": The message object itself that triggered this command.","position":{"start":{"line":272,"column":12,"offset":15527},"end":{"line":272,"column":68,"offset":15583},"indent":[]}}],"position":{"start":{"line":272,"column":3,"offset":15518},"end":{"line":272,"column":68,"offset":15583},"indent":[]}}],"position":{"start":{"line":272,"column":1,"offset":15516},"end":{"line":272,"column":68,"offset":15583},"indent":[]}},{"type":"listItem","spread":false,"checked":null,"children":[{"type":"paragraph","children":[{"type":"inlineCode","value":"args","position":{"start":{"line":273,"column":3,"offset":15586},"end":{"line":273,"column":9,"offset":15592},"indent":[]}},{"type":"text","value":": The args that were provided by the user.","position":{"start":{"line":273,"column":9,"offset":15592},"end":{"line":273,"column":51,"offset":15634},"indent":[]}}],"position":{"start":{"line":273,"column":3,"offset":15586},"end":{"line":273,"column":51,"offset":15634},"indent":[]}}],"position":{"start":{"line":273,"column":1,"offset":15584},"end":{"line":273,"column":51,"offset":15634},"indent":[]}},{"type":"listItem","spread":false,"checked":null,"children":[{"type":"paragraph","children":[{"type":"inlineCode","value":"guild","position":{"start":{"line":274,"column":3,"offset":15637},"end":{"line":274,"column":10,"offset":15644},"indent":[]}},{"type":"text","value":": The server guild object where this command was run.","position":{"start":{"line":274,"column":10,"offset":15644},"end":{"line":274,"column":63,"offset":15697},"indent":[]}}],"position":{"start":{"line":274,"column":3,"offset":15637},"end":{"line":274,"column":63,"offset":15697},"indent":[]}}],"position":{"start":{"line":274,"column":1,"offset":15635},"end":{"line":274,"column":63,"offset":15697},"indent":[]}}],"position":{"start":{"line":272,"column":1,"offset":15516},"end":{"line":274,"column":63,"offset":15697},"indent":[1,1]}},{"type":"code","lang":"ts","meta":null,"value":"execute: function (message, args, guild) {\n // The code that is to be executed goes here\n}","position":{"start":{"line":276,"column":1,"offset":15699},"end":{"line":280,"column":4,"offset":15800},"indent":[1,1,1,1]}},{"type":"blockquote","children":[{"type":"paragraph","children":[{"type":"strong","children":[{"type":"text","value":"Note:","position":{"start":{"line":282,"column":5,"offset":15806},"end":{"line":282,"column":10,"offset":15811},"indent":[]}}],"position":{"start":{"line":282,"column":3,"offset":15804},"end":{"line":282,"column":12,"offset":15813},"indent":[]}},{"type":"text","value":" I prefer writing code using the function keyword, but you can easily change to the fat arrow function if you prefer.","position":{"start":{"line":282,"column":12,"offset":15813},"end":{"line":282,"column":129,"offset":15930},"indent":[]}}],"position":{"start":{"line":282,"column":3,"offset":15804},"end":{"line":282,"column":129,"offset":15930},"indent":[]}},{"type":"code","lang":"ts","meta":null,"value":"execute: (message, args, guild) => {\n // The code that is to be executed goes here\n}","position":{"start":{"line":283,"column":3,"offset":15933},"end":{"line":287,"column":6,"offset":16037},"indent":[3,3,3,3]}}],"position":{"start":{"line":282,"column":1,"offset":15802},"end":{"line":287,"column":6,"offset":16037},"indent":[1,1,1,1,1]}},{"type":"paragraph","children":[{"type":"text","value":"Let's start out by writing some pseudo-code(comments that will help us plan the code).","position":{"start":{"line":289,"column":1,"offset":16039},"end":{"line":289,"column":87,"offset":16125},"indent":[]}}],"position":{"start":{"line":289,"column":1,"offset":16039},"end":{"line":289,"column":87,"offset":16125},"indent":[]}},{"type":"code","lang":"ts","meta":null,"value":"execute: function (message, args, guild) {\n // If this was the everyone role alert with a silly error\n\n // If this is a managed role(some bots role) we can't give/remove alert with silly error\n\n // Get the bots highest role\n\n // Check if the bot has a role higher than the role that it will try to give.\n\n // If the role is too high alert the user.\n\n // If the user has this role already remove the role from them.\n\n // Check the command author's highest role\n\n // If the author does not have a role high enough to give this role alert\n\n // If the user has this role already we should remove it\n\n // Add the role to the user.\n\n // Alert the user that used the command that the user has been give the role.\n}","position":{"start":{"line":291,"column":1,"offset":16127},"end":{"line":315,"column":4,"offset":16855},"indent":[1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1]}},{"type":"paragraph","children":[{"type":"text","value":"Nice! The plan for the code is complete. Now, let's add in the code.","position":{"start":{"line":317,"column":1,"offset":16857},"end":{"line":317,"column":69,"offset":16925},"indent":[]}}],"position":{"start":{"line":317,"column":1,"offset":16857},"end":{"line":317,"column":69,"offset":16925},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"The first thing we are going to try is to check if the role the user provided is the same as the everyone role.","position":{"start":{"line":319,"column":1,"offset":16927},"end":{"line":319,"column":112,"offset":17038},"indent":[]}}],"position":{"start":{"line":319,"column":1,"offset":16927},"end":{"line":319,"column":112,"offset":17038},"indent":[]}},{"type":"blockquote","children":[{"type":"paragraph","children":[{"type":"strong","children":[{"type":"text","value":"Note:","position":{"start":{"line":321,"column":5,"offset":17044},"end":{"line":321,"column":10,"offset":17049},"indent":[]}}],"position":{"start":{"line":321,"column":3,"offset":17042},"end":{"line":321,"column":12,"offset":17051},"indent":[]}},{"type":"text","value":" The everyone role ID is the same as the server guild ID.","position":{"start":{"line":321,"column":12,"offset":17051},"end":{"line":321,"column":69,"offset":17108},"indent":[]}}],"position":{"start":{"line":321,"column":3,"offset":17042},"end":{"line":321,"column":69,"offset":17108},"indent":[]}}],"position":{"start":{"line":321,"column":1,"offset":17040},"end":{"line":321,"column":69,"offset":17108},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"To do this, we are going to want something like this:","position":{"start":{"line":323,"column":1,"offset":17110},"end":{"line":323,"column":54,"offset":17163},"indent":[]}}],"position":{"start":{"line":323,"column":1,"offset":17110},"end":{"line":323,"column":54,"offset":17163},"indent":[]}},{"type":"code","lang":"ts","meta":null,"value":"if (args.role.id === message.guildID) {\n return sendResponse(message, \"The everyone role can not be given to anyone because everyone has the everyone role already. *Keep calm and let Carter figure it out*!\");\n}","position":{"start":{"line":325,"column":1,"offset":17165},"end":{"line":329,"column":4,"offset":17386},"indent":[1,1,1,1]}},{"type":"paragraph","children":[{"type":"text","value":"You might be seeing an error since we didn't provide the accurate typings for the ","position":{"start":{"line":331,"column":1,"offset":17388},"end":{"line":331,"column":83,"offset":17470},"indent":[]}},{"type":"inlineCode","value":"args","position":{"start":{"line":331,"column":83,"offset":17470},"end":{"line":331,"column":89,"offset":17476},"indent":[]}},{"type":"text","value":" parameter. The message and guild parameter is automated but the args is dynamic depending on your ","position":{"start":{"line":331,"column":89,"offset":17476},"end":{"line":331,"column":188,"offset":17575},"indent":[]}},{"type":"inlineCode","value":"arguments","position":{"start":{"line":331,"column":188,"offset":17575},"end":{"line":331,"column":199,"offset":17586},"indent":[]}},{"type":"text","value":" option for your command. So let's do this real quick.","position":{"start":{"line":331,"column":199,"offset":17586},"end":{"line":331,"column":253,"offset":17640},"indent":[]}}],"position":{"start":{"line":331,"column":1,"offset":17388},"end":{"line":331,"column":253,"offset":17640},"indent":[]}},{"type":"code","lang":"ts","meta":null,"value":"execute: function (message, args: RoleArgs, guild) {\n // If this was the everyone role alert with a silly error\n if (args.role.id === message.guildID) {\n return sendResponse(message, \"Are you trying to make this person a super hero? Everyone has the everyone role. I can't give the everyone role to another user.\");\n }\n\n // Lots of comments here hidden so you can see the changes easily.\n}\n\ninterface RoleArgs {\n role: Role;\n member: Member;\n}","position":{"start":{"line":333,"column":1,"offset":17642},"end":{"line":347,"column":4,"offset":18104},"indent":[1,1,1,1,1,1,1,1,1,1,1,1,1,1]}},{"type":"paragraph","children":[{"type":"text","value":"Awesome! Let's keep going.","position":{"start":{"line":349,"column":1,"offset":18106},"end":{"line":349,"column":27,"offset":18132},"indent":[]}}],"position":{"start":{"line":349,"column":1,"offset":18106},"end":{"line":349,"column":27,"offset":18132},"indent":[]}},{"type":"code","lang":"ts","meta":null,"value":"execute: function (message, args: RoleArgs, guild) {\n // If this was the everyone role alert with a silly error\n if (args.role.id === message.guildID) {\n return sendResponse(message, \"I don't know if you noticed or not but I'm an extremely arrogant bot who tends to think all of his plans will work. But I can't give the everyone role to someone.\");\n }\n\n // If this is a managed role(some bots role) we can't give/remove alert with silly error\n if (args.role.managed) {\n return sendResponse(message, \"Dammit man, just 'cause I'm Scottish doesn't mean I can give your people managed roles.\")\n }\n\n // Get the bots highest role\n const botsHighestRole = highestRole(message.guildID, botID);\n\n // Check if the bot has a role higher than the role that it will try to give.\n const botIsHigher = higherRolePosition(message.guildID, botsHighestRole.id, args.role.id)\n\n // If the role is too high alert the user.\n if (!botIsHigher) {\n return sendResponse(message, \"Okay look, asking me give a role that is higher than my highest role is ridiculous! I am the first bot to admit I don't know who these people are nor do I care to. Look, if you'd like I could take you down the hall and just point at the people who annoy me more than the rest. But that's about as useful as I get.\")\n }\n\n // Check the command author's highest role\n const membersHighestRole = highestRole(message.guildID, message.author.id);\n\n // If the author does not have a role high enough to give this role alert\n if (!higherRolePosition(message.guildID, membersHighestRole.id, args.role.id)) {\n return sendResponse(message, \"In my culture, whenever someone tries to give a role that is higher than their highest role, I would be well within my rights to dismember you.\")\n }\n\n // If the user has this role already we should remove it\n if (message.member().roles.includes(args.role.id)) {\n removeRole(message.guildID, args.member.user.id, args.role.id, `${message.author.tag} used the role command to remove this role.`)\n // Alert the user that used the command that the user has lost the role.\n return sendResponse(message, `The role **${args.role.name}** has been removed from **${args.member.tag}**.`)\n }\n\n // Add the role to the user.\n addRole(guildID, memberID, roleID)\n\n // Alert the user that used the command that the user has been give the role.\n return sendResponse(message, `The role **${args.role.name}** has been added to **${args.member.tag}**.`)\n}","position":{"start":{"line":352,"column":1,"offset":18135},"end":{"line":396,"column":4,"offset":20611},"indent":[1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1]}},{"type":"paragraph","children":[{"type":"text","value":"The final version of the command should look something like this:","position":{"start":{"line":398,"column":1,"offset":20613},"end":{"line":398,"column":66,"offset":20678},"indent":[]}}],"position":{"start":{"line":398,"column":1,"offset":20613},"end":{"line":398,"column":66,"offset":20678},"indent":[]}},{"type":"code","lang":"ts","meta":null,"value":"import { highestRole, higherRolePosition, botID, removeRole, addRole, Role, Member } from \"../../deps.ts\";\nimport { botCache } from \"../../mod.ts\";\nimport { PermissionLevels } from \"../types/commands.ts\";\nimport { sendResponse } from \"../utils/helpers.ts\";\n\nbotCache.commands.set(\"role\", {\n name: \"role\",\n permissionLevel: [PermissionLevels.MODERATOR, PermissionLevels.ADMIN],\n botServerPermissions: [\"MANAGE_ROLES\"],\n botChannelPermissions: [\"SEND_MESSAGES\"],\n cooldown: {\n seconds: 60,\n allowedUses: 5,\n },\n arguments: [\n\t\t{\n\t\t\tname: \"member\",\n\t\t\ttype: \"member\",\n\t\t\tmissing: (message) => {\n\t\t\t\tsendResponse(message, `you did not provide a member to give the role to. You can provide a @member mention, a member ID, or try using their nickname/username. The nickname/username will only work if they have been active in your server recently.`)\n\t\t\t}\n\t\t},\n\t\t{\n\t\t\tname: \"role\",\n\t\t\ttype: \"role\",\n\t\t\tmissing: (message) => {\n\t\t\t\tsendResponse(message, `you did not provide a role to give. You can provide a @role mention, a role ID, or it's name. If the role name did not work, try to use the **roleinfo** command to get the role ID.`)\n\t\t\t}\n\t\t}\n\t],\n execute: function (message, args: RoleArgs) {\n // If this was the everyone role alert with a silly error\n if (args.role.id === message.guildID) {\n return sendResponse(\n message,\n \"I don't know if you noticed or not but I'm an extremely arrogant bot who tends to think all of his plans will work. But I can't give the everyone role to someone.\",\n );\n }\n\n // If this is a managed role(some bots role) we can't give/remove alert with silly error\n if (args.role.managed) {\n return sendResponse(\n message,\n \"Dammit man, just 'cause I'm Scottish doesn't mean I can give your people managed roles.\",\n );\n }\n\n // Get the bots highest role\n const botsHighestRole = highestRole(message.guildID, botID);\n\n // Check if the bot has a role higher than the role that it will try to give. If the role is too high alert the user.\n if (!botsHighestRole || !higherRolePosition(\n message.guildID,\n botsHighestRole.id,\n args.role.id,\n )) {\n return sendResponse(\n message,\n \"Okay look, asking me give a role that is higher than my highest role is ridiculous! I am the first bot to admit I don't know who these people are nor do I care to. Look, if you'd like I could take you down the hall and just point at the people who annoy me more than the rest. But that's about as useful as I get.\",\n );\n }\n\n // Check the command author's highest role\n const membersHighestRole = highestRole(message.guildID, message.author.id);\n\n // If the author does not have a role high enough to give this role alert\n if (!membersHighestRole ||\n !higherRolePosition(message.guildID, membersHighestRole.id, args.role.id)\n ) {\n return sendResponse(\n message,\n \"In my culture, whenever someone tries to give a role that is higher than their highest role, I would be well within my rights to dismember you.\",\n );\n }\n\n // If the user has this role already we should remove it\n if (message.member()?.roles.includes(args.role.id)) {\n removeRole(\n message.guildID,\n args.member.user.id,\n args.role.id,\n `${message.author.username} used the role command to remove this role.`,\n );\n // Alert the user that used the command that the user has lost the role.\n return sendResponse(\n message,\n `The role **${args.role.name}** has been removed from **${args.member.tag}**.`,\n );\n }\n\n // Add the role to the user.\n addRole(message.guildID, args.member.user.id, args.role.id, `${message.author.username} used the role command to give this role.`);\n\n // Alert the user that used the command that the user has been give the role.\n return sendResponse(\n message,\n `The role **${args.role.name}** has been added to **${args.member.tag}**.`,\n );\n },\n});\n\ninterface RoleArgs {\n role: Role;\n member: Member;\n}","position":{"start":{"line":400,"column":1,"offset":20680},"end":{"line":506,"column":4,"offset":24762},"indent":[1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1]}},{"type":"blockquote","children":[{"type":"paragraph","children":[{"type":"strong","children":[{"type":"text","value":"Note:","position":{"start":{"line":508,"column":5,"offset":24768},"end":{"line":508,"column":10,"offset":24773},"indent":[]}}],"position":{"start":{"line":508,"column":3,"offset":24766},"end":{"line":508,"column":12,"offset":24775},"indent":[]}},{"type":"text","value":" The response strings are a play on some funny Stargate(my favorite tv show) moments. Feel free to change as you wish to fit your bot's personality.","position":{"start":{"line":508,"column":12,"offset":24775},"end":{"line":508,"column":160,"offset":24923},"indent":[]}}],"position":{"start":{"line":508,"column":3,"offset":24766},"end":{"line":508,"column":160,"offset":24923},"indent":[]}}],"position":{"start":{"line":508,"column":1,"offset":24764},"end":{"line":508,"column":160,"offset":24923},"indent":[]}},{"type":"heading","depth":2,"children":[{"type":"text","value":"Dynamic(Advanced Level) Command Creation","position":{"start":{"line":510,"column":4,"offset":24928},"end":{"line":510,"column":44,"offset":24968},"indent":[]}}],"position":{"start":{"line":510,"column":1,"offset":24925},"end":{"line":510,"column":44,"offset":24968},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"This is some advanced level super magical command creation skills. Discordeno gives you the power to dynamically create commands. What that means is you can write the code for one command but dynamically create like 50 commands using that same code.","position":{"start":{"line":512,"column":1,"offset":24970},"end":{"line":512,"column":250,"offset":25219},"indent":[]}}],"position":{"start":{"line":512,"column":1,"offset":24970},"end":{"line":512,"column":250,"offset":25219},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"For example, in my main bot I have a lot of \"fun\" commands like ","position":{"start":{"line":514,"column":1,"offset":25221},"end":{"line":514,"column":65,"offset":25285},"indent":[]}},{"type":"inlineCode","value":".hug","position":{"start":{"line":514,"column":65,"offset":25285},"end":{"line":514,"column":71,"offset":25291},"indent":[]}},{"type":"text","value":" or ","position":{"start":{"line":514,"column":71,"offset":25291},"end":{"line":514,"column":75,"offset":25295},"indent":[]}},{"type":"inlineCode","value":".kiss","position":{"start":{"line":514,"column":75,"offset":25295},"end":{"line":514,"column":82,"offset":25302},"indent":[]}},{"type":"text","value":" etc... All of these files have the exact same code except for 1 word being the command name. Would it not be better to simply write the code once and dynamically create every single command. Let me show you how that works.","position":{"start":{"line":514,"column":82,"offset":25302},"end":{"line":514,"column":305,"offset":25525},"indent":[]}}],"position":{"start":{"line":514,"column":1,"offset":25221},"end":{"line":514,"column":305,"offset":25525},"indent":[]}},{"type":"list","ordered":false,"start":null,"spread":false,"children":[{"type":"listItem","spread":false,"checked":null,"children":[{"type":"paragraph","children":[{"type":"text","value":"Create a file in the commands folder called ","position":{"start":{"line":516,"column":3,"offset":25529},"end":{"line":516,"column":47,"offset":25573},"indent":[]}},{"type":"inlineCode","value":"fun.ts","position":{"start":{"line":516,"column":47,"offset":25573},"end":{"line":516,"column":55,"offset":25581},"indent":[]}},{"type":"text","value":" which will create all our fun commands.","position":{"start":{"line":516,"column":55,"offset":25581},"end":{"line":516,"column":95,"offset":25621},"indent":[]}}],"position":{"start":{"line":516,"column":3,"offset":25529},"end":{"line":516,"column":95,"offset":25621},"indent":[]}}],"position":{"start":{"line":516,"column":1,"offset":25527},"end":{"line":516,"column":95,"offset":25621},"indent":[]}}],"position":{"start":{"line":516,"column":1,"offset":25527},"end":{"line":516,"column":95,"offset":25621},"indent":[]}},{"type":"code","lang":"ts","meta":null,"value":"import { Member, sendMessage, chooseRandom, avatarURL } from \"../../deps.ts\";\nimport { botCache } from \"../../mod.ts\";\nimport { createCommandAliases, sendEmbed } from \"../utils/helpers.ts\";\nimport { configs } from \"../../configs.ts\";\nimport { Embed } from \"../utils/Embed.ts\";\nimport { translate } from \"../utils/i18next.ts\";\n\nconst funCommandData = [\n { name: \"bite\", gifs: configs.gifs.bite },\n { name: \"cuddle\", gifs: configs.gifs.cuddle },\n { name: \"dance\", gifs: configs.gifs.dance },\n { name: \"hug\", gifs: configs.gifs.hug },\n { name: \"kiss\", gifs: configs.gifs.kiss },\n { name: \"kanna\", gifs: configs.gifs.kanna },\n { name: \"kiss\", gifs: configs.gifs.kiss },\n { name: \"kitten\", gifs: configs.gifs.kitten },\n { name: \"lmao\", gifs: configs.gifs.lmao, aliases: [\"lol\"] },\n { name: \"pat\", gifs: configs.gifs.pat },\n { name: \"poke\", gifs: configs.gifs.poke },\n { name: \"pony\", gifs: configs.gifs.pony },\n { name: \"puppy\", gifs: configs.gifs.puppy },\n { name: \"raphtalia\", gifs: configs.gifs.raphtalia },\n { name: \"stargate\", gifs: configs.gifs.stargate },\n { name: \"supernatural\", gifs: configs.gifs.supernatural },\n { name: \"tickle\", gifs: configs.gifs.tickle },\n { name: \"zerotwo\", gifs: configs.gifs.zerotwo },\n];\n\nfunCommandData.forEach((data) => {\n botCache.commands.set(data.name, {\n name: data.name,\n botChannelPermissions: [\"SEND_MESSAGES\", \"EMBED_LINKS\"],\n cooldown: {\n seconds: 2,\n },\n arguments: [\n {\n name: \"member\",\n type: \"member\",\n required: false,\n },\n ],\n execute: function (message, args: FunArgs) {\n\t\t\t// If a member is provided use that otherwise set the member themself\n const member = args.member || message.member()!;\n\n const type = member.user.id === message.author.id\n // Silly response like if user tries to hug themself\n ? \"SELF\"\n // Response for when user tries to hug another user\n : \"OTHER\";\n\n\n // Create an embed\n const embed = new Embed()\n .setAuthor(member.tag, avatarURL(member))\n .setDescription(\n translate(\n message.guildID,\n `commands/fun/${data.name}:${type}`,\n { mention: message.member()!.mention, user: member.mention },\n ),\n )\n .setImage(chooseRandom(data.gifs));\n\n return sendEmbed(message.channel, embed);\n },\n });\n\n if (data.aliases?.length) {\n createCommandAliases(data.name, data.aliases);\n }\n});\n\ninterface FunArgs {\n member?: Member;\n}","position":{"start":{"line":518,"column":1,"offset":25623},"end":{"line":596,"column":4,"offset":28138},"indent":[1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1]}},{"type":"blockquote","children":[{"type":"paragraph","children":[{"type":"strong","children":[{"type":"text","value":"Note:","position":{"start":{"line":598,"column":5,"offset":28144},"end":{"line":598,"column":10,"offset":28149},"indent":[]}}],"position":{"start":{"line":598,"column":3,"offset":28142},"end":{"line":598,"column":12,"offset":28151},"indent":[]}},{"type":"text","value":" The imports in this are a bit different. I did this to show you that you can also import everything grouped like this through the ","position":{"start":{"line":598,"column":12,"offset":28151},"end":{"line":598,"column":143,"offset":28282},"indent":[]}},{"type":"inlineCode","value":"deps.ts","position":{"start":{"line":598,"column":143,"offset":28282},"end":{"line":598,"column":152,"offset":28291},"indent":[]}},{"type":"text","value":" which will make everything available to you at ease.","position":{"start":{"line":598,"column":152,"offset":28291},"end":{"line":598,"column":205,"offset":28344},"indent":[]}}],"position":{"start":{"line":598,"column":3,"offset":28142},"end":{"line":598,"column":205,"offset":28344},"indent":[]}}],"position":{"start":{"line":598,"column":1,"offset":28140},"end":{"line":598,"column":205,"offset":28344},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"Take a minute to realize what just happened. This has made 18 different unique commands dynamically. In 1 file, using the same piece of code, we created so many commands. You can easily add more commands to this. For example, if you wanted to add weeb(animated) versions of these commands. Then you are at 36 commands with 1 simple command file.","position":{"start":{"line":600,"column":1,"offset":28346},"end":{"line":600,"column":346,"offset":28691},"indent":[]}}],"position":{"start":{"line":600,"column":1,"offset":28346},"end":{"line":600,"column":346,"offset":28691},"indent":[]}},{"type":"paragraph","children":[{"type":"strong","children":[{"type":"text","value":"That ladies and gentleman is the power and magic of Discordeno!","position":{"start":{"line":602,"column":3,"offset":28695},"end":{"line":602,"column":66,"offset":28758},"indent":[]}}],"position":{"start":{"line":602,"column":1,"offset":28693},"end":{"line":602,"column":68,"offset":28760},"indent":[]}}],"position":{"start":{"line":602,"column":1,"offset":28693},"end":{"line":602,"column":68,"offset":28760},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"Take a minute to stand up, step back and make some room around you. Now start dancing because you just acheived one of the most complex things in bot development. You have already created about 36 commands!!!!","position":{"start":{"line":604,"column":1,"offset":28762},"end":{"line":604,"column":210,"offset":28971},"indent":[]}}],"position":{"start":{"line":604,"column":1,"offset":28762},"end":{"line":604,"column":210,"offset":28971},"indent":[]}},{"type":"blockquote","children":[{"type":"paragraph","children":[{"type":"strong","children":[{"type":"text","value":"Note:","position":{"start":{"line":606,"column":5,"offset":28977},"end":{"line":606,"column":10,"offset":28982},"indent":[]}}],"position":{"start":{"line":606,"column":3,"offset":28975},"end":{"line":606,"column":12,"offset":28984},"indent":[]}},{"type":"text","value":" The command above uses translations which we will cover in depth in a later section of this guide.","position":{"start":{"line":606,"column":12,"offset":28984},"end":{"line":606,"column":111,"offset":29083},"indent":[]}}],"position":{"start":{"line":606,"column":3,"offset":28975},"end":{"line":606,"column":111,"offset":29083},"indent":[]}}],"position":{"start":{"line":606,"column":1,"offset":28973},"end":{"line":606,"column":111,"offset":29083},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"Once you are ready, let's proceed to making our events.","position":{"start":{"line":608,"column":1,"offset":29085},"end":{"line":608,"column":56,"offset":29140},"indent":[]}}],"position":{"start":{"line":608,"column":1,"offset":29085},"end":{"line":608,"column":56,"offset":29140},"indent":[]}},{"type":"export","value":"export const _frontmatter = {\"title\":\"Creating A Command\",\"metaTitle\":\"Creating A Command | Discordeno\",\"metaDescription\":\"Let's create our very first command with Discordeno!\"}","position":{"start":{"line":611,"column":1,"offset":29143},"end":{"line":611,"column":178,"offset":29320},"indent":[]}}],"position":{"start":{"line":1,"column":1,"offset":0},"end":{"line":611,"column":178,"offset":29320}}},"scopeImports":["import * as React from 'react'"],"scopeIdentifiers":["React"],"body":"function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }\n\nfunction _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }\n\nfunction _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }\n\n/* @jsx mdx */\nvar _frontmatter = {\n \"title\": \"Creating A Command\",\n \"metaTitle\": \"Creating A Command | Discordeno\",\n \"metaDescription\": \"Let's create our very first command with Discordeno!\"\n};\nvar layoutProps = {\n _frontmatter: _frontmatter\n};\nvar MDXLayout = \"wrapper\";\nreturn function MDXContent(_ref) {\n var components = _ref.components,\n props = _objectWithoutProperties(_ref, [\"components\"]);\n\n return mdx(MDXLayout, _extends({}, layoutProps, props, {\n components: components,\n mdxType: \"MDXLayout\"\n }), mdx(\"p\", null, \"Really great job. Now, lets dive into trying to use some of the commands and try to make our very own command.\"), mdx(\"h2\", null, \"Editing Invite Command\"), mdx(\"p\", null, \"Let's first start by taking an existing command and slightly modifying it to your needs. Let's use the \", mdx(\"inlineCode\", {\n parentName: \"p\"\n }, \"Invite\"), \" command as our example. When you open the command, you will see something like this:\"), mdx(\"pre\", null, mdx(\"code\", _extends({\n parentName: \"pre\"\n }, {\n \"className\": \"language-ts\"\n }), \"import { botCache } from \\\"../../mod.ts\\\";\\nimport { sendMessage } from \\\"https://raw.githubusercontent.com/Skillz4Killz/Discordeno/v7/src/handlers/channel.ts\\\";\\nimport { botID } from \\\"https://raw.githubusercontent.com/Skillz4Killz/Discordeno/v7/src/module/client.ts\\\";\\n\\nbotCache.commands.set(\\\"invite\\\", {\\n name: \\\"invite\\\",\\n execute: function (message) {\\n // Replace the permission number at the end to request the permissions you wish to request. By default, this will request Admin perms.\\n sendMessage(\\n message.channel,\\n `https://discordapp.com/oauth2/authorize?client_id=${botID}&scope=bot&permissions=8`,\\n );\\n },\\n});\\n\")), mdx(\"p\", null, \"Let's break this down. The first three lines are importing the necessary things from their files so we can use them in this command. Don't worry if this doesn't make sense, most of the time, this will all be done automatically for you if you use a good code editor like Visual Studio Code. We create a command by doing:\"), mdx(\"pre\", null, mdx(\"code\", _extends({\n parentName: \"pre\"\n }, {\n \"className\": \"language-ts\"\n }), \"botCache.commands.set('commandname', {\\n\\n})\\n\")), mdx(\"p\", null, \"The command name here must be unique. If it is not unique, your commands will not work properly as you wish. For example, you can't have 2 commands with the \", mdx(\"inlineCode\", {\n parentName: \"p\"\n }, \"ping\"), \" name. In this case, our command is called \", mdx(\"inlineCode\", {\n parentName: \"p\"\n }, \"invite\"), \".\"), mdx(\"p\", null, \"The \", mdx(\"inlineCode\", {\n parentName: \"p\"\n }, \"name: 'invite'\"), \" is also written as it is useful for our help command and inhibitors! Normally, these two things will be the same. So far it's super easy right.\"), mdx(\"p\", null, \"Next is the \", mdx(\"inlineCode\", {\n parentName: \"p\"\n }, \"execute\"), \". This is where the magic happens. This is the function that is triggered when the command is ran by a user. In this case, the bot simply sends a message to a channel where the command was ran and sends an invite link. Let's take a minute and optimize this for our case. We don't \", mdx(\"strong\", {\n parentName: \"p\"\n }, \"NEED\"), \" admin permissions for our bot. Let's go to the \", mdx(\"a\", _extends({\n parentName: \"p\"\n }, {\n \"href\": \"https://discordapi.com/permissions.html#0\"\n }), \"permission calculator\"), \" and figure out the permissions we need for our bot.\"), mdx(\"p\", null, \"Once you have decided which permissions you want to request, you can copy the number and replace it here. For example, if we want \", mdx(\"inlineCode\", {\n parentName: \"p\"\n }, \"68640\"), \" as our permissions. We can modify our command to be:\"), mdx(\"pre\", null, mdx(\"code\", _extends({\n parentName: \"pre\"\n }, {\n \"className\": \"language-ts\"\n }), \" `https://discordapp.com/oauth2/authorize?client_id=${botID}&scope=bot&permissions=68640`,\\n\")), mdx(\"p\", null, \"Lastly, let's get rid of the comment there as now it is customized to our needs.\"), mdx(\"h3\", null, \"Command Descriptions\"), mdx(\"p\", null, \"Right now, if you were to go to Discord and type \", mdx(\"inlineCode\", {\n parentName: \"p\"\n }, \"!help invite\"), \", you would see quite a bit of information. But where does all that text come from? It's not in this file. The description option tells Discordeno what to show the user when they use the help command. In that help message, each command has a small description next to it. The magic is happening because of Discordeno's translations feature.\"), mdx(\"blockquote\", null, mdx(\"p\", {\n parentName: \"blockquote\"\n }, \"Discordeno has built in multi-lingual support. You can support as many languages as you wish. We will learn more about languages when we create our own language but for now we just want to see how to customize the command. What we are going to do below isn't the correct way but it's the easy way to learn. We will see the correct way to do it when we get to translations.\")), mdx(\"p\", null, \"Let's add a custom description to our invite command.\"), mdx(\"pre\", null, mdx(\"code\", _extends({\n parentName: \"pre\"\n }, {\n \"className\": \"language-ts\"\n }), \" name: \\\"invite\\\",\\n description: \\\"Like the bot? Use this link to add it to your server!\\\"\\n\")), mdx(\"p\", null, \"\\uD83C\\uDF89 It's that simple. So let's restart the bot and see how it changed. Use \", mdx(\"strong\", {\n parentName: \"p\"\n }, \"CTRL + C\"), \" to shut down the bot. Then run the command from earlier.\"), mdx(\"pre\", null, mdx(\"code\", _extends({\n parentName: \"pre\"\n }, {\n \"className\": \"language-shell\"\n }), \"deno run --allow-net --allow-read mod.ts\\n\")), mdx(\"p\", null, \"To access this easily, most likely all you need to do is press the \", mdx(\"strong\", {\n parentName: \"p\"\n }, \"UP ARROW\"), \" key. Feel free to copy paste this if it doesn't work.\"), mdx(\"p\", null, \"Once the bot is started try \", mdx(\"inlineCode\", {\n parentName: \"p\"\n }, \"!help invite\"), \" again and you will see the change! \\uD83C\\uDF89\"), mdx(\"h2\", null, \"Command Aliases\"), mdx(\"p\", null, \"Now, let's make this a little bit easier. What if we wanted this command to also work with other names besides \", mdx(\"inlineCode\", {\n parentName: \"p\"\n }, \"invite\"), \". For example, as a shortcut what if users could just type \", mdx(\"inlineCode\", {\n parentName: \"p\"\n }, \"!inv\"), \" or as an alias type \", mdx(\"inlineCode\", {\n parentName: \"p\"\n }, \"!join\"), \". Let's go ahead and set that up. Go to the very last line of invite command file and type in \", mdx(\"inlineCode\", {\n parentName: \"p\"\n }, \"alias\"), \". You will see a popup showing you an autocompleted version of \", mdx(\"inlineCode\", {\n parentName: \"p\"\n }, \"createCommandAliases\"), \". Press enter and boom the magic is happening!\"), mdx(\"p\", null, \"The createCommandAliases takes in two arguments. The first argument is always the command name. In this case it is \", mdx(\"inlineCode\", {\n parentName: \"p\"\n }, \"invite\"), \". The second argument is the aliases you want to provide. Let's add in the two aliases we wanted.\"), mdx(\"pre\", null, mdx(\"code\", _extends({\n parentName: \"pre\"\n }, {\n \"className\": \"language-ts\"\n }), \" `https://discordapp.com/oauth2/authorize?client_id=${botID}&scope=bot&permissions=68640`,\\n );\\n },\\n});\\n\\ncreateCommandAliases('invite', ['inv', 'join'])\\n\")), mdx(\"blockquote\", null, mdx(\"p\", {\n parentName: \"blockquote\"\n }, mdx(\"strong\", {\n parentName: \"p\"\n }, \"Note:\"), \" If you only want to add 1 alias, you can pass in a simple string instead of an array as well as the second argument.\")), mdx(\"p\", null, \"Notice, I added 2 aliases here. You can add as many aliases as you like. If you see a lot of users typing it wrong by accident you can add those typos as aliases as well.\"), mdx(\"p\", null, \"Let's start testing this out. But first, let's understand something important.\"), mdx(\"h2\", null, \"Reloading\"), mdx(\"p\", null, \"Okay, we need to first understand a core concept of developing discord bots. If you had to restart your bot every time you made a tiny change, it would get really annoying/tedious to do. Also, if you had restarted your bot 1000 times, you would be in big trouble because Discord would ban your bot for 24 hours. The bigger your bot gets, the faster it is to hit this limit of 1000 identify calls to the Discord API.\"), mdx(\"p\", null, \"To solve this issue, Discordeno provides you with a really cool \", mdx(\"inlineCode\", {\n parentName: \"p\"\n }, \"reload\"), \" command. Whenever you make a change to any command, event, monitor, inhibitor, task, language or argument you can simply reload it. You don't need to restart your bot every time.\"), mdx(\"p\", null, \"Now since we added the aliases above, let's test it out.\"), mdx(\"ol\", null, mdx(\"li\", {\n parentName: \"ol\"\n }, mdx(\"inlineCode\", {\n parentName: \"li\"\n }, \"!inv\"), \" this will not work\"), mdx(\"li\", {\n parentName: \"ol\"\n }, mdx(\"inlineCode\", {\n parentName: \"li\"\n }, \"!reload commands\"), \" this will reload the files and the aliases will be created.\"), mdx(\"li\", {\n parentName: \"ol\"\n }, mdx(\"inlineCode\", {\n parentName: \"li\"\n }, \"!inv\"), \" This will now work. \\uD83C\\uDF89\")), mdx(\"hr\", null), mdx(\"p\", null, \"Perfect! You can take some time and customize the invite command to your needs if you wish. For example, this is my bot's invite command.\"), mdx(\"p\", null, mdx(\"img\", _extends({\n parentName: \"p\"\n }, {\n \"src\": \"https://i.imgur.com/4WRFMtR.png\",\n \"alt\": \"image\"\n }))), mdx(\"p\", null, \"Nice! You can now customize any of the commands from Discordeno as you wish. Then we will continue to making our very own command so we can learn about all the options that Discordeno gives us when it comes to making commands. As you learn more in this guide, you can keep improving it.\"), mdx(\"p\", null, \"If you get stuck, don't worry. When you are ready, let's continue to the next step.\"), mdx(\"h2\", null, \"Creating A Command\"), mdx(\"p\", null, \"Let's make a command that will allow guild admins to give or take roles from a member. Since, we are creating a \", mdx(\"inlineCode\", {\n parentName: \"p\"\n }, \"Moderation\"), \" command to give or take roles, let's go ahead and create a Category folder called \", mdx(\"inlineCode\", {\n parentName: \"p\"\n }, \"Moderation\"), \" and then create a file called \", mdx(\"inlineCode\", {\n parentName: \"p\"\n }, \"role.ts\"), \". Once the file is made, you can paste this following base snippet to make our first command.\"), mdx(\"pre\", null, mdx(\"code\", _extends({\n parentName: \"pre\"\n }, {\n \"className\": \"language-ts\"\n }), \"import { botCache } from \\\"../../mod.ts\\\";\\nimport { sendMessage } from \\\"https://raw.githubusercontent.com/Skillz4Killz/Discordeno/v7/src/handlers/channel.ts\\\";\\nimport { PermissionLevels } from \\\"../types/commands.ts\\\";\\nimport { createCommandAliases } from \\\"../utils/helpers\\\";\\n\\nbotCache.commands.set(\\\"commandname\\\", {\\n name: \\\"commandname\\\",\\n dmOnly: false,\\n guildOnly: false,\\n nsfw: false,\\n permissionLevel: [PermissionLevels.MEMBER],\\n botServerPermissions: [],\\n botChannelPermissions: [],\\n userServerPermissions: [],\\n userChannelPermissions: [],\\n description: string,\\n cooldown: {\\n seconds: 0,\\n allowedUses: 0,\\n },\\n arguments: [],\\n execute: function (message, args, guild) {\\n // The code for your command goes here\\n }\\n});\\n\\n// createCommandAliases(\\\"commandname\\\", [\\\"alias\\\"])\\n\")), mdx(\"h2\", null, \"Understanding Command Options\"), mdx(\"p\", null, \"Woah! We just added a massive file but most of that stuff is new to us. Don't worry, let's break everything down step by step.\"), mdx(\"blockquote\", null, mdx(\"p\", {\n parentName: \"blockquote\"\n }, mdx(\"strong\", {\n parentName: \"p\"\n }, \"Note:\"), \" Any options that are not changed from the snippet above can actually be deleted as Discordeno will use the default option if you do not provide anything for that option. This can help keep your files cleaner.\")), mdx(\"p\", null, \"Before we start, quickly update the command name and description.\"), mdx(\"blockquote\", null, mdx(\"p\", {\n parentName: \"blockquote\"\n }, mdx(\"strong\", {\n parentName: \"p\"\n }, \"Note:\"), \" Once you highlight the \", mdx(\"inlineCode\", {\n parentName: \"p\"\n }, \"commandname\"), \", press \", mdx(\"strong\", {\n parentName: \"p\"\n }, \"CTRL + SHIFT + L\"), \" to select ALL the \", mdx(\"inlineCode\", {\n parentName: \"p\"\n }, \"commandname\"), \" on the file and you can easily replace them at once. Another useful shortcut you may use when coding your bot is \", mdx(\"strong\", {\n parentName: \"p\"\n }, \"CTRL + D\"), \" after highlighting. This shortcut selects the next place where the same text exists as thing in the file that has the same thing as you highlighted.\")), mdx(\"h2\", null, \"dmOnly & guildOnly Options\"), mdx(\"p\", null, \"The \", mdx(\"inlineCode\", {\n parentName: \"p\"\n }, \"dmOnly\"), \" option is available if you want to make sure this command only runs in a direct message. If this command is ran in a server, the command will immediately exit out.\"), mdx(\"p\", null, \"On the other hand, \", mdx(\"inlineCode\", {\n parentName: \"p\"\n }, \"guildOnly\"), \" is the opposite. To easily make sure that this command is never allowed in a private message you can simple enable this.\"), mdx(\"p\", null, \"If you want to allow a command to be able to run both in a server and in a direct message, simply set them both to false.\"), mdx(\"p\", null, \"Remember if you want either of them as false, you can simply delete them and it will default to \", mdx(\"inlineCode\", {\n parentName: \"p\"\n }, \"false\"), \" allowing your bot to be cleaner and easier to read. However, if your prefer keeping it you can.\"), mdx(\"p\", null, \"For the purpose of this guide, we want our \", mdx(\"inlineCode\", {\n parentName: \"p\"\n }, \"role\"), \" comamnd to only be run in a server, so we can set \", mdx(\"inlineCode\", {\n parentName: \"p\"\n }, \"guildOnly\"), \" to be \", mdx(\"strong\", {\n parentName: \"p\"\n }, \"true\"), \" and delete the \", mdx(\"inlineCode\", {\n parentName: \"p\"\n }, \"dmOnly\"), \" option.\"), mdx(\"h2\", null, \"NSFW Option\"), mdx(\"p\", null, \"NSFW stands for \", mdx(\"strong\", {\n parentName: \"p\"\n }, \"Not Safe For Work\"), \". One of Discord's rules is that you enforce that NSFW content is sent only in NSFW channels. Discordeno has this built in. You simple tell Discordeno, that you want a command to be considered \", mdx(\"inlineCode\", {\n parentName: \"p\"\n }, \"nsfw\"), \" or not.\"), mdx(\"p\", null, \"If this option is enabled, this command will only be able to be used in a \", mdx(\"inlineCode\", {\n parentName: \"p\"\n }, \"nsfw\"), \" channel on a server. Discord does not consider Direct Messages as nsfw safe!\"), mdx(\"h2\", null, \"Permission Level Option\"), mdx(\"p\", null, \"Permission levels are a very powerful feature that easily allow you to set what permission is required to run a command. We will cover this in detail, in a separate section dedicated to permission levels. For now, just understand that this will restrict certain users from using a command.\"), mdx(\"p\", null, \"For example, the role command we only want to be used by moderators or server admins.\"), mdx(\"p\", null, \"Discordeno makes this pretty simple for us.\"), mdx(\"pre\", null, mdx(\"code\", _extends({\n parentName: \"pre\"\n }, {\n \"className\": \"language-ts\"\n }), \"permissionLevels: [PermissionLevels.MODERATOR, PermissionLevels.ADMIN]\\n\")), mdx(\"p\", null, \"We're not going to cover this in detail, here because we will have an entire in depth guide for permission levels. If you want to pause and learn it now, feel free: \", mdx(\"a\", _extends({\n parentName: \"p\"\n }, {\n \"href\": \"https://discordeno.netlify.app/advanced/permlevels\"\n }), \"Permission Levels Advanced Guide\")), mdx(\"h2\", null, \"Permissions Check Options\"), mdx(\"p\", null, \"Discordeno provides you 4 different types of permission handling that will be done before the command function is executed. This allows you to make sure that the permissions are available before running a command. For example, the role command will require the bot to have \", mdx(\"strong\", {\n parentName: \"p\"\n }, \"MANAGE ROLES\"), \" permission. This permission comes from the server settings so we can require this in the \", mdx(\"inlineCode\", {\n parentName: \"p\"\n }, \"botServerPermissions\"), \".\"), mdx(\"pre\", null, mdx(\"code\", _extends({\n parentName: \"pre\"\n }, {\n \"className\": \"language-ts\"\n }), \"botServerPermissions: [\\\"MANAGE_ROLES\\\"],\\n\")), mdx(\"p\", null, \"Discordeno will provide you easy to use auto-completion as soon as you type a single letter or two. This will help make it easier to use and will warn you when you make a typo and provide a wrong permission by accident.\"), mdx(\"p\", null, \"We also want to make sure that the bot can send a message in this channel so that we can respond to the user. This will check the correct permission heirarchy to make sure that the bot can indeed send a message in this channel.\"), mdx(\"pre\", null, mdx(\"code\", _extends({\n parentName: \"pre\"\n }, {\n \"className\": \"language-ts\"\n }), \"botChannelPermissions: [\\\"SEND_MESSAGES\\\"],\\n\")), mdx(\"blockquote\", null, mdx(\"p\", {\n parentName: \"blockquote\"\n }, mdx(\"strong\", {\n parentName: \"p\"\n }, \"Note:\"), \" If you want to send an embed response, you should also make sure it has the \", mdx(\"inlineCode\", {\n parentName: \"p\"\n }, \"EMBED_LINKS\"), \" permission.\")), mdx(\"p\", null, \"Already we have prevented two of the largest errors that can get our bot banned if it is not checked. Discordeno handles this internally so you don't have to worry about it.\"), mdx(\"p\", null, \"Sometimes, you may also want to make sure that the user using the command has a certain permission to run the command. To do this, you can use the \", mdx(\"inlineCode\", {\n parentName: \"p\"\n }, \"userServerPermissions\"), \" or the \", mdx(\"inlineCode\", {\n parentName: \"p\"\n }, \"userChannelPermissions\"), \".\"), mdx(\"h2\", null, \"Cooldown Options\"), mdx(\"p\", null, \"The cooldown options go hand in hand together.\"), mdx(\"ul\", null, mdx(\"li\", {\n parentName: \"ul\"\n }, mdx(\"inlineCode\", {\n parentName: \"li\"\n }, \"seconds\"), \" is how long to make the user wait in seconds before they can use the command again. By default, there is no wait time aka 0 seconds.\"), mdx(\"li\", {\n parentName: \"ul\"\n }, mdx(\"inlineCode\", {\n parentName: \"li\"\n }, \"allowedUses\"), \" is how many times a user is allowed to use a command before they are placed on cooldown.\"), mdx(\"li\", {\n parentName: \"ul\"\n }, \"Let's use our command as an example. We don't want someone to start spamming the role command so we can add a cooldown of 60 seconds. However, this would mean every time you give a role to someone, you would need to wait a whole minute to give a role to someone else. This is where \", mdx(\"inlineCode\", {\n parentName: \"li\"\n }, \"allowedUses\"), \" shines! Let's set it to to 5 so that a user can use this command 5 times in a row before being asked to wait for 60 seconds.\")), mdx(\"pre\", null, mdx(\"code\", _extends({\n parentName: \"pre\"\n }, {\n \"className\": \"language-ts\"\n }), \"cooldown: {\\n seconds: 60,\\n allowedUses: 5\\n},\\n\")), mdx(\"blockquote\", null, mdx(\"p\", {\n parentName: \"blockquote\"\n }, mdx(\"strong\", {\n parentName: \"p\"\n }, \"Note:\"), \" It is important to understand the way these two interact. The cooldown starts as soon as the first command is used. So, if a user uses the role command 5 times in 59 seconds, they only have to wait 1 second to do another 5 times.\")), mdx(\"p\", null, \"Let's give this a try shall we.\"), mdx(\"ol\", null, mdx(\"li\", {\n parentName: \"ol\"\n }, mdx(\"inlineCode\", {\n parentName: \"li\"\n }, \"!reload commands\")), mdx(\"li\", {\n parentName: \"ol\"\n }, \"Spam the \", mdx(\"inlineCode\", {\n parentName: \"li\"\n }, \"!role\"), \" very quickly 6 times in under a minute.\")), mdx(\"h2\", null, \"Arguments\"), mdx(\"p\", null, \"Arguments is an incredibly powerful feature in Discordeno. Like Permission Levels we will have an in depth look at arguments later in the guide. For now, let's try and understand this in a simple manner.\"), mdx(\"ul\", null, mdx(\"li\", {\n parentName: \"ul\"\n }, mdx(\"inlineCode\", {\n parentName: \"li\"\n }, \"name\"), \": The name of the argument. Useful for when you need to alert the user X arg is missing or when you want to use the arg in your command.\"), mdx(\"li\", {\n parentName: \"ul\"\n }, mdx(\"inlineCode\", {\n parentName: \"li\"\n }, \"type\"), \": The type of the argument you would like. Defaults to string. Some of the ones available by default are \\\"number\\\", \\\"string\\\", \\\"...string\\\", \\\"boolean\\\", \\\"subcommand\\\", \\\"member\\\".\"), mdx(\"li\", {\n parentName: \"ul\"\n }, mdx(\"inlineCode\", {\n parentName: \"li\"\n }, \"missing\"), \": a function that will be run when this argument is not provided by the user or if the provided argument is not valid. By default, it does nothing.\"), mdx(\"li\", {\n parentName: \"ul\"\n }, mdx(\"inlineCode\", {\n parentName: \"li\"\n }, \"required\"), \": Whether this argument is required or optional. By default, this is true.\"), mdx(\"li\", {\n parentName: \"ul\"\n }, mdx(\"inlineCode\", {\n parentName: \"li\"\n }, \"lowercase\"), \": If the type is a string, this can forcibly lowercase the string.\"), mdx(\"li\", {\n parentName: \"ul\"\n }, mdx(\"inlineCode\", {\n parentName: \"li\"\n }, \"literals\"), \": If the type is string or subcommand you can provide literals. The argument MUST be exactly the same as the literals to be accepted. For example, if you want to make sure the argument is \", mdx(\"inlineCode\", {\n parentName: \"li\"\n }, \"a\"), \" or \", mdx(\"inlineCode\", {\n parentName: \"li\"\n }, \"b\"), \" only and not \", mdx(\"inlineCode\", {\n parentName: \"li\"\n }, \"c\"), \".\"), mdx(\"li\", {\n parentName: \"ul\"\n }, mdx(\"inlineCode\", {\n parentName: \"li\"\n }, \"defaultValue\"), \": The default value for this argument/subcommand. If the user does not provide an argument or it is invalid, it can be defaulted to a certain value.\")), mdx(\"p\", null, \"For our role command, we need a \", mdx(\"inlineCode\", {\n parentName: \"p\"\n }, \"member\"), \" and a \", mdx(\"inlineCode\", {\n parentName: \"p\"\n }, \"role\"), \".\"), mdx(\"pre\", null, mdx(\"code\", _extends({\n parentName: \"pre\"\n }, {\n \"className\": \"language-ts\"\n }), \"arguments: [\\n {\\n name: \\\"member\\\",\\n type: \\\"member\\\",\\n missing: (message) => {\\n sendResponse(message, `you did not provide a member to give the role to. You can provide a @member mention, a member ID, or try using their nickname/username. The nickname/username will only work if they have been active in your server recently.`)\\n }\\n },\\n {\\n name: \\\"role\\\",\\n type: \\\"role\\\",\\n missing: (message) => {\\n sendResponse(message, `you did not provide a role to give. You can provide a @role mention, a role ID, or it's name. If the role name did not work, try to use the **roleinfo** command to get the role ID.`)\\n }\\n }\\n]\\n\")), mdx(\"h2\", null, \"Execute Option\"), mdx(\"p\", null, \"The execute option is the code that will run when the command is triggered. The execute function is passed 3 parameters that you can use in your command.\"), mdx(\"ul\", null, mdx(\"li\", {\n parentName: \"ul\"\n }, mdx(\"inlineCode\", {\n parentName: \"li\"\n }, \"message\"), \": The message object itself that triggered this command.\"), mdx(\"li\", {\n parentName: \"ul\"\n }, mdx(\"inlineCode\", {\n parentName: \"li\"\n }, \"args\"), \": The args that were provided by the user.\"), mdx(\"li\", {\n parentName: \"ul\"\n }, mdx(\"inlineCode\", {\n parentName: \"li\"\n }, \"guild\"), \": The server guild object where this command was run.\")), mdx(\"pre\", null, mdx(\"code\", _extends({\n parentName: \"pre\"\n }, {\n \"className\": \"language-ts\"\n }), \"execute: function (message, args, guild) {\\n // The code that is to be executed goes here\\n}\\n\")), mdx(\"blockquote\", null, mdx(\"p\", {\n parentName: \"blockquote\"\n }, mdx(\"strong\", {\n parentName: \"p\"\n }, \"Note:\"), \" I prefer writing code using the function keyword, but you can easily change to the fat arrow function if you prefer.\"), mdx(\"pre\", {\n parentName: \"blockquote\"\n }, mdx(\"code\", _extends({\n parentName: \"pre\"\n }, {\n \"className\": \"language-ts\"\n }), \"execute: (message, args, guild) => {\\n // The code that is to be executed goes here\\n}\\n\"))), mdx(\"p\", null, \"Let's start out by writing some pseudo-code(comments that will help us plan the code).\"), mdx(\"pre\", null, mdx(\"code\", _extends({\n parentName: \"pre\"\n }, {\n \"className\": \"language-ts\"\n }), \"execute: function (message, args, guild) {\\n // If this was the everyone role alert with a silly error\\n\\n // If this is a managed role(some bots role) we can't give/remove alert with silly error\\n\\n // Get the bots highest role\\n\\n // Check if the bot has a role higher than the role that it will try to give.\\n\\n // If the role is too high alert the user.\\n\\n // If the user has this role already remove the role from them.\\n\\n // Check the command author's highest role\\n\\n // If the author does not have a role high enough to give this role alert\\n\\n // If the user has this role already we should remove it\\n\\n // Add the role to the user.\\n\\n // Alert the user that used the command that the user has been give the role.\\n}\\n\")), mdx(\"p\", null, \"Nice! The plan for the code is complete. Now, let's add in the code.\"), mdx(\"p\", null, \"The first thing we are going to try is to check if the role the user provided is the same as the everyone role.\"), mdx(\"blockquote\", null, mdx(\"p\", {\n parentName: \"blockquote\"\n }, mdx(\"strong\", {\n parentName: \"p\"\n }, \"Note:\"), \" The everyone role ID is the same as the server guild ID.\")), mdx(\"p\", null, \"To do this, we are going to want something like this:\"), mdx(\"pre\", null, mdx(\"code\", _extends({\n parentName: \"pre\"\n }, {\n \"className\": \"language-ts\"\n }), \"if (args.role.id === message.guildID) {\\n return sendResponse(message, \\\"The everyone role can not be given to anyone because everyone has the everyone role already. *Keep calm and let Carter figure it out*!\\\");\\n}\\n\")), mdx(\"p\", null, \"You might be seeing an error since we didn't provide the accurate typings for the \", mdx(\"inlineCode\", {\n parentName: \"p\"\n }, \"args\"), \" parameter. The message and guild parameter is automated but the args is dynamic depending on your \", mdx(\"inlineCode\", {\n parentName: \"p\"\n }, \"arguments\"), \" option for your command. So let's do this real quick.\"), mdx(\"pre\", null, mdx(\"code\", _extends({\n parentName: \"pre\"\n }, {\n \"className\": \"language-ts\"\n }), \"execute: function (message, args: RoleArgs, guild) {\\n // If this was the everyone role alert with a silly error\\n if (args.role.id === message.guildID) {\\n return sendResponse(message, \\\"Are you trying to make this person a super hero? Everyone has the everyone role. I can't give the everyone role to another user.\\\");\\n }\\n\\n // Lots of comments here hidden so you can see the changes easily.\\n}\\n\\ninterface RoleArgs {\\n role: Role;\\n member: Member;\\n}\\n\")), mdx(\"p\", null, \"Awesome! Let's keep going.\"), mdx(\"pre\", null, mdx(\"code\", _extends({\n parentName: \"pre\"\n }, {\n \"className\": \"language-ts\"\n }), \"execute: function (message, args: RoleArgs, guild) {\\n // If this was the everyone role alert with a silly error\\n if (args.role.id === message.guildID) {\\n return sendResponse(message, \\\"I don't know if you noticed or not but I'm an extremely arrogant bot who tends to think all of his plans will work. But I can't give the everyone role to someone.\\\");\\n }\\n\\n // If this is a managed role(some bots role) we can't give/remove alert with silly error\\n if (args.role.managed) {\\n return sendResponse(message, \\\"Dammit man, just 'cause I'm Scottish doesn't mean I can give your people managed roles.\\\")\\n }\\n\\n // Get the bots highest role\\n const botsHighestRole = highestRole(message.guildID, botID);\\n\\n // Check if the bot has a role higher than the role that it will try to give.\\n const botIsHigher = higherRolePosition(message.guildID, botsHighestRole.id, args.role.id)\\n\\n // If the role is too high alert the user.\\n if (!botIsHigher) {\\n return sendResponse(message, \\\"Okay look, asking me give a role that is higher than my highest role is ridiculous! I am the first bot to admit I don't know who these people are nor do I care to. Look, if you'd like I could take you down the hall and just point at the people who annoy me more than the rest. But that's about as useful as I get.\\\")\\n }\\n\\n // Check the command author's highest role\\n const membersHighestRole = highestRole(message.guildID, message.author.id);\\n\\n // If the author does not have a role high enough to give this role alert\\n if (!higherRolePosition(message.guildID, membersHighestRole.id, args.role.id)) {\\n return sendResponse(message, \\\"In my culture, whenever someone tries to give a role that is higher than their highest role, I would be well within my rights to dismember you.\\\")\\n }\\n\\n // If the user has this role already we should remove it\\n if (message.member().roles.includes(args.role.id)) {\\n removeRole(message.guildID, args.member.user.id, args.role.id, `${message.author.tag} used the role command to remove this role.`)\\n // Alert the user that used the command that the user has lost the role.\\n return sendResponse(message, `The role **${args.role.name}** has been removed from **${args.member.tag}**.`)\\n }\\n\\n // Add the role to the user.\\n addRole(guildID, memberID, roleID)\\n\\n // Alert the user that used the command that the user has been give the role.\\n return sendResponse(message, `The role **${args.role.name}** has been added to **${args.member.tag}**.`)\\n}\\n\")), mdx(\"p\", null, \"The final version of the command should look something like this:\"), mdx(\"pre\", null, mdx(\"code\", _extends({\n parentName: \"pre\"\n }, {\n \"className\": \"language-ts\"\n }), \"import { highestRole, higherRolePosition, botID, removeRole, addRole, Role, Member } from \\\"../../deps.ts\\\";\\nimport { botCache } from \\\"../../mod.ts\\\";\\nimport { PermissionLevels } from \\\"../types/commands.ts\\\";\\nimport { sendResponse } from \\\"../utils/helpers.ts\\\";\\n\\nbotCache.commands.set(\\\"role\\\", {\\n name: \\\"role\\\",\\n permissionLevel: [PermissionLevels.MODERATOR, PermissionLevels.ADMIN],\\n botServerPermissions: [\\\"MANAGE_ROLES\\\"],\\n botChannelPermissions: [\\\"SEND_MESSAGES\\\"],\\n cooldown: {\\n seconds: 60,\\n allowedUses: 5,\\n },\\n arguments: [\\n {\\n name: \\\"member\\\",\\n type: \\\"member\\\",\\n missing: (message) => {\\n sendResponse(message, `you did not provide a member to give the role to. You can provide a @member mention, a member ID, or try using their nickname/username. The nickname/username will only work if they have been active in your server recently.`)\\n }\\n },\\n {\\n name: \\\"role\\\",\\n type: \\\"role\\\",\\n missing: (message) => {\\n sendResponse(message, `you did not provide a role to give. You can provide a @role mention, a role ID, or it's name. If the role name did not work, try to use the **roleinfo** command to get the role ID.`)\\n }\\n }\\n ],\\n execute: function (message, args: RoleArgs) {\\n // If this was the everyone role alert with a silly error\\n if (args.role.id === message.guildID) {\\n return sendResponse(\\n message,\\n \\\"I don't know if you noticed or not but I'm an extremely arrogant bot who tends to think all of his plans will work. But I can't give the everyone role to someone.\\\",\\n );\\n }\\n\\n // If this is a managed role(some bots role) we can't give/remove alert with silly error\\n if (args.role.managed) {\\n return sendResponse(\\n message,\\n \\\"Dammit man, just 'cause I'm Scottish doesn't mean I can give your people managed roles.\\\",\\n );\\n }\\n\\n // Get the bots highest role\\n const botsHighestRole = highestRole(message.guildID, botID);\\n\\n // Check if the bot has a role higher than the role that it will try to give. If the role is too high alert the user.\\n if (!botsHighestRole || !higherRolePosition(\\n message.guildID,\\n botsHighestRole.id,\\n args.role.id,\\n )) {\\n return sendResponse(\\n message,\\n \\\"Okay look, asking me give a role that is higher than my highest role is ridiculous! I am the first bot to admit I don't know who these people are nor do I care to. Look, if you'd like I could take you down the hall and just point at the people who annoy me more than the rest. But that's about as useful as I get.\\\",\\n );\\n }\\n\\n // Check the command author's highest role\\n const membersHighestRole = highestRole(message.guildID, message.author.id);\\n\\n // If the author does not have a role high enough to give this role alert\\n if (!membersHighestRole ||\\n !higherRolePosition(message.guildID, membersHighestRole.id, args.role.id)\\n ) {\\n return sendResponse(\\n message,\\n \\\"In my culture, whenever someone tries to give a role that is higher than their highest role, I would be well within my rights to dismember you.\\\",\\n );\\n }\\n\\n // If the user has this role already we should remove it\\n if (message.member()?.roles.includes(args.role.id)) {\\n removeRole(\\n message.guildID,\\n args.member.user.id,\\n args.role.id,\\n `${message.author.username} used the role command to remove this role.`,\\n );\\n // Alert the user that used the command that the user has lost the role.\\n return sendResponse(\\n message,\\n `The role **${args.role.name}** has been removed from **${args.member.tag}**.`,\\n );\\n }\\n\\n // Add the role to the user.\\n addRole(message.guildID, args.member.user.id, args.role.id, `${message.author.username} used the role command to give this role.`);\\n\\n // Alert the user that used the command that the user has been give the role.\\n return sendResponse(\\n message,\\n `The role **${args.role.name}** has been added to **${args.member.tag}**.`,\\n );\\n },\\n});\\n\\ninterface RoleArgs {\\n role: Role;\\n member: Member;\\n}\\n\")), mdx(\"blockquote\", null, mdx(\"p\", {\n parentName: \"blockquote\"\n }, mdx(\"strong\", {\n parentName: \"p\"\n }, \"Note:\"), \" The response strings are a play on some funny Stargate(my favorite tv show) moments. Feel free to change as you wish to fit your bot's personality.\")), mdx(\"h2\", null, \"Dynamic(Advanced Level) Command Creation\"), mdx(\"p\", null, \"This is some advanced level super magical command creation skills. Discordeno gives you the power to dynamically create commands. What that means is you can write the code for one command but dynamically create like 50 commands using that same code.\"), mdx(\"p\", null, \"For example, in my main bot I have a lot of \\\"fun\\\" commands like \", mdx(\"inlineCode\", {\n parentName: \"p\"\n }, \".hug\"), \" or \", mdx(\"inlineCode\", {\n parentName: \"p\"\n }, \".kiss\"), \" etc... All of these files have the exact same code except for 1 word being the command name. Would it not be better to simply write the code once and dynamically create every single command. Let me show you how that works.\"), mdx(\"ul\", null, mdx(\"li\", {\n parentName: \"ul\"\n }, \"Create a file in the commands folder called \", mdx(\"inlineCode\", {\n parentName: \"li\"\n }, \"fun.ts\"), \" which will create all our fun commands.\")), mdx(\"pre\", null, mdx(\"code\", _extends({\n parentName: \"pre\"\n }, {\n \"className\": \"language-ts\"\n }), \"import { Member, sendMessage, chooseRandom, avatarURL } from \\\"../../deps.ts\\\";\\nimport { botCache } from \\\"../../mod.ts\\\";\\nimport { createCommandAliases, sendEmbed } from \\\"../utils/helpers.ts\\\";\\nimport { configs } from \\\"../../configs.ts\\\";\\nimport { Embed } from \\\"../utils/Embed.ts\\\";\\nimport { translate } from \\\"../utils/i18next.ts\\\";\\n\\nconst funCommandData = [\\n { name: \\\"bite\\\", gifs: configs.gifs.bite },\\n { name: \\\"cuddle\\\", gifs: configs.gifs.cuddle },\\n { name: \\\"dance\\\", gifs: configs.gifs.dance },\\n { name: \\\"hug\\\", gifs: configs.gifs.hug },\\n { name: \\\"kiss\\\", gifs: configs.gifs.kiss },\\n { name: \\\"kanna\\\", gifs: configs.gifs.kanna },\\n { name: \\\"kiss\\\", gifs: configs.gifs.kiss },\\n { name: \\\"kitten\\\", gifs: configs.gifs.kitten },\\n { name: \\\"lmao\\\", gifs: configs.gifs.lmao, aliases: [\\\"lol\\\"] },\\n { name: \\\"pat\\\", gifs: configs.gifs.pat },\\n { name: \\\"poke\\\", gifs: configs.gifs.poke },\\n { name: \\\"pony\\\", gifs: configs.gifs.pony },\\n { name: \\\"puppy\\\", gifs: configs.gifs.puppy },\\n { name: \\\"raphtalia\\\", gifs: configs.gifs.raphtalia },\\n { name: \\\"stargate\\\", gifs: configs.gifs.stargate },\\n { name: \\\"supernatural\\\", gifs: configs.gifs.supernatural },\\n { name: \\\"tickle\\\", gifs: configs.gifs.tickle },\\n { name: \\\"zerotwo\\\", gifs: configs.gifs.zerotwo },\\n];\\n\\nfunCommandData.forEach((data) => {\\n botCache.commands.set(data.name, {\\n name: data.name,\\n botChannelPermissions: [\\\"SEND_MESSAGES\\\", \\\"EMBED_LINKS\\\"],\\n cooldown: {\\n seconds: 2,\\n },\\n arguments: [\\n {\\n name: \\\"member\\\",\\n type: \\\"member\\\",\\n required: false,\\n },\\n ],\\n execute: function (message, args: FunArgs) {\\n // If a member is provided use that otherwise set the member themself\\n const member = args.member || message.member()!;\\n\\n const type = member.user.id === message.author.id\\n // Silly response like if user tries to hug themself\\n ? \\\"SELF\\\"\\n // Response for when user tries to hug another user\\n : \\\"OTHER\\\";\\n\\n\\n // Create an embed\\n const embed = new Embed()\\n .setAuthor(member.tag, avatarURL(member))\\n .setDescription(\\n translate(\\n message.guildID,\\n `commands/fun/${data.name}:${type}`,\\n { mention: message.member()!.mention, user: member.mention },\\n ),\\n )\\n .setImage(chooseRandom(data.gifs));\\n\\n return sendEmbed(message.channel, embed);\\n },\\n });\\n\\n if (data.aliases?.length) {\\n createCommandAliases(data.name, data.aliases);\\n }\\n});\\n\\ninterface FunArgs {\\n member?: Member;\\n}\\n\")), mdx(\"blockquote\", null, mdx(\"p\", {\n parentName: \"blockquote\"\n }, mdx(\"strong\", {\n parentName: \"p\"\n }, \"Note:\"), \" The imports in this are a bit different. I did this to show you that you can also import everything grouped like this through the \", mdx(\"inlineCode\", {\n parentName: \"p\"\n }, \"deps.ts\"), \" which will make everything available to you at ease.\")), mdx(\"p\", null, \"Take a minute to realize what just happened. This has made 18 different unique commands dynamically. In 1 file, using the same piece of code, we created so many commands. You can easily add more commands to this. For example, if you wanted to add weeb(animated) versions of these commands. Then you are at 36 commands with 1 simple command file.\"), mdx(\"p\", null, mdx(\"strong\", {\n parentName: \"p\"\n }, \"That ladies and gentleman is the power and magic of Discordeno!\")), mdx(\"p\", null, \"Take a minute to stand up, step back and make some room around you. Now start dancing because you just acheived one of the most complex things in bot development. You have already created about 36 commands!!!!\"), mdx(\"blockquote\", null, mdx(\"p\", {\n parentName: \"blockquote\"\n }, mdx(\"strong\", {\n parentName: \"p\"\n }, \"Note:\"), \" The command above uses translations which we will cover in depth in a later section of this guide.\")), mdx(\"p\", null, \"Once you are ready, let's proceed to making our events.\"));\n}\n;\nMDXContent.isMDXComponent = true;","rawMDXOutput":"/* @jsx mdx */\nimport { mdx } from '@mdx-js/react';\n/* @jsx mdx */\n\nexport const _frontmatter = {\n \"title\": \"Creating A Command\",\n \"metaTitle\": \"Creating A Command | Discordeno\",\n \"metaDescription\": \"Let's create our very first command with Discordeno!\"\n};\n\nconst layoutProps = {\n _frontmatter\n};\nconst MDXLayout = \"wrapper\"\nexport default function MDXContent({\n components,\n ...props\n}) {\n return \n

{`Really great job. Now, lets dive into trying to use some of the commands and try to make our very own command.`}

\n

{`Editing Invite Command`}

\n

{`Let's first start by taking an existing command and slightly modifying it to your needs. Let's use the `}{`Invite`}{` command as our example. When you open the command, you will see something like this:`}

\n
{`import { botCache } from \"../../mod.ts\";\nimport { sendMessage } from \"https://raw.githubusercontent.com/Skillz4Killz/Discordeno/v7/src/handlers/channel.ts\";\nimport { botID } from \"https://raw.githubusercontent.com/Skillz4Killz/Discordeno/v7/src/module/client.ts\";\n\nbotCache.commands.set(\"invite\", {\n  name: \"invite\",\n  execute: function (message) {\n    // Replace the permission number at the end to request the permissions you wish to request. By default, this will request Admin perms.\n    sendMessage(\n      message.channel,\n      \\`https://discordapp.com/oauth2/authorize?client_id=\\${botID}&scope=bot&permissions=8\\`,\n    );\n  },\n});\n`}
\n

{`Let's break this down. The first three lines are importing the necessary things from their files so we can use them in this command. Don't worry if this doesn't make sense, most of the time, this will all be done automatically for you if you use a good code editor like Visual Studio Code. We create a command by doing:`}

\n
{`botCache.commands.set('commandname', {\n\n})\n`}
\n

{`The command name here must be unique. If it is not unique, your commands will not work properly as you wish. For example, you can't have 2 commands with the `}{`ping`}{` name. In this case, our command is called `}{`invite`}{`.`}

\n

{`The `}{`name: 'invite'`}{` is also written as it is useful for our help command and inhibitors! Normally, these two things will be the same. So far it's super easy right.`}

\n

{`Next is the `}{`execute`}{`. This is where the magic happens. This is the function that is triggered when the command is ran by a user. In this case, the bot simply sends a message to a channel where the command was ran and sends an invite link. Let's take a minute and optimize this for our case. We don't `}{`NEED`}{` admin permissions for our bot. Let's go to the `}{`permission calculator`}{` and figure out the permissions we need for our bot.`}

\n

{`Once you have decided which permissions you want to request, you can copy the number and replace it here. For example, if we want `}{`68640`}{` as our permissions. We can modify our command to be:`}

\n
{`    \\`https://discordapp.com/oauth2/authorize?client_id=\\${botID}&scope=bot&permissions=68640\\`,\n`}
\n

{`Lastly, let's get rid of the comment there as now it is customized to our needs.`}

\n

{`Command Descriptions`}

\n

{`Right now, if you were to go to Discord and type `}{`!help invite`}{`, you would see quite a bit of information. But where does all that text come from? It's not in this file. The description option tells Discordeno what to show the user when they use the help command. In that help message, each command has a small description next to it. The magic is happening because of Discordeno's translations feature.`}

\n
\n

{`Discordeno has built in multi-lingual support. You can support as many languages as you wish. We will learn more about languages when we create our own language but for now we just want to see how to customize the command. What we are going to do below isn't the correct way but it's the easy way to learn. We will see the correct way to do it when we get to translations.`}

\n
\n

{`Let's add a custom description to our invite command.`}

\n
{`    name: \"invite\",\n    description: \"Like the bot? Use this link to add it to your server!\"\n`}
\n

{`🎉 It's that simple. So let's restart the bot and see how it changed. Use `}{`CTRL + C`}{` to shut down the bot. Then run the command from earlier.`}

\n
{`deno run --allow-net --allow-read mod.ts\n`}
\n

{`To access this easily, most likely all you need to do is press the `}{`UP ARROW`}{` key. Feel free to copy paste this if it doesn't work.`}

\n

{`Once the bot is started try `}{`!help invite`}{` again and you will see the change! 🎉`}

\n

{`Command Aliases`}

\n

{`Now, let's make this a little bit easier. What if we wanted this command to also work with other names besides `}{`invite`}{`. For example, as a shortcut what if users could just type `}{`!inv`}{` or as an alias type `}{`!join`}{`. Let's go ahead and set that up. Go to the very last line of invite command file and type in `}{`alias`}{`. You will see a popup showing you an autocompleted version of `}{`createCommandAliases`}{`. Press enter and boom the magic is happening!`}

\n

{`The createCommandAliases takes in two arguments. The first argument is always the command name. In this case it is `}{`invite`}{`. The second argument is the aliases you want to provide. Let's add in the two aliases we wanted.`}

\n
{` \\`https://discordapp.com/oauth2/authorize?client_id=\\${botID}&scope=bot&permissions=68640\\`,\n    );\n  },\n});\n\ncreateCommandAliases('invite', ['inv', 'join'])\n`}
\n
\n

{`Note:`}{` If you only want to add 1 alias, you can pass in a simple string instead of an array as well as the second argument.`}

\n
\n

{`Notice, I added 2 aliases here. You can add as many aliases as you like. If you see a lot of users typing it wrong by accident you can add those typos as aliases as well.`}

\n

{`Let's start testing this out. But first, let's understand something important.`}

\n

{`Reloading`}

\n

{`Okay, we need to first understand a core concept of developing discord bots. If you had to restart your bot every time you made a tiny change, it would get really annoying/tedious to do. Also, if you had restarted your bot 1000 times, you would be in big trouble because Discord would ban your bot for 24 hours. The bigger your bot gets, the faster it is to hit this limit of 1000 identify calls to the Discord API.`}

\n

{`To solve this issue, Discordeno provides you with a really cool `}{`reload`}{` command. Whenever you make a change to any command, event, monitor, inhibitor, task, language or argument you can simply reload it. You don't need to restart your bot every time.`}

\n

{`Now since we added the aliases above, let's test it out.`}

\n
    \n
  1. {`!inv`}{` this will not work`}
  2. \n
  3. {`!reload commands`}{` this will reload the files and the aliases will be created.`}
  4. \n
  5. {`!inv`}{` This will now work. 🎉`}
  6. \n
\n
\n

{`Perfect! You can take some time and customize the invite command to your needs if you wish. For example, this is my bot's invite command.`}

\n

\n

{`Nice! You can now customize any of the commands from Discordeno as you wish. Then we will continue to making our very own command so we can learn about all the options that Discordeno gives us when it comes to making commands. As you learn more in this guide, you can keep improving it.`}

\n

{`If you get stuck, don't worry. When you are ready, let's continue to the next step.`}

\n

{`Creating A Command`}

\n

{`Let's make a command that will allow guild admins to give or take roles from a member. Since, we are creating a `}{`Moderation`}{` command to give or take roles, let's go ahead and create a Category folder called `}{`Moderation`}{` and then create a file called `}{`role.ts`}{`. Once the file is made, you can paste this following base snippet to make our first command.`}

\n
{`import { botCache } from \"../../mod.ts\";\nimport { sendMessage } from \"https://raw.githubusercontent.com/Skillz4Killz/Discordeno/v7/src/handlers/channel.ts\";\nimport { PermissionLevels } from \"../types/commands.ts\";\nimport { createCommandAliases } from \"../utils/helpers\";\n\nbotCache.commands.set(\"commandname\", {\n  name: \"commandname\",\n  dmOnly: false,\n  guildOnly: false,\n  nsfw: false,\n  permissionLevel: [PermissionLevels.MEMBER],\n  botServerPermissions: [],\n  botChannelPermissions: [],\n  userServerPermissions: [],\n  userChannelPermissions: [],\n  description: string,\n  cooldown: {\n    seconds: 0,\n    allowedUses: 0,\n  },\n  arguments: [],\n  execute: function (message, args, guild) {\n  // The code for your command goes here\n  }\n});\n\n// createCommandAliases(\"commandname\", [\"alias\"])\n`}
\n

{`Understanding Command Options`}

\n

{`Woah! We just added a massive file but most of that stuff is new to us. Don't worry, let's break everything down step by step.`}

\n
\n

{`Note:`}{` Any options that are not changed from the snippet above can actually be deleted as Discordeno will use the default option if you do not provide anything for that option. This can help keep your files cleaner.`}

\n
\n

{`Before we start, quickly update the command name and description.`}

\n
\n

{`Note:`}{` Once you highlight the `}{`commandname`}{`, press `}{`CTRL + SHIFT + L`}{` to select ALL the `}{`commandname`}{` on the file and you can easily replace them at once. Another useful shortcut you may use when coding your bot is `}{`CTRL + D`}{` after highlighting. This shortcut selects the next place where the same text exists as thing in the file that has the same thing as you highlighted.`}

\n
\n

{`dmOnly & guildOnly Options`}

\n

{`The `}{`dmOnly`}{` option is available if you want to make sure this command only runs in a direct message. If this command is ran in a server, the command will immediately exit out.`}

\n

{`On the other hand, `}{`guildOnly`}{` is the opposite. To easily make sure that this command is never allowed in a private message you can simple enable this.`}

\n

{`If you want to allow a command to be able to run both in a server and in a direct message, simply set them both to false.`}

\n

{`Remember if you want either of them as false, you can simply delete them and it will default to `}{`false`}{` allowing your bot to be cleaner and easier to read. However, if your prefer keeping it you can.`}

\n

{`For the purpose of this guide, we want our `}{`role`}{` comamnd to only be run in a server, so we can set `}{`guildOnly`}{` to be `}{`true`}{` and delete the `}{`dmOnly`}{` option.`}

\n

{`NSFW Option`}

\n

{`NSFW stands for `}{`Not Safe For Work`}{`. One of Discord's rules is that you enforce that NSFW content is sent only in NSFW channels. Discordeno has this built in. You simple tell Discordeno, that you want a command to be considered `}{`nsfw`}{` or not.`}

\n

{`If this option is enabled, this command will only be able to be used in a `}{`nsfw`}{` channel on a server. Discord does not consider Direct Messages as nsfw safe!`}

\n

{`Permission Level Option`}

\n

{`Permission levels are a very powerful feature that easily allow you to set what permission is required to run a command. We will cover this in detail, in a separate section dedicated to permission levels. For now, just understand that this will restrict certain users from using a command.`}

\n

{`For example, the role command we only want to be used by moderators or server admins.`}

\n

{`Discordeno makes this pretty simple for us.`}

\n
{`permissionLevels: [PermissionLevels.MODERATOR, PermissionLevels.ADMIN]\n`}
\n

{`We're not going to cover this in detail, here because we will have an entire in depth guide for permission levels. If you want to pause and learn it now, feel free: `}{`Permission Levels Advanced Guide`}

\n

{`Permissions Check Options`}

\n

{`Discordeno provides you 4 different types of permission handling that will be done before the command function is executed. This allows you to make sure that the permissions are available before running a command. For example, the role command will require the bot to have `}{`MANAGE ROLES`}{` permission. This permission comes from the server settings so we can require this in the `}{`botServerPermissions`}{`.`}

\n
{`botServerPermissions: [\"MANAGE_ROLES\"],\n`}
\n

{`Discordeno will provide you easy to use auto-completion as soon as you type a single letter or two. This will help make it easier to use and will warn you when you make a typo and provide a wrong permission by accident.`}

\n

{`We also want to make sure that the bot can send a message in this channel so that we can respond to the user. This will check the correct permission heirarchy to make sure that the bot can indeed send a message in this channel.`}

\n
{`botChannelPermissions: [\"SEND_MESSAGES\"],\n`}
\n
\n

{`Note:`}{` If you want to send an embed response, you should also make sure it has the `}{`EMBED_LINKS`}{` permission.`}

\n
\n

{`Already we have prevented two of the largest errors that can get our bot banned if it is not checked. Discordeno handles this internally so you don't have to worry about it.`}

\n

{`Sometimes, you may also want to make sure that the user using the command has a certain permission to run the command. To do this, you can use the `}{`userServerPermissions`}{` or the `}{`userChannelPermissions`}{`.`}

\n

{`Cooldown Options`}

\n

{`The cooldown options go hand in hand together.`}

\n
    \n
  • {`seconds`}{` is how long to make the user wait in seconds before they can use the command again. By default, there is no wait time aka 0 seconds.`}
  • \n
  • {`allowedUses`}{` is how many times a user is allowed to use a command before they are placed on cooldown.`}
  • \n
  • {`Let's use our command as an example. We don't want someone to start spamming the role command so we can add a cooldown of 60 seconds. However, this would mean every time you give a role to someone, you would need to wait a whole minute to give a role to someone else. This is where `}{`allowedUses`}{` shines! Let's set it to to 5 so that a user can use this command 5 times in a row before being asked to wait for 60 seconds.`}
  • \n
\n
{`cooldown: {\n  seconds: 60,\n  allowedUses: 5\n},\n`}
\n
\n

{`Note:`}{` It is important to understand the way these two interact. The cooldown starts as soon as the first command is used. So, if a user uses the role command 5 times in 59 seconds, they only have to wait 1 second to do another 5 times.`}

\n
\n

{`Let's give this a try shall we.`}

\n
    \n
  1. {`!reload commands`}
  2. \n
  3. {`Spam the `}{`!role`}{` very quickly 6 times in under a minute.`}
  4. \n
\n

{`Arguments`}

\n

{`Arguments is an incredibly powerful feature in Discordeno. Like Permission Levels we will have an in depth look at arguments later in the guide. For now, let's try and understand this in a simple manner.`}

\n
    \n
  • {`name`}{`: The name of the argument. Useful for when you need to alert the user X arg is missing or when you want to use the arg in your command.`}
  • \n
  • {`type`}{`: The type of the argument you would like. Defaults to string. Some of the ones available by default are \"number\", \"string\", \"...string\", \"boolean\", \"subcommand\", \"member\".`}
  • \n
  • {`missing`}{`: a function that will be run when this argument is not provided by the user or if the provided argument is not valid. By default, it does nothing.`}
  • \n
  • {`required`}{`: Whether this argument is required or optional. By default, this is true.`}
  • \n
  • {`lowercase`}{`: If the type is a string, this can forcibly lowercase the string.`}
  • \n
  • {`literals`}{`: If the type is string or subcommand you can provide literals. The argument MUST be exactly the same as the literals to be accepted. For example, if you want to make sure the argument is `}{`a`}{` or `}{`b`}{` only and not `}{`c`}{`.`}
  • \n
  • {`defaultValue`}{`: The default value for this argument/subcommand. If the user does not provide an argument or it is invalid, it can be defaulted to a certain value.`}
  • \n
\n

{`For our role command, we need a `}{`member`}{` and a `}{`role`}{`.`}

\n
{`arguments: [\n  {\n    name: \"member\",\n    type: \"member\",\n    missing: (message) => {\n      sendResponse(message, \\`you did not provide a member to give the role to. You can provide a @member mention, a member ID, or try using their nickname/username. The nickname/username will only work if they have been active in your server recently.\\`)\n    }\n  },\n  {\n    name: \"role\",\n    type: \"role\",\n    missing: (message) => {\n      sendResponse(message, \\`you did not provide a role to give. You can provide a @role mention, a role ID, or it's name. If the role name did not work, try to use the **roleinfo** command to get the role ID.\\`)\n    }\n  }\n]\n`}
\n

{`Execute Option`}

\n

{`The execute option is the code that will run when the command is triggered. The execute function is passed 3 parameters that you can use in your command.`}

\n
    \n
  • {`message`}{`: The message object itself that triggered this command.`}
  • \n
  • {`args`}{`: The args that were provided by the user.`}
  • \n
  • {`guild`}{`: The server guild object where this command was run.`}
  • \n
\n
{`execute: function (message, args, guild) {\n  // The code that is to be executed goes here\n}\n`}
\n
\n

{`Note:`}{` I prefer writing code using the function keyword, but you can easily change to the fat arrow function if you prefer.`}

\n
{`execute: (message, args, guild) => {\n   // The code that is to be executed goes here\n}\n`}
\n
\n

{`Let's start out by writing some pseudo-code(comments that will help us plan the code).`}

\n
{`execute: function (message, args, guild) {\n  // If this was the everyone role alert with a silly error\n\n  // If this is a managed role(some bots role) we can't give/remove alert with silly error\n\n  // Get the bots highest role\n\n  // Check if the bot has a role higher than the role that it will try to give.\n\n  // If the role is too high alert the user.\n\n  // If the user has this role already remove the role from them.\n\n  // Check the command author's highest role\n\n  // If the author does not have a role high enough to give this role alert\n\n  // If the user has this role already we should remove it\n\n  // Add the role to the user.\n\n  // Alert the user that used the command that the user has been give the role.\n}\n`}
\n

{`Nice! The plan for the code is complete. Now, let's add in the code.`}

\n

{`The first thing we are going to try is to check if the role the user provided is the same as the everyone role.`}

\n
\n

{`Note:`}{` The everyone role ID is the same as the server guild ID.`}

\n
\n

{`To do this, we are going to want something like this:`}

\n
{`if (args.role.id === message.guildID) {\n  return sendResponse(message, \"The everyone role can not be given to anyone because everyone has the everyone role already. *Keep calm and let Carter figure it out*!\");\n}\n`}
\n

{`You might be seeing an error since we didn't provide the accurate typings for the `}{`args`}{` parameter. The message and guild parameter is automated but the args is dynamic depending on your `}{`arguments`}{` option for your command. So let's do this real quick.`}

\n
{`execute: function (message, args: RoleArgs, guild) {\n  // If this was the everyone role alert with a silly error\n  if (args.role.id === message.guildID) {\n    return sendResponse(message, \"Are you trying to make this person a super hero? Everyone has the everyone role. I can't give the everyone role to another user.\");\n  }\n\n  // Lots of comments here hidden so you can see the changes easily.\n}\n\ninterface RoleArgs {\n  role: Role;\n  member: Member;\n}\n`}
\n

{`Awesome! Let's keep going.`}

\n
{`execute: function (message, args: RoleArgs, guild) {\n  // If this was the everyone role alert with a silly error\n  if (args.role.id === message.guildID) {\n    return sendResponse(message, \"I don't know if you noticed or not but I'm an extremely arrogant bot who tends to think all of his plans will work. But I can't give the everyone role to someone.\");\n  }\n\n  // If this is a managed role(some bots role) we can't give/remove alert with silly error\n  if (args.role.managed) {\n    return sendResponse(message, \"Dammit man, just 'cause I'm Scottish doesn't mean I can give your people managed roles.\")\n  }\n\n  // Get the bots highest role\n  const botsHighestRole = highestRole(message.guildID, botID);\n\n  // Check if the bot has a role higher than the role that it will try to give.\n  const botIsHigher = higherRolePosition(message.guildID, botsHighestRole.id, args.role.id)\n\n  // If the role is too high alert the user.\n  if (!botIsHigher) {\n    return sendResponse(message, \"Okay look, asking me give a role that is higher than my highest role is ridiculous! I am the first bot to admit I don't know who these people are nor do I care to. Look, if you'd like I could take you down the hall and just point at the people who annoy me more than the rest. But that's about as useful as I get.\")\n  }\n\n  // Check the command author's highest role\n  const membersHighestRole = highestRole(message.guildID, message.author.id);\n\n  // If the author does not have a role high enough to give this role alert\n  if (!higherRolePosition(message.guildID, membersHighestRole.id, args.role.id)) {\n    return sendResponse(message, \"In my culture, whenever someone tries to give a role that is higher than their highest role, I would be well within my rights to dismember you.\")\n  }\n\n  // If the user has this role already we should remove it\n  if (message.member().roles.includes(args.role.id)) {\n    removeRole(message.guildID, args.member.user.id, args.role.id, \\`\\${message.author.tag} used the role command to remove this role.\\`)\n    // Alert the user that used the command that the user has lost the role.\n    return sendResponse(message, \\`The role **\\${args.role.name}** has been removed from **\\${args.member.tag}**.\\`)\n  }\n\n  // Add the role to the user.\n  addRole(guildID, memberID, roleID)\n\n  // Alert the user that used the command that the user has been give the role.\n  return sendResponse(message, \\`The role **\\${args.role.name}** has been added to **\\${args.member.tag}**.\\`)\n}\n`}
\n

{`The final version of the command should look something like this:`}

\n
{`import { highestRole, higherRolePosition, botID, removeRole, addRole, Role, Member } from \"../../deps.ts\";\nimport { botCache } from \"../../mod.ts\";\nimport { PermissionLevels } from \"../types/commands.ts\";\nimport { sendResponse } from \"../utils/helpers.ts\";\n\nbotCache.commands.set(\"role\", {\n  name: \"role\",\n  permissionLevel: [PermissionLevels.MODERATOR, PermissionLevels.ADMIN],\n  botServerPermissions: [\"MANAGE_ROLES\"],\n  botChannelPermissions: [\"SEND_MESSAGES\"],\n  cooldown: {\n    seconds: 60,\n    allowedUses: 5,\n  },\n  arguments: [\n        {\n            name: \"member\",\n            type: \"member\",\n            missing: (message) => {\n                sendResponse(message, \\`you did not provide a member to give the role to. You can provide a @member mention, a member ID, or try using their nickname/username. The nickname/username will only work if they have been active in your server recently.\\`)\n            }\n        },\n        {\n            name: \"role\",\n            type: \"role\",\n            missing: (message) => {\n                sendResponse(message, \\`you did not provide a role to give. You can provide a @role mention, a role ID, or it's name. If the role name did not work, try to use the **roleinfo** command to get the role ID.\\`)\n            }\n        }\n    ],\n  execute: function (message, args: RoleArgs) {\n    // If this was the everyone role alert with a silly error\n    if (args.role.id === message.guildID) {\n      return sendResponse(\n        message,\n        \"I don't know if you noticed or not but I'm an extremely arrogant bot who tends to think all of his plans will work. But I can't give the everyone role to someone.\",\n      );\n    }\n\n    // If this is a managed role(some bots role) we can't give/remove alert with silly error\n    if (args.role.managed) {\n      return sendResponse(\n        message,\n        \"Dammit man, just 'cause I'm Scottish doesn't mean I can give your people managed roles.\",\n      );\n    }\n\n    // Get the bots highest role\n    const botsHighestRole = highestRole(message.guildID, botID);\n\n    // Check if the bot has a role higher than the role that it will try to give. If the role is too high alert the user.\n    if (!botsHighestRole || !higherRolePosition(\n      message.guildID,\n      botsHighestRole.id,\n      args.role.id,\n    )) {\n      return sendResponse(\n        message,\n        \"Okay look, asking me give a role that is higher than my highest role is ridiculous! I am the first bot to admit I don't know who these people are nor do I care to. Look, if you'd like I could take you down the hall and just point at the people who annoy me more than the rest. But that's about as useful as I get.\",\n      );\n    }\n\n    // Check the command author's highest role\n    const membersHighestRole = highestRole(message.guildID, message.author.id);\n\n    // If the author does not have a role high enough to give this role alert\n    if (!membersHighestRole ||\n      !higherRolePosition(message.guildID, membersHighestRole.id, args.role.id)\n    ) {\n      return sendResponse(\n        message,\n        \"In my culture, whenever someone tries to give a role that is higher than their highest role, I would be well within my rights to dismember you.\",\n      );\n    }\n\n    // If the user has this role already we should remove it\n    if (message.member()?.roles.includes(args.role.id)) {\n      removeRole(\n        message.guildID,\n        args.member.user.id,\n        args.role.id,\n        \\`\\${message.author.username} used the role command to remove this role.\\`,\n      );\n      // Alert the user that used the command that the user has lost the role.\n      return sendResponse(\n        message,\n        \\`The role **\\${args.role.name}** has been removed from **\\${args.member.tag}**.\\`,\n      );\n    }\n\n    // Add the role to the user.\n    addRole(message.guildID, args.member.user.id, args.role.id, \\`\\${message.author.username} used the role command to give this role.\\`);\n\n    // Alert the user that used the command that the user has been give the role.\n    return sendResponse(\n      message,\n      \\`The role **\\${args.role.name}** has been added to **\\${args.member.tag}**.\\`,\n    );\n  },\n});\n\ninterface RoleArgs {\n  role: Role;\n  member: Member;\n}\n`}
\n
\n

{`Note:`}{` The response strings are a play on some funny Stargate(my favorite tv show) moments. Feel free to change as you wish to fit your bot's personality.`}

\n
\n

{`Dynamic(Advanced Level) Command Creation`}

\n

{`This is some advanced level super magical command creation skills. Discordeno gives you the power to dynamically create commands. What that means is you can write the code for one command but dynamically create like 50 commands using that same code.`}

\n

{`For example, in my main bot I have a lot of \"fun\" commands like `}{`.hug`}{` or `}{`.kiss`}{` etc... All of these files have the exact same code except for 1 word being the command name. Would it not be better to simply write the code once and dynamically create every single command. Let me show you how that works.`}

\n
    \n
  • {`Create a file in the commands folder called `}{`fun.ts`}{` which will create all our fun commands.`}
  • \n
\n
{`import { Member, sendMessage, chooseRandom, avatarURL } from \"../../deps.ts\";\nimport { botCache } from \"../../mod.ts\";\nimport { createCommandAliases, sendEmbed } from \"../utils/helpers.ts\";\nimport { configs } from \"../../configs.ts\";\nimport { Embed } from \"../utils/Embed.ts\";\nimport { translate } from \"../utils/i18next.ts\";\n\nconst funCommandData = [\n  { name: \"bite\", gifs: configs.gifs.bite },\n  { name: \"cuddle\", gifs: configs.gifs.cuddle },\n  { name: \"dance\", gifs: configs.gifs.dance },\n  { name: \"hug\", gifs: configs.gifs.hug },\n  { name: \"kiss\", gifs: configs.gifs.kiss },\n  { name: \"kanna\", gifs: configs.gifs.kanna },\n  { name: \"kiss\", gifs: configs.gifs.kiss },\n  { name: \"kitten\", gifs: configs.gifs.kitten },\n  { name: \"lmao\", gifs: configs.gifs.lmao, aliases: [\"lol\"] },\n  { name: \"pat\", gifs: configs.gifs.pat },\n  { name: \"poke\", gifs: configs.gifs.poke },\n  { name: \"pony\", gifs: configs.gifs.pony },\n  { name: \"puppy\", gifs: configs.gifs.puppy },\n  { name: \"raphtalia\", gifs: configs.gifs.raphtalia },\n  { name: \"stargate\", gifs: configs.gifs.stargate },\n  { name: \"supernatural\", gifs: configs.gifs.supernatural },\n  { name: \"tickle\", gifs: configs.gifs.tickle },\n  { name: \"zerotwo\", gifs: configs.gifs.zerotwo },\n];\n\nfunCommandData.forEach((data) => {\n  botCache.commands.set(data.name, {\n    name: data.name,\n    botChannelPermissions: [\"SEND_MESSAGES\", \"EMBED_LINKS\"],\n    cooldown: {\n      seconds: 2,\n    },\n    arguments: [\n      {\n        name: \"member\",\n        type: \"member\",\n        required: false,\n      },\n    ],\n    execute: function (message, args: FunArgs) {\n            // If a member is provided use that otherwise set the member themself\n      const member = args.member || message.member()!;\n\n      const type = member.user.id === message.author.id\n        // Silly response like if user tries to hug themself\n        ? \"SELF\"\n        // Response for when user tries to hug another user\n        : \"OTHER\";\n\n\n      // Create an embed\n      const embed = new Embed()\n        .setAuthor(member.tag, avatarURL(member))\n        .setDescription(\n          translate(\n            message.guildID,\n            \\`commands/fun/\\${data.name}:\\${type}\\`,\n            { mention: message.member()!.mention, user: member.mention },\n          ),\n        )\n        .setImage(chooseRandom(data.gifs));\n\n      return sendEmbed(message.channel, embed);\n    },\n  });\n\n  if (data.aliases?.length) {\n    createCommandAliases(data.name, data.aliases);\n  }\n});\n\ninterface FunArgs {\n  member?: Member;\n}\n`}
\n
\n

{`Note:`}{` The imports in this are a bit different. I did this to show you that you can also import everything grouped like this through the `}{`deps.ts`}{` which will make everything available to you at ease.`}

\n
\n

{`Take a minute to realize what just happened. This has made 18 different unique commands dynamically. In 1 file, using the same piece of code, we created so many commands. You can easily add more commands to this. For example, if you wanted to add weeb(animated) versions of these commands. Then you are at 36 commands with 1 simple command file.`}

\n

{`That ladies and gentleman is the power and magic of Discordeno!`}

\n

{`Take a minute to stand up, step back and make some room around you. Now start dancing because you just acheived one of the most complex things in bot development. You have already created about 36 commands!!!!`}

\n
\n

{`Note:`}{` The command above uses translations which we will cover in depth in a later section of this guide.`}

\n
\n

{`Once you are ready, let's proceed to making our events.`}

\n\n
;\n}\n\n;\nMDXContent.isMDXComponent = true;"}} \ No newline at end of file diff --git a/docs/.cache/caches/gatsby-plugin-mdx/diskstore-2fb375a5daaca3d922669166e80f5896.json b/docs/.cache/caches/gatsby-plugin-mdx/diskstore-2fb375a5daaca3d922669166e80f5896.json new file mode 100644 index 000000000..6cdd7099f --- /dev/null +++ b/docs/.cache/caches/gatsby-plugin-mdx/diskstore-2fb375a5daaca3d922669166e80f5896.json @@ -0,0 +1 @@ +{"expireTime":9007200851634252000,"key":"gatsby-plugin-mdx-entire-payload-99497dd7ac7bf58b470355aa02d274ed-","val":{"mdast":{"type":"root","children":[{"type":"paragraph","children":[{"type":"text","value":"Woah! You are almost half way done with understanding all of Discordeno. Amazing isn't it? Something you may have noticed in the last section was there were some options that prevented some commands from running like ","position":{"start":{"line":2,"column":1,"offset":1},"end":{"line":2,"column":218,"offset":218},"indent":[]}},{"type":"inlineCode","value":"dmOnly","position":{"start":{"line":2,"column":218,"offset":218},"end":{"line":2,"column":226,"offset":226},"indent":[]}},{"type":"text","value":" or the permission options. we created a setting to prevent the monitor from running in certain channels. What if we wanted to do prevent commands from happening? How would we prevent commands from running?","position":{"start":{"line":2,"column":226,"offset":226},"end":{"line":2,"column":432,"offset":432},"indent":[]}}],"position":{"start":{"line":2,"column":1,"offset":1},"end":{"line":2,"column":432,"offset":432},"indent":[]}},{"type":"heading","depth":2,"children":[{"type":"text","value":"What is an Inhibitor?","position":{"start":{"line":4,"column":4,"offset":437},"end":{"line":4,"column":25,"offset":458},"indent":[]}}],"position":{"start":{"line":4,"column":1,"offset":434},"end":{"line":4,"column":25,"offset":458},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"An Inhibitor is very similar to how monitors work. A monitor runs on every message but an inhibitor runs on every command. Remember all those command options like cooldown, permissions, permissionLevel, nsfw, etc... Each and every one of these options has an inhibitor in that checks commands for these settings.","position":{"start":{"line":6,"column":1,"offset":460},"end":{"line":6,"column":313,"offset":772},"indent":[]}}],"position":{"start":{"line":6,"column":1,"offset":460},"end":{"line":6,"column":313,"offset":772},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"Let's create our own inhibitor that would prevent commands from being used if the user is not a VIP user.","position":{"start":{"line":8,"column":1,"offset":774},"end":{"line":8,"column":106,"offset":879},"indent":[]}}],"position":{"start":{"line":8,"column":1,"offset":774},"end":{"line":8,"column":106,"offset":879},"indent":[]}},{"type":"blockquote","children":[{"type":"paragraph","children":[{"type":"strong","children":[{"type":"text","value":"Note:","position":{"start":{"line":10,"column":5,"offset":885},"end":{"line":10,"column":10,"offset":890},"indent":[]}}],"position":{"start":{"line":10,"column":3,"offset":883},"end":{"line":10,"column":12,"offset":892},"indent":[]}},{"type":"text","value":" It is important to remember that everything below can be done with a simple permission level as well. We will create our own custom permission levels but for the purposes of this guide and to be able to learn about Inhibitors, we will be using an inhibitor.","position":{"start":{"line":10,"column":12,"offset":892},"end":{"line":10,"column":270,"offset":1150},"indent":[]}}],"position":{"start":{"line":10,"column":3,"offset":883},"end":{"line":10,"column":270,"offset":1150},"indent":[]}}],"position":{"start":{"line":10,"column":1,"offset":881},"end":{"line":10,"column":270,"offset":1150},"indent":[]}},{"type":"heading","depth":2,"children":[{"type":"text","value":"Creating the File","position":{"start":{"line":12,"column":4,"offset":1155},"end":{"line":12,"column":21,"offset":1172},"indent":[]}}],"position":{"start":{"line":12,"column":1,"offset":1152},"end":{"line":12,"column":21,"offset":1172},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"Let's start by creating a file inside the inhibitors folder called ","position":{"start":{"line":14,"column":1,"offset":1174},"end":{"line":14,"column":68,"offset":1241},"indent":[]}},{"type":"inlineCode","value":"boosted.ts","position":{"start":{"line":14,"column":68,"offset":1241},"end":{"line":14,"column":80,"offset":1253},"indent":[]}},{"type":"text","value":" and paste the following snippet of code:","position":{"start":{"line":14,"column":80,"offset":1253},"end":{"line":14,"column":121,"offset":1294},"indent":[]}}],"position":{"start":{"line":14,"column":1,"offset":1174},"end":{"line":14,"column":121,"offset":1294},"indent":[]}},{"type":"code","lang":"ts","meta":null,"value":"import { botCache } from \"../../mod.ts\";\n\nbotCache.inhibitors.set(\"inhibitorname\", async function (message, command, guild) {\n\t// Your code goes here\n});","position":{"start":{"line":16,"column":1,"offset":1296},"end":{"line":22,"column":4,"offset":1459},"indent":[1,1,1,1,1,1]}},{"type":"paragraph","children":[{"type":"text","value":"Inhibitors can take up to 3 arguments.","position":{"start":{"line":24,"column":1,"offset":1461},"end":{"line":24,"column":39,"offset":1499},"indent":[]}}],"position":{"start":{"line":24,"column":1,"offset":1461},"end":{"line":24,"column":39,"offset":1499},"indent":[]}},{"type":"list","ordered":false,"start":null,"spread":false,"children":[{"type":"listItem","spread":false,"checked":null,"children":[{"type":"paragraph","children":[{"type":"inlineCode","value":"message","position":{"start":{"line":26,"column":3,"offset":1503},"end":{"line":26,"column":12,"offset":1512},"indent":[]}},{"type":"text","value":": The message object that triggered the command.","position":{"start":{"line":26,"column":12,"offset":1512},"end":{"line":26,"column":60,"offset":1560},"indent":[]}}],"position":{"start":{"line":26,"column":3,"offset":1503},"end":{"line":26,"column":60,"offset":1560},"indent":[]}}],"position":{"start":{"line":26,"column":1,"offset":1501},"end":{"line":26,"column":60,"offset":1560},"indent":[]}},{"type":"listItem","spread":false,"checked":null,"children":[{"type":"paragraph","children":[{"type":"inlineCode","value":"command","position":{"start":{"line":27,"column":3,"offset":1563},"end":{"line":27,"column":12,"offset":1572},"indent":[]}},{"type":"text","value":": The command object itself that was triggered.","position":{"start":{"line":27,"column":12,"offset":1572},"end":{"line":27,"column":59,"offset":1619},"indent":[]}}],"position":{"start":{"line":27,"column":3,"offset":1563},"end":{"line":27,"column":59,"offset":1619},"indent":[]}}],"position":{"start":{"line":27,"column":1,"offset":1561},"end":{"line":27,"column":59,"offset":1619},"indent":[]}},{"type":"listItem","spread":false,"checked":null,"children":[{"type":"paragraph","children":[{"type":"inlineCode","value":"guild","position":{"start":{"line":28,"column":3,"offset":1622},"end":{"line":28,"column":10,"offset":1629},"indent":[]}},{"type":"text","value":": The server guild object where this command was ran.","position":{"start":{"line":28,"column":10,"offset":1629},"end":{"line":28,"column":63,"offset":1682},"indent":[]}}],"position":{"start":{"line":28,"column":3,"offset":1622},"end":{"line":28,"column":63,"offset":1682},"indent":[]}}],"position":{"start":{"line":28,"column":1,"offset":1620},"end":{"line":28,"column":63,"offset":1682},"indent":[]}}],"position":{"start":{"line":26,"column":1,"offset":1501},"end":{"line":28,"column":63,"offset":1682},"indent":[1,1]}},{"type":"heading","depth":2,"children":[{"type":"text","value":"Understanding How Inhibitors Function","position":{"start":{"line":30,"column":4,"offset":1687},"end":{"line":30,"column":41,"offset":1724},"indent":[]}}],"position":{"start":{"line":30,"column":1,"offset":1684},"end":{"line":30,"column":41,"offset":1724},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"To block a command you have to return a truthy value.","position":{"start":{"line":32,"column":1,"offset":1726},"end":{"line":32,"column":54,"offset":1779},"indent":[]}}],"position":{"start":{"line":32,"column":1,"offset":1726},"end":{"line":32,"column":54,"offset":1779},"indent":[]}},{"type":"list","ordered":false,"start":null,"spread":false,"children":[{"type":"listItem","spread":false,"checked":null,"children":[{"type":"paragraph","children":[{"type":"strong","children":[{"type":"text","value":"return true;","position":{"start":{"line":33,"column":5,"offset":1784},"end":{"line":33,"column":17,"offset":1796},"indent":[]}}],"position":{"start":{"line":33,"column":3,"offset":1782},"end":{"line":33,"column":19,"offset":1798},"indent":[]}},{"type":"text","value":" If you return true the inhibitor will block the execution of the command.\nTo allow a command return a falsey value.","position":{"start":{"line":33,"column":19,"offset":1798},"end":{"line":34,"column":42,"offset":1914},"indent":[1]}}],"position":{"start":{"line":33,"column":3,"offset":1782},"end":{"line":34,"column":42,"offset":1914},"indent":[1]}}],"position":{"start":{"line":33,"column":1,"offset":1780},"end":{"line":34,"column":42,"offset":1914},"indent":[1]}},{"type":"listItem","spread":false,"checked":null,"children":[{"type":"paragraph","children":[{"type":"strong","children":[{"type":"text","value":"return false;","position":{"start":{"line":35,"column":5,"offset":1919},"end":{"line":35,"column":18,"offset":1932},"indent":[]}}],"position":{"start":{"line":35,"column":3,"offset":1917},"end":{"line":35,"column":20,"offset":1934},"indent":[]}},{"type":"text","value":" If you return false the inhibitor will not block the error.","position":{"start":{"line":35,"column":20,"offset":1934},"end":{"line":35,"column":80,"offset":1994},"indent":[]}}],"position":{"start":{"line":35,"column":3,"offset":1917},"end":{"line":35,"column":80,"offset":1994},"indent":[]}}],"position":{"start":{"line":35,"column":1,"offset":1915},"end":{"line":35,"column":80,"offset":1994},"indent":[]}}],"position":{"start":{"line":33,"column":1,"offset":1780},"end":{"line":35,"column":80,"offset":1994},"indent":[1,1]}},{"type":"code","lang":"ts","meta":null,"value":"// If the command is not VIP only we can allow this command to execute\nif (!command.vipOnly) return false;\n\n// The bot's support server\nconst guild = cache.guilds.get(configs.supportServerID);\n// If the command author is not in the server they won't have the vip role\nconst member = guild.members.get(message.author.id) || await getMember(guild.id, message.author.id);\n// Member doesn't exist so cancel the command\nif (!member) return true;\n\n// If the user has the vip role on the support server given by patreon allow the command\nif (userIsVIP) return false;\n\n// The user is NOT VIP so we throw an error\nthrow `The ${command.name} is only allowed for VIP users.`","position":{"start":{"line":38,"column":1,"offset":1997},"end":{"line":54,"column":4,"offset":2670},"indent":[1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1]}},{"type":"export","value":"export const _frontmatter = {\"title\":\"Creating Inhibitors!\",\"metaTitle\":\"Creating An Inhibitor | Discordeno\",\"metaDescription\":\"Let's create our very own bot with Discordeno!\"}","position":{"start":{"line":57,"column":1,"offset":2673},"end":{"line":57,"column":177,"offset":2849},"indent":[]}}],"position":{"start":{"line":1,"column":1,"offset":0},"end":{"line":57,"column":177,"offset":2849}}},"scopeImports":["import * as React from 'react'"],"scopeIdentifiers":["React"],"body":"function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }\n\nfunction _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }\n\nfunction _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }\n\n/* @jsx mdx */\nvar _frontmatter = {\n \"title\": \"Creating Inhibitors!\",\n \"metaTitle\": \"Creating An Inhibitor | Discordeno\",\n \"metaDescription\": \"Let's create our very own bot with Discordeno!\"\n};\nvar layoutProps = {\n _frontmatter: _frontmatter\n};\nvar MDXLayout = \"wrapper\";\nreturn function MDXContent(_ref) {\n var components = _ref.components,\n props = _objectWithoutProperties(_ref, [\"components\"]);\n\n return mdx(MDXLayout, _extends({}, layoutProps, props, {\n components: components,\n mdxType: \"MDXLayout\"\n }), mdx(\"p\", null, \"Woah! You are almost half way done with understanding all of Discordeno. Amazing isn't it? Something you may have noticed in the last section was there were some options that prevented some commands from running like \", mdx(\"inlineCode\", {\n parentName: \"p\"\n }, \"dmOnly\"), \" or the permission options. we created a setting to prevent the monitor from running in certain channels. What if we wanted to do prevent commands from happening? How would we prevent commands from running?\"), mdx(\"h2\", null, \"What is an Inhibitor?\"), mdx(\"p\", null, \"An Inhibitor is very similar to how monitors work. A monitor runs on every message but an inhibitor runs on every command. Remember all those command options like cooldown, permissions, permissionLevel, nsfw, etc... Each and every one of these options has an inhibitor in that checks commands for these settings.\"), mdx(\"p\", null, \"Let's create our own inhibitor that would prevent commands from being used if the user is not a VIP user.\"), mdx(\"blockquote\", null, mdx(\"p\", {\n parentName: \"blockquote\"\n }, mdx(\"strong\", {\n parentName: \"p\"\n }, \"Note:\"), \" It is important to remember that everything below can be done with a simple permission level as well. We will create our own custom permission levels but for the purposes of this guide and to be able to learn about Inhibitors, we will be using an inhibitor.\")), mdx(\"h2\", null, \"Creating the File\"), mdx(\"p\", null, \"Let's start by creating a file inside the inhibitors folder called \", mdx(\"inlineCode\", {\n parentName: \"p\"\n }, \"boosted.ts\"), \" and paste the following snippet of code:\"), mdx(\"pre\", null, mdx(\"code\", _extends({\n parentName: \"pre\"\n }, {\n \"className\": \"language-ts\"\n }), \"import { botCache } from \\\"../../mod.ts\\\";\\n\\nbotCache.inhibitors.set(\\\"inhibitorname\\\", async function (message, command, guild) {\\n // Your code goes here\\n});\\n\")), mdx(\"p\", null, \"Inhibitors can take up to 3 arguments.\"), mdx(\"ul\", null, mdx(\"li\", {\n parentName: \"ul\"\n }, mdx(\"inlineCode\", {\n parentName: \"li\"\n }, \"message\"), \": The message object that triggered the command.\"), mdx(\"li\", {\n parentName: \"ul\"\n }, mdx(\"inlineCode\", {\n parentName: \"li\"\n }, \"command\"), \": The command object itself that was triggered.\"), mdx(\"li\", {\n parentName: \"ul\"\n }, mdx(\"inlineCode\", {\n parentName: \"li\"\n }, \"guild\"), \": The server guild object where this command was ran.\")), mdx(\"h2\", null, \"Understanding How Inhibitors Function\"), mdx(\"p\", null, \"To block a command you have to return a truthy value.\"), mdx(\"ul\", null, mdx(\"li\", {\n parentName: \"ul\"\n }, mdx(\"strong\", {\n parentName: \"li\"\n }, \"return true;\"), \" If you return true the inhibitor will block the execution of the command.\\nTo allow a command return a falsey value.\"), mdx(\"li\", {\n parentName: \"ul\"\n }, mdx(\"strong\", {\n parentName: \"li\"\n }, \"return false;\"), \" If you return false the inhibitor will not block the error.\")), mdx(\"pre\", null, mdx(\"code\", _extends({\n parentName: \"pre\"\n }, {\n \"className\": \"language-ts\"\n }), \"// If the command is not VIP only we can allow this command to execute\\nif (!command.vipOnly) return false;\\n\\n// The bot's support server\\nconst guild = cache.guilds.get(configs.supportServerID);\\n// If the command author is not in the server they won't have the vip role\\nconst member = guild.members.get(message.author.id) || await getMember(guild.id, message.author.id);\\n// Member doesn't exist so cancel the command\\nif (!member) return true;\\n\\n// If the user has the vip role on the support server given by patreon allow the command\\nif (userIsVIP) return false;\\n\\n// The user is NOT VIP so we throw an error\\nthrow `The ${command.name} is only allowed for VIP users.`\\n\")));\n}\n;\nMDXContent.isMDXComponent = true;","rawMDXOutput":"/* @jsx mdx */\nimport { mdx } from '@mdx-js/react';\n/* @jsx mdx */\n\nexport const _frontmatter = {\n \"title\": \"Creating Inhibitors!\",\n \"metaTitle\": \"Creating An Inhibitor | Discordeno\",\n \"metaDescription\": \"Let's create our very own bot with Discordeno!\"\n};\n\nconst layoutProps = {\n _frontmatter\n};\nconst MDXLayout = \"wrapper\"\nexport default function MDXContent({\n components,\n ...props\n}) {\n return \n

{`Woah! You are almost half way done with understanding all of Discordeno. Amazing isn't it? Something you may have noticed in the last section was there were some options that prevented some commands from running like `}{`dmOnly`}{` or the permission options. we created a setting to prevent the monitor from running in certain channels. What if we wanted to do prevent commands from happening? How would we prevent commands from running?`}

\n

{`What is an Inhibitor?`}

\n

{`An Inhibitor is very similar to how monitors work. A monitor runs on every message but an inhibitor runs on every command. Remember all those command options like cooldown, permissions, permissionLevel, nsfw, etc... Each and every one of these options has an inhibitor in that checks commands for these settings.`}

\n

{`Let's create our own inhibitor that would prevent commands from being used if the user is not a VIP user.`}

\n
\n

{`Note:`}{` It is important to remember that everything below can be done with a simple permission level as well. We will create our own custom permission levels but for the purposes of this guide and to be able to learn about Inhibitors, we will be using an inhibitor.`}

\n
\n

{`Creating the File`}

\n

{`Let's start by creating a file inside the inhibitors folder called `}{`boosted.ts`}{` and paste the following snippet of code:`}

\n
{`import { botCache } from \"../../mod.ts\";\n\nbotCache.inhibitors.set(\"inhibitorname\", async function (message, command, guild) {\n    // Your code goes here\n});\n`}
\n

{`Inhibitors can take up to 3 arguments.`}

\n
    \n
  • {`message`}{`: The message object that triggered the command.`}
  • \n
  • {`command`}{`: The command object itself that was triggered.`}
  • \n
  • {`guild`}{`: The server guild object where this command was ran.`}
  • \n
\n

{`Understanding How Inhibitors Function`}

\n

{`To block a command you have to return a truthy value.`}

\n
    \n
  • {`return true;`}{` If you return true the inhibitor will block the execution of the command.\nTo allow a command return a falsey value.`}
  • \n
  • {`return false;`}{` If you return false the inhibitor will not block the error.`}
  • \n
\n
{`// If the command is not VIP only we can allow this command to execute\nif (!command.vipOnly) return false;\n\n// The bot's support server\nconst guild = cache.guilds.get(configs.supportServerID);\n// If the command author is not in the server they won't have the vip role\nconst member = guild.members.get(message.author.id) || await getMember(guild.id, message.author.id);\n// Member doesn't exist so cancel the command\nif (!member) return true;\n\n// If the user has the vip role on the support server given by patreon allow the command\nif (userIsVIP) return false;\n\n// The user is NOT VIP so we throw an error\nthrow \\`The \\${command.name} is only allowed for VIP users.\\`\n`}
\n\n
;\n}\n\n;\nMDXContent.isMDXComponent = true;"}} \ No newline at end of file diff --git a/docs/.cache/caches/gatsby-plugin-mdx/diskstore-2feed06b5c382f85fd8ac516d633ae39.json b/docs/.cache/caches/gatsby-plugin-mdx/diskstore-2feed06b5c382f85fd8ac516d633ae39.json new file mode 100644 index 000000000..340e56fa7 --- /dev/null +++ b/docs/.cache/caches/gatsby-plugin-mdx/diskstore-2feed06b5c382f85fd8ac516d633ae39.json @@ -0,0 +1 @@ +{"expireTime":9007200851644269000,"key":"gatsby-plugin-mdx-entire-payload-989e7b7acc008cf48ccd1b417f86a9d0-","val":{"mdast":{"type":"root","children":[{"type":"paragraph","children":[{"type":"text","value":"Discordeno will help make Discord bot development much easier. Don't worry, as you go through this guide it will make a lot more sense.","position":{"start":{"line":2,"column":1,"offset":1},"end":{"line":2,"column":136,"offset":136},"indent":[]}}],"position":{"start":{"line":2,"column":1,"offset":1},"end":{"line":2,"column":136,"offset":136},"indent":[]}},{"type":"heading","depth":2,"children":[{"type":"text","value":"Creating The Bot!","position":{"start":{"line":4,"column":4,"offset":141},"end":{"line":4,"column":21,"offset":158},"indent":[]}}],"position":{"start":{"line":4,"column":1,"offset":138},"end":{"line":4,"column":21,"offset":158},"indent":[]}},{"type":"blockquote","children":[{"type":"paragraph","children":[{"type":"text","value":"This guide is going to assume you already have the basic requirements to make a bot ready. This includes github, git, a code editor like Visual Studio Code. If you don't have these yet please prepare them first before going forward.","position":{"start":{"line":6,"column":3,"offset":162},"end":{"line":6,"column":235,"offset":394},"indent":[]}}],"position":{"start":{"line":6,"column":3,"offset":162},"end":{"line":6,"column":235,"offset":394},"indent":[]}}],"position":{"start":{"line":6,"column":1,"offset":160},"end":{"line":6,"column":235,"offset":394},"indent":[]}},{"type":"list","ordered":false,"start":null,"spread":true,"children":[{"type":"listItem","spread":false,"checked":null,"children":[{"type":"paragraph","children":[{"type":"text","value":"First, create a Discordeno Bot using the ","position":{"start":{"line":8,"column":3,"offset":398},"end":{"line":8,"column":44,"offset":439},"indent":[]}},{"type":"link","title":null,"url":"https://github.com/Skillz4Killz/Discordeno-bot-template","children":[{"type":"text","value":"Generator Boilerplate","position":{"start":{"line":8,"column":45,"offset":440},"end":{"line":8,"column":66,"offset":461},"indent":[]}}],"position":{"start":{"line":8,"column":44,"offset":439},"end":{"line":8,"column":124,"offset":519},"indent":[]}},{"type":"text","value":". Give it any name you like. For the purpose of this guide we will call it, Stargate.","position":{"start":{"line":8,"column":124,"offset":519},"end":{"line":8,"column":209,"offset":604},"indent":[]}}],"position":{"start":{"line":8,"column":3,"offset":398},"end":{"line":8,"column":209,"offset":604},"indent":[]}}],"position":{"start":{"line":8,"column":1,"offset":396},"end":{"line":9,"column":1,"offset":605},"indent":[1]}},{"type":"listItem","spread":false,"checked":null,"children":[{"type":"paragraph","children":[{"type":"text","value":"Then ","position":{"start":{"line":10,"column":3,"offset":608},"end":{"line":10,"column":8,"offset":613},"indent":[]}},{"type":"inlineCode","value":"git clone https://github.com/Skillz4Killz/Stargate.git","position":{"start":{"line":10,"column":8,"offset":613},"end":{"line":10,"column":64,"offset":669},"indent":[]}}],"position":{"start":{"line":10,"column":3,"offset":608},"end":{"line":10,"column":64,"offset":669},"indent":[]}}],"position":{"start":{"line":10,"column":1,"offset":606},"end":{"line":11,"column":1,"offset":670},"indent":[1]}},{"type":"listItem","spread":false,"checked":null,"children":[{"type":"paragraph","children":[{"type":"text","value":"When that is done, go ahead and open up the folder with VSC.","position":{"start":{"line":12,"column":3,"offset":673},"end":{"line":12,"column":63,"offset":733},"indent":[]}}],"position":{"start":{"line":12,"column":3,"offset":673},"end":{"line":12,"column":63,"offset":733},"indent":[]}}],"position":{"start":{"line":12,"column":1,"offset":671},"end":{"line":12,"column":63,"offset":733},"indent":[]}},{"type":"listItem","spread":false,"checked":null,"children":[{"type":"paragraph","children":[{"type":"text","value":"Create a new file called ","position":{"start":{"line":13,"column":3,"offset":736},"end":{"line":13,"column":28,"offset":761},"indent":[]}},{"type":"inlineCode","value":"configs.ts","position":{"start":{"line":13,"column":28,"offset":761},"end":{"line":13,"column":40,"offset":773},"indent":[]}},{"type":"text","value":". Open the ","position":{"start":{"line":13,"column":40,"offset":773},"end":{"line":13,"column":51,"offset":784},"indent":[]}},{"type":"inlineCode","value":"configs.example.ts","position":{"start":{"line":13,"column":51,"offset":784},"end":{"line":13,"column":71,"offset":804},"indent":[]}},{"type":"text","value":" file and copy everything over.","position":{"start":{"line":13,"column":71,"offset":804},"end":{"line":13,"column":102,"offset":835},"indent":[]}}],"position":{"start":{"line":13,"column":3,"offset":736},"end":{"line":13,"column":102,"offset":835},"indent":[]}}],"position":{"start":{"line":13,"column":1,"offset":734},"end":{"line":13,"column":102,"offset":835},"indent":[]}}],"position":{"start":{"line":8,"column":1,"offset":396},"end":{"line":13,"column":102,"offset":835},"indent":[1,1,1,1,1]}},{"type":"paragraph","children":[{"type":"text","value":"Let's take a minute to review all the options we have available to us.","position":{"start":{"line":15,"column":1,"offset":837},"end":{"line":15,"column":71,"offset":907},"indent":[]}}],"position":{"start":{"line":15,"column":1,"offset":837},"end":{"line":15,"column":71,"offset":907},"indent":[]}},{"type":"heading","depth":3,"children":[{"type":"text","value":"Configs File","position":{"start":{"line":17,"column":5,"offset":913},"end":{"line":17,"column":17,"offset":925},"indent":[]}}],"position":{"start":{"line":17,"column":1,"offset":909},"end":{"line":17,"column":17,"offset":925},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"The ","position":{"start":{"line":19,"column":1,"offset":927},"end":{"line":19,"column":5,"offset":931},"indent":[]}},{"type":"inlineCode","value":"configs.ts","position":{"start":{"line":19,"column":5,"offset":931},"end":{"line":19,"column":17,"offset":943},"indent":[]}},{"type":"text","value":" file is where you will keep all your secret info you don't want to share with anyone else. As long as ","position":{"start":{"line":19,"column":17,"offset":943},"end":{"line":19,"column":120,"offset":1046},"indent":[]}},{"type":"inlineCode","value":".gitignore","position":{"start":{"line":19,"column":120,"offset":1046},"end":{"line":19,"column":132,"offset":1058},"indent":[]}},{"type":"text","value":" file is ignoring configs.ts your configurations will be kept private!","position":{"start":{"line":19,"column":132,"offset":1058},"end":{"line":19,"column":202,"offset":1128},"indent":[]}}],"position":{"start":{"line":19,"column":1,"offset":927},"end":{"line":19,"column":202,"offset":1128},"indent":[]}},{"type":"code","lang":"ts","meta":null,"value":"// Step 1: Remove the `.example` from this file name so it is called `configs.ts`\n// Step 2: Add all your bot's information below. The only required one is token and prefix. NOTE: As long as `.gitignore` file is ignoring configs.ts your configurations will be kept private!\n// Step 3: Remove these comments if you like.\n\nexport const configs = {\n // Your bot token goes here\n token: \"\",\n // The default prefix for your bot. Don't worry guilds can change this later.\n prefix: \"!\",\n // This isn't required but you can add bot list api keys here.\n botListTokens: {\n DISCORD_BOT_ORG: \"\",\n BOTS_ON_DISCORD: \"\",\n DISCORD_BOT_LIST: \"\",\n BOTS_FOR_DISCORD: \"\",\n DISCORD_BOATS: \"\",\n DISCORD_BOTS_GG: \"\",\n DISCORD_BOTS_GROUP: \"\",\n },\n // This is the server id for your bot's main server where users can get help/support\n supportServerID: \"\",\n // These are channel ids that will enable some functionality\n channelIDs: {\n // When a translation is missing this is the channel you will be alerted in.\n missingTranslation: \"\",\n // When an error occurs, we will try and log it to this channel\n errorChannelID: \"\"\n },\n // These are the role ids that will enable some functionality.\n roleIDs: {\n // If you have a patreon set up you can add the patreon vip role id here.\n patreonVIPRoleID: \"\",\n },\n // These are the user ids that will enable some functionality.\n userIDs: {\n // The user ids for the support team\n botSupporters: [],\n // The user ids for the other devs on your team\n botDevs: [],\n // The user ids who have complete 100% access to your bot\n botOwners: []\n }\n};\n","position":{"start":{"line":21,"column":1,"offset":1130},"end":{"line":66,"column":4,"offset":2770},"indent":[1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1]}},{"type":"heading","depth":4,"children":[{"type":"text","value":"Token","position":{"start":{"line":68,"column":6,"offset":2777},"end":{"line":68,"column":11,"offset":2782},"indent":[]}}],"position":{"start":{"line":68,"column":1,"offset":2772},"end":{"line":68,"column":11,"offset":2782},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"First, add your bot token. This is ","position":{"start":{"line":70,"column":1,"offset":2784},"end":{"line":70,"column":36,"offset":2819},"indent":[]}},{"type":"strong","children":[{"type":"text","value":"required","position":{"start":{"line":70,"column":38,"offset":2821},"end":{"line":70,"column":46,"offset":2829},"indent":[]}}],"position":{"start":{"line":70,"column":36,"offset":2819},"end":{"line":70,"column":48,"offset":2831},"indent":[]}},{"type":"text","value":" for the bot to start. Review the ","position":{"start":{"line":70,"column":48,"offset":2831},"end":{"line":70,"column":82,"offset":2865},"indent":[]}},{"type":"link","title":null,"url":"https://discordeno.netlify.app/gettingstarted#creatingyourfirstdiscordbotapplication","children":[{"type":"text","value":"instructions","position":{"start":{"line":70,"column":83,"offset":2866},"end":{"line":70,"column":95,"offset":2878},"indent":[]}}],"position":{"start":{"line":70,"column":82,"offset":2865},"end":{"line":70,"column":182,"offset":2965},"indent":[]}},{"type":"text","value":" if you have not made your token yet.","position":{"start":{"line":70,"column":182,"offset":2965},"end":{"line":70,"column":219,"offset":3002},"indent":[]}}],"position":{"start":{"line":70,"column":1,"offset":2784},"end":{"line":70,"column":219,"offset":3002},"indent":[]}},{"type":"heading","depth":4,"children":[{"type":"text","value":"Prefix","position":{"start":{"line":72,"column":6,"offset":3009},"end":{"line":72,"column":12,"offset":3015},"indent":[]}}],"position":{"start":{"line":72,"column":1,"offset":3004},"end":{"line":72,"column":12,"offset":3015},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"The prefix is where you will set the default prefix for your bot. Don't worry, every server will be able to choose their own prefix but we need a default prefix to start.","position":{"start":{"line":74,"column":1,"offset":3017},"end":{"line":74,"column":171,"offset":3187},"indent":[]}}],"position":{"start":{"line":74,"column":1,"offset":3017},"end":{"line":74,"column":171,"offset":3187},"indent":[]}},{"type":"heading","depth":4,"children":[{"type":"text","value":"Bot Lists Tokens","position":{"start":{"line":76,"column":6,"offset":3194},"end":{"line":76,"column":22,"offset":3210},"indent":[]}}],"position":{"start":{"line":76,"column":1,"offset":3189},"end":{"line":76,"column":22,"offset":3210},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"This section of the file is so you can easily have your bot's statistics updated on all the bot lists out there to help you grow your bot. The code is already written to handle this but you will need to do 3 things for each bot list.","position":{"start":{"line":78,"column":1,"offset":3212},"end":{"line":78,"column":234,"offset":3445},"indent":[]}}],"position":{"start":{"line":78,"column":1,"offset":3212},"end":{"line":78,"column":234,"offset":3445},"indent":[]}},{"type":"list","ordered":true,"start":1,"spread":false,"children":[{"type":"listItem","spread":false,"checked":null,"children":[{"type":"paragraph","children":[{"type":"text","value":"Go to the bot list and add your bot to their website. (Each site has it's own instructions)","position":{"start":{"line":80,"column":4,"offset":3450},"end":{"line":80,"column":95,"offset":3541},"indent":[]}}],"position":{"start":{"line":80,"column":4,"offset":3450},"end":{"line":80,"column":95,"offset":3541},"indent":[]}}],"position":{"start":{"line":80,"column":1,"offset":3447},"end":{"line":80,"column":95,"offset":3541},"indent":[]}},{"type":"listItem","spread":false,"checked":null,"children":[{"type":"paragraph","children":[{"type":"text","value":"Create a token for yourself on each website and paste it in your configs.","position":{"start":{"line":81,"column":4,"offset":3545},"end":{"line":81,"column":77,"offset":3618},"indent":[]}}],"position":{"start":{"line":81,"column":4,"offset":3545},"end":{"line":81,"column":77,"offset":3618},"indent":[]}}],"position":{"start":{"line":81,"column":1,"offset":3542},"end":{"line":81,"column":77,"offset":3618},"indent":[]}},{"type":"listItem","spread":false,"checked":null,"children":[{"type":"paragraph","children":[{"type":"text","value":"Enjoy!","position":{"start":{"line":82,"column":4,"offset":3622},"end":{"line":82,"column":10,"offset":3628},"indent":[]}}],"position":{"start":{"line":82,"column":4,"offset":3622},"end":{"line":82,"column":10,"offset":3628},"indent":[]}}],"position":{"start":{"line":82,"column":1,"offset":3619},"end":{"line":82,"column":10,"offset":3628},"indent":[]}}],"position":{"start":{"line":80,"column":1,"offset":3447},"end":{"line":82,"column":10,"offset":3628},"indent":[1,1]}},{"type":"paragraph","children":[{"type":"text","value":"If you wish to customize the code, you will find the bot list tasks in the tasks folder. Don't worry we will discuss this when we get to the tasks section of the guide.","position":{"start":{"line":84,"column":1,"offset":3630},"end":{"line":84,"column":169,"offset":3798},"indent":[]}}],"position":{"start":{"line":84,"column":1,"offset":3630},"end":{"line":84,"column":169,"offset":3798},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"For now just remember, that Discordeno provides you a built in way to update most discord bot lists.","position":{"start":{"line":86,"column":1,"offset":3800},"end":{"line":86,"column":101,"offset":3900},"indent":[]}}],"position":{"start":{"line":86,"column":1,"offset":3800},"end":{"line":86,"column":101,"offset":3900},"indent":[]}},{"type":"heading","depth":4,"children":[{"type":"text","value":"Channel IDs","position":{"start":{"line":88,"column":6,"offset":3907},"end":{"line":88,"column":17,"offset":3918},"indent":[]}}],"position":{"start":{"line":88,"column":1,"offset":3902},"end":{"line":88,"column":17,"offset":3918},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"The channelIDs section holds the channel IDs that are useful for specific features to help give you alerts/notifications. For example, the ","position":{"start":{"line":90,"column":1,"offset":3920},"end":{"line":90,"column":140,"offset":4059},"indent":[]}},{"type":"inlineCode","value":"missingTranslation","position":{"start":{"line":90,"column":140,"offset":4059},"end":{"line":90,"column":160,"offset":4079},"indent":[]}},{"type":"text","value":" channel will be where messages are sent alerting you that somewhere in your code you are trying to use a translation key that you never created.","position":{"start":{"line":90,"column":160,"offset":4079},"end":{"line":90,"column":305,"offset":4224},"indent":[]}}],"position":{"start":{"line":90,"column":1,"offset":3920},"end":{"line":90,"column":305,"offset":4224},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"When you get to around 25,000 Discord servers on your bot, you may want to convert these channel IDs to webhooks.","position":{"start":{"line":92,"column":1,"offset":4226},"end":{"line":92,"column":114,"offset":4339},"indent":[]}}],"position":{"start":{"line":92,"column":1,"offset":4226},"end":{"line":92,"column":114,"offset":4339},"indent":[]}},{"type":"heading","depth":4,"children":[{"type":"text","value":"Role IDs","position":{"start":{"line":94,"column":6,"offset":4346},"end":{"line":94,"column":14,"offset":4354},"indent":[]}}],"position":{"start":{"line":94,"column":1,"offset":4341},"end":{"line":94,"column":14,"offset":4354},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"The roleIDs section holds the role IDs that are useful for specific features. For example, the ","position":{"start":{"line":96,"column":1,"offset":4356},"end":{"line":96,"column":96,"offset":4451},"indent":[]}},{"type":"inlineCode","value":"patreonVIPRoleID","position":{"start":{"line":96,"column":96,"offset":4451},"end":{"line":96,"column":114,"offset":4469},"indent":[]}},{"type":"text","value":" role can be used easily to enable vip features later in this guide.","position":{"start":{"line":96,"column":114,"offset":4469},"end":{"line":96,"column":182,"offset":4537},"indent":[]}}],"position":{"start":{"line":96,"column":1,"offset":4356},"end":{"line":96,"column":182,"offset":4537},"indent":[]}},{"type":"heading","depth":4,"children":[{"type":"text","value":"User IDs","position":{"start":{"line":98,"column":6,"offset":4544},"end":{"line":98,"column":14,"offset":4552},"indent":[]}}],"position":{"start":{"line":98,"column":1,"offset":4539},"end":{"line":98,"column":14,"offset":4552},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"The userIDs section holds the user IDs that are useful for specific features. For example, the ","position":{"start":{"line":100,"column":1,"offset":4554},"end":{"line":100,"column":96,"offset":4649},"indent":[]}},{"type":"inlineCode","value":"bot","position":{"start":{"line":100,"column":96,"offset":4649},"end":{"line":100,"column":101,"offset":4654},"indent":[]}},{"type":"text","value":" user will be where messages are sent alerting you that somewhere in your code you are trying to use a translation key that you never created.","position":{"start":{"line":100,"column":101,"offset":4654},"end":{"line":100,"column":243,"offset":4796},"indent":[]}}],"position":{"start":{"line":100,"column":1,"offset":4554},"end":{"line":100,"column":243,"offset":4796},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"When you get to around 25,000 Discord servers on your bot, you may want to convert these user IDs to webhooks.","position":{"start":{"line":102,"column":1,"offset":4798},"end":{"line":102,"column":111,"offset":4908},"indent":[]}}],"position":{"start":{"line":102,"column":1,"offset":4798},"end":{"line":102,"column":111,"offset":4908},"indent":[]}},{"type":"heading","depth":2,"children":[{"type":"text","value":"It's Alive!","position":{"start":{"line":104,"column":4,"offset":4913},"end":{"line":104,"column":15,"offset":4924},"indent":[]}}],"position":{"start":{"line":104,"column":1,"offset":4910},"end":{"line":104,"column":15,"offset":4924},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"Oh my god! You now have a bot with a bunch of features already! You don't believe me? Well, seeing is believing, so start the bot.","position":{"start":{"line":106,"column":1,"offset":4926},"end":{"line":106,"column":131,"offset":5056},"indent":[]}}],"position":{"start":{"line":106,"column":1,"offset":4926},"end":{"line":106,"column":131,"offset":5056},"indent":[]}},{"type":"list","ordered":true,"start":1,"spread":false,"children":[{"type":"listItem","spread":false,"checked":null,"children":[{"type":"paragraph","children":[{"type":"text","value":"Invite your bot to a discord server.","position":{"start":{"line":108,"column":4,"offset":5061},"end":{"line":108,"column":40,"offset":5097},"indent":[]}}],"position":{"start":{"line":108,"column":4,"offset":5061},"end":{"line":108,"column":40,"offset":5097},"indent":[]}}],"position":{"start":{"line":108,"column":1,"offset":5058},"end":{"line":108,"column":40,"offset":5097},"indent":[]}},{"type":"listItem","spread":false,"checked":null,"children":[{"type":"paragraph","children":[{"type":"text","value":"Open up the integrated terminal in VSC using ","position":{"start":{"line":109,"column":4,"offset":5101},"end":{"line":109,"column":49,"offset":5146},"indent":[]}},{"type":"strong","children":[{"type":"text","value":"CTRL + `","position":{"start":{"line":109,"column":51,"offset":5148},"end":{"line":109,"column":59,"offset":5156},"indent":[]}}],"position":{"start":{"line":109,"column":49,"offset":5146},"end":{"line":109,"column":61,"offset":5158},"indent":[]}},{"type":"text","value":". If you use a Mac, replace CTRL with CMD.","position":{"start":{"line":109,"column":61,"offset":5158},"end":{"line":109,"column":103,"offset":5200},"indent":[]}}],"position":{"start":{"line":109,"column":4,"offset":5101},"end":{"line":109,"column":103,"offset":5200},"indent":[]}}],"position":{"start":{"line":109,"column":1,"offset":5098},"end":{"line":109,"column":103,"offset":5200},"indent":[]}},{"type":"listItem","spread":false,"checked":null,"children":[{"type":"paragraph","children":[{"type":"text","value":"Run the script below:","position":{"start":{"line":110,"column":4,"offset":5204},"end":{"line":110,"column":25,"offset":5225},"indent":[]}}],"position":{"start":{"line":110,"column":4,"offset":5204},"end":{"line":110,"column":25,"offset":5225},"indent":[]}}],"position":{"start":{"line":110,"column":1,"offset":5201},"end":{"line":110,"column":25,"offset":5225},"indent":[]}}],"position":{"start":{"line":108,"column":1,"offset":5058},"end":{"line":110,"column":25,"offset":5225},"indent":[1,1]}},{"type":"code","lang":"shell","meta":null,"value":"deno run --allow-net --allow-read mod.ts","position":{"start":{"line":112,"column":1,"offset":5227},"end":{"line":114,"column":4,"offset":5280},"indent":[1,1]}},{"type":"paragraph","children":[{"type":"text","value":"The first time you run it, you may see a lot of files being loaded. This is preparing all the magic behind the scene. Once it is ready, you will see something like this:","position":{"start":{"line":116,"column":1,"offset":5282},"end":{"line":116,"column":170,"offset":5451},"indent":[]}}],"position":{"start":{"line":116,"column":1,"offset":5282},"end":{"line":116,"column":170,"offset":5451},"indent":[]}},{"type":"paragraph","children":[{"type":"image","title":null,"url":"https://i.imgur.com/TOXjLgh.png","alt":"image","position":{"start":{"line":118,"column":1,"offset":5453},"end":{"line":118,"column":42,"offset":5494},"indent":[]}}],"position":{"start":{"line":118,"column":1,"offset":5453},"end":{"line":118,"column":42,"offset":5494},"indent":[]}},{"type":"heading","depth":2,"children":[{"type":"text","value":"Understanding What Discordeno Did","position":{"start":{"line":120,"column":4,"offset":5499},"end":{"line":120,"column":37,"offset":5532},"indent":[]}}],"position":{"start":{"line":120,"column":1,"offset":5496},"end":{"line":120,"column":37,"offset":5532},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"Discordeno includes these commands/folders as they are essential for any discord bot to have in order to meet the Discord Bot Best Practices. It also adds a few things that will help make some things easier to build a bot.","position":{"start":{"line":122,"column":1,"offset":5534},"end":{"line":122,"column":223,"offset":5756},"indent":[]}}],"position":{"start":{"line":122,"column":1,"offset":5534},"end":{"line":122,"column":223,"offset":5756},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"We will dive into these deeper in this guide. Let's take it step by step.","position":{"start":{"line":124,"column":1,"offset":5758},"end":{"line":124,"column":74,"offset":5831},"indent":[]}}],"position":{"start":{"line":124,"column":1,"offset":5758},"end":{"line":124,"column":74,"offset":5831},"indent":[]}},{"type":"export","value":"export const _frontmatter = {\"title\":\"Creating The Bot!\",\"metaTitle\":\"Creating A Bot | Discordeno\",\"metaDescription\":\"Let's create our very own bot with Discordeno!\"}","position":{"start":{"line":127,"column":1,"offset":5834},"end":{"line":127,"column":167,"offset":6000},"indent":[]}}],"position":{"start":{"line":1,"column":1,"offset":0},"end":{"line":127,"column":167,"offset":6000}}},"scopeImports":["import * as React from 'react'"],"scopeIdentifiers":["React"],"body":"function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }\n\nfunction _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }\n\nfunction _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }\n\n/* @jsx mdx */\nvar _frontmatter = {\n \"title\": \"Creating The Bot!\",\n \"metaTitle\": \"Creating A Bot | Discordeno\",\n \"metaDescription\": \"Let's create our very own bot with Discordeno!\"\n};\nvar layoutProps = {\n _frontmatter: _frontmatter\n};\nvar MDXLayout = \"wrapper\";\nreturn function MDXContent(_ref) {\n var components = _ref.components,\n props = _objectWithoutProperties(_ref, [\"components\"]);\n\n return mdx(MDXLayout, _extends({}, layoutProps, props, {\n components: components,\n mdxType: \"MDXLayout\"\n }), mdx(\"p\", null, \"Discordeno will help make Discord bot development much easier. Don't worry, as you go through this guide it will make a lot more sense.\"), mdx(\"h2\", null, \"Creating The Bot!\"), mdx(\"blockquote\", null, mdx(\"p\", {\n parentName: \"blockquote\"\n }, \"This guide is going to assume you already have the basic requirements to make a bot ready. This includes github, git, a code editor like Visual Studio Code. If you don't have these yet please prepare them first before going forward.\")), mdx(\"ul\", null, mdx(\"li\", {\n parentName: \"ul\"\n }, mdx(\"p\", {\n parentName: \"li\"\n }, \"First, create a Discordeno Bot using the \", mdx(\"a\", _extends({\n parentName: \"p\"\n }, {\n \"href\": \"https://github.com/Skillz4Killz/Discordeno-bot-template\"\n }), \"Generator Boilerplate\"), \". Give it any name you like. For the purpose of this guide we will call it, Stargate.\")), mdx(\"li\", {\n parentName: \"ul\"\n }, mdx(\"p\", {\n parentName: \"li\"\n }, \"Then \", mdx(\"inlineCode\", {\n parentName: \"p\"\n }, \"git clone https://github.com/Skillz4Killz/Stargate.git\"))), mdx(\"li\", {\n parentName: \"ul\"\n }, mdx(\"p\", {\n parentName: \"li\"\n }, \"When that is done, go ahead and open up the folder with VSC.\")), mdx(\"li\", {\n parentName: \"ul\"\n }, mdx(\"p\", {\n parentName: \"li\"\n }, \"Create a new file called \", mdx(\"inlineCode\", {\n parentName: \"p\"\n }, \"configs.ts\"), \". Open the \", mdx(\"inlineCode\", {\n parentName: \"p\"\n }, \"configs.example.ts\"), \" file and copy everything over.\"))), mdx(\"p\", null, \"Let's take a minute to review all the options we have available to us.\"), mdx(\"h3\", null, \"Configs File\"), mdx(\"p\", null, \"The \", mdx(\"inlineCode\", {\n parentName: \"p\"\n }, \"configs.ts\"), \" file is where you will keep all your secret info you don't want to share with anyone else. As long as \", mdx(\"inlineCode\", {\n parentName: \"p\"\n }, \".gitignore\"), \" file is ignoring configs.ts your configurations will be kept private!\"), mdx(\"pre\", null, mdx(\"code\", _extends({\n parentName: \"pre\"\n }, {\n \"className\": \"language-ts\"\n }), \"// Step 1: Remove the `.example` from this file name so it is called `configs.ts`\\n// Step 2: Add all your bot's information below. The only required one is token and prefix. NOTE: As long as `.gitignore` file is ignoring configs.ts your configurations will be kept private!\\n// Step 3: Remove these comments if you like.\\n\\nexport const configs = {\\n // Your bot token goes here\\n token: \\\"\\\",\\n // The default prefix for your bot. Don't worry guilds can change this later.\\n prefix: \\\"!\\\",\\n // This isn't required but you can add bot list api keys here.\\n botListTokens: {\\n DISCORD_BOT_ORG: \\\"\\\",\\n BOTS_ON_DISCORD: \\\"\\\",\\n DISCORD_BOT_LIST: \\\"\\\",\\n BOTS_FOR_DISCORD: \\\"\\\",\\n DISCORD_BOATS: \\\"\\\",\\n DISCORD_BOTS_GG: \\\"\\\",\\n DISCORD_BOTS_GROUP: \\\"\\\",\\n },\\n // This is the server id for your bot's main server where users can get help/support\\n supportServerID: \\\"\\\",\\n // These are channel ids that will enable some functionality\\n channelIDs: {\\n // When a translation is missing this is the channel you will be alerted in.\\n missingTranslation: \\\"\\\",\\n // When an error occurs, we will try and log it to this channel\\n errorChannelID: \\\"\\\"\\n },\\n // These are the role ids that will enable some functionality.\\n roleIDs: {\\n // If you have a patreon set up you can add the patreon vip role id here.\\n patreonVIPRoleID: \\\"\\\",\\n },\\n // These are the user ids that will enable some functionality.\\n userIDs: {\\n // The user ids for the support team\\n botSupporters: [],\\n // The user ids for the other devs on your team\\n botDevs: [],\\n // The user ids who have complete 100% access to your bot\\n botOwners: []\\n }\\n};\\n\\n\")), mdx(\"h4\", null, \"Token\"), mdx(\"p\", null, \"First, add your bot token. This is \", mdx(\"strong\", {\n parentName: \"p\"\n }, \"required\"), \" for the bot to start. Review the \", mdx(\"a\", _extends({\n parentName: \"p\"\n }, {\n \"href\": \"https://discordeno.netlify.app/gettingstarted#creatingyourfirstdiscordbotapplication\"\n }), \"instructions\"), \" if you have not made your token yet.\"), mdx(\"h4\", null, \"Prefix\"), mdx(\"p\", null, \"The prefix is where you will set the default prefix for your bot. Don't worry, every server will be able to choose their own prefix but we need a default prefix to start.\"), mdx(\"h4\", null, \"Bot Lists Tokens\"), mdx(\"p\", null, \"This section of the file is so you can easily have your bot's statistics updated on all the bot lists out there to help you grow your bot. The code is already written to handle this but you will need to do 3 things for each bot list.\"), mdx(\"ol\", null, mdx(\"li\", {\n parentName: \"ol\"\n }, \"Go to the bot list and add your bot to their website. (Each site has it's own instructions)\"), mdx(\"li\", {\n parentName: \"ol\"\n }, \"Create a token for yourself on each website and paste it in your configs.\"), mdx(\"li\", {\n parentName: \"ol\"\n }, \"Enjoy!\")), mdx(\"p\", null, \"If you wish to customize the code, you will find the bot list tasks in the tasks folder. Don't worry we will discuss this when we get to the tasks section of the guide.\"), mdx(\"p\", null, \"For now just remember, that Discordeno provides you a built in way to update most discord bot lists.\"), mdx(\"h4\", null, \"Channel IDs\"), mdx(\"p\", null, \"The channelIDs section holds the channel IDs that are useful for specific features to help give you alerts/notifications. For example, the \", mdx(\"inlineCode\", {\n parentName: \"p\"\n }, \"missingTranslation\"), \" channel will be where messages are sent alerting you that somewhere in your code you are trying to use a translation key that you never created.\"), mdx(\"p\", null, \"When you get to around 25,000 Discord servers on your bot, you may want to convert these channel IDs to webhooks.\"), mdx(\"h4\", null, \"Role IDs\"), mdx(\"p\", null, \"The roleIDs section holds the role IDs that are useful for specific features. For example, the \", mdx(\"inlineCode\", {\n parentName: \"p\"\n }, \"patreonVIPRoleID\"), \" role can be used easily to enable vip features later in this guide.\"), mdx(\"h4\", null, \"User IDs\"), mdx(\"p\", null, \"The userIDs section holds the user IDs that are useful for specific features. For example, the \", mdx(\"inlineCode\", {\n parentName: \"p\"\n }, \"bot\"), \" user will be where messages are sent alerting you that somewhere in your code you are trying to use a translation key that you never created.\"), mdx(\"p\", null, \"When you get to around 25,000 Discord servers on your bot, you may want to convert these user IDs to webhooks.\"), mdx(\"h2\", null, \"It's Alive!\"), mdx(\"p\", null, \"Oh my god! You now have a bot with a bunch of features already! You don't believe me? Well, seeing is believing, so start the bot.\"), mdx(\"ol\", null, mdx(\"li\", {\n parentName: \"ol\"\n }, \"Invite your bot to a discord server.\"), mdx(\"li\", {\n parentName: \"ol\"\n }, \"Open up the integrated terminal in VSC using \", mdx(\"strong\", {\n parentName: \"li\"\n }, \"CTRL + `\"), \". If you use a Mac, replace CTRL with CMD.\"), mdx(\"li\", {\n parentName: \"ol\"\n }, \"Run the script below:\")), mdx(\"pre\", null, mdx(\"code\", _extends({\n parentName: \"pre\"\n }, {\n \"className\": \"language-shell\"\n }), \"deno run --allow-net --allow-read mod.ts\\n\")), mdx(\"p\", null, \"The first time you run it, you may see a lot of files being loaded. This is preparing all the magic behind the scene. Once it is ready, you will see something like this:\"), mdx(\"p\", null, mdx(\"img\", _extends({\n parentName: \"p\"\n }, {\n \"src\": \"https://i.imgur.com/TOXjLgh.png\",\n \"alt\": \"image\"\n }))), mdx(\"h2\", null, \"Understanding What Discordeno Did\"), mdx(\"p\", null, \"Discordeno includes these commands/folders as they are essential for any discord bot to have in order to meet the Discord Bot Best Practices. It also adds a few things that will help make some things easier to build a bot.\"), mdx(\"p\", null, \"We will dive into these deeper in this guide. Let's take it step by step.\"));\n}\n;\nMDXContent.isMDXComponent = true;","rawMDXOutput":"/* @jsx mdx */\nimport { mdx } from '@mdx-js/react';\n/* @jsx mdx */\n\nexport const _frontmatter = {\n \"title\": \"Creating The Bot!\",\n \"metaTitle\": \"Creating A Bot | Discordeno\",\n \"metaDescription\": \"Let's create our very own bot with Discordeno!\"\n};\n\nconst layoutProps = {\n _frontmatter\n};\nconst MDXLayout = \"wrapper\"\nexport default function MDXContent({\n components,\n ...props\n}) {\n return \n

{`Discordeno will help make Discord bot development much easier. Don't worry, as you go through this guide it will make a lot more sense.`}

\n

{`Creating The Bot!`}

\n
\n

{`This guide is going to assume you already have the basic requirements to make a bot ready. This includes github, git, a code editor like Visual Studio Code. If you don't have these yet please prepare them first before going forward.`}

\n
\n
    \n
  • \n

    {`First, create a Discordeno Bot using the `}{`Generator Boilerplate`}{`. Give it any name you like. For the purpose of this guide we will call it, Stargate.`}

    \n
  • \n
  • \n

    {`Then `}{`git clone https://github.com/Skillz4Killz/Stargate.git`}

    \n
  • \n
  • \n

    {`When that is done, go ahead and open up the folder with VSC.`}

    \n
  • \n
  • \n

    {`Create a new file called `}{`configs.ts`}{`. Open the `}{`configs.example.ts`}{` file and copy everything over.`}

    \n
  • \n
\n

{`Let's take a minute to review all the options we have available to us.`}

\n

{`Configs File`}

\n

{`The `}{`configs.ts`}{` file is where you will keep all your secret info you don't want to share with anyone else. As long as `}{`.gitignore`}{` file is ignoring configs.ts your configurations will be kept private!`}

\n
{`// Step 1: Remove the \\`.example\\` from this file name so it is called \\`configs.ts\\`\n// Step 2: Add all your bot's information below. The only required one is token and prefix. NOTE: As long as \\`.gitignore\\` file is ignoring configs.ts your configurations will be kept private!\n// Step 3: Remove these comments if you like.\n\nexport const configs = {\n  // Your bot token goes here\n  token: \"\",\n  // The default prefix for your bot. Don't worry guilds can change this later.\n  prefix: \"!\",\n  // This isn't required but you can add bot list api keys here.\n  botListTokens: {\n    DISCORD_BOT_ORG: \"\",\n    BOTS_ON_DISCORD: \"\",\n    DISCORD_BOT_LIST: \"\",\n    BOTS_FOR_DISCORD: \"\",\n    DISCORD_BOATS: \"\",\n    DISCORD_BOTS_GG: \"\",\n    DISCORD_BOTS_GROUP: \"\",\n  },\n  // This is the server id for your bot's main server where users can get help/support\n  supportServerID: \"\",\n  // These are channel ids that will enable some functionality\n  channelIDs: {\n    // When a translation is missing this is the channel you will be alerted in.\n    missingTranslation: \"\",\n    // When an error occurs, we will try and log it to this channel\n    errorChannelID: \"\"\n  },\n  // These are the role ids that will enable some functionality.\n  roleIDs: {\n    // If you have a patreon set up you can add the patreon vip role id here.\n    patreonVIPRoleID: \"\",\n  },\n  // These are the user ids that will enable some functionality.\n  userIDs: {\n    // The user ids for the support team\n    botSupporters: [],\n    // The user ids for the other devs on your team\n    botDevs: [],\n    // The user ids who have complete 100% access to your bot\n    botOwners: []\n  }\n};\n\n`}
\n

{`Token`}

\n

{`First, add your bot token. This is `}{`required`}{` for the bot to start. Review the `}{`instructions`}{` if you have not made your token yet.`}

\n

{`Prefix`}

\n

{`The prefix is where you will set the default prefix for your bot. Don't worry, every server will be able to choose their own prefix but we need a default prefix to start.`}

\n

{`Bot Lists Tokens`}

\n

{`This section of the file is so you can easily have your bot's statistics updated on all the bot lists out there to help you grow your bot. The code is already written to handle this but you will need to do 3 things for each bot list.`}

\n
    \n
  1. {`Go to the bot list and add your bot to their website. (Each site has it's own instructions)`}
  2. \n
  3. {`Create a token for yourself on each website and paste it in your configs.`}
  4. \n
  5. {`Enjoy!`}
  6. \n
\n

{`If you wish to customize the code, you will find the bot list tasks in the tasks folder. Don't worry we will discuss this when we get to the tasks section of the guide.`}

\n

{`For now just remember, that Discordeno provides you a built in way to update most discord bot lists.`}

\n

{`Channel IDs`}

\n

{`The channelIDs section holds the channel IDs that are useful for specific features to help give you alerts/notifications. For example, the `}{`missingTranslation`}{` channel will be where messages are sent alerting you that somewhere in your code you are trying to use a translation key that you never created.`}

\n

{`When you get to around 25,000 Discord servers on your bot, you may want to convert these channel IDs to webhooks.`}

\n

{`Role IDs`}

\n

{`The roleIDs section holds the role IDs that are useful for specific features. For example, the `}{`patreonVIPRoleID`}{` role can be used easily to enable vip features later in this guide.`}

\n

{`User IDs`}

\n

{`The userIDs section holds the user IDs that are useful for specific features. For example, the `}{`bot`}{` user will be where messages are sent alerting you that somewhere in your code you are trying to use a translation key that you never created.`}

\n

{`When you get to around 25,000 Discord servers on your bot, you may want to convert these user IDs to webhooks.`}

\n

{`It's Alive!`}

\n

{`Oh my god! You now have a bot with a bunch of features already! You don't believe me? Well, seeing is believing, so start the bot.`}

\n
    \n
  1. {`Invite your bot to a discord server.`}
  2. \n
  3. {`Open up the integrated terminal in VSC using `}{`CTRL + \\``}{`. If you use a Mac, replace CTRL with CMD.`}
  4. \n
  5. {`Run the script below:`}
  6. \n
\n
{`deno run --allow-net --allow-read mod.ts\n`}
\n

{`The first time you run it, you may see a lot of files being loaded. This is preparing all the magic behind the scene. Once it is ready, you will see something like this:`}

\n

\n

{`Understanding What Discordeno Did`}

\n

{`Discordeno includes these commands/folders as they are essential for any discord bot to have in order to meet the Discord Bot Best Practices. It also adds a few things that will help make some things easier to build a bot.`}

\n

{`We will dive into these deeper in this guide. Let's take it step by step.`}

\n\n
;\n}\n\n;\nMDXContent.isMDXComponent = true;"}} \ No newline at end of file diff --git a/docs/.cache/caches/gatsby-plugin-mdx/diskstore-32eb83ed38d07ed1c91b8e08f1fba466.json b/docs/.cache/caches/gatsby-plugin-mdx/diskstore-32eb83ed38d07ed1c91b8e08f1fba466.json new file mode 100644 index 000000000..d70e2a896 --- /dev/null +++ b/docs/.cache/caches/gatsby-plugin-mdx/diskstore-32eb83ed38d07ed1c91b8e08f1fba466.json @@ -0,0 +1 @@ +{"expireTime":9007200851634959000,"key":"gatsby-plugin-mdx-entire-payload-6e58c799b48536328fab7b1b2a49ca13-","val":{"mdast":{"type":"root","children":[{"type":"paragraph","children":[{"type":"text","value":"Woah! You are almost half way done with understanding all of Discordeno. Amazing isn't it? Something you may have noticed in the last section was there were some options that prevented some commands from running like ","position":{"start":{"line":2,"column":1,"offset":1},"end":{"line":2,"column":218,"offset":218},"indent":[]}},{"type":"inlineCode","value":"dmOnly","position":{"start":{"line":2,"column":218,"offset":218},"end":{"line":2,"column":226,"offset":226},"indent":[]}},{"type":"text","value":" or the permission options. we created a setting to prevent the monitor from running in certain channels. What if we wanted to do prevent commands from happening? How would we prevent commands from running?","position":{"start":{"line":2,"column":226,"offset":226},"end":{"line":2,"column":432,"offset":432},"indent":[]}}],"position":{"start":{"line":2,"column":1,"offset":1},"end":{"line":2,"column":432,"offset":432},"indent":[]}},{"type":"heading","depth":2,"children":[{"type":"text","value":"What is an Inhibitor?","position":{"start":{"line":4,"column":4,"offset":437},"end":{"line":4,"column":25,"offset":458},"indent":[]}}],"position":{"start":{"line":4,"column":1,"offset":434},"end":{"line":4,"column":25,"offset":458},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"An Inhibitor is very similar to how monitors work. A monitor runs on every message but an inhibitor runs on every command. Remember all those command options like cooldown, permissions, permissionLevel, nsfw, etc... Each and every one of these options has an inhibitor in that checks commands for these settings.","position":{"start":{"line":6,"column":1,"offset":460},"end":{"line":6,"column":313,"offset":772},"indent":[]}}],"position":{"start":{"line":6,"column":1,"offset":460},"end":{"line":6,"column":313,"offset":772},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"Let's create our own inhibitor that would prevent commands from being used if the user is not a VIP user.","position":{"start":{"line":8,"column":1,"offset":774},"end":{"line":8,"column":106,"offset":879},"indent":[]}}],"position":{"start":{"line":8,"column":1,"offset":774},"end":{"line":8,"column":106,"offset":879},"indent":[]}},{"type":"blockquote","children":[{"type":"paragraph","children":[{"type":"strong","children":[{"type":"text","value":"Note:","position":{"start":{"line":10,"column":5,"offset":885},"end":{"line":10,"column":10,"offset":890},"indent":[]}}],"position":{"start":{"line":10,"column":3,"offset":883},"end":{"line":10,"column":12,"offset":892},"indent":[]}},{"type":"text","value":" It is important to remember that everything below can be done with a simple permission level as well. We will create our own custom permission levels but for the purposes of this guide and to be able to learn about Inhibitors, we will be using an inhibitor.","position":{"start":{"line":10,"column":12,"offset":892},"end":{"line":10,"column":270,"offset":1150},"indent":[]}}],"position":{"start":{"line":10,"column":3,"offset":883},"end":{"line":10,"column":270,"offset":1150},"indent":[]}}],"position":{"start":{"line":10,"column":1,"offset":881},"end":{"line":10,"column":270,"offset":1150},"indent":[]}},{"type":"heading","depth":2,"children":[{"type":"text","value":"Creating the File","position":{"start":{"line":12,"column":4,"offset":1155},"end":{"line":12,"column":21,"offset":1172},"indent":[]}}],"position":{"start":{"line":12,"column":1,"offset":1152},"end":{"line":12,"column":21,"offset":1172},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"Let's start by creating a file inside the inhibitors folder called ","position":{"start":{"line":14,"column":1,"offset":1174},"end":{"line":14,"column":68,"offset":1241},"indent":[]}},{"type":"inlineCode","value":"boosted.ts","position":{"start":{"line":14,"column":68,"offset":1241},"end":{"line":14,"column":80,"offset":1253},"indent":[]}},{"type":"text","value":" and paste the following snippet of code:","position":{"start":{"line":14,"column":80,"offset":1253},"end":{"line":14,"column":121,"offset":1294},"indent":[]}}],"position":{"start":{"line":14,"column":1,"offset":1174},"end":{"line":14,"column":121,"offset":1294},"indent":[]}},{"type":"code","lang":"ts","meta":null,"value":"import { botCache } from \"../../mod.ts\";\n\nbotCache.inhibitors.set(\"inhibitorname\", async function (message, command, guild) {\n\t// Your code goes here\n});","position":{"start":{"line":16,"column":1,"offset":1296},"end":{"line":22,"column":4,"offset":1459},"indent":[1,1,1,1,1,1]}},{"type":"paragraph","children":[{"type":"text","value":"Inhibitors can take up to 3 arguments.","position":{"start":{"line":24,"column":1,"offset":1461},"end":{"line":24,"column":39,"offset":1499},"indent":[]}}],"position":{"start":{"line":24,"column":1,"offset":1461},"end":{"line":24,"column":39,"offset":1499},"indent":[]}},{"type":"list","ordered":false,"start":null,"spread":false,"children":[{"type":"listItem","spread":false,"checked":null,"children":[{"type":"paragraph","children":[{"type":"inlineCode","value":"message","position":{"start":{"line":26,"column":3,"offset":1503},"end":{"line":26,"column":12,"offset":1512},"indent":[]}},{"type":"text","value":": The message object that triggered the command.","position":{"start":{"line":26,"column":12,"offset":1512},"end":{"line":26,"column":60,"offset":1560},"indent":[]}}],"position":{"start":{"line":26,"column":3,"offset":1503},"end":{"line":26,"column":60,"offset":1560},"indent":[]}}],"position":{"start":{"line":26,"column":1,"offset":1501},"end":{"line":26,"column":60,"offset":1560},"indent":[]}},{"type":"listItem","spread":false,"checked":null,"children":[{"type":"paragraph","children":[{"type":"inlineCode","value":"command","position":{"start":{"line":27,"column":3,"offset":1563},"end":{"line":27,"column":12,"offset":1572},"indent":[]}},{"type":"text","value":": The command object itself that was triggered.","position":{"start":{"line":27,"column":12,"offset":1572},"end":{"line":27,"column":59,"offset":1619},"indent":[]}}],"position":{"start":{"line":27,"column":3,"offset":1563},"end":{"line":27,"column":59,"offset":1619},"indent":[]}}],"position":{"start":{"line":27,"column":1,"offset":1561},"end":{"line":27,"column":59,"offset":1619},"indent":[]}},{"type":"listItem","spread":false,"checked":null,"children":[{"type":"paragraph","children":[{"type":"inlineCode","value":"guild","position":{"start":{"line":28,"column":3,"offset":1622},"end":{"line":28,"column":10,"offset":1629},"indent":[]}},{"type":"text","value":": The server guild object where this command was ran.","position":{"start":{"line":28,"column":10,"offset":1629},"end":{"line":28,"column":63,"offset":1682},"indent":[]}}],"position":{"start":{"line":28,"column":3,"offset":1622},"end":{"line":28,"column":63,"offset":1682},"indent":[]}}],"position":{"start":{"line":28,"column":1,"offset":1620},"end":{"line":28,"column":63,"offset":1682},"indent":[]}}],"position":{"start":{"line":26,"column":1,"offset":1501},"end":{"line":28,"column":63,"offset":1682},"indent":[1,1]}},{"type":"heading","depth":2,"children":[{"type":"text","value":"Understanding How Inhibitors Function","position":{"start":{"line":30,"column":4,"offset":1687},"end":{"line":30,"column":41,"offset":1724},"indent":[]}}],"position":{"start":{"line":30,"column":1,"offset":1684},"end":{"line":30,"column":41,"offset":1724},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"To block a command you have to return a truthy value.","position":{"start":{"line":32,"column":1,"offset":1726},"end":{"line":32,"column":54,"offset":1779},"indent":[]}}],"position":{"start":{"line":32,"column":1,"offset":1726},"end":{"line":32,"column":54,"offset":1779},"indent":[]}},{"type":"list","ordered":false,"start":null,"spread":false,"children":[{"type":"listItem","spread":false,"checked":null,"children":[{"type":"paragraph","children":[{"type":"strong","children":[{"type":"text","value":"return true;","position":{"start":{"line":33,"column":5,"offset":1784},"end":{"line":33,"column":17,"offset":1796},"indent":[]}}],"position":{"start":{"line":33,"column":3,"offset":1782},"end":{"line":33,"column":19,"offset":1798},"indent":[]}},{"type":"text","value":" If you return true the inhibitor will block the execution of the command.\nTo allow a command return a falsey value.","position":{"start":{"line":33,"column":19,"offset":1798},"end":{"line":34,"column":42,"offset":1914},"indent":[1]}}],"position":{"start":{"line":33,"column":3,"offset":1782},"end":{"line":34,"column":42,"offset":1914},"indent":[1]}}],"position":{"start":{"line":33,"column":1,"offset":1780},"end":{"line":34,"column":42,"offset":1914},"indent":[1]}},{"type":"listItem","spread":false,"checked":null,"children":[{"type":"paragraph","children":[{"type":"strong","children":[{"type":"text","value":"return false;","position":{"start":{"line":35,"column":5,"offset":1919},"end":{"line":35,"column":18,"offset":1932},"indent":[]}}],"position":{"start":{"line":35,"column":3,"offset":1917},"end":{"line":35,"column":20,"offset":1934},"indent":[]}},{"type":"text","value":" If you return false the inhibitor will not block the error.","position":{"start":{"line":35,"column":20,"offset":1934},"end":{"line":35,"column":80,"offset":1994},"indent":[]}}],"position":{"start":{"line":35,"column":3,"offset":1917},"end":{"line":35,"column":80,"offset":1994},"indent":[]}}],"position":{"start":{"line":35,"column":1,"offset":1915},"end":{"line":35,"column":80,"offset":1994},"indent":[]}}],"position":{"start":{"line":33,"column":1,"offset":1780},"end":{"line":35,"column":80,"offset":1994},"indent":[1,1]}},{"type":"code","lang":"ts","meta":null,"value":"// If the command is not VIP only we can allow this command to execute\nif (!command.vipOnly) return false;\n\n// The bot's support server\nconst guild = cache.guilds.get(configs.supportServerID);\n// If the command author is not in the server they won't have the vip role\nconst member = guild.members.get(message.author.id) || await getMember(guild.id, message.author.id);\n// Member doesn't exist so cancel the command\nif (!member) {\n\tsendResponse(message, `sorry, but you can not use this command until you become VIP. **Close the IRIS!!!**`)\n\treturn true;\n}\n\n// If the user has the vip role on the support server given by patreon allow the command\nif (member.roles.includes(configs.roleIDs.patreonVIPRoleID)) return false;\n\n// Alert the user they don't have vip and can't use the command\nsendResponse(message, `sorry, but you can not use this command until you become a VIP. I'm sorry, Teal'c. We'll go to Disneyland next year. I promise.`)\n// Cancel the command since the user does not have vip\nreturn true;","position":{"start":{"line":38,"column":1,"offset":1997},"end":{"line":59,"column":4,"offset":3013},"indent":[1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1]}},{"type":"heading","depth":2,"children":[{"type":"text","value":"Updating Command Typings","position":{"start":{"line":61,"column":4,"offset":3018},"end":{"line":61,"column":28,"offset":3042},"indent":[]}}],"position":{"start":{"line":61,"column":1,"offset":3015},"end":{"line":61,"column":28,"offset":3042},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"Since we need a new option on our commands we need to add that. Open the ","position":{"start":{"line":63,"column":1,"offset":3044},"end":{"line":63,"column":74,"offset":3117},"indent":[]}},{"type":"inlineCode","value":"src/types/commands.ts","position":{"start":{"line":63,"column":74,"offset":3117},"end":{"line":63,"column":97,"offset":3140},"indent":[]}},{"type":"text","value":" file and add in the following","position":{"start":{"line":63,"column":97,"offset":3140},"end":{"line":63,"column":127,"offset":3170},"indent":[]}}],"position":{"start":{"line":63,"column":1,"offset":3044},"end":{"line":63,"column":127,"offset":3170},"indent":[]}},{"type":"code","lang":"ts","meta":null,"value":" vipOnly?: boolean;","position":{"start":{"line":65,"column":1,"offset":3172},"end":{"line":67,"column":4,"offset":3202},"indent":[1,1]}},{"type":"paragraph","children":[{"type":"text","value":"Once that is added, you can go into any command and mark them as vip only commands. ","position":{"start":{"line":69,"column":1,"offset":3204},"end":{"line":69,"column":85,"offset":3288},"indent":[]}}],"position":{"start":{"line":69,"column":1,"offset":3204},"end":{"line":69,"column":85,"offset":3288},"indent":[]}},{"type":"heading","depth":2,"children":[{"type":"text","value":"Challenges","position":{"start":{"line":71,"column":4,"offset":3293},"end":{"line":71,"column":14,"offset":3303},"indent":[]}}],"position":{"start":{"line":71,"column":1,"offset":3290},"end":{"line":71,"column":14,"offset":3303},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"Hell yes! We just got through the entire inhibitor section. You have now mastered everything related to inhibitors.","position":{"start":{"line":73,"column":1,"offset":3305},"end":{"line":73,"column":116,"offset":3420},"indent":[]}}],"position":{"start":{"line":73,"column":1,"offset":3305},"end":{"line":73,"column":116,"offset":3420},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"You can now try and get a little more practice with inhibitors by trying to challenge yourself and make your own inhibitors. Don't worry if you can't think of any good use cases for inhibitors.","position":{"start":{"line":75,"column":1,"offset":3422},"end":{"line":75,"column":194,"offset":3615},"indent":[]}}],"position":{"start":{"line":75,"column":1,"offset":3422},"end":{"line":75,"column":194,"offset":3615},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"Majority of Discordeno bots do not use many custom inhibitors because most of the necessary/important ones already come built for you in the inhibitors folder.","position":{"start":{"line":77,"column":1,"offset":3617},"end":{"line":77,"column":160,"offset":3776},"indent":[]}}],"position":{"start":{"line":77,"column":1,"offset":3617},"end":{"line":77,"column":160,"offset":3776},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"Next we will try our hands at creating a monitor.","position":{"start":{"line":79,"column":1,"offset":3778},"end":{"line":79,"column":50,"offset":3827},"indent":[]}}],"position":{"start":{"line":79,"column":1,"offset":3778},"end":{"line":79,"column":50,"offset":3827},"indent":[]}},{"type":"export","value":"export const _frontmatter = {\"title\":\"Creating Inhibitors!\",\"metaTitle\":\"Creating An Inhibitor | Discordeno\",\"metaDescription\":\"Let's create our very own bot with Discordeno!\"}","position":{"start":{"line":82,"column":1,"offset":3830},"end":{"line":82,"column":177,"offset":4006},"indent":[]}}],"position":{"start":{"line":1,"column":1,"offset":0},"end":{"line":82,"column":177,"offset":4006}}},"scopeImports":["import * as React from 'react'"],"scopeIdentifiers":["React"],"body":"function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }\n\nfunction _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }\n\nfunction _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }\n\n/* @jsx mdx */\nvar _frontmatter = {\n \"title\": \"Creating Inhibitors!\",\n \"metaTitle\": \"Creating An Inhibitor | Discordeno\",\n \"metaDescription\": \"Let's create our very own bot with Discordeno!\"\n};\nvar layoutProps = {\n _frontmatter: _frontmatter\n};\nvar MDXLayout = \"wrapper\";\nreturn function MDXContent(_ref) {\n var components = _ref.components,\n props = _objectWithoutProperties(_ref, [\"components\"]);\n\n return mdx(MDXLayout, _extends({}, layoutProps, props, {\n components: components,\n mdxType: \"MDXLayout\"\n }), mdx(\"p\", null, \"Woah! You are almost half way done with understanding all of Discordeno. Amazing isn't it? Something you may have noticed in the last section was there were some options that prevented some commands from running like \", mdx(\"inlineCode\", {\n parentName: \"p\"\n }, \"dmOnly\"), \" or the permission options. we created a setting to prevent the monitor from running in certain channels. What if we wanted to do prevent commands from happening? How would we prevent commands from running?\"), mdx(\"h2\", null, \"What is an Inhibitor?\"), mdx(\"p\", null, \"An Inhibitor is very similar to how monitors work. A monitor runs on every message but an inhibitor runs on every command. Remember all those command options like cooldown, permissions, permissionLevel, nsfw, etc... Each and every one of these options has an inhibitor in that checks commands for these settings.\"), mdx(\"p\", null, \"Let's create our own inhibitor that would prevent commands from being used if the user is not a VIP user.\"), mdx(\"blockquote\", null, mdx(\"p\", {\n parentName: \"blockquote\"\n }, mdx(\"strong\", {\n parentName: \"p\"\n }, \"Note:\"), \" It is important to remember that everything below can be done with a simple permission level as well. We will create our own custom permission levels but for the purposes of this guide and to be able to learn about Inhibitors, we will be using an inhibitor.\")), mdx(\"h2\", null, \"Creating the File\"), mdx(\"p\", null, \"Let's start by creating a file inside the inhibitors folder called \", mdx(\"inlineCode\", {\n parentName: \"p\"\n }, \"boosted.ts\"), \" and paste the following snippet of code:\"), mdx(\"pre\", null, mdx(\"code\", _extends({\n parentName: \"pre\"\n }, {\n \"className\": \"language-ts\"\n }), \"import { botCache } from \\\"../../mod.ts\\\";\\n\\nbotCache.inhibitors.set(\\\"inhibitorname\\\", async function (message, command, guild) {\\n // Your code goes here\\n});\\n\")), mdx(\"p\", null, \"Inhibitors can take up to 3 arguments.\"), mdx(\"ul\", null, mdx(\"li\", {\n parentName: \"ul\"\n }, mdx(\"inlineCode\", {\n parentName: \"li\"\n }, \"message\"), \": The message object that triggered the command.\"), mdx(\"li\", {\n parentName: \"ul\"\n }, mdx(\"inlineCode\", {\n parentName: \"li\"\n }, \"command\"), \": The command object itself that was triggered.\"), mdx(\"li\", {\n parentName: \"ul\"\n }, mdx(\"inlineCode\", {\n parentName: \"li\"\n }, \"guild\"), \": The server guild object where this command was ran.\")), mdx(\"h2\", null, \"Understanding How Inhibitors Function\"), mdx(\"p\", null, \"To block a command you have to return a truthy value.\"), mdx(\"ul\", null, mdx(\"li\", {\n parentName: \"ul\"\n }, mdx(\"strong\", {\n parentName: \"li\"\n }, \"return true;\"), \" If you return true the inhibitor will block the execution of the command.\\nTo allow a command return a falsey value.\"), mdx(\"li\", {\n parentName: \"ul\"\n }, mdx(\"strong\", {\n parentName: \"li\"\n }, \"return false;\"), \" If you return false the inhibitor will not block the error.\")), mdx(\"pre\", null, mdx(\"code\", _extends({\n parentName: \"pre\"\n }, {\n \"className\": \"language-ts\"\n }), \"// If the command is not VIP only we can allow this command to execute\\nif (!command.vipOnly) return false;\\n\\n// The bot's support server\\nconst guild = cache.guilds.get(configs.supportServerID);\\n// If the command author is not in the server they won't have the vip role\\nconst member = guild.members.get(message.author.id) || await getMember(guild.id, message.author.id);\\n// Member doesn't exist so cancel the command\\nif (!member) {\\n sendResponse(message, `sorry, but you can not use this command until you become VIP. **Close the IRIS!!!**`)\\n return true;\\n}\\n\\n// If the user has the vip role on the support server given by patreon allow the command\\nif (member.roles.includes(configs.roleIDs.patreonVIPRoleID)) return false;\\n\\n// Alert the user they don't have vip and can't use the command\\nsendResponse(message, `sorry, but you can not use this command until you become a VIP. I'm sorry, Teal'c. We'll go to Disneyland next year. I promise.`)\\n// Cancel the command since the user does not have vip\\nreturn true;\\n\")), mdx(\"h2\", null, \"Updating Command Typings\"), mdx(\"p\", null, \"Since we need a new option on our commands we need to add that. Open the \", mdx(\"inlineCode\", {\n parentName: \"p\"\n }, \"src/types/commands.ts\"), \" file and add in the following\"), mdx(\"pre\", null, mdx(\"code\", _extends({\n parentName: \"pre\"\n }, {\n \"className\": \"language-ts\"\n }), \" vipOnly?: boolean;\\n\")), mdx(\"p\", null, \"Once that is added, you can go into any command and mark them as vip only commands. \"), mdx(\"h2\", null, \"Challenges\"), mdx(\"p\", null, \"Hell yes! We just got through the entire inhibitor section. You have now mastered everything related to inhibitors.\"), mdx(\"p\", null, \"You can now try and get a little more practice with inhibitors by trying to challenge yourself and make your own inhibitors. Don't worry if you can't think of any good use cases for inhibitors.\"), mdx(\"p\", null, \"Majority of Discordeno bots do not use many custom inhibitors because most of the necessary/important ones already come built for you in the inhibitors folder.\"), mdx(\"p\", null, \"Next we will try our hands at creating a monitor.\"));\n}\n;\nMDXContent.isMDXComponent = true;","rawMDXOutput":"/* @jsx mdx */\nimport { mdx } from '@mdx-js/react';\n/* @jsx mdx */\n\nexport const _frontmatter = {\n \"title\": \"Creating Inhibitors!\",\n \"metaTitle\": \"Creating An Inhibitor | Discordeno\",\n \"metaDescription\": \"Let's create our very own bot with Discordeno!\"\n};\n\nconst layoutProps = {\n _frontmatter\n};\nconst MDXLayout = \"wrapper\"\nexport default function MDXContent({\n components,\n ...props\n}) {\n return \n

{`Woah! You are almost half way done with understanding all of Discordeno. Amazing isn't it? Something you may have noticed in the last section was there were some options that prevented some commands from running like `}{`dmOnly`}{` or the permission options. we created a setting to prevent the monitor from running in certain channels. What if we wanted to do prevent commands from happening? How would we prevent commands from running?`}

\n

{`What is an Inhibitor?`}

\n

{`An Inhibitor is very similar to how monitors work. A monitor runs on every message but an inhibitor runs on every command. Remember all those command options like cooldown, permissions, permissionLevel, nsfw, etc... Each and every one of these options has an inhibitor in that checks commands for these settings.`}

\n

{`Let's create our own inhibitor that would prevent commands from being used if the user is not a VIP user.`}

\n
\n

{`Note:`}{` It is important to remember that everything below can be done with a simple permission level as well. We will create our own custom permission levels but for the purposes of this guide and to be able to learn about Inhibitors, we will be using an inhibitor.`}

\n
\n

{`Creating the File`}

\n

{`Let's start by creating a file inside the inhibitors folder called `}{`boosted.ts`}{` and paste the following snippet of code:`}

\n
{`import { botCache } from \"../../mod.ts\";\n\nbotCache.inhibitors.set(\"inhibitorname\", async function (message, command, guild) {\n    // Your code goes here\n});\n`}
\n

{`Inhibitors can take up to 3 arguments.`}

\n
    \n
  • {`message`}{`: The message object that triggered the command.`}
  • \n
  • {`command`}{`: The command object itself that was triggered.`}
  • \n
  • {`guild`}{`: The server guild object where this command was ran.`}
  • \n
\n

{`Understanding How Inhibitors Function`}

\n

{`To block a command you have to return a truthy value.`}

\n
    \n
  • {`return true;`}{` If you return true the inhibitor will block the execution of the command.\nTo allow a command return a falsey value.`}
  • \n
  • {`return false;`}{` If you return false the inhibitor will not block the error.`}
  • \n
\n
{`// If the command is not VIP only we can allow this command to execute\nif (!command.vipOnly) return false;\n\n// The bot's support server\nconst guild = cache.guilds.get(configs.supportServerID);\n// If the command author is not in the server they won't have the vip role\nconst member = guild.members.get(message.author.id) || await getMember(guild.id, message.author.id);\n// Member doesn't exist so cancel the command\nif (!member) {\n    sendResponse(message, \\`sorry, but you can not use this command until you become VIP. **Close the IRIS!!!**\\`)\n    return true;\n}\n\n// If the user has the vip role on the support server given by patreon allow the command\nif (member.roles.includes(configs.roleIDs.patreonVIPRoleID)) return false;\n\n// Alert the user they don't have vip and can't use the command\nsendResponse(message, \\`sorry, but you can not use this command until you become a VIP. I'm sorry, Teal'c. We'll go to Disneyland next year. I promise.\\`)\n// Cancel the command since the user does not have vip\nreturn true;\n`}
\n

{`Updating Command Typings`}

\n

{`Since we need a new option on our commands we need to add that. Open the `}{`src/types/commands.ts`}{` file and add in the following`}

\n
{`  vipOnly?: boolean;\n`}
\n

{`Once that is added, you can go into any command and mark them as vip only commands. `}

\n

{`Challenges`}

\n

{`Hell yes! We just got through the entire inhibitor section. You have now mastered everything related to inhibitors.`}

\n

{`You can now try and get a little more practice with inhibitors by trying to challenge yourself and make your own inhibitors. Don't worry if you can't think of any good use cases for inhibitors.`}

\n

{`Majority of Discordeno bots do not use many custom inhibitors because most of the necessary/important ones already come built for you in the inhibitors folder.`}

\n

{`Next we will try our hands at creating a monitor.`}

\n\n
;\n}\n\n;\nMDXContent.isMDXComponent = true;"}} \ No newline at end of file diff --git a/docs/.cache/caches/gatsby-plugin-mdx/diskstore-3425a0648a8d54d9f46f9da3c263ab0b.json b/docs/.cache/caches/gatsby-plugin-mdx/diskstore-3425a0648a8d54d9f46f9da3c263ab0b.json new file mode 100644 index 000000000..8ae5d319b --- /dev/null +++ b/docs/.cache/caches/gatsby-plugin-mdx/diskstore-3425a0648a8d54d9f46f9da3c263ab0b.json @@ -0,0 +1 @@ +{"expireTime":9007200851634134000,"key":"gatsby-plugin-mdx-entire-payload-813370091f0eb1bfeb15a12b57f2b53d-","val":{"mdast":{"type":"root","children":[{"type":"paragraph","children":[{"type":"text","value":"Woah! You are almost half way done with understanding all of Discordeno. Amazing isn't it? Something you may have noticed in the last section was there were some options that prevented some commands from running like ","position":{"start":{"line":2,"column":1,"offset":1},"end":{"line":2,"column":218,"offset":218},"indent":[]}},{"type":"inlineCode","value":"dmOnly","position":{"start":{"line":2,"column":218,"offset":218},"end":{"line":2,"column":226,"offset":226},"indent":[]}},{"type":"text","value":" or the permission options. we created a setting to prevent the monitor from running in certain channels. What if we wanted to do prevent commands from happening? How would we prevent commands from running?","position":{"start":{"line":2,"column":226,"offset":226},"end":{"line":2,"column":432,"offset":432},"indent":[]}}],"position":{"start":{"line":2,"column":1,"offset":1},"end":{"line":2,"column":432,"offset":432},"indent":[]}},{"type":"heading","depth":2,"children":[{"type":"text","value":"What is an Inhibitor?","position":{"start":{"line":4,"column":4,"offset":437},"end":{"line":4,"column":25,"offset":458},"indent":[]}}],"position":{"start":{"line":4,"column":1,"offset":434},"end":{"line":4,"column":25,"offset":458},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"An Inhibitor is very similar to how monitors work. A monitor runs on every message but an inhibitor runs on every command. Remember all those command options like cooldown, permissions, permissionLevel, nsfw, etc... Each and every one of these options has an inhibitor in that checks commands for these settings.","position":{"start":{"line":6,"column":1,"offset":460},"end":{"line":6,"column":313,"offset":772},"indent":[]}}],"position":{"start":{"line":6,"column":1,"offset":460},"end":{"line":6,"column":313,"offset":772},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"Let's create our own inhibitor that would prevent commands from being used if the user is not a VIP user.","position":{"start":{"line":8,"column":1,"offset":774},"end":{"line":8,"column":106,"offset":879},"indent":[]}}],"position":{"start":{"line":8,"column":1,"offset":774},"end":{"line":8,"column":106,"offset":879},"indent":[]}},{"type":"blockquote","children":[{"type":"paragraph","children":[{"type":"strong","children":[{"type":"text","value":"Note:","position":{"start":{"line":10,"column":5,"offset":885},"end":{"line":10,"column":10,"offset":890},"indent":[]}}],"position":{"start":{"line":10,"column":3,"offset":883},"end":{"line":10,"column":12,"offset":892},"indent":[]}},{"type":"text","value":" It is important to remember that everything below can be done with a simple permission level as well. We will create our own custom permission levels but for the purposes of this guide and to be able to learn about Inhibitors, we will be using an inhibitor.","position":{"start":{"line":10,"column":12,"offset":892},"end":{"line":10,"column":270,"offset":1150},"indent":[]}}],"position":{"start":{"line":10,"column":3,"offset":883},"end":{"line":10,"column":270,"offset":1150},"indent":[]}}],"position":{"start":{"line":10,"column":1,"offset":881},"end":{"line":10,"column":270,"offset":1150},"indent":[]}},{"type":"heading","depth":2,"children":[{"type":"text","value":"Creating the File","position":{"start":{"line":12,"column":4,"offset":1155},"end":{"line":12,"column":21,"offset":1172},"indent":[]}}],"position":{"start":{"line":12,"column":1,"offset":1152},"end":{"line":12,"column":21,"offset":1172},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"Let's start by creating a file inside the inhibitors folder called ","position":{"start":{"line":14,"column":1,"offset":1174},"end":{"line":14,"column":68,"offset":1241},"indent":[]}},{"type":"inlineCode","value":"boosted.ts","position":{"start":{"line":14,"column":68,"offset":1241},"end":{"line":14,"column":80,"offset":1253},"indent":[]}},{"type":"text","value":" and paste the following snippet of code:","position":{"start":{"line":14,"column":80,"offset":1253},"end":{"line":14,"column":121,"offset":1294},"indent":[]}}],"position":{"start":{"line":14,"column":1,"offset":1174},"end":{"line":14,"column":121,"offset":1294},"indent":[]}},{"type":"code","lang":"ts","meta":null,"value":"import { botCache } from \"../../mod.ts\";\n\nbotCache.inhibitors.set(\"inhibitorname\", async function (message, command, guild) {\n\t// Your code goes here\n});","position":{"start":{"line":16,"column":1,"offset":1296},"end":{"line":22,"column":4,"offset":1459},"indent":[1,1,1,1,1,1]}},{"type":"paragraph","children":[{"type":"text","value":"Inhibitors can take up to 3 arguments.","position":{"start":{"line":24,"column":1,"offset":1461},"end":{"line":24,"column":39,"offset":1499},"indent":[]}}],"position":{"start":{"line":24,"column":1,"offset":1461},"end":{"line":24,"column":39,"offset":1499},"indent":[]}},{"type":"list","ordered":false,"start":null,"spread":false,"children":[{"type":"listItem","spread":false,"checked":null,"children":[{"type":"paragraph","children":[{"type":"inlineCode","value":"message","position":{"start":{"line":26,"column":3,"offset":1503},"end":{"line":26,"column":12,"offset":1512},"indent":[]}},{"type":"text","value":": The message object that triggered the command.","position":{"start":{"line":26,"column":12,"offset":1512},"end":{"line":26,"column":60,"offset":1560},"indent":[]}}],"position":{"start":{"line":26,"column":3,"offset":1503},"end":{"line":26,"column":60,"offset":1560},"indent":[]}}],"position":{"start":{"line":26,"column":1,"offset":1501},"end":{"line":26,"column":60,"offset":1560},"indent":[]}},{"type":"listItem","spread":false,"checked":null,"children":[{"type":"paragraph","children":[{"type":"inlineCode","value":"command","position":{"start":{"line":27,"column":3,"offset":1563},"end":{"line":27,"column":12,"offset":1572},"indent":[]}},{"type":"text","value":": The command object itself that was triggered.","position":{"start":{"line":27,"column":12,"offset":1572},"end":{"line":27,"column":59,"offset":1619},"indent":[]}}],"position":{"start":{"line":27,"column":3,"offset":1563},"end":{"line":27,"column":59,"offset":1619},"indent":[]}}],"position":{"start":{"line":27,"column":1,"offset":1561},"end":{"line":27,"column":59,"offset":1619},"indent":[]}},{"type":"listItem","spread":false,"checked":null,"children":[{"type":"paragraph","children":[{"type":"inlineCode","value":"guild","position":{"start":{"line":28,"column":3,"offset":1622},"end":{"line":28,"column":10,"offset":1629},"indent":[]}},{"type":"text","value":": The server guild object where this command was ran.","position":{"start":{"line":28,"column":10,"offset":1629},"end":{"line":28,"column":63,"offset":1682},"indent":[]}}],"position":{"start":{"line":28,"column":3,"offset":1622},"end":{"line":28,"column":63,"offset":1682},"indent":[]}}],"position":{"start":{"line":28,"column":1,"offset":1620},"end":{"line":28,"column":63,"offset":1682},"indent":[]}}],"position":{"start":{"line":26,"column":1,"offset":1501},"end":{"line":28,"column":63,"offset":1682},"indent":[1,1]}},{"type":"heading","depth":2,"children":[{"type":"text","value":"Understanding How Inhibitors Function","position":{"start":{"line":30,"column":4,"offset":1687},"end":{"line":30,"column":41,"offset":1724},"indent":[]}}],"position":{"start":{"line":30,"column":1,"offset":1684},"end":{"line":30,"column":41,"offset":1724},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"To block a command you have to return a truthy value.","position":{"start":{"line":32,"column":1,"offset":1726},"end":{"line":32,"column":54,"offset":1779},"indent":[]}}],"position":{"start":{"line":32,"column":1,"offset":1726},"end":{"line":32,"column":54,"offset":1779},"indent":[]}},{"type":"list","ordered":false,"start":null,"spread":false,"children":[{"type":"listItem","spread":false,"checked":null,"children":[{"type":"paragraph","children":[{"type":"strong","children":[{"type":"text","value":"return true;","position":{"start":{"line":33,"column":5,"offset":1784},"end":{"line":33,"column":17,"offset":1796},"indent":[]}}],"position":{"start":{"line":33,"column":3,"offset":1782},"end":{"line":33,"column":19,"offset":1798},"indent":[]}},{"type":"text","value":" If you return true the inhibitor will block the execution of the command.\nTo allow a command return a falsey value.","position":{"start":{"line":33,"column":19,"offset":1798},"end":{"line":34,"column":42,"offset":1914},"indent":[1]}}],"position":{"start":{"line":33,"column":3,"offset":1782},"end":{"line":34,"column":42,"offset":1914},"indent":[1]}}],"position":{"start":{"line":33,"column":1,"offset":1780},"end":{"line":34,"column":42,"offset":1914},"indent":[1]}},{"type":"listItem","spread":false,"checked":null,"children":[{"type":"paragraph","children":[{"type":"strong","children":[{"type":"text","value":"return false;","position":{"start":{"line":35,"column":5,"offset":1919},"end":{"line":35,"column":18,"offset":1932},"indent":[]}}],"position":{"start":{"line":35,"column":3,"offset":1917},"end":{"line":35,"column":20,"offset":1934},"indent":[]}},{"type":"text","value":" If you return false the inhibitor will not block the error.","position":{"start":{"line":35,"column":20,"offset":1934},"end":{"line":35,"column":80,"offset":1994},"indent":[]}}],"position":{"start":{"line":35,"column":3,"offset":1917},"end":{"line":35,"column":80,"offset":1994},"indent":[]}}],"position":{"start":{"line":35,"column":1,"offset":1915},"end":{"line":35,"column":80,"offset":1994},"indent":[]}}],"position":{"start":{"line":33,"column":1,"offset":1780},"end":{"line":35,"column":80,"offset":1994},"indent":[1,1]}},{"type":"code","lang":"ts","meta":null,"value":"// If the command is not VIP only we can allow this command to execute\nif (!command.vipOnly) return false;\n\n// The bot's support server\nconst guild = cache.guilds.get(configs.supportServerID);\n\nconst\n// Check if the user has the vip role on the support server given by patreon\nconst userIsVIP = await isUserVIP(message.author.id)\n// The user is VIP so we can allow this command to be used\nif (userIsVIP) return false;\n\n// The user is NOT VIP so we throw an error\nthrow `The ${command.name} is only allowed for VIP users.`","position":{"start":{"line":38,"column":1,"offset":1997},"end":{"line":53,"column":4,"offset":2528},"indent":[1,1,1,1,1,1,1,1,1,1,1,1,1,1,1]}},{"type":"export","value":"export const _frontmatter = {\"title\":\"Creating Inhibitors!\",\"metaTitle\":\"Creating An Inhibitor | Discordeno\",\"metaDescription\":\"Let's create our very own bot with Discordeno!\"}","position":{"start":{"line":56,"column":1,"offset":2531},"end":{"line":56,"column":177,"offset":2707},"indent":[]}}],"position":{"start":{"line":1,"column":1,"offset":0},"end":{"line":56,"column":177,"offset":2707}}},"scopeImports":["import * as React from 'react'"],"scopeIdentifiers":["React"],"body":"function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }\n\nfunction _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }\n\nfunction _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }\n\n/* @jsx mdx */\nvar _frontmatter = {\n \"title\": \"Creating Inhibitors!\",\n \"metaTitle\": \"Creating An Inhibitor | Discordeno\",\n \"metaDescription\": \"Let's create our very own bot with Discordeno!\"\n};\nvar layoutProps = {\n _frontmatter: _frontmatter\n};\nvar MDXLayout = \"wrapper\";\nreturn function MDXContent(_ref) {\n var components = _ref.components,\n props = _objectWithoutProperties(_ref, [\"components\"]);\n\n return mdx(MDXLayout, _extends({}, layoutProps, props, {\n components: components,\n mdxType: \"MDXLayout\"\n }), mdx(\"p\", null, \"Woah! You are almost half way done with understanding all of Discordeno. Amazing isn't it? Something you may have noticed in the last section was there were some options that prevented some commands from running like \", mdx(\"inlineCode\", {\n parentName: \"p\"\n }, \"dmOnly\"), \" or the permission options. we created a setting to prevent the monitor from running in certain channels. What if we wanted to do prevent commands from happening? How would we prevent commands from running?\"), mdx(\"h2\", null, \"What is an Inhibitor?\"), mdx(\"p\", null, \"An Inhibitor is very similar to how monitors work. A monitor runs on every message but an inhibitor runs on every command. Remember all those command options like cooldown, permissions, permissionLevel, nsfw, etc... Each and every one of these options has an inhibitor in that checks commands for these settings.\"), mdx(\"p\", null, \"Let's create our own inhibitor that would prevent commands from being used if the user is not a VIP user.\"), mdx(\"blockquote\", null, mdx(\"p\", {\n parentName: \"blockquote\"\n }, mdx(\"strong\", {\n parentName: \"p\"\n }, \"Note:\"), \" It is important to remember that everything below can be done with a simple permission level as well. We will create our own custom permission levels but for the purposes of this guide and to be able to learn about Inhibitors, we will be using an inhibitor.\")), mdx(\"h2\", null, \"Creating the File\"), mdx(\"p\", null, \"Let's start by creating a file inside the inhibitors folder called \", mdx(\"inlineCode\", {\n parentName: \"p\"\n }, \"boosted.ts\"), \" and paste the following snippet of code:\"), mdx(\"pre\", null, mdx(\"code\", _extends({\n parentName: \"pre\"\n }, {\n \"className\": \"language-ts\"\n }), \"import { botCache } from \\\"../../mod.ts\\\";\\n\\nbotCache.inhibitors.set(\\\"inhibitorname\\\", async function (message, command, guild) {\\n // Your code goes here\\n});\\n\")), mdx(\"p\", null, \"Inhibitors can take up to 3 arguments.\"), mdx(\"ul\", null, mdx(\"li\", {\n parentName: \"ul\"\n }, mdx(\"inlineCode\", {\n parentName: \"li\"\n }, \"message\"), \": The message object that triggered the command.\"), mdx(\"li\", {\n parentName: \"ul\"\n }, mdx(\"inlineCode\", {\n parentName: \"li\"\n }, \"command\"), \": The command object itself that was triggered.\"), mdx(\"li\", {\n parentName: \"ul\"\n }, mdx(\"inlineCode\", {\n parentName: \"li\"\n }, \"guild\"), \": The server guild object where this command was ran.\")), mdx(\"h2\", null, \"Understanding How Inhibitors Function\"), mdx(\"p\", null, \"To block a command you have to return a truthy value.\"), mdx(\"ul\", null, mdx(\"li\", {\n parentName: \"ul\"\n }, mdx(\"strong\", {\n parentName: \"li\"\n }, \"return true;\"), \" If you return true the inhibitor will block the execution of the command.\\nTo allow a command return a falsey value.\"), mdx(\"li\", {\n parentName: \"ul\"\n }, mdx(\"strong\", {\n parentName: \"li\"\n }, \"return false;\"), \" If you return false the inhibitor will not block the error.\")), mdx(\"pre\", null, mdx(\"code\", _extends({\n parentName: \"pre\"\n }, {\n \"className\": \"language-ts\"\n }), \"// If the command is not VIP only we can allow this command to execute\\nif (!command.vipOnly) return false;\\n\\n// The bot's support server\\nconst guild = cache.guilds.get(configs.supportServerID);\\n\\nconst\\n// Check if the user has the vip role on the support server given by patreon\\nconst userIsVIP = await isUserVIP(message.author.id)\\n// The user is VIP so we can allow this command to be used\\nif (userIsVIP) return false;\\n\\n// The user is NOT VIP so we throw an error\\nthrow `The ${command.name} is only allowed for VIP users.`\\n\")));\n}\n;\nMDXContent.isMDXComponent = true;","rawMDXOutput":"/* @jsx mdx */\nimport { mdx } from '@mdx-js/react';\n/* @jsx mdx */\n\nexport const _frontmatter = {\n \"title\": \"Creating Inhibitors!\",\n \"metaTitle\": \"Creating An Inhibitor | Discordeno\",\n \"metaDescription\": \"Let's create our very own bot with Discordeno!\"\n};\n\nconst layoutProps = {\n _frontmatter\n};\nconst MDXLayout = \"wrapper\"\nexport default function MDXContent({\n components,\n ...props\n}) {\n return \n

{`Woah! You are almost half way done with understanding all of Discordeno. Amazing isn't it? Something you may have noticed in the last section was there were some options that prevented some commands from running like `}{`dmOnly`}{` or the permission options. we created a setting to prevent the monitor from running in certain channels. What if we wanted to do prevent commands from happening? How would we prevent commands from running?`}

\n

{`What is an Inhibitor?`}

\n

{`An Inhibitor is very similar to how monitors work. A monitor runs on every message but an inhibitor runs on every command. Remember all those command options like cooldown, permissions, permissionLevel, nsfw, etc... Each and every one of these options has an inhibitor in that checks commands for these settings.`}

\n

{`Let's create our own inhibitor that would prevent commands from being used if the user is not a VIP user.`}

\n
\n

{`Note:`}{` It is important to remember that everything below can be done with a simple permission level as well. We will create our own custom permission levels but for the purposes of this guide and to be able to learn about Inhibitors, we will be using an inhibitor.`}

\n
\n

{`Creating the File`}

\n

{`Let's start by creating a file inside the inhibitors folder called `}{`boosted.ts`}{` and paste the following snippet of code:`}

\n
{`import { botCache } from \"../../mod.ts\";\n\nbotCache.inhibitors.set(\"inhibitorname\", async function (message, command, guild) {\n    // Your code goes here\n});\n`}
\n

{`Inhibitors can take up to 3 arguments.`}

\n
    \n
  • {`message`}{`: The message object that triggered the command.`}
  • \n
  • {`command`}{`: The command object itself that was triggered.`}
  • \n
  • {`guild`}{`: The server guild object where this command was ran.`}
  • \n
\n

{`Understanding How Inhibitors Function`}

\n

{`To block a command you have to return a truthy value.`}

\n
    \n
  • {`return true;`}{` If you return true the inhibitor will block the execution of the command.\nTo allow a command return a falsey value.`}
  • \n
  • {`return false;`}{` If you return false the inhibitor will not block the error.`}
  • \n
\n
{`// If the command is not VIP only we can allow this command to execute\nif (!command.vipOnly) return false;\n\n// The bot's support server\nconst guild = cache.guilds.get(configs.supportServerID);\n\nconst\n// Check if the user has the vip role on the support server given by patreon\nconst userIsVIP = await isUserVIP(message.author.id)\n// The user is VIP so we can allow this command to be used\nif (userIsVIP) return false;\n\n// The user is NOT VIP so we throw an error\nthrow \\`The \\${command.name} is only allowed for VIP users.\\`\n`}
\n\n
;\n}\n\n;\nMDXContent.isMDXComponent = true;"}} \ No newline at end of file diff --git a/docs/.cache/caches/gatsby-plugin-mdx/diskstore-34a4acfe01a0275e6326e6ce53ae75ee.json b/docs/.cache/caches/gatsby-plugin-mdx/diskstore-34a4acfe01a0275e6326e6ce53ae75ee.json new file mode 100644 index 000000000..717d66f06 --- /dev/null +++ b/docs/.cache/caches/gatsby-plugin-mdx/diskstore-34a4acfe01a0275e6326e6ce53ae75ee.json @@ -0,0 +1 @@ +{"expireTime":9007200851596640000,"key":"gatsby-plugin-mdx-entire-payload-2c7a125f6e80583cd28e14c90f36288d-","val":{"mdast":{"type":"root","children":[{"type":"heading","depth":2,"children":[{"type":"text","value":"Understanding The Goals of This Guide","position":{"start":{"line":2,"column":4,"offset":4},"end":{"line":2,"column":41,"offset":41},"indent":[]}}],"position":{"start":{"line":2,"column":1,"offset":1},"end":{"line":2,"column":41,"offset":41},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"This guide is a step by step simple walkthrough meant for beginner developers but also can be quite useful for advanced developers to learn about Discordeno.","position":{"start":{"line":4,"column":1,"offset":43},"end":{"line":4,"column":158,"offset":200},"indent":[]}}],"position":{"start":{"line":4,"column":1,"offset":43},"end":{"line":4,"column":158,"offset":200},"indent":[]}},{"type":"heading","depth":2,"children":[{"type":"text","value":"Who Made Discordeno?","position":{"start":{"line":6,"column":4,"offset":205},"end":{"line":6,"column":24,"offset":225},"indent":[]}}],"position":{"start":{"line":6,"column":1,"offset":202},"end":{"line":6,"column":24,"offset":225},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"Skillz4Killz. However, there are a lot of other contributors to the project as well. Join the discord server to meet and learn more about the wonderful team!","position":{"start":{"line":8,"column":1,"offset":227},"end":{"line":8,"column":158,"offset":384},"indent":[]}}],"position":{"start":{"line":8,"column":1,"offset":227},"end":{"line":8,"column":158,"offset":384},"indent":[]}},{"type":"heading","depth":2,"children":[{"type":"text","value":"Why You Should Use Discordeno?","position":{"start":{"line":10,"column":4,"offset":389},"end":{"line":10,"column":34,"offset":419},"indent":[]}}],"position":{"start":{"line":10,"column":1,"offset":386},"end":{"line":10,"column":34,"offset":419},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"Discordeno provides you all the tools that you need to make bot development really easy. All the tools are already made for you to just simply copy and use for yourself. We will go through each and every tool in other sections of this guide.","position":{"start":{"line":12,"column":1,"offset":421},"end":{"line":12,"column":242,"offset":662},"indent":[]}}],"position":{"start":{"line":12,"column":1,"offset":421},"end":{"line":12,"column":242,"offset":662},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"As the old saying goes, the best way to learn to ride a bicycle is to actually try riding a bicycle. So let's try out Discordeno.","position":{"start":{"line":14,"column":1,"offset":664},"end":{"line":14,"column":130,"offset":793},"indent":[]}}],"position":{"start":{"line":14,"column":1,"offset":664},"end":{"line":14,"column":130,"offset":793},"indent":[]}},{"type":"export","value":"export const _frontmatter = {\"title\":\"Step By Step Guide\",\"metaTitle\":\"Step By Step Guide | Discordeno\",\"metaDescription\":\"This guide will help you learn every part of Discordeno, step by step to create your own bot as you wish.\"}","position":{"start":{"line":17,"column":1,"offset":796},"end":{"line":17,"column":231,"offset":1026},"indent":[]}}],"position":{"start":{"line":1,"column":1,"offset":0},"end":{"line":17,"column":231,"offset":1026}}},"scopeImports":["import * as React from 'react'"],"scopeIdentifiers":["React"],"body":"function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }\n\nfunction _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }\n\nfunction _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }\n\n/* @jsx mdx */\nvar _frontmatter = {\n \"title\": \"Step By Step Guide\",\n \"metaTitle\": \"Step By Step Guide | Discordeno\",\n \"metaDescription\": \"This guide will help you learn every part of Discordeno, step by step to create your own bot as you wish.\"\n};\nvar layoutProps = {\n _frontmatter: _frontmatter\n};\nvar MDXLayout = \"wrapper\";\nreturn function MDXContent(_ref) {\n var components = _ref.components,\n props = _objectWithoutProperties(_ref, [\"components\"]);\n\n return mdx(MDXLayout, _extends({}, layoutProps, props, {\n components: components,\n mdxType: \"MDXLayout\"\n }), mdx(\"h2\", null, \"Understanding The Goals of This Guide\"), mdx(\"p\", null, \"This guide is a step by step simple walkthrough meant for beginner developers but also can be quite useful for advanced developers to learn about Discordeno.\"), mdx(\"h2\", null, \"Who Made Discordeno?\"), mdx(\"p\", null, \"Skillz4Killz. However, there are a lot of other contributors to the project as well. Join the discord server to meet and learn more about the wonderful team!\"), mdx(\"h2\", null, \"Why You Should Use Discordeno?\"), mdx(\"p\", null, \"Discordeno provides you all the tools that you need to make bot development really easy. All the tools are already made for you to just simply copy and use for yourself. We will go through each and every tool in other sections of this guide.\"), mdx(\"p\", null, \"As the old saying goes, the best way to learn to ride a bicycle is to actually try riding a bicycle. So let's try out Discordeno.\"));\n}\n;\nMDXContent.isMDXComponent = true;","rawMDXOutput":"/* @jsx mdx */\nimport { mdx } from '@mdx-js/react';\n/* @jsx mdx */\n\nexport const _frontmatter = {\n \"title\": \"Step By Step Guide\",\n \"metaTitle\": \"Step By Step Guide | Discordeno\",\n \"metaDescription\": \"This guide will help you learn every part of Discordeno, step by step to create your own bot as you wish.\"\n};\n\nconst layoutProps = {\n _frontmatter\n};\nconst MDXLayout = \"wrapper\"\nexport default function MDXContent({\n components,\n ...props\n}) {\n return \n

{`Understanding The Goals of This Guide`}

\n

{`This guide is a step by step simple walkthrough meant for beginner developers but also can be quite useful for advanced developers to learn about Discordeno.`}

\n

{`Who Made Discordeno?`}

\n

{`Skillz4Killz. However, there are a lot of other contributors to the project as well. Join the discord server to meet and learn more about the wonderful team!`}

\n

{`Why You Should Use Discordeno?`}

\n

{`Discordeno provides you all the tools that you need to make bot development really easy. All the tools are already made for you to just simply copy and use for yourself. We will go through each and every tool in other sections of this guide.`}

\n

{`As the old saying goes, the best way to learn to ride a bicycle is to actually try riding a bicycle. So let's try out Discordeno.`}

\n\n
;\n}\n\n;\nMDXContent.isMDXComponent = true;"}} \ No newline at end of file diff --git a/docs/.cache/caches/gatsby-plugin-mdx/diskstore-368eae47c7bcba4b37cede9a8d9e812c.json b/docs/.cache/caches/gatsby-plugin-mdx/diskstore-368eae47c7bcba4b37cede9a8d9e812c.json new file mode 100644 index 000000000..177c6a6cf --- /dev/null +++ b/docs/.cache/caches/gatsby-plugin-mdx/diskstore-368eae47c7bcba4b37cede9a8d9e812c.json @@ -0,0 +1 @@ +{"expireTime":9007200851633747000,"key":"gatsby-plugin-mdx-entire-payload-eeb3a716c50dc66416ff59db1adcf858-","val":{"mdast":{"type":"root","children":[{"type":"paragraph","children":[{"type":"text","value":"Woah! You are almost half way done with understanding all of Discordeno. Amazing isn't it? Something you may have noticed in the last section was there were some options that prevented some commands from running like ","position":{"start":{"line":2,"column":1,"offset":1},"end":{"line":2,"column":218,"offset":218},"indent":[]}},{"type":"inlineCode","value":"dmOnly","position":{"start":{"line":2,"column":218,"offset":218},"end":{"line":2,"column":226,"offset":226},"indent":[]}},{"type":"text","value":" or the permission options. we created a setting to prevent the monitor from running in certain channels. What if we wanted to do prevent commands from happening? How would we prevent commands from running?","position":{"start":{"line":2,"column":226,"offset":226},"end":{"line":2,"column":432,"offset":432},"indent":[]}}],"position":{"start":{"line":2,"column":1,"offset":1},"end":{"line":2,"column":432,"offset":432},"indent":[]}},{"type":"heading","depth":2,"children":[{"type":"text","value":"What is an Inhibitor?","position":{"start":{"line":4,"column":4,"offset":437},"end":{"line":4,"column":25,"offset":458},"indent":[]}}],"position":{"start":{"line":4,"column":1,"offset":434},"end":{"line":4,"column":25,"offset":458},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"An Inhibitor is very similar to how monitors work. A monitor runs on every message but an inhibitor runs on every command. Remember all those command options like cooldown, permissions, permissionLevel, nsfw, etc... Each and every one of these options has an inhibitor in that checks commands for these settings.","position":{"start":{"line":6,"column":1,"offset":460},"end":{"line":6,"column":313,"offset":772},"indent":[]}}],"position":{"start":{"line":6,"column":1,"offset":460},"end":{"line":6,"column":313,"offset":772},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"Let's create our own inhibitor that would prevent commands from being used if the user is not a VIP user.","position":{"start":{"line":8,"column":1,"offset":774},"end":{"line":8,"column":106,"offset":879},"indent":[]}}],"position":{"start":{"line":8,"column":1,"offset":774},"end":{"line":8,"column":106,"offset":879},"indent":[]}},{"type":"blockquote","children":[{"type":"paragraph","children":[{"type":"strong","children":[{"type":"text","value":"Note:","position":{"start":{"line":10,"column":5,"offset":885},"end":{"line":10,"column":10,"offset":890},"indent":[]}}],"position":{"start":{"line":10,"column":3,"offset":883},"end":{"line":10,"column":12,"offset":892},"indent":[]}},{"type":"text","value":" It is important to remember that everything below can be done with a simple permission level as well. We will create our own custom permission levels but for the purposes of this guide and to be able to learn about Inhibitors, we will be using an inhibitor.","position":{"start":{"line":10,"column":12,"offset":892},"end":{"line":10,"column":270,"offset":1150},"indent":[]}}],"position":{"start":{"line":10,"column":3,"offset":883},"end":{"line":10,"column":270,"offset":1150},"indent":[]}}],"position":{"start":{"line":10,"column":1,"offset":881},"end":{"line":10,"column":270,"offset":1150},"indent":[]}},{"type":"heading","depth":2,"children":[{"type":"text","value":"Creating the File","position":{"start":{"line":12,"column":4,"offset":1155},"end":{"line":12,"column":21,"offset":1172},"indent":[]}}],"position":{"start":{"line":12,"column":1,"offset":1152},"end":{"line":12,"column":21,"offset":1172},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"Let's start by creating a file inside the inhibitors folder called ","position":{"start":{"line":14,"column":1,"offset":1174},"end":{"line":14,"column":68,"offset":1241},"indent":[]}},{"type":"inlineCode","value":"vipOnly.ts","position":{"start":{"line":14,"column":68,"offset":1241},"end":{"line":14,"column":80,"offset":1253},"indent":[]}},{"type":"text","value":" and paste the following snippet of code:","position":{"start":{"line":14,"column":80,"offset":1253},"end":{"line":14,"column":121,"offset":1294},"indent":[]}}],"position":{"start":{"line":14,"column":1,"offset":1174},"end":{"line":14,"column":121,"offset":1294},"indent":[]}},{"type":"code","lang":"ts","meta":null,"value":"import { botCache } from \"../../mod.ts\";\n\nbotCache.inhibitors.set(\"inhibitorname\", async function (message, command, guild) {\n\t// Your code goes here\n});","position":{"start":{"line":16,"column":1,"offset":1296},"end":{"line":22,"column":4,"offset":1459},"indent":[1,1,1,1,1,1]}},{"type":"paragraph","children":[{"type":"text","value":"Inhibitors can take up to 3 arguments.","position":{"start":{"line":24,"column":1,"offset":1461},"end":{"line":24,"column":39,"offset":1499},"indent":[]}}],"position":{"start":{"line":24,"column":1,"offset":1461},"end":{"line":24,"column":39,"offset":1499},"indent":[]}},{"type":"list","ordered":false,"start":null,"spread":false,"children":[{"type":"listItem","spread":false,"checked":null,"children":[{"type":"paragraph","children":[{"type":"inlineCode","value":"message","position":{"start":{"line":26,"column":3,"offset":1503},"end":{"line":26,"column":12,"offset":1512},"indent":[]}},{"type":"text","value":": The message object that triggered the command.","position":{"start":{"line":26,"column":12,"offset":1512},"end":{"line":26,"column":60,"offset":1560},"indent":[]}}],"position":{"start":{"line":26,"column":3,"offset":1503},"end":{"line":26,"column":60,"offset":1560},"indent":[]}}],"position":{"start":{"line":26,"column":1,"offset":1501},"end":{"line":26,"column":60,"offset":1560},"indent":[]}},{"type":"listItem","spread":false,"checked":null,"children":[{"type":"paragraph","children":[{"type":"inlineCode","value":"command","position":{"start":{"line":27,"column":3,"offset":1563},"end":{"line":27,"column":12,"offset":1572},"indent":[]}},{"type":"text","value":": The command object itself that was triggered.","position":{"start":{"line":27,"column":12,"offset":1572},"end":{"line":27,"column":59,"offset":1619},"indent":[]}}],"position":{"start":{"line":27,"column":3,"offset":1563},"end":{"line":27,"column":59,"offset":1619},"indent":[]}}],"position":{"start":{"line":27,"column":1,"offset":1561},"end":{"line":27,"column":59,"offset":1619},"indent":[]}},{"type":"listItem","spread":false,"checked":null,"children":[{"type":"paragraph","children":[{"type":"inlineCode","value":"guild","position":{"start":{"line":28,"column":3,"offset":1622},"end":{"line":28,"column":10,"offset":1629},"indent":[]}},{"type":"text","value":": The server guild object where this command was ran.","position":{"start":{"line":28,"column":10,"offset":1629},"end":{"line":28,"column":63,"offset":1682},"indent":[]}}],"position":{"start":{"line":28,"column":3,"offset":1622},"end":{"line":28,"column":63,"offset":1682},"indent":[]}}],"position":{"start":{"line":28,"column":1,"offset":1620},"end":{"line":28,"column":63,"offset":1682},"indent":[]}}],"position":{"start":{"line":26,"column":1,"offset":1501},"end":{"line":28,"column":63,"offset":1682},"indent":[1,1]}},{"type":"heading","depth":2,"children":[{"type":"text","value":"Understanding How Inhibitors Function","position":{"start":{"line":30,"column":4,"offset":1687},"end":{"line":30,"column":41,"offset":1724},"indent":[]}}],"position":{"start":{"line":30,"column":1,"offset":1684},"end":{"line":30,"column":41,"offset":1724},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"To block a command you have to return a truthy value.","position":{"start":{"line":32,"column":1,"offset":1726},"end":{"line":32,"column":54,"offset":1779},"indent":[]}}],"position":{"start":{"line":32,"column":1,"offset":1726},"end":{"line":32,"column":54,"offset":1779},"indent":[]}},{"type":"list","ordered":false,"start":null,"spread":false,"children":[{"type":"listItem","spread":false,"checked":null,"children":[{"type":"paragraph","children":[{"type":"strong","children":[{"type":"text","value":"return true;","position":{"start":{"line":33,"column":5,"offset":1784},"end":{"line":33,"column":17,"offset":1796},"indent":[]}}],"position":{"start":{"line":33,"column":3,"offset":1782},"end":{"line":33,"column":19,"offset":1798},"indent":[]}},{"type":"text","value":" If you return true the inhibitor will block the execution of the command.\nTo allow a command return a falsey value.","position":{"start":{"line":33,"column":19,"offset":1798},"end":{"line":34,"column":42,"offset":1914},"indent":[1]}}],"position":{"start":{"line":33,"column":3,"offset":1782},"end":{"line":34,"column":42,"offset":1914},"indent":[1]}}],"position":{"start":{"line":33,"column":1,"offset":1780},"end":{"line":34,"column":42,"offset":1914},"indent":[1]}},{"type":"listItem","spread":false,"checked":null,"children":[{"type":"paragraph","children":[{"type":"strong","children":[{"type":"text","value":"return false;","position":{"start":{"line":35,"column":5,"offset":1919},"end":{"line":35,"column":18,"offset":1932},"indent":[]}}],"position":{"start":{"line":35,"column":3,"offset":1917},"end":{"line":35,"column":20,"offset":1934},"indent":[]}},{"type":"text","value":" If you return false the inhibitor will not block the error.","position":{"start":{"line":35,"column":20,"offset":1934},"end":{"line":35,"column":80,"offset":1994},"indent":[]}}],"position":{"start":{"line":35,"column":3,"offset":1917},"end":{"line":35,"column":80,"offset":1994},"indent":[]}}],"position":{"start":{"line":35,"column":1,"offset":1915},"end":{"line":35,"column":80,"offset":1994},"indent":[]}}],"position":{"start":{"line":33,"column":1,"offset":1780},"end":{"line":35,"column":80,"offset":1994},"indent":[1,1]}},{"type":"code","lang":"ts","meta":null,"value":"// If the command is not VIP only we can allow this command to execute\nif (!command.vipOnly) return false;\n\n// Check if the user is VIP\nconst userIsVIP = check\n// The user is VIP so we can allow this command to be used\nif (userIsVIP) return false;\n\n// The user is NOT VIP so we throw an error\nthrow `The ${command.name} is only allowed for VIP users.`","position":{"start":{"line":38,"column":1,"offset":1997},"end":{"line":49,"column":4,"offset":2358},"indent":[1,1,1,1,1,1,1,1,1,1,1]}},{"type":"export","value":"export const _frontmatter = {\"title\":\"Creating Inhibitors!\",\"metaTitle\":\"Creating An Inhibitor | Discordeno\",\"metaDescription\":\"Let's create our very own bot with Discordeno!\"}","position":{"start":{"line":52,"column":1,"offset":2361},"end":{"line":52,"column":177,"offset":2537},"indent":[]}}],"position":{"start":{"line":1,"column":1,"offset":0},"end":{"line":52,"column":177,"offset":2537}}},"scopeImports":["import * as React from 'react'"],"scopeIdentifiers":["React"],"body":"function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }\n\nfunction _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }\n\nfunction _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }\n\n/* @jsx mdx */\nvar _frontmatter = {\n \"title\": \"Creating Inhibitors!\",\n \"metaTitle\": \"Creating An Inhibitor | Discordeno\",\n \"metaDescription\": \"Let's create our very own bot with Discordeno!\"\n};\nvar layoutProps = {\n _frontmatter: _frontmatter\n};\nvar MDXLayout = \"wrapper\";\nreturn function MDXContent(_ref) {\n var components = _ref.components,\n props = _objectWithoutProperties(_ref, [\"components\"]);\n\n return mdx(MDXLayout, _extends({}, layoutProps, props, {\n components: components,\n mdxType: \"MDXLayout\"\n }), mdx(\"p\", null, \"Woah! You are almost half way done with understanding all of Discordeno. Amazing isn't it? Something you may have noticed in the last section was there were some options that prevented some commands from running like \", mdx(\"inlineCode\", {\n parentName: \"p\"\n }, \"dmOnly\"), \" or the permission options. we created a setting to prevent the monitor from running in certain channels. What if we wanted to do prevent commands from happening? How would we prevent commands from running?\"), mdx(\"h2\", null, \"What is an Inhibitor?\"), mdx(\"p\", null, \"An Inhibitor is very similar to how monitors work. A monitor runs on every message but an inhibitor runs on every command. Remember all those command options like cooldown, permissions, permissionLevel, nsfw, etc... Each and every one of these options has an inhibitor in that checks commands for these settings.\"), mdx(\"p\", null, \"Let's create our own inhibitor that would prevent commands from being used if the user is not a VIP user.\"), mdx(\"blockquote\", null, mdx(\"p\", {\n parentName: \"blockquote\"\n }, mdx(\"strong\", {\n parentName: \"p\"\n }, \"Note:\"), \" It is important to remember that everything below can be done with a simple permission level as well. We will create our own custom permission levels but for the purposes of this guide and to be able to learn about Inhibitors, we will be using an inhibitor.\")), mdx(\"h2\", null, \"Creating the File\"), mdx(\"p\", null, \"Let's start by creating a file inside the inhibitors folder called \", mdx(\"inlineCode\", {\n parentName: \"p\"\n }, \"vipOnly.ts\"), \" and paste the following snippet of code:\"), mdx(\"pre\", null, mdx(\"code\", _extends({\n parentName: \"pre\"\n }, {\n \"className\": \"language-ts\"\n }), \"import { botCache } from \\\"../../mod.ts\\\";\\n\\nbotCache.inhibitors.set(\\\"inhibitorname\\\", async function (message, command, guild) {\\n // Your code goes here\\n});\\n\")), mdx(\"p\", null, \"Inhibitors can take up to 3 arguments.\"), mdx(\"ul\", null, mdx(\"li\", {\n parentName: \"ul\"\n }, mdx(\"inlineCode\", {\n parentName: \"li\"\n }, \"message\"), \": The message object that triggered the command.\"), mdx(\"li\", {\n parentName: \"ul\"\n }, mdx(\"inlineCode\", {\n parentName: \"li\"\n }, \"command\"), \": The command object itself that was triggered.\"), mdx(\"li\", {\n parentName: \"ul\"\n }, mdx(\"inlineCode\", {\n parentName: \"li\"\n }, \"guild\"), \": The server guild object where this command was ran.\")), mdx(\"h2\", null, \"Understanding How Inhibitors Function\"), mdx(\"p\", null, \"To block a command you have to return a truthy value.\"), mdx(\"ul\", null, mdx(\"li\", {\n parentName: \"ul\"\n }, mdx(\"strong\", {\n parentName: \"li\"\n }, \"return true;\"), \" If you return true the inhibitor will block the execution of the command.\\nTo allow a command return a falsey value.\"), mdx(\"li\", {\n parentName: \"ul\"\n }, mdx(\"strong\", {\n parentName: \"li\"\n }, \"return false;\"), \" If you return false the inhibitor will not block the error.\")), mdx(\"pre\", null, mdx(\"code\", _extends({\n parentName: \"pre\"\n }, {\n \"className\": \"language-ts\"\n }), \"// If the command is not VIP only we can allow this command to execute\\nif (!command.vipOnly) return false;\\n\\n// Check if the user is VIP\\nconst userIsVIP = check\\n// The user is VIP so we can allow this command to be used\\nif (userIsVIP) return false;\\n\\n// The user is NOT VIP so we throw an error\\nthrow `The ${command.name} is only allowed for VIP users.`\\n\")));\n}\n;\nMDXContent.isMDXComponent = true;","rawMDXOutput":"/* @jsx mdx */\nimport { mdx } from '@mdx-js/react';\n/* @jsx mdx */\n\nexport const _frontmatter = {\n \"title\": \"Creating Inhibitors!\",\n \"metaTitle\": \"Creating An Inhibitor | Discordeno\",\n \"metaDescription\": \"Let's create our very own bot with Discordeno!\"\n};\n\nconst layoutProps = {\n _frontmatter\n};\nconst MDXLayout = \"wrapper\"\nexport default function MDXContent({\n components,\n ...props\n}) {\n return \n

{`Woah! You are almost half way done with understanding all of Discordeno. Amazing isn't it? Something you may have noticed in the last section was there were some options that prevented some commands from running like `}{`dmOnly`}{` or the permission options. we created a setting to prevent the monitor from running in certain channels. What if we wanted to do prevent commands from happening? How would we prevent commands from running?`}

\n

{`What is an Inhibitor?`}

\n

{`An Inhibitor is very similar to how monitors work. A monitor runs on every message but an inhibitor runs on every command. Remember all those command options like cooldown, permissions, permissionLevel, nsfw, etc... Each and every one of these options has an inhibitor in that checks commands for these settings.`}

\n

{`Let's create our own inhibitor that would prevent commands from being used if the user is not a VIP user.`}

\n
\n

{`Note:`}{` It is important to remember that everything below can be done with a simple permission level as well. We will create our own custom permission levels but for the purposes of this guide and to be able to learn about Inhibitors, we will be using an inhibitor.`}

\n
\n

{`Creating the File`}

\n

{`Let's start by creating a file inside the inhibitors folder called `}{`vipOnly.ts`}{` and paste the following snippet of code:`}

\n
{`import { botCache } from \"../../mod.ts\";\n\nbotCache.inhibitors.set(\"inhibitorname\", async function (message, command, guild) {\n    // Your code goes here\n});\n`}
\n

{`Inhibitors can take up to 3 arguments.`}

\n
    \n
  • {`message`}{`: The message object that triggered the command.`}
  • \n
  • {`command`}{`: The command object itself that was triggered.`}
  • \n
  • {`guild`}{`: The server guild object where this command was ran.`}
  • \n
\n

{`Understanding How Inhibitors Function`}

\n

{`To block a command you have to return a truthy value.`}

\n
    \n
  • {`return true;`}{` If you return true the inhibitor will block the execution of the command.\nTo allow a command return a falsey value.`}
  • \n
  • {`return false;`}{` If you return false the inhibitor will not block the error.`}
  • \n
\n
{`// If the command is not VIP only we can allow this command to execute\nif (!command.vipOnly) return false;\n\n// Check if the user is VIP\nconst userIsVIP = check\n// The user is VIP so we can allow this command to be used\nif (userIsVIP) return false;\n\n// The user is NOT VIP so we throw an error\nthrow \\`The \\${command.name} is only allowed for VIP users.\\`\n`}
\n\n
;\n}\n\n;\nMDXContent.isMDXComponent = true;"}} \ No newline at end of file diff --git a/docs/.cache/caches/gatsby-plugin-mdx/diskstore-370943155a334bc8c7da62041fe3efea.json b/docs/.cache/caches/gatsby-plugin-mdx/diskstore-370943155a334bc8c7da62041fe3efea.json new file mode 100644 index 000000000..3fa23a19a --- /dev/null +++ b/docs/.cache/caches/gatsby-plugin-mdx/diskstore-370943155a334bc8c7da62041fe3efea.json @@ -0,0 +1 @@ +{"expireTime":9007200851632084000,"key":"gatsby-plugin-mdx-entire-payload-6dd53b1685018c5824db8e0f51cb3fac-","val":{"mdast":{"type":"root","children":[{"type":"paragraph","children":[{"type":"text","value":"Woah! You are almost half way done with understanding all of Discordeno. Amazing isn't it? Something you may have noticed in the last section was there were some options that prevented some commands from running like ","position":{"start":{"line":2,"column":1,"offset":1},"end":{"line":2,"column":218,"offset":218},"indent":[]}},{"type":"inlineCode","value":"dmOnly","position":{"start":{"line":2,"column":218,"offset":218},"end":{"line":2,"column":226,"offset":226},"indent":[]}},{"type":"text","value":" or the permission options. we created a setting to prevent the monitor from running in certain channels. What if we wanted to do prevent commands from happening? How would we prevent commands from running?","position":{"start":{"line":2,"column":226,"offset":226},"end":{"line":2,"column":432,"offset":432},"indent":[]}}],"position":{"start":{"line":2,"column":1,"offset":1},"end":{"line":2,"column":432,"offset":432},"indent":[]}},{"type":"heading","depth":2,"children":[{"type":"text","value":"What is an Inhibitor?","position":{"start":{"line":4,"column":4,"offset":437},"end":{"line":4,"column":25,"offset":458},"indent":[]}}],"position":{"start":{"line":4,"column":1,"offset":434},"end":{"line":4,"column":25,"offset":458},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"An Inhibitor is very similar to how monitors work. A monitor runs on every message but an inhibitor runs on every command. Remember all those command options like cooldown, enabled, requiredPermissions, permissionLevel, nsfw, requiredSettings, runIn. Each and every one of these options has an inhibitor in Klasa core that checks commands for these settings.\nLet's create our own inhibitor that would prevent commands from being used if the user is not a VIP user.","position":{"start":{"line":6,"column":1,"offset":460},"end":{"line":7,"column":106,"offset":924},"indent":[1]}}],"position":{"start":{"line":6,"column":1,"offset":460},"end":{"line":7,"column":106,"offset":924},"indent":[1]}},{"type":"blockquote","children":[{"type":"paragraph","children":[{"type":"strong","children":[{"type":"text","value":"Note:","position":{"start":{"line":9,"column":5,"offset":930},"end":{"line":9,"column":10,"offset":935},"indent":[]}}],"position":{"start":{"line":9,"column":3,"offset":928},"end":{"line":9,"column":12,"offset":937},"indent":[]}},{"type":"text","value":" It is important to remember that everything below can be done with a simple permission level as well. We will create our own custom permission levels but for the purposes of this guide and to be able to learn about Inhibitors, we will be using an inhibitor.","position":{"start":{"line":9,"column":12,"offset":937},"end":{"line":9,"column":270,"offset":1195},"indent":[]}}],"position":{"start":{"line":9,"column":3,"offset":928},"end":{"line":9,"column":270,"offset":1195},"indent":[]}}],"position":{"start":{"line":9,"column":1,"offset":926},"end":{"line":9,"column":270,"offset":1195},"indent":[]}},{"type":"export","value":"export const _frontmatter = {\"title\":\"Creating Inhibitors!\",\"metaTitle\":\"Creating An Inhibitor | Discordeno\",\"metaDescription\":\"Let's create our very own bot with Discordeno!\"}","position":{"start":{"line":12,"column":1,"offset":1198},"end":{"line":12,"column":177,"offset":1374},"indent":[]}}],"position":{"start":{"line":1,"column":1,"offset":0},"end":{"line":12,"column":177,"offset":1374}}},"scopeImports":["import * as React from 'react'"],"scopeIdentifiers":["React"],"body":"function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }\n\nfunction _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }\n\nfunction _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }\n\n/* @jsx mdx */\nvar _frontmatter = {\n \"title\": \"Creating Inhibitors!\",\n \"metaTitle\": \"Creating An Inhibitor | Discordeno\",\n \"metaDescription\": \"Let's create our very own bot with Discordeno!\"\n};\nvar layoutProps = {\n _frontmatter: _frontmatter\n};\nvar MDXLayout = \"wrapper\";\nreturn function MDXContent(_ref) {\n var components = _ref.components,\n props = _objectWithoutProperties(_ref, [\"components\"]);\n\n return mdx(MDXLayout, _extends({}, layoutProps, props, {\n components: components,\n mdxType: \"MDXLayout\"\n }), mdx(\"p\", null, \"Woah! You are almost half way done with understanding all of Discordeno. Amazing isn't it? Something you may have noticed in the last section was there were some options that prevented some commands from running like \", mdx(\"inlineCode\", {\n parentName: \"p\"\n }, \"dmOnly\"), \" or the permission options. we created a setting to prevent the monitor from running in certain channels. What if we wanted to do prevent commands from happening? How would we prevent commands from running?\"), mdx(\"h2\", null, \"What is an Inhibitor?\"), mdx(\"p\", null, \"An Inhibitor is very similar to how monitors work. A monitor runs on every message but an inhibitor runs on every command. Remember all those command options like cooldown, enabled, requiredPermissions, permissionLevel, nsfw, requiredSettings, runIn. Each and every one of these options has an inhibitor in Klasa core that checks commands for these settings.\\nLet's create our own inhibitor that would prevent commands from being used if the user is not a VIP user.\"), mdx(\"blockquote\", null, mdx(\"p\", {\n parentName: \"blockquote\"\n }, mdx(\"strong\", {\n parentName: \"p\"\n }, \"Note:\"), \" It is important to remember that everything below can be done with a simple permission level as well. We will create our own custom permission levels but for the purposes of this guide and to be able to learn about Inhibitors, we will be using an inhibitor.\")));\n}\n;\nMDXContent.isMDXComponent = true;","rawMDXOutput":"/* @jsx mdx */\nimport { mdx } from '@mdx-js/react';\n/* @jsx mdx */\n\nexport const _frontmatter = {\n \"title\": \"Creating Inhibitors!\",\n \"metaTitle\": \"Creating An Inhibitor | Discordeno\",\n \"metaDescription\": \"Let's create our very own bot with Discordeno!\"\n};\n\nconst layoutProps = {\n _frontmatter\n};\nconst MDXLayout = \"wrapper\"\nexport default function MDXContent({\n components,\n ...props\n}) {\n return \n

{`Woah! You are almost half way done with understanding all of Discordeno. Amazing isn't it? Something you may have noticed in the last section was there were some options that prevented some commands from running like `}{`dmOnly`}{` or the permission options. we created a setting to prevent the monitor from running in certain channels. What if we wanted to do prevent commands from happening? How would we prevent commands from running?`}

\n

{`What is an Inhibitor?`}

\n

{`An Inhibitor is very similar to how monitors work. A monitor runs on every message but an inhibitor runs on every command. Remember all those command options like cooldown, enabled, requiredPermissions, permissionLevel, nsfw, requiredSettings, runIn. Each and every one of these options has an inhibitor in Klasa core that checks commands for these settings.\nLet's create our own inhibitor that would prevent commands from being used if the user is not a VIP user.`}

\n
\n

{`Note:`}{` It is important to remember that everything below can be done with a simple permission level as well. We will create our own custom permission levels but for the purposes of this guide and to be able to learn about Inhibitors, we will be using an inhibitor.`}

\n
\n\n
;\n}\n\n;\nMDXContent.isMDXComponent = true;"}} \ No newline at end of file diff --git a/docs/.cache/caches/gatsby-plugin-mdx/diskstore-3aacbad8303a268479a96099b423e2d6.json b/docs/.cache/caches/gatsby-plugin-mdx/diskstore-3aacbad8303a268479a96099b423e2d6.json new file mode 100644 index 000000000..430d554c8 --- /dev/null +++ b/docs/.cache/caches/gatsby-plugin-mdx/diskstore-3aacbad8303a268479a96099b423e2d6.json @@ -0,0 +1 @@ +{"expireTime":9007200851644245000,"key":"gatsby-plugin-mdx-entire-payload-cb06c52f180de55094a9cd83136a2eb8-","val":{"mdast":{"type":"root","children":[{"type":"paragraph","children":[{"type":"text","value":"Discordeno will help make Discord bot development much easier. Don't worry, as you go through this guide it will make a lot more sense.","position":{"start":{"line":2,"column":1,"offset":1},"end":{"line":2,"column":136,"offset":136},"indent":[]}}],"position":{"start":{"line":2,"column":1,"offset":1},"end":{"line":2,"column":136,"offset":136},"indent":[]}},{"type":"heading","depth":2,"children":[{"type":"text","value":"Creating The Bot!","position":{"start":{"line":4,"column":4,"offset":141},"end":{"line":4,"column":21,"offset":158},"indent":[]}}],"position":{"start":{"line":4,"column":1,"offset":138},"end":{"line":4,"column":21,"offset":158},"indent":[]}},{"type":"blockquote","children":[{"type":"paragraph","children":[{"type":"text","value":"This guide is going to assume you already have the basic requirements to make a bot ready. This includes github, git, a code editor like Visual Studio Code. If you don't have these yet please prepare them first before going forward.","position":{"start":{"line":6,"column":3,"offset":162},"end":{"line":6,"column":235,"offset":394},"indent":[]}}],"position":{"start":{"line":6,"column":3,"offset":162},"end":{"line":6,"column":235,"offset":394},"indent":[]}}],"position":{"start":{"line":6,"column":1,"offset":160},"end":{"line":6,"column":235,"offset":394},"indent":[]}},{"type":"list","ordered":false,"start":null,"spread":true,"children":[{"type":"listItem","spread":false,"checked":null,"children":[{"type":"paragraph","children":[{"type":"text","value":"First, create a Discordeno Bot using the ","position":{"start":{"line":8,"column":3,"offset":398},"end":{"line":8,"column":44,"offset":439},"indent":[]}},{"type":"link","title":null,"url":"https://github.com/Skillz4Killz/Discordeno-bot-template","children":[{"type":"text","value":"Generator Boilerplate","position":{"start":{"line":8,"column":45,"offset":440},"end":{"line":8,"column":66,"offset":461},"indent":[]}}],"position":{"start":{"line":8,"column":44,"offset":439},"end":{"line":8,"column":124,"offset":519},"indent":[]}},{"type":"text","value":". Give it any name you like. For the purpose of this guide we will call it, Stargate.","position":{"start":{"line":8,"column":124,"offset":519},"end":{"line":8,"column":209,"offset":604},"indent":[]}}],"position":{"start":{"line":8,"column":3,"offset":398},"end":{"line":8,"column":209,"offset":604},"indent":[]}}],"position":{"start":{"line":8,"column":1,"offset":396},"end":{"line":9,"column":1,"offset":605},"indent":[1]}},{"type":"listItem","spread":false,"checked":null,"children":[{"type":"paragraph","children":[{"type":"text","value":"Then ","position":{"start":{"line":10,"column":3,"offset":608},"end":{"line":10,"column":8,"offset":613},"indent":[]}},{"type":"inlineCode","value":"git clone https://github.com/Skillz4Killz/Stargate.git","position":{"start":{"line":10,"column":8,"offset":613},"end":{"line":10,"column":64,"offset":669},"indent":[]}}],"position":{"start":{"line":10,"column":3,"offset":608},"end":{"line":10,"column":64,"offset":669},"indent":[]}}],"position":{"start":{"line":10,"column":1,"offset":606},"end":{"line":11,"column":1,"offset":670},"indent":[1]}},{"type":"listItem","spread":false,"checked":null,"children":[{"type":"paragraph","children":[{"type":"text","value":"When that is done, go ahead and open up the folder with VSC.","position":{"start":{"line":12,"column":3,"offset":673},"end":{"line":12,"column":63,"offset":733},"indent":[]}}],"position":{"start":{"line":12,"column":3,"offset":673},"end":{"line":12,"column":63,"offset":733},"indent":[]}}],"position":{"start":{"line":12,"column":1,"offset":671},"end":{"line":12,"column":63,"offset":733},"indent":[]}},{"type":"listItem","spread":false,"checked":null,"children":[{"type":"paragraph","children":[{"type":"text","value":"Create a new file called ","position":{"start":{"line":13,"column":3,"offset":736},"end":{"line":13,"column":28,"offset":761},"indent":[]}},{"type":"inlineCode","value":"configs.ts","position":{"start":{"line":13,"column":28,"offset":761},"end":{"line":13,"column":40,"offset":773},"indent":[]}},{"type":"text","value":". Open the ","position":{"start":{"line":13,"column":40,"offset":773},"end":{"line":13,"column":51,"offset":784},"indent":[]}},{"type":"inlineCode","value":"configs.example.ts","position":{"start":{"line":13,"column":51,"offset":784},"end":{"line":13,"column":71,"offset":804},"indent":[]}},{"type":"text","value":" file and copy everything over.","position":{"start":{"line":13,"column":71,"offset":804},"end":{"line":13,"column":102,"offset":835},"indent":[]}}],"position":{"start":{"line":13,"column":3,"offset":736},"end":{"line":13,"column":102,"offset":835},"indent":[]}}],"position":{"start":{"line":13,"column":1,"offset":734},"end":{"line":13,"column":102,"offset":835},"indent":[]}}],"position":{"start":{"line":8,"column":1,"offset":396},"end":{"line":13,"column":102,"offset":835},"indent":[1,1,1,1,1]}},{"type":"paragraph","children":[{"type":"text","value":"Let's take a minute to review all the options we have available to us.","position":{"start":{"line":15,"column":1,"offset":837},"end":{"line":15,"column":71,"offset":907},"indent":[]}}],"position":{"start":{"line":15,"column":1,"offset":837},"end":{"line":15,"column":71,"offset":907},"indent":[]}},{"type":"heading","depth":3,"children":[{"type":"text","value":"Configs File","position":{"start":{"line":17,"column":5,"offset":913},"end":{"line":17,"column":17,"offset":925},"indent":[]}}],"position":{"start":{"line":17,"column":1,"offset":909},"end":{"line":17,"column":17,"offset":925},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"The ","position":{"start":{"line":19,"column":1,"offset":927},"end":{"line":19,"column":5,"offset":931},"indent":[]}},{"type":"inlineCode","value":"configs.ts","position":{"start":{"line":19,"column":5,"offset":931},"end":{"line":19,"column":17,"offset":943},"indent":[]}},{"type":"text","value":" file is where you will keep all your secret info you don't want to share with anyone else. As long as ","position":{"start":{"line":19,"column":17,"offset":943},"end":{"line":19,"column":120,"offset":1046},"indent":[]}},{"type":"inlineCode","value":".gitignore","position":{"start":{"line":19,"column":120,"offset":1046},"end":{"line":19,"column":132,"offset":1058},"indent":[]}},{"type":"text","value":" file is ignoring configs.ts your configurations will be kept private!","position":{"start":{"line":19,"column":132,"offset":1058},"end":{"line":19,"column":202,"offset":1128},"indent":[]}}],"position":{"start":{"line":19,"column":1,"offset":927},"end":{"line":19,"column":202,"offset":1128},"indent":[]}},{"type":"code","lang":"ts","meta":null,"value":"// Step 1: Remove the `.example` from this file name so it is called `configs.ts`\n// Step 2: Add all your bot's information below. The only required one is token and prefix. NOTE: As long as `.gitignore` file is ignoring configs.ts your configurations will be kept private!\n// Step 3: Remove these comments if you like.\n\nexport const configs = {\n // Your bot token goes here\n token: \"\",\n // The default prefix for your bot. Don't worry guilds can change this later.\n prefix: \"!\",\n // This isn't required but you can add bot list api keys here.\n botListTokens: {\n DISCORD_BOT_ORG: \"\",\n BOTS_ON_DISCORD: \"\",\n DISCORD_BOT_LIST: \"\",\n BOTS_FOR_DISCORD: \"\",\n DISCORD_BOATS: \"\",\n DISCORD_BOTS_GG: \"\",\n DISCORD_BOTS_GROUP: \"\",\n },\n // This is the server id for your bot's main server where users can get help/support\n supportServerID: \"\",\n // These are channel ids that will enable some functionality\n channelIDs: {\n // When a translation is missing this is the channel you will be alerted in.\n missingTranslation: \"\",\n // When an error occurs, we will try and log it to this channel\n errorChannelID: \"\"\n },\n // These are the role ids that will enable some functionality.\n roleIDs: {\n // If you have a patreon set up you can add the patreon vip role id here.\n patreonVIPRoleID: \"\",\n },\n // These are the user ids that will enable some functionality.\n userIDs: {\n // The user ids for the support team\n botSupporters: [],\n // The user ids for the other devs on your team\n botDevs: [],\n // The user ids who have complete 100% access to your bot\n botOwners: []\n }\n};\n","position":{"start":{"line":21,"column":1,"offset":1130},"end":{"line":66,"column":4,"offset":2770},"indent":[1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1]}},{"type":"heading","depth":4,"children":[{"type":"text","value":"Token","position":{"start":{"line":68,"column":6,"offset":2777},"end":{"line":68,"column":11,"offset":2782},"indent":[]}}],"position":{"start":{"line":68,"column":1,"offset":2772},"end":{"line":68,"column":11,"offset":2782},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"First, add your bot token. This is ","position":{"start":{"line":70,"column":1,"offset":2784},"end":{"line":70,"column":36,"offset":2819},"indent":[]}},{"type":"strong","children":[{"type":"text","value":"required","position":{"start":{"line":70,"column":38,"offset":2821},"end":{"line":70,"column":46,"offset":2829},"indent":[]}}],"position":{"start":{"line":70,"column":36,"offset":2819},"end":{"line":70,"column":48,"offset":2831},"indent":[]}},{"type":"text","value":" for the bot to start. Review the ","position":{"start":{"line":70,"column":48,"offset":2831},"end":{"line":70,"column":82,"offset":2865},"indent":[]}},{"type":"link","title":null,"url":"https://discordeno.netlify.app/gettingstarted#creatingyourfirstdiscordbotapplication","children":[{"type":"text","value":"instructions","position":{"start":{"line":70,"column":83,"offset":2866},"end":{"line":70,"column":95,"offset":2878},"indent":[]}}],"position":{"start":{"line":70,"column":82,"offset":2865},"end":{"line":70,"column":182,"offset":2965},"indent":[]}},{"type":"text","value":" if you have not made your token yet.","position":{"start":{"line":70,"column":182,"offset":2965},"end":{"line":70,"column":219,"offset":3002},"indent":[]}}],"position":{"start":{"line":70,"column":1,"offset":2784},"end":{"line":70,"column":219,"offset":3002},"indent":[]}},{"type":"heading","depth":4,"children":[{"type":"text","value":"Prefix","position":{"start":{"line":72,"column":6,"offset":3009},"end":{"line":72,"column":12,"offset":3015},"indent":[]}}],"position":{"start":{"line":72,"column":1,"offset":3004},"end":{"line":72,"column":12,"offset":3015},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"The prefix is where you will set the default prefix for your bot. Don't worry, every server will be able to choose their own prefix but we need a default prefix to start.","position":{"start":{"line":74,"column":1,"offset":3017},"end":{"line":74,"column":171,"offset":3187},"indent":[]}}],"position":{"start":{"line":74,"column":1,"offset":3017},"end":{"line":74,"column":171,"offset":3187},"indent":[]}},{"type":"heading","depth":4,"children":[{"type":"text","value":"Bot Lists Tokens","position":{"start":{"line":76,"column":6,"offset":3194},"end":{"line":76,"column":22,"offset":3210},"indent":[]}}],"position":{"start":{"line":76,"column":1,"offset":3189},"end":{"line":76,"column":22,"offset":3210},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"This section of the file is so you can easily have your bot's statistics updated on all the bot lists out there to help you grow your bot. The code is already written to handle this but you will need to do 3 things for each bot list.","position":{"start":{"line":78,"column":1,"offset":3212},"end":{"line":78,"column":234,"offset":3445},"indent":[]}}],"position":{"start":{"line":78,"column":1,"offset":3212},"end":{"line":78,"column":234,"offset":3445},"indent":[]}},{"type":"list","ordered":true,"start":1,"spread":false,"children":[{"type":"listItem","spread":false,"checked":null,"children":[{"type":"paragraph","children":[{"type":"text","value":"Go to the bot list and add your bot to their website. (Each site has it's own instructions)","position":{"start":{"line":80,"column":4,"offset":3450},"end":{"line":80,"column":95,"offset":3541},"indent":[]}}],"position":{"start":{"line":80,"column":4,"offset":3450},"end":{"line":80,"column":95,"offset":3541},"indent":[]}}],"position":{"start":{"line":80,"column":1,"offset":3447},"end":{"line":80,"column":95,"offset":3541},"indent":[]}},{"type":"listItem","spread":false,"checked":null,"children":[{"type":"paragraph","children":[{"type":"text","value":"Create a token for yourself on each website and paste it in your configs.","position":{"start":{"line":81,"column":4,"offset":3545},"end":{"line":81,"column":77,"offset":3618},"indent":[]}}],"position":{"start":{"line":81,"column":4,"offset":3545},"end":{"line":81,"column":77,"offset":3618},"indent":[]}}],"position":{"start":{"line":81,"column":1,"offset":3542},"end":{"line":81,"column":77,"offset":3618},"indent":[]}},{"type":"listItem","spread":false,"checked":null,"children":[{"type":"paragraph","children":[{"type":"text","value":"Enjoy!","position":{"start":{"line":82,"column":4,"offset":3622},"end":{"line":82,"column":10,"offset":3628},"indent":[]}}],"position":{"start":{"line":82,"column":4,"offset":3622},"end":{"line":82,"column":10,"offset":3628},"indent":[]}}],"position":{"start":{"line":82,"column":1,"offset":3619},"end":{"line":82,"column":10,"offset":3628},"indent":[]}}],"position":{"start":{"line":80,"column":1,"offset":3447},"end":{"line":82,"column":10,"offset":3628},"indent":[1,1]}},{"type":"paragraph","children":[{"type":"text","value":"If you wish to customize the code, you will find the bot list tasks in the tasks folder. Don't worry we will discuss this when we get to the tasks section of the guide.","position":{"start":{"line":84,"column":1,"offset":3630},"end":{"line":84,"column":169,"offset":3798},"indent":[]}}],"position":{"start":{"line":84,"column":1,"offset":3630},"end":{"line":84,"column":169,"offset":3798},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"For now just remember, that Discordeno provides you a built in way to update most discord bot lists.","position":{"start":{"line":86,"column":1,"offset":3800},"end":{"line":86,"column":101,"offset":3900},"indent":[]}}],"position":{"start":{"line":86,"column":1,"offset":3800},"end":{"line":86,"column":101,"offset":3900},"indent":[]}},{"type":"heading","depth":4,"children":[{"type":"text","value":"Channel IDs","position":{"start":{"line":88,"column":6,"offset":3907},"end":{"line":88,"column":17,"offset":3918},"indent":[]}}],"position":{"start":{"line":88,"column":1,"offset":3902},"end":{"line":88,"column":17,"offset":3918},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"The channelIDs section holds the channel IDs that are useful for specific features to help give you alerts/notifications. For example, the ","position":{"start":{"line":90,"column":1,"offset":3920},"end":{"line":90,"column":140,"offset":4059},"indent":[]}},{"type":"inlineCode","value":"missingTranslation","position":{"start":{"line":90,"column":140,"offset":4059},"end":{"line":90,"column":160,"offset":4079},"indent":[]}},{"type":"text","value":" channel will be where messages are sent alerting you that somewhere in your code you are trying to use a translation key that you never created.","position":{"start":{"line":90,"column":160,"offset":4079},"end":{"line":90,"column":305,"offset":4224},"indent":[]}}],"position":{"start":{"line":90,"column":1,"offset":3920},"end":{"line":90,"column":305,"offset":4224},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"When you get to around 25,000 Discord servers on your bot, you may want to convert these channel IDs to webhooks.","position":{"start":{"line":92,"column":1,"offset":4226},"end":{"line":92,"column":114,"offset":4339},"indent":[]}}],"position":{"start":{"line":92,"column":1,"offset":4226},"end":{"line":92,"column":114,"offset":4339},"indent":[]}},{"type":"heading","depth":4,"children":[{"type":"text","value":"Role IDs","position":{"start":{"line":94,"column":6,"offset":4346},"end":{"line":94,"column":14,"offset":4354},"indent":[]}}],"position":{"start":{"line":94,"column":1,"offset":4341},"end":{"line":94,"column":14,"offset":4354},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"The roleIDs section holds the role IDs that are useful for specific features. For example, the ","position":{"start":{"line":96,"column":1,"offset":4356},"end":{"line":96,"column":96,"offset":4451},"indent":[]}},{"type":"inlineCode","value":"patreonVIPRoleID","position":{"start":{"line":96,"column":96,"offset":4451},"end":{"line":96,"column":114,"offset":4469},"indent":[]}},{"type":"text","value":" role can be used easily to enable vip features later in this guide.","position":{"start":{"line":96,"column":114,"offset":4469},"end":{"line":96,"column":182,"offset":4537},"indent":[]}}],"position":{"start":{"line":96,"column":1,"offset":4356},"end":{"line":96,"column":182,"offset":4537},"indent":[]}},{"type":"heading","depth":2,"children":[{"type":"text","value":"It's Alive!","position":{"start":{"line":99,"column":4,"offset":4543},"end":{"line":99,"column":15,"offset":4554},"indent":[]}}],"position":{"start":{"line":99,"column":1,"offset":4540},"end":{"line":99,"column":15,"offset":4554},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"Oh my god! You now have a bot with a bunch of features already! You don't believe me? Well, seeing is believing, so start the bot.","position":{"start":{"line":101,"column":1,"offset":4556},"end":{"line":101,"column":131,"offset":4686},"indent":[]}}],"position":{"start":{"line":101,"column":1,"offset":4556},"end":{"line":101,"column":131,"offset":4686},"indent":[]}},{"type":"list","ordered":true,"start":1,"spread":false,"children":[{"type":"listItem","spread":false,"checked":null,"children":[{"type":"paragraph","children":[{"type":"text","value":"Invite your bot to a discord server.","position":{"start":{"line":103,"column":4,"offset":4691},"end":{"line":103,"column":40,"offset":4727},"indent":[]}}],"position":{"start":{"line":103,"column":4,"offset":4691},"end":{"line":103,"column":40,"offset":4727},"indent":[]}}],"position":{"start":{"line":103,"column":1,"offset":4688},"end":{"line":103,"column":40,"offset":4727},"indent":[]}},{"type":"listItem","spread":false,"checked":null,"children":[{"type":"paragraph","children":[{"type":"text","value":"Open up the integrated terminal in VSC using ","position":{"start":{"line":104,"column":4,"offset":4731},"end":{"line":104,"column":49,"offset":4776},"indent":[]}},{"type":"strong","children":[{"type":"text","value":"CTRL + `","position":{"start":{"line":104,"column":51,"offset":4778},"end":{"line":104,"column":59,"offset":4786},"indent":[]}}],"position":{"start":{"line":104,"column":49,"offset":4776},"end":{"line":104,"column":61,"offset":4788},"indent":[]}},{"type":"text","value":". If you use a Mac, replace CTRL with CMD.","position":{"start":{"line":104,"column":61,"offset":4788},"end":{"line":104,"column":103,"offset":4830},"indent":[]}}],"position":{"start":{"line":104,"column":4,"offset":4731},"end":{"line":104,"column":103,"offset":4830},"indent":[]}}],"position":{"start":{"line":104,"column":1,"offset":4728},"end":{"line":104,"column":103,"offset":4830},"indent":[]}},{"type":"listItem","spread":false,"checked":null,"children":[{"type":"paragraph","children":[{"type":"text","value":"Run the script below:","position":{"start":{"line":105,"column":4,"offset":4834},"end":{"line":105,"column":25,"offset":4855},"indent":[]}}],"position":{"start":{"line":105,"column":4,"offset":4834},"end":{"line":105,"column":25,"offset":4855},"indent":[]}}],"position":{"start":{"line":105,"column":1,"offset":4831},"end":{"line":105,"column":25,"offset":4855},"indent":[]}}],"position":{"start":{"line":103,"column":1,"offset":4688},"end":{"line":105,"column":25,"offset":4855},"indent":[1,1]}},{"type":"code","lang":"shell","meta":null,"value":"deno run --allow-net --allow-read mod.ts","position":{"start":{"line":107,"column":1,"offset":4857},"end":{"line":109,"column":4,"offset":4910},"indent":[1,1]}},{"type":"paragraph","children":[{"type":"text","value":"The first time you run it, you may see a lot of files being loaded. This is preparing all the magic behind the scene. Once it is ready, you will see something like this:","position":{"start":{"line":111,"column":1,"offset":4912},"end":{"line":111,"column":170,"offset":5081},"indent":[]}}],"position":{"start":{"line":111,"column":1,"offset":4912},"end":{"line":111,"column":170,"offset":5081},"indent":[]}},{"type":"paragraph","children":[{"type":"image","title":null,"url":"https://i.imgur.com/TOXjLgh.png","alt":"image","position":{"start":{"line":113,"column":1,"offset":5083},"end":{"line":113,"column":42,"offset":5124},"indent":[]}}],"position":{"start":{"line":113,"column":1,"offset":5083},"end":{"line":113,"column":42,"offset":5124},"indent":[]}},{"type":"heading","depth":2,"children":[{"type":"text","value":"Understanding What Discordeno Did","position":{"start":{"line":115,"column":4,"offset":5129},"end":{"line":115,"column":37,"offset":5162},"indent":[]}}],"position":{"start":{"line":115,"column":1,"offset":5126},"end":{"line":115,"column":37,"offset":5162},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"Discordeno includes these commands/folders as they are essential for any discord bot to have in order to meet the Discord Bot Best Practices. It also adds a few things that will help make some things easier to build a bot.","position":{"start":{"line":117,"column":1,"offset":5164},"end":{"line":117,"column":223,"offset":5386},"indent":[]}}],"position":{"start":{"line":117,"column":1,"offset":5164},"end":{"line":117,"column":223,"offset":5386},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"We will dive into these deeper in this guide. Let's take it step by step.","position":{"start":{"line":119,"column":1,"offset":5388},"end":{"line":119,"column":74,"offset":5461},"indent":[]}}],"position":{"start":{"line":119,"column":1,"offset":5388},"end":{"line":119,"column":74,"offset":5461},"indent":[]}},{"type":"export","value":"export const _frontmatter = {\"title\":\"Creating The Bot!\",\"metaTitle\":\"Creating A Bot | Discordeno\",\"metaDescription\":\"Let's create our very own bot with Discordeno!\"}","position":{"start":{"line":122,"column":1,"offset":5464},"end":{"line":122,"column":167,"offset":5630},"indent":[]}}],"position":{"start":{"line":1,"column":1,"offset":0},"end":{"line":122,"column":167,"offset":5630}}},"scopeImports":["import * as React from 'react'"],"scopeIdentifiers":["React"],"body":"function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }\n\nfunction _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }\n\nfunction _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }\n\n/* @jsx mdx */\nvar _frontmatter = {\n \"title\": \"Creating The Bot!\",\n \"metaTitle\": \"Creating A Bot | Discordeno\",\n \"metaDescription\": \"Let's create our very own bot with Discordeno!\"\n};\nvar layoutProps = {\n _frontmatter: _frontmatter\n};\nvar MDXLayout = \"wrapper\";\nreturn function MDXContent(_ref) {\n var components = _ref.components,\n props = _objectWithoutProperties(_ref, [\"components\"]);\n\n return mdx(MDXLayout, _extends({}, layoutProps, props, {\n components: components,\n mdxType: \"MDXLayout\"\n }), mdx(\"p\", null, \"Discordeno will help make Discord bot development much easier. Don't worry, as you go through this guide it will make a lot more sense.\"), mdx(\"h2\", null, \"Creating The Bot!\"), mdx(\"blockquote\", null, mdx(\"p\", {\n parentName: \"blockquote\"\n }, \"This guide is going to assume you already have the basic requirements to make a bot ready. This includes github, git, a code editor like Visual Studio Code. If you don't have these yet please prepare them first before going forward.\")), mdx(\"ul\", null, mdx(\"li\", {\n parentName: \"ul\"\n }, mdx(\"p\", {\n parentName: \"li\"\n }, \"First, create a Discordeno Bot using the \", mdx(\"a\", _extends({\n parentName: \"p\"\n }, {\n \"href\": \"https://github.com/Skillz4Killz/Discordeno-bot-template\"\n }), \"Generator Boilerplate\"), \". Give it any name you like. For the purpose of this guide we will call it, Stargate.\")), mdx(\"li\", {\n parentName: \"ul\"\n }, mdx(\"p\", {\n parentName: \"li\"\n }, \"Then \", mdx(\"inlineCode\", {\n parentName: \"p\"\n }, \"git clone https://github.com/Skillz4Killz/Stargate.git\"))), mdx(\"li\", {\n parentName: \"ul\"\n }, mdx(\"p\", {\n parentName: \"li\"\n }, \"When that is done, go ahead and open up the folder with VSC.\")), mdx(\"li\", {\n parentName: \"ul\"\n }, mdx(\"p\", {\n parentName: \"li\"\n }, \"Create a new file called \", mdx(\"inlineCode\", {\n parentName: \"p\"\n }, \"configs.ts\"), \". Open the \", mdx(\"inlineCode\", {\n parentName: \"p\"\n }, \"configs.example.ts\"), \" file and copy everything over.\"))), mdx(\"p\", null, \"Let's take a minute to review all the options we have available to us.\"), mdx(\"h3\", null, \"Configs File\"), mdx(\"p\", null, \"The \", mdx(\"inlineCode\", {\n parentName: \"p\"\n }, \"configs.ts\"), \" file is where you will keep all your secret info you don't want to share with anyone else. As long as \", mdx(\"inlineCode\", {\n parentName: \"p\"\n }, \".gitignore\"), \" file is ignoring configs.ts your configurations will be kept private!\"), mdx(\"pre\", null, mdx(\"code\", _extends({\n parentName: \"pre\"\n }, {\n \"className\": \"language-ts\"\n }), \"// Step 1: Remove the `.example` from this file name so it is called `configs.ts`\\n// Step 2: Add all your bot's information below. The only required one is token and prefix. NOTE: As long as `.gitignore` file is ignoring configs.ts your configurations will be kept private!\\n// Step 3: Remove these comments if you like.\\n\\nexport const configs = {\\n // Your bot token goes here\\n token: \\\"\\\",\\n // The default prefix for your bot. Don't worry guilds can change this later.\\n prefix: \\\"!\\\",\\n // This isn't required but you can add bot list api keys here.\\n botListTokens: {\\n DISCORD_BOT_ORG: \\\"\\\",\\n BOTS_ON_DISCORD: \\\"\\\",\\n DISCORD_BOT_LIST: \\\"\\\",\\n BOTS_FOR_DISCORD: \\\"\\\",\\n DISCORD_BOATS: \\\"\\\",\\n DISCORD_BOTS_GG: \\\"\\\",\\n DISCORD_BOTS_GROUP: \\\"\\\",\\n },\\n // This is the server id for your bot's main server where users can get help/support\\n supportServerID: \\\"\\\",\\n // These are channel ids that will enable some functionality\\n channelIDs: {\\n // When a translation is missing this is the channel you will be alerted in.\\n missingTranslation: \\\"\\\",\\n // When an error occurs, we will try and log it to this channel\\n errorChannelID: \\\"\\\"\\n },\\n // These are the role ids that will enable some functionality.\\n roleIDs: {\\n // If you have a patreon set up you can add the patreon vip role id here.\\n patreonVIPRoleID: \\\"\\\",\\n },\\n // These are the user ids that will enable some functionality.\\n userIDs: {\\n // The user ids for the support team\\n botSupporters: [],\\n // The user ids for the other devs on your team\\n botDevs: [],\\n // The user ids who have complete 100% access to your bot\\n botOwners: []\\n }\\n};\\n\\n\")), mdx(\"h4\", null, \"Token\"), mdx(\"p\", null, \"First, add your bot token. This is \", mdx(\"strong\", {\n parentName: \"p\"\n }, \"required\"), \" for the bot to start. Review the \", mdx(\"a\", _extends({\n parentName: \"p\"\n }, {\n \"href\": \"https://discordeno.netlify.app/gettingstarted#creatingyourfirstdiscordbotapplication\"\n }), \"instructions\"), \" if you have not made your token yet.\"), mdx(\"h4\", null, \"Prefix\"), mdx(\"p\", null, \"The prefix is where you will set the default prefix for your bot. Don't worry, every server will be able to choose their own prefix but we need a default prefix to start.\"), mdx(\"h4\", null, \"Bot Lists Tokens\"), mdx(\"p\", null, \"This section of the file is so you can easily have your bot's statistics updated on all the bot lists out there to help you grow your bot. The code is already written to handle this but you will need to do 3 things for each bot list.\"), mdx(\"ol\", null, mdx(\"li\", {\n parentName: \"ol\"\n }, \"Go to the bot list and add your bot to their website. (Each site has it's own instructions)\"), mdx(\"li\", {\n parentName: \"ol\"\n }, \"Create a token for yourself on each website and paste it in your configs.\"), mdx(\"li\", {\n parentName: \"ol\"\n }, \"Enjoy!\")), mdx(\"p\", null, \"If you wish to customize the code, you will find the bot list tasks in the tasks folder. Don't worry we will discuss this when we get to the tasks section of the guide.\"), mdx(\"p\", null, \"For now just remember, that Discordeno provides you a built in way to update most discord bot lists.\"), mdx(\"h4\", null, \"Channel IDs\"), mdx(\"p\", null, \"The channelIDs section holds the channel IDs that are useful for specific features to help give you alerts/notifications. For example, the \", mdx(\"inlineCode\", {\n parentName: \"p\"\n }, \"missingTranslation\"), \" channel will be where messages are sent alerting you that somewhere in your code you are trying to use a translation key that you never created.\"), mdx(\"p\", null, \"When you get to around 25,000 Discord servers on your bot, you may want to convert these channel IDs to webhooks.\"), mdx(\"h4\", null, \"Role IDs\"), mdx(\"p\", null, \"The roleIDs section holds the role IDs that are useful for specific features. For example, the \", mdx(\"inlineCode\", {\n parentName: \"p\"\n }, \"patreonVIPRoleID\"), \" role can be used easily to enable vip features later in this guide.\"), mdx(\"h2\", null, \"It's Alive!\"), mdx(\"p\", null, \"Oh my god! You now have a bot with a bunch of features already! You don't believe me? Well, seeing is believing, so start the bot.\"), mdx(\"ol\", null, mdx(\"li\", {\n parentName: \"ol\"\n }, \"Invite your bot to a discord server.\"), mdx(\"li\", {\n parentName: \"ol\"\n }, \"Open up the integrated terminal in VSC using \", mdx(\"strong\", {\n parentName: \"li\"\n }, \"CTRL + `\"), \". If you use a Mac, replace CTRL with CMD.\"), mdx(\"li\", {\n parentName: \"ol\"\n }, \"Run the script below:\")), mdx(\"pre\", null, mdx(\"code\", _extends({\n parentName: \"pre\"\n }, {\n \"className\": \"language-shell\"\n }), \"deno run --allow-net --allow-read mod.ts\\n\")), mdx(\"p\", null, \"The first time you run it, you may see a lot of files being loaded. This is preparing all the magic behind the scene. Once it is ready, you will see something like this:\"), mdx(\"p\", null, mdx(\"img\", _extends({\n parentName: \"p\"\n }, {\n \"src\": \"https://i.imgur.com/TOXjLgh.png\",\n \"alt\": \"image\"\n }))), mdx(\"h2\", null, \"Understanding What Discordeno Did\"), mdx(\"p\", null, \"Discordeno includes these commands/folders as they are essential for any discord bot to have in order to meet the Discord Bot Best Practices. It also adds a few things that will help make some things easier to build a bot.\"), mdx(\"p\", null, \"We will dive into these deeper in this guide. Let's take it step by step.\"));\n}\n;\nMDXContent.isMDXComponent = true;","rawMDXOutput":"/* @jsx mdx */\nimport { mdx } from '@mdx-js/react';\n/* @jsx mdx */\n\nexport const _frontmatter = {\n \"title\": \"Creating The Bot!\",\n \"metaTitle\": \"Creating A Bot | Discordeno\",\n \"metaDescription\": \"Let's create our very own bot with Discordeno!\"\n};\n\nconst layoutProps = {\n _frontmatter\n};\nconst MDXLayout = \"wrapper\"\nexport default function MDXContent({\n components,\n ...props\n}) {\n return \n

{`Discordeno will help make Discord bot development much easier. Don't worry, as you go through this guide it will make a lot more sense.`}

\n

{`Creating The Bot!`}

\n
\n

{`This guide is going to assume you already have the basic requirements to make a bot ready. This includes github, git, a code editor like Visual Studio Code. If you don't have these yet please prepare them first before going forward.`}

\n
\n
    \n
  • \n

    {`First, create a Discordeno Bot using the `}{`Generator Boilerplate`}{`. Give it any name you like. For the purpose of this guide we will call it, Stargate.`}

    \n
  • \n
  • \n

    {`Then `}{`git clone https://github.com/Skillz4Killz/Stargate.git`}

    \n
  • \n
  • \n

    {`When that is done, go ahead and open up the folder with VSC.`}

    \n
  • \n
  • \n

    {`Create a new file called `}{`configs.ts`}{`. Open the `}{`configs.example.ts`}{` file and copy everything over.`}

    \n
  • \n
\n

{`Let's take a minute to review all the options we have available to us.`}

\n

{`Configs File`}

\n

{`The `}{`configs.ts`}{` file is where you will keep all your secret info you don't want to share with anyone else. As long as `}{`.gitignore`}{` file is ignoring configs.ts your configurations will be kept private!`}

\n
{`// Step 1: Remove the \\`.example\\` from this file name so it is called \\`configs.ts\\`\n// Step 2: Add all your bot's information below. The only required one is token and prefix. NOTE: As long as \\`.gitignore\\` file is ignoring configs.ts your configurations will be kept private!\n// Step 3: Remove these comments if you like.\n\nexport const configs = {\n  // Your bot token goes here\n  token: \"\",\n  // The default prefix for your bot. Don't worry guilds can change this later.\n  prefix: \"!\",\n  // This isn't required but you can add bot list api keys here.\n  botListTokens: {\n    DISCORD_BOT_ORG: \"\",\n    BOTS_ON_DISCORD: \"\",\n    DISCORD_BOT_LIST: \"\",\n    BOTS_FOR_DISCORD: \"\",\n    DISCORD_BOATS: \"\",\n    DISCORD_BOTS_GG: \"\",\n    DISCORD_BOTS_GROUP: \"\",\n  },\n  // This is the server id for your bot's main server where users can get help/support\n  supportServerID: \"\",\n  // These are channel ids that will enable some functionality\n  channelIDs: {\n    // When a translation is missing this is the channel you will be alerted in.\n    missingTranslation: \"\",\n    // When an error occurs, we will try and log it to this channel\n    errorChannelID: \"\"\n  },\n  // These are the role ids that will enable some functionality.\n  roleIDs: {\n    // If you have a patreon set up you can add the patreon vip role id here.\n    patreonVIPRoleID: \"\",\n  },\n  // These are the user ids that will enable some functionality.\n  userIDs: {\n    // The user ids for the support team\n    botSupporters: [],\n    // The user ids for the other devs on your team\n    botDevs: [],\n    // The user ids who have complete 100% access to your bot\n    botOwners: []\n  }\n};\n\n`}
\n

{`Token`}

\n

{`First, add your bot token. This is `}{`required`}{` for the bot to start. Review the `}{`instructions`}{` if you have not made your token yet.`}

\n

{`Prefix`}

\n

{`The prefix is where you will set the default prefix for your bot. Don't worry, every server will be able to choose their own prefix but we need a default prefix to start.`}

\n

{`Bot Lists Tokens`}

\n

{`This section of the file is so you can easily have your bot's statistics updated on all the bot lists out there to help you grow your bot. The code is already written to handle this but you will need to do 3 things for each bot list.`}

\n
    \n
  1. {`Go to the bot list and add your bot to their website. (Each site has it's own instructions)`}
  2. \n
  3. {`Create a token for yourself on each website and paste it in your configs.`}
  4. \n
  5. {`Enjoy!`}
  6. \n
\n

{`If you wish to customize the code, you will find the bot list tasks in the tasks folder. Don't worry we will discuss this when we get to the tasks section of the guide.`}

\n

{`For now just remember, that Discordeno provides you a built in way to update most discord bot lists.`}

\n

{`Channel IDs`}

\n

{`The channelIDs section holds the channel IDs that are useful for specific features to help give you alerts/notifications. For example, the `}{`missingTranslation`}{` channel will be where messages are sent alerting you that somewhere in your code you are trying to use a translation key that you never created.`}

\n

{`When you get to around 25,000 Discord servers on your bot, you may want to convert these channel IDs to webhooks.`}

\n

{`Role IDs`}

\n

{`The roleIDs section holds the role IDs that are useful for specific features. For example, the `}{`patreonVIPRoleID`}{` role can be used easily to enable vip features later in this guide.`}

\n

{`It's Alive!`}

\n

{`Oh my god! You now have a bot with a bunch of features already! You don't believe me? Well, seeing is believing, so start the bot.`}

\n
    \n
  1. {`Invite your bot to a discord server.`}
  2. \n
  3. {`Open up the integrated terminal in VSC using `}{`CTRL + \\``}{`. If you use a Mac, replace CTRL with CMD.`}
  4. \n
  5. {`Run the script below:`}
  6. \n
\n
{`deno run --allow-net --allow-read mod.ts\n`}
\n

{`The first time you run it, you may see a lot of files being loaded. This is preparing all the magic behind the scene. Once it is ready, you will see something like this:`}

\n

\n

{`Understanding What Discordeno Did`}

\n

{`Discordeno includes these commands/folders as they are essential for any discord bot to have in order to meet the Discord Bot Best Practices. It also adds a few things that will help make some things easier to build a bot.`}

\n

{`We will dive into these deeper in this guide. Let's take it step by step.`}

\n\n
;\n}\n\n;\nMDXContent.isMDXComponent = true;"}} \ No newline at end of file diff --git a/docs/.cache/caches/gatsby-plugin-mdx/diskstore-3b07aab8aef58a7b80390ef7ed5a58b4.json b/docs/.cache/caches/gatsby-plugin-mdx/diskstore-3b07aab8aef58a7b80390ef7ed5a58b4.json new file mode 100644 index 000000000..8823e5e61 --- /dev/null +++ b/docs/.cache/caches/gatsby-plugin-mdx/diskstore-3b07aab8aef58a7b80390ef7ed5a58b4.json @@ -0,0 +1 @@ +{"expireTime":9007200851634806000,"key":"gatsby-plugin-mdx-entire-payload-6d5f9809f74e51980efff2b4ac8852e7-","val":{"mdast":{"type":"root","children":[{"type":"paragraph","children":[{"type":"text","value":"Woah! You are almost half way done with understanding all of Discordeno. Amazing isn't it? Something you may have noticed in the last section was there were some options that prevented some commands from running like ","position":{"start":{"line":2,"column":1,"offset":1},"end":{"line":2,"column":218,"offset":218},"indent":[]}},{"type":"inlineCode","value":"dmOnly","position":{"start":{"line":2,"column":218,"offset":218},"end":{"line":2,"column":226,"offset":226},"indent":[]}},{"type":"text","value":" or the permission options. we created a setting to prevent the monitor from running in certain channels. What if we wanted to do prevent commands from happening? How would we prevent commands from running?","position":{"start":{"line":2,"column":226,"offset":226},"end":{"line":2,"column":432,"offset":432},"indent":[]}}],"position":{"start":{"line":2,"column":1,"offset":1},"end":{"line":2,"column":432,"offset":432},"indent":[]}},{"type":"heading","depth":2,"children":[{"type":"text","value":"What is an Inhibitor?","position":{"start":{"line":4,"column":4,"offset":437},"end":{"line":4,"column":25,"offset":458},"indent":[]}}],"position":{"start":{"line":4,"column":1,"offset":434},"end":{"line":4,"column":25,"offset":458},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"An Inhibitor is very similar to how monitors work. A monitor runs on every message but an inhibitor runs on every command. Remember all those command options like cooldown, permissions, permissionLevel, nsfw, etc... Each and every one of these options has an inhibitor in that checks commands for these settings.","position":{"start":{"line":6,"column":1,"offset":460},"end":{"line":6,"column":313,"offset":772},"indent":[]}}],"position":{"start":{"line":6,"column":1,"offset":460},"end":{"line":6,"column":313,"offset":772},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"Let's create our own inhibitor that would prevent commands from being used if the user is not a VIP user.","position":{"start":{"line":8,"column":1,"offset":774},"end":{"line":8,"column":106,"offset":879},"indent":[]}}],"position":{"start":{"line":8,"column":1,"offset":774},"end":{"line":8,"column":106,"offset":879},"indent":[]}},{"type":"blockquote","children":[{"type":"paragraph","children":[{"type":"strong","children":[{"type":"text","value":"Note:","position":{"start":{"line":10,"column":5,"offset":885},"end":{"line":10,"column":10,"offset":890},"indent":[]}}],"position":{"start":{"line":10,"column":3,"offset":883},"end":{"line":10,"column":12,"offset":892},"indent":[]}},{"type":"text","value":" It is important to remember that everything below can be done with a simple permission level as well. We will create our own custom permission levels but for the purposes of this guide and to be able to learn about Inhibitors, we will be using an inhibitor.","position":{"start":{"line":10,"column":12,"offset":892},"end":{"line":10,"column":270,"offset":1150},"indent":[]}}],"position":{"start":{"line":10,"column":3,"offset":883},"end":{"line":10,"column":270,"offset":1150},"indent":[]}}],"position":{"start":{"line":10,"column":1,"offset":881},"end":{"line":10,"column":270,"offset":1150},"indent":[]}},{"type":"heading","depth":2,"children":[{"type":"text","value":"Creating the File","position":{"start":{"line":12,"column":4,"offset":1155},"end":{"line":12,"column":21,"offset":1172},"indent":[]}}],"position":{"start":{"line":12,"column":1,"offset":1152},"end":{"line":12,"column":21,"offset":1172},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"Let's start by creating a file inside the inhibitors folder called ","position":{"start":{"line":14,"column":1,"offset":1174},"end":{"line":14,"column":68,"offset":1241},"indent":[]}},{"type":"inlineCode","value":"boosted.ts","position":{"start":{"line":14,"column":68,"offset":1241},"end":{"line":14,"column":80,"offset":1253},"indent":[]}},{"type":"text","value":" and paste the following snippet of code:","position":{"start":{"line":14,"column":80,"offset":1253},"end":{"line":14,"column":121,"offset":1294},"indent":[]}}],"position":{"start":{"line":14,"column":1,"offset":1174},"end":{"line":14,"column":121,"offset":1294},"indent":[]}},{"type":"code","lang":"ts","meta":null,"value":"import { botCache } from \"../../mod.ts\";\n\nbotCache.inhibitors.set(\"inhibitorname\", async function (message, command, guild) {\n\t// Your code goes here\n});","position":{"start":{"line":16,"column":1,"offset":1296},"end":{"line":22,"column":4,"offset":1459},"indent":[1,1,1,1,1,1]}},{"type":"paragraph","children":[{"type":"text","value":"Inhibitors can take up to 3 arguments.","position":{"start":{"line":24,"column":1,"offset":1461},"end":{"line":24,"column":39,"offset":1499},"indent":[]}}],"position":{"start":{"line":24,"column":1,"offset":1461},"end":{"line":24,"column":39,"offset":1499},"indent":[]}},{"type":"list","ordered":false,"start":null,"spread":false,"children":[{"type":"listItem","spread":false,"checked":null,"children":[{"type":"paragraph","children":[{"type":"inlineCode","value":"message","position":{"start":{"line":26,"column":3,"offset":1503},"end":{"line":26,"column":12,"offset":1512},"indent":[]}},{"type":"text","value":": The message object that triggered the command.","position":{"start":{"line":26,"column":12,"offset":1512},"end":{"line":26,"column":60,"offset":1560},"indent":[]}}],"position":{"start":{"line":26,"column":3,"offset":1503},"end":{"line":26,"column":60,"offset":1560},"indent":[]}}],"position":{"start":{"line":26,"column":1,"offset":1501},"end":{"line":26,"column":60,"offset":1560},"indent":[]}},{"type":"listItem","spread":false,"checked":null,"children":[{"type":"paragraph","children":[{"type":"inlineCode","value":"command","position":{"start":{"line":27,"column":3,"offset":1563},"end":{"line":27,"column":12,"offset":1572},"indent":[]}},{"type":"text","value":": The command object itself that was triggered.","position":{"start":{"line":27,"column":12,"offset":1572},"end":{"line":27,"column":59,"offset":1619},"indent":[]}}],"position":{"start":{"line":27,"column":3,"offset":1563},"end":{"line":27,"column":59,"offset":1619},"indent":[]}}],"position":{"start":{"line":27,"column":1,"offset":1561},"end":{"line":27,"column":59,"offset":1619},"indent":[]}},{"type":"listItem","spread":false,"checked":null,"children":[{"type":"paragraph","children":[{"type":"inlineCode","value":"guild","position":{"start":{"line":28,"column":3,"offset":1622},"end":{"line":28,"column":10,"offset":1629},"indent":[]}},{"type":"text","value":": The server guild object where this command was ran.","position":{"start":{"line":28,"column":10,"offset":1629},"end":{"line":28,"column":63,"offset":1682},"indent":[]}}],"position":{"start":{"line":28,"column":3,"offset":1622},"end":{"line":28,"column":63,"offset":1682},"indent":[]}}],"position":{"start":{"line":28,"column":1,"offset":1620},"end":{"line":28,"column":63,"offset":1682},"indent":[]}}],"position":{"start":{"line":26,"column":1,"offset":1501},"end":{"line":28,"column":63,"offset":1682},"indent":[1,1]}},{"type":"heading","depth":2,"children":[{"type":"text","value":"Understanding How Inhibitors Function","position":{"start":{"line":30,"column":4,"offset":1687},"end":{"line":30,"column":41,"offset":1724},"indent":[]}}],"position":{"start":{"line":30,"column":1,"offset":1684},"end":{"line":30,"column":41,"offset":1724},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"To block a command you have to return a truthy value.","position":{"start":{"line":32,"column":1,"offset":1726},"end":{"line":32,"column":54,"offset":1779},"indent":[]}}],"position":{"start":{"line":32,"column":1,"offset":1726},"end":{"line":32,"column":54,"offset":1779},"indent":[]}},{"type":"list","ordered":false,"start":null,"spread":false,"children":[{"type":"listItem","spread":false,"checked":null,"children":[{"type":"paragraph","children":[{"type":"strong","children":[{"type":"text","value":"return true;","position":{"start":{"line":33,"column":5,"offset":1784},"end":{"line":33,"column":17,"offset":1796},"indent":[]}}],"position":{"start":{"line":33,"column":3,"offset":1782},"end":{"line":33,"column":19,"offset":1798},"indent":[]}},{"type":"text","value":" If you return true the inhibitor will block the execution of the command.\nTo allow a command return a falsey value.","position":{"start":{"line":33,"column":19,"offset":1798},"end":{"line":34,"column":42,"offset":1914},"indent":[1]}}],"position":{"start":{"line":33,"column":3,"offset":1782},"end":{"line":34,"column":42,"offset":1914},"indent":[1]}}],"position":{"start":{"line":33,"column":1,"offset":1780},"end":{"line":34,"column":42,"offset":1914},"indent":[1]}},{"type":"listItem","spread":false,"checked":null,"children":[{"type":"paragraph","children":[{"type":"strong","children":[{"type":"text","value":"return false;","position":{"start":{"line":35,"column":5,"offset":1919},"end":{"line":35,"column":18,"offset":1932},"indent":[]}}],"position":{"start":{"line":35,"column":3,"offset":1917},"end":{"line":35,"column":20,"offset":1934},"indent":[]}},{"type":"text","value":" If you return false the inhibitor will not block the error.","position":{"start":{"line":35,"column":20,"offset":1934},"end":{"line":35,"column":80,"offset":1994},"indent":[]}}],"position":{"start":{"line":35,"column":3,"offset":1917},"end":{"line":35,"column":80,"offset":1994},"indent":[]}}],"position":{"start":{"line":35,"column":1,"offset":1915},"end":{"line":35,"column":80,"offset":1994},"indent":[]}}],"position":{"start":{"line":33,"column":1,"offset":1780},"end":{"line":35,"column":80,"offset":1994},"indent":[1,1]}},{"type":"code","lang":"ts","meta":null,"value":"// If the command is not VIP only we can allow this command to execute\nif (!command.vipOnly) return false;\n\n// The bot's support server\nconst guild = cache.guilds.get(configs.supportServerID);\n// If the command author is not in the server they won't have the vip role\nconst member = guild.members.get(message.author.id) || await getMember(guild.id, message.author.id);\n// Member doesn't exist so cancel the command\nif (!member) {\n\tsendResponse(message, `sorry, but you can not use this command until you become VIP. **Close the IRIS!!!**`)\n\treturn true;\n}\n\n// If the user has the vip role on the support server given by patreon allow the command\nif (member.roles.includes(configs.roleIDs.patreonVIPRoleID)) return false;\n\n// Alert the user they don't have vip and can't use the command\nsendResponse(message, `sorry, but you can not use this command until you become a VIP. I'm sorry, Teal'c. We'll go to Disneyland next year. I promise.`)\n// Cancel the command since the user does not have vip\nreturn true;","position":{"start":{"line":38,"column":1,"offset":1997},"end":{"line":59,"column":4,"offset":3013},"indent":[1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1]}},{"type":"heading","depth":2,"children":[{"type":"text","value":"Challenges","position":{"start":{"line":61,"column":4,"offset":3018},"end":{"line":61,"column":14,"offset":3028},"indent":[]}}],"position":{"start":{"line":61,"column":1,"offset":3015},"end":{"line":61,"column":14,"offset":3028},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"Hell yes! We just got through the entire inhibitor section. You have now mastered everything related to inhibitors.","position":{"start":{"line":63,"column":1,"offset":3030},"end":{"line":63,"column":116,"offset":3145},"indent":[]}}],"position":{"start":{"line":63,"column":1,"offset":3030},"end":{"line":63,"column":116,"offset":3145},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"You can now try and get a little more practice with inhibitors by trying to challenge yourself and make your own inhibitors. Don't worry if you can't think of any good use cases for inhibitors.","position":{"start":{"line":65,"column":1,"offset":3147},"end":{"line":65,"column":194,"offset":3340},"indent":[]}}],"position":{"start":{"line":65,"column":1,"offset":3147},"end":{"line":65,"column":194,"offset":3340},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"Majority of Discordeno bots do not use many custom inhibitors","position":{"start":{"line":67,"column":1,"offset":3342},"end":{"line":67,"column":62,"offset":3403},"indent":[]}}],"position":{"start":{"line":67,"column":1,"offset":3342},"end":{"line":67,"column":62,"offset":3403},"indent":[]}},{"type":"export","value":"export const _frontmatter = {\"title\":\"Creating Inhibitors!\",\"metaTitle\":\"Creating An Inhibitor | Discordeno\",\"metaDescription\":\"Let's create our very own bot with Discordeno!\"}","position":{"start":{"line":70,"column":1,"offset":3406},"end":{"line":70,"column":177,"offset":3582},"indent":[]}}],"position":{"start":{"line":1,"column":1,"offset":0},"end":{"line":70,"column":177,"offset":3582}}},"scopeImports":["import * as React from 'react'"],"scopeIdentifiers":["React"],"body":"function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }\n\nfunction _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }\n\nfunction _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }\n\n/* @jsx mdx */\nvar _frontmatter = {\n \"title\": \"Creating Inhibitors!\",\n \"metaTitle\": \"Creating An Inhibitor | Discordeno\",\n \"metaDescription\": \"Let's create our very own bot with Discordeno!\"\n};\nvar layoutProps = {\n _frontmatter: _frontmatter\n};\nvar MDXLayout = \"wrapper\";\nreturn function MDXContent(_ref) {\n var components = _ref.components,\n props = _objectWithoutProperties(_ref, [\"components\"]);\n\n return mdx(MDXLayout, _extends({}, layoutProps, props, {\n components: components,\n mdxType: \"MDXLayout\"\n }), mdx(\"p\", null, \"Woah! You are almost half way done with understanding all of Discordeno. Amazing isn't it? Something you may have noticed in the last section was there were some options that prevented some commands from running like \", mdx(\"inlineCode\", {\n parentName: \"p\"\n }, \"dmOnly\"), \" or the permission options. we created a setting to prevent the monitor from running in certain channels. What if we wanted to do prevent commands from happening? How would we prevent commands from running?\"), mdx(\"h2\", null, \"What is an Inhibitor?\"), mdx(\"p\", null, \"An Inhibitor is very similar to how monitors work. A monitor runs on every message but an inhibitor runs on every command. Remember all those command options like cooldown, permissions, permissionLevel, nsfw, etc... Each and every one of these options has an inhibitor in that checks commands for these settings.\"), mdx(\"p\", null, \"Let's create our own inhibitor that would prevent commands from being used if the user is not a VIP user.\"), mdx(\"blockquote\", null, mdx(\"p\", {\n parentName: \"blockquote\"\n }, mdx(\"strong\", {\n parentName: \"p\"\n }, \"Note:\"), \" It is important to remember that everything below can be done with a simple permission level as well. We will create our own custom permission levels but for the purposes of this guide and to be able to learn about Inhibitors, we will be using an inhibitor.\")), mdx(\"h2\", null, \"Creating the File\"), mdx(\"p\", null, \"Let's start by creating a file inside the inhibitors folder called \", mdx(\"inlineCode\", {\n parentName: \"p\"\n }, \"boosted.ts\"), \" and paste the following snippet of code:\"), mdx(\"pre\", null, mdx(\"code\", _extends({\n parentName: \"pre\"\n }, {\n \"className\": \"language-ts\"\n }), \"import { botCache } from \\\"../../mod.ts\\\";\\n\\nbotCache.inhibitors.set(\\\"inhibitorname\\\", async function (message, command, guild) {\\n // Your code goes here\\n});\\n\")), mdx(\"p\", null, \"Inhibitors can take up to 3 arguments.\"), mdx(\"ul\", null, mdx(\"li\", {\n parentName: \"ul\"\n }, mdx(\"inlineCode\", {\n parentName: \"li\"\n }, \"message\"), \": The message object that triggered the command.\"), mdx(\"li\", {\n parentName: \"ul\"\n }, mdx(\"inlineCode\", {\n parentName: \"li\"\n }, \"command\"), \": The command object itself that was triggered.\"), mdx(\"li\", {\n parentName: \"ul\"\n }, mdx(\"inlineCode\", {\n parentName: \"li\"\n }, \"guild\"), \": The server guild object where this command was ran.\")), mdx(\"h2\", null, \"Understanding How Inhibitors Function\"), mdx(\"p\", null, \"To block a command you have to return a truthy value.\"), mdx(\"ul\", null, mdx(\"li\", {\n parentName: \"ul\"\n }, mdx(\"strong\", {\n parentName: \"li\"\n }, \"return true;\"), \" If you return true the inhibitor will block the execution of the command.\\nTo allow a command return a falsey value.\"), mdx(\"li\", {\n parentName: \"ul\"\n }, mdx(\"strong\", {\n parentName: \"li\"\n }, \"return false;\"), \" If you return false the inhibitor will not block the error.\")), mdx(\"pre\", null, mdx(\"code\", _extends({\n parentName: \"pre\"\n }, {\n \"className\": \"language-ts\"\n }), \"// If the command is not VIP only we can allow this command to execute\\nif (!command.vipOnly) return false;\\n\\n// The bot's support server\\nconst guild = cache.guilds.get(configs.supportServerID);\\n// If the command author is not in the server they won't have the vip role\\nconst member = guild.members.get(message.author.id) || await getMember(guild.id, message.author.id);\\n// Member doesn't exist so cancel the command\\nif (!member) {\\n sendResponse(message, `sorry, but you can not use this command until you become VIP. **Close the IRIS!!!**`)\\n return true;\\n}\\n\\n// If the user has the vip role on the support server given by patreon allow the command\\nif (member.roles.includes(configs.roleIDs.patreonVIPRoleID)) return false;\\n\\n// Alert the user they don't have vip and can't use the command\\nsendResponse(message, `sorry, but you can not use this command until you become a VIP. I'm sorry, Teal'c. We'll go to Disneyland next year. I promise.`)\\n// Cancel the command since the user does not have vip\\nreturn true;\\n\")), mdx(\"h2\", null, \"Challenges\"), mdx(\"p\", null, \"Hell yes! We just got through the entire inhibitor section. You have now mastered everything related to inhibitors.\"), mdx(\"p\", null, \"You can now try and get a little more practice with inhibitors by trying to challenge yourself and make your own inhibitors. Don't worry if you can't think of any good use cases for inhibitors.\"), mdx(\"p\", null, \"Majority of Discordeno bots do not use many custom inhibitors\"));\n}\n;\nMDXContent.isMDXComponent = true;","rawMDXOutput":"/* @jsx mdx */\nimport { mdx } from '@mdx-js/react';\n/* @jsx mdx */\n\nexport const _frontmatter = {\n \"title\": \"Creating Inhibitors!\",\n \"metaTitle\": \"Creating An Inhibitor | Discordeno\",\n \"metaDescription\": \"Let's create our very own bot with Discordeno!\"\n};\n\nconst layoutProps = {\n _frontmatter\n};\nconst MDXLayout = \"wrapper\"\nexport default function MDXContent({\n components,\n ...props\n}) {\n return \n

{`Woah! You are almost half way done with understanding all of Discordeno. Amazing isn't it? Something you may have noticed in the last section was there were some options that prevented some commands from running like `}{`dmOnly`}{` or the permission options. we created a setting to prevent the monitor from running in certain channels. What if we wanted to do prevent commands from happening? How would we prevent commands from running?`}

\n

{`What is an Inhibitor?`}

\n

{`An Inhibitor is very similar to how monitors work. A monitor runs on every message but an inhibitor runs on every command. Remember all those command options like cooldown, permissions, permissionLevel, nsfw, etc... Each and every one of these options has an inhibitor in that checks commands for these settings.`}

\n

{`Let's create our own inhibitor that would prevent commands from being used if the user is not a VIP user.`}

\n
\n

{`Note:`}{` It is important to remember that everything below can be done with a simple permission level as well. We will create our own custom permission levels but for the purposes of this guide and to be able to learn about Inhibitors, we will be using an inhibitor.`}

\n
\n

{`Creating the File`}

\n

{`Let's start by creating a file inside the inhibitors folder called `}{`boosted.ts`}{` and paste the following snippet of code:`}

\n
{`import { botCache } from \"../../mod.ts\";\n\nbotCache.inhibitors.set(\"inhibitorname\", async function (message, command, guild) {\n    // Your code goes here\n});\n`}
\n

{`Inhibitors can take up to 3 arguments.`}

\n
    \n
  • {`message`}{`: The message object that triggered the command.`}
  • \n
  • {`command`}{`: The command object itself that was triggered.`}
  • \n
  • {`guild`}{`: The server guild object where this command was ran.`}
  • \n
\n

{`Understanding How Inhibitors Function`}

\n

{`To block a command you have to return a truthy value.`}

\n
    \n
  • {`return true;`}{` If you return true the inhibitor will block the execution of the command.\nTo allow a command return a falsey value.`}
  • \n
  • {`return false;`}{` If you return false the inhibitor will not block the error.`}
  • \n
\n
{`// If the command is not VIP only we can allow this command to execute\nif (!command.vipOnly) return false;\n\n// The bot's support server\nconst guild = cache.guilds.get(configs.supportServerID);\n// If the command author is not in the server they won't have the vip role\nconst member = guild.members.get(message.author.id) || await getMember(guild.id, message.author.id);\n// Member doesn't exist so cancel the command\nif (!member) {\n    sendResponse(message, \\`sorry, but you can not use this command until you become VIP. **Close the IRIS!!!**\\`)\n    return true;\n}\n\n// If the user has the vip role on the support server given by patreon allow the command\nif (member.roles.includes(configs.roleIDs.patreonVIPRoleID)) return false;\n\n// Alert the user they don't have vip and can't use the command\nsendResponse(message, \\`sorry, but you can not use this command until you become a VIP. I'm sorry, Teal'c. We'll go to Disneyland next year. I promise.\\`)\n// Cancel the command since the user does not have vip\nreturn true;\n`}
\n

{`Challenges`}

\n

{`Hell yes! We just got through the entire inhibitor section. You have now mastered everything related to inhibitors.`}

\n

{`You can now try and get a little more practice with inhibitors by trying to challenge yourself and make your own inhibitors. Don't worry if you can't think of any good use cases for inhibitors.`}

\n

{`Majority of Discordeno bots do not use many custom inhibitors`}

\n\n
;\n}\n\n;\nMDXContent.isMDXComponent = true;"}} \ No newline at end of file diff --git a/docs/.cache/caches/gatsby-plugin-mdx/diskstore-3de550f11eaca5577c6e46a61102df9e.json b/docs/.cache/caches/gatsby-plugin-mdx/diskstore-3de550f11eaca5577c6e46a61102df9e.json new file mode 100644 index 000000000..e547327c1 --- /dev/null +++ b/docs/.cache/caches/gatsby-plugin-mdx/diskstore-3de550f11eaca5577c6e46a61102df9e.json @@ -0,0 +1 @@ +{"expireTime":9007200851596121000,"key":"gatsby-plugin-mdx-entire-payload-e3ef98134b6bf11efcae7910dcec4e7c-","val":{"mdast":{"type":"root","children":[{"type":"heading","depth":2,"children":[{"type":"text","value":"Understanding The Goals of This Guide","position":{"start":{"line":2,"column":4,"offset":4},"end":{"line":2,"column":41,"offset":41},"indent":[]}}],"position":{"start":{"line":2,"column":1,"offset":1},"end":{"line":2,"column":41,"offset":41},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"This guide is not intended to trash or hate on Discord.JS. In fact, Discord.JS is the most popular Node.JS library which is why most users wanting to use Discordeno come from Discord.JS. Today, I had a user ask me for a guide to convert a Discord.JS bot to Discordeno. That was the start of this guide.","position":{"start":{"line":4,"column":1,"offset":43},"end":{"line":4,"column":303,"offset":345},"indent":[]}}],"position":{"start":{"line":4,"column":1,"offset":43},"end":{"line":4,"column":303,"offset":345},"indent":[]}},{"type":"heading","depth":2,"children":[{"type":"text","value":"Finding A Open Source Bot","position":{"start":{"line":6,"column":4,"offset":350},"end":{"line":6,"column":29,"offset":375},"indent":[]}}],"position":{"start":{"line":6,"column":1,"offset":347},"end":{"line":6,"column":29,"offset":375},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"For the purposes of this guide, I wanted to find a moderation bot that is totally open source to show an example of how to convert the bot to Discordeno. Trying to find one was not easy as most bot's were not using the latest Discord.JS version 12. Trying to find one that was using TypeScript made it even more difficult. My next best solution was to find a moderation bot that was recently updated(showing it is maintained or recently built). The best one I could find was ","position":{"start":{"line":8,"column":1,"offset":377},"end":{"line":8,"column":476,"offset":852},"indent":[]}},{"type":"link","title":null,"url":"https://github.com/Nukestye/Zodiac","children":[{"type":"text","value":"Zodiac Bot","position":{"start":{"line":8,"column":477,"offset":853},"end":{"line":8,"column":487,"offset":863},"indent":[]}}],"position":{"start":{"line":8,"column":476,"offset":852},"end":{"line":8,"column":524,"offset":900},"indent":[]}},{"type":"text","value":".","position":{"start":{"line":8,"column":524,"offset":900},"end":{"line":8,"column":525,"offset":901},"indent":[]}}],"position":{"start":{"line":8,"column":1,"offset":377},"end":{"line":8,"column":525,"offset":901},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"For the purposes of this guide, I will be using the current ","position":{"start":{"line":10,"column":1,"offset":903},"end":{"line":10,"column":61,"offset":963},"indent":[]}},{"type":"link","title":null,"url":"https://github.com/Nukestye/Zodiac/tree/213891a38af1b7ecbd068b661ef9062ab58cc818","children":[{"type":"text","value":"latest commit","position":{"start":{"line":10,"column":62,"offset":964},"end":{"line":10,"column":75,"offset":977},"indent":[]}}],"position":{"start":{"line":10,"column":61,"offset":963},"end":{"line":10,"column":158,"offset":1060},"indent":[]}}],"position":{"start":{"line":10,"column":1,"offset":903},"end":{"line":10,"column":158,"offset":1060},"indent":[]}},{"type":"heading","depth":2,"children":[{"type":"text","value":"Preparations","position":{"start":{"line":12,"column":4,"offset":1065},"end":{"line":12,"column":16,"offset":1077},"indent":[]}}],"position":{"start":{"line":12,"column":1,"offset":1062},"end":{"line":12,"column":16,"offset":1077},"indent":[]}},{"type":"list","ordered":false,"start":null,"spread":true,"children":[{"type":"listItem","spread":false,"checked":null,"children":[{"type":"paragraph","children":[{"type":"text","value":"First, create a Discordeno Bot using the ","position":{"start":{"line":14,"column":3,"offset":1081},"end":{"line":14,"column":44,"offset":1122},"indent":[]}},{"type":"link","title":null,"url":"https://github.com/Skillz4Killz/Discordeno-bot-template","children":[{"type":"text","value":"Generator Boilerplate","position":{"start":{"line":14,"column":45,"offset":1123},"end":{"line":14,"column":66,"offset":1144},"indent":[]}}],"position":{"start":{"line":14,"column":44,"offset":1122},"end":{"line":14,"column":124,"offset":1202},"indent":[]}},{"type":"text","value":" I will name it Zodiac.","position":{"start":{"line":14,"column":124,"offset":1202},"end":{"line":14,"column":147,"offset":1225},"indent":[]}}],"position":{"start":{"line":14,"column":3,"offset":1081},"end":{"line":14,"column":147,"offset":1225},"indent":[]}}],"position":{"start":{"line":14,"column":1,"offset":1079},"end":{"line":15,"column":1,"offset":1226},"indent":[1]}},{"type":"listItem","spread":false,"checked":null,"children":[{"type":"paragraph","children":[{"type":"text","value":"Then ","position":{"start":{"line":16,"column":3,"offset":1229},"end":{"line":16,"column":8,"offset":1234},"indent":[]}},{"type":"inlineCode","value":"git clone https://github.com/Skillz4Killz/Zodiac.git","position":{"start":{"line":16,"column":8,"offset":1234},"end":{"line":16,"column":62,"offset":1288},"indent":[]}}],"position":{"start":{"line":16,"column":3,"offset":1229},"end":{"line":16,"column":62,"offset":1288},"indent":[]}}],"position":{"start":{"line":16,"column":1,"offset":1227},"end":{"line":16,"column":62,"offset":1288},"indent":[]}}],"position":{"start":{"line":14,"column":1,"offset":1079},"end":{"line":16,"column":62,"offset":1288},"indent":[1,1]}},{"type":"paragraph","children":[{"type":"text","value":"Now that I had the repository cloned, I could begin. Note that although the bot we are converting is built in JavaScript, I converted all code to TypeScript in this Guide as Discordeno is designed to be the best lib for TypeScript developers.","position":{"start":{"line":18,"column":1,"offset":1290},"end":{"line":18,"column":243,"offset":1532},"indent":[]}}],"position":{"start":{"line":18,"column":1,"offset":1290},"end":{"line":18,"column":243,"offset":1532},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"Time to get started!","position":{"start":{"line":20,"column":1,"offset":1534},"end":{"line":20,"column":21,"offset":1554},"indent":[]}}],"position":{"start":{"line":20,"column":1,"offset":1534},"end":{"line":20,"column":21,"offset":1554},"indent":[]}},{"type":"heading","depth":2,"children":[{"type":"text","value":"Converting main.js (index file)","position":{"start":{"line":22,"column":4,"offset":1559},"end":{"line":22,"column":35,"offset":1590},"indent":[]}}],"position":{"start":{"line":22,"column":1,"offset":1556},"end":{"line":22,"column":35,"offset":1590},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"The first thing is to convert the ","position":{"start":{"line":24,"column":1,"offset":1592},"end":{"line":24,"column":35,"offset":1626},"indent":[]}},{"type":"inlineCode","value":"main.js","position":{"start":{"line":24,"column":35,"offset":1626},"end":{"line":24,"column":44,"offset":1635},"indent":[]}},{"type":"text","value":" file which would be the app.js or index.js file. This is the file that is run to start your bot. In this case, the bot developer chose ","position":{"start":{"line":24,"column":44,"offset":1635},"end":{"line":24,"column":180,"offset":1771},"indent":[]}},{"type":"inlineCode","value":"main.js","position":{"start":{"line":24,"column":180,"offset":1771},"end":{"line":24,"column":189,"offset":1780},"indent":[]}},{"type":"text","value":". In Deno, the initial file is named ","position":{"start":{"line":24,"column":189,"offset":1780},"end":{"line":24,"column":226,"offset":1817},"indent":[]}},{"type":"inlineCode","value":"mod.ts","position":{"start":{"line":24,"column":226,"offset":1817},"end":{"line":24,"column":234,"offset":1825},"indent":[]}},{"type":"text","value":" so we can go ahead and opt for the Deno pattern. Note: there is already a ","position":{"start":{"line":24,"column":234,"offset":1825},"end":{"line":24,"column":309,"offset":1900},"indent":[]}},{"type":"inlineCode","value":"mod.ts","position":{"start":{"line":24,"column":309,"offset":1900},"end":{"line":24,"column":317,"offset":1908},"indent":[]}},{"type":"text","value":" file created and prebuilt entirely using the Generator.","position":{"start":{"line":24,"column":317,"offset":1908},"end":{"line":24,"column":373,"offset":1964},"indent":[]}}],"position":{"start":{"line":24,"column":1,"offset":1592},"end":{"line":24,"column":373,"offset":1964},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"Current Discord.JS Code:","position":{"start":{"line":26,"column":1,"offset":1966},"end":{"line":26,"column":25,"offset":1990},"indent":[]}}],"position":{"start":{"line":26,"column":1,"offset":1966},"end":{"line":26,"column":25,"offset":1990},"indent":[]}},{"type":"code","lang":"js","meta":null,"value":"/* Keeping this to shoutout/credit the original author <3\n* @author: nukestye\n*/\n\nconst config = require('./config.json')\nconst fs = require('fs')\nconst log = console.log\n\n// Setting up the way to get commands\nconst { CommandoClient } = require('discord.js-commando')\nconst path = require('path')\n\n// reading events\nfs.readdir('./src/events/', (err, files) => {\n if (err) return console.error(err)\n files.forEach((file) => {\n const eventFunction = require(`./src/events/${file}`)\n if (eventFunction.disabled) return\n const event = eventFunction.event || file.split('.')[0]\n const emitter = (typeof eventFunction.emitter === 'string' ? client[eventFunction.emitter] : eventFunction.emitter) || client\n const { once } = eventFunction\n try {\n emitter[once ? 'once' : 'on'](event, (...args) => eventFunction.run(...args))\n } catch (error) {\n console.error(error.stack)\n }\n })\n})\n\nconst client = global.client = new CommandoClient({\n commandPrefix: `${config.prefix}`,\n owner: `${config.owner}`,\n invite: `${config.discord}`,\n unknownCommandResponse: false\n})\n\n// Registing the commands\nclient.registry\n .registerDefaultTypes()\n// The different fields for cmds\n .registerGroups([\n ['mod', 'Moderation Commands'],\n ['public', 'Public Commands']\n ])\n .registerDefaultGroups()\n// Basic cmds can be disabled like {\"cmd: false\"}\n .registerDefaultCommands()\n// commands in \"/src/commands\" will be counted\n .registerCommandsIn(path.join(__dirname, '/src/commands'))\n\n// list of activities that the bot goes through\nconst activityArray = [`${config.prefix}help | `]\n// Bot lanuch code\nclient.once('ready', () => {\n log(`Logged in as ${client.user.tag} in ${client.guilds.size} guild(s)!`)\n setInterval(() => {\n const index = Math.floor(Math.random() * (activityArray.length)) // generates a random number between 1 and the length of the activities array list\n client.user.setActivity(\n activityArray[index],\n {\n type: 'PLAYING'\n }) // sets bot\"s activities to one of the phrases in the arraylist.\n }, 5000) // updates every 10000ms = 10s\n})\n// If an error print it out\nclient.on('error', console.error)\n\n// Login in using the token in config\nclient.login(config.env.TOKEN)","position":{"start":{"line":27,"column":1,"offset":1991},"end":{"line":97,"column":4,"offset":4244},"indent":[1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1]}},{"type":"paragraph","children":[{"type":"text","value":"Discordeno Version:","position":{"start":{"line":99,"column":1,"offset":4246},"end":{"line":99,"column":20,"offset":4265},"indent":[]}}],"position":{"start":{"line":99,"column":1,"offset":4246},"end":{"line":99,"column":20,"offset":4265},"indent":[]}},{"type":"code","lang":"ts","meta":null,"value":"import Client, {\n updateEventHandlers,\n} from \"https://raw.githubusercontent.com/Skillz4Killz/Discordeno/v7/src/module/client.ts\";\nimport { configs } from \"./configs.ts\";\nimport { Intents } from \"https://raw.githubusercontent.com/Skillz4Killz/Discordeno/v7/src/types/options.ts\";\nimport { eventHandlers } from \"./src/events/eventHandlers.ts\";\nimport { Message } from \"https://raw.githubusercontent.com/Skillz4Killz/Discordeno/v7/src/structures/message.ts\";\nimport { Command } from \"./src/types/commands.ts\";\nimport { Guild } from \"https://raw.githubusercontent.com/Skillz4Killz/Discordeno/v7/src/structures/guild.ts\";\n\nexport const botCache = {\n commands: new Map(),\n commandAliases: new Map(),\n guildPrefixes: new Map(),\n inhibitors: new Map<\n string,\n (message: Message, command: Command, guild?: Guild) => boolean\n\t>(),\n\teventHandlers: {} as EventHandlers\n};\n\nconst importDirectory = async (path: string) => {\n const files = Deno.readDirSync(Deno.realPathSync(path));\n\n for (const file of files) {\n if (!file.name) continue;\n\n const currentPath = `${path}/${file.name}`;\n if (file.isFile) {\n await import(currentPath);\n continue;\n }\n\n importDirectory(currentPath);\n }\n};\n\n// Forces deno to read all the files which will fill the commands/inhibitors cache etc.\nawait Promise.all(\n [\"./src/commands\", \"./src/inhibitors\", \"./src/events\"].map((path) => importDirectory(path)),\n);\n\n\nClient({\n token: configs.token,\n // Pick the intents you wish to have for your bot.\n\tintents: [Intents.GUILDS, Intents.GUILD_MESSAGES],\n\teventHandlers: botCache.eventHandlers\n});","position":{"start":{"line":101,"column":1,"offset":4267},"end":{"line":151,"column":4,"offset":5927},"indent":[1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1]}},{"type":"paragraph","children":[{"type":"text","value":"Something we haven't converted yet from the ","position":{"start":{"line":153,"column":1,"offset":5929},"end":{"line":153,"column":45,"offset":5973},"indent":[]}},{"type":"inlineCode","value":"main.js","position":{"start":{"line":153,"column":45,"offset":5973},"end":{"line":153,"column":54,"offset":5982},"indent":[]}},{"type":"text","value":" files is the event listeners. To do that, we will open up the events folder and find the corresponding event or create it if necessary. In this case, we have the ","position":{"start":{"line":153,"column":54,"offset":5982},"end":{"line":153,"column":217,"offset":6145},"indent":[]}},{"type":"inlineCode","value":"ready","position":{"start":{"line":153,"column":217,"offset":6145},"end":{"line":153,"column":224,"offset":6152},"indent":[]}},{"type":"text","value":" event and there is already a ","position":{"start":{"line":153,"column":224,"offset":6152},"end":{"line":153,"column":254,"offset":6182},"indent":[]}},{"type":"inlineCode","value":"ready.ts","position":{"start":{"line":153,"column":254,"offset":6182},"end":{"line":153,"column":264,"offset":6192},"indent":[]}},{"type":"text","value":" file. We can just use that.","position":{"start":{"line":153,"column":264,"offset":6192},"end":{"line":153,"column":292,"offset":6220},"indent":[]}}],"position":{"start":{"line":153,"column":1,"offset":5929},"end":{"line":153,"column":292,"offset":6220},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"In our ","position":{"start":{"line":155,"column":1,"offset":6222},"end":{"line":155,"column":8,"offset":6229},"indent":[]}},{"type":"inlineCode","value":"ready.ts","position":{"start":{"line":155,"column":8,"offset":6229},"end":{"line":155,"column":18,"offset":6239},"indent":[]}},{"type":"text","value":" file we can add the ","position":{"start":{"line":155,"column":18,"offset":6239},"end":{"line":155,"column":39,"offset":6260},"indent":[]}},{"type":"inlineCode","value":"ready","position":{"start":{"line":155,"column":39,"offset":6260},"end":{"line":155,"column":46,"offset":6267},"indent":[]}},{"type":"text","value":" event listener.","position":{"start":{"line":155,"column":46,"offset":6267},"end":{"line":155,"column":62,"offset":6283},"indent":[]}}],"position":{"start":{"line":155,"column":1,"offset":6222},"end":{"line":155,"column":62,"offset":6283},"indent":[]}},{"type":"code","lang":"ts","meta":null,"value":"import { botCache } from \"../../mod.ts\";\nimport { configs } from \"../../configs.ts\";\nimport { cache } from \"https://raw.githubusercontent.com/Skillz4Killz/Discordeno/v7/src/utils/cache.ts\";\nimport { editBotsStatus, chooseRandom } from \"https://raw.githubusercontent.com/Skillz4Killz/Discordeno/v7/src/utils/utils.ts\";\nimport { StatusType } from \"https://raw.githubusercontent.com/Skillz4Killz/Discordeno/v7/src/types/discord.ts\";\nimport { ActivityType } from \"https://raw.githubusercontent.com/Skillz4Killz/Discordeno/v7/src/types/activity.ts\";\n\nbotCache.eventHandlers.ready = function () {\n console.log(`[READY] Bot is online and ready in ${cache.guilds.size} guild(s)!`);\n\n // list of activities that the bot goes through\n const activityArray = [`${configs.prefix}help | `];\n setInterval(() => {\n editBotsStatus(StatusType.Online, chooseRandom(activityArray), ActivityType.Game)\n }, 5000)\n};","position":{"start":{"line":157,"column":1,"offset":6285},"end":{"line":174,"column":4,"offset":7196},"indent":[1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1]}},{"type":"paragraph","children":[{"type":"text","value":"To understand this code, we are setting a function to be run when the bot is ","position":{"start":{"line":176,"column":1,"offset":7198},"end":{"line":176,"column":78,"offset":7275},"indent":[]}},{"type":"inlineCode","value":"ready","position":{"start":{"line":176,"column":78,"offset":7275},"end":{"line":176,"column":85,"offset":7282},"indent":[]}},{"type":"text","value":". Then the bot will edit the bots status every 5 seconds. Notice, that Discordeno provides a nice clean util function to choose a random item from an array. You also have beautiful enums provided that prevent you from making any typos/mistakes.","position":{"start":{"line":176,"column":85,"offset":7282},"end":{"line":176,"column":329,"offset":7526},"indent":[]}}],"position":{"start":{"line":176,"column":1,"offset":7198},"end":{"line":176,"column":329,"offset":7526},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"We have now converted the entire ","position":{"start":{"line":178,"column":1,"offset":7528},"end":{"line":178,"column":34,"offset":7561},"indent":[]}},{"type":"inlineCode","value":"main.js","position":{"start":{"line":178,"column":34,"offset":7561},"end":{"line":178,"column":43,"offset":7570},"indent":[]}},{"type":"text","value":" file, in a matter of seconds. The Discordeno official generator took care of the majority of workload and we just modified the ","position":{"start":{"line":178,"column":43,"offset":7570},"end":{"line":178,"column":171,"offset":7698},"indent":[]}},{"type":"inlineCode","value":"ready.ts","position":{"start":{"line":178,"column":171,"offset":7698},"end":{"line":178,"column":181,"offset":7708},"indent":[]}},{"type":"text","value":" file.","position":{"start":{"line":178,"column":181,"offset":7708},"end":{"line":178,"column":187,"offset":7714},"indent":[]}}],"position":{"start":{"line":178,"column":1,"offset":7528},"end":{"line":178,"column":187,"offset":7714},"indent":[]}},{"type":"paragraph","children":[{"type":"inlineCode","value":"Note:","position":{"start":{"line":180,"column":1,"offset":7716},"end":{"line":180,"column":8,"offset":7723},"indent":[]}},{"type":"text","value":" I did remove some generally well known \"bad practices\" such as global vars and such. Overall, you will see the functionality of the project will not change as we progress through this guide.","position":{"start":{"line":180,"column":8,"offset":7723},"end":{"line":180,"column":199,"offset":7914},"indent":[]}}],"position":{"start":{"line":180,"column":1,"offset":7716},"end":{"line":180,"column":199,"offset":7914},"indent":[]}},{"type":"heading","depth":2,"children":[{"type":"text","value":"Converting Commands","position":{"start":{"line":182,"column":4,"offset":7919},"end":{"line":182,"column":23,"offset":7938},"indent":[]}}],"position":{"start":{"line":182,"column":1,"offset":7916},"end":{"line":182,"column":23,"offset":7938},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"The first command in the commands folder is the ","position":{"start":{"line":184,"column":1,"offset":7940},"end":{"line":184,"column":49,"offset":7988},"indent":[]}},{"type":"inlineCode","value":"addRole","position":{"start":{"line":184,"column":49,"offset":7988},"end":{"line":184,"column":58,"offset":7997},"indent":[]}},{"type":"text","value":" command.","position":{"start":{"line":184,"column":58,"offset":7997},"end":{"line":184,"column":67,"offset":8006},"indent":[]}}],"position":{"start":{"line":184,"column":1,"offset":7940},"end":{"line":184,"column":67,"offset":8006},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"This is the code from the bot:","position":{"start":{"line":186,"column":1,"offset":8008},"end":{"line":186,"column":32,"offset":8039},"indent":[]}}],"position":{"start":{"line":186,"column":1,"offset":8008},"end":{"line":186,"column":32,"offset":8039},"indent":[]}},{"type":"code","lang":"ts","meta":null,"value":"// Getting the 'Command' features from Commando\nconst { Command } = require('discord.js-commando')\n\n// Code for the command\nmodule.exports = class addRoleCommand extends Command {\n constructor (client) {\n super(client, {\n // name of the command, must be in lowercase\n name: 'addrole',\n // other ways to call the command, must be in lowercase\n aliases: ['role'],\n // command group its part of\n group: 'mod',\n // name within the command group, must be in lowercase\n memberName: 'addrole',\n // Is the description used for 'help' command\n description: 'Adds mentioned role to mentioned user.',\n // Prevents it from being used in dms\n guildOnly: true,\n // Permissions, list found here > `discord.js.org/#/docs/main/11.5.1/class/Permissions?scrollTo=s-FLAGS`\n clientPermissions: ['ADMINISTRATOR', 'MANAGE_ROLES'],\n userPermissions: ['MANAGE_ROLES'],\n // Prevents anyone other than owner to use the command\n ownerOnly: false\n })\n }\n\n // Run code goes here\n run (message) {\n const user = message.mentions.members.first()\n const roleToAdd = message.mentions.roles.first()\n\n // checking to see if the user has the role or not\n if (!(user.roles.find(r => r.name === roleToAdd.name))) {\n user.addRole(roleToAdd)\n message.channel.send(`${user} has been given the role: ${roleToAdd.name}`)\n .then(msg => {\n msg.delete(5000)\n })\n } else {\n message.channel.send(`${user} already has the role: ${roleToAdd.name}`)\n }\n\n // console.error(user, roleToAdd, message.member.roles.find(r => r.name === roleToAdd));\n }\n}","position":{"start":{"line":187,"column":1,"offset":8040},"end":{"line":234,"column":4,"offset":9700},"indent":[1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1]}},{"type":"paragraph","children":[{"type":"text","value":"This is how to do it with Discordeno:","position":{"start":{"line":236,"column":1,"offset":9702},"end":{"line":236,"column":38,"offset":9739},"indent":[]}}],"position":{"start":{"line":236,"column":1,"offset":9702},"end":{"line":236,"column":38,"offset":9739},"indent":[]}},{"type":"code","lang":"ts","meta":null,"value":"import { botCache } from \"../../mod.ts\";\nimport { addRole } from \"https://raw.githubusercontent.com/Skillz4Killz/Discordeno/v7/src/handlers/member.ts\";\nimport { sendAlertResponse, sendResponse } from \"../utils/helpers.ts\";\n\nbotCache.commands.set(`addrole`, {\n // Is the description used for 'help' command\n description: \"Adds mentioned role to mentioned user.\",\n // Prevents it from being used in dms\n guildOnly: true,\n botServerPermissions: [\"ADMINISTRATOR\", \"MANAGE_ROLES\"],\n userServerPermissions: [\"MANAGE_ROLES\"],\n execute: (message, _args, guild) => {\n const [member] = message.mentions();\n const [roleIDToAdd] = message.mentionRoles;\n\t\tconst role = guild?.roles.get(roleIDToAdd)\n\n // checking to see if the user has the role or not\n if (!member.roles.includes(roleIDToAdd)) {\n\t\t\taddRole(guild!, member.user.id, roleIDToAdd)\n\t\t\tsendAlertResponse(message, `has been given the role: ${role!.name}`, 5);\n } else {\n\t\t\tsendResponse(message, `already has the role: ${role!.name}`)\n }\n }\n});\n\n// other ways to call the command\ncreateCommandAliases(\"role\", \"addrole\");","position":{"start":{"line":237,"column":1,"offset":9740},"end":{"line":266,"column":4,"offset":10842},"indent":[1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1]}},{"type":"paragraph","children":[{"type":"text","value":"Awesome, that is a full command converted from Discord.JS to Discordeno. See how easy it is! Let's convert one more command to see how to really take full advantage of Discordeno boilerplate and have something amazing.","position":{"start":{"line":268,"column":1,"offset":10844},"end":{"line":268,"column":219,"offset":11062},"indent":[]}}],"position":{"start":{"line":268,"column":1,"offset":10844},"end":{"line":268,"column":219,"offset":11062},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"Discord.JS Kick Command Version","position":{"start":{"line":270,"column":1,"offset":11064},"end":{"line":270,"column":32,"offset":11095},"indent":[]}}],"position":{"start":{"line":270,"column":1,"offset":11064},"end":{"line":270,"column":32,"offset":11095},"indent":[]}},{"type":"code","lang":"js","meta":null,"value":"// Getting the 'Command' features from Commando\nconst { Command } = require('discord.js-commando')\nconst { RichEmbed } = require('discord.js')\nconst chalk = require('chalk')\nconst log = console.log\n\n// Code for the command\nmodule.exports = class kickCommand extends Command {\n constructor (client) {\n super(client, {\n // name of the command, must be in lowercase\n name: 'kick',\n // other ways to call the command, must be in lowercase\n aliases: ['boot', 'tempban'],\n // command group its part of\n group: 'mod',\n // name within the command group, must be in lowercase\n memberName: 'kick',\n // Is the description used for 'help' command\n description: 'Kick command.',\n // adds cooldowns to the command\n throttling: {\n // usages in certain time x\n usages: 1,\n // the cooldown\n duration: 10\n },\n // Prevents it from being used in dms\n guildOnly: true,\n // Permissions, list found here > `discord.js.org/#/docs/main/11.5.1/class/Permissions?scrollTo=s-FLAGS`\n clientPermissions: ['ADMINISTRATOR'],\n userPermissions: ['KICK_MEMBERS'],\n // Prevents anyone other than owner to use the command\n ownerOnly: false\n\n })\n }\n\n // Run code goes here\n run (message) {\n const messageArry = message.content.split(' ')\n const args = messageArry.slice(1)\n\n const kUser = message.guild.member(message.mentions.users.first() || message.guild.get(args[0]))\n if (!kUser) return message.channel.send('User cannot be found!')\n const kreason = args.join(' ').slice(22)\n\n // setting up the embed for report/log\n const kickEmbed = new RichEmbed()\n .setDescription(`Report: ${kUser} Kick`)\n .addField('Reason >', `${kreason}`)\n .addField('Time', message.createdAt)\n\n const reportchannel = message.guild.channels.find('name', 'report')\n if (!reportchannel) return message.channel.send('*`Report channel cannot be found!`*')\n\n // Delete the message command\n // eslint-disable-next-line camelcase\n message.delete().catch(O_o => {})\n // Kick the user with reason\n message.guild.member(kUser).kick(kreason)\n // sends the kick report into log/report\n reportchannel.send(kickEmbed)\n // Logs the kick into the terminal\n log(chalk.red('KICK', chalk.underline.bgBlue(kUser) + '!'))\n }\n}","position":{"start":{"line":271,"column":1,"offset":11096},"end":{"line":339,"column":4,"offset":13460},"indent":[1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1]}},{"type":"paragraph","children":[{"type":"text","value":"Discordeno Version","position":{"start":{"line":341,"column":1,"offset":13462},"end":{"line":341,"column":19,"offset":13480},"indent":[]}}],"position":{"start":{"line":341,"column":1,"offset":13462},"end":{"line":341,"column":19,"offset":13480},"indent":[]}},{"type":"code","lang":"ts","meta":null,"value":"import { sendMessage } from \"https://raw.githubusercontent.com/Skillz4Killz/Discordeno/v7/src/handlers/channel.ts\";\nimport { Member } from \"https://raw.githubusercontent.com/Skillz4Killz/Discordeno/v7/src/structures/member.ts\";\nimport { kick } from \"https://raw.githubusercontent.com/Skillz4Killz/Discordeno/v7/src/handlers/member.ts\";\nimport { deleteMessage } from \"https://raw.githubusercontent.com/Skillz4Killz/Discordeno/v7/src/handlers/message.ts\";\nimport { botCache } from \"../../mod.ts\";\nimport { createCommandAliases, sendResponse } from \"../utils/helpers.ts\";\nimport { Embed } from \"../utils/Embed.ts\";\nimport { Args } from \"../types/commands.ts\";\n\nbotCache.commands.set(`kick`, {\n name: `kick`,\n description: \"Kick command.\",\n // adds cooldowns to the command\n cooldown: {\n // usages in certain duration of seconds below\n allowedUses: 1,\n // the cooldown\n seconds: 10,\n },\n // Prevents it from being used in dms\n guildOnly: true,\n botServerPermissions: [\"ADMINISTRATOR\"],\n userServerPermissions: [\"KICK_MEMBERS\"],\n arguments: [\n {\n name: \"member\",\n type: \"member\",\n missing: function (message) {\n sendResponse(message, `User cannot be found.`);\n },\n // By default this is true but for the purpose of the guide so you can see this exists.\n required: true,\n },\n {\n name: \"reason\",\n // The leftover string provided by the user that was not used by previous args.\n type: \"...string\",\n defaultValue: \"No reason provided.\",\n // It is silly to lowercase this but for the purpose of the guide you can see that this is also available to you.\n lowercase: true,\n },\n ],\n execute: function (message, args: KickArgs, guild) {\n if (!guild) return;\n // setting up the embed for report/log\n const embed = new Embed()\n .setDescription(`Report: ${args.member.mention} Kick`)\n .addField(\"Reason >\", args.reason)\n .addField(\"Time\", message.timestamp.toString());\n\n const reportchannel = guild.channels.find((channel) =>\n channel.name === \"report\"\n );\n if (!reportchannel) {\n return sendResponse(message, \"*`Report channel cannot be found!`*\");\n }\n\n // Delete the message command\n deleteMessage(message, \"Remove kick command trigger.\");\n // Kick the user with reason\n kick(guild, args.member.user.id, args.reason);\n // sends the kick report into log/report\n sendMessage(reportchannel, embed);\n },\n});\n\n// other ways to call the command, must be in lowercase\ncreateCommandAliases(\"kick\", [\"boot\", \"tempban\"]);\n\ninterface KickArgs {\n member: Member;\n reason: string;\n}","position":{"start":{"line":342,"column":1,"offset":13481},"end":{"line":416,"column":4,"offset":16116},"indent":[1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1]}},{"type":"paragraph","children":[{"type":"text","value":"Let's take a minute and explain the differences here. The first thing you will probably notice is different is the ","position":{"start":{"line":418,"column":1,"offset":16118},"end":{"line":418,"column":116,"offset":16233},"indent":[]}},{"type":"inlineCode","value":"arguments","position":{"start":{"line":418,"column":116,"offset":16233},"end":{"line":418,"column":127,"offset":16244},"indent":[]}},{"type":"text","value":" property. Discordeno provides the ","position":{"start":{"line":418,"column":127,"offset":16244},"end":{"line":418,"column":162,"offset":16279},"indent":[]}},{"type":"inlineCode","value":"arguments","position":{"start":{"line":418,"column":162,"offset":16279},"end":{"line":418,"column":173,"offset":16290},"indent":[]}},{"type":"text","value":" property because it provides argument handling/parsing/validating internally. You don't need to be splitting the message content or going through and validating it yourself. All you do is tell Discordeno that you want a member and a reason. It will do the magic and hard work to get you that data before you even run the command. You just do ","position":{"start":{"line":418,"column":173,"offset":16290},"end":{"line":418,"column":516,"offset":16633},"indent":[]}},{"type":"inlineCode","value":"args.member","position":{"start":{"line":418,"column":516,"offset":16633},"end":{"line":418,"column":529,"offset":16646},"indent":[]}},{"type":"text","value":" and you have access to the full member object. You can also see that aliases are created slightly different but it's not that huge a impact. The end functionality is the same. There are a lot more powerful aspects to Discordeno like arguments. Keep diving in and you will find all the wonderful tools available to give you the best developer experience possible.","position":{"start":{"line":418,"column":529,"offset":16646},"end":{"line":418,"column":892,"offset":17009},"indent":[]}}],"position":{"start":{"line":418,"column":1,"offset":16118},"end":{"line":418,"column":892,"offset":17009},"indent":[]}},{"type":"heading","depth":3,"children":[{"type":"text","value":"Need More Examples/Help","position":{"start":{"line":420,"column":5,"offset":17015},"end":{"line":420,"column":28,"offset":17038},"indent":[]}}],"position":{"start":{"line":420,"column":1,"offset":17011},"end":{"line":420,"column":28,"offset":17038},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"If you still need more help converting other aspects of your bot please contact me at ","position":{"start":{"line":422,"column":1,"offset":17040},"end":{"line":422,"column":87,"offset":17126},"indent":[]}},{"type":"link","title":null,"url":"https://discord.gg/J4NqJ72","children":[{"type":"text","value":"Discord","position":{"start":{"line":422,"column":88,"offset":17127},"end":{"line":422,"column":95,"offset":17134},"indent":[]}}],"position":{"start":{"line":422,"column":87,"offset":17126},"end":{"line":422,"column":124,"offset":17163},"indent":[]}},{"type":"text","value":". I will continue adding more examples to this guide as more people request them.","position":{"start":{"line":422,"column":124,"offset":17163},"end":{"line":422,"column":205,"offset":17244},"indent":[]}}],"position":{"start":{"line":422,"column":1,"offset":17040},"end":{"line":422,"column":205,"offset":17244},"indent":[]}},{"type":"export","value":"export const _frontmatter = {\"title\":\"Discord.JS to Discordeno Guide\",\"metaTitle\":\"Discord.JS to Discordeno | Discordeno\",\"metaDescription\":\"This guide will help should you how to convert a Discord.JS bot over to Discordeno.\"}","position":{"start":{"line":425,"column":1,"offset":17247},"end":{"line":425,"column":227,"offset":17473},"indent":[]}}],"position":{"start":{"line":1,"column":1,"offset":0},"end":{"line":425,"column":227,"offset":17473}}},"scopeImports":["import * as React from 'react'"],"scopeIdentifiers":["React"],"body":"function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }\n\nfunction _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }\n\nfunction _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }\n\n/* @jsx mdx */\nvar _frontmatter = {\n \"title\": \"Discord.JS to Discordeno Guide\",\n \"metaTitle\": \"Discord.JS to Discordeno | Discordeno\",\n \"metaDescription\": \"This guide will help should you how to convert a Discord.JS bot over to Discordeno.\"\n};\nvar layoutProps = {\n _frontmatter: _frontmatter\n};\nvar MDXLayout = \"wrapper\";\nreturn function MDXContent(_ref) {\n var components = _ref.components,\n props = _objectWithoutProperties(_ref, [\"components\"]);\n\n return mdx(MDXLayout, _extends({}, layoutProps, props, {\n components: components,\n mdxType: \"MDXLayout\"\n }), mdx(\"h2\", null, \"Understanding The Goals of This Guide\"), mdx(\"p\", null, \"This guide is not intended to trash or hate on Discord.JS. In fact, Discord.JS is the most popular Node.JS library which is why most users wanting to use Discordeno come from Discord.JS. Today, I had a user ask me for a guide to convert a Discord.JS bot to Discordeno. That was the start of this guide.\"), mdx(\"h2\", null, \"Finding A Open Source Bot\"), mdx(\"p\", null, \"For the purposes of this guide, I wanted to find a moderation bot that is totally open source to show an example of how to convert the bot to Discordeno. Trying to find one was not easy as most bot's were not using the latest Discord.JS version 12. Trying to find one that was using TypeScript made it even more difficult. My next best solution was to find a moderation bot that was recently updated(showing it is maintained or recently built). The best one I could find was \", mdx(\"a\", _extends({\n parentName: \"p\"\n }, {\n \"href\": \"https://github.com/Nukestye/Zodiac\"\n }), \"Zodiac Bot\"), \".\"), mdx(\"p\", null, \"For the purposes of this guide, I will be using the current \", mdx(\"a\", _extends({\n parentName: \"p\"\n }, {\n \"href\": \"https://github.com/Nukestye/Zodiac/tree/213891a38af1b7ecbd068b661ef9062ab58cc818\"\n }), \"latest commit\")), mdx(\"h2\", null, \"Preparations\"), mdx(\"ul\", null, mdx(\"li\", {\n parentName: \"ul\"\n }, mdx(\"p\", {\n parentName: \"li\"\n }, \"First, create a Discordeno Bot using the \", mdx(\"a\", _extends({\n parentName: \"p\"\n }, {\n \"href\": \"https://github.com/Skillz4Killz/Discordeno-bot-template\"\n }), \"Generator Boilerplate\"), \" I will name it Zodiac.\")), mdx(\"li\", {\n parentName: \"ul\"\n }, mdx(\"p\", {\n parentName: \"li\"\n }, \"Then \", mdx(\"inlineCode\", {\n parentName: \"p\"\n }, \"git clone https://github.com/Skillz4Killz/Zodiac.git\")))), mdx(\"p\", null, \"Now that I had the repository cloned, I could begin. Note that although the bot we are converting is built in JavaScript, I converted all code to TypeScript in this Guide as Discordeno is designed to be the best lib for TypeScript developers.\"), mdx(\"p\", null, \"Time to get started!\"), mdx(\"h2\", null, \"Converting main.js (index file)\"), mdx(\"p\", null, \"The first thing is to convert the \", mdx(\"inlineCode\", {\n parentName: \"p\"\n }, \"main.js\"), \" file which would be the app.js or index.js file. This is the file that is run to start your bot. In this case, the bot developer chose \", mdx(\"inlineCode\", {\n parentName: \"p\"\n }, \"main.js\"), \". In Deno, the initial file is named \", mdx(\"inlineCode\", {\n parentName: \"p\"\n }, \"mod.ts\"), \" so we can go ahead and opt for the Deno pattern. Note: there is already a \", mdx(\"inlineCode\", {\n parentName: \"p\"\n }, \"mod.ts\"), \" file created and prebuilt entirely using the Generator.\"), mdx(\"p\", null, \"Current Discord.JS Code:\"), mdx(\"pre\", null, mdx(\"code\", _extends({\n parentName: \"pre\"\n }, {\n \"className\": \"language-js\"\n }), \"/* Keeping this to shoutout/credit the original author <3\\n* @author: nukestye\\n*/\\n\\nconst config = require('./config.json')\\nconst fs = require('fs')\\nconst log = console.log\\n\\n// Setting up the way to get commands\\nconst { CommandoClient } = require('discord.js-commando')\\nconst path = require('path')\\n\\n// reading events\\nfs.readdir('./src/events/', (err, files) => {\\n if (err) return console.error(err)\\n files.forEach((file) => {\\n const eventFunction = require(`./src/events/${file}`)\\n if (eventFunction.disabled) return\\n const event = eventFunction.event || file.split('.')[0]\\n const emitter = (typeof eventFunction.emitter === 'string' ? client[eventFunction.emitter] : eventFunction.emitter) || client\\n const { once } = eventFunction\\n try {\\n emitter[once ? 'once' : 'on'](event, (...args) => eventFunction.run(...args))\\n } catch (error) {\\n console.error(error.stack)\\n }\\n })\\n})\\n\\nconst client = global.client = new CommandoClient({\\n commandPrefix: `${config.prefix}`,\\n owner: `${config.owner}`,\\n invite: `${config.discord}`,\\n unknownCommandResponse: false\\n})\\n\\n// Registing the commands\\nclient.registry\\n .registerDefaultTypes()\\n// The different fields for cmds\\n .registerGroups([\\n ['mod', 'Moderation Commands'],\\n ['public', 'Public Commands']\\n ])\\n .registerDefaultGroups()\\n// Basic cmds can be disabled like {\\\"cmd: false\\\"}\\n .registerDefaultCommands()\\n// commands in \\\"/src/commands\\\" will be counted\\n .registerCommandsIn(path.join(__dirname, '/src/commands'))\\n\\n// list of activities that the bot goes through\\nconst activityArray = [`${config.prefix}help | `]\\n// Bot lanuch code\\nclient.once('ready', () => {\\n log(`Logged in as ${client.user.tag} in ${client.guilds.size} guild(s)!`)\\n setInterval(() => {\\n const index = Math.floor(Math.random() * (activityArray.length)) // generates a random number between 1 and the length of the activities array list\\n client.user.setActivity(\\n activityArray[index],\\n {\\n type: 'PLAYING'\\n }) // sets bot\\\"s activities to one of the phrases in the arraylist.\\n }, 5000) // updates every 10000ms = 10s\\n})\\n// If an error print it out\\nclient.on('error', console.error)\\n\\n// Login in using the token in config\\nclient.login(config.env.TOKEN)\\n\")), mdx(\"p\", null, \"Discordeno Version:\"), mdx(\"pre\", null, mdx(\"code\", _extends({\n parentName: \"pre\"\n }, {\n \"className\": \"language-ts\"\n }), \"import Client, {\\n updateEventHandlers,\\n} from \\\"https://raw.githubusercontent.com/Skillz4Killz/Discordeno/v7/src/module/client.ts\\\";\\nimport { configs } from \\\"./configs.ts\\\";\\nimport { Intents } from \\\"https://raw.githubusercontent.com/Skillz4Killz/Discordeno/v7/src/types/options.ts\\\";\\nimport { eventHandlers } from \\\"./src/events/eventHandlers.ts\\\";\\nimport { Message } from \\\"https://raw.githubusercontent.com/Skillz4Killz/Discordeno/v7/src/structures/message.ts\\\";\\nimport { Command } from \\\"./src/types/commands.ts\\\";\\nimport { Guild } from \\\"https://raw.githubusercontent.com/Skillz4Killz/Discordeno/v7/src/structures/guild.ts\\\";\\n\\nexport const botCache = {\\n commands: new Map(),\\n commandAliases: new Map(),\\n guildPrefixes: new Map(),\\n inhibitors: new Map<\\n string,\\n (message: Message, command: Command, guild?: Guild) => boolean\\n >(),\\n eventHandlers: {} as EventHandlers\\n};\\n\\nconst importDirectory = async (path: string) => {\\n const files = Deno.readDirSync(Deno.realPathSync(path));\\n\\n for (const file of files) {\\n if (!file.name) continue;\\n\\n const currentPath = `${path}/${file.name}`;\\n if (file.isFile) {\\n await import(currentPath);\\n continue;\\n }\\n\\n importDirectory(currentPath);\\n }\\n};\\n\\n// Forces deno to read all the files which will fill the commands/inhibitors cache etc.\\nawait Promise.all(\\n [\\\"./src/commands\\\", \\\"./src/inhibitors\\\", \\\"./src/events\\\"].map((path) => importDirectory(path)),\\n);\\n\\n\\nClient({\\n token: configs.token,\\n // Pick the intents you wish to have for your bot.\\n intents: [Intents.GUILDS, Intents.GUILD_MESSAGES],\\n eventHandlers: botCache.eventHandlers\\n});\\n\")), mdx(\"p\", null, \"Something we haven't converted yet from the \", mdx(\"inlineCode\", {\n parentName: \"p\"\n }, \"main.js\"), \" files is the event listeners. To do that, we will open up the events folder and find the corresponding event or create it if necessary. In this case, we have the \", mdx(\"inlineCode\", {\n parentName: \"p\"\n }, \"ready\"), \" event and there is already a \", mdx(\"inlineCode\", {\n parentName: \"p\"\n }, \"ready.ts\"), \" file. We can just use that.\"), mdx(\"p\", null, \"In our \", mdx(\"inlineCode\", {\n parentName: \"p\"\n }, \"ready.ts\"), \" file we can add the \", mdx(\"inlineCode\", {\n parentName: \"p\"\n }, \"ready\"), \" event listener.\"), mdx(\"pre\", null, mdx(\"code\", _extends({\n parentName: \"pre\"\n }, {\n \"className\": \"language-ts\"\n }), \"import { botCache } from \\\"../../mod.ts\\\";\\nimport { configs } from \\\"../../configs.ts\\\";\\nimport { cache } from \\\"https://raw.githubusercontent.com/Skillz4Killz/Discordeno/v7/src/utils/cache.ts\\\";\\nimport { editBotsStatus, chooseRandom } from \\\"https://raw.githubusercontent.com/Skillz4Killz/Discordeno/v7/src/utils/utils.ts\\\";\\nimport { StatusType } from \\\"https://raw.githubusercontent.com/Skillz4Killz/Discordeno/v7/src/types/discord.ts\\\";\\nimport { ActivityType } from \\\"https://raw.githubusercontent.com/Skillz4Killz/Discordeno/v7/src/types/activity.ts\\\";\\n\\nbotCache.eventHandlers.ready = function () {\\n console.log(`[READY] Bot is online and ready in ${cache.guilds.size} guild(s)!`);\\n\\n // list of activities that the bot goes through\\n const activityArray = [`${configs.prefix}help | `];\\n setInterval(() => {\\n editBotsStatus(StatusType.Online, chooseRandom(activityArray), ActivityType.Game)\\n }, 5000)\\n};\\n\")), mdx(\"p\", null, \"To understand this code, we are setting a function to be run when the bot is \", mdx(\"inlineCode\", {\n parentName: \"p\"\n }, \"ready\"), \". Then the bot will edit the bots status every 5 seconds. Notice, that Discordeno provides a nice clean util function to choose a random item from an array. You also have beautiful enums provided that prevent you from making any typos/mistakes.\"), mdx(\"p\", null, \"We have now converted the entire \", mdx(\"inlineCode\", {\n parentName: \"p\"\n }, \"main.js\"), \" file, in a matter of seconds. The Discordeno official generator took care of the majority of workload and we just modified the \", mdx(\"inlineCode\", {\n parentName: \"p\"\n }, \"ready.ts\"), \" file.\"), mdx(\"p\", null, mdx(\"inlineCode\", {\n parentName: \"p\"\n }, \"Note:\"), \" I did remove some generally well known \\\"bad practices\\\" such as global vars and such. Overall, you will see the functionality of the project will not change as we progress through this guide.\"), mdx(\"h2\", null, \"Converting Commands\"), mdx(\"p\", null, \"The first command in the commands folder is the \", mdx(\"inlineCode\", {\n parentName: \"p\"\n }, \"addRole\"), \" command.\"), mdx(\"p\", null, \"This is the code from the bot:\"), mdx(\"pre\", null, mdx(\"code\", _extends({\n parentName: \"pre\"\n }, {\n \"className\": \"language-ts\"\n }), \"// Getting the 'Command' features from Commando\\nconst { Command } = require('discord.js-commando')\\n\\n// Code for the command\\nmodule.exports = class addRoleCommand extends Command {\\n constructor (client) {\\n super(client, {\\n // name of the command, must be in lowercase\\n name: 'addrole',\\n // other ways to call the command, must be in lowercase\\n aliases: ['role'],\\n // command group its part of\\n group: 'mod',\\n // name within the command group, must be in lowercase\\n memberName: 'addrole',\\n // Is the description used for 'help' command\\n description: 'Adds mentioned role to mentioned user.',\\n // Prevents it from being used in dms\\n guildOnly: true,\\n // Permissions, list found here > `discord.js.org/#/docs/main/11.5.1/class/Permissions?scrollTo=s-FLAGS`\\n clientPermissions: ['ADMINISTRATOR', 'MANAGE_ROLES'],\\n userPermissions: ['MANAGE_ROLES'],\\n // Prevents anyone other than owner to use the command\\n ownerOnly: false\\n })\\n }\\n\\n // Run code goes here\\n run (message) {\\n const user = message.mentions.members.first()\\n const roleToAdd = message.mentions.roles.first()\\n\\n // checking to see if the user has the role or not\\n if (!(user.roles.find(r => r.name === roleToAdd.name))) {\\n user.addRole(roleToAdd)\\n message.channel.send(`${user} has been given the role: ${roleToAdd.name}`)\\n .then(msg => {\\n msg.delete(5000)\\n })\\n } else {\\n message.channel.send(`${user} already has the role: ${roleToAdd.name}`)\\n }\\n\\n // console.error(user, roleToAdd, message.member.roles.find(r => r.name === roleToAdd));\\n }\\n}\\n\")), mdx(\"p\", null, \"This is how to do it with Discordeno:\"), mdx(\"pre\", null, mdx(\"code\", _extends({\n parentName: \"pre\"\n }, {\n \"className\": \"language-ts\"\n }), \"import { botCache } from \\\"../../mod.ts\\\";\\nimport { addRole } from \\\"https://raw.githubusercontent.com/Skillz4Killz/Discordeno/v7/src/handlers/member.ts\\\";\\nimport { sendAlertResponse, sendResponse } from \\\"../utils/helpers.ts\\\";\\n\\nbotCache.commands.set(`addrole`, {\\n // Is the description used for 'help' command\\n description: \\\"Adds mentioned role to mentioned user.\\\",\\n // Prevents it from being used in dms\\n guildOnly: true,\\n botServerPermissions: [\\\"ADMINISTRATOR\\\", \\\"MANAGE_ROLES\\\"],\\n userServerPermissions: [\\\"MANAGE_ROLES\\\"],\\n execute: (message, _args, guild) => {\\n const [member] = message.mentions();\\n const [roleIDToAdd] = message.mentionRoles;\\n const role = guild?.roles.get(roleIDToAdd)\\n\\n // checking to see if the user has the role or not\\n if (!member.roles.includes(roleIDToAdd)) {\\n addRole(guild!, member.user.id, roleIDToAdd)\\n sendAlertResponse(message, `has been given the role: ${role!.name}`, 5);\\n } else {\\n sendResponse(message, `already has the role: ${role!.name}`)\\n }\\n }\\n});\\n\\n// other ways to call the command\\ncreateCommandAliases(\\\"role\\\", \\\"addrole\\\");\\n\")), mdx(\"p\", null, \"Awesome, that is a full command converted from Discord.JS to Discordeno. See how easy it is! Let's convert one more command to see how to really take full advantage of Discordeno boilerplate and have something amazing.\"), mdx(\"p\", null, \"Discord.JS Kick Command Version\"), mdx(\"pre\", null, mdx(\"code\", _extends({\n parentName: \"pre\"\n }, {\n \"className\": \"language-js\"\n }), \"// Getting the 'Command' features from Commando\\nconst { Command } = require('discord.js-commando')\\nconst { RichEmbed } = require('discord.js')\\nconst chalk = require('chalk')\\nconst log = console.log\\n\\n// Code for the command\\nmodule.exports = class kickCommand extends Command {\\n constructor (client) {\\n super(client, {\\n // name of the command, must be in lowercase\\n name: 'kick',\\n // other ways to call the command, must be in lowercase\\n aliases: ['boot', 'tempban'],\\n // command group its part of\\n group: 'mod',\\n // name within the command group, must be in lowercase\\n memberName: 'kick',\\n // Is the description used for 'help' command\\n description: 'Kick command.',\\n // adds cooldowns to the command\\n throttling: {\\n // usages in certain time x\\n usages: 1,\\n // the cooldown\\n duration: 10\\n },\\n // Prevents it from being used in dms\\n guildOnly: true,\\n // Permissions, list found here > `discord.js.org/#/docs/main/11.5.1/class/Permissions?scrollTo=s-FLAGS`\\n clientPermissions: ['ADMINISTRATOR'],\\n userPermissions: ['KICK_MEMBERS'],\\n // Prevents anyone other than owner to use the command\\n ownerOnly: false\\n\\n })\\n }\\n\\n // Run code goes here\\n run (message) {\\n const messageArry = message.content.split(' ')\\n const args = messageArry.slice(1)\\n\\n const kUser = message.guild.member(message.mentions.users.first() || message.guild.get(args[0]))\\n if (!kUser) return message.channel.send('User cannot be found!')\\n const kreason = args.join(' ').slice(22)\\n\\n // setting up the embed for report/log\\n const kickEmbed = new RichEmbed()\\n .setDescription(`Report: ${kUser} Kick`)\\n .addField('Reason >', `${kreason}`)\\n .addField('Time', message.createdAt)\\n\\n const reportchannel = message.guild.channels.find('name', 'report')\\n if (!reportchannel) return message.channel.send('*`Report channel cannot be found!`*')\\n\\n // Delete the message command\\n // eslint-disable-next-line camelcase\\n message.delete().catch(O_o => {})\\n // Kick the user with reason\\n message.guild.member(kUser).kick(kreason)\\n // sends the kick report into log/report\\n reportchannel.send(kickEmbed)\\n // Logs the kick into the terminal\\n log(chalk.red('KICK', chalk.underline.bgBlue(kUser) + '!'))\\n }\\n}\\n\")), mdx(\"p\", null, \"Discordeno Version\"), mdx(\"pre\", null, mdx(\"code\", _extends({\n parentName: \"pre\"\n }, {\n \"className\": \"language-ts\"\n }), \"import { sendMessage } from \\\"https://raw.githubusercontent.com/Skillz4Killz/Discordeno/v7/src/handlers/channel.ts\\\";\\nimport { Member } from \\\"https://raw.githubusercontent.com/Skillz4Killz/Discordeno/v7/src/structures/member.ts\\\";\\nimport { kick } from \\\"https://raw.githubusercontent.com/Skillz4Killz/Discordeno/v7/src/handlers/member.ts\\\";\\nimport { deleteMessage } from \\\"https://raw.githubusercontent.com/Skillz4Killz/Discordeno/v7/src/handlers/message.ts\\\";\\nimport { botCache } from \\\"../../mod.ts\\\";\\nimport { createCommandAliases, sendResponse } from \\\"../utils/helpers.ts\\\";\\nimport { Embed } from \\\"../utils/Embed.ts\\\";\\nimport { Args } from \\\"../types/commands.ts\\\";\\n\\nbotCache.commands.set(`kick`, {\\n name: `kick`,\\n description: \\\"Kick command.\\\",\\n // adds cooldowns to the command\\n cooldown: {\\n // usages in certain duration of seconds below\\n allowedUses: 1,\\n // the cooldown\\n seconds: 10,\\n },\\n // Prevents it from being used in dms\\n guildOnly: true,\\n botServerPermissions: [\\\"ADMINISTRATOR\\\"],\\n userServerPermissions: [\\\"KICK_MEMBERS\\\"],\\n arguments: [\\n {\\n name: \\\"member\\\",\\n type: \\\"member\\\",\\n missing: function (message) {\\n sendResponse(message, `User cannot be found.`);\\n },\\n // By default this is true but for the purpose of the guide so you can see this exists.\\n required: true,\\n },\\n {\\n name: \\\"reason\\\",\\n // The leftover string provided by the user that was not used by previous args.\\n type: \\\"...string\\\",\\n defaultValue: \\\"No reason provided.\\\",\\n // It is silly to lowercase this but for the purpose of the guide you can see that this is also available to you.\\n lowercase: true,\\n },\\n ],\\n execute: function (message, args: KickArgs, guild) {\\n if (!guild) return;\\n // setting up the embed for report/log\\n const embed = new Embed()\\n .setDescription(`Report: ${args.member.mention} Kick`)\\n .addField(\\\"Reason >\\\", args.reason)\\n .addField(\\\"Time\\\", message.timestamp.toString());\\n\\n const reportchannel = guild.channels.find((channel) =>\\n channel.name === \\\"report\\\"\\n );\\n if (!reportchannel) {\\n return sendResponse(message, \\\"*`Report channel cannot be found!`*\\\");\\n }\\n\\n // Delete the message command\\n deleteMessage(message, \\\"Remove kick command trigger.\\\");\\n // Kick the user with reason\\n kick(guild, args.member.user.id, args.reason);\\n // sends the kick report into log/report\\n sendMessage(reportchannel, embed);\\n },\\n});\\n\\n// other ways to call the command, must be in lowercase\\ncreateCommandAliases(\\\"kick\\\", [\\\"boot\\\", \\\"tempban\\\"]);\\n\\ninterface KickArgs {\\n member: Member;\\n reason: string;\\n}\\n\")), mdx(\"p\", null, \"Let's take a minute and explain the differences here. The first thing you will probably notice is different is the \", mdx(\"inlineCode\", {\n parentName: \"p\"\n }, \"arguments\"), \" property. Discordeno provides the \", mdx(\"inlineCode\", {\n parentName: \"p\"\n }, \"arguments\"), \" property because it provides argument handling/parsing/validating internally. You don't need to be splitting the message content or going through and validating it yourself. All you do is tell Discordeno that you want a member and a reason. It will do the magic and hard work to get you that data before you even run the command. You just do \", mdx(\"inlineCode\", {\n parentName: \"p\"\n }, \"args.member\"), \" and you have access to the full member object. You can also see that aliases are created slightly different but it's not that huge a impact. The end functionality is the same. There are a lot more powerful aspects to Discordeno like arguments. Keep diving in and you will find all the wonderful tools available to give you the best developer experience possible.\"), mdx(\"h3\", null, \"Need More Examples/Help\"), mdx(\"p\", null, \"If you still need more help converting other aspects of your bot please contact me at \", mdx(\"a\", _extends({\n parentName: \"p\"\n }, {\n \"href\": \"https://discord.gg/J4NqJ72\"\n }), \"Discord\"), \". I will continue adding more examples to this guide as more people request them.\"));\n}\n;\nMDXContent.isMDXComponent = true;","rawMDXOutput":"/* @jsx mdx */\nimport { mdx } from '@mdx-js/react';\n/* @jsx mdx */\n\nexport const _frontmatter = {\n \"title\": \"Discord.JS to Discordeno Guide\",\n \"metaTitle\": \"Discord.JS to Discordeno | Discordeno\",\n \"metaDescription\": \"This guide will help should you how to convert a Discord.JS bot over to Discordeno.\"\n};\n\nconst layoutProps = {\n _frontmatter\n};\nconst MDXLayout = \"wrapper\"\nexport default function MDXContent({\n components,\n ...props\n}) {\n return \n

{`Understanding The Goals of This Guide`}

\n

{`This guide is not intended to trash or hate on Discord.JS. In fact, Discord.JS is the most popular Node.JS library which is why most users wanting to use Discordeno come from Discord.JS. Today, I had a user ask me for a guide to convert a Discord.JS bot to Discordeno. That was the start of this guide.`}

\n

{`Finding A Open Source Bot`}

\n

{`For the purposes of this guide, I wanted to find a moderation bot that is totally open source to show an example of how to convert the bot to Discordeno. Trying to find one was not easy as most bot's were not using the latest Discord.JS version 12. Trying to find one that was using TypeScript made it even more difficult. My next best solution was to find a moderation bot that was recently updated(showing it is maintained or recently built). The best one I could find was `}{`Zodiac Bot`}{`.`}

\n

{`For the purposes of this guide, I will be using the current `}{`latest commit`}

\n

{`Preparations`}

\n
    \n
  • \n

    {`First, create a Discordeno Bot using the `}{`Generator Boilerplate`}{` I will name it Zodiac.`}

    \n
  • \n
  • \n

    {`Then `}{`git clone https://github.com/Skillz4Killz/Zodiac.git`}

    \n
  • \n
\n

{`Now that I had the repository cloned, I could begin. Note that although the bot we are converting is built in JavaScript, I converted all code to TypeScript in this Guide as Discordeno is designed to be the best lib for TypeScript developers.`}

\n

{`Time to get started!`}

\n

{`Converting main.js (index file)`}

\n

{`The first thing is to convert the `}{`main.js`}{` file which would be the app.js or index.js file. This is the file that is run to start your bot. In this case, the bot developer chose `}{`main.js`}{`. In Deno, the initial file is named `}{`mod.ts`}{` so we can go ahead and opt for the Deno pattern. Note: there is already a `}{`mod.ts`}{` file created and prebuilt entirely using the Generator.`}

\n

{`Current Discord.JS Code:`}

\n
{`/* Keeping this to shoutout/credit the original author <3\n* @author: nukestye\n*/\n\nconst config = require('./config.json')\nconst fs = require('fs')\nconst log = console.log\n\n// Setting up the way to get commands\nconst { CommandoClient } = require('discord.js-commando')\nconst path = require('path')\n\n// reading events\nfs.readdir('./src/events/', (err, files) => {\n  if (err) return console.error(err)\n  files.forEach((file) => {\n    const eventFunction = require(\\`./src/events/\\${file}\\`)\n    if (eventFunction.disabled) return\n    const event = eventFunction.event || file.split('.')[0]\n    const emitter = (typeof eventFunction.emitter === 'string' ? client[eventFunction.emitter] : eventFunction.emitter) || client\n    const { once } = eventFunction\n    try {\n      emitter[once ? 'once' : 'on'](event, (...args) => eventFunction.run(...args))\n    } catch (error) {\n      console.error(error.stack)\n    }\n  })\n})\n\nconst client = global.client = new CommandoClient({\n  commandPrefix: \\`\\${config.prefix}\\`,\n  owner: \\`\\${config.owner}\\`,\n  invite: \\`\\${config.discord}\\`,\n  unknownCommandResponse: false\n})\n\n// Registing the commands\nclient.registry\n  .registerDefaultTypes()\n// The different fields for cmds\n  .registerGroups([\n    ['mod', 'Moderation Commands'],\n    ['public', 'Public Commands']\n  ])\n  .registerDefaultGroups()\n// Basic cmds can be disabled like {\"cmd: false\"}\n  .registerDefaultCommands()\n// commands in \"/src/commands\" will be counted\n  .registerCommandsIn(path.join(__dirname, '/src/commands'))\n\n// list of activities that the bot goes through\nconst activityArray = [\\`\\${config.prefix}help | \\`]\n// Bot lanuch code\nclient.once('ready', () => {\n  log(\\`Logged in as \\${client.user.tag} in \\${client.guilds.size} guild(s)!\\`)\n  setInterval(() => {\n    const index = Math.floor(Math.random() * (activityArray.length)) // generates a random number between 1 and the length of the activities array list\n    client.user.setActivity(\n      activityArray[index],\n      {\n        type: 'PLAYING'\n      }) // sets bot\"s activities to one of the phrases in the arraylist.\n  }, 5000) // updates every 10000ms = 10s\n})\n// If an error print it out\nclient.on('error', console.error)\n\n// Login in using the token in config\nclient.login(config.env.TOKEN)\n`}
\n

{`Discordeno Version:`}

\n
{`import Client, {\n  updateEventHandlers,\n} from \"https://raw.githubusercontent.com/Skillz4Killz/Discordeno/v7/src/module/client.ts\";\nimport { configs } from \"./configs.ts\";\nimport { Intents } from \"https://raw.githubusercontent.com/Skillz4Killz/Discordeno/v7/src/types/options.ts\";\nimport { eventHandlers } from \"./src/events/eventHandlers.ts\";\nimport { Message } from \"https://raw.githubusercontent.com/Skillz4Killz/Discordeno/v7/src/structures/message.ts\";\nimport { Command } from \"./src/types/commands.ts\";\nimport { Guild } from \"https://raw.githubusercontent.com/Skillz4Killz/Discordeno/v7/src/structures/guild.ts\";\n\nexport const botCache = {\n  commands: new Map(),\n  commandAliases: new Map(),\n  guildPrefixes: new Map(),\n  inhibitors: new Map<\n    string,\n    (message: Message, command: Command, guild?: Guild) => boolean\n    >(),\n    eventHandlers: {} as EventHandlers\n};\n\nconst importDirectory = async (path: string) => {\n  const files = Deno.readDirSync(Deno.realPathSync(path));\n\n  for (const file of files) {\n    if (!file.name) continue;\n\n    const currentPath = \\`\\${path}/\\${file.name}\\`;\n    if (file.isFile) {\n      await import(currentPath);\n      continue;\n    }\n\n    importDirectory(currentPath);\n  }\n};\n\n// Forces deno to read all the files which will fill the commands/inhibitors cache etc.\nawait Promise.all(\n  [\"./src/commands\", \"./src/inhibitors\", \"./src/events\"].map((path) => importDirectory(path)),\n);\n\n\nClient({\n  token: configs.token,\n  // Pick the intents you wish to have for your bot.\n    intents: [Intents.GUILDS, Intents.GUILD_MESSAGES],\n    eventHandlers: botCache.eventHandlers\n});\n`}
\n

{`Something we haven't converted yet from the `}{`main.js`}{` files is the event listeners. To do that, we will open up the events folder and find the corresponding event or create it if necessary. In this case, we have the `}{`ready`}{` event and there is already a `}{`ready.ts`}{` file. We can just use that.`}

\n

{`In our `}{`ready.ts`}{` file we can add the `}{`ready`}{` event listener.`}

\n
{`import { botCache } from \"../../mod.ts\";\nimport { configs } from \"../../configs.ts\";\nimport { cache } from \"https://raw.githubusercontent.com/Skillz4Killz/Discordeno/v7/src/utils/cache.ts\";\nimport { editBotsStatus, chooseRandom } from \"https://raw.githubusercontent.com/Skillz4Killz/Discordeno/v7/src/utils/utils.ts\";\nimport { StatusType } from \"https://raw.githubusercontent.com/Skillz4Killz/Discordeno/v7/src/types/discord.ts\";\nimport { ActivityType } from \"https://raw.githubusercontent.com/Skillz4Killz/Discordeno/v7/src/types/activity.ts\";\n\nbotCache.eventHandlers.ready = function () {\n  console.log(\\`[READY] Bot is online and ready in \\${cache.guilds.size} guild(s)!\\`);\n\n  // list of activities that the bot goes through\n  const activityArray = [\\`\\${configs.prefix}help | \\`];\n  setInterval(() => {\n    editBotsStatus(StatusType.Online, chooseRandom(activityArray), ActivityType.Game)\n  }, 5000)\n};\n`}
\n

{`To understand this code, we are setting a function to be run when the bot is `}{`ready`}{`. Then the bot will edit the bots status every 5 seconds. Notice, that Discordeno provides a nice clean util function to choose a random item from an array. You also have beautiful enums provided that prevent you from making any typos/mistakes.`}

\n

{`We have now converted the entire `}{`main.js`}{` file, in a matter of seconds. The Discordeno official generator took care of the majority of workload and we just modified the `}{`ready.ts`}{` file.`}

\n

{`Note:`}{` I did remove some generally well known \"bad practices\" such as global vars and such. Overall, you will see the functionality of the project will not change as we progress through this guide.`}

\n

{`Converting Commands`}

\n

{`The first command in the commands folder is the `}{`addRole`}{` command.`}

\n

{`This is the code from the bot:`}

\n
{`// Getting the 'Command' features from Commando\nconst { Command } = require('discord.js-commando')\n\n// Code for the command\nmodule.exports = class addRoleCommand extends Command {\n  constructor (client) {\n    super(client, {\n      // name of the command, must be in lowercase\n      name: 'addrole',\n      // other ways to call the command, must be in lowercase\n      aliases: ['role'],\n      // command group its part of\n      group: 'mod',\n      // name within the command group, must be in lowercase\n      memberName: 'addrole',\n      // Is the description used for 'help' command\n      description: 'Adds mentioned role to mentioned user.',\n      // Prevents it from being used in dms\n      guildOnly: true,\n      // Permissions, list found here > \\`discord.js.org/#/docs/main/11.5.1/class/Permissions?scrollTo=s-FLAGS\\`\n      clientPermissions: ['ADMINISTRATOR', 'MANAGE_ROLES'],\n      userPermissions: ['MANAGE_ROLES'],\n      // Prevents anyone other than owner to use the command\n      ownerOnly: false\n    })\n  }\n\n  // Run code goes here\n  run (message) {\n    const user = message.mentions.members.first()\n    const roleToAdd = message.mentions.roles.first()\n\n    // checking to see if the user has the role or not\n    if (!(user.roles.find(r => r.name === roleToAdd.name))) {\n      user.addRole(roleToAdd)\n      message.channel.send(\\`\\${user} has been given the role: \\${roleToAdd.name}\\`)\n        .then(msg => {\n          msg.delete(5000)\n        })\n    } else {\n      message.channel.send(\\`\\${user} already has the role: \\${roleToAdd.name}\\`)\n    }\n\n    // console.error(user, roleToAdd, message.member.roles.find(r => r.name === roleToAdd));\n  }\n}\n`}
\n

{`This is how to do it with Discordeno:`}

\n
{`import { botCache } from \"../../mod.ts\";\nimport { addRole } from \"https://raw.githubusercontent.com/Skillz4Killz/Discordeno/v7/src/handlers/member.ts\";\nimport { sendAlertResponse, sendResponse } from \"../utils/helpers.ts\";\n\nbotCache.commands.set(\\`addrole\\`, {\n  // Is the description used for 'help' command\n  description: \"Adds mentioned role to mentioned user.\",\n  // Prevents it from being used in dms\n  guildOnly: true,\n  botServerPermissions: [\"ADMINISTRATOR\", \"MANAGE_ROLES\"],\n  userServerPermissions: [\"MANAGE_ROLES\"],\n  execute: (message, _args, guild) => {\n    const [member] = message.mentions();\n    const [roleIDToAdd] = message.mentionRoles;\n        const role = guild?.roles.get(roleIDToAdd)\n\n    // checking to see if the user has the role or not\n    if (!member.roles.includes(roleIDToAdd)) {\n            addRole(guild!, member.user.id, roleIDToAdd)\n            sendAlertResponse(message, \\`has been given the role: \\${role!.name}\\`, 5);\n    } else {\n            sendResponse(message, \\`already has the role: \\${role!.name}\\`)\n    }\n  }\n});\n\n// other ways to call the command\ncreateCommandAliases(\"role\", \"addrole\");\n`}
\n

{`Awesome, that is a full command converted from Discord.JS to Discordeno. See how easy it is! Let's convert one more command to see how to really take full advantage of Discordeno boilerplate and have something amazing.`}

\n

{`Discord.JS Kick Command Version`}

\n
{`// Getting the 'Command' features from Commando\nconst { Command } = require('discord.js-commando')\nconst { RichEmbed } = require('discord.js')\nconst chalk = require('chalk')\nconst log = console.log\n\n// Code for the command\nmodule.exports = class kickCommand extends Command {\n  constructor (client) {\n    super(client, {\n      // name of the command, must be in lowercase\n      name: 'kick',\n      // other ways to call the command, must be in lowercase\n      aliases: ['boot', 'tempban'],\n      // command group its part of\n      group: 'mod',\n      // name within the command group, must be in lowercase\n      memberName: 'kick',\n      // Is the description used for 'help' command\n      description: 'Kick command.',\n      // adds cooldowns to the command\n      throttling: {\n        // usages in certain time x\n        usages: 1,\n        // the cooldown\n        duration: 10\n      },\n      // Prevents it from being used in dms\n      guildOnly: true,\n      // Permissions, list found here > \\`discord.js.org/#/docs/main/11.5.1/class/Permissions?scrollTo=s-FLAGS\\`\n      clientPermissions: ['ADMINISTRATOR'],\n      userPermissions: ['KICK_MEMBERS'],\n      // Prevents anyone other than owner to use the command\n      ownerOnly: false\n\n    })\n  }\n\n  // Run code goes here\n  run (message) {\n    const messageArry = message.content.split(' ')\n    const args = messageArry.slice(1)\n\n    const kUser = message.guild.member(message.mentions.users.first() || message.guild.get(args[0]))\n    if (!kUser) return message.channel.send('User cannot be found!')\n    const kreason = args.join(' ').slice(22)\n\n    // setting up the embed for report/log\n    const kickEmbed = new RichEmbed()\n      .setDescription(\\`Report: \\${kUser} Kick\\`)\n      .addField('Reason >', \\`\\${kreason}\\`)\n      .addField('Time', message.createdAt)\n\n    const reportchannel = message.guild.channels.find('name', 'report')\n    if (!reportchannel) return message.channel.send('*\\`Report channel cannot be found!\\`*')\n\n    // Delete the message command\n    // eslint-disable-next-line camelcase\n    message.delete().catch(O_o => {})\n    // Kick the user with reason\n    message.guild.member(kUser).kick(kreason)\n    // sends the kick report into log/report\n    reportchannel.send(kickEmbed)\n    // Logs the kick into the terminal\n    log(chalk.red('KICK', chalk.underline.bgBlue(kUser) + '!'))\n  }\n}\n`}
\n

{`Discordeno Version`}

\n
{`import { sendMessage } from \"https://raw.githubusercontent.com/Skillz4Killz/Discordeno/v7/src/handlers/channel.ts\";\nimport { Member } from \"https://raw.githubusercontent.com/Skillz4Killz/Discordeno/v7/src/structures/member.ts\";\nimport { kick } from \"https://raw.githubusercontent.com/Skillz4Killz/Discordeno/v7/src/handlers/member.ts\";\nimport { deleteMessage } from \"https://raw.githubusercontent.com/Skillz4Killz/Discordeno/v7/src/handlers/message.ts\";\nimport { botCache } from \"../../mod.ts\";\nimport { createCommandAliases, sendResponse } from \"../utils/helpers.ts\";\nimport { Embed } from \"../utils/Embed.ts\";\nimport { Args } from \"../types/commands.ts\";\n\nbotCache.commands.set(\\`kick\\`, {\n  name: \\`kick\\`,\n  description: \"Kick command.\",\n  // adds cooldowns to the command\n  cooldown: {\n    // usages in certain duration of seconds below\n    allowedUses: 1,\n    // the cooldown\n    seconds: 10,\n  },\n  // Prevents it from being used in dms\n  guildOnly: true,\n  botServerPermissions: [\"ADMINISTRATOR\"],\n  userServerPermissions: [\"KICK_MEMBERS\"],\n  arguments: [\n    {\n      name: \"member\",\n      type: \"member\",\n      missing: function (message) {\n        sendResponse(message, \\`User cannot be found.\\`);\n      },\n      // By default this is true but for the purpose of the guide so you can see this exists.\n      required: true,\n    },\n    {\n      name: \"reason\",\n      // The leftover string provided by the user that was not used by previous args.\n      type: \"...string\",\n      defaultValue: \"No reason provided.\",\n      // It is silly to lowercase this but for the purpose of the guide you can see that this is also available to you.\n      lowercase: true,\n    },\n  ],\n  execute: function (message, args: KickArgs, guild) {\n    if (!guild) return;\n    // setting up the embed for report/log\n    const embed = new Embed()\n      .setDescription(\\`Report: \\${args.member.mention} Kick\\`)\n      .addField(\"Reason >\", args.reason)\n      .addField(\"Time\", message.timestamp.toString());\n\n    const reportchannel = guild.channels.find((channel) =>\n      channel.name === \"report\"\n    );\n    if (!reportchannel) {\n      return sendResponse(message, \"*\\`Report channel cannot be found!\\`*\");\n    }\n\n    // Delete the message command\n    deleteMessage(message, \"Remove kick command trigger.\");\n    // Kick the user with reason\n    kick(guild, args.member.user.id, args.reason);\n    // sends the kick report into log/report\n    sendMessage(reportchannel, embed);\n  },\n});\n\n// other ways to call the command, must be in lowercase\ncreateCommandAliases(\"kick\", [\"boot\", \"tempban\"]);\n\ninterface KickArgs {\n  member: Member;\n  reason: string;\n}\n`}
\n

{`Let's take a minute and explain the differences here. The first thing you will probably notice is different is the `}{`arguments`}{` property. Discordeno provides the `}{`arguments`}{` property because it provides argument handling/parsing/validating internally. You don't need to be splitting the message content or going through and validating it yourself. All you do is tell Discordeno that you want a member and a reason. It will do the magic and hard work to get you that data before you even run the command. You just do `}{`args.member`}{` and you have access to the full member object. You can also see that aliases are created slightly different but it's not that huge a impact. The end functionality is the same. There are a lot more powerful aspects to Discordeno like arguments. Keep diving in and you will find all the wonderful tools available to give you the best developer experience possible.`}

\n

{`Need More Examples/Help`}

\n

{`If you still need more help converting other aspects of your bot please contact me at `}{`Discord`}{`. I will continue adding more examples to this guide as more people request them.`}

\n\n
;\n}\n\n;\nMDXContent.isMDXComponent = true;"}} \ No newline at end of file diff --git a/docs/.cache/caches/gatsby-plugin-mdx/diskstore-3fa301ca43ce78de093cd98ece436062.json b/docs/.cache/caches/gatsby-plugin-mdx/diskstore-3fa301ca43ce78de093cd98ece436062.json new file mode 100644 index 000000000..98a33d52d --- /dev/null +++ b/docs/.cache/caches/gatsby-plugin-mdx/diskstore-3fa301ca43ce78de093cd98ece436062.json @@ -0,0 +1 @@ +{"expireTime":9007200851634065000,"key":"gatsby-plugin-mdx-entire-payload-4efe60f1f50b96ac86d3b14e88072f26-","val":{"mdast":{"type":"root","children":[{"type":"paragraph","children":[{"type":"text","value":"Woah! You are almost half way done with understanding all of Discordeno. Amazing isn't it? Something you may have noticed in the last section was there were some options that prevented some commands from running like ","position":{"start":{"line":2,"column":1,"offset":1},"end":{"line":2,"column":218,"offset":218},"indent":[]}},{"type":"inlineCode","value":"dmOnly","position":{"start":{"line":2,"column":218,"offset":218},"end":{"line":2,"column":226,"offset":226},"indent":[]}},{"type":"text","value":" or the permission options. we created a setting to prevent the monitor from running in certain channels. What if we wanted to do prevent commands from happening? How would we prevent commands from running?","position":{"start":{"line":2,"column":226,"offset":226},"end":{"line":2,"column":432,"offset":432},"indent":[]}}],"position":{"start":{"line":2,"column":1,"offset":1},"end":{"line":2,"column":432,"offset":432},"indent":[]}},{"type":"heading","depth":2,"children":[{"type":"text","value":"What is an Inhibitor?","position":{"start":{"line":4,"column":4,"offset":437},"end":{"line":4,"column":25,"offset":458},"indent":[]}}],"position":{"start":{"line":4,"column":1,"offset":434},"end":{"line":4,"column":25,"offset":458},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"An Inhibitor is very similar to how monitors work. A monitor runs on every message but an inhibitor runs on every command. Remember all those command options like cooldown, permissions, permissionLevel, nsfw, etc... Each and every one of these options has an inhibitor in that checks commands for these settings.","position":{"start":{"line":6,"column":1,"offset":460},"end":{"line":6,"column":313,"offset":772},"indent":[]}}],"position":{"start":{"line":6,"column":1,"offset":460},"end":{"line":6,"column":313,"offset":772},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"Let's create our own inhibitor that would prevent commands from being used if the user is not a VIP user.","position":{"start":{"line":8,"column":1,"offset":774},"end":{"line":8,"column":106,"offset":879},"indent":[]}}],"position":{"start":{"line":8,"column":1,"offset":774},"end":{"line":8,"column":106,"offset":879},"indent":[]}},{"type":"blockquote","children":[{"type":"paragraph","children":[{"type":"strong","children":[{"type":"text","value":"Note:","position":{"start":{"line":10,"column":5,"offset":885},"end":{"line":10,"column":10,"offset":890},"indent":[]}}],"position":{"start":{"line":10,"column":3,"offset":883},"end":{"line":10,"column":12,"offset":892},"indent":[]}},{"type":"text","value":" It is important to remember that everything below can be done with a simple permission level as well. We will create our own custom permission levels but for the purposes of this guide and to be able to learn about Inhibitors, we will be using an inhibitor.","position":{"start":{"line":10,"column":12,"offset":892},"end":{"line":10,"column":270,"offset":1150},"indent":[]}}],"position":{"start":{"line":10,"column":3,"offset":883},"end":{"line":10,"column":270,"offset":1150},"indent":[]}}],"position":{"start":{"line":10,"column":1,"offset":881},"end":{"line":10,"column":270,"offset":1150},"indent":[]}},{"type":"heading","depth":2,"children":[{"type":"text","value":"Creating the File","position":{"start":{"line":12,"column":4,"offset":1155},"end":{"line":12,"column":21,"offset":1172},"indent":[]}}],"position":{"start":{"line":12,"column":1,"offset":1152},"end":{"line":12,"column":21,"offset":1172},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"Let's start by creating a file inside the inhibitors folder called ","position":{"start":{"line":14,"column":1,"offset":1174},"end":{"line":14,"column":68,"offset":1241},"indent":[]}},{"type":"inlineCode","value":"boostRequired.ts","position":{"start":{"line":14,"column":68,"offset":1241},"end":{"line":14,"column":86,"offset":1259},"indent":[]}},{"type":"text","value":" and paste the following snippet of code:","position":{"start":{"line":14,"column":86,"offset":1259},"end":{"line":14,"column":127,"offset":1300},"indent":[]}}],"position":{"start":{"line":14,"column":1,"offset":1174},"end":{"line":14,"column":127,"offset":1300},"indent":[]}},{"type":"code","lang":"ts","meta":null,"value":"import { botCache } from \"../../mod.ts\";\n\nbotCache.inhibitors.set(\"inhibitorname\", async function (message, command, guild) {\n\t// Your code goes here\n});","position":{"start":{"line":16,"column":1,"offset":1302},"end":{"line":22,"column":4,"offset":1465},"indent":[1,1,1,1,1,1]}},{"type":"paragraph","children":[{"type":"text","value":"Inhibitors can take up to 3 arguments.","position":{"start":{"line":24,"column":1,"offset":1467},"end":{"line":24,"column":39,"offset":1505},"indent":[]}}],"position":{"start":{"line":24,"column":1,"offset":1467},"end":{"line":24,"column":39,"offset":1505},"indent":[]}},{"type":"list","ordered":false,"start":null,"spread":false,"children":[{"type":"listItem","spread":false,"checked":null,"children":[{"type":"paragraph","children":[{"type":"inlineCode","value":"message","position":{"start":{"line":26,"column":3,"offset":1509},"end":{"line":26,"column":12,"offset":1518},"indent":[]}},{"type":"text","value":": The message object that triggered the command.","position":{"start":{"line":26,"column":12,"offset":1518},"end":{"line":26,"column":60,"offset":1566},"indent":[]}}],"position":{"start":{"line":26,"column":3,"offset":1509},"end":{"line":26,"column":60,"offset":1566},"indent":[]}}],"position":{"start":{"line":26,"column":1,"offset":1507},"end":{"line":26,"column":60,"offset":1566},"indent":[]}},{"type":"listItem","spread":false,"checked":null,"children":[{"type":"paragraph","children":[{"type":"inlineCode","value":"command","position":{"start":{"line":27,"column":3,"offset":1569},"end":{"line":27,"column":12,"offset":1578},"indent":[]}},{"type":"text","value":": The command object itself that was triggered.","position":{"start":{"line":27,"column":12,"offset":1578},"end":{"line":27,"column":59,"offset":1625},"indent":[]}}],"position":{"start":{"line":27,"column":3,"offset":1569},"end":{"line":27,"column":59,"offset":1625},"indent":[]}}],"position":{"start":{"line":27,"column":1,"offset":1567},"end":{"line":27,"column":59,"offset":1625},"indent":[]}},{"type":"listItem","spread":false,"checked":null,"children":[{"type":"paragraph","children":[{"type":"inlineCode","value":"guild","position":{"start":{"line":28,"column":3,"offset":1628},"end":{"line":28,"column":10,"offset":1635},"indent":[]}},{"type":"text","value":": The server guild object where this command was ran.","position":{"start":{"line":28,"column":10,"offset":1635},"end":{"line":28,"column":63,"offset":1688},"indent":[]}}],"position":{"start":{"line":28,"column":3,"offset":1628},"end":{"line":28,"column":63,"offset":1688},"indent":[]}}],"position":{"start":{"line":28,"column":1,"offset":1626},"end":{"line":28,"column":63,"offset":1688},"indent":[]}}],"position":{"start":{"line":26,"column":1,"offset":1507},"end":{"line":28,"column":63,"offset":1688},"indent":[1,1]}},{"type":"heading","depth":2,"children":[{"type":"text","value":"Understanding How Inhibitors Function","position":{"start":{"line":30,"column":4,"offset":1693},"end":{"line":30,"column":41,"offset":1730},"indent":[]}}],"position":{"start":{"line":30,"column":1,"offset":1690},"end":{"line":30,"column":41,"offset":1730},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"To block a command you have to return a truthy value.","position":{"start":{"line":32,"column":1,"offset":1732},"end":{"line":32,"column":54,"offset":1785},"indent":[]}}],"position":{"start":{"line":32,"column":1,"offset":1732},"end":{"line":32,"column":54,"offset":1785},"indent":[]}},{"type":"list","ordered":false,"start":null,"spread":false,"children":[{"type":"listItem","spread":false,"checked":null,"children":[{"type":"paragraph","children":[{"type":"strong","children":[{"type":"text","value":"return true;","position":{"start":{"line":33,"column":5,"offset":1790},"end":{"line":33,"column":17,"offset":1802},"indent":[]}}],"position":{"start":{"line":33,"column":3,"offset":1788},"end":{"line":33,"column":19,"offset":1804},"indent":[]}},{"type":"text","value":" If you return true the inhibitor will block the execution of the command.\nTo allow a command return a falsey value.","position":{"start":{"line":33,"column":19,"offset":1804},"end":{"line":34,"column":42,"offset":1920},"indent":[1]}}],"position":{"start":{"line":33,"column":3,"offset":1788},"end":{"line":34,"column":42,"offset":1920},"indent":[1]}}],"position":{"start":{"line":33,"column":1,"offset":1786},"end":{"line":34,"column":42,"offset":1920},"indent":[1]}},{"type":"listItem","spread":false,"checked":null,"children":[{"type":"paragraph","children":[{"type":"strong","children":[{"type":"text","value":"return false;","position":{"start":{"line":35,"column":5,"offset":1925},"end":{"line":35,"column":18,"offset":1938},"indent":[]}}],"position":{"start":{"line":35,"column":3,"offset":1923},"end":{"line":35,"column":20,"offset":1940},"indent":[]}},{"type":"text","value":" If you return false the inhibitor will not block the error.","position":{"start":{"line":35,"column":20,"offset":1940},"end":{"line":35,"column":80,"offset":2000},"indent":[]}}],"position":{"start":{"line":35,"column":3,"offset":1923},"end":{"line":35,"column":80,"offset":2000},"indent":[]}}],"position":{"start":{"line":35,"column":1,"offset":1921},"end":{"line":35,"column":80,"offset":2000},"indent":[]}}],"position":{"start":{"line":33,"column":1,"offset":1786},"end":{"line":35,"column":80,"offset":2000},"indent":[1,1]}},{"type":"code","lang":"ts","meta":null,"value":"// If the command does not require a nitro boost we can allow this command to execute\nif (!command.boostRequired) return false;\n\n// Check if the user has boosted this server\nconst userIsVIP = message.member().roles.includes(nitroRoleID)'\n// The user is VIP so we can allow this command to be used\nif (userIsVIP) return false;\n\n// The user is NOT VIP so we throw an error\nthrow `The ${command.name} is only allowed for VIP users.`","position":{"start":{"line":38,"column":1,"offset":2003},"end":{"line":49,"column":4,"offset":2442},"indent":[1,1,1,1,1,1,1,1,1,1,1]}},{"type":"export","value":"export const _frontmatter = {\"title\":\"Creating Inhibitors!\",\"metaTitle\":\"Creating An Inhibitor | Discordeno\",\"metaDescription\":\"Let's create our very own bot with Discordeno!\"}","position":{"start":{"line":52,"column":1,"offset":2445},"end":{"line":52,"column":177,"offset":2621},"indent":[]}}],"position":{"start":{"line":1,"column":1,"offset":0},"end":{"line":52,"column":177,"offset":2621}}},"scopeImports":["import * as React from 'react'"],"scopeIdentifiers":["React"],"body":"function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }\n\nfunction _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }\n\nfunction _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }\n\n/* @jsx mdx */\nvar _frontmatter = {\n \"title\": \"Creating Inhibitors!\",\n \"metaTitle\": \"Creating An Inhibitor | Discordeno\",\n \"metaDescription\": \"Let's create our very own bot with Discordeno!\"\n};\nvar layoutProps = {\n _frontmatter: _frontmatter\n};\nvar MDXLayout = \"wrapper\";\nreturn function MDXContent(_ref) {\n var components = _ref.components,\n props = _objectWithoutProperties(_ref, [\"components\"]);\n\n return mdx(MDXLayout, _extends({}, layoutProps, props, {\n components: components,\n mdxType: \"MDXLayout\"\n }), mdx(\"p\", null, \"Woah! You are almost half way done with understanding all of Discordeno. Amazing isn't it? Something you may have noticed in the last section was there were some options that prevented some commands from running like \", mdx(\"inlineCode\", {\n parentName: \"p\"\n }, \"dmOnly\"), \" or the permission options. we created a setting to prevent the monitor from running in certain channels. What if we wanted to do prevent commands from happening? How would we prevent commands from running?\"), mdx(\"h2\", null, \"What is an Inhibitor?\"), mdx(\"p\", null, \"An Inhibitor is very similar to how monitors work. A monitor runs on every message but an inhibitor runs on every command. Remember all those command options like cooldown, permissions, permissionLevel, nsfw, etc... Each and every one of these options has an inhibitor in that checks commands for these settings.\"), mdx(\"p\", null, \"Let's create our own inhibitor that would prevent commands from being used if the user is not a VIP user.\"), mdx(\"blockquote\", null, mdx(\"p\", {\n parentName: \"blockquote\"\n }, mdx(\"strong\", {\n parentName: \"p\"\n }, \"Note:\"), \" It is important to remember that everything below can be done with a simple permission level as well. We will create our own custom permission levels but for the purposes of this guide and to be able to learn about Inhibitors, we will be using an inhibitor.\")), mdx(\"h2\", null, \"Creating the File\"), mdx(\"p\", null, \"Let's start by creating a file inside the inhibitors folder called \", mdx(\"inlineCode\", {\n parentName: \"p\"\n }, \"boostRequired.ts\"), \" and paste the following snippet of code:\"), mdx(\"pre\", null, mdx(\"code\", _extends({\n parentName: \"pre\"\n }, {\n \"className\": \"language-ts\"\n }), \"import { botCache } from \\\"../../mod.ts\\\";\\n\\nbotCache.inhibitors.set(\\\"inhibitorname\\\", async function (message, command, guild) {\\n // Your code goes here\\n});\\n\")), mdx(\"p\", null, \"Inhibitors can take up to 3 arguments.\"), mdx(\"ul\", null, mdx(\"li\", {\n parentName: \"ul\"\n }, mdx(\"inlineCode\", {\n parentName: \"li\"\n }, \"message\"), \": The message object that triggered the command.\"), mdx(\"li\", {\n parentName: \"ul\"\n }, mdx(\"inlineCode\", {\n parentName: \"li\"\n }, \"command\"), \": The command object itself that was triggered.\"), mdx(\"li\", {\n parentName: \"ul\"\n }, mdx(\"inlineCode\", {\n parentName: \"li\"\n }, \"guild\"), \": The server guild object where this command was ran.\")), mdx(\"h2\", null, \"Understanding How Inhibitors Function\"), mdx(\"p\", null, \"To block a command you have to return a truthy value.\"), mdx(\"ul\", null, mdx(\"li\", {\n parentName: \"ul\"\n }, mdx(\"strong\", {\n parentName: \"li\"\n }, \"return true;\"), \" If you return true the inhibitor will block the execution of the command.\\nTo allow a command return a falsey value.\"), mdx(\"li\", {\n parentName: \"ul\"\n }, mdx(\"strong\", {\n parentName: \"li\"\n }, \"return false;\"), \" If you return false the inhibitor will not block the error.\")), mdx(\"pre\", null, mdx(\"code\", _extends({\n parentName: \"pre\"\n }, {\n \"className\": \"language-ts\"\n }), \"// If the command does not require a nitro boost we can allow this command to execute\\nif (!command.boostRequired) return false;\\n\\n// Check if the user has boosted this server\\nconst userIsVIP = message.member().roles.includes(nitroRoleID)'\\n// The user is VIP so we can allow this command to be used\\nif (userIsVIP) return false;\\n\\n// The user is NOT VIP so we throw an error\\nthrow `The ${command.name} is only allowed for VIP users.`\\n\")));\n}\n;\nMDXContent.isMDXComponent = true;","rawMDXOutput":"/* @jsx mdx */\nimport { mdx } from '@mdx-js/react';\n/* @jsx mdx */\n\nexport const _frontmatter = {\n \"title\": \"Creating Inhibitors!\",\n \"metaTitle\": \"Creating An Inhibitor | Discordeno\",\n \"metaDescription\": \"Let's create our very own bot with Discordeno!\"\n};\n\nconst layoutProps = {\n _frontmatter\n};\nconst MDXLayout = \"wrapper\"\nexport default function MDXContent({\n components,\n ...props\n}) {\n return \n

{`Woah! You are almost half way done with understanding all of Discordeno. Amazing isn't it? Something you may have noticed in the last section was there were some options that prevented some commands from running like `}{`dmOnly`}{` or the permission options. we created a setting to prevent the monitor from running in certain channels. What if we wanted to do prevent commands from happening? How would we prevent commands from running?`}

\n

{`What is an Inhibitor?`}

\n

{`An Inhibitor is very similar to how monitors work. A monitor runs on every message but an inhibitor runs on every command. Remember all those command options like cooldown, permissions, permissionLevel, nsfw, etc... Each and every one of these options has an inhibitor in that checks commands for these settings.`}

\n

{`Let's create our own inhibitor that would prevent commands from being used if the user is not a VIP user.`}

\n
\n

{`Note:`}{` It is important to remember that everything below can be done with a simple permission level as well. We will create our own custom permission levels but for the purposes of this guide and to be able to learn about Inhibitors, we will be using an inhibitor.`}

\n
\n

{`Creating the File`}

\n

{`Let's start by creating a file inside the inhibitors folder called `}{`boostRequired.ts`}{` and paste the following snippet of code:`}

\n
{`import { botCache } from \"../../mod.ts\";\n\nbotCache.inhibitors.set(\"inhibitorname\", async function (message, command, guild) {\n    // Your code goes here\n});\n`}
\n

{`Inhibitors can take up to 3 arguments.`}

\n
    \n
  • {`message`}{`: The message object that triggered the command.`}
  • \n
  • {`command`}{`: The command object itself that was triggered.`}
  • \n
  • {`guild`}{`: The server guild object where this command was ran.`}
  • \n
\n

{`Understanding How Inhibitors Function`}

\n

{`To block a command you have to return a truthy value.`}

\n
    \n
  • {`return true;`}{` If you return true the inhibitor will block the execution of the command.\nTo allow a command return a falsey value.`}
  • \n
  • {`return false;`}{` If you return false the inhibitor will not block the error.`}
  • \n
\n
{`// If the command does not require a nitro boost we can allow this command to execute\nif (!command.boostRequired) return false;\n\n// Check if the user has boosted this server\nconst userIsVIP = message.member().roles.includes(nitroRoleID)'\n// The user is VIP so we can allow this command to be used\nif (userIsVIP) return false;\n\n// The user is NOT VIP so we throw an error\nthrow \\`The \\${command.name} is only allowed for VIP users.\\`\n`}
\n\n
;\n}\n\n;\nMDXContent.isMDXComponent = true;"}} \ No newline at end of file diff --git a/docs/.cache/caches/gatsby-plugin-mdx/diskstore-40a9ecfef4111b17d024b3b7155902db.json b/docs/.cache/caches/gatsby-plugin-mdx/diskstore-40a9ecfef4111b17d024b3b7155902db.json new file mode 100644 index 000000000..58aa3a481 --- /dev/null +++ b/docs/.cache/caches/gatsby-plugin-mdx/diskstore-40a9ecfef4111b17d024b3b7155902db.json @@ -0,0 +1 @@ +{"expireTime":9007200851596827000,"key":"gatsby-plugin-mdx-entire-payload-e5f35e7713dca67cd1d270bda5b70723-","val":{"mdast":{"type":"root","children":[{"type":"paragraph","children":[{"type":"text","value":"Woah! You are almost half way done with understanding all of Discordeno. Amazing isn't it? Something you may have noticed in the last section was that we created a setting to prevent the monitor from running in certain channels. What if we wanted to do prevent commands from happening? How would we prevent commands from running?","position":{"start":{"line":2,"column":1,"offset":1},"end":{"line":2,"column":330,"offset":330},"indent":[]}}],"position":{"start":{"line":2,"column":1,"offset":1},"end":{"line":2,"column":330,"offset":330},"indent":[]}},{"type":"export","value":"export const _frontmatter = {\"title\":\"Creating Inhibitors!\",\"metaTitle\":\"Creating An Inhibitor | Discordeno\",\"metaDescription\":\"Let's create our very own bot with Discordeno!\"}","position":{"start":{"line":5,"column":1,"offset":333},"end":{"line":5,"column":177,"offset":509},"indent":[]}}],"position":{"start":{"line":1,"column":1,"offset":0},"end":{"line":5,"column":177,"offset":509}}},"scopeImports":["import * as React from 'react'"],"scopeIdentifiers":["React"],"body":"function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }\n\nfunction _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }\n\nfunction _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }\n\n/* @jsx mdx */\nvar _frontmatter = {\n \"title\": \"Creating Inhibitors!\",\n \"metaTitle\": \"Creating An Inhibitor | Discordeno\",\n \"metaDescription\": \"Let's create our very own bot with Discordeno!\"\n};\nvar layoutProps = {\n _frontmatter: _frontmatter\n};\nvar MDXLayout = \"wrapper\";\nreturn function MDXContent(_ref) {\n var components = _ref.components,\n props = _objectWithoutProperties(_ref, [\"components\"]);\n\n return mdx(MDXLayout, _extends({}, layoutProps, props, {\n components: components,\n mdxType: \"MDXLayout\"\n }), mdx(\"p\", null, \"Woah! You are almost half way done with understanding all of Discordeno. Amazing isn't it? Something you may have noticed in the last section was that we created a setting to prevent the monitor from running in certain channels. What if we wanted to do prevent commands from happening? How would we prevent commands from running?\"));\n}\n;\nMDXContent.isMDXComponent = true;","rawMDXOutput":"/* @jsx mdx */\nimport { mdx } from '@mdx-js/react';\n/* @jsx mdx */\n\nexport const _frontmatter = {\n \"title\": \"Creating Inhibitors!\",\n \"metaTitle\": \"Creating An Inhibitor | Discordeno\",\n \"metaDescription\": \"Let's create our very own bot with Discordeno!\"\n};\n\nconst layoutProps = {\n _frontmatter\n};\nconst MDXLayout = \"wrapper\"\nexport default function MDXContent({\n components,\n ...props\n}) {\n return \n

{`Woah! You are almost half way done with understanding all of Discordeno. Amazing isn't it? Something you may have noticed in the last section was that we created a setting to prevent the monitor from running in certain channels. What if we wanted to do prevent commands from happening? How would we prevent commands from running?`}

\n\n
;\n}\n\n;\nMDXContent.isMDXComponent = true;"}} \ No newline at end of file diff --git a/docs/.cache/caches/gatsby-plugin-mdx/diskstore-41944ca0837cb3dff1ad035ebcca9173.json b/docs/.cache/caches/gatsby-plugin-mdx/diskstore-41944ca0837cb3dff1ad035ebcca9173.json new file mode 100644 index 000000000..0e98be913 --- /dev/null +++ b/docs/.cache/caches/gatsby-plugin-mdx/diskstore-41944ca0837cb3dff1ad035ebcca9173.json @@ -0,0 +1 @@ +{"expireTime":9007200851596121000,"key":"gatsby-plugin-mdx-entire-payload-772f94027cfbd099a1f3e37dba924611-","val":{"mdast":{"type":"root","children":[{"type":"paragraph","children":[{"type":"text","value":"Really great job. Now, lets dive into trying to use some of the commands and try to make our very own command.","position":{"start":{"line":2,"column":1,"offset":1},"end":{"line":2,"column":111,"offset":111},"indent":[]}}],"position":{"start":{"line":2,"column":1,"offset":1},"end":{"line":2,"column":111,"offset":111},"indent":[]}},{"type":"heading","depth":2,"children":[{"type":"text","value":"Editing Invite Command","position":{"start":{"line":4,"column":4,"offset":116},"end":{"line":4,"column":26,"offset":138},"indent":[]}}],"position":{"start":{"line":4,"column":1,"offset":113},"end":{"line":4,"column":26,"offset":138},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"Let's first start by taking an existing command and slightly modifying it to your needs. Let's use the ","position":{"start":{"line":6,"column":1,"offset":140},"end":{"line":6,"column":104,"offset":243},"indent":[]}},{"type":"inlineCode","value":"Invite","position":{"start":{"line":6,"column":104,"offset":243},"end":{"line":6,"column":112,"offset":251},"indent":[]}},{"type":"text","value":" command as our example. When you open the command, you will see something like this:","position":{"start":{"line":6,"column":112,"offset":251},"end":{"line":6,"column":197,"offset":336},"indent":[]}}],"position":{"start":{"line":6,"column":1,"offset":140},"end":{"line":6,"column":197,"offset":336},"indent":[]}},{"type":"code","lang":"ts","meta":null,"value":"import { botCache } from \"../../mod.ts\";\nimport { sendMessage } from \"https://raw.githubusercontent.com/Skillz4Killz/Discordeno/v7/src/handlers/channel.ts\";\nimport { botID } from \"https://raw.githubusercontent.com/Skillz4Killz/Discordeno/v7/src/module/client.ts\";\n\nbotCache.commands.set(\"invite\", {\n name: \"invite\",\n execute: function (message) {\n // Replace the permission number at the end to request the permissions you wish to request. By default, this will request Admin perms.\n sendMessage(\n message.channel,\n `https://discordapp.com/oauth2/authorize?client_id=${botID}&scope=bot&permissions=8`,\n );\n },\n});","position":{"start":{"line":8,"column":1,"offset":338},"end":{"line":23,"column":4,"offset":983},"indent":[1,1,1,1,1,1,1,1,1,1,1,1,1,1,1]}},{"type":"paragraph","children":[{"type":"text","value":"Let's break this down. The first three lines are importing the necessary things from their files so we can use them in this command. Don't worry if this doesn't make sense, most of the time, this will all be done automatically for you if you use a good code editor like Visual Studio Code. We create a command by doing:","position":{"start":{"line":25,"column":1,"offset":985},"end":{"line":25,"column":320,"offset":1304},"indent":[]}}],"position":{"start":{"line":25,"column":1,"offset":985},"end":{"line":25,"column":320,"offset":1304},"indent":[]}},{"type":"code","lang":"ts","meta":null,"value":"botCache.commands.set('commandname', {\n\n})","position":{"start":{"line":27,"column":1,"offset":1306},"end":{"line":31,"column":4,"offset":1358},"indent":[1,1,1,1]}},{"type":"paragraph","children":[{"type":"text","value":"The command name here must be unique. If it is not unique, your commands will not work properly as you wish. For example, you can't have 2 commands with the ","position":{"start":{"line":33,"column":1,"offset":1360},"end":{"line":33,"column":158,"offset":1517},"indent":[]}},{"type":"inlineCode","value":"ping","position":{"start":{"line":33,"column":158,"offset":1517},"end":{"line":33,"column":164,"offset":1523},"indent":[]}},{"type":"text","value":" name. In this case, our command is called ","position":{"start":{"line":33,"column":164,"offset":1523},"end":{"line":33,"column":207,"offset":1566},"indent":[]}},{"type":"inlineCode","value":"invite","position":{"start":{"line":33,"column":207,"offset":1566},"end":{"line":33,"column":215,"offset":1574},"indent":[]}},{"type":"text","value":".","position":{"start":{"line":33,"column":215,"offset":1574},"end":{"line":33,"column":216,"offset":1575},"indent":[]}}],"position":{"start":{"line":33,"column":1,"offset":1360},"end":{"line":33,"column":216,"offset":1575},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"The ","position":{"start":{"line":35,"column":1,"offset":1577},"end":{"line":35,"column":5,"offset":1581},"indent":[]}},{"type":"inlineCode","value":"name: 'invite'","position":{"start":{"line":35,"column":5,"offset":1581},"end":{"line":35,"column":21,"offset":1597},"indent":[]}},{"type":"text","value":" is also written as it is useful for our help command and inhibitors! Normally, these two things will be the same. So far it's super easy right.","position":{"start":{"line":35,"column":21,"offset":1597},"end":{"line":35,"column":165,"offset":1741},"indent":[]}}],"position":{"start":{"line":35,"column":1,"offset":1577},"end":{"line":35,"column":165,"offset":1741},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"Next is the ","position":{"start":{"line":37,"column":1,"offset":1743},"end":{"line":37,"column":13,"offset":1755},"indent":[]}},{"type":"inlineCode","value":"execute","position":{"start":{"line":37,"column":13,"offset":1755},"end":{"line":37,"column":22,"offset":1764},"indent":[]}},{"type":"text","value":". This is where the magic happens. This is the function that is triggered when the command is ran by a user. In this case, the bot simply sends a message to a channel where the command was ran and sends an invite link. Let's take a minute and optimize this for our case. We don't ","position":{"start":{"line":37,"column":22,"offset":1764},"end":{"line":37,"column":302,"offset":2044},"indent":[]}},{"type":"strong","children":[{"type":"text","value":"NEED","position":{"start":{"line":37,"column":304,"offset":2046},"end":{"line":37,"column":308,"offset":2050},"indent":[]}}],"position":{"start":{"line":37,"column":302,"offset":2044},"end":{"line":37,"column":310,"offset":2052},"indent":[]}},{"type":"text","value":" admin permissions for our bot. Let's go to the ","position":{"start":{"line":37,"column":310,"offset":2052},"end":{"line":37,"column":358,"offset":2100},"indent":[]}},{"type":"link","title":null,"url":"https://discordapi.com/permissions.html#0","children":[{"type":"text","value":"permission calculator","position":{"start":{"line":37,"column":359,"offset":2101},"end":{"line":37,"column":380,"offset":2122},"indent":[]}}],"position":{"start":{"line":37,"column":358,"offset":2100},"end":{"line":37,"column":424,"offset":2166},"indent":[]}},{"type":"text","value":" and figure out the permissions we need for our bot.","position":{"start":{"line":37,"column":424,"offset":2166},"end":{"line":37,"column":476,"offset":2218},"indent":[]}}],"position":{"start":{"line":37,"column":1,"offset":1743},"end":{"line":37,"column":476,"offset":2218},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"Once you have decided which permissions you want to request, you can copy the number and replace it here. For example, if we want ","position":{"start":{"line":39,"column":1,"offset":2220},"end":{"line":39,"column":131,"offset":2350},"indent":[]}},{"type":"inlineCode","value":"68640","position":{"start":{"line":39,"column":131,"offset":2350},"end":{"line":39,"column":138,"offset":2357},"indent":[]}},{"type":"text","value":" as our permissions. We can modify our command to be:","position":{"start":{"line":39,"column":138,"offset":2357},"end":{"line":39,"column":191,"offset":2410},"indent":[]}}],"position":{"start":{"line":39,"column":1,"offset":2220},"end":{"line":39,"column":191,"offset":2410},"indent":[]}},{"type":"code","lang":"ts","meta":null,"value":"\t`https://discordapp.com/oauth2/authorize?client_id=${botID}&scope=bot&permissions=68640`,","position":{"start":{"line":42,"column":1,"offset":2413},"end":{"line":44,"column":4,"offset":2513},"indent":[1,1]}},{"type":"paragraph","children":[{"type":"text","value":"Lastly, let's get rid of the comment there as now it is customized to our needs.","position":{"start":{"line":46,"column":1,"offset":2515},"end":{"line":46,"column":81,"offset":2595},"indent":[]}}],"position":{"start":{"line":46,"column":1,"offset":2515},"end":{"line":46,"column":81,"offset":2595},"indent":[]}},{"type":"heading","depth":3,"children":[{"type":"text","value":"Command Descriptions","position":{"start":{"line":48,"column":5,"offset":2601},"end":{"line":48,"column":25,"offset":2621},"indent":[]}}],"position":{"start":{"line":48,"column":1,"offset":2597},"end":{"line":48,"column":25,"offset":2621},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"Right now, if you were to go to Discord and type ","position":{"start":{"line":50,"column":1,"offset":2623},"end":{"line":50,"column":50,"offset":2672},"indent":[]}},{"type":"inlineCode","value":"!help invite","position":{"start":{"line":50,"column":50,"offset":2672},"end":{"line":50,"column":64,"offset":2686},"indent":[]}},{"type":"text","value":", you would see quite a bit of information. But where does all that text come from? It's not in this file. The description option tells Discordeno what to show the user when they use the help command. In that help message, each command has a small description next to it. The magic is happening because of Discordeno's translations feature.","position":{"start":{"line":50,"column":64,"offset":2686},"end":{"line":50,"column":404,"offset":3026},"indent":[]}}],"position":{"start":{"line":50,"column":1,"offset":2623},"end":{"line":50,"column":404,"offset":3026},"indent":[]}},{"type":"blockquote","children":[{"type":"paragraph","children":[{"type":"text","value":"Discordeno has built in multi-lingual support. You can support as many languages as you wish. We will learn more about languages when we create our own language but for now we just want to see how to customize the command. What we are going to do below isn't the correct way but it's the easy way to learn. We will see the correct way to do it when we get to translations.","position":{"start":{"line":52,"column":3,"offset":3030},"end":{"line":52,"column":375,"offset":3402},"indent":[]}}],"position":{"start":{"line":52,"column":3,"offset":3030},"end":{"line":52,"column":375,"offset":3402},"indent":[]}}],"position":{"start":{"line":52,"column":1,"offset":3028},"end":{"line":52,"column":375,"offset":3402},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"Let's add a custom description to our invite command.","position":{"start":{"line":54,"column":1,"offset":3404},"end":{"line":54,"column":54,"offset":3457},"indent":[]}}],"position":{"start":{"line":54,"column":1,"offset":3404},"end":{"line":54,"column":54,"offset":3457},"indent":[]}},{"type":"code","lang":"ts","meta":null,"value":"\tname: \"invite\",\n\tdescription: \"Like the bot? Use this link to add it to your server!\"","position":{"start":{"line":56,"column":1,"offset":3459},"end":{"line":59,"column":4,"offset":3555},"indent":[1,1,1]}},{"type":"paragraph","children":[{"type":"text","value":"🎉 It's that simple. So let's restart the bot and see how it changed. Use ","position":{"start":{"line":61,"column":1,"offset":3557},"end":{"line":61,"column":75,"offset":3631},"indent":[]}},{"type":"strong","children":[{"type":"text","value":"CTRL + C","position":{"start":{"line":61,"column":77,"offset":3633},"end":{"line":61,"column":85,"offset":3641},"indent":[]}}],"position":{"start":{"line":61,"column":75,"offset":3631},"end":{"line":61,"column":87,"offset":3643},"indent":[]}},{"type":"text","value":" to shut down the bot. Then run the command from earlier.","position":{"start":{"line":61,"column":87,"offset":3643},"end":{"line":61,"column":144,"offset":3700},"indent":[]}}],"position":{"start":{"line":61,"column":1,"offset":3557},"end":{"line":61,"column":144,"offset":3700},"indent":[]}},{"type":"code","lang":"shell","meta":null,"value":"deno run --allow-net --allow-read mod.ts","position":{"start":{"line":63,"column":1,"offset":3702},"end":{"line":65,"column":4,"offset":3755},"indent":[1,1]}},{"type":"paragraph","children":[{"type":"text","value":"To access this easily, most likely all you need to do is press the ","position":{"start":{"line":67,"column":1,"offset":3757},"end":{"line":67,"column":68,"offset":3824},"indent":[]}},{"type":"strong","children":[{"type":"text","value":"UP ARROW","position":{"start":{"line":67,"column":70,"offset":3826},"end":{"line":67,"column":78,"offset":3834},"indent":[]}}],"position":{"start":{"line":67,"column":68,"offset":3824},"end":{"line":67,"column":80,"offset":3836},"indent":[]}},{"type":"text","value":" key. Feel free to copy paste this if it doesn't work.","position":{"start":{"line":67,"column":80,"offset":3836},"end":{"line":67,"column":134,"offset":3890},"indent":[]}}],"position":{"start":{"line":67,"column":1,"offset":3757},"end":{"line":67,"column":134,"offset":3890},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"Once the bot is started try ","position":{"start":{"line":69,"column":1,"offset":3892},"end":{"line":69,"column":29,"offset":3920},"indent":[]}},{"type":"inlineCode","value":"!help invite","position":{"start":{"line":69,"column":29,"offset":3920},"end":{"line":69,"column":43,"offset":3934},"indent":[]}},{"type":"text","value":" again and you will see the change! 🎉","position":{"start":{"line":69,"column":43,"offset":3934},"end":{"line":69,"column":81,"offset":3972},"indent":[]}}],"position":{"start":{"line":69,"column":1,"offset":3892},"end":{"line":69,"column":81,"offset":3972},"indent":[]}},{"type":"heading","depth":2,"children":[{"type":"text","value":"Command Aliases","position":{"start":{"line":71,"column":4,"offset":3977},"end":{"line":71,"column":19,"offset":3992},"indent":[]}}],"position":{"start":{"line":71,"column":1,"offset":3974},"end":{"line":71,"column":19,"offset":3992},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"Now, let's make this a little bit easier. What if we wanted this command to also work with other names besides ","position":{"start":{"line":73,"column":1,"offset":3994},"end":{"line":73,"column":112,"offset":4105},"indent":[]}},{"type":"inlineCode","value":"invite","position":{"start":{"line":73,"column":112,"offset":4105},"end":{"line":73,"column":120,"offset":4113},"indent":[]}},{"type":"text","value":". For example, as a shortcut what if users could just type ","position":{"start":{"line":73,"column":120,"offset":4113},"end":{"line":73,"column":179,"offset":4172},"indent":[]}},{"type":"inlineCode","value":"!inv","position":{"start":{"line":73,"column":179,"offset":4172},"end":{"line":73,"column":185,"offset":4178},"indent":[]}},{"type":"text","value":" or as an alias type ","position":{"start":{"line":73,"column":185,"offset":4178},"end":{"line":73,"column":206,"offset":4199},"indent":[]}},{"type":"inlineCode","value":"!join","position":{"start":{"line":73,"column":206,"offset":4199},"end":{"line":73,"column":213,"offset":4206},"indent":[]}},{"type":"text","value":". Let's go ahead and set that up. Go to the very last line of invite command file and type in ","position":{"start":{"line":73,"column":213,"offset":4206},"end":{"line":73,"column":307,"offset":4300},"indent":[]}},{"type":"inlineCode","value":"alias","position":{"start":{"line":73,"column":307,"offset":4300},"end":{"line":73,"column":314,"offset":4307},"indent":[]}},{"type":"text","value":". You will see a popup showing you an autocompleted version of ","position":{"start":{"line":73,"column":314,"offset":4307},"end":{"line":73,"column":377,"offset":4370},"indent":[]}},{"type":"inlineCode","value":"createCommandAliases","position":{"start":{"line":73,"column":377,"offset":4370},"end":{"line":73,"column":399,"offset":4392},"indent":[]}},{"type":"text","value":". Press enter and boom the magic is happening!","position":{"start":{"line":73,"column":399,"offset":4392},"end":{"line":73,"column":445,"offset":4438},"indent":[]}}],"position":{"start":{"line":73,"column":1,"offset":3994},"end":{"line":73,"column":445,"offset":4438},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"The createCommandAliases takes in two arguments. The first argument is always the command name. In this case it is ","position":{"start":{"line":75,"column":1,"offset":4440},"end":{"line":75,"column":116,"offset":4555},"indent":[]}},{"type":"inlineCode","value":"invite","position":{"start":{"line":75,"column":116,"offset":4555},"end":{"line":75,"column":124,"offset":4563},"indent":[]}},{"type":"text","value":". The second argument is the aliases you want to provide. Let's add in the two aliases we wanted.","position":{"start":{"line":75,"column":124,"offset":4563},"end":{"line":75,"column":221,"offset":4660},"indent":[]}}],"position":{"start":{"line":75,"column":1,"offset":4440},"end":{"line":75,"column":221,"offset":4660},"indent":[]}},{"type":"code","lang":"ts","meta":null,"value":" `https://discordapp.com/oauth2/authorize?client_id=${botID}&scope=bot&permissions=68640`,\n );\n },\n});\n\ncreateCommandAliases('invite', ['inv', 'join'])","position":{"start":{"line":77,"column":1,"offset":4662},"end":{"line":84,"column":4,"offset":4827},"indent":[1,1,1,1,1,1,1]}},{"type":"blockquote","children":[{"type":"paragraph","children":[{"type":"strong","children":[{"type":"text","value":"Note:","position":{"start":{"line":86,"column":5,"offset":4833},"end":{"line":86,"column":10,"offset":4838},"indent":[]}}],"position":{"start":{"line":86,"column":3,"offset":4831},"end":{"line":86,"column":12,"offset":4840},"indent":[]}},{"type":"text","value":" If you only want to add 1 alias, you can pass in a simple string instead of an array as well as the second argument.","position":{"start":{"line":86,"column":12,"offset":4840},"end":{"line":86,"column":129,"offset":4957},"indent":[]}}],"position":{"start":{"line":86,"column":3,"offset":4831},"end":{"line":86,"column":129,"offset":4957},"indent":[]}}],"position":{"start":{"line":86,"column":1,"offset":4829},"end":{"line":86,"column":129,"offset":4957},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"Notice, I added 2 aliases here. You can add as many aliases as you like. If you see a lot of users typing it wrong by accident you can add those typos as aliases as well.","position":{"start":{"line":88,"column":1,"offset":4959},"end":{"line":88,"column":171,"offset":5129},"indent":[]}}],"position":{"start":{"line":88,"column":1,"offset":4959},"end":{"line":88,"column":171,"offset":5129},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"Let's start testing this out. But first, let's understand something important.","position":{"start":{"line":90,"column":1,"offset":5131},"end":{"line":90,"column":79,"offset":5209},"indent":[]}}],"position":{"start":{"line":90,"column":1,"offset":5131},"end":{"line":90,"column":79,"offset":5209},"indent":[]}},{"type":"heading","depth":2,"children":[{"type":"text","value":"Reloading","position":{"start":{"line":92,"column":4,"offset":5214},"end":{"line":92,"column":13,"offset":5223},"indent":[]}}],"position":{"start":{"line":92,"column":1,"offset":5211},"end":{"line":92,"column":13,"offset":5223},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"Okay, we need to first understand a core concept of developing discord bots. If you had to restart your bot every time you made a tiny change, it would get really annoying/tedious to do. Also, if you had restarted your bot 1000 times, you would be in big trouble because Discord would ban your bot for 24 hours. The bigger your bot gets, the faster it is to hit this limit of 1000 identify calls to the Discord API.","position":{"start":{"line":94,"column":1,"offset":5225},"end":{"line":94,"column":416,"offset":5640},"indent":[]}}],"position":{"start":{"line":94,"column":1,"offset":5225},"end":{"line":94,"column":416,"offset":5640},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"To solve this issue, Discordeno provides you with a really cool ","position":{"start":{"line":96,"column":1,"offset":5642},"end":{"line":96,"column":65,"offset":5706},"indent":[]}},{"type":"inlineCode","value":"reload","position":{"start":{"line":96,"column":65,"offset":5706},"end":{"line":96,"column":73,"offset":5714},"indent":[]}},{"type":"text","value":" command. Whenever you make a change to any command, event, monitor, inhibitor, task, language or argument you can simply reload it. You don't need to restart your bot every time.","position":{"start":{"line":96,"column":73,"offset":5714},"end":{"line":96,"column":252,"offset":5893},"indent":[]}}],"position":{"start":{"line":96,"column":1,"offset":5642},"end":{"line":96,"column":252,"offset":5893},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"Now since we added the aliases above, let's test it out.","position":{"start":{"line":98,"column":1,"offset":5895},"end":{"line":98,"column":57,"offset":5951},"indent":[]}}],"position":{"start":{"line":98,"column":1,"offset":5895},"end":{"line":98,"column":57,"offset":5951},"indent":[]}},{"type":"list","ordered":true,"start":1,"spread":false,"children":[{"type":"listItem","spread":false,"checked":null,"children":[{"type":"paragraph","children":[{"type":"inlineCode","value":"!inv","position":{"start":{"line":100,"column":4,"offset":5956},"end":{"line":100,"column":10,"offset":5962},"indent":[]}},{"type":"text","value":" this will not work","position":{"start":{"line":100,"column":10,"offset":5962},"end":{"line":100,"column":29,"offset":5981},"indent":[]}}],"position":{"start":{"line":100,"column":4,"offset":5956},"end":{"line":100,"column":29,"offset":5981},"indent":[]}}],"position":{"start":{"line":100,"column":1,"offset":5953},"end":{"line":100,"column":29,"offset":5981},"indent":[]}},{"type":"listItem","spread":false,"checked":null,"children":[{"type":"paragraph","children":[{"type":"inlineCode","value":"!reload commands","position":{"start":{"line":101,"column":4,"offset":5985},"end":{"line":101,"column":22,"offset":6003},"indent":[]}},{"type":"text","value":" this will reload the files and the aliases will be created.","position":{"start":{"line":101,"column":22,"offset":6003},"end":{"line":101,"column":82,"offset":6063},"indent":[]}}],"position":{"start":{"line":101,"column":4,"offset":5985},"end":{"line":101,"column":82,"offset":6063},"indent":[]}}],"position":{"start":{"line":101,"column":1,"offset":5982},"end":{"line":101,"column":82,"offset":6063},"indent":[]}},{"type":"listItem","spread":false,"checked":null,"children":[{"type":"paragraph","children":[{"type":"inlineCode","value":"!inv","position":{"start":{"line":102,"column":4,"offset":6067},"end":{"line":102,"column":10,"offset":6073},"indent":[]}},{"type":"text","value":" This will now work. 🎉","position":{"start":{"line":102,"column":10,"offset":6073},"end":{"line":102,"column":33,"offset":6096},"indent":[]}}],"position":{"start":{"line":102,"column":4,"offset":6067},"end":{"line":102,"column":33,"offset":6096},"indent":[]}}],"position":{"start":{"line":102,"column":1,"offset":6064},"end":{"line":102,"column":33,"offset":6096},"indent":[]}}],"position":{"start":{"line":100,"column":1,"offset":5953},"end":{"line":102,"column":33,"offset":6096},"indent":[1,1]}},{"type":"thematicBreak","position":{"start":{"line":104,"column":1,"offset":6098},"end":{"line":104,"column":4,"offset":6101},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"Perfect! You can take some time and customize the invite command to your needs if you wish. For example, this is my bot's invite command.","position":{"start":{"line":106,"column":1,"offset":6103},"end":{"line":106,"column":138,"offset":6240},"indent":[]}}],"position":{"start":{"line":106,"column":1,"offset":6103},"end":{"line":106,"column":138,"offset":6240},"indent":[]}},{"type":"paragraph","children":[{"type":"image","title":null,"url":"https://i.imgur.com/4WRFMtR.png","alt":"image","position":{"start":{"line":108,"column":1,"offset":6242},"end":{"line":108,"column":42,"offset":6283},"indent":[]}}],"position":{"start":{"line":108,"column":1,"offset":6242},"end":{"line":108,"column":42,"offset":6283},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"Nice! You can now customize any of the commands from Discordeno as you wish. Then we will continue to making our very own command so we can learn about all the options that Discordeno gives us when it comes to making commands. As you learn more in this guide, you can keep improving it.","position":{"start":{"line":110,"column":1,"offset":6285},"end":{"line":110,"column":287,"offset":6571},"indent":[]}}],"position":{"start":{"line":110,"column":1,"offset":6285},"end":{"line":110,"column":287,"offset":6571},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"If you get stuck, don't worry. When you are ready, let's continue to the next step.","position":{"start":{"line":112,"column":1,"offset":6573},"end":{"line":112,"column":84,"offset":6656},"indent":[]}}],"position":{"start":{"line":112,"column":1,"offset":6573},"end":{"line":112,"column":84,"offset":6656},"indent":[]}},{"type":"heading","depth":2,"children":[{"type":"text","value":"Creating A Command","position":{"start":{"line":114,"column":4,"offset":6661},"end":{"line":114,"column":22,"offset":6679},"indent":[]}}],"position":{"start":{"line":114,"column":1,"offset":6658},"end":{"line":114,"column":22,"offset":6679},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"Let's make a command that will allow guild admins to give or take roles from a member. Since, we are creating a ","position":{"start":{"line":116,"column":1,"offset":6681},"end":{"line":116,"column":113,"offset":6793},"indent":[]}},{"type":"inlineCode","value":"Moderation","position":{"start":{"line":116,"column":113,"offset":6793},"end":{"line":116,"column":125,"offset":6805},"indent":[]}},{"type":"text","value":" command to give or take roles, let's go ahead and create a Category folder called ","position":{"start":{"line":116,"column":125,"offset":6805},"end":{"line":116,"column":208,"offset":6888},"indent":[]}},{"type":"inlineCode","value":"Moderation","position":{"start":{"line":116,"column":208,"offset":6888},"end":{"line":116,"column":220,"offset":6900},"indent":[]}},{"type":"text","value":" and then create a file called ","position":{"start":{"line":116,"column":220,"offset":6900},"end":{"line":116,"column":251,"offset":6931},"indent":[]}},{"type":"inlineCode","value":"role.ts","position":{"start":{"line":116,"column":251,"offset":6931},"end":{"line":116,"column":260,"offset":6940},"indent":[]}},{"type":"text","value":". Once the file is made, you can paste this following base snippet to make our first command.","position":{"start":{"line":116,"column":260,"offset":6940},"end":{"line":116,"column":353,"offset":7033},"indent":[]}}],"position":{"start":{"line":116,"column":1,"offset":6681},"end":{"line":116,"column":353,"offset":7033},"indent":[]}},{"type":"code","lang":"ts","meta":null,"value":"import { botCache } from \"../../mod.ts\";\nimport { sendMessage } from \"https://raw.githubusercontent.com/Skillz4Killz/Discordeno/v7/src/handlers/channel.ts\";\nimport { PermissionLevels } from \"../types/commands.ts\";\nimport { createCommandAliases } from \"../utils/helpers\";\n\nbotCache.commands.set(\"commandname\", {\n name: \"commandname\",\n dmOnly: false,\n guildOnly: false,\n nsfw: false,\n permissionLevel: [PermissionLevels.MEMBER],\n botServerPermissions: [],\n botChannelPermissions: [],\n userServerPermissions: [],\n userChannelPermissions: [],\n description: string,\n cooldown: {\n seconds: 0,\n allowedUses: 0,\n },\n arguments: [],\n execute: function (message, args, guild) {\n // The code for your command goes here\n }\n});\n\n// createCommandAliases(\"commandname\", [\"alias\"])","position":{"start":{"line":118,"column":1,"offset":7035},"end":{"line":146,"column":4,"offset":7832},"indent":[1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1]}},{"type":"heading","depth":2,"children":[{"type":"text","value":"Understanding Command Options","position":{"start":{"line":148,"column":4,"offset":7837},"end":{"line":148,"column":33,"offset":7866},"indent":[]}}],"position":{"start":{"line":148,"column":1,"offset":7834},"end":{"line":148,"column":33,"offset":7866},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"Woah! We just added a massive file but most of that stuff is new to us. Don't worry, let's break everything down step by step.","position":{"start":{"line":150,"column":1,"offset":7868},"end":{"line":150,"column":127,"offset":7994},"indent":[]}}],"position":{"start":{"line":150,"column":1,"offset":7868},"end":{"line":150,"column":127,"offset":7994},"indent":[]}},{"type":"blockquote","children":[{"type":"paragraph","children":[{"type":"strong","children":[{"type":"text","value":"Note:","position":{"start":{"line":152,"column":5,"offset":8000},"end":{"line":152,"column":10,"offset":8005},"indent":[]}}],"position":{"start":{"line":152,"column":3,"offset":7998},"end":{"line":152,"column":12,"offset":8007},"indent":[]}},{"type":"text","value":" Any options that are not changed from the snippet above can actually be deleted as Discordeno will use the default option if you do not provide anything for that option. This can help keep your files cleaner.","position":{"start":{"line":152,"column":12,"offset":8007},"end":{"line":152,"column":221,"offset":8216},"indent":[]}}],"position":{"start":{"line":152,"column":3,"offset":7998},"end":{"line":152,"column":221,"offset":8216},"indent":[]}}],"position":{"start":{"line":152,"column":1,"offset":7996},"end":{"line":152,"column":221,"offset":8216},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"Before we start, quickly update the command name and description.","position":{"start":{"line":154,"column":1,"offset":8218},"end":{"line":154,"column":66,"offset":8283},"indent":[]}}],"position":{"start":{"line":154,"column":1,"offset":8218},"end":{"line":154,"column":66,"offset":8283},"indent":[]}},{"type":"blockquote","children":[{"type":"paragraph","children":[{"type":"strong","children":[{"type":"text","value":"Note:","position":{"start":{"line":156,"column":5,"offset":8289},"end":{"line":156,"column":10,"offset":8294},"indent":[]}}],"position":{"start":{"line":156,"column":3,"offset":8287},"end":{"line":156,"column":12,"offset":8296},"indent":[]}},{"type":"text","value":" Once you highlight the ","position":{"start":{"line":156,"column":12,"offset":8296},"end":{"line":156,"column":36,"offset":8320},"indent":[]}},{"type":"inlineCode","value":"commandname","position":{"start":{"line":156,"column":36,"offset":8320},"end":{"line":156,"column":49,"offset":8333},"indent":[]}},{"type":"text","value":", press ","position":{"start":{"line":156,"column":49,"offset":8333},"end":{"line":156,"column":57,"offset":8341},"indent":[]}},{"type":"strong","children":[{"type":"text","value":"CTRL + SHIFT + L","position":{"start":{"line":156,"column":59,"offset":8343},"end":{"line":156,"column":75,"offset":8359},"indent":[]}}],"position":{"start":{"line":156,"column":57,"offset":8341},"end":{"line":156,"column":77,"offset":8361},"indent":[]}},{"type":"text","value":" to select ALL the ","position":{"start":{"line":156,"column":77,"offset":8361},"end":{"line":156,"column":96,"offset":8380},"indent":[]}},{"type":"inlineCode","value":"commandname","position":{"start":{"line":156,"column":96,"offset":8380},"end":{"line":156,"column":109,"offset":8393},"indent":[]}},{"type":"text","value":" on the file and you can easily replace them at once. Another useful shortcut you may use when coding your bot is ","position":{"start":{"line":156,"column":109,"offset":8393},"end":{"line":156,"column":223,"offset":8507},"indent":[]}},{"type":"strong","children":[{"type":"text","value":"CTRL + D","position":{"start":{"line":156,"column":225,"offset":8509},"end":{"line":156,"column":233,"offset":8517},"indent":[]}}],"position":{"start":{"line":156,"column":223,"offset":8507},"end":{"line":156,"column":235,"offset":8519},"indent":[]}},{"type":"text","value":" after highlighting. This shortcut selects the next place where the same text exists as thing in the file that has the same thing as you highlighted.","position":{"start":{"line":156,"column":235,"offset":8519},"end":{"line":156,"column":385,"offset":8669},"indent":[]}}],"position":{"start":{"line":156,"column":3,"offset":8287},"end":{"line":156,"column":385,"offset":8669},"indent":[]}}],"position":{"start":{"line":156,"column":1,"offset":8285},"end":{"line":156,"column":385,"offset":8669},"indent":[]}},{"type":"heading","depth":2,"children":[{"type":"text","value":"dmOnly & guildOnly Options","position":{"start":{"line":158,"column":4,"offset":8674},"end":{"line":158,"column":30,"offset":8700},"indent":[]}}],"position":{"start":{"line":158,"column":1,"offset":8671},"end":{"line":158,"column":30,"offset":8700},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"The ","position":{"start":{"line":160,"column":1,"offset":8702},"end":{"line":160,"column":5,"offset":8706},"indent":[]}},{"type":"inlineCode","value":"dmOnly","position":{"start":{"line":160,"column":5,"offset":8706},"end":{"line":160,"column":13,"offset":8714},"indent":[]}},{"type":"text","value":" option is available if you want to make sure this command only runs in a direct message. If this command is ran in a server, the command will immediately exit out.","position":{"start":{"line":160,"column":13,"offset":8714},"end":{"line":160,"column":177,"offset":8878},"indent":[]}}],"position":{"start":{"line":160,"column":1,"offset":8702},"end":{"line":160,"column":177,"offset":8878},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"On the other hand, ","position":{"start":{"line":162,"column":1,"offset":8880},"end":{"line":162,"column":20,"offset":8899},"indent":[]}},{"type":"inlineCode","value":"guildOnly","position":{"start":{"line":162,"column":20,"offset":8899},"end":{"line":162,"column":31,"offset":8910},"indent":[]}},{"type":"text","value":" is the opposite. To easily make sure that this command is never allowed in a private message you can simple enable this.","position":{"start":{"line":162,"column":31,"offset":8910},"end":{"line":162,"column":152,"offset":9031},"indent":[]}}],"position":{"start":{"line":162,"column":1,"offset":8880},"end":{"line":162,"column":152,"offset":9031},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"If you want to allow a command to be able to run both in a server and in a direct message, simply set them both to false.","position":{"start":{"line":164,"column":1,"offset":9033},"end":{"line":164,"column":122,"offset":9154},"indent":[]}}],"position":{"start":{"line":164,"column":1,"offset":9033},"end":{"line":164,"column":122,"offset":9154},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"Remember if you want either of them as false, you can simply delete them and it will default to ","position":{"start":{"line":166,"column":1,"offset":9156},"end":{"line":166,"column":97,"offset":9252},"indent":[]}},{"type":"inlineCode","value":"false","position":{"start":{"line":166,"column":97,"offset":9252},"end":{"line":166,"column":104,"offset":9259},"indent":[]}},{"type":"text","value":" allowing your bot to be cleaner and easier to read. However, if your prefer keeping it you can.","position":{"start":{"line":166,"column":104,"offset":9259},"end":{"line":166,"column":200,"offset":9355},"indent":[]}}],"position":{"start":{"line":166,"column":1,"offset":9156},"end":{"line":166,"column":200,"offset":9355},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"For the purpose of this guide, we want our ","position":{"start":{"line":168,"column":1,"offset":9357},"end":{"line":168,"column":44,"offset":9400},"indent":[]}},{"type":"inlineCode","value":"role","position":{"start":{"line":168,"column":44,"offset":9400},"end":{"line":168,"column":50,"offset":9406},"indent":[]}},{"type":"text","value":" comamnd to only be run in a server, so we can set ","position":{"start":{"line":168,"column":50,"offset":9406},"end":{"line":168,"column":101,"offset":9457},"indent":[]}},{"type":"inlineCode","value":"guildOnly","position":{"start":{"line":168,"column":101,"offset":9457},"end":{"line":168,"column":112,"offset":9468},"indent":[]}},{"type":"text","value":" to be ","position":{"start":{"line":168,"column":112,"offset":9468},"end":{"line":168,"column":119,"offset":9475},"indent":[]}},{"type":"strong","children":[{"type":"text","value":"true","position":{"start":{"line":168,"column":121,"offset":9477},"end":{"line":168,"column":125,"offset":9481},"indent":[]}}],"position":{"start":{"line":168,"column":119,"offset":9475},"end":{"line":168,"column":127,"offset":9483},"indent":[]}},{"type":"text","value":" and delete the ","position":{"start":{"line":168,"column":127,"offset":9483},"end":{"line":168,"column":143,"offset":9499},"indent":[]}},{"type":"inlineCode","value":"dmOnly","position":{"start":{"line":168,"column":143,"offset":9499},"end":{"line":168,"column":151,"offset":9507},"indent":[]}},{"type":"text","value":" option.","position":{"start":{"line":168,"column":151,"offset":9507},"end":{"line":168,"column":159,"offset":9515},"indent":[]}}],"position":{"start":{"line":168,"column":1,"offset":9357},"end":{"line":168,"column":159,"offset":9515},"indent":[]}},{"type":"heading","depth":2,"children":[{"type":"text","value":"NSFW Option","position":{"start":{"line":170,"column":4,"offset":9520},"end":{"line":170,"column":15,"offset":9531},"indent":[]}}],"position":{"start":{"line":170,"column":1,"offset":9517},"end":{"line":170,"column":15,"offset":9531},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"NSFW stands for ","position":{"start":{"line":172,"column":1,"offset":9533},"end":{"line":172,"column":17,"offset":9549},"indent":[]}},{"type":"strong","children":[{"type":"text","value":"Not Safe For Work","position":{"start":{"line":172,"column":19,"offset":9551},"end":{"line":172,"column":36,"offset":9568},"indent":[]}}],"position":{"start":{"line":172,"column":17,"offset":9549},"end":{"line":172,"column":38,"offset":9570},"indent":[]}},{"type":"text","value":". One of Discord's rules is that you enforce that NSFW content is sent only in NSFW channels. Discordeno has this built in. You simple tell Discordeno, that you want a command to be considered ","position":{"start":{"line":172,"column":38,"offset":9570},"end":{"line":172,"column":231,"offset":9763},"indent":[]}},{"type":"inlineCode","value":"nsfw","position":{"start":{"line":172,"column":231,"offset":9763},"end":{"line":172,"column":237,"offset":9769},"indent":[]}},{"type":"text","value":" or not.","position":{"start":{"line":172,"column":237,"offset":9769},"end":{"line":172,"column":245,"offset":9777},"indent":[]}}],"position":{"start":{"line":172,"column":1,"offset":9533},"end":{"line":172,"column":245,"offset":9777},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"If this option is enabled, this command will only be able to be used in a ","position":{"start":{"line":174,"column":1,"offset":9779},"end":{"line":174,"column":75,"offset":9853},"indent":[]}},{"type":"inlineCode","value":"nsfw","position":{"start":{"line":174,"column":75,"offset":9853},"end":{"line":174,"column":81,"offset":9859},"indent":[]}},{"type":"text","value":" channel on a server. Discord does not consider Direct Messages as nsfw safe!","position":{"start":{"line":174,"column":81,"offset":9859},"end":{"line":174,"column":158,"offset":9936},"indent":[]}}],"position":{"start":{"line":174,"column":1,"offset":9779},"end":{"line":174,"column":158,"offset":9936},"indent":[]}},{"type":"heading","depth":2,"children":[{"type":"text","value":"Permission Level Option","position":{"start":{"line":176,"column":4,"offset":9941},"end":{"line":176,"column":27,"offset":9964},"indent":[]}}],"position":{"start":{"line":176,"column":1,"offset":9938},"end":{"line":176,"column":27,"offset":9964},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"Permission levels are a very powerful feature that easily allow you to set what permission is required to run a command. We will cover this in detail, in a separate section dedicated to permission levels. For now, just understand that this will restrict certain users from using a command.","position":{"start":{"line":178,"column":1,"offset":9966},"end":{"line":178,"column":290,"offset":10255},"indent":[]}}],"position":{"start":{"line":178,"column":1,"offset":9966},"end":{"line":178,"column":290,"offset":10255},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"For example, the role command we only want to be used by moderators or server admins.","position":{"start":{"line":180,"column":1,"offset":10257},"end":{"line":180,"column":86,"offset":10342},"indent":[]}}],"position":{"start":{"line":180,"column":1,"offset":10257},"end":{"line":180,"column":86,"offset":10342},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"Discordeno makes this pretty simple for us.","position":{"start":{"line":182,"column":1,"offset":10344},"end":{"line":182,"column":44,"offset":10387},"indent":[]}}],"position":{"start":{"line":182,"column":1,"offset":10344},"end":{"line":182,"column":44,"offset":10387},"indent":[]}},{"type":"code","lang":"ts","meta":null,"value":"permissionLevels: [PermissionLevels.MODERATOR, PermissionLevels.ADMIN]","position":{"start":{"line":184,"column":1,"offset":10389},"end":{"line":186,"column":4,"offset":10469},"indent":[1,1]}},{"type":"paragraph","children":[{"type":"text","value":"We're not going to cover this in detail, here because we will have an entire in depth guide for permission levels. If you want to pause and learn it now, feel free: ","position":{"start":{"line":188,"column":1,"offset":10471},"end":{"line":188,"column":166,"offset":10636},"indent":[]}},{"type":"link","title":null,"url":"https://discordeno.netlify.app/advanced/permlevels","children":[{"type":"text","value":"Permission Levels Advanced Guide","position":{"start":{"line":188,"column":167,"offset":10637},"end":{"line":188,"column":199,"offset":10669},"indent":[]}}],"position":{"start":{"line":188,"column":166,"offset":10636},"end":{"line":188,"column":252,"offset":10722},"indent":[]}}],"position":{"start":{"line":188,"column":1,"offset":10471},"end":{"line":188,"column":252,"offset":10722},"indent":[]}},{"type":"heading","depth":2,"children":[{"type":"text","value":"Permissions Check Options","position":{"start":{"line":190,"column":4,"offset":10727},"end":{"line":190,"column":29,"offset":10752},"indent":[]}}],"position":{"start":{"line":190,"column":1,"offset":10724},"end":{"line":190,"column":29,"offset":10752},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"Discordeno provides you 4 different types of permission handling that will be done before the command function is executed. This allows you to make sure that the permissions are available before running a command. For example, the role command will require the bot to have ","position":{"start":{"line":192,"column":1,"offset":10754},"end":{"line":192,"column":274,"offset":11027},"indent":[]}},{"type":"strong","children":[{"type":"text","value":"MANAGE ROLES","position":{"start":{"line":192,"column":276,"offset":11029},"end":{"line":192,"column":288,"offset":11041},"indent":[]}}],"position":{"start":{"line":192,"column":274,"offset":11027},"end":{"line":192,"column":290,"offset":11043},"indent":[]}},{"type":"text","value":" permission. This permission comes from the server settings so we can require this in the ","position":{"start":{"line":192,"column":290,"offset":11043},"end":{"line":192,"column":380,"offset":11133},"indent":[]}},{"type":"inlineCode","value":"botServerPermissions","position":{"start":{"line":192,"column":380,"offset":11133},"end":{"line":192,"column":402,"offset":11155},"indent":[]}},{"type":"text","value":".","position":{"start":{"line":192,"column":402,"offset":11155},"end":{"line":192,"column":403,"offset":11156},"indent":[]}}],"position":{"start":{"line":192,"column":1,"offset":10754},"end":{"line":192,"column":403,"offset":11156},"indent":[]}},{"type":"code","lang":"ts","meta":null,"value":"botServerPermissions: [\"MANAGE_ROLES\"],","position":{"start":{"line":194,"column":1,"offset":11158},"end":{"line":196,"column":4,"offset":11207},"indent":[1,1]}},{"type":"paragraph","children":[{"type":"text","value":"Discordeno will provide you easy to use auto-completion as soon as you type a single letter or two. This will help make it easier to use and will warn you when you make a typo and provide a wrong permission by accident.","position":{"start":{"line":198,"column":1,"offset":11209},"end":{"line":198,"column":220,"offset":11428},"indent":[]}}],"position":{"start":{"line":198,"column":1,"offset":11209},"end":{"line":198,"column":220,"offset":11428},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"We also want to make sure that the bot can send a message in this channel so that we can respond to the user. This will check the correct permission heirarchy to make sure that the bot can indeed send a message in this channel.","position":{"start":{"line":200,"column":1,"offset":11430},"end":{"line":200,"column":228,"offset":11657},"indent":[]}}],"position":{"start":{"line":200,"column":1,"offset":11430},"end":{"line":200,"column":228,"offset":11657},"indent":[]}},{"type":"code","lang":"ts","meta":null,"value":"botChannelPermissions: [\"SEND_MESSAGES\"],","position":{"start":{"line":202,"column":1,"offset":11659},"end":{"line":204,"column":4,"offset":11710},"indent":[1,1]}},{"type":"blockquote","children":[{"type":"paragraph","children":[{"type":"strong","children":[{"type":"text","value":"Note:","position":{"start":{"line":206,"column":5,"offset":11716},"end":{"line":206,"column":10,"offset":11721},"indent":[]}}],"position":{"start":{"line":206,"column":3,"offset":11714},"end":{"line":206,"column":12,"offset":11723},"indent":[]}},{"type":"text","value":" If you want to send an embed response, you should also make sure it has the ","position":{"start":{"line":206,"column":12,"offset":11723},"end":{"line":206,"column":89,"offset":11800},"indent":[]}},{"type":"inlineCode","value":"EMBED_LINKS","position":{"start":{"line":206,"column":89,"offset":11800},"end":{"line":206,"column":102,"offset":11813},"indent":[]}},{"type":"text","value":" permission.","position":{"start":{"line":206,"column":102,"offset":11813},"end":{"line":206,"column":114,"offset":11825},"indent":[]}}],"position":{"start":{"line":206,"column":3,"offset":11714},"end":{"line":206,"column":114,"offset":11825},"indent":[]}}],"position":{"start":{"line":206,"column":1,"offset":11712},"end":{"line":206,"column":114,"offset":11825},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"Already we have prevented two of the largest errors that can get our bot banned if it is not checked. Discordeno handles this internally so you don't have to worry about it.","position":{"start":{"line":208,"column":1,"offset":11827},"end":{"line":208,"column":174,"offset":12000},"indent":[]}}],"position":{"start":{"line":208,"column":1,"offset":11827},"end":{"line":208,"column":174,"offset":12000},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"Sometimes, you may also want to make sure that the user using the command has a certain permission to run the command. To do this, you can use the ","position":{"start":{"line":210,"column":1,"offset":12002},"end":{"line":210,"column":148,"offset":12149},"indent":[]}},{"type":"inlineCode","value":"userServerPermissions","position":{"start":{"line":210,"column":148,"offset":12149},"end":{"line":210,"column":171,"offset":12172},"indent":[]}},{"type":"text","value":" or the ","position":{"start":{"line":210,"column":171,"offset":12172},"end":{"line":210,"column":179,"offset":12180},"indent":[]}},{"type":"inlineCode","value":"userChannelPermissions","position":{"start":{"line":210,"column":179,"offset":12180},"end":{"line":210,"column":203,"offset":12204},"indent":[]}},{"type":"text","value":".","position":{"start":{"line":210,"column":203,"offset":12204},"end":{"line":210,"column":204,"offset":12205},"indent":[]}}],"position":{"start":{"line":210,"column":1,"offset":12002},"end":{"line":210,"column":204,"offset":12205},"indent":[]}},{"type":"heading","depth":2,"children":[{"type":"text","value":"Cooldown Options","position":{"start":{"line":212,"column":4,"offset":12210},"end":{"line":212,"column":20,"offset":12226},"indent":[]}}],"position":{"start":{"line":212,"column":1,"offset":12207},"end":{"line":212,"column":20,"offset":12226},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"The cooldown options go hand in hand together.","position":{"start":{"line":214,"column":1,"offset":12228},"end":{"line":214,"column":47,"offset":12274},"indent":[]}}],"position":{"start":{"line":214,"column":1,"offset":12228},"end":{"line":214,"column":47,"offset":12274},"indent":[]}},{"type":"list","ordered":false,"start":null,"spread":false,"children":[{"type":"listItem","spread":false,"checked":null,"children":[{"type":"paragraph","children":[{"type":"inlineCode","value":"seconds","position":{"start":{"line":216,"column":3,"offset":12278},"end":{"line":216,"column":12,"offset":12287},"indent":[]}},{"type":"text","value":" is how long to make the user wait in seconds before they can use the command again. By default, there is no wait time aka 0 seconds.","position":{"start":{"line":216,"column":12,"offset":12287},"end":{"line":216,"column":145,"offset":12420},"indent":[]}}],"position":{"start":{"line":216,"column":3,"offset":12278},"end":{"line":216,"column":145,"offset":12420},"indent":[]}}],"position":{"start":{"line":216,"column":1,"offset":12276},"end":{"line":216,"column":145,"offset":12420},"indent":[]}},{"type":"listItem","spread":false,"checked":null,"children":[{"type":"paragraph","children":[{"type":"inlineCode","value":"allowedUses","position":{"start":{"line":217,"column":3,"offset":12423},"end":{"line":217,"column":16,"offset":12436},"indent":[]}},{"type":"text","value":" is how many times a user is allowed to use a command before they are placed on cooldown.","position":{"start":{"line":217,"column":16,"offset":12436},"end":{"line":217,"column":105,"offset":12525},"indent":[]}}],"position":{"start":{"line":217,"column":3,"offset":12423},"end":{"line":217,"column":105,"offset":12525},"indent":[]}}],"position":{"start":{"line":217,"column":1,"offset":12421},"end":{"line":217,"column":105,"offset":12525},"indent":[]}},{"type":"listItem","spread":false,"checked":null,"children":[{"type":"paragraph","children":[{"type":"text","value":"Let's use our command as an example. We don't want someone to start spamming the role command so we can add a cooldown of 60 seconds. However, this would mean every time you give a role to someone, you would need to wait a whole minute to give a role to someone else. This is where ","position":{"start":{"line":219,"column":1,"offset":12528},"end":{"line":219,"column":283,"offset":12810},"indent":[]}},{"type":"inlineCode","value":"allowedUses","position":{"start":{"line":219,"column":283,"offset":12810},"end":{"line":219,"column":296,"offset":12823},"indent":[]}},{"type":"text","value":" shines! Let's set it to to 5 so that a user can use this command 5 times in a row before being asked to wait for 60 seconds.","position":{"start":{"line":219,"column":296,"offset":12823},"end":{"line":219,"column":421,"offset":12948},"indent":[]}}],"position":{"start":{"line":219,"column":1,"offset":12528},"end":{"line":219,"column":421,"offset":12948},"indent":[]}}],"position":{"start":{"line":218,"column":1,"offset":12526},"end":{"line":219,"column":421,"offset":12948},"indent":[1]}}],"position":{"start":{"line":216,"column":1,"offset":12276},"end":{"line":219,"column":421,"offset":12948},"indent":[1,1,1]}},{"type":"code","lang":"ts","meta":null,"value":"cooldown: {\n seconds: 60,\n allowedUses: 5\n},","position":{"start":{"line":221,"column":1,"offset":12950},"end":{"line":226,"column":4,"offset":13006},"indent":[1,1,1,1,1]}},{"type":"blockquote","children":[{"type":"paragraph","children":[{"type":"strong","children":[{"type":"text","value":"Note:","position":{"start":{"line":228,"column":5,"offset":13012},"end":{"line":228,"column":10,"offset":13017},"indent":[]}}],"position":{"start":{"line":228,"column":3,"offset":13010},"end":{"line":228,"column":12,"offset":13019},"indent":[]}},{"type":"text","value":" It is important to understand the way these two interact. The cooldown starts as soon as the first command is used. So, if a user uses the role command 5 times in 59 seconds, they only have to wait 1 second to do another 5 times.","position":{"start":{"line":228,"column":12,"offset":13019},"end":{"line":228,"column":242,"offset":13249},"indent":[]}}],"position":{"start":{"line":228,"column":3,"offset":13010},"end":{"line":228,"column":242,"offset":13249},"indent":[]}}],"position":{"start":{"line":228,"column":1,"offset":13008},"end":{"line":228,"column":242,"offset":13249},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"Let's give this a try shall we.","position":{"start":{"line":230,"column":1,"offset":13251},"end":{"line":230,"column":32,"offset":13282},"indent":[]}}],"position":{"start":{"line":230,"column":1,"offset":13251},"end":{"line":230,"column":32,"offset":13282},"indent":[]}},{"type":"list","ordered":true,"start":1,"spread":false,"children":[{"type":"listItem","spread":false,"checked":null,"children":[{"type":"paragraph","children":[{"type":"inlineCode","value":"!reload commands","position":{"start":{"line":232,"column":4,"offset":13287},"end":{"line":232,"column":22,"offset":13305},"indent":[]}}],"position":{"start":{"line":232,"column":4,"offset":13287},"end":{"line":232,"column":22,"offset":13305},"indent":[]}}],"position":{"start":{"line":232,"column":1,"offset":13284},"end":{"line":232,"column":22,"offset":13305},"indent":[]}},{"type":"listItem","spread":false,"checked":null,"children":[{"type":"paragraph","children":[{"type":"text","value":"Spam the ","position":{"start":{"line":233,"column":4,"offset":13309},"end":{"line":233,"column":13,"offset":13318},"indent":[]}},{"type":"inlineCode","value":"!role","position":{"start":{"line":233,"column":13,"offset":13318},"end":{"line":233,"column":20,"offset":13325},"indent":[]}},{"type":"text","value":" very quickly 6 times in under a minute.","position":{"start":{"line":233,"column":20,"offset":13325},"end":{"line":233,"column":60,"offset":13365},"indent":[]}}],"position":{"start":{"line":233,"column":4,"offset":13309},"end":{"line":233,"column":60,"offset":13365},"indent":[]}}],"position":{"start":{"line":233,"column":1,"offset":13306},"end":{"line":233,"column":60,"offset":13365},"indent":[]}}],"position":{"start":{"line":232,"column":1,"offset":13284},"end":{"line":233,"column":60,"offset":13365},"indent":[1]}},{"type":"heading","depth":2,"children":[{"type":"text","value":"Arguments","position":{"start":{"line":235,"column":4,"offset":13370},"end":{"line":235,"column":13,"offset":13379},"indent":[]}}],"position":{"start":{"line":235,"column":1,"offset":13367},"end":{"line":235,"column":13,"offset":13379},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"Arguments is an incredibly powerful feature in Discordeno. Like Permission Levels we will have an in depth look at arguments later in the guide. For now, let's try and understand this in a simple manner.","position":{"start":{"line":237,"column":1,"offset":13381},"end":{"line":237,"column":204,"offset":13584},"indent":[]}}],"position":{"start":{"line":237,"column":1,"offset":13381},"end":{"line":237,"column":204,"offset":13584},"indent":[]}},{"type":"list","ordered":false,"start":null,"spread":false,"children":[{"type":"listItem","spread":false,"checked":null,"children":[{"type":"paragraph","children":[{"type":"inlineCode","value":"name","position":{"start":{"line":239,"column":3,"offset":13588},"end":{"line":239,"column":9,"offset":13594},"indent":[]}},{"type":"text","value":": The name of the argument. Useful for when you need to alert the user X arg is missing or when you want to use the arg in your command.","position":{"start":{"line":239,"column":9,"offset":13594},"end":{"line":239,"column":145,"offset":13730},"indent":[]}}],"position":{"start":{"line":239,"column":3,"offset":13588},"end":{"line":239,"column":145,"offset":13730},"indent":[]}}],"position":{"start":{"line":239,"column":1,"offset":13586},"end":{"line":239,"column":145,"offset":13730},"indent":[]}},{"type":"listItem","spread":false,"checked":null,"children":[{"type":"paragraph","children":[{"type":"inlineCode","value":"type","position":{"start":{"line":240,"column":3,"offset":13733},"end":{"line":240,"column":9,"offset":13739},"indent":[]}},{"type":"text","value":": The type of the argument you would like. Defaults to string. Some of the ones available by default are \"number\", \"string\", \"...string\", \"boolean\", \"subcommand\", \"member\".","position":{"start":{"line":240,"column":9,"offset":13739},"end":{"line":240,"column":181,"offset":13911},"indent":[]}}],"position":{"start":{"line":240,"column":3,"offset":13733},"end":{"line":240,"column":181,"offset":13911},"indent":[]}}],"position":{"start":{"line":240,"column":1,"offset":13731},"end":{"line":240,"column":181,"offset":13911},"indent":[]}},{"type":"listItem","spread":false,"checked":null,"children":[{"type":"paragraph","children":[{"type":"inlineCode","value":"missing","position":{"start":{"line":241,"column":3,"offset":13914},"end":{"line":241,"column":12,"offset":13923},"indent":[]}},{"type":"text","value":": a function that will be run when this argument is not provided by the user or if the provided argument is not valid. By default, it does nothing.","position":{"start":{"line":241,"column":12,"offset":13923},"end":{"line":241,"column":159,"offset":14070},"indent":[]}}],"position":{"start":{"line":241,"column":3,"offset":13914},"end":{"line":241,"column":159,"offset":14070},"indent":[]}}],"position":{"start":{"line":241,"column":1,"offset":13912},"end":{"line":241,"column":159,"offset":14070},"indent":[]}},{"type":"listItem","spread":false,"checked":null,"children":[{"type":"paragraph","children":[{"type":"inlineCode","value":"required","position":{"start":{"line":242,"column":3,"offset":14073},"end":{"line":242,"column":13,"offset":14083},"indent":[]}},{"type":"text","value":": Whether this argument is required or optional. By default, this is true.","position":{"start":{"line":242,"column":13,"offset":14083},"end":{"line":242,"column":87,"offset":14157},"indent":[]}}],"position":{"start":{"line":242,"column":3,"offset":14073},"end":{"line":242,"column":87,"offset":14157},"indent":[]}}],"position":{"start":{"line":242,"column":1,"offset":14071},"end":{"line":242,"column":87,"offset":14157},"indent":[]}},{"type":"listItem","spread":false,"checked":null,"children":[{"type":"paragraph","children":[{"type":"inlineCode","value":"lowercase","position":{"start":{"line":243,"column":3,"offset":14160},"end":{"line":243,"column":14,"offset":14171},"indent":[]}},{"type":"text","value":": If the type is a string, this can forcibly lowercase the string.","position":{"start":{"line":243,"column":14,"offset":14171},"end":{"line":243,"column":80,"offset":14237},"indent":[]}}],"position":{"start":{"line":243,"column":3,"offset":14160},"end":{"line":243,"column":80,"offset":14237},"indent":[]}}],"position":{"start":{"line":243,"column":1,"offset":14158},"end":{"line":243,"column":80,"offset":14237},"indent":[]}},{"type":"listItem","spread":false,"checked":null,"children":[{"type":"paragraph","children":[{"type":"inlineCode","value":"literals","position":{"start":{"line":244,"column":3,"offset":14240},"end":{"line":244,"column":13,"offset":14250},"indent":[]}},{"type":"text","value":": If the type is string or subcommand you can provide literals. The argument MUST be exactly the same as the literals to be accepted. For example, if you want to make sure the argument is ","position":{"start":{"line":244,"column":13,"offset":14250},"end":{"line":244,"column":201,"offset":14438},"indent":[]}},{"type":"inlineCode","value":"a","position":{"start":{"line":244,"column":201,"offset":14438},"end":{"line":244,"column":204,"offset":14441},"indent":[]}},{"type":"text","value":" or ","position":{"start":{"line":244,"column":204,"offset":14441},"end":{"line":244,"column":208,"offset":14445},"indent":[]}},{"type":"inlineCode","value":"b","position":{"start":{"line":244,"column":208,"offset":14445},"end":{"line":244,"column":211,"offset":14448},"indent":[]}},{"type":"text","value":" only and not ","position":{"start":{"line":244,"column":211,"offset":14448},"end":{"line":244,"column":225,"offset":14462},"indent":[]}},{"type":"inlineCode","value":"c","position":{"start":{"line":244,"column":225,"offset":14462},"end":{"line":244,"column":228,"offset":14465},"indent":[]}},{"type":"text","value":".","position":{"start":{"line":244,"column":228,"offset":14465},"end":{"line":244,"column":229,"offset":14466},"indent":[]}}],"position":{"start":{"line":244,"column":3,"offset":14240},"end":{"line":244,"column":229,"offset":14466},"indent":[]}}],"position":{"start":{"line":244,"column":1,"offset":14238},"end":{"line":244,"column":229,"offset":14466},"indent":[]}},{"type":"listItem","spread":false,"checked":null,"children":[{"type":"paragraph","children":[{"type":"inlineCode","value":"defaultValue","position":{"start":{"line":245,"column":3,"offset":14469},"end":{"line":245,"column":17,"offset":14483},"indent":[]}},{"type":"text","value":": The default value for this argument/subcommand. If the user does not provide an argument or it is invalid, it can be defaulted to a certain value.","position":{"start":{"line":245,"column":17,"offset":14483},"end":{"line":245,"column":165,"offset":14631},"indent":[]}}],"position":{"start":{"line":245,"column":3,"offset":14469},"end":{"line":245,"column":165,"offset":14631},"indent":[]}}],"position":{"start":{"line":245,"column":1,"offset":14467},"end":{"line":245,"column":165,"offset":14631},"indent":[]}}],"position":{"start":{"line":239,"column":1,"offset":13586},"end":{"line":245,"column":165,"offset":14631},"indent":[1,1,1,1,1,1]}},{"type":"paragraph","children":[{"type":"text","value":"For our role command, we need a ","position":{"start":{"line":247,"column":1,"offset":14633},"end":{"line":247,"column":33,"offset":14665},"indent":[]}},{"type":"inlineCode","value":"member","position":{"start":{"line":247,"column":33,"offset":14665},"end":{"line":247,"column":41,"offset":14673},"indent":[]}},{"type":"text","value":" and a ","position":{"start":{"line":247,"column":41,"offset":14673},"end":{"line":247,"column":48,"offset":14680},"indent":[]}},{"type":"inlineCode","value":"role","position":{"start":{"line":247,"column":48,"offset":14680},"end":{"line":247,"column":54,"offset":14686},"indent":[]}},{"type":"text","value":".","position":{"start":{"line":247,"column":54,"offset":14686},"end":{"line":247,"column":55,"offset":14687},"indent":[]}}],"position":{"start":{"line":247,"column":1,"offset":14633},"end":{"line":247,"column":55,"offset":14687},"indent":[]}},{"type":"code","lang":"ts","meta":null,"value":"arguments: [\n {\n name: \"member\",\n type: \"member\",\n missing: (message) => {\n sendResponse(message, `you did not provide a member to give the role to. You can provide a @member mention, a member ID, or try using their nickname/username. The nickname/username will only work if they have been active in your server recently.`)\n }\n },\n {\n name: \"role\",\n type: \"role\",\n missing: (message) => {\n sendResponse(message, `you did not provide a role to give. You can provide a @role mention, a role ID, or it's name. If the role name did not work, try to use the **roleinfo** command to get the role ID.`)\n }\n }\n]","position":{"start":{"line":249,"column":1,"offset":14689},"end":{"line":266,"column":4,"offset":15340},"indent":[1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1]}},{"type":"heading","depth":2,"children":[{"type":"text","value":"Execute Option","position":{"start":{"line":268,"column":4,"offset":15345},"end":{"line":268,"column":18,"offset":15359},"indent":[]}}],"position":{"start":{"line":268,"column":1,"offset":15342},"end":{"line":268,"column":18,"offset":15359},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"The execute option is the code that will run when the command is triggered. The execute function is passed 3 parameters that you can use in your command.","position":{"start":{"line":270,"column":1,"offset":15361},"end":{"line":270,"column":154,"offset":15514},"indent":[]}}],"position":{"start":{"line":270,"column":1,"offset":15361},"end":{"line":270,"column":154,"offset":15514},"indent":[]}},{"type":"list","ordered":false,"start":null,"spread":false,"children":[{"type":"listItem","spread":false,"checked":null,"children":[{"type":"paragraph","children":[{"type":"inlineCode","value":"message","position":{"start":{"line":272,"column":3,"offset":15518},"end":{"line":272,"column":12,"offset":15527},"indent":[]}},{"type":"text","value":": The message object itself that triggered this command.","position":{"start":{"line":272,"column":12,"offset":15527},"end":{"line":272,"column":68,"offset":15583},"indent":[]}}],"position":{"start":{"line":272,"column":3,"offset":15518},"end":{"line":272,"column":68,"offset":15583},"indent":[]}}],"position":{"start":{"line":272,"column":1,"offset":15516},"end":{"line":272,"column":68,"offset":15583},"indent":[]}},{"type":"listItem","spread":false,"checked":null,"children":[{"type":"paragraph","children":[{"type":"inlineCode","value":"args","position":{"start":{"line":273,"column":3,"offset":15586},"end":{"line":273,"column":9,"offset":15592},"indent":[]}},{"type":"text","value":": The args that were provided by the user.","position":{"start":{"line":273,"column":9,"offset":15592},"end":{"line":273,"column":51,"offset":15634},"indent":[]}}],"position":{"start":{"line":273,"column":3,"offset":15586},"end":{"line":273,"column":51,"offset":15634},"indent":[]}}],"position":{"start":{"line":273,"column":1,"offset":15584},"end":{"line":273,"column":51,"offset":15634},"indent":[]}},{"type":"listItem","spread":false,"checked":null,"children":[{"type":"paragraph","children":[{"type":"inlineCode","value":"guild","position":{"start":{"line":274,"column":3,"offset":15637},"end":{"line":274,"column":10,"offset":15644},"indent":[]}},{"type":"text","value":": The server guild object where this command was run.","position":{"start":{"line":274,"column":10,"offset":15644},"end":{"line":274,"column":63,"offset":15697},"indent":[]}}],"position":{"start":{"line":274,"column":3,"offset":15637},"end":{"line":274,"column":63,"offset":15697},"indent":[]}}],"position":{"start":{"line":274,"column":1,"offset":15635},"end":{"line":274,"column":63,"offset":15697},"indent":[]}}],"position":{"start":{"line":272,"column":1,"offset":15516},"end":{"line":274,"column":63,"offset":15697},"indent":[1,1]}},{"type":"code","lang":"ts","meta":null,"value":"execute: function (message, args, guild) {\n // The code that is to be executed goes here\n}","position":{"start":{"line":276,"column":1,"offset":15699},"end":{"line":280,"column":4,"offset":15800},"indent":[1,1,1,1]}},{"type":"blockquote","children":[{"type":"paragraph","children":[{"type":"strong","children":[{"type":"text","value":"Note:","position":{"start":{"line":282,"column":5,"offset":15806},"end":{"line":282,"column":10,"offset":15811},"indent":[]}}],"position":{"start":{"line":282,"column":3,"offset":15804},"end":{"line":282,"column":12,"offset":15813},"indent":[]}},{"type":"text","value":" I prefer writing code using the function keyword, but you can easily change to the fat arrow function if you prefer.","position":{"start":{"line":282,"column":12,"offset":15813},"end":{"line":282,"column":129,"offset":15930},"indent":[]}}],"position":{"start":{"line":282,"column":3,"offset":15804},"end":{"line":282,"column":129,"offset":15930},"indent":[]}},{"type":"code","lang":"ts","meta":null,"value":"execute: (message, args, guild) => {\n // The code that is to be executed goes here\n}","position":{"start":{"line":283,"column":3,"offset":15933},"end":{"line":287,"column":6,"offset":16037},"indent":[3,3,3,3]}}],"position":{"start":{"line":282,"column":1,"offset":15802},"end":{"line":287,"column":6,"offset":16037},"indent":[1,1,1,1,1]}},{"type":"paragraph","children":[{"type":"text","value":"Let's start out by writing some pseudo-code(comments that will help us plan the code).","position":{"start":{"line":289,"column":1,"offset":16039},"end":{"line":289,"column":87,"offset":16125},"indent":[]}}],"position":{"start":{"line":289,"column":1,"offset":16039},"end":{"line":289,"column":87,"offset":16125},"indent":[]}},{"type":"code","lang":"ts","meta":null,"value":"execute: function (message, args, guild) {\n // If this was the everyone role alert with a silly error\n\n // If this is a managed role(some bots role) we can't give/remove alert with silly error\n\n // Get the bots highest role\n\n // Check if the bot has a role higher than the role that it will try to give.\n\n // If the role is too high alert the user.\n\n // If the user has this role already remove the role from them.\n\n // Check the command author's highest role\n\n // If the author does not have a role high enough to give this role alert\n\n // If the user has this role already we should remove it\n\n // Add the role to the user.\n\n // Alert the user that used the command that the user has been give the role.\n}","position":{"start":{"line":291,"column":1,"offset":16127},"end":{"line":315,"column":4,"offset":16855},"indent":[1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1]}},{"type":"paragraph","children":[{"type":"text","value":"Nice! The plan for the code is complete. Now, let's add in the code.","position":{"start":{"line":317,"column":1,"offset":16857},"end":{"line":317,"column":69,"offset":16925},"indent":[]}}],"position":{"start":{"line":317,"column":1,"offset":16857},"end":{"line":317,"column":69,"offset":16925},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"The first thing we are going to try is to check if the role the user provided is the same as the everyone role.","position":{"start":{"line":319,"column":1,"offset":16927},"end":{"line":319,"column":112,"offset":17038},"indent":[]}}],"position":{"start":{"line":319,"column":1,"offset":16927},"end":{"line":319,"column":112,"offset":17038},"indent":[]}},{"type":"blockquote","children":[{"type":"paragraph","children":[{"type":"strong","children":[{"type":"text","value":"Note:","position":{"start":{"line":321,"column":5,"offset":17044},"end":{"line":321,"column":10,"offset":17049},"indent":[]}}],"position":{"start":{"line":321,"column":3,"offset":17042},"end":{"line":321,"column":12,"offset":17051},"indent":[]}},{"type":"text","value":" The everyone role ID is the same as the server guild ID.","position":{"start":{"line":321,"column":12,"offset":17051},"end":{"line":321,"column":69,"offset":17108},"indent":[]}}],"position":{"start":{"line":321,"column":3,"offset":17042},"end":{"line":321,"column":69,"offset":17108},"indent":[]}}],"position":{"start":{"line":321,"column":1,"offset":17040},"end":{"line":321,"column":69,"offset":17108},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"To do this, we are going to want something like this:","position":{"start":{"line":323,"column":1,"offset":17110},"end":{"line":323,"column":54,"offset":17163},"indent":[]}}],"position":{"start":{"line":323,"column":1,"offset":17110},"end":{"line":323,"column":54,"offset":17163},"indent":[]}},{"type":"code","lang":"ts","meta":null,"value":"if (args.role.id === message.guildID) {\n return sendResponse(message, \"The everyone role can not be given to anyone because everyone has the everyone role already. *Keep calm and let Carter figure it out*!\");\n}","position":{"start":{"line":325,"column":1,"offset":17165},"end":{"line":329,"column":4,"offset":17386},"indent":[1,1,1,1]}},{"type":"paragraph","children":[{"type":"text","value":"You might be seeing an error since we didn't provide the accurate typings for the ","position":{"start":{"line":331,"column":1,"offset":17388},"end":{"line":331,"column":83,"offset":17470},"indent":[]}},{"type":"inlineCode","value":"args","position":{"start":{"line":331,"column":83,"offset":17470},"end":{"line":331,"column":89,"offset":17476},"indent":[]}},{"type":"text","value":" parameter. The message and guild parameter is automated but the args is dynamic depending on your ","position":{"start":{"line":331,"column":89,"offset":17476},"end":{"line":331,"column":188,"offset":17575},"indent":[]}},{"type":"inlineCode","value":"arguments","position":{"start":{"line":331,"column":188,"offset":17575},"end":{"line":331,"column":199,"offset":17586},"indent":[]}},{"type":"text","value":" option for your command. So let's do this real quick.","position":{"start":{"line":331,"column":199,"offset":17586},"end":{"line":331,"column":253,"offset":17640},"indent":[]}}],"position":{"start":{"line":331,"column":1,"offset":17388},"end":{"line":331,"column":253,"offset":17640},"indent":[]}},{"type":"code","lang":"ts","meta":null,"value":"execute: function (message, args: RoleArgs, guild) {\n // If this was the everyone role alert with a silly error\n if (args.role.id === message.guildID) {\n return sendResponse(message, \"Are you trying to make this person a super hero? Everyone has the everyone role. I can't give the everyone role to another user.\");\n }\n\n // Lots of comments here hidden so you can see the changes easily.\n}\n\ninterface RoleArgs {\n role: Role;\n member: Member;\n}","position":{"start":{"line":333,"column":1,"offset":17642},"end":{"line":347,"column":4,"offset":18104},"indent":[1,1,1,1,1,1,1,1,1,1,1,1,1,1]}},{"type":"paragraph","children":[{"type":"text","value":"Awesome! Let's keep going.","position":{"start":{"line":349,"column":1,"offset":18106},"end":{"line":349,"column":27,"offset":18132},"indent":[]}}],"position":{"start":{"line":349,"column":1,"offset":18106},"end":{"line":349,"column":27,"offset":18132},"indent":[]}},{"type":"code","lang":"ts","meta":null,"value":"execute: function (message, args: RoleArgs, guild) {\n // If this was the everyone role alert with a silly error\n if (args.role.id === message.guildID) {\n return sendResponse(message, \"I don't know if you noticed or not but I'm an extremely arrogant bot who tends to think all of his plans will work. But I can't give the everyone role to someone.\");\n }\n\n // If this is a managed role(some bots role) we can't give/remove alert with silly error\n if (args.role.managed) {\n return sendResponse(message, \"Dammit man, just 'cause I'm Scottish doesn't mean I can give your people managed roles.\")\n }\n\n // Get the bots highest role\n const botsHighestRole = highestRole(message.guildID, botID);\n\n // Check if the bot has a role higher than the role that it will try to give.\n const botIsHigher = higherRolePosition(message.guildID, botsHighestRole.id, args.role.id)\n\n // If the role is too high alert the user.\n if (!botIsHigher) {\n return sendResponse(message, \"Okay look, asking me give a role that is higher than my highest role is ridiculous! I am the first bot to admit I don't know who these people are nor do I care to. Look, if you'd like I could take you down the hall and just point at the people who annoy me more than the rest. But that's about as useful as I get.\")\n }\n\n // Check the command author's highest role\n const membersHighestRole = highestRole(message.guildID, message.author.id);\n\n // If the author does not have a role high enough to give this role alert\n if (!higherRolePosition(message.guildID, membersHighestRole.id, args.role.id)) {\n return sendResponse(message, \"In my culture, whenever someone tries to give a role that is higher than their highest role, I would be well within my rights to dismember you.\")\n }\n\n // If the user has this role already we should remove it\n if (message.member().roles.includes(args.role.id)) {\n removeRole(message.guildID, args.member.user.id, args.role.id, `${message.author.tag} used the role command to remove this role.`)\n // Alert the user that used the command that the user has lost the role.\n return sendResponse(message, `The role **${args.role.name}** has been removed from **${args.member.tag}**.`)\n }\n\n // Add the role to the user.\n addRole(guildID, memberID, roleID)\n\n // Alert the user that used the command that the user has been give the role.\n return sendResponse(message, `The role **${args.role.name}** has been added to **${args.member.tag}**.`)\n}","position":{"start":{"line":352,"column":1,"offset":18135},"end":{"line":396,"column":4,"offset":20611},"indent":[1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1]}},{"type":"paragraph","children":[{"type":"text","value":"The final version of the command should look something like this:","position":{"start":{"line":398,"column":1,"offset":20613},"end":{"line":398,"column":66,"offset":20678},"indent":[]}}],"position":{"start":{"line":398,"column":1,"offset":20613},"end":{"line":398,"column":66,"offset":20678},"indent":[]}},{"type":"code","lang":"ts","meta":null,"value":"import { highestRole, higherRolePosition, botID, removeRole, addRole, Role, Member } from \"../../deps.ts\";\nimport { botCache } from \"../../mod.ts\";\nimport { PermissionLevels } from \"../types/commands.ts\";\nimport { sendResponse } from \"../utils/helpers.ts\";\n\nbotCache.commands.set(\"role\", {\n name: \"role\",\n permissionLevel: [PermissionLevels.MODERATOR, PermissionLevels.ADMIN],\n botServerPermissions: [\"MANAGE_ROLES\"],\n botChannelPermissions: [\"SEND_MESSAGES\"],\n cooldown: {\n seconds: 60,\n allowedUses: 5,\n },\n arguments: [\n\t\t{\n\t\t\tname: \"member\",\n\t\t\ttype: \"member\",\n\t\t\tmissing: (message) => {\n\t\t\t\tsendResponse(message, `you did not provide a member to give the role to. You can provide a @member mention, a member ID, or try using their nickname/username. The nickname/username will only work if they have been active in your server recently.`)\n\t\t\t}\n\t\t},\n\t\t{\n\t\t\tname: \"role\",\n\t\t\ttype: \"role\",\n\t\t\tmissing: (message) => {\n\t\t\t\tsendResponse(message, `you did not provide a role to give. You can provide a @role mention, a role ID, or it's name. If the role name did not work, try to use the **roleinfo** command to get the role ID.`)\n\t\t\t}\n\t\t}\n\t],\n execute: function (message, args: RoleArgs) {\n // If this was the everyone role alert with a silly error\n if (args.role.id === message.guildID) {\n return sendResponse(\n message,\n \"I don't know if you noticed or not but I'm an extremely arrogant bot who tends to think all of his plans will work. But I can't give the everyone role to someone.\",\n );\n }\n\n // If this is a managed role(some bots role) we can't give/remove alert with silly error\n if (args.role.managed) {\n return sendResponse(\n message,\n \"Dammit man, just 'cause I'm Scottish doesn't mean I can give your people managed roles.\",\n );\n }\n\n // Get the bots highest role\n const botsHighestRole = highestRole(message.guildID, botID);\n\n // Check if the bot has a role higher than the role that it will try to give. If the role is too high alert the user.\n if (!botsHighestRole || !higherRolePosition(\n message.guildID,\n botsHighestRole.id,\n args.role.id,\n )) {\n return sendResponse(\n message,\n \"Okay look, asking me give a role that is higher than my highest role is ridiculous! I am the first bot to admit I don't know who these people are nor do I care to. Look, if you'd like I could take you down the hall and just point at the people who annoy me more than the rest. But that's about as useful as I get.\",\n );\n }\n\n // Check the command author's highest role\n const membersHighestRole = highestRole(message.guildID, message.author.id);\n\n // If the author does not have a role high enough to give this role alert\n if (!membersHighestRole ||\n !higherRolePosition(message.guildID, membersHighestRole.id, args.role.id)\n ) {\n return sendResponse(\n message,\n \"In my culture, whenever someone tries to give a role that is higher than their highest role, I would be well within my rights to dismember you.\",\n );\n }\n\n // If the user has this role already we should remove it\n if (message.member()?.roles.includes(args.role.id)) {\n removeRole(\n message.guildID,\n args.member.user.id,\n args.role.id,\n `${message.author.username} used the role command to remove this role.`,\n );\n // Alert the user that used the command that the user has lost the role.\n return sendResponse(\n message,\n `The role **${args.role.name}** has been removed from **${args.member.tag}**.`,\n );\n }\n\n // Add the role to the user.\n addRole(message.guildID, args.member.user.id, args.role.id, `${message.author.username} used the role command to give this role.`);\n\n // Alert the user that used the command that the user has been give the role.\n return sendResponse(\n message,\n `The role **${args.role.name}** has been added to **${args.member.tag}**.`,\n );\n },\n});\n\ninterface RoleArgs {\n role: Role;\n member: Member;\n}","position":{"start":{"line":400,"column":1,"offset":20680},"end":{"line":506,"column":4,"offset":24762},"indent":[1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1]}},{"type":"blockquote","children":[{"type":"paragraph","children":[{"type":"strong","children":[{"type":"text","value":"Note:","position":{"start":{"line":508,"column":5,"offset":24768},"end":{"line":508,"column":10,"offset":24773},"indent":[]}}],"position":{"start":{"line":508,"column":3,"offset":24766},"end":{"line":508,"column":12,"offset":24775},"indent":[]}},{"type":"text","value":" The response strings are a play on some funny Stargate(my favorite tv show) moments. Feel free to change as you wish to fit your bot's personality.","position":{"start":{"line":508,"column":12,"offset":24775},"end":{"line":508,"column":160,"offset":24923},"indent":[]}}],"position":{"start":{"line":508,"column":3,"offset":24766},"end":{"line":508,"column":160,"offset":24923},"indent":[]}}],"position":{"start":{"line":508,"column":1,"offset":24764},"end":{"line":508,"column":160,"offset":24923},"indent":[]}},{"type":"heading","depth":2,"children":[{"type":"text","value":"Dynamic(Advanced Level) Command Creation","position":{"start":{"line":510,"column":4,"offset":24928},"end":{"line":510,"column":44,"offset":24968},"indent":[]}}],"position":{"start":{"line":510,"column":1,"offset":24925},"end":{"line":510,"column":44,"offset":24968},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"This is some advanced level super magical command creation skills. Discordeno gives you the power to dynamically create commands. What that means is you can write the code for one command but dynamically create like 50 commands using that same code.","position":{"start":{"line":512,"column":1,"offset":24970},"end":{"line":512,"column":250,"offset":25219},"indent":[]}}],"position":{"start":{"line":512,"column":1,"offset":24970},"end":{"line":512,"column":250,"offset":25219},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"For example, in my main bot I have a lot of \"fun\" commands like ","position":{"start":{"line":514,"column":1,"offset":25221},"end":{"line":514,"column":65,"offset":25285},"indent":[]}},{"type":"inlineCode","value":".hug","position":{"start":{"line":514,"column":65,"offset":25285},"end":{"line":514,"column":71,"offset":25291},"indent":[]}},{"type":"text","value":" or ","position":{"start":{"line":514,"column":71,"offset":25291},"end":{"line":514,"column":75,"offset":25295},"indent":[]}},{"type":"inlineCode","value":".kiss","position":{"start":{"line":514,"column":75,"offset":25295},"end":{"line":514,"column":82,"offset":25302},"indent":[]}},{"type":"text","value":" etc... All of these files have the exact same code except for 1 word being the command name. Would it not be better to simply write the code once and dynamically create every single command. Let me show you how that works.","position":{"start":{"line":514,"column":82,"offset":25302},"end":{"line":514,"column":305,"offset":25525},"indent":[]}}],"position":{"start":{"line":514,"column":1,"offset":25221},"end":{"line":514,"column":305,"offset":25525},"indent":[]}},{"type":"list","ordered":false,"start":null,"spread":false,"children":[{"type":"listItem","spread":false,"checked":null,"children":[{"type":"paragraph","children":[{"type":"text","value":"Create a file in the commands folder called ","position":{"start":{"line":516,"column":3,"offset":25529},"end":{"line":516,"column":47,"offset":25573},"indent":[]}},{"type":"inlineCode","value":"fun.ts","position":{"start":{"line":516,"column":47,"offset":25573},"end":{"line":516,"column":55,"offset":25581},"indent":[]}},{"type":"text","value":" which will create all our fun commands.","position":{"start":{"line":516,"column":55,"offset":25581},"end":{"line":516,"column":95,"offset":25621},"indent":[]}}],"position":{"start":{"line":516,"column":3,"offset":25529},"end":{"line":516,"column":95,"offset":25621},"indent":[]}}],"position":{"start":{"line":516,"column":1,"offset":25527},"end":{"line":516,"column":95,"offset":25621},"indent":[]}}],"position":{"start":{"line":516,"column":1,"offset":25527},"end":{"line":516,"column":95,"offset":25621},"indent":[]}},{"type":"code","lang":"ts","meta":null,"value":"import { Member, sendMessage, chooseRandom, avatarURL } from \"../../deps.ts\";\nimport { botCache } from \"../../mod.ts\";\nimport { createCommandAliases, sendEmbed } from \"../utils/helpers.ts\";\nimport { configs } from \"../../configs.ts\";\nimport { Embed } from \"../utils/Embed.ts\";\nimport { translate } from \"../utils/i18next.ts\";\n\nconst funCommandData = [\n { name: \"bite\", gifs: configs.gifs.bite },\n { name: \"cuddle\", gifs: configs.gifs.cuddle },\n { name: \"dance\", gifs: configs.gifs.dance },\n { name: \"hug\", gifs: configs.gifs.hug },\n { name: \"kiss\", gifs: configs.gifs.kiss },\n { name: \"kanna\", gifs: configs.gifs.kanna },\n { name: \"kiss\", gifs: configs.gifs.kiss },\n { name: \"kitten\", gifs: configs.gifs.kitten },\n { name: \"lmao\", gifs: configs.gifs.lmao, aliases: [\"lol\"] },\n { name: \"pat\", gifs: configs.gifs.pat },\n { name: \"poke\", gifs: configs.gifs.poke },\n { name: \"pony\", gifs: configs.gifs.pony },\n { name: \"puppy\", gifs: configs.gifs.puppy },\n { name: \"raphtalia\", gifs: configs.gifs.raphtalia },\n { name: \"stargate\", gifs: configs.gifs.stargate },\n { name: \"supernatural\", gifs: configs.gifs.supernatural },\n { name: \"tickle\", gifs: configs.gifs.tickle },\n { name: \"zerotwo\", gifs: configs.gifs.zerotwo },\n];\n\nfunCommandData.forEach((data) => {\n botCache.commands.set(data.name, {\n name: data.name,\n botChannelPermissions: [\"SEND_MESSAGES\", \"EMBED_LINKS\"],\n cooldown: {\n seconds: 2,\n },\n arguments: [\n {\n name: \"member\",\n type: \"member\",\n required: false,\n },\n ],\n execute: function (message, args: FunArgs) {\n\t\t\t// If a member is provided use that otherwise set the member themself\n const member = args.member || message.member()!;\n\n const type = member.user.id === message.author.id\n // Silly response like if user tries to hug themself\n ? \"SELF\"\n // Response for when user tries to hug another user\n : \"OTHER\";\n\n\n // Create an embed\n const embed = new Embed()\n .setAuthor(member.tag, avatarURL(member))\n .setDescription(\n translate(\n message.guildID,\n `commands/fun/${data.name}:${type}`,\n { mention: message.member()!.mention, user: member.mention },\n ),\n )\n .setImage(chooseRandom(data.gifs));\n\n return sendEmbed(message.channel, embed);\n },\n });\n\n if (data.aliases?.length) {\n createCommandAliases(data.name, data.aliases);\n }\n});\n\ninterface FunArgs {\n member?: Member;\n}","position":{"start":{"line":518,"column":1,"offset":25623},"end":{"line":596,"column":4,"offset":28138},"indent":[1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1]}},{"type":"paragraph","children":[{"type":"text","value":"Take a minute to realize what just happened. This has made 18 different unique commands dynamically. In 1 file, using the same piece of code, we created so many commands. You can easily add more commands to this. For example, if you wanted to add weeb(animated) versions of these commands. Then you are at 36 commands with 1 simple command file.","position":{"start":{"line":598,"column":1,"offset":28140},"end":{"line":598,"column":346,"offset":28485},"indent":[]}}],"position":{"start":{"line":598,"column":1,"offset":28140},"end":{"line":598,"column":346,"offset":28485},"indent":[]}},{"type":"paragraph","children":[{"type":"strong","children":[{"type":"text","value":"That ladies and gentleman is the power and magic of Discordeno!","position":{"start":{"line":600,"column":3,"offset":28489},"end":{"line":600,"column":66,"offset":28552},"indent":[]}}],"position":{"start":{"line":600,"column":1,"offset":28487},"end":{"line":600,"column":68,"offset":28554},"indent":[]}}],"position":{"start":{"line":600,"column":1,"offset":28487},"end":{"line":600,"column":68,"offset":28554},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"Take a minute to stand up, step back and make some room around you. Now start dancing because you just acheived one of the most complex things in bot development. You have already created about 36 commands!!!!","position":{"start":{"line":602,"column":1,"offset":28556},"end":{"line":602,"column":210,"offset":28765},"indent":[]}}],"position":{"start":{"line":602,"column":1,"offset":28556},"end":{"line":602,"column":210,"offset":28765},"indent":[]}},{"type":"blockquote","children":[{"type":"paragraph","children":[{"type":"strong","children":[{"type":"text","value":"Note:","position":{"start":{"line":604,"column":5,"offset":28771},"end":{"line":604,"column":10,"offset":28776},"indent":[]}}],"position":{"start":{"line":604,"column":3,"offset":28769},"end":{"line":604,"column":12,"offset":28778},"indent":[]}},{"type":"text","value":" The command above uses translations which we will cover in depth in a later section of this guide.","position":{"start":{"line":604,"column":12,"offset":28778},"end":{"line":604,"column":111,"offset":28877},"indent":[]}}],"position":{"start":{"line":604,"column":3,"offset":28769},"end":{"line":604,"column":111,"offset":28877},"indent":[]}}],"position":{"start":{"line":604,"column":1,"offset":28767},"end":{"line":604,"column":111,"offset":28877},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"Once you are ready, let's proceed to making our inhibitors.","position":{"start":{"line":606,"column":1,"offset":28879},"end":{"line":606,"column":60,"offset":28938},"indent":[]}}],"position":{"start":{"line":606,"column":1,"offset":28879},"end":{"line":606,"column":60,"offset":28938},"indent":[]}},{"type":"export","value":"export const _frontmatter = {\"title\":\"Creating A Command\",\"metaTitle\":\"Creating A Command | Discordeno\",\"metaDescription\":\"Let's create our very first command with Discordeno!\"}","position":{"start":{"line":609,"column":1,"offset":28941},"end":{"line":609,"column":178,"offset":29118},"indent":[]}}],"position":{"start":{"line":1,"column":1,"offset":0},"end":{"line":609,"column":178,"offset":29118}}},"scopeImports":["import * as React from 'react'"],"scopeIdentifiers":["React"],"body":"function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }\n\nfunction _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }\n\nfunction _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }\n\n/* @jsx mdx */\nvar _frontmatter = {\n \"title\": \"Creating A Command\",\n \"metaTitle\": \"Creating A Command | Discordeno\",\n \"metaDescription\": \"Let's create our very first command with Discordeno!\"\n};\nvar layoutProps = {\n _frontmatter: _frontmatter\n};\nvar MDXLayout = \"wrapper\";\nreturn function MDXContent(_ref) {\n var components = _ref.components,\n props = _objectWithoutProperties(_ref, [\"components\"]);\n\n return mdx(MDXLayout, _extends({}, layoutProps, props, {\n components: components,\n mdxType: \"MDXLayout\"\n }), mdx(\"p\", null, \"Really great job. Now, lets dive into trying to use some of the commands and try to make our very own command.\"), mdx(\"h2\", null, \"Editing Invite Command\"), mdx(\"p\", null, \"Let's first start by taking an existing command and slightly modifying it to your needs. Let's use the \", mdx(\"inlineCode\", {\n parentName: \"p\"\n }, \"Invite\"), \" command as our example. When you open the command, you will see something like this:\"), mdx(\"pre\", null, mdx(\"code\", _extends({\n parentName: \"pre\"\n }, {\n \"className\": \"language-ts\"\n }), \"import { botCache } from \\\"../../mod.ts\\\";\\nimport { sendMessage } from \\\"https://raw.githubusercontent.com/Skillz4Killz/Discordeno/v7/src/handlers/channel.ts\\\";\\nimport { botID } from \\\"https://raw.githubusercontent.com/Skillz4Killz/Discordeno/v7/src/module/client.ts\\\";\\n\\nbotCache.commands.set(\\\"invite\\\", {\\n name: \\\"invite\\\",\\n execute: function (message) {\\n // Replace the permission number at the end to request the permissions you wish to request. By default, this will request Admin perms.\\n sendMessage(\\n message.channel,\\n `https://discordapp.com/oauth2/authorize?client_id=${botID}&scope=bot&permissions=8`,\\n );\\n },\\n});\\n\")), mdx(\"p\", null, \"Let's break this down. The first three lines are importing the necessary things from their files so we can use them in this command. Don't worry if this doesn't make sense, most of the time, this will all be done automatically for you if you use a good code editor like Visual Studio Code. We create a command by doing:\"), mdx(\"pre\", null, mdx(\"code\", _extends({\n parentName: \"pre\"\n }, {\n \"className\": \"language-ts\"\n }), \"botCache.commands.set('commandname', {\\n\\n})\\n\")), mdx(\"p\", null, \"The command name here must be unique. If it is not unique, your commands will not work properly as you wish. For example, you can't have 2 commands with the \", mdx(\"inlineCode\", {\n parentName: \"p\"\n }, \"ping\"), \" name. In this case, our command is called \", mdx(\"inlineCode\", {\n parentName: \"p\"\n }, \"invite\"), \".\"), mdx(\"p\", null, \"The \", mdx(\"inlineCode\", {\n parentName: \"p\"\n }, \"name: 'invite'\"), \" is also written as it is useful for our help command and inhibitors! Normally, these two things will be the same. So far it's super easy right.\"), mdx(\"p\", null, \"Next is the \", mdx(\"inlineCode\", {\n parentName: \"p\"\n }, \"execute\"), \". This is where the magic happens. This is the function that is triggered when the command is ran by a user. In this case, the bot simply sends a message to a channel where the command was ran and sends an invite link. Let's take a minute and optimize this for our case. We don't \", mdx(\"strong\", {\n parentName: \"p\"\n }, \"NEED\"), \" admin permissions for our bot. Let's go to the \", mdx(\"a\", _extends({\n parentName: \"p\"\n }, {\n \"href\": \"https://discordapi.com/permissions.html#0\"\n }), \"permission calculator\"), \" and figure out the permissions we need for our bot.\"), mdx(\"p\", null, \"Once you have decided which permissions you want to request, you can copy the number and replace it here. For example, if we want \", mdx(\"inlineCode\", {\n parentName: \"p\"\n }, \"68640\"), \" as our permissions. We can modify our command to be:\"), mdx(\"pre\", null, mdx(\"code\", _extends({\n parentName: \"pre\"\n }, {\n \"className\": \"language-ts\"\n }), \" `https://discordapp.com/oauth2/authorize?client_id=${botID}&scope=bot&permissions=68640`,\\n\")), mdx(\"p\", null, \"Lastly, let's get rid of the comment there as now it is customized to our needs.\"), mdx(\"h3\", null, \"Command Descriptions\"), mdx(\"p\", null, \"Right now, if you were to go to Discord and type \", mdx(\"inlineCode\", {\n parentName: \"p\"\n }, \"!help invite\"), \", you would see quite a bit of information. But where does all that text come from? It's not in this file. The description option tells Discordeno what to show the user when they use the help command. In that help message, each command has a small description next to it. The magic is happening because of Discordeno's translations feature.\"), mdx(\"blockquote\", null, mdx(\"p\", {\n parentName: \"blockquote\"\n }, \"Discordeno has built in multi-lingual support. You can support as many languages as you wish. We will learn more about languages when we create our own language but for now we just want to see how to customize the command. What we are going to do below isn't the correct way but it's the easy way to learn. We will see the correct way to do it when we get to translations.\")), mdx(\"p\", null, \"Let's add a custom description to our invite command.\"), mdx(\"pre\", null, mdx(\"code\", _extends({\n parentName: \"pre\"\n }, {\n \"className\": \"language-ts\"\n }), \" name: \\\"invite\\\",\\n description: \\\"Like the bot? Use this link to add it to your server!\\\"\\n\")), mdx(\"p\", null, \"\\uD83C\\uDF89 It's that simple. So let's restart the bot and see how it changed. Use \", mdx(\"strong\", {\n parentName: \"p\"\n }, \"CTRL + C\"), \" to shut down the bot. Then run the command from earlier.\"), mdx(\"pre\", null, mdx(\"code\", _extends({\n parentName: \"pre\"\n }, {\n \"className\": \"language-shell\"\n }), \"deno run --allow-net --allow-read mod.ts\\n\")), mdx(\"p\", null, \"To access this easily, most likely all you need to do is press the \", mdx(\"strong\", {\n parentName: \"p\"\n }, \"UP ARROW\"), \" key. Feel free to copy paste this if it doesn't work.\"), mdx(\"p\", null, \"Once the bot is started try \", mdx(\"inlineCode\", {\n parentName: \"p\"\n }, \"!help invite\"), \" again and you will see the change! \\uD83C\\uDF89\"), mdx(\"h2\", null, \"Command Aliases\"), mdx(\"p\", null, \"Now, let's make this a little bit easier. What if we wanted this command to also work with other names besides \", mdx(\"inlineCode\", {\n parentName: \"p\"\n }, \"invite\"), \". For example, as a shortcut what if users could just type \", mdx(\"inlineCode\", {\n parentName: \"p\"\n }, \"!inv\"), \" or as an alias type \", mdx(\"inlineCode\", {\n parentName: \"p\"\n }, \"!join\"), \". Let's go ahead and set that up. Go to the very last line of invite command file and type in \", mdx(\"inlineCode\", {\n parentName: \"p\"\n }, \"alias\"), \". You will see a popup showing you an autocompleted version of \", mdx(\"inlineCode\", {\n parentName: \"p\"\n }, \"createCommandAliases\"), \". Press enter and boom the magic is happening!\"), mdx(\"p\", null, \"The createCommandAliases takes in two arguments. The first argument is always the command name. In this case it is \", mdx(\"inlineCode\", {\n parentName: \"p\"\n }, \"invite\"), \". The second argument is the aliases you want to provide. Let's add in the two aliases we wanted.\"), mdx(\"pre\", null, mdx(\"code\", _extends({\n parentName: \"pre\"\n }, {\n \"className\": \"language-ts\"\n }), \" `https://discordapp.com/oauth2/authorize?client_id=${botID}&scope=bot&permissions=68640`,\\n );\\n },\\n});\\n\\ncreateCommandAliases('invite', ['inv', 'join'])\\n\")), mdx(\"blockquote\", null, mdx(\"p\", {\n parentName: \"blockquote\"\n }, mdx(\"strong\", {\n parentName: \"p\"\n }, \"Note:\"), \" If you only want to add 1 alias, you can pass in a simple string instead of an array as well as the second argument.\")), mdx(\"p\", null, \"Notice, I added 2 aliases here. You can add as many aliases as you like. If you see a lot of users typing it wrong by accident you can add those typos as aliases as well.\"), mdx(\"p\", null, \"Let's start testing this out. But first, let's understand something important.\"), mdx(\"h2\", null, \"Reloading\"), mdx(\"p\", null, \"Okay, we need to first understand a core concept of developing discord bots. If you had to restart your bot every time you made a tiny change, it would get really annoying/tedious to do. Also, if you had restarted your bot 1000 times, you would be in big trouble because Discord would ban your bot for 24 hours. The bigger your bot gets, the faster it is to hit this limit of 1000 identify calls to the Discord API.\"), mdx(\"p\", null, \"To solve this issue, Discordeno provides you with a really cool \", mdx(\"inlineCode\", {\n parentName: \"p\"\n }, \"reload\"), \" command. Whenever you make a change to any command, event, monitor, inhibitor, task, language or argument you can simply reload it. You don't need to restart your bot every time.\"), mdx(\"p\", null, \"Now since we added the aliases above, let's test it out.\"), mdx(\"ol\", null, mdx(\"li\", {\n parentName: \"ol\"\n }, mdx(\"inlineCode\", {\n parentName: \"li\"\n }, \"!inv\"), \" this will not work\"), mdx(\"li\", {\n parentName: \"ol\"\n }, mdx(\"inlineCode\", {\n parentName: \"li\"\n }, \"!reload commands\"), \" this will reload the files and the aliases will be created.\"), mdx(\"li\", {\n parentName: \"ol\"\n }, mdx(\"inlineCode\", {\n parentName: \"li\"\n }, \"!inv\"), \" This will now work. \\uD83C\\uDF89\")), mdx(\"hr\", null), mdx(\"p\", null, \"Perfect! You can take some time and customize the invite command to your needs if you wish. For example, this is my bot's invite command.\"), mdx(\"p\", null, mdx(\"img\", _extends({\n parentName: \"p\"\n }, {\n \"src\": \"https://i.imgur.com/4WRFMtR.png\",\n \"alt\": \"image\"\n }))), mdx(\"p\", null, \"Nice! You can now customize any of the commands from Discordeno as you wish. Then we will continue to making our very own command so we can learn about all the options that Discordeno gives us when it comes to making commands. As you learn more in this guide, you can keep improving it.\"), mdx(\"p\", null, \"If you get stuck, don't worry. When you are ready, let's continue to the next step.\"), mdx(\"h2\", null, \"Creating A Command\"), mdx(\"p\", null, \"Let's make a command that will allow guild admins to give or take roles from a member. Since, we are creating a \", mdx(\"inlineCode\", {\n parentName: \"p\"\n }, \"Moderation\"), \" command to give or take roles, let's go ahead and create a Category folder called \", mdx(\"inlineCode\", {\n parentName: \"p\"\n }, \"Moderation\"), \" and then create a file called \", mdx(\"inlineCode\", {\n parentName: \"p\"\n }, \"role.ts\"), \". Once the file is made, you can paste this following base snippet to make our first command.\"), mdx(\"pre\", null, mdx(\"code\", _extends({\n parentName: \"pre\"\n }, {\n \"className\": \"language-ts\"\n }), \"import { botCache } from \\\"../../mod.ts\\\";\\nimport { sendMessage } from \\\"https://raw.githubusercontent.com/Skillz4Killz/Discordeno/v7/src/handlers/channel.ts\\\";\\nimport { PermissionLevels } from \\\"../types/commands.ts\\\";\\nimport { createCommandAliases } from \\\"../utils/helpers\\\";\\n\\nbotCache.commands.set(\\\"commandname\\\", {\\n name: \\\"commandname\\\",\\n dmOnly: false,\\n guildOnly: false,\\n nsfw: false,\\n permissionLevel: [PermissionLevels.MEMBER],\\n botServerPermissions: [],\\n botChannelPermissions: [],\\n userServerPermissions: [],\\n userChannelPermissions: [],\\n description: string,\\n cooldown: {\\n seconds: 0,\\n allowedUses: 0,\\n },\\n arguments: [],\\n execute: function (message, args, guild) {\\n // The code for your command goes here\\n }\\n});\\n\\n// createCommandAliases(\\\"commandname\\\", [\\\"alias\\\"])\\n\")), mdx(\"h2\", null, \"Understanding Command Options\"), mdx(\"p\", null, \"Woah! We just added a massive file but most of that stuff is new to us. Don't worry, let's break everything down step by step.\"), mdx(\"blockquote\", null, mdx(\"p\", {\n parentName: \"blockquote\"\n }, mdx(\"strong\", {\n parentName: \"p\"\n }, \"Note:\"), \" Any options that are not changed from the snippet above can actually be deleted as Discordeno will use the default option if you do not provide anything for that option. This can help keep your files cleaner.\")), mdx(\"p\", null, \"Before we start, quickly update the command name and description.\"), mdx(\"blockquote\", null, mdx(\"p\", {\n parentName: \"blockquote\"\n }, mdx(\"strong\", {\n parentName: \"p\"\n }, \"Note:\"), \" Once you highlight the \", mdx(\"inlineCode\", {\n parentName: \"p\"\n }, \"commandname\"), \", press \", mdx(\"strong\", {\n parentName: \"p\"\n }, \"CTRL + SHIFT + L\"), \" to select ALL the \", mdx(\"inlineCode\", {\n parentName: \"p\"\n }, \"commandname\"), \" on the file and you can easily replace them at once. Another useful shortcut you may use when coding your bot is \", mdx(\"strong\", {\n parentName: \"p\"\n }, \"CTRL + D\"), \" after highlighting. This shortcut selects the next place where the same text exists as thing in the file that has the same thing as you highlighted.\")), mdx(\"h2\", null, \"dmOnly & guildOnly Options\"), mdx(\"p\", null, \"The \", mdx(\"inlineCode\", {\n parentName: \"p\"\n }, \"dmOnly\"), \" option is available if you want to make sure this command only runs in a direct message. If this command is ran in a server, the command will immediately exit out.\"), mdx(\"p\", null, \"On the other hand, \", mdx(\"inlineCode\", {\n parentName: \"p\"\n }, \"guildOnly\"), \" is the opposite. To easily make sure that this command is never allowed in a private message you can simple enable this.\"), mdx(\"p\", null, \"If you want to allow a command to be able to run both in a server and in a direct message, simply set them both to false.\"), mdx(\"p\", null, \"Remember if you want either of them as false, you can simply delete them and it will default to \", mdx(\"inlineCode\", {\n parentName: \"p\"\n }, \"false\"), \" allowing your bot to be cleaner and easier to read. However, if your prefer keeping it you can.\"), mdx(\"p\", null, \"For the purpose of this guide, we want our \", mdx(\"inlineCode\", {\n parentName: \"p\"\n }, \"role\"), \" comamnd to only be run in a server, so we can set \", mdx(\"inlineCode\", {\n parentName: \"p\"\n }, \"guildOnly\"), \" to be \", mdx(\"strong\", {\n parentName: \"p\"\n }, \"true\"), \" and delete the \", mdx(\"inlineCode\", {\n parentName: \"p\"\n }, \"dmOnly\"), \" option.\"), mdx(\"h2\", null, \"NSFW Option\"), mdx(\"p\", null, \"NSFW stands for \", mdx(\"strong\", {\n parentName: \"p\"\n }, \"Not Safe For Work\"), \". One of Discord's rules is that you enforce that NSFW content is sent only in NSFW channels. Discordeno has this built in. You simple tell Discordeno, that you want a command to be considered \", mdx(\"inlineCode\", {\n parentName: \"p\"\n }, \"nsfw\"), \" or not.\"), mdx(\"p\", null, \"If this option is enabled, this command will only be able to be used in a \", mdx(\"inlineCode\", {\n parentName: \"p\"\n }, \"nsfw\"), \" channel on a server. Discord does not consider Direct Messages as nsfw safe!\"), mdx(\"h2\", null, \"Permission Level Option\"), mdx(\"p\", null, \"Permission levels are a very powerful feature that easily allow you to set what permission is required to run a command. We will cover this in detail, in a separate section dedicated to permission levels. For now, just understand that this will restrict certain users from using a command.\"), mdx(\"p\", null, \"For example, the role command we only want to be used by moderators or server admins.\"), mdx(\"p\", null, \"Discordeno makes this pretty simple for us.\"), mdx(\"pre\", null, mdx(\"code\", _extends({\n parentName: \"pre\"\n }, {\n \"className\": \"language-ts\"\n }), \"permissionLevels: [PermissionLevels.MODERATOR, PermissionLevels.ADMIN]\\n\")), mdx(\"p\", null, \"We're not going to cover this in detail, here because we will have an entire in depth guide for permission levels. If you want to pause and learn it now, feel free: \", mdx(\"a\", _extends({\n parentName: \"p\"\n }, {\n \"href\": \"https://discordeno.netlify.app/advanced/permlevels\"\n }), \"Permission Levels Advanced Guide\")), mdx(\"h2\", null, \"Permissions Check Options\"), mdx(\"p\", null, \"Discordeno provides you 4 different types of permission handling that will be done before the command function is executed. This allows you to make sure that the permissions are available before running a command. For example, the role command will require the bot to have \", mdx(\"strong\", {\n parentName: \"p\"\n }, \"MANAGE ROLES\"), \" permission. This permission comes from the server settings so we can require this in the \", mdx(\"inlineCode\", {\n parentName: \"p\"\n }, \"botServerPermissions\"), \".\"), mdx(\"pre\", null, mdx(\"code\", _extends({\n parentName: \"pre\"\n }, {\n \"className\": \"language-ts\"\n }), \"botServerPermissions: [\\\"MANAGE_ROLES\\\"],\\n\")), mdx(\"p\", null, \"Discordeno will provide you easy to use auto-completion as soon as you type a single letter or two. This will help make it easier to use and will warn you when you make a typo and provide a wrong permission by accident.\"), mdx(\"p\", null, \"We also want to make sure that the bot can send a message in this channel so that we can respond to the user. This will check the correct permission heirarchy to make sure that the bot can indeed send a message in this channel.\"), mdx(\"pre\", null, mdx(\"code\", _extends({\n parentName: \"pre\"\n }, {\n \"className\": \"language-ts\"\n }), \"botChannelPermissions: [\\\"SEND_MESSAGES\\\"],\\n\")), mdx(\"blockquote\", null, mdx(\"p\", {\n parentName: \"blockquote\"\n }, mdx(\"strong\", {\n parentName: \"p\"\n }, \"Note:\"), \" If you want to send an embed response, you should also make sure it has the \", mdx(\"inlineCode\", {\n parentName: \"p\"\n }, \"EMBED_LINKS\"), \" permission.\")), mdx(\"p\", null, \"Already we have prevented two of the largest errors that can get our bot banned if it is not checked. Discordeno handles this internally so you don't have to worry about it.\"), mdx(\"p\", null, \"Sometimes, you may also want to make sure that the user using the command has a certain permission to run the command. To do this, you can use the \", mdx(\"inlineCode\", {\n parentName: \"p\"\n }, \"userServerPermissions\"), \" or the \", mdx(\"inlineCode\", {\n parentName: \"p\"\n }, \"userChannelPermissions\"), \".\"), mdx(\"h2\", null, \"Cooldown Options\"), mdx(\"p\", null, \"The cooldown options go hand in hand together.\"), mdx(\"ul\", null, mdx(\"li\", {\n parentName: \"ul\"\n }, mdx(\"inlineCode\", {\n parentName: \"li\"\n }, \"seconds\"), \" is how long to make the user wait in seconds before they can use the command again. By default, there is no wait time aka 0 seconds.\"), mdx(\"li\", {\n parentName: \"ul\"\n }, mdx(\"inlineCode\", {\n parentName: \"li\"\n }, \"allowedUses\"), \" is how many times a user is allowed to use a command before they are placed on cooldown.\"), mdx(\"li\", {\n parentName: \"ul\"\n }, \"Let's use our command as an example. We don't want someone to start spamming the role command so we can add a cooldown of 60 seconds. However, this would mean every time you give a role to someone, you would need to wait a whole minute to give a role to someone else. This is where \", mdx(\"inlineCode\", {\n parentName: \"li\"\n }, \"allowedUses\"), \" shines! Let's set it to to 5 so that a user can use this command 5 times in a row before being asked to wait for 60 seconds.\")), mdx(\"pre\", null, mdx(\"code\", _extends({\n parentName: \"pre\"\n }, {\n \"className\": \"language-ts\"\n }), \"cooldown: {\\n seconds: 60,\\n allowedUses: 5\\n},\\n\")), mdx(\"blockquote\", null, mdx(\"p\", {\n parentName: \"blockquote\"\n }, mdx(\"strong\", {\n parentName: \"p\"\n }, \"Note:\"), \" It is important to understand the way these two interact. The cooldown starts as soon as the first command is used. So, if a user uses the role command 5 times in 59 seconds, they only have to wait 1 second to do another 5 times.\")), mdx(\"p\", null, \"Let's give this a try shall we.\"), mdx(\"ol\", null, mdx(\"li\", {\n parentName: \"ol\"\n }, mdx(\"inlineCode\", {\n parentName: \"li\"\n }, \"!reload commands\")), mdx(\"li\", {\n parentName: \"ol\"\n }, \"Spam the \", mdx(\"inlineCode\", {\n parentName: \"li\"\n }, \"!role\"), \" very quickly 6 times in under a minute.\")), mdx(\"h2\", null, \"Arguments\"), mdx(\"p\", null, \"Arguments is an incredibly powerful feature in Discordeno. Like Permission Levels we will have an in depth look at arguments later in the guide. For now, let's try and understand this in a simple manner.\"), mdx(\"ul\", null, mdx(\"li\", {\n parentName: \"ul\"\n }, mdx(\"inlineCode\", {\n parentName: \"li\"\n }, \"name\"), \": The name of the argument. Useful for when you need to alert the user X arg is missing or when you want to use the arg in your command.\"), mdx(\"li\", {\n parentName: \"ul\"\n }, mdx(\"inlineCode\", {\n parentName: \"li\"\n }, \"type\"), \": The type of the argument you would like. Defaults to string. Some of the ones available by default are \\\"number\\\", \\\"string\\\", \\\"...string\\\", \\\"boolean\\\", \\\"subcommand\\\", \\\"member\\\".\"), mdx(\"li\", {\n parentName: \"ul\"\n }, mdx(\"inlineCode\", {\n parentName: \"li\"\n }, \"missing\"), \": a function that will be run when this argument is not provided by the user or if the provided argument is not valid. By default, it does nothing.\"), mdx(\"li\", {\n parentName: \"ul\"\n }, mdx(\"inlineCode\", {\n parentName: \"li\"\n }, \"required\"), \": Whether this argument is required or optional. By default, this is true.\"), mdx(\"li\", {\n parentName: \"ul\"\n }, mdx(\"inlineCode\", {\n parentName: \"li\"\n }, \"lowercase\"), \": If the type is a string, this can forcibly lowercase the string.\"), mdx(\"li\", {\n parentName: \"ul\"\n }, mdx(\"inlineCode\", {\n parentName: \"li\"\n }, \"literals\"), \": If the type is string or subcommand you can provide literals. The argument MUST be exactly the same as the literals to be accepted. For example, if you want to make sure the argument is \", mdx(\"inlineCode\", {\n parentName: \"li\"\n }, \"a\"), \" or \", mdx(\"inlineCode\", {\n parentName: \"li\"\n }, \"b\"), \" only and not \", mdx(\"inlineCode\", {\n parentName: \"li\"\n }, \"c\"), \".\"), mdx(\"li\", {\n parentName: \"ul\"\n }, mdx(\"inlineCode\", {\n parentName: \"li\"\n }, \"defaultValue\"), \": The default value for this argument/subcommand. If the user does not provide an argument or it is invalid, it can be defaulted to a certain value.\")), mdx(\"p\", null, \"For our role command, we need a \", mdx(\"inlineCode\", {\n parentName: \"p\"\n }, \"member\"), \" and a \", mdx(\"inlineCode\", {\n parentName: \"p\"\n }, \"role\"), \".\"), mdx(\"pre\", null, mdx(\"code\", _extends({\n parentName: \"pre\"\n }, {\n \"className\": \"language-ts\"\n }), \"arguments: [\\n {\\n name: \\\"member\\\",\\n type: \\\"member\\\",\\n missing: (message) => {\\n sendResponse(message, `you did not provide a member to give the role to. You can provide a @member mention, a member ID, or try using their nickname/username. The nickname/username will only work if they have been active in your server recently.`)\\n }\\n },\\n {\\n name: \\\"role\\\",\\n type: \\\"role\\\",\\n missing: (message) => {\\n sendResponse(message, `you did not provide a role to give. You can provide a @role mention, a role ID, or it's name. If the role name did not work, try to use the **roleinfo** command to get the role ID.`)\\n }\\n }\\n]\\n\")), mdx(\"h2\", null, \"Execute Option\"), mdx(\"p\", null, \"The execute option is the code that will run when the command is triggered. The execute function is passed 3 parameters that you can use in your command.\"), mdx(\"ul\", null, mdx(\"li\", {\n parentName: \"ul\"\n }, mdx(\"inlineCode\", {\n parentName: \"li\"\n }, \"message\"), \": The message object itself that triggered this command.\"), mdx(\"li\", {\n parentName: \"ul\"\n }, mdx(\"inlineCode\", {\n parentName: \"li\"\n }, \"args\"), \": The args that were provided by the user.\"), mdx(\"li\", {\n parentName: \"ul\"\n }, mdx(\"inlineCode\", {\n parentName: \"li\"\n }, \"guild\"), \": The server guild object where this command was run.\")), mdx(\"pre\", null, mdx(\"code\", _extends({\n parentName: \"pre\"\n }, {\n \"className\": \"language-ts\"\n }), \"execute: function (message, args, guild) {\\n // The code that is to be executed goes here\\n}\\n\")), mdx(\"blockquote\", null, mdx(\"p\", {\n parentName: \"blockquote\"\n }, mdx(\"strong\", {\n parentName: \"p\"\n }, \"Note:\"), \" I prefer writing code using the function keyword, but you can easily change to the fat arrow function if you prefer.\"), mdx(\"pre\", {\n parentName: \"blockquote\"\n }, mdx(\"code\", _extends({\n parentName: \"pre\"\n }, {\n \"className\": \"language-ts\"\n }), \"execute: (message, args, guild) => {\\n // The code that is to be executed goes here\\n}\\n\"))), mdx(\"p\", null, \"Let's start out by writing some pseudo-code(comments that will help us plan the code).\"), mdx(\"pre\", null, mdx(\"code\", _extends({\n parentName: \"pre\"\n }, {\n \"className\": \"language-ts\"\n }), \"execute: function (message, args, guild) {\\n // If this was the everyone role alert with a silly error\\n\\n // If this is a managed role(some bots role) we can't give/remove alert with silly error\\n\\n // Get the bots highest role\\n\\n // Check if the bot has a role higher than the role that it will try to give.\\n\\n // If the role is too high alert the user.\\n\\n // If the user has this role already remove the role from them.\\n\\n // Check the command author's highest role\\n\\n // If the author does not have a role high enough to give this role alert\\n\\n // If the user has this role already we should remove it\\n\\n // Add the role to the user.\\n\\n // Alert the user that used the command that the user has been give the role.\\n}\\n\")), mdx(\"p\", null, \"Nice! The plan for the code is complete. Now, let's add in the code.\"), mdx(\"p\", null, \"The first thing we are going to try is to check if the role the user provided is the same as the everyone role.\"), mdx(\"blockquote\", null, mdx(\"p\", {\n parentName: \"blockquote\"\n }, mdx(\"strong\", {\n parentName: \"p\"\n }, \"Note:\"), \" The everyone role ID is the same as the server guild ID.\")), mdx(\"p\", null, \"To do this, we are going to want something like this:\"), mdx(\"pre\", null, mdx(\"code\", _extends({\n parentName: \"pre\"\n }, {\n \"className\": \"language-ts\"\n }), \"if (args.role.id === message.guildID) {\\n return sendResponse(message, \\\"The everyone role can not be given to anyone because everyone has the everyone role already. *Keep calm and let Carter figure it out*!\\\");\\n}\\n\")), mdx(\"p\", null, \"You might be seeing an error since we didn't provide the accurate typings for the \", mdx(\"inlineCode\", {\n parentName: \"p\"\n }, \"args\"), \" parameter. The message and guild parameter is automated but the args is dynamic depending on your \", mdx(\"inlineCode\", {\n parentName: \"p\"\n }, \"arguments\"), \" option for your command. So let's do this real quick.\"), mdx(\"pre\", null, mdx(\"code\", _extends({\n parentName: \"pre\"\n }, {\n \"className\": \"language-ts\"\n }), \"execute: function (message, args: RoleArgs, guild) {\\n // If this was the everyone role alert with a silly error\\n if (args.role.id === message.guildID) {\\n return sendResponse(message, \\\"Are you trying to make this person a super hero? Everyone has the everyone role. I can't give the everyone role to another user.\\\");\\n }\\n\\n // Lots of comments here hidden so you can see the changes easily.\\n}\\n\\ninterface RoleArgs {\\n role: Role;\\n member: Member;\\n}\\n\")), mdx(\"p\", null, \"Awesome! Let's keep going.\"), mdx(\"pre\", null, mdx(\"code\", _extends({\n parentName: \"pre\"\n }, {\n \"className\": \"language-ts\"\n }), \"execute: function (message, args: RoleArgs, guild) {\\n // If this was the everyone role alert with a silly error\\n if (args.role.id === message.guildID) {\\n return sendResponse(message, \\\"I don't know if you noticed or not but I'm an extremely arrogant bot who tends to think all of his plans will work. But I can't give the everyone role to someone.\\\");\\n }\\n\\n // If this is a managed role(some bots role) we can't give/remove alert with silly error\\n if (args.role.managed) {\\n return sendResponse(message, \\\"Dammit man, just 'cause I'm Scottish doesn't mean I can give your people managed roles.\\\")\\n }\\n\\n // Get the bots highest role\\n const botsHighestRole = highestRole(message.guildID, botID);\\n\\n // Check if the bot has a role higher than the role that it will try to give.\\n const botIsHigher = higherRolePosition(message.guildID, botsHighestRole.id, args.role.id)\\n\\n // If the role is too high alert the user.\\n if (!botIsHigher) {\\n return sendResponse(message, \\\"Okay look, asking me give a role that is higher than my highest role is ridiculous! I am the first bot to admit I don't know who these people are nor do I care to. Look, if you'd like I could take you down the hall and just point at the people who annoy me more than the rest. But that's about as useful as I get.\\\")\\n }\\n\\n // Check the command author's highest role\\n const membersHighestRole = highestRole(message.guildID, message.author.id);\\n\\n // If the author does not have a role high enough to give this role alert\\n if (!higherRolePosition(message.guildID, membersHighestRole.id, args.role.id)) {\\n return sendResponse(message, \\\"In my culture, whenever someone tries to give a role that is higher than their highest role, I would be well within my rights to dismember you.\\\")\\n }\\n\\n // If the user has this role already we should remove it\\n if (message.member().roles.includes(args.role.id)) {\\n removeRole(message.guildID, args.member.user.id, args.role.id, `${message.author.tag} used the role command to remove this role.`)\\n // Alert the user that used the command that the user has lost the role.\\n return sendResponse(message, `The role **${args.role.name}** has been removed from **${args.member.tag}**.`)\\n }\\n\\n // Add the role to the user.\\n addRole(guildID, memberID, roleID)\\n\\n // Alert the user that used the command that the user has been give the role.\\n return sendResponse(message, `The role **${args.role.name}** has been added to **${args.member.tag}**.`)\\n}\\n\")), mdx(\"p\", null, \"The final version of the command should look something like this:\"), mdx(\"pre\", null, mdx(\"code\", _extends({\n parentName: \"pre\"\n }, {\n \"className\": \"language-ts\"\n }), \"import { highestRole, higherRolePosition, botID, removeRole, addRole, Role, Member } from \\\"../../deps.ts\\\";\\nimport { botCache } from \\\"../../mod.ts\\\";\\nimport { PermissionLevels } from \\\"../types/commands.ts\\\";\\nimport { sendResponse } from \\\"../utils/helpers.ts\\\";\\n\\nbotCache.commands.set(\\\"role\\\", {\\n name: \\\"role\\\",\\n permissionLevel: [PermissionLevels.MODERATOR, PermissionLevels.ADMIN],\\n botServerPermissions: [\\\"MANAGE_ROLES\\\"],\\n botChannelPermissions: [\\\"SEND_MESSAGES\\\"],\\n cooldown: {\\n seconds: 60,\\n allowedUses: 5,\\n },\\n arguments: [\\n {\\n name: \\\"member\\\",\\n type: \\\"member\\\",\\n missing: (message) => {\\n sendResponse(message, `you did not provide a member to give the role to. You can provide a @member mention, a member ID, or try using their nickname/username. The nickname/username will only work if they have been active in your server recently.`)\\n }\\n },\\n {\\n name: \\\"role\\\",\\n type: \\\"role\\\",\\n missing: (message) => {\\n sendResponse(message, `you did not provide a role to give. You can provide a @role mention, a role ID, or it's name. If the role name did not work, try to use the **roleinfo** command to get the role ID.`)\\n }\\n }\\n ],\\n execute: function (message, args: RoleArgs) {\\n // If this was the everyone role alert with a silly error\\n if (args.role.id === message.guildID) {\\n return sendResponse(\\n message,\\n \\\"I don't know if you noticed or not but I'm an extremely arrogant bot who tends to think all of his plans will work. But I can't give the everyone role to someone.\\\",\\n );\\n }\\n\\n // If this is a managed role(some bots role) we can't give/remove alert with silly error\\n if (args.role.managed) {\\n return sendResponse(\\n message,\\n \\\"Dammit man, just 'cause I'm Scottish doesn't mean I can give your people managed roles.\\\",\\n );\\n }\\n\\n // Get the bots highest role\\n const botsHighestRole = highestRole(message.guildID, botID);\\n\\n // Check if the bot has a role higher than the role that it will try to give. If the role is too high alert the user.\\n if (!botsHighestRole || !higherRolePosition(\\n message.guildID,\\n botsHighestRole.id,\\n args.role.id,\\n )) {\\n return sendResponse(\\n message,\\n \\\"Okay look, asking me give a role that is higher than my highest role is ridiculous! I am the first bot to admit I don't know who these people are nor do I care to. Look, if you'd like I could take you down the hall and just point at the people who annoy me more than the rest. But that's about as useful as I get.\\\",\\n );\\n }\\n\\n // Check the command author's highest role\\n const membersHighestRole = highestRole(message.guildID, message.author.id);\\n\\n // If the author does not have a role high enough to give this role alert\\n if (!membersHighestRole ||\\n !higherRolePosition(message.guildID, membersHighestRole.id, args.role.id)\\n ) {\\n return sendResponse(\\n message,\\n \\\"In my culture, whenever someone tries to give a role that is higher than their highest role, I would be well within my rights to dismember you.\\\",\\n );\\n }\\n\\n // If the user has this role already we should remove it\\n if (message.member()?.roles.includes(args.role.id)) {\\n removeRole(\\n message.guildID,\\n args.member.user.id,\\n args.role.id,\\n `${message.author.username} used the role command to remove this role.`,\\n );\\n // Alert the user that used the command that the user has lost the role.\\n return sendResponse(\\n message,\\n `The role **${args.role.name}** has been removed from **${args.member.tag}**.`,\\n );\\n }\\n\\n // Add the role to the user.\\n addRole(message.guildID, args.member.user.id, args.role.id, `${message.author.username} used the role command to give this role.`);\\n\\n // Alert the user that used the command that the user has been give the role.\\n return sendResponse(\\n message,\\n `The role **${args.role.name}** has been added to **${args.member.tag}**.`,\\n );\\n },\\n});\\n\\ninterface RoleArgs {\\n role: Role;\\n member: Member;\\n}\\n\")), mdx(\"blockquote\", null, mdx(\"p\", {\n parentName: \"blockquote\"\n }, mdx(\"strong\", {\n parentName: \"p\"\n }, \"Note:\"), \" The response strings are a play on some funny Stargate(my favorite tv show) moments. Feel free to change as you wish to fit your bot's personality.\")), mdx(\"h2\", null, \"Dynamic(Advanced Level) Command Creation\"), mdx(\"p\", null, \"This is some advanced level super magical command creation skills. Discordeno gives you the power to dynamically create commands. What that means is you can write the code for one command but dynamically create like 50 commands using that same code.\"), mdx(\"p\", null, \"For example, in my main bot I have a lot of \\\"fun\\\" commands like \", mdx(\"inlineCode\", {\n parentName: \"p\"\n }, \".hug\"), \" or \", mdx(\"inlineCode\", {\n parentName: \"p\"\n }, \".kiss\"), \" etc... All of these files have the exact same code except for 1 word being the command name. Would it not be better to simply write the code once and dynamically create every single command. Let me show you how that works.\"), mdx(\"ul\", null, mdx(\"li\", {\n parentName: \"ul\"\n }, \"Create a file in the commands folder called \", mdx(\"inlineCode\", {\n parentName: \"li\"\n }, \"fun.ts\"), \" which will create all our fun commands.\")), mdx(\"pre\", null, mdx(\"code\", _extends({\n parentName: \"pre\"\n }, {\n \"className\": \"language-ts\"\n }), \"import { Member, sendMessage, chooseRandom, avatarURL } from \\\"../../deps.ts\\\";\\nimport { botCache } from \\\"../../mod.ts\\\";\\nimport { createCommandAliases, sendEmbed } from \\\"../utils/helpers.ts\\\";\\nimport { configs } from \\\"../../configs.ts\\\";\\nimport { Embed } from \\\"../utils/Embed.ts\\\";\\nimport { translate } from \\\"../utils/i18next.ts\\\";\\n\\nconst funCommandData = [\\n { name: \\\"bite\\\", gifs: configs.gifs.bite },\\n { name: \\\"cuddle\\\", gifs: configs.gifs.cuddle },\\n { name: \\\"dance\\\", gifs: configs.gifs.dance },\\n { name: \\\"hug\\\", gifs: configs.gifs.hug },\\n { name: \\\"kiss\\\", gifs: configs.gifs.kiss },\\n { name: \\\"kanna\\\", gifs: configs.gifs.kanna },\\n { name: \\\"kiss\\\", gifs: configs.gifs.kiss },\\n { name: \\\"kitten\\\", gifs: configs.gifs.kitten },\\n { name: \\\"lmao\\\", gifs: configs.gifs.lmao, aliases: [\\\"lol\\\"] },\\n { name: \\\"pat\\\", gifs: configs.gifs.pat },\\n { name: \\\"poke\\\", gifs: configs.gifs.poke },\\n { name: \\\"pony\\\", gifs: configs.gifs.pony },\\n { name: \\\"puppy\\\", gifs: configs.gifs.puppy },\\n { name: \\\"raphtalia\\\", gifs: configs.gifs.raphtalia },\\n { name: \\\"stargate\\\", gifs: configs.gifs.stargate },\\n { name: \\\"supernatural\\\", gifs: configs.gifs.supernatural },\\n { name: \\\"tickle\\\", gifs: configs.gifs.tickle },\\n { name: \\\"zerotwo\\\", gifs: configs.gifs.zerotwo },\\n];\\n\\nfunCommandData.forEach((data) => {\\n botCache.commands.set(data.name, {\\n name: data.name,\\n botChannelPermissions: [\\\"SEND_MESSAGES\\\", \\\"EMBED_LINKS\\\"],\\n cooldown: {\\n seconds: 2,\\n },\\n arguments: [\\n {\\n name: \\\"member\\\",\\n type: \\\"member\\\",\\n required: false,\\n },\\n ],\\n execute: function (message, args: FunArgs) {\\n // If a member is provided use that otherwise set the member themself\\n const member = args.member || message.member()!;\\n\\n const type = member.user.id === message.author.id\\n // Silly response like if user tries to hug themself\\n ? \\\"SELF\\\"\\n // Response for when user tries to hug another user\\n : \\\"OTHER\\\";\\n\\n\\n // Create an embed\\n const embed = new Embed()\\n .setAuthor(member.tag, avatarURL(member))\\n .setDescription(\\n translate(\\n message.guildID,\\n `commands/fun/${data.name}:${type}`,\\n { mention: message.member()!.mention, user: member.mention },\\n ),\\n )\\n .setImage(chooseRandom(data.gifs));\\n\\n return sendEmbed(message.channel, embed);\\n },\\n });\\n\\n if (data.aliases?.length) {\\n createCommandAliases(data.name, data.aliases);\\n }\\n});\\n\\ninterface FunArgs {\\n member?: Member;\\n}\\n\")), mdx(\"p\", null, \"Take a minute to realize what just happened. This has made 18 different unique commands dynamically. In 1 file, using the same piece of code, we created so many commands. You can easily add more commands to this. For example, if you wanted to add weeb(animated) versions of these commands. Then you are at 36 commands with 1 simple command file.\"), mdx(\"p\", null, mdx(\"strong\", {\n parentName: \"p\"\n }, \"That ladies and gentleman is the power and magic of Discordeno!\")), mdx(\"p\", null, \"Take a minute to stand up, step back and make some room around you. Now start dancing because you just acheived one of the most complex things in bot development. You have already created about 36 commands!!!!\"), mdx(\"blockquote\", null, mdx(\"p\", {\n parentName: \"blockquote\"\n }, mdx(\"strong\", {\n parentName: \"p\"\n }, \"Note:\"), \" The command above uses translations which we will cover in depth in a later section of this guide.\")), mdx(\"p\", null, \"Once you are ready, let's proceed to making our inhibitors.\"));\n}\n;\nMDXContent.isMDXComponent = true;","rawMDXOutput":"/* @jsx mdx */\nimport { mdx } from '@mdx-js/react';\n/* @jsx mdx */\n\nexport const _frontmatter = {\n \"title\": \"Creating A Command\",\n \"metaTitle\": \"Creating A Command | Discordeno\",\n \"metaDescription\": \"Let's create our very first command with Discordeno!\"\n};\n\nconst layoutProps = {\n _frontmatter\n};\nconst MDXLayout = \"wrapper\"\nexport default function MDXContent({\n components,\n ...props\n}) {\n return \n

{`Really great job. Now, lets dive into trying to use some of the commands and try to make our very own command.`}

\n

{`Editing Invite Command`}

\n

{`Let's first start by taking an existing command and slightly modifying it to your needs. Let's use the `}{`Invite`}{` command as our example. When you open the command, you will see something like this:`}

\n
{`import { botCache } from \"../../mod.ts\";\nimport { sendMessage } from \"https://raw.githubusercontent.com/Skillz4Killz/Discordeno/v7/src/handlers/channel.ts\";\nimport { botID } from \"https://raw.githubusercontent.com/Skillz4Killz/Discordeno/v7/src/module/client.ts\";\n\nbotCache.commands.set(\"invite\", {\n  name: \"invite\",\n  execute: function (message) {\n    // Replace the permission number at the end to request the permissions you wish to request. By default, this will request Admin perms.\n    sendMessage(\n      message.channel,\n      \\`https://discordapp.com/oauth2/authorize?client_id=\\${botID}&scope=bot&permissions=8\\`,\n    );\n  },\n});\n`}
\n

{`Let's break this down. The first three lines are importing the necessary things from their files so we can use them in this command. Don't worry if this doesn't make sense, most of the time, this will all be done automatically for you if you use a good code editor like Visual Studio Code. We create a command by doing:`}

\n
{`botCache.commands.set('commandname', {\n\n})\n`}
\n

{`The command name here must be unique. If it is not unique, your commands will not work properly as you wish. For example, you can't have 2 commands with the `}{`ping`}{` name. In this case, our command is called `}{`invite`}{`.`}

\n

{`The `}{`name: 'invite'`}{` is also written as it is useful for our help command and inhibitors! Normally, these two things will be the same. So far it's super easy right.`}

\n

{`Next is the `}{`execute`}{`. This is where the magic happens. This is the function that is triggered when the command is ran by a user. In this case, the bot simply sends a message to a channel where the command was ran and sends an invite link. Let's take a minute and optimize this for our case. We don't `}{`NEED`}{` admin permissions for our bot. Let's go to the `}{`permission calculator`}{` and figure out the permissions we need for our bot.`}

\n

{`Once you have decided which permissions you want to request, you can copy the number and replace it here. For example, if we want `}{`68640`}{` as our permissions. We can modify our command to be:`}

\n
{`    \\`https://discordapp.com/oauth2/authorize?client_id=\\${botID}&scope=bot&permissions=68640\\`,\n`}
\n

{`Lastly, let's get rid of the comment there as now it is customized to our needs.`}

\n

{`Command Descriptions`}

\n

{`Right now, if you were to go to Discord and type `}{`!help invite`}{`, you would see quite a bit of information. But where does all that text come from? It's not in this file. The description option tells Discordeno what to show the user when they use the help command. In that help message, each command has a small description next to it. The magic is happening because of Discordeno's translations feature.`}

\n
\n

{`Discordeno has built in multi-lingual support. You can support as many languages as you wish. We will learn more about languages when we create our own language but for now we just want to see how to customize the command. What we are going to do below isn't the correct way but it's the easy way to learn. We will see the correct way to do it when we get to translations.`}

\n
\n

{`Let's add a custom description to our invite command.`}

\n
{`    name: \"invite\",\n    description: \"Like the bot? Use this link to add it to your server!\"\n`}
\n

{`🎉 It's that simple. So let's restart the bot and see how it changed. Use `}{`CTRL + C`}{` to shut down the bot. Then run the command from earlier.`}

\n
{`deno run --allow-net --allow-read mod.ts\n`}
\n

{`To access this easily, most likely all you need to do is press the `}{`UP ARROW`}{` key. Feel free to copy paste this if it doesn't work.`}

\n

{`Once the bot is started try `}{`!help invite`}{` again and you will see the change! 🎉`}

\n

{`Command Aliases`}

\n

{`Now, let's make this a little bit easier. What if we wanted this command to also work with other names besides `}{`invite`}{`. For example, as a shortcut what if users could just type `}{`!inv`}{` or as an alias type `}{`!join`}{`. Let's go ahead and set that up. Go to the very last line of invite command file and type in `}{`alias`}{`. You will see a popup showing you an autocompleted version of `}{`createCommandAliases`}{`. Press enter and boom the magic is happening!`}

\n

{`The createCommandAliases takes in two arguments. The first argument is always the command name. In this case it is `}{`invite`}{`. The second argument is the aliases you want to provide. Let's add in the two aliases we wanted.`}

\n
{` \\`https://discordapp.com/oauth2/authorize?client_id=\\${botID}&scope=bot&permissions=68640\\`,\n    );\n  },\n});\n\ncreateCommandAliases('invite', ['inv', 'join'])\n`}
\n
\n

{`Note:`}{` If you only want to add 1 alias, you can pass in a simple string instead of an array as well as the second argument.`}

\n
\n

{`Notice, I added 2 aliases here. You can add as many aliases as you like. If you see a lot of users typing it wrong by accident you can add those typos as aliases as well.`}

\n

{`Let's start testing this out. But first, let's understand something important.`}

\n

{`Reloading`}

\n

{`Okay, we need to first understand a core concept of developing discord bots. If you had to restart your bot every time you made a tiny change, it would get really annoying/tedious to do. Also, if you had restarted your bot 1000 times, you would be in big trouble because Discord would ban your bot for 24 hours. The bigger your bot gets, the faster it is to hit this limit of 1000 identify calls to the Discord API.`}

\n

{`To solve this issue, Discordeno provides you with a really cool `}{`reload`}{` command. Whenever you make a change to any command, event, monitor, inhibitor, task, language or argument you can simply reload it. You don't need to restart your bot every time.`}

\n

{`Now since we added the aliases above, let's test it out.`}

\n
    \n
  1. {`!inv`}{` this will not work`}
  2. \n
  3. {`!reload commands`}{` this will reload the files and the aliases will be created.`}
  4. \n
  5. {`!inv`}{` This will now work. 🎉`}
  6. \n
\n
\n

{`Perfect! You can take some time and customize the invite command to your needs if you wish. For example, this is my bot's invite command.`}

\n

\n

{`Nice! You can now customize any of the commands from Discordeno as you wish. Then we will continue to making our very own command so we can learn about all the options that Discordeno gives us when it comes to making commands. As you learn more in this guide, you can keep improving it.`}

\n

{`If you get stuck, don't worry. When you are ready, let's continue to the next step.`}

\n

{`Creating A Command`}

\n

{`Let's make a command that will allow guild admins to give or take roles from a member. Since, we are creating a `}{`Moderation`}{` command to give or take roles, let's go ahead and create a Category folder called `}{`Moderation`}{` and then create a file called `}{`role.ts`}{`. Once the file is made, you can paste this following base snippet to make our first command.`}

\n
{`import { botCache } from \"../../mod.ts\";\nimport { sendMessage } from \"https://raw.githubusercontent.com/Skillz4Killz/Discordeno/v7/src/handlers/channel.ts\";\nimport { PermissionLevels } from \"../types/commands.ts\";\nimport { createCommandAliases } from \"../utils/helpers\";\n\nbotCache.commands.set(\"commandname\", {\n  name: \"commandname\",\n  dmOnly: false,\n  guildOnly: false,\n  nsfw: false,\n  permissionLevel: [PermissionLevels.MEMBER],\n  botServerPermissions: [],\n  botChannelPermissions: [],\n  userServerPermissions: [],\n  userChannelPermissions: [],\n  description: string,\n  cooldown: {\n    seconds: 0,\n    allowedUses: 0,\n  },\n  arguments: [],\n  execute: function (message, args, guild) {\n  // The code for your command goes here\n  }\n});\n\n// createCommandAliases(\"commandname\", [\"alias\"])\n`}
\n

{`Understanding Command Options`}

\n

{`Woah! We just added a massive file but most of that stuff is new to us. Don't worry, let's break everything down step by step.`}

\n
\n

{`Note:`}{` Any options that are not changed from the snippet above can actually be deleted as Discordeno will use the default option if you do not provide anything for that option. This can help keep your files cleaner.`}

\n
\n

{`Before we start, quickly update the command name and description.`}

\n
\n

{`Note:`}{` Once you highlight the `}{`commandname`}{`, press `}{`CTRL + SHIFT + L`}{` to select ALL the `}{`commandname`}{` on the file and you can easily replace them at once. Another useful shortcut you may use when coding your bot is `}{`CTRL + D`}{` after highlighting. This shortcut selects the next place where the same text exists as thing in the file that has the same thing as you highlighted.`}

\n
\n

{`dmOnly & guildOnly Options`}

\n

{`The `}{`dmOnly`}{` option is available if you want to make sure this command only runs in a direct message. If this command is ran in a server, the command will immediately exit out.`}

\n

{`On the other hand, `}{`guildOnly`}{` is the opposite. To easily make sure that this command is never allowed in a private message you can simple enable this.`}

\n

{`If you want to allow a command to be able to run both in a server and in a direct message, simply set them both to false.`}

\n

{`Remember if you want either of them as false, you can simply delete them and it will default to `}{`false`}{` allowing your bot to be cleaner and easier to read. However, if your prefer keeping it you can.`}

\n

{`For the purpose of this guide, we want our `}{`role`}{` comamnd to only be run in a server, so we can set `}{`guildOnly`}{` to be `}{`true`}{` and delete the `}{`dmOnly`}{` option.`}

\n

{`NSFW Option`}

\n

{`NSFW stands for `}{`Not Safe For Work`}{`. One of Discord's rules is that you enforce that NSFW content is sent only in NSFW channels. Discordeno has this built in. You simple tell Discordeno, that you want a command to be considered `}{`nsfw`}{` or not.`}

\n

{`If this option is enabled, this command will only be able to be used in a `}{`nsfw`}{` channel on a server. Discord does not consider Direct Messages as nsfw safe!`}

\n

{`Permission Level Option`}

\n

{`Permission levels are a very powerful feature that easily allow you to set what permission is required to run a command. We will cover this in detail, in a separate section dedicated to permission levels. For now, just understand that this will restrict certain users from using a command.`}

\n

{`For example, the role command we only want to be used by moderators or server admins.`}

\n

{`Discordeno makes this pretty simple for us.`}

\n
{`permissionLevels: [PermissionLevels.MODERATOR, PermissionLevels.ADMIN]\n`}
\n

{`We're not going to cover this in detail, here because we will have an entire in depth guide for permission levels. If you want to pause and learn it now, feel free: `}{`Permission Levels Advanced Guide`}

\n

{`Permissions Check Options`}

\n

{`Discordeno provides you 4 different types of permission handling that will be done before the command function is executed. This allows you to make sure that the permissions are available before running a command. For example, the role command will require the bot to have `}{`MANAGE ROLES`}{` permission. This permission comes from the server settings so we can require this in the `}{`botServerPermissions`}{`.`}

\n
{`botServerPermissions: [\"MANAGE_ROLES\"],\n`}
\n

{`Discordeno will provide you easy to use auto-completion as soon as you type a single letter or two. This will help make it easier to use and will warn you when you make a typo and provide a wrong permission by accident.`}

\n

{`We also want to make sure that the bot can send a message in this channel so that we can respond to the user. This will check the correct permission heirarchy to make sure that the bot can indeed send a message in this channel.`}

\n
{`botChannelPermissions: [\"SEND_MESSAGES\"],\n`}
\n
\n

{`Note:`}{` If you want to send an embed response, you should also make sure it has the `}{`EMBED_LINKS`}{` permission.`}

\n
\n

{`Already we have prevented two of the largest errors that can get our bot banned if it is not checked. Discordeno handles this internally so you don't have to worry about it.`}

\n

{`Sometimes, you may also want to make sure that the user using the command has a certain permission to run the command. To do this, you can use the `}{`userServerPermissions`}{` or the `}{`userChannelPermissions`}{`.`}

\n

{`Cooldown Options`}

\n

{`The cooldown options go hand in hand together.`}

\n
    \n
  • {`seconds`}{` is how long to make the user wait in seconds before they can use the command again. By default, there is no wait time aka 0 seconds.`}
  • \n
  • {`allowedUses`}{` is how many times a user is allowed to use a command before they are placed on cooldown.`}
  • \n
  • {`Let's use our command as an example. We don't want someone to start spamming the role command so we can add a cooldown of 60 seconds. However, this would mean every time you give a role to someone, you would need to wait a whole minute to give a role to someone else. This is where `}{`allowedUses`}{` shines! Let's set it to to 5 so that a user can use this command 5 times in a row before being asked to wait for 60 seconds.`}
  • \n
\n
{`cooldown: {\n  seconds: 60,\n  allowedUses: 5\n},\n`}
\n
\n

{`Note:`}{` It is important to understand the way these two interact. The cooldown starts as soon as the first command is used. So, if a user uses the role command 5 times in 59 seconds, they only have to wait 1 second to do another 5 times.`}

\n
\n

{`Let's give this a try shall we.`}

\n
    \n
  1. {`!reload commands`}
  2. \n
  3. {`Spam the `}{`!role`}{` very quickly 6 times in under a minute.`}
  4. \n
\n

{`Arguments`}

\n

{`Arguments is an incredibly powerful feature in Discordeno. Like Permission Levels we will have an in depth look at arguments later in the guide. For now, let's try and understand this in a simple manner.`}

\n
    \n
  • {`name`}{`: The name of the argument. Useful for when you need to alert the user X arg is missing or when you want to use the arg in your command.`}
  • \n
  • {`type`}{`: The type of the argument you would like. Defaults to string. Some of the ones available by default are \"number\", \"string\", \"...string\", \"boolean\", \"subcommand\", \"member\".`}
  • \n
  • {`missing`}{`: a function that will be run when this argument is not provided by the user or if the provided argument is not valid. By default, it does nothing.`}
  • \n
  • {`required`}{`: Whether this argument is required or optional. By default, this is true.`}
  • \n
  • {`lowercase`}{`: If the type is a string, this can forcibly lowercase the string.`}
  • \n
  • {`literals`}{`: If the type is string or subcommand you can provide literals. The argument MUST be exactly the same as the literals to be accepted. For example, if you want to make sure the argument is `}{`a`}{` or `}{`b`}{` only and not `}{`c`}{`.`}
  • \n
  • {`defaultValue`}{`: The default value for this argument/subcommand. If the user does not provide an argument or it is invalid, it can be defaulted to a certain value.`}
  • \n
\n

{`For our role command, we need a `}{`member`}{` and a `}{`role`}{`.`}

\n
{`arguments: [\n  {\n    name: \"member\",\n    type: \"member\",\n    missing: (message) => {\n      sendResponse(message, \\`you did not provide a member to give the role to. You can provide a @member mention, a member ID, or try using their nickname/username. The nickname/username will only work if they have been active in your server recently.\\`)\n    }\n  },\n  {\n    name: \"role\",\n    type: \"role\",\n    missing: (message) => {\n      sendResponse(message, \\`you did not provide a role to give. You can provide a @role mention, a role ID, or it's name. If the role name did not work, try to use the **roleinfo** command to get the role ID.\\`)\n    }\n  }\n]\n`}
\n

{`Execute Option`}

\n

{`The execute option is the code that will run when the command is triggered. The execute function is passed 3 parameters that you can use in your command.`}

\n
    \n
  • {`message`}{`: The message object itself that triggered this command.`}
  • \n
  • {`args`}{`: The args that were provided by the user.`}
  • \n
  • {`guild`}{`: The server guild object where this command was run.`}
  • \n
\n
{`execute: function (message, args, guild) {\n  // The code that is to be executed goes here\n}\n`}
\n
\n

{`Note:`}{` I prefer writing code using the function keyword, but you can easily change to the fat arrow function if you prefer.`}

\n
{`execute: (message, args, guild) => {\n   // The code that is to be executed goes here\n}\n`}
\n
\n

{`Let's start out by writing some pseudo-code(comments that will help us plan the code).`}

\n
{`execute: function (message, args, guild) {\n  // If this was the everyone role alert with a silly error\n\n  // If this is a managed role(some bots role) we can't give/remove alert with silly error\n\n  // Get the bots highest role\n\n  // Check if the bot has a role higher than the role that it will try to give.\n\n  // If the role is too high alert the user.\n\n  // If the user has this role already remove the role from them.\n\n  // Check the command author's highest role\n\n  // If the author does not have a role high enough to give this role alert\n\n  // If the user has this role already we should remove it\n\n  // Add the role to the user.\n\n  // Alert the user that used the command that the user has been give the role.\n}\n`}
\n

{`Nice! The plan for the code is complete. Now, let's add in the code.`}

\n

{`The first thing we are going to try is to check if the role the user provided is the same as the everyone role.`}

\n
\n

{`Note:`}{` The everyone role ID is the same as the server guild ID.`}

\n
\n

{`To do this, we are going to want something like this:`}

\n
{`if (args.role.id === message.guildID) {\n  return sendResponse(message, \"The everyone role can not be given to anyone because everyone has the everyone role already. *Keep calm and let Carter figure it out*!\");\n}\n`}
\n

{`You might be seeing an error since we didn't provide the accurate typings for the `}{`args`}{` parameter. The message and guild parameter is automated but the args is dynamic depending on your `}{`arguments`}{` option for your command. So let's do this real quick.`}

\n
{`execute: function (message, args: RoleArgs, guild) {\n  // If this was the everyone role alert with a silly error\n  if (args.role.id === message.guildID) {\n    return sendResponse(message, \"Are you trying to make this person a super hero? Everyone has the everyone role. I can't give the everyone role to another user.\");\n  }\n\n  // Lots of comments here hidden so you can see the changes easily.\n}\n\ninterface RoleArgs {\n  role: Role;\n  member: Member;\n}\n`}
\n

{`Awesome! Let's keep going.`}

\n
{`execute: function (message, args: RoleArgs, guild) {\n  // If this was the everyone role alert with a silly error\n  if (args.role.id === message.guildID) {\n    return sendResponse(message, \"I don't know if you noticed or not but I'm an extremely arrogant bot who tends to think all of his plans will work. But I can't give the everyone role to someone.\");\n  }\n\n  // If this is a managed role(some bots role) we can't give/remove alert with silly error\n  if (args.role.managed) {\n    return sendResponse(message, \"Dammit man, just 'cause I'm Scottish doesn't mean I can give your people managed roles.\")\n  }\n\n  // Get the bots highest role\n  const botsHighestRole = highestRole(message.guildID, botID);\n\n  // Check if the bot has a role higher than the role that it will try to give.\n  const botIsHigher = higherRolePosition(message.guildID, botsHighestRole.id, args.role.id)\n\n  // If the role is too high alert the user.\n  if (!botIsHigher) {\n    return sendResponse(message, \"Okay look, asking me give a role that is higher than my highest role is ridiculous! I am the first bot to admit I don't know who these people are nor do I care to. Look, if you'd like I could take you down the hall and just point at the people who annoy me more than the rest. But that's about as useful as I get.\")\n  }\n\n  // Check the command author's highest role\n  const membersHighestRole = highestRole(message.guildID, message.author.id);\n\n  // If the author does not have a role high enough to give this role alert\n  if (!higherRolePosition(message.guildID, membersHighestRole.id, args.role.id)) {\n    return sendResponse(message, \"In my culture, whenever someone tries to give a role that is higher than their highest role, I would be well within my rights to dismember you.\")\n  }\n\n  // If the user has this role already we should remove it\n  if (message.member().roles.includes(args.role.id)) {\n    removeRole(message.guildID, args.member.user.id, args.role.id, \\`\\${message.author.tag} used the role command to remove this role.\\`)\n    // Alert the user that used the command that the user has lost the role.\n    return sendResponse(message, \\`The role **\\${args.role.name}** has been removed from **\\${args.member.tag}**.\\`)\n  }\n\n  // Add the role to the user.\n  addRole(guildID, memberID, roleID)\n\n  // Alert the user that used the command that the user has been give the role.\n  return sendResponse(message, \\`The role **\\${args.role.name}** has been added to **\\${args.member.tag}**.\\`)\n}\n`}
\n

{`The final version of the command should look something like this:`}

\n
{`import { highestRole, higherRolePosition, botID, removeRole, addRole, Role, Member } from \"../../deps.ts\";\nimport { botCache } from \"../../mod.ts\";\nimport { PermissionLevels } from \"../types/commands.ts\";\nimport { sendResponse } from \"../utils/helpers.ts\";\n\nbotCache.commands.set(\"role\", {\n  name: \"role\",\n  permissionLevel: [PermissionLevels.MODERATOR, PermissionLevels.ADMIN],\n  botServerPermissions: [\"MANAGE_ROLES\"],\n  botChannelPermissions: [\"SEND_MESSAGES\"],\n  cooldown: {\n    seconds: 60,\n    allowedUses: 5,\n  },\n  arguments: [\n        {\n            name: \"member\",\n            type: \"member\",\n            missing: (message) => {\n                sendResponse(message, \\`you did not provide a member to give the role to. You can provide a @member mention, a member ID, or try using their nickname/username. The nickname/username will only work if they have been active in your server recently.\\`)\n            }\n        },\n        {\n            name: \"role\",\n            type: \"role\",\n            missing: (message) => {\n                sendResponse(message, \\`you did not provide a role to give. You can provide a @role mention, a role ID, or it's name. If the role name did not work, try to use the **roleinfo** command to get the role ID.\\`)\n            }\n        }\n    ],\n  execute: function (message, args: RoleArgs) {\n    // If this was the everyone role alert with a silly error\n    if (args.role.id === message.guildID) {\n      return sendResponse(\n        message,\n        \"I don't know if you noticed or not but I'm an extremely arrogant bot who tends to think all of his plans will work. But I can't give the everyone role to someone.\",\n      );\n    }\n\n    // If this is a managed role(some bots role) we can't give/remove alert with silly error\n    if (args.role.managed) {\n      return sendResponse(\n        message,\n        \"Dammit man, just 'cause I'm Scottish doesn't mean I can give your people managed roles.\",\n      );\n    }\n\n    // Get the bots highest role\n    const botsHighestRole = highestRole(message.guildID, botID);\n\n    // Check if the bot has a role higher than the role that it will try to give. If the role is too high alert the user.\n    if (!botsHighestRole || !higherRolePosition(\n      message.guildID,\n      botsHighestRole.id,\n      args.role.id,\n    )) {\n      return sendResponse(\n        message,\n        \"Okay look, asking me give a role that is higher than my highest role is ridiculous! I am the first bot to admit I don't know who these people are nor do I care to. Look, if you'd like I could take you down the hall and just point at the people who annoy me more than the rest. But that's about as useful as I get.\",\n      );\n    }\n\n    // Check the command author's highest role\n    const membersHighestRole = highestRole(message.guildID, message.author.id);\n\n    // If the author does not have a role high enough to give this role alert\n    if (!membersHighestRole ||\n      !higherRolePosition(message.guildID, membersHighestRole.id, args.role.id)\n    ) {\n      return sendResponse(\n        message,\n        \"In my culture, whenever someone tries to give a role that is higher than their highest role, I would be well within my rights to dismember you.\",\n      );\n    }\n\n    // If the user has this role already we should remove it\n    if (message.member()?.roles.includes(args.role.id)) {\n      removeRole(\n        message.guildID,\n        args.member.user.id,\n        args.role.id,\n        \\`\\${message.author.username} used the role command to remove this role.\\`,\n      );\n      // Alert the user that used the command that the user has lost the role.\n      return sendResponse(\n        message,\n        \\`The role **\\${args.role.name}** has been removed from **\\${args.member.tag}**.\\`,\n      );\n    }\n\n    // Add the role to the user.\n    addRole(message.guildID, args.member.user.id, args.role.id, \\`\\${message.author.username} used the role command to give this role.\\`);\n\n    // Alert the user that used the command that the user has been give the role.\n    return sendResponse(\n      message,\n      \\`The role **\\${args.role.name}** has been added to **\\${args.member.tag}**.\\`,\n    );\n  },\n});\n\ninterface RoleArgs {\n  role: Role;\n  member: Member;\n}\n`}
\n
\n

{`Note:`}{` The response strings are a play on some funny Stargate(my favorite tv show) moments. Feel free to change as you wish to fit your bot's personality.`}

\n
\n

{`Dynamic(Advanced Level) Command Creation`}

\n

{`This is some advanced level super magical command creation skills. Discordeno gives you the power to dynamically create commands. What that means is you can write the code for one command but dynamically create like 50 commands using that same code.`}

\n

{`For example, in my main bot I have a lot of \"fun\" commands like `}{`.hug`}{` or `}{`.kiss`}{` etc... All of these files have the exact same code except for 1 word being the command name. Would it not be better to simply write the code once and dynamically create every single command. Let me show you how that works.`}

\n
    \n
  • {`Create a file in the commands folder called `}{`fun.ts`}{` which will create all our fun commands.`}
  • \n
\n
{`import { Member, sendMessage, chooseRandom, avatarURL } from \"../../deps.ts\";\nimport { botCache } from \"../../mod.ts\";\nimport { createCommandAliases, sendEmbed } from \"../utils/helpers.ts\";\nimport { configs } from \"../../configs.ts\";\nimport { Embed } from \"../utils/Embed.ts\";\nimport { translate } from \"../utils/i18next.ts\";\n\nconst funCommandData = [\n  { name: \"bite\", gifs: configs.gifs.bite },\n  { name: \"cuddle\", gifs: configs.gifs.cuddle },\n  { name: \"dance\", gifs: configs.gifs.dance },\n  { name: \"hug\", gifs: configs.gifs.hug },\n  { name: \"kiss\", gifs: configs.gifs.kiss },\n  { name: \"kanna\", gifs: configs.gifs.kanna },\n  { name: \"kiss\", gifs: configs.gifs.kiss },\n  { name: \"kitten\", gifs: configs.gifs.kitten },\n  { name: \"lmao\", gifs: configs.gifs.lmao, aliases: [\"lol\"] },\n  { name: \"pat\", gifs: configs.gifs.pat },\n  { name: \"poke\", gifs: configs.gifs.poke },\n  { name: \"pony\", gifs: configs.gifs.pony },\n  { name: \"puppy\", gifs: configs.gifs.puppy },\n  { name: \"raphtalia\", gifs: configs.gifs.raphtalia },\n  { name: \"stargate\", gifs: configs.gifs.stargate },\n  { name: \"supernatural\", gifs: configs.gifs.supernatural },\n  { name: \"tickle\", gifs: configs.gifs.tickle },\n  { name: \"zerotwo\", gifs: configs.gifs.zerotwo },\n];\n\nfunCommandData.forEach((data) => {\n  botCache.commands.set(data.name, {\n    name: data.name,\n    botChannelPermissions: [\"SEND_MESSAGES\", \"EMBED_LINKS\"],\n    cooldown: {\n      seconds: 2,\n    },\n    arguments: [\n      {\n        name: \"member\",\n        type: \"member\",\n        required: false,\n      },\n    ],\n    execute: function (message, args: FunArgs) {\n            // If a member is provided use that otherwise set the member themself\n      const member = args.member || message.member()!;\n\n      const type = member.user.id === message.author.id\n        // Silly response like if user tries to hug themself\n        ? \"SELF\"\n        // Response for when user tries to hug another user\n        : \"OTHER\";\n\n\n      // Create an embed\n      const embed = new Embed()\n        .setAuthor(member.tag, avatarURL(member))\n        .setDescription(\n          translate(\n            message.guildID,\n            \\`commands/fun/\\${data.name}:\\${type}\\`,\n            { mention: message.member()!.mention, user: member.mention },\n          ),\n        )\n        .setImage(chooseRandom(data.gifs));\n\n      return sendEmbed(message.channel, embed);\n    },\n  });\n\n  if (data.aliases?.length) {\n    createCommandAliases(data.name, data.aliases);\n  }\n});\n\ninterface FunArgs {\n  member?: Member;\n}\n`}
\n

{`Take a minute to realize what just happened. This has made 18 different unique commands dynamically. In 1 file, using the same piece of code, we created so many commands. You can easily add more commands to this. For example, if you wanted to add weeb(animated) versions of these commands. Then you are at 36 commands with 1 simple command file.`}

\n

{`That ladies and gentleman is the power and magic of Discordeno!`}

\n

{`Take a minute to stand up, step back and make some room around you. Now start dancing because you just acheived one of the most complex things in bot development. You have already created about 36 commands!!!!`}

\n
\n

{`Note:`}{` The command above uses translations which we will cover in depth in a later section of this guide.`}

\n
\n

{`Once you are ready, let's proceed to making our inhibitors.`}

\n\n
;\n}\n\n;\nMDXContent.isMDXComponent = true;"}} \ No newline at end of file diff --git a/docs/.cache/caches/gatsby-plugin-mdx/diskstore-438d1d4d51c07abf0c56bef8f3061580.json b/docs/.cache/caches/gatsby-plugin-mdx/diskstore-438d1d4d51c07abf0c56bef8f3061580.json new file mode 100644 index 000000000..777022080 --- /dev/null +++ b/docs/.cache/caches/gatsby-plugin-mdx/diskstore-438d1d4d51c07abf0c56bef8f3061580.json @@ -0,0 +1 @@ +{"expireTime":9007200851644236000,"key":"gatsby-plugin-mdx-entire-payload-b9e039dea3a64f8592b69e02076a3146-","val":{"mdast":{"type":"root","children":[{"type":"paragraph","children":[{"type":"text","value":"Discordeno will help make Discord bot development much easier. Don't worry, as you go through this guide it will make a lot more sense.","position":{"start":{"line":2,"column":1,"offset":1},"end":{"line":2,"column":136,"offset":136},"indent":[]}}],"position":{"start":{"line":2,"column":1,"offset":1},"end":{"line":2,"column":136,"offset":136},"indent":[]}},{"type":"heading","depth":2,"children":[{"type":"text","value":"Creating The Bot!","position":{"start":{"line":4,"column":4,"offset":141},"end":{"line":4,"column":21,"offset":158},"indent":[]}}],"position":{"start":{"line":4,"column":1,"offset":138},"end":{"line":4,"column":21,"offset":158},"indent":[]}},{"type":"blockquote","children":[{"type":"paragraph","children":[{"type":"text","value":"This guide is going to assume you already have the basic requirements to make a bot ready. This includes github, git, a code editor like Visual Studio Code. If you don't have these yet please prepare them first before going forward.","position":{"start":{"line":6,"column":3,"offset":162},"end":{"line":6,"column":235,"offset":394},"indent":[]}}],"position":{"start":{"line":6,"column":3,"offset":162},"end":{"line":6,"column":235,"offset":394},"indent":[]}}],"position":{"start":{"line":6,"column":1,"offset":160},"end":{"line":6,"column":235,"offset":394},"indent":[]}},{"type":"list","ordered":false,"start":null,"spread":true,"children":[{"type":"listItem","spread":false,"checked":null,"children":[{"type":"paragraph","children":[{"type":"text","value":"First, create a Discordeno Bot using the ","position":{"start":{"line":8,"column":3,"offset":398},"end":{"line":8,"column":44,"offset":439},"indent":[]}},{"type":"link","title":null,"url":"https://github.com/Skillz4Killz/Discordeno-bot-template","children":[{"type":"text","value":"Generator Boilerplate","position":{"start":{"line":8,"column":45,"offset":440},"end":{"line":8,"column":66,"offset":461},"indent":[]}}],"position":{"start":{"line":8,"column":44,"offset":439},"end":{"line":8,"column":124,"offset":519},"indent":[]}},{"type":"text","value":". Give it any name you like. For the purpose of this guide we will call it, Stargate.","position":{"start":{"line":8,"column":124,"offset":519},"end":{"line":8,"column":209,"offset":604},"indent":[]}}],"position":{"start":{"line":8,"column":3,"offset":398},"end":{"line":8,"column":209,"offset":604},"indent":[]}}],"position":{"start":{"line":8,"column":1,"offset":396},"end":{"line":9,"column":1,"offset":605},"indent":[1]}},{"type":"listItem","spread":false,"checked":null,"children":[{"type":"paragraph","children":[{"type":"text","value":"Then ","position":{"start":{"line":10,"column":3,"offset":608},"end":{"line":10,"column":8,"offset":613},"indent":[]}},{"type":"inlineCode","value":"git clone https://github.com/Skillz4Killz/Stargate.git","position":{"start":{"line":10,"column":8,"offset":613},"end":{"line":10,"column":64,"offset":669},"indent":[]}}],"position":{"start":{"line":10,"column":3,"offset":608},"end":{"line":10,"column":64,"offset":669},"indent":[]}}],"position":{"start":{"line":10,"column":1,"offset":606},"end":{"line":11,"column":1,"offset":670},"indent":[1]}},{"type":"listItem","spread":false,"checked":null,"children":[{"type":"paragraph","children":[{"type":"text","value":"When that is done, go ahead and open up the folder with VSC.","position":{"start":{"line":12,"column":3,"offset":673},"end":{"line":12,"column":63,"offset":733},"indent":[]}}],"position":{"start":{"line":12,"column":3,"offset":673},"end":{"line":12,"column":63,"offset":733},"indent":[]}}],"position":{"start":{"line":12,"column":1,"offset":671},"end":{"line":12,"column":63,"offset":733},"indent":[]}},{"type":"listItem","spread":false,"checked":null,"children":[{"type":"paragraph","children":[{"type":"text","value":"Create a new file called ","position":{"start":{"line":13,"column":3,"offset":736},"end":{"line":13,"column":28,"offset":761},"indent":[]}},{"type":"inlineCode","value":"configs.ts","position":{"start":{"line":13,"column":28,"offset":761},"end":{"line":13,"column":40,"offset":773},"indent":[]}},{"type":"text","value":". Open the ","position":{"start":{"line":13,"column":40,"offset":773},"end":{"line":13,"column":51,"offset":784},"indent":[]}},{"type":"inlineCode","value":"configs.example.ts","position":{"start":{"line":13,"column":51,"offset":784},"end":{"line":13,"column":71,"offset":804},"indent":[]}},{"type":"text","value":" file and copy everything over.","position":{"start":{"line":13,"column":71,"offset":804},"end":{"line":13,"column":102,"offset":835},"indent":[]}}],"position":{"start":{"line":13,"column":3,"offset":736},"end":{"line":13,"column":102,"offset":835},"indent":[]}}],"position":{"start":{"line":13,"column":1,"offset":734},"end":{"line":13,"column":102,"offset":835},"indent":[]}}],"position":{"start":{"line":8,"column":1,"offset":396},"end":{"line":13,"column":102,"offset":835},"indent":[1,1,1,1,1]}},{"type":"paragraph","children":[{"type":"text","value":"Let's take a minute to review all the options we have available to us.","position":{"start":{"line":15,"column":1,"offset":837},"end":{"line":15,"column":71,"offset":907},"indent":[]}}],"position":{"start":{"line":15,"column":1,"offset":837},"end":{"line":15,"column":71,"offset":907},"indent":[]}},{"type":"heading","depth":3,"children":[{"type":"text","value":"Configs File","position":{"start":{"line":17,"column":5,"offset":913},"end":{"line":17,"column":17,"offset":925},"indent":[]}}],"position":{"start":{"line":17,"column":1,"offset":909},"end":{"line":17,"column":17,"offset":925},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"The ","position":{"start":{"line":19,"column":1,"offset":927},"end":{"line":19,"column":5,"offset":931},"indent":[]}},{"type":"inlineCode","value":"configs.ts","position":{"start":{"line":19,"column":5,"offset":931},"end":{"line":19,"column":17,"offset":943},"indent":[]}},{"type":"text","value":" file is where you will keep all your secret info you don't want to share with anyone else. As long as ","position":{"start":{"line":19,"column":17,"offset":943},"end":{"line":19,"column":120,"offset":1046},"indent":[]}},{"type":"inlineCode","value":".gitignore","position":{"start":{"line":19,"column":120,"offset":1046},"end":{"line":19,"column":132,"offset":1058},"indent":[]}},{"type":"text","value":" file is ignoring configs.ts your configurations will be kept private!","position":{"start":{"line":19,"column":132,"offset":1058},"end":{"line":19,"column":202,"offset":1128},"indent":[]}}],"position":{"start":{"line":19,"column":1,"offset":927},"end":{"line":19,"column":202,"offset":1128},"indent":[]}},{"type":"code","lang":"ts","meta":null,"value":"// Step 1: Remove the `.example` from this file name so it is called `configs.ts`\n// Step 2: Add all your bot's information below. The only required one is token and prefix. NOTE: As long as `.gitignore` file is ignoring configs.ts your configurations will be kept private!\n// Step 3: Remove these comments if you like.\n\nexport const configs = {\n // Your bot token goes here\n token: \"\",\n // The default prefix for your bot. Don't worry guilds can change this later.\n prefix: \"!\",\n // This isn't required but you can add bot list api keys here.\n botListTokens: {\n DISCORD_BOT_ORG: \"\",\n BOTS_ON_DISCORD: \"\",\n DISCORD_BOT_LIST: \"\",\n BOTS_FOR_DISCORD: \"\",\n DISCORD_BOATS: \"\",\n DISCORD_BOTS_GG: \"\",\n DISCORD_BOTS_GROUP: \"\",\n },\n // This is the server id for your bot's main server where users can get help/support\n supportServerID: \"\",\n // These are channel ids that will enable some functionality\n channelIDs: {\n // When a translation is missing this is the channel you will be alerted in.\n missingTranslation: \"\",\n // When an error occurs, we will try and log it to this channel\n errorChannelID: \"\"\n },\n // These are the role ids that will enable some functionality.\n roleIDs: {\n // If you have a patreon set up you can add the patreon vip role id here.\n patreonVIPRoleID: \"\",\n },\n // These are the user ids that will enable some functionality.\n userIDs: {\n // The user ids for the support team\n botSupporters: [],\n // The user ids for the other devs on your team\n botDevs: [],\n // The user ids who have complete 100% access to your bot\n botOwners: []\n }\n};\n","position":{"start":{"line":21,"column":1,"offset":1130},"end":{"line":66,"column":4,"offset":2770},"indent":[1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1]}},{"type":"heading","depth":4,"children":[{"type":"text","value":"Token","position":{"start":{"line":68,"column":6,"offset":2777},"end":{"line":68,"column":11,"offset":2782},"indent":[]}}],"position":{"start":{"line":68,"column":1,"offset":2772},"end":{"line":68,"column":11,"offset":2782},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"First, add your bot token. This is ","position":{"start":{"line":70,"column":1,"offset":2784},"end":{"line":70,"column":36,"offset":2819},"indent":[]}},{"type":"strong","children":[{"type":"text","value":"required","position":{"start":{"line":70,"column":38,"offset":2821},"end":{"line":70,"column":46,"offset":2829},"indent":[]}}],"position":{"start":{"line":70,"column":36,"offset":2819},"end":{"line":70,"column":48,"offset":2831},"indent":[]}},{"type":"text","value":" for the bot to start. Review the ","position":{"start":{"line":70,"column":48,"offset":2831},"end":{"line":70,"column":82,"offset":2865},"indent":[]}},{"type":"link","title":null,"url":"https://discordeno.netlify.app/gettingstarted#creatingyourfirstdiscordbotapplication","children":[{"type":"text","value":"instructions","position":{"start":{"line":70,"column":83,"offset":2866},"end":{"line":70,"column":95,"offset":2878},"indent":[]}}],"position":{"start":{"line":70,"column":82,"offset":2865},"end":{"line":70,"column":182,"offset":2965},"indent":[]}},{"type":"text","value":" if you have not made your token yet.","position":{"start":{"line":70,"column":182,"offset":2965},"end":{"line":70,"column":219,"offset":3002},"indent":[]}}],"position":{"start":{"line":70,"column":1,"offset":2784},"end":{"line":70,"column":219,"offset":3002},"indent":[]}},{"type":"heading","depth":4,"children":[{"type":"text","value":"Prefix","position":{"start":{"line":72,"column":6,"offset":3009},"end":{"line":72,"column":12,"offset":3015},"indent":[]}}],"position":{"start":{"line":72,"column":1,"offset":3004},"end":{"line":72,"column":12,"offset":3015},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"The prefix is where you will set the default prefix for your bot. Don't worry, every server will be able to choose their own prefix but we need a default prefix to start.","position":{"start":{"line":74,"column":1,"offset":3017},"end":{"line":74,"column":171,"offset":3187},"indent":[]}}],"position":{"start":{"line":74,"column":1,"offset":3017},"end":{"line":74,"column":171,"offset":3187},"indent":[]}},{"type":"heading","depth":4,"children":[{"type":"text","value":"Bot Lists Tokens","position":{"start":{"line":76,"column":6,"offset":3194},"end":{"line":76,"column":22,"offset":3210},"indent":[]}}],"position":{"start":{"line":76,"column":1,"offset":3189},"end":{"line":76,"column":22,"offset":3210},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"This section of the file is so you can easily have your bot's statistics updated on all the bot lists out there to help you grow your bot. The code is already written to handle this but you will need to do 3 things for each bot list.","position":{"start":{"line":78,"column":1,"offset":3212},"end":{"line":78,"column":234,"offset":3445},"indent":[]}}],"position":{"start":{"line":78,"column":1,"offset":3212},"end":{"line":78,"column":234,"offset":3445},"indent":[]}},{"type":"list","ordered":true,"start":1,"spread":false,"children":[{"type":"listItem","spread":false,"checked":null,"children":[{"type":"paragraph","children":[{"type":"text","value":"Go to the bot list and add your bot to their website. (Each site has it's own instructions)","position":{"start":{"line":80,"column":4,"offset":3450},"end":{"line":80,"column":95,"offset":3541},"indent":[]}}],"position":{"start":{"line":80,"column":4,"offset":3450},"end":{"line":80,"column":95,"offset":3541},"indent":[]}}],"position":{"start":{"line":80,"column":1,"offset":3447},"end":{"line":80,"column":95,"offset":3541},"indent":[]}},{"type":"listItem","spread":false,"checked":null,"children":[{"type":"paragraph","children":[{"type":"text","value":"Create a token for yourself on each website and paste it in your configs.","position":{"start":{"line":81,"column":4,"offset":3545},"end":{"line":81,"column":77,"offset":3618},"indent":[]}}],"position":{"start":{"line":81,"column":4,"offset":3545},"end":{"line":81,"column":77,"offset":3618},"indent":[]}}],"position":{"start":{"line":81,"column":1,"offset":3542},"end":{"line":81,"column":77,"offset":3618},"indent":[]}},{"type":"listItem","spread":false,"checked":null,"children":[{"type":"paragraph","children":[{"type":"text","value":"Enjoy!","position":{"start":{"line":82,"column":4,"offset":3622},"end":{"line":82,"column":10,"offset":3628},"indent":[]}}],"position":{"start":{"line":82,"column":4,"offset":3622},"end":{"line":82,"column":10,"offset":3628},"indent":[]}}],"position":{"start":{"line":82,"column":1,"offset":3619},"end":{"line":82,"column":10,"offset":3628},"indent":[]}}],"position":{"start":{"line":80,"column":1,"offset":3447},"end":{"line":82,"column":10,"offset":3628},"indent":[1,1]}},{"type":"paragraph","children":[{"type":"text","value":"If you wish to customize the code, you will find the bot list tasks in the tasks folder. Don't worry we will discuss this when we get to the tasks section of the guide.","position":{"start":{"line":84,"column":1,"offset":3630},"end":{"line":84,"column":169,"offset":3798},"indent":[]}}],"position":{"start":{"line":84,"column":1,"offset":3630},"end":{"line":84,"column":169,"offset":3798},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"For now just remember, that Discordeno provides you a built in way to update most discord bot lists.","position":{"start":{"line":86,"column":1,"offset":3800},"end":{"line":86,"column":101,"offset":3900},"indent":[]}}],"position":{"start":{"line":86,"column":1,"offset":3800},"end":{"line":86,"column":101,"offset":3900},"indent":[]}},{"type":"heading","depth":4,"children":[{"type":"text","value":"Channel IDs","position":{"start":{"line":88,"column":6,"offset":3907},"end":{"line":88,"column":17,"offset":3918},"indent":[]}}],"position":{"start":{"line":88,"column":1,"offset":3902},"end":{"line":88,"column":17,"offset":3918},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"The channelIDs section holds the channel IDs that are useful for specific features to help give you alerts/notifications. For example, the ","position":{"start":{"line":90,"column":1,"offset":3920},"end":{"line":90,"column":140,"offset":4059},"indent":[]}},{"type":"inlineCode","value":"missingTranslation","position":{"start":{"line":90,"column":140,"offset":4059},"end":{"line":90,"column":160,"offset":4079},"indent":[]}},{"type":"text","value":" channel will be where messages are sent alerting you that somewhere in your code you are trying to use a translation key that you never created.","position":{"start":{"line":90,"column":160,"offset":4079},"end":{"line":90,"column":305,"offset":4224},"indent":[]}}],"position":{"start":{"line":90,"column":1,"offset":3920},"end":{"line":90,"column":305,"offset":4224},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"When you get to around 25,000 Discord servers on your bot, you may want to convert these channel IDs to webhooks.","position":{"start":{"line":92,"column":1,"offset":4226},"end":{"line":92,"column":114,"offset":4339},"indent":[]}}],"position":{"start":{"line":92,"column":1,"offset":4226},"end":{"line":92,"column":114,"offset":4339},"indent":[]}},{"type":"heading","depth":4,"children":[{"type":"text","value":"Role IDs","position":{"start":{"line":94,"column":6,"offset":4346},"end":{"line":94,"column":14,"offset":4354},"indent":[]}}],"position":{"start":{"line":94,"column":1,"offset":4341},"end":{"line":94,"column":14,"offset":4354},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"The roleIDs section holds the role IDs that are useful for specific features. For example, the ","position":{"start":{"line":96,"column":1,"offset":4356},"end":{"line":96,"column":96,"offset":4451},"indent":[]}},{"type":"inlineCode","value":"patreonVIPRoleID","position":{"start":{"line":96,"column":96,"offset":4451},"end":{"line":96,"column":114,"offset":4469},"indent":[]}},{"type":"text","value":" role can be used easily to enable will be where messages are sent alerting you that somewhere in your code you are trying to use a translation key that you never created.","position":{"start":{"line":96,"column":114,"offset":4469},"end":{"line":96,"column":286,"offset":4641},"indent":[]}}],"position":{"start":{"line":96,"column":1,"offset":4356},"end":{"line":96,"column":286,"offset":4641},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"When you get to around 25,000 Discord servers on your bot, you may want to convert these channel IDs to webhooks.","position":{"start":{"line":98,"column":1,"offset":4643},"end":{"line":98,"column":114,"offset":4756},"indent":[]}}],"position":{"start":{"line":98,"column":1,"offset":4643},"end":{"line":98,"column":114,"offset":4756},"indent":[]}},{"type":"heading","depth":2,"children":[{"type":"text","value":"It's Alive!","position":{"start":{"line":100,"column":4,"offset":4761},"end":{"line":100,"column":15,"offset":4772},"indent":[]}}],"position":{"start":{"line":100,"column":1,"offset":4758},"end":{"line":100,"column":15,"offset":4772},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"Oh my god! You now have a bot with a bunch of features already! You don't believe me? Well, seeing is believing, so start the bot.","position":{"start":{"line":102,"column":1,"offset":4774},"end":{"line":102,"column":131,"offset":4904},"indent":[]}}],"position":{"start":{"line":102,"column":1,"offset":4774},"end":{"line":102,"column":131,"offset":4904},"indent":[]}},{"type":"list","ordered":true,"start":1,"spread":false,"children":[{"type":"listItem","spread":false,"checked":null,"children":[{"type":"paragraph","children":[{"type":"text","value":"Invite your bot to a discord server.","position":{"start":{"line":104,"column":4,"offset":4909},"end":{"line":104,"column":40,"offset":4945},"indent":[]}}],"position":{"start":{"line":104,"column":4,"offset":4909},"end":{"line":104,"column":40,"offset":4945},"indent":[]}}],"position":{"start":{"line":104,"column":1,"offset":4906},"end":{"line":104,"column":40,"offset":4945},"indent":[]}},{"type":"listItem","spread":false,"checked":null,"children":[{"type":"paragraph","children":[{"type":"text","value":"Open up the integrated terminal in VSC using ","position":{"start":{"line":105,"column":4,"offset":4949},"end":{"line":105,"column":49,"offset":4994},"indent":[]}},{"type":"strong","children":[{"type":"text","value":"CTRL + `","position":{"start":{"line":105,"column":51,"offset":4996},"end":{"line":105,"column":59,"offset":5004},"indent":[]}}],"position":{"start":{"line":105,"column":49,"offset":4994},"end":{"line":105,"column":61,"offset":5006},"indent":[]}},{"type":"text","value":". If you use a Mac, replace CTRL with CMD.","position":{"start":{"line":105,"column":61,"offset":5006},"end":{"line":105,"column":103,"offset":5048},"indent":[]}}],"position":{"start":{"line":105,"column":4,"offset":4949},"end":{"line":105,"column":103,"offset":5048},"indent":[]}}],"position":{"start":{"line":105,"column":1,"offset":4946},"end":{"line":105,"column":103,"offset":5048},"indent":[]}},{"type":"listItem","spread":false,"checked":null,"children":[{"type":"paragraph","children":[{"type":"text","value":"Run the script below:","position":{"start":{"line":106,"column":4,"offset":5052},"end":{"line":106,"column":25,"offset":5073},"indent":[]}}],"position":{"start":{"line":106,"column":4,"offset":5052},"end":{"line":106,"column":25,"offset":5073},"indent":[]}}],"position":{"start":{"line":106,"column":1,"offset":5049},"end":{"line":106,"column":25,"offset":5073},"indent":[]}}],"position":{"start":{"line":104,"column":1,"offset":4906},"end":{"line":106,"column":25,"offset":5073},"indent":[1,1]}},{"type":"code","lang":"shell","meta":null,"value":"deno run --allow-net --allow-read mod.ts","position":{"start":{"line":108,"column":1,"offset":5075},"end":{"line":110,"column":4,"offset":5128},"indent":[1,1]}},{"type":"paragraph","children":[{"type":"text","value":"The first time you run it, you may see a lot of files being loaded. This is preparing all the magic behind the scene. Once it is ready, you will see something like this:","position":{"start":{"line":112,"column":1,"offset":5130},"end":{"line":112,"column":170,"offset":5299},"indent":[]}}],"position":{"start":{"line":112,"column":1,"offset":5130},"end":{"line":112,"column":170,"offset":5299},"indent":[]}},{"type":"paragraph","children":[{"type":"image","title":null,"url":"https://i.imgur.com/TOXjLgh.png","alt":"image","position":{"start":{"line":114,"column":1,"offset":5301},"end":{"line":114,"column":42,"offset":5342},"indent":[]}}],"position":{"start":{"line":114,"column":1,"offset":5301},"end":{"line":114,"column":42,"offset":5342},"indent":[]}},{"type":"heading","depth":2,"children":[{"type":"text","value":"Understanding What Discordeno Did","position":{"start":{"line":116,"column":4,"offset":5347},"end":{"line":116,"column":37,"offset":5380},"indent":[]}}],"position":{"start":{"line":116,"column":1,"offset":5344},"end":{"line":116,"column":37,"offset":5380},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"Discordeno includes these commands/folders as they are essential for any discord bot to have in order to meet the Discord Bot Best Practices. It also adds a few things that will help make some things easier to build a bot.","position":{"start":{"line":118,"column":1,"offset":5382},"end":{"line":118,"column":223,"offset":5604},"indent":[]}}],"position":{"start":{"line":118,"column":1,"offset":5382},"end":{"line":118,"column":223,"offset":5604},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"We will dive into these deeper in this guide. Let's take it step by step.","position":{"start":{"line":120,"column":1,"offset":5606},"end":{"line":120,"column":74,"offset":5679},"indent":[]}}],"position":{"start":{"line":120,"column":1,"offset":5606},"end":{"line":120,"column":74,"offset":5679},"indent":[]}},{"type":"export","value":"export const _frontmatter = {\"title\":\"Creating The Bot!\",\"metaTitle\":\"Creating A Bot | Discordeno\",\"metaDescription\":\"Let's create our very own bot with Discordeno!\"}","position":{"start":{"line":123,"column":1,"offset":5682},"end":{"line":123,"column":167,"offset":5848},"indent":[]}}],"position":{"start":{"line":1,"column":1,"offset":0},"end":{"line":123,"column":167,"offset":5848}}},"scopeImports":["import * as React from 'react'"],"scopeIdentifiers":["React"],"body":"function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }\n\nfunction _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }\n\nfunction _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }\n\n/* @jsx mdx */\nvar _frontmatter = {\n \"title\": \"Creating The Bot!\",\n \"metaTitle\": \"Creating A Bot | Discordeno\",\n \"metaDescription\": \"Let's create our very own bot with Discordeno!\"\n};\nvar layoutProps = {\n _frontmatter: _frontmatter\n};\nvar MDXLayout = \"wrapper\";\nreturn function MDXContent(_ref) {\n var components = _ref.components,\n props = _objectWithoutProperties(_ref, [\"components\"]);\n\n return mdx(MDXLayout, _extends({}, layoutProps, props, {\n components: components,\n mdxType: \"MDXLayout\"\n }), mdx(\"p\", null, \"Discordeno will help make Discord bot development much easier. Don't worry, as you go through this guide it will make a lot more sense.\"), mdx(\"h2\", null, \"Creating The Bot!\"), mdx(\"blockquote\", null, mdx(\"p\", {\n parentName: \"blockquote\"\n }, \"This guide is going to assume you already have the basic requirements to make a bot ready. This includes github, git, a code editor like Visual Studio Code. If you don't have these yet please prepare them first before going forward.\")), mdx(\"ul\", null, mdx(\"li\", {\n parentName: \"ul\"\n }, mdx(\"p\", {\n parentName: \"li\"\n }, \"First, create a Discordeno Bot using the \", mdx(\"a\", _extends({\n parentName: \"p\"\n }, {\n \"href\": \"https://github.com/Skillz4Killz/Discordeno-bot-template\"\n }), \"Generator Boilerplate\"), \". Give it any name you like. For the purpose of this guide we will call it, Stargate.\")), mdx(\"li\", {\n parentName: \"ul\"\n }, mdx(\"p\", {\n parentName: \"li\"\n }, \"Then \", mdx(\"inlineCode\", {\n parentName: \"p\"\n }, \"git clone https://github.com/Skillz4Killz/Stargate.git\"))), mdx(\"li\", {\n parentName: \"ul\"\n }, mdx(\"p\", {\n parentName: \"li\"\n }, \"When that is done, go ahead and open up the folder with VSC.\")), mdx(\"li\", {\n parentName: \"ul\"\n }, mdx(\"p\", {\n parentName: \"li\"\n }, \"Create a new file called \", mdx(\"inlineCode\", {\n parentName: \"p\"\n }, \"configs.ts\"), \". Open the \", mdx(\"inlineCode\", {\n parentName: \"p\"\n }, \"configs.example.ts\"), \" file and copy everything over.\"))), mdx(\"p\", null, \"Let's take a minute to review all the options we have available to us.\"), mdx(\"h3\", null, \"Configs File\"), mdx(\"p\", null, \"The \", mdx(\"inlineCode\", {\n parentName: \"p\"\n }, \"configs.ts\"), \" file is where you will keep all your secret info you don't want to share with anyone else. As long as \", mdx(\"inlineCode\", {\n parentName: \"p\"\n }, \".gitignore\"), \" file is ignoring configs.ts your configurations will be kept private!\"), mdx(\"pre\", null, mdx(\"code\", _extends({\n parentName: \"pre\"\n }, {\n \"className\": \"language-ts\"\n }), \"// Step 1: Remove the `.example` from this file name so it is called `configs.ts`\\n// Step 2: Add all your bot's information below. The only required one is token and prefix. NOTE: As long as `.gitignore` file is ignoring configs.ts your configurations will be kept private!\\n// Step 3: Remove these comments if you like.\\n\\nexport const configs = {\\n // Your bot token goes here\\n token: \\\"\\\",\\n // The default prefix for your bot. Don't worry guilds can change this later.\\n prefix: \\\"!\\\",\\n // This isn't required but you can add bot list api keys here.\\n botListTokens: {\\n DISCORD_BOT_ORG: \\\"\\\",\\n BOTS_ON_DISCORD: \\\"\\\",\\n DISCORD_BOT_LIST: \\\"\\\",\\n BOTS_FOR_DISCORD: \\\"\\\",\\n DISCORD_BOATS: \\\"\\\",\\n DISCORD_BOTS_GG: \\\"\\\",\\n DISCORD_BOTS_GROUP: \\\"\\\",\\n },\\n // This is the server id for your bot's main server where users can get help/support\\n supportServerID: \\\"\\\",\\n // These are channel ids that will enable some functionality\\n channelIDs: {\\n // When a translation is missing this is the channel you will be alerted in.\\n missingTranslation: \\\"\\\",\\n // When an error occurs, we will try and log it to this channel\\n errorChannelID: \\\"\\\"\\n },\\n // These are the role ids that will enable some functionality.\\n roleIDs: {\\n // If you have a patreon set up you can add the patreon vip role id here.\\n patreonVIPRoleID: \\\"\\\",\\n },\\n // These are the user ids that will enable some functionality.\\n userIDs: {\\n // The user ids for the support team\\n botSupporters: [],\\n // The user ids for the other devs on your team\\n botDevs: [],\\n // The user ids who have complete 100% access to your bot\\n botOwners: []\\n }\\n};\\n\\n\")), mdx(\"h4\", null, \"Token\"), mdx(\"p\", null, \"First, add your bot token. This is \", mdx(\"strong\", {\n parentName: \"p\"\n }, \"required\"), \" for the bot to start. Review the \", mdx(\"a\", _extends({\n parentName: \"p\"\n }, {\n \"href\": \"https://discordeno.netlify.app/gettingstarted#creatingyourfirstdiscordbotapplication\"\n }), \"instructions\"), \" if you have not made your token yet.\"), mdx(\"h4\", null, \"Prefix\"), mdx(\"p\", null, \"The prefix is where you will set the default prefix for your bot. Don't worry, every server will be able to choose their own prefix but we need a default prefix to start.\"), mdx(\"h4\", null, \"Bot Lists Tokens\"), mdx(\"p\", null, \"This section of the file is so you can easily have your bot's statistics updated on all the bot lists out there to help you grow your bot. The code is already written to handle this but you will need to do 3 things for each bot list.\"), mdx(\"ol\", null, mdx(\"li\", {\n parentName: \"ol\"\n }, \"Go to the bot list and add your bot to their website. (Each site has it's own instructions)\"), mdx(\"li\", {\n parentName: \"ol\"\n }, \"Create a token for yourself on each website and paste it in your configs.\"), mdx(\"li\", {\n parentName: \"ol\"\n }, \"Enjoy!\")), mdx(\"p\", null, \"If you wish to customize the code, you will find the bot list tasks in the tasks folder. Don't worry we will discuss this when we get to the tasks section of the guide.\"), mdx(\"p\", null, \"For now just remember, that Discordeno provides you a built in way to update most discord bot lists.\"), mdx(\"h4\", null, \"Channel IDs\"), mdx(\"p\", null, \"The channelIDs section holds the channel IDs that are useful for specific features to help give you alerts/notifications. For example, the \", mdx(\"inlineCode\", {\n parentName: \"p\"\n }, \"missingTranslation\"), \" channel will be where messages are sent alerting you that somewhere in your code you are trying to use a translation key that you never created.\"), mdx(\"p\", null, \"When you get to around 25,000 Discord servers on your bot, you may want to convert these channel IDs to webhooks.\"), mdx(\"h4\", null, \"Role IDs\"), mdx(\"p\", null, \"The roleIDs section holds the role IDs that are useful for specific features. For example, the \", mdx(\"inlineCode\", {\n parentName: \"p\"\n }, \"patreonVIPRoleID\"), \" role can be used easily to enable will be where messages are sent alerting you that somewhere in your code you are trying to use a translation key that you never created.\"), mdx(\"p\", null, \"When you get to around 25,000 Discord servers on your bot, you may want to convert these channel IDs to webhooks.\"), mdx(\"h2\", null, \"It's Alive!\"), mdx(\"p\", null, \"Oh my god! You now have a bot with a bunch of features already! You don't believe me? Well, seeing is believing, so start the bot.\"), mdx(\"ol\", null, mdx(\"li\", {\n parentName: \"ol\"\n }, \"Invite your bot to a discord server.\"), mdx(\"li\", {\n parentName: \"ol\"\n }, \"Open up the integrated terminal in VSC using \", mdx(\"strong\", {\n parentName: \"li\"\n }, \"CTRL + `\"), \". If you use a Mac, replace CTRL with CMD.\"), mdx(\"li\", {\n parentName: \"ol\"\n }, \"Run the script below:\")), mdx(\"pre\", null, mdx(\"code\", _extends({\n parentName: \"pre\"\n }, {\n \"className\": \"language-shell\"\n }), \"deno run --allow-net --allow-read mod.ts\\n\")), mdx(\"p\", null, \"The first time you run it, you may see a lot of files being loaded. This is preparing all the magic behind the scene. Once it is ready, you will see something like this:\"), mdx(\"p\", null, mdx(\"img\", _extends({\n parentName: \"p\"\n }, {\n \"src\": \"https://i.imgur.com/TOXjLgh.png\",\n \"alt\": \"image\"\n }))), mdx(\"h2\", null, \"Understanding What Discordeno Did\"), mdx(\"p\", null, \"Discordeno includes these commands/folders as they are essential for any discord bot to have in order to meet the Discord Bot Best Practices. It also adds a few things that will help make some things easier to build a bot.\"), mdx(\"p\", null, \"We will dive into these deeper in this guide. Let's take it step by step.\"));\n}\n;\nMDXContent.isMDXComponent = true;","rawMDXOutput":"/* @jsx mdx */\nimport { mdx } from '@mdx-js/react';\n/* @jsx mdx */\n\nexport const _frontmatter = {\n \"title\": \"Creating The Bot!\",\n \"metaTitle\": \"Creating A Bot | Discordeno\",\n \"metaDescription\": \"Let's create our very own bot with Discordeno!\"\n};\n\nconst layoutProps = {\n _frontmatter\n};\nconst MDXLayout = \"wrapper\"\nexport default function MDXContent({\n components,\n ...props\n}) {\n return \n

{`Discordeno will help make Discord bot development much easier. Don't worry, as you go through this guide it will make a lot more sense.`}

\n

{`Creating The Bot!`}

\n
\n

{`This guide is going to assume you already have the basic requirements to make a bot ready. This includes github, git, a code editor like Visual Studio Code. If you don't have these yet please prepare them first before going forward.`}

\n
\n
    \n
  • \n

    {`First, create a Discordeno Bot using the `}{`Generator Boilerplate`}{`. Give it any name you like. For the purpose of this guide we will call it, Stargate.`}

    \n
  • \n
  • \n

    {`Then `}{`git clone https://github.com/Skillz4Killz/Stargate.git`}

    \n
  • \n
  • \n

    {`When that is done, go ahead and open up the folder with VSC.`}

    \n
  • \n
  • \n

    {`Create a new file called `}{`configs.ts`}{`. Open the `}{`configs.example.ts`}{` file and copy everything over.`}

    \n
  • \n
\n

{`Let's take a minute to review all the options we have available to us.`}

\n

{`Configs File`}

\n

{`The `}{`configs.ts`}{` file is where you will keep all your secret info you don't want to share with anyone else. As long as `}{`.gitignore`}{` file is ignoring configs.ts your configurations will be kept private!`}

\n
{`// Step 1: Remove the \\`.example\\` from this file name so it is called \\`configs.ts\\`\n// Step 2: Add all your bot's information below. The only required one is token and prefix. NOTE: As long as \\`.gitignore\\` file is ignoring configs.ts your configurations will be kept private!\n// Step 3: Remove these comments if you like.\n\nexport const configs = {\n  // Your bot token goes here\n  token: \"\",\n  // The default prefix for your bot. Don't worry guilds can change this later.\n  prefix: \"!\",\n  // This isn't required but you can add bot list api keys here.\n  botListTokens: {\n    DISCORD_BOT_ORG: \"\",\n    BOTS_ON_DISCORD: \"\",\n    DISCORD_BOT_LIST: \"\",\n    BOTS_FOR_DISCORD: \"\",\n    DISCORD_BOATS: \"\",\n    DISCORD_BOTS_GG: \"\",\n    DISCORD_BOTS_GROUP: \"\",\n  },\n  // This is the server id for your bot's main server where users can get help/support\n  supportServerID: \"\",\n  // These are channel ids that will enable some functionality\n  channelIDs: {\n    // When a translation is missing this is the channel you will be alerted in.\n    missingTranslation: \"\",\n    // When an error occurs, we will try and log it to this channel\n    errorChannelID: \"\"\n  },\n  // These are the role ids that will enable some functionality.\n  roleIDs: {\n    // If you have a patreon set up you can add the patreon vip role id here.\n    patreonVIPRoleID: \"\",\n  },\n  // These are the user ids that will enable some functionality.\n  userIDs: {\n    // The user ids for the support team\n    botSupporters: [],\n    // The user ids for the other devs on your team\n    botDevs: [],\n    // The user ids who have complete 100% access to your bot\n    botOwners: []\n  }\n};\n\n`}
\n

{`Token`}

\n

{`First, add your bot token. This is `}{`required`}{` for the bot to start. Review the `}{`instructions`}{` if you have not made your token yet.`}

\n

{`Prefix`}

\n

{`The prefix is where you will set the default prefix for your bot. Don't worry, every server will be able to choose their own prefix but we need a default prefix to start.`}

\n

{`Bot Lists Tokens`}

\n

{`This section of the file is so you can easily have your bot's statistics updated on all the bot lists out there to help you grow your bot. The code is already written to handle this but you will need to do 3 things for each bot list.`}

\n
    \n
  1. {`Go to the bot list and add your bot to their website. (Each site has it's own instructions)`}
  2. \n
  3. {`Create a token for yourself on each website and paste it in your configs.`}
  4. \n
  5. {`Enjoy!`}
  6. \n
\n

{`If you wish to customize the code, you will find the bot list tasks in the tasks folder. Don't worry we will discuss this when we get to the tasks section of the guide.`}

\n

{`For now just remember, that Discordeno provides you a built in way to update most discord bot lists.`}

\n

{`Channel IDs`}

\n

{`The channelIDs section holds the channel IDs that are useful for specific features to help give you alerts/notifications. For example, the `}{`missingTranslation`}{` channel will be where messages are sent alerting you that somewhere in your code you are trying to use a translation key that you never created.`}

\n

{`When you get to around 25,000 Discord servers on your bot, you may want to convert these channel IDs to webhooks.`}

\n

{`Role IDs`}

\n

{`The roleIDs section holds the role IDs that are useful for specific features. For example, the `}{`patreonVIPRoleID`}{` role can be used easily to enable will be where messages are sent alerting you that somewhere in your code you are trying to use a translation key that you never created.`}

\n

{`When you get to around 25,000 Discord servers on your bot, you may want to convert these channel IDs to webhooks.`}

\n

{`It's Alive!`}

\n

{`Oh my god! You now have a bot with a bunch of features already! You don't believe me? Well, seeing is believing, so start the bot.`}

\n
    \n
  1. {`Invite your bot to a discord server.`}
  2. \n
  3. {`Open up the integrated terminal in VSC using `}{`CTRL + \\``}{`. If you use a Mac, replace CTRL with CMD.`}
  4. \n
  5. {`Run the script below:`}
  6. \n
\n
{`deno run --allow-net --allow-read mod.ts\n`}
\n

{`The first time you run it, you may see a lot of files being loaded. This is preparing all the magic behind the scene. Once it is ready, you will see something like this:`}

\n

\n

{`Understanding What Discordeno Did`}

\n

{`Discordeno includes these commands/folders as they are essential for any discord bot to have in order to meet the Discord Bot Best Practices. It also adds a few things that will help make some things easier to build a bot.`}

\n

{`We will dive into these deeper in this guide. Let's take it step by step.`}

\n\n
;\n}\n\n;\nMDXContent.isMDXComponent = true;"}} \ No newline at end of file diff --git a/docs/.cache/caches/gatsby-plugin-mdx/diskstore-45335280506205b267fa24939f66a7a2.json b/docs/.cache/caches/gatsby-plugin-mdx/diskstore-45335280506205b267fa24939f66a7a2.json new file mode 100644 index 000000000..a69e93a7d --- /dev/null +++ b/docs/.cache/caches/gatsby-plugin-mdx/diskstore-45335280506205b267fa24939f66a7a2.json @@ -0,0 +1 @@ +{"expireTime":9007200851634138000,"key":"gatsby-plugin-mdx-entire-payload-cb35f9ed1653f54ba7c8f90f6677b8f8-","val":{"mdast":{"type":"root","children":[{"type":"paragraph","children":[{"type":"text","value":"Woah! You are almost half way done with understanding all of Discordeno. Amazing isn't it? Something you may have noticed in the last section was there were some options that prevented some commands from running like ","position":{"start":{"line":2,"column":1,"offset":1},"end":{"line":2,"column":218,"offset":218},"indent":[]}},{"type":"inlineCode","value":"dmOnly","position":{"start":{"line":2,"column":218,"offset":218},"end":{"line":2,"column":226,"offset":226},"indent":[]}},{"type":"text","value":" or the permission options. we created a setting to prevent the monitor from running in certain channels. What if we wanted to do prevent commands from happening? How would we prevent commands from running?","position":{"start":{"line":2,"column":226,"offset":226},"end":{"line":2,"column":432,"offset":432},"indent":[]}}],"position":{"start":{"line":2,"column":1,"offset":1},"end":{"line":2,"column":432,"offset":432},"indent":[]}},{"type":"heading","depth":2,"children":[{"type":"text","value":"What is an Inhibitor?","position":{"start":{"line":4,"column":4,"offset":437},"end":{"line":4,"column":25,"offset":458},"indent":[]}}],"position":{"start":{"line":4,"column":1,"offset":434},"end":{"line":4,"column":25,"offset":458},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"An Inhibitor is very similar to how monitors work. A monitor runs on every message but an inhibitor runs on every command. Remember all those command options like cooldown, permissions, permissionLevel, nsfw, etc... Each and every one of these options has an inhibitor in that checks commands for these settings.","position":{"start":{"line":6,"column":1,"offset":460},"end":{"line":6,"column":313,"offset":772},"indent":[]}}],"position":{"start":{"line":6,"column":1,"offset":460},"end":{"line":6,"column":313,"offset":772},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"Let's create our own inhibitor that would prevent commands from being used if the user is not a VIP user.","position":{"start":{"line":8,"column":1,"offset":774},"end":{"line":8,"column":106,"offset":879},"indent":[]}}],"position":{"start":{"line":8,"column":1,"offset":774},"end":{"line":8,"column":106,"offset":879},"indent":[]}},{"type":"blockquote","children":[{"type":"paragraph","children":[{"type":"strong","children":[{"type":"text","value":"Note:","position":{"start":{"line":10,"column":5,"offset":885},"end":{"line":10,"column":10,"offset":890},"indent":[]}}],"position":{"start":{"line":10,"column":3,"offset":883},"end":{"line":10,"column":12,"offset":892},"indent":[]}},{"type":"text","value":" It is important to remember that everything below can be done with a simple permission level as well. We will create our own custom permission levels but for the purposes of this guide and to be able to learn about Inhibitors, we will be using an inhibitor.","position":{"start":{"line":10,"column":12,"offset":892},"end":{"line":10,"column":270,"offset":1150},"indent":[]}}],"position":{"start":{"line":10,"column":3,"offset":883},"end":{"line":10,"column":270,"offset":1150},"indent":[]}}],"position":{"start":{"line":10,"column":1,"offset":881},"end":{"line":10,"column":270,"offset":1150},"indent":[]}},{"type":"heading","depth":2,"children":[{"type":"text","value":"Creating the File","position":{"start":{"line":12,"column":4,"offset":1155},"end":{"line":12,"column":21,"offset":1172},"indent":[]}}],"position":{"start":{"line":12,"column":1,"offset":1152},"end":{"line":12,"column":21,"offset":1172},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"Let's start by creating a file inside the inhibitors folder called ","position":{"start":{"line":14,"column":1,"offset":1174},"end":{"line":14,"column":68,"offset":1241},"indent":[]}},{"type":"inlineCode","value":"boosted.ts","position":{"start":{"line":14,"column":68,"offset":1241},"end":{"line":14,"column":80,"offset":1253},"indent":[]}},{"type":"text","value":" and paste the following snippet of code:","position":{"start":{"line":14,"column":80,"offset":1253},"end":{"line":14,"column":121,"offset":1294},"indent":[]}}],"position":{"start":{"line":14,"column":1,"offset":1174},"end":{"line":14,"column":121,"offset":1294},"indent":[]}},{"type":"code","lang":"ts","meta":null,"value":"import { botCache } from \"../../mod.ts\";\n\nbotCache.inhibitors.set(\"inhibitorname\", async function (message, command, guild) {\n\t// Your code goes here\n});","position":{"start":{"line":16,"column":1,"offset":1296},"end":{"line":22,"column":4,"offset":1459},"indent":[1,1,1,1,1,1]}},{"type":"paragraph","children":[{"type":"text","value":"Inhibitors can take up to 3 arguments.","position":{"start":{"line":24,"column":1,"offset":1461},"end":{"line":24,"column":39,"offset":1499},"indent":[]}}],"position":{"start":{"line":24,"column":1,"offset":1461},"end":{"line":24,"column":39,"offset":1499},"indent":[]}},{"type":"list","ordered":false,"start":null,"spread":false,"children":[{"type":"listItem","spread":false,"checked":null,"children":[{"type":"paragraph","children":[{"type":"inlineCode","value":"message","position":{"start":{"line":26,"column":3,"offset":1503},"end":{"line":26,"column":12,"offset":1512},"indent":[]}},{"type":"text","value":": The message object that triggered the command.","position":{"start":{"line":26,"column":12,"offset":1512},"end":{"line":26,"column":60,"offset":1560},"indent":[]}}],"position":{"start":{"line":26,"column":3,"offset":1503},"end":{"line":26,"column":60,"offset":1560},"indent":[]}}],"position":{"start":{"line":26,"column":1,"offset":1501},"end":{"line":26,"column":60,"offset":1560},"indent":[]}},{"type":"listItem","spread":false,"checked":null,"children":[{"type":"paragraph","children":[{"type":"inlineCode","value":"command","position":{"start":{"line":27,"column":3,"offset":1563},"end":{"line":27,"column":12,"offset":1572},"indent":[]}},{"type":"text","value":": The command object itself that was triggered.","position":{"start":{"line":27,"column":12,"offset":1572},"end":{"line":27,"column":59,"offset":1619},"indent":[]}}],"position":{"start":{"line":27,"column":3,"offset":1563},"end":{"line":27,"column":59,"offset":1619},"indent":[]}}],"position":{"start":{"line":27,"column":1,"offset":1561},"end":{"line":27,"column":59,"offset":1619},"indent":[]}},{"type":"listItem","spread":false,"checked":null,"children":[{"type":"paragraph","children":[{"type":"inlineCode","value":"guild","position":{"start":{"line":28,"column":3,"offset":1622},"end":{"line":28,"column":10,"offset":1629},"indent":[]}},{"type":"text","value":": The server guild object where this command was ran.","position":{"start":{"line":28,"column":10,"offset":1629},"end":{"line":28,"column":63,"offset":1682},"indent":[]}}],"position":{"start":{"line":28,"column":3,"offset":1622},"end":{"line":28,"column":63,"offset":1682},"indent":[]}}],"position":{"start":{"line":28,"column":1,"offset":1620},"end":{"line":28,"column":63,"offset":1682},"indent":[]}}],"position":{"start":{"line":26,"column":1,"offset":1501},"end":{"line":28,"column":63,"offset":1682},"indent":[1,1]}},{"type":"heading","depth":2,"children":[{"type":"text","value":"Understanding How Inhibitors Function","position":{"start":{"line":30,"column":4,"offset":1687},"end":{"line":30,"column":41,"offset":1724},"indent":[]}}],"position":{"start":{"line":30,"column":1,"offset":1684},"end":{"line":30,"column":41,"offset":1724},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"To block a command you have to return a truthy value.","position":{"start":{"line":32,"column":1,"offset":1726},"end":{"line":32,"column":54,"offset":1779},"indent":[]}}],"position":{"start":{"line":32,"column":1,"offset":1726},"end":{"line":32,"column":54,"offset":1779},"indent":[]}},{"type":"list","ordered":false,"start":null,"spread":false,"children":[{"type":"listItem","spread":false,"checked":null,"children":[{"type":"paragraph","children":[{"type":"strong","children":[{"type":"text","value":"return true;","position":{"start":{"line":33,"column":5,"offset":1784},"end":{"line":33,"column":17,"offset":1796},"indent":[]}}],"position":{"start":{"line":33,"column":3,"offset":1782},"end":{"line":33,"column":19,"offset":1798},"indent":[]}},{"type":"text","value":" If you return true the inhibitor will block the execution of the command.\nTo allow a command return a falsey value.","position":{"start":{"line":33,"column":19,"offset":1798},"end":{"line":34,"column":42,"offset":1914},"indent":[1]}}],"position":{"start":{"line":33,"column":3,"offset":1782},"end":{"line":34,"column":42,"offset":1914},"indent":[1]}}],"position":{"start":{"line":33,"column":1,"offset":1780},"end":{"line":34,"column":42,"offset":1914},"indent":[1]}},{"type":"listItem","spread":false,"checked":null,"children":[{"type":"paragraph","children":[{"type":"strong","children":[{"type":"text","value":"return false;","position":{"start":{"line":35,"column":5,"offset":1919},"end":{"line":35,"column":18,"offset":1932},"indent":[]}}],"position":{"start":{"line":35,"column":3,"offset":1917},"end":{"line":35,"column":20,"offset":1934},"indent":[]}},{"type":"text","value":" If you return false the inhibitor will not block the error.","position":{"start":{"line":35,"column":20,"offset":1934},"end":{"line":35,"column":80,"offset":1994},"indent":[]}}],"position":{"start":{"line":35,"column":3,"offset":1917},"end":{"line":35,"column":80,"offset":1994},"indent":[]}}],"position":{"start":{"line":35,"column":1,"offset":1915},"end":{"line":35,"column":80,"offset":1994},"indent":[]}}],"position":{"start":{"line":33,"column":1,"offset":1780},"end":{"line":35,"column":80,"offset":1994},"indent":[1,1]}},{"type":"code","lang":"ts","meta":null,"value":"// If the command is not VIP only we can allow this command to execute\nif (!command.vipOnly) return false;\n\n// The bot's support server\nconst guild = cache.guilds.get(configs.supportServerID);\n// The \nconst\n// Check if the user has the vip role on the support server given by patreon\nconst userIsVIP = await isUserVIP(message.author.id)\n// The user is VIP so we can allow this command to be used\nif (userIsVIP) return false;\n\n// The user is NOT VIP so we throw an error\nthrow `The ${command.name} is only allowed for VIP users.`","position":{"start":{"line":38,"column":1,"offset":1997},"end":{"line":53,"column":4,"offset":2535},"indent":[1,1,1,1,1,1,1,1,1,1,1,1,1,1,1]}},{"type":"export","value":"export const _frontmatter = {\"title\":\"Creating Inhibitors!\",\"metaTitle\":\"Creating An Inhibitor | Discordeno\",\"metaDescription\":\"Let's create our very own bot with Discordeno!\"}","position":{"start":{"line":56,"column":1,"offset":2538},"end":{"line":56,"column":177,"offset":2714},"indent":[]}}],"position":{"start":{"line":1,"column":1,"offset":0},"end":{"line":56,"column":177,"offset":2714}}},"scopeImports":["import * as React from 'react'"],"scopeIdentifiers":["React"],"body":"function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }\n\nfunction _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }\n\nfunction _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }\n\n/* @jsx mdx */\nvar _frontmatter = {\n \"title\": \"Creating Inhibitors!\",\n \"metaTitle\": \"Creating An Inhibitor | Discordeno\",\n \"metaDescription\": \"Let's create our very own bot with Discordeno!\"\n};\nvar layoutProps = {\n _frontmatter: _frontmatter\n};\nvar MDXLayout = \"wrapper\";\nreturn function MDXContent(_ref) {\n var components = _ref.components,\n props = _objectWithoutProperties(_ref, [\"components\"]);\n\n return mdx(MDXLayout, _extends({}, layoutProps, props, {\n components: components,\n mdxType: \"MDXLayout\"\n }), mdx(\"p\", null, \"Woah! You are almost half way done with understanding all of Discordeno. Amazing isn't it? Something you may have noticed in the last section was there were some options that prevented some commands from running like \", mdx(\"inlineCode\", {\n parentName: \"p\"\n }, \"dmOnly\"), \" or the permission options. we created a setting to prevent the monitor from running in certain channels. What if we wanted to do prevent commands from happening? How would we prevent commands from running?\"), mdx(\"h2\", null, \"What is an Inhibitor?\"), mdx(\"p\", null, \"An Inhibitor is very similar to how monitors work. A monitor runs on every message but an inhibitor runs on every command. Remember all those command options like cooldown, permissions, permissionLevel, nsfw, etc... Each and every one of these options has an inhibitor in that checks commands for these settings.\"), mdx(\"p\", null, \"Let's create our own inhibitor that would prevent commands from being used if the user is not a VIP user.\"), mdx(\"blockquote\", null, mdx(\"p\", {\n parentName: \"blockquote\"\n }, mdx(\"strong\", {\n parentName: \"p\"\n }, \"Note:\"), \" It is important to remember that everything below can be done with a simple permission level as well. We will create our own custom permission levels but for the purposes of this guide and to be able to learn about Inhibitors, we will be using an inhibitor.\")), mdx(\"h2\", null, \"Creating the File\"), mdx(\"p\", null, \"Let's start by creating a file inside the inhibitors folder called \", mdx(\"inlineCode\", {\n parentName: \"p\"\n }, \"boosted.ts\"), \" and paste the following snippet of code:\"), mdx(\"pre\", null, mdx(\"code\", _extends({\n parentName: \"pre\"\n }, {\n \"className\": \"language-ts\"\n }), \"import { botCache } from \\\"../../mod.ts\\\";\\n\\nbotCache.inhibitors.set(\\\"inhibitorname\\\", async function (message, command, guild) {\\n // Your code goes here\\n});\\n\")), mdx(\"p\", null, \"Inhibitors can take up to 3 arguments.\"), mdx(\"ul\", null, mdx(\"li\", {\n parentName: \"ul\"\n }, mdx(\"inlineCode\", {\n parentName: \"li\"\n }, \"message\"), \": The message object that triggered the command.\"), mdx(\"li\", {\n parentName: \"ul\"\n }, mdx(\"inlineCode\", {\n parentName: \"li\"\n }, \"command\"), \": The command object itself that was triggered.\"), mdx(\"li\", {\n parentName: \"ul\"\n }, mdx(\"inlineCode\", {\n parentName: \"li\"\n }, \"guild\"), \": The server guild object where this command was ran.\")), mdx(\"h2\", null, \"Understanding How Inhibitors Function\"), mdx(\"p\", null, \"To block a command you have to return a truthy value.\"), mdx(\"ul\", null, mdx(\"li\", {\n parentName: \"ul\"\n }, mdx(\"strong\", {\n parentName: \"li\"\n }, \"return true;\"), \" If you return true the inhibitor will block the execution of the command.\\nTo allow a command return a falsey value.\"), mdx(\"li\", {\n parentName: \"ul\"\n }, mdx(\"strong\", {\n parentName: \"li\"\n }, \"return false;\"), \" If you return false the inhibitor will not block the error.\")), mdx(\"pre\", null, mdx(\"code\", _extends({\n parentName: \"pre\"\n }, {\n \"className\": \"language-ts\"\n }), \"// If the command is not VIP only we can allow this command to execute\\nif (!command.vipOnly) return false;\\n\\n// The bot's support server\\nconst guild = cache.guilds.get(configs.supportServerID);\\n// The \\nconst\\n// Check if the user has the vip role on the support server given by patreon\\nconst userIsVIP = await isUserVIP(message.author.id)\\n// The user is VIP so we can allow this command to be used\\nif (userIsVIP) return false;\\n\\n// The user is NOT VIP so we throw an error\\nthrow `The ${command.name} is only allowed for VIP users.`\\n\")));\n}\n;\nMDXContent.isMDXComponent = true;","rawMDXOutput":"/* @jsx mdx */\nimport { mdx } from '@mdx-js/react';\n/* @jsx mdx */\n\nexport const _frontmatter = {\n \"title\": \"Creating Inhibitors!\",\n \"metaTitle\": \"Creating An Inhibitor | Discordeno\",\n \"metaDescription\": \"Let's create our very own bot with Discordeno!\"\n};\n\nconst layoutProps = {\n _frontmatter\n};\nconst MDXLayout = \"wrapper\"\nexport default function MDXContent({\n components,\n ...props\n}) {\n return \n

{`Woah! You are almost half way done with understanding all of Discordeno. Amazing isn't it? Something you may have noticed in the last section was there were some options that prevented some commands from running like `}{`dmOnly`}{` or the permission options. we created a setting to prevent the monitor from running in certain channels. What if we wanted to do prevent commands from happening? How would we prevent commands from running?`}

\n

{`What is an Inhibitor?`}

\n

{`An Inhibitor is very similar to how monitors work. A monitor runs on every message but an inhibitor runs on every command. Remember all those command options like cooldown, permissions, permissionLevel, nsfw, etc... Each and every one of these options has an inhibitor in that checks commands for these settings.`}

\n

{`Let's create our own inhibitor that would prevent commands from being used if the user is not a VIP user.`}

\n
\n

{`Note:`}{` It is important to remember that everything below can be done with a simple permission level as well. We will create our own custom permission levels but for the purposes of this guide and to be able to learn about Inhibitors, we will be using an inhibitor.`}

\n
\n

{`Creating the File`}

\n

{`Let's start by creating a file inside the inhibitors folder called `}{`boosted.ts`}{` and paste the following snippet of code:`}

\n
{`import { botCache } from \"../../mod.ts\";\n\nbotCache.inhibitors.set(\"inhibitorname\", async function (message, command, guild) {\n    // Your code goes here\n});\n`}
\n

{`Inhibitors can take up to 3 arguments.`}

\n
    \n
  • {`message`}{`: The message object that triggered the command.`}
  • \n
  • {`command`}{`: The command object itself that was triggered.`}
  • \n
  • {`guild`}{`: The server guild object where this command was ran.`}
  • \n
\n

{`Understanding How Inhibitors Function`}

\n

{`To block a command you have to return a truthy value.`}

\n
    \n
  • {`return true;`}{` If you return true the inhibitor will block the execution of the command.\nTo allow a command return a falsey value.`}
  • \n
  • {`return false;`}{` If you return false the inhibitor will not block the error.`}
  • \n
\n
{`// If the command is not VIP only we can allow this command to execute\nif (!command.vipOnly) return false;\n\n// The bot's support server\nconst guild = cache.guilds.get(configs.supportServerID);\n// The \nconst\n// Check if the user has the vip role on the support server given by patreon\nconst userIsVIP = await isUserVIP(message.author.id)\n// The user is VIP so we can allow this command to be used\nif (userIsVIP) return false;\n\n// The user is NOT VIP so we throw an error\nthrow \\`The \\${command.name} is only allowed for VIP users.\\`\n`}
\n\n
;\n}\n\n;\nMDXContent.isMDXComponent = true;"}} \ No newline at end of file diff --git a/docs/.cache/caches/gatsby-plugin-mdx/diskstore-46cfa0f805b5feb9157382b2cdd6e3fc.json b/docs/.cache/caches/gatsby-plugin-mdx/diskstore-46cfa0f805b5feb9157382b2cdd6e3fc.json new file mode 100644 index 000000000..25983fe57 --- /dev/null +++ b/docs/.cache/caches/gatsby-plugin-mdx/diskstore-46cfa0f805b5feb9157382b2cdd6e3fc.json @@ -0,0 +1 @@ +{"expireTime":9007200851644187000,"key":"gatsby-plugin-mdx-entire-payload-de3a42f9693a8b0783a183d8a8854b48-","val":{"mdast":{"type":"root","children":[{"type":"paragraph","children":[{"type":"text","value":"Discordeno will help make Discord bot development much easier. Don't worry, as you go through this guide it will make a lot more sense.","position":{"start":{"line":2,"column":1,"offset":1},"end":{"line":2,"column":136,"offset":136},"indent":[]}}],"position":{"start":{"line":2,"column":1,"offset":1},"end":{"line":2,"column":136,"offset":136},"indent":[]}},{"type":"heading","depth":2,"children":[{"type":"text","value":"Creating The Bot!","position":{"start":{"line":4,"column":4,"offset":141},"end":{"line":4,"column":21,"offset":158},"indent":[]}}],"position":{"start":{"line":4,"column":1,"offset":138},"end":{"line":4,"column":21,"offset":158},"indent":[]}},{"type":"blockquote","children":[{"type":"paragraph","children":[{"type":"text","value":"This guide is going to assume you already have the basic requirements to make a bot ready. This includes github, git, a code editor like Visual Studio Code. If you don't have these yet please prepare them first before going forward.","position":{"start":{"line":6,"column":3,"offset":162},"end":{"line":6,"column":235,"offset":394},"indent":[]}}],"position":{"start":{"line":6,"column":3,"offset":162},"end":{"line":6,"column":235,"offset":394},"indent":[]}}],"position":{"start":{"line":6,"column":1,"offset":160},"end":{"line":6,"column":235,"offset":394},"indent":[]}},{"type":"list","ordered":false,"start":null,"spread":true,"children":[{"type":"listItem","spread":false,"checked":null,"children":[{"type":"paragraph","children":[{"type":"text","value":"First, create a Discordeno Bot using the ","position":{"start":{"line":8,"column":3,"offset":398},"end":{"line":8,"column":44,"offset":439},"indent":[]}},{"type":"link","title":null,"url":"https://github.com/Skillz4Killz/Discordeno-bot-template","children":[{"type":"text","value":"Generator Boilerplate","position":{"start":{"line":8,"column":45,"offset":440},"end":{"line":8,"column":66,"offset":461},"indent":[]}}],"position":{"start":{"line":8,"column":44,"offset":439},"end":{"line":8,"column":124,"offset":519},"indent":[]}},{"type":"text","value":". Give it any name you like. For the purpose of this guide we will call it, Stargate.","position":{"start":{"line":8,"column":124,"offset":519},"end":{"line":8,"column":209,"offset":604},"indent":[]}}],"position":{"start":{"line":8,"column":3,"offset":398},"end":{"line":8,"column":209,"offset":604},"indent":[]}}],"position":{"start":{"line":8,"column":1,"offset":396},"end":{"line":9,"column":1,"offset":605},"indent":[1]}},{"type":"listItem","spread":false,"checked":null,"children":[{"type":"paragraph","children":[{"type":"text","value":"Then ","position":{"start":{"line":10,"column":3,"offset":608},"end":{"line":10,"column":8,"offset":613},"indent":[]}},{"type":"inlineCode","value":"git clone https://github.com/Skillz4Killz/Stargate.git","position":{"start":{"line":10,"column":8,"offset":613},"end":{"line":10,"column":64,"offset":669},"indent":[]}}],"position":{"start":{"line":10,"column":3,"offset":608},"end":{"line":10,"column":64,"offset":669},"indent":[]}}],"position":{"start":{"line":10,"column":1,"offset":606},"end":{"line":11,"column":1,"offset":670},"indent":[1]}},{"type":"listItem","spread":false,"checked":null,"children":[{"type":"paragraph","children":[{"type":"text","value":"When that is done, go ahead and open up the folder with VSC.","position":{"start":{"line":12,"column":3,"offset":673},"end":{"line":12,"column":63,"offset":733},"indent":[]}}],"position":{"start":{"line":12,"column":3,"offset":673},"end":{"line":12,"column":63,"offset":733},"indent":[]}}],"position":{"start":{"line":12,"column":1,"offset":671},"end":{"line":12,"column":63,"offset":733},"indent":[]}},{"type":"listItem","spread":false,"checked":null,"children":[{"type":"paragraph","children":[{"type":"text","value":"Create a new file called ","position":{"start":{"line":13,"column":3,"offset":736},"end":{"line":13,"column":28,"offset":761},"indent":[]}},{"type":"inlineCode","value":"configs.ts","position":{"start":{"line":13,"column":28,"offset":761},"end":{"line":13,"column":40,"offset":773},"indent":[]}},{"type":"text","value":". Open the ","position":{"start":{"line":13,"column":40,"offset":773},"end":{"line":13,"column":51,"offset":784},"indent":[]}},{"type":"inlineCode","value":"configs.example.ts","position":{"start":{"line":13,"column":51,"offset":784},"end":{"line":13,"column":71,"offset":804},"indent":[]}},{"type":"text","value":" file and copy everything over.","position":{"start":{"line":13,"column":71,"offset":804},"end":{"line":13,"column":102,"offset":835},"indent":[]}}],"position":{"start":{"line":13,"column":3,"offset":736},"end":{"line":13,"column":102,"offset":835},"indent":[]}}],"position":{"start":{"line":13,"column":1,"offset":734},"end":{"line":13,"column":102,"offset":835},"indent":[]}}],"position":{"start":{"line":8,"column":1,"offset":396},"end":{"line":13,"column":102,"offset":835},"indent":[1,1,1,1,1]}},{"type":"paragraph","children":[{"type":"text","value":"Let's take a minute to review all the options we have available to us.","position":{"start":{"line":15,"column":1,"offset":837},"end":{"line":15,"column":71,"offset":907},"indent":[]}}],"position":{"start":{"line":15,"column":1,"offset":837},"end":{"line":15,"column":71,"offset":907},"indent":[]}},{"type":"heading","depth":3,"children":[{"type":"text","value":"Configs File","position":{"start":{"line":17,"column":5,"offset":913},"end":{"line":17,"column":17,"offset":925},"indent":[]}}],"position":{"start":{"line":17,"column":1,"offset":909},"end":{"line":17,"column":17,"offset":925},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"The ","position":{"start":{"line":19,"column":1,"offset":927},"end":{"line":19,"column":5,"offset":931},"indent":[]}},{"type":"inlineCode","value":"configs.ts","position":{"start":{"line":19,"column":5,"offset":931},"end":{"line":19,"column":17,"offset":943},"indent":[]}},{"type":"text","value":" file is where you will keep all your secret info you don't want to share with anyone else. As long as ","position":{"start":{"line":19,"column":17,"offset":943},"end":{"line":19,"column":120,"offset":1046},"indent":[]}},{"type":"inlineCode","value":".gitignore","position":{"start":{"line":19,"column":120,"offset":1046},"end":{"line":19,"column":132,"offset":1058},"indent":[]}},{"type":"text","value":" file is ignoring configs.ts your configurations will be kept private!","position":{"start":{"line":19,"column":132,"offset":1058},"end":{"line":19,"column":202,"offset":1128},"indent":[]}}],"position":{"start":{"line":19,"column":1,"offset":927},"end":{"line":19,"column":202,"offset":1128},"indent":[]}},{"type":"code","lang":"ts","meta":null,"value":"// Step 1: Remove the `.example` from this file name so it is called `configs.ts`\n// Step 2: Add all your bot's information below. The only required one is token and prefix. NOTE: As long as `.gitignore` file is ignoring configs.ts your configurations will be kept private!\n// Step 3: Remove these comments if you like.\n\nexport const configs = {\n // Your bot token goes here\n token: \"\",\n // The default prefix for your bot. Don't worry guilds can change this later.\n prefix: \"!\",\n // This isn't required but you can add bot list api keys here.\n botListTokens: {\n DISCORD_BOT_ORG: \"\",\n BOTS_ON_DISCORD: \"\",\n DISCORD_BOT_LIST: \"\",\n BOTS_FOR_DISCORD: \"\",\n DISCORD_BOATS: \"\",\n DISCORD_BOTS_GG: \"\",\n DISCORD_BOTS_GROUP: \"\",\n },\n // This is the server id for your bot's main server where users can get help/support\n supportServerID: \"\",\n // These are channel ids that will enable some functionality\n channelIDs: {\n // When a translation is missing this is the channel you will be alerted in.\n missingTranslation: \"\",\n // When an error occurs, we will try and log it to this channel\n errorChannelID: \"\"\n },\n // These are the role ids that will enable some functionality.\n roleIDs: {\n // If you have a patreon set up you can add the patreon vip role id here.\n patreonVIPRoleID: \"\",\n },\n // These are the user ids that will enable some functionality.\n userIDs: {\n // The user ids for the support team\n botSupporters: [],\n // The user ids for the other devs on your team\n botDevs: [],\n // The user ids who have complete 100% access to your bot\n botOwners: []\n }\n};\n","position":{"start":{"line":21,"column":1,"offset":1130},"end":{"line":66,"column":4,"offset":2770},"indent":[1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1]}},{"type":"heading","depth":4,"children":[{"type":"text","value":"Token","position":{"start":{"line":68,"column":6,"offset":2777},"end":{"line":68,"column":11,"offset":2782},"indent":[]}}],"position":{"start":{"line":68,"column":1,"offset":2772},"end":{"line":68,"column":11,"offset":2782},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"First, add your bot token. This is ","position":{"start":{"line":70,"column":1,"offset":2784},"end":{"line":70,"column":36,"offset":2819},"indent":[]}},{"type":"strong","children":[{"type":"text","value":"required","position":{"start":{"line":70,"column":38,"offset":2821},"end":{"line":70,"column":46,"offset":2829},"indent":[]}}],"position":{"start":{"line":70,"column":36,"offset":2819},"end":{"line":70,"column":48,"offset":2831},"indent":[]}},{"type":"text","value":" for the bot to start. Review the ","position":{"start":{"line":70,"column":48,"offset":2831},"end":{"line":70,"column":82,"offset":2865},"indent":[]}},{"type":"link","title":null,"url":"https://discordeno.netlify.app/gettingstarted#creatingyourfirstdiscordbotapplication","children":[{"type":"text","value":"instructions","position":{"start":{"line":70,"column":83,"offset":2866},"end":{"line":70,"column":95,"offset":2878},"indent":[]}}],"position":{"start":{"line":70,"column":82,"offset":2865},"end":{"line":70,"column":182,"offset":2965},"indent":[]}},{"type":"text","value":" if you have not made your token yet.","position":{"start":{"line":70,"column":182,"offset":2965},"end":{"line":70,"column":219,"offset":3002},"indent":[]}}],"position":{"start":{"line":70,"column":1,"offset":2784},"end":{"line":70,"column":219,"offset":3002},"indent":[]}},{"type":"heading","depth":4,"children":[{"type":"text","value":"Prefix","position":{"start":{"line":72,"column":6,"offset":3009},"end":{"line":72,"column":12,"offset":3015},"indent":[]}}],"position":{"start":{"line":72,"column":1,"offset":3004},"end":{"line":72,"column":12,"offset":3015},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"The prefix is where you will set the default prefix for your bot. Don't worry, every server will be able to choose their own prefix but we need a default prefix to start.","position":{"start":{"line":74,"column":1,"offset":3017},"end":{"line":74,"column":171,"offset":3187},"indent":[]}}],"position":{"start":{"line":74,"column":1,"offset":3017},"end":{"line":74,"column":171,"offset":3187},"indent":[]}},{"type":"heading","depth":4,"children":[{"type":"text","value":"Bot Lists Tokens","position":{"start":{"line":76,"column":6,"offset":3194},"end":{"line":76,"column":22,"offset":3210},"indent":[]}}],"position":{"start":{"line":76,"column":1,"offset":3189},"end":{"line":76,"column":22,"offset":3210},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"This section of the file is so you can easily have your bot's statistics updated on all the bot lists out there to help you grow your bot. The code is already written to handle this but you will need to do 3 things for each bot list.","position":{"start":{"line":78,"column":1,"offset":3212},"end":{"line":78,"column":234,"offset":3445},"indent":[]}}],"position":{"start":{"line":78,"column":1,"offset":3212},"end":{"line":78,"column":234,"offset":3445},"indent":[]}},{"type":"list","ordered":true,"start":1,"spread":false,"children":[{"type":"listItem","spread":false,"checked":null,"children":[{"type":"paragraph","children":[{"type":"text","value":"Go to the bot list and add your bot to their website. (Each site has it's own instructions)","position":{"start":{"line":80,"column":4,"offset":3450},"end":{"line":80,"column":95,"offset":3541},"indent":[]}}],"position":{"start":{"line":80,"column":4,"offset":3450},"end":{"line":80,"column":95,"offset":3541},"indent":[]}}],"position":{"start":{"line":80,"column":1,"offset":3447},"end":{"line":80,"column":95,"offset":3541},"indent":[]}},{"type":"listItem","spread":false,"checked":null,"children":[{"type":"paragraph","children":[{"type":"text","value":"Create a token for yourself on each website and paste it in your configs.","position":{"start":{"line":81,"column":4,"offset":3545},"end":{"line":81,"column":77,"offset":3618},"indent":[]}}],"position":{"start":{"line":81,"column":4,"offset":3545},"end":{"line":81,"column":77,"offset":3618},"indent":[]}}],"position":{"start":{"line":81,"column":1,"offset":3542},"end":{"line":81,"column":77,"offset":3618},"indent":[]}},{"type":"listItem","spread":false,"checked":null,"children":[{"type":"paragraph","children":[{"type":"text","value":"Enjoy!","position":{"start":{"line":82,"column":4,"offset":3622},"end":{"line":82,"column":10,"offset":3628},"indent":[]}}],"position":{"start":{"line":82,"column":4,"offset":3622},"end":{"line":82,"column":10,"offset":3628},"indent":[]}}],"position":{"start":{"line":82,"column":1,"offset":3619},"end":{"line":82,"column":10,"offset":3628},"indent":[]}}],"position":{"start":{"line":80,"column":1,"offset":3447},"end":{"line":82,"column":10,"offset":3628},"indent":[1,1]}},{"type":"paragraph","children":[{"type":"text","value":"If you wish to customize the code, you will find the bot list tasks in the tasks folder. Don't worry we will discuss this when we get to the tasks section of the guide.","position":{"start":{"line":84,"column":1,"offset":3630},"end":{"line":84,"column":169,"offset":3798},"indent":[]}}],"position":{"start":{"line":84,"column":1,"offset":3630},"end":{"line":84,"column":169,"offset":3798},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"For now just remember, that Discordeno provides you a built in way to update most discord bot lists.","position":{"start":{"line":86,"column":1,"offset":3800},"end":{"line":86,"column":101,"offset":3900},"indent":[]}}],"position":{"start":{"line":86,"column":1,"offset":3800},"end":{"line":86,"column":101,"offset":3900},"indent":[]}},{"type":"heading","depth":4,"children":[{"type":"text","value":"Channel IDs","position":{"start":{"line":88,"column":6,"offset":3907},"end":{"line":88,"column":17,"offset":3918},"indent":[]}}],"position":{"start":{"line":88,"column":1,"offset":3902},"end":{"line":88,"column":17,"offset":3918},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"The channelIDs section holds the useful for specific features to help give you alerts/notifications. For example, the ","position":{"start":{"line":90,"column":1,"offset":3920},"end":{"line":90,"column":119,"offset":4038},"indent":[]}},{"type":"inlineCode","value":"missingTranslation","position":{"start":{"line":90,"column":119,"offset":4038},"end":{"line":90,"column":139,"offset":4058},"indent":[]}},{"type":"text","value":" channel will be where messages are sent alerting you that somewhere in your code you are trying to use a translation key that you never created.","position":{"start":{"line":90,"column":139,"offset":4058},"end":{"line":90,"column":284,"offset":4203},"indent":[]}}],"position":{"start":{"line":90,"column":1,"offset":3920},"end":{"line":90,"column":284,"offset":4203},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"When you get to around 25,000 Discord servers on your bot, you may want to convert these channel IDs to webhooks.","position":{"start":{"line":92,"column":1,"offset":4205},"end":{"line":92,"column":114,"offset":4318},"indent":[]}}],"position":{"start":{"line":92,"column":1,"offset":4205},"end":{"line":92,"column":114,"offset":4318},"indent":[]}},{"type":"heading","depth":4,"children":[{"type":"text","value":"Channel IDs","position":{"start":{"line":94,"column":6,"offset":4325},"end":{"line":94,"column":17,"offset":4336},"indent":[]}}],"position":{"start":{"line":94,"column":1,"offset":4320},"end":{"line":94,"column":17,"offset":4336},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"The channelIDs section holds the useful for specific features to help give you alerts/notifications. For example, the ","position":{"start":{"line":96,"column":1,"offset":4338},"end":{"line":96,"column":119,"offset":4456},"indent":[]}},{"type":"inlineCode","value":"missingTranslation","position":{"start":{"line":96,"column":119,"offset":4456},"end":{"line":96,"column":139,"offset":4476},"indent":[]}},{"type":"text","value":" channel will be where messages are sent alerting you that somewhere in your code you are trying to use a translation key that you never created.","position":{"start":{"line":96,"column":139,"offset":4476},"end":{"line":96,"column":284,"offset":4621},"indent":[]}}],"position":{"start":{"line":96,"column":1,"offset":4338},"end":{"line":96,"column":284,"offset":4621},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"When you get to around 25,000 Discord servers on your bot, you may want to convert these channel IDs to webhooks.","position":{"start":{"line":98,"column":1,"offset":4623},"end":{"line":98,"column":114,"offset":4736},"indent":[]}}],"position":{"start":{"line":98,"column":1,"offset":4623},"end":{"line":98,"column":114,"offset":4736},"indent":[]}},{"type":"heading","depth":2,"children":[{"type":"text","value":"It's Alive!","position":{"start":{"line":100,"column":4,"offset":4741},"end":{"line":100,"column":15,"offset":4752},"indent":[]}}],"position":{"start":{"line":100,"column":1,"offset":4738},"end":{"line":100,"column":15,"offset":4752},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"Oh my god! You now have a bot with a bunch of features already! You don't believe me? Well, seeing is believing, so start the bot.","position":{"start":{"line":102,"column":1,"offset":4754},"end":{"line":102,"column":131,"offset":4884},"indent":[]}}],"position":{"start":{"line":102,"column":1,"offset":4754},"end":{"line":102,"column":131,"offset":4884},"indent":[]}},{"type":"list","ordered":true,"start":1,"spread":false,"children":[{"type":"listItem","spread":false,"checked":null,"children":[{"type":"paragraph","children":[{"type":"text","value":"Invite your bot to a discord server.","position":{"start":{"line":104,"column":4,"offset":4889},"end":{"line":104,"column":40,"offset":4925},"indent":[]}}],"position":{"start":{"line":104,"column":4,"offset":4889},"end":{"line":104,"column":40,"offset":4925},"indent":[]}}],"position":{"start":{"line":104,"column":1,"offset":4886},"end":{"line":104,"column":40,"offset":4925},"indent":[]}},{"type":"listItem","spread":false,"checked":null,"children":[{"type":"paragraph","children":[{"type":"text","value":"Open up the integrated terminal in VSC using ","position":{"start":{"line":105,"column":4,"offset":4929},"end":{"line":105,"column":49,"offset":4974},"indent":[]}},{"type":"strong","children":[{"type":"text","value":"CTRL + `","position":{"start":{"line":105,"column":51,"offset":4976},"end":{"line":105,"column":59,"offset":4984},"indent":[]}}],"position":{"start":{"line":105,"column":49,"offset":4974},"end":{"line":105,"column":61,"offset":4986},"indent":[]}},{"type":"text","value":". If you use a Mac, replace CTRL with CMD.","position":{"start":{"line":105,"column":61,"offset":4986},"end":{"line":105,"column":103,"offset":5028},"indent":[]}}],"position":{"start":{"line":105,"column":4,"offset":4929},"end":{"line":105,"column":103,"offset":5028},"indent":[]}}],"position":{"start":{"line":105,"column":1,"offset":4926},"end":{"line":105,"column":103,"offset":5028},"indent":[]}},{"type":"listItem","spread":false,"checked":null,"children":[{"type":"paragraph","children":[{"type":"text","value":"Run the script below:","position":{"start":{"line":106,"column":4,"offset":5032},"end":{"line":106,"column":25,"offset":5053},"indent":[]}}],"position":{"start":{"line":106,"column":4,"offset":5032},"end":{"line":106,"column":25,"offset":5053},"indent":[]}}],"position":{"start":{"line":106,"column":1,"offset":5029},"end":{"line":106,"column":25,"offset":5053},"indent":[]}}],"position":{"start":{"line":104,"column":1,"offset":4886},"end":{"line":106,"column":25,"offset":5053},"indent":[1,1]}},{"type":"code","lang":"shell","meta":null,"value":"deno run --allow-net --allow-read mod.ts","position":{"start":{"line":108,"column":1,"offset":5055},"end":{"line":110,"column":4,"offset":5108},"indent":[1,1]}},{"type":"paragraph","children":[{"type":"text","value":"The first time you run it, you may see a lot of files being loaded. This is preparing all the magic behind the scene. Once it is ready, you will see something like this:","position":{"start":{"line":112,"column":1,"offset":5110},"end":{"line":112,"column":170,"offset":5279},"indent":[]}}],"position":{"start":{"line":112,"column":1,"offset":5110},"end":{"line":112,"column":170,"offset":5279},"indent":[]}},{"type":"paragraph","children":[{"type":"image","title":null,"url":"https://i.imgur.com/TOXjLgh.png","alt":"image","position":{"start":{"line":114,"column":1,"offset":5281},"end":{"line":114,"column":42,"offset":5322},"indent":[]}}],"position":{"start":{"line":114,"column":1,"offset":5281},"end":{"line":114,"column":42,"offset":5322},"indent":[]}},{"type":"heading","depth":2,"children":[{"type":"text","value":"Understanding What Discordeno Did","position":{"start":{"line":116,"column":4,"offset":5327},"end":{"line":116,"column":37,"offset":5360},"indent":[]}}],"position":{"start":{"line":116,"column":1,"offset":5324},"end":{"line":116,"column":37,"offset":5360},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"Discordeno includes these commands/folders as they are essential for any discord bot to have in order to meet the Discord Bot Best Practices. It also adds a few things that will help make some things easier to build a bot.","position":{"start":{"line":118,"column":1,"offset":5362},"end":{"line":118,"column":223,"offset":5584},"indent":[]}}],"position":{"start":{"line":118,"column":1,"offset":5362},"end":{"line":118,"column":223,"offset":5584},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"We will dive into these deeper in this guide. Let's take it step by step.","position":{"start":{"line":120,"column":1,"offset":5586},"end":{"line":120,"column":74,"offset":5659},"indent":[]}}],"position":{"start":{"line":120,"column":1,"offset":5586},"end":{"line":120,"column":74,"offset":5659},"indent":[]}},{"type":"export","value":"export const _frontmatter = {\"title\":\"Creating The Bot!\",\"metaTitle\":\"Creating A Bot | Discordeno\",\"metaDescription\":\"Let's create our very own bot with Discordeno!\"}","position":{"start":{"line":123,"column":1,"offset":5662},"end":{"line":123,"column":167,"offset":5828},"indent":[]}}],"position":{"start":{"line":1,"column":1,"offset":0},"end":{"line":123,"column":167,"offset":5828}}},"scopeImports":["import * as React from 'react'"],"scopeIdentifiers":["React"],"body":"function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }\n\nfunction _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }\n\nfunction _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }\n\n/* @jsx mdx */\nvar _frontmatter = {\n \"title\": \"Creating The Bot!\",\n \"metaTitle\": \"Creating A Bot | Discordeno\",\n \"metaDescription\": \"Let's create our very own bot with Discordeno!\"\n};\nvar layoutProps = {\n _frontmatter: _frontmatter\n};\nvar MDXLayout = \"wrapper\";\nreturn function MDXContent(_ref) {\n var components = _ref.components,\n props = _objectWithoutProperties(_ref, [\"components\"]);\n\n return mdx(MDXLayout, _extends({}, layoutProps, props, {\n components: components,\n mdxType: \"MDXLayout\"\n }), mdx(\"p\", null, \"Discordeno will help make Discord bot development much easier. Don't worry, as you go through this guide it will make a lot more sense.\"), mdx(\"h2\", null, \"Creating The Bot!\"), mdx(\"blockquote\", null, mdx(\"p\", {\n parentName: \"blockquote\"\n }, \"This guide is going to assume you already have the basic requirements to make a bot ready. This includes github, git, a code editor like Visual Studio Code. If you don't have these yet please prepare them first before going forward.\")), mdx(\"ul\", null, mdx(\"li\", {\n parentName: \"ul\"\n }, mdx(\"p\", {\n parentName: \"li\"\n }, \"First, create a Discordeno Bot using the \", mdx(\"a\", _extends({\n parentName: \"p\"\n }, {\n \"href\": \"https://github.com/Skillz4Killz/Discordeno-bot-template\"\n }), \"Generator Boilerplate\"), \". Give it any name you like. For the purpose of this guide we will call it, Stargate.\")), mdx(\"li\", {\n parentName: \"ul\"\n }, mdx(\"p\", {\n parentName: \"li\"\n }, \"Then \", mdx(\"inlineCode\", {\n parentName: \"p\"\n }, \"git clone https://github.com/Skillz4Killz/Stargate.git\"))), mdx(\"li\", {\n parentName: \"ul\"\n }, mdx(\"p\", {\n parentName: \"li\"\n }, \"When that is done, go ahead and open up the folder with VSC.\")), mdx(\"li\", {\n parentName: \"ul\"\n }, mdx(\"p\", {\n parentName: \"li\"\n }, \"Create a new file called \", mdx(\"inlineCode\", {\n parentName: \"p\"\n }, \"configs.ts\"), \". Open the \", mdx(\"inlineCode\", {\n parentName: \"p\"\n }, \"configs.example.ts\"), \" file and copy everything over.\"))), mdx(\"p\", null, \"Let's take a minute to review all the options we have available to us.\"), mdx(\"h3\", null, \"Configs File\"), mdx(\"p\", null, \"The \", mdx(\"inlineCode\", {\n parentName: \"p\"\n }, \"configs.ts\"), \" file is where you will keep all your secret info you don't want to share with anyone else. As long as \", mdx(\"inlineCode\", {\n parentName: \"p\"\n }, \".gitignore\"), \" file is ignoring configs.ts your configurations will be kept private!\"), mdx(\"pre\", null, mdx(\"code\", _extends({\n parentName: \"pre\"\n }, {\n \"className\": \"language-ts\"\n }), \"// Step 1: Remove the `.example` from this file name so it is called `configs.ts`\\n// Step 2: Add all your bot's information below. The only required one is token and prefix. NOTE: As long as `.gitignore` file is ignoring configs.ts your configurations will be kept private!\\n// Step 3: Remove these comments if you like.\\n\\nexport const configs = {\\n // Your bot token goes here\\n token: \\\"\\\",\\n // The default prefix for your bot. Don't worry guilds can change this later.\\n prefix: \\\"!\\\",\\n // This isn't required but you can add bot list api keys here.\\n botListTokens: {\\n DISCORD_BOT_ORG: \\\"\\\",\\n BOTS_ON_DISCORD: \\\"\\\",\\n DISCORD_BOT_LIST: \\\"\\\",\\n BOTS_FOR_DISCORD: \\\"\\\",\\n DISCORD_BOATS: \\\"\\\",\\n DISCORD_BOTS_GG: \\\"\\\",\\n DISCORD_BOTS_GROUP: \\\"\\\",\\n },\\n // This is the server id for your bot's main server where users can get help/support\\n supportServerID: \\\"\\\",\\n // These are channel ids that will enable some functionality\\n channelIDs: {\\n // When a translation is missing this is the channel you will be alerted in.\\n missingTranslation: \\\"\\\",\\n // When an error occurs, we will try and log it to this channel\\n errorChannelID: \\\"\\\"\\n },\\n // These are the role ids that will enable some functionality.\\n roleIDs: {\\n // If you have a patreon set up you can add the patreon vip role id here.\\n patreonVIPRoleID: \\\"\\\",\\n },\\n // These are the user ids that will enable some functionality.\\n userIDs: {\\n // The user ids for the support team\\n botSupporters: [],\\n // The user ids for the other devs on your team\\n botDevs: [],\\n // The user ids who have complete 100% access to your bot\\n botOwners: []\\n }\\n};\\n\\n\")), mdx(\"h4\", null, \"Token\"), mdx(\"p\", null, \"First, add your bot token. This is \", mdx(\"strong\", {\n parentName: \"p\"\n }, \"required\"), \" for the bot to start. Review the \", mdx(\"a\", _extends({\n parentName: \"p\"\n }, {\n \"href\": \"https://discordeno.netlify.app/gettingstarted#creatingyourfirstdiscordbotapplication\"\n }), \"instructions\"), \" if you have not made your token yet.\"), mdx(\"h4\", null, \"Prefix\"), mdx(\"p\", null, \"The prefix is where you will set the default prefix for your bot. Don't worry, every server will be able to choose their own prefix but we need a default prefix to start.\"), mdx(\"h4\", null, \"Bot Lists Tokens\"), mdx(\"p\", null, \"This section of the file is so you can easily have your bot's statistics updated on all the bot lists out there to help you grow your bot. The code is already written to handle this but you will need to do 3 things for each bot list.\"), mdx(\"ol\", null, mdx(\"li\", {\n parentName: \"ol\"\n }, \"Go to the bot list and add your bot to their website. (Each site has it's own instructions)\"), mdx(\"li\", {\n parentName: \"ol\"\n }, \"Create a token for yourself on each website and paste it in your configs.\"), mdx(\"li\", {\n parentName: \"ol\"\n }, \"Enjoy!\")), mdx(\"p\", null, \"If you wish to customize the code, you will find the bot list tasks in the tasks folder. Don't worry we will discuss this when we get to the tasks section of the guide.\"), mdx(\"p\", null, \"For now just remember, that Discordeno provides you a built in way to update most discord bot lists.\"), mdx(\"h4\", null, \"Channel IDs\"), mdx(\"p\", null, \"The channelIDs section holds the useful for specific features to help give you alerts/notifications. For example, the \", mdx(\"inlineCode\", {\n parentName: \"p\"\n }, \"missingTranslation\"), \" channel will be where messages are sent alerting you that somewhere in your code you are trying to use a translation key that you never created.\"), mdx(\"p\", null, \"When you get to around 25,000 Discord servers on your bot, you may want to convert these channel IDs to webhooks.\"), mdx(\"h4\", null, \"Channel IDs\"), mdx(\"p\", null, \"The channelIDs section holds the useful for specific features to help give you alerts/notifications. For example, the \", mdx(\"inlineCode\", {\n parentName: \"p\"\n }, \"missingTranslation\"), \" channel will be where messages are sent alerting you that somewhere in your code you are trying to use a translation key that you never created.\"), mdx(\"p\", null, \"When you get to around 25,000 Discord servers on your bot, you may want to convert these channel IDs to webhooks.\"), mdx(\"h2\", null, \"It's Alive!\"), mdx(\"p\", null, \"Oh my god! You now have a bot with a bunch of features already! You don't believe me? Well, seeing is believing, so start the bot.\"), mdx(\"ol\", null, mdx(\"li\", {\n parentName: \"ol\"\n }, \"Invite your bot to a discord server.\"), mdx(\"li\", {\n parentName: \"ol\"\n }, \"Open up the integrated terminal in VSC using \", mdx(\"strong\", {\n parentName: \"li\"\n }, \"CTRL + `\"), \". If you use a Mac, replace CTRL with CMD.\"), mdx(\"li\", {\n parentName: \"ol\"\n }, \"Run the script below:\")), mdx(\"pre\", null, mdx(\"code\", _extends({\n parentName: \"pre\"\n }, {\n \"className\": \"language-shell\"\n }), \"deno run --allow-net --allow-read mod.ts\\n\")), mdx(\"p\", null, \"The first time you run it, you may see a lot of files being loaded. This is preparing all the magic behind the scene. Once it is ready, you will see something like this:\"), mdx(\"p\", null, mdx(\"img\", _extends({\n parentName: \"p\"\n }, {\n \"src\": \"https://i.imgur.com/TOXjLgh.png\",\n \"alt\": \"image\"\n }))), mdx(\"h2\", null, \"Understanding What Discordeno Did\"), mdx(\"p\", null, \"Discordeno includes these commands/folders as they are essential for any discord bot to have in order to meet the Discord Bot Best Practices. It also adds a few things that will help make some things easier to build a bot.\"), mdx(\"p\", null, \"We will dive into these deeper in this guide. Let's take it step by step.\"));\n}\n;\nMDXContent.isMDXComponent = true;","rawMDXOutput":"/* @jsx mdx */\nimport { mdx } from '@mdx-js/react';\n/* @jsx mdx */\n\nexport const _frontmatter = {\n \"title\": \"Creating The Bot!\",\n \"metaTitle\": \"Creating A Bot | Discordeno\",\n \"metaDescription\": \"Let's create our very own bot with Discordeno!\"\n};\n\nconst layoutProps = {\n _frontmatter\n};\nconst MDXLayout = \"wrapper\"\nexport default function MDXContent({\n components,\n ...props\n}) {\n return \n

{`Discordeno will help make Discord bot development much easier. Don't worry, as you go through this guide it will make a lot more sense.`}

\n

{`Creating The Bot!`}

\n
\n

{`This guide is going to assume you already have the basic requirements to make a bot ready. This includes github, git, a code editor like Visual Studio Code. If you don't have these yet please prepare them first before going forward.`}

\n
\n
    \n
  • \n

    {`First, create a Discordeno Bot using the `}{`Generator Boilerplate`}{`. Give it any name you like. For the purpose of this guide we will call it, Stargate.`}

    \n
  • \n
  • \n

    {`Then `}{`git clone https://github.com/Skillz4Killz/Stargate.git`}

    \n
  • \n
  • \n

    {`When that is done, go ahead and open up the folder with VSC.`}

    \n
  • \n
  • \n

    {`Create a new file called `}{`configs.ts`}{`. Open the `}{`configs.example.ts`}{` file and copy everything over.`}

    \n
  • \n
\n

{`Let's take a minute to review all the options we have available to us.`}

\n

{`Configs File`}

\n

{`The `}{`configs.ts`}{` file is where you will keep all your secret info you don't want to share with anyone else. As long as `}{`.gitignore`}{` file is ignoring configs.ts your configurations will be kept private!`}

\n
{`// Step 1: Remove the \\`.example\\` from this file name so it is called \\`configs.ts\\`\n// Step 2: Add all your bot's information below. The only required one is token and prefix. NOTE: As long as \\`.gitignore\\` file is ignoring configs.ts your configurations will be kept private!\n// Step 3: Remove these comments if you like.\n\nexport const configs = {\n  // Your bot token goes here\n  token: \"\",\n  // The default prefix for your bot. Don't worry guilds can change this later.\n  prefix: \"!\",\n  // This isn't required but you can add bot list api keys here.\n  botListTokens: {\n    DISCORD_BOT_ORG: \"\",\n    BOTS_ON_DISCORD: \"\",\n    DISCORD_BOT_LIST: \"\",\n    BOTS_FOR_DISCORD: \"\",\n    DISCORD_BOATS: \"\",\n    DISCORD_BOTS_GG: \"\",\n    DISCORD_BOTS_GROUP: \"\",\n  },\n  // This is the server id for your bot's main server where users can get help/support\n  supportServerID: \"\",\n  // These are channel ids that will enable some functionality\n  channelIDs: {\n    // When a translation is missing this is the channel you will be alerted in.\n    missingTranslation: \"\",\n    // When an error occurs, we will try and log it to this channel\n    errorChannelID: \"\"\n  },\n  // These are the role ids that will enable some functionality.\n  roleIDs: {\n    // If you have a patreon set up you can add the patreon vip role id here.\n    patreonVIPRoleID: \"\",\n  },\n  // These are the user ids that will enable some functionality.\n  userIDs: {\n    // The user ids for the support team\n    botSupporters: [],\n    // The user ids for the other devs on your team\n    botDevs: [],\n    // The user ids who have complete 100% access to your bot\n    botOwners: []\n  }\n};\n\n`}
\n

{`Token`}

\n

{`First, add your bot token. This is `}{`required`}{` for the bot to start. Review the `}{`instructions`}{` if you have not made your token yet.`}

\n

{`Prefix`}

\n

{`The prefix is where you will set the default prefix for your bot. Don't worry, every server will be able to choose their own prefix but we need a default prefix to start.`}

\n

{`Bot Lists Tokens`}

\n

{`This section of the file is so you can easily have your bot's statistics updated on all the bot lists out there to help you grow your bot. The code is already written to handle this but you will need to do 3 things for each bot list.`}

\n
    \n
  1. {`Go to the bot list and add your bot to their website. (Each site has it's own instructions)`}
  2. \n
  3. {`Create a token for yourself on each website and paste it in your configs.`}
  4. \n
  5. {`Enjoy!`}
  6. \n
\n

{`If you wish to customize the code, you will find the bot list tasks in the tasks folder. Don't worry we will discuss this when we get to the tasks section of the guide.`}

\n

{`For now just remember, that Discordeno provides you a built in way to update most discord bot lists.`}

\n

{`Channel IDs`}

\n

{`The channelIDs section holds the useful for specific features to help give you alerts/notifications. For example, the `}{`missingTranslation`}{` channel will be where messages are sent alerting you that somewhere in your code you are trying to use a translation key that you never created.`}

\n

{`When you get to around 25,000 Discord servers on your bot, you may want to convert these channel IDs to webhooks.`}

\n

{`Channel IDs`}

\n

{`The channelIDs section holds the useful for specific features to help give you alerts/notifications. For example, the `}{`missingTranslation`}{` channel will be where messages are sent alerting you that somewhere in your code you are trying to use a translation key that you never created.`}

\n

{`When you get to around 25,000 Discord servers on your bot, you may want to convert these channel IDs to webhooks.`}

\n

{`It's Alive!`}

\n

{`Oh my god! You now have a bot with a bunch of features already! You don't believe me? Well, seeing is believing, so start the bot.`}

\n
    \n
  1. {`Invite your bot to a discord server.`}
  2. \n
  3. {`Open up the integrated terminal in VSC using `}{`CTRL + \\``}{`. If you use a Mac, replace CTRL with CMD.`}
  4. \n
  5. {`Run the script below:`}
  6. \n
\n
{`deno run --allow-net --allow-read mod.ts\n`}
\n

{`The first time you run it, you may see a lot of files being loaded. This is preparing all the magic behind the scene. Once it is ready, you will see something like this:`}

\n

\n

{`Understanding What Discordeno Did`}

\n

{`Discordeno includes these commands/folders as they are essential for any discord bot to have in order to meet the Discord Bot Best Practices. It also adds a few things that will help make some things easier to build a bot.`}

\n

{`We will dive into these deeper in this guide. Let's take it step by step.`}

\n\n
;\n}\n\n;\nMDXContent.isMDXComponent = true;"}} \ No newline at end of file diff --git a/docs/.cache/caches/gatsby-plugin-mdx/diskstore-46f228c491807eb72544f4e29d43af57.json b/docs/.cache/caches/gatsby-plugin-mdx/diskstore-46f228c491807eb72544f4e29d43af57.json new file mode 100644 index 000000000..ece65f99a --- /dev/null +++ b/docs/.cache/caches/gatsby-plugin-mdx/diskstore-46f228c491807eb72544f4e29d43af57.json @@ -0,0 +1 @@ +{"expireTime":9007200851644212000,"key":"gatsby-plugin-mdx-entire-payload-c80b34de12907bdcf67609163795560f-","val":{"mdast":{"type":"root","children":[{"type":"paragraph","children":[{"type":"text","value":"Discordeno will help make Discord bot development much easier. Don't worry, as you go through this guide it will make a lot more sense.","position":{"start":{"line":2,"column":1,"offset":1},"end":{"line":2,"column":136,"offset":136},"indent":[]}}],"position":{"start":{"line":2,"column":1,"offset":1},"end":{"line":2,"column":136,"offset":136},"indent":[]}},{"type":"heading","depth":2,"children":[{"type":"text","value":"Creating The Bot!","position":{"start":{"line":4,"column":4,"offset":141},"end":{"line":4,"column":21,"offset":158},"indent":[]}}],"position":{"start":{"line":4,"column":1,"offset":138},"end":{"line":4,"column":21,"offset":158},"indent":[]}},{"type":"blockquote","children":[{"type":"paragraph","children":[{"type":"text","value":"This guide is going to assume you already have the basic requirements to make a bot ready. This includes github, git, a code editor like Visual Studio Code. If you don't have these yet please prepare them first before going forward.","position":{"start":{"line":6,"column":3,"offset":162},"end":{"line":6,"column":235,"offset":394},"indent":[]}}],"position":{"start":{"line":6,"column":3,"offset":162},"end":{"line":6,"column":235,"offset":394},"indent":[]}}],"position":{"start":{"line":6,"column":1,"offset":160},"end":{"line":6,"column":235,"offset":394},"indent":[]}},{"type":"list","ordered":false,"start":null,"spread":true,"children":[{"type":"listItem","spread":false,"checked":null,"children":[{"type":"paragraph","children":[{"type":"text","value":"First, create a Discordeno Bot using the ","position":{"start":{"line":8,"column":3,"offset":398},"end":{"line":8,"column":44,"offset":439},"indent":[]}},{"type":"link","title":null,"url":"https://github.com/Skillz4Killz/Discordeno-bot-template","children":[{"type":"text","value":"Generator Boilerplate","position":{"start":{"line":8,"column":45,"offset":440},"end":{"line":8,"column":66,"offset":461},"indent":[]}}],"position":{"start":{"line":8,"column":44,"offset":439},"end":{"line":8,"column":124,"offset":519},"indent":[]}},{"type":"text","value":". Give it any name you like. For the purpose of this guide we will call it, Stargate.","position":{"start":{"line":8,"column":124,"offset":519},"end":{"line":8,"column":209,"offset":604},"indent":[]}}],"position":{"start":{"line":8,"column":3,"offset":398},"end":{"line":8,"column":209,"offset":604},"indent":[]}}],"position":{"start":{"line":8,"column":1,"offset":396},"end":{"line":9,"column":1,"offset":605},"indent":[1]}},{"type":"listItem","spread":false,"checked":null,"children":[{"type":"paragraph","children":[{"type":"text","value":"Then ","position":{"start":{"line":10,"column":3,"offset":608},"end":{"line":10,"column":8,"offset":613},"indent":[]}},{"type":"inlineCode","value":"git clone https://github.com/Skillz4Killz/Stargate.git","position":{"start":{"line":10,"column":8,"offset":613},"end":{"line":10,"column":64,"offset":669},"indent":[]}}],"position":{"start":{"line":10,"column":3,"offset":608},"end":{"line":10,"column":64,"offset":669},"indent":[]}}],"position":{"start":{"line":10,"column":1,"offset":606},"end":{"line":11,"column":1,"offset":670},"indent":[1]}},{"type":"listItem","spread":false,"checked":null,"children":[{"type":"paragraph","children":[{"type":"text","value":"When that is done, go ahead and open up the folder with VSC.","position":{"start":{"line":12,"column":3,"offset":673},"end":{"line":12,"column":63,"offset":733},"indent":[]}}],"position":{"start":{"line":12,"column":3,"offset":673},"end":{"line":12,"column":63,"offset":733},"indent":[]}}],"position":{"start":{"line":12,"column":1,"offset":671},"end":{"line":12,"column":63,"offset":733},"indent":[]}},{"type":"listItem","spread":false,"checked":null,"children":[{"type":"paragraph","children":[{"type":"text","value":"Create a new file called ","position":{"start":{"line":13,"column":3,"offset":736},"end":{"line":13,"column":28,"offset":761},"indent":[]}},{"type":"inlineCode","value":"configs.ts","position":{"start":{"line":13,"column":28,"offset":761},"end":{"line":13,"column":40,"offset":773},"indent":[]}},{"type":"text","value":". Open the ","position":{"start":{"line":13,"column":40,"offset":773},"end":{"line":13,"column":51,"offset":784},"indent":[]}},{"type":"inlineCode","value":"configs.example.ts","position":{"start":{"line":13,"column":51,"offset":784},"end":{"line":13,"column":71,"offset":804},"indent":[]}},{"type":"text","value":" file and copy everything over.","position":{"start":{"line":13,"column":71,"offset":804},"end":{"line":13,"column":102,"offset":835},"indent":[]}}],"position":{"start":{"line":13,"column":3,"offset":736},"end":{"line":13,"column":102,"offset":835},"indent":[]}}],"position":{"start":{"line":13,"column":1,"offset":734},"end":{"line":13,"column":102,"offset":835},"indent":[]}}],"position":{"start":{"line":8,"column":1,"offset":396},"end":{"line":13,"column":102,"offset":835},"indent":[1,1,1,1,1]}},{"type":"paragraph","children":[{"type":"text","value":"Let's take a minute to review all the options we have available to us.","position":{"start":{"line":15,"column":1,"offset":837},"end":{"line":15,"column":71,"offset":907},"indent":[]}}],"position":{"start":{"line":15,"column":1,"offset":837},"end":{"line":15,"column":71,"offset":907},"indent":[]}},{"type":"heading","depth":3,"children":[{"type":"text","value":"Configs File","position":{"start":{"line":17,"column":5,"offset":913},"end":{"line":17,"column":17,"offset":925},"indent":[]}}],"position":{"start":{"line":17,"column":1,"offset":909},"end":{"line":17,"column":17,"offset":925},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"The ","position":{"start":{"line":19,"column":1,"offset":927},"end":{"line":19,"column":5,"offset":931},"indent":[]}},{"type":"inlineCode","value":"configs.ts","position":{"start":{"line":19,"column":5,"offset":931},"end":{"line":19,"column":17,"offset":943},"indent":[]}},{"type":"text","value":" file is where you will keep all your secret info you don't want to share with anyone else. As long as ","position":{"start":{"line":19,"column":17,"offset":943},"end":{"line":19,"column":120,"offset":1046},"indent":[]}},{"type":"inlineCode","value":".gitignore","position":{"start":{"line":19,"column":120,"offset":1046},"end":{"line":19,"column":132,"offset":1058},"indent":[]}},{"type":"text","value":" file is ignoring configs.ts your configurations will be kept private!","position":{"start":{"line":19,"column":132,"offset":1058},"end":{"line":19,"column":202,"offset":1128},"indent":[]}}],"position":{"start":{"line":19,"column":1,"offset":927},"end":{"line":19,"column":202,"offset":1128},"indent":[]}},{"type":"code","lang":"ts","meta":null,"value":"// Step 1: Remove the `.example` from this file name so it is called `configs.ts`\n// Step 2: Add all your bot's information below. The only required one is token and prefix. NOTE: As long as `.gitignore` file is ignoring configs.ts your configurations will be kept private!\n// Step 3: Remove these comments if you like.\n\nexport const configs = {\n // Your bot token goes here\n token: \"\",\n // The default prefix for your bot. Don't worry guilds can change this later.\n prefix: \"!\",\n // This isn't required but you can add bot list api keys here.\n botListTokens: {\n DISCORD_BOT_ORG: \"\",\n BOTS_ON_DISCORD: \"\",\n DISCORD_BOT_LIST: \"\",\n BOTS_FOR_DISCORD: \"\",\n DISCORD_BOATS: \"\",\n DISCORD_BOTS_GG: \"\",\n DISCORD_BOTS_GROUP: \"\",\n },\n // This is the server id for your bot's main server where users can get help/support\n supportServerID: \"\",\n // These are channel ids that will enable some functionality\n channelIDs: {\n // When a translation is missing this is the channel you will be alerted in.\n missingTranslation: \"\",\n // When an error occurs, we will try and log it to this channel\n errorChannelID: \"\"\n },\n // These are the role ids that will enable some functionality.\n roleIDs: {\n // If you have a patreon set up you can add the patreon vip role id here.\n patreonVIPRoleID: \"\",\n },\n // These are the user ids that will enable some functionality.\n userIDs: {\n // The user ids for the support team\n botSupporters: [],\n // The user ids for the other devs on your team\n botDevs: [],\n // The user ids who have complete 100% access to your bot\n botOwners: []\n }\n};\n","position":{"start":{"line":21,"column":1,"offset":1130},"end":{"line":66,"column":4,"offset":2770},"indent":[1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1]}},{"type":"heading","depth":4,"children":[{"type":"text","value":"Token","position":{"start":{"line":68,"column":6,"offset":2777},"end":{"line":68,"column":11,"offset":2782},"indent":[]}}],"position":{"start":{"line":68,"column":1,"offset":2772},"end":{"line":68,"column":11,"offset":2782},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"First, add your bot token. This is ","position":{"start":{"line":70,"column":1,"offset":2784},"end":{"line":70,"column":36,"offset":2819},"indent":[]}},{"type":"strong","children":[{"type":"text","value":"required","position":{"start":{"line":70,"column":38,"offset":2821},"end":{"line":70,"column":46,"offset":2829},"indent":[]}}],"position":{"start":{"line":70,"column":36,"offset":2819},"end":{"line":70,"column":48,"offset":2831},"indent":[]}},{"type":"text","value":" for the bot to start. Review the ","position":{"start":{"line":70,"column":48,"offset":2831},"end":{"line":70,"column":82,"offset":2865},"indent":[]}},{"type":"link","title":null,"url":"https://discordeno.netlify.app/gettingstarted#creatingyourfirstdiscordbotapplication","children":[{"type":"text","value":"instructions","position":{"start":{"line":70,"column":83,"offset":2866},"end":{"line":70,"column":95,"offset":2878},"indent":[]}}],"position":{"start":{"line":70,"column":82,"offset":2865},"end":{"line":70,"column":182,"offset":2965},"indent":[]}},{"type":"text","value":" if you have not made your token yet.","position":{"start":{"line":70,"column":182,"offset":2965},"end":{"line":70,"column":219,"offset":3002},"indent":[]}}],"position":{"start":{"line":70,"column":1,"offset":2784},"end":{"line":70,"column":219,"offset":3002},"indent":[]}},{"type":"heading","depth":4,"children":[{"type":"text","value":"Prefix","position":{"start":{"line":72,"column":6,"offset":3009},"end":{"line":72,"column":12,"offset":3015},"indent":[]}}],"position":{"start":{"line":72,"column":1,"offset":3004},"end":{"line":72,"column":12,"offset":3015},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"The prefix is where you will set the default prefix for your bot. Don't worry, every server will be able to choose their own prefix but we need a default prefix to start.","position":{"start":{"line":74,"column":1,"offset":3017},"end":{"line":74,"column":171,"offset":3187},"indent":[]}}],"position":{"start":{"line":74,"column":1,"offset":3017},"end":{"line":74,"column":171,"offset":3187},"indent":[]}},{"type":"heading","depth":4,"children":[{"type":"text","value":"Bot Lists Tokens","position":{"start":{"line":76,"column":6,"offset":3194},"end":{"line":76,"column":22,"offset":3210},"indent":[]}}],"position":{"start":{"line":76,"column":1,"offset":3189},"end":{"line":76,"column":22,"offset":3210},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"This section of the file is so you can easily have your bot's statistics updated on all the bot lists out there to help you grow your bot. The code is already written to handle this but you will need to do 3 things for each bot list.","position":{"start":{"line":78,"column":1,"offset":3212},"end":{"line":78,"column":234,"offset":3445},"indent":[]}}],"position":{"start":{"line":78,"column":1,"offset":3212},"end":{"line":78,"column":234,"offset":3445},"indent":[]}},{"type":"list","ordered":true,"start":1,"spread":false,"children":[{"type":"listItem","spread":false,"checked":null,"children":[{"type":"paragraph","children":[{"type":"text","value":"Go to the bot list and add your bot to their website. (Each site has it's own instructions)","position":{"start":{"line":80,"column":4,"offset":3450},"end":{"line":80,"column":95,"offset":3541},"indent":[]}}],"position":{"start":{"line":80,"column":4,"offset":3450},"end":{"line":80,"column":95,"offset":3541},"indent":[]}}],"position":{"start":{"line":80,"column":1,"offset":3447},"end":{"line":80,"column":95,"offset":3541},"indent":[]}},{"type":"listItem","spread":false,"checked":null,"children":[{"type":"paragraph","children":[{"type":"text","value":"Create a token for yourself on each website and paste it in your configs.","position":{"start":{"line":81,"column":4,"offset":3545},"end":{"line":81,"column":77,"offset":3618},"indent":[]}}],"position":{"start":{"line":81,"column":4,"offset":3545},"end":{"line":81,"column":77,"offset":3618},"indent":[]}}],"position":{"start":{"line":81,"column":1,"offset":3542},"end":{"line":81,"column":77,"offset":3618},"indent":[]}},{"type":"listItem","spread":false,"checked":null,"children":[{"type":"paragraph","children":[{"type":"text","value":"Enjoy!","position":{"start":{"line":82,"column":4,"offset":3622},"end":{"line":82,"column":10,"offset":3628},"indent":[]}}],"position":{"start":{"line":82,"column":4,"offset":3622},"end":{"line":82,"column":10,"offset":3628},"indent":[]}}],"position":{"start":{"line":82,"column":1,"offset":3619},"end":{"line":82,"column":10,"offset":3628},"indent":[]}}],"position":{"start":{"line":80,"column":1,"offset":3447},"end":{"line":82,"column":10,"offset":3628},"indent":[1,1]}},{"type":"paragraph","children":[{"type":"text","value":"If you wish to customize the code, you will find the bot list tasks in the tasks folder. Don't worry we will discuss this when we get to the tasks section of the guide.","position":{"start":{"line":84,"column":1,"offset":3630},"end":{"line":84,"column":169,"offset":3798},"indent":[]}}],"position":{"start":{"line":84,"column":1,"offset":3630},"end":{"line":84,"column":169,"offset":3798},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"For now just remember, that Discordeno provides you a built in way to update most discord bot lists.","position":{"start":{"line":86,"column":1,"offset":3800},"end":{"line":86,"column":101,"offset":3900},"indent":[]}}],"position":{"start":{"line":86,"column":1,"offset":3800},"end":{"line":86,"column":101,"offset":3900},"indent":[]}},{"type":"heading","depth":4,"children":[{"type":"text","value":"Channel IDs","position":{"start":{"line":88,"column":6,"offset":3907},"end":{"line":88,"column":17,"offset":3918},"indent":[]}}],"position":{"start":{"line":88,"column":1,"offset":3902},"end":{"line":88,"column":17,"offset":3918},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"The channelIDs section holds the channel IDs that are useful for specific features to help give you alerts/notifications. For example, the ","position":{"start":{"line":90,"column":1,"offset":3920},"end":{"line":90,"column":140,"offset":4059},"indent":[]}},{"type":"inlineCode","value":"missingTranslation","position":{"start":{"line":90,"column":140,"offset":4059},"end":{"line":90,"column":160,"offset":4079},"indent":[]}},{"type":"text","value":" channel will be where messages are sent alerting you that somewhere in your code you are trying to use a translation key that you never created.","position":{"start":{"line":90,"column":160,"offset":4079},"end":{"line":90,"column":305,"offset":4224},"indent":[]}}],"position":{"start":{"line":90,"column":1,"offset":3920},"end":{"line":90,"column":305,"offset":4224},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"When you get to around 25,000 Discord servers on your bot, you may want to convert these channel IDs to webhooks.","position":{"start":{"line":92,"column":1,"offset":4226},"end":{"line":92,"column":114,"offset":4339},"indent":[]}}],"position":{"start":{"line":92,"column":1,"offset":4226},"end":{"line":92,"column":114,"offset":4339},"indent":[]}},{"type":"heading","depth":4,"children":[{"type":"text","value":"Role IDs","position":{"start":{"line":94,"column":6,"offset":4346},"end":{"line":94,"column":14,"offset":4354},"indent":[]}}],"position":{"start":{"line":94,"column":1,"offset":4341},"end":{"line":94,"column":14,"offset":4354},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"The roleIDs section holds the role IDs that are useful for specific features to help give you alerts/notifications. For example, the ","position":{"start":{"line":96,"column":1,"offset":4356},"end":{"line":96,"column":134,"offset":4489},"indent":[]}},{"type":"inlineCode","value":"missingTranslation","position":{"start":{"line":96,"column":134,"offset":4489},"end":{"line":96,"column":154,"offset":4509},"indent":[]}},{"type":"text","value":" channel will be where messages are sent alerting you that somewhere in your code you are trying to use a translation key that you never created.","position":{"start":{"line":96,"column":154,"offset":4509},"end":{"line":96,"column":299,"offset":4654},"indent":[]}}],"position":{"start":{"line":96,"column":1,"offset":4356},"end":{"line":96,"column":299,"offset":4654},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"When you get to around 25,000 Discord servers on your bot, you may want to convert these channel IDs to webhooks.","position":{"start":{"line":98,"column":1,"offset":4656},"end":{"line":98,"column":114,"offset":4769},"indent":[]}}],"position":{"start":{"line":98,"column":1,"offset":4656},"end":{"line":98,"column":114,"offset":4769},"indent":[]}},{"type":"heading","depth":2,"children":[{"type":"text","value":"It's Alive!","position":{"start":{"line":100,"column":4,"offset":4774},"end":{"line":100,"column":15,"offset":4785},"indent":[]}}],"position":{"start":{"line":100,"column":1,"offset":4771},"end":{"line":100,"column":15,"offset":4785},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"Oh my god! You now have a bot with a bunch of features already! You don't believe me? Well, seeing is believing, so start the bot.","position":{"start":{"line":102,"column":1,"offset":4787},"end":{"line":102,"column":131,"offset":4917},"indent":[]}}],"position":{"start":{"line":102,"column":1,"offset":4787},"end":{"line":102,"column":131,"offset":4917},"indent":[]}},{"type":"list","ordered":true,"start":1,"spread":false,"children":[{"type":"listItem","spread":false,"checked":null,"children":[{"type":"paragraph","children":[{"type":"text","value":"Invite your bot to a discord server.","position":{"start":{"line":104,"column":4,"offset":4922},"end":{"line":104,"column":40,"offset":4958},"indent":[]}}],"position":{"start":{"line":104,"column":4,"offset":4922},"end":{"line":104,"column":40,"offset":4958},"indent":[]}}],"position":{"start":{"line":104,"column":1,"offset":4919},"end":{"line":104,"column":40,"offset":4958},"indent":[]}},{"type":"listItem","spread":false,"checked":null,"children":[{"type":"paragraph","children":[{"type":"text","value":"Open up the integrated terminal in VSC using ","position":{"start":{"line":105,"column":4,"offset":4962},"end":{"line":105,"column":49,"offset":5007},"indent":[]}},{"type":"strong","children":[{"type":"text","value":"CTRL + `","position":{"start":{"line":105,"column":51,"offset":5009},"end":{"line":105,"column":59,"offset":5017},"indent":[]}}],"position":{"start":{"line":105,"column":49,"offset":5007},"end":{"line":105,"column":61,"offset":5019},"indent":[]}},{"type":"text","value":". If you use a Mac, replace CTRL with CMD.","position":{"start":{"line":105,"column":61,"offset":5019},"end":{"line":105,"column":103,"offset":5061},"indent":[]}}],"position":{"start":{"line":105,"column":4,"offset":4962},"end":{"line":105,"column":103,"offset":5061},"indent":[]}}],"position":{"start":{"line":105,"column":1,"offset":4959},"end":{"line":105,"column":103,"offset":5061},"indent":[]}},{"type":"listItem","spread":false,"checked":null,"children":[{"type":"paragraph","children":[{"type":"text","value":"Run the script below:","position":{"start":{"line":106,"column":4,"offset":5065},"end":{"line":106,"column":25,"offset":5086},"indent":[]}}],"position":{"start":{"line":106,"column":4,"offset":5065},"end":{"line":106,"column":25,"offset":5086},"indent":[]}}],"position":{"start":{"line":106,"column":1,"offset":5062},"end":{"line":106,"column":25,"offset":5086},"indent":[]}}],"position":{"start":{"line":104,"column":1,"offset":4919},"end":{"line":106,"column":25,"offset":5086},"indent":[1,1]}},{"type":"code","lang":"shell","meta":null,"value":"deno run --allow-net --allow-read mod.ts","position":{"start":{"line":108,"column":1,"offset":5088},"end":{"line":110,"column":4,"offset":5141},"indent":[1,1]}},{"type":"paragraph","children":[{"type":"text","value":"The first time you run it, you may see a lot of files being loaded. This is preparing all the magic behind the scene. Once it is ready, you will see something like this:","position":{"start":{"line":112,"column":1,"offset":5143},"end":{"line":112,"column":170,"offset":5312},"indent":[]}}],"position":{"start":{"line":112,"column":1,"offset":5143},"end":{"line":112,"column":170,"offset":5312},"indent":[]}},{"type":"paragraph","children":[{"type":"image","title":null,"url":"https://i.imgur.com/TOXjLgh.png","alt":"image","position":{"start":{"line":114,"column":1,"offset":5314},"end":{"line":114,"column":42,"offset":5355},"indent":[]}}],"position":{"start":{"line":114,"column":1,"offset":5314},"end":{"line":114,"column":42,"offset":5355},"indent":[]}},{"type":"heading","depth":2,"children":[{"type":"text","value":"Understanding What Discordeno Did","position":{"start":{"line":116,"column":4,"offset":5360},"end":{"line":116,"column":37,"offset":5393},"indent":[]}}],"position":{"start":{"line":116,"column":1,"offset":5357},"end":{"line":116,"column":37,"offset":5393},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"Discordeno includes these commands/folders as they are essential for any discord bot to have in order to meet the Discord Bot Best Practices. It also adds a few things that will help make some things easier to build a bot.","position":{"start":{"line":118,"column":1,"offset":5395},"end":{"line":118,"column":223,"offset":5617},"indent":[]}}],"position":{"start":{"line":118,"column":1,"offset":5395},"end":{"line":118,"column":223,"offset":5617},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"We will dive into these deeper in this guide. Let's take it step by step.","position":{"start":{"line":120,"column":1,"offset":5619},"end":{"line":120,"column":74,"offset":5692},"indent":[]}}],"position":{"start":{"line":120,"column":1,"offset":5619},"end":{"line":120,"column":74,"offset":5692},"indent":[]}},{"type":"export","value":"export const _frontmatter = {\"title\":\"Creating The Bot!\",\"metaTitle\":\"Creating A Bot | Discordeno\",\"metaDescription\":\"Let's create our very own bot with Discordeno!\"}","position":{"start":{"line":123,"column":1,"offset":5695},"end":{"line":123,"column":167,"offset":5861},"indent":[]}}],"position":{"start":{"line":1,"column":1,"offset":0},"end":{"line":123,"column":167,"offset":5861}}},"scopeImports":["import * as React from 'react'"],"scopeIdentifiers":["React"],"body":"function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }\n\nfunction _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }\n\nfunction _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }\n\n/* @jsx mdx */\nvar _frontmatter = {\n \"title\": \"Creating The Bot!\",\n \"metaTitle\": \"Creating A Bot | Discordeno\",\n \"metaDescription\": \"Let's create our very own bot with Discordeno!\"\n};\nvar layoutProps = {\n _frontmatter: _frontmatter\n};\nvar MDXLayout = \"wrapper\";\nreturn function MDXContent(_ref) {\n var components = _ref.components,\n props = _objectWithoutProperties(_ref, [\"components\"]);\n\n return mdx(MDXLayout, _extends({}, layoutProps, props, {\n components: components,\n mdxType: \"MDXLayout\"\n }), mdx(\"p\", null, \"Discordeno will help make Discord bot development much easier. Don't worry, as you go through this guide it will make a lot more sense.\"), mdx(\"h2\", null, \"Creating The Bot!\"), mdx(\"blockquote\", null, mdx(\"p\", {\n parentName: \"blockquote\"\n }, \"This guide is going to assume you already have the basic requirements to make a bot ready. This includes github, git, a code editor like Visual Studio Code. If you don't have these yet please prepare them first before going forward.\")), mdx(\"ul\", null, mdx(\"li\", {\n parentName: \"ul\"\n }, mdx(\"p\", {\n parentName: \"li\"\n }, \"First, create a Discordeno Bot using the \", mdx(\"a\", _extends({\n parentName: \"p\"\n }, {\n \"href\": \"https://github.com/Skillz4Killz/Discordeno-bot-template\"\n }), \"Generator Boilerplate\"), \". Give it any name you like. For the purpose of this guide we will call it, Stargate.\")), mdx(\"li\", {\n parentName: \"ul\"\n }, mdx(\"p\", {\n parentName: \"li\"\n }, \"Then \", mdx(\"inlineCode\", {\n parentName: \"p\"\n }, \"git clone https://github.com/Skillz4Killz/Stargate.git\"))), mdx(\"li\", {\n parentName: \"ul\"\n }, mdx(\"p\", {\n parentName: \"li\"\n }, \"When that is done, go ahead and open up the folder with VSC.\")), mdx(\"li\", {\n parentName: \"ul\"\n }, mdx(\"p\", {\n parentName: \"li\"\n }, \"Create a new file called \", mdx(\"inlineCode\", {\n parentName: \"p\"\n }, \"configs.ts\"), \". Open the \", mdx(\"inlineCode\", {\n parentName: \"p\"\n }, \"configs.example.ts\"), \" file and copy everything over.\"))), mdx(\"p\", null, \"Let's take a minute to review all the options we have available to us.\"), mdx(\"h3\", null, \"Configs File\"), mdx(\"p\", null, \"The \", mdx(\"inlineCode\", {\n parentName: \"p\"\n }, \"configs.ts\"), \" file is where you will keep all your secret info you don't want to share with anyone else. As long as \", mdx(\"inlineCode\", {\n parentName: \"p\"\n }, \".gitignore\"), \" file is ignoring configs.ts your configurations will be kept private!\"), mdx(\"pre\", null, mdx(\"code\", _extends({\n parentName: \"pre\"\n }, {\n \"className\": \"language-ts\"\n }), \"// Step 1: Remove the `.example` from this file name so it is called `configs.ts`\\n// Step 2: Add all your bot's information below. The only required one is token and prefix. NOTE: As long as `.gitignore` file is ignoring configs.ts your configurations will be kept private!\\n// Step 3: Remove these comments if you like.\\n\\nexport const configs = {\\n // Your bot token goes here\\n token: \\\"\\\",\\n // The default prefix for your bot. Don't worry guilds can change this later.\\n prefix: \\\"!\\\",\\n // This isn't required but you can add bot list api keys here.\\n botListTokens: {\\n DISCORD_BOT_ORG: \\\"\\\",\\n BOTS_ON_DISCORD: \\\"\\\",\\n DISCORD_BOT_LIST: \\\"\\\",\\n BOTS_FOR_DISCORD: \\\"\\\",\\n DISCORD_BOATS: \\\"\\\",\\n DISCORD_BOTS_GG: \\\"\\\",\\n DISCORD_BOTS_GROUP: \\\"\\\",\\n },\\n // This is the server id for your bot's main server where users can get help/support\\n supportServerID: \\\"\\\",\\n // These are channel ids that will enable some functionality\\n channelIDs: {\\n // When a translation is missing this is the channel you will be alerted in.\\n missingTranslation: \\\"\\\",\\n // When an error occurs, we will try and log it to this channel\\n errorChannelID: \\\"\\\"\\n },\\n // These are the role ids that will enable some functionality.\\n roleIDs: {\\n // If you have a patreon set up you can add the patreon vip role id here.\\n patreonVIPRoleID: \\\"\\\",\\n },\\n // These are the user ids that will enable some functionality.\\n userIDs: {\\n // The user ids for the support team\\n botSupporters: [],\\n // The user ids for the other devs on your team\\n botDevs: [],\\n // The user ids who have complete 100% access to your bot\\n botOwners: []\\n }\\n};\\n\\n\")), mdx(\"h4\", null, \"Token\"), mdx(\"p\", null, \"First, add your bot token. This is \", mdx(\"strong\", {\n parentName: \"p\"\n }, \"required\"), \" for the bot to start. Review the \", mdx(\"a\", _extends({\n parentName: \"p\"\n }, {\n \"href\": \"https://discordeno.netlify.app/gettingstarted#creatingyourfirstdiscordbotapplication\"\n }), \"instructions\"), \" if you have not made your token yet.\"), mdx(\"h4\", null, \"Prefix\"), mdx(\"p\", null, \"The prefix is where you will set the default prefix for your bot. Don't worry, every server will be able to choose their own prefix but we need a default prefix to start.\"), mdx(\"h4\", null, \"Bot Lists Tokens\"), mdx(\"p\", null, \"This section of the file is so you can easily have your bot's statistics updated on all the bot lists out there to help you grow your bot. The code is already written to handle this but you will need to do 3 things for each bot list.\"), mdx(\"ol\", null, mdx(\"li\", {\n parentName: \"ol\"\n }, \"Go to the bot list and add your bot to their website. (Each site has it's own instructions)\"), mdx(\"li\", {\n parentName: \"ol\"\n }, \"Create a token for yourself on each website and paste it in your configs.\"), mdx(\"li\", {\n parentName: \"ol\"\n }, \"Enjoy!\")), mdx(\"p\", null, \"If you wish to customize the code, you will find the bot list tasks in the tasks folder. Don't worry we will discuss this when we get to the tasks section of the guide.\"), mdx(\"p\", null, \"For now just remember, that Discordeno provides you a built in way to update most discord bot lists.\"), mdx(\"h4\", null, \"Channel IDs\"), mdx(\"p\", null, \"The channelIDs section holds the channel IDs that are useful for specific features to help give you alerts/notifications. For example, the \", mdx(\"inlineCode\", {\n parentName: \"p\"\n }, \"missingTranslation\"), \" channel will be where messages are sent alerting you that somewhere in your code you are trying to use a translation key that you never created.\"), mdx(\"p\", null, \"When you get to around 25,000 Discord servers on your bot, you may want to convert these channel IDs to webhooks.\"), mdx(\"h4\", null, \"Role IDs\"), mdx(\"p\", null, \"The roleIDs section holds the role IDs that are useful for specific features to help give you alerts/notifications. For example, the \", mdx(\"inlineCode\", {\n parentName: \"p\"\n }, \"missingTranslation\"), \" channel will be where messages are sent alerting you that somewhere in your code you are trying to use a translation key that you never created.\"), mdx(\"p\", null, \"When you get to around 25,000 Discord servers on your bot, you may want to convert these channel IDs to webhooks.\"), mdx(\"h2\", null, \"It's Alive!\"), mdx(\"p\", null, \"Oh my god! You now have a bot with a bunch of features already! You don't believe me? Well, seeing is believing, so start the bot.\"), mdx(\"ol\", null, mdx(\"li\", {\n parentName: \"ol\"\n }, \"Invite your bot to a discord server.\"), mdx(\"li\", {\n parentName: \"ol\"\n }, \"Open up the integrated terminal in VSC using \", mdx(\"strong\", {\n parentName: \"li\"\n }, \"CTRL + `\"), \". If you use a Mac, replace CTRL with CMD.\"), mdx(\"li\", {\n parentName: \"ol\"\n }, \"Run the script below:\")), mdx(\"pre\", null, mdx(\"code\", _extends({\n parentName: \"pre\"\n }, {\n \"className\": \"language-shell\"\n }), \"deno run --allow-net --allow-read mod.ts\\n\")), mdx(\"p\", null, \"The first time you run it, you may see a lot of files being loaded. This is preparing all the magic behind the scene. Once it is ready, you will see something like this:\"), mdx(\"p\", null, mdx(\"img\", _extends({\n parentName: \"p\"\n }, {\n \"src\": \"https://i.imgur.com/TOXjLgh.png\",\n \"alt\": \"image\"\n }))), mdx(\"h2\", null, \"Understanding What Discordeno Did\"), mdx(\"p\", null, \"Discordeno includes these commands/folders as they are essential for any discord bot to have in order to meet the Discord Bot Best Practices. It also adds a few things that will help make some things easier to build a bot.\"), mdx(\"p\", null, \"We will dive into these deeper in this guide. Let's take it step by step.\"));\n}\n;\nMDXContent.isMDXComponent = true;","rawMDXOutput":"/* @jsx mdx */\nimport { mdx } from '@mdx-js/react';\n/* @jsx mdx */\n\nexport const _frontmatter = {\n \"title\": \"Creating The Bot!\",\n \"metaTitle\": \"Creating A Bot | Discordeno\",\n \"metaDescription\": \"Let's create our very own bot with Discordeno!\"\n};\n\nconst layoutProps = {\n _frontmatter\n};\nconst MDXLayout = \"wrapper\"\nexport default function MDXContent({\n components,\n ...props\n}) {\n return \n

{`Discordeno will help make Discord bot development much easier. Don't worry, as you go through this guide it will make a lot more sense.`}

\n

{`Creating The Bot!`}

\n
\n

{`This guide is going to assume you already have the basic requirements to make a bot ready. This includes github, git, a code editor like Visual Studio Code. If you don't have these yet please prepare them first before going forward.`}

\n
\n
    \n
  • \n

    {`First, create a Discordeno Bot using the `}{`Generator Boilerplate`}{`. Give it any name you like. For the purpose of this guide we will call it, Stargate.`}

    \n
  • \n
  • \n

    {`Then `}{`git clone https://github.com/Skillz4Killz/Stargate.git`}

    \n
  • \n
  • \n

    {`When that is done, go ahead and open up the folder with VSC.`}

    \n
  • \n
  • \n

    {`Create a new file called `}{`configs.ts`}{`. Open the `}{`configs.example.ts`}{` file and copy everything over.`}

    \n
  • \n
\n

{`Let's take a minute to review all the options we have available to us.`}

\n

{`Configs File`}

\n

{`The `}{`configs.ts`}{` file is where you will keep all your secret info you don't want to share with anyone else. As long as `}{`.gitignore`}{` file is ignoring configs.ts your configurations will be kept private!`}

\n
{`// Step 1: Remove the \\`.example\\` from this file name so it is called \\`configs.ts\\`\n// Step 2: Add all your bot's information below. The only required one is token and prefix. NOTE: As long as \\`.gitignore\\` file is ignoring configs.ts your configurations will be kept private!\n// Step 3: Remove these comments if you like.\n\nexport const configs = {\n  // Your bot token goes here\n  token: \"\",\n  // The default prefix for your bot. Don't worry guilds can change this later.\n  prefix: \"!\",\n  // This isn't required but you can add bot list api keys here.\n  botListTokens: {\n    DISCORD_BOT_ORG: \"\",\n    BOTS_ON_DISCORD: \"\",\n    DISCORD_BOT_LIST: \"\",\n    BOTS_FOR_DISCORD: \"\",\n    DISCORD_BOATS: \"\",\n    DISCORD_BOTS_GG: \"\",\n    DISCORD_BOTS_GROUP: \"\",\n  },\n  // This is the server id for your bot's main server where users can get help/support\n  supportServerID: \"\",\n  // These are channel ids that will enable some functionality\n  channelIDs: {\n    // When a translation is missing this is the channel you will be alerted in.\n    missingTranslation: \"\",\n    // When an error occurs, we will try and log it to this channel\n    errorChannelID: \"\"\n  },\n  // These are the role ids that will enable some functionality.\n  roleIDs: {\n    // If you have a patreon set up you can add the patreon vip role id here.\n    patreonVIPRoleID: \"\",\n  },\n  // These are the user ids that will enable some functionality.\n  userIDs: {\n    // The user ids for the support team\n    botSupporters: [],\n    // The user ids for the other devs on your team\n    botDevs: [],\n    // The user ids who have complete 100% access to your bot\n    botOwners: []\n  }\n};\n\n`}
\n

{`Token`}

\n

{`First, add your bot token. This is `}{`required`}{` for the bot to start. Review the `}{`instructions`}{` if you have not made your token yet.`}

\n

{`Prefix`}

\n

{`The prefix is where you will set the default prefix for your bot. Don't worry, every server will be able to choose their own prefix but we need a default prefix to start.`}

\n

{`Bot Lists Tokens`}

\n

{`This section of the file is so you can easily have your bot's statistics updated on all the bot lists out there to help you grow your bot. The code is already written to handle this but you will need to do 3 things for each bot list.`}

\n
    \n
  1. {`Go to the bot list and add your bot to their website. (Each site has it's own instructions)`}
  2. \n
  3. {`Create a token for yourself on each website and paste it in your configs.`}
  4. \n
  5. {`Enjoy!`}
  6. \n
\n

{`If you wish to customize the code, you will find the bot list tasks in the tasks folder. Don't worry we will discuss this when we get to the tasks section of the guide.`}

\n

{`For now just remember, that Discordeno provides you a built in way to update most discord bot lists.`}

\n

{`Channel IDs`}

\n

{`The channelIDs section holds the channel IDs that are useful for specific features to help give you alerts/notifications. For example, the `}{`missingTranslation`}{` channel will be where messages are sent alerting you that somewhere in your code you are trying to use a translation key that you never created.`}

\n

{`When you get to around 25,000 Discord servers on your bot, you may want to convert these channel IDs to webhooks.`}

\n

{`Role IDs`}

\n

{`The roleIDs section holds the role IDs that are useful for specific features to help give you alerts/notifications. For example, the `}{`missingTranslation`}{` channel will be where messages are sent alerting you that somewhere in your code you are trying to use a translation key that you never created.`}

\n

{`When you get to around 25,000 Discord servers on your bot, you may want to convert these channel IDs to webhooks.`}

\n

{`It's Alive!`}

\n

{`Oh my god! You now have a bot with a bunch of features already! You don't believe me? Well, seeing is believing, so start the bot.`}

\n
    \n
  1. {`Invite your bot to a discord server.`}
  2. \n
  3. {`Open up the integrated terminal in VSC using `}{`CTRL + \\``}{`. If you use a Mac, replace CTRL with CMD.`}
  4. \n
  5. {`Run the script below:`}
  6. \n
\n
{`deno run --allow-net --allow-read mod.ts\n`}
\n

{`The first time you run it, you may see a lot of files being loaded. This is preparing all the magic behind the scene. Once it is ready, you will see something like this:`}

\n

\n

{`Understanding What Discordeno Did`}

\n

{`Discordeno includes these commands/folders as they are essential for any discord bot to have in order to meet the Discord Bot Best Practices. It also adds a few things that will help make some things easier to build a bot.`}

\n

{`We will dive into these deeper in this guide. Let's take it step by step.`}

\n\n
;\n}\n\n;\nMDXContent.isMDXComponent = true;"}} \ No newline at end of file diff --git a/docs/.cache/caches/gatsby-plugin-mdx/diskstore-4849d65f9f719edca85e89f2877d14aa.json b/docs/.cache/caches/gatsby-plugin-mdx/diskstore-4849d65f9f719edca85e89f2877d14aa.json new file mode 100644 index 000000000..c3c36c79f --- /dev/null +++ b/docs/.cache/caches/gatsby-plugin-mdx/diskstore-4849d65f9f719edca85e89f2877d14aa.json @@ -0,0 +1 @@ +{"expireTime":9007200851633132000,"key":"gatsby-plugin-mdx-entire-payload-8759872eecd771853359268d5ccfafbd-","val":{"mdast":{"type":"root","children":[{"type":"paragraph","children":[{"type":"text","value":"Woah! You are almost half way done with understanding all of Discordeno. Amazing isn't it? Something you may have noticed in the last section was there were some options that prevented some commands from running like ","position":{"start":{"line":2,"column":1,"offset":1},"end":{"line":2,"column":218,"offset":218},"indent":[]}},{"type":"inlineCode","value":"dmOnly","position":{"start":{"line":2,"column":218,"offset":218},"end":{"line":2,"column":226,"offset":226},"indent":[]}},{"type":"text","value":" or the permission options. we created a setting to prevent the monitor from running in certain channels. What if we wanted to do prevent commands from happening? How would we prevent commands from running?","position":{"start":{"line":2,"column":226,"offset":226},"end":{"line":2,"column":432,"offset":432},"indent":[]}}],"position":{"start":{"line":2,"column":1,"offset":1},"end":{"line":2,"column":432,"offset":432},"indent":[]}},{"type":"heading","depth":2,"children":[{"type":"text","value":"What is an Inhibitor?","position":{"start":{"line":4,"column":4,"offset":437},"end":{"line":4,"column":25,"offset":458},"indent":[]}}],"position":{"start":{"line":4,"column":1,"offset":434},"end":{"line":4,"column":25,"offset":458},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"An Inhibitor is very similar to how monitors work. A monitor runs on every message but an inhibitor runs on every command. Remember all those command options like cooldown, permissions, permissionLevel, nsfw, etc... Each and every one of these options has an inhibitor in that checks commands for these settings.","position":{"start":{"line":6,"column":1,"offset":460},"end":{"line":6,"column":313,"offset":772},"indent":[]}}],"position":{"start":{"line":6,"column":1,"offset":460},"end":{"line":6,"column":313,"offset":772},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"Let's create our own inhibitor that would prevent commands from being used if the user is not a VIP user.","position":{"start":{"line":8,"column":1,"offset":774},"end":{"line":8,"column":106,"offset":879},"indent":[]}}],"position":{"start":{"line":8,"column":1,"offset":774},"end":{"line":8,"column":106,"offset":879},"indent":[]}},{"type":"blockquote","children":[{"type":"paragraph","children":[{"type":"strong","children":[{"type":"text","value":"Note:","position":{"start":{"line":10,"column":5,"offset":885},"end":{"line":10,"column":10,"offset":890},"indent":[]}}],"position":{"start":{"line":10,"column":3,"offset":883},"end":{"line":10,"column":12,"offset":892},"indent":[]}},{"type":"text","value":" It is important to remember that everything below can be done with a simple permission level as well. We will create our own custom permission levels but for the purposes of this guide and to be able to learn about Inhibitors, we will be using an inhibitor.","position":{"start":{"line":10,"column":12,"offset":892},"end":{"line":10,"column":270,"offset":1150},"indent":[]}}],"position":{"start":{"line":10,"column":3,"offset":883},"end":{"line":10,"column":270,"offset":1150},"indent":[]}}],"position":{"start":{"line":10,"column":1,"offset":881},"end":{"line":10,"column":270,"offset":1150},"indent":[]}},{"type":"heading","depth":2,"children":[{"type":"text","value":"Creating the File","position":{"start":{"line":12,"column":4,"offset":1155},"end":{"line":12,"column":21,"offset":1172},"indent":[]}}],"position":{"start":{"line":12,"column":1,"offset":1152},"end":{"line":12,"column":21,"offset":1172},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"Let's start by creating a file inside the inhibitors folder called ","position":{"start":{"line":14,"column":1,"offset":1174},"end":{"line":14,"column":68,"offset":1241},"indent":[]}},{"type":"inlineCode","value":"vipOnly.ts","position":{"start":{"line":14,"column":68,"offset":1241},"end":{"line":14,"column":80,"offset":1253},"indent":[]}},{"type":"text","value":" and paste the following snippet of code:","position":{"start":{"line":14,"column":80,"offset":1253},"end":{"line":14,"column":121,"offset":1294},"indent":[]}}],"position":{"start":{"line":14,"column":1,"offset":1174},"end":{"line":14,"column":121,"offset":1294},"indent":[]}},{"type":"code","lang":"ts","meta":null,"value":"import { botCache } from \"../../mod.ts\";\n\nbotCache.inhibitors.set(\"inhibitorname\", async function (message, command, guild) {\n\t// Your code goes here\n});","position":{"start":{"line":16,"column":1,"offset":1296},"end":{"line":22,"column":4,"offset":1459},"indent":[1,1,1,1,1,1]}},{"type":"paragraph","children":[{"type":"text","value":"Inhibitors can take up to 3 arguments.","position":{"start":{"line":24,"column":1,"offset":1461},"end":{"line":24,"column":39,"offset":1499},"indent":[]}}],"position":{"start":{"line":24,"column":1,"offset":1461},"end":{"line":24,"column":39,"offset":1499},"indent":[]}},{"type":"list","ordered":false,"start":null,"spread":false,"children":[{"type":"listItem","spread":false,"checked":null,"children":[{"type":"paragraph","children":[{"type":"inlineCode","value":"message","position":{"start":{"line":26,"column":3,"offset":1503},"end":{"line":26,"column":12,"offset":1512},"indent":[]}},{"type":"text","value":": The message object that triggered the command.","position":{"start":{"line":26,"column":12,"offset":1512},"end":{"line":26,"column":60,"offset":1560},"indent":[]}}],"position":{"start":{"line":26,"column":3,"offset":1503},"end":{"line":26,"column":60,"offset":1560},"indent":[]}}],"position":{"start":{"line":26,"column":1,"offset":1501},"end":{"line":26,"column":60,"offset":1560},"indent":[]}},{"type":"listItem","spread":false,"checked":null,"children":[{"type":"paragraph","children":[{"type":"inlineCode","value":"command","position":{"start":{"line":27,"column":3,"offset":1563},"end":{"line":27,"column":12,"offset":1572},"indent":[]}},{"type":"text","value":": The command object itself that was triggered.","position":{"start":{"line":27,"column":12,"offset":1572},"end":{"line":27,"column":59,"offset":1619},"indent":[]}}],"position":{"start":{"line":27,"column":3,"offset":1563},"end":{"line":27,"column":59,"offset":1619},"indent":[]}}],"position":{"start":{"line":27,"column":1,"offset":1561},"end":{"line":27,"column":59,"offset":1619},"indent":[]}},{"type":"listItem","spread":false,"checked":null,"children":[{"type":"paragraph","children":[{"type":"inlineCode","value":"guild","position":{"start":{"line":28,"column":3,"offset":1622},"end":{"line":28,"column":10,"offset":1629},"indent":[]}},{"type":"text","value":": The server guild object where this command was ran.","position":{"start":{"line":28,"column":10,"offset":1629},"end":{"line":28,"column":63,"offset":1682},"indent":[]}}],"position":{"start":{"line":28,"column":3,"offset":1622},"end":{"line":28,"column":63,"offset":1682},"indent":[]}}],"position":{"start":{"line":28,"column":1,"offset":1620},"end":{"line":28,"column":63,"offset":1682},"indent":[]}}],"position":{"start":{"line":26,"column":1,"offset":1501},"end":{"line":28,"column":63,"offset":1682},"indent":[1,1]}},{"type":"heading","depth":2,"children":[{"type":"text","value":"Understanding How Inhibitors Function","position":{"start":{"line":30,"column":4,"offset":1687},"end":{"line":30,"column":41,"offset":1724},"indent":[]}}],"position":{"start":{"line":30,"column":1,"offset":1684},"end":{"line":30,"column":41,"offset":1724},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"To block a command you have to return a truthy value.\n\t","position":{"start":{"line":32,"column":1,"offset":1726},"end":{"line":33,"column":2,"offset":1781},"indent":[1]}},{"type":"strong","children":[{"type":"text","value":"return true;","position":{"start":{"line":33,"column":4,"offset":1783},"end":{"line":33,"column":16,"offset":1795},"indent":[]}}],"position":{"start":{"line":33,"column":2,"offset":1781},"end":{"line":33,"column":18,"offset":1797},"indent":[]}},{"type":"text","value":" If you return true the inhibitor will block the execution of the command.\nTo allow a command return a falsey value.","position":{"start":{"line":33,"column":18,"offset":1797},"end":{"line":34,"column":42,"offset":1913},"indent":[1]}}],"position":{"start":{"line":32,"column":1,"offset":1726},"end":{"line":34,"column":42,"offset":1913},"indent":[1,1]}},{"type":"code","lang":null,"meta":null,"value":"- **return false;** If you return false the inhibitor will not block the error.","position":{"start":{"line":35,"column":1,"offset":1914},"end":{"line":35,"column":81,"offset":1994},"indent":[]}},{"type":"code","lang":"ts","meta":null,"value":"// If the command is not VIP only we can allow this command\nif (!command.vipOnly) return false;\n\n// Check if the user is VIP\nconst userIsVIP = message.author.settings.get(`isVIP`)\n// The user is VIP so we can allow this command to be used\nif (userIsVIP) return false\n// The user is NOT VIP so we throw an error\nthrow `The ${command.name} is only allowed for VIP users.`","position":{"start":{"line":38,"column":1,"offset":1997},"end":{"line":48,"column":4,"offset":2376},"indent":[1,1,1,1,1,1,1,1,1,1]}},{"type":"export","value":"export const _frontmatter = {\"title\":\"Creating Inhibitors!\",\"metaTitle\":\"Creating An Inhibitor | Discordeno\",\"metaDescription\":\"Let's create our very own bot with Discordeno!\"}","position":{"start":{"line":51,"column":1,"offset":2379},"end":{"line":51,"column":177,"offset":2555},"indent":[]}}],"position":{"start":{"line":1,"column":1,"offset":0},"end":{"line":51,"column":177,"offset":2555}}},"scopeImports":["import * as React from 'react'"],"scopeIdentifiers":["React"],"body":"function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }\n\nfunction _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }\n\nfunction _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }\n\n/* @jsx mdx */\nvar _frontmatter = {\n \"title\": \"Creating Inhibitors!\",\n \"metaTitle\": \"Creating An Inhibitor | Discordeno\",\n \"metaDescription\": \"Let's create our very own bot with Discordeno!\"\n};\nvar layoutProps = {\n _frontmatter: _frontmatter\n};\nvar MDXLayout = \"wrapper\";\nreturn function MDXContent(_ref) {\n var components = _ref.components,\n props = _objectWithoutProperties(_ref, [\"components\"]);\n\n return mdx(MDXLayout, _extends({}, layoutProps, props, {\n components: components,\n mdxType: \"MDXLayout\"\n }), mdx(\"p\", null, \"Woah! You are almost half way done with understanding all of Discordeno. Amazing isn't it? Something you may have noticed in the last section was there were some options that prevented some commands from running like \", mdx(\"inlineCode\", {\n parentName: \"p\"\n }, \"dmOnly\"), \" or the permission options. we created a setting to prevent the monitor from running in certain channels. What if we wanted to do prevent commands from happening? How would we prevent commands from running?\"), mdx(\"h2\", null, \"What is an Inhibitor?\"), mdx(\"p\", null, \"An Inhibitor is very similar to how monitors work. A monitor runs on every message but an inhibitor runs on every command. Remember all those command options like cooldown, permissions, permissionLevel, nsfw, etc... Each and every one of these options has an inhibitor in that checks commands for these settings.\"), mdx(\"p\", null, \"Let's create our own inhibitor that would prevent commands from being used if the user is not a VIP user.\"), mdx(\"blockquote\", null, mdx(\"p\", {\n parentName: \"blockquote\"\n }, mdx(\"strong\", {\n parentName: \"p\"\n }, \"Note:\"), \" It is important to remember that everything below can be done with a simple permission level as well. We will create our own custom permission levels but for the purposes of this guide and to be able to learn about Inhibitors, we will be using an inhibitor.\")), mdx(\"h2\", null, \"Creating the File\"), mdx(\"p\", null, \"Let's start by creating a file inside the inhibitors folder called \", mdx(\"inlineCode\", {\n parentName: \"p\"\n }, \"vipOnly.ts\"), \" and paste the following snippet of code:\"), mdx(\"pre\", null, mdx(\"code\", _extends({\n parentName: \"pre\"\n }, {\n \"className\": \"language-ts\"\n }), \"import { botCache } from \\\"../../mod.ts\\\";\\n\\nbotCache.inhibitors.set(\\\"inhibitorname\\\", async function (message, command, guild) {\\n // Your code goes here\\n});\\n\")), mdx(\"p\", null, \"Inhibitors can take up to 3 arguments.\"), mdx(\"ul\", null, mdx(\"li\", {\n parentName: \"ul\"\n }, mdx(\"inlineCode\", {\n parentName: \"li\"\n }, \"message\"), \": The message object that triggered the command.\"), mdx(\"li\", {\n parentName: \"ul\"\n }, mdx(\"inlineCode\", {\n parentName: \"li\"\n }, \"command\"), \": The command object itself that was triggered.\"), mdx(\"li\", {\n parentName: \"ul\"\n }, mdx(\"inlineCode\", {\n parentName: \"li\"\n }, \"guild\"), \": The server guild object where this command was ran.\")), mdx(\"h2\", null, \"Understanding How Inhibitors Function\"), mdx(\"p\", null, \"To block a command you have to return a truthy value.\\n\", mdx(\"strong\", {\n parentName: \"p\"\n }, \"return true;\"), \" If you return true the inhibitor will block the execution of the command.\\nTo allow a command return a falsey value.\"), mdx(\"pre\", null, mdx(\"code\", _extends({\n parentName: \"pre\"\n }, {}), \"- **return false;** If you return false the inhibitor will not block the error.\\n\")), mdx(\"pre\", null, mdx(\"code\", _extends({\n parentName: \"pre\"\n }, {\n \"className\": \"language-ts\"\n }), \"// If the command is not VIP only we can allow this command\\nif (!command.vipOnly) return false;\\n\\n// Check if the user is VIP\\nconst userIsVIP = message.author.settings.get(`isVIP`)\\n// The user is VIP so we can allow this command to be used\\nif (userIsVIP) return false\\n// The user is NOT VIP so we throw an error\\nthrow `The ${command.name} is only allowed for VIP users.`\\n\")));\n}\n;\nMDXContent.isMDXComponent = true;","rawMDXOutput":"/* @jsx mdx */\nimport { mdx } from '@mdx-js/react';\n/* @jsx mdx */\n\nexport const _frontmatter = {\n \"title\": \"Creating Inhibitors!\",\n \"metaTitle\": \"Creating An Inhibitor | Discordeno\",\n \"metaDescription\": \"Let's create our very own bot with Discordeno!\"\n};\n\nconst layoutProps = {\n _frontmatter\n};\nconst MDXLayout = \"wrapper\"\nexport default function MDXContent({\n components,\n ...props\n}) {\n return \n

{`Woah! You are almost half way done with understanding all of Discordeno. Amazing isn't it? Something you may have noticed in the last section was there were some options that prevented some commands from running like `}{`dmOnly`}{` or the permission options. we created a setting to prevent the monitor from running in certain channels. What if we wanted to do prevent commands from happening? How would we prevent commands from running?`}

\n

{`What is an Inhibitor?`}

\n

{`An Inhibitor is very similar to how monitors work. A monitor runs on every message but an inhibitor runs on every command. Remember all those command options like cooldown, permissions, permissionLevel, nsfw, etc... Each and every one of these options has an inhibitor in that checks commands for these settings.`}

\n

{`Let's create our own inhibitor that would prevent commands from being used if the user is not a VIP user.`}

\n
\n

{`Note:`}{` It is important to remember that everything below can be done with a simple permission level as well. We will create our own custom permission levels but for the purposes of this guide and to be able to learn about Inhibitors, we will be using an inhibitor.`}

\n
\n

{`Creating the File`}

\n

{`Let's start by creating a file inside the inhibitors folder called `}{`vipOnly.ts`}{` and paste the following snippet of code:`}

\n
{`import { botCache } from \"../../mod.ts\";\n\nbotCache.inhibitors.set(\"inhibitorname\", async function (message, command, guild) {\n    // Your code goes here\n});\n`}
\n

{`Inhibitors can take up to 3 arguments.`}

\n
    \n
  • {`message`}{`: The message object that triggered the command.`}
  • \n
  • {`command`}{`: The command object itself that was triggered.`}
  • \n
  • {`guild`}{`: The server guild object where this command was ran.`}
  • \n
\n

{`Understanding How Inhibitors Function`}

\n

{`To block a command you have to return a truthy value.\n`}{`return true;`}{` If you return true the inhibitor will block the execution of the command.\nTo allow a command return a falsey value.`}

\n
{`- **return false;** If you return false the inhibitor will not block the error.\n`}
\n
{`// If the command is not VIP only we can allow this command\nif (!command.vipOnly) return false;\n\n// Check if the user is VIP\nconst userIsVIP = message.author.settings.get(\\`isVIP\\`)\n// The user is VIP so we can allow this command to be used\nif (userIsVIP) return false\n// The user is NOT VIP so we throw an error\nthrow \\`The \\${command.name} is only allowed for VIP users.\\`\n`}
\n\n
;\n}\n\n;\nMDXContent.isMDXComponent = true;"}} \ No newline at end of file diff --git a/docs/.cache/caches/gatsby-plugin-mdx/diskstore-498145645926159b73b80d18f82ab579.json b/docs/.cache/caches/gatsby-plugin-mdx/diskstore-498145645926159b73b80d18f82ab579.json new file mode 100644 index 000000000..df8c9521e --- /dev/null +++ b/docs/.cache/caches/gatsby-plugin-mdx/diskstore-498145645926159b73b80d18f82ab579.json @@ -0,0 +1 @@ +{"expireTime":9007200851644271000,"key":"gatsby-plugin-mdx-entire-payload-617f71b17942803b83f7957f3c2d3bb7-","val":{"mdast":{"type":"root","children":[{"type":"paragraph","children":[{"type":"text","value":"Discordeno will help make Discord bot development much easier. Don't worry, as you go through this guide it will make a lot more sense.","position":{"start":{"line":2,"column":1,"offset":1},"end":{"line":2,"column":136,"offset":136},"indent":[]}}],"position":{"start":{"line":2,"column":1,"offset":1},"end":{"line":2,"column":136,"offset":136},"indent":[]}},{"type":"heading","depth":2,"children":[{"type":"text","value":"Creating The Bot!","position":{"start":{"line":4,"column":4,"offset":141},"end":{"line":4,"column":21,"offset":158},"indent":[]}}],"position":{"start":{"line":4,"column":1,"offset":138},"end":{"line":4,"column":21,"offset":158},"indent":[]}},{"type":"blockquote","children":[{"type":"paragraph","children":[{"type":"text","value":"This guide is going to assume you already have the basic requirements to make a bot ready. This includes github, git, a code editor like Visual Studio Code. If you don't have these yet please prepare them first before going forward.","position":{"start":{"line":6,"column":3,"offset":162},"end":{"line":6,"column":235,"offset":394},"indent":[]}}],"position":{"start":{"line":6,"column":3,"offset":162},"end":{"line":6,"column":235,"offset":394},"indent":[]}}],"position":{"start":{"line":6,"column":1,"offset":160},"end":{"line":6,"column":235,"offset":394},"indent":[]}},{"type":"list","ordered":false,"start":null,"spread":true,"children":[{"type":"listItem","spread":false,"checked":null,"children":[{"type":"paragraph","children":[{"type":"text","value":"First, create a Discordeno Bot using the ","position":{"start":{"line":8,"column":3,"offset":398},"end":{"line":8,"column":44,"offset":439},"indent":[]}},{"type":"link","title":null,"url":"https://github.com/Skillz4Killz/Discordeno-bot-template","children":[{"type":"text","value":"Generator Boilerplate","position":{"start":{"line":8,"column":45,"offset":440},"end":{"line":8,"column":66,"offset":461},"indent":[]}}],"position":{"start":{"line":8,"column":44,"offset":439},"end":{"line":8,"column":124,"offset":519},"indent":[]}},{"type":"text","value":". Give it any name you like. For the purpose of this guide we will call it, Stargate.","position":{"start":{"line":8,"column":124,"offset":519},"end":{"line":8,"column":209,"offset":604},"indent":[]}}],"position":{"start":{"line":8,"column":3,"offset":398},"end":{"line":8,"column":209,"offset":604},"indent":[]}}],"position":{"start":{"line":8,"column":1,"offset":396},"end":{"line":9,"column":1,"offset":605},"indent":[1]}},{"type":"listItem","spread":false,"checked":null,"children":[{"type":"paragraph","children":[{"type":"text","value":"Then ","position":{"start":{"line":10,"column":3,"offset":608},"end":{"line":10,"column":8,"offset":613},"indent":[]}},{"type":"inlineCode","value":"git clone https://github.com/Skillz4Killz/Stargate.git","position":{"start":{"line":10,"column":8,"offset":613},"end":{"line":10,"column":64,"offset":669},"indent":[]}}],"position":{"start":{"line":10,"column":3,"offset":608},"end":{"line":10,"column":64,"offset":669},"indent":[]}}],"position":{"start":{"line":10,"column":1,"offset":606},"end":{"line":11,"column":1,"offset":670},"indent":[1]}},{"type":"listItem","spread":false,"checked":null,"children":[{"type":"paragraph","children":[{"type":"text","value":"When that is done, go ahead and open up the folder with VSC.","position":{"start":{"line":12,"column":3,"offset":673},"end":{"line":12,"column":63,"offset":733},"indent":[]}}],"position":{"start":{"line":12,"column":3,"offset":673},"end":{"line":12,"column":63,"offset":733},"indent":[]}}],"position":{"start":{"line":12,"column":1,"offset":671},"end":{"line":12,"column":63,"offset":733},"indent":[]}},{"type":"listItem","spread":false,"checked":null,"children":[{"type":"paragraph","children":[{"type":"text","value":"Create a new file called ","position":{"start":{"line":13,"column":3,"offset":736},"end":{"line":13,"column":28,"offset":761},"indent":[]}},{"type":"inlineCode","value":"configs.ts","position":{"start":{"line":13,"column":28,"offset":761},"end":{"line":13,"column":40,"offset":773},"indent":[]}},{"type":"text","value":". Open the ","position":{"start":{"line":13,"column":40,"offset":773},"end":{"line":13,"column":51,"offset":784},"indent":[]}},{"type":"inlineCode","value":"configs.example.ts","position":{"start":{"line":13,"column":51,"offset":784},"end":{"line":13,"column":71,"offset":804},"indent":[]}},{"type":"text","value":" file and copy everything over.","position":{"start":{"line":13,"column":71,"offset":804},"end":{"line":13,"column":102,"offset":835},"indent":[]}}],"position":{"start":{"line":13,"column":3,"offset":736},"end":{"line":13,"column":102,"offset":835},"indent":[]}}],"position":{"start":{"line":13,"column":1,"offset":734},"end":{"line":13,"column":102,"offset":835},"indent":[]}}],"position":{"start":{"line":8,"column":1,"offset":396},"end":{"line":13,"column":102,"offset":835},"indent":[1,1,1,1,1]}},{"type":"paragraph","children":[{"type":"text","value":"Let's take a minute to review all the options we have available to us.","position":{"start":{"line":15,"column":1,"offset":837},"end":{"line":15,"column":71,"offset":907},"indent":[]}}],"position":{"start":{"line":15,"column":1,"offset":837},"end":{"line":15,"column":71,"offset":907},"indent":[]}},{"type":"heading","depth":3,"children":[{"type":"text","value":"Configs File","position":{"start":{"line":17,"column":5,"offset":913},"end":{"line":17,"column":17,"offset":925},"indent":[]}}],"position":{"start":{"line":17,"column":1,"offset":909},"end":{"line":17,"column":17,"offset":925},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"The ","position":{"start":{"line":19,"column":1,"offset":927},"end":{"line":19,"column":5,"offset":931},"indent":[]}},{"type":"inlineCode","value":"configs.ts","position":{"start":{"line":19,"column":5,"offset":931},"end":{"line":19,"column":17,"offset":943},"indent":[]}},{"type":"text","value":" file is where you will keep all your secret info you don't want to share with anyone else. As long as ","position":{"start":{"line":19,"column":17,"offset":943},"end":{"line":19,"column":120,"offset":1046},"indent":[]}},{"type":"inlineCode","value":".gitignore","position":{"start":{"line":19,"column":120,"offset":1046},"end":{"line":19,"column":132,"offset":1058},"indent":[]}},{"type":"text","value":" file is ignoring configs.ts your configurations will be kept private!","position":{"start":{"line":19,"column":132,"offset":1058},"end":{"line":19,"column":202,"offset":1128},"indent":[]}}],"position":{"start":{"line":19,"column":1,"offset":927},"end":{"line":19,"column":202,"offset":1128},"indent":[]}},{"type":"code","lang":"ts","meta":null,"value":"// Step 1: Remove the `.example` from this file name so it is called `configs.ts`\n// Step 2: Add all your bot's information below. The only required one is token and prefix. NOTE: As long as `.gitignore` file is ignoring configs.ts your configurations will be kept private!\n// Step 3: Remove these comments if you like.\n\nexport const configs = {\n // Your bot token goes here\n token: \"\",\n // The default prefix for your bot. Don't worry guilds can change this later.\n prefix: \"!\",\n // This isn't required but you can add bot list api keys here.\n botListTokens: {\n DISCORD_BOT_ORG: \"\",\n BOTS_ON_DISCORD: \"\",\n DISCORD_BOT_LIST: \"\",\n BOTS_FOR_DISCORD: \"\",\n DISCORD_BOATS: \"\",\n DISCORD_BOTS_GG: \"\",\n DISCORD_BOTS_GROUP: \"\",\n },\n // This is the server id for your bot's main server where users can get help/support\n supportServerID: \"\",\n // These are channel ids that will enable some functionality\n channelIDs: {\n // When a translation is missing this is the channel you will be alerted in.\n missingTranslation: \"\",\n // When an error occurs, we will try and log it to this channel\n errorChannelID: \"\"\n },\n // These are the role ids that will enable some functionality.\n roleIDs: {\n // If you have a patreon set up you can add the patreon vip role id here.\n patreonVIPRoleID: \"\",\n },\n // These are the user ids that will enable some functionality.\n userIDs: {\n // The user ids for the support team\n botSupporters: [],\n // The user ids for the other devs on your team\n botDevs: [],\n // The user ids who have complete 100% access to your bot\n botOwners: []\n }\n};\n","position":{"start":{"line":21,"column":1,"offset":1130},"end":{"line":66,"column":4,"offset":2770},"indent":[1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1]}},{"type":"heading","depth":4,"children":[{"type":"text","value":"Token","position":{"start":{"line":68,"column":6,"offset":2777},"end":{"line":68,"column":11,"offset":2782},"indent":[]}}],"position":{"start":{"line":68,"column":1,"offset":2772},"end":{"line":68,"column":11,"offset":2782},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"First, add your bot token. This is ","position":{"start":{"line":70,"column":1,"offset":2784},"end":{"line":70,"column":36,"offset":2819},"indent":[]}},{"type":"strong","children":[{"type":"text","value":"required","position":{"start":{"line":70,"column":38,"offset":2821},"end":{"line":70,"column":46,"offset":2829},"indent":[]}}],"position":{"start":{"line":70,"column":36,"offset":2819},"end":{"line":70,"column":48,"offset":2831},"indent":[]}},{"type":"text","value":" for the bot to start. Review the ","position":{"start":{"line":70,"column":48,"offset":2831},"end":{"line":70,"column":82,"offset":2865},"indent":[]}},{"type":"link","title":null,"url":"https://discordeno.netlify.app/gettingstarted#creatingyourfirstdiscordbotapplication","children":[{"type":"text","value":"instructions","position":{"start":{"line":70,"column":83,"offset":2866},"end":{"line":70,"column":95,"offset":2878},"indent":[]}}],"position":{"start":{"line":70,"column":82,"offset":2865},"end":{"line":70,"column":182,"offset":2965},"indent":[]}},{"type":"text","value":" if you have not made your token yet.","position":{"start":{"line":70,"column":182,"offset":2965},"end":{"line":70,"column":219,"offset":3002},"indent":[]}}],"position":{"start":{"line":70,"column":1,"offset":2784},"end":{"line":70,"column":219,"offset":3002},"indent":[]}},{"type":"heading","depth":4,"children":[{"type":"text","value":"Prefix","position":{"start":{"line":72,"column":6,"offset":3009},"end":{"line":72,"column":12,"offset":3015},"indent":[]}}],"position":{"start":{"line":72,"column":1,"offset":3004},"end":{"line":72,"column":12,"offset":3015},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"The prefix is where you will set the default prefix for your bot. Don't worry, every server will be able to choose their own prefix but we need a default prefix to start.","position":{"start":{"line":74,"column":1,"offset":3017},"end":{"line":74,"column":171,"offset":3187},"indent":[]}}],"position":{"start":{"line":74,"column":1,"offset":3017},"end":{"line":74,"column":171,"offset":3187},"indent":[]}},{"type":"heading","depth":4,"children":[{"type":"text","value":"Bot Lists Tokens","position":{"start":{"line":76,"column":6,"offset":3194},"end":{"line":76,"column":22,"offset":3210},"indent":[]}}],"position":{"start":{"line":76,"column":1,"offset":3189},"end":{"line":76,"column":22,"offset":3210},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"This section of the file is so you can easily have your bot's statistics updated on all the bot lists out there to help you grow your bot. The code is already written to handle this but you will need to do 3 things for each bot list.","position":{"start":{"line":78,"column":1,"offset":3212},"end":{"line":78,"column":234,"offset":3445},"indent":[]}}],"position":{"start":{"line":78,"column":1,"offset":3212},"end":{"line":78,"column":234,"offset":3445},"indent":[]}},{"type":"list","ordered":true,"start":1,"spread":false,"children":[{"type":"listItem","spread":false,"checked":null,"children":[{"type":"paragraph","children":[{"type":"text","value":"Go to the bot list and add your bot to their website. (Each site has it's own instructions)","position":{"start":{"line":80,"column":4,"offset":3450},"end":{"line":80,"column":95,"offset":3541},"indent":[]}}],"position":{"start":{"line":80,"column":4,"offset":3450},"end":{"line":80,"column":95,"offset":3541},"indent":[]}}],"position":{"start":{"line":80,"column":1,"offset":3447},"end":{"line":80,"column":95,"offset":3541},"indent":[]}},{"type":"listItem","spread":false,"checked":null,"children":[{"type":"paragraph","children":[{"type":"text","value":"Create a token for yourself on each website and paste it in your configs.","position":{"start":{"line":81,"column":4,"offset":3545},"end":{"line":81,"column":77,"offset":3618},"indent":[]}}],"position":{"start":{"line":81,"column":4,"offset":3545},"end":{"line":81,"column":77,"offset":3618},"indent":[]}}],"position":{"start":{"line":81,"column":1,"offset":3542},"end":{"line":81,"column":77,"offset":3618},"indent":[]}},{"type":"listItem","spread":false,"checked":null,"children":[{"type":"paragraph","children":[{"type":"text","value":"Enjoy!","position":{"start":{"line":82,"column":4,"offset":3622},"end":{"line":82,"column":10,"offset":3628},"indent":[]}}],"position":{"start":{"line":82,"column":4,"offset":3622},"end":{"line":82,"column":10,"offset":3628},"indent":[]}}],"position":{"start":{"line":82,"column":1,"offset":3619},"end":{"line":82,"column":10,"offset":3628},"indent":[]}}],"position":{"start":{"line":80,"column":1,"offset":3447},"end":{"line":82,"column":10,"offset":3628},"indent":[1,1]}},{"type":"paragraph","children":[{"type":"text","value":"If you wish to customize the code, you will find the bot list tasks in the tasks folder. Don't worry we will discuss this when we get to the tasks section of the guide.","position":{"start":{"line":84,"column":1,"offset":3630},"end":{"line":84,"column":169,"offset":3798},"indent":[]}}],"position":{"start":{"line":84,"column":1,"offset":3630},"end":{"line":84,"column":169,"offset":3798},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"For now just remember, that Discordeno provides you a built in way to update most discord bot lists.","position":{"start":{"line":86,"column":1,"offset":3800},"end":{"line":86,"column":101,"offset":3900},"indent":[]}}],"position":{"start":{"line":86,"column":1,"offset":3800},"end":{"line":86,"column":101,"offset":3900},"indent":[]}},{"type":"heading","depth":4,"children":[{"type":"text","value":"Channel IDs","position":{"start":{"line":88,"column":6,"offset":3907},"end":{"line":88,"column":17,"offset":3918},"indent":[]}}],"position":{"start":{"line":88,"column":1,"offset":3902},"end":{"line":88,"column":17,"offset":3918},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"The channelIDs section holds the channel IDs that are useful for specific features to help give you alerts/notifications. For example, the ","position":{"start":{"line":90,"column":1,"offset":3920},"end":{"line":90,"column":140,"offset":4059},"indent":[]}},{"type":"inlineCode","value":"missingTranslation","position":{"start":{"line":90,"column":140,"offset":4059},"end":{"line":90,"column":160,"offset":4079},"indent":[]}},{"type":"text","value":" channel will be where messages are sent alerting you that somewhere in your code you are trying to use a translation key that you never created.","position":{"start":{"line":90,"column":160,"offset":4079},"end":{"line":90,"column":305,"offset":4224},"indent":[]}}],"position":{"start":{"line":90,"column":1,"offset":3920},"end":{"line":90,"column":305,"offset":4224},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"When you get to around 25,000 Discord servers on your bot, you may want to convert these channel IDs to webhooks.","position":{"start":{"line":92,"column":1,"offset":4226},"end":{"line":92,"column":114,"offset":4339},"indent":[]}}],"position":{"start":{"line":92,"column":1,"offset":4226},"end":{"line":92,"column":114,"offset":4339},"indent":[]}},{"type":"heading","depth":4,"children":[{"type":"text","value":"Role IDs","position":{"start":{"line":94,"column":6,"offset":4346},"end":{"line":94,"column":14,"offset":4354},"indent":[]}}],"position":{"start":{"line":94,"column":1,"offset":4341},"end":{"line":94,"column":14,"offset":4354},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"The roleIDs section holds the role IDs that are useful for specific features. For example, the ","position":{"start":{"line":96,"column":1,"offset":4356},"end":{"line":96,"column":96,"offset":4451},"indent":[]}},{"type":"inlineCode","value":"patreonVIPRoleID","position":{"start":{"line":96,"column":96,"offset":4451},"end":{"line":96,"column":114,"offset":4469},"indent":[]}},{"type":"text","value":" role can be used easily to enable vip features later in this guide.","position":{"start":{"line":96,"column":114,"offset":4469},"end":{"line":96,"column":182,"offset":4537},"indent":[]}}],"position":{"start":{"line":96,"column":1,"offset":4356},"end":{"line":96,"column":182,"offset":4537},"indent":[]}},{"type":"heading","depth":4,"children":[{"type":"text","value":"User IDs","position":{"start":{"line":98,"column":6,"offset":4544},"end":{"line":98,"column":14,"offset":4552},"indent":[]}}],"position":{"start":{"line":98,"column":1,"offset":4539},"end":{"line":98,"column":14,"offset":4552},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"The userIDs section holds the user IDs that are useful for specific features. For example, the ","position":{"start":{"line":100,"column":1,"offset":4554},"end":{"line":100,"column":96,"offset":4649},"indent":[]}},{"type":"inlineCode","value":"botDevs","position":{"start":{"line":100,"column":96,"offset":4649},"end":{"line":100,"column":105,"offset":4658},"indent":[]}},{"type":"text","value":" user will be where messages are sent alerting you that somewhere in your code you are trying to use a translation key that you never created.","position":{"start":{"line":100,"column":105,"offset":4658},"end":{"line":100,"column":247,"offset":4800},"indent":[]}}],"position":{"start":{"line":100,"column":1,"offset":4554},"end":{"line":100,"column":247,"offset":4800},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"When you get to around 25,000 Discord servers on your bot, you may want to convert these user IDs to webhooks.","position":{"start":{"line":102,"column":1,"offset":4802},"end":{"line":102,"column":111,"offset":4912},"indent":[]}}],"position":{"start":{"line":102,"column":1,"offset":4802},"end":{"line":102,"column":111,"offset":4912},"indent":[]}},{"type":"heading","depth":2,"children":[{"type":"text","value":"It's Alive!","position":{"start":{"line":104,"column":4,"offset":4917},"end":{"line":104,"column":15,"offset":4928},"indent":[]}}],"position":{"start":{"line":104,"column":1,"offset":4914},"end":{"line":104,"column":15,"offset":4928},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"Oh my god! You now have a bot with a bunch of features already! You don't believe me? Well, seeing is believing, so start the bot.","position":{"start":{"line":106,"column":1,"offset":4930},"end":{"line":106,"column":131,"offset":5060},"indent":[]}}],"position":{"start":{"line":106,"column":1,"offset":4930},"end":{"line":106,"column":131,"offset":5060},"indent":[]}},{"type":"list","ordered":true,"start":1,"spread":false,"children":[{"type":"listItem","spread":false,"checked":null,"children":[{"type":"paragraph","children":[{"type":"text","value":"Invite your bot to a discord server.","position":{"start":{"line":108,"column":4,"offset":5065},"end":{"line":108,"column":40,"offset":5101},"indent":[]}}],"position":{"start":{"line":108,"column":4,"offset":5065},"end":{"line":108,"column":40,"offset":5101},"indent":[]}}],"position":{"start":{"line":108,"column":1,"offset":5062},"end":{"line":108,"column":40,"offset":5101},"indent":[]}},{"type":"listItem","spread":false,"checked":null,"children":[{"type":"paragraph","children":[{"type":"text","value":"Open up the integrated terminal in VSC using ","position":{"start":{"line":109,"column":4,"offset":5105},"end":{"line":109,"column":49,"offset":5150},"indent":[]}},{"type":"strong","children":[{"type":"text","value":"CTRL + `","position":{"start":{"line":109,"column":51,"offset":5152},"end":{"line":109,"column":59,"offset":5160},"indent":[]}}],"position":{"start":{"line":109,"column":49,"offset":5150},"end":{"line":109,"column":61,"offset":5162},"indent":[]}},{"type":"text","value":". If you use a Mac, replace CTRL with CMD.","position":{"start":{"line":109,"column":61,"offset":5162},"end":{"line":109,"column":103,"offset":5204},"indent":[]}}],"position":{"start":{"line":109,"column":4,"offset":5105},"end":{"line":109,"column":103,"offset":5204},"indent":[]}}],"position":{"start":{"line":109,"column":1,"offset":5102},"end":{"line":109,"column":103,"offset":5204},"indent":[]}},{"type":"listItem","spread":false,"checked":null,"children":[{"type":"paragraph","children":[{"type":"text","value":"Run the script below:","position":{"start":{"line":110,"column":4,"offset":5208},"end":{"line":110,"column":25,"offset":5229},"indent":[]}}],"position":{"start":{"line":110,"column":4,"offset":5208},"end":{"line":110,"column":25,"offset":5229},"indent":[]}}],"position":{"start":{"line":110,"column":1,"offset":5205},"end":{"line":110,"column":25,"offset":5229},"indent":[]}}],"position":{"start":{"line":108,"column":1,"offset":5062},"end":{"line":110,"column":25,"offset":5229},"indent":[1,1]}},{"type":"code","lang":"shell","meta":null,"value":"deno run --allow-net --allow-read mod.ts","position":{"start":{"line":112,"column":1,"offset":5231},"end":{"line":114,"column":4,"offset":5284},"indent":[1,1]}},{"type":"paragraph","children":[{"type":"text","value":"The first time you run it, you may see a lot of files being loaded. This is preparing all the magic behind the scene. Once it is ready, you will see something like this:","position":{"start":{"line":116,"column":1,"offset":5286},"end":{"line":116,"column":170,"offset":5455},"indent":[]}}],"position":{"start":{"line":116,"column":1,"offset":5286},"end":{"line":116,"column":170,"offset":5455},"indent":[]}},{"type":"paragraph","children":[{"type":"image","title":null,"url":"https://i.imgur.com/TOXjLgh.png","alt":"image","position":{"start":{"line":118,"column":1,"offset":5457},"end":{"line":118,"column":42,"offset":5498},"indent":[]}}],"position":{"start":{"line":118,"column":1,"offset":5457},"end":{"line":118,"column":42,"offset":5498},"indent":[]}},{"type":"heading","depth":2,"children":[{"type":"text","value":"Understanding What Discordeno Did","position":{"start":{"line":120,"column":4,"offset":5503},"end":{"line":120,"column":37,"offset":5536},"indent":[]}}],"position":{"start":{"line":120,"column":1,"offset":5500},"end":{"line":120,"column":37,"offset":5536},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"Discordeno includes these commands/folders as they are essential for any discord bot to have in order to meet the Discord Bot Best Practices. It also adds a few things that will help make some things easier to build a bot.","position":{"start":{"line":122,"column":1,"offset":5538},"end":{"line":122,"column":223,"offset":5760},"indent":[]}}],"position":{"start":{"line":122,"column":1,"offset":5538},"end":{"line":122,"column":223,"offset":5760},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"We will dive into these deeper in this guide. Let's take it step by step.","position":{"start":{"line":124,"column":1,"offset":5762},"end":{"line":124,"column":74,"offset":5835},"indent":[]}}],"position":{"start":{"line":124,"column":1,"offset":5762},"end":{"line":124,"column":74,"offset":5835},"indent":[]}},{"type":"export","value":"export const _frontmatter = {\"title\":\"Creating The Bot!\",\"metaTitle\":\"Creating A Bot | Discordeno\",\"metaDescription\":\"Let's create our very own bot with Discordeno!\"}","position":{"start":{"line":127,"column":1,"offset":5838},"end":{"line":127,"column":167,"offset":6004},"indent":[]}}],"position":{"start":{"line":1,"column":1,"offset":0},"end":{"line":127,"column":167,"offset":6004}}},"scopeImports":["import * as React from 'react'"],"scopeIdentifiers":["React"],"body":"function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }\n\nfunction _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }\n\nfunction _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }\n\n/* @jsx mdx */\nvar _frontmatter = {\n \"title\": \"Creating The Bot!\",\n \"metaTitle\": \"Creating A Bot | Discordeno\",\n \"metaDescription\": \"Let's create our very own bot with Discordeno!\"\n};\nvar layoutProps = {\n _frontmatter: _frontmatter\n};\nvar MDXLayout = \"wrapper\";\nreturn function MDXContent(_ref) {\n var components = _ref.components,\n props = _objectWithoutProperties(_ref, [\"components\"]);\n\n return mdx(MDXLayout, _extends({}, layoutProps, props, {\n components: components,\n mdxType: \"MDXLayout\"\n }), mdx(\"p\", null, \"Discordeno will help make Discord bot development much easier. Don't worry, as you go through this guide it will make a lot more sense.\"), mdx(\"h2\", null, \"Creating The Bot!\"), mdx(\"blockquote\", null, mdx(\"p\", {\n parentName: \"blockquote\"\n }, \"This guide is going to assume you already have the basic requirements to make a bot ready. This includes github, git, a code editor like Visual Studio Code. If you don't have these yet please prepare them first before going forward.\")), mdx(\"ul\", null, mdx(\"li\", {\n parentName: \"ul\"\n }, mdx(\"p\", {\n parentName: \"li\"\n }, \"First, create a Discordeno Bot using the \", mdx(\"a\", _extends({\n parentName: \"p\"\n }, {\n \"href\": \"https://github.com/Skillz4Killz/Discordeno-bot-template\"\n }), \"Generator Boilerplate\"), \". Give it any name you like. For the purpose of this guide we will call it, Stargate.\")), mdx(\"li\", {\n parentName: \"ul\"\n }, mdx(\"p\", {\n parentName: \"li\"\n }, \"Then \", mdx(\"inlineCode\", {\n parentName: \"p\"\n }, \"git clone https://github.com/Skillz4Killz/Stargate.git\"))), mdx(\"li\", {\n parentName: \"ul\"\n }, mdx(\"p\", {\n parentName: \"li\"\n }, \"When that is done, go ahead and open up the folder with VSC.\")), mdx(\"li\", {\n parentName: \"ul\"\n }, mdx(\"p\", {\n parentName: \"li\"\n }, \"Create a new file called \", mdx(\"inlineCode\", {\n parentName: \"p\"\n }, \"configs.ts\"), \". Open the \", mdx(\"inlineCode\", {\n parentName: \"p\"\n }, \"configs.example.ts\"), \" file and copy everything over.\"))), mdx(\"p\", null, \"Let's take a minute to review all the options we have available to us.\"), mdx(\"h3\", null, \"Configs File\"), mdx(\"p\", null, \"The \", mdx(\"inlineCode\", {\n parentName: \"p\"\n }, \"configs.ts\"), \" file is where you will keep all your secret info you don't want to share with anyone else. As long as \", mdx(\"inlineCode\", {\n parentName: \"p\"\n }, \".gitignore\"), \" file is ignoring configs.ts your configurations will be kept private!\"), mdx(\"pre\", null, mdx(\"code\", _extends({\n parentName: \"pre\"\n }, {\n \"className\": \"language-ts\"\n }), \"// Step 1: Remove the `.example` from this file name so it is called `configs.ts`\\n// Step 2: Add all your bot's information below. The only required one is token and prefix. NOTE: As long as `.gitignore` file is ignoring configs.ts your configurations will be kept private!\\n// Step 3: Remove these comments if you like.\\n\\nexport const configs = {\\n // Your bot token goes here\\n token: \\\"\\\",\\n // The default prefix for your bot. Don't worry guilds can change this later.\\n prefix: \\\"!\\\",\\n // This isn't required but you can add bot list api keys here.\\n botListTokens: {\\n DISCORD_BOT_ORG: \\\"\\\",\\n BOTS_ON_DISCORD: \\\"\\\",\\n DISCORD_BOT_LIST: \\\"\\\",\\n BOTS_FOR_DISCORD: \\\"\\\",\\n DISCORD_BOATS: \\\"\\\",\\n DISCORD_BOTS_GG: \\\"\\\",\\n DISCORD_BOTS_GROUP: \\\"\\\",\\n },\\n // This is the server id for your bot's main server where users can get help/support\\n supportServerID: \\\"\\\",\\n // These are channel ids that will enable some functionality\\n channelIDs: {\\n // When a translation is missing this is the channel you will be alerted in.\\n missingTranslation: \\\"\\\",\\n // When an error occurs, we will try and log it to this channel\\n errorChannelID: \\\"\\\"\\n },\\n // These are the role ids that will enable some functionality.\\n roleIDs: {\\n // If you have a patreon set up you can add the patreon vip role id here.\\n patreonVIPRoleID: \\\"\\\",\\n },\\n // These are the user ids that will enable some functionality.\\n userIDs: {\\n // The user ids for the support team\\n botSupporters: [],\\n // The user ids for the other devs on your team\\n botDevs: [],\\n // The user ids who have complete 100% access to your bot\\n botOwners: []\\n }\\n};\\n\\n\")), mdx(\"h4\", null, \"Token\"), mdx(\"p\", null, \"First, add your bot token. This is \", mdx(\"strong\", {\n parentName: \"p\"\n }, \"required\"), \" for the bot to start. Review the \", mdx(\"a\", _extends({\n parentName: \"p\"\n }, {\n \"href\": \"https://discordeno.netlify.app/gettingstarted#creatingyourfirstdiscordbotapplication\"\n }), \"instructions\"), \" if you have not made your token yet.\"), mdx(\"h4\", null, \"Prefix\"), mdx(\"p\", null, \"The prefix is where you will set the default prefix for your bot. Don't worry, every server will be able to choose their own prefix but we need a default prefix to start.\"), mdx(\"h4\", null, \"Bot Lists Tokens\"), mdx(\"p\", null, \"This section of the file is so you can easily have your bot's statistics updated on all the bot lists out there to help you grow your bot. The code is already written to handle this but you will need to do 3 things for each bot list.\"), mdx(\"ol\", null, mdx(\"li\", {\n parentName: \"ol\"\n }, \"Go to the bot list and add your bot to their website. (Each site has it's own instructions)\"), mdx(\"li\", {\n parentName: \"ol\"\n }, \"Create a token for yourself on each website and paste it in your configs.\"), mdx(\"li\", {\n parentName: \"ol\"\n }, \"Enjoy!\")), mdx(\"p\", null, \"If you wish to customize the code, you will find the bot list tasks in the tasks folder. Don't worry we will discuss this when we get to the tasks section of the guide.\"), mdx(\"p\", null, \"For now just remember, that Discordeno provides you a built in way to update most discord bot lists.\"), mdx(\"h4\", null, \"Channel IDs\"), mdx(\"p\", null, \"The channelIDs section holds the channel IDs that are useful for specific features to help give you alerts/notifications. For example, the \", mdx(\"inlineCode\", {\n parentName: \"p\"\n }, \"missingTranslation\"), \" channel will be where messages are sent alerting you that somewhere in your code you are trying to use a translation key that you never created.\"), mdx(\"p\", null, \"When you get to around 25,000 Discord servers on your bot, you may want to convert these channel IDs to webhooks.\"), mdx(\"h4\", null, \"Role IDs\"), mdx(\"p\", null, \"The roleIDs section holds the role IDs that are useful for specific features. For example, the \", mdx(\"inlineCode\", {\n parentName: \"p\"\n }, \"patreonVIPRoleID\"), \" role can be used easily to enable vip features later in this guide.\"), mdx(\"h4\", null, \"User IDs\"), mdx(\"p\", null, \"The userIDs section holds the user IDs that are useful for specific features. For example, the \", mdx(\"inlineCode\", {\n parentName: \"p\"\n }, \"botDevs\"), \" user will be where messages are sent alerting you that somewhere in your code you are trying to use a translation key that you never created.\"), mdx(\"p\", null, \"When you get to around 25,000 Discord servers on your bot, you may want to convert these user IDs to webhooks.\"), mdx(\"h2\", null, \"It's Alive!\"), mdx(\"p\", null, \"Oh my god! You now have a bot with a bunch of features already! You don't believe me? Well, seeing is believing, so start the bot.\"), mdx(\"ol\", null, mdx(\"li\", {\n parentName: \"ol\"\n }, \"Invite your bot to a discord server.\"), mdx(\"li\", {\n parentName: \"ol\"\n }, \"Open up the integrated terminal in VSC using \", mdx(\"strong\", {\n parentName: \"li\"\n }, \"CTRL + `\"), \". If you use a Mac, replace CTRL with CMD.\"), mdx(\"li\", {\n parentName: \"ol\"\n }, \"Run the script below:\")), mdx(\"pre\", null, mdx(\"code\", _extends({\n parentName: \"pre\"\n }, {\n \"className\": \"language-shell\"\n }), \"deno run --allow-net --allow-read mod.ts\\n\")), mdx(\"p\", null, \"The first time you run it, you may see a lot of files being loaded. This is preparing all the magic behind the scene. Once it is ready, you will see something like this:\"), mdx(\"p\", null, mdx(\"img\", _extends({\n parentName: \"p\"\n }, {\n \"src\": \"https://i.imgur.com/TOXjLgh.png\",\n \"alt\": \"image\"\n }))), mdx(\"h2\", null, \"Understanding What Discordeno Did\"), mdx(\"p\", null, \"Discordeno includes these commands/folders as they are essential for any discord bot to have in order to meet the Discord Bot Best Practices. It also adds a few things that will help make some things easier to build a bot.\"), mdx(\"p\", null, \"We will dive into these deeper in this guide. Let's take it step by step.\"));\n}\n;\nMDXContent.isMDXComponent = true;","rawMDXOutput":"/* @jsx mdx */\nimport { mdx } from '@mdx-js/react';\n/* @jsx mdx */\n\nexport const _frontmatter = {\n \"title\": \"Creating The Bot!\",\n \"metaTitle\": \"Creating A Bot | Discordeno\",\n \"metaDescription\": \"Let's create our very own bot with Discordeno!\"\n};\n\nconst layoutProps = {\n _frontmatter\n};\nconst MDXLayout = \"wrapper\"\nexport default function MDXContent({\n components,\n ...props\n}) {\n return \n

{`Discordeno will help make Discord bot development much easier. Don't worry, as you go through this guide it will make a lot more sense.`}

\n

{`Creating The Bot!`}

\n
\n

{`This guide is going to assume you already have the basic requirements to make a bot ready. This includes github, git, a code editor like Visual Studio Code. If you don't have these yet please prepare them first before going forward.`}

\n
\n
    \n
  • \n

    {`First, create a Discordeno Bot using the `}{`Generator Boilerplate`}{`. Give it any name you like. For the purpose of this guide we will call it, Stargate.`}

    \n
  • \n
  • \n

    {`Then `}{`git clone https://github.com/Skillz4Killz/Stargate.git`}

    \n
  • \n
  • \n

    {`When that is done, go ahead and open up the folder with VSC.`}

    \n
  • \n
  • \n

    {`Create a new file called `}{`configs.ts`}{`. Open the `}{`configs.example.ts`}{` file and copy everything over.`}

    \n
  • \n
\n

{`Let's take a minute to review all the options we have available to us.`}

\n

{`Configs File`}

\n

{`The `}{`configs.ts`}{` file is where you will keep all your secret info you don't want to share with anyone else. As long as `}{`.gitignore`}{` file is ignoring configs.ts your configurations will be kept private!`}

\n
{`// Step 1: Remove the \\`.example\\` from this file name so it is called \\`configs.ts\\`\n// Step 2: Add all your bot's information below. The only required one is token and prefix. NOTE: As long as \\`.gitignore\\` file is ignoring configs.ts your configurations will be kept private!\n// Step 3: Remove these comments if you like.\n\nexport const configs = {\n  // Your bot token goes here\n  token: \"\",\n  // The default prefix for your bot. Don't worry guilds can change this later.\n  prefix: \"!\",\n  // This isn't required but you can add bot list api keys here.\n  botListTokens: {\n    DISCORD_BOT_ORG: \"\",\n    BOTS_ON_DISCORD: \"\",\n    DISCORD_BOT_LIST: \"\",\n    BOTS_FOR_DISCORD: \"\",\n    DISCORD_BOATS: \"\",\n    DISCORD_BOTS_GG: \"\",\n    DISCORD_BOTS_GROUP: \"\",\n  },\n  // This is the server id for your bot's main server where users can get help/support\n  supportServerID: \"\",\n  // These are channel ids that will enable some functionality\n  channelIDs: {\n    // When a translation is missing this is the channel you will be alerted in.\n    missingTranslation: \"\",\n    // When an error occurs, we will try and log it to this channel\n    errorChannelID: \"\"\n  },\n  // These are the role ids that will enable some functionality.\n  roleIDs: {\n    // If you have a patreon set up you can add the patreon vip role id here.\n    patreonVIPRoleID: \"\",\n  },\n  // These are the user ids that will enable some functionality.\n  userIDs: {\n    // The user ids for the support team\n    botSupporters: [],\n    // The user ids for the other devs on your team\n    botDevs: [],\n    // The user ids who have complete 100% access to your bot\n    botOwners: []\n  }\n};\n\n`}
\n

{`Token`}

\n

{`First, add your bot token. This is `}{`required`}{` for the bot to start. Review the `}{`instructions`}{` if you have not made your token yet.`}

\n

{`Prefix`}

\n

{`The prefix is where you will set the default prefix for your bot. Don't worry, every server will be able to choose their own prefix but we need a default prefix to start.`}

\n

{`Bot Lists Tokens`}

\n

{`This section of the file is so you can easily have your bot's statistics updated on all the bot lists out there to help you grow your bot. The code is already written to handle this but you will need to do 3 things for each bot list.`}

\n
    \n
  1. {`Go to the bot list and add your bot to their website. (Each site has it's own instructions)`}
  2. \n
  3. {`Create a token for yourself on each website and paste it in your configs.`}
  4. \n
  5. {`Enjoy!`}
  6. \n
\n

{`If you wish to customize the code, you will find the bot list tasks in the tasks folder. Don't worry we will discuss this when we get to the tasks section of the guide.`}

\n

{`For now just remember, that Discordeno provides you a built in way to update most discord bot lists.`}

\n

{`Channel IDs`}

\n

{`The channelIDs section holds the channel IDs that are useful for specific features to help give you alerts/notifications. For example, the `}{`missingTranslation`}{` channel will be where messages are sent alerting you that somewhere in your code you are trying to use a translation key that you never created.`}

\n

{`When you get to around 25,000 Discord servers on your bot, you may want to convert these channel IDs to webhooks.`}

\n

{`Role IDs`}

\n

{`The roleIDs section holds the role IDs that are useful for specific features. For example, the `}{`patreonVIPRoleID`}{` role can be used easily to enable vip features later in this guide.`}

\n

{`User IDs`}

\n

{`The userIDs section holds the user IDs that are useful for specific features. For example, the `}{`botDevs`}{` user will be where messages are sent alerting you that somewhere in your code you are trying to use a translation key that you never created.`}

\n

{`When you get to around 25,000 Discord servers on your bot, you may want to convert these user IDs to webhooks.`}

\n

{`It's Alive!`}

\n

{`Oh my god! You now have a bot with a bunch of features already! You don't believe me? Well, seeing is believing, so start the bot.`}

\n
    \n
  1. {`Invite your bot to a discord server.`}
  2. \n
  3. {`Open up the integrated terminal in VSC using `}{`CTRL + \\``}{`. If you use a Mac, replace CTRL with CMD.`}
  4. \n
  5. {`Run the script below:`}
  6. \n
\n
{`deno run --allow-net --allow-read mod.ts\n`}
\n

{`The first time you run it, you may see a lot of files being loaded. This is preparing all the magic behind the scene. Once it is ready, you will see something like this:`}

\n

\n

{`Understanding What Discordeno Did`}

\n

{`Discordeno includes these commands/folders as they are essential for any discord bot to have in order to meet the Discord Bot Best Practices. It also adds a few things that will help make some things easier to build a bot.`}

\n

{`We will dive into these deeper in this guide. Let's take it step by step.`}

\n\n
;\n}\n\n;\nMDXContent.isMDXComponent = true;"}} \ No newline at end of file diff --git a/docs/.cache/caches/gatsby-plugin-mdx/diskstore-4a201e513228102f84d47e1d65453335.json b/docs/.cache/caches/gatsby-plugin-mdx/diskstore-4a201e513228102f84d47e1d65453335.json new file mode 100644 index 000000000..76300d572 --- /dev/null +++ b/docs/.cache/caches/gatsby-plugin-mdx/diskstore-4a201e513228102f84d47e1d65453335.json @@ -0,0 +1 @@ +{"expireTime":9007200851634621000,"key":"gatsby-plugin-mdx-entire-payload-63e7da80fa8df2901392fd13b2515b90-","val":{"mdast":{"type":"root","children":[{"type":"paragraph","children":[{"type":"text","value":"Woah! You are almost half way done with understanding all of Discordeno. Amazing isn't it? Something you may have noticed in the last section was there were some options that prevented some commands from running like ","position":{"start":{"line":2,"column":1,"offset":1},"end":{"line":2,"column":218,"offset":218},"indent":[]}},{"type":"inlineCode","value":"dmOnly","position":{"start":{"line":2,"column":218,"offset":218},"end":{"line":2,"column":226,"offset":226},"indent":[]}},{"type":"text","value":" or the permission options. we created a setting to prevent the monitor from running in certain channels. What if we wanted to do prevent commands from happening? How would we prevent commands from running?","position":{"start":{"line":2,"column":226,"offset":226},"end":{"line":2,"column":432,"offset":432},"indent":[]}}],"position":{"start":{"line":2,"column":1,"offset":1},"end":{"line":2,"column":432,"offset":432},"indent":[]}},{"type":"heading","depth":2,"children":[{"type":"text","value":"What is an Inhibitor?","position":{"start":{"line":4,"column":4,"offset":437},"end":{"line":4,"column":25,"offset":458},"indent":[]}}],"position":{"start":{"line":4,"column":1,"offset":434},"end":{"line":4,"column":25,"offset":458},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"An Inhibitor is very similar to how monitors work. A monitor runs on every message but an inhibitor runs on every command. Remember all those command options like cooldown, permissions, permissionLevel, nsfw, etc... Each and every one of these options has an inhibitor in that checks commands for these settings.","position":{"start":{"line":6,"column":1,"offset":460},"end":{"line":6,"column":313,"offset":772},"indent":[]}}],"position":{"start":{"line":6,"column":1,"offset":460},"end":{"line":6,"column":313,"offset":772},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"Let's create our own inhibitor that would prevent commands from being used if the user is not a VIP user.","position":{"start":{"line":8,"column":1,"offset":774},"end":{"line":8,"column":106,"offset":879},"indent":[]}}],"position":{"start":{"line":8,"column":1,"offset":774},"end":{"line":8,"column":106,"offset":879},"indent":[]}},{"type":"blockquote","children":[{"type":"paragraph","children":[{"type":"strong","children":[{"type":"text","value":"Note:","position":{"start":{"line":10,"column":5,"offset":885},"end":{"line":10,"column":10,"offset":890},"indent":[]}}],"position":{"start":{"line":10,"column":3,"offset":883},"end":{"line":10,"column":12,"offset":892},"indent":[]}},{"type":"text","value":" It is important to remember that everything below can be done with a simple permission level as well. We will create our own custom permission levels but for the purposes of this guide and to be able to learn about Inhibitors, we will be using an inhibitor.","position":{"start":{"line":10,"column":12,"offset":892},"end":{"line":10,"column":270,"offset":1150},"indent":[]}}],"position":{"start":{"line":10,"column":3,"offset":883},"end":{"line":10,"column":270,"offset":1150},"indent":[]}}],"position":{"start":{"line":10,"column":1,"offset":881},"end":{"line":10,"column":270,"offset":1150},"indent":[]}},{"type":"heading","depth":2,"children":[{"type":"text","value":"Creating the File","position":{"start":{"line":12,"column":4,"offset":1155},"end":{"line":12,"column":21,"offset":1172},"indent":[]}}],"position":{"start":{"line":12,"column":1,"offset":1152},"end":{"line":12,"column":21,"offset":1172},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"Let's start by creating a file inside the inhibitors folder called ","position":{"start":{"line":14,"column":1,"offset":1174},"end":{"line":14,"column":68,"offset":1241},"indent":[]}},{"type":"inlineCode","value":"boosted.ts","position":{"start":{"line":14,"column":68,"offset":1241},"end":{"line":14,"column":80,"offset":1253},"indent":[]}},{"type":"text","value":" and paste the following snippet of code:","position":{"start":{"line":14,"column":80,"offset":1253},"end":{"line":14,"column":121,"offset":1294},"indent":[]}}],"position":{"start":{"line":14,"column":1,"offset":1174},"end":{"line":14,"column":121,"offset":1294},"indent":[]}},{"type":"code","lang":"ts","meta":null,"value":"import { botCache } from \"../../mod.ts\";\n\nbotCache.inhibitors.set(\"inhibitorname\", async function (message, command, guild) {\n\t// Your code goes here\n});","position":{"start":{"line":16,"column":1,"offset":1296},"end":{"line":22,"column":4,"offset":1459},"indent":[1,1,1,1,1,1]}},{"type":"paragraph","children":[{"type":"text","value":"Inhibitors can take up to 3 arguments.","position":{"start":{"line":24,"column":1,"offset":1461},"end":{"line":24,"column":39,"offset":1499},"indent":[]}}],"position":{"start":{"line":24,"column":1,"offset":1461},"end":{"line":24,"column":39,"offset":1499},"indent":[]}},{"type":"list","ordered":false,"start":null,"spread":false,"children":[{"type":"listItem","spread":false,"checked":null,"children":[{"type":"paragraph","children":[{"type":"inlineCode","value":"message","position":{"start":{"line":26,"column":3,"offset":1503},"end":{"line":26,"column":12,"offset":1512},"indent":[]}},{"type":"text","value":": The message object that triggered the command.","position":{"start":{"line":26,"column":12,"offset":1512},"end":{"line":26,"column":60,"offset":1560},"indent":[]}}],"position":{"start":{"line":26,"column":3,"offset":1503},"end":{"line":26,"column":60,"offset":1560},"indent":[]}}],"position":{"start":{"line":26,"column":1,"offset":1501},"end":{"line":26,"column":60,"offset":1560},"indent":[]}},{"type":"listItem","spread":false,"checked":null,"children":[{"type":"paragraph","children":[{"type":"inlineCode","value":"command","position":{"start":{"line":27,"column":3,"offset":1563},"end":{"line":27,"column":12,"offset":1572},"indent":[]}},{"type":"text","value":": The command object itself that was triggered.","position":{"start":{"line":27,"column":12,"offset":1572},"end":{"line":27,"column":59,"offset":1619},"indent":[]}}],"position":{"start":{"line":27,"column":3,"offset":1563},"end":{"line":27,"column":59,"offset":1619},"indent":[]}}],"position":{"start":{"line":27,"column":1,"offset":1561},"end":{"line":27,"column":59,"offset":1619},"indent":[]}},{"type":"listItem","spread":false,"checked":null,"children":[{"type":"paragraph","children":[{"type":"inlineCode","value":"guild","position":{"start":{"line":28,"column":3,"offset":1622},"end":{"line":28,"column":10,"offset":1629},"indent":[]}},{"type":"text","value":": The server guild object where this command was ran.","position":{"start":{"line":28,"column":10,"offset":1629},"end":{"line":28,"column":63,"offset":1682},"indent":[]}}],"position":{"start":{"line":28,"column":3,"offset":1622},"end":{"line":28,"column":63,"offset":1682},"indent":[]}}],"position":{"start":{"line":28,"column":1,"offset":1620},"end":{"line":28,"column":63,"offset":1682},"indent":[]}}],"position":{"start":{"line":26,"column":1,"offset":1501},"end":{"line":28,"column":63,"offset":1682},"indent":[1,1]}},{"type":"heading","depth":2,"children":[{"type":"text","value":"Understanding How Inhibitors Function","position":{"start":{"line":30,"column":4,"offset":1687},"end":{"line":30,"column":41,"offset":1724},"indent":[]}}],"position":{"start":{"line":30,"column":1,"offset":1684},"end":{"line":30,"column":41,"offset":1724},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"To block a command you have to return a truthy value.","position":{"start":{"line":32,"column":1,"offset":1726},"end":{"line":32,"column":54,"offset":1779},"indent":[]}}],"position":{"start":{"line":32,"column":1,"offset":1726},"end":{"line":32,"column":54,"offset":1779},"indent":[]}},{"type":"list","ordered":false,"start":null,"spread":false,"children":[{"type":"listItem","spread":false,"checked":null,"children":[{"type":"paragraph","children":[{"type":"strong","children":[{"type":"text","value":"return true;","position":{"start":{"line":33,"column":5,"offset":1784},"end":{"line":33,"column":17,"offset":1796},"indent":[]}}],"position":{"start":{"line":33,"column":3,"offset":1782},"end":{"line":33,"column":19,"offset":1798},"indent":[]}},{"type":"text","value":" If you return true the inhibitor will block the execution of the command.\nTo allow a command return a falsey value.","position":{"start":{"line":33,"column":19,"offset":1798},"end":{"line":34,"column":42,"offset":1914},"indent":[1]}}],"position":{"start":{"line":33,"column":3,"offset":1782},"end":{"line":34,"column":42,"offset":1914},"indent":[1]}}],"position":{"start":{"line":33,"column":1,"offset":1780},"end":{"line":34,"column":42,"offset":1914},"indent":[1]}},{"type":"listItem","spread":false,"checked":null,"children":[{"type":"paragraph","children":[{"type":"strong","children":[{"type":"text","value":"return false;","position":{"start":{"line":35,"column":5,"offset":1919},"end":{"line":35,"column":18,"offset":1932},"indent":[]}}],"position":{"start":{"line":35,"column":3,"offset":1917},"end":{"line":35,"column":20,"offset":1934},"indent":[]}},{"type":"text","value":" If you return false the inhibitor will not block the error.","position":{"start":{"line":35,"column":20,"offset":1934},"end":{"line":35,"column":80,"offset":1994},"indent":[]}}],"position":{"start":{"line":35,"column":3,"offset":1917},"end":{"line":35,"column":80,"offset":1994},"indent":[]}}],"position":{"start":{"line":35,"column":1,"offset":1915},"end":{"line":35,"column":80,"offset":1994},"indent":[]}}],"position":{"start":{"line":33,"column":1,"offset":1780},"end":{"line":35,"column":80,"offset":1994},"indent":[1,1]}},{"type":"code","lang":"ts","meta":null,"value":"// If the command is not VIP only we can allow this command to execute\nif (!command.vipOnly) return false;\n\n// The bot's support server\nconst guild = cache.guilds.get(configs.channelIDsupportServerID);\n// If the command author is not in the server they won't have the vip role\nconst member = guild.members.get(message.author.id) || await getMember(guild.id, message.author.id);\n// Member doesn't exist so cancel the command\nif (!member) {\n\tsendResponse(message, `sorry, but you can not use this command until you become VIP. **Close the IRIS!!!**`)\n\treturn true;\n}\n\n// If the user has the vip role on the support server given by patreon allow the command\nif (member.roles.includes(configs.roleIDs.patreonVIPRoleID)) return false;\n\n// Alert the user they don't have vip and can't use the command\nsendResponse(message, `sorry, but you can not use this command until you become a VIP. I'm sorry, Teal'c. We'll go to Disneyland next year. I promise.`)\n// Cancel the command since the user does not have vip\nreturn true;","position":{"start":{"line":38,"column":1,"offset":1997},"end":{"line":59,"column":4,"offset":3022},"indent":[1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1]}},{"type":"export","value":"export const _frontmatter = {\"title\":\"Creating Inhibitors!\",\"metaTitle\":\"Creating An Inhibitor | Discordeno\",\"metaDescription\":\"Let's create our very own bot with Discordeno!\"}","position":{"start":{"line":62,"column":1,"offset":3025},"end":{"line":62,"column":177,"offset":3201},"indent":[]}}],"position":{"start":{"line":1,"column":1,"offset":0},"end":{"line":62,"column":177,"offset":3201}}},"scopeImports":["import * as React from 'react'"],"scopeIdentifiers":["React"],"body":"function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }\n\nfunction _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }\n\nfunction _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }\n\n/* @jsx mdx */\nvar _frontmatter = {\n \"title\": \"Creating Inhibitors!\",\n \"metaTitle\": \"Creating An Inhibitor | Discordeno\",\n \"metaDescription\": \"Let's create our very own bot with Discordeno!\"\n};\nvar layoutProps = {\n _frontmatter: _frontmatter\n};\nvar MDXLayout = \"wrapper\";\nreturn function MDXContent(_ref) {\n var components = _ref.components,\n props = _objectWithoutProperties(_ref, [\"components\"]);\n\n return mdx(MDXLayout, _extends({}, layoutProps, props, {\n components: components,\n mdxType: \"MDXLayout\"\n }), mdx(\"p\", null, \"Woah! You are almost half way done with understanding all of Discordeno. Amazing isn't it? Something you may have noticed in the last section was there were some options that prevented some commands from running like \", mdx(\"inlineCode\", {\n parentName: \"p\"\n }, \"dmOnly\"), \" or the permission options. we created a setting to prevent the monitor from running in certain channels. What if we wanted to do prevent commands from happening? How would we prevent commands from running?\"), mdx(\"h2\", null, \"What is an Inhibitor?\"), mdx(\"p\", null, \"An Inhibitor is very similar to how monitors work. A monitor runs on every message but an inhibitor runs on every command. Remember all those command options like cooldown, permissions, permissionLevel, nsfw, etc... Each and every one of these options has an inhibitor in that checks commands for these settings.\"), mdx(\"p\", null, \"Let's create our own inhibitor that would prevent commands from being used if the user is not a VIP user.\"), mdx(\"blockquote\", null, mdx(\"p\", {\n parentName: \"blockquote\"\n }, mdx(\"strong\", {\n parentName: \"p\"\n }, \"Note:\"), \" It is important to remember that everything below can be done with a simple permission level as well. We will create our own custom permission levels but for the purposes of this guide and to be able to learn about Inhibitors, we will be using an inhibitor.\")), mdx(\"h2\", null, \"Creating the File\"), mdx(\"p\", null, \"Let's start by creating a file inside the inhibitors folder called \", mdx(\"inlineCode\", {\n parentName: \"p\"\n }, \"boosted.ts\"), \" and paste the following snippet of code:\"), mdx(\"pre\", null, mdx(\"code\", _extends({\n parentName: \"pre\"\n }, {\n \"className\": \"language-ts\"\n }), \"import { botCache } from \\\"../../mod.ts\\\";\\n\\nbotCache.inhibitors.set(\\\"inhibitorname\\\", async function (message, command, guild) {\\n // Your code goes here\\n});\\n\")), mdx(\"p\", null, \"Inhibitors can take up to 3 arguments.\"), mdx(\"ul\", null, mdx(\"li\", {\n parentName: \"ul\"\n }, mdx(\"inlineCode\", {\n parentName: \"li\"\n }, \"message\"), \": The message object that triggered the command.\"), mdx(\"li\", {\n parentName: \"ul\"\n }, mdx(\"inlineCode\", {\n parentName: \"li\"\n }, \"command\"), \": The command object itself that was triggered.\"), mdx(\"li\", {\n parentName: \"ul\"\n }, mdx(\"inlineCode\", {\n parentName: \"li\"\n }, \"guild\"), \": The server guild object where this command was ran.\")), mdx(\"h2\", null, \"Understanding How Inhibitors Function\"), mdx(\"p\", null, \"To block a command you have to return a truthy value.\"), mdx(\"ul\", null, mdx(\"li\", {\n parentName: \"ul\"\n }, mdx(\"strong\", {\n parentName: \"li\"\n }, \"return true;\"), \" If you return true the inhibitor will block the execution of the command.\\nTo allow a command return a falsey value.\"), mdx(\"li\", {\n parentName: \"ul\"\n }, mdx(\"strong\", {\n parentName: \"li\"\n }, \"return false;\"), \" If you return false the inhibitor will not block the error.\")), mdx(\"pre\", null, mdx(\"code\", _extends({\n parentName: \"pre\"\n }, {\n \"className\": \"language-ts\"\n }), \"// If the command is not VIP only we can allow this command to execute\\nif (!command.vipOnly) return false;\\n\\n// The bot's support server\\nconst guild = cache.guilds.get(configs.channelIDsupportServerID);\\n// If the command author is not in the server they won't have the vip role\\nconst member = guild.members.get(message.author.id) || await getMember(guild.id, message.author.id);\\n// Member doesn't exist so cancel the command\\nif (!member) {\\n sendResponse(message, `sorry, but you can not use this command until you become VIP. **Close the IRIS!!!**`)\\n return true;\\n}\\n\\n// If the user has the vip role on the support server given by patreon allow the command\\nif (member.roles.includes(configs.roleIDs.patreonVIPRoleID)) return false;\\n\\n// Alert the user they don't have vip and can't use the command\\nsendResponse(message, `sorry, but you can not use this command until you become a VIP. I'm sorry, Teal'c. We'll go to Disneyland next year. I promise.`)\\n// Cancel the command since the user does not have vip\\nreturn true;\\n\")));\n}\n;\nMDXContent.isMDXComponent = true;","rawMDXOutput":"/* @jsx mdx */\nimport { mdx } from '@mdx-js/react';\n/* @jsx mdx */\n\nexport const _frontmatter = {\n \"title\": \"Creating Inhibitors!\",\n \"metaTitle\": \"Creating An Inhibitor | Discordeno\",\n \"metaDescription\": \"Let's create our very own bot with Discordeno!\"\n};\n\nconst layoutProps = {\n _frontmatter\n};\nconst MDXLayout = \"wrapper\"\nexport default function MDXContent({\n components,\n ...props\n}) {\n return \n

{`Woah! You are almost half way done with understanding all of Discordeno. Amazing isn't it? Something you may have noticed in the last section was there were some options that prevented some commands from running like `}{`dmOnly`}{` or the permission options. we created a setting to prevent the monitor from running in certain channels. What if we wanted to do prevent commands from happening? How would we prevent commands from running?`}

\n

{`What is an Inhibitor?`}

\n

{`An Inhibitor is very similar to how monitors work. A monitor runs on every message but an inhibitor runs on every command. Remember all those command options like cooldown, permissions, permissionLevel, nsfw, etc... Each and every one of these options has an inhibitor in that checks commands for these settings.`}

\n

{`Let's create our own inhibitor that would prevent commands from being used if the user is not a VIP user.`}

\n
\n

{`Note:`}{` It is important to remember that everything below can be done with a simple permission level as well. We will create our own custom permission levels but for the purposes of this guide and to be able to learn about Inhibitors, we will be using an inhibitor.`}

\n
\n

{`Creating the File`}

\n

{`Let's start by creating a file inside the inhibitors folder called `}{`boosted.ts`}{` and paste the following snippet of code:`}

\n
{`import { botCache } from \"../../mod.ts\";\n\nbotCache.inhibitors.set(\"inhibitorname\", async function (message, command, guild) {\n    // Your code goes here\n});\n`}
\n

{`Inhibitors can take up to 3 arguments.`}

\n
    \n
  • {`message`}{`: The message object that triggered the command.`}
  • \n
  • {`command`}{`: The command object itself that was triggered.`}
  • \n
  • {`guild`}{`: The server guild object where this command was ran.`}
  • \n
\n

{`Understanding How Inhibitors Function`}

\n

{`To block a command you have to return a truthy value.`}

\n
    \n
  • {`return true;`}{` If you return true the inhibitor will block the execution of the command.\nTo allow a command return a falsey value.`}
  • \n
  • {`return false;`}{` If you return false the inhibitor will not block the error.`}
  • \n
\n
{`// If the command is not VIP only we can allow this command to execute\nif (!command.vipOnly) return false;\n\n// The bot's support server\nconst guild = cache.guilds.get(configs.channelIDsupportServerID);\n// If the command author is not in the server they won't have the vip role\nconst member = guild.members.get(message.author.id) || await getMember(guild.id, message.author.id);\n// Member doesn't exist so cancel the command\nif (!member) {\n    sendResponse(message, \\`sorry, but you can not use this command until you become VIP. **Close the IRIS!!!**\\`)\n    return true;\n}\n\n// If the user has the vip role on the support server given by patreon allow the command\nif (member.roles.includes(configs.roleIDs.patreonVIPRoleID)) return false;\n\n// Alert the user they don't have vip and can't use the command\nsendResponse(message, \\`sorry, but you can not use this command until you become a VIP. I'm sorry, Teal'c. We'll go to Disneyland next year. I promise.\\`)\n// Cancel the command since the user does not have vip\nreturn true;\n`}
\n\n
;\n}\n\n;\nMDXContent.isMDXComponent = true;"}} \ No newline at end of file diff --git a/docs/.cache/caches/gatsby-plugin-mdx/diskstore-4a78dd7a552cc77c4f55d57f3443877b.json b/docs/.cache/caches/gatsby-plugin-mdx/diskstore-4a78dd7a552cc77c4f55d57f3443877b.json new file mode 100644 index 000000000..47627a014 --- /dev/null +++ b/docs/.cache/caches/gatsby-plugin-mdx/diskstore-4a78dd7a552cc77c4f55d57f3443877b.json @@ -0,0 +1 @@ +{"expireTime":9007200851634262000,"key":"gatsby-plugin-mdx-entire-payload-27b6e77ce1f11cbca2f3b3ffc3e73a60-","val":{"mdast":{"type":"root","children":[{"type":"paragraph","children":[{"type":"text","value":"Woah! You are almost half way done with understanding all of Discordeno. Amazing isn't it? Something you may have noticed in the last section was there were some options that prevented some commands from running like ","position":{"start":{"line":2,"column":1,"offset":1},"end":{"line":2,"column":218,"offset":218},"indent":[]}},{"type":"inlineCode","value":"dmOnly","position":{"start":{"line":2,"column":218,"offset":218},"end":{"line":2,"column":226,"offset":226},"indent":[]}},{"type":"text","value":" or the permission options. we created a setting to prevent the monitor from running in certain channels. What if we wanted to do prevent commands from happening? How would we prevent commands from running?","position":{"start":{"line":2,"column":226,"offset":226},"end":{"line":2,"column":432,"offset":432},"indent":[]}}],"position":{"start":{"line":2,"column":1,"offset":1},"end":{"line":2,"column":432,"offset":432},"indent":[]}},{"type":"heading","depth":2,"children":[{"type":"text","value":"What is an Inhibitor?","position":{"start":{"line":4,"column":4,"offset":437},"end":{"line":4,"column":25,"offset":458},"indent":[]}}],"position":{"start":{"line":4,"column":1,"offset":434},"end":{"line":4,"column":25,"offset":458},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"An Inhibitor is very similar to how monitors work. A monitor runs on every message but an inhibitor runs on every command. Remember all those command options like cooldown, permissions, permissionLevel, nsfw, etc... Each and every one of these options has an inhibitor in that checks commands for these settings.","position":{"start":{"line":6,"column":1,"offset":460},"end":{"line":6,"column":313,"offset":772},"indent":[]}}],"position":{"start":{"line":6,"column":1,"offset":460},"end":{"line":6,"column":313,"offset":772},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"Let's create our own inhibitor that would prevent commands from being used if the user is not a VIP user.","position":{"start":{"line":8,"column":1,"offset":774},"end":{"line":8,"column":106,"offset":879},"indent":[]}}],"position":{"start":{"line":8,"column":1,"offset":774},"end":{"line":8,"column":106,"offset":879},"indent":[]}},{"type":"blockquote","children":[{"type":"paragraph","children":[{"type":"strong","children":[{"type":"text","value":"Note:","position":{"start":{"line":10,"column":5,"offset":885},"end":{"line":10,"column":10,"offset":890},"indent":[]}}],"position":{"start":{"line":10,"column":3,"offset":883},"end":{"line":10,"column":12,"offset":892},"indent":[]}},{"type":"text","value":" It is important to remember that everything below can be done with a simple permission level as well. We will create our own custom permission levels but for the purposes of this guide and to be able to learn about Inhibitors, we will be using an inhibitor.","position":{"start":{"line":10,"column":12,"offset":892},"end":{"line":10,"column":270,"offset":1150},"indent":[]}}],"position":{"start":{"line":10,"column":3,"offset":883},"end":{"line":10,"column":270,"offset":1150},"indent":[]}}],"position":{"start":{"line":10,"column":1,"offset":881},"end":{"line":10,"column":270,"offset":1150},"indent":[]}},{"type":"heading","depth":2,"children":[{"type":"text","value":"Creating the File","position":{"start":{"line":12,"column":4,"offset":1155},"end":{"line":12,"column":21,"offset":1172},"indent":[]}}],"position":{"start":{"line":12,"column":1,"offset":1152},"end":{"line":12,"column":21,"offset":1172},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"Let's start by creating a file inside the inhibitors folder called ","position":{"start":{"line":14,"column":1,"offset":1174},"end":{"line":14,"column":68,"offset":1241},"indent":[]}},{"type":"inlineCode","value":"boosted.ts","position":{"start":{"line":14,"column":68,"offset":1241},"end":{"line":14,"column":80,"offset":1253},"indent":[]}},{"type":"text","value":" and paste the following snippet of code:","position":{"start":{"line":14,"column":80,"offset":1253},"end":{"line":14,"column":121,"offset":1294},"indent":[]}}],"position":{"start":{"line":14,"column":1,"offset":1174},"end":{"line":14,"column":121,"offset":1294},"indent":[]}},{"type":"code","lang":"ts","meta":null,"value":"import { botCache } from \"../../mod.ts\";\n\nbotCache.inhibitors.set(\"inhibitorname\", async function (message, command, guild) {\n\t// Your code goes here\n});","position":{"start":{"line":16,"column":1,"offset":1296},"end":{"line":22,"column":4,"offset":1459},"indent":[1,1,1,1,1,1]}},{"type":"paragraph","children":[{"type":"text","value":"Inhibitors can take up to 3 arguments.","position":{"start":{"line":24,"column":1,"offset":1461},"end":{"line":24,"column":39,"offset":1499},"indent":[]}}],"position":{"start":{"line":24,"column":1,"offset":1461},"end":{"line":24,"column":39,"offset":1499},"indent":[]}},{"type":"list","ordered":false,"start":null,"spread":false,"children":[{"type":"listItem","spread":false,"checked":null,"children":[{"type":"paragraph","children":[{"type":"inlineCode","value":"message","position":{"start":{"line":26,"column":3,"offset":1503},"end":{"line":26,"column":12,"offset":1512},"indent":[]}},{"type":"text","value":": The message object that triggered the command.","position":{"start":{"line":26,"column":12,"offset":1512},"end":{"line":26,"column":60,"offset":1560},"indent":[]}}],"position":{"start":{"line":26,"column":3,"offset":1503},"end":{"line":26,"column":60,"offset":1560},"indent":[]}}],"position":{"start":{"line":26,"column":1,"offset":1501},"end":{"line":26,"column":60,"offset":1560},"indent":[]}},{"type":"listItem","spread":false,"checked":null,"children":[{"type":"paragraph","children":[{"type":"inlineCode","value":"command","position":{"start":{"line":27,"column":3,"offset":1563},"end":{"line":27,"column":12,"offset":1572},"indent":[]}},{"type":"text","value":": The command object itself that was triggered.","position":{"start":{"line":27,"column":12,"offset":1572},"end":{"line":27,"column":59,"offset":1619},"indent":[]}}],"position":{"start":{"line":27,"column":3,"offset":1563},"end":{"line":27,"column":59,"offset":1619},"indent":[]}}],"position":{"start":{"line":27,"column":1,"offset":1561},"end":{"line":27,"column":59,"offset":1619},"indent":[]}},{"type":"listItem","spread":false,"checked":null,"children":[{"type":"paragraph","children":[{"type":"inlineCode","value":"guild","position":{"start":{"line":28,"column":3,"offset":1622},"end":{"line":28,"column":10,"offset":1629},"indent":[]}},{"type":"text","value":": The server guild object where this command was ran.","position":{"start":{"line":28,"column":10,"offset":1629},"end":{"line":28,"column":63,"offset":1682},"indent":[]}}],"position":{"start":{"line":28,"column":3,"offset":1622},"end":{"line":28,"column":63,"offset":1682},"indent":[]}}],"position":{"start":{"line":28,"column":1,"offset":1620},"end":{"line":28,"column":63,"offset":1682},"indent":[]}}],"position":{"start":{"line":26,"column":1,"offset":1501},"end":{"line":28,"column":63,"offset":1682},"indent":[1,1]}},{"type":"heading","depth":2,"children":[{"type":"text","value":"Understanding How Inhibitors Function","position":{"start":{"line":30,"column":4,"offset":1687},"end":{"line":30,"column":41,"offset":1724},"indent":[]}}],"position":{"start":{"line":30,"column":1,"offset":1684},"end":{"line":30,"column":41,"offset":1724},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"To block a command you have to return a truthy value.","position":{"start":{"line":32,"column":1,"offset":1726},"end":{"line":32,"column":54,"offset":1779},"indent":[]}}],"position":{"start":{"line":32,"column":1,"offset":1726},"end":{"line":32,"column":54,"offset":1779},"indent":[]}},{"type":"list","ordered":false,"start":null,"spread":false,"children":[{"type":"listItem","spread":false,"checked":null,"children":[{"type":"paragraph","children":[{"type":"strong","children":[{"type":"text","value":"return true;","position":{"start":{"line":33,"column":5,"offset":1784},"end":{"line":33,"column":17,"offset":1796},"indent":[]}}],"position":{"start":{"line":33,"column":3,"offset":1782},"end":{"line":33,"column":19,"offset":1798},"indent":[]}},{"type":"text","value":" If you return true the inhibitor will block the execution of the command.\nTo allow a command return a falsey value.","position":{"start":{"line":33,"column":19,"offset":1798},"end":{"line":34,"column":42,"offset":1914},"indent":[1]}}],"position":{"start":{"line":33,"column":3,"offset":1782},"end":{"line":34,"column":42,"offset":1914},"indent":[1]}}],"position":{"start":{"line":33,"column":1,"offset":1780},"end":{"line":34,"column":42,"offset":1914},"indent":[1]}},{"type":"listItem","spread":false,"checked":null,"children":[{"type":"paragraph","children":[{"type":"strong","children":[{"type":"text","value":"return false;","position":{"start":{"line":35,"column":5,"offset":1919},"end":{"line":35,"column":18,"offset":1932},"indent":[]}}],"position":{"start":{"line":35,"column":3,"offset":1917},"end":{"line":35,"column":20,"offset":1934},"indent":[]}},{"type":"text","value":" If you return false the inhibitor will not block the error.","position":{"start":{"line":35,"column":20,"offset":1934},"end":{"line":35,"column":80,"offset":1994},"indent":[]}}],"position":{"start":{"line":35,"column":3,"offset":1917},"end":{"line":35,"column":80,"offset":1994},"indent":[]}}],"position":{"start":{"line":35,"column":1,"offset":1915},"end":{"line":35,"column":80,"offset":1994},"indent":[]}}],"position":{"start":{"line":33,"column":1,"offset":1780},"end":{"line":35,"column":80,"offset":1994},"indent":[1,1]}},{"type":"code","lang":"ts","meta":null,"value":"// If the command is not VIP only we can allow this command to execute\nif (!command.vipOnly) return false;\n\n// The bot's support server\nconst guild = cache.guilds.get(configs.supportServerID);\n// If the command author is not in the server they won't have the vip role\nconst member = guild.members.get(message.author.id) || await getMember(guild.id, message.author.id);\n// Member doesn't exist so cancel the command\nif (!member) return true;\n\n// If the user has the vip role on the support server given by patreon allow the command\nif (member.roles.includes(configs.)) return false;\n\n// The user is NOT VIP so we throw an error\nthrow `The ${command.name} is only allowed for VIP users.`","position":{"start":{"line":38,"column":1,"offset":1997},"end":{"line":54,"column":4,"offset":2692},"indent":[1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1]}},{"type":"export","value":"export const _frontmatter = {\"title\":\"Creating Inhibitors!\",\"metaTitle\":\"Creating An Inhibitor | Discordeno\",\"metaDescription\":\"Let's create our very own bot with Discordeno!\"}","position":{"start":{"line":57,"column":1,"offset":2695},"end":{"line":57,"column":177,"offset":2871},"indent":[]}}],"position":{"start":{"line":1,"column":1,"offset":0},"end":{"line":57,"column":177,"offset":2871}}},"scopeImports":["import * as React from 'react'"],"scopeIdentifiers":["React"],"body":"function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }\n\nfunction _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }\n\nfunction _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }\n\n/* @jsx mdx */\nvar _frontmatter = {\n \"title\": \"Creating Inhibitors!\",\n \"metaTitle\": \"Creating An Inhibitor | Discordeno\",\n \"metaDescription\": \"Let's create our very own bot with Discordeno!\"\n};\nvar layoutProps = {\n _frontmatter: _frontmatter\n};\nvar MDXLayout = \"wrapper\";\nreturn function MDXContent(_ref) {\n var components = _ref.components,\n props = _objectWithoutProperties(_ref, [\"components\"]);\n\n return mdx(MDXLayout, _extends({}, layoutProps, props, {\n components: components,\n mdxType: \"MDXLayout\"\n }), mdx(\"p\", null, \"Woah! You are almost half way done with understanding all of Discordeno. Amazing isn't it? Something you may have noticed in the last section was there were some options that prevented some commands from running like \", mdx(\"inlineCode\", {\n parentName: \"p\"\n }, \"dmOnly\"), \" or the permission options. we created a setting to prevent the monitor from running in certain channels. What if we wanted to do prevent commands from happening? How would we prevent commands from running?\"), mdx(\"h2\", null, \"What is an Inhibitor?\"), mdx(\"p\", null, \"An Inhibitor is very similar to how monitors work. A monitor runs on every message but an inhibitor runs on every command. Remember all those command options like cooldown, permissions, permissionLevel, nsfw, etc... Each and every one of these options has an inhibitor in that checks commands for these settings.\"), mdx(\"p\", null, \"Let's create our own inhibitor that would prevent commands from being used if the user is not a VIP user.\"), mdx(\"blockquote\", null, mdx(\"p\", {\n parentName: \"blockquote\"\n }, mdx(\"strong\", {\n parentName: \"p\"\n }, \"Note:\"), \" It is important to remember that everything below can be done with a simple permission level as well. We will create our own custom permission levels but for the purposes of this guide and to be able to learn about Inhibitors, we will be using an inhibitor.\")), mdx(\"h2\", null, \"Creating the File\"), mdx(\"p\", null, \"Let's start by creating a file inside the inhibitors folder called \", mdx(\"inlineCode\", {\n parentName: \"p\"\n }, \"boosted.ts\"), \" and paste the following snippet of code:\"), mdx(\"pre\", null, mdx(\"code\", _extends({\n parentName: \"pre\"\n }, {\n \"className\": \"language-ts\"\n }), \"import { botCache } from \\\"../../mod.ts\\\";\\n\\nbotCache.inhibitors.set(\\\"inhibitorname\\\", async function (message, command, guild) {\\n // Your code goes here\\n});\\n\")), mdx(\"p\", null, \"Inhibitors can take up to 3 arguments.\"), mdx(\"ul\", null, mdx(\"li\", {\n parentName: \"ul\"\n }, mdx(\"inlineCode\", {\n parentName: \"li\"\n }, \"message\"), \": The message object that triggered the command.\"), mdx(\"li\", {\n parentName: \"ul\"\n }, mdx(\"inlineCode\", {\n parentName: \"li\"\n }, \"command\"), \": The command object itself that was triggered.\"), mdx(\"li\", {\n parentName: \"ul\"\n }, mdx(\"inlineCode\", {\n parentName: \"li\"\n }, \"guild\"), \": The server guild object where this command was ran.\")), mdx(\"h2\", null, \"Understanding How Inhibitors Function\"), mdx(\"p\", null, \"To block a command you have to return a truthy value.\"), mdx(\"ul\", null, mdx(\"li\", {\n parentName: \"ul\"\n }, mdx(\"strong\", {\n parentName: \"li\"\n }, \"return true;\"), \" If you return true the inhibitor will block the execution of the command.\\nTo allow a command return a falsey value.\"), mdx(\"li\", {\n parentName: \"ul\"\n }, mdx(\"strong\", {\n parentName: \"li\"\n }, \"return false;\"), \" If you return false the inhibitor will not block the error.\")), mdx(\"pre\", null, mdx(\"code\", _extends({\n parentName: \"pre\"\n }, {\n \"className\": \"language-ts\"\n }), \"// If the command is not VIP only we can allow this command to execute\\nif (!command.vipOnly) return false;\\n\\n// The bot's support server\\nconst guild = cache.guilds.get(configs.supportServerID);\\n// If the command author is not in the server they won't have the vip role\\nconst member = guild.members.get(message.author.id) || await getMember(guild.id, message.author.id);\\n// Member doesn't exist so cancel the command\\nif (!member) return true;\\n\\n// If the user has the vip role on the support server given by patreon allow the command\\nif (member.roles.includes(configs.)) return false;\\n\\n// The user is NOT VIP so we throw an error\\nthrow `The ${command.name} is only allowed for VIP users.`\\n\")));\n}\n;\nMDXContent.isMDXComponent = true;","rawMDXOutput":"/* @jsx mdx */\nimport { mdx } from '@mdx-js/react';\n/* @jsx mdx */\n\nexport const _frontmatter = {\n \"title\": \"Creating Inhibitors!\",\n \"metaTitle\": \"Creating An Inhibitor | Discordeno\",\n \"metaDescription\": \"Let's create our very own bot with Discordeno!\"\n};\n\nconst layoutProps = {\n _frontmatter\n};\nconst MDXLayout = \"wrapper\"\nexport default function MDXContent({\n components,\n ...props\n}) {\n return \n

{`Woah! You are almost half way done with understanding all of Discordeno. Amazing isn't it? Something you may have noticed in the last section was there were some options that prevented some commands from running like `}{`dmOnly`}{` or the permission options. we created a setting to prevent the monitor from running in certain channels. What if we wanted to do prevent commands from happening? How would we prevent commands from running?`}

\n

{`What is an Inhibitor?`}

\n

{`An Inhibitor is very similar to how monitors work. A monitor runs on every message but an inhibitor runs on every command. Remember all those command options like cooldown, permissions, permissionLevel, nsfw, etc... Each and every one of these options has an inhibitor in that checks commands for these settings.`}

\n

{`Let's create our own inhibitor that would prevent commands from being used if the user is not a VIP user.`}

\n
\n

{`Note:`}{` It is important to remember that everything below can be done with a simple permission level as well. We will create our own custom permission levels but for the purposes of this guide and to be able to learn about Inhibitors, we will be using an inhibitor.`}

\n
\n

{`Creating the File`}

\n

{`Let's start by creating a file inside the inhibitors folder called `}{`boosted.ts`}{` and paste the following snippet of code:`}

\n
{`import { botCache } from \"../../mod.ts\";\n\nbotCache.inhibitors.set(\"inhibitorname\", async function (message, command, guild) {\n    // Your code goes here\n});\n`}
\n

{`Inhibitors can take up to 3 arguments.`}

\n
    \n
  • {`message`}{`: The message object that triggered the command.`}
  • \n
  • {`command`}{`: The command object itself that was triggered.`}
  • \n
  • {`guild`}{`: The server guild object where this command was ran.`}
  • \n
\n

{`Understanding How Inhibitors Function`}

\n

{`To block a command you have to return a truthy value.`}

\n
    \n
  • {`return true;`}{` If you return true the inhibitor will block the execution of the command.\nTo allow a command return a falsey value.`}
  • \n
  • {`return false;`}{` If you return false the inhibitor will not block the error.`}
  • \n
\n
{`// If the command is not VIP only we can allow this command to execute\nif (!command.vipOnly) return false;\n\n// The bot's support server\nconst guild = cache.guilds.get(configs.supportServerID);\n// If the command author is not in the server they won't have the vip role\nconst member = guild.members.get(message.author.id) || await getMember(guild.id, message.author.id);\n// Member doesn't exist so cancel the command\nif (!member) return true;\n\n// If the user has the vip role on the support server given by patreon allow the command\nif (member.roles.includes(configs.)) return false;\n\n// The user is NOT VIP so we throw an error\nthrow \\`The \\${command.name} is only allowed for VIP users.\\`\n`}
\n\n
;\n}\n\n;\nMDXContent.isMDXComponent = true;"}} \ No newline at end of file diff --git a/docs/.cache/caches/gatsby-plugin-mdx/diskstore-4f6d0a38ed5cb1fc487e4b0530ac3758.json b/docs/.cache/caches/gatsby-plugin-mdx/diskstore-4f6d0a38ed5cb1fc487e4b0530ac3758.json new file mode 100644 index 000000000..81b96c4d5 --- /dev/null +++ b/docs/.cache/caches/gatsby-plugin-mdx/diskstore-4f6d0a38ed5cb1fc487e4b0530ac3758.json @@ -0,0 +1 @@ +{"expireTime":9007200851633260000,"key":"gatsby-plugin-mdx-entire-payload-83e089fa0e621d2a0587fd8cddfb7b46-","val":{"mdast":{"type":"root","children":[{"type":"paragraph","children":[{"type":"text","value":"Woah! You are almost half way done with understanding all of Discordeno. Amazing isn't it? Something you may have noticed in the last section was there were some options that prevented some commands from running like ","position":{"start":{"line":2,"column":1,"offset":1},"end":{"line":2,"column":218,"offset":218},"indent":[]}},{"type":"inlineCode","value":"dmOnly","position":{"start":{"line":2,"column":218,"offset":218},"end":{"line":2,"column":226,"offset":226},"indent":[]}},{"type":"text","value":" or the permission options. we created a setting to prevent the monitor from running in certain channels. What if we wanted to do prevent commands from happening? How would we prevent commands from running?","position":{"start":{"line":2,"column":226,"offset":226},"end":{"line":2,"column":432,"offset":432},"indent":[]}}],"position":{"start":{"line":2,"column":1,"offset":1},"end":{"line":2,"column":432,"offset":432},"indent":[]}},{"type":"heading","depth":2,"children":[{"type":"text","value":"What is an Inhibitor?","position":{"start":{"line":4,"column":4,"offset":437},"end":{"line":4,"column":25,"offset":458},"indent":[]}}],"position":{"start":{"line":4,"column":1,"offset":434},"end":{"line":4,"column":25,"offset":458},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"An Inhibitor is very similar to how monitors work. A monitor runs on every message but an inhibitor runs on every command. Remember all those command options like cooldown, permissions, permissionLevel, nsfw, etc... Each and every one of these options has an inhibitor in that checks commands for these settings.","position":{"start":{"line":6,"column":1,"offset":460},"end":{"line":6,"column":313,"offset":772},"indent":[]}}],"position":{"start":{"line":6,"column":1,"offset":460},"end":{"line":6,"column":313,"offset":772},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"Let's create our own inhibitor that would prevent commands from being used if the user is not a VIP user.","position":{"start":{"line":8,"column":1,"offset":774},"end":{"line":8,"column":106,"offset":879},"indent":[]}}],"position":{"start":{"line":8,"column":1,"offset":774},"end":{"line":8,"column":106,"offset":879},"indent":[]}},{"type":"blockquote","children":[{"type":"paragraph","children":[{"type":"strong","children":[{"type":"text","value":"Note:","position":{"start":{"line":10,"column":5,"offset":885},"end":{"line":10,"column":10,"offset":890},"indent":[]}}],"position":{"start":{"line":10,"column":3,"offset":883},"end":{"line":10,"column":12,"offset":892},"indent":[]}},{"type":"text","value":" It is important to remember that everything below can be done with a simple permission level as well. We will create our own custom permission levels but for the purposes of this guide and to be able to learn about Inhibitors, we will be using an inhibitor.","position":{"start":{"line":10,"column":12,"offset":892},"end":{"line":10,"column":270,"offset":1150},"indent":[]}}],"position":{"start":{"line":10,"column":3,"offset":883},"end":{"line":10,"column":270,"offset":1150},"indent":[]}}],"position":{"start":{"line":10,"column":1,"offset":881},"end":{"line":10,"column":270,"offset":1150},"indent":[]}},{"type":"heading","depth":2,"children":[{"type":"text","value":"Creating the File","position":{"start":{"line":12,"column":4,"offset":1155},"end":{"line":12,"column":21,"offset":1172},"indent":[]}}],"position":{"start":{"line":12,"column":1,"offset":1152},"end":{"line":12,"column":21,"offset":1172},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"Let's start by creating a file inside the inhibitors folder called ","position":{"start":{"line":14,"column":1,"offset":1174},"end":{"line":14,"column":68,"offset":1241},"indent":[]}},{"type":"inlineCode","value":"vipOnly.ts","position":{"start":{"line":14,"column":68,"offset":1241},"end":{"line":14,"column":80,"offset":1253},"indent":[]}},{"type":"text","value":" and paste the following snippet of code:","position":{"start":{"line":14,"column":80,"offset":1253},"end":{"line":14,"column":121,"offset":1294},"indent":[]}}],"position":{"start":{"line":14,"column":1,"offset":1174},"end":{"line":14,"column":121,"offset":1294},"indent":[]}},{"type":"code","lang":"ts","meta":null,"value":"import { botCache } from \"../../mod.ts\";\n\nbotCache.inhibitors.set(\"inhibitorname\", async function (message, command, guild) {\n\t// Your code goes here\n});","position":{"start":{"line":16,"column":1,"offset":1296},"end":{"line":22,"column":4,"offset":1459},"indent":[1,1,1,1,1,1]}},{"type":"paragraph","children":[{"type":"text","value":"Inhibitors can take up to 3 arguments.","position":{"start":{"line":24,"column":1,"offset":1461},"end":{"line":24,"column":39,"offset":1499},"indent":[]}}],"position":{"start":{"line":24,"column":1,"offset":1461},"end":{"line":24,"column":39,"offset":1499},"indent":[]}},{"type":"list","ordered":false,"start":null,"spread":false,"children":[{"type":"listItem","spread":false,"checked":null,"children":[{"type":"paragraph","children":[{"type":"inlineCode","value":"message","position":{"start":{"line":26,"column":3,"offset":1503},"end":{"line":26,"column":12,"offset":1512},"indent":[]}},{"type":"text","value":": The message object that triggered the command.","position":{"start":{"line":26,"column":12,"offset":1512},"end":{"line":26,"column":60,"offset":1560},"indent":[]}}],"position":{"start":{"line":26,"column":3,"offset":1503},"end":{"line":26,"column":60,"offset":1560},"indent":[]}}],"position":{"start":{"line":26,"column":1,"offset":1501},"end":{"line":26,"column":60,"offset":1560},"indent":[]}},{"type":"listItem","spread":false,"checked":null,"children":[{"type":"paragraph","children":[{"type":"inlineCode","value":"command","position":{"start":{"line":27,"column":3,"offset":1563},"end":{"line":27,"column":12,"offset":1572},"indent":[]}},{"type":"text","value":": The command object itself that was triggered.","position":{"start":{"line":27,"column":12,"offset":1572},"end":{"line":27,"column":59,"offset":1619},"indent":[]}}],"position":{"start":{"line":27,"column":3,"offset":1563},"end":{"line":27,"column":59,"offset":1619},"indent":[]}}],"position":{"start":{"line":27,"column":1,"offset":1561},"end":{"line":27,"column":59,"offset":1619},"indent":[]}},{"type":"listItem","spread":false,"checked":null,"children":[{"type":"paragraph","children":[{"type":"inlineCode","value":"guild","position":{"start":{"line":28,"column":3,"offset":1622},"end":{"line":28,"column":10,"offset":1629},"indent":[]}},{"type":"text","value":": The server guild object where this command was ran.","position":{"start":{"line":28,"column":10,"offset":1629},"end":{"line":28,"column":63,"offset":1682},"indent":[]}}],"position":{"start":{"line":28,"column":3,"offset":1622},"end":{"line":28,"column":63,"offset":1682},"indent":[]}}],"position":{"start":{"line":28,"column":1,"offset":1620},"end":{"line":28,"column":63,"offset":1682},"indent":[]}}],"position":{"start":{"line":26,"column":1,"offset":1501},"end":{"line":28,"column":63,"offset":1682},"indent":[1,1]}},{"type":"heading","depth":2,"children":[{"type":"text","value":"Understanding How Inhibitors Function","position":{"start":{"line":30,"column":4,"offset":1687},"end":{"line":30,"column":41,"offset":1724},"indent":[]}}],"position":{"start":{"line":30,"column":1,"offset":1684},"end":{"line":30,"column":41,"offset":1724},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"To block a command you have to return a truthy value.","position":{"start":{"line":32,"column":1,"offset":1726},"end":{"line":32,"column":54,"offset":1779},"indent":[]}}],"position":{"start":{"line":32,"column":1,"offset":1726},"end":{"line":32,"column":54,"offset":1779},"indent":[]}},{"type":"list","ordered":false,"start":null,"spread":false,"children":[{"type":"listItem","spread":false,"checked":null,"children":[{"type":"paragraph","children":[{"type":"strong","children":[{"type":"text","value":"return true;","position":{"start":{"line":33,"column":5,"offset":1784},"end":{"line":33,"column":17,"offset":1796},"indent":[]}}],"position":{"start":{"line":33,"column":3,"offset":1782},"end":{"line":33,"column":19,"offset":1798},"indent":[]}},{"type":"text","value":" If you return true the inhibitor will block the execution of the command.\nTo allow a command return a falsey value.","position":{"start":{"line":33,"column":19,"offset":1798},"end":{"line":34,"column":42,"offset":1914},"indent":[1]}}],"position":{"start":{"line":33,"column":3,"offset":1782},"end":{"line":34,"column":42,"offset":1914},"indent":[1]}}],"position":{"start":{"line":33,"column":1,"offset":1780},"end":{"line":34,"column":42,"offset":1914},"indent":[1]}},{"type":"listItem","spread":false,"checked":null,"children":[{"type":"paragraph","children":[{"type":"strong","children":[{"type":"text","value":"return false;","position":{"start":{"line":35,"column":5,"offset":1919},"end":{"line":35,"column":18,"offset":1932},"indent":[]}}],"position":{"start":{"line":35,"column":3,"offset":1917},"end":{"line":35,"column":20,"offset":1934},"indent":[]}},{"type":"text","value":" If you return false the inhibitor will not block the error.","position":{"start":{"line":35,"column":20,"offset":1934},"end":{"line":35,"column":80,"offset":1994},"indent":[]}}],"position":{"start":{"line":35,"column":3,"offset":1917},"end":{"line":35,"column":80,"offset":1994},"indent":[]}}],"position":{"start":{"line":35,"column":1,"offset":1915},"end":{"line":35,"column":80,"offset":1994},"indent":[]}}],"position":{"start":{"line":33,"column":1,"offset":1780},"end":{"line":35,"column":80,"offset":1994},"indent":[1,1]}},{"type":"code","lang":"ts","meta":null,"value":"// If the command is not VIP only we can allow this command to execute\nif (!command.vipOnly) return false;\n\n// Check if the user is VIP\nconst userIsVIP = message.author.settings.get(`isVIP`)\n// The user is VIP so we can allow this command to be used\nif (userIsVIP) return false;\n\n// The user is NOT VIP so we throw an error\nthrow `The ${command.name} is only allowed for VIP users.`","position":{"start":{"line":38,"column":1,"offset":1997},"end":{"line":49,"column":4,"offset":2389},"indent":[1,1,1,1,1,1,1,1,1,1,1]}},{"type":"export","value":"export const _frontmatter = {\"title\":\"Creating Inhibitors!\",\"metaTitle\":\"Creating An Inhibitor | Discordeno\",\"metaDescription\":\"Let's create our very own bot with Discordeno!\"}","position":{"start":{"line":52,"column":1,"offset":2392},"end":{"line":52,"column":177,"offset":2568},"indent":[]}}],"position":{"start":{"line":1,"column":1,"offset":0},"end":{"line":52,"column":177,"offset":2568}}},"scopeImports":["import * as React from 'react'"],"scopeIdentifiers":["React"],"body":"function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }\n\nfunction _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }\n\nfunction _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }\n\n/* @jsx mdx */\nvar _frontmatter = {\n \"title\": \"Creating Inhibitors!\",\n \"metaTitle\": \"Creating An Inhibitor | Discordeno\",\n \"metaDescription\": \"Let's create our very own bot with Discordeno!\"\n};\nvar layoutProps = {\n _frontmatter: _frontmatter\n};\nvar MDXLayout = \"wrapper\";\nreturn function MDXContent(_ref) {\n var components = _ref.components,\n props = _objectWithoutProperties(_ref, [\"components\"]);\n\n return mdx(MDXLayout, _extends({}, layoutProps, props, {\n components: components,\n mdxType: \"MDXLayout\"\n }), mdx(\"p\", null, \"Woah! You are almost half way done with understanding all of Discordeno. Amazing isn't it? Something you may have noticed in the last section was there were some options that prevented some commands from running like \", mdx(\"inlineCode\", {\n parentName: \"p\"\n }, \"dmOnly\"), \" or the permission options. we created a setting to prevent the monitor from running in certain channels. What if we wanted to do prevent commands from happening? How would we prevent commands from running?\"), mdx(\"h2\", null, \"What is an Inhibitor?\"), mdx(\"p\", null, \"An Inhibitor is very similar to how monitors work. A monitor runs on every message but an inhibitor runs on every command. Remember all those command options like cooldown, permissions, permissionLevel, nsfw, etc... Each and every one of these options has an inhibitor in that checks commands for these settings.\"), mdx(\"p\", null, \"Let's create our own inhibitor that would prevent commands from being used if the user is not a VIP user.\"), mdx(\"blockquote\", null, mdx(\"p\", {\n parentName: \"blockquote\"\n }, mdx(\"strong\", {\n parentName: \"p\"\n }, \"Note:\"), \" It is important to remember that everything below can be done with a simple permission level as well. We will create our own custom permission levels but for the purposes of this guide and to be able to learn about Inhibitors, we will be using an inhibitor.\")), mdx(\"h2\", null, \"Creating the File\"), mdx(\"p\", null, \"Let's start by creating a file inside the inhibitors folder called \", mdx(\"inlineCode\", {\n parentName: \"p\"\n }, \"vipOnly.ts\"), \" and paste the following snippet of code:\"), mdx(\"pre\", null, mdx(\"code\", _extends({\n parentName: \"pre\"\n }, {\n \"className\": \"language-ts\"\n }), \"import { botCache } from \\\"../../mod.ts\\\";\\n\\nbotCache.inhibitors.set(\\\"inhibitorname\\\", async function (message, command, guild) {\\n // Your code goes here\\n});\\n\")), mdx(\"p\", null, \"Inhibitors can take up to 3 arguments.\"), mdx(\"ul\", null, mdx(\"li\", {\n parentName: \"ul\"\n }, mdx(\"inlineCode\", {\n parentName: \"li\"\n }, \"message\"), \": The message object that triggered the command.\"), mdx(\"li\", {\n parentName: \"ul\"\n }, mdx(\"inlineCode\", {\n parentName: \"li\"\n }, \"command\"), \": The command object itself that was triggered.\"), mdx(\"li\", {\n parentName: \"ul\"\n }, mdx(\"inlineCode\", {\n parentName: \"li\"\n }, \"guild\"), \": The server guild object where this command was ran.\")), mdx(\"h2\", null, \"Understanding How Inhibitors Function\"), mdx(\"p\", null, \"To block a command you have to return a truthy value.\"), mdx(\"ul\", null, mdx(\"li\", {\n parentName: \"ul\"\n }, mdx(\"strong\", {\n parentName: \"li\"\n }, \"return true;\"), \" If you return true the inhibitor will block the execution of the command.\\nTo allow a command return a falsey value.\"), mdx(\"li\", {\n parentName: \"ul\"\n }, mdx(\"strong\", {\n parentName: \"li\"\n }, \"return false;\"), \" If you return false the inhibitor will not block the error.\")), mdx(\"pre\", null, mdx(\"code\", _extends({\n parentName: \"pre\"\n }, {\n \"className\": \"language-ts\"\n }), \"// If the command is not VIP only we can allow this command to execute\\nif (!command.vipOnly) return false;\\n\\n// Check if the user is VIP\\nconst userIsVIP = message.author.settings.get(`isVIP`)\\n// The user is VIP so we can allow this command to be used\\nif (userIsVIP) return false;\\n\\n// The user is NOT VIP so we throw an error\\nthrow `The ${command.name} is only allowed for VIP users.`\\n\")));\n}\n;\nMDXContent.isMDXComponent = true;","rawMDXOutput":"/* @jsx mdx */\nimport { mdx } from '@mdx-js/react';\n/* @jsx mdx */\n\nexport const _frontmatter = {\n \"title\": \"Creating Inhibitors!\",\n \"metaTitle\": \"Creating An Inhibitor | Discordeno\",\n \"metaDescription\": \"Let's create our very own bot with Discordeno!\"\n};\n\nconst layoutProps = {\n _frontmatter\n};\nconst MDXLayout = \"wrapper\"\nexport default function MDXContent({\n components,\n ...props\n}) {\n return \n

{`Woah! You are almost half way done with understanding all of Discordeno. Amazing isn't it? Something you may have noticed in the last section was there were some options that prevented some commands from running like `}{`dmOnly`}{` or the permission options. we created a setting to prevent the monitor from running in certain channels. What if we wanted to do prevent commands from happening? How would we prevent commands from running?`}

\n

{`What is an Inhibitor?`}

\n

{`An Inhibitor is very similar to how monitors work. A monitor runs on every message but an inhibitor runs on every command. Remember all those command options like cooldown, permissions, permissionLevel, nsfw, etc... Each and every one of these options has an inhibitor in that checks commands for these settings.`}

\n

{`Let's create our own inhibitor that would prevent commands from being used if the user is not a VIP user.`}

\n
\n

{`Note:`}{` It is important to remember that everything below can be done with a simple permission level as well. We will create our own custom permission levels but for the purposes of this guide and to be able to learn about Inhibitors, we will be using an inhibitor.`}

\n
\n

{`Creating the File`}

\n

{`Let's start by creating a file inside the inhibitors folder called `}{`vipOnly.ts`}{` and paste the following snippet of code:`}

\n
{`import { botCache } from \"../../mod.ts\";\n\nbotCache.inhibitors.set(\"inhibitorname\", async function (message, command, guild) {\n    // Your code goes here\n});\n`}
\n

{`Inhibitors can take up to 3 arguments.`}

\n
    \n
  • {`message`}{`: The message object that triggered the command.`}
  • \n
  • {`command`}{`: The command object itself that was triggered.`}
  • \n
  • {`guild`}{`: The server guild object where this command was ran.`}
  • \n
\n

{`Understanding How Inhibitors Function`}

\n

{`To block a command you have to return a truthy value.`}

\n
    \n
  • {`return true;`}{` If you return true the inhibitor will block the execution of the command.\nTo allow a command return a falsey value.`}
  • \n
  • {`return false;`}{` If you return false the inhibitor will not block the error.`}
  • \n
\n
{`// If the command is not VIP only we can allow this command to execute\nif (!command.vipOnly) return false;\n\n// Check if the user is VIP\nconst userIsVIP = message.author.settings.get(\\`isVIP\\`)\n// The user is VIP so we can allow this command to be used\nif (userIsVIP) return false;\n\n// The user is NOT VIP so we throw an error\nthrow \\`The \\${command.name} is only allowed for VIP users.\\`\n`}
\n\n
;\n}\n\n;\nMDXContent.isMDXComponent = true;"}} \ No newline at end of file diff --git a/docs/.cache/caches/gatsby-plugin-mdx/diskstore-4f83dd443785eb26ad81572a5b149d6e.json b/docs/.cache/caches/gatsby-plugin-mdx/diskstore-4f83dd443785eb26ad81572a5b149d6e.json new file mode 100644 index 000000000..b8fbe330b --- /dev/null +++ b/docs/.cache/caches/gatsby-plugin-mdx/diskstore-4f83dd443785eb26ad81572a5b149d6e.json @@ -0,0 +1 @@ +{"expireTime":9007200851634802000,"key":"gatsby-plugin-mdx-entire-payload-1f89e0a41ac5e8c851742688f8c78431-","val":{"mdast":{"type":"root","children":[{"type":"paragraph","children":[{"type":"text","value":"Woah! You are almost half way done with understanding all of Discordeno. Amazing isn't it? Something you may have noticed in the last section was there were some options that prevented some commands from running like ","position":{"start":{"line":2,"column":1,"offset":1},"end":{"line":2,"column":218,"offset":218},"indent":[]}},{"type":"inlineCode","value":"dmOnly","position":{"start":{"line":2,"column":218,"offset":218},"end":{"line":2,"column":226,"offset":226},"indent":[]}},{"type":"text","value":" or the permission options. we created a setting to prevent the monitor from running in certain channels. What if we wanted to do prevent commands from happening? How would we prevent commands from running?","position":{"start":{"line":2,"column":226,"offset":226},"end":{"line":2,"column":432,"offset":432},"indent":[]}}],"position":{"start":{"line":2,"column":1,"offset":1},"end":{"line":2,"column":432,"offset":432},"indent":[]}},{"type":"heading","depth":2,"children":[{"type":"text","value":"What is an Inhibitor?","position":{"start":{"line":4,"column":4,"offset":437},"end":{"line":4,"column":25,"offset":458},"indent":[]}}],"position":{"start":{"line":4,"column":1,"offset":434},"end":{"line":4,"column":25,"offset":458},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"An Inhibitor is very similar to how monitors work. A monitor runs on every message but an inhibitor runs on every command. Remember all those command options like cooldown, permissions, permissionLevel, nsfw, etc... Each and every one of these options has an inhibitor in that checks commands for these settings.","position":{"start":{"line":6,"column":1,"offset":460},"end":{"line":6,"column":313,"offset":772},"indent":[]}}],"position":{"start":{"line":6,"column":1,"offset":460},"end":{"line":6,"column":313,"offset":772},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"Let's create our own inhibitor that would prevent commands from being used if the user is not a VIP user.","position":{"start":{"line":8,"column":1,"offset":774},"end":{"line":8,"column":106,"offset":879},"indent":[]}}],"position":{"start":{"line":8,"column":1,"offset":774},"end":{"line":8,"column":106,"offset":879},"indent":[]}},{"type":"blockquote","children":[{"type":"paragraph","children":[{"type":"strong","children":[{"type":"text","value":"Note:","position":{"start":{"line":10,"column":5,"offset":885},"end":{"line":10,"column":10,"offset":890},"indent":[]}}],"position":{"start":{"line":10,"column":3,"offset":883},"end":{"line":10,"column":12,"offset":892},"indent":[]}},{"type":"text","value":" It is important to remember that everything below can be done with a simple permission level as well. We will create our own custom permission levels but for the purposes of this guide and to be able to learn about Inhibitors, we will be using an inhibitor.","position":{"start":{"line":10,"column":12,"offset":892},"end":{"line":10,"column":270,"offset":1150},"indent":[]}}],"position":{"start":{"line":10,"column":3,"offset":883},"end":{"line":10,"column":270,"offset":1150},"indent":[]}}],"position":{"start":{"line":10,"column":1,"offset":881},"end":{"line":10,"column":270,"offset":1150},"indent":[]}},{"type":"heading","depth":2,"children":[{"type":"text","value":"Creating the File","position":{"start":{"line":12,"column":4,"offset":1155},"end":{"line":12,"column":21,"offset":1172},"indent":[]}}],"position":{"start":{"line":12,"column":1,"offset":1152},"end":{"line":12,"column":21,"offset":1172},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"Let's start by creating a file inside the inhibitors folder called ","position":{"start":{"line":14,"column":1,"offset":1174},"end":{"line":14,"column":68,"offset":1241},"indent":[]}},{"type":"inlineCode","value":"boosted.ts","position":{"start":{"line":14,"column":68,"offset":1241},"end":{"line":14,"column":80,"offset":1253},"indent":[]}},{"type":"text","value":" and paste the following snippet of code:","position":{"start":{"line":14,"column":80,"offset":1253},"end":{"line":14,"column":121,"offset":1294},"indent":[]}}],"position":{"start":{"line":14,"column":1,"offset":1174},"end":{"line":14,"column":121,"offset":1294},"indent":[]}},{"type":"code","lang":"ts","meta":null,"value":"import { botCache } from \"../../mod.ts\";\n\nbotCache.inhibitors.set(\"inhibitorname\", async function (message, command, guild) {\n\t// Your code goes here\n});","position":{"start":{"line":16,"column":1,"offset":1296},"end":{"line":22,"column":4,"offset":1459},"indent":[1,1,1,1,1,1]}},{"type":"paragraph","children":[{"type":"text","value":"Inhibitors can take up to 3 arguments.","position":{"start":{"line":24,"column":1,"offset":1461},"end":{"line":24,"column":39,"offset":1499},"indent":[]}}],"position":{"start":{"line":24,"column":1,"offset":1461},"end":{"line":24,"column":39,"offset":1499},"indent":[]}},{"type":"list","ordered":false,"start":null,"spread":false,"children":[{"type":"listItem","spread":false,"checked":null,"children":[{"type":"paragraph","children":[{"type":"inlineCode","value":"message","position":{"start":{"line":26,"column":3,"offset":1503},"end":{"line":26,"column":12,"offset":1512},"indent":[]}},{"type":"text","value":": The message object that triggered the command.","position":{"start":{"line":26,"column":12,"offset":1512},"end":{"line":26,"column":60,"offset":1560},"indent":[]}}],"position":{"start":{"line":26,"column":3,"offset":1503},"end":{"line":26,"column":60,"offset":1560},"indent":[]}}],"position":{"start":{"line":26,"column":1,"offset":1501},"end":{"line":26,"column":60,"offset":1560},"indent":[]}},{"type":"listItem","spread":false,"checked":null,"children":[{"type":"paragraph","children":[{"type":"inlineCode","value":"command","position":{"start":{"line":27,"column":3,"offset":1563},"end":{"line":27,"column":12,"offset":1572},"indent":[]}},{"type":"text","value":": The command object itself that was triggered.","position":{"start":{"line":27,"column":12,"offset":1572},"end":{"line":27,"column":59,"offset":1619},"indent":[]}}],"position":{"start":{"line":27,"column":3,"offset":1563},"end":{"line":27,"column":59,"offset":1619},"indent":[]}}],"position":{"start":{"line":27,"column":1,"offset":1561},"end":{"line":27,"column":59,"offset":1619},"indent":[]}},{"type":"listItem","spread":false,"checked":null,"children":[{"type":"paragraph","children":[{"type":"inlineCode","value":"guild","position":{"start":{"line":28,"column":3,"offset":1622},"end":{"line":28,"column":10,"offset":1629},"indent":[]}},{"type":"text","value":": The server guild object where this command was ran.","position":{"start":{"line":28,"column":10,"offset":1629},"end":{"line":28,"column":63,"offset":1682},"indent":[]}}],"position":{"start":{"line":28,"column":3,"offset":1622},"end":{"line":28,"column":63,"offset":1682},"indent":[]}}],"position":{"start":{"line":28,"column":1,"offset":1620},"end":{"line":28,"column":63,"offset":1682},"indent":[]}}],"position":{"start":{"line":26,"column":1,"offset":1501},"end":{"line":28,"column":63,"offset":1682},"indent":[1,1]}},{"type":"heading","depth":2,"children":[{"type":"text","value":"Understanding How Inhibitors Function","position":{"start":{"line":30,"column":4,"offset":1687},"end":{"line":30,"column":41,"offset":1724},"indent":[]}}],"position":{"start":{"line":30,"column":1,"offset":1684},"end":{"line":30,"column":41,"offset":1724},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"To block a command you have to return a truthy value.","position":{"start":{"line":32,"column":1,"offset":1726},"end":{"line":32,"column":54,"offset":1779},"indent":[]}}],"position":{"start":{"line":32,"column":1,"offset":1726},"end":{"line":32,"column":54,"offset":1779},"indent":[]}},{"type":"list","ordered":false,"start":null,"spread":false,"children":[{"type":"listItem","spread":false,"checked":null,"children":[{"type":"paragraph","children":[{"type":"strong","children":[{"type":"text","value":"return true;","position":{"start":{"line":33,"column":5,"offset":1784},"end":{"line":33,"column":17,"offset":1796},"indent":[]}}],"position":{"start":{"line":33,"column":3,"offset":1782},"end":{"line":33,"column":19,"offset":1798},"indent":[]}},{"type":"text","value":" If you return true the inhibitor will block the execution of the command.\nTo allow a command return a falsey value.","position":{"start":{"line":33,"column":19,"offset":1798},"end":{"line":34,"column":42,"offset":1914},"indent":[1]}}],"position":{"start":{"line":33,"column":3,"offset":1782},"end":{"line":34,"column":42,"offset":1914},"indent":[1]}}],"position":{"start":{"line":33,"column":1,"offset":1780},"end":{"line":34,"column":42,"offset":1914},"indent":[1]}},{"type":"listItem","spread":false,"checked":null,"children":[{"type":"paragraph","children":[{"type":"strong","children":[{"type":"text","value":"return false;","position":{"start":{"line":35,"column":5,"offset":1919},"end":{"line":35,"column":18,"offset":1932},"indent":[]}}],"position":{"start":{"line":35,"column":3,"offset":1917},"end":{"line":35,"column":20,"offset":1934},"indent":[]}},{"type":"text","value":" If you return false the inhibitor will not block the error.","position":{"start":{"line":35,"column":20,"offset":1934},"end":{"line":35,"column":80,"offset":1994},"indent":[]}}],"position":{"start":{"line":35,"column":3,"offset":1917},"end":{"line":35,"column":80,"offset":1994},"indent":[]}}],"position":{"start":{"line":35,"column":1,"offset":1915},"end":{"line":35,"column":80,"offset":1994},"indent":[]}}],"position":{"start":{"line":33,"column":1,"offset":1780},"end":{"line":35,"column":80,"offset":1994},"indent":[1,1]}},{"type":"code","lang":"ts","meta":null,"value":"// If the command is not VIP only we can allow this command to execute\nif (!command.vipOnly) return false;\n\n// The bot's support server\nconst guild = cache.guilds.get(configs.supportServerID);\n// If the command author is not in the server they won't have the vip role\nconst member = guild.members.get(message.author.id) || await getMember(guild.id, message.author.id);\n// Member doesn't exist so cancel the command\nif (!member) {\n\tsendResponse(message, `sorry, but you can not use this command until you become VIP. **Close the IRIS!!!**`)\n\treturn true;\n}\n\n// If the user has the vip role on the support server given by patreon allow the command\nif (member.roles.includes(configs.roleIDs.patreonVIPRoleID)) return false;\n\n// Alert the user they don't have vip and can't use the command\nsendResponse(message, `sorry, but you can not use this command until you become a VIP. I'm sorry, Teal'c. We'll go to Disneyland next year. I promise.`)\n// Cancel the command since the user does not have vip\nreturn true;","position":{"start":{"line":38,"column":1,"offset":1997},"end":{"line":59,"column":4,"offset":3013},"indent":[1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1]}},{"type":"heading","depth":2,"children":[{"type":"text","value":"Challenges","position":{"start":{"line":61,"column":4,"offset":3018},"end":{"line":61,"column":14,"offset":3028},"indent":[]}}],"position":{"start":{"line":61,"column":1,"offset":3015},"end":{"line":61,"column":14,"offset":3028},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"Hell yes! We just got through the entire inhibitor section. You have now mastered everything related to inhibitors.","position":{"start":{"line":63,"column":1,"offset":3030},"end":{"line":63,"column":116,"offset":3145},"indent":[]}}],"position":{"start":{"line":63,"column":1,"offset":3030},"end":{"line":63,"column":116,"offset":3145},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"You can now try and get a little more practice with inhibitors by trying to challenge yourself and make your own inhibitors. Don't worry if you can't think of any good use cases for inhibitors.","position":{"start":{"line":65,"column":1,"offset":3147},"end":{"line":65,"column":194,"offset":3340},"indent":[]}}],"position":{"start":{"line":65,"column":1,"offset":3147},"end":{"line":65,"column":194,"offset":3340},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"Majority of Discordeno bots do not use many custom","position":{"start":{"line":67,"column":1,"offset":3342},"end":{"line":67,"column":51,"offset":3392},"indent":[]}}],"position":{"start":{"line":67,"column":1,"offset":3342},"end":{"line":67,"column":51,"offset":3392},"indent":[]}},{"type":"export","value":"export const _frontmatter = {\"title\":\"Creating Inhibitors!\",\"metaTitle\":\"Creating An Inhibitor | Discordeno\",\"metaDescription\":\"Let's create our very own bot with Discordeno!\"}","position":{"start":{"line":70,"column":1,"offset":3395},"end":{"line":70,"column":177,"offset":3571},"indent":[]}}],"position":{"start":{"line":1,"column":1,"offset":0},"end":{"line":70,"column":177,"offset":3571}}},"scopeImports":["import * as React from 'react'"],"scopeIdentifiers":["React"],"body":"function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }\n\nfunction _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }\n\nfunction _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }\n\n/* @jsx mdx */\nvar _frontmatter = {\n \"title\": \"Creating Inhibitors!\",\n \"metaTitle\": \"Creating An Inhibitor | Discordeno\",\n \"metaDescription\": \"Let's create our very own bot with Discordeno!\"\n};\nvar layoutProps = {\n _frontmatter: _frontmatter\n};\nvar MDXLayout = \"wrapper\";\nreturn function MDXContent(_ref) {\n var components = _ref.components,\n props = _objectWithoutProperties(_ref, [\"components\"]);\n\n return mdx(MDXLayout, _extends({}, layoutProps, props, {\n components: components,\n mdxType: \"MDXLayout\"\n }), mdx(\"p\", null, \"Woah! You are almost half way done with understanding all of Discordeno. Amazing isn't it? Something you may have noticed in the last section was there were some options that prevented some commands from running like \", mdx(\"inlineCode\", {\n parentName: \"p\"\n }, \"dmOnly\"), \" or the permission options. we created a setting to prevent the monitor from running in certain channels. What if we wanted to do prevent commands from happening? How would we prevent commands from running?\"), mdx(\"h2\", null, \"What is an Inhibitor?\"), mdx(\"p\", null, \"An Inhibitor is very similar to how monitors work. A monitor runs on every message but an inhibitor runs on every command. Remember all those command options like cooldown, permissions, permissionLevel, nsfw, etc... Each and every one of these options has an inhibitor in that checks commands for these settings.\"), mdx(\"p\", null, \"Let's create our own inhibitor that would prevent commands from being used if the user is not a VIP user.\"), mdx(\"blockquote\", null, mdx(\"p\", {\n parentName: \"blockquote\"\n }, mdx(\"strong\", {\n parentName: \"p\"\n }, \"Note:\"), \" It is important to remember that everything below can be done with a simple permission level as well. We will create our own custom permission levels but for the purposes of this guide and to be able to learn about Inhibitors, we will be using an inhibitor.\")), mdx(\"h2\", null, \"Creating the File\"), mdx(\"p\", null, \"Let's start by creating a file inside the inhibitors folder called \", mdx(\"inlineCode\", {\n parentName: \"p\"\n }, \"boosted.ts\"), \" and paste the following snippet of code:\"), mdx(\"pre\", null, mdx(\"code\", _extends({\n parentName: \"pre\"\n }, {\n \"className\": \"language-ts\"\n }), \"import { botCache } from \\\"../../mod.ts\\\";\\n\\nbotCache.inhibitors.set(\\\"inhibitorname\\\", async function (message, command, guild) {\\n // Your code goes here\\n});\\n\")), mdx(\"p\", null, \"Inhibitors can take up to 3 arguments.\"), mdx(\"ul\", null, mdx(\"li\", {\n parentName: \"ul\"\n }, mdx(\"inlineCode\", {\n parentName: \"li\"\n }, \"message\"), \": The message object that triggered the command.\"), mdx(\"li\", {\n parentName: \"ul\"\n }, mdx(\"inlineCode\", {\n parentName: \"li\"\n }, \"command\"), \": The command object itself that was triggered.\"), mdx(\"li\", {\n parentName: \"ul\"\n }, mdx(\"inlineCode\", {\n parentName: \"li\"\n }, \"guild\"), \": The server guild object where this command was ran.\")), mdx(\"h2\", null, \"Understanding How Inhibitors Function\"), mdx(\"p\", null, \"To block a command you have to return a truthy value.\"), mdx(\"ul\", null, mdx(\"li\", {\n parentName: \"ul\"\n }, mdx(\"strong\", {\n parentName: \"li\"\n }, \"return true;\"), \" If you return true the inhibitor will block the execution of the command.\\nTo allow a command return a falsey value.\"), mdx(\"li\", {\n parentName: \"ul\"\n }, mdx(\"strong\", {\n parentName: \"li\"\n }, \"return false;\"), \" If you return false the inhibitor will not block the error.\")), mdx(\"pre\", null, mdx(\"code\", _extends({\n parentName: \"pre\"\n }, {\n \"className\": \"language-ts\"\n }), \"// If the command is not VIP only we can allow this command to execute\\nif (!command.vipOnly) return false;\\n\\n// The bot's support server\\nconst guild = cache.guilds.get(configs.supportServerID);\\n// If the command author is not in the server they won't have the vip role\\nconst member = guild.members.get(message.author.id) || await getMember(guild.id, message.author.id);\\n// Member doesn't exist so cancel the command\\nif (!member) {\\n sendResponse(message, `sorry, but you can not use this command until you become VIP. **Close the IRIS!!!**`)\\n return true;\\n}\\n\\n// If the user has the vip role on the support server given by patreon allow the command\\nif (member.roles.includes(configs.roleIDs.patreonVIPRoleID)) return false;\\n\\n// Alert the user they don't have vip and can't use the command\\nsendResponse(message, `sorry, but you can not use this command until you become a VIP. I'm sorry, Teal'c. We'll go to Disneyland next year. I promise.`)\\n// Cancel the command since the user does not have vip\\nreturn true;\\n\")), mdx(\"h2\", null, \"Challenges\"), mdx(\"p\", null, \"Hell yes! We just got through the entire inhibitor section. You have now mastered everything related to inhibitors.\"), mdx(\"p\", null, \"You can now try and get a little more practice with inhibitors by trying to challenge yourself and make your own inhibitors. Don't worry if you can't think of any good use cases for inhibitors.\"), mdx(\"p\", null, \"Majority of Discordeno bots do not use many custom\"));\n}\n;\nMDXContent.isMDXComponent = true;","rawMDXOutput":"/* @jsx mdx */\nimport { mdx } from '@mdx-js/react';\n/* @jsx mdx */\n\nexport const _frontmatter = {\n \"title\": \"Creating Inhibitors!\",\n \"metaTitle\": \"Creating An Inhibitor | Discordeno\",\n \"metaDescription\": \"Let's create our very own bot with Discordeno!\"\n};\n\nconst layoutProps = {\n _frontmatter\n};\nconst MDXLayout = \"wrapper\"\nexport default function MDXContent({\n components,\n ...props\n}) {\n return \n

{`Woah! You are almost half way done with understanding all of Discordeno. Amazing isn't it? Something you may have noticed in the last section was there were some options that prevented some commands from running like `}{`dmOnly`}{` or the permission options. we created a setting to prevent the monitor from running in certain channels. What if we wanted to do prevent commands from happening? How would we prevent commands from running?`}

\n

{`What is an Inhibitor?`}

\n

{`An Inhibitor is very similar to how monitors work. A monitor runs on every message but an inhibitor runs on every command. Remember all those command options like cooldown, permissions, permissionLevel, nsfw, etc... Each and every one of these options has an inhibitor in that checks commands for these settings.`}

\n

{`Let's create our own inhibitor that would prevent commands from being used if the user is not a VIP user.`}

\n
\n

{`Note:`}{` It is important to remember that everything below can be done with a simple permission level as well. We will create our own custom permission levels but for the purposes of this guide and to be able to learn about Inhibitors, we will be using an inhibitor.`}

\n
\n

{`Creating the File`}

\n

{`Let's start by creating a file inside the inhibitors folder called `}{`boosted.ts`}{` and paste the following snippet of code:`}

\n
{`import { botCache } from \"../../mod.ts\";\n\nbotCache.inhibitors.set(\"inhibitorname\", async function (message, command, guild) {\n    // Your code goes here\n});\n`}
\n

{`Inhibitors can take up to 3 arguments.`}

\n
    \n
  • {`message`}{`: The message object that triggered the command.`}
  • \n
  • {`command`}{`: The command object itself that was triggered.`}
  • \n
  • {`guild`}{`: The server guild object where this command was ran.`}
  • \n
\n

{`Understanding How Inhibitors Function`}

\n

{`To block a command you have to return a truthy value.`}

\n
    \n
  • {`return true;`}{` If you return true the inhibitor will block the execution of the command.\nTo allow a command return a falsey value.`}
  • \n
  • {`return false;`}{` If you return false the inhibitor will not block the error.`}
  • \n
\n
{`// If the command is not VIP only we can allow this command to execute\nif (!command.vipOnly) return false;\n\n// The bot's support server\nconst guild = cache.guilds.get(configs.supportServerID);\n// If the command author is not in the server they won't have the vip role\nconst member = guild.members.get(message.author.id) || await getMember(guild.id, message.author.id);\n// Member doesn't exist so cancel the command\nif (!member) {\n    sendResponse(message, \\`sorry, but you can not use this command until you become VIP. **Close the IRIS!!!**\\`)\n    return true;\n}\n\n// If the user has the vip role on the support server given by patreon allow the command\nif (member.roles.includes(configs.roleIDs.patreonVIPRoleID)) return false;\n\n// Alert the user they don't have vip and can't use the command\nsendResponse(message, \\`sorry, but you can not use this command until you become a VIP. I'm sorry, Teal'c. We'll go to Disneyland next year. I promise.\\`)\n// Cancel the command since the user does not have vip\nreturn true;\n`}
\n

{`Challenges`}

\n

{`Hell yes! We just got through the entire inhibitor section. You have now mastered everything related to inhibitors.`}

\n

{`You can now try and get a little more practice with inhibitors by trying to challenge yourself and make your own inhibitors. Don't worry if you can't think of any good use cases for inhibitors.`}

\n

{`Majority of Discordeno bots do not use many custom`}

\n\n
;\n}\n\n;\nMDXContent.isMDXComponent = true;"}} \ No newline at end of file diff --git a/docs/.cache/caches/gatsby-plugin-mdx/diskstore-4fe774b5ec1ead5bf01db3eb5336e5ed.json b/docs/.cache/caches/gatsby-plugin-mdx/diskstore-4fe774b5ec1ead5bf01db3eb5336e5ed.json new file mode 100644 index 000000000..993cc2e4d --- /dev/null +++ b/docs/.cache/caches/gatsby-plugin-mdx/diskstore-4fe774b5ec1ead5bf01db3eb5336e5ed.json @@ -0,0 +1 @@ +{"expireTime":9007200851634878000,"key":"gatsby-plugin-mdx-entire-payload-eba1c22c3b445b71c8cc49c633f268df-","val":{"mdast":{"type":"root","children":[{"type":"paragraph","children":[{"type":"text","value":"Woah! You are almost half way done with understanding all of Discordeno. Amazing isn't it? Something you may have noticed in the last section was there were some options that prevented some commands from running like ","position":{"start":{"line":2,"column":1,"offset":1},"end":{"line":2,"column":218,"offset":218},"indent":[]}},{"type":"inlineCode","value":"dmOnly","position":{"start":{"line":2,"column":218,"offset":218},"end":{"line":2,"column":226,"offset":226},"indent":[]}},{"type":"text","value":" or the permission options. we created a setting to prevent the monitor from running in certain channels. What if we wanted to do prevent commands from happening? How would we prevent commands from running?","position":{"start":{"line":2,"column":226,"offset":226},"end":{"line":2,"column":432,"offset":432},"indent":[]}}],"position":{"start":{"line":2,"column":1,"offset":1},"end":{"line":2,"column":432,"offset":432},"indent":[]}},{"type":"heading","depth":2,"children":[{"type":"text","value":"What is an Inhibitor?","position":{"start":{"line":4,"column":4,"offset":437},"end":{"line":4,"column":25,"offset":458},"indent":[]}}],"position":{"start":{"line":4,"column":1,"offset":434},"end":{"line":4,"column":25,"offset":458},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"An Inhibitor is very similar to how monitors work. A monitor runs on every message but an inhibitor runs on every command. Remember all those command options like cooldown, permissions, permissionLevel, nsfw, etc... Each and every one of these options has an inhibitor in that checks commands for these settings.","position":{"start":{"line":6,"column":1,"offset":460},"end":{"line":6,"column":313,"offset":772},"indent":[]}}],"position":{"start":{"line":6,"column":1,"offset":460},"end":{"line":6,"column":313,"offset":772},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"Let's create our own inhibitor that would prevent commands from being used if the user is not a VIP user.","position":{"start":{"line":8,"column":1,"offset":774},"end":{"line":8,"column":106,"offset":879},"indent":[]}}],"position":{"start":{"line":8,"column":1,"offset":774},"end":{"line":8,"column":106,"offset":879},"indent":[]}},{"type":"blockquote","children":[{"type":"paragraph","children":[{"type":"strong","children":[{"type":"text","value":"Note:","position":{"start":{"line":10,"column":5,"offset":885},"end":{"line":10,"column":10,"offset":890},"indent":[]}}],"position":{"start":{"line":10,"column":3,"offset":883},"end":{"line":10,"column":12,"offset":892},"indent":[]}},{"type":"text","value":" It is important to remember that everything below can be done with a simple permission level as well. We will create our own custom permission levels but for the purposes of this guide and to be able to learn about Inhibitors, we will be using an inhibitor.","position":{"start":{"line":10,"column":12,"offset":892},"end":{"line":10,"column":270,"offset":1150},"indent":[]}}],"position":{"start":{"line":10,"column":3,"offset":883},"end":{"line":10,"column":270,"offset":1150},"indent":[]}}],"position":{"start":{"line":10,"column":1,"offset":881},"end":{"line":10,"column":270,"offset":1150},"indent":[]}},{"type":"heading","depth":2,"children":[{"type":"text","value":"Creating the File","position":{"start":{"line":12,"column":4,"offset":1155},"end":{"line":12,"column":21,"offset":1172},"indent":[]}}],"position":{"start":{"line":12,"column":1,"offset":1152},"end":{"line":12,"column":21,"offset":1172},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"Let's start by creating a file inside the inhibitors folder called ","position":{"start":{"line":14,"column":1,"offset":1174},"end":{"line":14,"column":68,"offset":1241},"indent":[]}},{"type":"inlineCode","value":"boosted.ts","position":{"start":{"line":14,"column":68,"offset":1241},"end":{"line":14,"column":80,"offset":1253},"indent":[]}},{"type":"text","value":" and paste the following snippet of code:","position":{"start":{"line":14,"column":80,"offset":1253},"end":{"line":14,"column":121,"offset":1294},"indent":[]}}],"position":{"start":{"line":14,"column":1,"offset":1174},"end":{"line":14,"column":121,"offset":1294},"indent":[]}},{"type":"code","lang":"ts","meta":null,"value":"import { botCache } from \"../../mod.ts\";\n\nbotCache.inhibitors.set(\"inhibitorname\", async function (message, command, guild) {\n\t// Your code goes here\n});","position":{"start":{"line":16,"column":1,"offset":1296},"end":{"line":22,"column":4,"offset":1459},"indent":[1,1,1,1,1,1]}},{"type":"paragraph","children":[{"type":"text","value":"Inhibitors can take up to 3 arguments.","position":{"start":{"line":24,"column":1,"offset":1461},"end":{"line":24,"column":39,"offset":1499},"indent":[]}}],"position":{"start":{"line":24,"column":1,"offset":1461},"end":{"line":24,"column":39,"offset":1499},"indent":[]}},{"type":"list","ordered":false,"start":null,"spread":false,"children":[{"type":"listItem","spread":false,"checked":null,"children":[{"type":"paragraph","children":[{"type":"inlineCode","value":"message","position":{"start":{"line":26,"column":3,"offset":1503},"end":{"line":26,"column":12,"offset":1512},"indent":[]}},{"type":"text","value":": The message object that triggered the command.","position":{"start":{"line":26,"column":12,"offset":1512},"end":{"line":26,"column":60,"offset":1560},"indent":[]}}],"position":{"start":{"line":26,"column":3,"offset":1503},"end":{"line":26,"column":60,"offset":1560},"indent":[]}}],"position":{"start":{"line":26,"column":1,"offset":1501},"end":{"line":26,"column":60,"offset":1560},"indent":[]}},{"type":"listItem","spread":false,"checked":null,"children":[{"type":"paragraph","children":[{"type":"inlineCode","value":"command","position":{"start":{"line":27,"column":3,"offset":1563},"end":{"line":27,"column":12,"offset":1572},"indent":[]}},{"type":"text","value":": The command object itself that was triggered.","position":{"start":{"line":27,"column":12,"offset":1572},"end":{"line":27,"column":59,"offset":1619},"indent":[]}}],"position":{"start":{"line":27,"column":3,"offset":1563},"end":{"line":27,"column":59,"offset":1619},"indent":[]}}],"position":{"start":{"line":27,"column":1,"offset":1561},"end":{"line":27,"column":59,"offset":1619},"indent":[]}},{"type":"listItem","spread":false,"checked":null,"children":[{"type":"paragraph","children":[{"type":"inlineCode","value":"guild","position":{"start":{"line":28,"column":3,"offset":1622},"end":{"line":28,"column":10,"offset":1629},"indent":[]}},{"type":"text","value":": The server guild object where this command was ran.","position":{"start":{"line":28,"column":10,"offset":1629},"end":{"line":28,"column":63,"offset":1682},"indent":[]}}],"position":{"start":{"line":28,"column":3,"offset":1622},"end":{"line":28,"column":63,"offset":1682},"indent":[]}}],"position":{"start":{"line":28,"column":1,"offset":1620},"end":{"line":28,"column":63,"offset":1682},"indent":[]}}],"position":{"start":{"line":26,"column":1,"offset":1501},"end":{"line":28,"column":63,"offset":1682},"indent":[1,1]}},{"type":"heading","depth":2,"children":[{"type":"text","value":"Understanding How Inhibitors Function","position":{"start":{"line":30,"column":4,"offset":1687},"end":{"line":30,"column":41,"offset":1724},"indent":[]}}],"position":{"start":{"line":30,"column":1,"offset":1684},"end":{"line":30,"column":41,"offset":1724},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"To block a command you have to return a truthy value.","position":{"start":{"line":32,"column":1,"offset":1726},"end":{"line":32,"column":54,"offset":1779},"indent":[]}}],"position":{"start":{"line":32,"column":1,"offset":1726},"end":{"line":32,"column":54,"offset":1779},"indent":[]}},{"type":"list","ordered":false,"start":null,"spread":false,"children":[{"type":"listItem","spread":false,"checked":null,"children":[{"type":"paragraph","children":[{"type":"strong","children":[{"type":"text","value":"return true;","position":{"start":{"line":33,"column":5,"offset":1784},"end":{"line":33,"column":17,"offset":1796},"indent":[]}}],"position":{"start":{"line":33,"column":3,"offset":1782},"end":{"line":33,"column":19,"offset":1798},"indent":[]}},{"type":"text","value":" If you return true the inhibitor will block the execution of the command.\nTo allow a command return a falsey value.","position":{"start":{"line":33,"column":19,"offset":1798},"end":{"line":34,"column":42,"offset":1914},"indent":[1]}}],"position":{"start":{"line":33,"column":3,"offset":1782},"end":{"line":34,"column":42,"offset":1914},"indent":[1]}}],"position":{"start":{"line":33,"column":1,"offset":1780},"end":{"line":34,"column":42,"offset":1914},"indent":[1]}},{"type":"listItem","spread":false,"checked":null,"children":[{"type":"paragraph","children":[{"type":"strong","children":[{"type":"text","value":"return false;","position":{"start":{"line":35,"column":5,"offset":1919},"end":{"line":35,"column":18,"offset":1932},"indent":[]}}],"position":{"start":{"line":35,"column":3,"offset":1917},"end":{"line":35,"column":20,"offset":1934},"indent":[]}},{"type":"text","value":" If you return false the inhibitor will not block the error.","position":{"start":{"line":35,"column":20,"offset":1934},"end":{"line":35,"column":80,"offset":1994},"indent":[]}}],"position":{"start":{"line":35,"column":3,"offset":1917},"end":{"line":35,"column":80,"offset":1994},"indent":[]}}],"position":{"start":{"line":35,"column":1,"offset":1915},"end":{"line":35,"column":80,"offset":1994},"indent":[]}}],"position":{"start":{"line":33,"column":1,"offset":1780},"end":{"line":35,"column":80,"offset":1994},"indent":[1,1]}},{"type":"code","lang":"ts","meta":null,"value":"// If the command is not VIP only we can allow this command to execute\nif (!command.vipOnly) return false;\n\n// The bot's support server\nconst guild = cache.guilds.get(configs.supportServerID);\n// If the command author is not in the server they won't have the vip role\nconst member = guild.members.get(message.author.id) || await getMember(guild.id, message.author.id);\n// Member doesn't exist so cancel the command\nif (!member) {\n\tsendResponse(message, `sorry, but you can not use this command until you become VIP. **Close the IRIS!!!**`)\n\treturn true;\n}\n\n// If the user has the vip role on the support server given by patreon allow the command\nif (member.roles.includes(configs.roleIDs.patreonVIPRoleID)) return false;\n\n// Alert the user they don't have vip and can't use the command\nsendResponse(message, `sorry, but you can not use this command until you become a VIP. I'm sorry, Teal'c. We'll go to Disneyland next year. I promise.`)\n// Cancel the command since the user does not have vip\nreturn true;","position":{"start":{"line":38,"column":1,"offset":1997},"end":{"line":59,"column":4,"offset":3013},"indent":[1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1]}},{"type":"heading","depth":2,"children":[{"type":"text","value":"Challenges","position":{"start":{"line":63,"column":4,"offset":3020},"end":{"line":63,"column":14,"offset":3030},"indent":[]}}],"position":{"start":{"line":63,"column":1,"offset":3017},"end":{"line":63,"column":14,"offset":3030},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"Hell yes! We just got through the entire inhibitor section. You have now mastered everything related to inhibitors.","position":{"start":{"line":65,"column":1,"offset":3032},"end":{"line":65,"column":116,"offset":3147},"indent":[]}}],"position":{"start":{"line":65,"column":1,"offset":3032},"end":{"line":65,"column":116,"offset":3147},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"You can now try and get a little more practice with inhibitors by trying to challenge yourself and make your own inhibitors. Don't worry if you can't think of any good use cases for inhibitors.","position":{"start":{"line":67,"column":1,"offset":3149},"end":{"line":67,"column":194,"offset":3342},"indent":[]}}],"position":{"start":{"line":67,"column":1,"offset":3149},"end":{"line":67,"column":194,"offset":3342},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"Majority of Discordeno bots do not use many custom inhibitors because most of the necessary/important ones already come built for you in the inhibitors folder.","position":{"start":{"line":69,"column":1,"offset":3344},"end":{"line":69,"column":160,"offset":3503},"indent":[]}}],"position":{"start":{"line":69,"column":1,"offset":3344},"end":{"line":69,"column":160,"offset":3503},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"Next we will try our hands at creating a monitor.","position":{"start":{"line":71,"column":1,"offset":3505},"end":{"line":71,"column":50,"offset":3554},"indent":[]}}],"position":{"start":{"line":71,"column":1,"offset":3505},"end":{"line":71,"column":50,"offset":3554},"indent":[]}},{"type":"export","value":"export const _frontmatter = {\"title\":\"Creating Inhibitors!\",\"metaTitle\":\"Creating An Inhibitor | Discordeno\",\"metaDescription\":\"Let's create our very own bot with Discordeno!\"}","position":{"start":{"line":74,"column":1,"offset":3557},"end":{"line":74,"column":177,"offset":3733},"indent":[]}}],"position":{"start":{"line":1,"column":1,"offset":0},"end":{"line":74,"column":177,"offset":3733}}},"scopeImports":["import * as React from 'react'"],"scopeIdentifiers":["React"],"body":"function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }\n\nfunction _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }\n\nfunction _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }\n\n/* @jsx mdx */\nvar _frontmatter = {\n \"title\": \"Creating Inhibitors!\",\n \"metaTitle\": \"Creating An Inhibitor | Discordeno\",\n \"metaDescription\": \"Let's create our very own bot with Discordeno!\"\n};\nvar layoutProps = {\n _frontmatter: _frontmatter\n};\nvar MDXLayout = \"wrapper\";\nreturn function MDXContent(_ref) {\n var components = _ref.components,\n props = _objectWithoutProperties(_ref, [\"components\"]);\n\n return mdx(MDXLayout, _extends({}, layoutProps, props, {\n components: components,\n mdxType: \"MDXLayout\"\n }), mdx(\"p\", null, \"Woah! You are almost half way done with understanding all of Discordeno. Amazing isn't it? Something you may have noticed in the last section was there were some options that prevented some commands from running like \", mdx(\"inlineCode\", {\n parentName: \"p\"\n }, \"dmOnly\"), \" or the permission options. we created a setting to prevent the monitor from running in certain channels. What if we wanted to do prevent commands from happening? How would we prevent commands from running?\"), mdx(\"h2\", null, \"What is an Inhibitor?\"), mdx(\"p\", null, \"An Inhibitor is very similar to how monitors work. A monitor runs on every message but an inhibitor runs on every command. Remember all those command options like cooldown, permissions, permissionLevel, nsfw, etc... Each and every one of these options has an inhibitor in that checks commands for these settings.\"), mdx(\"p\", null, \"Let's create our own inhibitor that would prevent commands from being used if the user is not a VIP user.\"), mdx(\"blockquote\", null, mdx(\"p\", {\n parentName: \"blockquote\"\n }, mdx(\"strong\", {\n parentName: \"p\"\n }, \"Note:\"), \" It is important to remember that everything below can be done with a simple permission level as well. We will create our own custom permission levels but for the purposes of this guide and to be able to learn about Inhibitors, we will be using an inhibitor.\")), mdx(\"h2\", null, \"Creating the File\"), mdx(\"p\", null, \"Let's start by creating a file inside the inhibitors folder called \", mdx(\"inlineCode\", {\n parentName: \"p\"\n }, \"boosted.ts\"), \" and paste the following snippet of code:\"), mdx(\"pre\", null, mdx(\"code\", _extends({\n parentName: \"pre\"\n }, {\n \"className\": \"language-ts\"\n }), \"import { botCache } from \\\"../../mod.ts\\\";\\n\\nbotCache.inhibitors.set(\\\"inhibitorname\\\", async function (message, command, guild) {\\n // Your code goes here\\n});\\n\")), mdx(\"p\", null, \"Inhibitors can take up to 3 arguments.\"), mdx(\"ul\", null, mdx(\"li\", {\n parentName: \"ul\"\n }, mdx(\"inlineCode\", {\n parentName: \"li\"\n }, \"message\"), \": The message object that triggered the command.\"), mdx(\"li\", {\n parentName: \"ul\"\n }, mdx(\"inlineCode\", {\n parentName: \"li\"\n }, \"command\"), \": The command object itself that was triggered.\"), mdx(\"li\", {\n parentName: \"ul\"\n }, mdx(\"inlineCode\", {\n parentName: \"li\"\n }, \"guild\"), \": The server guild object where this command was ran.\")), mdx(\"h2\", null, \"Understanding How Inhibitors Function\"), mdx(\"p\", null, \"To block a command you have to return a truthy value.\"), mdx(\"ul\", null, mdx(\"li\", {\n parentName: \"ul\"\n }, mdx(\"strong\", {\n parentName: \"li\"\n }, \"return true;\"), \" If you return true the inhibitor will block the execution of the command.\\nTo allow a command return a falsey value.\"), mdx(\"li\", {\n parentName: \"ul\"\n }, mdx(\"strong\", {\n parentName: \"li\"\n }, \"return false;\"), \" If you return false the inhibitor will not block the error.\")), mdx(\"pre\", null, mdx(\"code\", _extends({\n parentName: \"pre\"\n }, {\n \"className\": \"language-ts\"\n }), \"// If the command is not VIP only we can allow this command to execute\\nif (!command.vipOnly) return false;\\n\\n// The bot's support server\\nconst guild = cache.guilds.get(configs.supportServerID);\\n// If the command author is not in the server they won't have the vip role\\nconst member = guild.members.get(message.author.id) || await getMember(guild.id, message.author.id);\\n// Member doesn't exist so cancel the command\\nif (!member) {\\n sendResponse(message, `sorry, but you can not use this command until you become VIP. **Close the IRIS!!!**`)\\n return true;\\n}\\n\\n// If the user has the vip role on the support server given by patreon allow the command\\nif (member.roles.includes(configs.roleIDs.patreonVIPRoleID)) return false;\\n\\n// Alert the user they don't have vip and can't use the command\\nsendResponse(message, `sorry, but you can not use this command until you become a VIP. I'm sorry, Teal'c. We'll go to Disneyland next year. I promise.`)\\n// Cancel the command since the user does not have vip\\nreturn true;\\n\")), mdx(\"h2\", null, \"Challenges\"), mdx(\"p\", null, \"Hell yes! We just got through the entire inhibitor section. You have now mastered everything related to inhibitors.\"), mdx(\"p\", null, \"You can now try and get a little more practice with inhibitors by trying to challenge yourself and make your own inhibitors. Don't worry if you can't think of any good use cases for inhibitors.\"), mdx(\"p\", null, \"Majority of Discordeno bots do not use many custom inhibitors because most of the necessary/important ones already come built for you in the inhibitors folder.\"), mdx(\"p\", null, \"Next we will try our hands at creating a monitor.\"));\n}\n;\nMDXContent.isMDXComponent = true;","rawMDXOutput":"/* @jsx mdx */\nimport { mdx } from '@mdx-js/react';\n/* @jsx mdx */\n\nexport const _frontmatter = {\n \"title\": \"Creating Inhibitors!\",\n \"metaTitle\": \"Creating An Inhibitor | Discordeno\",\n \"metaDescription\": \"Let's create our very own bot with Discordeno!\"\n};\n\nconst layoutProps = {\n _frontmatter\n};\nconst MDXLayout = \"wrapper\"\nexport default function MDXContent({\n components,\n ...props\n}) {\n return \n

{`Woah! You are almost half way done with understanding all of Discordeno. Amazing isn't it? Something you may have noticed in the last section was there were some options that prevented some commands from running like `}{`dmOnly`}{` or the permission options. we created a setting to prevent the monitor from running in certain channels. What if we wanted to do prevent commands from happening? How would we prevent commands from running?`}

\n

{`What is an Inhibitor?`}

\n

{`An Inhibitor is very similar to how monitors work. A monitor runs on every message but an inhibitor runs on every command. Remember all those command options like cooldown, permissions, permissionLevel, nsfw, etc... Each and every one of these options has an inhibitor in that checks commands for these settings.`}

\n

{`Let's create our own inhibitor that would prevent commands from being used if the user is not a VIP user.`}

\n
\n

{`Note:`}{` It is important to remember that everything below can be done with a simple permission level as well. We will create our own custom permission levels but for the purposes of this guide and to be able to learn about Inhibitors, we will be using an inhibitor.`}

\n
\n

{`Creating the File`}

\n

{`Let's start by creating a file inside the inhibitors folder called `}{`boosted.ts`}{` and paste the following snippet of code:`}

\n
{`import { botCache } from \"../../mod.ts\";\n\nbotCache.inhibitors.set(\"inhibitorname\", async function (message, command, guild) {\n    // Your code goes here\n});\n`}
\n

{`Inhibitors can take up to 3 arguments.`}

\n
    \n
  • {`message`}{`: The message object that triggered the command.`}
  • \n
  • {`command`}{`: The command object itself that was triggered.`}
  • \n
  • {`guild`}{`: The server guild object where this command was ran.`}
  • \n
\n

{`Understanding How Inhibitors Function`}

\n

{`To block a command you have to return a truthy value.`}

\n
    \n
  • {`return true;`}{` If you return true the inhibitor will block the execution of the command.\nTo allow a command return a falsey value.`}
  • \n
  • {`return false;`}{` If you return false the inhibitor will not block the error.`}
  • \n
\n
{`// If the command is not VIP only we can allow this command to execute\nif (!command.vipOnly) return false;\n\n// The bot's support server\nconst guild = cache.guilds.get(configs.supportServerID);\n// If the command author is not in the server they won't have the vip role\nconst member = guild.members.get(message.author.id) || await getMember(guild.id, message.author.id);\n// Member doesn't exist so cancel the command\nif (!member) {\n    sendResponse(message, \\`sorry, but you can not use this command until you become VIP. **Close the IRIS!!!**\\`)\n    return true;\n}\n\n// If the user has the vip role on the support server given by patreon allow the command\nif (member.roles.includes(configs.roleIDs.patreonVIPRoleID)) return false;\n\n// Alert the user they don't have vip and can't use the command\nsendResponse(message, \\`sorry, but you can not use this command until you become a VIP. I'm sorry, Teal'c. We'll go to Disneyland next year. I promise.\\`)\n// Cancel the command since the user does not have vip\nreturn true;\n`}
\n

{`Challenges`}

\n

{`Hell yes! We just got through the entire inhibitor section. You have now mastered everything related to inhibitors.`}

\n

{`You can now try and get a little more practice with inhibitors by trying to challenge yourself and make your own inhibitors. Don't worry if you can't think of any good use cases for inhibitors.`}

\n

{`Majority of Discordeno bots do not use many custom inhibitors because most of the necessary/important ones already come built for you in the inhibitors folder.`}

\n

{`Next we will try our hands at creating a monitor.`}

\n\n
;\n}\n\n;\nMDXContent.isMDXComponent = true;"}} \ No newline at end of file diff --git a/docs/.cache/caches/gatsby-plugin-mdx/diskstore-51ebaae4b3322366598354b14491fd0e.json b/docs/.cache/caches/gatsby-plugin-mdx/diskstore-51ebaae4b3322366598354b14491fd0e.json new file mode 100644 index 000000000..474fcfbe4 --- /dev/null +++ b/docs/.cache/caches/gatsby-plugin-mdx/diskstore-51ebaae4b3322366598354b14491fd0e.json @@ -0,0 +1 @@ +{"expireTime":9007200851635036000,"key":"gatsby-plugin-mdx-entire-payload-3b0380898722c4a0b8fa1c25f316c9ae-","val":{"mdast":{"type":"root","children":[{"type":"paragraph","children":[{"type":"text","value":"Woah! You are almost half way done with understanding all of Discordeno. Amazing isn't it? Something you may have noticed in the last section was there were some options that prevented some commands from running like ","position":{"start":{"line":2,"column":1,"offset":1},"end":{"line":2,"column":218,"offset":218},"indent":[]}},{"type":"inlineCode","value":"dmOnly","position":{"start":{"line":2,"column":218,"offset":218},"end":{"line":2,"column":226,"offset":226},"indent":[]}},{"type":"text","value":" or the permission options. we created a setting to prevent the monitor from running in certain channels. What if we wanted to do prevent commands from happening? How would we prevent commands from running?","position":{"start":{"line":2,"column":226,"offset":226},"end":{"line":2,"column":432,"offset":432},"indent":[]}}],"position":{"start":{"line":2,"column":1,"offset":1},"end":{"line":2,"column":432,"offset":432},"indent":[]}},{"type":"heading","depth":2,"children":[{"type":"text","value":"What is an Inhibitor?","position":{"start":{"line":4,"column":4,"offset":437},"end":{"line":4,"column":25,"offset":458},"indent":[]}}],"position":{"start":{"line":4,"column":1,"offset":434},"end":{"line":4,"column":25,"offset":458},"indent":[]}},{"type":"export","value":"export const _frontmatter = {\"title\":\"Creating Inhibitors!\",\"metaTitle\":\"Creating An Inhibitor | Discordeno\",\"metaDescription\":\"Let's create our very own bot with Discordeno!\"}","position":{"start":{"line":8,"column":1,"offset":462},"end":{"line":8,"column":177,"offset":638},"indent":[]}}],"position":{"start":{"line":1,"column":1,"offset":0},"end":{"line":8,"column":177,"offset":638}}},"scopeImports":["import * as React from 'react'"],"scopeIdentifiers":["React"],"body":"function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }\n\nfunction _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }\n\nfunction _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }\n\n/* @jsx mdx */\nvar _frontmatter = {\n \"title\": \"Creating Inhibitors!\",\n \"metaTitle\": \"Creating An Inhibitor | Discordeno\",\n \"metaDescription\": \"Let's create our very own bot with Discordeno!\"\n};\nvar layoutProps = {\n _frontmatter: _frontmatter\n};\nvar MDXLayout = \"wrapper\";\nreturn function MDXContent(_ref) {\n var components = _ref.components,\n props = _objectWithoutProperties(_ref, [\"components\"]);\n\n return mdx(MDXLayout, _extends({}, layoutProps, props, {\n components: components,\n mdxType: \"MDXLayout\"\n }), mdx(\"p\", null, \"Woah! You are almost half way done with understanding all of Discordeno. Amazing isn't it? Something you may have noticed in the last section was there were some options that prevented some commands from running like \", mdx(\"inlineCode\", {\n parentName: \"p\"\n }, \"dmOnly\"), \" or the permission options. we created a setting to prevent the monitor from running in certain channels. What if we wanted to do prevent commands from happening? How would we prevent commands from running?\"), mdx(\"h2\", null, \"What is an Inhibitor?\"));\n}\n;\nMDXContent.isMDXComponent = true;","rawMDXOutput":"/* @jsx mdx */\nimport { mdx } from '@mdx-js/react';\n/* @jsx mdx */\n\nexport const _frontmatter = {\n \"title\": \"Creating Inhibitors!\",\n \"metaTitle\": \"Creating An Inhibitor | Discordeno\",\n \"metaDescription\": \"Let's create our very own bot with Discordeno!\"\n};\n\nconst layoutProps = {\n _frontmatter\n};\nconst MDXLayout = \"wrapper\"\nexport default function MDXContent({\n components,\n ...props\n}) {\n return \n

{`Woah! You are almost half way done with understanding all of Discordeno. Amazing isn't it? Something you may have noticed in the last section was there were some options that prevented some commands from running like `}{`dmOnly`}{` or the permission options. we created a setting to prevent the monitor from running in certain channels. What if we wanted to do prevent commands from happening? How would we prevent commands from running?`}

\n

{`What is an Inhibitor?`}

\n\n
;\n}\n\n;\nMDXContent.isMDXComponent = true;"}} \ No newline at end of file diff --git a/docs/.cache/caches/gatsby-plugin-mdx/diskstore-51f081f0d9daa5d3e3b97358c9a0d6e3.json b/docs/.cache/caches/gatsby-plugin-mdx/diskstore-51f081f0d9daa5d3e3b97358c9a0d6e3.json new file mode 100644 index 000000000..a93e3a090 --- /dev/null +++ b/docs/.cache/caches/gatsby-plugin-mdx/diskstore-51f081f0d9daa5d3e3b97358c9a0d6e3.json @@ -0,0 +1 @@ +{"expireTime":9007200851632826000,"key":"gatsby-plugin-mdx-entire-payload-9c59f15cd564692e7dbd07101b62c7f5-","val":{"mdast":{"type":"root","children":[{"type":"paragraph","children":[{"type":"text","value":"Woah! You are almost half way done with understanding all of Discordeno. Amazing isn't it? Something you may have noticed in the last section was there were some options that prevented some commands from running like ","position":{"start":{"line":2,"column":1,"offset":1},"end":{"line":2,"column":218,"offset":218},"indent":[]}},{"type":"inlineCode","value":"dmOnly","position":{"start":{"line":2,"column":218,"offset":218},"end":{"line":2,"column":226,"offset":226},"indent":[]}},{"type":"text","value":" or the permission options. we created a setting to prevent the monitor from running in certain channels. What if we wanted to do prevent commands from happening? How would we prevent commands from running?","position":{"start":{"line":2,"column":226,"offset":226},"end":{"line":2,"column":432,"offset":432},"indent":[]}}],"position":{"start":{"line":2,"column":1,"offset":1},"end":{"line":2,"column":432,"offset":432},"indent":[]}},{"type":"heading","depth":2,"children":[{"type":"text","value":"What is an Inhibitor?","position":{"start":{"line":4,"column":4,"offset":437},"end":{"line":4,"column":25,"offset":458},"indent":[]}}],"position":{"start":{"line":4,"column":1,"offset":434},"end":{"line":4,"column":25,"offset":458},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"An Inhibitor is very similar to how monitors work. A monitor runs on every message but an inhibitor runs on every command. Remember all those command options like cooldown, permissions, permissionLevel, nsfw, etc... Each and every one of these options has an inhibitor in that checks commands for these settings.","position":{"start":{"line":6,"column":1,"offset":460},"end":{"line":6,"column":313,"offset":772},"indent":[]}}],"position":{"start":{"line":6,"column":1,"offset":460},"end":{"line":6,"column":313,"offset":772},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"Let's create our own inhibitor that would prevent commands from being used if the user is not a VIP user.","position":{"start":{"line":8,"column":1,"offset":774},"end":{"line":8,"column":106,"offset":879},"indent":[]}}],"position":{"start":{"line":8,"column":1,"offset":774},"end":{"line":8,"column":106,"offset":879},"indent":[]}},{"type":"blockquote","children":[{"type":"paragraph","children":[{"type":"strong","children":[{"type":"text","value":"Note:","position":{"start":{"line":10,"column":5,"offset":885},"end":{"line":10,"column":10,"offset":890},"indent":[]}}],"position":{"start":{"line":10,"column":3,"offset":883},"end":{"line":10,"column":12,"offset":892},"indent":[]}},{"type":"text","value":" It is important to remember that everything below can be done with a simple permission level as well. We will create our own custom permission levels but for the purposes of this guide and to be able to learn about Inhibitors, we will be using an inhibitor.","position":{"start":{"line":10,"column":12,"offset":892},"end":{"line":10,"column":270,"offset":1150},"indent":[]}}],"position":{"start":{"line":10,"column":3,"offset":883},"end":{"line":10,"column":270,"offset":1150},"indent":[]}}],"position":{"start":{"line":10,"column":1,"offset":881},"end":{"line":10,"column":270,"offset":1150},"indent":[]}},{"type":"heading","depth":2,"children":[{"type":"text","value":"Creating the File","position":{"start":{"line":12,"column":4,"offset":1155},"end":{"line":12,"column":21,"offset":1172},"indent":[]}}],"position":{"start":{"line":12,"column":1,"offset":1152},"end":{"line":12,"column":21,"offset":1172},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"Let's start by creating a file inside the inhibitors folder called ","position":{"start":{"line":14,"column":1,"offset":1174},"end":{"line":14,"column":68,"offset":1241},"indent":[]}},{"type":"inlineCode","value":"vipOnly.ts","position":{"start":{"line":14,"column":68,"offset":1241},"end":{"line":14,"column":80,"offset":1253},"indent":[]}},{"type":"text","value":" and paste the following snippet of code:","position":{"start":{"line":14,"column":80,"offset":1253},"end":{"line":14,"column":121,"offset":1294},"indent":[]}}],"position":{"start":{"line":14,"column":1,"offset":1174},"end":{"line":14,"column":121,"offset":1294},"indent":[]}},{"type":"code","lang":"ts","meta":null,"value":"import { botCache } from \"../../mod.ts\";\n\nbotCache.inhibitors.set(\"inhibitorname\", async function (message, command, guild) {\n\t// Your code goes here\n});","position":{"start":{"line":16,"column":1,"offset":1296},"end":{"line":22,"column":4,"offset":1459},"indent":[1,1,1,1,1,1]}},{"type":"paragraph","children":[{"type":"text","value":"Inhibitors can take up to 3 arguments.","position":{"start":{"line":24,"column":1,"offset":1461},"end":{"line":24,"column":39,"offset":1499},"indent":[]}}],"position":{"start":{"line":24,"column":1,"offset":1461},"end":{"line":24,"column":39,"offset":1499},"indent":[]}},{"type":"list","ordered":false,"start":null,"spread":false,"children":[{"type":"listItem","spread":false,"checked":null,"children":[{"type":"paragraph","children":[{"type":"inlineCode","value":"message","position":{"start":{"line":26,"column":3,"offset":1503},"end":{"line":26,"column":12,"offset":1512},"indent":[]}},{"type":"text","value":": The message object that triggered the command.","position":{"start":{"line":26,"column":12,"offset":1512},"end":{"line":26,"column":60,"offset":1560},"indent":[]}}],"position":{"start":{"line":26,"column":3,"offset":1503},"end":{"line":26,"column":60,"offset":1560},"indent":[]}}],"position":{"start":{"line":26,"column":1,"offset":1501},"end":{"line":26,"column":60,"offset":1560},"indent":[]}},{"type":"listItem","spread":false,"checked":null,"children":[{"type":"paragraph","children":[{"type":"inlineCode","value":"command","position":{"start":{"line":27,"column":3,"offset":1563},"end":{"line":27,"column":12,"offset":1572},"indent":[]}},{"type":"text","value":": The command object itself that was triggered.","position":{"start":{"line":27,"column":12,"offset":1572},"end":{"line":27,"column":59,"offset":1619},"indent":[]}}],"position":{"start":{"line":27,"column":3,"offset":1563},"end":{"line":27,"column":59,"offset":1619},"indent":[]}}],"position":{"start":{"line":27,"column":1,"offset":1561},"end":{"line":27,"column":59,"offset":1619},"indent":[]}},{"type":"listItem","spread":false,"checked":null,"children":[{"type":"paragraph","children":[{"type":"inlineCode","value":"guild","position":{"start":{"line":28,"column":3,"offset":1622},"end":{"line":28,"column":10,"offset":1629},"indent":[]}},{"type":"text","value":": The server guild object where this command was ran.","position":{"start":{"line":28,"column":10,"offset":1629},"end":{"line":28,"column":63,"offset":1682},"indent":[]}}],"position":{"start":{"line":28,"column":3,"offset":1622},"end":{"line":28,"column":63,"offset":1682},"indent":[]}}],"position":{"start":{"line":28,"column":1,"offset":1620},"end":{"line":28,"column":63,"offset":1682},"indent":[]}}],"position":{"start":{"line":26,"column":1,"offset":1501},"end":{"line":28,"column":63,"offset":1682},"indent":[1,1]}},{"type":"heading","depth":2,"children":[{"type":"text","value":"Understanding How Inhibitors Function","position":{"start":{"line":30,"column":4,"offset":1687},"end":{"line":30,"column":41,"offset":1724},"indent":[]}}],"position":{"start":{"line":30,"column":1,"offset":1684},"end":{"line":30,"column":41,"offset":1724},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"To block a command you have to return a truthy value.","position":{"start":{"line":32,"column":1,"offset":1726},"end":{"line":32,"column":54,"offset":1779},"indent":[]}}],"position":{"start":{"line":32,"column":1,"offset":1726},"end":{"line":32,"column":54,"offset":1779},"indent":[]}},{"type":"code","lang":null,"meta":null,"value":"- **return true;** If you return true the inhibitor will block the execution of the command.","position":{"start":{"line":33,"column":1,"offset":1780},"end":{"line":33,"column":94,"offset":1873},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"To allow a command return a falsey value.","position":{"start":{"line":34,"column":1,"offset":1874},"end":{"line":34,"column":42,"offset":1915},"indent":[]}}],"position":{"start":{"line":34,"column":1,"offset":1874},"end":{"line":34,"column":42,"offset":1915},"indent":[]}},{"type":"code","lang":null,"meta":null,"value":"- **return false;** If you return false the inhibitor will not block the error.","position":{"start":{"line":35,"column":1,"offset":1916},"end":{"line":35,"column":81,"offset":1996},"indent":[]}},{"type":"code","lang":"ts","meta":null,"value":"// If the command is not VIP only we can allow this command\nif (!command.vipOnly) return false;\n// Check if the user is VIP\nconst userIsVIP = message.author.settings.get(`isVIP`)\n// The user is VIP so we can allow this command to be used\nif (userIsVIP) return false\n// The user is NOT VIP so we throw an error\nthrow `The ${command.name} is only allowed for VIP users.`","position":{"start":{"line":38,"column":1,"offset":1999},"end":{"line":47,"column":4,"offset":2377},"indent":[1,1,1,1,1,1,1,1,1]}},{"type":"export","value":"export const _frontmatter = {\"title\":\"Creating Inhibitors!\",\"metaTitle\":\"Creating An Inhibitor | Discordeno\",\"metaDescription\":\"Let's create our very own bot with Discordeno!\"}","position":{"start":{"line":50,"column":1,"offset":2380},"end":{"line":50,"column":177,"offset":2556},"indent":[]}}],"position":{"start":{"line":1,"column":1,"offset":0},"end":{"line":50,"column":177,"offset":2556}}},"scopeImports":["import * as React from 'react'"],"scopeIdentifiers":["React"],"body":"function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }\n\nfunction _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }\n\nfunction _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }\n\n/* @jsx mdx */\nvar _frontmatter = {\n \"title\": \"Creating Inhibitors!\",\n \"metaTitle\": \"Creating An Inhibitor | Discordeno\",\n \"metaDescription\": \"Let's create our very own bot with Discordeno!\"\n};\nvar layoutProps = {\n _frontmatter: _frontmatter\n};\nvar MDXLayout = \"wrapper\";\nreturn function MDXContent(_ref) {\n var components = _ref.components,\n props = _objectWithoutProperties(_ref, [\"components\"]);\n\n return mdx(MDXLayout, _extends({}, layoutProps, props, {\n components: components,\n mdxType: \"MDXLayout\"\n }), mdx(\"p\", null, \"Woah! You are almost half way done with understanding all of Discordeno. Amazing isn't it? Something you may have noticed in the last section was there were some options that prevented some commands from running like \", mdx(\"inlineCode\", {\n parentName: \"p\"\n }, \"dmOnly\"), \" or the permission options. we created a setting to prevent the monitor from running in certain channels. What if we wanted to do prevent commands from happening? How would we prevent commands from running?\"), mdx(\"h2\", null, \"What is an Inhibitor?\"), mdx(\"p\", null, \"An Inhibitor is very similar to how monitors work. A monitor runs on every message but an inhibitor runs on every command. Remember all those command options like cooldown, permissions, permissionLevel, nsfw, etc... Each and every one of these options has an inhibitor in that checks commands for these settings.\"), mdx(\"p\", null, \"Let's create our own inhibitor that would prevent commands from being used if the user is not a VIP user.\"), mdx(\"blockquote\", null, mdx(\"p\", {\n parentName: \"blockquote\"\n }, mdx(\"strong\", {\n parentName: \"p\"\n }, \"Note:\"), \" It is important to remember that everything below can be done with a simple permission level as well. We will create our own custom permission levels but for the purposes of this guide and to be able to learn about Inhibitors, we will be using an inhibitor.\")), mdx(\"h2\", null, \"Creating the File\"), mdx(\"p\", null, \"Let's start by creating a file inside the inhibitors folder called \", mdx(\"inlineCode\", {\n parentName: \"p\"\n }, \"vipOnly.ts\"), \" and paste the following snippet of code:\"), mdx(\"pre\", null, mdx(\"code\", _extends({\n parentName: \"pre\"\n }, {\n \"className\": \"language-ts\"\n }), \"import { botCache } from \\\"../../mod.ts\\\";\\n\\nbotCache.inhibitors.set(\\\"inhibitorname\\\", async function (message, command, guild) {\\n // Your code goes here\\n});\\n\")), mdx(\"p\", null, \"Inhibitors can take up to 3 arguments.\"), mdx(\"ul\", null, mdx(\"li\", {\n parentName: \"ul\"\n }, mdx(\"inlineCode\", {\n parentName: \"li\"\n }, \"message\"), \": The message object that triggered the command.\"), mdx(\"li\", {\n parentName: \"ul\"\n }, mdx(\"inlineCode\", {\n parentName: \"li\"\n }, \"command\"), \": The command object itself that was triggered.\"), mdx(\"li\", {\n parentName: \"ul\"\n }, mdx(\"inlineCode\", {\n parentName: \"li\"\n }, \"guild\"), \": The server guild object where this command was ran.\")), mdx(\"h2\", null, \"Understanding How Inhibitors Function\"), mdx(\"p\", null, \"To block a command you have to return a truthy value.\"), mdx(\"pre\", null, mdx(\"code\", _extends({\n parentName: \"pre\"\n }, {}), \"- **return true;** If you return true the inhibitor will block the execution of the command.\\n\")), mdx(\"p\", null, \"To allow a command return a falsey value.\"), mdx(\"pre\", null, mdx(\"code\", _extends({\n parentName: \"pre\"\n }, {}), \"- **return false;** If you return false the inhibitor will not block the error.\\n\")), mdx(\"pre\", null, mdx(\"code\", _extends({\n parentName: \"pre\"\n }, {\n \"className\": \"language-ts\"\n }), \"// If the command is not VIP only we can allow this command\\nif (!command.vipOnly) return false;\\n// Check if the user is VIP\\nconst userIsVIP = message.author.settings.get(`isVIP`)\\n// The user is VIP so we can allow this command to be used\\nif (userIsVIP) return false\\n// The user is NOT VIP so we throw an error\\nthrow `The ${command.name} is only allowed for VIP users.`\\n\")));\n}\n;\nMDXContent.isMDXComponent = true;","rawMDXOutput":"/* @jsx mdx */\nimport { mdx } from '@mdx-js/react';\n/* @jsx mdx */\n\nexport const _frontmatter = {\n \"title\": \"Creating Inhibitors!\",\n \"metaTitle\": \"Creating An Inhibitor | Discordeno\",\n \"metaDescription\": \"Let's create our very own bot with Discordeno!\"\n};\n\nconst layoutProps = {\n _frontmatter\n};\nconst MDXLayout = \"wrapper\"\nexport default function MDXContent({\n components,\n ...props\n}) {\n return \n

{`Woah! You are almost half way done with understanding all of Discordeno. Amazing isn't it? Something you may have noticed in the last section was there were some options that prevented some commands from running like `}{`dmOnly`}{` or the permission options. we created a setting to prevent the monitor from running in certain channels. What if we wanted to do prevent commands from happening? How would we prevent commands from running?`}

\n

{`What is an Inhibitor?`}

\n

{`An Inhibitor is very similar to how monitors work. A monitor runs on every message but an inhibitor runs on every command. Remember all those command options like cooldown, permissions, permissionLevel, nsfw, etc... Each and every one of these options has an inhibitor in that checks commands for these settings.`}

\n

{`Let's create our own inhibitor that would prevent commands from being used if the user is not a VIP user.`}

\n
\n

{`Note:`}{` It is important to remember that everything below can be done with a simple permission level as well. We will create our own custom permission levels but for the purposes of this guide and to be able to learn about Inhibitors, we will be using an inhibitor.`}

\n
\n

{`Creating the File`}

\n

{`Let's start by creating a file inside the inhibitors folder called `}{`vipOnly.ts`}{` and paste the following snippet of code:`}

\n
{`import { botCache } from \"../../mod.ts\";\n\nbotCache.inhibitors.set(\"inhibitorname\", async function (message, command, guild) {\n    // Your code goes here\n});\n`}
\n

{`Inhibitors can take up to 3 arguments.`}

\n
    \n
  • {`message`}{`: The message object that triggered the command.`}
  • \n
  • {`command`}{`: The command object itself that was triggered.`}
  • \n
  • {`guild`}{`: The server guild object where this command was ran.`}
  • \n
\n

{`Understanding How Inhibitors Function`}

\n

{`To block a command you have to return a truthy value.`}

\n
{`- **return true;** If you return true the inhibitor will block the execution of the command.\n`}
\n

{`To allow a command return a falsey value.`}

\n
{`- **return false;** If you return false the inhibitor will not block the error.\n`}
\n
{`// If the command is not VIP only we can allow this command\nif (!command.vipOnly) return false;\n// Check if the user is VIP\nconst userIsVIP = message.author.settings.get(\\`isVIP\\`)\n// The user is VIP so we can allow this command to be used\nif (userIsVIP) return false\n// The user is NOT VIP so we throw an error\nthrow \\`The \\${command.name} is only allowed for VIP users.\\`\n`}
\n\n
;\n}\n\n;\nMDXContent.isMDXComponent = true;"}} \ No newline at end of file diff --git a/docs/.cache/caches/gatsby-plugin-mdx/diskstore-5221d7a133e99116b22e656af927fca7.json b/docs/.cache/caches/gatsby-plugin-mdx/diskstore-5221d7a133e99116b22e656af927fca7.json new file mode 100644 index 000000000..6e4663d92 --- /dev/null +++ b/docs/.cache/caches/gatsby-plugin-mdx/diskstore-5221d7a133e99116b22e656af927fca7.json @@ -0,0 +1 @@ +{"expireTime":9007200851634011000,"key":"gatsby-plugin-mdx-entire-payload-a1e0fcb0a46095bdaa3d83bc524fc0c8-","val":{"mdast":{"type":"root","children":[{"type":"paragraph","children":[{"type":"text","value":"Woah! You are almost half way done with understanding all of Discordeno. Amazing isn't it? Something you may have noticed in the last section was there were some options that prevented some commands from running like ","position":{"start":{"line":2,"column":1,"offset":1},"end":{"line":2,"column":218,"offset":218},"indent":[]}},{"type":"inlineCode","value":"dmOnly","position":{"start":{"line":2,"column":218,"offset":218},"end":{"line":2,"column":226,"offset":226},"indent":[]}},{"type":"text","value":" or the permission options. we created a setting to prevent the monitor from running in certain channels. What if we wanted to do prevent commands from happening? How would we prevent commands from running?","position":{"start":{"line":2,"column":226,"offset":226},"end":{"line":2,"column":432,"offset":432},"indent":[]}}],"position":{"start":{"line":2,"column":1,"offset":1},"end":{"line":2,"column":432,"offset":432},"indent":[]}},{"type":"heading","depth":2,"children":[{"type":"text","value":"What is an Inhibitor?","position":{"start":{"line":4,"column":4,"offset":437},"end":{"line":4,"column":25,"offset":458},"indent":[]}}],"position":{"start":{"line":4,"column":1,"offset":434},"end":{"line":4,"column":25,"offset":458},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"An Inhibitor is very similar to how monitors work. A monitor runs on every message but an inhibitor runs on every command. Remember all those command options like cooldown, permissions, permissionLevel, nsfw, etc... Each and every one of these options has an inhibitor in that checks commands for these settings.","position":{"start":{"line":6,"column":1,"offset":460},"end":{"line":6,"column":313,"offset":772},"indent":[]}}],"position":{"start":{"line":6,"column":1,"offset":460},"end":{"line":6,"column":313,"offset":772},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"Let's create our own inhibitor that would prevent commands from being used if the user is not a VIP user.","position":{"start":{"line":8,"column":1,"offset":774},"end":{"line":8,"column":106,"offset":879},"indent":[]}}],"position":{"start":{"line":8,"column":1,"offset":774},"end":{"line":8,"column":106,"offset":879},"indent":[]}},{"type":"blockquote","children":[{"type":"paragraph","children":[{"type":"strong","children":[{"type":"text","value":"Note:","position":{"start":{"line":10,"column":5,"offset":885},"end":{"line":10,"column":10,"offset":890},"indent":[]}}],"position":{"start":{"line":10,"column":3,"offset":883},"end":{"line":10,"column":12,"offset":892},"indent":[]}},{"type":"text","value":" It is important to remember that everything below can be done with a simple permission level as well. We will create our own custom permission levels but for the purposes of this guide and to be able to learn about Inhibitors, we will be using an inhibitor.","position":{"start":{"line":10,"column":12,"offset":892},"end":{"line":10,"column":270,"offset":1150},"indent":[]}}],"position":{"start":{"line":10,"column":3,"offset":883},"end":{"line":10,"column":270,"offset":1150},"indent":[]}}],"position":{"start":{"line":10,"column":1,"offset":881},"end":{"line":10,"column":270,"offset":1150},"indent":[]}},{"type":"heading","depth":2,"children":[{"type":"text","value":"Creating the File","position":{"start":{"line":12,"column":4,"offset":1155},"end":{"line":12,"column":21,"offset":1172},"indent":[]}}],"position":{"start":{"line":12,"column":1,"offset":1152},"end":{"line":12,"column":21,"offset":1172},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"Let's start by creating a file inside the inhibitors folder called ","position":{"start":{"line":14,"column":1,"offset":1174},"end":{"line":14,"column":68,"offset":1241},"indent":[]}},{"type":"inlineCode","value":"boosted.ts","position":{"start":{"line":14,"column":68,"offset":1241},"end":{"line":14,"column":80,"offset":1253},"indent":[]}},{"type":"text","value":" and paste the following snippet of code:","position":{"start":{"line":14,"column":80,"offset":1253},"end":{"line":14,"column":121,"offset":1294},"indent":[]}}],"position":{"start":{"line":14,"column":1,"offset":1174},"end":{"line":14,"column":121,"offset":1294},"indent":[]}},{"type":"code","lang":"ts","meta":null,"value":"import { botCache } from \"../../mod.ts\";\n\nbotCache.inhibitors.set(\"inhibitorname\", async function (message, command, guild) {\n\t// Your code goes here\n});","position":{"start":{"line":16,"column":1,"offset":1296},"end":{"line":22,"column":4,"offset":1459},"indent":[1,1,1,1,1,1]}},{"type":"paragraph","children":[{"type":"text","value":"Inhibitors can take up to 3 arguments.","position":{"start":{"line":24,"column":1,"offset":1461},"end":{"line":24,"column":39,"offset":1499},"indent":[]}}],"position":{"start":{"line":24,"column":1,"offset":1461},"end":{"line":24,"column":39,"offset":1499},"indent":[]}},{"type":"list","ordered":false,"start":null,"spread":false,"children":[{"type":"listItem","spread":false,"checked":null,"children":[{"type":"paragraph","children":[{"type":"inlineCode","value":"message","position":{"start":{"line":26,"column":3,"offset":1503},"end":{"line":26,"column":12,"offset":1512},"indent":[]}},{"type":"text","value":": The message object that triggered the command.","position":{"start":{"line":26,"column":12,"offset":1512},"end":{"line":26,"column":60,"offset":1560},"indent":[]}}],"position":{"start":{"line":26,"column":3,"offset":1503},"end":{"line":26,"column":60,"offset":1560},"indent":[]}}],"position":{"start":{"line":26,"column":1,"offset":1501},"end":{"line":26,"column":60,"offset":1560},"indent":[]}},{"type":"listItem","spread":false,"checked":null,"children":[{"type":"paragraph","children":[{"type":"inlineCode","value":"command","position":{"start":{"line":27,"column":3,"offset":1563},"end":{"line":27,"column":12,"offset":1572},"indent":[]}},{"type":"text","value":": The command object itself that was triggered.","position":{"start":{"line":27,"column":12,"offset":1572},"end":{"line":27,"column":59,"offset":1619},"indent":[]}}],"position":{"start":{"line":27,"column":3,"offset":1563},"end":{"line":27,"column":59,"offset":1619},"indent":[]}}],"position":{"start":{"line":27,"column":1,"offset":1561},"end":{"line":27,"column":59,"offset":1619},"indent":[]}},{"type":"listItem","spread":false,"checked":null,"children":[{"type":"paragraph","children":[{"type":"inlineCode","value":"guild","position":{"start":{"line":28,"column":3,"offset":1622},"end":{"line":28,"column":10,"offset":1629},"indent":[]}},{"type":"text","value":": The server guild object where this command was ran.","position":{"start":{"line":28,"column":10,"offset":1629},"end":{"line":28,"column":63,"offset":1682},"indent":[]}}],"position":{"start":{"line":28,"column":3,"offset":1622},"end":{"line":28,"column":63,"offset":1682},"indent":[]}}],"position":{"start":{"line":28,"column":1,"offset":1620},"end":{"line":28,"column":63,"offset":1682},"indent":[]}}],"position":{"start":{"line":26,"column":1,"offset":1501},"end":{"line":28,"column":63,"offset":1682},"indent":[1,1]}},{"type":"heading","depth":2,"children":[{"type":"text","value":"Understanding How Inhibitors Function","position":{"start":{"line":30,"column":4,"offset":1687},"end":{"line":30,"column":41,"offset":1724},"indent":[]}}],"position":{"start":{"line":30,"column":1,"offset":1684},"end":{"line":30,"column":41,"offset":1724},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"To block a command you have to return a truthy value.","position":{"start":{"line":32,"column":1,"offset":1726},"end":{"line":32,"column":54,"offset":1779},"indent":[]}}],"position":{"start":{"line":32,"column":1,"offset":1726},"end":{"line":32,"column":54,"offset":1779},"indent":[]}},{"type":"list","ordered":false,"start":null,"spread":false,"children":[{"type":"listItem","spread":false,"checked":null,"children":[{"type":"paragraph","children":[{"type":"strong","children":[{"type":"text","value":"return true;","position":{"start":{"line":33,"column":5,"offset":1784},"end":{"line":33,"column":17,"offset":1796},"indent":[]}}],"position":{"start":{"line":33,"column":3,"offset":1782},"end":{"line":33,"column":19,"offset":1798},"indent":[]}},{"type":"text","value":" If you return true the inhibitor will block the execution of the command.\nTo allow a command return a falsey value.","position":{"start":{"line":33,"column":19,"offset":1798},"end":{"line":34,"column":42,"offset":1914},"indent":[1]}}],"position":{"start":{"line":33,"column":3,"offset":1782},"end":{"line":34,"column":42,"offset":1914},"indent":[1]}}],"position":{"start":{"line":33,"column":1,"offset":1780},"end":{"line":34,"column":42,"offset":1914},"indent":[1]}},{"type":"listItem","spread":false,"checked":null,"children":[{"type":"paragraph","children":[{"type":"strong","children":[{"type":"text","value":"return false;","position":{"start":{"line":35,"column":5,"offset":1919},"end":{"line":35,"column":18,"offset":1932},"indent":[]}}],"position":{"start":{"line":35,"column":3,"offset":1917},"end":{"line":35,"column":20,"offset":1934},"indent":[]}},{"type":"text","value":" If you return false the inhibitor will not block the error.","position":{"start":{"line":35,"column":20,"offset":1934},"end":{"line":35,"column":80,"offset":1994},"indent":[]}}],"position":{"start":{"line":35,"column":3,"offset":1917},"end":{"line":35,"column":80,"offset":1994},"indent":[]}}],"position":{"start":{"line":35,"column":1,"offset":1915},"end":{"line":35,"column":80,"offset":1994},"indent":[]}}],"position":{"start":{"line":33,"column":1,"offset":1780},"end":{"line":35,"column":80,"offset":1994},"indent":[1,1]}},{"type":"code","lang":"ts","meta":null,"value":"// If the command is not VIP only we can allow this command to execute\nif (!command.boostRequired) return false;\n\n// Check if the user has boosted this server\nconst userIsVIP = await isUserVIP(message.author.id)\n// The user is VIP so we can allow this command to be used\nif (userIsVIP) return false;\n\n// The user is NOT VIP so we throw an error\nthrow `The ${command.name} is only allowed for VIP users.`","position":{"start":{"line":38,"column":1,"offset":1997},"end":{"line":49,"column":4,"offset":2410},"indent":[1,1,1,1,1,1,1,1,1,1,1]}},{"type":"export","value":"export const _frontmatter = {\"title\":\"Creating Inhibitors!\",\"metaTitle\":\"Creating An Inhibitor | Discordeno\",\"metaDescription\":\"Let's create our very own bot with Discordeno!\"}","position":{"start":{"line":52,"column":1,"offset":2413},"end":{"line":52,"column":177,"offset":2589},"indent":[]}}],"position":{"start":{"line":1,"column":1,"offset":0},"end":{"line":52,"column":177,"offset":2589}}},"scopeImports":["import * as React from 'react'"],"scopeIdentifiers":["React"],"body":"function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }\n\nfunction _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }\n\nfunction _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }\n\n/* @jsx mdx */\nvar _frontmatter = {\n \"title\": \"Creating Inhibitors!\",\n \"metaTitle\": \"Creating An Inhibitor | Discordeno\",\n \"metaDescription\": \"Let's create our very own bot with Discordeno!\"\n};\nvar layoutProps = {\n _frontmatter: _frontmatter\n};\nvar MDXLayout = \"wrapper\";\nreturn function MDXContent(_ref) {\n var components = _ref.components,\n props = _objectWithoutProperties(_ref, [\"components\"]);\n\n return mdx(MDXLayout, _extends({}, layoutProps, props, {\n components: components,\n mdxType: \"MDXLayout\"\n }), mdx(\"p\", null, \"Woah! You are almost half way done with understanding all of Discordeno. Amazing isn't it? Something you may have noticed in the last section was there were some options that prevented some commands from running like \", mdx(\"inlineCode\", {\n parentName: \"p\"\n }, \"dmOnly\"), \" or the permission options. we created a setting to prevent the monitor from running in certain channels. What if we wanted to do prevent commands from happening? How would we prevent commands from running?\"), mdx(\"h2\", null, \"What is an Inhibitor?\"), mdx(\"p\", null, \"An Inhibitor is very similar to how monitors work. A monitor runs on every message but an inhibitor runs on every command. Remember all those command options like cooldown, permissions, permissionLevel, nsfw, etc... Each and every one of these options has an inhibitor in that checks commands for these settings.\"), mdx(\"p\", null, \"Let's create our own inhibitor that would prevent commands from being used if the user is not a VIP user.\"), mdx(\"blockquote\", null, mdx(\"p\", {\n parentName: \"blockquote\"\n }, mdx(\"strong\", {\n parentName: \"p\"\n }, \"Note:\"), \" It is important to remember that everything below can be done with a simple permission level as well. We will create our own custom permission levels but for the purposes of this guide and to be able to learn about Inhibitors, we will be using an inhibitor.\")), mdx(\"h2\", null, \"Creating the File\"), mdx(\"p\", null, \"Let's start by creating a file inside the inhibitors folder called \", mdx(\"inlineCode\", {\n parentName: \"p\"\n }, \"boosted.ts\"), \" and paste the following snippet of code:\"), mdx(\"pre\", null, mdx(\"code\", _extends({\n parentName: \"pre\"\n }, {\n \"className\": \"language-ts\"\n }), \"import { botCache } from \\\"../../mod.ts\\\";\\n\\nbotCache.inhibitors.set(\\\"inhibitorname\\\", async function (message, command, guild) {\\n // Your code goes here\\n});\\n\")), mdx(\"p\", null, \"Inhibitors can take up to 3 arguments.\"), mdx(\"ul\", null, mdx(\"li\", {\n parentName: \"ul\"\n }, mdx(\"inlineCode\", {\n parentName: \"li\"\n }, \"message\"), \": The message object that triggered the command.\"), mdx(\"li\", {\n parentName: \"ul\"\n }, mdx(\"inlineCode\", {\n parentName: \"li\"\n }, \"command\"), \": The command object itself that was triggered.\"), mdx(\"li\", {\n parentName: \"ul\"\n }, mdx(\"inlineCode\", {\n parentName: \"li\"\n }, \"guild\"), \": The server guild object where this command was ran.\")), mdx(\"h2\", null, \"Understanding How Inhibitors Function\"), mdx(\"p\", null, \"To block a command you have to return a truthy value.\"), mdx(\"ul\", null, mdx(\"li\", {\n parentName: \"ul\"\n }, mdx(\"strong\", {\n parentName: \"li\"\n }, \"return true;\"), \" If you return true the inhibitor will block the execution of the command.\\nTo allow a command return a falsey value.\"), mdx(\"li\", {\n parentName: \"ul\"\n }, mdx(\"strong\", {\n parentName: \"li\"\n }, \"return false;\"), \" If you return false the inhibitor will not block the error.\")), mdx(\"pre\", null, mdx(\"code\", _extends({\n parentName: \"pre\"\n }, {\n \"className\": \"language-ts\"\n }), \"// If the command is not VIP only we can allow this command to execute\\nif (!command.boostRequired) return false;\\n\\n// Check if the user has boosted this server\\nconst userIsVIP = await isUserVIP(message.author.id)\\n// The user is VIP so we can allow this command to be used\\nif (userIsVIP) return false;\\n\\n// The user is NOT VIP so we throw an error\\nthrow `The ${command.name} is only allowed for VIP users.`\\n\")));\n}\n;\nMDXContent.isMDXComponent = true;","rawMDXOutput":"/* @jsx mdx */\nimport { mdx } from '@mdx-js/react';\n/* @jsx mdx */\n\nexport const _frontmatter = {\n \"title\": \"Creating Inhibitors!\",\n \"metaTitle\": \"Creating An Inhibitor | Discordeno\",\n \"metaDescription\": \"Let's create our very own bot with Discordeno!\"\n};\n\nconst layoutProps = {\n _frontmatter\n};\nconst MDXLayout = \"wrapper\"\nexport default function MDXContent({\n components,\n ...props\n}) {\n return \n

{`Woah! You are almost half way done with understanding all of Discordeno. Amazing isn't it? Something you may have noticed in the last section was there were some options that prevented some commands from running like `}{`dmOnly`}{` or the permission options. we created a setting to prevent the monitor from running in certain channels. What if we wanted to do prevent commands from happening? How would we prevent commands from running?`}

\n

{`What is an Inhibitor?`}

\n

{`An Inhibitor is very similar to how monitors work. A monitor runs on every message but an inhibitor runs on every command. Remember all those command options like cooldown, permissions, permissionLevel, nsfw, etc... Each and every one of these options has an inhibitor in that checks commands for these settings.`}

\n

{`Let's create our own inhibitor that would prevent commands from being used if the user is not a VIP user.`}

\n
\n

{`Note:`}{` It is important to remember that everything below can be done with a simple permission level as well. We will create our own custom permission levels but for the purposes of this guide and to be able to learn about Inhibitors, we will be using an inhibitor.`}

\n
\n

{`Creating the File`}

\n

{`Let's start by creating a file inside the inhibitors folder called `}{`boosted.ts`}{` and paste the following snippet of code:`}

\n
{`import { botCache } from \"../../mod.ts\";\n\nbotCache.inhibitors.set(\"inhibitorname\", async function (message, command, guild) {\n    // Your code goes here\n});\n`}
\n

{`Inhibitors can take up to 3 arguments.`}

\n
    \n
  • {`message`}{`: The message object that triggered the command.`}
  • \n
  • {`command`}{`: The command object itself that was triggered.`}
  • \n
  • {`guild`}{`: The server guild object where this command was ran.`}
  • \n
\n

{`Understanding How Inhibitors Function`}

\n

{`To block a command you have to return a truthy value.`}

\n
    \n
  • {`return true;`}{` If you return true the inhibitor will block the execution of the command.\nTo allow a command return a falsey value.`}
  • \n
  • {`return false;`}{` If you return false the inhibitor will not block the error.`}
  • \n
\n
{`// If the command is not VIP only we can allow this command to execute\nif (!command.boostRequired) return false;\n\n// Check if the user has boosted this server\nconst userIsVIP = await isUserVIP(message.author.id)\n// The user is VIP so we can allow this command to be used\nif (userIsVIP) return false;\n\n// The user is NOT VIP so we throw an error\nthrow \\`The \\${command.name} is only allowed for VIP users.\\`\n`}
\n\n
;\n}\n\n;\nMDXContent.isMDXComponent = true;"}} \ No newline at end of file diff --git a/docs/.cache/caches/gatsby-plugin-mdx/diskstore-569b61f23c759cc425604a583501cc29.json b/docs/.cache/caches/gatsby-plugin-mdx/diskstore-569b61f23c759cc425604a583501cc29.json new file mode 100644 index 000000000..a0ec9f6c5 --- /dev/null +++ b/docs/.cache/caches/gatsby-plugin-mdx/diskstore-569b61f23c759cc425604a583501cc29.json @@ -0,0 +1 @@ +{"expireTime":9007200851596822000,"key":"gatsby-plugin-mdx-entire-payload-551a633896c8cb022b7cb17a1bc6676e-","val":{"mdast":{"type":"root","children":[{"type":"paragraph","children":[{"type":"text","value":"Woah! You are almost half way done with understanding all of Klasa. Amazing isn't it? Something you may have noticed in the last section was that we created a setting to prevent the monitor from running in certain channels. What if we wanted to do prevent commands from happening? How would we prevent commands from running?","position":{"start":{"line":2,"column":1,"offset":1},"end":{"line":2,"column":325,"offset":325},"indent":[]}}],"position":{"start":{"line":2,"column":1,"offset":1},"end":{"line":2,"column":325,"offset":325},"indent":[]}},{"type":"export","value":"export const _frontmatter = {\"title\":\"Creating Inhibitors!\",\"metaTitle\":\"Creating An Inhibitor | Discordeno\",\"metaDescription\":\"Let's create our very own bot with Discordeno!\"}","position":{"start":{"line":5,"column":1,"offset":328},"end":{"line":5,"column":177,"offset":504},"indent":[]}}],"position":{"start":{"line":1,"column":1,"offset":0},"end":{"line":5,"column":177,"offset":504}}},"scopeImports":["import * as React from 'react'"],"scopeIdentifiers":["React"],"body":"function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }\n\nfunction _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }\n\nfunction _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }\n\n/* @jsx mdx */\nvar _frontmatter = {\n \"title\": \"Creating Inhibitors!\",\n \"metaTitle\": \"Creating An Inhibitor | Discordeno\",\n \"metaDescription\": \"Let's create our very own bot with Discordeno!\"\n};\nvar layoutProps = {\n _frontmatter: _frontmatter\n};\nvar MDXLayout = \"wrapper\";\nreturn function MDXContent(_ref) {\n var components = _ref.components,\n props = _objectWithoutProperties(_ref, [\"components\"]);\n\n return mdx(MDXLayout, _extends({}, layoutProps, props, {\n components: components,\n mdxType: \"MDXLayout\"\n }), mdx(\"p\", null, \"Woah! You are almost half way done with understanding all of Klasa. Amazing isn't it? Something you may have noticed in the last section was that we created a setting to prevent the monitor from running in certain channels. What if we wanted to do prevent commands from happening? How would we prevent commands from running?\"));\n}\n;\nMDXContent.isMDXComponent = true;","rawMDXOutput":"/* @jsx mdx */\nimport { mdx } from '@mdx-js/react';\n/* @jsx mdx */\n\nexport const _frontmatter = {\n \"title\": \"Creating Inhibitors!\",\n \"metaTitle\": \"Creating An Inhibitor | Discordeno\",\n \"metaDescription\": \"Let's create our very own bot with Discordeno!\"\n};\n\nconst layoutProps = {\n _frontmatter\n};\nconst MDXLayout = \"wrapper\"\nexport default function MDXContent({\n components,\n ...props\n}) {\n return \n

{`Woah! You are almost half way done with understanding all of Klasa. Amazing isn't it? Something you may have noticed in the last section was that we created a setting to prevent the monitor from running in certain channels. What if we wanted to do prevent commands from happening? How would we prevent commands from running?`}

\n\n
;\n}\n\n;\nMDXContent.isMDXComponent = true;"}} \ No newline at end of file diff --git a/docs/.cache/caches/gatsby-plugin-mdx/diskstore-57c268670c7fc0b69e57e50ee08a28cf.json b/docs/.cache/caches/gatsby-plugin-mdx/diskstore-57c268670c7fc0b69e57e50ee08a28cf.json new file mode 100644 index 000000000..7f458a3a4 --- /dev/null +++ b/docs/.cache/caches/gatsby-plugin-mdx/diskstore-57c268670c7fc0b69e57e50ee08a28cf.json @@ -0,0 +1 @@ +{"expireTime":9007200851635045000,"key":"gatsby-plugin-mdx-entire-payload-ac24e2006f5ba224809e664e659a61b9-","val":{"mdast":{"type":"root","children":[{"type":"paragraph","children":[{"type":"text","value":"Woah! You are almost half way done with understanding all of Discordeno. Amazing isn't it? Something you may have noticed in the last section was there were some options that prevented some commands from running like ","position":{"start":{"line":2,"column":1,"offset":1},"end":{"line":2,"column":218,"offset":218},"indent":[]}},{"type":"inlineCode","value":"dmOnly","position":{"start":{"line":2,"column":218,"offset":218},"end":{"line":2,"column":226,"offset":226},"indent":[]}},{"type":"text","value":" or the permission options. we created a setting to prevent the monitor from running in certain channels. What if we wanted to do prevent commands from happening? How would we prevent commands from running?","position":{"start":{"line":2,"column":226,"offset":226},"end":{"line":2,"column":432,"offset":432},"indent":[]}}],"position":{"start":{"line":2,"column":1,"offset":1},"end":{"line":2,"column":432,"offset":432},"indent":[]}},{"type":"heading","depth":2,"children":[{"type":"text","value":"What is an Inhibitor?","position":{"start":{"line":4,"column":4,"offset":437},"end":{"line":4,"column":25,"offset":458},"indent":[]}}],"position":{"start":{"line":4,"column":1,"offset":434},"end":{"line":4,"column":25,"offset":458},"indent":[]}},{"type":"export","value":"export const _frontmatter = {\"title\":\"Creating Events!\",\"metaTitle\":\"Creating An Event | Discordeno\",\"metaDescription\":\"Let's create our very own bot with Discordeno!\"}","position":{"start":{"line":8,"column":1,"offset":462},"end":{"line":8,"column":169,"offset":630},"indent":[]}}],"position":{"start":{"line":1,"column":1,"offset":0},"end":{"line":8,"column":169,"offset":630}}},"scopeImports":["import * as React from 'react'"],"scopeIdentifiers":["React"],"body":"function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }\n\nfunction _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }\n\nfunction _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }\n\n/* @jsx mdx */\nvar _frontmatter = {\n \"title\": \"Creating Events!\",\n \"metaTitle\": \"Creating An Event | Discordeno\",\n \"metaDescription\": \"Let's create our very own bot with Discordeno!\"\n};\nvar layoutProps = {\n _frontmatter: _frontmatter\n};\nvar MDXLayout = \"wrapper\";\nreturn function MDXContent(_ref) {\n var components = _ref.components,\n props = _objectWithoutProperties(_ref, [\"components\"]);\n\n return mdx(MDXLayout, _extends({}, layoutProps, props, {\n components: components,\n mdxType: \"MDXLayout\"\n }), mdx(\"p\", null, \"Woah! You are almost half way done with understanding all of Discordeno. Amazing isn't it? Something you may have noticed in the last section was there were some options that prevented some commands from running like \", mdx(\"inlineCode\", {\n parentName: \"p\"\n }, \"dmOnly\"), \" or the permission options. we created a setting to prevent the monitor from running in certain channels. What if we wanted to do prevent commands from happening? How would we prevent commands from running?\"), mdx(\"h2\", null, \"What is an Inhibitor?\"));\n}\n;\nMDXContent.isMDXComponent = true;","rawMDXOutput":"/* @jsx mdx */\nimport { mdx } from '@mdx-js/react';\n/* @jsx mdx */\n\nexport const _frontmatter = {\n \"title\": \"Creating Events!\",\n \"metaTitle\": \"Creating An Event | Discordeno\",\n \"metaDescription\": \"Let's create our very own bot with Discordeno!\"\n};\n\nconst layoutProps = {\n _frontmatter\n};\nconst MDXLayout = \"wrapper\"\nexport default function MDXContent({\n components,\n ...props\n}) {\n return \n

{`Woah! You are almost half way done with understanding all of Discordeno. Amazing isn't it? Something you may have noticed in the last section was there were some options that prevented some commands from running like `}{`dmOnly`}{` or the permission options. we created a setting to prevent the monitor from running in certain channels. What if we wanted to do prevent commands from happening? How would we prevent commands from running?`}

\n

{`What is an Inhibitor?`}

\n\n
;\n}\n\n;\nMDXContent.isMDXComponent = true;"}} \ No newline at end of file diff --git a/docs/.cache/caches/gatsby-plugin-mdx/diskstore-5a931acdf6c13efd74cef3e5c64561d5.json b/docs/.cache/caches/gatsby-plugin-mdx/diskstore-5a931acdf6c13efd74cef3e5c64561d5.json new file mode 100644 index 000000000..4e6af9cac --- /dev/null +++ b/docs/.cache/caches/gatsby-plugin-mdx/diskstore-5a931acdf6c13efd74cef3e5c64561d5.json @@ -0,0 +1 @@ +{"expireTime":9007200851634898000,"key":"gatsby-plugin-mdx-entire-payload-1a6dcbe6e81789239459f1ee2e5731fc-","val":{"mdast":{"type":"root","children":[{"type":"paragraph","children":[{"type":"text","value":"Woah! You are almost half way done with understanding all of Discordeno. Amazing isn't it? Something you may have noticed in the last section was there were some options that prevented some commands from running like ","position":{"start":{"line":2,"column":1,"offset":1},"end":{"line":2,"column":218,"offset":218},"indent":[]}},{"type":"inlineCode","value":"dmOnly","position":{"start":{"line":2,"column":218,"offset":218},"end":{"line":2,"column":226,"offset":226},"indent":[]}},{"type":"text","value":" or the permission options. we created a setting to prevent the monitor from running in certain channels. What if we wanted to do prevent commands from happening? How would we prevent commands from running?","position":{"start":{"line":2,"column":226,"offset":226},"end":{"line":2,"column":432,"offset":432},"indent":[]}}],"position":{"start":{"line":2,"column":1,"offset":1},"end":{"line":2,"column":432,"offset":432},"indent":[]}},{"type":"heading","depth":2,"children":[{"type":"text","value":"What is an Inhibitor?","position":{"start":{"line":4,"column":4,"offset":437},"end":{"line":4,"column":25,"offset":458},"indent":[]}}],"position":{"start":{"line":4,"column":1,"offset":434},"end":{"line":4,"column":25,"offset":458},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"An Inhibitor is very similar to how monitors work. A monitor runs on every message but an inhibitor runs on every command. Remember all those command options like cooldown, permissions, permissionLevel, nsfw, etc... Each and every one of these options has an inhibitor in that checks commands for these settings.","position":{"start":{"line":6,"column":1,"offset":460},"end":{"line":6,"column":313,"offset":772},"indent":[]}}],"position":{"start":{"line":6,"column":1,"offset":460},"end":{"line":6,"column":313,"offset":772},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"Let's create our own inhibitor that would prevent commands from being used if the user is not a VIP user.","position":{"start":{"line":8,"column":1,"offset":774},"end":{"line":8,"column":106,"offset":879},"indent":[]}}],"position":{"start":{"line":8,"column":1,"offset":774},"end":{"line":8,"column":106,"offset":879},"indent":[]}},{"type":"blockquote","children":[{"type":"paragraph","children":[{"type":"strong","children":[{"type":"text","value":"Note:","position":{"start":{"line":10,"column":5,"offset":885},"end":{"line":10,"column":10,"offset":890},"indent":[]}}],"position":{"start":{"line":10,"column":3,"offset":883},"end":{"line":10,"column":12,"offset":892},"indent":[]}},{"type":"text","value":" It is important to remember that everything below can be done with a simple permission level as well. We will create our own custom permission levels but for the purposes of this guide and to be able to learn about Inhibitors, we will be using an inhibitor.","position":{"start":{"line":10,"column":12,"offset":892},"end":{"line":10,"column":270,"offset":1150},"indent":[]}}],"position":{"start":{"line":10,"column":3,"offset":883},"end":{"line":10,"column":270,"offset":1150},"indent":[]}}],"position":{"start":{"line":10,"column":1,"offset":881},"end":{"line":10,"column":270,"offset":1150},"indent":[]}},{"type":"heading","depth":2,"children":[{"type":"text","value":"Creating the File","position":{"start":{"line":12,"column":4,"offset":1155},"end":{"line":12,"column":21,"offset":1172},"indent":[]}}],"position":{"start":{"line":12,"column":1,"offset":1152},"end":{"line":12,"column":21,"offset":1172},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"Let's start by creating a file inside the inhibitors folder called ","position":{"start":{"line":14,"column":1,"offset":1174},"end":{"line":14,"column":68,"offset":1241},"indent":[]}},{"type":"inlineCode","value":"boosted.ts","position":{"start":{"line":14,"column":68,"offset":1241},"end":{"line":14,"column":80,"offset":1253},"indent":[]}},{"type":"text","value":" and paste the following snippet of code:","position":{"start":{"line":14,"column":80,"offset":1253},"end":{"line":14,"column":121,"offset":1294},"indent":[]}}],"position":{"start":{"line":14,"column":1,"offset":1174},"end":{"line":14,"column":121,"offset":1294},"indent":[]}},{"type":"code","lang":"ts","meta":null,"value":"import { botCache } from \"../../mod.ts\";\n\nbotCache.inhibitors.set(\"inhibitorname\", async function (message, command, guild) {\n\t// Your code goes here\n});","position":{"start":{"line":16,"column":1,"offset":1296},"end":{"line":22,"column":4,"offset":1459},"indent":[1,1,1,1,1,1]}},{"type":"paragraph","children":[{"type":"text","value":"Inhibitors can take up to 3 arguments.","position":{"start":{"line":24,"column":1,"offset":1461},"end":{"line":24,"column":39,"offset":1499},"indent":[]}}],"position":{"start":{"line":24,"column":1,"offset":1461},"end":{"line":24,"column":39,"offset":1499},"indent":[]}},{"type":"list","ordered":false,"start":null,"spread":false,"children":[{"type":"listItem","spread":false,"checked":null,"children":[{"type":"paragraph","children":[{"type":"inlineCode","value":"message","position":{"start":{"line":26,"column":3,"offset":1503},"end":{"line":26,"column":12,"offset":1512},"indent":[]}},{"type":"text","value":": The message object that triggered the command.","position":{"start":{"line":26,"column":12,"offset":1512},"end":{"line":26,"column":60,"offset":1560},"indent":[]}}],"position":{"start":{"line":26,"column":3,"offset":1503},"end":{"line":26,"column":60,"offset":1560},"indent":[]}}],"position":{"start":{"line":26,"column":1,"offset":1501},"end":{"line":26,"column":60,"offset":1560},"indent":[]}},{"type":"listItem","spread":false,"checked":null,"children":[{"type":"paragraph","children":[{"type":"inlineCode","value":"command","position":{"start":{"line":27,"column":3,"offset":1563},"end":{"line":27,"column":12,"offset":1572},"indent":[]}},{"type":"text","value":": The command object itself that was triggered.","position":{"start":{"line":27,"column":12,"offset":1572},"end":{"line":27,"column":59,"offset":1619},"indent":[]}}],"position":{"start":{"line":27,"column":3,"offset":1563},"end":{"line":27,"column":59,"offset":1619},"indent":[]}}],"position":{"start":{"line":27,"column":1,"offset":1561},"end":{"line":27,"column":59,"offset":1619},"indent":[]}},{"type":"listItem","spread":false,"checked":null,"children":[{"type":"paragraph","children":[{"type":"inlineCode","value":"guild","position":{"start":{"line":28,"column":3,"offset":1622},"end":{"line":28,"column":10,"offset":1629},"indent":[]}},{"type":"text","value":": The server guild object where this command was ran.","position":{"start":{"line":28,"column":10,"offset":1629},"end":{"line":28,"column":63,"offset":1682},"indent":[]}}],"position":{"start":{"line":28,"column":3,"offset":1622},"end":{"line":28,"column":63,"offset":1682},"indent":[]}}],"position":{"start":{"line":28,"column":1,"offset":1620},"end":{"line":28,"column":63,"offset":1682},"indent":[]}}],"position":{"start":{"line":26,"column":1,"offset":1501},"end":{"line":28,"column":63,"offset":1682},"indent":[1,1]}},{"type":"heading","depth":2,"children":[{"type":"text","value":"Understanding How Inhibitors Function","position":{"start":{"line":30,"column":4,"offset":1687},"end":{"line":30,"column":41,"offset":1724},"indent":[]}}],"position":{"start":{"line":30,"column":1,"offset":1684},"end":{"line":30,"column":41,"offset":1724},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"To block a command you have to return a truthy value.","position":{"start":{"line":32,"column":1,"offset":1726},"end":{"line":32,"column":54,"offset":1779},"indent":[]}}],"position":{"start":{"line":32,"column":1,"offset":1726},"end":{"line":32,"column":54,"offset":1779},"indent":[]}},{"type":"list","ordered":false,"start":null,"spread":false,"children":[{"type":"listItem","spread":false,"checked":null,"children":[{"type":"paragraph","children":[{"type":"strong","children":[{"type":"text","value":"return true;","position":{"start":{"line":33,"column":5,"offset":1784},"end":{"line":33,"column":17,"offset":1796},"indent":[]}}],"position":{"start":{"line":33,"column":3,"offset":1782},"end":{"line":33,"column":19,"offset":1798},"indent":[]}},{"type":"text","value":" If you return true the inhibitor will block the execution of the command.\nTo allow a command return a falsey value.","position":{"start":{"line":33,"column":19,"offset":1798},"end":{"line":34,"column":42,"offset":1914},"indent":[1]}}],"position":{"start":{"line":33,"column":3,"offset":1782},"end":{"line":34,"column":42,"offset":1914},"indent":[1]}}],"position":{"start":{"line":33,"column":1,"offset":1780},"end":{"line":34,"column":42,"offset":1914},"indent":[1]}},{"type":"listItem","spread":false,"checked":null,"children":[{"type":"paragraph","children":[{"type":"strong","children":[{"type":"text","value":"return false;","position":{"start":{"line":35,"column":5,"offset":1919},"end":{"line":35,"column":18,"offset":1932},"indent":[]}}],"position":{"start":{"line":35,"column":3,"offset":1917},"end":{"line":35,"column":20,"offset":1934},"indent":[]}},{"type":"text","value":" If you return false the inhibitor will not block the error.","position":{"start":{"line":35,"column":20,"offset":1934},"end":{"line":35,"column":80,"offset":1994},"indent":[]}}],"position":{"start":{"line":35,"column":3,"offset":1917},"end":{"line":35,"column":80,"offset":1994},"indent":[]}}],"position":{"start":{"line":35,"column":1,"offset":1915},"end":{"line":35,"column":80,"offset":1994},"indent":[]}}],"position":{"start":{"line":33,"column":1,"offset":1780},"end":{"line":35,"column":80,"offset":1994},"indent":[1,1]}},{"type":"code","lang":"ts","meta":null,"value":"// If the command is not VIP only we can allow this command to execute\nif (!command.vipOnly) return false;\n\n// The bot's support server\nconst guild = cache.guilds.get(configs.supportServerID);\n// If the command author is not in the server they won't have the vip role\nconst member = guild.members.get(message.author.id) || await getMember(guild.id, message.author.id);\n// Member doesn't exist so cancel the command\nif (!member) {\n\tsendResponse(message, `sorry, but you can not use this command until you become VIP. **Close the IRIS!!!**`)\n\treturn true;\n}\n\n// If the user has the vip role on the support server given by patreon allow the command\nif (member.roles.includes(configs.roleIDs.patreonVIPRoleID)) return false;\n\n// Alert the user they don't have vip and can't use the command\nsendResponse(message, `sorry, but you can not use this command until you become a VIP. I'm sorry, Teal'c. We'll go to Disneyland next year. I promise.`)\n// Cancel the command since the user does not have vip\nreturn true;","position":{"start":{"line":38,"column":1,"offset":1997},"end":{"line":59,"column":4,"offset":3013},"indent":[1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1]}},{"type":"heading","depth":2,"children":[{"type":"text","value":"Updating Command Typings","position":{"start":{"line":61,"column":4,"offset":3018},"end":{"line":61,"column":28,"offset":3042},"indent":[]}}],"position":{"start":{"line":61,"column":1,"offset":3015},"end":{"line":61,"column":28,"offset":3042},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"Since we need a new option on our commands we need to add that. Open the `","position":{"start":{"line":63,"column":1,"offset":3044},"end":{"line":63,"column":75,"offset":3118},"indent":[]}}],"position":{"start":{"line":63,"column":1,"offset":3044},"end":{"line":63,"column":75,"offset":3118},"indent":[]}},{"type":"heading","depth":2,"children":[{"type":"text","value":"Challenges","position":{"start":{"line":65,"column":4,"offset":3123},"end":{"line":65,"column":14,"offset":3133},"indent":[]}}],"position":{"start":{"line":65,"column":1,"offset":3120},"end":{"line":65,"column":14,"offset":3133},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"Hell yes! We just got through the entire inhibitor section. You have now mastered everything related to inhibitors.","position":{"start":{"line":67,"column":1,"offset":3135},"end":{"line":67,"column":116,"offset":3250},"indent":[]}}],"position":{"start":{"line":67,"column":1,"offset":3135},"end":{"line":67,"column":116,"offset":3250},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"You can now try and get a little more practice with inhibitors by trying to challenge yourself and make your own inhibitors. Don't worry if you can't think of any good use cases for inhibitors.","position":{"start":{"line":69,"column":1,"offset":3252},"end":{"line":69,"column":194,"offset":3445},"indent":[]}}],"position":{"start":{"line":69,"column":1,"offset":3252},"end":{"line":69,"column":194,"offset":3445},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"Majority of Discordeno bots do not use many custom inhibitors because most of the necessary/important ones already come built for you in the inhibitors folder.","position":{"start":{"line":71,"column":1,"offset":3447},"end":{"line":71,"column":160,"offset":3606},"indent":[]}}],"position":{"start":{"line":71,"column":1,"offset":3447},"end":{"line":71,"column":160,"offset":3606},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"Next we will try our hands at creating a monitor.","position":{"start":{"line":73,"column":1,"offset":3608},"end":{"line":73,"column":50,"offset":3657},"indent":[]}}],"position":{"start":{"line":73,"column":1,"offset":3608},"end":{"line":73,"column":50,"offset":3657},"indent":[]}},{"type":"export","value":"export const _frontmatter = {\"title\":\"Creating Inhibitors!\",\"metaTitle\":\"Creating An Inhibitor | Discordeno\",\"metaDescription\":\"Let's create our very own bot with Discordeno!\"}","position":{"start":{"line":76,"column":1,"offset":3660},"end":{"line":76,"column":177,"offset":3836},"indent":[]}}],"position":{"start":{"line":1,"column":1,"offset":0},"end":{"line":76,"column":177,"offset":3836}}},"scopeImports":["import * as React from 'react'"],"scopeIdentifiers":["React"],"body":"function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }\n\nfunction _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }\n\nfunction _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }\n\n/* @jsx mdx */\nvar _frontmatter = {\n \"title\": \"Creating Inhibitors!\",\n \"metaTitle\": \"Creating An Inhibitor | Discordeno\",\n \"metaDescription\": \"Let's create our very own bot with Discordeno!\"\n};\nvar layoutProps = {\n _frontmatter: _frontmatter\n};\nvar MDXLayout = \"wrapper\";\nreturn function MDXContent(_ref) {\n var components = _ref.components,\n props = _objectWithoutProperties(_ref, [\"components\"]);\n\n return mdx(MDXLayout, _extends({}, layoutProps, props, {\n components: components,\n mdxType: \"MDXLayout\"\n }), mdx(\"p\", null, \"Woah! You are almost half way done with understanding all of Discordeno. Amazing isn't it? Something you may have noticed in the last section was there were some options that prevented some commands from running like \", mdx(\"inlineCode\", {\n parentName: \"p\"\n }, \"dmOnly\"), \" or the permission options. we created a setting to prevent the monitor from running in certain channels. What if we wanted to do prevent commands from happening? How would we prevent commands from running?\"), mdx(\"h2\", null, \"What is an Inhibitor?\"), mdx(\"p\", null, \"An Inhibitor is very similar to how monitors work. A monitor runs on every message but an inhibitor runs on every command. Remember all those command options like cooldown, permissions, permissionLevel, nsfw, etc... Each and every one of these options has an inhibitor in that checks commands for these settings.\"), mdx(\"p\", null, \"Let's create our own inhibitor that would prevent commands from being used if the user is not a VIP user.\"), mdx(\"blockquote\", null, mdx(\"p\", {\n parentName: \"blockquote\"\n }, mdx(\"strong\", {\n parentName: \"p\"\n }, \"Note:\"), \" It is important to remember that everything below can be done with a simple permission level as well. We will create our own custom permission levels but for the purposes of this guide and to be able to learn about Inhibitors, we will be using an inhibitor.\")), mdx(\"h2\", null, \"Creating the File\"), mdx(\"p\", null, \"Let's start by creating a file inside the inhibitors folder called \", mdx(\"inlineCode\", {\n parentName: \"p\"\n }, \"boosted.ts\"), \" and paste the following snippet of code:\"), mdx(\"pre\", null, mdx(\"code\", _extends({\n parentName: \"pre\"\n }, {\n \"className\": \"language-ts\"\n }), \"import { botCache } from \\\"../../mod.ts\\\";\\n\\nbotCache.inhibitors.set(\\\"inhibitorname\\\", async function (message, command, guild) {\\n // Your code goes here\\n});\\n\")), mdx(\"p\", null, \"Inhibitors can take up to 3 arguments.\"), mdx(\"ul\", null, mdx(\"li\", {\n parentName: \"ul\"\n }, mdx(\"inlineCode\", {\n parentName: \"li\"\n }, \"message\"), \": The message object that triggered the command.\"), mdx(\"li\", {\n parentName: \"ul\"\n }, mdx(\"inlineCode\", {\n parentName: \"li\"\n }, \"command\"), \": The command object itself that was triggered.\"), mdx(\"li\", {\n parentName: \"ul\"\n }, mdx(\"inlineCode\", {\n parentName: \"li\"\n }, \"guild\"), \": The server guild object where this command was ran.\")), mdx(\"h2\", null, \"Understanding How Inhibitors Function\"), mdx(\"p\", null, \"To block a command you have to return a truthy value.\"), mdx(\"ul\", null, mdx(\"li\", {\n parentName: \"ul\"\n }, mdx(\"strong\", {\n parentName: \"li\"\n }, \"return true;\"), \" If you return true the inhibitor will block the execution of the command.\\nTo allow a command return a falsey value.\"), mdx(\"li\", {\n parentName: \"ul\"\n }, mdx(\"strong\", {\n parentName: \"li\"\n }, \"return false;\"), \" If you return false the inhibitor will not block the error.\")), mdx(\"pre\", null, mdx(\"code\", _extends({\n parentName: \"pre\"\n }, {\n \"className\": \"language-ts\"\n }), \"// If the command is not VIP only we can allow this command to execute\\nif (!command.vipOnly) return false;\\n\\n// The bot's support server\\nconst guild = cache.guilds.get(configs.supportServerID);\\n// If the command author is not in the server they won't have the vip role\\nconst member = guild.members.get(message.author.id) || await getMember(guild.id, message.author.id);\\n// Member doesn't exist so cancel the command\\nif (!member) {\\n sendResponse(message, `sorry, but you can not use this command until you become VIP. **Close the IRIS!!!**`)\\n return true;\\n}\\n\\n// If the user has the vip role on the support server given by patreon allow the command\\nif (member.roles.includes(configs.roleIDs.patreonVIPRoleID)) return false;\\n\\n// Alert the user they don't have vip and can't use the command\\nsendResponse(message, `sorry, but you can not use this command until you become a VIP. I'm sorry, Teal'c. We'll go to Disneyland next year. I promise.`)\\n// Cancel the command since the user does not have vip\\nreturn true;\\n\")), mdx(\"h2\", null, \"Updating Command Typings\"), mdx(\"p\", null, \"Since we need a new option on our commands we need to add that. Open the `\"), mdx(\"h2\", null, \"Challenges\"), mdx(\"p\", null, \"Hell yes! We just got through the entire inhibitor section. You have now mastered everything related to inhibitors.\"), mdx(\"p\", null, \"You can now try and get a little more practice with inhibitors by trying to challenge yourself and make your own inhibitors. Don't worry if you can't think of any good use cases for inhibitors.\"), mdx(\"p\", null, \"Majority of Discordeno bots do not use many custom inhibitors because most of the necessary/important ones already come built for you in the inhibitors folder.\"), mdx(\"p\", null, \"Next we will try our hands at creating a monitor.\"));\n}\n;\nMDXContent.isMDXComponent = true;","rawMDXOutput":"/* @jsx mdx */\nimport { mdx } from '@mdx-js/react';\n/* @jsx mdx */\n\nexport const _frontmatter = {\n \"title\": \"Creating Inhibitors!\",\n \"metaTitle\": \"Creating An Inhibitor | Discordeno\",\n \"metaDescription\": \"Let's create our very own bot with Discordeno!\"\n};\n\nconst layoutProps = {\n _frontmatter\n};\nconst MDXLayout = \"wrapper\"\nexport default function MDXContent({\n components,\n ...props\n}) {\n return \n

{`Woah! You are almost half way done with understanding all of Discordeno. Amazing isn't it? Something you may have noticed in the last section was there were some options that prevented some commands from running like `}{`dmOnly`}{` or the permission options. we created a setting to prevent the monitor from running in certain channels. What if we wanted to do prevent commands from happening? How would we prevent commands from running?`}

\n

{`What is an Inhibitor?`}

\n

{`An Inhibitor is very similar to how monitors work. A monitor runs on every message but an inhibitor runs on every command. Remember all those command options like cooldown, permissions, permissionLevel, nsfw, etc... Each and every one of these options has an inhibitor in that checks commands for these settings.`}

\n

{`Let's create our own inhibitor that would prevent commands from being used if the user is not a VIP user.`}

\n
\n

{`Note:`}{` It is important to remember that everything below can be done with a simple permission level as well. We will create our own custom permission levels but for the purposes of this guide and to be able to learn about Inhibitors, we will be using an inhibitor.`}

\n
\n

{`Creating the File`}

\n

{`Let's start by creating a file inside the inhibitors folder called `}{`boosted.ts`}{` and paste the following snippet of code:`}

\n
{`import { botCache } from \"../../mod.ts\";\n\nbotCache.inhibitors.set(\"inhibitorname\", async function (message, command, guild) {\n    // Your code goes here\n});\n`}
\n

{`Inhibitors can take up to 3 arguments.`}

\n
    \n
  • {`message`}{`: The message object that triggered the command.`}
  • \n
  • {`command`}{`: The command object itself that was triggered.`}
  • \n
  • {`guild`}{`: The server guild object where this command was ran.`}
  • \n
\n

{`Understanding How Inhibitors Function`}

\n

{`To block a command you have to return a truthy value.`}

\n
    \n
  • {`return true;`}{` If you return true the inhibitor will block the execution of the command.\nTo allow a command return a falsey value.`}
  • \n
  • {`return false;`}{` If you return false the inhibitor will not block the error.`}
  • \n
\n
{`// If the command is not VIP only we can allow this command to execute\nif (!command.vipOnly) return false;\n\n// The bot's support server\nconst guild = cache.guilds.get(configs.supportServerID);\n// If the command author is not in the server they won't have the vip role\nconst member = guild.members.get(message.author.id) || await getMember(guild.id, message.author.id);\n// Member doesn't exist so cancel the command\nif (!member) {\n    sendResponse(message, \\`sorry, but you can not use this command until you become VIP. **Close the IRIS!!!**\\`)\n    return true;\n}\n\n// If the user has the vip role on the support server given by patreon allow the command\nif (member.roles.includes(configs.roleIDs.patreonVIPRoleID)) return false;\n\n// Alert the user they don't have vip and can't use the command\nsendResponse(message, \\`sorry, but you can not use this command until you become a VIP. I'm sorry, Teal'c. We'll go to Disneyland next year. I promise.\\`)\n// Cancel the command since the user does not have vip\nreturn true;\n`}
\n

{`Updating Command Typings`}

\n

{`Since we need a new option on our commands we need to add that. Open the \\``}

\n

{`Challenges`}

\n

{`Hell yes! We just got through the entire inhibitor section. You have now mastered everything related to inhibitors.`}

\n

{`You can now try and get a little more practice with inhibitors by trying to challenge yourself and make your own inhibitors. Don't worry if you can't think of any good use cases for inhibitors.`}

\n

{`Majority of Discordeno bots do not use many custom inhibitors because most of the necessary/important ones already come built for you in the inhibitors folder.`}

\n

{`Next we will try our hands at creating a monitor.`}

\n\n
;\n}\n\n;\nMDXContent.isMDXComponent = true;"}} \ No newline at end of file diff --git a/docs/.cache/caches/gatsby-plugin-mdx/diskstore-5b49a3a2037e09b0b767101a0ba9d679.json b/docs/.cache/caches/gatsby-plugin-mdx/diskstore-5b49a3a2037e09b0b767101a0ba9d679.json new file mode 100644 index 000000000..d1e108e9a --- /dev/null +++ b/docs/.cache/caches/gatsby-plugin-mdx/diskstore-5b49a3a2037e09b0b767101a0ba9d679.json @@ -0,0 +1 @@ +{"expireTime":9007200851635249000,"key":"gatsby-plugin-mdx-entire-payload-2516d940edd7a6f5eac15b0f2e42e9dd-","val":{"mdast":{"type":"root","children":[{"type":"paragraph","children":[{"type":"text","value":"Woah! You are almost half way done with understanding all of Discordeno. Amazing isn't it? Something you may have noticed in the last section was when the bot started up you could see a bunch of messages like ","position":{"start":{"line":2,"column":1,"offset":1},"end":{"line":2,"column":210,"offset":210},"indent":[]}},{"type":"inlineCode","value":"Loaded X Commands","position":{"start":{"line":2,"column":210,"offset":210},"end":{"line":2,"column":229,"offset":229},"indent":[]}},{"type":"text","value":" and such. Let's jump into this part now and understand how event handling works in Discordeno.","position":{"start":{"line":2,"column":229,"offset":229},"end":{"line":2,"column":324,"offset":324},"indent":[]}}],"position":{"start":{"line":2,"column":1,"offset":1},"end":{"line":2,"column":324,"offset":324},"indent":[]}},{"type":"heading","depth":2,"children":[{"type":"text","value":"What Is An Event?","position":{"start":{"line":4,"column":4,"offset":329},"end":{"line":4,"column":21,"offset":346},"indent":[]}}],"position":{"start":{"line":4,"column":1,"offset":326},"end":{"line":4,"column":21,"offset":346},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"An event in Discordeno is a function that can be called when a specific event occurs. For the most part, events will usually be the ones that are available from Discordeno. However, you can create your own custom events as well if you wish.","position":{"start":{"line":6,"column":1,"offset":348},"end":{"line":6,"column":241,"offset":588},"indent":[]}}],"position":{"start":{"line":6,"column":1,"offset":348},"end":{"line":6,"column":241,"offset":588},"indent":[]}},{"type":"heading","depth":2,"children":[{"type":"text","value":"Creating The File","position":{"start":{"line":8,"column":4,"offset":593},"end":{"line":8,"column":21,"offset":610},"indent":[]}}],"position":{"start":{"line":8,"column":1,"offset":590},"end":{"line":8,"column":21,"offset":610},"indent":[]}},{"type":"export","value":"export const _frontmatter = {\"title\":\"Creating Events!\",\"metaTitle\":\"Creating An Event | Discordeno\",\"metaDescription\":\"Let's create our very own bot with Discordeno!\"}","position":{"start":{"line":13,"column":1,"offset":615},"end":{"line":13,"column":169,"offset":783},"indent":[]}}],"position":{"start":{"line":1,"column":1,"offset":0},"end":{"line":13,"column":169,"offset":783}}},"scopeImports":["import * as React from 'react'"],"scopeIdentifiers":["React"],"body":"function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }\n\nfunction _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }\n\nfunction _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }\n\n/* @jsx mdx */\nvar _frontmatter = {\n \"title\": \"Creating Events!\",\n \"metaTitle\": \"Creating An Event | Discordeno\",\n \"metaDescription\": \"Let's create our very own bot with Discordeno!\"\n};\nvar layoutProps = {\n _frontmatter: _frontmatter\n};\nvar MDXLayout = \"wrapper\";\nreturn function MDXContent(_ref) {\n var components = _ref.components,\n props = _objectWithoutProperties(_ref, [\"components\"]);\n\n return mdx(MDXLayout, _extends({}, layoutProps, props, {\n components: components,\n mdxType: \"MDXLayout\"\n }), mdx(\"p\", null, \"Woah! You are almost half way done with understanding all of Discordeno. Amazing isn't it? Something you may have noticed in the last section was when the bot started up you could see a bunch of messages like \", mdx(\"inlineCode\", {\n parentName: \"p\"\n }, \"Loaded X Commands\"), \" and such. Let's jump into this part now and understand how event handling works in Discordeno.\"), mdx(\"h2\", null, \"What Is An Event?\"), mdx(\"p\", null, \"An event in Discordeno is a function that can be called when a specific event occurs. For the most part, events will usually be the ones that are available from Discordeno. However, you can create your own custom events as well if you wish.\"), mdx(\"h2\", null, \"Creating The File\"));\n}\n;\nMDXContent.isMDXComponent = true;","rawMDXOutput":"/* @jsx mdx */\nimport { mdx } from '@mdx-js/react';\n/* @jsx mdx */\n\nexport const _frontmatter = {\n \"title\": \"Creating Events!\",\n \"metaTitle\": \"Creating An Event | Discordeno\",\n \"metaDescription\": \"Let's create our very own bot with Discordeno!\"\n};\n\nconst layoutProps = {\n _frontmatter\n};\nconst MDXLayout = \"wrapper\"\nexport default function MDXContent({\n components,\n ...props\n}) {\n return \n

{`Woah! You are almost half way done with understanding all of Discordeno. Amazing isn't it? Something you may have noticed in the last section was when the bot started up you could see a bunch of messages like `}{`Loaded X Commands`}{` and such. Let's jump into this part now and understand how event handling works in Discordeno.`}

\n

{`What Is An Event?`}

\n

{`An event in Discordeno is a function that can be called when a specific event occurs. For the most part, events will usually be the ones that are available from Discordeno. However, you can create your own custom events as well if you wish.`}

\n

{`Creating The File`}

\n\n
;\n}\n\n;\nMDXContent.isMDXComponent = true;"}} \ No newline at end of file diff --git a/docs/.cache/caches/gatsby-plugin-mdx/diskstore-5c9357b248181abfaba7c457c93f8853.json b/docs/.cache/caches/gatsby-plugin-mdx/diskstore-5c9357b248181abfaba7c457c93f8853.json new file mode 100644 index 000000000..f2751e02d --- /dev/null +++ b/docs/.cache/caches/gatsby-plugin-mdx/diskstore-5c9357b248181abfaba7c457c93f8853.json @@ -0,0 +1 @@ +{"expireTime":9007200851634016000,"key":"gatsby-plugin-mdx-entire-payload-4bd98c87905aa7bf5e515a1d6089e7d8-","val":{"mdast":{"type":"root","children":[{"type":"paragraph","children":[{"type":"text","value":"Woah! You are almost half way done with understanding all of Discordeno. Amazing isn't it? Something you may have noticed in the last section was there were some options that prevented some commands from running like ","position":{"start":{"line":2,"column":1,"offset":1},"end":{"line":2,"column":218,"offset":218},"indent":[]}},{"type":"inlineCode","value":"dmOnly","position":{"start":{"line":2,"column":218,"offset":218},"end":{"line":2,"column":226,"offset":226},"indent":[]}},{"type":"text","value":" or the permission options. we created a setting to prevent the monitor from running in certain channels. What if we wanted to do prevent commands from happening? How would we prevent commands from running?","position":{"start":{"line":2,"column":226,"offset":226},"end":{"line":2,"column":432,"offset":432},"indent":[]}}],"position":{"start":{"line":2,"column":1,"offset":1},"end":{"line":2,"column":432,"offset":432},"indent":[]}},{"type":"heading","depth":2,"children":[{"type":"text","value":"What is an Inhibitor?","position":{"start":{"line":4,"column":4,"offset":437},"end":{"line":4,"column":25,"offset":458},"indent":[]}}],"position":{"start":{"line":4,"column":1,"offset":434},"end":{"line":4,"column":25,"offset":458},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"An Inhibitor is very similar to how monitors work. A monitor runs on every message but an inhibitor runs on every command. Remember all those command options like cooldown, permissions, permissionLevel, nsfw, etc... Each and every one of these options has an inhibitor in that checks commands for these settings.","position":{"start":{"line":6,"column":1,"offset":460},"end":{"line":6,"column":313,"offset":772},"indent":[]}}],"position":{"start":{"line":6,"column":1,"offset":460},"end":{"line":6,"column":313,"offset":772},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"Let's create our own inhibitor that would prevent commands from being used if the user is not a VIP user.","position":{"start":{"line":8,"column":1,"offset":774},"end":{"line":8,"column":106,"offset":879},"indent":[]}}],"position":{"start":{"line":8,"column":1,"offset":774},"end":{"line":8,"column":106,"offset":879},"indent":[]}},{"type":"blockquote","children":[{"type":"paragraph","children":[{"type":"strong","children":[{"type":"text","value":"Note:","position":{"start":{"line":10,"column":5,"offset":885},"end":{"line":10,"column":10,"offset":890},"indent":[]}}],"position":{"start":{"line":10,"column":3,"offset":883},"end":{"line":10,"column":12,"offset":892},"indent":[]}},{"type":"text","value":" It is important to remember that everything below can be done with a simple permission level as well. We will create our own custom permission levels but for the purposes of this guide and to be able to learn about Inhibitors, we will be using an inhibitor.","position":{"start":{"line":10,"column":12,"offset":892},"end":{"line":10,"column":270,"offset":1150},"indent":[]}}],"position":{"start":{"line":10,"column":3,"offset":883},"end":{"line":10,"column":270,"offset":1150},"indent":[]}}],"position":{"start":{"line":10,"column":1,"offset":881},"end":{"line":10,"column":270,"offset":1150},"indent":[]}},{"type":"heading","depth":2,"children":[{"type":"text","value":"Creating the File","position":{"start":{"line":12,"column":4,"offset":1155},"end":{"line":12,"column":21,"offset":1172},"indent":[]}}],"position":{"start":{"line":12,"column":1,"offset":1152},"end":{"line":12,"column":21,"offset":1172},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"Let's start by creating a file inside the inhibitors folder called ","position":{"start":{"line":14,"column":1,"offset":1174},"end":{"line":14,"column":68,"offset":1241},"indent":[]}},{"type":"inlineCode","value":"boostRequired.ts","position":{"start":{"line":14,"column":68,"offset":1241},"end":{"line":14,"column":86,"offset":1259},"indent":[]}},{"type":"text","value":" and paste the following snippet of code:","position":{"start":{"line":14,"column":86,"offset":1259},"end":{"line":14,"column":127,"offset":1300},"indent":[]}}],"position":{"start":{"line":14,"column":1,"offset":1174},"end":{"line":14,"column":127,"offset":1300},"indent":[]}},{"type":"code","lang":"ts","meta":null,"value":"import { botCache } from \"../../mod.ts\";\n\nbotCache.inhibitors.set(\"inhibitorname\", async function (message, command, guild) {\n\t// Your code goes here\n});","position":{"start":{"line":16,"column":1,"offset":1302},"end":{"line":22,"column":4,"offset":1465},"indent":[1,1,1,1,1,1]}},{"type":"paragraph","children":[{"type":"text","value":"Inhibitors can take up to 3 arguments.","position":{"start":{"line":24,"column":1,"offset":1467},"end":{"line":24,"column":39,"offset":1505},"indent":[]}}],"position":{"start":{"line":24,"column":1,"offset":1467},"end":{"line":24,"column":39,"offset":1505},"indent":[]}},{"type":"list","ordered":false,"start":null,"spread":false,"children":[{"type":"listItem","spread":false,"checked":null,"children":[{"type":"paragraph","children":[{"type":"inlineCode","value":"message","position":{"start":{"line":26,"column":3,"offset":1509},"end":{"line":26,"column":12,"offset":1518},"indent":[]}},{"type":"text","value":": The message object that triggered the command.","position":{"start":{"line":26,"column":12,"offset":1518},"end":{"line":26,"column":60,"offset":1566},"indent":[]}}],"position":{"start":{"line":26,"column":3,"offset":1509},"end":{"line":26,"column":60,"offset":1566},"indent":[]}}],"position":{"start":{"line":26,"column":1,"offset":1507},"end":{"line":26,"column":60,"offset":1566},"indent":[]}},{"type":"listItem","spread":false,"checked":null,"children":[{"type":"paragraph","children":[{"type":"inlineCode","value":"command","position":{"start":{"line":27,"column":3,"offset":1569},"end":{"line":27,"column":12,"offset":1578},"indent":[]}},{"type":"text","value":": The command object itself that was triggered.","position":{"start":{"line":27,"column":12,"offset":1578},"end":{"line":27,"column":59,"offset":1625},"indent":[]}}],"position":{"start":{"line":27,"column":3,"offset":1569},"end":{"line":27,"column":59,"offset":1625},"indent":[]}}],"position":{"start":{"line":27,"column":1,"offset":1567},"end":{"line":27,"column":59,"offset":1625},"indent":[]}},{"type":"listItem","spread":false,"checked":null,"children":[{"type":"paragraph","children":[{"type":"inlineCode","value":"guild","position":{"start":{"line":28,"column":3,"offset":1628},"end":{"line":28,"column":10,"offset":1635},"indent":[]}},{"type":"text","value":": The server guild object where this command was ran.","position":{"start":{"line":28,"column":10,"offset":1635},"end":{"line":28,"column":63,"offset":1688},"indent":[]}}],"position":{"start":{"line":28,"column":3,"offset":1628},"end":{"line":28,"column":63,"offset":1688},"indent":[]}}],"position":{"start":{"line":28,"column":1,"offset":1626},"end":{"line":28,"column":63,"offset":1688},"indent":[]}}],"position":{"start":{"line":26,"column":1,"offset":1507},"end":{"line":28,"column":63,"offset":1688},"indent":[1,1]}},{"type":"heading","depth":2,"children":[{"type":"text","value":"Understanding How Inhibitors Function","position":{"start":{"line":30,"column":4,"offset":1693},"end":{"line":30,"column":41,"offset":1730},"indent":[]}}],"position":{"start":{"line":30,"column":1,"offset":1690},"end":{"line":30,"column":41,"offset":1730},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"To block a command you have to return a truthy value.","position":{"start":{"line":32,"column":1,"offset":1732},"end":{"line":32,"column":54,"offset":1785},"indent":[]}}],"position":{"start":{"line":32,"column":1,"offset":1732},"end":{"line":32,"column":54,"offset":1785},"indent":[]}},{"type":"list","ordered":false,"start":null,"spread":false,"children":[{"type":"listItem","spread":false,"checked":null,"children":[{"type":"paragraph","children":[{"type":"strong","children":[{"type":"text","value":"return true;","position":{"start":{"line":33,"column":5,"offset":1790},"end":{"line":33,"column":17,"offset":1802},"indent":[]}}],"position":{"start":{"line":33,"column":3,"offset":1788},"end":{"line":33,"column":19,"offset":1804},"indent":[]}},{"type":"text","value":" If you return true the inhibitor will block the execution of the command.\nTo allow a command return a falsey value.","position":{"start":{"line":33,"column":19,"offset":1804},"end":{"line":34,"column":42,"offset":1920},"indent":[1]}}],"position":{"start":{"line":33,"column":3,"offset":1788},"end":{"line":34,"column":42,"offset":1920},"indent":[1]}}],"position":{"start":{"line":33,"column":1,"offset":1786},"end":{"line":34,"column":42,"offset":1920},"indent":[1]}},{"type":"listItem","spread":false,"checked":null,"children":[{"type":"paragraph","children":[{"type":"strong","children":[{"type":"text","value":"return false;","position":{"start":{"line":35,"column":5,"offset":1925},"end":{"line":35,"column":18,"offset":1938},"indent":[]}}],"position":{"start":{"line":35,"column":3,"offset":1923},"end":{"line":35,"column":20,"offset":1940},"indent":[]}},{"type":"text","value":" If you return false the inhibitor will not block the error.","position":{"start":{"line":35,"column":20,"offset":1940},"end":{"line":35,"column":80,"offset":2000},"indent":[]}}],"position":{"start":{"line":35,"column":3,"offset":1923},"end":{"line":35,"column":80,"offset":2000},"indent":[]}}],"position":{"start":{"line":35,"column":1,"offset":1921},"end":{"line":35,"column":80,"offset":2000},"indent":[]}}],"position":{"start":{"line":33,"column":1,"offset":1786},"end":{"line":35,"column":80,"offset":2000},"indent":[1,1]}},{"type":"code","lang":"ts","meta":null,"value":"// If the command is not VIP only we can allow this command to execute\nif (!command.boostRequired) return false;\n\n// Check if the user has boosted this server\nconst userIsVIP = await isUserVIP(message.author.id)\n// The user is VIP so we can allow this command to be used\nif (userIsVIP) return false;\n\n// The user is NOT VIP so we throw an error\nthrow `The ${command.name} is only allowed for VIP users.`","position":{"start":{"line":38,"column":1,"offset":2003},"end":{"line":49,"column":4,"offset":2416},"indent":[1,1,1,1,1,1,1,1,1,1,1]}},{"type":"export","value":"export const _frontmatter = {\"title\":\"Creating Inhibitors!\",\"metaTitle\":\"Creating An Inhibitor | Discordeno\",\"metaDescription\":\"Let's create our very own bot with Discordeno!\"}","position":{"start":{"line":52,"column":1,"offset":2419},"end":{"line":52,"column":177,"offset":2595},"indent":[]}}],"position":{"start":{"line":1,"column":1,"offset":0},"end":{"line":52,"column":177,"offset":2595}}},"scopeImports":["import * as React from 'react'"],"scopeIdentifiers":["React"],"body":"function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }\n\nfunction _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }\n\nfunction _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }\n\n/* @jsx mdx */\nvar _frontmatter = {\n \"title\": \"Creating Inhibitors!\",\n \"metaTitle\": \"Creating An Inhibitor | Discordeno\",\n \"metaDescription\": \"Let's create our very own bot with Discordeno!\"\n};\nvar layoutProps = {\n _frontmatter: _frontmatter\n};\nvar MDXLayout = \"wrapper\";\nreturn function MDXContent(_ref) {\n var components = _ref.components,\n props = _objectWithoutProperties(_ref, [\"components\"]);\n\n return mdx(MDXLayout, _extends({}, layoutProps, props, {\n components: components,\n mdxType: \"MDXLayout\"\n }), mdx(\"p\", null, \"Woah! You are almost half way done with understanding all of Discordeno. Amazing isn't it? Something you may have noticed in the last section was there were some options that prevented some commands from running like \", mdx(\"inlineCode\", {\n parentName: \"p\"\n }, \"dmOnly\"), \" or the permission options. we created a setting to prevent the monitor from running in certain channels. What if we wanted to do prevent commands from happening? How would we prevent commands from running?\"), mdx(\"h2\", null, \"What is an Inhibitor?\"), mdx(\"p\", null, \"An Inhibitor is very similar to how monitors work. A monitor runs on every message but an inhibitor runs on every command. Remember all those command options like cooldown, permissions, permissionLevel, nsfw, etc... Each and every one of these options has an inhibitor in that checks commands for these settings.\"), mdx(\"p\", null, \"Let's create our own inhibitor that would prevent commands from being used if the user is not a VIP user.\"), mdx(\"blockquote\", null, mdx(\"p\", {\n parentName: \"blockquote\"\n }, mdx(\"strong\", {\n parentName: \"p\"\n }, \"Note:\"), \" It is important to remember that everything below can be done with a simple permission level as well. We will create our own custom permission levels but for the purposes of this guide and to be able to learn about Inhibitors, we will be using an inhibitor.\")), mdx(\"h2\", null, \"Creating the File\"), mdx(\"p\", null, \"Let's start by creating a file inside the inhibitors folder called \", mdx(\"inlineCode\", {\n parentName: \"p\"\n }, \"boostRequired.ts\"), \" and paste the following snippet of code:\"), mdx(\"pre\", null, mdx(\"code\", _extends({\n parentName: \"pre\"\n }, {\n \"className\": \"language-ts\"\n }), \"import { botCache } from \\\"../../mod.ts\\\";\\n\\nbotCache.inhibitors.set(\\\"inhibitorname\\\", async function (message, command, guild) {\\n // Your code goes here\\n});\\n\")), mdx(\"p\", null, \"Inhibitors can take up to 3 arguments.\"), mdx(\"ul\", null, mdx(\"li\", {\n parentName: \"ul\"\n }, mdx(\"inlineCode\", {\n parentName: \"li\"\n }, \"message\"), \": The message object that triggered the command.\"), mdx(\"li\", {\n parentName: \"ul\"\n }, mdx(\"inlineCode\", {\n parentName: \"li\"\n }, \"command\"), \": The command object itself that was triggered.\"), mdx(\"li\", {\n parentName: \"ul\"\n }, mdx(\"inlineCode\", {\n parentName: \"li\"\n }, \"guild\"), \": The server guild object where this command was ran.\")), mdx(\"h2\", null, \"Understanding How Inhibitors Function\"), mdx(\"p\", null, \"To block a command you have to return a truthy value.\"), mdx(\"ul\", null, mdx(\"li\", {\n parentName: \"ul\"\n }, mdx(\"strong\", {\n parentName: \"li\"\n }, \"return true;\"), \" If you return true the inhibitor will block the execution of the command.\\nTo allow a command return a falsey value.\"), mdx(\"li\", {\n parentName: \"ul\"\n }, mdx(\"strong\", {\n parentName: \"li\"\n }, \"return false;\"), \" If you return false the inhibitor will not block the error.\")), mdx(\"pre\", null, mdx(\"code\", _extends({\n parentName: \"pre\"\n }, {\n \"className\": \"language-ts\"\n }), \"// If the command is not VIP only we can allow this command to execute\\nif (!command.boostRequired) return false;\\n\\n// Check if the user has boosted this server\\nconst userIsVIP = await isUserVIP(message.author.id)\\n// The user is VIP so we can allow this command to be used\\nif (userIsVIP) return false;\\n\\n// The user is NOT VIP so we throw an error\\nthrow `The ${command.name} is only allowed for VIP users.`\\n\")));\n}\n;\nMDXContent.isMDXComponent = true;","rawMDXOutput":"/* @jsx mdx */\nimport { mdx } from '@mdx-js/react';\n/* @jsx mdx */\n\nexport const _frontmatter = {\n \"title\": \"Creating Inhibitors!\",\n \"metaTitle\": \"Creating An Inhibitor | Discordeno\",\n \"metaDescription\": \"Let's create our very own bot with Discordeno!\"\n};\n\nconst layoutProps = {\n _frontmatter\n};\nconst MDXLayout = \"wrapper\"\nexport default function MDXContent({\n components,\n ...props\n}) {\n return \n

{`Woah! You are almost half way done with understanding all of Discordeno. Amazing isn't it? Something you may have noticed in the last section was there were some options that prevented some commands from running like `}{`dmOnly`}{` or the permission options. we created a setting to prevent the monitor from running in certain channels. What if we wanted to do prevent commands from happening? How would we prevent commands from running?`}

\n

{`What is an Inhibitor?`}

\n

{`An Inhibitor is very similar to how monitors work. A monitor runs on every message but an inhibitor runs on every command. Remember all those command options like cooldown, permissions, permissionLevel, nsfw, etc... Each and every one of these options has an inhibitor in that checks commands for these settings.`}

\n

{`Let's create our own inhibitor that would prevent commands from being used if the user is not a VIP user.`}

\n
\n

{`Note:`}{` It is important to remember that everything below can be done with a simple permission level as well. We will create our own custom permission levels but for the purposes of this guide and to be able to learn about Inhibitors, we will be using an inhibitor.`}

\n
\n

{`Creating the File`}

\n

{`Let's start by creating a file inside the inhibitors folder called `}{`boostRequired.ts`}{` and paste the following snippet of code:`}

\n
{`import { botCache } from \"../../mod.ts\";\n\nbotCache.inhibitors.set(\"inhibitorname\", async function (message, command, guild) {\n    // Your code goes here\n});\n`}
\n

{`Inhibitors can take up to 3 arguments.`}

\n
    \n
  • {`message`}{`: The message object that triggered the command.`}
  • \n
  • {`command`}{`: The command object itself that was triggered.`}
  • \n
  • {`guild`}{`: The server guild object where this command was ran.`}
  • \n
\n

{`Understanding How Inhibitors Function`}

\n

{`To block a command you have to return a truthy value.`}

\n
    \n
  • {`return true;`}{` If you return true the inhibitor will block the execution of the command.\nTo allow a command return a falsey value.`}
  • \n
  • {`return false;`}{` If you return false the inhibitor will not block the error.`}
  • \n
\n
{`// If the command is not VIP only we can allow this command to execute\nif (!command.boostRequired) return false;\n\n// Check if the user has boosted this server\nconst userIsVIP = await isUserVIP(message.author.id)\n// The user is VIP so we can allow this command to be used\nif (userIsVIP) return false;\n\n// The user is NOT VIP so we throw an error\nthrow \\`The \\${command.name} is only allowed for VIP users.\\`\n`}
\n\n
;\n}\n\n;\nMDXContent.isMDXComponent = true;"}} \ No newline at end of file diff --git a/docs/.cache/caches/gatsby-plugin-mdx/diskstore-5d95dc7df00bb011c165c9390441facf.json b/docs/.cache/caches/gatsby-plugin-mdx/diskstore-5d95dc7df00bb011c165c9390441facf.json new file mode 100644 index 000000000..f4de51ce7 --- /dev/null +++ b/docs/.cache/caches/gatsby-plugin-mdx/diskstore-5d95dc7df00bb011c165c9390441facf.json @@ -0,0 +1 @@ +{"expireTime":9007200851634483000,"key":"gatsby-plugin-mdx-entire-payload-2640c9ad57676024b4fc59937ee5f601-","val":{"mdast":{"type":"root","children":[{"type":"paragraph","children":[{"type":"text","value":"Woah! You are almost half way done with understanding all of Discordeno. Amazing isn't it? Something you may have noticed in the last section was there were some options that prevented some commands from running like ","position":{"start":{"line":2,"column":1,"offset":1},"end":{"line":2,"column":218,"offset":218},"indent":[]}},{"type":"inlineCode","value":"dmOnly","position":{"start":{"line":2,"column":218,"offset":218},"end":{"line":2,"column":226,"offset":226},"indent":[]}},{"type":"text","value":" or the permission options. we created a setting to prevent the monitor from running in certain channels. What if we wanted to do prevent commands from happening? How would we prevent commands from running?","position":{"start":{"line":2,"column":226,"offset":226},"end":{"line":2,"column":432,"offset":432},"indent":[]}}],"position":{"start":{"line":2,"column":1,"offset":1},"end":{"line":2,"column":432,"offset":432},"indent":[]}},{"type":"heading","depth":2,"children":[{"type":"text","value":"What is an Inhibitor?","position":{"start":{"line":4,"column":4,"offset":437},"end":{"line":4,"column":25,"offset":458},"indent":[]}}],"position":{"start":{"line":4,"column":1,"offset":434},"end":{"line":4,"column":25,"offset":458},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"An Inhibitor is very similar to how monitors work. A monitor runs on every message but an inhibitor runs on every command. Remember all those command options like cooldown, permissions, permissionLevel, nsfw, etc... Each and every one of these options has an inhibitor in that checks commands for these settings.","position":{"start":{"line":6,"column":1,"offset":460},"end":{"line":6,"column":313,"offset":772},"indent":[]}}],"position":{"start":{"line":6,"column":1,"offset":460},"end":{"line":6,"column":313,"offset":772},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"Let's create our own inhibitor that would prevent commands from being used if the user is not a VIP user.","position":{"start":{"line":8,"column":1,"offset":774},"end":{"line":8,"column":106,"offset":879},"indent":[]}}],"position":{"start":{"line":8,"column":1,"offset":774},"end":{"line":8,"column":106,"offset":879},"indent":[]}},{"type":"blockquote","children":[{"type":"paragraph","children":[{"type":"strong","children":[{"type":"text","value":"Note:","position":{"start":{"line":10,"column":5,"offset":885},"end":{"line":10,"column":10,"offset":890},"indent":[]}}],"position":{"start":{"line":10,"column":3,"offset":883},"end":{"line":10,"column":12,"offset":892},"indent":[]}},{"type":"text","value":" It is important to remember that everything below can be done with a simple permission level as well. We will create our own custom permission levels but for the purposes of this guide and to be able to learn about Inhibitors, we will be using an inhibitor.","position":{"start":{"line":10,"column":12,"offset":892},"end":{"line":10,"column":270,"offset":1150},"indent":[]}}],"position":{"start":{"line":10,"column":3,"offset":883},"end":{"line":10,"column":270,"offset":1150},"indent":[]}}],"position":{"start":{"line":10,"column":1,"offset":881},"end":{"line":10,"column":270,"offset":1150},"indent":[]}},{"type":"heading","depth":2,"children":[{"type":"text","value":"Creating the File","position":{"start":{"line":12,"column":4,"offset":1155},"end":{"line":12,"column":21,"offset":1172},"indent":[]}}],"position":{"start":{"line":12,"column":1,"offset":1152},"end":{"line":12,"column":21,"offset":1172},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"Let's start by creating a file inside the inhibitors folder called ","position":{"start":{"line":14,"column":1,"offset":1174},"end":{"line":14,"column":68,"offset":1241},"indent":[]}},{"type":"inlineCode","value":"boosted.ts","position":{"start":{"line":14,"column":68,"offset":1241},"end":{"line":14,"column":80,"offset":1253},"indent":[]}},{"type":"text","value":" and paste the following snippet of code:","position":{"start":{"line":14,"column":80,"offset":1253},"end":{"line":14,"column":121,"offset":1294},"indent":[]}}],"position":{"start":{"line":14,"column":1,"offset":1174},"end":{"line":14,"column":121,"offset":1294},"indent":[]}},{"type":"code","lang":"ts","meta":null,"value":"import { botCache } from \"../../mod.ts\";\n\nbotCache.inhibitors.set(\"inhibitorname\", async function (message, command, guild) {\n\t// Your code goes here\n});","position":{"start":{"line":16,"column":1,"offset":1296},"end":{"line":22,"column":4,"offset":1459},"indent":[1,1,1,1,1,1]}},{"type":"paragraph","children":[{"type":"text","value":"Inhibitors can take up to 3 arguments.","position":{"start":{"line":24,"column":1,"offset":1461},"end":{"line":24,"column":39,"offset":1499},"indent":[]}}],"position":{"start":{"line":24,"column":1,"offset":1461},"end":{"line":24,"column":39,"offset":1499},"indent":[]}},{"type":"list","ordered":false,"start":null,"spread":false,"children":[{"type":"listItem","spread":false,"checked":null,"children":[{"type":"paragraph","children":[{"type":"inlineCode","value":"message","position":{"start":{"line":26,"column":3,"offset":1503},"end":{"line":26,"column":12,"offset":1512},"indent":[]}},{"type":"text","value":": The message object that triggered the command.","position":{"start":{"line":26,"column":12,"offset":1512},"end":{"line":26,"column":60,"offset":1560},"indent":[]}}],"position":{"start":{"line":26,"column":3,"offset":1503},"end":{"line":26,"column":60,"offset":1560},"indent":[]}}],"position":{"start":{"line":26,"column":1,"offset":1501},"end":{"line":26,"column":60,"offset":1560},"indent":[]}},{"type":"listItem","spread":false,"checked":null,"children":[{"type":"paragraph","children":[{"type":"inlineCode","value":"command","position":{"start":{"line":27,"column":3,"offset":1563},"end":{"line":27,"column":12,"offset":1572},"indent":[]}},{"type":"text","value":": The command object itself that was triggered.","position":{"start":{"line":27,"column":12,"offset":1572},"end":{"line":27,"column":59,"offset":1619},"indent":[]}}],"position":{"start":{"line":27,"column":3,"offset":1563},"end":{"line":27,"column":59,"offset":1619},"indent":[]}}],"position":{"start":{"line":27,"column":1,"offset":1561},"end":{"line":27,"column":59,"offset":1619},"indent":[]}},{"type":"listItem","spread":false,"checked":null,"children":[{"type":"paragraph","children":[{"type":"inlineCode","value":"guild","position":{"start":{"line":28,"column":3,"offset":1622},"end":{"line":28,"column":10,"offset":1629},"indent":[]}},{"type":"text","value":": The server guild object where this command was ran.","position":{"start":{"line":28,"column":10,"offset":1629},"end":{"line":28,"column":63,"offset":1682},"indent":[]}}],"position":{"start":{"line":28,"column":3,"offset":1622},"end":{"line":28,"column":63,"offset":1682},"indent":[]}}],"position":{"start":{"line":28,"column":1,"offset":1620},"end":{"line":28,"column":63,"offset":1682},"indent":[]}}],"position":{"start":{"line":26,"column":1,"offset":1501},"end":{"line":28,"column":63,"offset":1682},"indent":[1,1]}},{"type":"heading","depth":2,"children":[{"type":"text","value":"Understanding How Inhibitors Function","position":{"start":{"line":30,"column":4,"offset":1687},"end":{"line":30,"column":41,"offset":1724},"indent":[]}}],"position":{"start":{"line":30,"column":1,"offset":1684},"end":{"line":30,"column":41,"offset":1724},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"To block a command you have to return a truthy value.","position":{"start":{"line":32,"column":1,"offset":1726},"end":{"line":32,"column":54,"offset":1779},"indent":[]}}],"position":{"start":{"line":32,"column":1,"offset":1726},"end":{"line":32,"column":54,"offset":1779},"indent":[]}},{"type":"list","ordered":false,"start":null,"spread":false,"children":[{"type":"listItem","spread":false,"checked":null,"children":[{"type":"paragraph","children":[{"type":"strong","children":[{"type":"text","value":"return true;","position":{"start":{"line":33,"column":5,"offset":1784},"end":{"line":33,"column":17,"offset":1796},"indent":[]}}],"position":{"start":{"line":33,"column":3,"offset":1782},"end":{"line":33,"column":19,"offset":1798},"indent":[]}},{"type":"text","value":" If you return true the inhibitor will block the execution of the command.\nTo allow a command return a falsey value.","position":{"start":{"line":33,"column":19,"offset":1798},"end":{"line":34,"column":42,"offset":1914},"indent":[1]}}],"position":{"start":{"line":33,"column":3,"offset":1782},"end":{"line":34,"column":42,"offset":1914},"indent":[1]}}],"position":{"start":{"line":33,"column":1,"offset":1780},"end":{"line":34,"column":42,"offset":1914},"indent":[1]}},{"type":"listItem","spread":false,"checked":null,"children":[{"type":"paragraph","children":[{"type":"strong","children":[{"type":"text","value":"return false;","position":{"start":{"line":35,"column":5,"offset":1919},"end":{"line":35,"column":18,"offset":1932},"indent":[]}}],"position":{"start":{"line":35,"column":3,"offset":1917},"end":{"line":35,"column":20,"offset":1934},"indent":[]}},{"type":"text","value":" If you return false the inhibitor will not block the error.","position":{"start":{"line":35,"column":20,"offset":1934},"end":{"line":35,"column":80,"offset":1994},"indent":[]}}],"position":{"start":{"line":35,"column":3,"offset":1917},"end":{"line":35,"column":80,"offset":1994},"indent":[]}}],"position":{"start":{"line":35,"column":1,"offset":1915},"end":{"line":35,"column":80,"offset":1994},"indent":[]}}],"position":{"start":{"line":33,"column":1,"offset":1780},"end":{"line":35,"column":80,"offset":1994},"indent":[1,1]}},{"type":"code","lang":"ts","meta":null,"value":"// If the command is not VIP only we can allow this command to execute\nif (!command.vipOnly) return false;\n\n// The bot's support server\nconst guild = cache.guilds.get(configs.supportServerID);\n// If the command author is not in the server they won't have the vip role\nconst member = guild.members.get(message.author.id) || await getMember(guild.id, message.author.id);\n// Member doesn't exist so cancel the command\nif (!member) {\n\tsendResponse(message, `sorry, but you can not use this command until you become VIP. Close the IRIS!!!`)\n\treturn true;\n}\n\n// If the user has the vip role on the support server given by patreon allow the command\nif (member.roles.includes(configs.patreonVIPRoleID)) return false;\n\n// Alert the user they don't have vip and can't use the command\nsendResponse(message, `sorry, but you can not use this command until you become a VIP. I'm sorry, Teal'c. We'll go to Disneyland next year. I promise.`)\n// Cancel the command since the user does not have vip\nreturn true;","position":{"start":{"line":38,"column":1,"offset":1997},"end":{"line":59,"column":4,"offset":3001},"indent":[1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1]}},{"type":"export","value":"export const _frontmatter = {\"title\":\"Creating Inhibitors!\",\"metaTitle\":\"Creating An Inhibitor | Discordeno\",\"metaDescription\":\"Let's create our very own bot with Discordeno!\"}","position":{"start":{"line":62,"column":1,"offset":3004},"end":{"line":62,"column":177,"offset":3180},"indent":[]}}],"position":{"start":{"line":1,"column":1,"offset":0},"end":{"line":62,"column":177,"offset":3180}}},"scopeImports":["import * as React from 'react'"],"scopeIdentifiers":["React"],"body":"function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }\n\nfunction _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }\n\nfunction _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }\n\n/* @jsx mdx */\nvar _frontmatter = {\n \"title\": \"Creating Inhibitors!\",\n \"metaTitle\": \"Creating An Inhibitor | Discordeno\",\n \"metaDescription\": \"Let's create our very own bot with Discordeno!\"\n};\nvar layoutProps = {\n _frontmatter: _frontmatter\n};\nvar MDXLayout = \"wrapper\";\nreturn function MDXContent(_ref) {\n var components = _ref.components,\n props = _objectWithoutProperties(_ref, [\"components\"]);\n\n return mdx(MDXLayout, _extends({}, layoutProps, props, {\n components: components,\n mdxType: \"MDXLayout\"\n }), mdx(\"p\", null, \"Woah! You are almost half way done with understanding all of Discordeno. Amazing isn't it? Something you may have noticed in the last section was there were some options that prevented some commands from running like \", mdx(\"inlineCode\", {\n parentName: \"p\"\n }, \"dmOnly\"), \" or the permission options. we created a setting to prevent the monitor from running in certain channels. What if we wanted to do prevent commands from happening? How would we prevent commands from running?\"), mdx(\"h2\", null, \"What is an Inhibitor?\"), mdx(\"p\", null, \"An Inhibitor is very similar to how monitors work. A monitor runs on every message but an inhibitor runs on every command. Remember all those command options like cooldown, permissions, permissionLevel, nsfw, etc... Each and every one of these options has an inhibitor in that checks commands for these settings.\"), mdx(\"p\", null, \"Let's create our own inhibitor that would prevent commands from being used if the user is not a VIP user.\"), mdx(\"blockquote\", null, mdx(\"p\", {\n parentName: \"blockquote\"\n }, mdx(\"strong\", {\n parentName: \"p\"\n }, \"Note:\"), \" It is important to remember that everything below can be done with a simple permission level as well. We will create our own custom permission levels but for the purposes of this guide and to be able to learn about Inhibitors, we will be using an inhibitor.\")), mdx(\"h2\", null, \"Creating the File\"), mdx(\"p\", null, \"Let's start by creating a file inside the inhibitors folder called \", mdx(\"inlineCode\", {\n parentName: \"p\"\n }, \"boosted.ts\"), \" and paste the following snippet of code:\"), mdx(\"pre\", null, mdx(\"code\", _extends({\n parentName: \"pre\"\n }, {\n \"className\": \"language-ts\"\n }), \"import { botCache } from \\\"../../mod.ts\\\";\\n\\nbotCache.inhibitors.set(\\\"inhibitorname\\\", async function (message, command, guild) {\\n // Your code goes here\\n});\\n\")), mdx(\"p\", null, \"Inhibitors can take up to 3 arguments.\"), mdx(\"ul\", null, mdx(\"li\", {\n parentName: \"ul\"\n }, mdx(\"inlineCode\", {\n parentName: \"li\"\n }, \"message\"), \": The message object that triggered the command.\"), mdx(\"li\", {\n parentName: \"ul\"\n }, mdx(\"inlineCode\", {\n parentName: \"li\"\n }, \"command\"), \": The command object itself that was triggered.\"), mdx(\"li\", {\n parentName: \"ul\"\n }, mdx(\"inlineCode\", {\n parentName: \"li\"\n }, \"guild\"), \": The server guild object where this command was ran.\")), mdx(\"h2\", null, \"Understanding How Inhibitors Function\"), mdx(\"p\", null, \"To block a command you have to return a truthy value.\"), mdx(\"ul\", null, mdx(\"li\", {\n parentName: \"ul\"\n }, mdx(\"strong\", {\n parentName: \"li\"\n }, \"return true;\"), \" If you return true the inhibitor will block the execution of the command.\\nTo allow a command return a falsey value.\"), mdx(\"li\", {\n parentName: \"ul\"\n }, mdx(\"strong\", {\n parentName: \"li\"\n }, \"return false;\"), \" If you return false the inhibitor will not block the error.\")), mdx(\"pre\", null, mdx(\"code\", _extends({\n parentName: \"pre\"\n }, {\n \"className\": \"language-ts\"\n }), \"// If the command is not VIP only we can allow this command to execute\\nif (!command.vipOnly) return false;\\n\\n// The bot's support server\\nconst guild = cache.guilds.get(configs.supportServerID);\\n// If the command author is not in the server they won't have the vip role\\nconst member = guild.members.get(message.author.id) || await getMember(guild.id, message.author.id);\\n// Member doesn't exist so cancel the command\\nif (!member) {\\n sendResponse(message, `sorry, but you can not use this command until you become VIP. Close the IRIS!!!`)\\n return true;\\n}\\n\\n// If the user has the vip role on the support server given by patreon allow the command\\nif (member.roles.includes(configs.patreonVIPRoleID)) return false;\\n\\n// Alert the user they don't have vip and can't use the command\\nsendResponse(message, `sorry, but you can not use this command until you become a VIP. I'm sorry, Teal'c. We'll go to Disneyland next year. I promise.`)\\n// Cancel the command since the user does not have vip\\nreturn true;\\n\")));\n}\n;\nMDXContent.isMDXComponent = true;","rawMDXOutput":"/* @jsx mdx */\nimport { mdx } from '@mdx-js/react';\n/* @jsx mdx */\n\nexport const _frontmatter = {\n \"title\": \"Creating Inhibitors!\",\n \"metaTitle\": \"Creating An Inhibitor | Discordeno\",\n \"metaDescription\": \"Let's create our very own bot with Discordeno!\"\n};\n\nconst layoutProps = {\n _frontmatter\n};\nconst MDXLayout = \"wrapper\"\nexport default function MDXContent({\n components,\n ...props\n}) {\n return \n

{`Woah! You are almost half way done with understanding all of Discordeno. Amazing isn't it? Something you may have noticed in the last section was there were some options that prevented some commands from running like `}{`dmOnly`}{` or the permission options. we created a setting to prevent the monitor from running in certain channels. What if we wanted to do prevent commands from happening? How would we prevent commands from running?`}

\n

{`What is an Inhibitor?`}

\n

{`An Inhibitor is very similar to how monitors work. A monitor runs on every message but an inhibitor runs on every command. Remember all those command options like cooldown, permissions, permissionLevel, nsfw, etc... Each and every one of these options has an inhibitor in that checks commands for these settings.`}

\n

{`Let's create our own inhibitor that would prevent commands from being used if the user is not a VIP user.`}

\n
\n

{`Note:`}{` It is important to remember that everything below can be done with a simple permission level as well. We will create our own custom permission levels but for the purposes of this guide and to be able to learn about Inhibitors, we will be using an inhibitor.`}

\n
\n

{`Creating the File`}

\n

{`Let's start by creating a file inside the inhibitors folder called `}{`boosted.ts`}{` and paste the following snippet of code:`}

\n
{`import { botCache } from \"../../mod.ts\";\n\nbotCache.inhibitors.set(\"inhibitorname\", async function (message, command, guild) {\n    // Your code goes here\n});\n`}
\n

{`Inhibitors can take up to 3 arguments.`}

\n
    \n
  • {`message`}{`: The message object that triggered the command.`}
  • \n
  • {`command`}{`: The command object itself that was triggered.`}
  • \n
  • {`guild`}{`: The server guild object where this command was ran.`}
  • \n
\n

{`Understanding How Inhibitors Function`}

\n

{`To block a command you have to return a truthy value.`}

\n
    \n
  • {`return true;`}{` If you return true the inhibitor will block the execution of the command.\nTo allow a command return a falsey value.`}
  • \n
  • {`return false;`}{` If you return false the inhibitor will not block the error.`}
  • \n
\n
{`// If the command is not VIP only we can allow this command to execute\nif (!command.vipOnly) return false;\n\n// The bot's support server\nconst guild = cache.guilds.get(configs.supportServerID);\n// If the command author is not in the server they won't have the vip role\nconst member = guild.members.get(message.author.id) || await getMember(guild.id, message.author.id);\n// Member doesn't exist so cancel the command\nif (!member) {\n    sendResponse(message, \\`sorry, but you can not use this command until you become VIP. Close the IRIS!!!\\`)\n    return true;\n}\n\n// If the user has the vip role on the support server given by patreon allow the command\nif (member.roles.includes(configs.patreonVIPRoleID)) return false;\n\n// Alert the user they don't have vip and can't use the command\nsendResponse(message, \\`sorry, but you can not use this command until you become a VIP. I'm sorry, Teal'c. We'll go to Disneyland next year. I promise.\\`)\n// Cancel the command since the user does not have vip\nreturn true;\n`}
\n\n
;\n}\n\n;\nMDXContent.isMDXComponent = true;"}} \ No newline at end of file diff --git a/docs/.cache/caches/gatsby-plugin-mdx/diskstore-651a52a02788cae1d13a988a653c5754.json b/docs/.cache/caches/gatsby-plugin-mdx/diskstore-651a52a02788cae1d13a988a653c5754.json new file mode 100644 index 000000000..e3e63eb0f --- /dev/null +++ b/docs/.cache/caches/gatsby-plugin-mdx/diskstore-651a52a02788cae1d13a988a653c5754.json @@ -0,0 +1 @@ +{"expireTime":9007200851634042000,"key":"gatsby-plugin-mdx-entire-payload-a24b9d422b200a82b9490270255c9462-","val":{"mdast":{"type":"root","children":[{"type":"paragraph","children":[{"type":"text","value":"Woah! You are almost half way done with understanding all of Discordeno. Amazing isn't it? Something you may have noticed in the last section was there were some options that prevented some commands from running like ","position":{"start":{"line":2,"column":1,"offset":1},"end":{"line":2,"column":218,"offset":218},"indent":[]}},{"type":"inlineCode","value":"dmOnly","position":{"start":{"line":2,"column":218,"offset":218},"end":{"line":2,"column":226,"offset":226},"indent":[]}},{"type":"text","value":" or the permission options. we created a setting to prevent the monitor from running in certain channels. What if we wanted to do prevent commands from happening? How would we prevent commands from running?","position":{"start":{"line":2,"column":226,"offset":226},"end":{"line":2,"column":432,"offset":432},"indent":[]}}],"position":{"start":{"line":2,"column":1,"offset":1},"end":{"line":2,"column":432,"offset":432},"indent":[]}},{"type":"heading","depth":2,"children":[{"type":"text","value":"What is an Inhibitor?","position":{"start":{"line":4,"column":4,"offset":437},"end":{"line":4,"column":25,"offset":458},"indent":[]}}],"position":{"start":{"line":4,"column":1,"offset":434},"end":{"line":4,"column":25,"offset":458},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"An Inhibitor is very similar to how monitors work. A monitor runs on every message but an inhibitor runs on every command. Remember all those command options like cooldown, permissions, permissionLevel, nsfw, etc... Each and every one of these options has an inhibitor in that checks commands for these settings.","position":{"start":{"line":6,"column":1,"offset":460},"end":{"line":6,"column":313,"offset":772},"indent":[]}}],"position":{"start":{"line":6,"column":1,"offset":460},"end":{"line":6,"column":313,"offset":772},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"Let's create our own inhibitor that would prevent commands from being used if the user is not a VIP user.","position":{"start":{"line":8,"column":1,"offset":774},"end":{"line":8,"column":106,"offset":879},"indent":[]}}],"position":{"start":{"line":8,"column":1,"offset":774},"end":{"line":8,"column":106,"offset":879},"indent":[]}},{"type":"blockquote","children":[{"type":"paragraph","children":[{"type":"strong","children":[{"type":"text","value":"Note:","position":{"start":{"line":10,"column":5,"offset":885},"end":{"line":10,"column":10,"offset":890},"indent":[]}}],"position":{"start":{"line":10,"column":3,"offset":883},"end":{"line":10,"column":12,"offset":892},"indent":[]}},{"type":"text","value":" It is important to remember that everything below can be done with a simple permission level as well. We will create our own custom permission levels but for the purposes of this guide and to be able to learn about Inhibitors, we will be using an inhibitor.","position":{"start":{"line":10,"column":12,"offset":892},"end":{"line":10,"column":270,"offset":1150},"indent":[]}}],"position":{"start":{"line":10,"column":3,"offset":883},"end":{"line":10,"column":270,"offset":1150},"indent":[]}}],"position":{"start":{"line":10,"column":1,"offset":881},"end":{"line":10,"column":270,"offset":1150},"indent":[]}},{"type":"heading","depth":2,"children":[{"type":"text","value":"Creating the File","position":{"start":{"line":12,"column":4,"offset":1155},"end":{"line":12,"column":21,"offset":1172},"indent":[]}}],"position":{"start":{"line":12,"column":1,"offset":1152},"end":{"line":12,"column":21,"offset":1172},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"Let's start by creating a file inside the inhibitors folder called ","position":{"start":{"line":14,"column":1,"offset":1174},"end":{"line":14,"column":68,"offset":1241},"indent":[]}},{"type":"inlineCode","value":"boostRequired.ts","position":{"start":{"line":14,"column":68,"offset":1241},"end":{"line":14,"column":86,"offset":1259},"indent":[]}},{"type":"text","value":" and paste the following snippet of code:","position":{"start":{"line":14,"column":86,"offset":1259},"end":{"line":14,"column":127,"offset":1300},"indent":[]}}],"position":{"start":{"line":14,"column":1,"offset":1174},"end":{"line":14,"column":127,"offset":1300},"indent":[]}},{"type":"code","lang":"ts","meta":null,"value":"import { botCache } from \"../../mod.ts\";\n\nbotCache.inhibitors.set(\"inhibitorname\", async function (message, command, guild) {\n\t// Your code goes here\n});","position":{"start":{"line":16,"column":1,"offset":1302},"end":{"line":22,"column":4,"offset":1465},"indent":[1,1,1,1,1,1]}},{"type":"paragraph","children":[{"type":"text","value":"Inhibitors can take up to 3 arguments.","position":{"start":{"line":24,"column":1,"offset":1467},"end":{"line":24,"column":39,"offset":1505},"indent":[]}}],"position":{"start":{"line":24,"column":1,"offset":1467},"end":{"line":24,"column":39,"offset":1505},"indent":[]}},{"type":"list","ordered":false,"start":null,"spread":false,"children":[{"type":"listItem","spread":false,"checked":null,"children":[{"type":"paragraph","children":[{"type":"inlineCode","value":"message","position":{"start":{"line":26,"column":3,"offset":1509},"end":{"line":26,"column":12,"offset":1518},"indent":[]}},{"type":"text","value":": The message object that triggered the command.","position":{"start":{"line":26,"column":12,"offset":1518},"end":{"line":26,"column":60,"offset":1566},"indent":[]}}],"position":{"start":{"line":26,"column":3,"offset":1509},"end":{"line":26,"column":60,"offset":1566},"indent":[]}}],"position":{"start":{"line":26,"column":1,"offset":1507},"end":{"line":26,"column":60,"offset":1566},"indent":[]}},{"type":"listItem","spread":false,"checked":null,"children":[{"type":"paragraph","children":[{"type":"inlineCode","value":"command","position":{"start":{"line":27,"column":3,"offset":1569},"end":{"line":27,"column":12,"offset":1578},"indent":[]}},{"type":"text","value":": The command object itself that was triggered.","position":{"start":{"line":27,"column":12,"offset":1578},"end":{"line":27,"column":59,"offset":1625},"indent":[]}}],"position":{"start":{"line":27,"column":3,"offset":1569},"end":{"line":27,"column":59,"offset":1625},"indent":[]}}],"position":{"start":{"line":27,"column":1,"offset":1567},"end":{"line":27,"column":59,"offset":1625},"indent":[]}},{"type":"listItem","spread":false,"checked":null,"children":[{"type":"paragraph","children":[{"type":"inlineCode","value":"guild","position":{"start":{"line":28,"column":3,"offset":1628},"end":{"line":28,"column":10,"offset":1635},"indent":[]}},{"type":"text","value":": The server guild object where this command was ran.","position":{"start":{"line":28,"column":10,"offset":1635},"end":{"line":28,"column":63,"offset":1688},"indent":[]}}],"position":{"start":{"line":28,"column":3,"offset":1628},"end":{"line":28,"column":63,"offset":1688},"indent":[]}}],"position":{"start":{"line":28,"column":1,"offset":1626},"end":{"line":28,"column":63,"offset":1688},"indent":[]}}],"position":{"start":{"line":26,"column":1,"offset":1507},"end":{"line":28,"column":63,"offset":1688},"indent":[1,1]}},{"type":"heading","depth":2,"children":[{"type":"text","value":"Understanding How Inhibitors Function","position":{"start":{"line":30,"column":4,"offset":1693},"end":{"line":30,"column":41,"offset":1730},"indent":[]}}],"position":{"start":{"line":30,"column":1,"offset":1690},"end":{"line":30,"column":41,"offset":1730},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"To block a command you have to return a truthy value.","position":{"start":{"line":32,"column":1,"offset":1732},"end":{"line":32,"column":54,"offset":1785},"indent":[]}}],"position":{"start":{"line":32,"column":1,"offset":1732},"end":{"line":32,"column":54,"offset":1785},"indent":[]}},{"type":"list","ordered":false,"start":null,"spread":false,"children":[{"type":"listItem","spread":false,"checked":null,"children":[{"type":"paragraph","children":[{"type":"strong","children":[{"type":"text","value":"return true;","position":{"start":{"line":33,"column":5,"offset":1790},"end":{"line":33,"column":17,"offset":1802},"indent":[]}}],"position":{"start":{"line":33,"column":3,"offset":1788},"end":{"line":33,"column":19,"offset":1804},"indent":[]}},{"type":"text","value":" If you return true the inhibitor will block the execution of the command.\nTo allow a command return a falsey value.","position":{"start":{"line":33,"column":19,"offset":1804},"end":{"line":34,"column":42,"offset":1920},"indent":[1]}}],"position":{"start":{"line":33,"column":3,"offset":1788},"end":{"line":34,"column":42,"offset":1920},"indent":[1]}}],"position":{"start":{"line":33,"column":1,"offset":1786},"end":{"line":34,"column":42,"offset":1920},"indent":[1]}},{"type":"listItem","spread":false,"checked":null,"children":[{"type":"paragraph","children":[{"type":"strong","children":[{"type":"text","value":"return false;","position":{"start":{"line":35,"column":5,"offset":1925},"end":{"line":35,"column":18,"offset":1938},"indent":[]}}],"position":{"start":{"line":35,"column":3,"offset":1923},"end":{"line":35,"column":20,"offset":1940},"indent":[]}},{"type":"text","value":" If you return false the inhibitor will not block the error.","position":{"start":{"line":35,"column":20,"offset":1940},"end":{"line":35,"column":80,"offset":2000},"indent":[]}}],"position":{"start":{"line":35,"column":3,"offset":1923},"end":{"line":35,"column":80,"offset":2000},"indent":[]}}],"position":{"start":{"line":35,"column":1,"offset":1921},"end":{"line":35,"column":80,"offset":2000},"indent":[]}}],"position":{"start":{"line":33,"column":1,"offset":1786},"end":{"line":35,"column":80,"offset":2000},"indent":[1,1]}},{"type":"code","lang":"ts","meta":null,"value":"// If the command does not require a nitro boost we can allow this command to execute\nif (!command.boostRequired) return false;\n\n// Check if the user has boosted this server\nconst userIsVIP = await \n// The user is VIP so we can allow this command to be used\nif (userIsVIP) return false;\n\n// The user is NOT VIP so we throw an error\nthrow `The ${command.name} is only allowed for VIP users.`","position":{"start":{"line":38,"column":1,"offset":2003},"end":{"line":49,"column":4,"offset":2403},"indent":[1,1,1,1,1,1,1,1,1,1,1]}},{"type":"export","value":"export const _frontmatter = {\"title\":\"Creating Inhibitors!\",\"metaTitle\":\"Creating An Inhibitor | Discordeno\",\"metaDescription\":\"Let's create our very own bot with Discordeno!\"}","position":{"start":{"line":52,"column":1,"offset":2406},"end":{"line":52,"column":177,"offset":2582},"indent":[]}}],"position":{"start":{"line":1,"column":1,"offset":0},"end":{"line":52,"column":177,"offset":2582}}},"scopeImports":["import * as React from 'react'"],"scopeIdentifiers":["React"],"body":"function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }\n\nfunction _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }\n\nfunction _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }\n\n/* @jsx mdx */\nvar _frontmatter = {\n \"title\": \"Creating Inhibitors!\",\n \"metaTitle\": \"Creating An Inhibitor | Discordeno\",\n \"metaDescription\": \"Let's create our very own bot with Discordeno!\"\n};\nvar layoutProps = {\n _frontmatter: _frontmatter\n};\nvar MDXLayout = \"wrapper\";\nreturn function MDXContent(_ref) {\n var components = _ref.components,\n props = _objectWithoutProperties(_ref, [\"components\"]);\n\n return mdx(MDXLayout, _extends({}, layoutProps, props, {\n components: components,\n mdxType: \"MDXLayout\"\n }), mdx(\"p\", null, \"Woah! You are almost half way done with understanding all of Discordeno. Amazing isn't it? Something you may have noticed in the last section was there were some options that prevented some commands from running like \", mdx(\"inlineCode\", {\n parentName: \"p\"\n }, \"dmOnly\"), \" or the permission options. we created a setting to prevent the monitor from running in certain channels. What if we wanted to do prevent commands from happening? How would we prevent commands from running?\"), mdx(\"h2\", null, \"What is an Inhibitor?\"), mdx(\"p\", null, \"An Inhibitor is very similar to how monitors work. A monitor runs on every message but an inhibitor runs on every command. Remember all those command options like cooldown, permissions, permissionLevel, nsfw, etc... Each and every one of these options has an inhibitor in that checks commands for these settings.\"), mdx(\"p\", null, \"Let's create our own inhibitor that would prevent commands from being used if the user is not a VIP user.\"), mdx(\"blockquote\", null, mdx(\"p\", {\n parentName: \"blockquote\"\n }, mdx(\"strong\", {\n parentName: \"p\"\n }, \"Note:\"), \" It is important to remember that everything below can be done with a simple permission level as well. We will create our own custom permission levels but for the purposes of this guide and to be able to learn about Inhibitors, we will be using an inhibitor.\")), mdx(\"h2\", null, \"Creating the File\"), mdx(\"p\", null, \"Let's start by creating a file inside the inhibitors folder called \", mdx(\"inlineCode\", {\n parentName: \"p\"\n }, \"boostRequired.ts\"), \" and paste the following snippet of code:\"), mdx(\"pre\", null, mdx(\"code\", _extends({\n parentName: \"pre\"\n }, {\n \"className\": \"language-ts\"\n }), \"import { botCache } from \\\"../../mod.ts\\\";\\n\\nbotCache.inhibitors.set(\\\"inhibitorname\\\", async function (message, command, guild) {\\n // Your code goes here\\n});\\n\")), mdx(\"p\", null, \"Inhibitors can take up to 3 arguments.\"), mdx(\"ul\", null, mdx(\"li\", {\n parentName: \"ul\"\n }, mdx(\"inlineCode\", {\n parentName: \"li\"\n }, \"message\"), \": The message object that triggered the command.\"), mdx(\"li\", {\n parentName: \"ul\"\n }, mdx(\"inlineCode\", {\n parentName: \"li\"\n }, \"command\"), \": The command object itself that was triggered.\"), mdx(\"li\", {\n parentName: \"ul\"\n }, mdx(\"inlineCode\", {\n parentName: \"li\"\n }, \"guild\"), \": The server guild object where this command was ran.\")), mdx(\"h2\", null, \"Understanding How Inhibitors Function\"), mdx(\"p\", null, \"To block a command you have to return a truthy value.\"), mdx(\"ul\", null, mdx(\"li\", {\n parentName: \"ul\"\n }, mdx(\"strong\", {\n parentName: \"li\"\n }, \"return true;\"), \" If you return true the inhibitor will block the execution of the command.\\nTo allow a command return a falsey value.\"), mdx(\"li\", {\n parentName: \"ul\"\n }, mdx(\"strong\", {\n parentName: \"li\"\n }, \"return false;\"), \" If you return false the inhibitor will not block the error.\")), mdx(\"pre\", null, mdx(\"code\", _extends({\n parentName: \"pre\"\n }, {\n \"className\": \"language-ts\"\n }), \"// If the command does not require a nitro boost we can allow this command to execute\\nif (!command.boostRequired) return false;\\n\\n// Check if the user has boosted this server\\nconst userIsVIP = await \\n// The user is VIP so we can allow this command to be used\\nif (userIsVIP) return false;\\n\\n// The user is NOT VIP so we throw an error\\nthrow `The ${command.name} is only allowed for VIP users.`\\n\")));\n}\n;\nMDXContent.isMDXComponent = true;","rawMDXOutput":"/* @jsx mdx */\nimport { mdx } from '@mdx-js/react';\n/* @jsx mdx */\n\nexport const _frontmatter = {\n \"title\": \"Creating Inhibitors!\",\n \"metaTitle\": \"Creating An Inhibitor | Discordeno\",\n \"metaDescription\": \"Let's create our very own bot with Discordeno!\"\n};\n\nconst layoutProps = {\n _frontmatter\n};\nconst MDXLayout = \"wrapper\"\nexport default function MDXContent({\n components,\n ...props\n}) {\n return \n

{`Woah! You are almost half way done with understanding all of Discordeno. Amazing isn't it? Something you may have noticed in the last section was there were some options that prevented some commands from running like `}{`dmOnly`}{` or the permission options. we created a setting to prevent the monitor from running in certain channels. What if we wanted to do prevent commands from happening? How would we prevent commands from running?`}

\n

{`What is an Inhibitor?`}

\n

{`An Inhibitor is very similar to how monitors work. A monitor runs on every message but an inhibitor runs on every command. Remember all those command options like cooldown, permissions, permissionLevel, nsfw, etc... Each and every one of these options has an inhibitor in that checks commands for these settings.`}

\n

{`Let's create our own inhibitor that would prevent commands from being used if the user is not a VIP user.`}

\n
\n

{`Note:`}{` It is important to remember that everything below can be done with a simple permission level as well. We will create our own custom permission levels but for the purposes of this guide and to be able to learn about Inhibitors, we will be using an inhibitor.`}

\n
\n

{`Creating the File`}

\n

{`Let's start by creating a file inside the inhibitors folder called `}{`boostRequired.ts`}{` and paste the following snippet of code:`}

\n
{`import { botCache } from \"../../mod.ts\";\n\nbotCache.inhibitors.set(\"inhibitorname\", async function (message, command, guild) {\n    // Your code goes here\n});\n`}
\n

{`Inhibitors can take up to 3 arguments.`}

\n
    \n
  • {`message`}{`: The message object that triggered the command.`}
  • \n
  • {`command`}{`: The command object itself that was triggered.`}
  • \n
  • {`guild`}{`: The server guild object where this command was ran.`}
  • \n
\n

{`Understanding How Inhibitors Function`}

\n

{`To block a command you have to return a truthy value.`}

\n
    \n
  • {`return true;`}{` If you return true the inhibitor will block the execution of the command.\nTo allow a command return a falsey value.`}
  • \n
  • {`return false;`}{` If you return false the inhibitor will not block the error.`}
  • \n
\n
{`// If the command does not require a nitro boost we can allow this command to execute\nif (!command.boostRequired) return false;\n\n// Check if the user has boosted this server\nconst userIsVIP = await \n// The user is VIP so we can allow this command to be used\nif (userIsVIP) return false;\n\n// The user is NOT VIP so we throw an error\nthrow \\`The \\${command.name} is only allowed for VIP users.\\`\n`}
\n\n
;\n}\n\n;\nMDXContent.isMDXComponent = true;"}} \ No newline at end of file diff --git a/docs/.cache/caches/gatsby-plugin-mdx/diskstore-67746d58d4cc8a61799ed91117b51303.json b/docs/.cache/caches/gatsby-plugin-mdx/diskstore-67746d58d4cc8a61799ed91117b51303.json new file mode 100644 index 000000000..1ab93c353 --- /dev/null +++ b/docs/.cache/caches/gatsby-plugin-mdx/diskstore-67746d58d4cc8a61799ed91117b51303.json @@ -0,0 +1 @@ +{"expireTime":9007200851634219000,"key":"gatsby-plugin-mdx-entire-payload-a8a6be675cf7d2c9b5a26b254a879a74-","val":{"mdast":{"type":"root","children":[{"type":"paragraph","children":[{"type":"text","value":"Woah! You are almost half way done with understanding all of Discordeno. Amazing isn't it? Something you may have noticed in the last section was there were some options that prevented some commands from running like ","position":{"start":{"line":2,"column":1,"offset":1},"end":{"line":2,"column":218,"offset":218},"indent":[]}},{"type":"inlineCode","value":"dmOnly","position":{"start":{"line":2,"column":218,"offset":218},"end":{"line":2,"column":226,"offset":226},"indent":[]}},{"type":"text","value":" or the permission options. we created a setting to prevent the monitor from running in certain channels. What if we wanted to do prevent commands from happening? How would we prevent commands from running?","position":{"start":{"line":2,"column":226,"offset":226},"end":{"line":2,"column":432,"offset":432},"indent":[]}}],"position":{"start":{"line":2,"column":1,"offset":1},"end":{"line":2,"column":432,"offset":432},"indent":[]}},{"type":"heading","depth":2,"children":[{"type":"text","value":"What is an Inhibitor?","position":{"start":{"line":4,"column":4,"offset":437},"end":{"line":4,"column":25,"offset":458},"indent":[]}}],"position":{"start":{"line":4,"column":1,"offset":434},"end":{"line":4,"column":25,"offset":458},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"An Inhibitor is very similar to how monitors work. A monitor runs on every message but an inhibitor runs on every command. Remember all those command options like cooldown, permissions, permissionLevel, nsfw, etc... Each and every one of these options has an inhibitor in that checks commands for these settings.","position":{"start":{"line":6,"column":1,"offset":460},"end":{"line":6,"column":313,"offset":772},"indent":[]}}],"position":{"start":{"line":6,"column":1,"offset":460},"end":{"line":6,"column":313,"offset":772},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"Let's create our own inhibitor that would prevent commands from being used if the user is not a VIP user.","position":{"start":{"line":8,"column":1,"offset":774},"end":{"line":8,"column":106,"offset":879},"indent":[]}}],"position":{"start":{"line":8,"column":1,"offset":774},"end":{"line":8,"column":106,"offset":879},"indent":[]}},{"type":"blockquote","children":[{"type":"paragraph","children":[{"type":"strong","children":[{"type":"text","value":"Note:","position":{"start":{"line":10,"column":5,"offset":885},"end":{"line":10,"column":10,"offset":890},"indent":[]}}],"position":{"start":{"line":10,"column":3,"offset":883},"end":{"line":10,"column":12,"offset":892},"indent":[]}},{"type":"text","value":" It is important to remember that everything below can be done with a simple permission level as well. We will create our own custom permission levels but for the purposes of this guide and to be able to learn about Inhibitors, we will be using an inhibitor.","position":{"start":{"line":10,"column":12,"offset":892},"end":{"line":10,"column":270,"offset":1150},"indent":[]}}],"position":{"start":{"line":10,"column":3,"offset":883},"end":{"line":10,"column":270,"offset":1150},"indent":[]}}],"position":{"start":{"line":10,"column":1,"offset":881},"end":{"line":10,"column":270,"offset":1150},"indent":[]}},{"type":"heading","depth":2,"children":[{"type":"text","value":"Creating the File","position":{"start":{"line":12,"column":4,"offset":1155},"end":{"line":12,"column":21,"offset":1172},"indent":[]}}],"position":{"start":{"line":12,"column":1,"offset":1152},"end":{"line":12,"column":21,"offset":1172},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"Let's start by creating a file inside the inhibitors folder called ","position":{"start":{"line":14,"column":1,"offset":1174},"end":{"line":14,"column":68,"offset":1241},"indent":[]}},{"type":"inlineCode","value":"boosted.ts","position":{"start":{"line":14,"column":68,"offset":1241},"end":{"line":14,"column":80,"offset":1253},"indent":[]}},{"type":"text","value":" and paste the following snippet of code:","position":{"start":{"line":14,"column":80,"offset":1253},"end":{"line":14,"column":121,"offset":1294},"indent":[]}}],"position":{"start":{"line":14,"column":1,"offset":1174},"end":{"line":14,"column":121,"offset":1294},"indent":[]}},{"type":"code","lang":"ts","meta":null,"value":"import { botCache } from \"../../mod.ts\";\n\nbotCache.inhibitors.set(\"inhibitorname\", async function (message, command, guild) {\n\t// Your code goes here\n});","position":{"start":{"line":16,"column":1,"offset":1296},"end":{"line":22,"column":4,"offset":1459},"indent":[1,1,1,1,1,1]}},{"type":"paragraph","children":[{"type":"text","value":"Inhibitors can take up to 3 arguments.","position":{"start":{"line":24,"column":1,"offset":1461},"end":{"line":24,"column":39,"offset":1499},"indent":[]}}],"position":{"start":{"line":24,"column":1,"offset":1461},"end":{"line":24,"column":39,"offset":1499},"indent":[]}},{"type":"list","ordered":false,"start":null,"spread":false,"children":[{"type":"listItem","spread":false,"checked":null,"children":[{"type":"paragraph","children":[{"type":"inlineCode","value":"message","position":{"start":{"line":26,"column":3,"offset":1503},"end":{"line":26,"column":12,"offset":1512},"indent":[]}},{"type":"text","value":": The message object that triggered the command.","position":{"start":{"line":26,"column":12,"offset":1512},"end":{"line":26,"column":60,"offset":1560},"indent":[]}}],"position":{"start":{"line":26,"column":3,"offset":1503},"end":{"line":26,"column":60,"offset":1560},"indent":[]}}],"position":{"start":{"line":26,"column":1,"offset":1501},"end":{"line":26,"column":60,"offset":1560},"indent":[]}},{"type":"listItem","spread":false,"checked":null,"children":[{"type":"paragraph","children":[{"type":"inlineCode","value":"command","position":{"start":{"line":27,"column":3,"offset":1563},"end":{"line":27,"column":12,"offset":1572},"indent":[]}},{"type":"text","value":": The command object itself that was triggered.","position":{"start":{"line":27,"column":12,"offset":1572},"end":{"line":27,"column":59,"offset":1619},"indent":[]}}],"position":{"start":{"line":27,"column":3,"offset":1563},"end":{"line":27,"column":59,"offset":1619},"indent":[]}}],"position":{"start":{"line":27,"column":1,"offset":1561},"end":{"line":27,"column":59,"offset":1619},"indent":[]}},{"type":"listItem","spread":false,"checked":null,"children":[{"type":"paragraph","children":[{"type":"inlineCode","value":"guild","position":{"start":{"line":28,"column":3,"offset":1622},"end":{"line":28,"column":10,"offset":1629},"indent":[]}},{"type":"text","value":": The server guild object where this command was ran.","position":{"start":{"line":28,"column":10,"offset":1629},"end":{"line":28,"column":63,"offset":1682},"indent":[]}}],"position":{"start":{"line":28,"column":3,"offset":1622},"end":{"line":28,"column":63,"offset":1682},"indent":[]}}],"position":{"start":{"line":28,"column":1,"offset":1620},"end":{"line":28,"column":63,"offset":1682},"indent":[]}}],"position":{"start":{"line":26,"column":1,"offset":1501},"end":{"line":28,"column":63,"offset":1682},"indent":[1,1]}},{"type":"heading","depth":2,"children":[{"type":"text","value":"Understanding How Inhibitors Function","position":{"start":{"line":30,"column":4,"offset":1687},"end":{"line":30,"column":41,"offset":1724},"indent":[]}}],"position":{"start":{"line":30,"column":1,"offset":1684},"end":{"line":30,"column":41,"offset":1724},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"To block a command you have to return a truthy value.","position":{"start":{"line":32,"column":1,"offset":1726},"end":{"line":32,"column":54,"offset":1779},"indent":[]}}],"position":{"start":{"line":32,"column":1,"offset":1726},"end":{"line":32,"column":54,"offset":1779},"indent":[]}},{"type":"list","ordered":false,"start":null,"spread":false,"children":[{"type":"listItem","spread":false,"checked":null,"children":[{"type":"paragraph","children":[{"type":"strong","children":[{"type":"text","value":"return true;","position":{"start":{"line":33,"column":5,"offset":1784},"end":{"line":33,"column":17,"offset":1796},"indent":[]}}],"position":{"start":{"line":33,"column":3,"offset":1782},"end":{"line":33,"column":19,"offset":1798},"indent":[]}},{"type":"text","value":" If you return true the inhibitor will block the execution of the command.\nTo allow a command return a falsey value.","position":{"start":{"line":33,"column":19,"offset":1798},"end":{"line":34,"column":42,"offset":1914},"indent":[1]}}],"position":{"start":{"line":33,"column":3,"offset":1782},"end":{"line":34,"column":42,"offset":1914},"indent":[1]}}],"position":{"start":{"line":33,"column":1,"offset":1780},"end":{"line":34,"column":42,"offset":1914},"indent":[1]}},{"type":"listItem","spread":false,"checked":null,"children":[{"type":"paragraph","children":[{"type":"strong","children":[{"type":"text","value":"return false;","position":{"start":{"line":35,"column":5,"offset":1919},"end":{"line":35,"column":18,"offset":1932},"indent":[]}}],"position":{"start":{"line":35,"column":3,"offset":1917},"end":{"line":35,"column":20,"offset":1934},"indent":[]}},{"type":"text","value":" If you return false the inhibitor will not block the error.","position":{"start":{"line":35,"column":20,"offset":1934},"end":{"line":35,"column":80,"offset":1994},"indent":[]}}],"position":{"start":{"line":35,"column":3,"offset":1917},"end":{"line":35,"column":80,"offset":1994},"indent":[]}}],"position":{"start":{"line":35,"column":1,"offset":1915},"end":{"line":35,"column":80,"offset":1994},"indent":[]}}],"position":{"start":{"line":33,"column":1,"offset":1780},"end":{"line":35,"column":80,"offset":1994},"indent":[1,1]}},{"type":"code","lang":"ts","meta":null,"value":"// If the command is not VIP only we can allow this command to execute\nif (!command.vipOnly) return false;\n\n// The bot's support server\nconst guild = cache.guilds.get(configs.supportServerID);\n// If the command author is not in the server they won't have the vip role\nconst member = guild.members.get(message.author.id) || await getMember(guild.id, message.author.id);\n// Member doesn't exist so cancel the command\nif (!member) return true;\n// Check if the user has the vip role on the support server given by patreon\nconst userIsVIP = await isUserVIP(message.author.id)\n// The user is VIP so we can allow this command to be used\nif (userIsVIP) return false;\n\n// The user is NOT VIP so we throw an error\nthrow `The ${command.name} is only allowed for VIP users.`","position":{"start":{"line":38,"column":1,"offset":1997},"end":{"line":55,"column":4,"offset":2769},"indent":[1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1]}},{"type":"export","value":"export const _frontmatter = {\"title\":\"Creating Inhibitors!\",\"metaTitle\":\"Creating An Inhibitor | Discordeno\",\"metaDescription\":\"Let's create our very own bot with Discordeno!\"}","position":{"start":{"line":58,"column":1,"offset":2772},"end":{"line":58,"column":177,"offset":2948},"indent":[]}}],"position":{"start":{"line":1,"column":1,"offset":0},"end":{"line":58,"column":177,"offset":2948}}},"scopeImports":["import * as React from 'react'"],"scopeIdentifiers":["React"],"body":"function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }\n\nfunction _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }\n\nfunction _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }\n\n/* @jsx mdx */\nvar _frontmatter = {\n \"title\": \"Creating Inhibitors!\",\n \"metaTitle\": \"Creating An Inhibitor | Discordeno\",\n \"metaDescription\": \"Let's create our very own bot with Discordeno!\"\n};\nvar layoutProps = {\n _frontmatter: _frontmatter\n};\nvar MDXLayout = \"wrapper\";\nreturn function MDXContent(_ref) {\n var components = _ref.components,\n props = _objectWithoutProperties(_ref, [\"components\"]);\n\n return mdx(MDXLayout, _extends({}, layoutProps, props, {\n components: components,\n mdxType: \"MDXLayout\"\n }), mdx(\"p\", null, \"Woah! You are almost half way done with understanding all of Discordeno. Amazing isn't it? Something you may have noticed in the last section was there were some options that prevented some commands from running like \", mdx(\"inlineCode\", {\n parentName: \"p\"\n }, \"dmOnly\"), \" or the permission options. we created a setting to prevent the monitor from running in certain channels. What if we wanted to do prevent commands from happening? How would we prevent commands from running?\"), mdx(\"h2\", null, \"What is an Inhibitor?\"), mdx(\"p\", null, \"An Inhibitor is very similar to how monitors work. A monitor runs on every message but an inhibitor runs on every command. Remember all those command options like cooldown, permissions, permissionLevel, nsfw, etc... Each and every one of these options has an inhibitor in that checks commands for these settings.\"), mdx(\"p\", null, \"Let's create our own inhibitor that would prevent commands from being used if the user is not a VIP user.\"), mdx(\"blockquote\", null, mdx(\"p\", {\n parentName: \"blockquote\"\n }, mdx(\"strong\", {\n parentName: \"p\"\n }, \"Note:\"), \" It is important to remember that everything below can be done with a simple permission level as well. We will create our own custom permission levels but for the purposes of this guide and to be able to learn about Inhibitors, we will be using an inhibitor.\")), mdx(\"h2\", null, \"Creating the File\"), mdx(\"p\", null, \"Let's start by creating a file inside the inhibitors folder called \", mdx(\"inlineCode\", {\n parentName: \"p\"\n }, \"boosted.ts\"), \" and paste the following snippet of code:\"), mdx(\"pre\", null, mdx(\"code\", _extends({\n parentName: \"pre\"\n }, {\n \"className\": \"language-ts\"\n }), \"import { botCache } from \\\"../../mod.ts\\\";\\n\\nbotCache.inhibitors.set(\\\"inhibitorname\\\", async function (message, command, guild) {\\n // Your code goes here\\n});\\n\")), mdx(\"p\", null, \"Inhibitors can take up to 3 arguments.\"), mdx(\"ul\", null, mdx(\"li\", {\n parentName: \"ul\"\n }, mdx(\"inlineCode\", {\n parentName: \"li\"\n }, \"message\"), \": The message object that triggered the command.\"), mdx(\"li\", {\n parentName: \"ul\"\n }, mdx(\"inlineCode\", {\n parentName: \"li\"\n }, \"command\"), \": The command object itself that was triggered.\"), mdx(\"li\", {\n parentName: \"ul\"\n }, mdx(\"inlineCode\", {\n parentName: \"li\"\n }, \"guild\"), \": The server guild object where this command was ran.\")), mdx(\"h2\", null, \"Understanding How Inhibitors Function\"), mdx(\"p\", null, \"To block a command you have to return a truthy value.\"), mdx(\"ul\", null, mdx(\"li\", {\n parentName: \"ul\"\n }, mdx(\"strong\", {\n parentName: \"li\"\n }, \"return true;\"), \" If you return true the inhibitor will block the execution of the command.\\nTo allow a command return a falsey value.\"), mdx(\"li\", {\n parentName: \"ul\"\n }, mdx(\"strong\", {\n parentName: \"li\"\n }, \"return false;\"), \" If you return false the inhibitor will not block the error.\")), mdx(\"pre\", null, mdx(\"code\", _extends({\n parentName: \"pre\"\n }, {\n \"className\": \"language-ts\"\n }), \"// If the command is not VIP only we can allow this command to execute\\nif (!command.vipOnly) return false;\\n\\n// The bot's support server\\nconst guild = cache.guilds.get(configs.supportServerID);\\n// If the command author is not in the server they won't have the vip role\\nconst member = guild.members.get(message.author.id) || await getMember(guild.id, message.author.id);\\n// Member doesn't exist so cancel the command\\nif (!member) return true;\\n// Check if the user has the vip role on the support server given by patreon\\nconst userIsVIP = await isUserVIP(message.author.id)\\n// The user is VIP so we can allow this command to be used\\nif (userIsVIP) return false;\\n\\n// The user is NOT VIP so we throw an error\\nthrow `The ${command.name} is only allowed for VIP users.`\\n\")));\n}\n;\nMDXContent.isMDXComponent = true;","rawMDXOutput":"/* @jsx mdx */\nimport { mdx } from '@mdx-js/react';\n/* @jsx mdx */\n\nexport const _frontmatter = {\n \"title\": \"Creating Inhibitors!\",\n \"metaTitle\": \"Creating An Inhibitor | Discordeno\",\n \"metaDescription\": \"Let's create our very own bot with Discordeno!\"\n};\n\nconst layoutProps = {\n _frontmatter\n};\nconst MDXLayout = \"wrapper\"\nexport default function MDXContent({\n components,\n ...props\n}) {\n return \n

{`Woah! You are almost half way done with understanding all of Discordeno. Amazing isn't it? Something you may have noticed in the last section was there were some options that prevented some commands from running like `}{`dmOnly`}{` or the permission options. we created a setting to prevent the monitor from running in certain channels. What if we wanted to do prevent commands from happening? How would we prevent commands from running?`}

\n

{`What is an Inhibitor?`}

\n

{`An Inhibitor is very similar to how monitors work. A monitor runs on every message but an inhibitor runs on every command. Remember all those command options like cooldown, permissions, permissionLevel, nsfw, etc... Each and every one of these options has an inhibitor in that checks commands for these settings.`}

\n

{`Let's create our own inhibitor that would prevent commands from being used if the user is not a VIP user.`}

\n
\n

{`Note:`}{` It is important to remember that everything below can be done with a simple permission level as well. We will create our own custom permission levels but for the purposes of this guide and to be able to learn about Inhibitors, we will be using an inhibitor.`}

\n
\n

{`Creating the File`}

\n

{`Let's start by creating a file inside the inhibitors folder called `}{`boosted.ts`}{` and paste the following snippet of code:`}

\n
{`import { botCache } from \"../../mod.ts\";\n\nbotCache.inhibitors.set(\"inhibitorname\", async function (message, command, guild) {\n    // Your code goes here\n});\n`}
\n

{`Inhibitors can take up to 3 arguments.`}

\n
    \n
  • {`message`}{`: The message object that triggered the command.`}
  • \n
  • {`command`}{`: The command object itself that was triggered.`}
  • \n
  • {`guild`}{`: The server guild object where this command was ran.`}
  • \n
\n

{`Understanding How Inhibitors Function`}

\n

{`To block a command you have to return a truthy value.`}

\n
    \n
  • {`return true;`}{` If you return true the inhibitor will block the execution of the command.\nTo allow a command return a falsey value.`}
  • \n
  • {`return false;`}{` If you return false the inhibitor will not block the error.`}
  • \n
\n
{`// If the command is not VIP only we can allow this command to execute\nif (!command.vipOnly) return false;\n\n// The bot's support server\nconst guild = cache.guilds.get(configs.supportServerID);\n// If the command author is not in the server they won't have the vip role\nconst member = guild.members.get(message.author.id) || await getMember(guild.id, message.author.id);\n// Member doesn't exist so cancel the command\nif (!member) return true;\n// Check if the user has the vip role on the support server given by patreon\nconst userIsVIP = await isUserVIP(message.author.id)\n// The user is VIP so we can allow this command to be used\nif (userIsVIP) return false;\n\n// The user is NOT VIP so we throw an error\nthrow \\`The \\${command.name} is only allowed for VIP users.\\`\n`}
\n\n
;\n}\n\n;\nMDXContent.isMDXComponent = true;"}} \ No newline at end of file diff --git a/docs/.cache/caches/gatsby-plugin-mdx/diskstore-67a4416f6199e0263e2fdef9ccb769d7.json b/docs/.cache/caches/gatsby-plugin-mdx/diskstore-67a4416f6199e0263e2fdef9ccb769d7.json new file mode 100644 index 000000000..90fac8bb3 --- /dev/null +++ b/docs/.cache/caches/gatsby-plugin-mdx/diskstore-67a4416f6199e0263e2fdef9ccb769d7.json @@ -0,0 +1 @@ +{"expireTime":9007200851596637000,"key":"gatsby-plugin-mdx-entire-payload-a75dec90c7c476a493cb87fbcd7783e8-","val":{"mdast":{"type":"root","children":[{"type":"export","value":"export const _frontmatter = {}","position":{"start":{"line":3,"column":1,"offset":2},"end":{"line":3,"column":31,"offset":32},"indent":[]}}],"position":{"start":{"line":1,"column":1,"offset":0},"end":{"line":3,"column":31,"offset":32}}},"scopeImports":["import * as React from 'react'"],"scopeIdentifiers":["React"],"body":"function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }\n\nfunction _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }\n\nfunction _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }\n\n/* @jsx mdx */\nvar _frontmatter = {};\nvar layoutProps = {\n _frontmatter: _frontmatter\n};\nvar MDXLayout = \"wrapper\";\nreturn function MDXContent(_ref) {\n var components = _ref.components,\n props = _objectWithoutProperties(_ref, [\"components\"]);\n\n return mdx(MDXLayout, _extends({}, layoutProps, props, {\n components: components,\n mdxType: \"MDXLayout\"\n }));\n}\n;\nMDXContent.isMDXComponent = true;","rawMDXOutput":"/* @jsx mdx */\nimport { mdx } from '@mdx-js/react';\n/* @jsx mdx */\n\nexport const _frontmatter = {};\n\nconst layoutProps = {\n _frontmatter\n};\nconst MDXLayout = \"wrapper\"\nexport default function MDXContent({\n components,\n ...props\n}) {\n return \n\n ;\n}\n\n;\nMDXContent.isMDXComponent = true;"}} \ No newline at end of file diff --git a/docs/.cache/caches/gatsby-plugin-mdx/diskstore-683661f7c6f3bab20ab1dde554c699ac.json b/docs/.cache/caches/gatsby-plugin-mdx/diskstore-683661f7c6f3bab20ab1dde554c699ac.json new file mode 100644 index 000000000..e9f9eef6a --- /dev/null +++ b/docs/.cache/caches/gatsby-plugin-mdx/diskstore-683661f7c6f3bab20ab1dde554c699ac.json @@ -0,0 +1 @@ +{"expireTime":9007200851634126000,"key":"gatsby-plugin-mdx-entire-payload-9ea779f68986e708bcc4f046700e047c-","val":{"mdast":{"type":"root","children":[{"type":"paragraph","children":[{"type":"text","value":"Woah! You are almost half way done with understanding all of Discordeno. Amazing isn't it? Something you may have noticed in the last section was there were some options that prevented some commands from running like ","position":{"start":{"line":2,"column":1,"offset":1},"end":{"line":2,"column":218,"offset":218},"indent":[]}},{"type":"inlineCode","value":"dmOnly","position":{"start":{"line":2,"column":218,"offset":218},"end":{"line":2,"column":226,"offset":226},"indent":[]}},{"type":"text","value":" or the permission options. we created a setting to prevent the monitor from running in certain channels. What if we wanted to do prevent commands from happening? How would we prevent commands from running?","position":{"start":{"line":2,"column":226,"offset":226},"end":{"line":2,"column":432,"offset":432},"indent":[]}}],"position":{"start":{"line":2,"column":1,"offset":1},"end":{"line":2,"column":432,"offset":432},"indent":[]}},{"type":"heading","depth":2,"children":[{"type":"text","value":"What is an Inhibitor?","position":{"start":{"line":4,"column":4,"offset":437},"end":{"line":4,"column":25,"offset":458},"indent":[]}}],"position":{"start":{"line":4,"column":1,"offset":434},"end":{"line":4,"column":25,"offset":458},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"An Inhibitor is very similar to how monitors work. A monitor runs on every message but an inhibitor runs on every command. Remember all those command options like cooldown, permissions, permissionLevel, nsfw, etc... Each and every one of these options has an inhibitor in that checks commands for these settings.","position":{"start":{"line":6,"column":1,"offset":460},"end":{"line":6,"column":313,"offset":772},"indent":[]}}],"position":{"start":{"line":6,"column":1,"offset":460},"end":{"line":6,"column":313,"offset":772},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"Let's create our own inhibitor that would prevent commands from being used if the user is not a VIP user.","position":{"start":{"line":8,"column":1,"offset":774},"end":{"line":8,"column":106,"offset":879},"indent":[]}}],"position":{"start":{"line":8,"column":1,"offset":774},"end":{"line":8,"column":106,"offset":879},"indent":[]}},{"type":"blockquote","children":[{"type":"paragraph","children":[{"type":"strong","children":[{"type":"text","value":"Note:","position":{"start":{"line":10,"column":5,"offset":885},"end":{"line":10,"column":10,"offset":890},"indent":[]}}],"position":{"start":{"line":10,"column":3,"offset":883},"end":{"line":10,"column":12,"offset":892},"indent":[]}},{"type":"text","value":" It is important to remember that everything below can be done with a simple permission level as well. We will create our own custom permission levels but for the purposes of this guide and to be able to learn about Inhibitors, we will be using an inhibitor.","position":{"start":{"line":10,"column":12,"offset":892},"end":{"line":10,"column":270,"offset":1150},"indent":[]}}],"position":{"start":{"line":10,"column":3,"offset":883},"end":{"line":10,"column":270,"offset":1150},"indent":[]}}],"position":{"start":{"line":10,"column":1,"offset":881},"end":{"line":10,"column":270,"offset":1150},"indent":[]}},{"type":"heading","depth":2,"children":[{"type":"text","value":"Creating the File","position":{"start":{"line":12,"column":4,"offset":1155},"end":{"line":12,"column":21,"offset":1172},"indent":[]}}],"position":{"start":{"line":12,"column":1,"offset":1152},"end":{"line":12,"column":21,"offset":1172},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"Let's start by creating a file inside the inhibitors folder called ","position":{"start":{"line":14,"column":1,"offset":1174},"end":{"line":14,"column":68,"offset":1241},"indent":[]}},{"type":"inlineCode","value":"boosted.ts","position":{"start":{"line":14,"column":68,"offset":1241},"end":{"line":14,"column":80,"offset":1253},"indent":[]}},{"type":"text","value":" and paste the following snippet of code:","position":{"start":{"line":14,"column":80,"offset":1253},"end":{"line":14,"column":121,"offset":1294},"indent":[]}}],"position":{"start":{"line":14,"column":1,"offset":1174},"end":{"line":14,"column":121,"offset":1294},"indent":[]}},{"type":"code","lang":"ts","meta":null,"value":"import { botCache } from \"../../mod.ts\";\n\nbotCache.inhibitors.set(\"inhibitorname\", async function (message, command, guild) {\n\t// Your code goes here\n});","position":{"start":{"line":16,"column":1,"offset":1296},"end":{"line":22,"column":4,"offset":1459},"indent":[1,1,1,1,1,1]}},{"type":"paragraph","children":[{"type":"text","value":"Inhibitors can take up to 3 arguments.","position":{"start":{"line":24,"column":1,"offset":1461},"end":{"line":24,"column":39,"offset":1499},"indent":[]}}],"position":{"start":{"line":24,"column":1,"offset":1461},"end":{"line":24,"column":39,"offset":1499},"indent":[]}},{"type":"list","ordered":false,"start":null,"spread":false,"children":[{"type":"listItem","spread":false,"checked":null,"children":[{"type":"paragraph","children":[{"type":"inlineCode","value":"message","position":{"start":{"line":26,"column":3,"offset":1503},"end":{"line":26,"column":12,"offset":1512},"indent":[]}},{"type":"text","value":": The message object that triggered the command.","position":{"start":{"line":26,"column":12,"offset":1512},"end":{"line":26,"column":60,"offset":1560},"indent":[]}}],"position":{"start":{"line":26,"column":3,"offset":1503},"end":{"line":26,"column":60,"offset":1560},"indent":[]}}],"position":{"start":{"line":26,"column":1,"offset":1501},"end":{"line":26,"column":60,"offset":1560},"indent":[]}},{"type":"listItem","spread":false,"checked":null,"children":[{"type":"paragraph","children":[{"type":"inlineCode","value":"command","position":{"start":{"line":27,"column":3,"offset":1563},"end":{"line":27,"column":12,"offset":1572},"indent":[]}},{"type":"text","value":": The command object itself that was triggered.","position":{"start":{"line":27,"column":12,"offset":1572},"end":{"line":27,"column":59,"offset":1619},"indent":[]}}],"position":{"start":{"line":27,"column":3,"offset":1563},"end":{"line":27,"column":59,"offset":1619},"indent":[]}}],"position":{"start":{"line":27,"column":1,"offset":1561},"end":{"line":27,"column":59,"offset":1619},"indent":[]}},{"type":"listItem","spread":false,"checked":null,"children":[{"type":"paragraph","children":[{"type":"inlineCode","value":"guild","position":{"start":{"line":28,"column":3,"offset":1622},"end":{"line":28,"column":10,"offset":1629},"indent":[]}},{"type":"text","value":": The server guild object where this command was ran.","position":{"start":{"line":28,"column":10,"offset":1629},"end":{"line":28,"column":63,"offset":1682},"indent":[]}}],"position":{"start":{"line":28,"column":3,"offset":1622},"end":{"line":28,"column":63,"offset":1682},"indent":[]}}],"position":{"start":{"line":28,"column":1,"offset":1620},"end":{"line":28,"column":63,"offset":1682},"indent":[]}}],"position":{"start":{"line":26,"column":1,"offset":1501},"end":{"line":28,"column":63,"offset":1682},"indent":[1,1]}},{"type":"heading","depth":2,"children":[{"type":"text","value":"Understanding How Inhibitors Function","position":{"start":{"line":30,"column":4,"offset":1687},"end":{"line":30,"column":41,"offset":1724},"indent":[]}}],"position":{"start":{"line":30,"column":1,"offset":1684},"end":{"line":30,"column":41,"offset":1724},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"To block a command you have to return a truthy value.","position":{"start":{"line":32,"column":1,"offset":1726},"end":{"line":32,"column":54,"offset":1779},"indent":[]}}],"position":{"start":{"line":32,"column":1,"offset":1726},"end":{"line":32,"column":54,"offset":1779},"indent":[]}},{"type":"list","ordered":false,"start":null,"spread":false,"children":[{"type":"listItem","spread":false,"checked":null,"children":[{"type":"paragraph","children":[{"type":"strong","children":[{"type":"text","value":"return true;","position":{"start":{"line":33,"column":5,"offset":1784},"end":{"line":33,"column":17,"offset":1796},"indent":[]}}],"position":{"start":{"line":33,"column":3,"offset":1782},"end":{"line":33,"column":19,"offset":1798},"indent":[]}},{"type":"text","value":" If you return true the inhibitor will block the execution of the command.\nTo allow a command return a falsey value.","position":{"start":{"line":33,"column":19,"offset":1798},"end":{"line":34,"column":42,"offset":1914},"indent":[1]}}],"position":{"start":{"line":33,"column":3,"offset":1782},"end":{"line":34,"column":42,"offset":1914},"indent":[1]}}],"position":{"start":{"line":33,"column":1,"offset":1780},"end":{"line":34,"column":42,"offset":1914},"indent":[1]}},{"type":"listItem","spread":false,"checked":null,"children":[{"type":"paragraph","children":[{"type":"strong","children":[{"type":"text","value":"return false;","position":{"start":{"line":35,"column":5,"offset":1919},"end":{"line":35,"column":18,"offset":1932},"indent":[]}}],"position":{"start":{"line":35,"column":3,"offset":1917},"end":{"line":35,"column":20,"offset":1934},"indent":[]}},{"type":"text","value":" If you return false the inhibitor will not block the error.","position":{"start":{"line":35,"column":20,"offset":1934},"end":{"line":35,"column":80,"offset":1994},"indent":[]}}],"position":{"start":{"line":35,"column":3,"offset":1917},"end":{"line":35,"column":80,"offset":1994},"indent":[]}}],"position":{"start":{"line":35,"column":1,"offset":1915},"end":{"line":35,"column":80,"offset":1994},"indent":[]}}],"position":{"start":{"line":33,"column":1,"offset":1780},"end":{"line":35,"column":80,"offset":1994},"indent":[1,1]}},{"type":"code","lang":"ts","meta":null,"value":"// If the command is not VIP only we can allow this command to execute\nif (!command.vipOnly) return false;\n\n// The bot's support server\nconst guild = cache.guilds.get(configs.supportServerID)\n// Check if the user has the vip role on the support server given by patreon\nconst userIsVIP = await isUserVIP(message.author.id)\n// The user is VIP so we can allow this command to be used\nif (userIsVIP) return false;\n\n// The user is NOT VIP so we throw an error\nthrow `The ${command.name} is only allowed for VIP users.`","position":{"start":{"line":38,"column":1,"offset":1997},"end":{"line":51,"column":4,"offset":2520},"indent":[1,1,1,1,1,1,1,1,1,1,1,1,1]}},{"type":"export","value":"export const _frontmatter = {\"title\":\"Creating Inhibitors!\",\"metaTitle\":\"Creating An Inhibitor | Discordeno\",\"metaDescription\":\"Let's create our very own bot with Discordeno!\"}","position":{"start":{"line":54,"column":1,"offset":2523},"end":{"line":54,"column":177,"offset":2699},"indent":[]}}],"position":{"start":{"line":1,"column":1,"offset":0},"end":{"line":54,"column":177,"offset":2699}}},"scopeImports":["import * as React from 'react'"],"scopeIdentifiers":["React"],"body":"function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }\n\nfunction _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }\n\nfunction _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }\n\n/* @jsx mdx */\nvar _frontmatter = {\n \"title\": \"Creating Inhibitors!\",\n \"metaTitle\": \"Creating An Inhibitor | Discordeno\",\n \"metaDescription\": \"Let's create our very own bot with Discordeno!\"\n};\nvar layoutProps = {\n _frontmatter: _frontmatter\n};\nvar MDXLayout = \"wrapper\";\nreturn function MDXContent(_ref) {\n var components = _ref.components,\n props = _objectWithoutProperties(_ref, [\"components\"]);\n\n return mdx(MDXLayout, _extends({}, layoutProps, props, {\n components: components,\n mdxType: \"MDXLayout\"\n }), mdx(\"p\", null, \"Woah! You are almost half way done with understanding all of Discordeno. Amazing isn't it? Something you may have noticed in the last section was there were some options that prevented some commands from running like \", mdx(\"inlineCode\", {\n parentName: \"p\"\n }, \"dmOnly\"), \" or the permission options. we created a setting to prevent the monitor from running in certain channels. What if we wanted to do prevent commands from happening? How would we prevent commands from running?\"), mdx(\"h2\", null, \"What is an Inhibitor?\"), mdx(\"p\", null, \"An Inhibitor is very similar to how monitors work. A monitor runs on every message but an inhibitor runs on every command. Remember all those command options like cooldown, permissions, permissionLevel, nsfw, etc... Each and every one of these options has an inhibitor in that checks commands for these settings.\"), mdx(\"p\", null, \"Let's create our own inhibitor that would prevent commands from being used if the user is not a VIP user.\"), mdx(\"blockquote\", null, mdx(\"p\", {\n parentName: \"blockquote\"\n }, mdx(\"strong\", {\n parentName: \"p\"\n }, \"Note:\"), \" It is important to remember that everything below can be done with a simple permission level as well. We will create our own custom permission levels but for the purposes of this guide and to be able to learn about Inhibitors, we will be using an inhibitor.\")), mdx(\"h2\", null, \"Creating the File\"), mdx(\"p\", null, \"Let's start by creating a file inside the inhibitors folder called \", mdx(\"inlineCode\", {\n parentName: \"p\"\n }, \"boosted.ts\"), \" and paste the following snippet of code:\"), mdx(\"pre\", null, mdx(\"code\", _extends({\n parentName: \"pre\"\n }, {\n \"className\": \"language-ts\"\n }), \"import { botCache } from \\\"../../mod.ts\\\";\\n\\nbotCache.inhibitors.set(\\\"inhibitorname\\\", async function (message, command, guild) {\\n // Your code goes here\\n});\\n\")), mdx(\"p\", null, \"Inhibitors can take up to 3 arguments.\"), mdx(\"ul\", null, mdx(\"li\", {\n parentName: \"ul\"\n }, mdx(\"inlineCode\", {\n parentName: \"li\"\n }, \"message\"), \": The message object that triggered the command.\"), mdx(\"li\", {\n parentName: \"ul\"\n }, mdx(\"inlineCode\", {\n parentName: \"li\"\n }, \"command\"), \": The command object itself that was triggered.\"), mdx(\"li\", {\n parentName: \"ul\"\n }, mdx(\"inlineCode\", {\n parentName: \"li\"\n }, \"guild\"), \": The server guild object where this command was ran.\")), mdx(\"h2\", null, \"Understanding How Inhibitors Function\"), mdx(\"p\", null, \"To block a command you have to return a truthy value.\"), mdx(\"ul\", null, mdx(\"li\", {\n parentName: \"ul\"\n }, mdx(\"strong\", {\n parentName: \"li\"\n }, \"return true;\"), \" If you return true the inhibitor will block the execution of the command.\\nTo allow a command return a falsey value.\"), mdx(\"li\", {\n parentName: \"ul\"\n }, mdx(\"strong\", {\n parentName: \"li\"\n }, \"return false;\"), \" If you return false the inhibitor will not block the error.\")), mdx(\"pre\", null, mdx(\"code\", _extends({\n parentName: \"pre\"\n }, {\n \"className\": \"language-ts\"\n }), \"// If the command is not VIP only we can allow this command to execute\\nif (!command.vipOnly) return false;\\n\\n// The bot's support server\\nconst guild = cache.guilds.get(configs.supportServerID)\\n// Check if the user has the vip role on the support server given by patreon\\nconst userIsVIP = await isUserVIP(message.author.id)\\n// The user is VIP so we can allow this command to be used\\nif (userIsVIP) return false;\\n\\n// The user is NOT VIP so we throw an error\\nthrow `The ${command.name} is only allowed for VIP users.`\\n\")));\n}\n;\nMDXContent.isMDXComponent = true;","rawMDXOutput":"/* @jsx mdx */\nimport { mdx } from '@mdx-js/react';\n/* @jsx mdx */\n\nexport const _frontmatter = {\n \"title\": \"Creating Inhibitors!\",\n \"metaTitle\": \"Creating An Inhibitor | Discordeno\",\n \"metaDescription\": \"Let's create our very own bot with Discordeno!\"\n};\n\nconst layoutProps = {\n _frontmatter\n};\nconst MDXLayout = \"wrapper\"\nexport default function MDXContent({\n components,\n ...props\n}) {\n return \n

{`Woah! You are almost half way done with understanding all of Discordeno. Amazing isn't it? Something you may have noticed in the last section was there were some options that prevented some commands from running like `}{`dmOnly`}{` or the permission options. we created a setting to prevent the monitor from running in certain channels. What if we wanted to do prevent commands from happening? How would we prevent commands from running?`}

\n

{`What is an Inhibitor?`}

\n

{`An Inhibitor is very similar to how monitors work. A monitor runs on every message but an inhibitor runs on every command. Remember all those command options like cooldown, permissions, permissionLevel, nsfw, etc... Each and every one of these options has an inhibitor in that checks commands for these settings.`}

\n

{`Let's create our own inhibitor that would prevent commands from being used if the user is not a VIP user.`}

\n
\n

{`Note:`}{` It is important to remember that everything below can be done with a simple permission level as well. We will create our own custom permission levels but for the purposes of this guide and to be able to learn about Inhibitors, we will be using an inhibitor.`}

\n
\n

{`Creating the File`}

\n

{`Let's start by creating a file inside the inhibitors folder called `}{`boosted.ts`}{` and paste the following snippet of code:`}

\n
{`import { botCache } from \"../../mod.ts\";\n\nbotCache.inhibitors.set(\"inhibitorname\", async function (message, command, guild) {\n    // Your code goes here\n});\n`}
\n

{`Inhibitors can take up to 3 arguments.`}

\n
    \n
  • {`message`}{`: The message object that triggered the command.`}
  • \n
  • {`command`}{`: The command object itself that was triggered.`}
  • \n
  • {`guild`}{`: The server guild object where this command was ran.`}
  • \n
\n

{`Understanding How Inhibitors Function`}

\n

{`To block a command you have to return a truthy value.`}

\n
    \n
  • {`return true;`}{` If you return true the inhibitor will block the execution of the command.\nTo allow a command return a falsey value.`}
  • \n
  • {`return false;`}{` If you return false the inhibitor will not block the error.`}
  • \n
\n
{`// If the command is not VIP only we can allow this command to execute\nif (!command.vipOnly) return false;\n\n// The bot's support server\nconst guild = cache.guilds.get(configs.supportServerID)\n// Check if the user has the vip role on the support server given by patreon\nconst userIsVIP = await isUserVIP(message.author.id)\n// The user is VIP so we can allow this command to be used\nif (userIsVIP) return false;\n\n// The user is NOT VIP so we throw an error\nthrow \\`The \\${command.name} is only allowed for VIP users.\\`\n`}
\n\n
;\n}\n\n;\nMDXContent.isMDXComponent = true;"}} \ No newline at end of file diff --git a/docs/.cache/caches/gatsby-plugin-mdx/diskstore-6ac9865e532d4c06cc6575a815a5cb87.json b/docs/.cache/caches/gatsby-plugin-mdx/diskstore-6ac9865e532d4c06cc6575a815a5cb87.json new file mode 100644 index 000000000..d327f1a63 --- /dev/null +++ b/docs/.cache/caches/gatsby-plugin-mdx/diskstore-6ac9865e532d4c06cc6575a815a5cb87.json @@ -0,0 +1 @@ +{"expireTime":9007200851633995000,"key":"gatsby-plugin-mdx-entire-payload-ae8cbf5dbaa09633334d7ed58d339ce1-","val":{"mdast":{"type":"root","children":[{"type":"paragraph","children":[{"type":"text","value":"Woah! You are almost half way done with understanding all of Discordeno. Amazing isn't it? Something you may have noticed in the last section was there were some options that prevented some commands from running like ","position":{"start":{"line":2,"column":1,"offset":1},"end":{"line":2,"column":218,"offset":218},"indent":[]}},{"type":"inlineCode","value":"dmOnly","position":{"start":{"line":2,"column":218,"offset":218},"end":{"line":2,"column":226,"offset":226},"indent":[]}},{"type":"text","value":" or the permission options. we created a setting to prevent the monitor from running in certain channels. What if we wanted to do prevent commands from happening? How would we prevent commands from running?","position":{"start":{"line":2,"column":226,"offset":226},"end":{"line":2,"column":432,"offset":432},"indent":[]}}],"position":{"start":{"line":2,"column":1,"offset":1},"end":{"line":2,"column":432,"offset":432},"indent":[]}},{"type":"heading","depth":2,"children":[{"type":"text","value":"What is an Inhibitor?","position":{"start":{"line":4,"column":4,"offset":437},"end":{"line":4,"column":25,"offset":458},"indent":[]}}],"position":{"start":{"line":4,"column":1,"offset":434},"end":{"line":4,"column":25,"offset":458},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"An Inhibitor is very similar to how monitors work. A monitor runs on every message but an inhibitor runs on every command. Remember all those command options like cooldown, permissions, permissionLevel, nsfw, etc... Each and every one of these options has an inhibitor in that checks commands for these settings.","position":{"start":{"line":6,"column":1,"offset":460},"end":{"line":6,"column":313,"offset":772},"indent":[]}}],"position":{"start":{"line":6,"column":1,"offset":460},"end":{"line":6,"column":313,"offset":772},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"Let's create our own inhibitor that would prevent commands from being used if the user is not a VIP user.","position":{"start":{"line":8,"column":1,"offset":774},"end":{"line":8,"column":106,"offset":879},"indent":[]}}],"position":{"start":{"line":8,"column":1,"offset":774},"end":{"line":8,"column":106,"offset":879},"indent":[]}},{"type":"blockquote","children":[{"type":"paragraph","children":[{"type":"strong","children":[{"type":"text","value":"Note:","position":{"start":{"line":10,"column":5,"offset":885},"end":{"line":10,"column":10,"offset":890},"indent":[]}}],"position":{"start":{"line":10,"column":3,"offset":883},"end":{"line":10,"column":12,"offset":892},"indent":[]}},{"type":"text","value":" It is important to remember that everything below can be done with a simple permission level as well. We will create our own custom permission levels but for the purposes of this guide and to be able to learn about Inhibitors, we will be using an inhibitor.","position":{"start":{"line":10,"column":12,"offset":892},"end":{"line":10,"column":270,"offset":1150},"indent":[]}}],"position":{"start":{"line":10,"column":3,"offset":883},"end":{"line":10,"column":270,"offset":1150},"indent":[]}}],"position":{"start":{"line":10,"column":1,"offset":881},"end":{"line":10,"column":270,"offset":1150},"indent":[]}},{"type":"heading","depth":2,"children":[{"type":"text","value":"Creating the File","position":{"start":{"line":12,"column":4,"offset":1155},"end":{"line":12,"column":21,"offset":1172},"indent":[]}}],"position":{"start":{"line":12,"column":1,"offset":1152},"end":{"line":12,"column":21,"offset":1172},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"Let's start by creating a file inside the inhibitors folder called ","position":{"start":{"line":14,"column":1,"offset":1174},"end":{"line":14,"column":68,"offset":1241},"indent":[]}},{"type":"inlineCode","value":"boosted.ts","position":{"start":{"line":14,"column":68,"offset":1241},"end":{"line":14,"column":80,"offset":1253},"indent":[]}},{"type":"text","value":" and paste the following snippet of code:","position":{"start":{"line":14,"column":80,"offset":1253},"end":{"line":14,"column":121,"offset":1294},"indent":[]}}],"position":{"start":{"line":14,"column":1,"offset":1174},"end":{"line":14,"column":121,"offset":1294},"indent":[]}},{"type":"code","lang":"ts","meta":null,"value":"import { botCache } from \"../../mod.ts\";\n\nbotCache.inhibitors.set(\"inhibitorname\", async function (message, command, guild) {\n\t// Your code goes here\n});","position":{"start":{"line":16,"column":1,"offset":1296},"end":{"line":22,"column":4,"offset":1459},"indent":[1,1,1,1,1,1]}},{"type":"paragraph","children":[{"type":"text","value":"Inhibitors can take up to 3 arguments.","position":{"start":{"line":24,"column":1,"offset":1461},"end":{"line":24,"column":39,"offset":1499},"indent":[]}}],"position":{"start":{"line":24,"column":1,"offset":1461},"end":{"line":24,"column":39,"offset":1499},"indent":[]}},{"type":"list","ordered":false,"start":null,"spread":false,"children":[{"type":"listItem","spread":false,"checked":null,"children":[{"type":"paragraph","children":[{"type":"inlineCode","value":"message","position":{"start":{"line":26,"column":3,"offset":1503},"end":{"line":26,"column":12,"offset":1512},"indent":[]}},{"type":"text","value":": The message object that triggered the command.","position":{"start":{"line":26,"column":12,"offset":1512},"end":{"line":26,"column":60,"offset":1560},"indent":[]}}],"position":{"start":{"line":26,"column":3,"offset":1503},"end":{"line":26,"column":60,"offset":1560},"indent":[]}}],"position":{"start":{"line":26,"column":1,"offset":1501},"end":{"line":26,"column":60,"offset":1560},"indent":[]}},{"type":"listItem","spread":false,"checked":null,"children":[{"type":"paragraph","children":[{"type":"inlineCode","value":"command","position":{"start":{"line":27,"column":3,"offset":1563},"end":{"line":27,"column":12,"offset":1572},"indent":[]}},{"type":"text","value":": The command object itself that was triggered.","position":{"start":{"line":27,"column":12,"offset":1572},"end":{"line":27,"column":59,"offset":1619},"indent":[]}}],"position":{"start":{"line":27,"column":3,"offset":1563},"end":{"line":27,"column":59,"offset":1619},"indent":[]}}],"position":{"start":{"line":27,"column":1,"offset":1561},"end":{"line":27,"column":59,"offset":1619},"indent":[]}},{"type":"listItem","spread":false,"checked":null,"children":[{"type":"paragraph","children":[{"type":"inlineCode","value":"guild","position":{"start":{"line":28,"column":3,"offset":1622},"end":{"line":28,"column":10,"offset":1629},"indent":[]}},{"type":"text","value":": The server guild object where this command was ran.","position":{"start":{"line":28,"column":10,"offset":1629},"end":{"line":28,"column":63,"offset":1682},"indent":[]}}],"position":{"start":{"line":28,"column":3,"offset":1622},"end":{"line":28,"column":63,"offset":1682},"indent":[]}}],"position":{"start":{"line":28,"column":1,"offset":1620},"end":{"line":28,"column":63,"offset":1682},"indent":[]}}],"position":{"start":{"line":26,"column":1,"offset":1501},"end":{"line":28,"column":63,"offset":1682},"indent":[1,1]}},{"type":"heading","depth":2,"children":[{"type":"text","value":"Understanding How Inhibitors Function","position":{"start":{"line":30,"column":4,"offset":1687},"end":{"line":30,"column":41,"offset":1724},"indent":[]}}],"position":{"start":{"line":30,"column":1,"offset":1684},"end":{"line":30,"column":41,"offset":1724},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"To block a command you have to return a truthy value.","position":{"start":{"line":32,"column":1,"offset":1726},"end":{"line":32,"column":54,"offset":1779},"indent":[]}}],"position":{"start":{"line":32,"column":1,"offset":1726},"end":{"line":32,"column":54,"offset":1779},"indent":[]}},{"type":"list","ordered":false,"start":null,"spread":false,"children":[{"type":"listItem","spread":false,"checked":null,"children":[{"type":"paragraph","children":[{"type":"strong","children":[{"type":"text","value":"return true;","position":{"start":{"line":33,"column":5,"offset":1784},"end":{"line":33,"column":17,"offset":1796},"indent":[]}}],"position":{"start":{"line":33,"column":3,"offset":1782},"end":{"line":33,"column":19,"offset":1798},"indent":[]}},{"type":"text","value":" If you return true the inhibitor will block the execution of the command.\nTo allow a command return a falsey value.","position":{"start":{"line":33,"column":19,"offset":1798},"end":{"line":34,"column":42,"offset":1914},"indent":[1]}}],"position":{"start":{"line":33,"column":3,"offset":1782},"end":{"line":34,"column":42,"offset":1914},"indent":[1]}}],"position":{"start":{"line":33,"column":1,"offset":1780},"end":{"line":34,"column":42,"offset":1914},"indent":[1]}},{"type":"listItem","spread":false,"checked":null,"children":[{"type":"paragraph","children":[{"type":"strong","children":[{"type":"text","value":"return false;","position":{"start":{"line":35,"column":5,"offset":1919},"end":{"line":35,"column":18,"offset":1932},"indent":[]}}],"position":{"start":{"line":35,"column":3,"offset":1917},"end":{"line":35,"column":20,"offset":1934},"indent":[]}},{"type":"text","value":" If you return false the inhibitor will not block the error.","position":{"start":{"line":35,"column":20,"offset":1934},"end":{"line":35,"column":80,"offset":1994},"indent":[]}}],"position":{"start":{"line":35,"column":3,"offset":1917},"end":{"line":35,"column":80,"offset":1994},"indent":[]}}],"position":{"start":{"line":35,"column":1,"offset":1915},"end":{"line":35,"column":80,"offset":1994},"indent":[]}}],"position":{"start":{"line":33,"column":1,"offset":1780},"end":{"line":35,"column":80,"offset":1994},"indent":[1,1]}},{"type":"code","lang":"ts","meta":null,"value":"// If the command is not VIP only we can allow this command to execute\nif (!command.vipOnly) return false;\n\n// Check if the user has boosted this server\nconst userIsVIP = await isUserVIP(message.author.id)\n// The user is VIP so we can allow this command to be used\nif (userIsVIP) return false;\n\n// The user is NOT VIP so we throw an error\nthrow `The ${command.name} is only allowed for VIP users.`","position":{"start":{"line":38,"column":1,"offset":1997},"end":{"line":49,"column":4,"offset":2404},"indent":[1,1,1,1,1,1,1,1,1,1,1]}},{"type":"export","value":"export const _frontmatter = {\"title\":\"Creating Inhibitors!\",\"metaTitle\":\"Creating An Inhibitor | Discordeno\",\"metaDescription\":\"Let's create our very own bot with Discordeno!\"}","position":{"start":{"line":52,"column":1,"offset":2407},"end":{"line":52,"column":177,"offset":2583},"indent":[]}}],"position":{"start":{"line":1,"column":1,"offset":0},"end":{"line":52,"column":177,"offset":2583}}},"scopeImports":["import * as React from 'react'"],"scopeIdentifiers":["React"],"body":"function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }\n\nfunction _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }\n\nfunction _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }\n\n/* @jsx mdx */\nvar _frontmatter = {\n \"title\": \"Creating Inhibitors!\",\n \"metaTitle\": \"Creating An Inhibitor | Discordeno\",\n \"metaDescription\": \"Let's create our very own bot with Discordeno!\"\n};\nvar layoutProps = {\n _frontmatter: _frontmatter\n};\nvar MDXLayout = \"wrapper\";\nreturn function MDXContent(_ref) {\n var components = _ref.components,\n props = _objectWithoutProperties(_ref, [\"components\"]);\n\n return mdx(MDXLayout, _extends({}, layoutProps, props, {\n components: components,\n mdxType: \"MDXLayout\"\n }), mdx(\"p\", null, \"Woah! You are almost half way done with understanding all of Discordeno. Amazing isn't it? Something you may have noticed in the last section was there were some options that prevented some commands from running like \", mdx(\"inlineCode\", {\n parentName: \"p\"\n }, \"dmOnly\"), \" or the permission options. we created a setting to prevent the monitor from running in certain channels. What if we wanted to do prevent commands from happening? How would we prevent commands from running?\"), mdx(\"h2\", null, \"What is an Inhibitor?\"), mdx(\"p\", null, \"An Inhibitor is very similar to how monitors work. A monitor runs on every message but an inhibitor runs on every command. Remember all those command options like cooldown, permissions, permissionLevel, nsfw, etc... Each and every one of these options has an inhibitor in that checks commands for these settings.\"), mdx(\"p\", null, \"Let's create our own inhibitor that would prevent commands from being used if the user is not a VIP user.\"), mdx(\"blockquote\", null, mdx(\"p\", {\n parentName: \"blockquote\"\n }, mdx(\"strong\", {\n parentName: \"p\"\n }, \"Note:\"), \" It is important to remember that everything below can be done with a simple permission level as well. We will create our own custom permission levels but for the purposes of this guide and to be able to learn about Inhibitors, we will be using an inhibitor.\")), mdx(\"h2\", null, \"Creating the File\"), mdx(\"p\", null, \"Let's start by creating a file inside the inhibitors folder called \", mdx(\"inlineCode\", {\n parentName: \"p\"\n }, \"boosted.ts\"), \" and paste the following snippet of code:\"), mdx(\"pre\", null, mdx(\"code\", _extends({\n parentName: \"pre\"\n }, {\n \"className\": \"language-ts\"\n }), \"import { botCache } from \\\"../../mod.ts\\\";\\n\\nbotCache.inhibitors.set(\\\"inhibitorname\\\", async function (message, command, guild) {\\n // Your code goes here\\n});\\n\")), mdx(\"p\", null, \"Inhibitors can take up to 3 arguments.\"), mdx(\"ul\", null, mdx(\"li\", {\n parentName: \"ul\"\n }, mdx(\"inlineCode\", {\n parentName: \"li\"\n }, \"message\"), \": The message object that triggered the command.\"), mdx(\"li\", {\n parentName: \"ul\"\n }, mdx(\"inlineCode\", {\n parentName: \"li\"\n }, \"command\"), \": The command object itself that was triggered.\"), mdx(\"li\", {\n parentName: \"ul\"\n }, mdx(\"inlineCode\", {\n parentName: \"li\"\n }, \"guild\"), \": The server guild object where this command was ran.\")), mdx(\"h2\", null, \"Understanding How Inhibitors Function\"), mdx(\"p\", null, \"To block a command you have to return a truthy value.\"), mdx(\"ul\", null, mdx(\"li\", {\n parentName: \"ul\"\n }, mdx(\"strong\", {\n parentName: \"li\"\n }, \"return true;\"), \" If you return true the inhibitor will block the execution of the command.\\nTo allow a command return a falsey value.\"), mdx(\"li\", {\n parentName: \"ul\"\n }, mdx(\"strong\", {\n parentName: \"li\"\n }, \"return false;\"), \" If you return false the inhibitor will not block the error.\")), mdx(\"pre\", null, mdx(\"code\", _extends({\n parentName: \"pre\"\n }, {\n \"className\": \"language-ts\"\n }), \"// If the command is not VIP only we can allow this command to execute\\nif (!command.vipOnly) return false;\\n\\n// Check if the user has boosted this server\\nconst userIsVIP = await isUserVIP(message.author.id)\\n// The user is VIP so we can allow this command to be used\\nif (userIsVIP) return false;\\n\\n// The user is NOT VIP so we throw an error\\nthrow `The ${command.name} is only allowed for VIP users.`\\n\")));\n}\n;\nMDXContent.isMDXComponent = true;","rawMDXOutput":"/* @jsx mdx */\nimport { mdx } from '@mdx-js/react';\n/* @jsx mdx */\n\nexport const _frontmatter = {\n \"title\": \"Creating Inhibitors!\",\n \"metaTitle\": \"Creating An Inhibitor | Discordeno\",\n \"metaDescription\": \"Let's create our very own bot with Discordeno!\"\n};\n\nconst layoutProps = {\n _frontmatter\n};\nconst MDXLayout = \"wrapper\"\nexport default function MDXContent({\n components,\n ...props\n}) {\n return \n

{`Woah! You are almost half way done with understanding all of Discordeno. Amazing isn't it? Something you may have noticed in the last section was there were some options that prevented some commands from running like `}{`dmOnly`}{` or the permission options. we created a setting to prevent the monitor from running in certain channels. What if we wanted to do prevent commands from happening? How would we prevent commands from running?`}

\n

{`What is an Inhibitor?`}

\n

{`An Inhibitor is very similar to how monitors work. A monitor runs on every message but an inhibitor runs on every command. Remember all those command options like cooldown, permissions, permissionLevel, nsfw, etc... Each and every one of these options has an inhibitor in that checks commands for these settings.`}

\n

{`Let's create our own inhibitor that would prevent commands from being used if the user is not a VIP user.`}

\n
\n

{`Note:`}{` It is important to remember that everything below can be done with a simple permission level as well. We will create our own custom permission levels but for the purposes of this guide and to be able to learn about Inhibitors, we will be using an inhibitor.`}

\n
\n

{`Creating the File`}

\n

{`Let's start by creating a file inside the inhibitors folder called `}{`boosted.ts`}{` and paste the following snippet of code:`}

\n
{`import { botCache } from \"../../mod.ts\";\n\nbotCache.inhibitors.set(\"inhibitorname\", async function (message, command, guild) {\n    // Your code goes here\n});\n`}
\n

{`Inhibitors can take up to 3 arguments.`}

\n
    \n
  • {`message`}{`: The message object that triggered the command.`}
  • \n
  • {`command`}{`: The command object itself that was triggered.`}
  • \n
  • {`guild`}{`: The server guild object where this command was ran.`}
  • \n
\n

{`Understanding How Inhibitors Function`}

\n

{`To block a command you have to return a truthy value.`}

\n
    \n
  • {`return true;`}{` If you return true the inhibitor will block the execution of the command.\nTo allow a command return a falsey value.`}
  • \n
  • {`return false;`}{` If you return false the inhibitor will not block the error.`}
  • \n
\n
{`// If the command is not VIP only we can allow this command to execute\nif (!command.vipOnly) return false;\n\n// Check if the user has boosted this server\nconst userIsVIP = await isUserVIP(message.author.id)\n// The user is VIP so we can allow this command to be used\nif (userIsVIP) return false;\n\n// The user is NOT VIP so we throw an error\nthrow \\`The \\${command.name} is only allowed for VIP users.\\`\n`}
\n\n
;\n}\n\n;\nMDXContent.isMDXComponent = true;"}} \ No newline at end of file diff --git a/docs/.cache/caches/gatsby-plugin-mdx/diskstore-6c4d5c3f58a54075704406c9152c8629.json b/docs/.cache/caches/gatsby-plugin-mdx/diskstore-6c4d5c3f58a54075704406c9152c8629.json new file mode 100644 index 000000000..0f33d2627 --- /dev/null +++ b/docs/.cache/caches/gatsby-plugin-mdx/diskstore-6c4d5c3f58a54075704406c9152c8629.json @@ -0,0 +1 @@ +{"expireTime":9007200851644257000,"key":"gatsby-plugin-mdx-entire-payload-63277e875a75d7240d42ab9afaa5193d-","val":{"mdast":{"type":"root","children":[{"type":"paragraph","children":[{"type":"text","value":"Discordeno will help make Discord bot development much easier. Don't worry, as you go through this guide it will make a lot more sense.","position":{"start":{"line":2,"column":1,"offset":1},"end":{"line":2,"column":136,"offset":136},"indent":[]}}],"position":{"start":{"line":2,"column":1,"offset":1},"end":{"line":2,"column":136,"offset":136},"indent":[]}},{"type":"heading","depth":2,"children":[{"type":"text","value":"Creating The Bot!","position":{"start":{"line":4,"column":4,"offset":141},"end":{"line":4,"column":21,"offset":158},"indent":[]}}],"position":{"start":{"line":4,"column":1,"offset":138},"end":{"line":4,"column":21,"offset":158},"indent":[]}},{"type":"blockquote","children":[{"type":"paragraph","children":[{"type":"text","value":"This guide is going to assume you already have the basic requirements to make a bot ready. This includes github, git, a code editor like Visual Studio Code. If you don't have these yet please prepare them first before going forward.","position":{"start":{"line":6,"column":3,"offset":162},"end":{"line":6,"column":235,"offset":394},"indent":[]}}],"position":{"start":{"line":6,"column":3,"offset":162},"end":{"line":6,"column":235,"offset":394},"indent":[]}}],"position":{"start":{"line":6,"column":1,"offset":160},"end":{"line":6,"column":235,"offset":394},"indent":[]}},{"type":"list","ordered":false,"start":null,"spread":true,"children":[{"type":"listItem","spread":false,"checked":null,"children":[{"type":"paragraph","children":[{"type":"text","value":"First, create a Discordeno Bot using the ","position":{"start":{"line":8,"column":3,"offset":398},"end":{"line":8,"column":44,"offset":439},"indent":[]}},{"type":"link","title":null,"url":"https://github.com/Skillz4Killz/Discordeno-bot-template","children":[{"type":"text","value":"Generator Boilerplate","position":{"start":{"line":8,"column":45,"offset":440},"end":{"line":8,"column":66,"offset":461},"indent":[]}}],"position":{"start":{"line":8,"column":44,"offset":439},"end":{"line":8,"column":124,"offset":519},"indent":[]}},{"type":"text","value":". Give it any name you like. For the purpose of this guide we will call it, Stargate.","position":{"start":{"line":8,"column":124,"offset":519},"end":{"line":8,"column":209,"offset":604},"indent":[]}}],"position":{"start":{"line":8,"column":3,"offset":398},"end":{"line":8,"column":209,"offset":604},"indent":[]}}],"position":{"start":{"line":8,"column":1,"offset":396},"end":{"line":9,"column":1,"offset":605},"indent":[1]}},{"type":"listItem","spread":false,"checked":null,"children":[{"type":"paragraph","children":[{"type":"text","value":"Then ","position":{"start":{"line":10,"column":3,"offset":608},"end":{"line":10,"column":8,"offset":613},"indent":[]}},{"type":"inlineCode","value":"git clone https://github.com/Skillz4Killz/Stargate.git","position":{"start":{"line":10,"column":8,"offset":613},"end":{"line":10,"column":64,"offset":669},"indent":[]}}],"position":{"start":{"line":10,"column":3,"offset":608},"end":{"line":10,"column":64,"offset":669},"indent":[]}}],"position":{"start":{"line":10,"column":1,"offset":606},"end":{"line":11,"column":1,"offset":670},"indent":[1]}},{"type":"listItem","spread":false,"checked":null,"children":[{"type":"paragraph","children":[{"type":"text","value":"When that is done, go ahead and open up the folder with VSC.","position":{"start":{"line":12,"column":3,"offset":673},"end":{"line":12,"column":63,"offset":733},"indent":[]}}],"position":{"start":{"line":12,"column":3,"offset":673},"end":{"line":12,"column":63,"offset":733},"indent":[]}}],"position":{"start":{"line":12,"column":1,"offset":671},"end":{"line":12,"column":63,"offset":733},"indent":[]}},{"type":"listItem","spread":false,"checked":null,"children":[{"type":"paragraph","children":[{"type":"text","value":"Create a new file called ","position":{"start":{"line":13,"column":3,"offset":736},"end":{"line":13,"column":28,"offset":761},"indent":[]}},{"type":"inlineCode","value":"configs.ts","position":{"start":{"line":13,"column":28,"offset":761},"end":{"line":13,"column":40,"offset":773},"indent":[]}},{"type":"text","value":". Open the ","position":{"start":{"line":13,"column":40,"offset":773},"end":{"line":13,"column":51,"offset":784},"indent":[]}},{"type":"inlineCode","value":"configs.example.ts","position":{"start":{"line":13,"column":51,"offset":784},"end":{"line":13,"column":71,"offset":804},"indent":[]}},{"type":"text","value":" file and copy everything over.","position":{"start":{"line":13,"column":71,"offset":804},"end":{"line":13,"column":102,"offset":835},"indent":[]}}],"position":{"start":{"line":13,"column":3,"offset":736},"end":{"line":13,"column":102,"offset":835},"indent":[]}}],"position":{"start":{"line":13,"column":1,"offset":734},"end":{"line":13,"column":102,"offset":835},"indent":[]}}],"position":{"start":{"line":8,"column":1,"offset":396},"end":{"line":13,"column":102,"offset":835},"indent":[1,1,1,1,1]}},{"type":"paragraph","children":[{"type":"text","value":"Let's take a minute to review all the options we have available to us.","position":{"start":{"line":15,"column":1,"offset":837},"end":{"line":15,"column":71,"offset":907},"indent":[]}}],"position":{"start":{"line":15,"column":1,"offset":837},"end":{"line":15,"column":71,"offset":907},"indent":[]}},{"type":"heading","depth":3,"children":[{"type":"text","value":"Configs File","position":{"start":{"line":17,"column":5,"offset":913},"end":{"line":17,"column":17,"offset":925},"indent":[]}}],"position":{"start":{"line":17,"column":1,"offset":909},"end":{"line":17,"column":17,"offset":925},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"The ","position":{"start":{"line":19,"column":1,"offset":927},"end":{"line":19,"column":5,"offset":931},"indent":[]}},{"type":"inlineCode","value":"configs.ts","position":{"start":{"line":19,"column":5,"offset":931},"end":{"line":19,"column":17,"offset":943},"indent":[]}},{"type":"text","value":" file is where you will keep all your secret info you don't want to share with anyone else. As long as ","position":{"start":{"line":19,"column":17,"offset":943},"end":{"line":19,"column":120,"offset":1046},"indent":[]}},{"type":"inlineCode","value":".gitignore","position":{"start":{"line":19,"column":120,"offset":1046},"end":{"line":19,"column":132,"offset":1058},"indent":[]}},{"type":"text","value":" file is ignoring configs.ts your configurations will be kept private!","position":{"start":{"line":19,"column":132,"offset":1058},"end":{"line":19,"column":202,"offset":1128},"indent":[]}}],"position":{"start":{"line":19,"column":1,"offset":927},"end":{"line":19,"column":202,"offset":1128},"indent":[]}},{"type":"code","lang":"ts","meta":null,"value":"// Step 1: Remove the `.example` from this file name so it is called `configs.ts`\n// Step 2: Add all your bot's information below. The only required one is token and prefix. NOTE: As long as `.gitignore` file is ignoring configs.ts your configurations will be kept private!\n// Step 3: Remove these comments if you like.\n\nexport const configs = {\n // Your bot token goes here\n token: \"\",\n // The default prefix for your bot. Don't worry guilds can change this later.\n prefix: \"!\",\n // This isn't required but you can add bot list api keys here.\n botListTokens: {\n DISCORD_BOT_ORG: \"\",\n BOTS_ON_DISCORD: \"\",\n DISCORD_BOT_LIST: \"\",\n BOTS_FOR_DISCORD: \"\",\n DISCORD_BOATS: \"\",\n DISCORD_BOTS_GG: \"\",\n DISCORD_BOTS_GROUP: \"\",\n },\n // This is the server id for your bot's main server where users can get help/support\n supportServerID: \"\",\n // These are channel ids that will enable some functionality\n channelIDs: {\n // When a translation is missing this is the channel you will be alerted in.\n missingTranslation: \"\",\n // When an error occurs, we will try and log it to this channel\n errorChannelID: \"\"\n },\n // These are the role ids that will enable some functionality.\n roleIDs: {\n // If you have a patreon set up you can add the patreon vip role id here.\n patreonVIPRoleID: \"\",\n },\n // These are the user ids that will enable some functionality.\n userIDs: {\n // The user ids for the support team\n botSupporters: [],\n // The user ids for the other devs on your team\n botDevs: [],\n // The user ids who have complete 100% access to your bot\n botOwners: []\n }\n};\n","position":{"start":{"line":21,"column":1,"offset":1130},"end":{"line":66,"column":4,"offset":2770},"indent":[1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1]}},{"type":"heading","depth":4,"children":[{"type":"text","value":"Token","position":{"start":{"line":68,"column":6,"offset":2777},"end":{"line":68,"column":11,"offset":2782},"indent":[]}}],"position":{"start":{"line":68,"column":1,"offset":2772},"end":{"line":68,"column":11,"offset":2782},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"First, add your bot token. This is ","position":{"start":{"line":70,"column":1,"offset":2784},"end":{"line":70,"column":36,"offset":2819},"indent":[]}},{"type":"strong","children":[{"type":"text","value":"required","position":{"start":{"line":70,"column":38,"offset":2821},"end":{"line":70,"column":46,"offset":2829},"indent":[]}}],"position":{"start":{"line":70,"column":36,"offset":2819},"end":{"line":70,"column":48,"offset":2831},"indent":[]}},{"type":"text","value":" for the bot to start. Review the ","position":{"start":{"line":70,"column":48,"offset":2831},"end":{"line":70,"column":82,"offset":2865},"indent":[]}},{"type":"link","title":null,"url":"https://discordeno.netlify.app/gettingstarted#creatingyourfirstdiscordbotapplication","children":[{"type":"text","value":"instructions","position":{"start":{"line":70,"column":83,"offset":2866},"end":{"line":70,"column":95,"offset":2878},"indent":[]}}],"position":{"start":{"line":70,"column":82,"offset":2865},"end":{"line":70,"column":182,"offset":2965},"indent":[]}},{"type":"text","value":" if you have not made your token yet.","position":{"start":{"line":70,"column":182,"offset":2965},"end":{"line":70,"column":219,"offset":3002},"indent":[]}}],"position":{"start":{"line":70,"column":1,"offset":2784},"end":{"line":70,"column":219,"offset":3002},"indent":[]}},{"type":"heading","depth":4,"children":[{"type":"text","value":"Prefix","position":{"start":{"line":72,"column":6,"offset":3009},"end":{"line":72,"column":12,"offset":3015},"indent":[]}}],"position":{"start":{"line":72,"column":1,"offset":3004},"end":{"line":72,"column":12,"offset":3015},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"The prefix is where you will set the default prefix for your bot. Don't worry, every server will be able to choose their own prefix but we need a default prefix to start.","position":{"start":{"line":74,"column":1,"offset":3017},"end":{"line":74,"column":171,"offset":3187},"indent":[]}}],"position":{"start":{"line":74,"column":1,"offset":3017},"end":{"line":74,"column":171,"offset":3187},"indent":[]}},{"type":"heading","depth":4,"children":[{"type":"text","value":"Bot Lists Tokens","position":{"start":{"line":76,"column":6,"offset":3194},"end":{"line":76,"column":22,"offset":3210},"indent":[]}}],"position":{"start":{"line":76,"column":1,"offset":3189},"end":{"line":76,"column":22,"offset":3210},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"This section of the file is so you can easily have your bot's statistics updated on all the bot lists out there to help you grow your bot. The code is already written to handle this but you will need to do 3 things for each bot list.","position":{"start":{"line":78,"column":1,"offset":3212},"end":{"line":78,"column":234,"offset":3445},"indent":[]}}],"position":{"start":{"line":78,"column":1,"offset":3212},"end":{"line":78,"column":234,"offset":3445},"indent":[]}},{"type":"list","ordered":true,"start":1,"spread":false,"children":[{"type":"listItem","spread":false,"checked":null,"children":[{"type":"paragraph","children":[{"type":"text","value":"Go to the bot list and add your bot to their website. (Each site has it's own instructions)","position":{"start":{"line":80,"column":4,"offset":3450},"end":{"line":80,"column":95,"offset":3541},"indent":[]}}],"position":{"start":{"line":80,"column":4,"offset":3450},"end":{"line":80,"column":95,"offset":3541},"indent":[]}}],"position":{"start":{"line":80,"column":1,"offset":3447},"end":{"line":80,"column":95,"offset":3541},"indent":[]}},{"type":"listItem","spread":false,"checked":null,"children":[{"type":"paragraph","children":[{"type":"text","value":"Create a token for yourself on each website and paste it in your configs.","position":{"start":{"line":81,"column":4,"offset":3545},"end":{"line":81,"column":77,"offset":3618},"indent":[]}}],"position":{"start":{"line":81,"column":4,"offset":3545},"end":{"line":81,"column":77,"offset":3618},"indent":[]}}],"position":{"start":{"line":81,"column":1,"offset":3542},"end":{"line":81,"column":77,"offset":3618},"indent":[]}},{"type":"listItem","spread":false,"checked":null,"children":[{"type":"paragraph","children":[{"type":"text","value":"Enjoy!","position":{"start":{"line":82,"column":4,"offset":3622},"end":{"line":82,"column":10,"offset":3628},"indent":[]}}],"position":{"start":{"line":82,"column":4,"offset":3622},"end":{"line":82,"column":10,"offset":3628},"indent":[]}}],"position":{"start":{"line":82,"column":1,"offset":3619},"end":{"line":82,"column":10,"offset":3628},"indent":[]}}],"position":{"start":{"line":80,"column":1,"offset":3447},"end":{"line":82,"column":10,"offset":3628},"indent":[1,1]}},{"type":"paragraph","children":[{"type":"text","value":"If you wish to customize the code, you will find the bot list tasks in the tasks folder. Don't worry we will discuss this when we get to the tasks section of the guide.","position":{"start":{"line":84,"column":1,"offset":3630},"end":{"line":84,"column":169,"offset":3798},"indent":[]}}],"position":{"start":{"line":84,"column":1,"offset":3630},"end":{"line":84,"column":169,"offset":3798},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"For now just remember, that Discordeno provides you a built in way to update most discord bot lists.","position":{"start":{"line":86,"column":1,"offset":3800},"end":{"line":86,"column":101,"offset":3900},"indent":[]}}],"position":{"start":{"line":86,"column":1,"offset":3800},"end":{"line":86,"column":101,"offset":3900},"indent":[]}},{"type":"heading","depth":4,"children":[{"type":"text","value":"Channel IDs","position":{"start":{"line":88,"column":6,"offset":3907},"end":{"line":88,"column":17,"offset":3918},"indent":[]}}],"position":{"start":{"line":88,"column":1,"offset":3902},"end":{"line":88,"column":17,"offset":3918},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"The channelIDs section holds the channel IDs that are useful for specific features to help give you alerts/notifications. For example, the ","position":{"start":{"line":90,"column":1,"offset":3920},"end":{"line":90,"column":140,"offset":4059},"indent":[]}},{"type":"inlineCode","value":"missingTranslation","position":{"start":{"line":90,"column":140,"offset":4059},"end":{"line":90,"column":160,"offset":4079},"indent":[]}},{"type":"text","value":" channel will be where messages are sent alerting you that somewhere in your code you are trying to use a translation key that you never created.","position":{"start":{"line":90,"column":160,"offset":4079},"end":{"line":90,"column":305,"offset":4224},"indent":[]}}],"position":{"start":{"line":90,"column":1,"offset":3920},"end":{"line":90,"column":305,"offset":4224},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"When you get to around 25,000 Discord servers on your bot, you may want to convert these channel IDs to webhooks.","position":{"start":{"line":92,"column":1,"offset":4226},"end":{"line":92,"column":114,"offset":4339},"indent":[]}}],"position":{"start":{"line":92,"column":1,"offset":4226},"end":{"line":92,"column":114,"offset":4339},"indent":[]}},{"type":"heading","depth":4,"children":[{"type":"text","value":"Role IDs","position":{"start":{"line":94,"column":6,"offset":4346},"end":{"line":94,"column":14,"offset":4354},"indent":[]}}],"position":{"start":{"line":94,"column":1,"offset":4341},"end":{"line":94,"column":14,"offset":4354},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"The roleIDs section holds the role IDs that are useful for specific features. For example, the ","position":{"start":{"line":96,"column":1,"offset":4356},"end":{"line":96,"column":96,"offset":4451},"indent":[]}},{"type":"inlineCode","value":"patreonVIPRoleID","position":{"start":{"line":96,"column":96,"offset":4451},"end":{"line":96,"column":114,"offset":4469},"indent":[]}},{"type":"text","value":" role can be used easily to enable vip features later in this guide.","position":{"start":{"line":96,"column":114,"offset":4469},"end":{"line":96,"column":182,"offset":4537},"indent":[]}}],"position":{"start":{"line":96,"column":1,"offset":4356},"end":{"line":96,"column":182,"offset":4537},"indent":[]}},{"type":"heading","depth":4,"children":[{"type":"text","value":"User IDs","position":{"start":{"line":98,"column":6,"offset":4544},"end":{"line":98,"column":14,"offset":4552},"indent":[]}}],"position":{"start":{"line":98,"column":1,"offset":4539},"end":{"line":98,"column":14,"offset":4552},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"The userIDs section holds the channel IDs that are useful for specific features to help give you alerts/notifications. For example, the ","position":{"start":{"line":100,"column":1,"offset":4554},"end":{"line":100,"column":137,"offset":4690},"indent":[]}},{"type":"inlineCode","value":"missingTranslation","position":{"start":{"line":100,"column":137,"offset":4690},"end":{"line":100,"column":157,"offset":4710},"indent":[]}},{"type":"text","value":" channel will be where messages are sent alerting you that somewhere in your code you are trying to use a translation key that you never created.","position":{"start":{"line":100,"column":157,"offset":4710},"end":{"line":100,"column":302,"offset":4855},"indent":[]}}],"position":{"start":{"line":100,"column":1,"offset":4554},"end":{"line":100,"column":302,"offset":4855},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"When you get to around 25,000 Discord servers on your bot, you may want to convert these channel IDs to webhooks.","position":{"start":{"line":102,"column":1,"offset":4857},"end":{"line":102,"column":114,"offset":4970},"indent":[]}}],"position":{"start":{"line":102,"column":1,"offset":4857},"end":{"line":102,"column":114,"offset":4970},"indent":[]}},{"type":"heading","depth":2,"children":[{"type":"text","value":"It's Alive!","position":{"start":{"line":104,"column":4,"offset":4975},"end":{"line":104,"column":15,"offset":4986},"indent":[]}}],"position":{"start":{"line":104,"column":1,"offset":4972},"end":{"line":104,"column":15,"offset":4986},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"Oh my god! You now have a bot with a bunch of features already! You don't believe me? Well, seeing is believing, so start the bot.","position":{"start":{"line":106,"column":1,"offset":4988},"end":{"line":106,"column":131,"offset":5118},"indent":[]}}],"position":{"start":{"line":106,"column":1,"offset":4988},"end":{"line":106,"column":131,"offset":5118},"indent":[]}},{"type":"list","ordered":true,"start":1,"spread":false,"children":[{"type":"listItem","spread":false,"checked":null,"children":[{"type":"paragraph","children":[{"type":"text","value":"Invite your bot to a discord server.","position":{"start":{"line":108,"column":4,"offset":5123},"end":{"line":108,"column":40,"offset":5159},"indent":[]}}],"position":{"start":{"line":108,"column":4,"offset":5123},"end":{"line":108,"column":40,"offset":5159},"indent":[]}}],"position":{"start":{"line":108,"column":1,"offset":5120},"end":{"line":108,"column":40,"offset":5159},"indent":[]}},{"type":"listItem","spread":false,"checked":null,"children":[{"type":"paragraph","children":[{"type":"text","value":"Open up the integrated terminal in VSC using ","position":{"start":{"line":109,"column":4,"offset":5163},"end":{"line":109,"column":49,"offset":5208},"indent":[]}},{"type":"strong","children":[{"type":"text","value":"CTRL + `","position":{"start":{"line":109,"column":51,"offset":5210},"end":{"line":109,"column":59,"offset":5218},"indent":[]}}],"position":{"start":{"line":109,"column":49,"offset":5208},"end":{"line":109,"column":61,"offset":5220},"indent":[]}},{"type":"text","value":". If you use a Mac, replace CTRL with CMD.","position":{"start":{"line":109,"column":61,"offset":5220},"end":{"line":109,"column":103,"offset":5262},"indent":[]}}],"position":{"start":{"line":109,"column":4,"offset":5163},"end":{"line":109,"column":103,"offset":5262},"indent":[]}}],"position":{"start":{"line":109,"column":1,"offset":5160},"end":{"line":109,"column":103,"offset":5262},"indent":[]}},{"type":"listItem","spread":false,"checked":null,"children":[{"type":"paragraph","children":[{"type":"text","value":"Run the script below:","position":{"start":{"line":110,"column":4,"offset":5266},"end":{"line":110,"column":25,"offset":5287},"indent":[]}}],"position":{"start":{"line":110,"column":4,"offset":5266},"end":{"line":110,"column":25,"offset":5287},"indent":[]}}],"position":{"start":{"line":110,"column":1,"offset":5263},"end":{"line":110,"column":25,"offset":5287},"indent":[]}}],"position":{"start":{"line":108,"column":1,"offset":5120},"end":{"line":110,"column":25,"offset":5287},"indent":[1,1]}},{"type":"code","lang":"shell","meta":null,"value":"deno run --allow-net --allow-read mod.ts","position":{"start":{"line":112,"column":1,"offset":5289},"end":{"line":114,"column":4,"offset":5342},"indent":[1,1]}},{"type":"paragraph","children":[{"type":"text","value":"The first time you run it, you may see a lot of files being loaded. This is preparing all the magic behind the scene. Once it is ready, you will see something like this:","position":{"start":{"line":116,"column":1,"offset":5344},"end":{"line":116,"column":170,"offset":5513},"indent":[]}}],"position":{"start":{"line":116,"column":1,"offset":5344},"end":{"line":116,"column":170,"offset":5513},"indent":[]}},{"type":"paragraph","children":[{"type":"image","title":null,"url":"https://i.imgur.com/TOXjLgh.png","alt":"image","position":{"start":{"line":118,"column":1,"offset":5515},"end":{"line":118,"column":42,"offset":5556},"indent":[]}}],"position":{"start":{"line":118,"column":1,"offset":5515},"end":{"line":118,"column":42,"offset":5556},"indent":[]}},{"type":"heading","depth":2,"children":[{"type":"text","value":"Understanding What Discordeno Did","position":{"start":{"line":120,"column":4,"offset":5561},"end":{"line":120,"column":37,"offset":5594},"indent":[]}}],"position":{"start":{"line":120,"column":1,"offset":5558},"end":{"line":120,"column":37,"offset":5594},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"Discordeno includes these commands/folders as they are essential for any discord bot to have in order to meet the Discord Bot Best Practices. It also adds a few things that will help make some things easier to build a bot.","position":{"start":{"line":122,"column":1,"offset":5596},"end":{"line":122,"column":223,"offset":5818},"indent":[]}}],"position":{"start":{"line":122,"column":1,"offset":5596},"end":{"line":122,"column":223,"offset":5818},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"We will dive into these deeper in this guide. Let's take it step by step.","position":{"start":{"line":124,"column":1,"offset":5820},"end":{"line":124,"column":74,"offset":5893},"indent":[]}}],"position":{"start":{"line":124,"column":1,"offset":5820},"end":{"line":124,"column":74,"offset":5893},"indent":[]}},{"type":"export","value":"export const _frontmatter = {\"title\":\"Creating The Bot!\",\"metaTitle\":\"Creating A Bot | Discordeno\",\"metaDescription\":\"Let's create our very own bot with Discordeno!\"}","position":{"start":{"line":127,"column":1,"offset":5896},"end":{"line":127,"column":167,"offset":6062},"indent":[]}}],"position":{"start":{"line":1,"column":1,"offset":0},"end":{"line":127,"column":167,"offset":6062}}},"scopeImports":["import * as React from 'react'"],"scopeIdentifiers":["React"],"body":"function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }\n\nfunction _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }\n\nfunction _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }\n\n/* @jsx mdx */\nvar _frontmatter = {\n \"title\": \"Creating The Bot!\",\n \"metaTitle\": \"Creating A Bot | Discordeno\",\n \"metaDescription\": \"Let's create our very own bot with Discordeno!\"\n};\nvar layoutProps = {\n _frontmatter: _frontmatter\n};\nvar MDXLayout = \"wrapper\";\nreturn function MDXContent(_ref) {\n var components = _ref.components,\n props = _objectWithoutProperties(_ref, [\"components\"]);\n\n return mdx(MDXLayout, _extends({}, layoutProps, props, {\n components: components,\n mdxType: \"MDXLayout\"\n }), mdx(\"p\", null, \"Discordeno will help make Discord bot development much easier. Don't worry, as you go through this guide it will make a lot more sense.\"), mdx(\"h2\", null, \"Creating The Bot!\"), mdx(\"blockquote\", null, mdx(\"p\", {\n parentName: \"blockquote\"\n }, \"This guide is going to assume you already have the basic requirements to make a bot ready. This includes github, git, a code editor like Visual Studio Code. If you don't have these yet please prepare them first before going forward.\")), mdx(\"ul\", null, mdx(\"li\", {\n parentName: \"ul\"\n }, mdx(\"p\", {\n parentName: \"li\"\n }, \"First, create a Discordeno Bot using the \", mdx(\"a\", _extends({\n parentName: \"p\"\n }, {\n \"href\": \"https://github.com/Skillz4Killz/Discordeno-bot-template\"\n }), \"Generator Boilerplate\"), \". Give it any name you like. For the purpose of this guide we will call it, Stargate.\")), mdx(\"li\", {\n parentName: \"ul\"\n }, mdx(\"p\", {\n parentName: \"li\"\n }, \"Then \", mdx(\"inlineCode\", {\n parentName: \"p\"\n }, \"git clone https://github.com/Skillz4Killz/Stargate.git\"))), mdx(\"li\", {\n parentName: \"ul\"\n }, mdx(\"p\", {\n parentName: \"li\"\n }, \"When that is done, go ahead and open up the folder with VSC.\")), mdx(\"li\", {\n parentName: \"ul\"\n }, mdx(\"p\", {\n parentName: \"li\"\n }, \"Create a new file called \", mdx(\"inlineCode\", {\n parentName: \"p\"\n }, \"configs.ts\"), \". Open the \", mdx(\"inlineCode\", {\n parentName: \"p\"\n }, \"configs.example.ts\"), \" file and copy everything over.\"))), mdx(\"p\", null, \"Let's take a minute to review all the options we have available to us.\"), mdx(\"h3\", null, \"Configs File\"), mdx(\"p\", null, \"The \", mdx(\"inlineCode\", {\n parentName: \"p\"\n }, \"configs.ts\"), \" file is where you will keep all your secret info you don't want to share with anyone else. As long as \", mdx(\"inlineCode\", {\n parentName: \"p\"\n }, \".gitignore\"), \" file is ignoring configs.ts your configurations will be kept private!\"), mdx(\"pre\", null, mdx(\"code\", _extends({\n parentName: \"pre\"\n }, {\n \"className\": \"language-ts\"\n }), \"// Step 1: Remove the `.example` from this file name so it is called `configs.ts`\\n// Step 2: Add all your bot's information below. The only required one is token and prefix. NOTE: As long as `.gitignore` file is ignoring configs.ts your configurations will be kept private!\\n// Step 3: Remove these comments if you like.\\n\\nexport const configs = {\\n // Your bot token goes here\\n token: \\\"\\\",\\n // The default prefix for your bot. Don't worry guilds can change this later.\\n prefix: \\\"!\\\",\\n // This isn't required but you can add bot list api keys here.\\n botListTokens: {\\n DISCORD_BOT_ORG: \\\"\\\",\\n BOTS_ON_DISCORD: \\\"\\\",\\n DISCORD_BOT_LIST: \\\"\\\",\\n BOTS_FOR_DISCORD: \\\"\\\",\\n DISCORD_BOATS: \\\"\\\",\\n DISCORD_BOTS_GG: \\\"\\\",\\n DISCORD_BOTS_GROUP: \\\"\\\",\\n },\\n // This is the server id for your bot's main server where users can get help/support\\n supportServerID: \\\"\\\",\\n // These are channel ids that will enable some functionality\\n channelIDs: {\\n // When a translation is missing this is the channel you will be alerted in.\\n missingTranslation: \\\"\\\",\\n // When an error occurs, we will try and log it to this channel\\n errorChannelID: \\\"\\\"\\n },\\n // These are the role ids that will enable some functionality.\\n roleIDs: {\\n // If you have a patreon set up you can add the patreon vip role id here.\\n patreonVIPRoleID: \\\"\\\",\\n },\\n // These are the user ids that will enable some functionality.\\n userIDs: {\\n // The user ids for the support team\\n botSupporters: [],\\n // The user ids for the other devs on your team\\n botDevs: [],\\n // The user ids who have complete 100% access to your bot\\n botOwners: []\\n }\\n};\\n\\n\")), mdx(\"h4\", null, \"Token\"), mdx(\"p\", null, \"First, add your bot token. This is \", mdx(\"strong\", {\n parentName: \"p\"\n }, \"required\"), \" for the bot to start. Review the \", mdx(\"a\", _extends({\n parentName: \"p\"\n }, {\n \"href\": \"https://discordeno.netlify.app/gettingstarted#creatingyourfirstdiscordbotapplication\"\n }), \"instructions\"), \" if you have not made your token yet.\"), mdx(\"h4\", null, \"Prefix\"), mdx(\"p\", null, \"The prefix is where you will set the default prefix for your bot. Don't worry, every server will be able to choose their own prefix but we need a default prefix to start.\"), mdx(\"h4\", null, \"Bot Lists Tokens\"), mdx(\"p\", null, \"This section of the file is so you can easily have your bot's statistics updated on all the bot lists out there to help you grow your bot. The code is already written to handle this but you will need to do 3 things for each bot list.\"), mdx(\"ol\", null, mdx(\"li\", {\n parentName: \"ol\"\n }, \"Go to the bot list and add your bot to their website. (Each site has it's own instructions)\"), mdx(\"li\", {\n parentName: \"ol\"\n }, \"Create a token for yourself on each website and paste it in your configs.\"), mdx(\"li\", {\n parentName: \"ol\"\n }, \"Enjoy!\")), mdx(\"p\", null, \"If you wish to customize the code, you will find the bot list tasks in the tasks folder. Don't worry we will discuss this when we get to the tasks section of the guide.\"), mdx(\"p\", null, \"For now just remember, that Discordeno provides you a built in way to update most discord bot lists.\"), mdx(\"h4\", null, \"Channel IDs\"), mdx(\"p\", null, \"The channelIDs section holds the channel IDs that are useful for specific features to help give you alerts/notifications. For example, the \", mdx(\"inlineCode\", {\n parentName: \"p\"\n }, \"missingTranslation\"), \" channel will be where messages are sent alerting you that somewhere in your code you are trying to use a translation key that you never created.\"), mdx(\"p\", null, \"When you get to around 25,000 Discord servers on your bot, you may want to convert these channel IDs to webhooks.\"), mdx(\"h4\", null, \"Role IDs\"), mdx(\"p\", null, \"The roleIDs section holds the role IDs that are useful for specific features. For example, the \", mdx(\"inlineCode\", {\n parentName: \"p\"\n }, \"patreonVIPRoleID\"), \" role can be used easily to enable vip features later in this guide.\"), mdx(\"h4\", null, \"User IDs\"), mdx(\"p\", null, \"The userIDs section holds the channel IDs that are useful for specific features to help give you alerts/notifications. For example, the \", mdx(\"inlineCode\", {\n parentName: \"p\"\n }, \"missingTranslation\"), \" channel will be where messages are sent alerting you that somewhere in your code you are trying to use a translation key that you never created.\"), mdx(\"p\", null, \"When you get to around 25,000 Discord servers on your bot, you may want to convert these channel IDs to webhooks.\"), mdx(\"h2\", null, \"It's Alive!\"), mdx(\"p\", null, \"Oh my god! You now have a bot with a bunch of features already! You don't believe me? Well, seeing is believing, so start the bot.\"), mdx(\"ol\", null, mdx(\"li\", {\n parentName: \"ol\"\n }, \"Invite your bot to a discord server.\"), mdx(\"li\", {\n parentName: \"ol\"\n }, \"Open up the integrated terminal in VSC using \", mdx(\"strong\", {\n parentName: \"li\"\n }, \"CTRL + `\"), \". If you use a Mac, replace CTRL with CMD.\"), mdx(\"li\", {\n parentName: \"ol\"\n }, \"Run the script below:\")), mdx(\"pre\", null, mdx(\"code\", _extends({\n parentName: \"pre\"\n }, {\n \"className\": \"language-shell\"\n }), \"deno run --allow-net --allow-read mod.ts\\n\")), mdx(\"p\", null, \"The first time you run it, you may see a lot of files being loaded. This is preparing all the magic behind the scene. Once it is ready, you will see something like this:\"), mdx(\"p\", null, mdx(\"img\", _extends({\n parentName: \"p\"\n }, {\n \"src\": \"https://i.imgur.com/TOXjLgh.png\",\n \"alt\": \"image\"\n }))), mdx(\"h2\", null, \"Understanding What Discordeno Did\"), mdx(\"p\", null, \"Discordeno includes these commands/folders as they are essential for any discord bot to have in order to meet the Discord Bot Best Practices. It also adds a few things that will help make some things easier to build a bot.\"), mdx(\"p\", null, \"We will dive into these deeper in this guide. Let's take it step by step.\"));\n}\n;\nMDXContent.isMDXComponent = true;","rawMDXOutput":"/* @jsx mdx */\nimport { mdx } from '@mdx-js/react';\n/* @jsx mdx */\n\nexport const _frontmatter = {\n \"title\": \"Creating The Bot!\",\n \"metaTitle\": \"Creating A Bot | Discordeno\",\n \"metaDescription\": \"Let's create our very own bot with Discordeno!\"\n};\n\nconst layoutProps = {\n _frontmatter\n};\nconst MDXLayout = \"wrapper\"\nexport default function MDXContent({\n components,\n ...props\n}) {\n return \n

{`Discordeno will help make Discord bot development much easier. Don't worry, as you go through this guide it will make a lot more sense.`}

\n

{`Creating The Bot!`}

\n
\n

{`This guide is going to assume you already have the basic requirements to make a bot ready. This includes github, git, a code editor like Visual Studio Code. If you don't have these yet please prepare them first before going forward.`}

\n
\n
    \n
  • \n

    {`First, create a Discordeno Bot using the `}{`Generator Boilerplate`}{`. Give it any name you like. For the purpose of this guide we will call it, Stargate.`}

    \n
  • \n
  • \n

    {`Then `}{`git clone https://github.com/Skillz4Killz/Stargate.git`}

    \n
  • \n
  • \n

    {`When that is done, go ahead and open up the folder with VSC.`}

    \n
  • \n
  • \n

    {`Create a new file called `}{`configs.ts`}{`. Open the `}{`configs.example.ts`}{` file and copy everything over.`}

    \n
  • \n
\n

{`Let's take a minute to review all the options we have available to us.`}

\n

{`Configs File`}

\n

{`The `}{`configs.ts`}{` file is where you will keep all your secret info you don't want to share with anyone else. As long as `}{`.gitignore`}{` file is ignoring configs.ts your configurations will be kept private!`}

\n
{`// Step 1: Remove the \\`.example\\` from this file name so it is called \\`configs.ts\\`\n// Step 2: Add all your bot's information below. The only required one is token and prefix. NOTE: As long as \\`.gitignore\\` file is ignoring configs.ts your configurations will be kept private!\n// Step 3: Remove these comments if you like.\n\nexport const configs = {\n  // Your bot token goes here\n  token: \"\",\n  // The default prefix for your bot. Don't worry guilds can change this later.\n  prefix: \"!\",\n  // This isn't required but you can add bot list api keys here.\n  botListTokens: {\n    DISCORD_BOT_ORG: \"\",\n    BOTS_ON_DISCORD: \"\",\n    DISCORD_BOT_LIST: \"\",\n    BOTS_FOR_DISCORD: \"\",\n    DISCORD_BOATS: \"\",\n    DISCORD_BOTS_GG: \"\",\n    DISCORD_BOTS_GROUP: \"\",\n  },\n  // This is the server id for your bot's main server where users can get help/support\n  supportServerID: \"\",\n  // These are channel ids that will enable some functionality\n  channelIDs: {\n    // When a translation is missing this is the channel you will be alerted in.\n    missingTranslation: \"\",\n    // When an error occurs, we will try and log it to this channel\n    errorChannelID: \"\"\n  },\n  // These are the role ids that will enable some functionality.\n  roleIDs: {\n    // If you have a patreon set up you can add the patreon vip role id here.\n    patreonVIPRoleID: \"\",\n  },\n  // These are the user ids that will enable some functionality.\n  userIDs: {\n    // The user ids for the support team\n    botSupporters: [],\n    // The user ids for the other devs on your team\n    botDevs: [],\n    // The user ids who have complete 100% access to your bot\n    botOwners: []\n  }\n};\n\n`}
\n

{`Token`}

\n

{`First, add your bot token. This is `}{`required`}{` for the bot to start. Review the `}{`instructions`}{` if you have not made your token yet.`}

\n

{`Prefix`}

\n

{`The prefix is where you will set the default prefix for your bot. Don't worry, every server will be able to choose their own prefix but we need a default prefix to start.`}

\n

{`Bot Lists Tokens`}

\n

{`This section of the file is so you can easily have your bot's statistics updated on all the bot lists out there to help you grow your bot. The code is already written to handle this but you will need to do 3 things for each bot list.`}

\n
    \n
  1. {`Go to the bot list and add your bot to their website. (Each site has it's own instructions)`}
  2. \n
  3. {`Create a token for yourself on each website and paste it in your configs.`}
  4. \n
  5. {`Enjoy!`}
  6. \n
\n

{`If you wish to customize the code, you will find the bot list tasks in the tasks folder. Don't worry we will discuss this when we get to the tasks section of the guide.`}

\n

{`For now just remember, that Discordeno provides you a built in way to update most discord bot lists.`}

\n

{`Channel IDs`}

\n

{`The channelIDs section holds the channel IDs that are useful for specific features to help give you alerts/notifications. For example, the `}{`missingTranslation`}{` channel will be where messages are sent alerting you that somewhere in your code you are trying to use a translation key that you never created.`}

\n

{`When you get to around 25,000 Discord servers on your bot, you may want to convert these channel IDs to webhooks.`}

\n

{`Role IDs`}

\n

{`The roleIDs section holds the role IDs that are useful for specific features. For example, the `}{`patreonVIPRoleID`}{` role can be used easily to enable vip features later in this guide.`}

\n

{`User IDs`}

\n

{`The userIDs section holds the channel IDs that are useful for specific features to help give you alerts/notifications. For example, the `}{`missingTranslation`}{` channel will be where messages are sent alerting you that somewhere in your code you are trying to use a translation key that you never created.`}

\n

{`When you get to around 25,000 Discord servers on your bot, you may want to convert these channel IDs to webhooks.`}

\n

{`It's Alive!`}

\n

{`Oh my god! You now have a bot with a bunch of features already! You don't believe me? Well, seeing is believing, so start the bot.`}

\n
    \n
  1. {`Invite your bot to a discord server.`}
  2. \n
  3. {`Open up the integrated terminal in VSC using `}{`CTRL + \\``}{`. If you use a Mac, replace CTRL with CMD.`}
  4. \n
  5. {`Run the script below:`}
  6. \n
\n
{`deno run --allow-net --allow-read mod.ts\n`}
\n

{`The first time you run it, you may see a lot of files being loaded. This is preparing all the magic behind the scene. Once it is ready, you will see something like this:`}

\n

\n

{`Understanding What Discordeno Did`}

\n

{`Discordeno includes these commands/folders as they are essential for any discord bot to have in order to meet the Discord Bot Best Practices. It also adds a few things that will help make some things easier to build a bot.`}

\n

{`We will dive into these deeper in this guide. Let's take it step by step.`}

\n\n
;\n}\n\n;\nMDXContent.isMDXComponent = true;"}} \ No newline at end of file diff --git a/docs/.cache/caches/gatsby-plugin-mdx/diskstore-6e802be7b87638c47cf4a3844aee228f.json b/docs/.cache/caches/gatsby-plugin-mdx/diskstore-6e802be7b87638c47cf4a3844aee228f.json new file mode 100644 index 000000000..05e07f6ca --- /dev/null +++ b/docs/.cache/caches/gatsby-plugin-mdx/diskstore-6e802be7b87638c47cf4a3844aee228f.json @@ -0,0 +1 @@ +{"expireTime":9007200851635356000,"key":"gatsby-plugin-mdx-entire-payload-ed22c1e95f9c15ea75939a57b6f90451-","val":{"mdast":{"type":"root","children":[{"type":"paragraph","children":[{"type":"text","value":"Woah! You are almost half way done with understanding all of Discordeno. Amazing isn't it? Something you may have noticed in the last section was when the bot started up you could see a bunch of messages like ","position":{"start":{"line":2,"column":1,"offset":1},"end":{"line":2,"column":210,"offset":210},"indent":[]}},{"type":"inlineCode","value":"Loaded X Commands","position":{"start":{"line":2,"column":210,"offset":210},"end":{"line":2,"column":229,"offset":229},"indent":[]}},{"type":"text","value":" and such. Let's jump into this part now and understand how event handling works in Discordeno.","position":{"start":{"line":2,"column":229,"offset":229},"end":{"line":2,"column":324,"offset":324},"indent":[]}}],"position":{"start":{"line":2,"column":1,"offset":1},"end":{"line":2,"column":324,"offset":324},"indent":[]}},{"type":"heading","depth":2,"children":[{"type":"text","value":"What Is An Event?","position":{"start":{"line":4,"column":4,"offset":329},"end":{"line":4,"column":21,"offset":346},"indent":[]}}],"position":{"start":{"line":4,"column":1,"offset":326},"end":{"line":4,"column":21,"offset":346},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"An event in Discordeno is a function that can be called when a specific event occurs. For the most part, events will usually be the ones that are available from Discordeno. However, you can create your own custom events as well if you wish.","position":{"start":{"line":6,"column":1,"offset":348},"end":{"line":6,"column":241,"offset":588},"indent":[]}}],"position":{"start":{"line":6,"column":1,"offset":348},"end":{"line":6,"column":241,"offset":588},"indent":[]}},{"type":"heading","depth":2,"children":[{"type":"text","value":"Creating The File","position":{"start":{"line":8,"column":4,"offset":593},"end":{"line":8,"column":21,"offset":610},"indent":[]}}],"position":{"start":{"line":8,"column":1,"offset":590},"end":{"line":8,"column":21,"offset":610},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"Make a new file in the events folder called ","position":{"start":{"line":10,"column":1,"offset":612},"end":{"line":10,"column":45,"offset":656},"indent":[]}},{"type":"inlineCode","value":"discordLog.ts","position":{"start":{"line":10,"column":45,"offset":656},"end":{"line":10,"column":60,"offset":671},"indent":[]}},{"type":"text","value":" that will send a message to a discord channel whenever we get an error so we don't need to always be watching the console to see errors. Once you made the file, go ahead and paste the base event snippet below.","position":{"start":{"line":10,"column":60,"offset":671},"end":{"line":10,"column":270,"offset":881},"indent":[]}}],"position":{"start":{"line":10,"column":1,"offset":612},"end":{"line":10,"column":270,"offset":881},"indent":[]}},{"type":"code","lang":"ts","meta":null,"value":"import { botCache } from \"../../mod.ts\";\n\nbotCache.eventHandlers.ready = function () {\n // Your code goes here\n};\n","position":{"start":{"line":13,"column":1,"offset":884},"end":{"line":20,"column":4,"offset":1009},"indent":[1,1,1,1,1,1,1]}},{"type":"export","value":"export const _frontmatter = {\"title\":\"Creating Events!\",\"metaTitle\":\"Creating An Event | Discordeno\",\"metaDescription\":\"Let's create our very own bot with Discordeno!\"}","position":{"start":{"line":23,"column":1,"offset":1012},"end":{"line":23,"column":169,"offset":1180},"indent":[]}}],"position":{"start":{"line":1,"column":1,"offset":0},"end":{"line":23,"column":169,"offset":1180}}},"scopeImports":["import * as React from 'react'"],"scopeIdentifiers":["React"],"body":"function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }\n\nfunction _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }\n\nfunction _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }\n\n/* @jsx mdx */\nvar _frontmatter = {\n \"title\": \"Creating Events!\",\n \"metaTitle\": \"Creating An Event | Discordeno\",\n \"metaDescription\": \"Let's create our very own bot with Discordeno!\"\n};\nvar layoutProps = {\n _frontmatter: _frontmatter\n};\nvar MDXLayout = \"wrapper\";\nreturn function MDXContent(_ref) {\n var components = _ref.components,\n props = _objectWithoutProperties(_ref, [\"components\"]);\n\n return mdx(MDXLayout, _extends({}, layoutProps, props, {\n components: components,\n mdxType: \"MDXLayout\"\n }), mdx(\"p\", null, \"Woah! You are almost half way done with understanding all of Discordeno. Amazing isn't it? Something you may have noticed in the last section was when the bot started up you could see a bunch of messages like \", mdx(\"inlineCode\", {\n parentName: \"p\"\n }, \"Loaded X Commands\"), \" and such. Let's jump into this part now and understand how event handling works in Discordeno.\"), mdx(\"h2\", null, \"What Is An Event?\"), mdx(\"p\", null, \"An event in Discordeno is a function that can be called when a specific event occurs. For the most part, events will usually be the ones that are available from Discordeno. However, you can create your own custom events as well if you wish.\"), mdx(\"h2\", null, \"Creating The File\"), mdx(\"p\", null, \"Make a new file in the events folder called \", mdx(\"inlineCode\", {\n parentName: \"p\"\n }, \"discordLog.ts\"), \" that will send a message to a discord channel whenever we get an error so we don't need to always be watching the console to see errors. Once you made the file, go ahead and paste the base event snippet below.\"), mdx(\"pre\", null, mdx(\"code\", _extends({\n parentName: \"pre\"\n }, {\n \"className\": \"language-ts\"\n }), \"import { botCache } from \\\"../../mod.ts\\\";\\n\\nbotCache.eventHandlers.ready = function () {\\n // Your code goes here\\n};\\n\\n\")));\n}\n;\nMDXContent.isMDXComponent = true;","rawMDXOutput":"/* @jsx mdx */\nimport { mdx } from '@mdx-js/react';\n/* @jsx mdx */\n\nexport const _frontmatter = {\n \"title\": \"Creating Events!\",\n \"metaTitle\": \"Creating An Event | Discordeno\",\n \"metaDescription\": \"Let's create our very own bot with Discordeno!\"\n};\n\nconst layoutProps = {\n _frontmatter\n};\nconst MDXLayout = \"wrapper\"\nexport default function MDXContent({\n components,\n ...props\n}) {\n return \n

{`Woah! You are almost half way done with understanding all of Discordeno. Amazing isn't it? Something you may have noticed in the last section was when the bot started up you could see a bunch of messages like `}{`Loaded X Commands`}{` and such. Let's jump into this part now and understand how event handling works in Discordeno.`}

\n

{`What Is An Event?`}

\n

{`An event in Discordeno is a function that can be called when a specific event occurs. For the most part, events will usually be the ones that are available from Discordeno. However, you can create your own custom events as well if you wish.`}

\n

{`Creating The File`}

\n

{`Make a new file in the events folder called `}{`discordLog.ts`}{` that will send a message to a discord channel whenever we get an error so we don't need to always be watching the console to see errors. Once you made the file, go ahead and paste the base event snippet below.`}

\n
{`import { botCache } from \"../../mod.ts\";\n\nbotCache.eventHandlers.ready = function () {\n  // Your code goes here\n};\n\n`}
\n\n
;\n}\n\n;\nMDXContent.isMDXComponent = true;"}} \ No newline at end of file diff --git a/docs/.cache/caches/gatsby-plugin-mdx/diskstore-6fc5d5eef37afc0a534ff4ebad37218a.json b/docs/.cache/caches/gatsby-plugin-mdx/diskstore-6fc5d5eef37afc0a534ff4ebad37218a.json new file mode 100644 index 000000000..422e1d675 --- /dev/null +++ b/docs/.cache/caches/gatsby-plugin-mdx/diskstore-6fc5d5eef37afc0a534ff4ebad37218a.json @@ -0,0 +1 @@ +{"expireTime":9007200851634380000,"key":"gatsby-plugin-mdx-entire-payload-a6d0375efbcd2c0a33c5f48cdeac634c-","val":{"mdast":{"type":"root","children":[{"type":"paragraph","children":[{"type":"text","value":"Woah! You are almost half way done with understanding all of Discordeno. Amazing isn't it? Something you may have noticed in the last section was there were some options that prevented some commands from running like ","position":{"start":{"line":2,"column":1,"offset":1},"end":{"line":2,"column":218,"offset":218},"indent":[]}},{"type":"inlineCode","value":"dmOnly","position":{"start":{"line":2,"column":218,"offset":218},"end":{"line":2,"column":226,"offset":226},"indent":[]}},{"type":"text","value":" or the permission options. we created a setting to prevent the monitor from running in certain channels. What if we wanted to do prevent commands from happening? How would we prevent commands from running?","position":{"start":{"line":2,"column":226,"offset":226},"end":{"line":2,"column":432,"offset":432},"indent":[]}}],"position":{"start":{"line":2,"column":1,"offset":1},"end":{"line":2,"column":432,"offset":432},"indent":[]}},{"type":"heading","depth":2,"children":[{"type":"text","value":"What is an Inhibitor?","position":{"start":{"line":4,"column":4,"offset":437},"end":{"line":4,"column":25,"offset":458},"indent":[]}}],"position":{"start":{"line":4,"column":1,"offset":434},"end":{"line":4,"column":25,"offset":458},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"An Inhibitor is very similar to how monitors work. A monitor runs on every message but an inhibitor runs on every command. Remember all those command options like cooldown, permissions, permissionLevel, nsfw, etc... Each and every one of these options has an inhibitor in that checks commands for these settings.","position":{"start":{"line":6,"column":1,"offset":460},"end":{"line":6,"column":313,"offset":772},"indent":[]}}],"position":{"start":{"line":6,"column":1,"offset":460},"end":{"line":6,"column":313,"offset":772},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"Let's create our own inhibitor that would prevent commands from being used if the user is not a VIP user.","position":{"start":{"line":8,"column":1,"offset":774},"end":{"line":8,"column":106,"offset":879},"indent":[]}}],"position":{"start":{"line":8,"column":1,"offset":774},"end":{"line":8,"column":106,"offset":879},"indent":[]}},{"type":"blockquote","children":[{"type":"paragraph","children":[{"type":"strong","children":[{"type":"text","value":"Note:","position":{"start":{"line":10,"column":5,"offset":885},"end":{"line":10,"column":10,"offset":890},"indent":[]}}],"position":{"start":{"line":10,"column":3,"offset":883},"end":{"line":10,"column":12,"offset":892},"indent":[]}},{"type":"text","value":" It is important to remember that everything below can be done with a simple permission level as well. We will create our own custom permission levels but for the purposes of this guide and to be able to learn about Inhibitors, we will be using an inhibitor.","position":{"start":{"line":10,"column":12,"offset":892},"end":{"line":10,"column":270,"offset":1150},"indent":[]}}],"position":{"start":{"line":10,"column":3,"offset":883},"end":{"line":10,"column":270,"offset":1150},"indent":[]}}],"position":{"start":{"line":10,"column":1,"offset":881},"end":{"line":10,"column":270,"offset":1150},"indent":[]}},{"type":"heading","depth":2,"children":[{"type":"text","value":"Creating the File","position":{"start":{"line":12,"column":4,"offset":1155},"end":{"line":12,"column":21,"offset":1172},"indent":[]}}],"position":{"start":{"line":12,"column":1,"offset":1152},"end":{"line":12,"column":21,"offset":1172},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"Let's start by creating a file inside the inhibitors folder called ","position":{"start":{"line":14,"column":1,"offset":1174},"end":{"line":14,"column":68,"offset":1241},"indent":[]}},{"type":"inlineCode","value":"boosted.ts","position":{"start":{"line":14,"column":68,"offset":1241},"end":{"line":14,"column":80,"offset":1253},"indent":[]}},{"type":"text","value":" and paste the following snippet of code:","position":{"start":{"line":14,"column":80,"offset":1253},"end":{"line":14,"column":121,"offset":1294},"indent":[]}}],"position":{"start":{"line":14,"column":1,"offset":1174},"end":{"line":14,"column":121,"offset":1294},"indent":[]}},{"type":"code","lang":"ts","meta":null,"value":"import { botCache } from \"../../mod.ts\";\n\nbotCache.inhibitors.set(\"inhibitorname\", async function (message, command, guild) {\n\t// Your code goes here\n});","position":{"start":{"line":16,"column":1,"offset":1296},"end":{"line":22,"column":4,"offset":1459},"indent":[1,1,1,1,1,1]}},{"type":"paragraph","children":[{"type":"text","value":"Inhibitors can take up to 3 arguments.","position":{"start":{"line":24,"column":1,"offset":1461},"end":{"line":24,"column":39,"offset":1499},"indent":[]}}],"position":{"start":{"line":24,"column":1,"offset":1461},"end":{"line":24,"column":39,"offset":1499},"indent":[]}},{"type":"list","ordered":false,"start":null,"spread":false,"children":[{"type":"listItem","spread":false,"checked":null,"children":[{"type":"paragraph","children":[{"type":"inlineCode","value":"message","position":{"start":{"line":26,"column":3,"offset":1503},"end":{"line":26,"column":12,"offset":1512},"indent":[]}},{"type":"text","value":": The message object that triggered the command.","position":{"start":{"line":26,"column":12,"offset":1512},"end":{"line":26,"column":60,"offset":1560},"indent":[]}}],"position":{"start":{"line":26,"column":3,"offset":1503},"end":{"line":26,"column":60,"offset":1560},"indent":[]}}],"position":{"start":{"line":26,"column":1,"offset":1501},"end":{"line":26,"column":60,"offset":1560},"indent":[]}},{"type":"listItem","spread":false,"checked":null,"children":[{"type":"paragraph","children":[{"type":"inlineCode","value":"command","position":{"start":{"line":27,"column":3,"offset":1563},"end":{"line":27,"column":12,"offset":1572},"indent":[]}},{"type":"text","value":": The command object itself that was triggered.","position":{"start":{"line":27,"column":12,"offset":1572},"end":{"line":27,"column":59,"offset":1619},"indent":[]}}],"position":{"start":{"line":27,"column":3,"offset":1563},"end":{"line":27,"column":59,"offset":1619},"indent":[]}}],"position":{"start":{"line":27,"column":1,"offset":1561},"end":{"line":27,"column":59,"offset":1619},"indent":[]}},{"type":"listItem","spread":false,"checked":null,"children":[{"type":"paragraph","children":[{"type":"inlineCode","value":"guild","position":{"start":{"line":28,"column":3,"offset":1622},"end":{"line":28,"column":10,"offset":1629},"indent":[]}},{"type":"text","value":": The server guild object where this command was ran.","position":{"start":{"line":28,"column":10,"offset":1629},"end":{"line":28,"column":63,"offset":1682},"indent":[]}}],"position":{"start":{"line":28,"column":3,"offset":1622},"end":{"line":28,"column":63,"offset":1682},"indent":[]}}],"position":{"start":{"line":28,"column":1,"offset":1620},"end":{"line":28,"column":63,"offset":1682},"indent":[]}}],"position":{"start":{"line":26,"column":1,"offset":1501},"end":{"line":28,"column":63,"offset":1682},"indent":[1,1]}},{"type":"heading","depth":2,"children":[{"type":"text","value":"Understanding How Inhibitors Function","position":{"start":{"line":30,"column":4,"offset":1687},"end":{"line":30,"column":41,"offset":1724},"indent":[]}}],"position":{"start":{"line":30,"column":1,"offset":1684},"end":{"line":30,"column":41,"offset":1724},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"To block a command you have to return a truthy value.","position":{"start":{"line":32,"column":1,"offset":1726},"end":{"line":32,"column":54,"offset":1779},"indent":[]}}],"position":{"start":{"line":32,"column":1,"offset":1726},"end":{"line":32,"column":54,"offset":1779},"indent":[]}},{"type":"list","ordered":false,"start":null,"spread":false,"children":[{"type":"listItem","spread":false,"checked":null,"children":[{"type":"paragraph","children":[{"type":"strong","children":[{"type":"text","value":"return true;","position":{"start":{"line":33,"column":5,"offset":1784},"end":{"line":33,"column":17,"offset":1796},"indent":[]}}],"position":{"start":{"line":33,"column":3,"offset":1782},"end":{"line":33,"column":19,"offset":1798},"indent":[]}},{"type":"text","value":" If you return true the inhibitor will block the execution of the command.\nTo allow a command return a falsey value.","position":{"start":{"line":33,"column":19,"offset":1798},"end":{"line":34,"column":42,"offset":1914},"indent":[1]}}],"position":{"start":{"line":33,"column":3,"offset":1782},"end":{"line":34,"column":42,"offset":1914},"indent":[1]}}],"position":{"start":{"line":33,"column":1,"offset":1780},"end":{"line":34,"column":42,"offset":1914},"indent":[1]}},{"type":"listItem","spread":false,"checked":null,"children":[{"type":"paragraph","children":[{"type":"strong","children":[{"type":"text","value":"return false;","position":{"start":{"line":35,"column":5,"offset":1919},"end":{"line":35,"column":18,"offset":1932},"indent":[]}}],"position":{"start":{"line":35,"column":3,"offset":1917},"end":{"line":35,"column":20,"offset":1934},"indent":[]}},{"type":"text","value":" If you return false the inhibitor will not block the error.","position":{"start":{"line":35,"column":20,"offset":1934},"end":{"line":35,"column":80,"offset":1994},"indent":[]}}],"position":{"start":{"line":35,"column":3,"offset":1917},"end":{"line":35,"column":80,"offset":1994},"indent":[]}}],"position":{"start":{"line":35,"column":1,"offset":1915},"end":{"line":35,"column":80,"offset":1994},"indent":[]}}],"position":{"start":{"line":33,"column":1,"offset":1780},"end":{"line":35,"column":80,"offset":1994},"indent":[1,1]}},{"type":"code","lang":"ts","meta":null,"value":"// If the command is not VIP only we can allow this command to execute\nif (!command.vipOnly) return false;\n\n// The bot's support server\nconst guild = cache.guilds.get(configs.supportServerID);\n// If the command author is not in the server they won't have the vip role\nconst member = guild.members.get(message.author.id) || await getMember(guild.id, message.author.id);\n// Member doesn't exist so cancel the command\nif (!member) {\n\tsendResponse(message, `sorry, but you can not use this command until you become VIP.`)\n\treturn true;\n}\n\n// If the user has the vip role on the support server given by patreon allow the command\nif (member.roles.includes(configs.patreonVIPRoleID)) return false;\n\n// Alert the user they don't have vip and can't use the command\nsendResponse(message, `sorry, but you can not use this command until you become a VIP.`)\n// Cancel the command since the user does not have vip\nreturn true;","position":{"start":{"line":38,"column":1,"offset":1997},"end":{"line":59,"column":4,"offset":2919},"indent":[1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1]}},{"type":"export","value":"export const _frontmatter = {\"title\":\"Creating Inhibitors!\",\"metaTitle\":\"Creating An Inhibitor | Discordeno\",\"metaDescription\":\"Let's create our very own bot with Discordeno!\"}","position":{"start":{"line":62,"column":1,"offset":2922},"end":{"line":62,"column":177,"offset":3098},"indent":[]}}],"position":{"start":{"line":1,"column":1,"offset":0},"end":{"line":62,"column":177,"offset":3098}}},"scopeImports":["import * as React from 'react'"],"scopeIdentifiers":["React"],"body":"function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }\n\nfunction _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }\n\nfunction _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }\n\n/* @jsx mdx */\nvar _frontmatter = {\n \"title\": \"Creating Inhibitors!\",\n \"metaTitle\": \"Creating An Inhibitor | Discordeno\",\n \"metaDescription\": \"Let's create our very own bot with Discordeno!\"\n};\nvar layoutProps = {\n _frontmatter: _frontmatter\n};\nvar MDXLayout = \"wrapper\";\nreturn function MDXContent(_ref) {\n var components = _ref.components,\n props = _objectWithoutProperties(_ref, [\"components\"]);\n\n return mdx(MDXLayout, _extends({}, layoutProps, props, {\n components: components,\n mdxType: \"MDXLayout\"\n }), mdx(\"p\", null, \"Woah! You are almost half way done with understanding all of Discordeno. Amazing isn't it? Something you may have noticed in the last section was there were some options that prevented some commands from running like \", mdx(\"inlineCode\", {\n parentName: \"p\"\n }, \"dmOnly\"), \" or the permission options. we created a setting to prevent the monitor from running in certain channels. What if we wanted to do prevent commands from happening? How would we prevent commands from running?\"), mdx(\"h2\", null, \"What is an Inhibitor?\"), mdx(\"p\", null, \"An Inhibitor is very similar to how monitors work. A monitor runs on every message but an inhibitor runs on every command. Remember all those command options like cooldown, permissions, permissionLevel, nsfw, etc... Each and every one of these options has an inhibitor in that checks commands for these settings.\"), mdx(\"p\", null, \"Let's create our own inhibitor that would prevent commands from being used if the user is not a VIP user.\"), mdx(\"blockquote\", null, mdx(\"p\", {\n parentName: \"blockquote\"\n }, mdx(\"strong\", {\n parentName: \"p\"\n }, \"Note:\"), \" It is important to remember that everything below can be done with a simple permission level as well. We will create our own custom permission levels but for the purposes of this guide and to be able to learn about Inhibitors, we will be using an inhibitor.\")), mdx(\"h2\", null, \"Creating the File\"), mdx(\"p\", null, \"Let's start by creating a file inside the inhibitors folder called \", mdx(\"inlineCode\", {\n parentName: \"p\"\n }, \"boosted.ts\"), \" and paste the following snippet of code:\"), mdx(\"pre\", null, mdx(\"code\", _extends({\n parentName: \"pre\"\n }, {\n \"className\": \"language-ts\"\n }), \"import { botCache } from \\\"../../mod.ts\\\";\\n\\nbotCache.inhibitors.set(\\\"inhibitorname\\\", async function (message, command, guild) {\\n // Your code goes here\\n});\\n\")), mdx(\"p\", null, \"Inhibitors can take up to 3 arguments.\"), mdx(\"ul\", null, mdx(\"li\", {\n parentName: \"ul\"\n }, mdx(\"inlineCode\", {\n parentName: \"li\"\n }, \"message\"), \": The message object that triggered the command.\"), mdx(\"li\", {\n parentName: \"ul\"\n }, mdx(\"inlineCode\", {\n parentName: \"li\"\n }, \"command\"), \": The command object itself that was triggered.\"), mdx(\"li\", {\n parentName: \"ul\"\n }, mdx(\"inlineCode\", {\n parentName: \"li\"\n }, \"guild\"), \": The server guild object where this command was ran.\")), mdx(\"h2\", null, \"Understanding How Inhibitors Function\"), mdx(\"p\", null, \"To block a command you have to return a truthy value.\"), mdx(\"ul\", null, mdx(\"li\", {\n parentName: \"ul\"\n }, mdx(\"strong\", {\n parentName: \"li\"\n }, \"return true;\"), \" If you return true the inhibitor will block the execution of the command.\\nTo allow a command return a falsey value.\"), mdx(\"li\", {\n parentName: \"ul\"\n }, mdx(\"strong\", {\n parentName: \"li\"\n }, \"return false;\"), \" If you return false the inhibitor will not block the error.\")), mdx(\"pre\", null, mdx(\"code\", _extends({\n parentName: \"pre\"\n }, {\n \"className\": \"language-ts\"\n }), \"// If the command is not VIP only we can allow this command to execute\\nif (!command.vipOnly) return false;\\n\\n// The bot's support server\\nconst guild = cache.guilds.get(configs.supportServerID);\\n// If the command author is not in the server they won't have the vip role\\nconst member = guild.members.get(message.author.id) || await getMember(guild.id, message.author.id);\\n// Member doesn't exist so cancel the command\\nif (!member) {\\n sendResponse(message, `sorry, but you can not use this command until you become VIP.`)\\n return true;\\n}\\n\\n// If the user has the vip role on the support server given by patreon allow the command\\nif (member.roles.includes(configs.patreonVIPRoleID)) return false;\\n\\n// Alert the user they don't have vip and can't use the command\\nsendResponse(message, `sorry, but you can not use this command until you become a VIP.`)\\n// Cancel the command since the user does not have vip\\nreturn true;\\n\")));\n}\n;\nMDXContent.isMDXComponent = true;","rawMDXOutput":"/* @jsx mdx */\nimport { mdx } from '@mdx-js/react';\n/* @jsx mdx */\n\nexport const _frontmatter = {\n \"title\": \"Creating Inhibitors!\",\n \"metaTitle\": \"Creating An Inhibitor | Discordeno\",\n \"metaDescription\": \"Let's create our very own bot with Discordeno!\"\n};\n\nconst layoutProps = {\n _frontmatter\n};\nconst MDXLayout = \"wrapper\"\nexport default function MDXContent({\n components,\n ...props\n}) {\n return \n

{`Woah! You are almost half way done with understanding all of Discordeno. Amazing isn't it? Something you may have noticed in the last section was there were some options that prevented some commands from running like `}{`dmOnly`}{` or the permission options. we created a setting to prevent the monitor from running in certain channels. What if we wanted to do prevent commands from happening? How would we prevent commands from running?`}

\n

{`What is an Inhibitor?`}

\n

{`An Inhibitor is very similar to how monitors work. A monitor runs on every message but an inhibitor runs on every command. Remember all those command options like cooldown, permissions, permissionLevel, nsfw, etc... Each and every one of these options has an inhibitor in that checks commands for these settings.`}

\n

{`Let's create our own inhibitor that would prevent commands from being used if the user is not a VIP user.`}

\n
\n

{`Note:`}{` It is important to remember that everything below can be done with a simple permission level as well. We will create our own custom permission levels but for the purposes of this guide and to be able to learn about Inhibitors, we will be using an inhibitor.`}

\n
\n

{`Creating the File`}

\n

{`Let's start by creating a file inside the inhibitors folder called `}{`boosted.ts`}{` and paste the following snippet of code:`}

\n
{`import { botCache } from \"../../mod.ts\";\n\nbotCache.inhibitors.set(\"inhibitorname\", async function (message, command, guild) {\n    // Your code goes here\n});\n`}
\n

{`Inhibitors can take up to 3 arguments.`}

\n
    \n
  • {`message`}{`: The message object that triggered the command.`}
  • \n
  • {`command`}{`: The command object itself that was triggered.`}
  • \n
  • {`guild`}{`: The server guild object where this command was ran.`}
  • \n
\n

{`Understanding How Inhibitors Function`}

\n

{`To block a command you have to return a truthy value.`}

\n
    \n
  • {`return true;`}{` If you return true the inhibitor will block the execution of the command.\nTo allow a command return a falsey value.`}
  • \n
  • {`return false;`}{` If you return false the inhibitor will not block the error.`}
  • \n
\n
{`// If the command is not VIP only we can allow this command to execute\nif (!command.vipOnly) return false;\n\n// The bot's support server\nconst guild = cache.guilds.get(configs.supportServerID);\n// If the command author is not in the server they won't have the vip role\nconst member = guild.members.get(message.author.id) || await getMember(guild.id, message.author.id);\n// Member doesn't exist so cancel the command\nif (!member) {\n    sendResponse(message, \\`sorry, but you can not use this command until you become VIP.\\`)\n    return true;\n}\n\n// If the user has the vip role on the support server given by patreon allow the command\nif (member.roles.includes(configs.patreonVIPRoleID)) return false;\n\n// Alert the user they don't have vip and can't use the command\nsendResponse(message, \\`sorry, but you can not use this command until you become a VIP.\\`)\n// Cancel the command since the user does not have vip\nreturn true;\n`}
\n\n
;\n}\n\n;\nMDXContent.isMDXComponent = true;"}} \ No newline at end of file diff --git a/docs/.cache/caches/gatsby-plugin-mdx/diskstore-7259aedea45c9b0de34264203207aff4.json b/docs/.cache/caches/gatsby-plugin-mdx/diskstore-7259aedea45c9b0de34264203207aff4.json new file mode 100644 index 000000000..8d494aa08 --- /dev/null +++ b/docs/.cache/caches/gatsby-plugin-mdx/diskstore-7259aedea45c9b0de34264203207aff4.json @@ -0,0 +1 @@ +{"expireTime":9007200851644241000,"key":"gatsby-plugin-mdx-entire-payload-d792cf26248dd25a5a035bb5e5131a02-","val":{"mdast":{"type":"root","children":[{"type":"paragraph","children":[{"type":"text","value":"Discordeno will help make Discord bot development much easier. Don't worry, as you go through this guide it will make a lot more sense.","position":{"start":{"line":2,"column":1,"offset":1},"end":{"line":2,"column":136,"offset":136},"indent":[]}}],"position":{"start":{"line":2,"column":1,"offset":1},"end":{"line":2,"column":136,"offset":136},"indent":[]}},{"type":"heading","depth":2,"children":[{"type":"text","value":"Creating The Bot!","position":{"start":{"line":4,"column":4,"offset":141},"end":{"line":4,"column":21,"offset":158},"indent":[]}}],"position":{"start":{"line":4,"column":1,"offset":138},"end":{"line":4,"column":21,"offset":158},"indent":[]}},{"type":"blockquote","children":[{"type":"paragraph","children":[{"type":"text","value":"This guide is going to assume you already have the basic requirements to make a bot ready. This includes github, git, a code editor like Visual Studio Code. If you don't have these yet please prepare them first before going forward.","position":{"start":{"line":6,"column":3,"offset":162},"end":{"line":6,"column":235,"offset":394},"indent":[]}}],"position":{"start":{"line":6,"column":3,"offset":162},"end":{"line":6,"column":235,"offset":394},"indent":[]}}],"position":{"start":{"line":6,"column":1,"offset":160},"end":{"line":6,"column":235,"offset":394},"indent":[]}},{"type":"list","ordered":false,"start":null,"spread":true,"children":[{"type":"listItem","spread":false,"checked":null,"children":[{"type":"paragraph","children":[{"type":"text","value":"First, create a Discordeno Bot using the ","position":{"start":{"line":8,"column":3,"offset":398},"end":{"line":8,"column":44,"offset":439},"indent":[]}},{"type":"link","title":null,"url":"https://github.com/Skillz4Killz/Discordeno-bot-template","children":[{"type":"text","value":"Generator Boilerplate","position":{"start":{"line":8,"column":45,"offset":440},"end":{"line":8,"column":66,"offset":461},"indent":[]}}],"position":{"start":{"line":8,"column":44,"offset":439},"end":{"line":8,"column":124,"offset":519},"indent":[]}},{"type":"text","value":". Give it any name you like. For the purpose of this guide we will call it, Stargate.","position":{"start":{"line":8,"column":124,"offset":519},"end":{"line":8,"column":209,"offset":604},"indent":[]}}],"position":{"start":{"line":8,"column":3,"offset":398},"end":{"line":8,"column":209,"offset":604},"indent":[]}}],"position":{"start":{"line":8,"column":1,"offset":396},"end":{"line":9,"column":1,"offset":605},"indent":[1]}},{"type":"listItem","spread":false,"checked":null,"children":[{"type":"paragraph","children":[{"type":"text","value":"Then ","position":{"start":{"line":10,"column":3,"offset":608},"end":{"line":10,"column":8,"offset":613},"indent":[]}},{"type":"inlineCode","value":"git clone https://github.com/Skillz4Killz/Stargate.git","position":{"start":{"line":10,"column":8,"offset":613},"end":{"line":10,"column":64,"offset":669},"indent":[]}}],"position":{"start":{"line":10,"column":3,"offset":608},"end":{"line":10,"column":64,"offset":669},"indent":[]}}],"position":{"start":{"line":10,"column":1,"offset":606},"end":{"line":11,"column":1,"offset":670},"indent":[1]}},{"type":"listItem","spread":false,"checked":null,"children":[{"type":"paragraph","children":[{"type":"text","value":"When that is done, go ahead and open up the folder with VSC.","position":{"start":{"line":12,"column":3,"offset":673},"end":{"line":12,"column":63,"offset":733},"indent":[]}}],"position":{"start":{"line":12,"column":3,"offset":673},"end":{"line":12,"column":63,"offset":733},"indent":[]}}],"position":{"start":{"line":12,"column":1,"offset":671},"end":{"line":12,"column":63,"offset":733},"indent":[]}},{"type":"listItem","spread":false,"checked":null,"children":[{"type":"paragraph","children":[{"type":"text","value":"Create a new file called ","position":{"start":{"line":13,"column":3,"offset":736},"end":{"line":13,"column":28,"offset":761},"indent":[]}},{"type":"inlineCode","value":"configs.ts","position":{"start":{"line":13,"column":28,"offset":761},"end":{"line":13,"column":40,"offset":773},"indent":[]}},{"type":"text","value":". Open the ","position":{"start":{"line":13,"column":40,"offset":773},"end":{"line":13,"column":51,"offset":784},"indent":[]}},{"type":"inlineCode","value":"configs.example.ts","position":{"start":{"line":13,"column":51,"offset":784},"end":{"line":13,"column":71,"offset":804},"indent":[]}},{"type":"text","value":" file and copy everything over.","position":{"start":{"line":13,"column":71,"offset":804},"end":{"line":13,"column":102,"offset":835},"indent":[]}}],"position":{"start":{"line":13,"column":3,"offset":736},"end":{"line":13,"column":102,"offset":835},"indent":[]}}],"position":{"start":{"line":13,"column":1,"offset":734},"end":{"line":13,"column":102,"offset":835},"indent":[]}}],"position":{"start":{"line":8,"column":1,"offset":396},"end":{"line":13,"column":102,"offset":835},"indent":[1,1,1,1,1]}},{"type":"paragraph","children":[{"type":"text","value":"Let's take a minute to review all the options we have available to us.","position":{"start":{"line":15,"column":1,"offset":837},"end":{"line":15,"column":71,"offset":907},"indent":[]}}],"position":{"start":{"line":15,"column":1,"offset":837},"end":{"line":15,"column":71,"offset":907},"indent":[]}},{"type":"heading","depth":3,"children":[{"type":"text","value":"Configs File","position":{"start":{"line":17,"column":5,"offset":913},"end":{"line":17,"column":17,"offset":925},"indent":[]}}],"position":{"start":{"line":17,"column":1,"offset":909},"end":{"line":17,"column":17,"offset":925},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"The ","position":{"start":{"line":19,"column":1,"offset":927},"end":{"line":19,"column":5,"offset":931},"indent":[]}},{"type":"inlineCode","value":"configs.ts","position":{"start":{"line":19,"column":5,"offset":931},"end":{"line":19,"column":17,"offset":943},"indent":[]}},{"type":"text","value":" file is where you will keep all your secret info you don't want to share with anyone else. As long as ","position":{"start":{"line":19,"column":17,"offset":943},"end":{"line":19,"column":120,"offset":1046},"indent":[]}},{"type":"inlineCode","value":".gitignore","position":{"start":{"line":19,"column":120,"offset":1046},"end":{"line":19,"column":132,"offset":1058},"indent":[]}},{"type":"text","value":" file is ignoring configs.ts your configurations will be kept private!","position":{"start":{"line":19,"column":132,"offset":1058},"end":{"line":19,"column":202,"offset":1128},"indent":[]}}],"position":{"start":{"line":19,"column":1,"offset":927},"end":{"line":19,"column":202,"offset":1128},"indent":[]}},{"type":"code","lang":"ts","meta":null,"value":"// Step 1: Remove the `.example` from this file name so it is called `configs.ts`\n// Step 2: Add all your bot's information below. The only required one is token and prefix. NOTE: As long as `.gitignore` file is ignoring configs.ts your configurations will be kept private!\n// Step 3: Remove these comments if you like.\n\nexport const configs = {\n // Your bot token goes here\n token: \"\",\n // The default prefix for your bot. Don't worry guilds can change this later.\n prefix: \"!\",\n // This isn't required but you can add bot list api keys here.\n botListTokens: {\n DISCORD_BOT_ORG: \"\",\n BOTS_ON_DISCORD: \"\",\n DISCORD_BOT_LIST: \"\",\n BOTS_FOR_DISCORD: \"\",\n DISCORD_BOATS: \"\",\n DISCORD_BOTS_GG: \"\",\n DISCORD_BOTS_GROUP: \"\",\n },\n // This is the server id for your bot's main server where users can get help/support\n supportServerID: \"\",\n // These are channel ids that will enable some functionality\n channelIDs: {\n // When a translation is missing this is the channel you will be alerted in.\n missingTranslation: \"\",\n // When an error occurs, we will try and log it to this channel\n errorChannelID: \"\"\n },\n // These are the role ids that will enable some functionality.\n roleIDs: {\n // If you have a patreon set up you can add the patreon vip role id here.\n patreonVIPRoleID: \"\",\n },\n // These are the user ids that will enable some functionality.\n userIDs: {\n // The user ids for the support team\n botSupporters: [],\n // The user ids for the other devs on your team\n botDevs: [],\n // The user ids who have complete 100% access to your bot\n botOwners: []\n }\n};\n","position":{"start":{"line":21,"column":1,"offset":1130},"end":{"line":66,"column":4,"offset":2770},"indent":[1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1]}},{"type":"heading","depth":4,"children":[{"type":"text","value":"Token","position":{"start":{"line":68,"column":6,"offset":2777},"end":{"line":68,"column":11,"offset":2782},"indent":[]}}],"position":{"start":{"line":68,"column":1,"offset":2772},"end":{"line":68,"column":11,"offset":2782},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"First, add your bot token. This is ","position":{"start":{"line":70,"column":1,"offset":2784},"end":{"line":70,"column":36,"offset":2819},"indent":[]}},{"type":"strong","children":[{"type":"text","value":"required","position":{"start":{"line":70,"column":38,"offset":2821},"end":{"line":70,"column":46,"offset":2829},"indent":[]}}],"position":{"start":{"line":70,"column":36,"offset":2819},"end":{"line":70,"column":48,"offset":2831},"indent":[]}},{"type":"text","value":" for the bot to start. Review the ","position":{"start":{"line":70,"column":48,"offset":2831},"end":{"line":70,"column":82,"offset":2865},"indent":[]}},{"type":"link","title":null,"url":"https://discordeno.netlify.app/gettingstarted#creatingyourfirstdiscordbotapplication","children":[{"type":"text","value":"instructions","position":{"start":{"line":70,"column":83,"offset":2866},"end":{"line":70,"column":95,"offset":2878},"indent":[]}}],"position":{"start":{"line":70,"column":82,"offset":2865},"end":{"line":70,"column":182,"offset":2965},"indent":[]}},{"type":"text","value":" if you have not made your token yet.","position":{"start":{"line":70,"column":182,"offset":2965},"end":{"line":70,"column":219,"offset":3002},"indent":[]}}],"position":{"start":{"line":70,"column":1,"offset":2784},"end":{"line":70,"column":219,"offset":3002},"indent":[]}},{"type":"heading","depth":4,"children":[{"type":"text","value":"Prefix","position":{"start":{"line":72,"column":6,"offset":3009},"end":{"line":72,"column":12,"offset":3015},"indent":[]}}],"position":{"start":{"line":72,"column":1,"offset":3004},"end":{"line":72,"column":12,"offset":3015},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"The prefix is where you will set the default prefix for your bot. Don't worry, every server will be able to choose their own prefix but we need a default prefix to start.","position":{"start":{"line":74,"column":1,"offset":3017},"end":{"line":74,"column":171,"offset":3187},"indent":[]}}],"position":{"start":{"line":74,"column":1,"offset":3017},"end":{"line":74,"column":171,"offset":3187},"indent":[]}},{"type":"heading","depth":4,"children":[{"type":"text","value":"Bot Lists Tokens","position":{"start":{"line":76,"column":6,"offset":3194},"end":{"line":76,"column":22,"offset":3210},"indent":[]}}],"position":{"start":{"line":76,"column":1,"offset":3189},"end":{"line":76,"column":22,"offset":3210},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"This section of the file is so you can easily have your bot's statistics updated on all the bot lists out there to help you grow your bot. The code is already written to handle this but you will need to do 3 things for each bot list.","position":{"start":{"line":78,"column":1,"offset":3212},"end":{"line":78,"column":234,"offset":3445},"indent":[]}}],"position":{"start":{"line":78,"column":1,"offset":3212},"end":{"line":78,"column":234,"offset":3445},"indent":[]}},{"type":"list","ordered":true,"start":1,"spread":false,"children":[{"type":"listItem","spread":false,"checked":null,"children":[{"type":"paragraph","children":[{"type":"text","value":"Go to the bot list and add your bot to their website. (Each site has it's own instructions)","position":{"start":{"line":80,"column":4,"offset":3450},"end":{"line":80,"column":95,"offset":3541},"indent":[]}}],"position":{"start":{"line":80,"column":4,"offset":3450},"end":{"line":80,"column":95,"offset":3541},"indent":[]}}],"position":{"start":{"line":80,"column":1,"offset":3447},"end":{"line":80,"column":95,"offset":3541},"indent":[]}},{"type":"listItem","spread":false,"checked":null,"children":[{"type":"paragraph","children":[{"type":"text","value":"Create a token for yourself on each website and paste it in your configs.","position":{"start":{"line":81,"column":4,"offset":3545},"end":{"line":81,"column":77,"offset":3618},"indent":[]}}],"position":{"start":{"line":81,"column":4,"offset":3545},"end":{"line":81,"column":77,"offset":3618},"indent":[]}}],"position":{"start":{"line":81,"column":1,"offset":3542},"end":{"line":81,"column":77,"offset":3618},"indent":[]}},{"type":"listItem","spread":false,"checked":null,"children":[{"type":"paragraph","children":[{"type":"text","value":"Enjoy!","position":{"start":{"line":82,"column":4,"offset":3622},"end":{"line":82,"column":10,"offset":3628},"indent":[]}}],"position":{"start":{"line":82,"column":4,"offset":3622},"end":{"line":82,"column":10,"offset":3628},"indent":[]}}],"position":{"start":{"line":82,"column":1,"offset":3619},"end":{"line":82,"column":10,"offset":3628},"indent":[]}}],"position":{"start":{"line":80,"column":1,"offset":3447},"end":{"line":82,"column":10,"offset":3628},"indent":[1,1]}},{"type":"paragraph","children":[{"type":"text","value":"If you wish to customize the code, you will find the bot list tasks in the tasks folder. Don't worry we will discuss this when we get to the tasks section of the guide.","position":{"start":{"line":84,"column":1,"offset":3630},"end":{"line":84,"column":169,"offset":3798},"indent":[]}}],"position":{"start":{"line":84,"column":1,"offset":3630},"end":{"line":84,"column":169,"offset":3798},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"For now just remember, that Discordeno provides you a built in way to update most discord bot lists.","position":{"start":{"line":86,"column":1,"offset":3800},"end":{"line":86,"column":101,"offset":3900},"indent":[]}}],"position":{"start":{"line":86,"column":1,"offset":3800},"end":{"line":86,"column":101,"offset":3900},"indent":[]}},{"type":"heading","depth":4,"children":[{"type":"text","value":"Channel IDs","position":{"start":{"line":88,"column":6,"offset":3907},"end":{"line":88,"column":17,"offset":3918},"indent":[]}}],"position":{"start":{"line":88,"column":1,"offset":3902},"end":{"line":88,"column":17,"offset":3918},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"The channelIDs section holds the channel IDs that are useful for specific features to help give you alerts/notifications. For example, the ","position":{"start":{"line":90,"column":1,"offset":3920},"end":{"line":90,"column":140,"offset":4059},"indent":[]}},{"type":"inlineCode","value":"missingTranslation","position":{"start":{"line":90,"column":140,"offset":4059},"end":{"line":90,"column":160,"offset":4079},"indent":[]}},{"type":"text","value":" channel will be where messages are sent alerting you that somewhere in your code you are trying to use a translation key that you never created.","position":{"start":{"line":90,"column":160,"offset":4079},"end":{"line":90,"column":305,"offset":4224},"indent":[]}}],"position":{"start":{"line":90,"column":1,"offset":3920},"end":{"line":90,"column":305,"offset":4224},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"When you get to around 25,000 Discord servers on your bot, you may want to convert these channel IDs to webhooks.","position":{"start":{"line":92,"column":1,"offset":4226},"end":{"line":92,"column":114,"offset":4339},"indent":[]}}],"position":{"start":{"line":92,"column":1,"offset":4226},"end":{"line":92,"column":114,"offset":4339},"indent":[]}},{"type":"heading","depth":4,"children":[{"type":"text","value":"Role IDs","position":{"start":{"line":94,"column":6,"offset":4346},"end":{"line":94,"column":14,"offset":4354},"indent":[]}}],"position":{"start":{"line":94,"column":1,"offset":4341},"end":{"line":94,"column":14,"offset":4354},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"The roleIDs section holds the role IDs that are useful for specific features. For example, the ","position":{"start":{"line":96,"column":1,"offset":4356},"end":{"line":96,"column":96,"offset":4451},"indent":[]}},{"type":"inlineCode","value":"patreonVIPRoleID","position":{"start":{"line":96,"column":96,"offset":4451},"end":{"line":96,"column":114,"offset":4469},"indent":[]}},{"type":"text","value":" role can be used easily to enable vip features later in this guide. will be where messages are sent alerting you that somewhere in your code you are trying to use a translation key that you never created.","position":{"start":{"line":96,"column":114,"offset":4469},"end":{"line":96,"column":319,"offset":4674},"indent":[]}}],"position":{"start":{"line":96,"column":1,"offset":4356},"end":{"line":96,"column":319,"offset":4674},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"When you get to around 25,000 Discord servers on your bot, you may want to convert these channel IDs to webhooks.","position":{"start":{"line":98,"column":1,"offset":4676},"end":{"line":98,"column":114,"offset":4789},"indent":[]}}],"position":{"start":{"line":98,"column":1,"offset":4676},"end":{"line":98,"column":114,"offset":4789},"indent":[]}},{"type":"heading","depth":2,"children":[{"type":"text","value":"It's Alive!","position":{"start":{"line":100,"column":4,"offset":4794},"end":{"line":100,"column":15,"offset":4805},"indent":[]}}],"position":{"start":{"line":100,"column":1,"offset":4791},"end":{"line":100,"column":15,"offset":4805},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"Oh my god! You now have a bot with a bunch of features already! You don't believe me? Well, seeing is believing, so start the bot.","position":{"start":{"line":102,"column":1,"offset":4807},"end":{"line":102,"column":131,"offset":4937},"indent":[]}}],"position":{"start":{"line":102,"column":1,"offset":4807},"end":{"line":102,"column":131,"offset":4937},"indent":[]}},{"type":"list","ordered":true,"start":1,"spread":false,"children":[{"type":"listItem","spread":false,"checked":null,"children":[{"type":"paragraph","children":[{"type":"text","value":"Invite your bot to a discord server.","position":{"start":{"line":104,"column":4,"offset":4942},"end":{"line":104,"column":40,"offset":4978},"indent":[]}}],"position":{"start":{"line":104,"column":4,"offset":4942},"end":{"line":104,"column":40,"offset":4978},"indent":[]}}],"position":{"start":{"line":104,"column":1,"offset":4939},"end":{"line":104,"column":40,"offset":4978},"indent":[]}},{"type":"listItem","spread":false,"checked":null,"children":[{"type":"paragraph","children":[{"type":"text","value":"Open up the integrated terminal in VSC using ","position":{"start":{"line":105,"column":4,"offset":4982},"end":{"line":105,"column":49,"offset":5027},"indent":[]}},{"type":"strong","children":[{"type":"text","value":"CTRL + `","position":{"start":{"line":105,"column":51,"offset":5029},"end":{"line":105,"column":59,"offset":5037},"indent":[]}}],"position":{"start":{"line":105,"column":49,"offset":5027},"end":{"line":105,"column":61,"offset":5039},"indent":[]}},{"type":"text","value":". If you use a Mac, replace CTRL with CMD.","position":{"start":{"line":105,"column":61,"offset":5039},"end":{"line":105,"column":103,"offset":5081},"indent":[]}}],"position":{"start":{"line":105,"column":4,"offset":4982},"end":{"line":105,"column":103,"offset":5081},"indent":[]}}],"position":{"start":{"line":105,"column":1,"offset":4979},"end":{"line":105,"column":103,"offset":5081},"indent":[]}},{"type":"listItem","spread":false,"checked":null,"children":[{"type":"paragraph","children":[{"type":"text","value":"Run the script below:","position":{"start":{"line":106,"column":4,"offset":5085},"end":{"line":106,"column":25,"offset":5106},"indent":[]}}],"position":{"start":{"line":106,"column":4,"offset":5085},"end":{"line":106,"column":25,"offset":5106},"indent":[]}}],"position":{"start":{"line":106,"column":1,"offset":5082},"end":{"line":106,"column":25,"offset":5106},"indent":[]}}],"position":{"start":{"line":104,"column":1,"offset":4939},"end":{"line":106,"column":25,"offset":5106},"indent":[1,1]}},{"type":"code","lang":"shell","meta":null,"value":"deno run --allow-net --allow-read mod.ts","position":{"start":{"line":108,"column":1,"offset":5108},"end":{"line":110,"column":4,"offset":5161},"indent":[1,1]}},{"type":"paragraph","children":[{"type":"text","value":"The first time you run it, you may see a lot of files being loaded. This is preparing all the magic behind the scene. Once it is ready, you will see something like this:","position":{"start":{"line":112,"column":1,"offset":5163},"end":{"line":112,"column":170,"offset":5332},"indent":[]}}],"position":{"start":{"line":112,"column":1,"offset":5163},"end":{"line":112,"column":170,"offset":5332},"indent":[]}},{"type":"paragraph","children":[{"type":"image","title":null,"url":"https://i.imgur.com/TOXjLgh.png","alt":"image","position":{"start":{"line":114,"column":1,"offset":5334},"end":{"line":114,"column":42,"offset":5375},"indent":[]}}],"position":{"start":{"line":114,"column":1,"offset":5334},"end":{"line":114,"column":42,"offset":5375},"indent":[]}},{"type":"heading","depth":2,"children":[{"type":"text","value":"Understanding What Discordeno Did","position":{"start":{"line":116,"column":4,"offset":5380},"end":{"line":116,"column":37,"offset":5413},"indent":[]}}],"position":{"start":{"line":116,"column":1,"offset":5377},"end":{"line":116,"column":37,"offset":5413},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"Discordeno includes these commands/folders as they are essential for any discord bot to have in order to meet the Discord Bot Best Practices. It also adds a few things that will help make some things easier to build a bot.","position":{"start":{"line":118,"column":1,"offset":5415},"end":{"line":118,"column":223,"offset":5637},"indent":[]}}],"position":{"start":{"line":118,"column":1,"offset":5415},"end":{"line":118,"column":223,"offset":5637},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"We will dive into these deeper in this guide. Let's take it step by step.","position":{"start":{"line":120,"column":1,"offset":5639},"end":{"line":120,"column":74,"offset":5712},"indent":[]}}],"position":{"start":{"line":120,"column":1,"offset":5639},"end":{"line":120,"column":74,"offset":5712},"indent":[]}},{"type":"export","value":"export const _frontmatter = {\"title\":\"Creating The Bot!\",\"metaTitle\":\"Creating A Bot | Discordeno\",\"metaDescription\":\"Let's create our very own bot with Discordeno!\"}","position":{"start":{"line":123,"column":1,"offset":5715},"end":{"line":123,"column":167,"offset":5881},"indent":[]}}],"position":{"start":{"line":1,"column":1,"offset":0},"end":{"line":123,"column":167,"offset":5881}}},"scopeImports":["import * as React from 'react'"],"scopeIdentifiers":["React"],"body":"function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }\n\nfunction _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }\n\nfunction _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }\n\n/* @jsx mdx */\nvar _frontmatter = {\n \"title\": \"Creating The Bot!\",\n \"metaTitle\": \"Creating A Bot | Discordeno\",\n \"metaDescription\": \"Let's create our very own bot with Discordeno!\"\n};\nvar layoutProps = {\n _frontmatter: _frontmatter\n};\nvar MDXLayout = \"wrapper\";\nreturn function MDXContent(_ref) {\n var components = _ref.components,\n props = _objectWithoutProperties(_ref, [\"components\"]);\n\n return mdx(MDXLayout, _extends({}, layoutProps, props, {\n components: components,\n mdxType: \"MDXLayout\"\n }), mdx(\"p\", null, \"Discordeno will help make Discord bot development much easier. Don't worry, as you go through this guide it will make a lot more sense.\"), mdx(\"h2\", null, \"Creating The Bot!\"), mdx(\"blockquote\", null, mdx(\"p\", {\n parentName: \"blockquote\"\n }, \"This guide is going to assume you already have the basic requirements to make a bot ready. This includes github, git, a code editor like Visual Studio Code. If you don't have these yet please prepare them first before going forward.\")), mdx(\"ul\", null, mdx(\"li\", {\n parentName: \"ul\"\n }, mdx(\"p\", {\n parentName: \"li\"\n }, \"First, create a Discordeno Bot using the \", mdx(\"a\", _extends({\n parentName: \"p\"\n }, {\n \"href\": \"https://github.com/Skillz4Killz/Discordeno-bot-template\"\n }), \"Generator Boilerplate\"), \". Give it any name you like. For the purpose of this guide we will call it, Stargate.\")), mdx(\"li\", {\n parentName: \"ul\"\n }, mdx(\"p\", {\n parentName: \"li\"\n }, \"Then \", mdx(\"inlineCode\", {\n parentName: \"p\"\n }, \"git clone https://github.com/Skillz4Killz/Stargate.git\"))), mdx(\"li\", {\n parentName: \"ul\"\n }, mdx(\"p\", {\n parentName: \"li\"\n }, \"When that is done, go ahead and open up the folder with VSC.\")), mdx(\"li\", {\n parentName: \"ul\"\n }, mdx(\"p\", {\n parentName: \"li\"\n }, \"Create a new file called \", mdx(\"inlineCode\", {\n parentName: \"p\"\n }, \"configs.ts\"), \". Open the \", mdx(\"inlineCode\", {\n parentName: \"p\"\n }, \"configs.example.ts\"), \" file and copy everything over.\"))), mdx(\"p\", null, \"Let's take a minute to review all the options we have available to us.\"), mdx(\"h3\", null, \"Configs File\"), mdx(\"p\", null, \"The \", mdx(\"inlineCode\", {\n parentName: \"p\"\n }, \"configs.ts\"), \" file is where you will keep all your secret info you don't want to share with anyone else. As long as \", mdx(\"inlineCode\", {\n parentName: \"p\"\n }, \".gitignore\"), \" file is ignoring configs.ts your configurations will be kept private!\"), mdx(\"pre\", null, mdx(\"code\", _extends({\n parentName: \"pre\"\n }, {\n \"className\": \"language-ts\"\n }), \"// Step 1: Remove the `.example` from this file name so it is called `configs.ts`\\n// Step 2: Add all your bot's information below. The only required one is token and prefix. NOTE: As long as `.gitignore` file is ignoring configs.ts your configurations will be kept private!\\n// Step 3: Remove these comments if you like.\\n\\nexport const configs = {\\n // Your bot token goes here\\n token: \\\"\\\",\\n // The default prefix for your bot. Don't worry guilds can change this later.\\n prefix: \\\"!\\\",\\n // This isn't required but you can add bot list api keys here.\\n botListTokens: {\\n DISCORD_BOT_ORG: \\\"\\\",\\n BOTS_ON_DISCORD: \\\"\\\",\\n DISCORD_BOT_LIST: \\\"\\\",\\n BOTS_FOR_DISCORD: \\\"\\\",\\n DISCORD_BOATS: \\\"\\\",\\n DISCORD_BOTS_GG: \\\"\\\",\\n DISCORD_BOTS_GROUP: \\\"\\\",\\n },\\n // This is the server id for your bot's main server where users can get help/support\\n supportServerID: \\\"\\\",\\n // These are channel ids that will enable some functionality\\n channelIDs: {\\n // When a translation is missing this is the channel you will be alerted in.\\n missingTranslation: \\\"\\\",\\n // When an error occurs, we will try and log it to this channel\\n errorChannelID: \\\"\\\"\\n },\\n // These are the role ids that will enable some functionality.\\n roleIDs: {\\n // If you have a patreon set up you can add the patreon vip role id here.\\n patreonVIPRoleID: \\\"\\\",\\n },\\n // These are the user ids that will enable some functionality.\\n userIDs: {\\n // The user ids for the support team\\n botSupporters: [],\\n // The user ids for the other devs on your team\\n botDevs: [],\\n // The user ids who have complete 100% access to your bot\\n botOwners: []\\n }\\n};\\n\\n\")), mdx(\"h4\", null, \"Token\"), mdx(\"p\", null, \"First, add your bot token. This is \", mdx(\"strong\", {\n parentName: \"p\"\n }, \"required\"), \" for the bot to start. Review the \", mdx(\"a\", _extends({\n parentName: \"p\"\n }, {\n \"href\": \"https://discordeno.netlify.app/gettingstarted#creatingyourfirstdiscordbotapplication\"\n }), \"instructions\"), \" if you have not made your token yet.\"), mdx(\"h4\", null, \"Prefix\"), mdx(\"p\", null, \"The prefix is where you will set the default prefix for your bot. Don't worry, every server will be able to choose their own prefix but we need a default prefix to start.\"), mdx(\"h4\", null, \"Bot Lists Tokens\"), mdx(\"p\", null, \"This section of the file is so you can easily have your bot's statistics updated on all the bot lists out there to help you grow your bot. The code is already written to handle this but you will need to do 3 things for each bot list.\"), mdx(\"ol\", null, mdx(\"li\", {\n parentName: \"ol\"\n }, \"Go to the bot list and add your bot to their website. (Each site has it's own instructions)\"), mdx(\"li\", {\n parentName: \"ol\"\n }, \"Create a token for yourself on each website and paste it in your configs.\"), mdx(\"li\", {\n parentName: \"ol\"\n }, \"Enjoy!\")), mdx(\"p\", null, \"If you wish to customize the code, you will find the bot list tasks in the tasks folder. Don't worry we will discuss this when we get to the tasks section of the guide.\"), mdx(\"p\", null, \"For now just remember, that Discordeno provides you a built in way to update most discord bot lists.\"), mdx(\"h4\", null, \"Channel IDs\"), mdx(\"p\", null, \"The channelIDs section holds the channel IDs that are useful for specific features to help give you alerts/notifications. For example, the \", mdx(\"inlineCode\", {\n parentName: \"p\"\n }, \"missingTranslation\"), \" channel will be where messages are sent alerting you that somewhere in your code you are trying to use a translation key that you never created.\"), mdx(\"p\", null, \"When you get to around 25,000 Discord servers on your bot, you may want to convert these channel IDs to webhooks.\"), mdx(\"h4\", null, \"Role IDs\"), mdx(\"p\", null, \"The roleIDs section holds the role IDs that are useful for specific features. For example, the \", mdx(\"inlineCode\", {\n parentName: \"p\"\n }, \"patreonVIPRoleID\"), \" role can be used easily to enable vip features later in this guide. will be where messages are sent alerting you that somewhere in your code you are trying to use a translation key that you never created.\"), mdx(\"p\", null, \"When you get to around 25,000 Discord servers on your bot, you may want to convert these channel IDs to webhooks.\"), mdx(\"h2\", null, \"It's Alive!\"), mdx(\"p\", null, \"Oh my god! You now have a bot with a bunch of features already! You don't believe me? Well, seeing is believing, so start the bot.\"), mdx(\"ol\", null, mdx(\"li\", {\n parentName: \"ol\"\n }, \"Invite your bot to a discord server.\"), mdx(\"li\", {\n parentName: \"ol\"\n }, \"Open up the integrated terminal in VSC using \", mdx(\"strong\", {\n parentName: \"li\"\n }, \"CTRL + `\"), \". If you use a Mac, replace CTRL with CMD.\"), mdx(\"li\", {\n parentName: \"ol\"\n }, \"Run the script below:\")), mdx(\"pre\", null, mdx(\"code\", _extends({\n parentName: \"pre\"\n }, {\n \"className\": \"language-shell\"\n }), \"deno run --allow-net --allow-read mod.ts\\n\")), mdx(\"p\", null, \"The first time you run it, you may see a lot of files being loaded. This is preparing all the magic behind the scene. Once it is ready, you will see something like this:\"), mdx(\"p\", null, mdx(\"img\", _extends({\n parentName: \"p\"\n }, {\n \"src\": \"https://i.imgur.com/TOXjLgh.png\",\n \"alt\": \"image\"\n }))), mdx(\"h2\", null, \"Understanding What Discordeno Did\"), mdx(\"p\", null, \"Discordeno includes these commands/folders as they are essential for any discord bot to have in order to meet the Discord Bot Best Practices. It also adds a few things that will help make some things easier to build a bot.\"), mdx(\"p\", null, \"We will dive into these deeper in this guide. Let's take it step by step.\"));\n}\n;\nMDXContent.isMDXComponent = true;","rawMDXOutput":"/* @jsx mdx */\nimport { mdx } from '@mdx-js/react';\n/* @jsx mdx */\n\nexport const _frontmatter = {\n \"title\": \"Creating The Bot!\",\n \"metaTitle\": \"Creating A Bot | Discordeno\",\n \"metaDescription\": \"Let's create our very own bot with Discordeno!\"\n};\n\nconst layoutProps = {\n _frontmatter\n};\nconst MDXLayout = \"wrapper\"\nexport default function MDXContent({\n components,\n ...props\n}) {\n return \n

{`Discordeno will help make Discord bot development much easier. Don't worry, as you go through this guide it will make a lot more sense.`}

\n

{`Creating The Bot!`}

\n
\n

{`This guide is going to assume you already have the basic requirements to make a bot ready. This includes github, git, a code editor like Visual Studio Code. If you don't have these yet please prepare them first before going forward.`}

\n
\n
    \n
  • \n

    {`First, create a Discordeno Bot using the `}{`Generator Boilerplate`}{`. Give it any name you like. For the purpose of this guide we will call it, Stargate.`}

    \n
  • \n
  • \n

    {`Then `}{`git clone https://github.com/Skillz4Killz/Stargate.git`}

    \n
  • \n
  • \n

    {`When that is done, go ahead and open up the folder with VSC.`}

    \n
  • \n
  • \n

    {`Create a new file called `}{`configs.ts`}{`. Open the `}{`configs.example.ts`}{` file and copy everything over.`}

    \n
  • \n
\n

{`Let's take a minute to review all the options we have available to us.`}

\n

{`Configs File`}

\n

{`The `}{`configs.ts`}{` file is where you will keep all your secret info you don't want to share with anyone else. As long as `}{`.gitignore`}{` file is ignoring configs.ts your configurations will be kept private!`}

\n
{`// Step 1: Remove the \\`.example\\` from this file name so it is called \\`configs.ts\\`\n// Step 2: Add all your bot's information below. The only required one is token and prefix. NOTE: As long as \\`.gitignore\\` file is ignoring configs.ts your configurations will be kept private!\n// Step 3: Remove these comments if you like.\n\nexport const configs = {\n  // Your bot token goes here\n  token: \"\",\n  // The default prefix for your bot. Don't worry guilds can change this later.\n  prefix: \"!\",\n  // This isn't required but you can add bot list api keys here.\n  botListTokens: {\n    DISCORD_BOT_ORG: \"\",\n    BOTS_ON_DISCORD: \"\",\n    DISCORD_BOT_LIST: \"\",\n    BOTS_FOR_DISCORD: \"\",\n    DISCORD_BOATS: \"\",\n    DISCORD_BOTS_GG: \"\",\n    DISCORD_BOTS_GROUP: \"\",\n  },\n  // This is the server id for your bot's main server where users can get help/support\n  supportServerID: \"\",\n  // These are channel ids that will enable some functionality\n  channelIDs: {\n    // When a translation is missing this is the channel you will be alerted in.\n    missingTranslation: \"\",\n    // When an error occurs, we will try and log it to this channel\n    errorChannelID: \"\"\n  },\n  // These are the role ids that will enable some functionality.\n  roleIDs: {\n    // If you have a patreon set up you can add the patreon vip role id here.\n    patreonVIPRoleID: \"\",\n  },\n  // These are the user ids that will enable some functionality.\n  userIDs: {\n    // The user ids for the support team\n    botSupporters: [],\n    // The user ids for the other devs on your team\n    botDevs: [],\n    // The user ids who have complete 100% access to your bot\n    botOwners: []\n  }\n};\n\n`}
\n

{`Token`}

\n

{`First, add your bot token. This is `}{`required`}{` for the bot to start. Review the `}{`instructions`}{` if you have not made your token yet.`}

\n

{`Prefix`}

\n

{`The prefix is where you will set the default prefix for your bot. Don't worry, every server will be able to choose their own prefix but we need a default prefix to start.`}

\n

{`Bot Lists Tokens`}

\n

{`This section of the file is so you can easily have your bot's statistics updated on all the bot lists out there to help you grow your bot. The code is already written to handle this but you will need to do 3 things for each bot list.`}

\n
    \n
  1. {`Go to the bot list and add your bot to their website. (Each site has it's own instructions)`}
  2. \n
  3. {`Create a token for yourself on each website and paste it in your configs.`}
  4. \n
  5. {`Enjoy!`}
  6. \n
\n

{`If you wish to customize the code, you will find the bot list tasks in the tasks folder. Don't worry we will discuss this when we get to the tasks section of the guide.`}

\n

{`For now just remember, that Discordeno provides you a built in way to update most discord bot lists.`}

\n

{`Channel IDs`}

\n

{`The channelIDs section holds the channel IDs that are useful for specific features to help give you alerts/notifications. For example, the `}{`missingTranslation`}{` channel will be where messages are sent alerting you that somewhere in your code you are trying to use a translation key that you never created.`}

\n

{`When you get to around 25,000 Discord servers on your bot, you may want to convert these channel IDs to webhooks.`}

\n

{`Role IDs`}

\n

{`The roleIDs section holds the role IDs that are useful for specific features. For example, the `}{`patreonVIPRoleID`}{` role can be used easily to enable vip features later in this guide. will be where messages are sent alerting you that somewhere in your code you are trying to use a translation key that you never created.`}

\n

{`When you get to around 25,000 Discord servers on your bot, you may want to convert these channel IDs to webhooks.`}

\n

{`It's Alive!`}

\n

{`Oh my god! You now have a bot with a bunch of features already! You don't believe me? Well, seeing is believing, so start the bot.`}

\n
    \n
  1. {`Invite your bot to a discord server.`}
  2. \n
  3. {`Open up the integrated terminal in VSC using `}{`CTRL + \\``}{`. If you use a Mac, replace CTRL with CMD.`}
  4. \n
  5. {`Run the script below:`}
  6. \n
\n
{`deno run --allow-net --allow-read mod.ts\n`}
\n

{`The first time you run it, you may see a lot of files being loaded. This is preparing all the magic behind the scene. Once it is ready, you will see something like this:`}

\n

\n

{`Understanding What Discordeno Did`}

\n

{`Discordeno includes these commands/folders as they are essential for any discord bot to have in order to meet the Discord Bot Best Practices. It also adds a few things that will help make some things easier to build a bot.`}

\n

{`We will dive into these deeper in this guide. Let's take it step by step.`}

\n\n
;\n}\n\n;\nMDXContent.isMDXComponent = true;"}} \ No newline at end of file diff --git a/docs/.cache/caches/gatsby-plugin-mdx/diskstore-72787bc26e4f5cc2b39382ec9008f12b.json b/docs/.cache/caches/gatsby-plugin-mdx/diskstore-72787bc26e4f5cc2b39382ec9008f12b.json new file mode 100644 index 000000000..7521f71cd --- /dev/null +++ b/docs/.cache/caches/gatsby-plugin-mdx/diskstore-72787bc26e4f5cc2b39382ec9008f12b.json @@ -0,0 +1 @@ +{"expireTime":9007200851596802000,"key":"gatsby-plugin-mdx-entire-payload-62f2334fa664579021de55fe62d175ff-","val":{"mdast":{"type":"root","children":[{"type":"paragraph","children":[{"type":"text","value":"Discordeno will help make Discord bot development much easier. Don't worry, as you go through this guide it will make a lot more sense.","position":{"start":{"line":2,"column":1,"offset":1},"end":{"line":2,"column":136,"offset":136},"indent":[]}}],"position":{"start":{"line":2,"column":1,"offset":1},"end":{"line":2,"column":136,"offset":136},"indent":[]}},{"type":"heading","depth":2,"children":[{"type":"text","value":"Creating The Bot!","position":{"start":{"line":4,"column":4,"offset":141},"end":{"line":4,"column":21,"offset":158},"indent":[]}}],"position":{"start":{"line":4,"column":1,"offset":138},"end":{"line":4,"column":21,"offset":158},"indent":[]}},{"type":"blockquote","children":[{"type":"paragraph","children":[{"type":"text","value":"This guide is going to assume you already have the basic requirements to make a bot ready. This includes github, git, a code editor like Visual Studio Code. If you don't have these yet please prepare them first before going forward.","position":{"start":{"line":6,"column":3,"offset":162},"end":{"line":6,"column":235,"offset":394},"indent":[]}}],"position":{"start":{"line":6,"column":3,"offset":162},"end":{"line":6,"column":235,"offset":394},"indent":[]}}],"position":{"start":{"line":6,"column":1,"offset":160},"end":{"line":6,"column":235,"offset":394},"indent":[]}},{"type":"list","ordered":false,"start":null,"spread":true,"children":[{"type":"listItem","spread":false,"checked":null,"children":[{"type":"paragraph","children":[{"type":"text","value":"First, create a Discordeno Bot using the ","position":{"start":{"line":8,"column":3,"offset":398},"end":{"line":8,"column":44,"offset":439},"indent":[]}},{"type":"link","title":null,"url":"https://github.com/Skillz4Killz/Discordeno-bot-template","children":[{"type":"text","value":"Generator Boilerplate","position":{"start":{"line":8,"column":45,"offset":440},"end":{"line":8,"column":66,"offset":461},"indent":[]}}],"position":{"start":{"line":8,"column":44,"offset":439},"end":{"line":8,"column":124,"offset":519},"indent":[]}},{"type":"text","value":". Give it any name you like. For the purpose of this guide we will call it, Stargate.","position":{"start":{"line":8,"column":124,"offset":519},"end":{"line":8,"column":209,"offset":604},"indent":[]}}],"position":{"start":{"line":8,"column":3,"offset":398},"end":{"line":8,"column":209,"offset":604},"indent":[]}}],"position":{"start":{"line":8,"column":1,"offset":396},"end":{"line":9,"column":1,"offset":605},"indent":[1]}},{"type":"listItem","spread":false,"checked":null,"children":[{"type":"paragraph","children":[{"type":"text","value":"Then ","position":{"start":{"line":10,"column":3,"offset":608},"end":{"line":10,"column":8,"offset":613},"indent":[]}},{"type":"inlineCode","value":"git clone https://github.com/Skillz4Killz/Stargate.git","position":{"start":{"line":10,"column":8,"offset":613},"end":{"line":10,"column":64,"offset":669},"indent":[]}}],"position":{"start":{"line":10,"column":3,"offset":608},"end":{"line":10,"column":64,"offset":669},"indent":[]}}],"position":{"start":{"line":10,"column":1,"offset":606},"end":{"line":11,"column":1,"offset":670},"indent":[1]}},{"type":"listItem","spread":false,"checked":null,"children":[{"type":"paragraph","children":[{"type":"text","value":"When that is done, go ahead and open up the folder with VSC.","position":{"start":{"line":12,"column":3,"offset":673},"end":{"line":12,"column":63,"offset":733},"indent":[]}}],"position":{"start":{"line":12,"column":3,"offset":673},"end":{"line":12,"column":63,"offset":733},"indent":[]}}],"position":{"start":{"line":12,"column":1,"offset":671},"end":{"line":12,"column":63,"offset":733},"indent":[]}},{"type":"listItem","spread":false,"checked":null,"children":[{"type":"paragraph","children":[{"type":"text","value":"Create a new file called ","position":{"start":{"line":13,"column":3,"offset":736},"end":{"line":13,"column":28,"offset":761},"indent":[]}},{"type":"inlineCode","value":"configs.ts","position":{"start":{"line":13,"column":28,"offset":761},"end":{"line":13,"column":40,"offset":773},"indent":[]}},{"type":"text","value":". Open the ","position":{"start":{"line":13,"column":40,"offset":773},"end":{"line":13,"column":51,"offset":784},"indent":[]}},{"type":"inlineCode","value":"configs.example.ts","position":{"start":{"line":13,"column":51,"offset":784},"end":{"line":13,"column":71,"offset":804},"indent":[]}},{"type":"text","value":" file and copy everything over.","position":{"start":{"line":13,"column":71,"offset":804},"end":{"line":13,"column":102,"offset":835},"indent":[]}}],"position":{"start":{"line":13,"column":3,"offset":736},"end":{"line":13,"column":102,"offset":835},"indent":[]}}],"position":{"start":{"line":13,"column":1,"offset":734},"end":{"line":13,"column":102,"offset":835},"indent":[]}}],"position":{"start":{"line":8,"column":1,"offset":396},"end":{"line":13,"column":102,"offset":835},"indent":[1,1,1,1,1]}},{"type":"paragraph","children":[{"type":"text","value":"Let's take a minute to review all the options we have available to us.","position":{"start":{"line":15,"column":1,"offset":837},"end":{"line":15,"column":71,"offset":907},"indent":[]}}],"position":{"start":{"line":15,"column":1,"offset":837},"end":{"line":15,"column":71,"offset":907},"indent":[]}},{"type":"heading","depth":3,"children":[{"type":"text","value":"Configs File","position":{"start":{"line":17,"column":5,"offset":913},"end":{"line":17,"column":17,"offset":925},"indent":[]}}],"position":{"start":{"line":17,"column":1,"offset":909},"end":{"line":17,"column":17,"offset":925},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"The ","position":{"start":{"line":19,"column":1,"offset":927},"end":{"line":19,"column":5,"offset":931},"indent":[]}},{"type":"inlineCode","value":"configs.ts","position":{"start":{"line":19,"column":5,"offset":931},"end":{"line":19,"column":17,"offset":943},"indent":[]}},{"type":"text","value":" file is where you will keep all your secret info you don't want to share with anyone else. As long as ","position":{"start":{"line":19,"column":17,"offset":943},"end":{"line":19,"column":120,"offset":1046},"indent":[]}},{"type":"inlineCode","value":".gitignore","position":{"start":{"line":19,"column":120,"offset":1046},"end":{"line":19,"column":132,"offset":1058},"indent":[]}},{"type":"text","value":" file is ignoring configs.ts your configurations will be kept private!","position":{"start":{"line":19,"column":132,"offset":1058},"end":{"line":19,"column":202,"offset":1128},"indent":[]}}],"position":{"start":{"line":19,"column":1,"offset":927},"end":{"line":19,"column":202,"offset":1128},"indent":[]}},{"type":"code","lang":"ts","meta":null,"value":"export const configs = {\n token: \"\",\n prefix: \"!\",\n botListTokens: {\n DISCORD_BOT_ORG: \"\",\n BOTS_ON_DISCORD: \"\",\n DISCORD_BOT_LIST: \"\",\n BOTS_FOR_DISCORD: \"\",\n DISCORD_BOATS: \"\",\n DISCORD_BOTS_GG: \"\",\n DISCORD_BOTS_GROUP: \"\",\n },\n channelIDs: {\n missingTranslation: \"\",\n },\n};","position":{"start":{"line":21,"column":1,"offset":1130},"end":{"line":38,"column":4,"offset":1446},"indent":[1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1]}},{"type":"heading","depth":4,"children":[{"type":"text","value":"Token","position":{"start":{"line":40,"column":6,"offset":1453},"end":{"line":40,"column":11,"offset":1458},"indent":[]}}],"position":{"start":{"line":40,"column":1,"offset":1448},"end":{"line":40,"column":11,"offset":1458},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"First, add your bot token. This is ","position":{"start":{"line":42,"column":1,"offset":1460},"end":{"line":42,"column":36,"offset":1495},"indent":[]}},{"type":"strong","children":[{"type":"text","value":"required","position":{"start":{"line":42,"column":38,"offset":1497},"end":{"line":42,"column":46,"offset":1505},"indent":[]}}],"position":{"start":{"line":42,"column":36,"offset":1495},"end":{"line":42,"column":48,"offset":1507},"indent":[]}},{"type":"text","value":" for the bot to start. Review the ","position":{"start":{"line":42,"column":48,"offset":1507},"end":{"line":42,"column":82,"offset":1541},"indent":[]}},{"type":"link","title":null,"url":"https://discordeno.netlify.app/gettingstarted#creatingyourfirstdiscordbotapplication","children":[{"type":"text","value":"instructions","position":{"start":{"line":42,"column":83,"offset":1542},"end":{"line":42,"column":95,"offset":1554},"indent":[]}}],"position":{"start":{"line":42,"column":82,"offset":1541},"end":{"line":42,"column":182,"offset":1641},"indent":[]}},{"type":"text","value":" if you have not made your token yet.","position":{"start":{"line":42,"column":182,"offset":1641},"end":{"line":42,"column":219,"offset":1678},"indent":[]}}],"position":{"start":{"line":42,"column":1,"offset":1460},"end":{"line":42,"column":219,"offset":1678},"indent":[]}},{"type":"heading","depth":4,"children":[{"type":"text","value":"Prefix","position":{"start":{"line":44,"column":6,"offset":1685},"end":{"line":44,"column":12,"offset":1691},"indent":[]}}],"position":{"start":{"line":44,"column":1,"offset":1680},"end":{"line":44,"column":12,"offset":1691},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"The prefix is where you will set the default prefix for your bot. Don't worry, every server will be able to choose their own prefix but we need a default prefix to start.","position":{"start":{"line":46,"column":1,"offset":1693},"end":{"line":46,"column":171,"offset":1863},"indent":[]}}],"position":{"start":{"line":46,"column":1,"offset":1693},"end":{"line":46,"column":171,"offset":1863},"indent":[]}},{"type":"heading","depth":4,"children":[{"type":"text","value":"Bot Lists Tokens","position":{"start":{"line":48,"column":6,"offset":1870},"end":{"line":48,"column":22,"offset":1886},"indent":[]}}],"position":{"start":{"line":48,"column":1,"offset":1865},"end":{"line":48,"column":22,"offset":1886},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"This section of the file is so you can easily have your bot's statistics updated on all the bot lists out there to help you grow your bot. The code is already written to handle this but you will need to do 3 things for each bot list.","position":{"start":{"line":50,"column":1,"offset":1888},"end":{"line":50,"column":234,"offset":2121},"indent":[]}}],"position":{"start":{"line":50,"column":1,"offset":1888},"end":{"line":50,"column":234,"offset":2121},"indent":[]}},{"type":"list","ordered":true,"start":1,"spread":false,"children":[{"type":"listItem","spread":false,"checked":null,"children":[{"type":"paragraph","children":[{"type":"text","value":"Go to the bot list and add your bot to their website. (Each site has it's own instructions)","position":{"start":{"line":52,"column":4,"offset":2126},"end":{"line":52,"column":95,"offset":2217},"indent":[]}}],"position":{"start":{"line":52,"column":4,"offset":2126},"end":{"line":52,"column":95,"offset":2217},"indent":[]}}],"position":{"start":{"line":52,"column":1,"offset":2123},"end":{"line":52,"column":95,"offset":2217},"indent":[]}},{"type":"listItem","spread":false,"checked":null,"children":[{"type":"paragraph","children":[{"type":"text","value":"Create a token for yourself on each website and paste it in your configs.","position":{"start":{"line":53,"column":4,"offset":2221},"end":{"line":53,"column":77,"offset":2294},"indent":[]}}],"position":{"start":{"line":53,"column":4,"offset":2221},"end":{"line":53,"column":77,"offset":2294},"indent":[]}}],"position":{"start":{"line":53,"column":1,"offset":2218},"end":{"line":53,"column":77,"offset":2294},"indent":[]}},{"type":"listItem","spread":false,"checked":null,"children":[{"type":"paragraph","children":[{"type":"text","value":"Enjoy!","position":{"start":{"line":54,"column":4,"offset":2298},"end":{"line":54,"column":10,"offset":2304},"indent":[]}}],"position":{"start":{"line":54,"column":4,"offset":2298},"end":{"line":54,"column":10,"offset":2304},"indent":[]}}],"position":{"start":{"line":54,"column":1,"offset":2295},"end":{"line":54,"column":10,"offset":2304},"indent":[]}}],"position":{"start":{"line":52,"column":1,"offset":2123},"end":{"line":54,"column":10,"offset":2304},"indent":[1,1]}},{"type":"paragraph","children":[{"type":"text","value":"If you wish to customize the code, you will find the bot list tasks in the tasks folder. Don't worry we will discuss this when we get to the tasks section of the guide.","position":{"start":{"line":56,"column":1,"offset":2306},"end":{"line":56,"column":169,"offset":2474},"indent":[]}}],"position":{"start":{"line":56,"column":1,"offset":2306},"end":{"line":56,"column":169,"offset":2474},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"For now just remember, that Discordeno provides you a built in way to update most discord bot lists.","position":{"start":{"line":58,"column":1,"offset":2476},"end":{"line":58,"column":101,"offset":2576},"indent":[]}}],"position":{"start":{"line":58,"column":1,"offset":2476},"end":{"line":58,"column":101,"offset":2576},"indent":[]}},{"type":"heading","depth":4,"children":[{"type":"text","value":"Channel IDs","position":{"start":{"line":60,"column":6,"offset":2583},"end":{"line":60,"column":17,"offset":2594},"indent":[]}}],"position":{"start":{"line":60,"column":1,"offset":2578},"end":{"line":60,"column":17,"offset":2594},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"The channelIDs section holds the useful for specific features to help give you alerts/notifications. For example, the ","position":{"start":{"line":62,"column":1,"offset":2596},"end":{"line":62,"column":119,"offset":2714},"indent":[]}},{"type":"inlineCode","value":"missingTranslation","position":{"start":{"line":62,"column":119,"offset":2714},"end":{"line":62,"column":139,"offset":2734},"indent":[]}},{"type":"text","value":" channel will be where messages are sent alerting you that somewhere in your code you are trying to use a translation key that you never created.","position":{"start":{"line":62,"column":139,"offset":2734},"end":{"line":62,"column":284,"offset":2879},"indent":[]}}],"position":{"start":{"line":62,"column":1,"offset":2596},"end":{"line":62,"column":284,"offset":2879},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"When you get to around 25,000 Discord servers on your bot, you may want to convert these channel IDs to webhooks.","position":{"start":{"line":64,"column":1,"offset":2881},"end":{"line":64,"column":114,"offset":2994},"indent":[]}}],"position":{"start":{"line":64,"column":1,"offset":2881},"end":{"line":64,"column":114,"offset":2994},"indent":[]}},{"type":"heading","depth":2,"children":[{"type":"text","value":"It's Alive!","position":{"start":{"line":66,"column":4,"offset":2999},"end":{"line":66,"column":15,"offset":3010},"indent":[]}}],"position":{"start":{"line":66,"column":1,"offset":2996},"end":{"line":66,"column":15,"offset":3010},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"Oh my god! You now have a bot with a bunch of features already! You don't believe me? Well, seeing is believing, so start the bot.","position":{"start":{"line":68,"column":1,"offset":3012},"end":{"line":68,"column":131,"offset":3142},"indent":[]}}],"position":{"start":{"line":68,"column":1,"offset":3012},"end":{"line":68,"column":131,"offset":3142},"indent":[]}},{"type":"list","ordered":true,"start":1,"spread":false,"children":[{"type":"listItem","spread":false,"checked":null,"children":[{"type":"paragraph","children":[{"type":"text","value":"Invite your bot to a discord server.","position":{"start":{"line":70,"column":4,"offset":3147},"end":{"line":70,"column":40,"offset":3183},"indent":[]}}],"position":{"start":{"line":70,"column":4,"offset":3147},"end":{"line":70,"column":40,"offset":3183},"indent":[]}}],"position":{"start":{"line":70,"column":1,"offset":3144},"end":{"line":70,"column":40,"offset":3183},"indent":[]}},{"type":"listItem","spread":false,"checked":null,"children":[{"type":"paragraph","children":[{"type":"text","value":"Open up the integrated terminal in VSC using ","position":{"start":{"line":71,"column":4,"offset":3187},"end":{"line":71,"column":49,"offset":3232},"indent":[]}},{"type":"strong","children":[{"type":"text","value":"CTRL + `","position":{"start":{"line":71,"column":51,"offset":3234},"end":{"line":71,"column":59,"offset":3242},"indent":[]}}],"position":{"start":{"line":71,"column":49,"offset":3232},"end":{"line":71,"column":61,"offset":3244},"indent":[]}},{"type":"text","value":". If you use a Mac, replace CTRL with CMD.","position":{"start":{"line":71,"column":61,"offset":3244},"end":{"line":71,"column":103,"offset":3286},"indent":[]}}],"position":{"start":{"line":71,"column":4,"offset":3187},"end":{"line":71,"column":103,"offset":3286},"indent":[]}}],"position":{"start":{"line":71,"column":1,"offset":3184},"end":{"line":71,"column":103,"offset":3286},"indent":[]}},{"type":"listItem","spread":false,"checked":null,"children":[{"type":"paragraph","children":[{"type":"text","value":"Run the script below:","position":{"start":{"line":72,"column":4,"offset":3290},"end":{"line":72,"column":25,"offset":3311},"indent":[]}}],"position":{"start":{"line":72,"column":4,"offset":3290},"end":{"line":72,"column":25,"offset":3311},"indent":[]}}],"position":{"start":{"line":72,"column":1,"offset":3287},"end":{"line":72,"column":25,"offset":3311},"indent":[]}}],"position":{"start":{"line":70,"column":1,"offset":3144},"end":{"line":72,"column":25,"offset":3311},"indent":[1,1]}},{"type":"code","lang":"shell","meta":null,"value":"deno run --allow-net --allow-read mod.ts","position":{"start":{"line":74,"column":1,"offset":3313},"end":{"line":76,"column":4,"offset":3366},"indent":[1,1]}},{"type":"paragraph","children":[{"type":"text","value":"The first time you run it, you may see a lot of files being loaded. This is preparing all the magic behind the scene. Once it is ready, you will see something like this:","position":{"start":{"line":78,"column":1,"offset":3368},"end":{"line":78,"column":170,"offset":3537},"indent":[]}}],"position":{"start":{"line":78,"column":1,"offset":3368},"end":{"line":78,"column":170,"offset":3537},"indent":[]}},{"type":"paragraph","children":[{"type":"image","title":null,"url":"https://i.imgur.com/TOXjLgh.png","alt":"image","position":{"start":{"line":80,"column":1,"offset":3539},"end":{"line":80,"column":42,"offset":3580},"indent":[]}}],"position":{"start":{"line":80,"column":1,"offset":3539},"end":{"line":80,"column":42,"offset":3580},"indent":[]}},{"type":"heading","depth":2,"children":[{"type":"text","value":"Understanding What Discordeno Did","position":{"start":{"line":82,"column":4,"offset":3585},"end":{"line":82,"column":37,"offset":3618},"indent":[]}}],"position":{"start":{"line":82,"column":1,"offset":3582},"end":{"line":82,"column":37,"offset":3618},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"Discordeno includes these commands/folders as they are essential for any discord bot to have in order to meet the Discord Bot Best Practices. It also adds a few things that will help make some things easier to build a bot.","position":{"start":{"line":84,"column":1,"offset":3620},"end":{"line":84,"column":223,"offset":3842},"indent":[]}}],"position":{"start":{"line":84,"column":1,"offset":3620},"end":{"line":84,"column":223,"offset":3842},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"We will dive into these deeper in this guide. Let's take it step by step.","position":{"start":{"line":86,"column":1,"offset":3844},"end":{"line":86,"column":74,"offset":3917},"indent":[]}}],"position":{"start":{"line":86,"column":1,"offset":3844},"end":{"line":86,"column":74,"offset":3917},"indent":[]}},{"type":"export","value":"export const _frontmatter = {\"title\":\"Creating The Bot!\",\"metaTitle\":\"Creating A Bot | Discordeno\",\"metaDescription\":\"Let's create our very own bot with Discordeno!\"}","position":{"start":{"line":89,"column":1,"offset":3920},"end":{"line":89,"column":167,"offset":4086},"indent":[]}}],"position":{"start":{"line":1,"column":1,"offset":0},"end":{"line":89,"column":167,"offset":4086}}},"scopeImports":["import * as React from 'react'"],"scopeIdentifiers":["React"],"body":"function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }\n\nfunction _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }\n\nfunction _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }\n\n/* @jsx mdx */\nvar _frontmatter = {\n \"title\": \"Creating The Bot!\",\n \"metaTitle\": \"Creating A Bot | Discordeno\",\n \"metaDescription\": \"Let's create our very own bot with Discordeno!\"\n};\nvar layoutProps = {\n _frontmatter: _frontmatter\n};\nvar MDXLayout = \"wrapper\";\nreturn function MDXContent(_ref) {\n var components = _ref.components,\n props = _objectWithoutProperties(_ref, [\"components\"]);\n\n return mdx(MDXLayout, _extends({}, layoutProps, props, {\n components: components,\n mdxType: \"MDXLayout\"\n }), mdx(\"p\", null, \"Discordeno will help make Discord bot development much easier. Don't worry, as you go through this guide it will make a lot more sense.\"), mdx(\"h2\", null, \"Creating The Bot!\"), mdx(\"blockquote\", null, mdx(\"p\", {\n parentName: \"blockquote\"\n }, \"This guide is going to assume you already have the basic requirements to make a bot ready. This includes github, git, a code editor like Visual Studio Code. If you don't have these yet please prepare them first before going forward.\")), mdx(\"ul\", null, mdx(\"li\", {\n parentName: \"ul\"\n }, mdx(\"p\", {\n parentName: \"li\"\n }, \"First, create a Discordeno Bot using the \", mdx(\"a\", _extends({\n parentName: \"p\"\n }, {\n \"href\": \"https://github.com/Skillz4Killz/Discordeno-bot-template\"\n }), \"Generator Boilerplate\"), \". Give it any name you like. For the purpose of this guide we will call it, Stargate.\")), mdx(\"li\", {\n parentName: \"ul\"\n }, mdx(\"p\", {\n parentName: \"li\"\n }, \"Then \", mdx(\"inlineCode\", {\n parentName: \"p\"\n }, \"git clone https://github.com/Skillz4Killz/Stargate.git\"))), mdx(\"li\", {\n parentName: \"ul\"\n }, mdx(\"p\", {\n parentName: \"li\"\n }, \"When that is done, go ahead and open up the folder with VSC.\")), mdx(\"li\", {\n parentName: \"ul\"\n }, mdx(\"p\", {\n parentName: \"li\"\n }, \"Create a new file called \", mdx(\"inlineCode\", {\n parentName: \"p\"\n }, \"configs.ts\"), \". Open the \", mdx(\"inlineCode\", {\n parentName: \"p\"\n }, \"configs.example.ts\"), \" file and copy everything over.\"))), mdx(\"p\", null, \"Let's take a minute to review all the options we have available to us.\"), mdx(\"h3\", null, \"Configs File\"), mdx(\"p\", null, \"The \", mdx(\"inlineCode\", {\n parentName: \"p\"\n }, \"configs.ts\"), \" file is where you will keep all your secret info you don't want to share with anyone else. As long as \", mdx(\"inlineCode\", {\n parentName: \"p\"\n }, \".gitignore\"), \" file is ignoring configs.ts your configurations will be kept private!\"), mdx(\"pre\", null, mdx(\"code\", _extends({\n parentName: \"pre\"\n }, {\n \"className\": \"language-ts\"\n }), \"export const configs = {\\n token: \\\"\\\",\\n prefix: \\\"!\\\",\\n botListTokens: {\\n DISCORD_BOT_ORG: \\\"\\\",\\n BOTS_ON_DISCORD: \\\"\\\",\\n DISCORD_BOT_LIST: \\\"\\\",\\n BOTS_FOR_DISCORD: \\\"\\\",\\n DISCORD_BOATS: \\\"\\\",\\n DISCORD_BOTS_GG: \\\"\\\",\\n DISCORD_BOTS_GROUP: \\\"\\\",\\n },\\n channelIDs: {\\n missingTranslation: \\\"\\\",\\n },\\n};\\n\")), mdx(\"h4\", null, \"Token\"), mdx(\"p\", null, \"First, add your bot token. This is \", mdx(\"strong\", {\n parentName: \"p\"\n }, \"required\"), \" for the bot to start. Review the \", mdx(\"a\", _extends({\n parentName: \"p\"\n }, {\n \"href\": \"https://discordeno.netlify.app/gettingstarted#creatingyourfirstdiscordbotapplication\"\n }), \"instructions\"), \" if you have not made your token yet.\"), mdx(\"h4\", null, \"Prefix\"), mdx(\"p\", null, \"The prefix is where you will set the default prefix for your bot. Don't worry, every server will be able to choose their own prefix but we need a default prefix to start.\"), mdx(\"h4\", null, \"Bot Lists Tokens\"), mdx(\"p\", null, \"This section of the file is so you can easily have your bot's statistics updated on all the bot lists out there to help you grow your bot. The code is already written to handle this but you will need to do 3 things for each bot list.\"), mdx(\"ol\", null, mdx(\"li\", {\n parentName: \"ol\"\n }, \"Go to the bot list and add your bot to their website. (Each site has it's own instructions)\"), mdx(\"li\", {\n parentName: \"ol\"\n }, \"Create a token for yourself on each website and paste it in your configs.\"), mdx(\"li\", {\n parentName: \"ol\"\n }, \"Enjoy!\")), mdx(\"p\", null, \"If you wish to customize the code, you will find the bot list tasks in the tasks folder. Don't worry we will discuss this when we get to the tasks section of the guide.\"), mdx(\"p\", null, \"For now just remember, that Discordeno provides you a built in way to update most discord bot lists.\"), mdx(\"h4\", null, \"Channel IDs\"), mdx(\"p\", null, \"The channelIDs section holds the useful for specific features to help give you alerts/notifications. For example, the \", mdx(\"inlineCode\", {\n parentName: \"p\"\n }, \"missingTranslation\"), \" channel will be where messages are sent alerting you that somewhere in your code you are trying to use a translation key that you never created.\"), mdx(\"p\", null, \"When you get to around 25,000 Discord servers on your bot, you may want to convert these channel IDs to webhooks.\"), mdx(\"h2\", null, \"It's Alive!\"), mdx(\"p\", null, \"Oh my god! You now have a bot with a bunch of features already! You don't believe me? Well, seeing is believing, so start the bot.\"), mdx(\"ol\", null, mdx(\"li\", {\n parentName: \"ol\"\n }, \"Invite your bot to a discord server.\"), mdx(\"li\", {\n parentName: \"ol\"\n }, \"Open up the integrated terminal in VSC using \", mdx(\"strong\", {\n parentName: \"li\"\n }, \"CTRL + `\"), \". If you use a Mac, replace CTRL with CMD.\"), mdx(\"li\", {\n parentName: \"ol\"\n }, \"Run the script below:\")), mdx(\"pre\", null, mdx(\"code\", _extends({\n parentName: \"pre\"\n }, {\n \"className\": \"language-shell\"\n }), \"deno run --allow-net --allow-read mod.ts\\n\")), mdx(\"p\", null, \"The first time you run it, you may see a lot of files being loaded. This is preparing all the magic behind the scene. Once it is ready, you will see something like this:\"), mdx(\"p\", null, mdx(\"img\", _extends({\n parentName: \"p\"\n }, {\n \"src\": \"https://i.imgur.com/TOXjLgh.png\",\n \"alt\": \"image\"\n }))), mdx(\"h2\", null, \"Understanding What Discordeno Did\"), mdx(\"p\", null, \"Discordeno includes these commands/folders as they are essential for any discord bot to have in order to meet the Discord Bot Best Practices. It also adds a few things that will help make some things easier to build a bot.\"), mdx(\"p\", null, \"We will dive into these deeper in this guide. Let's take it step by step.\"));\n}\n;\nMDXContent.isMDXComponent = true;","rawMDXOutput":"/* @jsx mdx */\nimport { mdx } from '@mdx-js/react';\n/* @jsx mdx */\n\nexport const _frontmatter = {\n \"title\": \"Creating The Bot!\",\n \"metaTitle\": \"Creating A Bot | Discordeno\",\n \"metaDescription\": \"Let's create our very own bot with Discordeno!\"\n};\n\nconst layoutProps = {\n _frontmatter\n};\nconst MDXLayout = \"wrapper\"\nexport default function MDXContent({\n components,\n ...props\n}) {\n return \n

{`Discordeno will help make Discord bot development much easier. Don't worry, as you go through this guide it will make a lot more sense.`}

\n

{`Creating The Bot!`}

\n
\n

{`This guide is going to assume you already have the basic requirements to make a bot ready. This includes github, git, a code editor like Visual Studio Code. If you don't have these yet please prepare them first before going forward.`}

\n
\n
    \n
  • \n

    {`First, create a Discordeno Bot using the `}{`Generator Boilerplate`}{`. Give it any name you like. For the purpose of this guide we will call it, Stargate.`}

    \n
  • \n
  • \n

    {`Then `}{`git clone https://github.com/Skillz4Killz/Stargate.git`}

    \n
  • \n
  • \n

    {`When that is done, go ahead and open up the folder with VSC.`}

    \n
  • \n
  • \n

    {`Create a new file called `}{`configs.ts`}{`. Open the `}{`configs.example.ts`}{` file and copy everything over.`}

    \n
  • \n
\n

{`Let's take a minute to review all the options we have available to us.`}

\n

{`Configs File`}

\n

{`The `}{`configs.ts`}{` file is where you will keep all your secret info you don't want to share with anyone else. As long as `}{`.gitignore`}{` file is ignoring configs.ts your configurations will be kept private!`}

\n
{`export const configs = {\n  token: \"\",\n  prefix: \"!\",\n  botListTokens: {\n    DISCORD_BOT_ORG: \"\",\n    BOTS_ON_DISCORD: \"\",\n    DISCORD_BOT_LIST: \"\",\n    BOTS_FOR_DISCORD: \"\",\n    DISCORD_BOATS: \"\",\n    DISCORD_BOTS_GG: \"\",\n    DISCORD_BOTS_GROUP: \"\",\n  },\n  channelIDs: {\n    missingTranslation: \"\",\n  },\n};\n`}
\n

{`Token`}

\n

{`First, add your bot token. This is `}{`required`}{` for the bot to start. Review the `}{`instructions`}{` if you have not made your token yet.`}

\n

{`Prefix`}

\n

{`The prefix is where you will set the default prefix for your bot. Don't worry, every server will be able to choose their own prefix but we need a default prefix to start.`}

\n

{`Bot Lists Tokens`}

\n

{`This section of the file is so you can easily have your bot's statistics updated on all the bot lists out there to help you grow your bot. The code is already written to handle this but you will need to do 3 things for each bot list.`}

\n
    \n
  1. {`Go to the bot list and add your bot to their website. (Each site has it's own instructions)`}
  2. \n
  3. {`Create a token for yourself on each website and paste it in your configs.`}
  4. \n
  5. {`Enjoy!`}
  6. \n
\n

{`If you wish to customize the code, you will find the bot list tasks in the tasks folder. Don't worry we will discuss this when we get to the tasks section of the guide.`}

\n

{`For now just remember, that Discordeno provides you a built in way to update most discord bot lists.`}

\n

{`Channel IDs`}

\n

{`The channelIDs section holds the useful for specific features to help give you alerts/notifications. For example, the `}{`missingTranslation`}{` channel will be where messages are sent alerting you that somewhere in your code you are trying to use a translation key that you never created.`}

\n

{`When you get to around 25,000 Discord servers on your bot, you may want to convert these channel IDs to webhooks.`}

\n

{`It's Alive!`}

\n

{`Oh my god! You now have a bot with a bunch of features already! You don't believe me? Well, seeing is believing, so start the bot.`}

\n
    \n
  1. {`Invite your bot to a discord server.`}
  2. \n
  3. {`Open up the integrated terminal in VSC using `}{`CTRL + \\``}{`. If you use a Mac, replace CTRL with CMD.`}
  4. \n
  5. {`Run the script below:`}
  6. \n
\n
{`deno run --allow-net --allow-read mod.ts\n`}
\n

{`The first time you run it, you may see a lot of files being loaded. This is preparing all the magic behind the scene. Once it is ready, you will see something like this:`}

\n

\n

{`Understanding What Discordeno Did`}

\n

{`Discordeno includes these commands/folders as they are essential for any discord bot to have in order to meet the Discord Bot Best Practices. It also adds a few things that will help make some things easier to build a bot.`}

\n

{`We will dive into these deeper in this guide. Let's take it step by step.`}

\n\n
;\n}\n\n;\nMDXContent.isMDXComponent = true;"}} \ No newline at end of file diff --git a/docs/.cache/caches/gatsby-plugin-mdx/diskstore-72acad23a065a02f9da956503f5680a8.json b/docs/.cache/caches/gatsby-plugin-mdx/diskstore-72acad23a065a02f9da956503f5680a8.json new file mode 100644 index 000000000..792d165c3 --- /dev/null +++ b/docs/.cache/caches/gatsby-plugin-mdx/diskstore-72acad23a065a02f9da956503f5680a8.json @@ -0,0 +1 @@ +{"expireTime":9007200851632099000,"key":"gatsby-plugin-mdx-entire-payload-1a04231b77fa64141f51f7e59b2ece66-","val":{"mdast":{"type":"root","children":[{"type":"paragraph","children":[{"type":"text","value":"Woah! You are almost half way done with understanding all of Discordeno. Amazing isn't it? Something you may have noticed in the last section was there were some options that prevented some commands from running like ","position":{"start":{"line":2,"column":1,"offset":1},"end":{"line":2,"column":218,"offset":218},"indent":[]}},{"type":"inlineCode","value":"dmOnly","position":{"start":{"line":2,"column":218,"offset":218},"end":{"line":2,"column":226,"offset":226},"indent":[]}},{"type":"text","value":" or the permission options. we created a setting to prevent the monitor from running in certain channels. What if we wanted to do prevent commands from happening? How would we prevent commands from running?","position":{"start":{"line":2,"column":226,"offset":226},"end":{"line":2,"column":432,"offset":432},"indent":[]}}],"position":{"start":{"line":2,"column":1,"offset":1},"end":{"line":2,"column":432,"offset":432},"indent":[]}},{"type":"heading","depth":2,"children":[{"type":"text","value":"What is an Inhibitor?","position":{"start":{"line":4,"column":4,"offset":437},"end":{"line":4,"column":25,"offset":458},"indent":[]}}],"position":{"start":{"line":4,"column":1,"offset":434},"end":{"line":4,"column":25,"offset":458},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"An Inhibitor is very similar to how monitors work. A monitor runs on every message but an inhibitor runs on every command. Remember all those command options like cooldown, requiredPermissions, permissionLevel, nsfw, requiredSettings, runIn. Each and every one of these options has an inhibitor in Klasa core that checks commands for these settings.\nLet's create our own inhibitor that would prevent commands from being used if the user is not a VIP user.","position":{"start":{"line":6,"column":1,"offset":460},"end":{"line":7,"column":106,"offset":915},"indent":[1]}}],"position":{"start":{"line":6,"column":1,"offset":460},"end":{"line":7,"column":106,"offset":915},"indent":[1]}},{"type":"blockquote","children":[{"type":"paragraph","children":[{"type":"strong","children":[{"type":"text","value":"Note:","position":{"start":{"line":9,"column":5,"offset":921},"end":{"line":9,"column":10,"offset":926},"indent":[]}}],"position":{"start":{"line":9,"column":3,"offset":919},"end":{"line":9,"column":12,"offset":928},"indent":[]}},{"type":"text","value":" It is important to remember that everything below can be done with a simple permission level as well. We will create our own custom permission levels but for the purposes of this guide and to be able to learn about Inhibitors, we will be using an inhibitor.","position":{"start":{"line":9,"column":12,"offset":928},"end":{"line":9,"column":270,"offset":1186},"indent":[]}}],"position":{"start":{"line":9,"column":3,"offset":919},"end":{"line":9,"column":270,"offset":1186},"indent":[]}}],"position":{"start":{"line":9,"column":1,"offset":917},"end":{"line":9,"column":270,"offset":1186},"indent":[]}},{"type":"export","value":"export const _frontmatter = {\"title\":\"Creating Inhibitors!\",\"metaTitle\":\"Creating An Inhibitor | Discordeno\",\"metaDescription\":\"Let's create our very own bot with Discordeno!\"}","position":{"start":{"line":12,"column":1,"offset":1189},"end":{"line":12,"column":177,"offset":1365},"indent":[]}}],"position":{"start":{"line":1,"column":1,"offset":0},"end":{"line":12,"column":177,"offset":1365}}},"scopeImports":["import * as React from 'react'"],"scopeIdentifiers":["React"],"body":"function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }\n\nfunction _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }\n\nfunction _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }\n\n/* @jsx mdx */\nvar _frontmatter = {\n \"title\": \"Creating Inhibitors!\",\n \"metaTitle\": \"Creating An Inhibitor | Discordeno\",\n \"metaDescription\": \"Let's create our very own bot with Discordeno!\"\n};\nvar layoutProps = {\n _frontmatter: _frontmatter\n};\nvar MDXLayout = \"wrapper\";\nreturn function MDXContent(_ref) {\n var components = _ref.components,\n props = _objectWithoutProperties(_ref, [\"components\"]);\n\n return mdx(MDXLayout, _extends({}, layoutProps, props, {\n components: components,\n mdxType: \"MDXLayout\"\n }), mdx(\"p\", null, \"Woah! You are almost half way done with understanding all of Discordeno. Amazing isn't it? Something you may have noticed in the last section was there were some options that prevented some commands from running like \", mdx(\"inlineCode\", {\n parentName: \"p\"\n }, \"dmOnly\"), \" or the permission options. we created a setting to prevent the monitor from running in certain channels. What if we wanted to do prevent commands from happening? How would we prevent commands from running?\"), mdx(\"h2\", null, \"What is an Inhibitor?\"), mdx(\"p\", null, \"An Inhibitor is very similar to how monitors work. A monitor runs on every message but an inhibitor runs on every command. Remember all those command options like cooldown, requiredPermissions, permissionLevel, nsfw, requiredSettings, runIn. Each and every one of these options has an inhibitor in Klasa core that checks commands for these settings.\\nLet's create our own inhibitor that would prevent commands from being used if the user is not a VIP user.\"), mdx(\"blockquote\", null, mdx(\"p\", {\n parentName: \"blockquote\"\n }, mdx(\"strong\", {\n parentName: \"p\"\n }, \"Note:\"), \" It is important to remember that everything below can be done with a simple permission level as well. We will create our own custom permission levels but for the purposes of this guide and to be able to learn about Inhibitors, we will be using an inhibitor.\")));\n}\n;\nMDXContent.isMDXComponent = true;","rawMDXOutput":"/* @jsx mdx */\nimport { mdx } from '@mdx-js/react';\n/* @jsx mdx */\n\nexport const _frontmatter = {\n \"title\": \"Creating Inhibitors!\",\n \"metaTitle\": \"Creating An Inhibitor | Discordeno\",\n \"metaDescription\": \"Let's create our very own bot with Discordeno!\"\n};\n\nconst layoutProps = {\n _frontmatter\n};\nconst MDXLayout = \"wrapper\"\nexport default function MDXContent({\n components,\n ...props\n}) {\n return \n

{`Woah! You are almost half way done with understanding all of Discordeno. Amazing isn't it? Something you may have noticed in the last section was there were some options that prevented some commands from running like `}{`dmOnly`}{` or the permission options. we created a setting to prevent the monitor from running in certain channels. What if we wanted to do prevent commands from happening? How would we prevent commands from running?`}

\n

{`What is an Inhibitor?`}

\n

{`An Inhibitor is very similar to how monitors work. A monitor runs on every message but an inhibitor runs on every command. Remember all those command options like cooldown, requiredPermissions, permissionLevel, nsfw, requiredSettings, runIn. Each and every one of these options has an inhibitor in Klasa core that checks commands for these settings.\nLet's create our own inhibitor that would prevent commands from being used if the user is not a VIP user.`}

\n
\n

{`Note:`}{` It is important to remember that everything below can be done with a simple permission level as well. We will create our own custom permission levels but for the purposes of this guide and to be able to learn about Inhibitors, we will be using an inhibitor.`}

\n
\n\n
;\n}\n\n;\nMDXContent.isMDXComponent = true;"}} \ No newline at end of file diff --git a/docs/.cache/caches/gatsby-plugin-mdx/diskstore-737e99c52ea631b48b570e12d4afe63a.json b/docs/.cache/caches/gatsby-plugin-mdx/diskstore-737e99c52ea631b48b570e12d4afe63a.json new file mode 100644 index 000000000..b5f639b7f --- /dev/null +++ b/docs/.cache/caches/gatsby-plugin-mdx/diskstore-737e99c52ea631b48b570e12d4afe63a.json @@ -0,0 +1 @@ +{"expireTime":9007200851644260000,"key":"gatsby-plugin-mdx-entire-payload-62270ddb3b0528072fb454327db53862-","val":{"mdast":{"type":"root","children":[{"type":"paragraph","children":[{"type":"text","value":"Discordeno will help make Discord bot development much easier. Don't worry, as you go through this guide it will make a lot more sense.","position":{"start":{"line":2,"column":1,"offset":1},"end":{"line":2,"column":136,"offset":136},"indent":[]}}],"position":{"start":{"line":2,"column":1,"offset":1},"end":{"line":2,"column":136,"offset":136},"indent":[]}},{"type":"heading","depth":2,"children":[{"type":"text","value":"Creating The Bot!","position":{"start":{"line":4,"column":4,"offset":141},"end":{"line":4,"column":21,"offset":158},"indent":[]}}],"position":{"start":{"line":4,"column":1,"offset":138},"end":{"line":4,"column":21,"offset":158},"indent":[]}},{"type":"blockquote","children":[{"type":"paragraph","children":[{"type":"text","value":"This guide is going to assume you already have the basic requirements to make a bot ready. This includes github, git, a code editor like Visual Studio Code. If you don't have these yet please prepare them first before going forward.","position":{"start":{"line":6,"column":3,"offset":162},"end":{"line":6,"column":235,"offset":394},"indent":[]}}],"position":{"start":{"line":6,"column":3,"offset":162},"end":{"line":6,"column":235,"offset":394},"indent":[]}}],"position":{"start":{"line":6,"column":1,"offset":160},"end":{"line":6,"column":235,"offset":394},"indent":[]}},{"type":"list","ordered":false,"start":null,"spread":true,"children":[{"type":"listItem","spread":false,"checked":null,"children":[{"type":"paragraph","children":[{"type":"text","value":"First, create a Discordeno Bot using the ","position":{"start":{"line":8,"column":3,"offset":398},"end":{"line":8,"column":44,"offset":439},"indent":[]}},{"type":"link","title":null,"url":"https://github.com/Skillz4Killz/Discordeno-bot-template","children":[{"type":"text","value":"Generator Boilerplate","position":{"start":{"line":8,"column":45,"offset":440},"end":{"line":8,"column":66,"offset":461},"indent":[]}}],"position":{"start":{"line":8,"column":44,"offset":439},"end":{"line":8,"column":124,"offset":519},"indent":[]}},{"type":"text","value":". Give it any name you like. For the purpose of this guide we will call it, Stargate.","position":{"start":{"line":8,"column":124,"offset":519},"end":{"line":8,"column":209,"offset":604},"indent":[]}}],"position":{"start":{"line":8,"column":3,"offset":398},"end":{"line":8,"column":209,"offset":604},"indent":[]}}],"position":{"start":{"line":8,"column":1,"offset":396},"end":{"line":9,"column":1,"offset":605},"indent":[1]}},{"type":"listItem","spread":false,"checked":null,"children":[{"type":"paragraph","children":[{"type":"text","value":"Then ","position":{"start":{"line":10,"column":3,"offset":608},"end":{"line":10,"column":8,"offset":613},"indent":[]}},{"type":"inlineCode","value":"git clone https://github.com/Skillz4Killz/Stargate.git","position":{"start":{"line":10,"column":8,"offset":613},"end":{"line":10,"column":64,"offset":669},"indent":[]}}],"position":{"start":{"line":10,"column":3,"offset":608},"end":{"line":10,"column":64,"offset":669},"indent":[]}}],"position":{"start":{"line":10,"column":1,"offset":606},"end":{"line":11,"column":1,"offset":670},"indent":[1]}},{"type":"listItem","spread":false,"checked":null,"children":[{"type":"paragraph","children":[{"type":"text","value":"When that is done, go ahead and open up the folder with VSC.","position":{"start":{"line":12,"column":3,"offset":673},"end":{"line":12,"column":63,"offset":733},"indent":[]}}],"position":{"start":{"line":12,"column":3,"offset":673},"end":{"line":12,"column":63,"offset":733},"indent":[]}}],"position":{"start":{"line":12,"column":1,"offset":671},"end":{"line":12,"column":63,"offset":733},"indent":[]}},{"type":"listItem","spread":false,"checked":null,"children":[{"type":"paragraph","children":[{"type":"text","value":"Create a new file called ","position":{"start":{"line":13,"column":3,"offset":736},"end":{"line":13,"column":28,"offset":761},"indent":[]}},{"type":"inlineCode","value":"configs.ts","position":{"start":{"line":13,"column":28,"offset":761},"end":{"line":13,"column":40,"offset":773},"indent":[]}},{"type":"text","value":". Open the ","position":{"start":{"line":13,"column":40,"offset":773},"end":{"line":13,"column":51,"offset":784},"indent":[]}},{"type":"inlineCode","value":"configs.example.ts","position":{"start":{"line":13,"column":51,"offset":784},"end":{"line":13,"column":71,"offset":804},"indent":[]}},{"type":"text","value":" file and copy everything over.","position":{"start":{"line":13,"column":71,"offset":804},"end":{"line":13,"column":102,"offset":835},"indent":[]}}],"position":{"start":{"line":13,"column":3,"offset":736},"end":{"line":13,"column":102,"offset":835},"indent":[]}}],"position":{"start":{"line":13,"column":1,"offset":734},"end":{"line":13,"column":102,"offset":835},"indent":[]}}],"position":{"start":{"line":8,"column":1,"offset":396},"end":{"line":13,"column":102,"offset":835},"indent":[1,1,1,1,1]}},{"type":"paragraph","children":[{"type":"text","value":"Let's take a minute to review all the options we have available to us.","position":{"start":{"line":15,"column":1,"offset":837},"end":{"line":15,"column":71,"offset":907},"indent":[]}}],"position":{"start":{"line":15,"column":1,"offset":837},"end":{"line":15,"column":71,"offset":907},"indent":[]}},{"type":"heading","depth":3,"children":[{"type":"text","value":"Configs File","position":{"start":{"line":17,"column":5,"offset":913},"end":{"line":17,"column":17,"offset":925},"indent":[]}}],"position":{"start":{"line":17,"column":1,"offset":909},"end":{"line":17,"column":17,"offset":925},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"The ","position":{"start":{"line":19,"column":1,"offset":927},"end":{"line":19,"column":5,"offset":931},"indent":[]}},{"type":"inlineCode","value":"configs.ts","position":{"start":{"line":19,"column":5,"offset":931},"end":{"line":19,"column":17,"offset":943},"indent":[]}},{"type":"text","value":" file is where you will keep all your secret info you don't want to share with anyone else. As long as ","position":{"start":{"line":19,"column":17,"offset":943},"end":{"line":19,"column":120,"offset":1046},"indent":[]}},{"type":"inlineCode","value":".gitignore","position":{"start":{"line":19,"column":120,"offset":1046},"end":{"line":19,"column":132,"offset":1058},"indent":[]}},{"type":"text","value":" file is ignoring configs.ts your configurations will be kept private!","position":{"start":{"line":19,"column":132,"offset":1058},"end":{"line":19,"column":202,"offset":1128},"indent":[]}}],"position":{"start":{"line":19,"column":1,"offset":927},"end":{"line":19,"column":202,"offset":1128},"indent":[]}},{"type":"code","lang":"ts","meta":null,"value":"// Step 1: Remove the `.example` from this file name so it is called `configs.ts`\n// Step 2: Add all your bot's information below. The only required one is token and prefix. NOTE: As long as `.gitignore` file is ignoring configs.ts your configurations will be kept private!\n// Step 3: Remove these comments if you like.\n\nexport const configs = {\n // Your bot token goes here\n token: \"\",\n // The default prefix for your bot. Don't worry guilds can change this later.\n prefix: \"!\",\n // This isn't required but you can add bot list api keys here.\n botListTokens: {\n DISCORD_BOT_ORG: \"\",\n BOTS_ON_DISCORD: \"\",\n DISCORD_BOT_LIST: \"\",\n BOTS_FOR_DISCORD: \"\",\n DISCORD_BOATS: \"\",\n DISCORD_BOTS_GG: \"\",\n DISCORD_BOTS_GROUP: \"\",\n },\n // This is the server id for your bot's main server where users can get help/support\n supportServerID: \"\",\n // These are channel ids that will enable some functionality\n channelIDs: {\n // When a translation is missing this is the channel you will be alerted in.\n missingTranslation: \"\",\n // When an error occurs, we will try and log it to this channel\n errorChannelID: \"\"\n },\n // These are the role ids that will enable some functionality.\n roleIDs: {\n // If you have a patreon set up you can add the patreon vip role id here.\n patreonVIPRoleID: \"\",\n },\n // These are the user ids that will enable some functionality.\n userIDs: {\n // The user ids for the support team\n botSupporters: [],\n // The user ids for the other devs on your team\n botDevs: [],\n // The user ids who have complete 100% access to your bot\n botOwners: []\n }\n};\n","position":{"start":{"line":21,"column":1,"offset":1130},"end":{"line":66,"column":4,"offset":2770},"indent":[1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1]}},{"type":"heading","depth":4,"children":[{"type":"text","value":"Token","position":{"start":{"line":68,"column":6,"offset":2777},"end":{"line":68,"column":11,"offset":2782},"indent":[]}}],"position":{"start":{"line":68,"column":1,"offset":2772},"end":{"line":68,"column":11,"offset":2782},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"First, add your bot token. This is ","position":{"start":{"line":70,"column":1,"offset":2784},"end":{"line":70,"column":36,"offset":2819},"indent":[]}},{"type":"strong","children":[{"type":"text","value":"required","position":{"start":{"line":70,"column":38,"offset":2821},"end":{"line":70,"column":46,"offset":2829},"indent":[]}}],"position":{"start":{"line":70,"column":36,"offset":2819},"end":{"line":70,"column":48,"offset":2831},"indent":[]}},{"type":"text","value":" for the bot to start. Review the ","position":{"start":{"line":70,"column":48,"offset":2831},"end":{"line":70,"column":82,"offset":2865},"indent":[]}},{"type":"link","title":null,"url":"https://discordeno.netlify.app/gettingstarted#creatingyourfirstdiscordbotapplication","children":[{"type":"text","value":"instructions","position":{"start":{"line":70,"column":83,"offset":2866},"end":{"line":70,"column":95,"offset":2878},"indent":[]}}],"position":{"start":{"line":70,"column":82,"offset":2865},"end":{"line":70,"column":182,"offset":2965},"indent":[]}},{"type":"text","value":" if you have not made your token yet.","position":{"start":{"line":70,"column":182,"offset":2965},"end":{"line":70,"column":219,"offset":3002},"indent":[]}}],"position":{"start":{"line":70,"column":1,"offset":2784},"end":{"line":70,"column":219,"offset":3002},"indent":[]}},{"type":"heading","depth":4,"children":[{"type":"text","value":"Prefix","position":{"start":{"line":72,"column":6,"offset":3009},"end":{"line":72,"column":12,"offset":3015},"indent":[]}}],"position":{"start":{"line":72,"column":1,"offset":3004},"end":{"line":72,"column":12,"offset":3015},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"The prefix is where you will set the default prefix for your bot. Don't worry, every server will be able to choose their own prefix but we need a default prefix to start.","position":{"start":{"line":74,"column":1,"offset":3017},"end":{"line":74,"column":171,"offset":3187},"indent":[]}}],"position":{"start":{"line":74,"column":1,"offset":3017},"end":{"line":74,"column":171,"offset":3187},"indent":[]}},{"type":"heading","depth":4,"children":[{"type":"text","value":"Bot Lists Tokens","position":{"start":{"line":76,"column":6,"offset":3194},"end":{"line":76,"column":22,"offset":3210},"indent":[]}}],"position":{"start":{"line":76,"column":1,"offset":3189},"end":{"line":76,"column":22,"offset":3210},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"This section of the file is so you can easily have your bot's statistics updated on all the bot lists out there to help you grow your bot. The code is already written to handle this but you will need to do 3 things for each bot list.","position":{"start":{"line":78,"column":1,"offset":3212},"end":{"line":78,"column":234,"offset":3445},"indent":[]}}],"position":{"start":{"line":78,"column":1,"offset":3212},"end":{"line":78,"column":234,"offset":3445},"indent":[]}},{"type":"list","ordered":true,"start":1,"spread":false,"children":[{"type":"listItem","spread":false,"checked":null,"children":[{"type":"paragraph","children":[{"type":"text","value":"Go to the bot list and add your bot to their website. (Each site has it's own instructions)","position":{"start":{"line":80,"column":4,"offset":3450},"end":{"line":80,"column":95,"offset":3541},"indent":[]}}],"position":{"start":{"line":80,"column":4,"offset":3450},"end":{"line":80,"column":95,"offset":3541},"indent":[]}}],"position":{"start":{"line":80,"column":1,"offset":3447},"end":{"line":80,"column":95,"offset":3541},"indent":[]}},{"type":"listItem","spread":false,"checked":null,"children":[{"type":"paragraph","children":[{"type":"text","value":"Create a token for yourself on each website and paste it in your configs.","position":{"start":{"line":81,"column":4,"offset":3545},"end":{"line":81,"column":77,"offset":3618},"indent":[]}}],"position":{"start":{"line":81,"column":4,"offset":3545},"end":{"line":81,"column":77,"offset":3618},"indent":[]}}],"position":{"start":{"line":81,"column":1,"offset":3542},"end":{"line":81,"column":77,"offset":3618},"indent":[]}},{"type":"listItem","spread":false,"checked":null,"children":[{"type":"paragraph","children":[{"type":"text","value":"Enjoy!","position":{"start":{"line":82,"column":4,"offset":3622},"end":{"line":82,"column":10,"offset":3628},"indent":[]}}],"position":{"start":{"line":82,"column":4,"offset":3622},"end":{"line":82,"column":10,"offset":3628},"indent":[]}}],"position":{"start":{"line":82,"column":1,"offset":3619},"end":{"line":82,"column":10,"offset":3628},"indent":[]}}],"position":{"start":{"line":80,"column":1,"offset":3447},"end":{"line":82,"column":10,"offset":3628},"indent":[1,1]}},{"type":"paragraph","children":[{"type":"text","value":"If you wish to customize the code, you will find the bot list tasks in the tasks folder. Don't worry we will discuss this when we get to the tasks section of the guide.","position":{"start":{"line":84,"column":1,"offset":3630},"end":{"line":84,"column":169,"offset":3798},"indent":[]}}],"position":{"start":{"line":84,"column":1,"offset":3630},"end":{"line":84,"column":169,"offset":3798},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"For now just remember, that Discordeno provides you a built in way to update most discord bot lists.","position":{"start":{"line":86,"column":1,"offset":3800},"end":{"line":86,"column":101,"offset":3900},"indent":[]}}],"position":{"start":{"line":86,"column":1,"offset":3800},"end":{"line":86,"column":101,"offset":3900},"indent":[]}},{"type":"heading","depth":4,"children":[{"type":"text","value":"Channel IDs","position":{"start":{"line":88,"column":6,"offset":3907},"end":{"line":88,"column":17,"offset":3918},"indent":[]}}],"position":{"start":{"line":88,"column":1,"offset":3902},"end":{"line":88,"column":17,"offset":3918},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"The channelIDs section holds the channel IDs that are useful for specific features to help give you alerts/notifications. For example, the ","position":{"start":{"line":90,"column":1,"offset":3920},"end":{"line":90,"column":140,"offset":4059},"indent":[]}},{"type":"inlineCode","value":"missingTranslation","position":{"start":{"line":90,"column":140,"offset":4059},"end":{"line":90,"column":160,"offset":4079},"indent":[]}},{"type":"text","value":" channel will be where messages are sent alerting you that somewhere in your code you are trying to use a translation key that you never created.","position":{"start":{"line":90,"column":160,"offset":4079},"end":{"line":90,"column":305,"offset":4224},"indent":[]}}],"position":{"start":{"line":90,"column":1,"offset":3920},"end":{"line":90,"column":305,"offset":4224},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"When you get to around 25,000 Discord servers on your bot, you may want to convert these channel IDs to webhooks.","position":{"start":{"line":92,"column":1,"offset":4226},"end":{"line":92,"column":114,"offset":4339},"indent":[]}}],"position":{"start":{"line":92,"column":1,"offset":4226},"end":{"line":92,"column":114,"offset":4339},"indent":[]}},{"type":"heading","depth":4,"children":[{"type":"text","value":"Role IDs","position":{"start":{"line":94,"column":6,"offset":4346},"end":{"line":94,"column":14,"offset":4354},"indent":[]}}],"position":{"start":{"line":94,"column":1,"offset":4341},"end":{"line":94,"column":14,"offset":4354},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"The roleIDs section holds the role IDs that are useful for specific features. For example, the ","position":{"start":{"line":96,"column":1,"offset":4356},"end":{"line":96,"column":96,"offset":4451},"indent":[]}},{"type":"inlineCode","value":"patreonVIPRoleID","position":{"start":{"line":96,"column":96,"offset":4451},"end":{"line":96,"column":114,"offset":4469},"indent":[]}},{"type":"text","value":" role can be used easily to enable vip features later in this guide.","position":{"start":{"line":96,"column":114,"offset":4469},"end":{"line":96,"column":182,"offset":4537},"indent":[]}}],"position":{"start":{"line":96,"column":1,"offset":4356},"end":{"line":96,"column":182,"offset":4537},"indent":[]}},{"type":"heading","depth":4,"children":[{"type":"text","value":"User IDs","position":{"start":{"line":98,"column":6,"offset":4544},"end":{"line":98,"column":14,"offset":4552},"indent":[]}}],"position":{"start":{"line":98,"column":1,"offset":4539},"end":{"line":98,"column":14,"offset":4552},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"The userIDs section holds the user IDs that are useful for specific features to help give you alerts/notifications. For example, the ","position":{"start":{"line":100,"column":1,"offset":4554},"end":{"line":100,"column":134,"offset":4687},"indent":[]}},{"type":"inlineCode","value":"missingTranslation","position":{"start":{"line":100,"column":134,"offset":4687},"end":{"line":100,"column":154,"offset":4707},"indent":[]}},{"type":"text","value":" user will be where messages are sent alerting you that somewhere in your code you are trying to use a translation key that you never created.","position":{"start":{"line":100,"column":154,"offset":4707},"end":{"line":100,"column":296,"offset":4849},"indent":[]}}],"position":{"start":{"line":100,"column":1,"offset":4554},"end":{"line":100,"column":296,"offset":4849},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"When you get to around 25,000 Discord servers on your bot, you may want to convert these user IDs to webhooks.","position":{"start":{"line":102,"column":1,"offset":4851},"end":{"line":102,"column":111,"offset":4961},"indent":[]}}],"position":{"start":{"line":102,"column":1,"offset":4851},"end":{"line":102,"column":111,"offset":4961},"indent":[]}},{"type":"heading","depth":2,"children":[{"type":"text","value":"It's Alive!","position":{"start":{"line":104,"column":4,"offset":4966},"end":{"line":104,"column":15,"offset":4977},"indent":[]}}],"position":{"start":{"line":104,"column":1,"offset":4963},"end":{"line":104,"column":15,"offset":4977},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"Oh my god! You now have a bot with a bunch of features already! You don't believe me? Well, seeing is believing, so start the bot.","position":{"start":{"line":106,"column":1,"offset":4979},"end":{"line":106,"column":131,"offset":5109},"indent":[]}}],"position":{"start":{"line":106,"column":1,"offset":4979},"end":{"line":106,"column":131,"offset":5109},"indent":[]}},{"type":"list","ordered":true,"start":1,"spread":false,"children":[{"type":"listItem","spread":false,"checked":null,"children":[{"type":"paragraph","children":[{"type":"text","value":"Invite your bot to a discord server.","position":{"start":{"line":108,"column":4,"offset":5114},"end":{"line":108,"column":40,"offset":5150},"indent":[]}}],"position":{"start":{"line":108,"column":4,"offset":5114},"end":{"line":108,"column":40,"offset":5150},"indent":[]}}],"position":{"start":{"line":108,"column":1,"offset":5111},"end":{"line":108,"column":40,"offset":5150},"indent":[]}},{"type":"listItem","spread":false,"checked":null,"children":[{"type":"paragraph","children":[{"type":"text","value":"Open up the integrated terminal in VSC using ","position":{"start":{"line":109,"column":4,"offset":5154},"end":{"line":109,"column":49,"offset":5199},"indent":[]}},{"type":"strong","children":[{"type":"text","value":"CTRL + `","position":{"start":{"line":109,"column":51,"offset":5201},"end":{"line":109,"column":59,"offset":5209},"indent":[]}}],"position":{"start":{"line":109,"column":49,"offset":5199},"end":{"line":109,"column":61,"offset":5211},"indent":[]}},{"type":"text","value":". If you use a Mac, replace CTRL with CMD.","position":{"start":{"line":109,"column":61,"offset":5211},"end":{"line":109,"column":103,"offset":5253},"indent":[]}}],"position":{"start":{"line":109,"column":4,"offset":5154},"end":{"line":109,"column":103,"offset":5253},"indent":[]}}],"position":{"start":{"line":109,"column":1,"offset":5151},"end":{"line":109,"column":103,"offset":5253},"indent":[]}},{"type":"listItem","spread":false,"checked":null,"children":[{"type":"paragraph","children":[{"type":"text","value":"Run the script below:","position":{"start":{"line":110,"column":4,"offset":5257},"end":{"line":110,"column":25,"offset":5278},"indent":[]}}],"position":{"start":{"line":110,"column":4,"offset":5257},"end":{"line":110,"column":25,"offset":5278},"indent":[]}}],"position":{"start":{"line":110,"column":1,"offset":5254},"end":{"line":110,"column":25,"offset":5278},"indent":[]}}],"position":{"start":{"line":108,"column":1,"offset":5111},"end":{"line":110,"column":25,"offset":5278},"indent":[1,1]}},{"type":"code","lang":"shell","meta":null,"value":"deno run --allow-net --allow-read mod.ts","position":{"start":{"line":112,"column":1,"offset":5280},"end":{"line":114,"column":4,"offset":5333},"indent":[1,1]}},{"type":"paragraph","children":[{"type":"text","value":"The first time you run it, you may see a lot of files being loaded. This is preparing all the magic behind the scene. Once it is ready, you will see something like this:","position":{"start":{"line":116,"column":1,"offset":5335},"end":{"line":116,"column":170,"offset":5504},"indent":[]}}],"position":{"start":{"line":116,"column":1,"offset":5335},"end":{"line":116,"column":170,"offset":5504},"indent":[]}},{"type":"paragraph","children":[{"type":"image","title":null,"url":"https://i.imgur.com/TOXjLgh.png","alt":"image","position":{"start":{"line":118,"column":1,"offset":5506},"end":{"line":118,"column":42,"offset":5547},"indent":[]}}],"position":{"start":{"line":118,"column":1,"offset":5506},"end":{"line":118,"column":42,"offset":5547},"indent":[]}},{"type":"heading","depth":2,"children":[{"type":"text","value":"Understanding What Discordeno Did","position":{"start":{"line":120,"column":4,"offset":5552},"end":{"line":120,"column":37,"offset":5585},"indent":[]}}],"position":{"start":{"line":120,"column":1,"offset":5549},"end":{"line":120,"column":37,"offset":5585},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"Discordeno includes these commands/folders as they are essential for any discord bot to have in order to meet the Discord Bot Best Practices. It also adds a few things that will help make some things easier to build a bot.","position":{"start":{"line":122,"column":1,"offset":5587},"end":{"line":122,"column":223,"offset":5809},"indent":[]}}],"position":{"start":{"line":122,"column":1,"offset":5587},"end":{"line":122,"column":223,"offset":5809},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"We will dive into these deeper in this guide. Let's take it step by step.","position":{"start":{"line":124,"column":1,"offset":5811},"end":{"line":124,"column":74,"offset":5884},"indent":[]}}],"position":{"start":{"line":124,"column":1,"offset":5811},"end":{"line":124,"column":74,"offset":5884},"indent":[]}},{"type":"export","value":"export const _frontmatter = {\"title\":\"Creating The Bot!\",\"metaTitle\":\"Creating A Bot | Discordeno\",\"metaDescription\":\"Let's create our very own bot with Discordeno!\"}","position":{"start":{"line":127,"column":1,"offset":5887},"end":{"line":127,"column":167,"offset":6053},"indent":[]}}],"position":{"start":{"line":1,"column":1,"offset":0},"end":{"line":127,"column":167,"offset":6053}}},"scopeImports":["import * as React from 'react'"],"scopeIdentifiers":["React"],"body":"function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }\n\nfunction _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }\n\nfunction _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }\n\n/* @jsx mdx */\nvar _frontmatter = {\n \"title\": \"Creating The Bot!\",\n \"metaTitle\": \"Creating A Bot | Discordeno\",\n \"metaDescription\": \"Let's create our very own bot with Discordeno!\"\n};\nvar layoutProps = {\n _frontmatter: _frontmatter\n};\nvar MDXLayout = \"wrapper\";\nreturn function MDXContent(_ref) {\n var components = _ref.components,\n props = _objectWithoutProperties(_ref, [\"components\"]);\n\n return mdx(MDXLayout, _extends({}, layoutProps, props, {\n components: components,\n mdxType: \"MDXLayout\"\n }), mdx(\"p\", null, \"Discordeno will help make Discord bot development much easier. Don't worry, as you go through this guide it will make a lot more sense.\"), mdx(\"h2\", null, \"Creating The Bot!\"), mdx(\"blockquote\", null, mdx(\"p\", {\n parentName: \"blockquote\"\n }, \"This guide is going to assume you already have the basic requirements to make a bot ready. This includes github, git, a code editor like Visual Studio Code. If you don't have these yet please prepare them first before going forward.\")), mdx(\"ul\", null, mdx(\"li\", {\n parentName: \"ul\"\n }, mdx(\"p\", {\n parentName: \"li\"\n }, \"First, create a Discordeno Bot using the \", mdx(\"a\", _extends({\n parentName: \"p\"\n }, {\n \"href\": \"https://github.com/Skillz4Killz/Discordeno-bot-template\"\n }), \"Generator Boilerplate\"), \". Give it any name you like. For the purpose of this guide we will call it, Stargate.\")), mdx(\"li\", {\n parentName: \"ul\"\n }, mdx(\"p\", {\n parentName: \"li\"\n }, \"Then \", mdx(\"inlineCode\", {\n parentName: \"p\"\n }, \"git clone https://github.com/Skillz4Killz/Stargate.git\"))), mdx(\"li\", {\n parentName: \"ul\"\n }, mdx(\"p\", {\n parentName: \"li\"\n }, \"When that is done, go ahead and open up the folder with VSC.\")), mdx(\"li\", {\n parentName: \"ul\"\n }, mdx(\"p\", {\n parentName: \"li\"\n }, \"Create a new file called \", mdx(\"inlineCode\", {\n parentName: \"p\"\n }, \"configs.ts\"), \". Open the \", mdx(\"inlineCode\", {\n parentName: \"p\"\n }, \"configs.example.ts\"), \" file and copy everything over.\"))), mdx(\"p\", null, \"Let's take a minute to review all the options we have available to us.\"), mdx(\"h3\", null, \"Configs File\"), mdx(\"p\", null, \"The \", mdx(\"inlineCode\", {\n parentName: \"p\"\n }, \"configs.ts\"), \" file is where you will keep all your secret info you don't want to share with anyone else. As long as \", mdx(\"inlineCode\", {\n parentName: \"p\"\n }, \".gitignore\"), \" file is ignoring configs.ts your configurations will be kept private!\"), mdx(\"pre\", null, mdx(\"code\", _extends({\n parentName: \"pre\"\n }, {\n \"className\": \"language-ts\"\n }), \"// Step 1: Remove the `.example` from this file name so it is called `configs.ts`\\n// Step 2: Add all your bot's information below. The only required one is token and prefix. NOTE: As long as `.gitignore` file is ignoring configs.ts your configurations will be kept private!\\n// Step 3: Remove these comments if you like.\\n\\nexport const configs = {\\n // Your bot token goes here\\n token: \\\"\\\",\\n // The default prefix for your bot. Don't worry guilds can change this later.\\n prefix: \\\"!\\\",\\n // This isn't required but you can add bot list api keys here.\\n botListTokens: {\\n DISCORD_BOT_ORG: \\\"\\\",\\n BOTS_ON_DISCORD: \\\"\\\",\\n DISCORD_BOT_LIST: \\\"\\\",\\n BOTS_FOR_DISCORD: \\\"\\\",\\n DISCORD_BOATS: \\\"\\\",\\n DISCORD_BOTS_GG: \\\"\\\",\\n DISCORD_BOTS_GROUP: \\\"\\\",\\n },\\n // This is the server id for your bot's main server where users can get help/support\\n supportServerID: \\\"\\\",\\n // These are channel ids that will enable some functionality\\n channelIDs: {\\n // When a translation is missing this is the channel you will be alerted in.\\n missingTranslation: \\\"\\\",\\n // When an error occurs, we will try and log it to this channel\\n errorChannelID: \\\"\\\"\\n },\\n // These are the role ids that will enable some functionality.\\n roleIDs: {\\n // If you have a patreon set up you can add the patreon vip role id here.\\n patreonVIPRoleID: \\\"\\\",\\n },\\n // These are the user ids that will enable some functionality.\\n userIDs: {\\n // The user ids for the support team\\n botSupporters: [],\\n // The user ids for the other devs on your team\\n botDevs: [],\\n // The user ids who have complete 100% access to your bot\\n botOwners: []\\n }\\n};\\n\\n\")), mdx(\"h4\", null, \"Token\"), mdx(\"p\", null, \"First, add your bot token. This is \", mdx(\"strong\", {\n parentName: \"p\"\n }, \"required\"), \" for the bot to start. Review the \", mdx(\"a\", _extends({\n parentName: \"p\"\n }, {\n \"href\": \"https://discordeno.netlify.app/gettingstarted#creatingyourfirstdiscordbotapplication\"\n }), \"instructions\"), \" if you have not made your token yet.\"), mdx(\"h4\", null, \"Prefix\"), mdx(\"p\", null, \"The prefix is where you will set the default prefix for your bot. Don't worry, every server will be able to choose their own prefix but we need a default prefix to start.\"), mdx(\"h4\", null, \"Bot Lists Tokens\"), mdx(\"p\", null, \"This section of the file is so you can easily have your bot's statistics updated on all the bot lists out there to help you grow your bot. The code is already written to handle this but you will need to do 3 things for each bot list.\"), mdx(\"ol\", null, mdx(\"li\", {\n parentName: \"ol\"\n }, \"Go to the bot list and add your bot to their website. (Each site has it's own instructions)\"), mdx(\"li\", {\n parentName: \"ol\"\n }, \"Create a token for yourself on each website and paste it in your configs.\"), mdx(\"li\", {\n parentName: \"ol\"\n }, \"Enjoy!\")), mdx(\"p\", null, \"If you wish to customize the code, you will find the bot list tasks in the tasks folder. Don't worry we will discuss this when we get to the tasks section of the guide.\"), mdx(\"p\", null, \"For now just remember, that Discordeno provides you a built in way to update most discord bot lists.\"), mdx(\"h4\", null, \"Channel IDs\"), mdx(\"p\", null, \"The channelIDs section holds the channel IDs that are useful for specific features to help give you alerts/notifications. For example, the \", mdx(\"inlineCode\", {\n parentName: \"p\"\n }, \"missingTranslation\"), \" channel will be where messages are sent alerting you that somewhere in your code you are trying to use a translation key that you never created.\"), mdx(\"p\", null, \"When you get to around 25,000 Discord servers on your bot, you may want to convert these channel IDs to webhooks.\"), mdx(\"h4\", null, \"Role IDs\"), mdx(\"p\", null, \"The roleIDs section holds the role IDs that are useful for specific features. For example, the \", mdx(\"inlineCode\", {\n parentName: \"p\"\n }, \"patreonVIPRoleID\"), \" role can be used easily to enable vip features later in this guide.\"), mdx(\"h4\", null, \"User IDs\"), mdx(\"p\", null, \"The userIDs section holds the user IDs that are useful for specific features to help give you alerts/notifications. For example, the \", mdx(\"inlineCode\", {\n parentName: \"p\"\n }, \"missingTranslation\"), \" user will be where messages are sent alerting you that somewhere in your code you are trying to use a translation key that you never created.\"), mdx(\"p\", null, \"When you get to around 25,000 Discord servers on your bot, you may want to convert these user IDs to webhooks.\"), mdx(\"h2\", null, \"It's Alive!\"), mdx(\"p\", null, \"Oh my god! You now have a bot with a bunch of features already! You don't believe me? Well, seeing is believing, so start the bot.\"), mdx(\"ol\", null, mdx(\"li\", {\n parentName: \"ol\"\n }, \"Invite your bot to a discord server.\"), mdx(\"li\", {\n parentName: \"ol\"\n }, \"Open up the integrated terminal in VSC using \", mdx(\"strong\", {\n parentName: \"li\"\n }, \"CTRL + `\"), \". If you use a Mac, replace CTRL with CMD.\"), mdx(\"li\", {\n parentName: \"ol\"\n }, \"Run the script below:\")), mdx(\"pre\", null, mdx(\"code\", _extends({\n parentName: \"pre\"\n }, {\n \"className\": \"language-shell\"\n }), \"deno run --allow-net --allow-read mod.ts\\n\")), mdx(\"p\", null, \"The first time you run it, you may see a lot of files being loaded. This is preparing all the magic behind the scene. Once it is ready, you will see something like this:\"), mdx(\"p\", null, mdx(\"img\", _extends({\n parentName: \"p\"\n }, {\n \"src\": \"https://i.imgur.com/TOXjLgh.png\",\n \"alt\": \"image\"\n }))), mdx(\"h2\", null, \"Understanding What Discordeno Did\"), mdx(\"p\", null, \"Discordeno includes these commands/folders as they are essential for any discord bot to have in order to meet the Discord Bot Best Practices. It also adds a few things that will help make some things easier to build a bot.\"), mdx(\"p\", null, \"We will dive into these deeper in this guide. Let's take it step by step.\"));\n}\n;\nMDXContent.isMDXComponent = true;","rawMDXOutput":"/* @jsx mdx */\nimport { mdx } from '@mdx-js/react';\n/* @jsx mdx */\n\nexport const _frontmatter = {\n \"title\": \"Creating The Bot!\",\n \"metaTitle\": \"Creating A Bot | Discordeno\",\n \"metaDescription\": \"Let's create our very own bot with Discordeno!\"\n};\n\nconst layoutProps = {\n _frontmatter\n};\nconst MDXLayout = \"wrapper\"\nexport default function MDXContent({\n components,\n ...props\n}) {\n return \n

{`Discordeno will help make Discord bot development much easier. Don't worry, as you go through this guide it will make a lot more sense.`}

\n

{`Creating The Bot!`}

\n
\n

{`This guide is going to assume you already have the basic requirements to make a bot ready. This includes github, git, a code editor like Visual Studio Code. If you don't have these yet please prepare them first before going forward.`}

\n
\n
    \n
  • \n

    {`First, create a Discordeno Bot using the `}{`Generator Boilerplate`}{`. Give it any name you like. For the purpose of this guide we will call it, Stargate.`}

    \n
  • \n
  • \n

    {`Then `}{`git clone https://github.com/Skillz4Killz/Stargate.git`}

    \n
  • \n
  • \n

    {`When that is done, go ahead and open up the folder with VSC.`}

    \n
  • \n
  • \n

    {`Create a new file called `}{`configs.ts`}{`. Open the `}{`configs.example.ts`}{` file and copy everything over.`}

    \n
  • \n
\n

{`Let's take a minute to review all the options we have available to us.`}

\n

{`Configs File`}

\n

{`The `}{`configs.ts`}{` file is where you will keep all your secret info you don't want to share with anyone else. As long as `}{`.gitignore`}{` file is ignoring configs.ts your configurations will be kept private!`}

\n
{`// Step 1: Remove the \\`.example\\` from this file name so it is called \\`configs.ts\\`\n// Step 2: Add all your bot's information below. The only required one is token and prefix. NOTE: As long as \\`.gitignore\\` file is ignoring configs.ts your configurations will be kept private!\n// Step 3: Remove these comments if you like.\n\nexport const configs = {\n  // Your bot token goes here\n  token: \"\",\n  // The default prefix for your bot. Don't worry guilds can change this later.\n  prefix: \"!\",\n  // This isn't required but you can add bot list api keys here.\n  botListTokens: {\n    DISCORD_BOT_ORG: \"\",\n    BOTS_ON_DISCORD: \"\",\n    DISCORD_BOT_LIST: \"\",\n    BOTS_FOR_DISCORD: \"\",\n    DISCORD_BOATS: \"\",\n    DISCORD_BOTS_GG: \"\",\n    DISCORD_BOTS_GROUP: \"\",\n  },\n  // This is the server id for your bot's main server where users can get help/support\n  supportServerID: \"\",\n  // These are channel ids that will enable some functionality\n  channelIDs: {\n    // When a translation is missing this is the channel you will be alerted in.\n    missingTranslation: \"\",\n    // When an error occurs, we will try and log it to this channel\n    errorChannelID: \"\"\n  },\n  // These are the role ids that will enable some functionality.\n  roleIDs: {\n    // If you have a patreon set up you can add the patreon vip role id here.\n    patreonVIPRoleID: \"\",\n  },\n  // These are the user ids that will enable some functionality.\n  userIDs: {\n    // The user ids for the support team\n    botSupporters: [],\n    // The user ids for the other devs on your team\n    botDevs: [],\n    // The user ids who have complete 100% access to your bot\n    botOwners: []\n  }\n};\n\n`}
\n

{`Token`}

\n

{`First, add your bot token. This is `}{`required`}{` for the bot to start. Review the `}{`instructions`}{` if you have not made your token yet.`}

\n

{`Prefix`}

\n

{`The prefix is where you will set the default prefix for your bot. Don't worry, every server will be able to choose their own prefix but we need a default prefix to start.`}

\n

{`Bot Lists Tokens`}

\n

{`This section of the file is so you can easily have your bot's statistics updated on all the bot lists out there to help you grow your bot. The code is already written to handle this but you will need to do 3 things for each bot list.`}

\n
    \n
  1. {`Go to the bot list and add your bot to their website. (Each site has it's own instructions)`}
  2. \n
  3. {`Create a token for yourself on each website and paste it in your configs.`}
  4. \n
  5. {`Enjoy!`}
  6. \n
\n

{`If you wish to customize the code, you will find the bot list tasks in the tasks folder. Don't worry we will discuss this when we get to the tasks section of the guide.`}

\n

{`For now just remember, that Discordeno provides you a built in way to update most discord bot lists.`}

\n

{`Channel IDs`}

\n

{`The channelIDs section holds the channel IDs that are useful for specific features to help give you alerts/notifications. For example, the `}{`missingTranslation`}{` channel will be where messages are sent alerting you that somewhere in your code you are trying to use a translation key that you never created.`}

\n

{`When you get to around 25,000 Discord servers on your bot, you may want to convert these channel IDs to webhooks.`}

\n

{`Role IDs`}

\n

{`The roleIDs section holds the role IDs that are useful for specific features. For example, the `}{`patreonVIPRoleID`}{` role can be used easily to enable vip features later in this guide.`}

\n

{`User IDs`}

\n

{`The userIDs section holds the user IDs that are useful for specific features to help give you alerts/notifications. For example, the `}{`missingTranslation`}{` user will be where messages are sent alerting you that somewhere in your code you are trying to use a translation key that you never created.`}

\n

{`When you get to around 25,000 Discord servers on your bot, you may want to convert these user IDs to webhooks.`}

\n

{`It's Alive!`}

\n

{`Oh my god! You now have a bot with a bunch of features already! You don't believe me? Well, seeing is believing, so start the bot.`}

\n
    \n
  1. {`Invite your bot to a discord server.`}
  2. \n
  3. {`Open up the integrated terminal in VSC using `}{`CTRL + \\``}{`. If you use a Mac, replace CTRL with CMD.`}
  4. \n
  5. {`Run the script below:`}
  6. \n
\n
{`deno run --allow-net --allow-read mod.ts\n`}
\n

{`The first time you run it, you may see a lot of files being loaded. This is preparing all the magic behind the scene. Once it is ready, you will see something like this:`}

\n

\n

{`Understanding What Discordeno Did`}

\n

{`Discordeno includes these commands/folders as they are essential for any discord bot to have in order to meet the Discord Bot Best Practices. It also adds a few things that will help make some things easier to build a bot.`}

\n

{`We will dive into these deeper in this guide. Let's take it step by step.`}

\n\n
;\n}\n\n;\nMDXContent.isMDXComponent = true;"}} \ No newline at end of file diff --git a/docs/.cache/caches/gatsby-plugin-mdx/diskstore-73e958c154415a617e359a958fdcf8c7.json b/docs/.cache/caches/gatsby-plugin-mdx/diskstore-73e958c154415a617e359a958fdcf8c7.json new file mode 100644 index 000000000..fac020ca2 --- /dev/null +++ b/docs/.cache/caches/gatsby-plugin-mdx/diskstore-73e958c154415a617e359a958fdcf8c7.json @@ -0,0 +1 @@ +{"expireTime":9007200851634790000,"key":"gatsby-plugin-mdx-entire-payload-6318e29c6b7d117812a75e7101aeafc0-","val":{"mdast":{"type":"root","children":[{"type":"paragraph","children":[{"type":"text","value":"Woah! You are almost half way done with understanding all of Discordeno. Amazing isn't it? Something you may have noticed in the last section was there were some options that prevented some commands from running like ","position":{"start":{"line":2,"column":1,"offset":1},"end":{"line":2,"column":218,"offset":218},"indent":[]}},{"type":"inlineCode","value":"dmOnly","position":{"start":{"line":2,"column":218,"offset":218},"end":{"line":2,"column":226,"offset":226},"indent":[]}},{"type":"text","value":" or the permission options. we created a setting to prevent the monitor from running in certain channels. What if we wanted to do prevent commands from happening? How would we prevent commands from running?","position":{"start":{"line":2,"column":226,"offset":226},"end":{"line":2,"column":432,"offset":432},"indent":[]}}],"position":{"start":{"line":2,"column":1,"offset":1},"end":{"line":2,"column":432,"offset":432},"indent":[]}},{"type":"heading","depth":2,"children":[{"type":"text","value":"What is an Inhibitor?","position":{"start":{"line":4,"column":4,"offset":437},"end":{"line":4,"column":25,"offset":458},"indent":[]}}],"position":{"start":{"line":4,"column":1,"offset":434},"end":{"line":4,"column":25,"offset":458},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"An Inhibitor is very similar to how monitors work. A monitor runs on every message but an inhibitor runs on every command. Remember all those command options like cooldown, permissions, permissionLevel, nsfw, etc... Each and every one of these options has an inhibitor in that checks commands for these settings.","position":{"start":{"line":6,"column":1,"offset":460},"end":{"line":6,"column":313,"offset":772},"indent":[]}}],"position":{"start":{"line":6,"column":1,"offset":460},"end":{"line":6,"column":313,"offset":772},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"Let's create our own inhibitor that would prevent commands from being used if the user is not a VIP user.","position":{"start":{"line":8,"column":1,"offset":774},"end":{"line":8,"column":106,"offset":879},"indent":[]}}],"position":{"start":{"line":8,"column":1,"offset":774},"end":{"line":8,"column":106,"offset":879},"indent":[]}},{"type":"blockquote","children":[{"type":"paragraph","children":[{"type":"strong","children":[{"type":"text","value":"Note:","position":{"start":{"line":10,"column":5,"offset":885},"end":{"line":10,"column":10,"offset":890},"indent":[]}}],"position":{"start":{"line":10,"column":3,"offset":883},"end":{"line":10,"column":12,"offset":892},"indent":[]}},{"type":"text","value":" It is important to remember that everything below can be done with a simple permission level as well. We will create our own custom permission levels but for the purposes of this guide and to be able to learn about Inhibitors, we will be using an inhibitor.","position":{"start":{"line":10,"column":12,"offset":892},"end":{"line":10,"column":270,"offset":1150},"indent":[]}}],"position":{"start":{"line":10,"column":3,"offset":883},"end":{"line":10,"column":270,"offset":1150},"indent":[]}}],"position":{"start":{"line":10,"column":1,"offset":881},"end":{"line":10,"column":270,"offset":1150},"indent":[]}},{"type":"heading","depth":2,"children":[{"type":"text","value":"Creating the File","position":{"start":{"line":12,"column":4,"offset":1155},"end":{"line":12,"column":21,"offset":1172},"indent":[]}}],"position":{"start":{"line":12,"column":1,"offset":1152},"end":{"line":12,"column":21,"offset":1172},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"Let's start by creating a file inside the inhibitors folder called ","position":{"start":{"line":14,"column":1,"offset":1174},"end":{"line":14,"column":68,"offset":1241},"indent":[]}},{"type":"inlineCode","value":"boosted.ts","position":{"start":{"line":14,"column":68,"offset":1241},"end":{"line":14,"column":80,"offset":1253},"indent":[]}},{"type":"text","value":" and paste the following snippet of code:","position":{"start":{"line":14,"column":80,"offset":1253},"end":{"line":14,"column":121,"offset":1294},"indent":[]}}],"position":{"start":{"line":14,"column":1,"offset":1174},"end":{"line":14,"column":121,"offset":1294},"indent":[]}},{"type":"code","lang":"ts","meta":null,"value":"import { botCache } from \"../../mod.ts\";\n\nbotCache.inhibitors.set(\"inhibitorname\", async function (message, command, guild) {\n\t// Your code goes here\n});","position":{"start":{"line":16,"column":1,"offset":1296},"end":{"line":22,"column":4,"offset":1459},"indent":[1,1,1,1,1,1]}},{"type":"paragraph","children":[{"type":"text","value":"Inhibitors can take up to 3 arguments.","position":{"start":{"line":24,"column":1,"offset":1461},"end":{"line":24,"column":39,"offset":1499},"indent":[]}}],"position":{"start":{"line":24,"column":1,"offset":1461},"end":{"line":24,"column":39,"offset":1499},"indent":[]}},{"type":"list","ordered":false,"start":null,"spread":false,"children":[{"type":"listItem","spread":false,"checked":null,"children":[{"type":"paragraph","children":[{"type":"inlineCode","value":"message","position":{"start":{"line":26,"column":3,"offset":1503},"end":{"line":26,"column":12,"offset":1512},"indent":[]}},{"type":"text","value":": The message object that triggered the command.","position":{"start":{"line":26,"column":12,"offset":1512},"end":{"line":26,"column":60,"offset":1560},"indent":[]}}],"position":{"start":{"line":26,"column":3,"offset":1503},"end":{"line":26,"column":60,"offset":1560},"indent":[]}}],"position":{"start":{"line":26,"column":1,"offset":1501},"end":{"line":26,"column":60,"offset":1560},"indent":[]}},{"type":"listItem","spread":false,"checked":null,"children":[{"type":"paragraph","children":[{"type":"inlineCode","value":"command","position":{"start":{"line":27,"column":3,"offset":1563},"end":{"line":27,"column":12,"offset":1572},"indent":[]}},{"type":"text","value":": The command object itself that was triggered.","position":{"start":{"line":27,"column":12,"offset":1572},"end":{"line":27,"column":59,"offset":1619},"indent":[]}}],"position":{"start":{"line":27,"column":3,"offset":1563},"end":{"line":27,"column":59,"offset":1619},"indent":[]}}],"position":{"start":{"line":27,"column":1,"offset":1561},"end":{"line":27,"column":59,"offset":1619},"indent":[]}},{"type":"listItem","spread":false,"checked":null,"children":[{"type":"paragraph","children":[{"type":"inlineCode","value":"guild","position":{"start":{"line":28,"column":3,"offset":1622},"end":{"line":28,"column":10,"offset":1629},"indent":[]}},{"type":"text","value":": The server guild object where this command was ran.","position":{"start":{"line":28,"column":10,"offset":1629},"end":{"line":28,"column":63,"offset":1682},"indent":[]}}],"position":{"start":{"line":28,"column":3,"offset":1622},"end":{"line":28,"column":63,"offset":1682},"indent":[]}}],"position":{"start":{"line":28,"column":1,"offset":1620},"end":{"line":28,"column":63,"offset":1682},"indent":[]}}],"position":{"start":{"line":26,"column":1,"offset":1501},"end":{"line":28,"column":63,"offset":1682},"indent":[1,1]}},{"type":"heading","depth":2,"children":[{"type":"text","value":"Understanding How Inhibitors Function","position":{"start":{"line":30,"column":4,"offset":1687},"end":{"line":30,"column":41,"offset":1724},"indent":[]}}],"position":{"start":{"line":30,"column":1,"offset":1684},"end":{"line":30,"column":41,"offset":1724},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"To block a command you have to return a truthy value.","position":{"start":{"line":32,"column":1,"offset":1726},"end":{"line":32,"column":54,"offset":1779},"indent":[]}}],"position":{"start":{"line":32,"column":1,"offset":1726},"end":{"line":32,"column":54,"offset":1779},"indent":[]}},{"type":"list","ordered":false,"start":null,"spread":false,"children":[{"type":"listItem","spread":false,"checked":null,"children":[{"type":"paragraph","children":[{"type":"strong","children":[{"type":"text","value":"return true;","position":{"start":{"line":33,"column":5,"offset":1784},"end":{"line":33,"column":17,"offset":1796},"indent":[]}}],"position":{"start":{"line":33,"column":3,"offset":1782},"end":{"line":33,"column":19,"offset":1798},"indent":[]}},{"type":"text","value":" If you return true the inhibitor will block the execution of the command.\nTo allow a command return a falsey value.","position":{"start":{"line":33,"column":19,"offset":1798},"end":{"line":34,"column":42,"offset":1914},"indent":[1]}}],"position":{"start":{"line":33,"column":3,"offset":1782},"end":{"line":34,"column":42,"offset":1914},"indent":[1]}}],"position":{"start":{"line":33,"column":1,"offset":1780},"end":{"line":34,"column":42,"offset":1914},"indent":[1]}},{"type":"listItem","spread":false,"checked":null,"children":[{"type":"paragraph","children":[{"type":"strong","children":[{"type":"text","value":"return false;","position":{"start":{"line":35,"column":5,"offset":1919},"end":{"line":35,"column":18,"offset":1932},"indent":[]}}],"position":{"start":{"line":35,"column":3,"offset":1917},"end":{"line":35,"column":20,"offset":1934},"indent":[]}},{"type":"text","value":" If you return false the inhibitor will not block the error.","position":{"start":{"line":35,"column":20,"offset":1934},"end":{"line":35,"column":80,"offset":1994},"indent":[]}}],"position":{"start":{"line":35,"column":3,"offset":1917},"end":{"line":35,"column":80,"offset":1994},"indent":[]}}],"position":{"start":{"line":35,"column":1,"offset":1915},"end":{"line":35,"column":80,"offset":1994},"indent":[]}}],"position":{"start":{"line":33,"column":1,"offset":1780},"end":{"line":35,"column":80,"offset":1994},"indent":[1,1]}},{"type":"code","lang":"ts","meta":null,"value":"// If the command is not VIP only we can allow this command to execute\nif (!command.vipOnly) return false;\n\n// The bot's support server\nconst guild = cache.guilds.get(configs.supportServerID);\n// If the command author is not in the server they won't have the vip role\nconst member = guild.members.get(message.author.id) || await getMember(guild.id, message.author.id);\n// Member doesn't exist so cancel the command\nif (!member) {\n\tsendResponse(message, `sorry, but you can not use this command until you become VIP. **Close the IRIS!!!**`)\n\treturn true;\n}\n\n// If the user has the vip role on the support server given by patreon allow the command\nif (member.roles.includes(configs.roleIDs.patreonVIPRoleID)) return false;\n\n// Alert the user they don't have vip and can't use the command\nsendResponse(message, `sorry, but you can not use this command until you become a VIP. I'm sorry, Teal'c. We'll go to Disneyland next year. I promise.`)\n// Cancel the command since the user does not have vip\nreturn true;","position":{"start":{"line":38,"column":1,"offset":1997},"end":{"line":59,"column":4,"offset":3013},"indent":[1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1]}},{"type":"heading","depth":2,"children":[{"type":"text","value":"Challenges","position":{"start":{"line":61,"column":4,"offset":3018},"end":{"line":61,"column":14,"offset":3028},"indent":[]}}],"position":{"start":{"line":61,"column":1,"offset":3015},"end":{"line":61,"column":14,"offset":3028},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"Hell yes! We just got through the entire inhibitor section. You have now mastered everything related to inhibitors.","position":{"start":{"line":63,"column":1,"offset":3030},"end":{"line":63,"column":116,"offset":3145},"indent":[]}}],"position":{"start":{"line":63,"column":1,"offset":3030},"end":{"line":63,"column":116,"offset":3145},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"You can now try and get a little more practice with inhibitors by trying to challenge yourself and make your own inhibitors. Don't worry if you can't think of any good use cases for inhibitors.","position":{"start":{"line":65,"column":1,"offset":3147},"end":{"line":65,"column":194,"offset":3340},"indent":[]}}],"position":{"start":{"line":65,"column":1,"offset":3147},"end":{"line":65,"column":194,"offset":3340},"indent":[]}},{"type":"export","value":"export const _frontmatter = {\"title\":\"Creating Inhibitors!\",\"metaTitle\":\"Creating An Inhibitor | Discordeno\",\"metaDescription\":\"Let's create our very own bot with Discordeno!\"}","position":{"start":{"line":69,"column":1,"offset":3344},"end":{"line":69,"column":177,"offset":3520},"indent":[]}}],"position":{"start":{"line":1,"column":1,"offset":0},"end":{"line":69,"column":177,"offset":3520}}},"scopeImports":["import * as React from 'react'"],"scopeIdentifiers":["React"],"body":"function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }\n\nfunction _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }\n\nfunction _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }\n\n/* @jsx mdx */\nvar _frontmatter = {\n \"title\": \"Creating Inhibitors!\",\n \"metaTitle\": \"Creating An Inhibitor | Discordeno\",\n \"metaDescription\": \"Let's create our very own bot with Discordeno!\"\n};\nvar layoutProps = {\n _frontmatter: _frontmatter\n};\nvar MDXLayout = \"wrapper\";\nreturn function MDXContent(_ref) {\n var components = _ref.components,\n props = _objectWithoutProperties(_ref, [\"components\"]);\n\n return mdx(MDXLayout, _extends({}, layoutProps, props, {\n components: components,\n mdxType: \"MDXLayout\"\n }), mdx(\"p\", null, \"Woah! You are almost half way done with understanding all of Discordeno. Amazing isn't it? Something you may have noticed in the last section was there were some options that prevented some commands from running like \", mdx(\"inlineCode\", {\n parentName: \"p\"\n }, \"dmOnly\"), \" or the permission options. we created a setting to prevent the monitor from running in certain channels. What if we wanted to do prevent commands from happening? How would we prevent commands from running?\"), mdx(\"h2\", null, \"What is an Inhibitor?\"), mdx(\"p\", null, \"An Inhibitor is very similar to how monitors work. A monitor runs on every message but an inhibitor runs on every command. Remember all those command options like cooldown, permissions, permissionLevel, nsfw, etc... Each and every one of these options has an inhibitor in that checks commands for these settings.\"), mdx(\"p\", null, \"Let's create our own inhibitor that would prevent commands from being used if the user is not a VIP user.\"), mdx(\"blockquote\", null, mdx(\"p\", {\n parentName: \"blockquote\"\n }, mdx(\"strong\", {\n parentName: \"p\"\n }, \"Note:\"), \" It is important to remember that everything below can be done with a simple permission level as well. We will create our own custom permission levels but for the purposes of this guide and to be able to learn about Inhibitors, we will be using an inhibitor.\")), mdx(\"h2\", null, \"Creating the File\"), mdx(\"p\", null, \"Let's start by creating a file inside the inhibitors folder called \", mdx(\"inlineCode\", {\n parentName: \"p\"\n }, \"boosted.ts\"), \" and paste the following snippet of code:\"), mdx(\"pre\", null, mdx(\"code\", _extends({\n parentName: \"pre\"\n }, {\n \"className\": \"language-ts\"\n }), \"import { botCache } from \\\"../../mod.ts\\\";\\n\\nbotCache.inhibitors.set(\\\"inhibitorname\\\", async function (message, command, guild) {\\n // Your code goes here\\n});\\n\")), mdx(\"p\", null, \"Inhibitors can take up to 3 arguments.\"), mdx(\"ul\", null, mdx(\"li\", {\n parentName: \"ul\"\n }, mdx(\"inlineCode\", {\n parentName: \"li\"\n }, \"message\"), \": The message object that triggered the command.\"), mdx(\"li\", {\n parentName: \"ul\"\n }, mdx(\"inlineCode\", {\n parentName: \"li\"\n }, \"command\"), \": The command object itself that was triggered.\"), mdx(\"li\", {\n parentName: \"ul\"\n }, mdx(\"inlineCode\", {\n parentName: \"li\"\n }, \"guild\"), \": The server guild object where this command was ran.\")), mdx(\"h2\", null, \"Understanding How Inhibitors Function\"), mdx(\"p\", null, \"To block a command you have to return a truthy value.\"), mdx(\"ul\", null, mdx(\"li\", {\n parentName: \"ul\"\n }, mdx(\"strong\", {\n parentName: \"li\"\n }, \"return true;\"), \" If you return true the inhibitor will block the execution of the command.\\nTo allow a command return a falsey value.\"), mdx(\"li\", {\n parentName: \"ul\"\n }, mdx(\"strong\", {\n parentName: \"li\"\n }, \"return false;\"), \" If you return false the inhibitor will not block the error.\")), mdx(\"pre\", null, mdx(\"code\", _extends({\n parentName: \"pre\"\n }, {\n \"className\": \"language-ts\"\n }), \"// If the command is not VIP only we can allow this command to execute\\nif (!command.vipOnly) return false;\\n\\n// The bot's support server\\nconst guild = cache.guilds.get(configs.supportServerID);\\n// If the command author is not in the server they won't have the vip role\\nconst member = guild.members.get(message.author.id) || await getMember(guild.id, message.author.id);\\n// Member doesn't exist so cancel the command\\nif (!member) {\\n sendResponse(message, `sorry, but you can not use this command until you become VIP. **Close the IRIS!!!**`)\\n return true;\\n}\\n\\n// If the user has the vip role on the support server given by patreon allow the command\\nif (member.roles.includes(configs.roleIDs.patreonVIPRoleID)) return false;\\n\\n// Alert the user they don't have vip and can't use the command\\nsendResponse(message, `sorry, but you can not use this command until you become a VIP. I'm sorry, Teal'c. We'll go to Disneyland next year. I promise.`)\\n// Cancel the command since the user does not have vip\\nreturn true;\\n\")), mdx(\"h2\", null, \"Challenges\"), mdx(\"p\", null, \"Hell yes! We just got through the entire inhibitor section. You have now mastered everything related to inhibitors.\"), mdx(\"p\", null, \"You can now try and get a little more practice with inhibitors by trying to challenge yourself and make your own inhibitors. Don't worry if you can't think of any good use cases for inhibitors.\"));\n}\n;\nMDXContent.isMDXComponent = true;","rawMDXOutput":"/* @jsx mdx */\nimport { mdx } from '@mdx-js/react';\n/* @jsx mdx */\n\nexport const _frontmatter = {\n \"title\": \"Creating Inhibitors!\",\n \"metaTitle\": \"Creating An Inhibitor | Discordeno\",\n \"metaDescription\": \"Let's create our very own bot with Discordeno!\"\n};\n\nconst layoutProps = {\n _frontmatter\n};\nconst MDXLayout = \"wrapper\"\nexport default function MDXContent({\n components,\n ...props\n}) {\n return \n

{`Woah! You are almost half way done with understanding all of Discordeno. Amazing isn't it? Something you may have noticed in the last section was there were some options that prevented some commands from running like `}{`dmOnly`}{` or the permission options. we created a setting to prevent the monitor from running in certain channels. What if we wanted to do prevent commands from happening? How would we prevent commands from running?`}

\n

{`What is an Inhibitor?`}

\n

{`An Inhibitor is very similar to how monitors work. A monitor runs on every message but an inhibitor runs on every command. Remember all those command options like cooldown, permissions, permissionLevel, nsfw, etc... Each and every one of these options has an inhibitor in that checks commands for these settings.`}

\n

{`Let's create our own inhibitor that would prevent commands from being used if the user is not a VIP user.`}

\n
\n

{`Note:`}{` It is important to remember that everything below can be done with a simple permission level as well. We will create our own custom permission levels but for the purposes of this guide and to be able to learn about Inhibitors, we will be using an inhibitor.`}

\n
\n

{`Creating the File`}

\n

{`Let's start by creating a file inside the inhibitors folder called `}{`boosted.ts`}{` and paste the following snippet of code:`}

\n
{`import { botCache } from \"../../mod.ts\";\n\nbotCache.inhibitors.set(\"inhibitorname\", async function (message, command, guild) {\n    // Your code goes here\n});\n`}
\n

{`Inhibitors can take up to 3 arguments.`}

\n
    \n
  • {`message`}{`: The message object that triggered the command.`}
  • \n
  • {`command`}{`: The command object itself that was triggered.`}
  • \n
  • {`guild`}{`: The server guild object where this command was ran.`}
  • \n
\n

{`Understanding How Inhibitors Function`}

\n

{`To block a command you have to return a truthy value.`}

\n
    \n
  • {`return true;`}{` If you return true the inhibitor will block the execution of the command.\nTo allow a command return a falsey value.`}
  • \n
  • {`return false;`}{` If you return false the inhibitor will not block the error.`}
  • \n
\n
{`// If the command is not VIP only we can allow this command to execute\nif (!command.vipOnly) return false;\n\n// The bot's support server\nconst guild = cache.guilds.get(configs.supportServerID);\n// If the command author is not in the server they won't have the vip role\nconst member = guild.members.get(message.author.id) || await getMember(guild.id, message.author.id);\n// Member doesn't exist so cancel the command\nif (!member) {\n    sendResponse(message, \\`sorry, but you can not use this command until you become VIP. **Close the IRIS!!!**\\`)\n    return true;\n}\n\n// If the user has the vip role on the support server given by patreon allow the command\nif (member.roles.includes(configs.roleIDs.patreonVIPRoleID)) return false;\n\n// Alert the user they don't have vip and can't use the command\nsendResponse(message, \\`sorry, but you can not use this command until you become a VIP. I'm sorry, Teal'c. We'll go to Disneyland next year. I promise.\\`)\n// Cancel the command since the user does not have vip\nreturn true;\n`}
\n

{`Challenges`}

\n

{`Hell yes! We just got through the entire inhibitor section. You have now mastered everything related to inhibitors.`}

\n

{`You can now try and get a little more practice with inhibitors by trying to challenge yourself and make your own inhibitors. Don't worry if you can't think of any good use cases for inhibitors.`}

\n\n
;\n}\n\n;\nMDXContent.isMDXComponent = true;"}} \ No newline at end of file diff --git a/docs/.cache/caches/gatsby-plugin-mdx/diskstore-7401ad1aecbbae1ae281022c6350a3bf.json b/docs/.cache/caches/gatsby-plugin-mdx/diskstore-7401ad1aecbbae1ae281022c6350a3bf.json new file mode 100644 index 000000000..2e37aa53f --- /dev/null +++ b/docs/.cache/caches/gatsby-plugin-mdx/diskstore-7401ad1aecbbae1ae281022c6350a3bf.json @@ -0,0 +1 @@ +{"expireTime":9007200851634952000,"key":"gatsby-plugin-mdx-entire-payload-b5e7895a4eb3c703992566ba4256eac9-","val":{"mdast":{"type":"root","children":[{"type":"paragraph","children":[{"type":"text","value":"Woah! You are almost half way done with understanding all of Discordeno. Amazing isn't it? Something you may have noticed in the last section was there were some options that prevented some commands from running like ","position":{"start":{"line":2,"column":1,"offset":1},"end":{"line":2,"column":218,"offset":218},"indent":[]}},{"type":"inlineCode","value":"dmOnly","position":{"start":{"line":2,"column":218,"offset":218},"end":{"line":2,"column":226,"offset":226},"indent":[]}},{"type":"text","value":" or the permission options. we created a setting to prevent the monitor from running in certain channels. What if we wanted to do prevent commands from happening? How would we prevent commands from running?","position":{"start":{"line":2,"column":226,"offset":226},"end":{"line":2,"column":432,"offset":432},"indent":[]}}],"position":{"start":{"line":2,"column":1,"offset":1},"end":{"line":2,"column":432,"offset":432},"indent":[]}},{"type":"heading","depth":2,"children":[{"type":"text","value":"What is an Inhibitor?","position":{"start":{"line":4,"column":4,"offset":437},"end":{"line":4,"column":25,"offset":458},"indent":[]}}],"position":{"start":{"line":4,"column":1,"offset":434},"end":{"line":4,"column":25,"offset":458},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"An Inhibitor is very similar to how monitors work. A monitor runs on every message but an inhibitor runs on every command. Remember all those command options like cooldown, permissions, permissionLevel, nsfw, etc... Each and every one of these options has an inhibitor in that checks commands for these settings.","position":{"start":{"line":6,"column":1,"offset":460},"end":{"line":6,"column":313,"offset":772},"indent":[]}}],"position":{"start":{"line":6,"column":1,"offset":460},"end":{"line":6,"column":313,"offset":772},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"Let's create our own inhibitor that would prevent commands from being used if the user is not a VIP user.","position":{"start":{"line":8,"column":1,"offset":774},"end":{"line":8,"column":106,"offset":879},"indent":[]}}],"position":{"start":{"line":8,"column":1,"offset":774},"end":{"line":8,"column":106,"offset":879},"indent":[]}},{"type":"blockquote","children":[{"type":"paragraph","children":[{"type":"strong","children":[{"type":"text","value":"Note:","position":{"start":{"line":10,"column":5,"offset":885},"end":{"line":10,"column":10,"offset":890},"indent":[]}}],"position":{"start":{"line":10,"column":3,"offset":883},"end":{"line":10,"column":12,"offset":892},"indent":[]}},{"type":"text","value":" It is important to remember that everything below can be done with a simple permission level as well. We will create our own custom permission levels but for the purposes of this guide and to be able to learn about Inhibitors, we will be using an inhibitor.","position":{"start":{"line":10,"column":12,"offset":892},"end":{"line":10,"column":270,"offset":1150},"indent":[]}}],"position":{"start":{"line":10,"column":3,"offset":883},"end":{"line":10,"column":270,"offset":1150},"indent":[]}}],"position":{"start":{"line":10,"column":1,"offset":881},"end":{"line":10,"column":270,"offset":1150},"indent":[]}},{"type":"heading","depth":2,"children":[{"type":"text","value":"Creating the File","position":{"start":{"line":12,"column":4,"offset":1155},"end":{"line":12,"column":21,"offset":1172},"indent":[]}}],"position":{"start":{"line":12,"column":1,"offset":1152},"end":{"line":12,"column":21,"offset":1172},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"Let's start by creating a file inside the inhibitors folder called ","position":{"start":{"line":14,"column":1,"offset":1174},"end":{"line":14,"column":68,"offset":1241},"indent":[]}},{"type":"inlineCode","value":"boosted.ts","position":{"start":{"line":14,"column":68,"offset":1241},"end":{"line":14,"column":80,"offset":1253},"indent":[]}},{"type":"text","value":" and paste the following snippet of code:","position":{"start":{"line":14,"column":80,"offset":1253},"end":{"line":14,"column":121,"offset":1294},"indent":[]}}],"position":{"start":{"line":14,"column":1,"offset":1174},"end":{"line":14,"column":121,"offset":1294},"indent":[]}},{"type":"code","lang":"ts","meta":null,"value":"import { botCache } from \"../../mod.ts\";\n\nbotCache.inhibitors.set(\"inhibitorname\", async function (message, command, guild) {\n\t// Your code goes here\n});","position":{"start":{"line":16,"column":1,"offset":1296},"end":{"line":22,"column":4,"offset":1459},"indent":[1,1,1,1,1,1]}},{"type":"paragraph","children":[{"type":"text","value":"Inhibitors can take up to 3 arguments.","position":{"start":{"line":24,"column":1,"offset":1461},"end":{"line":24,"column":39,"offset":1499},"indent":[]}}],"position":{"start":{"line":24,"column":1,"offset":1461},"end":{"line":24,"column":39,"offset":1499},"indent":[]}},{"type":"list","ordered":false,"start":null,"spread":false,"children":[{"type":"listItem","spread":false,"checked":null,"children":[{"type":"paragraph","children":[{"type":"inlineCode","value":"message","position":{"start":{"line":26,"column":3,"offset":1503},"end":{"line":26,"column":12,"offset":1512},"indent":[]}},{"type":"text","value":": The message object that triggered the command.","position":{"start":{"line":26,"column":12,"offset":1512},"end":{"line":26,"column":60,"offset":1560},"indent":[]}}],"position":{"start":{"line":26,"column":3,"offset":1503},"end":{"line":26,"column":60,"offset":1560},"indent":[]}}],"position":{"start":{"line":26,"column":1,"offset":1501},"end":{"line":26,"column":60,"offset":1560},"indent":[]}},{"type":"listItem","spread":false,"checked":null,"children":[{"type":"paragraph","children":[{"type":"inlineCode","value":"command","position":{"start":{"line":27,"column":3,"offset":1563},"end":{"line":27,"column":12,"offset":1572},"indent":[]}},{"type":"text","value":": The command object itself that was triggered.","position":{"start":{"line":27,"column":12,"offset":1572},"end":{"line":27,"column":59,"offset":1619},"indent":[]}}],"position":{"start":{"line":27,"column":3,"offset":1563},"end":{"line":27,"column":59,"offset":1619},"indent":[]}}],"position":{"start":{"line":27,"column":1,"offset":1561},"end":{"line":27,"column":59,"offset":1619},"indent":[]}},{"type":"listItem","spread":false,"checked":null,"children":[{"type":"paragraph","children":[{"type":"inlineCode","value":"guild","position":{"start":{"line":28,"column":3,"offset":1622},"end":{"line":28,"column":10,"offset":1629},"indent":[]}},{"type":"text","value":": The server guild object where this command was ran.","position":{"start":{"line":28,"column":10,"offset":1629},"end":{"line":28,"column":63,"offset":1682},"indent":[]}}],"position":{"start":{"line":28,"column":3,"offset":1622},"end":{"line":28,"column":63,"offset":1682},"indent":[]}}],"position":{"start":{"line":28,"column":1,"offset":1620},"end":{"line":28,"column":63,"offset":1682},"indent":[]}}],"position":{"start":{"line":26,"column":1,"offset":1501},"end":{"line":28,"column":63,"offset":1682},"indent":[1,1]}},{"type":"heading","depth":2,"children":[{"type":"text","value":"Understanding How Inhibitors Function","position":{"start":{"line":30,"column":4,"offset":1687},"end":{"line":30,"column":41,"offset":1724},"indent":[]}}],"position":{"start":{"line":30,"column":1,"offset":1684},"end":{"line":30,"column":41,"offset":1724},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"To block a command you have to return a truthy value.","position":{"start":{"line":32,"column":1,"offset":1726},"end":{"line":32,"column":54,"offset":1779},"indent":[]}}],"position":{"start":{"line":32,"column":1,"offset":1726},"end":{"line":32,"column":54,"offset":1779},"indent":[]}},{"type":"list","ordered":false,"start":null,"spread":false,"children":[{"type":"listItem","spread":false,"checked":null,"children":[{"type":"paragraph","children":[{"type":"strong","children":[{"type":"text","value":"return true;","position":{"start":{"line":33,"column":5,"offset":1784},"end":{"line":33,"column":17,"offset":1796},"indent":[]}}],"position":{"start":{"line":33,"column":3,"offset":1782},"end":{"line":33,"column":19,"offset":1798},"indent":[]}},{"type":"text","value":" If you return true the inhibitor will block the execution of the command.\nTo allow a command return a falsey value.","position":{"start":{"line":33,"column":19,"offset":1798},"end":{"line":34,"column":42,"offset":1914},"indent":[1]}}],"position":{"start":{"line":33,"column":3,"offset":1782},"end":{"line":34,"column":42,"offset":1914},"indent":[1]}}],"position":{"start":{"line":33,"column":1,"offset":1780},"end":{"line":34,"column":42,"offset":1914},"indent":[1]}},{"type":"listItem","spread":false,"checked":null,"children":[{"type":"paragraph","children":[{"type":"strong","children":[{"type":"text","value":"return false;","position":{"start":{"line":35,"column":5,"offset":1919},"end":{"line":35,"column":18,"offset":1932},"indent":[]}}],"position":{"start":{"line":35,"column":3,"offset":1917},"end":{"line":35,"column":20,"offset":1934},"indent":[]}},{"type":"text","value":" If you return false the inhibitor will not block the error.","position":{"start":{"line":35,"column":20,"offset":1934},"end":{"line":35,"column":80,"offset":1994},"indent":[]}}],"position":{"start":{"line":35,"column":3,"offset":1917},"end":{"line":35,"column":80,"offset":1994},"indent":[]}}],"position":{"start":{"line":35,"column":1,"offset":1915},"end":{"line":35,"column":80,"offset":1994},"indent":[]}}],"position":{"start":{"line":33,"column":1,"offset":1780},"end":{"line":35,"column":80,"offset":1994},"indent":[1,1]}},{"type":"code","lang":"ts","meta":null,"value":"// If the command is not VIP only we can allow this command to execute\nif (!command.vipOnly) return false;\n\n// The bot's support server\nconst guild = cache.guilds.get(configs.supportServerID);\n// If the command author is not in the server they won't have the vip role\nconst member = guild.members.get(message.author.id) || await getMember(guild.id, message.author.id);\n// Member doesn't exist so cancel the command\nif (!member) {\n\tsendResponse(message, `sorry, but you can not use this command until you become VIP. **Close the IRIS!!!**`)\n\treturn true;\n}\n\n// If the user has the vip role on the support server given by patreon allow the command\nif (member.roles.includes(configs.roleIDs.patreonVIPRoleID)) return false;\n\n// Alert the user they don't have vip and can't use the command\nsendResponse(message, `sorry, but you can not use this command until you become a VIP. I'm sorry, Teal'c. We'll go to Disneyland next year. I promise.`)\n// Cancel the command since the user does not have vip\nreturn true;","position":{"start":{"line":38,"column":1,"offset":1997},"end":{"line":59,"column":4,"offset":3013},"indent":[1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1]}},{"type":"heading","depth":2,"children":[{"type":"text","value":"Updating Command Typings","position":{"start":{"line":61,"column":4,"offset":3018},"end":{"line":61,"column":28,"offset":3042},"indent":[]}}],"position":{"start":{"line":61,"column":1,"offset":3015},"end":{"line":61,"column":28,"offset":3042},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"Since we need a new option on our commands we need to add that. Open the ","position":{"start":{"line":63,"column":1,"offset":3044},"end":{"line":63,"column":74,"offset":3117},"indent":[]}},{"type":"inlineCode","value":"src/types/commands.ts","position":{"start":{"line":63,"column":74,"offset":3117},"end":{"line":63,"column":97,"offset":3140},"indent":[]}},{"type":"text","value":" file and add in the following","position":{"start":{"line":63,"column":97,"offset":3140},"end":{"line":63,"column":127,"offset":3170},"indent":[]}}],"position":{"start":{"line":63,"column":1,"offset":3044},"end":{"line":63,"column":127,"offset":3170},"indent":[]}},{"type":"code","lang":"ts","meta":null,"value":" vipOnly?: boolean;","position":{"start":{"line":65,"column":1,"offset":3172},"end":{"line":67,"column":4,"offset":3202},"indent":[1,1]}},{"type":"paragraph","children":[{"type":"text","value":"Once that is added, you can go into any command and mark them as vip only commands.","position":{"start":{"line":69,"column":1,"offset":3204},"end":{"line":69,"column":84,"offset":3287},"indent":[]}}],"position":{"start":{"line":69,"column":1,"offset":3204},"end":{"line":69,"column":84,"offset":3287},"indent":[]}},{"type":"heading","depth":2,"children":[{"type":"text","value":"Challenges","position":{"start":{"line":71,"column":4,"offset":3292},"end":{"line":71,"column":14,"offset":3302},"indent":[]}}],"position":{"start":{"line":71,"column":1,"offset":3289},"end":{"line":71,"column":14,"offset":3302},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"Hell yes! We just got through the entire inhibitor section. You have now mastered everything related to inhibitors.","position":{"start":{"line":73,"column":1,"offset":3304},"end":{"line":73,"column":116,"offset":3419},"indent":[]}}],"position":{"start":{"line":73,"column":1,"offset":3304},"end":{"line":73,"column":116,"offset":3419},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"You can now try and get a little more practice with inhibitors by trying to challenge yourself and make your own inhibitors. Don't worry if you can't think of any good use cases for inhibitors.","position":{"start":{"line":75,"column":1,"offset":3421},"end":{"line":75,"column":194,"offset":3614},"indent":[]}}],"position":{"start":{"line":75,"column":1,"offset":3421},"end":{"line":75,"column":194,"offset":3614},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"Majority of Discordeno bots do not use many custom inhibitors because most of the necessary/important ones already come built for you in the inhibitors folder.","position":{"start":{"line":77,"column":1,"offset":3616},"end":{"line":77,"column":160,"offset":3775},"indent":[]}}],"position":{"start":{"line":77,"column":1,"offset":3616},"end":{"line":77,"column":160,"offset":3775},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"Next we will try our hands at creating a monitor.","position":{"start":{"line":79,"column":1,"offset":3777},"end":{"line":79,"column":50,"offset":3826},"indent":[]}}],"position":{"start":{"line":79,"column":1,"offset":3777},"end":{"line":79,"column":50,"offset":3826},"indent":[]}},{"type":"export","value":"export const _frontmatter = {\"title\":\"Creating Inhibitors!\",\"metaTitle\":\"Creating An Inhibitor | Discordeno\",\"metaDescription\":\"Let's create our very own bot with Discordeno!\"}","position":{"start":{"line":82,"column":1,"offset":3829},"end":{"line":82,"column":177,"offset":4005},"indent":[]}}],"position":{"start":{"line":1,"column":1,"offset":0},"end":{"line":82,"column":177,"offset":4005}}},"scopeImports":["import * as React from 'react'"],"scopeIdentifiers":["React"],"body":"function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }\n\nfunction _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }\n\nfunction _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }\n\n/* @jsx mdx */\nvar _frontmatter = {\n \"title\": \"Creating Inhibitors!\",\n \"metaTitle\": \"Creating An Inhibitor | Discordeno\",\n \"metaDescription\": \"Let's create our very own bot with Discordeno!\"\n};\nvar layoutProps = {\n _frontmatter: _frontmatter\n};\nvar MDXLayout = \"wrapper\";\nreturn function MDXContent(_ref) {\n var components = _ref.components,\n props = _objectWithoutProperties(_ref, [\"components\"]);\n\n return mdx(MDXLayout, _extends({}, layoutProps, props, {\n components: components,\n mdxType: \"MDXLayout\"\n }), mdx(\"p\", null, \"Woah! You are almost half way done with understanding all of Discordeno. Amazing isn't it? Something you may have noticed in the last section was there were some options that prevented some commands from running like \", mdx(\"inlineCode\", {\n parentName: \"p\"\n }, \"dmOnly\"), \" or the permission options. we created a setting to prevent the monitor from running in certain channels. What if we wanted to do prevent commands from happening? How would we prevent commands from running?\"), mdx(\"h2\", null, \"What is an Inhibitor?\"), mdx(\"p\", null, \"An Inhibitor is very similar to how monitors work. A monitor runs on every message but an inhibitor runs on every command. Remember all those command options like cooldown, permissions, permissionLevel, nsfw, etc... Each and every one of these options has an inhibitor in that checks commands for these settings.\"), mdx(\"p\", null, \"Let's create our own inhibitor that would prevent commands from being used if the user is not a VIP user.\"), mdx(\"blockquote\", null, mdx(\"p\", {\n parentName: \"blockquote\"\n }, mdx(\"strong\", {\n parentName: \"p\"\n }, \"Note:\"), \" It is important to remember that everything below can be done with a simple permission level as well. We will create our own custom permission levels but for the purposes of this guide and to be able to learn about Inhibitors, we will be using an inhibitor.\")), mdx(\"h2\", null, \"Creating the File\"), mdx(\"p\", null, \"Let's start by creating a file inside the inhibitors folder called \", mdx(\"inlineCode\", {\n parentName: \"p\"\n }, \"boosted.ts\"), \" and paste the following snippet of code:\"), mdx(\"pre\", null, mdx(\"code\", _extends({\n parentName: \"pre\"\n }, {\n \"className\": \"language-ts\"\n }), \"import { botCache } from \\\"../../mod.ts\\\";\\n\\nbotCache.inhibitors.set(\\\"inhibitorname\\\", async function (message, command, guild) {\\n // Your code goes here\\n});\\n\")), mdx(\"p\", null, \"Inhibitors can take up to 3 arguments.\"), mdx(\"ul\", null, mdx(\"li\", {\n parentName: \"ul\"\n }, mdx(\"inlineCode\", {\n parentName: \"li\"\n }, \"message\"), \": The message object that triggered the command.\"), mdx(\"li\", {\n parentName: \"ul\"\n }, mdx(\"inlineCode\", {\n parentName: \"li\"\n }, \"command\"), \": The command object itself that was triggered.\"), mdx(\"li\", {\n parentName: \"ul\"\n }, mdx(\"inlineCode\", {\n parentName: \"li\"\n }, \"guild\"), \": The server guild object where this command was ran.\")), mdx(\"h2\", null, \"Understanding How Inhibitors Function\"), mdx(\"p\", null, \"To block a command you have to return a truthy value.\"), mdx(\"ul\", null, mdx(\"li\", {\n parentName: \"ul\"\n }, mdx(\"strong\", {\n parentName: \"li\"\n }, \"return true;\"), \" If you return true the inhibitor will block the execution of the command.\\nTo allow a command return a falsey value.\"), mdx(\"li\", {\n parentName: \"ul\"\n }, mdx(\"strong\", {\n parentName: \"li\"\n }, \"return false;\"), \" If you return false the inhibitor will not block the error.\")), mdx(\"pre\", null, mdx(\"code\", _extends({\n parentName: \"pre\"\n }, {\n \"className\": \"language-ts\"\n }), \"// If the command is not VIP only we can allow this command to execute\\nif (!command.vipOnly) return false;\\n\\n// The bot's support server\\nconst guild = cache.guilds.get(configs.supportServerID);\\n// If the command author is not in the server they won't have the vip role\\nconst member = guild.members.get(message.author.id) || await getMember(guild.id, message.author.id);\\n// Member doesn't exist so cancel the command\\nif (!member) {\\n sendResponse(message, `sorry, but you can not use this command until you become VIP. **Close the IRIS!!!**`)\\n return true;\\n}\\n\\n// If the user has the vip role on the support server given by patreon allow the command\\nif (member.roles.includes(configs.roleIDs.patreonVIPRoleID)) return false;\\n\\n// Alert the user they don't have vip and can't use the command\\nsendResponse(message, `sorry, but you can not use this command until you become a VIP. I'm sorry, Teal'c. We'll go to Disneyland next year. I promise.`)\\n// Cancel the command since the user does not have vip\\nreturn true;\\n\")), mdx(\"h2\", null, \"Updating Command Typings\"), mdx(\"p\", null, \"Since we need a new option on our commands we need to add that. Open the \", mdx(\"inlineCode\", {\n parentName: \"p\"\n }, \"src/types/commands.ts\"), \" file and add in the following\"), mdx(\"pre\", null, mdx(\"code\", _extends({\n parentName: \"pre\"\n }, {\n \"className\": \"language-ts\"\n }), \" vipOnly?: boolean;\\n\")), mdx(\"p\", null, \"Once that is added, you can go into any command and mark them as vip only commands.\"), mdx(\"h2\", null, \"Challenges\"), mdx(\"p\", null, \"Hell yes! We just got through the entire inhibitor section. You have now mastered everything related to inhibitors.\"), mdx(\"p\", null, \"You can now try and get a little more practice with inhibitors by trying to challenge yourself and make your own inhibitors. Don't worry if you can't think of any good use cases for inhibitors.\"), mdx(\"p\", null, \"Majority of Discordeno bots do not use many custom inhibitors because most of the necessary/important ones already come built for you in the inhibitors folder.\"), mdx(\"p\", null, \"Next we will try our hands at creating a monitor.\"));\n}\n;\nMDXContent.isMDXComponent = true;","rawMDXOutput":"/* @jsx mdx */\nimport { mdx } from '@mdx-js/react';\n/* @jsx mdx */\n\nexport const _frontmatter = {\n \"title\": \"Creating Inhibitors!\",\n \"metaTitle\": \"Creating An Inhibitor | Discordeno\",\n \"metaDescription\": \"Let's create our very own bot with Discordeno!\"\n};\n\nconst layoutProps = {\n _frontmatter\n};\nconst MDXLayout = \"wrapper\"\nexport default function MDXContent({\n components,\n ...props\n}) {\n return \n

{`Woah! You are almost half way done with understanding all of Discordeno. Amazing isn't it? Something you may have noticed in the last section was there were some options that prevented some commands from running like `}{`dmOnly`}{` or the permission options. we created a setting to prevent the monitor from running in certain channels. What if we wanted to do prevent commands from happening? How would we prevent commands from running?`}

\n

{`What is an Inhibitor?`}

\n

{`An Inhibitor is very similar to how monitors work. A monitor runs on every message but an inhibitor runs on every command. Remember all those command options like cooldown, permissions, permissionLevel, nsfw, etc... Each and every one of these options has an inhibitor in that checks commands for these settings.`}

\n

{`Let's create our own inhibitor that would prevent commands from being used if the user is not a VIP user.`}

\n
\n

{`Note:`}{` It is important to remember that everything below can be done with a simple permission level as well. We will create our own custom permission levels but for the purposes of this guide and to be able to learn about Inhibitors, we will be using an inhibitor.`}

\n
\n

{`Creating the File`}

\n

{`Let's start by creating a file inside the inhibitors folder called `}{`boosted.ts`}{` and paste the following snippet of code:`}

\n
{`import { botCache } from \"../../mod.ts\";\n\nbotCache.inhibitors.set(\"inhibitorname\", async function (message, command, guild) {\n    // Your code goes here\n});\n`}
\n

{`Inhibitors can take up to 3 arguments.`}

\n
    \n
  • {`message`}{`: The message object that triggered the command.`}
  • \n
  • {`command`}{`: The command object itself that was triggered.`}
  • \n
  • {`guild`}{`: The server guild object where this command was ran.`}
  • \n
\n

{`Understanding How Inhibitors Function`}

\n

{`To block a command you have to return a truthy value.`}

\n
    \n
  • {`return true;`}{` If you return true the inhibitor will block the execution of the command.\nTo allow a command return a falsey value.`}
  • \n
  • {`return false;`}{` If you return false the inhibitor will not block the error.`}
  • \n
\n
{`// If the command is not VIP only we can allow this command to execute\nif (!command.vipOnly) return false;\n\n// The bot's support server\nconst guild = cache.guilds.get(configs.supportServerID);\n// If the command author is not in the server they won't have the vip role\nconst member = guild.members.get(message.author.id) || await getMember(guild.id, message.author.id);\n// Member doesn't exist so cancel the command\nif (!member) {\n    sendResponse(message, \\`sorry, but you can not use this command until you become VIP. **Close the IRIS!!!**\\`)\n    return true;\n}\n\n// If the user has the vip role on the support server given by patreon allow the command\nif (member.roles.includes(configs.roleIDs.patreonVIPRoleID)) return false;\n\n// Alert the user they don't have vip and can't use the command\nsendResponse(message, \\`sorry, but you can not use this command until you become a VIP. I'm sorry, Teal'c. We'll go to Disneyland next year. I promise.\\`)\n// Cancel the command since the user does not have vip\nreturn true;\n`}
\n

{`Updating Command Typings`}

\n

{`Since we need a new option on our commands we need to add that. Open the `}{`src/types/commands.ts`}{` file and add in the following`}

\n
{`  vipOnly?: boolean;\n`}
\n

{`Once that is added, you can go into any command and mark them as vip only commands.`}

\n

{`Challenges`}

\n

{`Hell yes! We just got through the entire inhibitor section. You have now mastered everything related to inhibitors.`}

\n

{`You can now try and get a little more practice with inhibitors by trying to challenge yourself and make your own inhibitors. Don't worry if you can't think of any good use cases for inhibitors.`}

\n

{`Majority of Discordeno bots do not use many custom inhibitors because most of the necessary/important ones already come built for you in the inhibitors folder.`}

\n

{`Next we will try our hands at creating a monitor.`}

\n\n
;\n}\n\n;\nMDXContent.isMDXComponent = true;"}} \ No newline at end of file diff --git a/docs/.cache/caches/gatsby-plugin-mdx/diskstore-74119f2cf2b84308129e13bd0d3a7046.json b/docs/.cache/caches/gatsby-plugin-mdx/diskstore-74119f2cf2b84308129e13bd0d3a7046.json new file mode 100644 index 000000000..74f4cff75 --- /dev/null +++ b/docs/.cache/caches/gatsby-plugin-mdx/diskstore-74119f2cf2b84308129e13bd0d3a7046.json @@ -0,0 +1 @@ +{"expireTime":9007200851634834000,"key":"gatsby-plugin-mdx-entire-payload-e4d146943f314d606cec91a1731969ff-","val":{"mdast":{"type":"root","children":[{"type":"paragraph","children":[{"type":"text","value":"Woah! You are almost half way done with understanding all of Discordeno. Amazing isn't it? Something you may have noticed in the last section was there were some options that prevented some commands from running like ","position":{"start":{"line":2,"column":1,"offset":1},"end":{"line":2,"column":218,"offset":218},"indent":[]}},{"type":"inlineCode","value":"dmOnly","position":{"start":{"line":2,"column":218,"offset":218},"end":{"line":2,"column":226,"offset":226},"indent":[]}},{"type":"text","value":" or the permission options. we created a setting to prevent the monitor from running in certain channels. What if we wanted to do prevent commands from happening? How would we prevent commands from running?","position":{"start":{"line":2,"column":226,"offset":226},"end":{"line":2,"column":432,"offset":432},"indent":[]}}],"position":{"start":{"line":2,"column":1,"offset":1},"end":{"line":2,"column":432,"offset":432},"indent":[]}},{"type":"heading","depth":2,"children":[{"type":"text","value":"What is an Inhibitor?","position":{"start":{"line":4,"column":4,"offset":437},"end":{"line":4,"column":25,"offset":458},"indent":[]}}],"position":{"start":{"line":4,"column":1,"offset":434},"end":{"line":4,"column":25,"offset":458},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"An Inhibitor is very similar to how monitors work. A monitor runs on every message but an inhibitor runs on every command. Remember all those command options like cooldown, permissions, permissionLevel, nsfw, etc... Each and every one of these options has an inhibitor in that checks commands for these settings.","position":{"start":{"line":6,"column":1,"offset":460},"end":{"line":6,"column":313,"offset":772},"indent":[]}}],"position":{"start":{"line":6,"column":1,"offset":460},"end":{"line":6,"column":313,"offset":772},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"Let's create our own inhibitor that would prevent commands from being used if the user is not a VIP user.","position":{"start":{"line":8,"column":1,"offset":774},"end":{"line":8,"column":106,"offset":879},"indent":[]}}],"position":{"start":{"line":8,"column":1,"offset":774},"end":{"line":8,"column":106,"offset":879},"indent":[]}},{"type":"blockquote","children":[{"type":"paragraph","children":[{"type":"strong","children":[{"type":"text","value":"Note:","position":{"start":{"line":10,"column":5,"offset":885},"end":{"line":10,"column":10,"offset":890},"indent":[]}}],"position":{"start":{"line":10,"column":3,"offset":883},"end":{"line":10,"column":12,"offset":892},"indent":[]}},{"type":"text","value":" It is important to remember that everything below can be done with a simple permission level as well. We will create our own custom permission levels but for the purposes of this guide and to be able to learn about Inhibitors, we will be using an inhibitor.","position":{"start":{"line":10,"column":12,"offset":892},"end":{"line":10,"column":270,"offset":1150},"indent":[]}}],"position":{"start":{"line":10,"column":3,"offset":883},"end":{"line":10,"column":270,"offset":1150},"indent":[]}}],"position":{"start":{"line":10,"column":1,"offset":881},"end":{"line":10,"column":270,"offset":1150},"indent":[]}},{"type":"heading","depth":2,"children":[{"type":"text","value":"Creating the File","position":{"start":{"line":12,"column":4,"offset":1155},"end":{"line":12,"column":21,"offset":1172},"indent":[]}}],"position":{"start":{"line":12,"column":1,"offset":1152},"end":{"line":12,"column":21,"offset":1172},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"Let's start by creating a file inside the inhibitors folder called ","position":{"start":{"line":14,"column":1,"offset":1174},"end":{"line":14,"column":68,"offset":1241},"indent":[]}},{"type":"inlineCode","value":"boosted.ts","position":{"start":{"line":14,"column":68,"offset":1241},"end":{"line":14,"column":80,"offset":1253},"indent":[]}},{"type":"text","value":" and paste the following snippet of code:","position":{"start":{"line":14,"column":80,"offset":1253},"end":{"line":14,"column":121,"offset":1294},"indent":[]}}],"position":{"start":{"line":14,"column":1,"offset":1174},"end":{"line":14,"column":121,"offset":1294},"indent":[]}},{"type":"code","lang":"ts","meta":null,"value":"import { botCache } from \"../../mod.ts\";\n\nbotCache.inhibitors.set(\"inhibitorname\", async function (message, command, guild) {\n\t// Your code goes here\n});","position":{"start":{"line":16,"column":1,"offset":1296},"end":{"line":22,"column":4,"offset":1459},"indent":[1,1,1,1,1,1]}},{"type":"paragraph","children":[{"type":"text","value":"Inhibitors can take up to 3 arguments.","position":{"start":{"line":24,"column":1,"offset":1461},"end":{"line":24,"column":39,"offset":1499},"indent":[]}}],"position":{"start":{"line":24,"column":1,"offset":1461},"end":{"line":24,"column":39,"offset":1499},"indent":[]}},{"type":"list","ordered":false,"start":null,"spread":false,"children":[{"type":"listItem","spread":false,"checked":null,"children":[{"type":"paragraph","children":[{"type":"inlineCode","value":"message","position":{"start":{"line":26,"column":3,"offset":1503},"end":{"line":26,"column":12,"offset":1512},"indent":[]}},{"type":"text","value":": The message object that triggered the command.","position":{"start":{"line":26,"column":12,"offset":1512},"end":{"line":26,"column":60,"offset":1560},"indent":[]}}],"position":{"start":{"line":26,"column":3,"offset":1503},"end":{"line":26,"column":60,"offset":1560},"indent":[]}}],"position":{"start":{"line":26,"column":1,"offset":1501},"end":{"line":26,"column":60,"offset":1560},"indent":[]}},{"type":"listItem","spread":false,"checked":null,"children":[{"type":"paragraph","children":[{"type":"inlineCode","value":"command","position":{"start":{"line":27,"column":3,"offset":1563},"end":{"line":27,"column":12,"offset":1572},"indent":[]}},{"type":"text","value":": The command object itself that was triggered.","position":{"start":{"line":27,"column":12,"offset":1572},"end":{"line":27,"column":59,"offset":1619},"indent":[]}}],"position":{"start":{"line":27,"column":3,"offset":1563},"end":{"line":27,"column":59,"offset":1619},"indent":[]}}],"position":{"start":{"line":27,"column":1,"offset":1561},"end":{"line":27,"column":59,"offset":1619},"indent":[]}},{"type":"listItem","spread":false,"checked":null,"children":[{"type":"paragraph","children":[{"type":"inlineCode","value":"guild","position":{"start":{"line":28,"column":3,"offset":1622},"end":{"line":28,"column":10,"offset":1629},"indent":[]}},{"type":"text","value":": The server guild object where this command was ran.","position":{"start":{"line":28,"column":10,"offset":1629},"end":{"line":28,"column":63,"offset":1682},"indent":[]}}],"position":{"start":{"line":28,"column":3,"offset":1622},"end":{"line":28,"column":63,"offset":1682},"indent":[]}}],"position":{"start":{"line":28,"column":1,"offset":1620},"end":{"line":28,"column":63,"offset":1682},"indent":[]}}],"position":{"start":{"line":26,"column":1,"offset":1501},"end":{"line":28,"column":63,"offset":1682},"indent":[1,1]}},{"type":"heading","depth":2,"children":[{"type":"text","value":"Understanding How Inhibitors Function","position":{"start":{"line":30,"column":4,"offset":1687},"end":{"line":30,"column":41,"offset":1724},"indent":[]}}],"position":{"start":{"line":30,"column":1,"offset":1684},"end":{"line":30,"column":41,"offset":1724},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"To block a command you have to return a truthy value.","position":{"start":{"line":32,"column":1,"offset":1726},"end":{"line":32,"column":54,"offset":1779},"indent":[]}}],"position":{"start":{"line":32,"column":1,"offset":1726},"end":{"line":32,"column":54,"offset":1779},"indent":[]}},{"type":"list","ordered":false,"start":null,"spread":false,"children":[{"type":"listItem","spread":false,"checked":null,"children":[{"type":"paragraph","children":[{"type":"strong","children":[{"type":"text","value":"return true;","position":{"start":{"line":33,"column":5,"offset":1784},"end":{"line":33,"column":17,"offset":1796},"indent":[]}}],"position":{"start":{"line":33,"column":3,"offset":1782},"end":{"line":33,"column":19,"offset":1798},"indent":[]}},{"type":"text","value":" If you return true the inhibitor will block the execution of the command.\nTo allow a command return a falsey value.","position":{"start":{"line":33,"column":19,"offset":1798},"end":{"line":34,"column":42,"offset":1914},"indent":[1]}}],"position":{"start":{"line":33,"column":3,"offset":1782},"end":{"line":34,"column":42,"offset":1914},"indent":[1]}}],"position":{"start":{"line":33,"column":1,"offset":1780},"end":{"line":34,"column":42,"offset":1914},"indent":[1]}},{"type":"listItem","spread":false,"checked":null,"children":[{"type":"paragraph","children":[{"type":"strong","children":[{"type":"text","value":"return false;","position":{"start":{"line":35,"column":5,"offset":1919},"end":{"line":35,"column":18,"offset":1932},"indent":[]}}],"position":{"start":{"line":35,"column":3,"offset":1917},"end":{"line":35,"column":20,"offset":1934},"indent":[]}},{"type":"text","value":" If you return false the inhibitor will not block the error.","position":{"start":{"line":35,"column":20,"offset":1934},"end":{"line":35,"column":80,"offset":1994},"indent":[]}}],"position":{"start":{"line":35,"column":3,"offset":1917},"end":{"line":35,"column":80,"offset":1994},"indent":[]}}],"position":{"start":{"line":35,"column":1,"offset":1915},"end":{"line":35,"column":80,"offset":1994},"indent":[]}}],"position":{"start":{"line":33,"column":1,"offset":1780},"end":{"line":35,"column":80,"offset":1994},"indent":[1,1]}},{"type":"code","lang":"ts","meta":null,"value":"// If the command is not VIP only we can allow this command to execute\nif (!command.vipOnly) return false;\n\n// The bot's support server\nconst guild = cache.guilds.get(configs.supportServerID);\n// If the command author is not in the server they won't have the vip role\nconst member = guild.members.get(message.author.id) || await getMember(guild.id, message.author.id);\n// Member doesn't exist so cancel the command\nif (!member) {\n\tsendResponse(message, `sorry, but you can not use this command until you become VIP. **Close the IRIS!!!**`)\n\treturn true;\n}\n\n// If the user has the vip role on the support server given by patreon allow the command\nif (member.roles.includes(configs.roleIDs.patreonVIPRoleID)) return false;\n\n// Alert the user they don't have vip and can't use the command\nsendResponse(message, `sorry, but you can not use this command until you become a VIP. I'm sorry, Teal'c. We'll go to Disneyland next year. I promise.`)\n// Cancel the command since the user does not have vip\nreturn true;","position":{"start":{"line":38,"column":1,"offset":1997},"end":{"line":59,"column":4,"offset":3013},"indent":[1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1]}},{"type":"heading","depth":2,"children":[{"type":"text","value":"Challenges","position":{"start":{"line":61,"column":4,"offset":3018},"end":{"line":61,"column":14,"offset":3028},"indent":[]}}],"position":{"start":{"line":61,"column":1,"offset":3015},"end":{"line":61,"column":14,"offset":3028},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"Hell yes! We just got through the entire inhibitor section. You have now mastered everything related to inhibitors.","position":{"start":{"line":63,"column":1,"offset":3030},"end":{"line":63,"column":116,"offset":3145},"indent":[]}}],"position":{"start":{"line":63,"column":1,"offset":3030},"end":{"line":63,"column":116,"offset":3145},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"You can now try and get a little more practice with inhibitors by trying to challenge yourself and make your own inhibitors. Don't worry if you can't think of any good use cases for inhibitors.","position":{"start":{"line":65,"column":1,"offset":3147},"end":{"line":65,"column":194,"offset":3340},"indent":[]}}],"position":{"start":{"line":65,"column":1,"offset":3147},"end":{"line":65,"column":194,"offset":3340},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"Majority of Discordeno bots do not use many custom inhibitors because most of the necessary/important ones already come built for you in the inhibitors folder.","position":{"start":{"line":67,"column":1,"offset":3342},"end":{"line":67,"column":160,"offset":3501},"indent":[]}}],"position":{"start":{"line":67,"column":1,"offset":3342},"end":{"line":67,"column":160,"offset":3501},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"Next we will try our hands ","position":{"start":{"line":69,"column":1,"offset":3503},"end":{"line":69,"column":28,"offset":3530},"indent":[]}}],"position":{"start":{"line":69,"column":1,"offset":3503},"end":{"line":69,"column":28,"offset":3530},"indent":[]}},{"type":"export","value":"export const _frontmatter = {\"title\":\"Creating Inhibitors!\",\"metaTitle\":\"Creating An Inhibitor | Discordeno\",\"metaDescription\":\"Let's create our very own bot with Discordeno!\"}","position":{"start":{"line":72,"column":1,"offset":3533},"end":{"line":72,"column":177,"offset":3709},"indent":[]}}],"position":{"start":{"line":1,"column":1,"offset":0},"end":{"line":72,"column":177,"offset":3709}}},"scopeImports":["import * as React from 'react'"],"scopeIdentifiers":["React"],"body":"function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }\n\nfunction _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }\n\nfunction _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }\n\n/* @jsx mdx */\nvar _frontmatter = {\n \"title\": \"Creating Inhibitors!\",\n \"metaTitle\": \"Creating An Inhibitor | Discordeno\",\n \"metaDescription\": \"Let's create our very own bot with Discordeno!\"\n};\nvar layoutProps = {\n _frontmatter: _frontmatter\n};\nvar MDXLayout = \"wrapper\";\nreturn function MDXContent(_ref) {\n var components = _ref.components,\n props = _objectWithoutProperties(_ref, [\"components\"]);\n\n return mdx(MDXLayout, _extends({}, layoutProps, props, {\n components: components,\n mdxType: \"MDXLayout\"\n }), mdx(\"p\", null, \"Woah! You are almost half way done with understanding all of Discordeno. Amazing isn't it? Something you may have noticed in the last section was there were some options that prevented some commands from running like \", mdx(\"inlineCode\", {\n parentName: \"p\"\n }, \"dmOnly\"), \" or the permission options. we created a setting to prevent the monitor from running in certain channels. What if we wanted to do prevent commands from happening? How would we prevent commands from running?\"), mdx(\"h2\", null, \"What is an Inhibitor?\"), mdx(\"p\", null, \"An Inhibitor is very similar to how monitors work. A monitor runs on every message but an inhibitor runs on every command. Remember all those command options like cooldown, permissions, permissionLevel, nsfw, etc... Each and every one of these options has an inhibitor in that checks commands for these settings.\"), mdx(\"p\", null, \"Let's create our own inhibitor that would prevent commands from being used if the user is not a VIP user.\"), mdx(\"blockquote\", null, mdx(\"p\", {\n parentName: \"blockquote\"\n }, mdx(\"strong\", {\n parentName: \"p\"\n }, \"Note:\"), \" It is important to remember that everything below can be done with a simple permission level as well. We will create our own custom permission levels but for the purposes of this guide and to be able to learn about Inhibitors, we will be using an inhibitor.\")), mdx(\"h2\", null, \"Creating the File\"), mdx(\"p\", null, \"Let's start by creating a file inside the inhibitors folder called \", mdx(\"inlineCode\", {\n parentName: \"p\"\n }, \"boosted.ts\"), \" and paste the following snippet of code:\"), mdx(\"pre\", null, mdx(\"code\", _extends({\n parentName: \"pre\"\n }, {\n \"className\": \"language-ts\"\n }), \"import { botCache } from \\\"../../mod.ts\\\";\\n\\nbotCache.inhibitors.set(\\\"inhibitorname\\\", async function (message, command, guild) {\\n // Your code goes here\\n});\\n\")), mdx(\"p\", null, \"Inhibitors can take up to 3 arguments.\"), mdx(\"ul\", null, mdx(\"li\", {\n parentName: \"ul\"\n }, mdx(\"inlineCode\", {\n parentName: \"li\"\n }, \"message\"), \": The message object that triggered the command.\"), mdx(\"li\", {\n parentName: \"ul\"\n }, mdx(\"inlineCode\", {\n parentName: \"li\"\n }, \"command\"), \": The command object itself that was triggered.\"), mdx(\"li\", {\n parentName: \"ul\"\n }, mdx(\"inlineCode\", {\n parentName: \"li\"\n }, \"guild\"), \": The server guild object where this command was ran.\")), mdx(\"h2\", null, \"Understanding How Inhibitors Function\"), mdx(\"p\", null, \"To block a command you have to return a truthy value.\"), mdx(\"ul\", null, mdx(\"li\", {\n parentName: \"ul\"\n }, mdx(\"strong\", {\n parentName: \"li\"\n }, \"return true;\"), \" If you return true the inhibitor will block the execution of the command.\\nTo allow a command return a falsey value.\"), mdx(\"li\", {\n parentName: \"ul\"\n }, mdx(\"strong\", {\n parentName: \"li\"\n }, \"return false;\"), \" If you return false the inhibitor will not block the error.\")), mdx(\"pre\", null, mdx(\"code\", _extends({\n parentName: \"pre\"\n }, {\n \"className\": \"language-ts\"\n }), \"// If the command is not VIP only we can allow this command to execute\\nif (!command.vipOnly) return false;\\n\\n// The bot's support server\\nconst guild = cache.guilds.get(configs.supportServerID);\\n// If the command author is not in the server they won't have the vip role\\nconst member = guild.members.get(message.author.id) || await getMember(guild.id, message.author.id);\\n// Member doesn't exist so cancel the command\\nif (!member) {\\n sendResponse(message, `sorry, but you can not use this command until you become VIP. **Close the IRIS!!!**`)\\n return true;\\n}\\n\\n// If the user has the vip role on the support server given by patreon allow the command\\nif (member.roles.includes(configs.roleIDs.patreonVIPRoleID)) return false;\\n\\n// Alert the user they don't have vip and can't use the command\\nsendResponse(message, `sorry, but you can not use this command until you become a VIP. I'm sorry, Teal'c. We'll go to Disneyland next year. I promise.`)\\n// Cancel the command since the user does not have vip\\nreturn true;\\n\")), mdx(\"h2\", null, \"Challenges\"), mdx(\"p\", null, \"Hell yes! We just got through the entire inhibitor section. You have now mastered everything related to inhibitors.\"), mdx(\"p\", null, \"You can now try and get a little more practice with inhibitors by trying to challenge yourself and make your own inhibitors. Don't worry if you can't think of any good use cases for inhibitors.\"), mdx(\"p\", null, \"Majority of Discordeno bots do not use many custom inhibitors because most of the necessary/important ones already come built for you in the inhibitors folder.\"), mdx(\"p\", null, \"Next we will try our hands \"));\n}\n;\nMDXContent.isMDXComponent = true;","rawMDXOutput":"/* @jsx mdx */\nimport { mdx } from '@mdx-js/react';\n/* @jsx mdx */\n\nexport const _frontmatter = {\n \"title\": \"Creating Inhibitors!\",\n \"metaTitle\": \"Creating An Inhibitor | Discordeno\",\n \"metaDescription\": \"Let's create our very own bot with Discordeno!\"\n};\n\nconst layoutProps = {\n _frontmatter\n};\nconst MDXLayout = \"wrapper\"\nexport default function MDXContent({\n components,\n ...props\n}) {\n return \n

{`Woah! You are almost half way done with understanding all of Discordeno. Amazing isn't it? Something you may have noticed in the last section was there were some options that prevented some commands from running like `}{`dmOnly`}{` or the permission options. we created a setting to prevent the monitor from running in certain channels. What if we wanted to do prevent commands from happening? How would we prevent commands from running?`}

\n

{`What is an Inhibitor?`}

\n

{`An Inhibitor is very similar to how monitors work. A monitor runs on every message but an inhibitor runs on every command. Remember all those command options like cooldown, permissions, permissionLevel, nsfw, etc... Each and every one of these options has an inhibitor in that checks commands for these settings.`}

\n

{`Let's create our own inhibitor that would prevent commands from being used if the user is not a VIP user.`}

\n
\n

{`Note:`}{` It is important to remember that everything below can be done with a simple permission level as well. We will create our own custom permission levels but for the purposes of this guide and to be able to learn about Inhibitors, we will be using an inhibitor.`}

\n
\n

{`Creating the File`}

\n

{`Let's start by creating a file inside the inhibitors folder called `}{`boosted.ts`}{` and paste the following snippet of code:`}

\n
{`import { botCache } from \"../../mod.ts\";\n\nbotCache.inhibitors.set(\"inhibitorname\", async function (message, command, guild) {\n    // Your code goes here\n});\n`}
\n

{`Inhibitors can take up to 3 arguments.`}

\n
    \n
  • {`message`}{`: The message object that triggered the command.`}
  • \n
  • {`command`}{`: The command object itself that was triggered.`}
  • \n
  • {`guild`}{`: The server guild object where this command was ran.`}
  • \n
\n

{`Understanding How Inhibitors Function`}

\n

{`To block a command you have to return a truthy value.`}

\n
    \n
  • {`return true;`}{` If you return true the inhibitor will block the execution of the command.\nTo allow a command return a falsey value.`}
  • \n
  • {`return false;`}{` If you return false the inhibitor will not block the error.`}
  • \n
\n
{`// If the command is not VIP only we can allow this command to execute\nif (!command.vipOnly) return false;\n\n// The bot's support server\nconst guild = cache.guilds.get(configs.supportServerID);\n// If the command author is not in the server they won't have the vip role\nconst member = guild.members.get(message.author.id) || await getMember(guild.id, message.author.id);\n// Member doesn't exist so cancel the command\nif (!member) {\n    sendResponse(message, \\`sorry, but you can not use this command until you become VIP. **Close the IRIS!!!**\\`)\n    return true;\n}\n\n// If the user has the vip role on the support server given by patreon allow the command\nif (member.roles.includes(configs.roleIDs.patreonVIPRoleID)) return false;\n\n// Alert the user they don't have vip and can't use the command\nsendResponse(message, \\`sorry, but you can not use this command until you become a VIP. I'm sorry, Teal'c. We'll go to Disneyland next year. I promise.\\`)\n// Cancel the command since the user does not have vip\nreturn true;\n`}
\n

{`Challenges`}

\n

{`Hell yes! We just got through the entire inhibitor section. You have now mastered everything related to inhibitors.`}

\n

{`You can now try and get a little more practice with inhibitors by trying to challenge yourself and make your own inhibitors. Don't worry if you can't think of any good use cases for inhibitors.`}

\n

{`Majority of Discordeno bots do not use many custom inhibitors because most of the necessary/important ones already come built for you in the inhibitors folder.`}

\n

{`Next we will try our hands `}

\n\n
;\n}\n\n;\nMDXContent.isMDXComponent = true;"}} \ No newline at end of file diff --git a/docs/.cache/caches/gatsby-plugin-mdx/diskstore-74987a851eaf18ea6eabc2c76c6f8105.json b/docs/.cache/caches/gatsby-plugin-mdx/diskstore-74987a851eaf18ea6eabc2c76c6f8105.json new file mode 100644 index 000000000..992e999f2 --- /dev/null +++ b/docs/.cache/caches/gatsby-plugin-mdx/diskstore-74987a851eaf18ea6eabc2c76c6f8105.json @@ -0,0 +1 @@ +{"expireTime":9007200851633986000,"key":"gatsby-plugin-mdx-entire-payload-aa216df0983e87b5af523a0d6918d81d-","val":{"mdast":{"type":"root","children":[{"type":"paragraph","children":[{"type":"text","value":"Woah! You are almost half way done with understanding all of Discordeno. Amazing isn't it? Something you may have noticed in the last section was there were some options that prevented some commands from running like ","position":{"start":{"line":2,"column":1,"offset":1},"end":{"line":2,"column":218,"offset":218},"indent":[]}},{"type":"inlineCode","value":"dmOnly","position":{"start":{"line":2,"column":218,"offset":218},"end":{"line":2,"column":226,"offset":226},"indent":[]}},{"type":"text","value":" or the permission options. we created a setting to prevent the monitor from running in certain channels. What if we wanted to do prevent commands from happening? How would we prevent commands from running?","position":{"start":{"line":2,"column":226,"offset":226},"end":{"line":2,"column":432,"offset":432},"indent":[]}}],"position":{"start":{"line":2,"column":1,"offset":1},"end":{"line":2,"column":432,"offset":432},"indent":[]}},{"type":"heading","depth":2,"children":[{"type":"text","value":"What is an Inhibitor?","position":{"start":{"line":4,"column":4,"offset":437},"end":{"line":4,"column":25,"offset":458},"indent":[]}}],"position":{"start":{"line":4,"column":1,"offset":434},"end":{"line":4,"column":25,"offset":458},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"An Inhibitor is very similar to how monitors work. A monitor runs on every message but an inhibitor runs on every command. Remember all those command options like cooldown, permissions, permissionLevel, nsfw, etc... Each and every one of these options has an inhibitor in that checks commands for these settings.","position":{"start":{"line":6,"column":1,"offset":460},"end":{"line":6,"column":313,"offset":772},"indent":[]}}],"position":{"start":{"line":6,"column":1,"offset":460},"end":{"line":6,"column":313,"offset":772},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"Let's create our own inhibitor that would prevent commands from being used if the user is not a VIP user.","position":{"start":{"line":8,"column":1,"offset":774},"end":{"line":8,"column":106,"offset":879},"indent":[]}}],"position":{"start":{"line":8,"column":1,"offset":774},"end":{"line":8,"column":106,"offset":879},"indent":[]}},{"type":"blockquote","children":[{"type":"paragraph","children":[{"type":"strong","children":[{"type":"text","value":"Note:","position":{"start":{"line":10,"column":5,"offset":885},"end":{"line":10,"column":10,"offset":890},"indent":[]}}],"position":{"start":{"line":10,"column":3,"offset":883},"end":{"line":10,"column":12,"offset":892},"indent":[]}},{"type":"text","value":" It is important to remember that everything below can be done with a simple permission level as well. We will create our own custom permission levels but for the purposes of this guide and to be able to learn about Inhibitors, we will be using an inhibitor.","position":{"start":{"line":10,"column":12,"offset":892},"end":{"line":10,"column":270,"offset":1150},"indent":[]}}],"position":{"start":{"line":10,"column":3,"offset":883},"end":{"line":10,"column":270,"offset":1150},"indent":[]}}],"position":{"start":{"line":10,"column":1,"offset":881},"end":{"line":10,"column":270,"offset":1150},"indent":[]}},{"type":"heading","depth":2,"children":[{"type":"text","value":"Creating the File","position":{"start":{"line":12,"column":4,"offset":1155},"end":{"line":12,"column":21,"offset":1172},"indent":[]}}],"position":{"start":{"line":12,"column":1,"offset":1152},"end":{"line":12,"column":21,"offset":1172},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"Let's start by creating a file inside the inhibitors folder called ","position":{"start":{"line":14,"column":1,"offset":1174},"end":{"line":14,"column":68,"offset":1241},"indent":[]}},{"type":"inlineCode","value":"boosted.ts","position":{"start":{"line":14,"column":68,"offset":1241},"end":{"line":14,"column":80,"offset":1253},"indent":[]}},{"type":"text","value":" and paste the following snippet of code:","position":{"start":{"line":14,"column":80,"offset":1253},"end":{"line":14,"column":121,"offset":1294},"indent":[]}}],"position":{"start":{"line":14,"column":1,"offset":1174},"end":{"line":14,"column":121,"offset":1294},"indent":[]}},{"type":"code","lang":"ts","meta":null,"value":"import { botCache } from \"../../mod.ts\";\n\nbotCache.inhibitors.set(\"inhibitorname\", async function (message, command, guild) {\n\t// Your code goes here\n});","position":{"start":{"line":16,"column":1,"offset":1296},"end":{"line":22,"column":4,"offset":1459},"indent":[1,1,1,1,1,1]}},{"type":"paragraph","children":[{"type":"text","value":"Inhibitors can take up to 3 arguments.","position":{"start":{"line":24,"column":1,"offset":1461},"end":{"line":24,"column":39,"offset":1499},"indent":[]}}],"position":{"start":{"line":24,"column":1,"offset":1461},"end":{"line":24,"column":39,"offset":1499},"indent":[]}},{"type":"list","ordered":false,"start":null,"spread":false,"children":[{"type":"listItem","spread":false,"checked":null,"children":[{"type":"paragraph","children":[{"type":"inlineCode","value":"message","position":{"start":{"line":26,"column":3,"offset":1503},"end":{"line":26,"column":12,"offset":1512},"indent":[]}},{"type":"text","value":": The message object that triggered the command.","position":{"start":{"line":26,"column":12,"offset":1512},"end":{"line":26,"column":60,"offset":1560},"indent":[]}}],"position":{"start":{"line":26,"column":3,"offset":1503},"end":{"line":26,"column":60,"offset":1560},"indent":[]}}],"position":{"start":{"line":26,"column":1,"offset":1501},"end":{"line":26,"column":60,"offset":1560},"indent":[]}},{"type":"listItem","spread":false,"checked":null,"children":[{"type":"paragraph","children":[{"type":"inlineCode","value":"command","position":{"start":{"line":27,"column":3,"offset":1563},"end":{"line":27,"column":12,"offset":1572},"indent":[]}},{"type":"text","value":": The command object itself that was triggered.","position":{"start":{"line":27,"column":12,"offset":1572},"end":{"line":27,"column":59,"offset":1619},"indent":[]}}],"position":{"start":{"line":27,"column":3,"offset":1563},"end":{"line":27,"column":59,"offset":1619},"indent":[]}}],"position":{"start":{"line":27,"column":1,"offset":1561},"end":{"line":27,"column":59,"offset":1619},"indent":[]}},{"type":"listItem","spread":false,"checked":null,"children":[{"type":"paragraph","children":[{"type":"inlineCode","value":"guild","position":{"start":{"line":28,"column":3,"offset":1622},"end":{"line":28,"column":10,"offset":1629},"indent":[]}},{"type":"text","value":": The server guild object where this command was ran.","position":{"start":{"line":28,"column":10,"offset":1629},"end":{"line":28,"column":63,"offset":1682},"indent":[]}}],"position":{"start":{"line":28,"column":3,"offset":1622},"end":{"line":28,"column":63,"offset":1682},"indent":[]}}],"position":{"start":{"line":28,"column":1,"offset":1620},"end":{"line":28,"column":63,"offset":1682},"indent":[]}}],"position":{"start":{"line":26,"column":1,"offset":1501},"end":{"line":28,"column":63,"offset":1682},"indent":[1,1]}},{"type":"heading","depth":2,"children":[{"type":"text","value":"Understanding How Inhibitors Function","position":{"start":{"line":30,"column":4,"offset":1687},"end":{"line":30,"column":41,"offset":1724},"indent":[]}}],"position":{"start":{"line":30,"column":1,"offset":1684},"end":{"line":30,"column":41,"offset":1724},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"To block a command you have to return a truthy value.","position":{"start":{"line":32,"column":1,"offset":1726},"end":{"line":32,"column":54,"offset":1779},"indent":[]}}],"position":{"start":{"line":32,"column":1,"offset":1726},"end":{"line":32,"column":54,"offset":1779},"indent":[]}},{"type":"list","ordered":false,"start":null,"spread":false,"children":[{"type":"listItem","spread":false,"checked":null,"children":[{"type":"paragraph","children":[{"type":"strong","children":[{"type":"text","value":"return true;","position":{"start":{"line":33,"column":5,"offset":1784},"end":{"line":33,"column":17,"offset":1796},"indent":[]}}],"position":{"start":{"line":33,"column":3,"offset":1782},"end":{"line":33,"column":19,"offset":1798},"indent":[]}},{"type":"text","value":" If you return true the inhibitor will block the execution of the command.\nTo allow a command return a falsey value.","position":{"start":{"line":33,"column":19,"offset":1798},"end":{"line":34,"column":42,"offset":1914},"indent":[1]}}],"position":{"start":{"line":33,"column":3,"offset":1782},"end":{"line":34,"column":42,"offset":1914},"indent":[1]}}],"position":{"start":{"line":33,"column":1,"offset":1780},"end":{"line":34,"column":42,"offset":1914},"indent":[1]}},{"type":"listItem","spread":false,"checked":null,"children":[{"type":"paragraph","children":[{"type":"strong","children":[{"type":"text","value":"return false;","position":{"start":{"line":35,"column":5,"offset":1919},"end":{"line":35,"column":18,"offset":1932},"indent":[]}}],"position":{"start":{"line":35,"column":3,"offset":1917},"end":{"line":35,"column":20,"offset":1934},"indent":[]}},{"type":"text","value":" If you return false the inhibitor will not block the error.","position":{"start":{"line":35,"column":20,"offset":1934},"end":{"line":35,"column":80,"offset":1994},"indent":[]}}],"position":{"start":{"line":35,"column":3,"offset":1917},"end":{"line":35,"column":80,"offset":1994},"indent":[]}}],"position":{"start":{"line":35,"column":1,"offset":1915},"end":{"line":35,"column":80,"offset":1994},"indent":[]}}],"position":{"start":{"line":33,"column":1,"offset":1780},"end":{"line":35,"column":80,"offset":1994},"indent":[1,1]}},{"type":"code","lang":"ts","meta":null,"value":"// If the command is not VIP only we can allow this command to execute\nif (!command.vipOnly) return false;\n\n// S\nconst userIsVIP = await isUserVIP(message.author.id)\n// The user is VIP so we can allow this command to be used\nif (userIsVIP) return false;\n\n// The user is NOT VIP so we throw an error\nthrow `The ${command.name} is only allowed for VIP users.`","position":{"start":{"line":38,"column":1,"offset":1997},"end":{"line":49,"column":4,"offset":2364},"indent":[1,1,1,1,1,1,1,1,1,1,1]}},{"type":"export","value":"export const _frontmatter = {\"title\":\"Creating Inhibitors!\",\"metaTitle\":\"Creating An Inhibitor | Discordeno\",\"metaDescription\":\"Let's create our very own bot with Discordeno!\"}","position":{"start":{"line":52,"column":1,"offset":2367},"end":{"line":52,"column":177,"offset":2543},"indent":[]}}],"position":{"start":{"line":1,"column":1,"offset":0},"end":{"line":52,"column":177,"offset":2543}}},"scopeImports":["import * as React from 'react'"],"scopeIdentifiers":["React"],"body":"function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }\n\nfunction _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }\n\nfunction _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }\n\n/* @jsx mdx */\nvar _frontmatter = {\n \"title\": \"Creating Inhibitors!\",\n \"metaTitle\": \"Creating An Inhibitor | Discordeno\",\n \"metaDescription\": \"Let's create our very own bot with Discordeno!\"\n};\nvar layoutProps = {\n _frontmatter: _frontmatter\n};\nvar MDXLayout = \"wrapper\";\nreturn function MDXContent(_ref) {\n var components = _ref.components,\n props = _objectWithoutProperties(_ref, [\"components\"]);\n\n return mdx(MDXLayout, _extends({}, layoutProps, props, {\n components: components,\n mdxType: \"MDXLayout\"\n }), mdx(\"p\", null, \"Woah! You are almost half way done with understanding all of Discordeno. Amazing isn't it? Something you may have noticed in the last section was there were some options that prevented some commands from running like \", mdx(\"inlineCode\", {\n parentName: \"p\"\n }, \"dmOnly\"), \" or the permission options. we created a setting to prevent the monitor from running in certain channels. What if we wanted to do prevent commands from happening? How would we prevent commands from running?\"), mdx(\"h2\", null, \"What is an Inhibitor?\"), mdx(\"p\", null, \"An Inhibitor is very similar to how monitors work. A monitor runs on every message but an inhibitor runs on every command. Remember all those command options like cooldown, permissions, permissionLevel, nsfw, etc... Each and every one of these options has an inhibitor in that checks commands for these settings.\"), mdx(\"p\", null, \"Let's create our own inhibitor that would prevent commands from being used if the user is not a VIP user.\"), mdx(\"blockquote\", null, mdx(\"p\", {\n parentName: \"blockquote\"\n }, mdx(\"strong\", {\n parentName: \"p\"\n }, \"Note:\"), \" It is important to remember that everything below can be done with a simple permission level as well. We will create our own custom permission levels but for the purposes of this guide and to be able to learn about Inhibitors, we will be using an inhibitor.\")), mdx(\"h2\", null, \"Creating the File\"), mdx(\"p\", null, \"Let's start by creating a file inside the inhibitors folder called \", mdx(\"inlineCode\", {\n parentName: \"p\"\n }, \"boosted.ts\"), \" and paste the following snippet of code:\"), mdx(\"pre\", null, mdx(\"code\", _extends({\n parentName: \"pre\"\n }, {\n \"className\": \"language-ts\"\n }), \"import { botCache } from \\\"../../mod.ts\\\";\\n\\nbotCache.inhibitors.set(\\\"inhibitorname\\\", async function (message, command, guild) {\\n // Your code goes here\\n});\\n\")), mdx(\"p\", null, \"Inhibitors can take up to 3 arguments.\"), mdx(\"ul\", null, mdx(\"li\", {\n parentName: \"ul\"\n }, mdx(\"inlineCode\", {\n parentName: \"li\"\n }, \"message\"), \": The message object that triggered the command.\"), mdx(\"li\", {\n parentName: \"ul\"\n }, mdx(\"inlineCode\", {\n parentName: \"li\"\n }, \"command\"), \": The command object itself that was triggered.\"), mdx(\"li\", {\n parentName: \"ul\"\n }, mdx(\"inlineCode\", {\n parentName: \"li\"\n }, \"guild\"), \": The server guild object where this command was ran.\")), mdx(\"h2\", null, \"Understanding How Inhibitors Function\"), mdx(\"p\", null, \"To block a command you have to return a truthy value.\"), mdx(\"ul\", null, mdx(\"li\", {\n parentName: \"ul\"\n }, mdx(\"strong\", {\n parentName: \"li\"\n }, \"return true;\"), \" If you return true the inhibitor will block the execution of the command.\\nTo allow a command return a falsey value.\"), mdx(\"li\", {\n parentName: \"ul\"\n }, mdx(\"strong\", {\n parentName: \"li\"\n }, \"return false;\"), \" If you return false the inhibitor will not block the error.\")), mdx(\"pre\", null, mdx(\"code\", _extends({\n parentName: \"pre\"\n }, {\n \"className\": \"language-ts\"\n }), \"// If the command is not VIP only we can allow this command to execute\\nif (!command.vipOnly) return false;\\n\\n// S\\nconst userIsVIP = await isUserVIP(message.author.id)\\n// The user is VIP so we can allow this command to be used\\nif (userIsVIP) return false;\\n\\n// The user is NOT VIP so we throw an error\\nthrow `The ${command.name} is only allowed for VIP users.`\\n\")));\n}\n;\nMDXContent.isMDXComponent = true;","rawMDXOutput":"/* @jsx mdx */\nimport { mdx } from '@mdx-js/react';\n/* @jsx mdx */\n\nexport const _frontmatter = {\n \"title\": \"Creating Inhibitors!\",\n \"metaTitle\": \"Creating An Inhibitor | Discordeno\",\n \"metaDescription\": \"Let's create our very own bot with Discordeno!\"\n};\n\nconst layoutProps = {\n _frontmatter\n};\nconst MDXLayout = \"wrapper\"\nexport default function MDXContent({\n components,\n ...props\n}) {\n return \n

{`Woah! You are almost half way done with understanding all of Discordeno. Amazing isn't it? Something you may have noticed in the last section was there were some options that prevented some commands from running like `}{`dmOnly`}{` or the permission options. we created a setting to prevent the monitor from running in certain channels. What if we wanted to do prevent commands from happening? How would we prevent commands from running?`}

\n

{`What is an Inhibitor?`}

\n

{`An Inhibitor is very similar to how monitors work. A monitor runs on every message but an inhibitor runs on every command. Remember all those command options like cooldown, permissions, permissionLevel, nsfw, etc... Each and every one of these options has an inhibitor in that checks commands for these settings.`}

\n

{`Let's create our own inhibitor that would prevent commands from being used if the user is not a VIP user.`}

\n
\n

{`Note:`}{` It is important to remember that everything below can be done with a simple permission level as well. We will create our own custom permission levels but for the purposes of this guide and to be able to learn about Inhibitors, we will be using an inhibitor.`}

\n
\n

{`Creating the File`}

\n

{`Let's start by creating a file inside the inhibitors folder called `}{`boosted.ts`}{` and paste the following snippet of code:`}

\n
{`import { botCache } from \"../../mod.ts\";\n\nbotCache.inhibitors.set(\"inhibitorname\", async function (message, command, guild) {\n    // Your code goes here\n});\n`}
\n

{`Inhibitors can take up to 3 arguments.`}

\n
    \n
  • {`message`}{`: The message object that triggered the command.`}
  • \n
  • {`command`}{`: The command object itself that was triggered.`}
  • \n
  • {`guild`}{`: The server guild object where this command was ran.`}
  • \n
\n

{`Understanding How Inhibitors Function`}

\n

{`To block a command you have to return a truthy value.`}

\n
    \n
  • {`return true;`}{` If you return true the inhibitor will block the execution of the command.\nTo allow a command return a falsey value.`}
  • \n
  • {`return false;`}{` If you return false the inhibitor will not block the error.`}
  • \n
\n
{`// If the command is not VIP only we can allow this command to execute\nif (!command.vipOnly) return false;\n\n// S\nconst userIsVIP = await isUserVIP(message.author.id)\n// The user is VIP so we can allow this command to be used\nif (userIsVIP) return false;\n\n// The user is NOT VIP so we throw an error\nthrow \\`The \\${command.name} is only allowed for VIP users.\\`\n`}
\n\n
;\n}\n\n;\nMDXContent.isMDXComponent = true;"}} \ No newline at end of file diff --git a/docs/.cache/caches/gatsby-plugin-mdx/diskstore-75ae9b7a0b3d0d5c86883980f02b94f0.json b/docs/.cache/caches/gatsby-plugin-mdx/diskstore-75ae9b7a0b3d0d5c86883980f02b94f0.json new file mode 100644 index 000000000..6ae731726 --- /dev/null +++ b/docs/.cache/caches/gatsby-plugin-mdx/diskstore-75ae9b7a0b3d0d5c86883980f02b94f0.json @@ -0,0 +1 @@ +{"expireTime":9007200851596121000,"key":"gatsby-plugin-mdx-entire-payload-51761999901d9aca5f9204c80453717b-","val":{"mdast":{"type":"root","children":[{"type":"heading","depth":2,"children":[{"type":"text","value":"Frequently Asked Questions","position":{"start":{"line":2,"column":5,"offset":5},"end":{"line":2,"column":31,"offset":31},"indent":[]}}],"position":{"start":{"line":2,"column":1,"offset":1},"end":{"line":2,"column":31,"offset":31},"indent":[]}},{"type":"heading","depth":2,"children":[{"type":"text","value":"Does Discordeno Support TypeScript?","position":{"start":{"line":4,"column":4,"offset":36},"end":{"line":4,"column":39,"offset":71},"indent":[]}}],"position":{"start":{"line":4,"column":1,"offset":33},"end":{"line":4,"column":39,"offset":71},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"Discordeno provides first class support for TypeScript! Since Deno provides support for Typescript, that also comes into Discordeno. This means you don't need to compile TypeScript before you use it. However, this isn't really why Discordeno is the best library for TypeScript developers. When I developed this library, I was experimenting with a lot of different things and one of them was automated typings.","position":{"start":{"line":6,"column":1,"offset":73},"end":{"line":6,"column":410,"offset":482},"indent":[]}}],"position":{"start":{"line":6,"column":1,"offset":73},"end":{"line":6,"column":410,"offset":482},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"Whenever I used other libraries, I was always seeing typings being inaccurate or problematic. This is because in any Discord API library, the majority is not used by the library itself so TypeScript doesn't warn the library developers. This makes it extremely likely that those typings become inaccurate or out of date because of simple mistakes like forgetting to update typings. Sometimes libraries will add a property and forget to add that on their typings. This makes it useable for JavaScript developers but not for TypeScript devs. For TypeScript developers, typings is everything! So I asked myself how could I solve this in my own library because I didn't want to have to suffer these problems again. The best solution was to not have any typings for the module at all.","position":{"start":{"line":8,"column":1,"offset":484},"end":{"line":8,"column":779,"offset":1262},"indent":[]}}],"position":{"start":{"line":8,"column":1,"offset":484},"end":{"line":8,"column":779,"offset":1262},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"In Discordeno, there are no typings created/maintained manually. It is all done ","position":{"start":{"line":10,"column":1,"offset":1264},"end":{"line":10,"column":81,"offset":1344},"indent":[]}},{"type":"strong","children":[{"type":"text","value":"automatically","position":{"start":{"line":10,"column":83,"offset":1346},"end":{"line":10,"column":96,"offset":1359},"indent":[]}}],"position":{"start":{"line":10,"column":81,"offset":1344},"end":{"line":10,"column":98,"offset":1361},"indent":[]}},{"type":"text","value":" by TypeScript because of the design decisions of the code itself. ","position":{"start":{"line":10,"column":98,"offset":1361},"end":{"line":10,"column":165,"offset":1428},"indent":[]}},{"type":"strong","children":[{"type":"text","value":"When the code is changed, the typings are automatically updated.","position":{"start":{"line":10,"column":167,"offset":1430},"end":{"line":10,"column":231,"offset":1494},"indent":[]}}],"position":{"start":{"line":10,"column":165,"offset":1428},"end":{"line":10,"column":233,"offset":1496},"indent":[]}},{"type":"text","value":" Never again will you suffer the problems of other libraries forgetting to keep their typings up to date properly.","position":{"start":{"line":10,"column":233,"offset":1496},"end":{"line":10,"column":347,"offset":1610},"indent":[]}}],"position":{"start":{"line":10,"column":1,"offset":1264},"end":{"line":10,"column":347,"offset":1610},"indent":[]}},{"type":"heading","depth":2,"children":[{"type":"text","value":"If Discordeno Doesn't Have Typings, What Is The Types Folder?","position":{"start":{"line":12,"column":4,"offset":1615},"end":{"line":12,"column":65,"offset":1676},"indent":[]}}],"position":{"start":{"line":12,"column":1,"offset":1612},"end":{"line":12,"column":65,"offset":1676},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"The types folder is typings built for Discord API Payload not for this lib. Discordeno provides these typings to provide the best developer experience possible when you code.","position":{"start":{"line":14,"column":1,"offset":1678},"end":{"line":14,"column":175,"offset":1852},"indent":[]}}],"position":{"start":{"line":14,"column":1,"offset":1678},"end":{"line":14,"column":175,"offset":1852},"indent":[]}},{"type":"heading","depth":2,"children":[{"type":"text","value":"How Stable Is Discordeno?","position":{"start":{"line":16,"column":4,"offset":1857},"end":{"line":16,"column":29,"offset":1882},"indent":[]}}],"position":{"start":{"line":16,"column":1,"offset":1854},"end":{"line":16,"column":29,"offset":1882},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"One of the biggest issues with almost every library(I have used) is stability. None of the libraries gave much love and attention to Typescript developers the way it deserves. Discord.JS developers continues to make breaking changes(on \"stable\" version) to TS projects without bumping the MAJOR version causing TS developers to have their bots break. Eris was the most stable when it comes to JS, but in regards to TS, I was personally maintaing the typings and this was just a hassle to try and maintain when very few others cared to keep it properly maintained. Detritus was in fact the best library for TS, but once again it lacked in proper stability. It only had 1 master branch and no signs of a proper stable version where I would not have to worry about breaking changes.","position":{"start":{"line":18,"column":1,"offset":1884},"end":{"line":18,"column":780,"offset":2663},"indent":[]}}],"position":{"start":{"line":18,"column":1,"offset":1884},"end":{"line":18,"column":780,"offset":2663},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"This is why I made it one of my foundational goals of this library to have the best stability for TypeScript developers. No matter how small, a breaking change is a breaking change when it affects the public API. I could care less if we end up at version 500. Being afraid to bump a MAJOR because it's a small change or a typing change is a terrible decision as a library maintainer and destroys the experience for end users. Discordeno provides 2 separate versioning systems to provide you as much flexibility and stability as you like.","position":{"start":{"line":20,"column":1,"offset":2665},"end":{"line":20,"column":538,"offset":3202},"indent":[]}}],"position":{"start":{"line":20,"column":1,"offset":2665},"end":{"line":20,"column":538,"offset":3202},"indent":[]}},{"type":"heading","depth":2,"children":[{"type":"text","value":"What Do You Mean By 2 Separate Versioning Systems?","position":{"start":{"line":22,"column":4,"offset":3207},"end":{"line":22,"column":54,"offset":3257},"indent":[]}}],"position":{"start":{"line":22,"column":1,"offset":3204},"end":{"line":22,"column":54,"offset":3257},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"Discordeno will have releases that comply with SemVer. To use this system you will simply use the ","position":{"start":{"line":24,"column":1,"offset":3259},"end":{"line":24,"column":99,"offset":3357},"indent":[]}},{"type":"inlineCode","value":"v2.0.0","position":{"start":{"line":24,"column":99,"offset":3357},"end":{"line":24,"column":107,"offset":3365},"indent":[]}},{"type":"text","value":" system in your version.","position":{"start":{"line":24,"column":107,"offset":3365},"end":{"line":24,"column":131,"offset":3389},"indent":[]}}],"position":{"start":{"line":24,"column":1,"offset":3259},"end":{"line":24,"column":131,"offset":3389},"indent":[]}},{"type":"blockquote","children":[{"type":"paragraph","children":[{"type":"text","value":"Note: This means for every tiny bug fix/change you need to manually update the code every time. So if a new feature is added, you would need to bump the version in your code.","position":{"start":{"line":26,"column":3,"offset":3393},"end":{"line":26,"column":177,"offset":3567},"indent":[]}}],"position":{"start":{"line":26,"column":3,"offset":3393},"end":{"line":26,"column":177,"offset":3567},"indent":[]}}],"position":{"start":{"line":26,"column":1,"offset":3391},"end":{"line":26,"column":177,"offset":3567},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"Each version is also available through a specific branch. For example v2 branch holds all the version 2 code. This branch is always updated whenever a MINOR or PATCH update is made that will NOT break your bots.","position":{"start":{"line":28,"column":1,"offset":3569},"end":{"line":28,"column":212,"offset":3780},"indent":[]}}],"position":{"start":{"line":28,"column":1,"offset":3569},"end":{"line":28,"column":212,"offset":3780},"indent":[]}},{"type":"blockquote","children":[{"type":"paragraph","children":[{"type":"text","value":"Note: This means you never have to update your code EXCEPT when you are ready to bump to next MAJOR version. So if a new feature is added, it will be added automatically. If a small bug is fixed it will be automatic.","position":{"start":{"line":30,"column":3,"offset":3784},"end":{"line":30,"column":219,"offset":4000},"indent":[]}}],"position":{"start":{"line":30,"column":3,"offset":3784},"end":{"line":30,"column":219,"offset":4000},"indent":[]}}],"position":{"start":{"line":30,"column":1,"offset":3782},"end":{"line":30,"column":219,"offset":4000},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"SemVer means more manual work for you to update code but a more secure module. Automated means almost no manual work for you to update code but a less secure module.","position":{"start":{"line":32,"column":1,"offset":4002},"end":{"line":32,"column":166,"offset":4167},"indent":[]}}],"position":{"start":{"line":32,"column":1,"offset":4002},"end":{"line":32,"column":166,"offset":4167},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"To understand that, SemVer makes it so you are using specific Release versions. In your code, you would do this by targeting the ","position":{"start":{"line":34,"column":1,"offset":4169},"end":{"line":34,"column":130,"offset":4298},"indent":[]}},{"type":"inlineCode","value":"..../Skillz4Killz/Discordeno/v4.0.0/...","position":{"start":{"line":34,"column":130,"offset":4298},"end":{"line":34,"column":171,"offset":4339},"indent":[]}},{"type":"text","value":" in order to use it. Whenever I make a small bug fix or new feature that does not break your code it would be released in a new release such as today's release of v4.0.1. This means you have to manually update your code to get these latest improvements. Until you do, you may have bugs or possibly missing features. The good part about SemVer is that if I make a mistake that could potentially make the code worse, it's a lot easier to move back to a proper version with SemVer.","position":{"start":{"line":34,"column":171,"offset":4339},"end":{"line":34,"column":649,"offset":4817},"indent":[]}}],"position":{"start":{"line":34,"column":1,"offset":4169},"end":{"line":34,"column":649,"offset":4817},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"The automated version would just simply be installed as soon as you reloaded cache for deno because it uses the branch itself as its url ","position":{"start":{"line":36,"column":1,"offset":4819},"end":{"line":36,"column":138,"offset":4956},"indent":[]}},{"type":"inlineCode","value":".../Skillz4Killz/Discordeno/v4/...","position":{"start":{"line":36,"column":138,"offset":4956},"end":{"line":36,"column":174,"offset":4992},"indent":[]}},{"type":"text","value":" For example, when i start bots I use a script that reloads cache and restarts the bot making it so i am always using the latest code. Deno makes this possible because it can pull the latest code from any URL even github. So using Github branches to it's peak I create a branch for each version. These versions simply update automatically and you dont have to worry about updating. The only time you need to update is when you bump a MAJOR version like from v4 to v5. Because these may need you to make changes in your code. Note, even the good part about SemVer can be slightly removed by just locking a certain commit as well using this method.","position":{"start":{"line":36,"column":174,"offset":4992},"end":{"line":36,"column":820,"offset":5638},"indent":[]}}],"position":{"start":{"line":36,"column":1,"offset":4819},"end":{"line":36,"column":820,"offset":5638},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"At the end of the day, I think both systems can work and I am curious how everyone feels about them. I will be trying my best to maintain both systems.","position":{"start":{"line":38,"column":1,"offset":5640},"end":{"line":38,"column":152,"offset":5791},"indent":[]}}],"position":{"start":{"line":38,"column":1,"offset":5640},"end":{"line":38,"column":152,"offset":5791},"indent":[]}},{"type":"heading","depth":2,"children":[{"type":"text","value":"Why Doesn't Discordeno Use Classes or EventEmitter?","position":{"start":{"line":40,"column":4,"offset":5796},"end":{"line":40,"column":55,"offset":5847},"indent":[]}}],"position":{"start":{"line":40,"column":1,"offset":5793},"end":{"line":40,"column":55,"offset":5847},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"This is a design decision for the lib itself. You can still use class if you want on your bot. In fact, I hope someone makes a framework/boilerplate for this lib one day using classes so that devs have a choice on which style they prefer. Without trying to write an entire thesis statement on the reasons why Classes are bad in JavaScript, I will just link to the best resources I believe help explain it.","position":{"start":{"line":42,"column":1,"offset":5849},"end":{"line":42,"column":406,"offset":6254},"indent":[]}}],"position":{"start":{"line":42,"column":1,"offset":5849},"end":{"line":42,"column":406,"offset":6254},"indent":[]}},{"type":"list","ordered":false,"start":null,"spread":false,"children":[{"type":"listItem","spread":false,"checked":null,"children":[{"type":"paragraph","children":[{"type":"text","value":"Really good article: ","position":{"start":{"line":44,"column":3,"offset":6258},"end":{"line":44,"column":24,"offset":6279},"indent":[]}},{"type":"link","title":null,"url":"https://dannyfritz.wordpress.com/2014/10/11/class-free-object-oriented-programming/","children":[{"type":"text","value":"https://dannyfritz.wordpress.com/2014/10/11/class-free-object-oriented-programming/","position":{"start":{"line":44,"column":24,"offset":6279},"end":{"line":44,"column":107,"offset":6362},"indent":[]}}],"position":{"start":{"line":44,"column":24,"offset":6279},"end":{"line":44,"column":107,"offset":6362},"indent":[]}}],"position":{"start":{"line":44,"column":3,"offset":6258},"end":{"line":44,"column":107,"offset":6362},"indent":[]}}],"position":{"start":{"line":44,"column":1,"offset":6256},"end":{"line":44,"column":107,"offset":6362},"indent":[]}},{"type":"listItem","spread":false,"checked":null,"children":[{"type":"paragraph","children":[{"type":"text","value":"Lecture by one of the developers who makes JavaScript: ","position":{"start":{"line":45,"column":3,"offset":6365},"end":{"line":45,"column":58,"offset":6420},"indent":[]}},{"type":"link","title":null,"url":"https://www.youtube.com/watch?v=PSGEjv3Tqo0","children":[{"type":"text","value":"https://www.youtube.com/watch?v=PSGEjv3Tqo0","position":{"start":{"line":45,"column":58,"offset":6420},"end":{"line":45,"column":101,"offset":6463},"indent":[]}}],"position":{"start":{"line":45,"column":58,"offset":6420},"end":{"line":45,"column":101,"offset":6463},"indent":[]}}],"position":{"start":{"line":45,"column":3,"offset":6365},"end":{"line":45,"column":101,"offset":6463},"indent":[]}}],"position":{"start":{"line":45,"column":1,"offset":6363},"end":{"line":45,"column":101,"offset":6463},"indent":[]}}],"position":{"start":{"line":44,"column":1,"offset":6256},"end":{"line":45,"column":101,"offset":6463},"indent":[1]}},{"type":"paragraph","children":[{"type":"text","value":"In regards to EventEmitter, I believe a functional event API was a much better choice. EventEmitter at it's core is simply just functions that run when a certain event is emitted. In Discordeno, that function is executed instead of emitting some event to trigger that function.","position":{"start":{"line":47,"column":1,"offset":6465},"end":{"line":47,"column":278,"offset":6742},"indent":[]}}],"position":{"start":{"line":47,"column":1,"offset":6465},"end":{"line":47,"column":278,"offset":6742},"indent":[]}},{"type":"code","lang":"typescript","meta":null,"value":"// EventEmitter Example\nEventEmitter.emit('guildCreate', guild);\n// Discordeno Example\neventHandlers.guildCreate?.(guild);","position":{"start":{"line":49,"column":1,"offset":6744},"end":{"line":54,"column":4,"offset":6884},"indent":[1,1,1,1,1]}},{"type":"paragraph","children":[{"type":"text","value":"There isn't really any difference especially for users when they use it. One bad thing about EventEmitter is that it can crash your code or cause memory leak issues. For example this screenshot is taken with the same bot token running the same minimal ping command example code and fetching all members on startup on 2 different libs:","position":{"start":{"line":55,"column":1,"offset":6885},"end":{"line":55,"column":335,"offset":7219},"indent":[]}}],"position":{"start":{"line":55,"column":1,"offset":6885},"end":{"line":55,"column":335,"offset":7219},"indent":[]}},{"type":"paragraph","children":[{"type":"image","title":null,"url":"https://user-images.githubusercontent.com/23035000/82705428-a13c9500-9c45-11ea-8dd7-a88f05c8120f.png","alt":"image","position":{"start":{"line":57,"column":1,"offset":7221},"end":{"line":57,"column":111,"offset":7331},"indent":[]}}],"position":{"start":{"line":57,"column":1,"offset":7221},"end":{"line":57,"column":111,"offset":7331},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"It is very easy to open yourself up to these memory leak issues when you use something like EventEmitter. Another issue with EventEmitter is trying to update the code in those functions without having to deal with headaches left and right.","position":{"start":{"line":59,"column":1,"offset":7333},"end":{"line":59,"column":240,"offset":7572},"indent":[]}}],"position":{"start":{"line":59,"column":1,"offset":7333},"end":{"line":59,"column":240,"offset":7572},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"In Discordeno, this is extremely simple:","position":{"start":{"line":61,"column":1,"offset":7574},"end":{"line":61,"column":41,"offset":7614},"indent":[]}}],"position":{"start":{"line":61,"column":1,"offset":7574},"end":{"line":61,"column":41,"offset":7614},"indent":[]}},{"type":"code","lang":"typescript","meta":null,"value":"updateEventHandlers(newEventHandlers)","position":{"start":{"line":63,"column":1,"offset":7616},"end":{"line":65,"column":4,"offset":7671},"indent":[1,1]}},{"type":"heading","depth":2,"children":[{"type":"text","value":"Why Do You Have A Class for Collection If Classes Are Bad?","position":{"start":{"line":67,"column":4,"offset":7676},"end":{"line":67,"column":62,"offset":7734},"indent":[]}}],"position":{"start":{"line":67,"column":1,"offset":7673},"end":{"line":67,"column":62,"offset":7734},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"The Collection class is an exception in the library where a class was allowed. This is because Collection extends Map. The Map class is provided by JavaScript itself and is extremely fast. You can perform millions of operations a second with a Map. Maps are too useful to avoid and don't have downsides like EventEmitters do. The Collection class simply adds on other functionality that Discordeno users felt they needed. Although I am against using classes whenever possible, I am also a big supporter of providing the best developer experience.","position":{"start":{"line":69,"column":1,"offset":7736},"end":{"line":69,"column":547,"offset":8282},"indent":[]}}],"position":{"start":{"line":69,"column":1,"offset":7736},"end":{"line":69,"column":547,"offset":8282},"indent":[]}},{"type":"heading","depth":2,"children":[{"type":"text","value":"Why Are there no options in Discordeno?","position":{"start":{"line":71,"column":4,"offset":8287},"end":{"line":71,"column":43,"offset":8326},"indent":[]}}],"position":{"start":{"line":71,"column":1,"offset":8284},"end":{"line":71,"column":43,"offset":8326},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"Discordeno is not a library that handles code in the exact way every person wants it to. It is opinionated. Discordeno defaults to the Discord recommended options or the best options for majority of developers needs. For example, there is no option of sharding or not sharding or only sharding a custom amount of shards. This is just going to cause confusion and lead to users needing guides on what sharding is or isnt or how to enable or disable. In Discordeno, we follow Discords recommended sharding solution and it just works internally. The End! No fuss! No Muss! Just good stuff!","position":{"start":{"line":73,"column":1,"offset":8328},"end":{"line":73,"column":587,"offset":8914},"indent":[]}}],"position":{"start":{"line":73,"column":1,"offset":8328},"end":{"line":73,"column":587,"offset":8914},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"Now, I understand that there are times when it's necessary to be able to customize the amount of shards or do something special for it. This should be done by simply forking the repo and using the commit your on. If you are advanced enough to need these options, you should be able to simply modify the repo slightly to your specific needs. The main module should remain minimalistic and easy to use for 99% of users.","position":{"start":{"line":75,"column":1,"offset":8916},"end":{"line":75,"column":418,"offset":9333},"indent":[]}}],"position":{"start":{"line":75,"column":1,"offset":8916},"end":{"line":75,"column":418,"offset":9333},"indent":[]}},{"type":"heading","depth":2,"children":[{"type":"text","value":"Why Do I See errors Like \"MISSING_VIEW_CHANNEL\" or \"BOTS_HIGHEST_ROLE_TOO_LOW\"?","position":{"start":{"line":77,"column":4,"offset":9338},"end":{"line":77,"column":83,"offset":9417},"indent":[]}}],"position":{"start":{"line":77,"column":1,"offset":9335},"end":{"line":77,"column":83,"offset":9417},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"Discordeno is the only library(that I have used), that has built in permission handling. A lot of bots get automatically banned by Discord because they forget to handle permissions. When bots don't check permissions and continue to send requests to the API, this leads to bots being banned. I have tried to request adding this feature into libraries but they were reluctant to do so because it would require the devs to maintain the library whenever an update was made by Discord.","position":{"start":{"line":79,"column":1,"offset":9419},"end":{"line":79,"column":481,"offset":9899},"indent":[]}}],"position":{"start":{"line":79,"column":1,"offset":9419},"end":{"line":79,"column":481,"offset":9899},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"Discordeno provides you specific keywords that you can use to send a clean response to the end user of your choosing. I have even seen some bots have hundreds of thousands of Missing Permission or Missing Access errors because libraries don't handle it. IMO, this is a crucial part of any good library as much as it is to handle rate limiting.","position":{"start":{"line":81,"column":1,"offset":9901},"end":{"line":81,"column":344,"offset":10244},"indent":[]}}],"position":{"start":{"line":81,"column":1,"offset":9901},"end":{"line":81,"column":344,"offset":10244},"indent":[]}},{"type":"code","lang":"typescript","meta":null,"value":"import { Errors } from \"https://raw.githubusercontent.com/Skillz4Killz/Discordeno/v4/types/errors.ts\";\nimport { Message } from \"https://raw.githubusercontent.com/Skillz4Killz/Discordeno/v4/structures/message.ts\";\n\nexport function handleCommandError(message: Message, type: Errors) {\n\tswitch (type) {\n\t\tcase Errors.MISSING_MANAGE_NICKNAMES:\n\t\t\treturn message.channel.sendMessage(\"The bot does not have the necessary permission to manage/edit other user's nicknames. Grant the **MANAGE_NICKNAME** permission to the bot and try again.\");\n\t\tcase Errors.MISSING_MANAGE_ROLES:\n\t\t\t// Note: i18n is not part of the library. This is just an example of how you could use i18n for custom error responses.\n\t\t\treturn message.channel.sendMessage(i18n.translate(type));\n\t}\n}","position":{"start":{"line":83,"column":1,"offset":10246},"end":{"line":96,"column":4,"offset":11023},"indent":[1,1,1,1,1,1,1,1,1,1,1,1,1]}},{"type":"export","value":"export const _frontmatter = {\"title\":\"FAQ\",\"metaTitle\":\"FAQ | Discordeno\",\"metaDescription\":\"Discordeno is a Third Party Deno Library for interacting with the Discord API.\"}","position":{"start":{"line":99,"column":1,"offset":11026},"end":{"line":99,"column":174,"offset":11199},"indent":[]}}],"position":{"start":{"line":1,"column":1,"offset":0},"end":{"line":99,"column":174,"offset":11199}}},"scopeImports":["import * as React from 'react'"],"scopeIdentifiers":["React"],"body":"function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }\n\nfunction _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }\n\nfunction _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }\n\n/* @jsx mdx */\nvar _frontmatter = {\n \"title\": \"FAQ\",\n \"metaTitle\": \"FAQ | Discordeno\",\n \"metaDescription\": \"Discordeno is a Third Party Deno Library for interacting with the Discord API.\"\n};\nvar layoutProps = {\n _frontmatter: _frontmatter\n};\nvar MDXLayout = \"wrapper\";\nreturn function MDXContent(_ref) {\n var components = _ref.components,\n props = _objectWithoutProperties(_ref, [\"components\"]);\n\n return mdx(MDXLayout, _extends({}, layoutProps, props, {\n components: components,\n mdxType: \"MDXLayout\"\n }), mdx(\"h2\", null, \"Frequently Asked Questions\"), mdx(\"h2\", null, \"Does Discordeno Support TypeScript?\"), mdx(\"p\", null, \"Discordeno provides first class support for TypeScript! Since Deno provides support for Typescript, that also comes into Discordeno. This means you don't need to compile TypeScript before you use it. However, this isn't really why Discordeno is the best library for TypeScript developers. When I developed this library, I was experimenting with a lot of different things and one of them was automated typings.\"), mdx(\"p\", null, \"Whenever I used other libraries, I was always seeing typings being inaccurate or problematic. This is because in any Discord API library, the majority is not used by the library itself so TypeScript doesn't warn the library developers. This makes it extremely likely that those typings become inaccurate or out of date because of simple mistakes like forgetting to update typings. Sometimes libraries will add a property and forget to add that on their typings. This makes it useable for JavaScript developers but not for TypeScript devs. For TypeScript developers, typings is everything! So I asked myself how could I solve this in my own library because I didn't want to have to suffer these problems again. The best solution was to not have any typings for the module at all.\"), mdx(\"p\", null, \"In Discordeno, there are no typings created/maintained manually. It is all done \", mdx(\"strong\", {\n parentName: \"p\"\n }, \"automatically\"), \" by TypeScript because of the design decisions of the code itself. \", mdx(\"strong\", {\n parentName: \"p\"\n }, \"When the code is changed, the typings are automatically updated.\"), \" Never again will you suffer the problems of other libraries forgetting to keep their typings up to date properly.\"), mdx(\"h2\", null, \"If Discordeno Doesn't Have Typings, What Is The Types Folder?\"), mdx(\"p\", null, \"The types folder is typings built for Discord API Payload not for this lib. Discordeno provides these typings to provide the best developer experience possible when you code.\"), mdx(\"h2\", null, \"How Stable Is Discordeno?\"), mdx(\"p\", null, \"One of the biggest issues with almost every library(I have used) is stability. None of the libraries gave much love and attention to Typescript developers the way it deserves. Discord.JS developers continues to make breaking changes(on \\\"stable\\\" version) to TS projects without bumping the MAJOR version causing TS developers to have their bots break. Eris was the most stable when it comes to JS, but in regards to TS, I was personally maintaing the typings and this was just a hassle to try and maintain when very few others cared to keep it properly maintained. Detritus was in fact the best library for TS, but once again it lacked in proper stability. It only had 1 master branch and no signs of a proper stable version where I would not have to worry about breaking changes.\"), mdx(\"p\", null, \"This is why I made it one of my foundational goals of this library to have the best stability for TypeScript developers. No matter how small, a breaking change is a breaking change when it affects the public API. I could care less if we end up at version 500. Being afraid to bump a MAJOR because it's a small change or a typing change is a terrible decision as a library maintainer and destroys the experience for end users. Discordeno provides 2 separate versioning systems to provide you as much flexibility and stability as you like.\"), mdx(\"h2\", null, \"What Do You Mean By 2 Separate Versioning Systems?\"), mdx(\"p\", null, \"Discordeno will have releases that comply with SemVer. To use this system you will simply use the \", mdx(\"inlineCode\", {\n parentName: \"p\"\n }, \"v2.0.0\"), \" system in your version.\"), mdx(\"blockquote\", null, mdx(\"p\", {\n parentName: \"blockquote\"\n }, \"Note: This means for every tiny bug fix/change you need to manually update the code every time. So if a new feature is added, you would need to bump the version in your code.\")), mdx(\"p\", null, \"Each version is also available through a specific branch. For example v2 branch holds all the version 2 code. This branch is always updated whenever a MINOR or PATCH update is made that will NOT break your bots.\"), mdx(\"blockquote\", null, mdx(\"p\", {\n parentName: \"blockquote\"\n }, \"Note: This means you never have to update your code EXCEPT when you are ready to bump to next MAJOR version. So if a new feature is added, it will be added automatically. If a small bug is fixed it will be automatic.\")), mdx(\"p\", null, \"SemVer means more manual work for you to update code but a more secure module. Automated means almost no manual work for you to update code but a less secure module.\"), mdx(\"p\", null, \"To understand that, SemVer makes it so you are using specific Release versions. In your code, you would do this by targeting the \", mdx(\"inlineCode\", {\n parentName: \"p\"\n }, \"..../Skillz4Killz/Discordeno/v4.0.0/...\"), \" in order to use it. Whenever I make a small bug fix or new feature that does not break your code it would be released in a new release such as today's release of v4.0.1. This means you have to manually update your code to get these latest improvements. Until you do, you may have bugs or possibly missing features. The good part about SemVer is that if I make a mistake that could potentially make the code worse, it's a lot easier to move back to a proper version with SemVer.\"), mdx(\"p\", null, \"The automated version would just simply be installed as soon as you reloaded cache for deno because it uses the branch itself as its url \", mdx(\"inlineCode\", {\n parentName: \"p\"\n }, \".../Skillz4Killz/Discordeno/v4/...\"), \" For example, when i start bots I use a script that reloads cache and restarts the bot making it so i am always using the latest code. Deno makes this possible because it can pull the latest code from any URL even github. So using Github branches to it's peak I create a branch for each version. These versions simply update automatically and you dont have to worry about updating. The only time you need to update is when you bump a MAJOR version like from v4 to v5. Because these may need you to make changes in your code. Note, even the good part about SemVer can be slightly removed by just locking a certain commit as well using this method.\"), mdx(\"p\", null, \"At the end of the day, I think both systems can work and I am curious how everyone feels about them. I will be trying my best to maintain both systems.\"), mdx(\"h2\", null, \"Why Doesn't Discordeno Use Classes or EventEmitter?\"), mdx(\"p\", null, \"This is a design decision for the lib itself. You can still use class if you want on your bot. In fact, I hope someone makes a framework/boilerplate for this lib one day using classes so that devs have a choice on which style they prefer. Without trying to write an entire thesis statement on the reasons why Classes are bad in JavaScript, I will just link to the best resources I believe help explain it.\"), mdx(\"ul\", null, mdx(\"li\", {\n parentName: \"ul\"\n }, \"Really good article: \", mdx(\"a\", _extends({\n parentName: \"li\"\n }, {\n \"href\": \"https://dannyfritz.wordpress.com/2014/10/11/class-free-object-oriented-programming/\"\n }), \"https://dannyfritz.wordpress.com/2014/10/11/class-free-object-oriented-programming/\")), mdx(\"li\", {\n parentName: \"ul\"\n }, \"Lecture by one of the developers who makes JavaScript: \", mdx(\"a\", _extends({\n parentName: \"li\"\n }, {\n \"href\": \"https://www.youtube.com/watch?v=PSGEjv3Tqo0\"\n }), \"https://www.youtube.com/watch?v=PSGEjv3Tqo0\"))), mdx(\"p\", null, \"In regards to EventEmitter, I believe a functional event API was a much better choice. EventEmitter at it's core is simply just functions that run when a certain event is emitted. In Discordeno, that function is executed instead of emitting some event to trigger that function.\"), mdx(\"pre\", null, mdx(\"code\", _extends({\n parentName: \"pre\"\n }, {\n \"className\": \"language-typescript\"\n }), \"// EventEmitter Example\\nEventEmitter.emit('guildCreate', guild);\\n// Discordeno Example\\neventHandlers.guildCreate?.(guild);\\n\")), mdx(\"p\", null, \"There isn't really any difference especially for users when they use it. One bad thing about EventEmitter is that it can crash your code or cause memory leak issues. For example this screenshot is taken with the same bot token running the same minimal ping command example code and fetching all members on startup on 2 different libs:\"), mdx(\"p\", null, mdx(\"img\", _extends({\n parentName: \"p\"\n }, {\n \"src\": \"https://user-images.githubusercontent.com/23035000/82705428-a13c9500-9c45-11ea-8dd7-a88f05c8120f.png\",\n \"alt\": \"image\"\n }))), mdx(\"p\", null, \"It is very easy to open yourself up to these memory leak issues when you use something like EventEmitter. Another issue with EventEmitter is trying to update the code in those functions without having to deal with headaches left and right.\"), mdx(\"p\", null, \"In Discordeno, this is extremely simple:\"), mdx(\"pre\", null, mdx(\"code\", _extends({\n parentName: \"pre\"\n }, {\n \"className\": \"language-typescript\"\n }), \"updateEventHandlers(newEventHandlers)\\n\")), mdx(\"h2\", null, \"Why Do You Have A Class for Collection If Classes Are Bad?\"), mdx(\"p\", null, \"The Collection class is an exception in the library where a class was allowed. This is because Collection extends Map. The Map class is provided by JavaScript itself and is extremely fast. You can perform millions of operations a second with a Map. Maps are too useful to avoid and don't have downsides like EventEmitters do. The Collection class simply adds on other functionality that Discordeno users felt they needed. Although I am against using classes whenever possible, I am also a big supporter of providing the best developer experience.\"), mdx(\"h2\", null, \"Why Are there no options in Discordeno?\"), mdx(\"p\", null, \"Discordeno is not a library that handles code in the exact way every person wants it to. It is opinionated. Discordeno defaults to the Discord recommended options or the best options for majority of developers needs. For example, there is no option of sharding or not sharding or only sharding a custom amount of shards. This is just going to cause confusion and lead to users needing guides on what sharding is or isnt or how to enable or disable. In Discordeno, we follow Discords recommended sharding solution and it just works internally. The End! No fuss! No Muss! Just good stuff!\"), mdx(\"p\", null, \"Now, I understand that there are times when it's necessary to be able to customize the amount of shards or do something special for it. This should be done by simply forking the repo and using the commit your on. If you are advanced enough to need these options, you should be able to simply modify the repo slightly to your specific needs. The main module should remain minimalistic and easy to use for 99% of users.\"), mdx(\"h2\", null, \"Why Do I See errors Like \\\"MISSING_VIEW_CHANNEL\\\" or \\\"BOTS_HIGHEST_ROLE_TOO_LOW\\\"?\"), mdx(\"p\", null, \"Discordeno is the only library(that I have used), that has built in permission handling. A lot of bots get automatically banned by Discord because they forget to handle permissions. When bots don't check permissions and continue to send requests to the API, this leads to bots being banned. I have tried to request adding this feature into libraries but they were reluctant to do so because it would require the devs to maintain the library whenever an update was made by Discord.\"), mdx(\"p\", null, \"Discordeno provides you specific keywords that you can use to send a clean response to the end user of your choosing. I have even seen some bots have hundreds of thousands of Missing Permission or Missing Access errors because libraries don't handle it. IMO, this is a crucial part of any good library as much as it is to handle rate limiting.\"), mdx(\"pre\", null, mdx(\"code\", _extends({\n parentName: \"pre\"\n }, {\n \"className\": \"language-typescript\"\n }), \"import { Errors } from \\\"https://raw.githubusercontent.com/Skillz4Killz/Discordeno/v4/types/errors.ts\\\";\\nimport { Message } from \\\"https://raw.githubusercontent.com/Skillz4Killz/Discordeno/v4/structures/message.ts\\\";\\n\\nexport function handleCommandError(message: Message, type: Errors) {\\n switch (type) {\\n case Errors.MISSING_MANAGE_NICKNAMES:\\n return message.channel.sendMessage(\\\"The bot does not have the necessary permission to manage/edit other user's nicknames. Grant the **MANAGE_NICKNAME** permission to the bot and try again.\\\");\\n case Errors.MISSING_MANAGE_ROLES:\\n // Note: i18n is not part of the library. This is just an example of how you could use i18n for custom error responses.\\n return message.channel.sendMessage(i18n.translate(type));\\n }\\n}\\n\")));\n}\n;\nMDXContent.isMDXComponent = true;","rawMDXOutput":"/* @jsx mdx */\nimport { mdx } from '@mdx-js/react';\n/* @jsx mdx */\n\nexport const _frontmatter = {\n \"title\": \"FAQ\",\n \"metaTitle\": \"FAQ | Discordeno\",\n \"metaDescription\": \"Discordeno is a Third Party Deno Library for interacting with the Discord API.\"\n};\n\nconst layoutProps = {\n _frontmatter\n};\nconst MDXLayout = \"wrapper\"\nexport default function MDXContent({\n components,\n ...props\n}) {\n return \n

{`Frequently Asked Questions`}

\n

{`Does Discordeno Support TypeScript?`}

\n

{`Discordeno provides first class support for TypeScript! Since Deno provides support for Typescript, that also comes into Discordeno. This means you don't need to compile TypeScript before you use it. However, this isn't really why Discordeno is the best library for TypeScript developers. When I developed this library, I was experimenting with a lot of different things and one of them was automated typings.`}

\n

{`Whenever I used other libraries, I was always seeing typings being inaccurate or problematic. This is because in any Discord API library, the majority is not used by the library itself so TypeScript doesn't warn the library developers. This makes it extremely likely that those typings become inaccurate or out of date because of simple mistakes like forgetting to update typings. Sometimes libraries will add a property and forget to add that on their typings. This makes it useable for JavaScript developers but not for TypeScript devs. For TypeScript developers, typings is everything! So I asked myself how could I solve this in my own library because I didn't want to have to suffer these problems again. The best solution was to not have any typings for the module at all.`}

\n

{`In Discordeno, there are no typings created/maintained manually. It is all done `}{`automatically`}{` by TypeScript because of the design decisions of the code itself. `}{`When the code is changed, the typings are automatically updated.`}{` Never again will you suffer the problems of other libraries forgetting to keep their typings up to date properly.`}

\n

{`If Discordeno Doesn't Have Typings, What Is The Types Folder?`}

\n

{`The types folder is typings built for Discord API Payload not for this lib. Discordeno provides these typings to provide the best developer experience possible when you code.`}

\n

{`How Stable Is Discordeno?`}

\n

{`One of the biggest issues with almost every library(I have used) is stability. None of the libraries gave much love and attention to Typescript developers the way it deserves. Discord.JS developers continues to make breaking changes(on \"stable\" version) to TS projects without bumping the MAJOR version causing TS developers to have their bots break. Eris was the most stable when it comes to JS, but in regards to TS, I was personally maintaing the typings and this was just a hassle to try and maintain when very few others cared to keep it properly maintained. Detritus was in fact the best library for TS, but once again it lacked in proper stability. It only had 1 master branch and no signs of a proper stable version where I would not have to worry about breaking changes.`}

\n

{`This is why I made it one of my foundational goals of this library to have the best stability for TypeScript developers. No matter how small, a breaking change is a breaking change when it affects the public API. I could care less if we end up at version 500. Being afraid to bump a MAJOR because it's a small change or a typing change is a terrible decision as a library maintainer and destroys the experience for end users. Discordeno provides 2 separate versioning systems to provide you as much flexibility and stability as you like.`}

\n

{`What Do You Mean By 2 Separate Versioning Systems?`}

\n

{`Discordeno will have releases that comply with SemVer. To use this system you will simply use the `}{`v2.0.0`}{` system in your version.`}

\n
\n

{`Note: This means for every tiny bug fix/change you need to manually update the code every time. So if a new feature is added, you would need to bump the version in your code.`}

\n
\n

{`Each version is also available through a specific branch. For example v2 branch holds all the version 2 code. This branch is always updated whenever a MINOR or PATCH update is made that will NOT break your bots.`}

\n
\n

{`Note: This means you never have to update your code EXCEPT when you are ready to bump to next MAJOR version. So if a new feature is added, it will be added automatically. If a small bug is fixed it will be automatic.`}

\n
\n

{`SemVer means more manual work for you to update code but a more secure module. Automated means almost no manual work for you to update code but a less secure module.`}

\n

{`To understand that, SemVer makes it so you are using specific Release versions. In your code, you would do this by targeting the `}{`..../Skillz4Killz/Discordeno/v4.0.0/...`}{` in order to use it. Whenever I make a small bug fix or new feature that does not break your code it would be released in a new release such as today's release of v4.0.1. This means you have to manually update your code to get these latest improvements. Until you do, you may have bugs or possibly missing features. The good part about SemVer is that if I make a mistake that could potentially make the code worse, it's a lot easier to move back to a proper version with SemVer.`}

\n

{`The automated version would just simply be installed as soon as you reloaded cache for deno because it uses the branch itself as its url `}{`.../Skillz4Killz/Discordeno/v4/...`}{` For example, when i start bots I use a script that reloads cache and restarts the bot making it so i am always using the latest code. Deno makes this possible because it can pull the latest code from any URL even github. So using Github branches to it's peak I create a branch for each version. These versions simply update automatically and you dont have to worry about updating. The only time you need to update is when you bump a MAJOR version like from v4 to v5. Because these may need you to make changes in your code. Note, even the good part about SemVer can be slightly removed by just locking a certain commit as well using this method.`}

\n

{`At the end of the day, I think both systems can work and I am curious how everyone feels about them. I will be trying my best to maintain both systems.`}

\n

{`Why Doesn't Discordeno Use Classes or EventEmitter?`}

\n

{`This is a design decision for the lib itself. You can still use class if you want on your bot. In fact, I hope someone makes a framework/boilerplate for this lib one day using classes so that devs have a choice on which style they prefer. Without trying to write an entire thesis statement on the reasons why Classes are bad in JavaScript, I will just link to the best resources I believe help explain it.`}

\n \n

{`In regards to EventEmitter, I believe a functional event API was a much better choice. EventEmitter at it's core is simply just functions that run when a certain event is emitted. In Discordeno, that function is executed instead of emitting some event to trigger that function.`}

\n
{`// EventEmitter Example\nEventEmitter.emit('guildCreate', guild);\n// Discordeno Example\neventHandlers.guildCreate?.(guild);\n`}
\n

{`There isn't really any difference especially for users when they use it. One bad thing about EventEmitter is that it can crash your code or cause memory leak issues. For example this screenshot is taken with the same bot token running the same minimal ping command example code and fetching all members on startup on 2 different libs:`}

\n

\n

{`It is very easy to open yourself up to these memory leak issues when you use something like EventEmitter. Another issue with EventEmitter is trying to update the code in those functions without having to deal with headaches left and right.`}

\n

{`In Discordeno, this is extremely simple:`}

\n
{`updateEventHandlers(newEventHandlers)\n`}
\n

{`Why Do You Have A Class for Collection If Classes Are Bad?`}

\n

{`The Collection class is an exception in the library where a class was allowed. This is because Collection extends Map. The Map class is provided by JavaScript itself and is extremely fast. You can perform millions of operations a second with a Map. Maps are too useful to avoid and don't have downsides like EventEmitters do. The Collection class simply adds on other functionality that Discordeno users felt they needed. Although I am against using classes whenever possible, I am also a big supporter of providing the best developer experience.`}

\n

{`Why Are there no options in Discordeno?`}

\n

{`Discordeno is not a library that handles code in the exact way every person wants it to. It is opinionated. Discordeno defaults to the Discord recommended options or the best options for majority of developers needs. For example, there is no option of sharding or not sharding or only sharding a custom amount of shards. This is just going to cause confusion and lead to users needing guides on what sharding is or isnt or how to enable or disable. In Discordeno, we follow Discords recommended sharding solution and it just works internally. The End! No fuss! No Muss! Just good stuff!`}

\n

{`Now, I understand that there are times when it's necessary to be able to customize the amount of shards or do something special for it. This should be done by simply forking the repo and using the commit your on. If you are advanced enough to need these options, you should be able to simply modify the repo slightly to your specific needs. The main module should remain minimalistic and easy to use for 99% of users.`}

\n

{`Why Do I See errors Like \"MISSING_VIEW_CHANNEL\" or \"BOTS_HIGHEST_ROLE_TOO_LOW\"?`}

\n

{`Discordeno is the only library(that I have used), that has built in permission handling. A lot of bots get automatically banned by Discord because they forget to handle permissions. When bots don't check permissions and continue to send requests to the API, this leads to bots being banned. I have tried to request adding this feature into libraries but they were reluctant to do so because it would require the devs to maintain the library whenever an update was made by Discord.`}

\n

{`Discordeno provides you specific keywords that you can use to send a clean response to the end user of your choosing. I have even seen some bots have hundreds of thousands of Missing Permission or Missing Access errors because libraries don't handle it. IMO, this is a crucial part of any good library as much as it is to handle rate limiting.`}

\n
{`import { Errors } from \"https://raw.githubusercontent.com/Skillz4Killz/Discordeno/v4/types/errors.ts\";\nimport { Message } from \"https://raw.githubusercontent.com/Skillz4Killz/Discordeno/v4/structures/message.ts\";\n\nexport function handleCommandError(message: Message, type: Errors) {\n    switch (type) {\n        case Errors.MISSING_MANAGE_NICKNAMES:\n            return message.channel.sendMessage(\"The bot does not have the necessary permission to manage/edit other user's nicknames. Grant the **MANAGE_NICKNAME** permission to the bot and try again.\");\n        case Errors.MISSING_MANAGE_ROLES:\n            // Note: i18n is not part of the library. This is just an example of how you could use i18n for custom error responses.\n            return message.channel.sendMessage(i18n.translate(type));\n    }\n}\n`}
\n\n
;\n}\n\n;\nMDXContent.isMDXComponent = true;"}} \ No newline at end of file diff --git a/docs/.cache/caches/gatsby-plugin-mdx/diskstore-75bea16c14b4f40816dc5cd6013e717d.json b/docs/.cache/caches/gatsby-plugin-mdx/diskstore-75bea16c14b4f40816dc5cd6013e717d.json new file mode 100644 index 000000000..c5c55d4b9 --- /dev/null +++ b/docs/.cache/caches/gatsby-plugin-mdx/diskstore-75bea16c14b4f40816dc5cd6013e717d.json @@ -0,0 +1 @@ +{"expireTime":9007200851634185000,"key":"gatsby-plugin-mdx-entire-payload-35876a01b9747caba362b47f47d033d7-","val":{"mdast":{"type":"root","children":[{"type":"paragraph","children":[{"type":"text","value":"Woah! You are almost half way done with understanding all of Discordeno. Amazing isn't it? Something you may have noticed in the last section was there were some options that prevented some commands from running like ","position":{"start":{"line":2,"column":1,"offset":1},"end":{"line":2,"column":218,"offset":218},"indent":[]}},{"type":"inlineCode","value":"dmOnly","position":{"start":{"line":2,"column":218,"offset":218},"end":{"line":2,"column":226,"offset":226},"indent":[]}},{"type":"text","value":" or the permission options. we created a setting to prevent the monitor from running in certain channels. What if we wanted to do prevent commands from happening? How would we prevent commands from running?","position":{"start":{"line":2,"column":226,"offset":226},"end":{"line":2,"column":432,"offset":432},"indent":[]}}],"position":{"start":{"line":2,"column":1,"offset":1},"end":{"line":2,"column":432,"offset":432},"indent":[]}},{"type":"heading","depth":2,"children":[{"type":"text","value":"What is an Inhibitor?","position":{"start":{"line":4,"column":4,"offset":437},"end":{"line":4,"column":25,"offset":458},"indent":[]}}],"position":{"start":{"line":4,"column":1,"offset":434},"end":{"line":4,"column":25,"offset":458},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"An Inhibitor is very similar to how monitors work. A monitor runs on every message but an inhibitor runs on every command. Remember all those command options like cooldown, permissions, permissionLevel, nsfw, etc... Each and every one of these options has an inhibitor in that checks commands for these settings.","position":{"start":{"line":6,"column":1,"offset":460},"end":{"line":6,"column":313,"offset":772},"indent":[]}}],"position":{"start":{"line":6,"column":1,"offset":460},"end":{"line":6,"column":313,"offset":772},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"Let's create our own inhibitor that would prevent commands from being used if the user is not a VIP user.","position":{"start":{"line":8,"column":1,"offset":774},"end":{"line":8,"column":106,"offset":879},"indent":[]}}],"position":{"start":{"line":8,"column":1,"offset":774},"end":{"line":8,"column":106,"offset":879},"indent":[]}},{"type":"blockquote","children":[{"type":"paragraph","children":[{"type":"strong","children":[{"type":"text","value":"Note:","position":{"start":{"line":10,"column":5,"offset":885},"end":{"line":10,"column":10,"offset":890},"indent":[]}}],"position":{"start":{"line":10,"column":3,"offset":883},"end":{"line":10,"column":12,"offset":892},"indent":[]}},{"type":"text","value":" It is important to remember that everything below can be done with a simple permission level as well. We will create our own custom permission levels but for the purposes of this guide and to be able to learn about Inhibitors, we will be using an inhibitor.","position":{"start":{"line":10,"column":12,"offset":892},"end":{"line":10,"column":270,"offset":1150},"indent":[]}}],"position":{"start":{"line":10,"column":3,"offset":883},"end":{"line":10,"column":270,"offset":1150},"indent":[]}}],"position":{"start":{"line":10,"column":1,"offset":881},"end":{"line":10,"column":270,"offset":1150},"indent":[]}},{"type":"heading","depth":2,"children":[{"type":"text","value":"Creating the File","position":{"start":{"line":12,"column":4,"offset":1155},"end":{"line":12,"column":21,"offset":1172},"indent":[]}}],"position":{"start":{"line":12,"column":1,"offset":1152},"end":{"line":12,"column":21,"offset":1172},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"Let's start by creating a file inside the inhibitors folder called ","position":{"start":{"line":14,"column":1,"offset":1174},"end":{"line":14,"column":68,"offset":1241},"indent":[]}},{"type":"inlineCode","value":"boosted.ts","position":{"start":{"line":14,"column":68,"offset":1241},"end":{"line":14,"column":80,"offset":1253},"indent":[]}},{"type":"text","value":" and paste the following snippet of code:","position":{"start":{"line":14,"column":80,"offset":1253},"end":{"line":14,"column":121,"offset":1294},"indent":[]}}],"position":{"start":{"line":14,"column":1,"offset":1174},"end":{"line":14,"column":121,"offset":1294},"indent":[]}},{"type":"code","lang":"ts","meta":null,"value":"import { botCache } from \"../../mod.ts\";\n\nbotCache.inhibitors.set(\"inhibitorname\", async function (message, command, guild) {\n\t// Your code goes here\n});","position":{"start":{"line":16,"column":1,"offset":1296},"end":{"line":22,"column":4,"offset":1459},"indent":[1,1,1,1,1,1]}},{"type":"paragraph","children":[{"type":"text","value":"Inhibitors can take up to 3 arguments.","position":{"start":{"line":24,"column":1,"offset":1461},"end":{"line":24,"column":39,"offset":1499},"indent":[]}}],"position":{"start":{"line":24,"column":1,"offset":1461},"end":{"line":24,"column":39,"offset":1499},"indent":[]}},{"type":"list","ordered":false,"start":null,"spread":false,"children":[{"type":"listItem","spread":false,"checked":null,"children":[{"type":"paragraph","children":[{"type":"inlineCode","value":"message","position":{"start":{"line":26,"column":3,"offset":1503},"end":{"line":26,"column":12,"offset":1512},"indent":[]}},{"type":"text","value":": The message object that triggered the command.","position":{"start":{"line":26,"column":12,"offset":1512},"end":{"line":26,"column":60,"offset":1560},"indent":[]}}],"position":{"start":{"line":26,"column":3,"offset":1503},"end":{"line":26,"column":60,"offset":1560},"indent":[]}}],"position":{"start":{"line":26,"column":1,"offset":1501},"end":{"line":26,"column":60,"offset":1560},"indent":[]}},{"type":"listItem","spread":false,"checked":null,"children":[{"type":"paragraph","children":[{"type":"inlineCode","value":"command","position":{"start":{"line":27,"column":3,"offset":1563},"end":{"line":27,"column":12,"offset":1572},"indent":[]}},{"type":"text","value":": The command object itself that was triggered.","position":{"start":{"line":27,"column":12,"offset":1572},"end":{"line":27,"column":59,"offset":1619},"indent":[]}}],"position":{"start":{"line":27,"column":3,"offset":1563},"end":{"line":27,"column":59,"offset":1619},"indent":[]}}],"position":{"start":{"line":27,"column":1,"offset":1561},"end":{"line":27,"column":59,"offset":1619},"indent":[]}},{"type":"listItem","spread":false,"checked":null,"children":[{"type":"paragraph","children":[{"type":"inlineCode","value":"guild","position":{"start":{"line":28,"column":3,"offset":1622},"end":{"line":28,"column":10,"offset":1629},"indent":[]}},{"type":"text","value":": The server guild object where this command was ran.","position":{"start":{"line":28,"column":10,"offset":1629},"end":{"line":28,"column":63,"offset":1682},"indent":[]}}],"position":{"start":{"line":28,"column":3,"offset":1622},"end":{"line":28,"column":63,"offset":1682},"indent":[]}}],"position":{"start":{"line":28,"column":1,"offset":1620},"end":{"line":28,"column":63,"offset":1682},"indent":[]}}],"position":{"start":{"line":26,"column":1,"offset":1501},"end":{"line":28,"column":63,"offset":1682},"indent":[1,1]}},{"type":"heading","depth":2,"children":[{"type":"text","value":"Understanding How Inhibitors Function","position":{"start":{"line":30,"column":4,"offset":1687},"end":{"line":30,"column":41,"offset":1724},"indent":[]}}],"position":{"start":{"line":30,"column":1,"offset":1684},"end":{"line":30,"column":41,"offset":1724},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"To block a command you have to return a truthy value.","position":{"start":{"line":32,"column":1,"offset":1726},"end":{"line":32,"column":54,"offset":1779},"indent":[]}}],"position":{"start":{"line":32,"column":1,"offset":1726},"end":{"line":32,"column":54,"offset":1779},"indent":[]}},{"type":"list","ordered":false,"start":null,"spread":false,"children":[{"type":"listItem","spread":false,"checked":null,"children":[{"type":"paragraph","children":[{"type":"strong","children":[{"type":"text","value":"return true;","position":{"start":{"line":33,"column":5,"offset":1784},"end":{"line":33,"column":17,"offset":1796},"indent":[]}}],"position":{"start":{"line":33,"column":3,"offset":1782},"end":{"line":33,"column":19,"offset":1798},"indent":[]}},{"type":"text","value":" If you return true the inhibitor will block the execution of the command.\nTo allow a command return a falsey value.","position":{"start":{"line":33,"column":19,"offset":1798},"end":{"line":34,"column":42,"offset":1914},"indent":[1]}}],"position":{"start":{"line":33,"column":3,"offset":1782},"end":{"line":34,"column":42,"offset":1914},"indent":[1]}}],"position":{"start":{"line":33,"column":1,"offset":1780},"end":{"line":34,"column":42,"offset":1914},"indent":[1]}},{"type":"listItem","spread":false,"checked":null,"children":[{"type":"paragraph","children":[{"type":"strong","children":[{"type":"text","value":"return false;","position":{"start":{"line":35,"column":5,"offset":1919},"end":{"line":35,"column":18,"offset":1932},"indent":[]}}],"position":{"start":{"line":35,"column":3,"offset":1917},"end":{"line":35,"column":20,"offset":1934},"indent":[]}},{"type":"text","value":" If you return false the inhibitor will not block the error.","position":{"start":{"line":35,"column":20,"offset":1934},"end":{"line":35,"column":80,"offset":1994},"indent":[]}}],"position":{"start":{"line":35,"column":3,"offset":1917},"end":{"line":35,"column":80,"offset":1994},"indent":[]}}],"position":{"start":{"line":35,"column":1,"offset":1915},"end":{"line":35,"column":80,"offset":1994},"indent":[]}}],"position":{"start":{"line":33,"column":1,"offset":1780},"end":{"line":35,"column":80,"offset":1994},"indent":[1,1]}},{"type":"code","lang":"ts","meta":null,"value":"// If the command is not VIP only we can allow this command to execute\nif (!command.vipOnly) return false;\n\n// The bot's support server\nconst guild = cache.guilds.get(configs.supportServerID);\n// If the command author is not in the server they won't have the vip role\nconst member = guild.members.get(message.author.id);\n// so cancel the command\nif (!member) return true;\n// Check if the user has the vip role on the support server given by patreon\nconst userIsVIP = await isUserVIP(message.author.id)\n// The user is VIP so we can allow this command to be used\nif (userIsVIP) return false;\n\n// The user is NOT VIP so we throw an error\nthrow `The ${command.name} is only allowed for VIP users.`","position":{"start":{"line":38,"column":1,"offset":1997},"end":{"line":55,"column":4,"offset":2700},"indent":[1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1]}},{"type":"export","value":"export const _frontmatter = {\"title\":\"Creating Inhibitors!\",\"metaTitle\":\"Creating An Inhibitor | Discordeno\",\"metaDescription\":\"Let's create our very own bot with Discordeno!\"}","position":{"start":{"line":58,"column":1,"offset":2703},"end":{"line":58,"column":177,"offset":2879},"indent":[]}}],"position":{"start":{"line":1,"column":1,"offset":0},"end":{"line":58,"column":177,"offset":2879}}},"scopeImports":["import * as React from 'react'"],"scopeIdentifiers":["React"],"body":"function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }\n\nfunction _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }\n\nfunction _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }\n\n/* @jsx mdx */\nvar _frontmatter = {\n \"title\": \"Creating Inhibitors!\",\n \"metaTitle\": \"Creating An Inhibitor | Discordeno\",\n \"metaDescription\": \"Let's create our very own bot with Discordeno!\"\n};\nvar layoutProps = {\n _frontmatter: _frontmatter\n};\nvar MDXLayout = \"wrapper\";\nreturn function MDXContent(_ref) {\n var components = _ref.components,\n props = _objectWithoutProperties(_ref, [\"components\"]);\n\n return mdx(MDXLayout, _extends({}, layoutProps, props, {\n components: components,\n mdxType: \"MDXLayout\"\n }), mdx(\"p\", null, \"Woah! You are almost half way done with understanding all of Discordeno. Amazing isn't it? Something you may have noticed in the last section was there were some options that prevented some commands from running like \", mdx(\"inlineCode\", {\n parentName: \"p\"\n }, \"dmOnly\"), \" or the permission options. we created a setting to prevent the monitor from running in certain channels. What if we wanted to do prevent commands from happening? How would we prevent commands from running?\"), mdx(\"h2\", null, \"What is an Inhibitor?\"), mdx(\"p\", null, \"An Inhibitor is very similar to how monitors work. A monitor runs on every message but an inhibitor runs on every command. Remember all those command options like cooldown, permissions, permissionLevel, nsfw, etc... Each and every one of these options has an inhibitor in that checks commands for these settings.\"), mdx(\"p\", null, \"Let's create our own inhibitor that would prevent commands from being used if the user is not a VIP user.\"), mdx(\"blockquote\", null, mdx(\"p\", {\n parentName: \"blockquote\"\n }, mdx(\"strong\", {\n parentName: \"p\"\n }, \"Note:\"), \" It is important to remember that everything below can be done with a simple permission level as well. We will create our own custom permission levels but for the purposes of this guide and to be able to learn about Inhibitors, we will be using an inhibitor.\")), mdx(\"h2\", null, \"Creating the File\"), mdx(\"p\", null, \"Let's start by creating a file inside the inhibitors folder called \", mdx(\"inlineCode\", {\n parentName: \"p\"\n }, \"boosted.ts\"), \" and paste the following snippet of code:\"), mdx(\"pre\", null, mdx(\"code\", _extends({\n parentName: \"pre\"\n }, {\n \"className\": \"language-ts\"\n }), \"import { botCache } from \\\"../../mod.ts\\\";\\n\\nbotCache.inhibitors.set(\\\"inhibitorname\\\", async function (message, command, guild) {\\n // Your code goes here\\n});\\n\")), mdx(\"p\", null, \"Inhibitors can take up to 3 arguments.\"), mdx(\"ul\", null, mdx(\"li\", {\n parentName: \"ul\"\n }, mdx(\"inlineCode\", {\n parentName: \"li\"\n }, \"message\"), \": The message object that triggered the command.\"), mdx(\"li\", {\n parentName: \"ul\"\n }, mdx(\"inlineCode\", {\n parentName: \"li\"\n }, \"command\"), \": The command object itself that was triggered.\"), mdx(\"li\", {\n parentName: \"ul\"\n }, mdx(\"inlineCode\", {\n parentName: \"li\"\n }, \"guild\"), \": The server guild object where this command was ran.\")), mdx(\"h2\", null, \"Understanding How Inhibitors Function\"), mdx(\"p\", null, \"To block a command you have to return a truthy value.\"), mdx(\"ul\", null, mdx(\"li\", {\n parentName: \"ul\"\n }, mdx(\"strong\", {\n parentName: \"li\"\n }, \"return true;\"), \" If you return true the inhibitor will block the execution of the command.\\nTo allow a command return a falsey value.\"), mdx(\"li\", {\n parentName: \"ul\"\n }, mdx(\"strong\", {\n parentName: \"li\"\n }, \"return false;\"), \" If you return false the inhibitor will not block the error.\")), mdx(\"pre\", null, mdx(\"code\", _extends({\n parentName: \"pre\"\n }, {\n \"className\": \"language-ts\"\n }), \"// If the command is not VIP only we can allow this command to execute\\nif (!command.vipOnly) return false;\\n\\n// The bot's support server\\nconst guild = cache.guilds.get(configs.supportServerID);\\n// If the command author is not in the server they won't have the vip role\\nconst member = guild.members.get(message.author.id);\\n// so cancel the command\\nif (!member) return true;\\n// Check if the user has the vip role on the support server given by patreon\\nconst userIsVIP = await isUserVIP(message.author.id)\\n// The user is VIP so we can allow this command to be used\\nif (userIsVIP) return false;\\n\\n// The user is NOT VIP so we throw an error\\nthrow `The ${command.name} is only allowed for VIP users.`\\n\")));\n}\n;\nMDXContent.isMDXComponent = true;","rawMDXOutput":"/* @jsx mdx */\nimport { mdx } from '@mdx-js/react';\n/* @jsx mdx */\n\nexport const _frontmatter = {\n \"title\": \"Creating Inhibitors!\",\n \"metaTitle\": \"Creating An Inhibitor | Discordeno\",\n \"metaDescription\": \"Let's create our very own bot with Discordeno!\"\n};\n\nconst layoutProps = {\n _frontmatter\n};\nconst MDXLayout = \"wrapper\"\nexport default function MDXContent({\n components,\n ...props\n}) {\n return \n

{`Woah! You are almost half way done with understanding all of Discordeno. Amazing isn't it? Something you may have noticed in the last section was there were some options that prevented some commands from running like `}{`dmOnly`}{` or the permission options. we created a setting to prevent the monitor from running in certain channels. What if we wanted to do prevent commands from happening? How would we prevent commands from running?`}

\n

{`What is an Inhibitor?`}

\n

{`An Inhibitor is very similar to how monitors work. A monitor runs on every message but an inhibitor runs on every command. Remember all those command options like cooldown, permissions, permissionLevel, nsfw, etc... Each and every one of these options has an inhibitor in that checks commands for these settings.`}

\n

{`Let's create our own inhibitor that would prevent commands from being used if the user is not a VIP user.`}

\n
\n

{`Note:`}{` It is important to remember that everything below can be done with a simple permission level as well. We will create our own custom permission levels but for the purposes of this guide and to be able to learn about Inhibitors, we will be using an inhibitor.`}

\n
\n

{`Creating the File`}

\n

{`Let's start by creating a file inside the inhibitors folder called `}{`boosted.ts`}{` and paste the following snippet of code:`}

\n
{`import { botCache } from \"../../mod.ts\";\n\nbotCache.inhibitors.set(\"inhibitorname\", async function (message, command, guild) {\n    // Your code goes here\n});\n`}
\n

{`Inhibitors can take up to 3 arguments.`}

\n
    \n
  • {`message`}{`: The message object that triggered the command.`}
  • \n
  • {`command`}{`: The command object itself that was triggered.`}
  • \n
  • {`guild`}{`: The server guild object where this command was ran.`}
  • \n
\n

{`Understanding How Inhibitors Function`}

\n

{`To block a command you have to return a truthy value.`}

\n
    \n
  • {`return true;`}{` If you return true the inhibitor will block the execution of the command.\nTo allow a command return a falsey value.`}
  • \n
  • {`return false;`}{` If you return false the inhibitor will not block the error.`}
  • \n
\n
{`// If the command is not VIP only we can allow this command to execute\nif (!command.vipOnly) return false;\n\n// The bot's support server\nconst guild = cache.guilds.get(configs.supportServerID);\n// If the command author is not in the server they won't have the vip role\nconst member = guild.members.get(message.author.id);\n// so cancel the command\nif (!member) return true;\n// Check if the user has the vip role on the support server given by patreon\nconst userIsVIP = await isUserVIP(message.author.id)\n// The user is VIP so we can allow this command to be used\nif (userIsVIP) return false;\n\n// The user is NOT VIP so we throw an error\nthrow \\`The \\${command.name} is only allowed for VIP users.\\`\n`}
\n\n
;\n}\n\n;\nMDXContent.isMDXComponent = true;"}} \ No newline at end of file diff --git a/docs/.cache/caches/gatsby-plugin-mdx/diskstore-7624176d8560d4dc695be036bfbeccc9.json b/docs/.cache/caches/gatsby-plugin-mdx/diskstore-7624176d8560d4dc695be036bfbeccc9.json new file mode 100644 index 000000000..3d4ab1b5d --- /dev/null +++ b/docs/.cache/caches/gatsby-plugin-mdx/diskstore-7624176d8560d4dc695be036bfbeccc9.json @@ -0,0 +1 @@ +{"expireTime":9007200851644288000,"key":"gatsby-plugin-mdx-entire-payload-faa61a4d8bbf9072d27366558d378a29-","val":{"mdast":{"type":"root","children":[{"type":"paragraph","children":[{"type":"text","value":"Discordeno will help make Discord bot development much easier. Don't worry, as you go through this guide it will make a lot more sense.","position":{"start":{"line":2,"column":1,"offset":1},"end":{"line":2,"column":136,"offset":136},"indent":[]}}],"position":{"start":{"line":2,"column":1,"offset":1},"end":{"line":2,"column":136,"offset":136},"indent":[]}},{"type":"heading","depth":2,"children":[{"type":"text","value":"Creating The Bot!","position":{"start":{"line":4,"column":4,"offset":141},"end":{"line":4,"column":21,"offset":158},"indent":[]}}],"position":{"start":{"line":4,"column":1,"offset":138},"end":{"line":4,"column":21,"offset":158},"indent":[]}},{"type":"blockquote","children":[{"type":"paragraph","children":[{"type":"text","value":"This guide is going to assume you already have the basic requirements to make a bot ready. This includes github, git, a code editor like Visual Studio Code. If you don't have these yet please prepare them first before going forward.","position":{"start":{"line":6,"column":3,"offset":162},"end":{"line":6,"column":235,"offset":394},"indent":[]}}],"position":{"start":{"line":6,"column":3,"offset":162},"end":{"line":6,"column":235,"offset":394},"indent":[]}}],"position":{"start":{"line":6,"column":1,"offset":160},"end":{"line":6,"column":235,"offset":394},"indent":[]}},{"type":"list","ordered":false,"start":null,"spread":true,"children":[{"type":"listItem","spread":false,"checked":null,"children":[{"type":"paragraph","children":[{"type":"text","value":"First, create a Discordeno Bot using the ","position":{"start":{"line":8,"column":3,"offset":398},"end":{"line":8,"column":44,"offset":439},"indent":[]}},{"type":"link","title":null,"url":"https://github.com/Skillz4Killz/Discordeno-bot-template","children":[{"type":"text","value":"Generator Boilerplate","position":{"start":{"line":8,"column":45,"offset":440},"end":{"line":8,"column":66,"offset":461},"indent":[]}}],"position":{"start":{"line":8,"column":44,"offset":439},"end":{"line":8,"column":124,"offset":519},"indent":[]}},{"type":"text","value":". Give it any name you like. For the purpose of this guide we will call it, Stargate.","position":{"start":{"line":8,"column":124,"offset":519},"end":{"line":8,"column":209,"offset":604},"indent":[]}}],"position":{"start":{"line":8,"column":3,"offset":398},"end":{"line":8,"column":209,"offset":604},"indent":[]}}],"position":{"start":{"line":8,"column":1,"offset":396},"end":{"line":9,"column":1,"offset":605},"indent":[1]}},{"type":"listItem","spread":false,"checked":null,"children":[{"type":"paragraph","children":[{"type":"text","value":"Then ","position":{"start":{"line":10,"column":3,"offset":608},"end":{"line":10,"column":8,"offset":613},"indent":[]}},{"type":"inlineCode","value":"git clone https://github.com/Skillz4Killz/Stargate.git","position":{"start":{"line":10,"column":8,"offset":613},"end":{"line":10,"column":64,"offset":669},"indent":[]}}],"position":{"start":{"line":10,"column":3,"offset":608},"end":{"line":10,"column":64,"offset":669},"indent":[]}}],"position":{"start":{"line":10,"column":1,"offset":606},"end":{"line":11,"column":1,"offset":670},"indent":[1]}},{"type":"listItem","spread":false,"checked":null,"children":[{"type":"paragraph","children":[{"type":"text","value":"When that is done, go ahead and open up the folder with VSC.","position":{"start":{"line":12,"column":3,"offset":673},"end":{"line":12,"column":63,"offset":733},"indent":[]}}],"position":{"start":{"line":12,"column":3,"offset":673},"end":{"line":12,"column":63,"offset":733},"indent":[]}}],"position":{"start":{"line":12,"column":1,"offset":671},"end":{"line":12,"column":63,"offset":733},"indent":[]}},{"type":"listItem","spread":false,"checked":null,"children":[{"type":"paragraph","children":[{"type":"text","value":"Create a new file called ","position":{"start":{"line":13,"column":3,"offset":736},"end":{"line":13,"column":28,"offset":761},"indent":[]}},{"type":"inlineCode","value":"configs.ts","position":{"start":{"line":13,"column":28,"offset":761},"end":{"line":13,"column":40,"offset":773},"indent":[]}},{"type":"text","value":". Open the ","position":{"start":{"line":13,"column":40,"offset":773},"end":{"line":13,"column":51,"offset":784},"indent":[]}},{"type":"inlineCode","value":"configs.example.ts","position":{"start":{"line":13,"column":51,"offset":784},"end":{"line":13,"column":71,"offset":804},"indent":[]}},{"type":"text","value":" file and copy everything over.","position":{"start":{"line":13,"column":71,"offset":804},"end":{"line":13,"column":102,"offset":835},"indent":[]}}],"position":{"start":{"line":13,"column":3,"offset":736},"end":{"line":13,"column":102,"offset":835},"indent":[]}}],"position":{"start":{"line":13,"column":1,"offset":734},"end":{"line":13,"column":102,"offset":835},"indent":[]}}],"position":{"start":{"line":8,"column":1,"offset":396},"end":{"line":13,"column":102,"offset":835},"indent":[1,1,1,1,1]}},{"type":"paragraph","children":[{"type":"text","value":"Let's take a minute to review all the options we have available to us.","position":{"start":{"line":15,"column":1,"offset":837},"end":{"line":15,"column":71,"offset":907},"indent":[]}}],"position":{"start":{"line":15,"column":1,"offset":837},"end":{"line":15,"column":71,"offset":907},"indent":[]}},{"type":"heading","depth":3,"children":[{"type":"text","value":"Configs File","position":{"start":{"line":17,"column":5,"offset":913},"end":{"line":17,"column":17,"offset":925},"indent":[]}}],"position":{"start":{"line":17,"column":1,"offset":909},"end":{"line":17,"column":17,"offset":925},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"The ","position":{"start":{"line":19,"column":1,"offset":927},"end":{"line":19,"column":5,"offset":931},"indent":[]}},{"type":"inlineCode","value":"configs.ts","position":{"start":{"line":19,"column":5,"offset":931},"end":{"line":19,"column":17,"offset":943},"indent":[]}},{"type":"text","value":" file is where you will keep all your secret info you don't want to share with anyone else. As long as ","position":{"start":{"line":19,"column":17,"offset":943},"end":{"line":19,"column":120,"offset":1046},"indent":[]}},{"type":"inlineCode","value":".gitignore","position":{"start":{"line":19,"column":120,"offset":1046},"end":{"line":19,"column":132,"offset":1058},"indent":[]}},{"type":"text","value":" file is ignoring configs.ts your configurations will be kept private!","position":{"start":{"line":19,"column":132,"offset":1058},"end":{"line":19,"column":202,"offset":1128},"indent":[]}}],"position":{"start":{"line":19,"column":1,"offset":927},"end":{"line":19,"column":202,"offset":1128},"indent":[]}},{"type":"code","lang":"ts","meta":null,"value":"// Step 1: Remove the `.example` from this file name so it is called `configs.ts`\n// Step 2: Add all your bot's information below. The only required one is token and prefix. NOTE: As long as `.gitignore` file is ignoring configs.ts your configurations will be kept private!\n// Step 3: Remove these comments if you like.\n\nexport const configs = {\n // Your bot token goes here\n token: \"\",\n // The default prefix for your bot. Don't worry guilds can change this later.\n prefix: \"!\",\n // This isn't required but you can add bot list api keys here.\n botListTokens: {\n DISCORD_BOT_ORG: \"\",\n BOTS_ON_DISCORD: \"\",\n DISCORD_BOT_LIST: \"\",\n BOTS_FOR_DISCORD: \"\",\n DISCORD_BOATS: \"\",\n DISCORD_BOTS_GG: \"\",\n DISCORD_BOTS_GROUP: \"\",\n },\n // This is the server id for your bot's main server where users can get help/support\n supportServerID: \"\",\n // These are channel ids that will enable some functionality\n channelIDs: {\n // When a translation is missing this is the channel you will be alerted in.\n missingTranslation: \"\",\n // When an error occurs, we will try and log it to this channel\n errorChannelID: \"\"\n },\n // These are the role ids that will enable some functionality.\n roleIDs: {\n // If you have a patreon set up you can add the patreon vip role id here.\n patreonVIPRoleID: \"\",\n },\n // These are the user ids that will enable some functionality.\n userIDs: {\n // The user ids for the support team\n botSupporters: [],\n // The user ids for the other devs on your team\n botDevs: [],\n // The user ids who have complete 100% access to your bot\n botOwners: []\n }\n};\n","position":{"start":{"line":21,"column":1,"offset":1130},"end":{"line":66,"column":4,"offset":2770},"indent":[1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1]}},{"type":"heading","depth":4,"children":[{"type":"text","value":"Token","position":{"start":{"line":68,"column":6,"offset":2777},"end":{"line":68,"column":11,"offset":2782},"indent":[]}}],"position":{"start":{"line":68,"column":1,"offset":2772},"end":{"line":68,"column":11,"offset":2782},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"First, add your bot token. This is ","position":{"start":{"line":70,"column":1,"offset":2784},"end":{"line":70,"column":36,"offset":2819},"indent":[]}},{"type":"strong","children":[{"type":"text","value":"required","position":{"start":{"line":70,"column":38,"offset":2821},"end":{"line":70,"column":46,"offset":2829},"indent":[]}}],"position":{"start":{"line":70,"column":36,"offset":2819},"end":{"line":70,"column":48,"offset":2831},"indent":[]}},{"type":"text","value":" for the bot to start. Review the ","position":{"start":{"line":70,"column":48,"offset":2831},"end":{"line":70,"column":82,"offset":2865},"indent":[]}},{"type":"link","title":null,"url":"https://discordeno.netlify.app/gettingstarted#creatingyourfirstdiscordbotapplication","children":[{"type":"text","value":"instructions","position":{"start":{"line":70,"column":83,"offset":2866},"end":{"line":70,"column":95,"offset":2878},"indent":[]}}],"position":{"start":{"line":70,"column":82,"offset":2865},"end":{"line":70,"column":182,"offset":2965},"indent":[]}},{"type":"text","value":" if you have not made your token yet.","position":{"start":{"line":70,"column":182,"offset":2965},"end":{"line":70,"column":219,"offset":3002},"indent":[]}}],"position":{"start":{"line":70,"column":1,"offset":2784},"end":{"line":70,"column":219,"offset":3002},"indent":[]}},{"type":"heading","depth":4,"children":[{"type":"text","value":"Prefix","position":{"start":{"line":72,"column":6,"offset":3009},"end":{"line":72,"column":12,"offset":3015},"indent":[]}}],"position":{"start":{"line":72,"column":1,"offset":3004},"end":{"line":72,"column":12,"offset":3015},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"The prefix is where you will set the default prefix for your bot. Don't worry, every server will be able to choose their own prefix but we need a default prefix to start.","position":{"start":{"line":74,"column":1,"offset":3017},"end":{"line":74,"column":171,"offset":3187},"indent":[]}}],"position":{"start":{"line":74,"column":1,"offset":3017},"end":{"line":74,"column":171,"offset":3187},"indent":[]}},{"type":"heading","depth":4,"children":[{"type":"text","value":"Bot Lists Tokens","position":{"start":{"line":76,"column":6,"offset":3194},"end":{"line":76,"column":22,"offset":3210},"indent":[]}}],"position":{"start":{"line":76,"column":1,"offset":3189},"end":{"line":76,"column":22,"offset":3210},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"This section of the file is so you can easily have your bot's statistics updated on all the bot lists out there to help you grow your bot. The code is already written to handle this but you will need to do 3 things for each bot list.","position":{"start":{"line":78,"column":1,"offset":3212},"end":{"line":78,"column":234,"offset":3445},"indent":[]}}],"position":{"start":{"line":78,"column":1,"offset":3212},"end":{"line":78,"column":234,"offset":3445},"indent":[]}},{"type":"list","ordered":true,"start":1,"spread":false,"children":[{"type":"listItem","spread":false,"checked":null,"children":[{"type":"paragraph","children":[{"type":"text","value":"Go to the bot list and add your bot to their website. (Each site has it's own instructions)","position":{"start":{"line":80,"column":4,"offset":3450},"end":{"line":80,"column":95,"offset":3541},"indent":[]}}],"position":{"start":{"line":80,"column":4,"offset":3450},"end":{"line":80,"column":95,"offset":3541},"indent":[]}}],"position":{"start":{"line":80,"column":1,"offset":3447},"end":{"line":80,"column":95,"offset":3541},"indent":[]}},{"type":"listItem","spread":false,"checked":null,"children":[{"type":"paragraph","children":[{"type":"text","value":"Create a token for yourself on each website and paste it in your configs.","position":{"start":{"line":81,"column":4,"offset":3545},"end":{"line":81,"column":77,"offset":3618},"indent":[]}}],"position":{"start":{"line":81,"column":4,"offset":3545},"end":{"line":81,"column":77,"offset":3618},"indent":[]}}],"position":{"start":{"line":81,"column":1,"offset":3542},"end":{"line":81,"column":77,"offset":3618},"indent":[]}},{"type":"listItem","spread":false,"checked":null,"children":[{"type":"paragraph","children":[{"type":"text","value":"Enjoy!","position":{"start":{"line":82,"column":4,"offset":3622},"end":{"line":82,"column":10,"offset":3628},"indent":[]}}],"position":{"start":{"line":82,"column":4,"offset":3622},"end":{"line":82,"column":10,"offset":3628},"indent":[]}}],"position":{"start":{"line":82,"column":1,"offset":3619},"end":{"line":82,"column":10,"offset":3628},"indent":[]}}],"position":{"start":{"line":80,"column":1,"offset":3447},"end":{"line":82,"column":10,"offset":3628},"indent":[1,1]}},{"type":"paragraph","children":[{"type":"text","value":"If you wish to customize the code, you will find the bot list tasks in the tasks folder. Don't worry we will discuss this when we get to the tasks section of the guide.","position":{"start":{"line":84,"column":1,"offset":3630},"end":{"line":84,"column":169,"offset":3798},"indent":[]}}],"position":{"start":{"line":84,"column":1,"offset":3630},"end":{"line":84,"column":169,"offset":3798},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"For now just remember, that Discordeno provides you a built in way to update most discord bot lists.","position":{"start":{"line":86,"column":1,"offset":3800},"end":{"line":86,"column":101,"offset":3900},"indent":[]}}],"position":{"start":{"line":86,"column":1,"offset":3800},"end":{"line":86,"column":101,"offset":3900},"indent":[]}},{"type":"heading","depth":4,"children":[{"type":"text","value":"Channel IDs","position":{"start":{"line":88,"column":6,"offset":3907},"end":{"line":88,"column":17,"offset":3918},"indent":[]}}],"position":{"start":{"line":88,"column":1,"offset":3902},"end":{"line":88,"column":17,"offset":3918},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"The channelIDs section holds the channel IDs that are useful for specific features to help give you alerts/notifications. For example, the ","position":{"start":{"line":90,"column":1,"offset":3920},"end":{"line":90,"column":140,"offset":4059},"indent":[]}},{"type":"inlineCode","value":"missingTranslation","position":{"start":{"line":90,"column":140,"offset":4059},"end":{"line":90,"column":160,"offset":4079},"indent":[]}},{"type":"text","value":" channel will be where messages are sent alerting you that somewhere in your code you are trying to use a translation key that you never created.","position":{"start":{"line":90,"column":160,"offset":4079},"end":{"line":90,"column":305,"offset":4224},"indent":[]}}],"position":{"start":{"line":90,"column":1,"offset":3920},"end":{"line":90,"column":305,"offset":4224},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"When you get to around 25,000 Discord servers on your bot, you may want to convert these channel IDs to webhooks.","position":{"start":{"line":92,"column":1,"offset":4226},"end":{"line":92,"column":114,"offset":4339},"indent":[]}}],"position":{"start":{"line":92,"column":1,"offset":4226},"end":{"line":92,"column":114,"offset":4339},"indent":[]}},{"type":"heading","depth":4,"children":[{"type":"text","value":"Role IDs","position":{"start":{"line":94,"column":6,"offset":4346},"end":{"line":94,"column":14,"offset":4354},"indent":[]}}],"position":{"start":{"line":94,"column":1,"offset":4341},"end":{"line":94,"column":14,"offset":4354},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"The roleIDs section holds the role IDs that are useful for specific features. For example, the ","position":{"start":{"line":96,"column":1,"offset":4356},"end":{"line":96,"column":96,"offset":4451},"indent":[]}},{"type":"inlineCode","value":"patreonVIPRoleID","position":{"start":{"line":96,"column":96,"offset":4451},"end":{"line":96,"column":114,"offset":4469},"indent":[]}},{"type":"text","value":" role can be used easily to enable vip features later in this guide.","position":{"start":{"line":96,"column":114,"offset":4469},"end":{"line":96,"column":182,"offset":4537},"indent":[]}}],"position":{"start":{"line":96,"column":1,"offset":4356},"end":{"line":96,"column":182,"offset":4537},"indent":[]}},{"type":"heading","depth":4,"children":[{"type":"text","value":"User IDs","position":{"start":{"line":98,"column":6,"offset":4544},"end":{"line":98,"column":14,"offset":4552},"indent":[]}}],"position":{"start":{"line":98,"column":1,"offset":4539},"end":{"line":98,"column":14,"offset":4552},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"The userIDs section holds the user IDs that are useful for specific features. For example, the ","position":{"start":{"line":100,"column":1,"offset":4554},"end":{"line":100,"column":96,"offset":4649},"indent":[]}},{"type":"inlineCode","value":"botDevs","position":{"start":{"line":100,"column":96,"offset":4649},"end":{"line":100,"column":105,"offset":4658},"indent":[]}},{"type":"text","value":" and such are useful for permission levels as you will see in the Permission Level part of the guide.","position":{"start":{"line":100,"column":105,"offset":4658},"end":{"line":100,"column":206,"offset":4759},"indent":[]}}],"position":{"start":{"line":100,"column":1,"offset":4554},"end":{"line":100,"column":206,"offset":4759},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"When you get to around 25,000 Discord servers on your bot, you may want to convert these user IDs to webhooks.","position":{"start":{"line":102,"column":1,"offset":4761},"end":{"line":102,"column":111,"offset":4871},"indent":[]}}],"position":{"start":{"line":102,"column":1,"offset":4761},"end":{"line":102,"column":111,"offset":4871},"indent":[]}},{"type":"heading","depth":2,"children":[{"type":"text","value":"It's Alive!","position":{"start":{"line":104,"column":4,"offset":4876},"end":{"line":104,"column":15,"offset":4887},"indent":[]}}],"position":{"start":{"line":104,"column":1,"offset":4873},"end":{"line":104,"column":15,"offset":4887},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"Oh my god! You now have a bot with a bunch of features already! You don't believe me? Well, seeing is believing, so start the bot.","position":{"start":{"line":106,"column":1,"offset":4889},"end":{"line":106,"column":131,"offset":5019},"indent":[]}}],"position":{"start":{"line":106,"column":1,"offset":4889},"end":{"line":106,"column":131,"offset":5019},"indent":[]}},{"type":"list","ordered":true,"start":1,"spread":false,"children":[{"type":"listItem","spread":false,"checked":null,"children":[{"type":"paragraph","children":[{"type":"text","value":"Invite your bot to a discord server.","position":{"start":{"line":108,"column":4,"offset":5024},"end":{"line":108,"column":40,"offset":5060},"indent":[]}}],"position":{"start":{"line":108,"column":4,"offset":5024},"end":{"line":108,"column":40,"offset":5060},"indent":[]}}],"position":{"start":{"line":108,"column":1,"offset":5021},"end":{"line":108,"column":40,"offset":5060},"indent":[]}},{"type":"listItem","spread":false,"checked":null,"children":[{"type":"paragraph","children":[{"type":"text","value":"Open up the integrated terminal in VSC using ","position":{"start":{"line":109,"column":4,"offset":5064},"end":{"line":109,"column":49,"offset":5109},"indent":[]}},{"type":"strong","children":[{"type":"text","value":"CTRL + `","position":{"start":{"line":109,"column":51,"offset":5111},"end":{"line":109,"column":59,"offset":5119},"indent":[]}}],"position":{"start":{"line":109,"column":49,"offset":5109},"end":{"line":109,"column":61,"offset":5121},"indent":[]}},{"type":"text","value":". If you use a Mac, replace CTRL with CMD.","position":{"start":{"line":109,"column":61,"offset":5121},"end":{"line":109,"column":103,"offset":5163},"indent":[]}}],"position":{"start":{"line":109,"column":4,"offset":5064},"end":{"line":109,"column":103,"offset":5163},"indent":[]}}],"position":{"start":{"line":109,"column":1,"offset":5061},"end":{"line":109,"column":103,"offset":5163},"indent":[]}},{"type":"listItem","spread":false,"checked":null,"children":[{"type":"paragraph","children":[{"type":"text","value":"Run the script below:","position":{"start":{"line":110,"column":4,"offset":5167},"end":{"line":110,"column":25,"offset":5188},"indent":[]}}],"position":{"start":{"line":110,"column":4,"offset":5167},"end":{"line":110,"column":25,"offset":5188},"indent":[]}}],"position":{"start":{"line":110,"column":1,"offset":5164},"end":{"line":110,"column":25,"offset":5188},"indent":[]}}],"position":{"start":{"line":108,"column":1,"offset":5021},"end":{"line":110,"column":25,"offset":5188},"indent":[1,1]}},{"type":"code","lang":"shell","meta":null,"value":"deno run --allow-net --allow-read mod.ts","position":{"start":{"line":112,"column":1,"offset":5190},"end":{"line":114,"column":4,"offset":5243},"indent":[1,1]}},{"type":"paragraph","children":[{"type":"text","value":"The first time you run it, you may see a lot of files being loaded. This is preparing all the magic behind the scene. Once it is ready, you will see something like this:","position":{"start":{"line":116,"column":1,"offset":5245},"end":{"line":116,"column":170,"offset":5414},"indent":[]}}],"position":{"start":{"line":116,"column":1,"offset":5245},"end":{"line":116,"column":170,"offset":5414},"indent":[]}},{"type":"paragraph","children":[{"type":"image","title":null,"url":"https://i.imgur.com/TOXjLgh.png","alt":"image","position":{"start":{"line":118,"column":1,"offset":5416},"end":{"line":118,"column":42,"offset":5457},"indent":[]}}],"position":{"start":{"line":118,"column":1,"offset":5416},"end":{"line":118,"column":42,"offset":5457},"indent":[]}},{"type":"heading","depth":2,"children":[{"type":"text","value":"Understanding What Discordeno Did","position":{"start":{"line":120,"column":4,"offset":5462},"end":{"line":120,"column":37,"offset":5495},"indent":[]}}],"position":{"start":{"line":120,"column":1,"offset":5459},"end":{"line":120,"column":37,"offset":5495},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"Discordeno includes these commands/folders as they are essential for any discord bot to have in order to meet the Discord Bot Best Practices. It also adds a few things that will help make some things easier to build a bot.","position":{"start":{"line":122,"column":1,"offset":5497},"end":{"line":122,"column":223,"offset":5719},"indent":[]}}],"position":{"start":{"line":122,"column":1,"offset":5497},"end":{"line":122,"column":223,"offset":5719},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"We will dive into these deeper in this guide. Let's take it step by step.","position":{"start":{"line":124,"column":1,"offset":5721},"end":{"line":124,"column":74,"offset":5794},"indent":[]}}],"position":{"start":{"line":124,"column":1,"offset":5721},"end":{"line":124,"column":74,"offset":5794},"indent":[]}},{"type":"export","value":"export const _frontmatter = {\"title\":\"Creating The Bot!\",\"metaTitle\":\"Creating A Bot | Discordeno\",\"metaDescription\":\"Let's create our very own bot with Discordeno!\"}","position":{"start":{"line":127,"column":1,"offset":5797},"end":{"line":127,"column":167,"offset":5963},"indent":[]}}],"position":{"start":{"line":1,"column":1,"offset":0},"end":{"line":127,"column":167,"offset":5963}}},"scopeImports":["import * as React from 'react'"],"scopeIdentifiers":["React"],"body":"function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }\n\nfunction _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }\n\nfunction _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }\n\n/* @jsx mdx */\nvar _frontmatter = {\n \"title\": \"Creating The Bot!\",\n \"metaTitle\": \"Creating A Bot | Discordeno\",\n \"metaDescription\": \"Let's create our very own bot with Discordeno!\"\n};\nvar layoutProps = {\n _frontmatter: _frontmatter\n};\nvar MDXLayout = \"wrapper\";\nreturn function MDXContent(_ref) {\n var components = _ref.components,\n props = _objectWithoutProperties(_ref, [\"components\"]);\n\n return mdx(MDXLayout, _extends({}, layoutProps, props, {\n components: components,\n mdxType: \"MDXLayout\"\n }), mdx(\"p\", null, \"Discordeno will help make Discord bot development much easier. Don't worry, as you go through this guide it will make a lot more sense.\"), mdx(\"h2\", null, \"Creating The Bot!\"), mdx(\"blockquote\", null, mdx(\"p\", {\n parentName: \"blockquote\"\n }, \"This guide is going to assume you already have the basic requirements to make a bot ready. This includes github, git, a code editor like Visual Studio Code. If you don't have these yet please prepare them first before going forward.\")), mdx(\"ul\", null, mdx(\"li\", {\n parentName: \"ul\"\n }, mdx(\"p\", {\n parentName: \"li\"\n }, \"First, create a Discordeno Bot using the \", mdx(\"a\", _extends({\n parentName: \"p\"\n }, {\n \"href\": \"https://github.com/Skillz4Killz/Discordeno-bot-template\"\n }), \"Generator Boilerplate\"), \". Give it any name you like. For the purpose of this guide we will call it, Stargate.\")), mdx(\"li\", {\n parentName: \"ul\"\n }, mdx(\"p\", {\n parentName: \"li\"\n }, \"Then \", mdx(\"inlineCode\", {\n parentName: \"p\"\n }, \"git clone https://github.com/Skillz4Killz/Stargate.git\"))), mdx(\"li\", {\n parentName: \"ul\"\n }, mdx(\"p\", {\n parentName: \"li\"\n }, \"When that is done, go ahead and open up the folder with VSC.\")), mdx(\"li\", {\n parentName: \"ul\"\n }, mdx(\"p\", {\n parentName: \"li\"\n }, \"Create a new file called \", mdx(\"inlineCode\", {\n parentName: \"p\"\n }, \"configs.ts\"), \". Open the \", mdx(\"inlineCode\", {\n parentName: \"p\"\n }, \"configs.example.ts\"), \" file and copy everything over.\"))), mdx(\"p\", null, \"Let's take a minute to review all the options we have available to us.\"), mdx(\"h3\", null, \"Configs File\"), mdx(\"p\", null, \"The \", mdx(\"inlineCode\", {\n parentName: \"p\"\n }, \"configs.ts\"), \" file is where you will keep all your secret info you don't want to share with anyone else. As long as \", mdx(\"inlineCode\", {\n parentName: \"p\"\n }, \".gitignore\"), \" file is ignoring configs.ts your configurations will be kept private!\"), mdx(\"pre\", null, mdx(\"code\", _extends({\n parentName: \"pre\"\n }, {\n \"className\": \"language-ts\"\n }), \"// Step 1: Remove the `.example` from this file name so it is called `configs.ts`\\n// Step 2: Add all your bot's information below. The only required one is token and prefix. NOTE: As long as `.gitignore` file is ignoring configs.ts your configurations will be kept private!\\n// Step 3: Remove these comments if you like.\\n\\nexport const configs = {\\n // Your bot token goes here\\n token: \\\"\\\",\\n // The default prefix for your bot. Don't worry guilds can change this later.\\n prefix: \\\"!\\\",\\n // This isn't required but you can add bot list api keys here.\\n botListTokens: {\\n DISCORD_BOT_ORG: \\\"\\\",\\n BOTS_ON_DISCORD: \\\"\\\",\\n DISCORD_BOT_LIST: \\\"\\\",\\n BOTS_FOR_DISCORD: \\\"\\\",\\n DISCORD_BOATS: \\\"\\\",\\n DISCORD_BOTS_GG: \\\"\\\",\\n DISCORD_BOTS_GROUP: \\\"\\\",\\n },\\n // This is the server id for your bot's main server where users can get help/support\\n supportServerID: \\\"\\\",\\n // These are channel ids that will enable some functionality\\n channelIDs: {\\n // When a translation is missing this is the channel you will be alerted in.\\n missingTranslation: \\\"\\\",\\n // When an error occurs, we will try and log it to this channel\\n errorChannelID: \\\"\\\"\\n },\\n // These are the role ids that will enable some functionality.\\n roleIDs: {\\n // If you have a patreon set up you can add the patreon vip role id here.\\n patreonVIPRoleID: \\\"\\\",\\n },\\n // These are the user ids that will enable some functionality.\\n userIDs: {\\n // The user ids for the support team\\n botSupporters: [],\\n // The user ids for the other devs on your team\\n botDevs: [],\\n // The user ids who have complete 100% access to your bot\\n botOwners: []\\n }\\n};\\n\\n\")), mdx(\"h4\", null, \"Token\"), mdx(\"p\", null, \"First, add your bot token. This is \", mdx(\"strong\", {\n parentName: \"p\"\n }, \"required\"), \" for the bot to start. Review the \", mdx(\"a\", _extends({\n parentName: \"p\"\n }, {\n \"href\": \"https://discordeno.netlify.app/gettingstarted#creatingyourfirstdiscordbotapplication\"\n }), \"instructions\"), \" if you have not made your token yet.\"), mdx(\"h4\", null, \"Prefix\"), mdx(\"p\", null, \"The prefix is where you will set the default prefix for your bot. Don't worry, every server will be able to choose their own prefix but we need a default prefix to start.\"), mdx(\"h4\", null, \"Bot Lists Tokens\"), mdx(\"p\", null, \"This section of the file is so you can easily have your bot's statistics updated on all the bot lists out there to help you grow your bot. The code is already written to handle this but you will need to do 3 things for each bot list.\"), mdx(\"ol\", null, mdx(\"li\", {\n parentName: \"ol\"\n }, \"Go to the bot list and add your bot to their website. (Each site has it's own instructions)\"), mdx(\"li\", {\n parentName: \"ol\"\n }, \"Create a token for yourself on each website and paste it in your configs.\"), mdx(\"li\", {\n parentName: \"ol\"\n }, \"Enjoy!\")), mdx(\"p\", null, \"If you wish to customize the code, you will find the bot list tasks in the tasks folder. Don't worry we will discuss this when we get to the tasks section of the guide.\"), mdx(\"p\", null, \"For now just remember, that Discordeno provides you a built in way to update most discord bot lists.\"), mdx(\"h4\", null, \"Channel IDs\"), mdx(\"p\", null, \"The channelIDs section holds the channel IDs that are useful for specific features to help give you alerts/notifications. For example, the \", mdx(\"inlineCode\", {\n parentName: \"p\"\n }, \"missingTranslation\"), \" channel will be where messages are sent alerting you that somewhere in your code you are trying to use a translation key that you never created.\"), mdx(\"p\", null, \"When you get to around 25,000 Discord servers on your bot, you may want to convert these channel IDs to webhooks.\"), mdx(\"h4\", null, \"Role IDs\"), mdx(\"p\", null, \"The roleIDs section holds the role IDs that are useful for specific features. For example, the \", mdx(\"inlineCode\", {\n parentName: \"p\"\n }, \"patreonVIPRoleID\"), \" role can be used easily to enable vip features later in this guide.\"), mdx(\"h4\", null, \"User IDs\"), mdx(\"p\", null, \"The userIDs section holds the user IDs that are useful for specific features. For example, the \", mdx(\"inlineCode\", {\n parentName: \"p\"\n }, \"botDevs\"), \" and such are useful for permission levels as you will see in the Permission Level part of the guide.\"), mdx(\"p\", null, \"When you get to around 25,000 Discord servers on your bot, you may want to convert these user IDs to webhooks.\"), mdx(\"h2\", null, \"It's Alive!\"), mdx(\"p\", null, \"Oh my god! You now have a bot with a bunch of features already! You don't believe me? Well, seeing is believing, so start the bot.\"), mdx(\"ol\", null, mdx(\"li\", {\n parentName: \"ol\"\n }, \"Invite your bot to a discord server.\"), mdx(\"li\", {\n parentName: \"ol\"\n }, \"Open up the integrated terminal in VSC using \", mdx(\"strong\", {\n parentName: \"li\"\n }, \"CTRL + `\"), \". If you use a Mac, replace CTRL with CMD.\"), mdx(\"li\", {\n parentName: \"ol\"\n }, \"Run the script below:\")), mdx(\"pre\", null, mdx(\"code\", _extends({\n parentName: \"pre\"\n }, {\n \"className\": \"language-shell\"\n }), \"deno run --allow-net --allow-read mod.ts\\n\")), mdx(\"p\", null, \"The first time you run it, you may see a lot of files being loaded. This is preparing all the magic behind the scene. Once it is ready, you will see something like this:\"), mdx(\"p\", null, mdx(\"img\", _extends({\n parentName: \"p\"\n }, {\n \"src\": \"https://i.imgur.com/TOXjLgh.png\",\n \"alt\": \"image\"\n }))), mdx(\"h2\", null, \"Understanding What Discordeno Did\"), mdx(\"p\", null, \"Discordeno includes these commands/folders as they are essential for any discord bot to have in order to meet the Discord Bot Best Practices. It also adds a few things that will help make some things easier to build a bot.\"), mdx(\"p\", null, \"We will dive into these deeper in this guide. Let's take it step by step.\"));\n}\n;\nMDXContent.isMDXComponent = true;","rawMDXOutput":"/* @jsx mdx */\nimport { mdx } from '@mdx-js/react';\n/* @jsx mdx */\n\nexport const _frontmatter = {\n \"title\": \"Creating The Bot!\",\n \"metaTitle\": \"Creating A Bot | Discordeno\",\n \"metaDescription\": \"Let's create our very own bot with Discordeno!\"\n};\n\nconst layoutProps = {\n _frontmatter\n};\nconst MDXLayout = \"wrapper\"\nexport default function MDXContent({\n components,\n ...props\n}) {\n return \n

{`Discordeno will help make Discord bot development much easier. Don't worry, as you go through this guide it will make a lot more sense.`}

\n

{`Creating The Bot!`}

\n
\n

{`This guide is going to assume you already have the basic requirements to make a bot ready. This includes github, git, a code editor like Visual Studio Code. If you don't have these yet please prepare them first before going forward.`}

\n
\n
    \n
  • \n

    {`First, create a Discordeno Bot using the `}{`Generator Boilerplate`}{`. Give it any name you like. For the purpose of this guide we will call it, Stargate.`}

    \n
  • \n
  • \n

    {`Then `}{`git clone https://github.com/Skillz4Killz/Stargate.git`}

    \n
  • \n
  • \n

    {`When that is done, go ahead and open up the folder with VSC.`}

    \n
  • \n
  • \n

    {`Create a new file called `}{`configs.ts`}{`. Open the `}{`configs.example.ts`}{` file and copy everything over.`}

    \n
  • \n
\n

{`Let's take a minute to review all the options we have available to us.`}

\n

{`Configs File`}

\n

{`The `}{`configs.ts`}{` file is where you will keep all your secret info you don't want to share with anyone else. As long as `}{`.gitignore`}{` file is ignoring configs.ts your configurations will be kept private!`}

\n
{`// Step 1: Remove the \\`.example\\` from this file name so it is called \\`configs.ts\\`\n// Step 2: Add all your bot's information below. The only required one is token and prefix. NOTE: As long as \\`.gitignore\\` file is ignoring configs.ts your configurations will be kept private!\n// Step 3: Remove these comments if you like.\n\nexport const configs = {\n  // Your bot token goes here\n  token: \"\",\n  // The default prefix for your bot. Don't worry guilds can change this later.\n  prefix: \"!\",\n  // This isn't required but you can add bot list api keys here.\n  botListTokens: {\n    DISCORD_BOT_ORG: \"\",\n    BOTS_ON_DISCORD: \"\",\n    DISCORD_BOT_LIST: \"\",\n    BOTS_FOR_DISCORD: \"\",\n    DISCORD_BOATS: \"\",\n    DISCORD_BOTS_GG: \"\",\n    DISCORD_BOTS_GROUP: \"\",\n  },\n  // This is the server id for your bot's main server where users can get help/support\n  supportServerID: \"\",\n  // These are channel ids that will enable some functionality\n  channelIDs: {\n    // When a translation is missing this is the channel you will be alerted in.\n    missingTranslation: \"\",\n    // When an error occurs, we will try and log it to this channel\n    errorChannelID: \"\"\n  },\n  // These are the role ids that will enable some functionality.\n  roleIDs: {\n    // If you have a patreon set up you can add the patreon vip role id here.\n    patreonVIPRoleID: \"\",\n  },\n  // These are the user ids that will enable some functionality.\n  userIDs: {\n    // The user ids for the support team\n    botSupporters: [],\n    // The user ids for the other devs on your team\n    botDevs: [],\n    // The user ids who have complete 100% access to your bot\n    botOwners: []\n  }\n};\n\n`}
\n

{`Token`}

\n

{`First, add your bot token. This is `}{`required`}{` for the bot to start. Review the `}{`instructions`}{` if you have not made your token yet.`}

\n

{`Prefix`}

\n

{`The prefix is where you will set the default prefix for your bot. Don't worry, every server will be able to choose their own prefix but we need a default prefix to start.`}

\n

{`Bot Lists Tokens`}

\n

{`This section of the file is so you can easily have your bot's statistics updated on all the bot lists out there to help you grow your bot. The code is already written to handle this but you will need to do 3 things for each bot list.`}

\n
    \n
  1. {`Go to the bot list and add your bot to their website. (Each site has it's own instructions)`}
  2. \n
  3. {`Create a token for yourself on each website and paste it in your configs.`}
  4. \n
  5. {`Enjoy!`}
  6. \n
\n

{`If you wish to customize the code, you will find the bot list tasks in the tasks folder. Don't worry we will discuss this when we get to the tasks section of the guide.`}

\n

{`For now just remember, that Discordeno provides you a built in way to update most discord bot lists.`}

\n

{`Channel IDs`}

\n

{`The channelIDs section holds the channel IDs that are useful for specific features to help give you alerts/notifications. For example, the `}{`missingTranslation`}{` channel will be where messages are sent alerting you that somewhere in your code you are trying to use a translation key that you never created.`}

\n

{`When you get to around 25,000 Discord servers on your bot, you may want to convert these channel IDs to webhooks.`}

\n

{`Role IDs`}

\n

{`The roleIDs section holds the role IDs that are useful for specific features. For example, the `}{`patreonVIPRoleID`}{` role can be used easily to enable vip features later in this guide.`}

\n

{`User IDs`}

\n

{`The userIDs section holds the user IDs that are useful for specific features. For example, the `}{`botDevs`}{` and such are useful for permission levels as you will see in the Permission Level part of the guide.`}

\n

{`When you get to around 25,000 Discord servers on your bot, you may want to convert these user IDs to webhooks.`}

\n

{`It's Alive!`}

\n

{`Oh my god! You now have a bot with a bunch of features already! You don't believe me? Well, seeing is believing, so start the bot.`}

\n
    \n
  1. {`Invite your bot to a discord server.`}
  2. \n
  3. {`Open up the integrated terminal in VSC using `}{`CTRL + \\``}{`. If you use a Mac, replace CTRL with CMD.`}
  4. \n
  5. {`Run the script below:`}
  6. \n
\n
{`deno run --allow-net --allow-read mod.ts\n`}
\n

{`The first time you run it, you may see a lot of files being loaded. This is preparing all the magic behind the scene. Once it is ready, you will see something like this:`}

\n

\n

{`Understanding What Discordeno Did`}

\n

{`Discordeno includes these commands/folders as they are essential for any discord bot to have in order to meet the Discord Bot Best Practices. It also adds a few things that will help make some things easier to build a bot.`}

\n

{`We will dive into these deeper in this guide. Let's take it step by step.`}

\n\n
;\n}\n\n;\nMDXContent.isMDXComponent = true;"}} \ No newline at end of file diff --git a/docs/.cache/caches/gatsby-plugin-mdx/diskstore-765afef9bd4e34d3860b1e8f7b06926a.json b/docs/.cache/caches/gatsby-plugin-mdx/diskstore-765afef9bd4e34d3860b1e8f7b06926a.json new file mode 100644 index 000000000..14a37797e --- /dev/null +++ b/docs/.cache/caches/gatsby-plugin-mdx/diskstore-765afef9bd4e34d3860b1e8f7b06926a.json @@ -0,0 +1 @@ +{"expireTime":9007200851634890000,"key":"gatsby-plugin-mdx-entire-payload-897c4726417349c8e34f064525c06ec4-","val":{"mdast":{"type":"root","children":[{"type":"paragraph","children":[{"type":"text","value":"Woah! You are almost half way done with understanding all of Discordeno. Amazing isn't it? Something you may have noticed in the last section was there were some options that prevented some commands from running like ","position":{"start":{"line":2,"column":1,"offset":1},"end":{"line":2,"column":218,"offset":218},"indent":[]}},{"type":"inlineCode","value":"dmOnly","position":{"start":{"line":2,"column":218,"offset":218},"end":{"line":2,"column":226,"offset":226},"indent":[]}},{"type":"text","value":" or the permission options. we created a setting to prevent the monitor from running in certain channels. What if we wanted to do prevent commands from happening? How would we prevent commands from running?","position":{"start":{"line":2,"column":226,"offset":226},"end":{"line":2,"column":432,"offset":432},"indent":[]}}],"position":{"start":{"line":2,"column":1,"offset":1},"end":{"line":2,"column":432,"offset":432},"indent":[]}},{"type":"heading","depth":2,"children":[{"type":"text","value":"What is an Inhibitor?","position":{"start":{"line":4,"column":4,"offset":437},"end":{"line":4,"column":25,"offset":458},"indent":[]}}],"position":{"start":{"line":4,"column":1,"offset":434},"end":{"line":4,"column":25,"offset":458},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"An Inhibitor is very similar to how monitors work. A monitor runs on every message but an inhibitor runs on every command. Remember all those command options like cooldown, permissions, permissionLevel, nsfw, etc... Each and every one of these options has an inhibitor in that checks commands for these settings.","position":{"start":{"line":6,"column":1,"offset":460},"end":{"line":6,"column":313,"offset":772},"indent":[]}}],"position":{"start":{"line":6,"column":1,"offset":460},"end":{"line":6,"column":313,"offset":772},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"Let's create our own inhibitor that would prevent commands from being used if the user is not a VIP user.","position":{"start":{"line":8,"column":1,"offset":774},"end":{"line":8,"column":106,"offset":879},"indent":[]}}],"position":{"start":{"line":8,"column":1,"offset":774},"end":{"line":8,"column":106,"offset":879},"indent":[]}},{"type":"blockquote","children":[{"type":"paragraph","children":[{"type":"strong","children":[{"type":"text","value":"Note:","position":{"start":{"line":10,"column":5,"offset":885},"end":{"line":10,"column":10,"offset":890},"indent":[]}}],"position":{"start":{"line":10,"column":3,"offset":883},"end":{"line":10,"column":12,"offset":892},"indent":[]}},{"type":"text","value":" It is important to remember that everything below can be done with a simple permission level as well. We will create our own custom permission levels but for the purposes of this guide and to be able to learn about Inhibitors, we will be using an inhibitor.","position":{"start":{"line":10,"column":12,"offset":892},"end":{"line":10,"column":270,"offset":1150},"indent":[]}}],"position":{"start":{"line":10,"column":3,"offset":883},"end":{"line":10,"column":270,"offset":1150},"indent":[]}}],"position":{"start":{"line":10,"column":1,"offset":881},"end":{"line":10,"column":270,"offset":1150},"indent":[]}},{"type":"heading","depth":2,"children":[{"type":"text","value":"Creating the File","position":{"start":{"line":12,"column":4,"offset":1155},"end":{"line":12,"column":21,"offset":1172},"indent":[]}}],"position":{"start":{"line":12,"column":1,"offset":1152},"end":{"line":12,"column":21,"offset":1172},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"Let's start by creating a file inside the inhibitors folder called ","position":{"start":{"line":14,"column":1,"offset":1174},"end":{"line":14,"column":68,"offset":1241},"indent":[]}},{"type":"inlineCode","value":"boosted.ts","position":{"start":{"line":14,"column":68,"offset":1241},"end":{"line":14,"column":80,"offset":1253},"indent":[]}},{"type":"text","value":" and paste the following snippet of code:","position":{"start":{"line":14,"column":80,"offset":1253},"end":{"line":14,"column":121,"offset":1294},"indent":[]}}],"position":{"start":{"line":14,"column":1,"offset":1174},"end":{"line":14,"column":121,"offset":1294},"indent":[]}},{"type":"code","lang":"ts","meta":null,"value":"import { botCache } from \"../../mod.ts\";\n\nbotCache.inhibitors.set(\"inhibitorname\", async function (message, command, guild) {\n\t// Your code goes here\n});","position":{"start":{"line":16,"column":1,"offset":1296},"end":{"line":22,"column":4,"offset":1459},"indent":[1,1,1,1,1,1]}},{"type":"paragraph","children":[{"type":"text","value":"Inhibitors can take up to 3 arguments.","position":{"start":{"line":24,"column":1,"offset":1461},"end":{"line":24,"column":39,"offset":1499},"indent":[]}}],"position":{"start":{"line":24,"column":1,"offset":1461},"end":{"line":24,"column":39,"offset":1499},"indent":[]}},{"type":"list","ordered":false,"start":null,"spread":false,"children":[{"type":"listItem","spread":false,"checked":null,"children":[{"type":"paragraph","children":[{"type":"inlineCode","value":"message","position":{"start":{"line":26,"column":3,"offset":1503},"end":{"line":26,"column":12,"offset":1512},"indent":[]}},{"type":"text","value":": The message object that triggered the command.","position":{"start":{"line":26,"column":12,"offset":1512},"end":{"line":26,"column":60,"offset":1560},"indent":[]}}],"position":{"start":{"line":26,"column":3,"offset":1503},"end":{"line":26,"column":60,"offset":1560},"indent":[]}}],"position":{"start":{"line":26,"column":1,"offset":1501},"end":{"line":26,"column":60,"offset":1560},"indent":[]}},{"type":"listItem","spread":false,"checked":null,"children":[{"type":"paragraph","children":[{"type":"inlineCode","value":"command","position":{"start":{"line":27,"column":3,"offset":1563},"end":{"line":27,"column":12,"offset":1572},"indent":[]}},{"type":"text","value":": The command object itself that was triggered.","position":{"start":{"line":27,"column":12,"offset":1572},"end":{"line":27,"column":59,"offset":1619},"indent":[]}}],"position":{"start":{"line":27,"column":3,"offset":1563},"end":{"line":27,"column":59,"offset":1619},"indent":[]}}],"position":{"start":{"line":27,"column":1,"offset":1561},"end":{"line":27,"column":59,"offset":1619},"indent":[]}},{"type":"listItem","spread":false,"checked":null,"children":[{"type":"paragraph","children":[{"type":"inlineCode","value":"guild","position":{"start":{"line":28,"column":3,"offset":1622},"end":{"line":28,"column":10,"offset":1629},"indent":[]}},{"type":"text","value":": The server guild object where this command was ran.","position":{"start":{"line":28,"column":10,"offset":1629},"end":{"line":28,"column":63,"offset":1682},"indent":[]}}],"position":{"start":{"line":28,"column":3,"offset":1622},"end":{"line":28,"column":63,"offset":1682},"indent":[]}}],"position":{"start":{"line":28,"column":1,"offset":1620},"end":{"line":28,"column":63,"offset":1682},"indent":[]}}],"position":{"start":{"line":26,"column":1,"offset":1501},"end":{"line":28,"column":63,"offset":1682},"indent":[1,1]}},{"type":"heading","depth":2,"children":[{"type":"text","value":"Understanding How Inhibitors Function","position":{"start":{"line":30,"column":4,"offset":1687},"end":{"line":30,"column":41,"offset":1724},"indent":[]}}],"position":{"start":{"line":30,"column":1,"offset":1684},"end":{"line":30,"column":41,"offset":1724},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"To block a command you have to return a truthy value.","position":{"start":{"line":32,"column":1,"offset":1726},"end":{"line":32,"column":54,"offset":1779},"indent":[]}}],"position":{"start":{"line":32,"column":1,"offset":1726},"end":{"line":32,"column":54,"offset":1779},"indent":[]}},{"type":"list","ordered":false,"start":null,"spread":false,"children":[{"type":"listItem","spread":false,"checked":null,"children":[{"type":"paragraph","children":[{"type":"strong","children":[{"type":"text","value":"return true;","position":{"start":{"line":33,"column":5,"offset":1784},"end":{"line":33,"column":17,"offset":1796},"indent":[]}}],"position":{"start":{"line":33,"column":3,"offset":1782},"end":{"line":33,"column":19,"offset":1798},"indent":[]}},{"type":"text","value":" If you return true the inhibitor will block the execution of the command.\nTo allow a command return a falsey value.","position":{"start":{"line":33,"column":19,"offset":1798},"end":{"line":34,"column":42,"offset":1914},"indent":[1]}}],"position":{"start":{"line":33,"column":3,"offset":1782},"end":{"line":34,"column":42,"offset":1914},"indent":[1]}}],"position":{"start":{"line":33,"column":1,"offset":1780},"end":{"line":34,"column":42,"offset":1914},"indent":[1]}},{"type":"listItem","spread":false,"checked":null,"children":[{"type":"paragraph","children":[{"type":"strong","children":[{"type":"text","value":"return false;","position":{"start":{"line":35,"column":5,"offset":1919},"end":{"line":35,"column":18,"offset":1932},"indent":[]}}],"position":{"start":{"line":35,"column":3,"offset":1917},"end":{"line":35,"column":20,"offset":1934},"indent":[]}},{"type":"text","value":" If you return false the inhibitor will not block the error.","position":{"start":{"line":35,"column":20,"offset":1934},"end":{"line":35,"column":80,"offset":1994},"indent":[]}}],"position":{"start":{"line":35,"column":3,"offset":1917},"end":{"line":35,"column":80,"offset":1994},"indent":[]}}],"position":{"start":{"line":35,"column":1,"offset":1915},"end":{"line":35,"column":80,"offset":1994},"indent":[]}}],"position":{"start":{"line":33,"column":1,"offset":1780},"end":{"line":35,"column":80,"offset":1994},"indent":[1,1]}},{"type":"code","lang":"ts","meta":null,"value":"// If the command is not VIP only we can allow this command to execute\nif (!command.vipOnly) return false;\n\n// The bot's support server\nconst guild = cache.guilds.get(configs.supportServerID);\n// If the command author is not in the server they won't have the vip role\nconst member = guild.members.get(message.author.id) || await getMember(guild.id, message.author.id);\n// Member doesn't exist so cancel the command\nif (!member) {\n\tsendResponse(message, `sorry, but you can not use this command until you become VIP. **Close the IRIS!!!**`)\n\treturn true;\n}\n\n// If the user has the vip role on the support server given by patreon allow the command\nif (member.roles.includes(configs.roleIDs.patreonVIPRoleID)) return false;\n\n// Alert the user they don't have vip and can't use the command\nsendResponse(message, `sorry, but you can not use this command until you become a VIP. I'm sorry, Teal'c. We'll go to Disneyland next year. I promise.`)\n// Cancel the command since the user does not have vip\nreturn true;","position":{"start":{"line":38,"column":1,"offset":1997},"end":{"line":59,"column":4,"offset":3013},"indent":[1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1]}},{"type":"heading","depth":2,"children":[{"type":"text","value":"Updating Command Typings","position":{"start":{"line":61,"column":4,"offset":3018},"end":{"line":61,"column":28,"offset":3042},"indent":[]}}],"position":{"start":{"line":61,"column":1,"offset":3015},"end":{"line":61,"column":28,"offset":3042},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"Since we need a new option on ","position":{"start":{"line":63,"column":1,"offset":3044},"end":{"line":63,"column":31,"offset":3074},"indent":[]}}],"position":{"start":{"line":63,"column":1,"offset":3044},"end":{"line":63,"column":31,"offset":3074},"indent":[]}},{"type":"heading","depth":2,"children":[{"type":"text","value":"Challenges","position":{"start":{"line":65,"column":4,"offset":3079},"end":{"line":65,"column":14,"offset":3089},"indent":[]}}],"position":{"start":{"line":65,"column":1,"offset":3076},"end":{"line":65,"column":14,"offset":3089},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"Hell yes! We just got through the entire inhibitor section. You have now mastered everything related to inhibitors.","position":{"start":{"line":67,"column":1,"offset":3091},"end":{"line":67,"column":116,"offset":3206},"indent":[]}}],"position":{"start":{"line":67,"column":1,"offset":3091},"end":{"line":67,"column":116,"offset":3206},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"You can now try and get a little more practice with inhibitors by trying to challenge yourself and make your own inhibitors. Don't worry if you can't think of any good use cases for inhibitors.","position":{"start":{"line":69,"column":1,"offset":3208},"end":{"line":69,"column":194,"offset":3401},"indent":[]}}],"position":{"start":{"line":69,"column":1,"offset":3208},"end":{"line":69,"column":194,"offset":3401},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"Majority of Discordeno bots do not use many custom inhibitors because most of the necessary/important ones already come built for you in the inhibitors folder.","position":{"start":{"line":71,"column":1,"offset":3403},"end":{"line":71,"column":160,"offset":3562},"indent":[]}}],"position":{"start":{"line":71,"column":1,"offset":3403},"end":{"line":71,"column":160,"offset":3562},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"Next we will try our hands at creating a monitor.","position":{"start":{"line":73,"column":1,"offset":3564},"end":{"line":73,"column":50,"offset":3613},"indent":[]}}],"position":{"start":{"line":73,"column":1,"offset":3564},"end":{"line":73,"column":50,"offset":3613},"indent":[]}},{"type":"export","value":"export const _frontmatter = {\"title\":\"Creating Inhibitors!\",\"metaTitle\":\"Creating An Inhibitor | Discordeno\",\"metaDescription\":\"Let's create our very own bot with Discordeno!\"}","position":{"start":{"line":76,"column":1,"offset":3616},"end":{"line":76,"column":177,"offset":3792},"indent":[]}}],"position":{"start":{"line":1,"column":1,"offset":0},"end":{"line":76,"column":177,"offset":3792}}},"scopeImports":["import * as React from 'react'"],"scopeIdentifiers":["React"],"body":"function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }\n\nfunction _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }\n\nfunction _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }\n\n/* @jsx mdx */\nvar _frontmatter = {\n \"title\": \"Creating Inhibitors!\",\n \"metaTitle\": \"Creating An Inhibitor | Discordeno\",\n \"metaDescription\": \"Let's create our very own bot with Discordeno!\"\n};\nvar layoutProps = {\n _frontmatter: _frontmatter\n};\nvar MDXLayout = \"wrapper\";\nreturn function MDXContent(_ref) {\n var components = _ref.components,\n props = _objectWithoutProperties(_ref, [\"components\"]);\n\n return mdx(MDXLayout, _extends({}, layoutProps, props, {\n components: components,\n mdxType: \"MDXLayout\"\n }), mdx(\"p\", null, \"Woah! You are almost half way done with understanding all of Discordeno. Amazing isn't it? Something you may have noticed in the last section was there were some options that prevented some commands from running like \", mdx(\"inlineCode\", {\n parentName: \"p\"\n }, \"dmOnly\"), \" or the permission options. we created a setting to prevent the monitor from running in certain channels. What if we wanted to do prevent commands from happening? How would we prevent commands from running?\"), mdx(\"h2\", null, \"What is an Inhibitor?\"), mdx(\"p\", null, \"An Inhibitor is very similar to how monitors work. A monitor runs on every message but an inhibitor runs on every command. Remember all those command options like cooldown, permissions, permissionLevel, nsfw, etc... Each and every one of these options has an inhibitor in that checks commands for these settings.\"), mdx(\"p\", null, \"Let's create our own inhibitor that would prevent commands from being used if the user is not a VIP user.\"), mdx(\"blockquote\", null, mdx(\"p\", {\n parentName: \"blockquote\"\n }, mdx(\"strong\", {\n parentName: \"p\"\n }, \"Note:\"), \" It is important to remember that everything below can be done with a simple permission level as well. We will create our own custom permission levels but for the purposes of this guide and to be able to learn about Inhibitors, we will be using an inhibitor.\")), mdx(\"h2\", null, \"Creating the File\"), mdx(\"p\", null, \"Let's start by creating a file inside the inhibitors folder called \", mdx(\"inlineCode\", {\n parentName: \"p\"\n }, \"boosted.ts\"), \" and paste the following snippet of code:\"), mdx(\"pre\", null, mdx(\"code\", _extends({\n parentName: \"pre\"\n }, {\n \"className\": \"language-ts\"\n }), \"import { botCache } from \\\"../../mod.ts\\\";\\n\\nbotCache.inhibitors.set(\\\"inhibitorname\\\", async function (message, command, guild) {\\n // Your code goes here\\n});\\n\")), mdx(\"p\", null, \"Inhibitors can take up to 3 arguments.\"), mdx(\"ul\", null, mdx(\"li\", {\n parentName: \"ul\"\n }, mdx(\"inlineCode\", {\n parentName: \"li\"\n }, \"message\"), \": The message object that triggered the command.\"), mdx(\"li\", {\n parentName: \"ul\"\n }, mdx(\"inlineCode\", {\n parentName: \"li\"\n }, \"command\"), \": The command object itself that was triggered.\"), mdx(\"li\", {\n parentName: \"ul\"\n }, mdx(\"inlineCode\", {\n parentName: \"li\"\n }, \"guild\"), \": The server guild object where this command was ran.\")), mdx(\"h2\", null, \"Understanding How Inhibitors Function\"), mdx(\"p\", null, \"To block a command you have to return a truthy value.\"), mdx(\"ul\", null, mdx(\"li\", {\n parentName: \"ul\"\n }, mdx(\"strong\", {\n parentName: \"li\"\n }, \"return true;\"), \" If you return true the inhibitor will block the execution of the command.\\nTo allow a command return a falsey value.\"), mdx(\"li\", {\n parentName: \"ul\"\n }, mdx(\"strong\", {\n parentName: \"li\"\n }, \"return false;\"), \" If you return false the inhibitor will not block the error.\")), mdx(\"pre\", null, mdx(\"code\", _extends({\n parentName: \"pre\"\n }, {\n \"className\": \"language-ts\"\n }), \"// If the command is not VIP only we can allow this command to execute\\nif (!command.vipOnly) return false;\\n\\n// The bot's support server\\nconst guild = cache.guilds.get(configs.supportServerID);\\n// If the command author is not in the server they won't have the vip role\\nconst member = guild.members.get(message.author.id) || await getMember(guild.id, message.author.id);\\n// Member doesn't exist so cancel the command\\nif (!member) {\\n sendResponse(message, `sorry, but you can not use this command until you become VIP. **Close the IRIS!!!**`)\\n return true;\\n}\\n\\n// If the user has the vip role on the support server given by patreon allow the command\\nif (member.roles.includes(configs.roleIDs.patreonVIPRoleID)) return false;\\n\\n// Alert the user they don't have vip and can't use the command\\nsendResponse(message, `sorry, but you can not use this command until you become a VIP. I'm sorry, Teal'c. We'll go to Disneyland next year. I promise.`)\\n// Cancel the command since the user does not have vip\\nreturn true;\\n\")), mdx(\"h2\", null, \"Updating Command Typings\"), mdx(\"p\", null, \"Since we need a new option on \"), mdx(\"h2\", null, \"Challenges\"), mdx(\"p\", null, \"Hell yes! We just got through the entire inhibitor section. You have now mastered everything related to inhibitors.\"), mdx(\"p\", null, \"You can now try and get a little more practice with inhibitors by trying to challenge yourself and make your own inhibitors. Don't worry if you can't think of any good use cases for inhibitors.\"), mdx(\"p\", null, \"Majority of Discordeno bots do not use many custom inhibitors because most of the necessary/important ones already come built for you in the inhibitors folder.\"), mdx(\"p\", null, \"Next we will try our hands at creating a monitor.\"));\n}\n;\nMDXContent.isMDXComponent = true;","rawMDXOutput":"/* @jsx mdx */\nimport { mdx } from '@mdx-js/react';\n/* @jsx mdx */\n\nexport const _frontmatter = {\n \"title\": \"Creating Inhibitors!\",\n \"metaTitle\": \"Creating An Inhibitor | Discordeno\",\n \"metaDescription\": \"Let's create our very own bot with Discordeno!\"\n};\n\nconst layoutProps = {\n _frontmatter\n};\nconst MDXLayout = \"wrapper\"\nexport default function MDXContent({\n components,\n ...props\n}) {\n return \n

{`Woah! You are almost half way done with understanding all of Discordeno. Amazing isn't it? Something you may have noticed in the last section was there were some options that prevented some commands from running like `}{`dmOnly`}{` or the permission options. we created a setting to prevent the monitor from running in certain channels. What if we wanted to do prevent commands from happening? How would we prevent commands from running?`}

\n

{`What is an Inhibitor?`}

\n

{`An Inhibitor is very similar to how monitors work. A monitor runs on every message but an inhibitor runs on every command. Remember all those command options like cooldown, permissions, permissionLevel, nsfw, etc... Each and every one of these options has an inhibitor in that checks commands for these settings.`}

\n

{`Let's create our own inhibitor that would prevent commands from being used if the user is not a VIP user.`}

\n
\n

{`Note:`}{` It is important to remember that everything below can be done with a simple permission level as well. We will create our own custom permission levels but for the purposes of this guide and to be able to learn about Inhibitors, we will be using an inhibitor.`}

\n
\n

{`Creating the File`}

\n

{`Let's start by creating a file inside the inhibitors folder called `}{`boosted.ts`}{` and paste the following snippet of code:`}

\n
{`import { botCache } from \"../../mod.ts\";\n\nbotCache.inhibitors.set(\"inhibitorname\", async function (message, command, guild) {\n    // Your code goes here\n});\n`}
\n

{`Inhibitors can take up to 3 arguments.`}

\n
    \n
  • {`message`}{`: The message object that triggered the command.`}
  • \n
  • {`command`}{`: The command object itself that was triggered.`}
  • \n
  • {`guild`}{`: The server guild object where this command was ran.`}
  • \n
\n

{`Understanding How Inhibitors Function`}

\n

{`To block a command you have to return a truthy value.`}

\n
    \n
  • {`return true;`}{` If you return true the inhibitor will block the execution of the command.\nTo allow a command return a falsey value.`}
  • \n
  • {`return false;`}{` If you return false the inhibitor will not block the error.`}
  • \n
\n
{`// If the command is not VIP only we can allow this command to execute\nif (!command.vipOnly) return false;\n\n// The bot's support server\nconst guild = cache.guilds.get(configs.supportServerID);\n// If the command author is not in the server they won't have the vip role\nconst member = guild.members.get(message.author.id) || await getMember(guild.id, message.author.id);\n// Member doesn't exist so cancel the command\nif (!member) {\n    sendResponse(message, \\`sorry, but you can not use this command until you become VIP. **Close the IRIS!!!**\\`)\n    return true;\n}\n\n// If the user has the vip role on the support server given by patreon allow the command\nif (member.roles.includes(configs.roleIDs.patreonVIPRoleID)) return false;\n\n// Alert the user they don't have vip and can't use the command\nsendResponse(message, \\`sorry, but you can not use this command until you become a VIP. I'm sorry, Teal'c. We'll go to Disneyland next year. I promise.\\`)\n// Cancel the command since the user does not have vip\nreturn true;\n`}
\n

{`Updating Command Typings`}

\n

{`Since we need a new option on `}

\n

{`Challenges`}

\n

{`Hell yes! We just got through the entire inhibitor section. You have now mastered everything related to inhibitors.`}

\n

{`You can now try and get a little more practice with inhibitors by trying to challenge yourself and make your own inhibitors. Don't worry if you can't think of any good use cases for inhibitors.`}

\n

{`Majority of Discordeno bots do not use many custom inhibitors because most of the necessary/important ones already come built for you in the inhibitors folder.`}

\n

{`Next we will try our hands at creating a monitor.`}

\n\n
;\n}\n\n;\nMDXContent.isMDXComponent = true;"}} \ No newline at end of file diff --git a/docs/.cache/caches/gatsby-plugin-mdx/diskstore-77cd89d184cb3acbc2bb9db50a587b5c.json b/docs/.cache/caches/gatsby-plugin-mdx/diskstore-77cd89d184cb3acbc2bb9db50a587b5c.json new file mode 100644 index 000000000..5e20103e3 --- /dev/null +++ b/docs/.cache/caches/gatsby-plugin-mdx/diskstore-77cd89d184cb3acbc2bb9db50a587b5c.json @@ -0,0 +1 @@ +{"expireTime":9007200851635022000,"key":"gatsby-plugin-mdx-entire-payload-f4ae69d2d171532f6304c04189e796fd-","val":{"mdast":{"type":"root","children":[{"type":"export","value":"export const _frontmatter = {}","position":{"start":{"line":3,"column":1,"offset":2},"end":{"line":3,"column":31,"offset":32},"indent":[]}}],"position":{"start":{"line":1,"column":1,"offset":0},"end":{"line":3,"column":31,"offset":32}}},"scopeImports":["import * as React from 'react'"],"scopeIdentifiers":["React"],"body":"function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }\n\nfunction _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }\n\nfunction _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }\n\n/* @jsx mdx */\nvar _frontmatter = {};\nvar layoutProps = {\n _frontmatter: _frontmatter\n};\nvar MDXLayout = \"wrapper\";\nreturn function MDXContent(_ref) {\n var components = _ref.components,\n props = _objectWithoutProperties(_ref, [\"components\"]);\n\n return mdx(MDXLayout, _extends({}, layoutProps, props, {\n components: components,\n mdxType: \"MDXLayout\"\n }));\n}\n;\nMDXContent.isMDXComponent = true;","rawMDXOutput":"/* @jsx mdx */\nimport { mdx } from '@mdx-js/react';\n/* @jsx mdx */\n\nexport const _frontmatter = {};\n\nconst layoutProps = {\n _frontmatter\n};\nconst MDXLayout = \"wrapper\"\nexport default function MDXContent({\n components,\n ...props\n}) {\n return \n\n ;\n}\n\n;\nMDXContent.isMDXComponent = true;"}} \ No newline at end of file diff --git a/docs/.cache/caches/gatsby-plugin-mdx/diskstore-78813b6c296158893ff9a721082fd0e8.json b/docs/.cache/caches/gatsby-plugin-mdx/diskstore-78813b6c296158893ff9a721082fd0e8.json new file mode 100644 index 000000000..7c62747a7 --- /dev/null +++ b/docs/.cache/caches/gatsby-plugin-mdx/diskstore-78813b6c296158893ff9a721082fd0e8.json @@ -0,0 +1 @@ +{"expireTime":9007200851642145000,"key":"gatsby-plugin-mdx-entire-payload-505dec895651802ed4c64262a9d66816-","val":{"mdast":{"type":"root","children":[{"type":"paragraph","children":[{"type":"text","value":"Woot! You have mastered Discordeno inhibitors already. Now it's time to finally make our bot multi-lingual. Vàmanos!","position":{"start":{"line":2,"column":1,"offset":1},"end":{"line":2,"column":117,"offset":117},"indent":[]}}],"position":{"start":{"line":2,"column":1,"offset":1},"end":{"line":2,"column":117,"offset":117},"indent":[]}},{"type":"heading","depth":2,"children":[{"type":"text","value":"What Is A Discordeno Language?","position":{"start":{"line":4,"column":4,"offset":122},"end":{"line":4,"column":34,"offset":152},"indent":[]}}],"position":{"start":{"line":4,"column":1,"offset":119},"end":{"line":4,"column":34,"offset":152},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"A Discordeno language is a folder that will hold all our responses that the bot sends. By having various different language files you can have a multi-lingual bot that can be used in different languages.","position":{"start":{"line":6,"column":1,"offset":154},"end":{"line":6,"column":204,"offset":357},"indent":[]}}],"position":{"start":{"line":6,"column":1,"offset":154},"end":{"line":6,"column":204,"offset":357},"indent":[]}},{"type":"heading","depth":2,"children":[{"type":"text","value":"i18next","position":{"start":{"line":8,"column":4,"offset":362},"end":{"line":8,"column":11,"offset":369},"indent":[]}}],"position":{"start":{"line":8,"column":1,"offset":359},"end":{"line":8,"column":11,"offset":369},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"By default, Discordeno comes built with support for i18next(one of if not the best localization libraries). If you want to learn more, go to ","position":{"start":{"line":10,"column":1,"offset":371},"end":{"line":10,"column":142,"offset":512},"indent":[]}},{"type":"link","title":null,"url":"https://www.i18next.com/","children":[{"type":"text","value":"i18next website","position":{"start":{"line":10,"column":143,"offset":513},"end":{"line":10,"column":158,"offset":528},"indent":[]}}],"position":{"start":{"line":10,"column":142,"offset":512},"end":{"line":10,"column":185,"offset":555},"indent":[]}},{"type":"text","value":". For now, there is probably not going to be anything you will need to learn there. As most of the functionality has already been created for you right here in Discordeno.","position":{"start":{"line":10,"column":185,"offset":555},"end":{"line":10,"column":356,"offset":726},"indent":[]}}],"position":{"start":{"line":10,"column":1,"offset":371},"end":{"line":10,"column":356,"offset":726},"indent":[]}},{"type":"heading","depth":2,"children":[{"type":"text","value":"Default Language","position":{"start":{"line":12,"column":4,"offset":731},"end":{"line":12,"column":20,"offset":747},"indent":[]}}],"position":{"start":{"line":12,"column":1,"offset":728},"end":{"line":12,"column":20,"offset":747},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"The default language with Discordeno is American English which uses the name ","position":{"start":{"line":14,"column":1,"offset":749},"end":{"line":14,"column":78,"offset":826},"indent":[]}},{"type":"inlineCode","value":"en_US","position":{"start":{"line":14,"column":78,"offset":826},"end":{"line":14,"column":85,"offset":833},"indent":[]}},{"type":"text","value":". So when you open the ","position":{"start":{"line":14,"column":85,"offset":833},"end":{"line":14,"column":108,"offset":856},"indent":[]}},{"type":"inlineCode","value":"src/languages/","position":{"start":{"line":14,"column":108,"offset":856},"end":{"line":14,"column":124,"offset":872},"indent":[]}},{"type":"text","value":" folder you will find a folder called ","position":{"start":{"line":14,"column":124,"offset":872},"end":{"line":14,"column":162,"offset":910},"indent":[]}},{"type":"inlineCode","value":"en_US","position":{"start":{"line":14,"column":162,"offset":910},"end":{"line":14,"column":169,"offset":917},"indent":[]}},{"type":"text","value":". This is where all the strings can be kept for your bot that can be easily translated by other translators.","position":{"start":{"line":14,"column":169,"offset":917},"end":{"line":14,"column":277,"offset":1025},"indent":[]}}],"position":{"start":{"line":14,"column":1,"offset":749},"end":{"line":14,"column":277,"offset":1025},"indent":[]}},{"type":"heading","depth":2,"children":[{"type":"text","value":"Understanding The Folder Structure","position":{"start":{"line":16,"column":4,"offset":1030},"end":{"line":16,"column":38,"offset":1064},"indent":[]}}],"position":{"start":{"line":16,"column":1,"offset":1027},"end":{"line":16,"column":38,"offset":1064},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"The first folder inside the languages folder must be a language folder following the name pattern like ","position":{"start":{"line":18,"column":1,"offset":1066},"end":{"line":18,"column":104,"offset":1169},"indent":[]}},{"type":"inlineCode","value":"en_US","position":{"start":{"line":18,"column":104,"offset":1169},"end":{"line":18,"column":111,"offset":1176},"indent":[]}},{"type":"text","value":". So for example, if we wanted to add a Spanish(Spain) language to our bot we would create a new folder called ","position":{"start":{"line":18,"column":111,"offset":1176},"end":{"line":18,"column":222,"offset":1287},"indent":[]}},{"type":"inlineCode","value":"es_ES","position":{"start":{"line":18,"column":222,"offset":1287},"end":{"line":18,"column":229,"offset":1294},"indent":[]}},{"type":"text","value":".","position":{"start":{"line":18,"column":229,"offset":1294},"end":{"line":18,"column":230,"offset":1295},"indent":[]}}],"position":{"start":{"line":18,"column":1,"offset":1066},"end":{"line":18,"column":230,"offset":1295},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"You can have as many folder in here as you like. For example I can do something like ","position":{"start":{"line":20,"column":1,"offset":1297},"end":{"line":20,"column":86,"offset":1382},"indent":[]}},{"type":"inlineCode","value":"src/languages/en_US/commands/fun/hug.json","position":{"start":{"line":20,"column":86,"offset":1382},"end":{"line":20,"column":129,"offset":1425},"indent":[]}},{"type":"text","value":". Notice that I have created categories to help keep them categorized and easier to find. You can do it however you wish to have them. For now, just remember that files must always be ","position":{"start":{"line":20,"column":129,"offset":1425},"end":{"line":20,"column":313,"offset":1609},"indent":[]}},{"type":"inlineCode","value":".json","position":{"start":{"line":20,"column":313,"offset":1609},"end":{"line":20,"column":320,"offset":1616},"indent":[]}},{"type":"text","value":" files in these folders. ","position":{"start":{"line":20,"column":320,"offset":1616},"end":{"line":20,"column":345,"offset":1641},"indent":[]}},{"type":"strong","children":[{"type":"text","value":"JSON is required.","position":{"start":{"line":20,"column":347,"offset":1643},"end":{"line":20,"column":364,"offset":1660},"indent":[]}}],"position":{"start":{"line":20,"column":345,"offset":1641},"end":{"line":20,"column":366,"offset":1662},"indent":[]}}],"position":{"start":{"line":20,"column":1,"offset":1297},"end":{"line":20,"column":366,"offset":1662},"indent":[]}},{"type":"heading","depth":2,"children":[{"type":"text","value":"Adding Hug Strings","position":{"start":{"line":22,"column":4,"offset":1667},"end":{"line":22,"column":22,"offset":1685},"indent":[]}}],"position":{"start":{"line":22,"column":1,"offset":1664},"end":{"line":22,"column":22,"offset":1685},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"Earlier in the guide, we made a hug command. So let's make that commands translations work properly now.","position":{"start":{"line":24,"column":1,"offset":1687},"end":{"line":24,"column":105,"offset":1791},"indent":[]}}],"position":{"start":{"line":24,"column":1,"offset":1687},"end":{"line":24,"column":105,"offset":1791},"indent":[]}},{"type":"list","ordered":false,"start":null,"spread":false,"children":[{"type":"listItem","spread":false,"checked":null,"children":[{"type":"paragraph","children":[{"type":"text","value":"Create the ","position":{"start":{"line":26,"column":3,"offset":1795},"end":{"line":26,"column":14,"offset":1806},"indent":[]}},{"type":"inlineCode","value":"hug.json","position":{"start":{"line":26,"column":14,"offset":1806},"end":{"line":26,"column":24,"offset":1816},"indent":[]}},{"type":"text","value":" file in the ","position":{"start":{"line":26,"column":24,"offset":1816},"end":{"line":26,"column":37,"offset":1829},"indent":[]}},{"type":"inlineCode","value":"src/languages/en_US/commands/fun/","position":{"start":{"line":26,"column":37,"offset":1829},"end":{"line":26,"column":72,"offset":1864},"indent":[]}},{"type":"text","value":" folder.","position":{"start":{"line":26,"column":72,"offset":1864},"end":{"line":26,"column":80,"offset":1872},"indent":[]}}],"position":{"start":{"line":26,"column":3,"offset":1795},"end":{"line":26,"column":80,"offset":1872},"indent":[]}}],"position":{"start":{"line":26,"column":1,"offset":1793},"end":{"line":26,"column":80,"offset":1872},"indent":[]}}],"position":{"start":{"line":26,"column":1,"offset":1793},"end":{"line":26,"column":80,"offset":1872},"indent":[]}},{"type":"code","lang":"json","meta":null,"value":"{\n\t\"DESCRIPTION\": \"Hug yourself or another user.\"\n}","position":{"start":{"line":28,"column":1,"offset":1874},"end":{"line":32,"column":4,"offset":1937},"indent":[1,1,1,1]}},{"type":"paragraph","children":[{"type":"text","value":"Most of the time, you should start with this base. The ","position":{"start":{"line":34,"column":1,"offset":1939},"end":{"line":34,"column":56,"offset":1994},"indent":[]}},{"type":"inlineCode","value":"DESCRIPTION","position":{"start":{"line":34,"column":56,"offset":1994},"end":{"line":34,"column":69,"offset":2007},"indent":[]}},{"type":"text","value":" key, is used in the help command and provides the description for the command. When someone types ","position":{"start":{"line":34,"column":69,"offset":2007},"end":{"line":34,"column":168,"offset":2106},"indent":[]}},{"type":"inlineCode","value":"!help hug","position":{"start":{"line":34,"column":168,"offset":2106},"end":{"line":34,"column":179,"offset":2117},"indent":[]}},{"type":"text","value":" they would see this description you typed.","position":{"start":{"line":34,"column":179,"offset":2117},"end":{"line":34,"column":222,"offset":2160},"indent":[]}}],"position":{"start":{"line":34,"column":1,"offset":1939},"end":{"line":34,"column":222,"offset":2160},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"In our hug command we also had 2 other keys we used. ","position":{"start":{"line":36,"column":1,"offset":2162},"end":{"line":36,"column":54,"offset":2215},"indent":[]}},{"type":"inlineCode","value":"SELF","position":{"start":{"line":36,"column":54,"offset":2215},"end":{"line":36,"column":60,"offset":2221},"indent":[]}},{"type":"text","value":" and ","position":{"start":{"line":36,"column":60,"offset":2221},"end":{"line":36,"column":65,"offset":2226},"indent":[]}},{"type":"inlineCode","value":"OTHER","position":{"start":{"line":36,"column":65,"offset":2226},"end":{"line":36,"column":72,"offset":2233},"indent":[]}},{"type":"text","value":" so let's add those in.","position":{"start":{"line":36,"column":72,"offset":2233},"end":{"line":36,"column":95,"offset":2256},"indent":[]}}],"position":{"start":{"line":36,"column":1,"offset":2162},"end":{"line":36,"column":95,"offset":2256},"indent":[]}},{"type":"code","lang":"json","meta":null,"value":"{\n\t\"DESCRIPTION\": \"Hug yourself or another user.\",\n\t\"SELF\": \"If you had no one to hug you could have hugged me. Years from now, when you're thinking about me, you're gonna say: 'How did I ever get along without that wonderful, constant companion?' *Woof.*\",\n\t\"OTHER\": \"{{user}} was hugged by {{mention}}\"\n}","position":{"start":{"line":38,"column":1,"offset":2258},"end":{"line":44,"column":4,"offset":2576},"indent":[1,1,1,1,1,1]}},{"type":"paragraph","children":[{"type":"text","value":"Now the ","position":{"start":{"line":46,"column":1,"offset":2578},"end":{"line":46,"column":9,"offset":2586},"indent":[]}},{"type":"inlineCode","value":"\"SELF\"","position":{"start":{"line":46,"column":9,"offset":2586},"end":{"line":46,"column":17,"offset":2594},"indent":[]}},{"type":"text","value":" is pretty easy to understand but the ","position":{"start":{"line":46,"column":17,"offset":2594},"end":{"line":46,"column":55,"offset":2632},"indent":[]}},{"type":"inlineCode","value":"OTHER","position":{"start":{"line":46,"column":55,"offset":2632},"end":{"line":46,"column":62,"offset":2639},"indent":[]}},{"type":"text","value":" has some interesting things in it so let's jump into that.","position":{"start":{"line":46,"column":62,"offset":2639},"end":{"line":46,"column":121,"offset":2698},"indent":[]}}],"position":{"start":{"line":46,"column":1,"offset":2578},"end":{"line":46,"column":121,"offset":2698},"indent":[]}},{"type":"heading","depth":2,"children":[{"type":"text","value":"Translate Function","position":{"start":{"line":48,"column":4,"offset":2703},"end":{"line":48,"column":22,"offset":2721},"indent":[]}}],"position":{"start":{"line":48,"column":1,"offset":2700},"end":{"line":48,"column":22,"offset":2721},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"Discordeno provides you a built in function called ","position":{"start":{"line":50,"column":1,"offset":2723},"end":{"line":50,"column":52,"offset":2774},"indent":[]}},{"type":"inlineCode","value":"translate","position":{"start":{"line":50,"column":52,"offset":2774},"end":{"line":50,"column":63,"offset":2785},"indent":[]}},{"type":"text","value":". It takes in 3 different arguments.","position":{"start":{"line":50,"column":63,"offset":2785},"end":{"line":50,"column":99,"offset":2821},"indent":[]}}],"position":{"start":{"line":50,"column":1,"offset":2723},"end":{"line":50,"column":99,"offset":2821},"indent":[]}},{"type":"list","ordered":false,"start":null,"spread":false,"children":[{"type":"listItem","spread":false,"checked":null,"children":[{"type":"paragraph","children":[{"type":"inlineCode","value":"guildID","position":{"start":{"line":52,"column":3,"offset":2825},"end":{"line":52,"column":12,"offset":2834},"indent":[]}},{"type":"text","value":" the id of the server. This is used to determine which language to use.","position":{"start":{"line":52,"column":12,"offset":2834},"end":{"line":52,"column":83,"offset":2905},"indent":[]}}],"position":{"start":{"line":52,"column":3,"offset":2825},"end":{"line":52,"column":83,"offset":2905},"indent":[]}}],"position":{"start":{"line":52,"column":1,"offset":2823},"end":{"line":52,"column":83,"offset":2905},"indent":[]}},{"type":"listItem","spread":false,"checked":null,"children":[{"type":"paragraph","children":[{"type":"inlineCode","value":"key","position":{"start":{"line":53,"column":3,"offset":2908},"end":{"line":53,"column":8,"offset":2913},"indent":[]}},{"type":"text","value":" the unique folderpath:KEY string that will determine which string to translate.","position":{"start":{"line":53,"column":8,"offset":2913},"end":{"line":53,"column":88,"offset":2993},"indent":[]}}],"position":{"start":{"line":53,"column":3,"offset":2908},"end":{"line":53,"column":88,"offset":2993},"indent":[]}}],"position":{"start":{"line":53,"column":1,"offset":2906},"end":{"line":53,"column":88,"offset":2993},"indent":[]}},{"type":"listItem","spread":false,"checked":null,"children":[{"type":"paragraph","children":[{"type":"inlineCode","value":"options","position":{"start":{"line":54,"column":3,"offset":2996},"end":{"line":54,"column":12,"offset":3005},"indent":[]}},{"type":"text","value":" the variables that the strings have available to them.","position":{"start":{"line":54,"column":12,"offset":3005},"end":{"line":54,"column":67,"offset":3060},"indent":[]}}],"position":{"start":{"line":54,"column":3,"offset":2996},"end":{"line":54,"column":67,"offset":3060},"indent":[]}}],"position":{"start":{"line":54,"column":1,"offset":2994},"end":{"line":54,"column":67,"offset":3060},"indent":[]}}],"position":{"start":{"line":52,"column":1,"offset":2823},"end":{"line":54,"column":67,"offset":3060},"indent":[1,1]}},{"type":"paragraph","children":[{"type":"text","value":"i18next allows you to pass in variables that you can use when you want in your strings. If you recall from our guide ealier we passed in 2 variables.","position":{"start":{"line":56,"column":1,"offset":3062},"end":{"line":56,"column":150,"offset":3211},"indent":[]}}],"position":{"start":{"line":56,"column":1,"offset":3062},"end":{"line":56,"column":150,"offset":3211},"indent":[]}},{"type":"code","lang":"ts","meta":null,"value":"translate(\n\tmessage.guildID,\n\t`commands/fun/${data.name}:${type}`,\n\t{ mention: message.member()!.mention, user: member.mention },\n)","position":{"start":{"line":58,"column":1,"offset":3213},"end":{"line":64,"column":4,"offset":3354},"indent":[1,1,1,1,1,1]}},{"type":"paragraph","children":[{"type":"text","value":"Here we can see that we passed in:","position":{"start":{"line":66,"column":1,"offset":3356},"end":{"line":66,"column":35,"offset":3390},"indent":[]}}],"position":{"start":{"line":66,"column":1,"offset":3356},"end":{"line":66,"column":35,"offset":3390},"indent":[]}},{"type":"list","ordered":false,"start":null,"spread":false,"children":[{"type":"listItem","spread":false,"checked":null,"children":[{"type":"paragraph","children":[{"type":"inlineCode","value":"mention","position":{"start":{"line":68,"column":3,"offset":3394},"end":{"line":68,"column":12,"offset":3403},"indent":[]}},{"type":"text","value":": The user mention who used this command. ","position":{"start":{"line":68,"column":12,"offset":3403},"end":{"line":68,"column":54,"offset":3445},"indent":[]}},{"type":"inlineCode","value":"!hug","position":{"start":{"line":68,"column":54,"offset":3445},"end":{"line":68,"column":60,"offset":3451},"indent":[]}}],"position":{"start":{"line":68,"column":3,"offset":3394},"end":{"line":68,"column":60,"offset":3451},"indent":[]}}],"position":{"start":{"line":68,"column":1,"offset":3392},"end":{"line":68,"column":60,"offset":3451},"indent":[]}},{"type":"listItem","spread":false,"checked":null,"children":[{"type":"paragraph","children":[{"type":"inlineCode","value":"user","position":{"start":{"line":69,"column":3,"offset":3454},"end":{"line":69,"column":9,"offset":3460},"indent":[]}},{"type":"text","value":": The user mention of the member who was @ by the command author. ","position":{"start":{"line":69,"column":9,"offset":3460},"end":{"line":69,"column":75,"offset":3526},"indent":[]}},{"type":"inlineCode","value":"!hug @o'neill","position":{"start":{"line":69,"column":75,"offset":3526},"end":{"line":69,"column":90,"offset":3541},"indent":[]}}],"position":{"start":{"line":69,"column":3,"offset":3454},"end":{"line":69,"column":90,"offset":3541},"indent":[]}}],"position":{"start":{"line":69,"column":1,"offset":3452},"end":{"line":69,"column":90,"offset":3541},"indent":[]}}],"position":{"start":{"line":68,"column":1,"offset":3392},"end":{"line":69,"column":90,"offset":3541},"indent":[1]}},{"type":"heading","depth":2,"children":[{"type":"text","value":"Variables","position":{"start":{"line":71,"column":4,"offset":3546},"end":{"line":71,"column":13,"offset":3555},"indent":[]}}],"position":{"start":{"line":71,"column":1,"offset":3543},"end":{"line":71,"column":13,"offset":3555},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"Variables in i18next use the ","position":{"start":{"line":73,"column":1,"offset":3557},"end":{"line":73,"column":30,"offset":3586},"indent":[]}},{"type":"inlineCode","value":"{{}}","position":{"start":{"line":73,"column":30,"offset":3586},"end":{"line":73,"column":36,"offset":3592},"indent":[]}},{"type":"text","value":" format. So the variable ","position":{"start":{"line":73,"column":36,"offset":3592},"end":{"line":73,"column":61,"offset":3617},"indent":[]}},{"type":"inlineCode","value":"mention","position":{"start":{"line":73,"column":61,"offset":3617},"end":{"line":73,"column":70,"offset":3626},"indent":[]}},{"type":"text","value":" would be used by doing ","position":{"start":{"line":73,"column":70,"offset":3626},"end":{"line":73,"column":94,"offset":3650},"indent":[]}},{"type":"inlineCode","value":"{{mention}}","position":{"start":{"line":73,"column":94,"offset":3650},"end":{"line":73,"column":107,"offset":3663},"indent":[]}}],"position":{"start":{"line":73,"column":1,"offset":3557},"end":{"line":73,"column":107,"offset":3663},"indent":[]}},{"type":"heading","depth":2,"children":[{"type":"text","value":"Key Rules","position":{"start":{"line":75,"column":4,"offset":3668},"end":{"line":75,"column":13,"offset":3677},"indent":[]}}],"position":{"start":{"line":75,"column":1,"offset":3665},"end":{"line":75,"column":13,"offset":3677},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"When you create keys in the files there are a couple rules to follow.","position":{"start":{"line":77,"column":1,"offset":3679},"end":{"line":77,"column":70,"offset":3748},"indent":[]}}],"position":{"start":{"line":77,"column":1,"offset":3679},"end":{"line":77,"column":70,"offset":3748},"indent":[]}},{"type":"list","ordered":false,"start":null,"spread":false,"children":[{"type":"listItem","spread":false,"checked":null,"children":[{"type":"paragraph","children":[{"type":"text","value":"Never use ","position":{"start":{"line":79,"column":3,"offset":3752},"end":{"line":79,"column":13,"offset":3762},"indent":[]}},{"type":"inlineCode","value":":","position":{"start":{"line":79,"column":13,"offset":3762},"end":{"line":79,"column":16,"offset":3765},"indent":[]}},{"type":"text","value":" in your key name. ","position":{"start":{"line":79,"column":16,"offset":3765},"end":{"line":79,"column":35,"offset":3784},"indent":[]}},{"type":"strong","children":[{"type":"text","value":"REQUIRED","position":{"start":{"line":79,"column":37,"offset":3786},"end":{"line":79,"column":45,"offset":3794},"indent":[]}}],"position":{"start":{"line":79,"column":35,"offset":3784},"end":{"line":79,"column":47,"offset":3796},"indent":[]}}],"position":{"start":{"line":79,"column":3,"offset":3752},"end":{"line":79,"column":47,"offset":3796},"indent":[]}}],"position":{"start":{"line":79,"column":1,"offset":3750},"end":{"line":79,"column":47,"offset":3796},"indent":[]}},{"type":"listItem","spread":false,"checked":null,"children":[{"type":"paragraph","children":[{"type":"text","value":"ALWAYS USE UPPERCASE ","position":{"start":{"line":80,"column":3,"offset":3799},"end":{"line":80,"column":24,"offset":3820},"indent":[]}},{"type":"strong","children":[{"type":"text","value":"OPTIONAL","position":{"start":{"line":80,"column":26,"offset":3822},"end":{"line":80,"column":34,"offset":3830},"indent":[]}}],"position":{"start":{"line":80,"column":24,"offset":3820},"end":{"line":80,"column":36,"offset":3832},"indent":[]}}],"position":{"start":{"line":80,"column":3,"offset":3799},"end":{"line":80,"column":36,"offset":3832},"indent":[]}}],"position":{"start":{"line":80,"column":1,"offset":3797},"end":{"line":80,"column":36,"offset":3832},"indent":[]}},{"type":"listItem","spread":false,"checked":null,"children":[{"type":"paragraph","children":[{"type":"text","value":"Words are separated by ","position":{"start":{"line":81,"column":3,"offset":3835},"end":{"line":81,"column":26,"offset":3858},"indent":[]}},{"type":"inlineCode","value":"_","position":{"start":{"line":81,"column":26,"offset":3858},"end":{"line":81,"column":29,"offset":3861},"indent":[]}},{"type":"text","value":" ","position":{"start":{"line":81,"column":29,"offset":3861},"end":{"line":81,"column":30,"offset":3862},"indent":[]}},{"type":"strong","children":[{"type":"text","value":"OPTIONAL","position":{"start":{"line":81,"column":32,"offset":3864},"end":{"line":81,"column":40,"offset":3872},"indent":[]}}],"position":{"start":{"line":81,"column":30,"offset":3862},"end":{"line":81,"column":42,"offset":3874},"indent":[]}}],"position":{"start":{"line":81,"column":3,"offset":3835},"end":{"line":81,"column":42,"offset":3874},"indent":[]}}],"position":{"start":{"line":81,"column":1,"offset":3833},"end":{"line":81,"column":42,"offset":3874},"indent":[]}}],"position":{"start":{"line":79,"column":1,"offset":3750},"end":{"line":81,"column":42,"offset":3874},"indent":[1,1]}},{"type":"paragraph","children":[{"type":"text","value":"The first one is the only one that is mandatory. The other two are recommended for you.","position":{"start":{"line":83,"column":1,"offset":3876},"end":{"line":83,"column":88,"offset":3963},"indent":[]}}],"position":{"start":{"line":83,"column":1,"offset":3876},"end":{"line":83,"column":88,"offset":3963},"indent":[]}},{"type":"heading","depth":2,"children":[{"type":"text","value":"Missing Keys","position":{"start":{"line":85,"column":4,"offset":3968},"end":{"line":85,"column":16,"offset":3980},"indent":[]}}],"position":{"start":{"line":85,"column":1,"offset":3965},"end":{"line":85,"column":16,"offset":3980},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"Every developer forgets stuff sometimes. When you forget to translate a key, it will be marked as a missing key and you will be alerted. If you provided a channelID in the configs file, you be be sent a message there and it will also be logged in your console.","position":{"start":{"line":87,"column":1,"offset":3982},"end":{"line":87,"column":261,"offset":4242},"indent":[]}}],"position":{"start":{"line":87,"column":1,"offset":3982},"end":{"line":87,"column":261,"offset":4242},"indent":[]}},{"type":"heading","depth":2,"children":[{"type":"text","value":"Spanish Version","position":{"start":{"line":89,"column":4,"offset":4247},"end":{"line":89,"column":19,"offset":4262},"indent":[]}}],"position":{"start":{"line":89,"column":1,"offset":4244},"end":{"line":89,"column":19,"offset":4262},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"Let's just create a spanish version of the hug command from above to see an example of different languages.","position":{"start":{"line":91,"column":1,"offset":4264},"end":{"line":91,"column":108,"offset":4371},"indent":[]}}],"position":{"start":{"line":91,"column":1,"offset":4264},"end":{"line":91,"column":108,"offset":4371},"indent":[]}},{"type":"list","ordered":false,"start":null,"spread":false,"children":[{"type":"listItem","spread":false,"checked":null,"children":[{"type":"paragraph","children":[{"type":"text","value":"Create a file called ","position":{"start":{"line":93,"column":3,"offset":4375},"end":{"line":93,"column":24,"offset":4396},"indent":[]}},{"type":"inlineCode","value":"hug.json","position":{"start":{"line":93,"column":24,"offset":4396},"end":{"line":93,"column":34,"offset":4406},"indent":[]}},{"type":"text","value":" in the folder ","position":{"start":{"line":93,"column":34,"offset":4406},"end":{"line":93,"column":49,"offset":4421},"indent":[]}},{"type":"inlineCode","value":"src/languages/es_ES/commands/fun/","position":{"start":{"line":93,"column":49,"offset":4421},"end":{"line":93,"column":84,"offset":4456},"indent":[]}}],"position":{"start":{"line":93,"column":3,"offset":4375},"end":{"line":93,"column":84,"offset":4456},"indent":[]}}],"position":{"start":{"line":93,"column":1,"offset":4373},"end":{"line":93,"column":84,"offset":4456},"indent":[]}}],"position":{"start":{"line":93,"column":1,"offset":4373},"end":{"line":93,"column":84,"offset":4456},"indent":[]}},{"type":"code","lang":"json","meta":null,"value":"{\n\t\"DESCRIPTION\": \"Abrázate a ti mismo oa otro usuario\",\n\t\"SELF\": \"Si no tuvieras a nadie a quien abrazar, podrías haberme abrazado. Años a partir de ahora, cuando estés pensando en mí, dirás: '¿Cómo me las arreglé sin esa maravillosa y constante compañera?' *Guau.*\",\n\t\"OTHER\": \"{{user}} fue abrazado por {{mention}}\"\n}","position":{"start":{"line":95,"column":1,"offset":4458},"end":{"line":101,"column":4,"offset":4790},"indent":[1,1,1,1,1,1]}},{"type":"paragraph","children":[{"type":"text","value":"Notice, that there are 2 thing that were ","position":{"start":{"line":103,"column":1,"offset":4792},"end":{"line":103,"column":42,"offset":4833},"indent":[]}},{"type":"strong","children":[{"type":"text","value":"NOT","position":{"start":{"line":103,"column":44,"offset":4835},"end":{"line":103,"column":47,"offset":4838},"indent":[]}}],"position":{"start":{"line":103,"column":42,"offset":4833},"end":{"line":103,"column":49,"offset":4840},"indent":[]}},{"type":"text","value":" translated. The ","position":{"start":{"line":103,"column":49,"offset":4840},"end":{"line":103,"column":66,"offset":4857},"indent":[]}},{"type":"inlineCode","value":"KEY","position":{"start":{"line":103,"column":66,"offset":4857},"end":{"line":103,"column":71,"offset":4862},"indent":[]}},{"type":"text","value":" names and the ","position":{"start":{"line":103,"column":71,"offset":4862},"end":{"line":103,"column":86,"offset":4877},"indent":[]}},{"type":"inlineCode","value":"VARIABLES","position":{"start":{"line":103,"column":86,"offset":4877},"end":{"line":103,"column":97,"offset":4888},"indent":[]}},{"type":"text","value":". These 2 things should never be translated. Anything else can be translated upon your needs.","position":{"start":{"line":103,"column":97,"offset":4888},"end":{"line":103,"column":190,"offset":4981},"indent":[]}}],"position":{"start":{"line":103,"column":1,"offset":4792},"end":{"line":103,"column":190,"offset":4981},"indent":[]}},{"type":"heading","depth":2,"children":[{"type":"text","value":"Localization Platform","position":{"start":{"line":105,"column":4,"offset":4986},"end":{"line":105,"column":25,"offset":5007},"indent":[]}}],"position":{"start":{"line":105,"column":1,"offset":4983},"end":{"line":105,"column":25,"offset":5007},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"i18next works perfectly with localization platforms. For example, you can easily plug in ","position":{"start":{"line":107,"column":1,"offset":5009},"end":{"line":107,"column":90,"offset":5098},"indent":[]}},{"type":"inlineCode","value":"crowdin","position":{"start":{"line":107,"column":90,"offset":5098},"end":{"line":107,"column":99,"offset":5107},"indent":[]}},{"type":"text","value":" or ","position":{"start":{"line":107,"column":99,"offset":5107},"end":{"line":107,"column":103,"offset":5111},"indent":[]}},{"type":"inlineCode","value":"transifex","position":{"start":{"line":107,"column":103,"offset":5111},"end":{"line":107,"column":114,"offset":5122},"indent":[]}},{"type":"text","value":" to your project.","position":{"start":{"line":107,"column":114,"offset":5122},"end":{"line":107,"column":131,"offset":5139},"indent":[]}}],"position":{"start":{"line":107,"column":1,"offset":5009},"end":{"line":107,"column":131,"offset":5139},"indent":[]}},{"type":"list","ordered":false,"start":null,"spread":false,"children":[{"type":"listItem","spread":false,"checked":null,"children":[{"type":"paragraph","children":[{"type":"link","title":null,"url":"https://www.transifex.com/","children":[{"type":"text","value":"Transifex","position":{"start":{"line":109,"column":4,"offset":5144},"end":{"line":109,"column":13,"offset":5153},"indent":[]}}],"position":{"start":{"line":109,"column":3,"offset":5143},"end":{"line":109,"column":42,"offset":5182},"indent":[]}},{"type":"text","value":" ","position":{"start":{"line":109,"column":42,"offset":5182},"end":{"line":109,"column":43,"offset":5183},"indent":[]}},{"type":"emphasis","children":[{"type":"text","value":"This is the one I use in my bot but you can use anything you like.","position":{"start":{"line":109,"column":44,"offset":5184},"end":{"line":109,"column":110,"offset":5250},"indent":[]}}],"position":{"start":{"line":109,"column":43,"offset":5183},"end":{"line":109,"column":111,"offset":5251},"indent":[]}}],"position":{"start":{"line":109,"column":3,"offset":5143},"end":{"line":109,"column":111,"offset":5251},"indent":[]}}],"position":{"start":{"line":109,"column":1,"offset":5141},"end":{"line":109,"column":111,"offset":5251},"indent":[]}},{"type":"listItem","spread":false,"checked":null,"children":[{"type":"paragraph","children":[{"type":"link","title":null,"url":"https://crowdin.com/","children":[{"type":"text","value":"Crowdin","position":{"start":{"line":110,"column":4,"offset":5255},"end":{"line":110,"column":11,"offset":5262},"indent":[]}}],"position":{"start":{"line":110,"column":3,"offset":5254},"end":{"line":110,"column":34,"offset":5285},"indent":[]}}],"position":{"start":{"line":110,"column":3,"offset":5254},"end":{"line":110,"column":34,"offset":5285},"indent":[]}}],"position":{"start":{"line":110,"column":1,"offset":5252},"end":{"line":110,"column":34,"offset":5285},"indent":[]}}],"position":{"start":{"line":109,"column":1,"offset":5141},"end":{"line":110,"column":34,"offset":5285},"indent":[1]}},{"type":"heading","depth":2,"children":[{"type":"text","value":"Challenge","position":{"start":{"line":112,"column":4,"offset":5290},"end":{"line":112,"column":13,"offset":5299},"indent":[]}}],"position":{"start":{"line":112,"column":1,"offset":5287},"end":{"line":112,"column":13,"offset":5299},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"Wow! You have even masted languages. Go ahead and jump back to the role command we made earlier and add translation support to it. Give it some love!","position":{"start":{"line":114,"column":1,"offset":5301},"end":{"line":114,"column":150,"offset":5450},"indent":[]}}],"position":{"start":{"line":114,"column":1,"offset":5301},"end":{"line":114,"column":150,"offset":5450},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"Once you are ready, let's go make our first monitor.","position":{"start":{"line":116,"column":1,"offset":5452},"end":{"line":116,"column":53,"offset":5504},"indent":[]}}],"position":{"start":{"line":116,"column":1,"offset":5452},"end":{"line":116,"column":53,"offset":5504},"indent":[]}},{"type":"export","value":"export const _frontmatter = {\"title\":\"Creating Languages!\",\"metaTitle\":\"Creating A Language | Discordeno\",\"metaDescription\":\"Let's create our very own bot with Discordeno!\"}","position":{"start":{"line":119,"column":1,"offset":5507},"end":{"line":119,"column":174,"offset":5680},"indent":[]}}],"position":{"start":{"line":1,"column":1,"offset":0},"end":{"line":119,"column":174,"offset":5680}}},"scopeImports":["import * as React from 'react'"],"scopeIdentifiers":["React"],"body":"function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }\n\nfunction _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }\n\nfunction _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }\n\n/* @jsx mdx */\nvar _frontmatter = {\n \"title\": \"Creating Languages!\",\n \"metaTitle\": \"Creating A Language | Discordeno\",\n \"metaDescription\": \"Let's create our very own bot with Discordeno!\"\n};\nvar layoutProps = {\n _frontmatter: _frontmatter\n};\nvar MDXLayout = \"wrapper\";\nreturn function MDXContent(_ref) {\n var components = _ref.components,\n props = _objectWithoutProperties(_ref, [\"components\"]);\n\n return mdx(MDXLayout, _extends({}, layoutProps, props, {\n components: components,\n mdxType: \"MDXLayout\"\n }), mdx(\"p\", null, \"Woot! You have mastered Discordeno inhibitors already. Now it's time to finally make our bot multi-lingual. V\\xE0manos!\"), mdx(\"h2\", null, \"What Is A Discordeno Language?\"), mdx(\"p\", null, \"A Discordeno language is a folder that will hold all our responses that the bot sends. By having various different language files you can have a multi-lingual bot that can be used in different languages.\"), mdx(\"h2\", null, \"i18next\"), mdx(\"p\", null, \"By default, Discordeno comes built with support for i18next(one of if not the best localization libraries). If you want to learn more, go to \", mdx(\"a\", _extends({\n parentName: \"p\"\n }, {\n \"href\": \"https://www.i18next.com/\"\n }), \"i18next website\"), \". For now, there is probably not going to be anything you will need to learn there. As most of the functionality has already been created for you right here in Discordeno.\"), mdx(\"h2\", null, \"Default Language\"), mdx(\"p\", null, \"The default language with Discordeno is American English which uses the name \", mdx(\"inlineCode\", {\n parentName: \"p\"\n }, \"en_US\"), \". So when you open the \", mdx(\"inlineCode\", {\n parentName: \"p\"\n }, \"src/languages/\"), \" folder you will find a folder called \", mdx(\"inlineCode\", {\n parentName: \"p\"\n }, \"en_US\"), \". This is where all the strings can be kept for your bot that can be easily translated by other translators.\"), mdx(\"h2\", null, \"Understanding The Folder Structure\"), mdx(\"p\", null, \"The first folder inside the languages folder must be a language folder following the name pattern like \", mdx(\"inlineCode\", {\n parentName: \"p\"\n }, \"en_US\"), \". So for example, if we wanted to add a Spanish(Spain) language to our bot we would create a new folder called \", mdx(\"inlineCode\", {\n parentName: \"p\"\n }, \"es_ES\"), \".\"), mdx(\"p\", null, \"You can have as many folder in here as you like. For example I can do something like \", mdx(\"inlineCode\", {\n parentName: \"p\"\n }, \"src/languages/en_US/commands/fun/hug.json\"), \". Notice that I have created categories to help keep them categorized and easier to find. You can do it however you wish to have them. For now, just remember that files must always be \", mdx(\"inlineCode\", {\n parentName: \"p\"\n }, \".json\"), \" files in these folders. \", mdx(\"strong\", {\n parentName: \"p\"\n }, \"JSON is required.\")), mdx(\"h2\", null, \"Adding Hug Strings\"), mdx(\"p\", null, \"Earlier in the guide, we made a hug command. So let's make that commands translations work properly now.\"), mdx(\"ul\", null, mdx(\"li\", {\n parentName: \"ul\"\n }, \"Create the \", mdx(\"inlineCode\", {\n parentName: \"li\"\n }, \"hug.json\"), \" file in the \", mdx(\"inlineCode\", {\n parentName: \"li\"\n }, \"src/languages/en_US/commands/fun/\"), \" folder.\")), mdx(\"pre\", null, mdx(\"code\", _extends({\n parentName: \"pre\"\n }, {\n \"className\": \"language-json\"\n }), \"{\\n \\\"DESCRIPTION\\\": \\\"Hug yourself or another user.\\\"\\n}\\n\")), mdx(\"p\", null, \"Most of the time, you should start with this base. The \", mdx(\"inlineCode\", {\n parentName: \"p\"\n }, \"DESCRIPTION\"), \" key, is used in the help command and provides the description for the command. When someone types \", mdx(\"inlineCode\", {\n parentName: \"p\"\n }, \"!help hug\"), \" they would see this description you typed.\"), mdx(\"p\", null, \"In our hug command we also had 2 other keys we used. \", mdx(\"inlineCode\", {\n parentName: \"p\"\n }, \"SELF\"), \" and \", mdx(\"inlineCode\", {\n parentName: \"p\"\n }, \"OTHER\"), \" so let's add those in.\"), mdx(\"pre\", null, mdx(\"code\", _extends({\n parentName: \"pre\"\n }, {\n \"className\": \"language-json\"\n }), \"{\\n \\\"DESCRIPTION\\\": \\\"Hug yourself or another user.\\\",\\n \\\"SELF\\\": \\\"If you had no one to hug you could have hugged me. Years from now, when you're thinking about me, you're gonna say: 'How did I ever get along without that wonderful, constant companion?' *Woof.*\\\",\\n \\\"OTHER\\\": \\\"{{user}} was hugged by {{mention}}\\\"\\n}\\n\")), mdx(\"p\", null, \"Now the \", mdx(\"inlineCode\", {\n parentName: \"p\"\n }, \"\\\"SELF\\\"\"), \" is pretty easy to understand but the \", mdx(\"inlineCode\", {\n parentName: \"p\"\n }, \"OTHER\"), \" has some interesting things in it so let's jump into that.\"), mdx(\"h2\", null, \"Translate Function\"), mdx(\"p\", null, \"Discordeno provides you a built in function called \", mdx(\"inlineCode\", {\n parentName: \"p\"\n }, \"translate\"), \". It takes in 3 different arguments.\"), mdx(\"ul\", null, mdx(\"li\", {\n parentName: \"ul\"\n }, mdx(\"inlineCode\", {\n parentName: \"li\"\n }, \"guildID\"), \" the id of the server. This is used to determine which language to use.\"), mdx(\"li\", {\n parentName: \"ul\"\n }, mdx(\"inlineCode\", {\n parentName: \"li\"\n }, \"key\"), \" the unique folderpath:KEY string that will determine which string to translate.\"), mdx(\"li\", {\n parentName: \"ul\"\n }, mdx(\"inlineCode\", {\n parentName: \"li\"\n }, \"options\"), \" the variables that the strings have available to them.\")), mdx(\"p\", null, \"i18next allows you to pass in variables that you can use when you want in your strings. If you recall from our guide ealier we passed in 2 variables.\"), mdx(\"pre\", null, mdx(\"code\", _extends({\n parentName: \"pre\"\n }, {\n \"className\": \"language-ts\"\n }), \"translate(\\n message.guildID,\\n `commands/fun/${data.name}:${type}`,\\n { mention: message.member()!.mention, user: member.mention },\\n)\\n\")), mdx(\"p\", null, \"Here we can see that we passed in:\"), mdx(\"ul\", null, mdx(\"li\", {\n parentName: \"ul\"\n }, mdx(\"inlineCode\", {\n parentName: \"li\"\n }, \"mention\"), \": The user mention who used this command. \", mdx(\"inlineCode\", {\n parentName: \"li\"\n }, \"!hug\")), mdx(\"li\", {\n parentName: \"ul\"\n }, mdx(\"inlineCode\", {\n parentName: \"li\"\n }, \"user\"), \": The user mention of the member who was @ by the command author. \", mdx(\"inlineCode\", {\n parentName: \"li\"\n }, \"!hug @o'neill\"))), mdx(\"h2\", null, \"Variables\"), mdx(\"p\", null, \"Variables in i18next use the \", mdx(\"inlineCode\", {\n parentName: \"p\"\n }, \"{{}}\"), \" format. So the variable \", mdx(\"inlineCode\", {\n parentName: \"p\"\n }, \"mention\"), \" would be used by doing \", mdx(\"inlineCode\", {\n parentName: \"p\"\n }, \"{{mention}}\")), mdx(\"h2\", null, \"Key Rules\"), mdx(\"p\", null, \"When you create keys in the files there are a couple rules to follow.\"), mdx(\"ul\", null, mdx(\"li\", {\n parentName: \"ul\"\n }, \"Never use \", mdx(\"inlineCode\", {\n parentName: \"li\"\n }, \":\"), \" in your key name. \", mdx(\"strong\", {\n parentName: \"li\"\n }, \"REQUIRED\")), mdx(\"li\", {\n parentName: \"ul\"\n }, \"ALWAYS USE UPPERCASE \", mdx(\"strong\", {\n parentName: \"li\"\n }, \"OPTIONAL\")), mdx(\"li\", {\n parentName: \"ul\"\n }, \"Words are separated by \", mdx(\"inlineCode\", {\n parentName: \"li\"\n }, \"_\"), \" \", mdx(\"strong\", {\n parentName: \"li\"\n }, \"OPTIONAL\"))), mdx(\"p\", null, \"The first one is the only one that is mandatory. The other two are recommended for you.\"), mdx(\"h2\", null, \"Missing Keys\"), mdx(\"p\", null, \"Every developer forgets stuff sometimes. When you forget to translate a key, it will be marked as a missing key and you will be alerted. If you provided a channelID in the configs file, you be be sent a message there and it will also be logged in your console.\"), mdx(\"h2\", null, \"Spanish Version\"), mdx(\"p\", null, \"Let's just create a spanish version of the hug command from above to see an example of different languages.\"), mdx(\"ul\", null, mdx(\"li\", {\n parentName: \"ul\"\n }, \"Create a file called \", mdx(\"inlineCode\", {\n parentName: \"li\"\n }, \"hug.json\"), \" in the folder \", mdx(\"inlineCode\", {\n parentName: \"li\"\n }, \"src/languages/es_ES/commands/fun/\"))), mdx(\"pre\", null, mdx(\"code\", _extends({\n parentName: \"pre\"\n }, {\n \"className\": \"language-json\"\n }), \"{\\n \\\"DESCRIPTION\\\": \\\"Abr\\xE1zate a ti mismo oa otro usuario\\\",\\n \\\"SELF\\\": \\\"Si no tuvieras a nadie a quien abrazar, podr\\xEDas haberme abrazado. A\\xF1os a partir de ahora, cuando est\\xE9s pensando en m\\xED, dir\\xE1s: '\\xBFC\\xF3mo me las arregl\\xE9 sin esa maravillosa y constante compa\\xF1era?' *Guau.*\\\",\\n \\\"OTHER\\\": \\\"{{user}} fue abrazado por {{mention}}\\\"\\n}\\n\")), mdx(\"p\", null, \"Notice, that there are 2 thing that were \", mdx(\"strong\", {\n parentName: \"p\"\n }, \"NOT\"), \" translated. The \", mdx(\"inlineCode\", {\n parentName: \"p\"\n }, \"KEY\"), \" names and the \", mdx(\"inlineCode\", {\n parentName: \"p\"\n }, \"VARIABLES\"), \". These 2 things should never be translated. Anything else can be translated upon your needs.\"), mdx(\"h2\", null, \"Localization Platform\"), mdx(\"p\", null, \"i18next works perfectly with localization platforms. For example, you can easily plug in \", mdx(\"inlineCode\", {\n parentName: \"p\"\n }, \"crowdin\"), \" or \", mdx(\"inlineCode\", {\n parentName: \"p\"\n }, \"transifex\"), \" to your project.\"), mdx(\"ul\", null, mdx(\"li\", {\n parentName: \"ul\"\n }, mdx(\"a\", _extends({\n parentName: \"li\"\n }, {\n \"href\": \"https://www.transifex.com/\"\n }), \"Transifex\"), \" \", mdx(\"em\", {\n parentName: \"li\"\n }, \"This is the one I use in my bot but you can use anything you like.\")), mdx(\"li\", {\n parentName: \"ul\"\n }, mdx(\"a\", _extends({\n parentName: \"li\"\n }, {\n \"href\": \"https://crowdin.com/\"\n }), \"Crowdin\"))), mdx(\"h2\", null, \"Challenge\"), mdx(\"p\", null, \"Wow! You have even masted languages. Go ahead and jump back to the role command we made earlier and add translation support to it. Give it some love!\"), mdx(\"p\", null, \"Once you are ready, let's go make our first monitor.\"));\n}\n;\nMDXContent.isMDXComponent = true;","rawMDXOutput":"/* @jsx mdx */\nimport { mdx } from '@mdx-js/react';\n/* @jsx mdx */\n\nexport const _frontmatter = {\n \"title\": \"Creating Languages!\",\n \"metaTitle\": \"Creating A Language | Discordeno\",\n \"metaDescription\": \"Let's create our very own bot with Discordeno!\"\n};\n\nconst layoutProps = {\n _frontmatter\n};\nconst MDXLayout = \"wrapper\"\nexport default function MDXContent({\n components,\n ...props\n}) {\n return \n

{`Woot! You have mastered Discordeno inhibitors already. Now it's time to finally make our bot multi-lingual. Vàmanos!`}

\n

{`What Is A Discordeno Language?`}

\n

{`A Discordeno language is a folder that will hold all our responses that the bot sends. By having various different language files you can have a multi-lingual bot that can be used in different languages.`}

\n

{`i18next`}

\n

{`By default, Discordeno comes built with support for i18next(one of if not the best localization libraries). If you want to learn more, go to `}{`i18next website`}{`. For now, there is probably not going to be anything you will need to learn there. As most of the functionality has already been created for you right here in Discordeno.`}

\n

{`Default Language`}

\n

{`The default language with Discordeno is American English which uses the name `}{`en_US`}{`. So when you open the `}{`src/languages/`}{` folder you will find a folder called `}{`en_US`}{`. This is where all the strings can be kept for your bot that can be easily translated by other translators.`}

\n

{`Understanding The Folder Structure`}

\n

{`The first folder inside the languages folder must be a language folder following the name pattern like `}{`en_US`}{`. So for example, if we wanted to add a Spanish(Spain) language to our bot we would create a new folder called `}{`es_ES`}{`.`}

\n

{`You can have as many folder in here as you like. For example I can do something like `}{`src/languages/en_US/commands/fun/hug.json`}{`. Notice that I have created categories to help keep them categorized and easier to find. You can do it however you wish to have them. For now, just remember that files must always be `}{`.json`}{` files in these folders. `}{`JSON is required.`}

\n

{`Adding Hug Strings`}

\n

{`Earlier in the guide, we made a hug command. So let's make that commands translations work properly now.`}

\n
    \n
  • {`Create the `}{`hug.json`}{` file in the `}{`src/languages/en_US/commands/fun/`}{` folder.`}
  • \n
\n
{`{\n    \"DESCRIPTION\": \"Hug yourself or another user.\"\n}\n`}
\n

{`Most of the time, you should start with this base. The `}{`DESCRIPTION`}{` key, is used in the help command and provides the description for the command. When someone types `}{`!help hug`}{` they would see this description you typed.`}

\n

{`In our hug command we also had 2 other keys we used. `}{`SELF`}{` and `}{`OTHER`}{` so let's add those in.`}

\n
{`{\n    \"DESCRIPTION\": \"Hug yourself or another user.\",\n    \"SELF\": \"If you had no one to hug you could have hugged me. Years from now, when you're thinking about me, you're gonna say: 'How did I ever get along without that wonderful, constant companion?' *Woof.*\",\n    \"OTHER\": \"{{user}} was hugged by {{mention}}\"\n}\n`}
\n

{`Now the `}{`\"SELF\"`}{` is pretty easy to understand but the `}{`OTHER`}{` has some interesting things in it so let's jump into that.`}

\n

{`Translate Function`}

\n

{`Discordeno provides you a built in function called `}{`translate`}{`. It takes in 3 different arguments.`}

\n
    \n
  • {`guildID`}{` the id of the server. This is used to determine which language to use.`}
  • \n
  • {`key`}{` the unique folderpath:KEY string that will determine which string to translate.`}
  • \n
  • {`options`}{` the variables that the strings have available to them.`}
  • \n
\n

{`i18next allows you to pass in variables that you can use when you want in your strings. If you recall from our guide ealier we passed in 2 variables.`}

\n
{`translate(\n    message.guildID,\n    \\`commands/fun/\\${data.name}:\\${type}\\`,\n    { mention: message.member()!.mention, user: member.mention },\n)\n`}
\n

{`Here we can see that we passed in:`}

\n
    \n
  • {`mention`}{`: The user mention who used this command. `}{`!hug`}
  • \n
  • {`user`}{`: The user mention of the member who was @ by the command author. `}{`!hug @o'neill`}
  • \n
\n

{`Variables`}

\n

{`Variables in i18next use the `}{`{{}}`}{` format. So the variable `}{`mention`}{` would be used by doing `}{`{{mention}}`}

\n

{`Key Rules`}

\n

{`When you create keys in the files there are a couple rules to follow.`}

\n
    \n
  • {`Never use `}{`:`}{` in your key name. `}{`REQUIRED`}
  • \n
  • {`ALWAYS USE UPPERCASE `}{`OPTIONAL`}
  • \n
  • {`Words are separated by `}{`_`}{` `}{`OPTIONAL`}
  • \n
\n

{`The first one is the only one that is mandatory. The other two are recommended for you.`}

\n

{`Missing Keys`}

\n

{`Every developer forgets stuff sometimes. When you forget to translate a key, it will be marked as a missing key and you will be alerted. If you provided a channelID in the configs file, you be be sent a message there and it will also be logged in your console.`}

\n

{`Spanish Version`}

\n

{`Let's just create a spanish version of the hug command from above to see an example of different languages.`}

\n
    \n
  • {`Create a file called `}{`hug.json`}{` in the folder `}{`src/languages/es_ES/commands/fun/`}
  • \n
\n
{`{\n    \"DESCRIPTION\": \"Abrázate a ti mismo oa otro usuario\",\n    \"SELF\": \"Si no tuvieras a nadie a quien abrazar, podrías haberme abrazado. Años a partir de ahora, cuando estés pensando en mí, dirás: '¿Cómo me las arreglé sin esa maravillosa y constante compañera?' *Guau.*\",\n    \"OTHER\": \"{{user}} fue abrazado por {{mention}}\"\n}\n`}
\n

{`Notice, that there are 2 thing that were `}{`NOT`}{` translated. The `}{`KEY`}{` names and the `}{`VARIABLES`}{`. These 2 things should never be translated. Anything else can be translated upon your needs.`}

\n

{`Localization Platform`}

\n

{`i18next works perfectly with localization platforms. For example, you can easily plug in `}{`crowdin`}{` or `}{`transifex`}{` to your project.`}

\n \n

{`Challenge`}

\n

{`Wow! You have even masted languages. Go ahead and jump back to the role command we made earlier and add translation support to it. Give it some love!`}

\n

{`Once you are ready, let's go make our first monitor.`}

\n\n
;\n}\n\n;\nMDXContent.isMDXComponent = true;"}} \ No newline at end of file diff --git a/docs/.cache/caches/gatsby-plugin-mdx/diskstore-7946f359a67ab79556fe70c7ea4b3884.json b/docs/.cache/caches/gatsby-plugin-mdx/diskstore-7946f359a67ab79556fe70c7ea4b3884.json new file mode 100644 index 000000000..60d44e72d --- /dev/null +++ b/docs/.cache/caches/gatsby-plugin-mdx/diskstore-7946f359a67ab79556fe70c7ea4b3884.json @@ -0,0 +1 @@ +{"expireTime":9007200851635231000,"key":"gatsby-plugin-mdx-entire-payload-36a7485fd00529f9b9e15483dfb275b5-","val":{"mdast":{"type":"root","children":[{"type":"paragraph","children":[{"type":"text","value":"Woah! You are almost half way done with understanding all of Discordeno. Amazing isn't it? Something you may have noticed in the last section was when the bot started up you could see a bunch of messages like ","position":{"start":{"line":2,"column":1,"offset":1},"end":{"line":2,"column":210,"offset":210},"indent":[]}},{"type":"inlineCode","value":"Loaded X Commands","position":{"start":{"line":2,"column":210,"offset":210},"end":{"line":2,"column":229,"offset":229},"indent":[]}},{"type":"text","value":" and such. Let's jump into this part now and understand how event handling works in Discordeno.","position":{"start":{"line":2,"column":229,"offset":229},"end":{"line":2,"column":324,"offset":324},"indent":[]}}],"position":{"start":{"line":2,"column":1,"offset":1},"end":{"line":2,"column":324,"offset":324},"indent":[]}},{"type":"heading","depth":2,"children":[{"type":"text","value":"What Is An Event?","position":{"start":{"line":4,"column":4,"offset":329},"end":{"line":4,"column":21,"offset":346},"indent":[]}}],"position":{"start":{"line":4,"column":1,"offset":326},"end":{"line":4,"column":21,"offset":346},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"An event in Discordeno is a function that can be called when a specific event occurs. For the most part, events will usually be the ones that are available from Discordeno. However, you can create your own custom events as well if you wish. ","position":{"start":{"line":6,"column":1,"offset":348},"end":{"line":6,"column":242,"offset":589},"indent":[]}}],"position":{"start":{"line":6,"column":1,"offset":348},"end":{"line":6,"column":242,"offset":589},"indent":[]}},{"type":"export","value":"export const _frontmatter = {\"title\":\"Creating Events!\",\"metaTitle\":\"Creating An Event | Discordeno\",\"metaDescription\":\"Let's create our very own bot with Discordeno!\"}","position":{"start":{"line":9,"column":1,"offset":592},"end":{"line":9,"column":169,"offset":760},"indent":[]}}],"position":{"start":{"line":1,"column":1,"offset":0},"end":{"line":9,"column":169,"offset":760}}},"scopeImports":["import * as React from 'react'"],"scopeIdentifiers":["React"],"body":"function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }\n\nfunction _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }\n\nfunction _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }\n\n/* @jsx mdx */\nvar _frontmatter = {\n \"title\": \"Creating Events!\",\n \"metaTitle\": \"Creating An Event | Discordeno\",\n \"metaDescription\": \"Let's create our very own bot with Discordeno!\"\n};\nvar layoutProps = {\n _frontmatter: _frontmatter\n};\nvar MDXLayout = \"wrapper\";\nreturn function MDXContent(_ref) {\n var components = _ref.components,\n props = _objectWithoutProperties(_ref, [\"components\"]);\n\n return mdx(MDXLayout, _extends({}, layoutProps, props, {\n components: components,\n mdxType: \"MDXLayout\"\n }), mdx(\"p\", null, \"Woah! You are almost half way done with understanding all of Discordeno. Amazing isn't it? Something you may have noticed in the last section was when the bot started up you could see a bunch of messages like \", mdx(\"inlineCode\", {\n parentName: \"p\"\n }, \"Loaded X Commands\"), \" and such. Let's jump into this part now and understand how event handling works in Discordeno.\"), mdx(\"h2\", null, \"What Is An Event?\"), mdx(\"p\", null, \"An event in Discordeno is a function that can be called when a specific event occurs. For the most part, events will usually be the ones that are available from Discordeno. However, you can create your own custom events as well if you wish. \"));\n}\n;\nMDXContent.isMDXComponent = true;","rawMDXOutput":"/* @jsx mdx */\nimport { mdx } from '@mdx-js/react';\n/* @jsx mdx */\n\nexport const _frontmatter = {\n \"title\": \"Creating Events!\",\n \"metaTitle\": \"Creating An Event | Discordeno\",\n \"metaDescription\": \"Let's create our very own bot with Discordeno!\"\n};\n\nconst layoutProps = {\n _frontmatter\n};\nconst MDXLayout = \"wrapper\"\nexport default function MDXContent({\n components,\n ...props\n}) {\n return \n

{`Woah! You are almost half way done with understanding all of Discordeno. Amazing isn't it? Something you may have noticed in the last section was when the bot started up you could see a bunch of messages like `}{`Loaded X Commands`}{` and such. Let's jump into this part now and understand how event handling works in Discordeno.`}

\n

{`What Is An Event?`}

\n

{`An event in Discordeno is a function that can be called when a specific event occurs. For the most part, events will usually be the ones that are available from Discordeno. However, you can create your own custom events as well if you wish. `}

\n\n
;\n}\n\n;\nMDXContent.isMDXComponent = true;"}} \ No newline at end of file diff --git a/docs/.cache/caches/gatsby-plugin-mdx/diskstore-794797195edf61a3b05547501cb7a1d5.json b/docs/.cache/caches/gatsby-plugin-mdx/diskstore-794797195edf61a3b05547501cb7a1d5.json new file mode 100644 index 000000000..eceb1d028 --- /dev/null +++ b/docs/.cache/caches/gatsby-plugin-mdx/diskstore-794797195edf61a3b05547501cb7a1d5.json @@ -0,0 +1 @@ +{"expireTime":9007200851634035000,"key":"gatsby-plugin-mdx-entire-payload-7985a6fe941dd65f9396636c1420954e-","val":{"mdast":{"type":"root","children":[{"type":"paragraph","children":[{"type":"text","value":"Woah! You are almost half way done with understanding all of Discordeno. Amazing isn't it? Something you may have noticed in the last section was there were some options that prevented some commands from running like ","position":{"start":{"line":2,"column":1,"offset":1},"end":{"line":2,"column":218,"offset":218},"indent":[]}},{"type":"inlineCode","value":"dmOnly","position":{"start":{"line":2,"column":218,"offset":218},"end":{"line":2,"column":226,"offset":226},"indent":[]}},{"type":"text","value":" or the permission options. we created a setting to prevent the monitor from running in certain channels. What if we wanted to do prevent commands from happening? How would we prevent commands from running?","position":{"start":{"line":2,"column":226,"offset":226},"end":{"line":2,"column":432,"offset":432},"indent":[]}}],"position":{"start":{"line":2,"column":1,"offset":1},"end":{"line":2,"column":432,"offset":432},"indent":[]}},{"type":"heading","depth":2,"children":[{"type":"text","value":"What is an Inhibitor?","position":{"start":{"line":4,"column":4,"offset":437},"end":{"line":4,"column":25,"offset":458},"indent":[]}}],"position":{"start":{"line":4,"column":1,"offset":434},"end":{"line":4,"column":25,"offset":458},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"An Inhibitor is very similar to how monitors work. A monitor runs on every message but an inhibitor runs on every command. Remember all those command options like cooldown, permissions, permissionLevel, nsfw, etc... Each and every one of these options has an inhibitor in that checks commands for these settings.","position":{"start":{"line":6,"column":1,"offset":460},"end":{"line":6,"column":313,"offset":772},"indent":[]}}],"position":{"start":{"line":6,"column":1,"offset":460},"end":{"line":6,"column":313,"offset":772},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"Let's create our own inhibitor that would prevent commands from being used if the user is not a VIP user.","position":{"start":{"line":8,"column":1,"offset":774},"end":{"line":8,"column":106,"offset":879},"indent":[]}}],"position":{"start":{"line":8,"column":1,"offset":774},"end":{"line":8,"column":106,"offset":879},"indent":[]}},{"type":"blockquote","children":[{"type":"paragraph","children":[{"type":"strong","children":[{"type":"text","value":"Note:","position":{"start":{"line":10,"column":5,"offset":885},"end":{"line":10,"column":10,"offset":890},"indent":[]}}],"position":{"start":{"line":10,"column":3,"offset":883},"end":{"line":10,"column":12,"offset":892},"indent":[]}},{"type":"text","value":" It is important to remember that everything below can be done with a simple permission level as well. We will create our own custom permission levels but for the purposes of this guide and to be able to learn about Inhibitors, we will be using an inhibitor.","position":{"start":{"line":10,"column":12,"offset":892},"end":{"line":10,"column":270,"offset":1150},"indent":[]}}],"position":{"start":{"line":10,"column":3,"offset":883},"end":{"line":10,"column":270,"offset":1150},"indent":[]}}],"position":{"start":{"line":10,"column":1,"offset":881},"end":{"line":10,"column":270,"offset":1150},"indent":[]}},{"type":"heading","depth":2,"children":[{"type":"text","value":"Creating the File","position":{"start":{"line":12,"column":4,"offset":1155},"end":{"line":12,"column":21,"offset":1172},"indent":[]}}],"position":{"start":{"line":12,"column":1,"offset":1152},"end":{"line":12,"column":21,"offset":1172},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"Let's start by creating a file inside the inhibitors folder called ","position":{"start":{"line":14,"column":1,"offset":1174},"end":{"line":14,"column":68,"offset":1241},"indent":[]}},{"type":"inlineCode","value":"boostRequired.ts","position":{"start":{"line":14,"column":68,"offset":1241},"end":{"line":14,"column":86,"offset":1259},"indent":[]}},{"type":"text","value":" and paste the following snippet of code:","position":{"start":{"line":14,"column":86,"offset":1259},"end":{"line":14,"column":127,"offset":1300},"indent":[]}}],"position":{"start":{"line":14,"column":1,"offset":1174},"end":{"line":14,"column":127,"offset":1300},"indent":[]}},{"type":"code","lang":"ts","meta":null,"value":"import { botCache } from \"../../mod.ts\";\n\nbotCache.inhibitors.set(\"inhibitorname\", async function (message, command, guild) {\n\t// Your code goes here\n});","position":{"start":{"line":16,"column":1,"offset":1302},"end":{"line":22,"column":4,"offset":1465},"indent":[1,1,1,1,1,1]}},{"type":"paragraph","children":[{"type":"text","value":"Inhibitors can take up to 3 arguments.","position":{"start":{"line":24,"column":1,"offset":1467},"end":{"line":24,"column":39,"offset":1505},"indent":[]}}],"position":{"start":{"line":24,"column":1,"offset":1467},"end":{"line":24,"column":39,"offset":1505},"indent":[]}},{"type":"list","ordered":false,"start":null,"spread":false,"children":[{"type":"listItem","spread":false,"checked":null,"children":[{"type":"paragraph","children":[{"type":"inlineCode","value":"message","position":{"start":{"line":26,"column":3,"offset":1509},"end":{"line":26,"column":12,"offset":1518},"indent":[]}},{"type":"text","value":": The message object that triggered the command.","position":{"start":{"line":26,"column":12,"offset":1518},"end":{"line":26,"column":60,"offset":1566},"indent":[]}}],"position":{"start":{"line":26,"column":3,"offset":1509},"end":{"line":26,"column":60,"offset":1566},"indent":[]}}],"position":{"start":{"line":26,"column":1,"offset":1507},"end":{"line":26,"column":60,"offset":1566},"indent":[]}},{"type":"listItem","spread":false,"checked":null,"children":[{"type":"paragraph","children":[{"type":"inlineCode","value":"command","position":{"start":{"line":27,"column":3,"offset":1569},"end":{"line":27,"column":12,"offset":1578},"indent":[]}},{"type":"text","value":": The command object itself that was triggered.","position":{"start":{"line":27,"column":12,"offset":1578},"end":{"line":27,"column":59,"offset":1625},"indent":[]}}],"position":{"start":{"line":27,"column":3,"offset":1569},"end":{"line":27,"column":59,"offset":1625},"indent":[]}}],"position":{"start":{"line":27,"column":1,"offset":1567},"end":{"line":27,"column":59,"offset":1625},"indent":[]}},{"type":"listItem","spread":false,"checked":null,"children":[{"type":"paragraph","children":[{"type":"inlineCode","value":"guild","position":{"start":{"line":28,"column":3,"offset":1628},"end":{"line":28,"column":10,"offset":1635},"indent":[]}},{"type":"text","value":": The server guild object where this command was ran.","position":{"start":{"line":28,"column":10,"offset":1635},"end":{"line":28,"column":63,"offset":1688},"indent":[]}}],"position":{"start":{"line":28,"column":3,"offset":1628},"end":{"line":28,"column":63,"offset":1688},"indent":[]}}],"position":{"start":{"line":28,"column":1,"offset":1626},"end":{"line":28,"column":63,"offset":1688},"indent":[]}}],"position":{"start":{"line":26,"column":1,"offset":1507},"end":{"line":28,"column":63,"offset":1688},"indent":[1,1]}},{"type":"heading","depth":2,"children":[{"type":"text","value":"Understanding How Inhibitors Function","position":{"start":{"line":30,"column":4,"offset":1693},"end":{"line":30,"column":41,"offset":1730},"indent":[]}}],"position":{"start":{"line":30,"column":1,"offset":1690},"end":{"line":30,"column":41,"offset":1730},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"To block a command you have to return a truthy value.","position":{"start":{"line":32,"column":1,"offset":1732},"end":{"line":32,"column":54,"offset":1785},"indent":[]}}],"position":{"start":{"line":32,"column":1,"offset":1732},"end":{"line":32,"column":54,"offset":1785},"indent":[]}},{"type":"list","ordered":false,"start":null,"spread":false,"children":[{"type":"listItem","spread":false,"checked":null,"children":[{"type":"paragraph","children":[{"type":"strong","children":[{"type":"text","value":"return true;","position":{"start":{"line":33,"column":5,"offset":1790},"end":{"line":33,"column":17,"offset":1802},"indent":[]}}],"position":{"start":{"line":33,"column":3,"offset":1788},"end":{"line":33,"column":19,"offset":1804},"indent":[]}},{"type":"text","value":" If you return true the inhibitor will block the execution of the command.\nTo allow a command return a falsey value.","position":{"start":{"line":33,"column":19,"offset":1804},"end":{"line":34,"column":42,"offset":1920},"indent":[1]}}],"position":{"start":{"line":33,"column":3,"offset":1788},"end":{"line":34,"column":42,"offset":1920},"indent":[1]}}],"position":{"start":{"line":33,"column":1,"offset":1786},"end":{"line":34,"column":42,"offset":1920},"indent":[1]}},{"type":"listItem","spread":false,"checked":null,"children":[{"type":"paragraph","children":[{"type":"strong","children":[{"type":"text","value":"return false;","position":{"start":{"line":35,"column":5,"offset":1925},"end":{"line":35,"column":18,"offset":1938},"indent":[]}}],"position":{"start":{"line":35,"column":3,"offset":1923},"end":{"line":35,"column":20,"offset":1940},"indent":[]}},{"type":"text","value":" If you return false the inhibitor will not block the error.","position":{"start":{"line":35,"column":20,"offset":1940},"end":{"line":35,"column":80,"offset":2000},"indent":[]}}],"position":{"start":{"line":35,"column":3,"offset":1923},"end":{"line":35,"column":80,"offset":2000},"indent":[]}}],"position":{"start":{"line":35,"column":1,"offset":1921},"end":{"line":35,"column":80,"offset":2000},"indent":[]}}],"position":{"start":{"line":33,"column":1,"offset":1786},"end":{"line":35,"column":80,"offset":2000},"indent":[1,1]}},{"type":"code","lang":"ts","meta":null,"value":"// If the command does not require a nitro boost we can allow this command to execute\nif (!command.boostRequired) return false;\n\n// Check if the user has boosted this server\nconst userIsVIP = await isUserVIP(message.author.id)\n// The user is VIP so we can allow this command to be used\nif (userIsVIP) return false;\n\n// The user is NOT VIP so we throw an error\nthrow `The ${command.name} is only allowed for VIP users.`","position":{"start":{"line":38,"column":1,"offset":2003},"end":{"line":49,"column":4,"offset":2431},"indent":[1,1,1,1,1,1,1,1,1,1,1]}},{"type":"export","value":"export const _frontmatter = {\"title\":\"Creating Inhibitors!\",\"metaTitle\":\"Creating An Inhibitor | Discordeno\",\"metaDescription\":\"Let's create our very own bot with Discordeno!\"}","position":{"start":{"line":52,"column":1,"offset":2434},"end":{"line":52,"column":177,"offset":2610},"indent":[]}}],"position":{"start":{"line":1,"column":1,"offset":0},"end":{"line":52,"column":177,"offset":2610}}},"scopeImports":["import * as React from 'react'"],"scopeIdentifiers":["React"],"body":"function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }\n\nfunction _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }\n\nfunction _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }\n\n/* @jsx mdx */\nvar _frontmatter = {\n \"title\": \"Creating Inhibitors!\",\n \"metaTitle\": \"Creating An Inhibitor | Discordeno\",\n \"metaDescription\": \"Let's create our very own bot with Discordeno!\"\n};\nvar layoutProps = {\n _frontmatter: _frontmatter\n};\nvar MDXLayout = \"wrapper\";\nreturn function MDXContent(_ref) {\n var components = _ref.components,\n props = _objectWithoutProperties(_ref, [\"components\"]);\n\n return mdx(MDXLayout, _extends({}, layoutProps, props, {\n components: components,\n mdxType: \"MDXLayout\"\n }), mdx(\"p\", null, \"Woah! You are almost half way done with understanding all of Discordeno. Amazing isn't it? Something you may have noticed in the last section was there were some options that prevented some commands from running like \", mdx(\"inlineCode\", {\n parentName: \"p\"\n }, \"dmOnly\"), \" or the permission options. we created a setting to prevent the monitor from running in certain channels. What if we wanted to do prevent commands from happening? How would we prevent commands from running?\"), mdx(\"h2\", null, \"What is an Inhibitor?\"), mdx(\"p\", null, \"An Inhibitor is very similar to how monitors work. A monitor runs on every message but an inhibitor runs on every command. Remember all those command options like cooldown, permissions, permissionLevel, nsfw, etc... Each and every one of these options has an inhibitor in that checks commands for these settings.\"), mdx(\"p\", null, \"Let's create our own inhibitor that would prevent commands from being used if the user is not a VIP user.\"), mdx(\"blockquote\", null, mdx(\"p\", {\n parentName: \"blockquote\"\n }, mdx(\"strong\", {\n parentName: \"p\"\n }, \"Note:\"), \" It is important to remember that everything below can be done with a simple permission level as well. We will create our own custom permission levels but for the purposes of this guide and to be able to learn about Inhibitors, we will be using an inhibitor.\")), mdx(\"h2\", null, \"Creating the File\"), mdx(\"p\", null, \"Let's start by creating a file inside the inhibitors folder called \", mdx(\"inlineCode\", {\n parentName: \"p\"\n }, \"boostRequired.ts\"), \" and paste the following snippet of code:\"), mdx(\"pre\", null, mdx(\"code\", _extends({\n parentName: \"pre\"\n }, {\n \"className\": \"language-ts\"\n }), \"import { botCache } from \\\"../../mod.ts\\\";\\n\\nbotCache.inhibitors.set(\\\"inhibitorname\\\", async function (message, command, guild) {\\n // Your code goes here\\n});\\n\")), mdx(\"p\", null, \"Inhibitors can take up to 3 arguments.\"), mdx(\"ul\", null, mdx(\"li\", {\n parentName: \"ul\"\n }, mdx(\"inlineCode\", {\n parentName: \"li\"\n }, \"message\"), \": The message object that triggered the command.\"), mdx(\"li\", {\n parentName: \"ul\"\n }, mdx(\"inlineCode\", {\n parentName: \"li\"\n }, \"command\"), \": The command object itself that was triggered.\"), mdx(\"li\", {\n parentName: \"ul\"\n }, mdx(\"inlineCode\", {\n parentName: \"li\"\n }, \"guild\"), \": The server guild object where this command was ran.\")), mdx(\"h2\", null, \"Understanding How Inhibitors Function\"), mdx(\"p\", null, \"To block a command you have to return a truthy value.\"), mdx(\"ul\", null, mdx(\"li\", {\n parentName: \"ul\"\n }, mdx(\"strong\", {\n parentName: \"li\"\n }, \"return true;\"), \" If you return true the inhibitor will block the execution of the command.\\nTo allow a command return a falsey value.\"), mdx(\"li\", {\n parentName: \"ul\"\n }, mdx(\"strong\", {\n parentName: \"li\"\n }, \"return false;\"), \" If you return false the inhibitor will not block the error.\")), mdx(\"pre\", null, mdx(\"code\", _extends({\n parentName: \"pre\"\n }, {\n \"className\": \"language-ts\"\n }), \"// If the command does not require a nitro boost we can allow this command to execute\\nif (!command.boostRequired) return false;\\n\\n// Check if the user has boosted this server\\nconst userIsVIP = await isUserVIP(message.author.id)\\n// The user is VIP so we can allow this command to be used\\nif (userIsVIP) return false;\\n\\n// The user is NOT VIP so we throw an error\\nthrow `The ${command.name} is only allowed for VIP users.`\\n\")));\n}\n;\nMDXContent.isMDXComponent = true;","rawMDXOutput":"/* @jsx mdx */\nimport { mdx } from '@mdx-js/react';\n/* @jsx mdx */\n\nexport const _frontmatter = {\n \"title\": \"Creating Inhibitors!\",\n \"metaTitle\": \"Creating An Inhibitor | Discordeno\",\n \"metaDescription\": \"Let's create our very own bot with Discordeno!\"\n};\n\nconst layoutProps = {\n _frontmatter\n};\nconst MDXLayout = \"wrapper\"\nexport default function MDXContent({\n components,\n ...props\n}) {\n return \n

{`Woah! You are almost half way done with understanding all of Discordeno. Amazing isn't it? Something you may have noticed in the last section was there were some options that prevented some commands from running like `}{`dmOnly`}{` or the permission options. we created a setting to prevent the monitor from running in certain channels. What if we wanted to do prevent commands from happening? How would we prevent commands from running?`}

\n

{`What is an Inhibitor?`}

\n

{`An Inhibitor is very similar to how monitors work. A monitor runs on every message but an inhibitor runs on every command. Remember all those command options like cooldown, permissions, permissionLevel, nsfw, etc... Each and every one of these options has an inhibitor in that checks commands for these settings.`}

\n

{`Let's create our own inhibitor that would prevent commands from being used if the user is not a VIP user.`}

\n
\n

{`Note:`}{` It is important to remember that everything below can be done with a simple permission level as well. We will create our own custom permission levels but for the purposes of this guide and to be able to learn about Inhibitors, we will be using an inhibitor.`}

\n
\n

{`Creating the File`}

\n

{`Let's start by creating a file inside the inhibitors folder called `}{`boostRequired.ts`}{` and paste the following snippet of code:`}

\n
{`import { botCache } from \"../../mod.ts\";\n\nbotCache.inhibitors.set(\"inhibitorname\", async function (message, command, guild) {\n    // Your code goes here\n});\n`}
\n

{`Inhibitors can take up to 3 arguments.`}

\n
    \n
  • {`message`}{`: The message object that triggered the command.`}
  • \n
  • {`command`}{`: The command object itself that was triggered.`}
  • \n
  • {`guild`}{`: The server guild object where this command was ran.`}
  • \n
\n

{`Understanding How Inhibitors Function`}

\n

{`To block a command you have to return a truthy value.`}

\n
    \n
  • {`return true;`}{` If you return true the inhibitor will block the execution of the command.\nTo allow a command return a falsey value.`}
  • \n
  • {`return false;`}{` If you return false the inhibitor will not block the error.`}
  • \n
\n
{`// If the command does not require a nitro boost we can allow this command to execute\nif (!command.boostRequired) return false;\n\n// Check if the user has boosted this server\nconst userIsVIP = await isUserVIP(message.author.id)\n// The user is VIP so we can allow this command to be used\nif (userIsVIP) return false;\n\n// The user is NOT VIP so we throw an error\nthrow \\`The \\${command.name} is only allowed for VIP users.\\`\n`}
\n\n
;\n}\n\n;\nMDXContent.isMDXComponent = true;"}} \ No newline at end of file diff --git a/docs/.cache/caches/gatsby-plugin-mdx/diskstore-7a7059fb75507b5fc793da3f6ea6b0cf.json b/docs/.cache/caches/gatsby-plugin-mdx/diskstore-7a7059fb75507b5fc793da3f6ea6b0cf.json new file mode 100644 index 000000000..9f36661f0 --- /dev/null +++ b/docs/.cache/caches/gatsby-plugin-mdx/diskstore-7a7059fb75507b5fc793da3f6ea6b0cf.json @@ -0,0 +1 @@ +{"expireTime":9007200851596121000,"key":"gatsby-plugin-mdx-entire-payload-0f6356c310ebe81e16a30f92f69b15b8-","val":{"mdast":{"type":"root","children":[{"type":"paragraph","children":[{"type":"text","value":"Perm level guide here in depth version!","position":{"start":{"line":2,"column":1,"offset":1},"end":{"line":2,"column":40,"offset":40},"indent":[]}}],"position":{"start":{"line":2,"column":1,"offset":1},"end":{"line":2,"column":40,"offset":40},"indent":[]}},{"type":"export","value":"export const _frontmatter = {\"title\":\"Permission Levels!\",\"metaTitle\":\"Permission Levels | Discordeno\",\"metaDescription\":\"Understanding and creating custom Discordeno permission levels!\"}","position":{"start":{"line":5,"column":1,"offset":43},"end":{"line":5,"column":188,"offset":230},"indent":[]}}],"position":{"start":{"line":1,"column":1,"offset":0},"end":{"line":5,"column":188,"offset":230}}},"scopeImports":["import * as React from 'react'"],"scopeIdentifiers":["React"],"body":"function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }\n\nfunction _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }\n\nfunction _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }\n\n/* @jsx mdx */\nvar _frontmatter = {\n \"title\": \"Permission Levels!\",\n \"metaTitle\": \"Permission Levels | Discordeno\",\n \"metaDescription\": \"Understanding and creating custom Discordeno permission levels!\"\n};\nvar layoutProps = {\n _frontmatter: _frontmatter\n};\nvar MDXLayout = \"wrapper\";\nreturn function MDXContent(_ref) {\n var components = _ref.components,\n props = _objectWithoutProperties(_ref, [\"components\"]);\n\n return mdx(MDXLayout, _extends({}, layoutProps, props, {\n components: components,\n mdxType: \"MDXLayout\"\n }), mdx(\"p\", null, \"Perm level guide here in depth version!\"));\n}\n;\nMDXContent.isMDXComponent = true;","rawMDXOutput":"/* @jsx mdx */\nimport { mdx } from '@mdx-js/react';\n/* @jsx mdx */\n\nexport const _frontmatter = {\n \"title\": \"Permission Levels!\",\n \"metaTitle\": \"Permission Levels | Discordeno\",\n \"metaDescription\": \"Understanding and creating custom Discordeno permission levels!\"\n};\n\nconst layoutProps = {\n _frontmatter\n};\nconst MDXLayout = \"wrapper\"\nexport default function MDXContent({\n components,\n ...props\n}) {\n return \n

{`Perm level guide here in depth version!`}

\n\n
;\n}\n\n;\nMDXContent.isMDXComponent = true;"}} \ No newline at end of file diff --git a/docs/.cache/caches/gatsby-plugin-mdx/diskstore-7aa7740504ab81a59de1396473cb350c.json b/docs/.cache/caches/gatsby-plugin-mdx/diskstore-7aa7740504ab81a59de1396473cb350c.json new file mode 100644 index 000000000..74bce4c83 --- /dev/null +++ b/docs/.cache/caches/gatsby-plugin-mdx/diskstore-7aa7740504ab81a59de1396473cb350c.json @@ -0,0 +1 @@ +{"expireTime":9007200851634788000,"key":"gatsby-plugin-mdx-entire-payload-52922dd158ef3c7ceb42fdc6b29ac6df-","val":{"mdast":{"type":"root","children":[{"type":"paragraph","children":[{"type":"text","value":"Woah! You are almost half way done with understanding all of Discordeno. Amazing isn't it? Something you may have noticed in the last section was there were some options that prevented some commands from running like ","position":{"start":{"line":2,"column":1,"offset":1},"end":{"line":2,"column":218,"offset":218},"indent":[]}},{"type":"inlineCode","value":"dmOnly","position":{"start":{"line":2,"column":218,"offset":218},"end":{"line":2,"column":226,"offset":226},"indent":[]}},{"type":"text","value":" or the permission options. we created a setting to prevent the monitor from running in certain channels. What if we wanted to do prevent commands from happening? How would we prevent commands from running?","position":{"start":{"line":2,"column":226,"offset":226},"end":{"line":2,"column":432,"offset":432},"indent":[]}}],"position":{"start":{"line":2,"column":1,"offset":1},"end":{"line":2,"column":432,"offset":432},"indent":[]}},{"type":"heading","depth":2,"children":[{"type":"text","value":"What is an Inhibitor?","position":{"start":{"line":4,"column":4,"offset":437},"end":{"line":4,"column":25,"offset":458},"indent":[]}}],"position":{"start":{"line":4,"column":1,"offset":434},"end":{"line":4,"column":25,"offset":458},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"An Inhibitor is very similar to how monitors work. A monitor runs on every message but an inhibitor runs on every command. Remember all those command options like cooldown, permissions, permissionLevel, nsfw, etc... Each and every one of these options has an inhibitor in that checks commands for these settings.","position":{"start":{"line":6,"column":1,"offset":460},"end":{"line":6,"column":313,"offset":772},"indent":[]}}],"position":{"start":{"line":6,"column":1,"offset":460},"end":{"line":6,"column":313,"offset":772},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"Let's create our own inhibitor that would prevent commands from being used if the user is not a VIP user.","position":{"start":{"line":8,"column":1,"offset":774},"end":{"line":8,"column":106,"offset":879},"indent":[]}}],"position":{"start":{"line":8,"column":1,"offset":774},"end":{"line":8,"column":106,"offset":879},"indent":[]}},{"type":"blockquote","children":[{"type":"paragraph","children":[{"type":"strong","children":[{"type":"text","value":"Note:","position":{"start":{"line":10,"column":5,"offset":885},"end":{"line":10,"column":10,"offset":890},"indent":[]}}],"position":{"start":{"line":10,"column":3,"offset":883},"end":{"line":10,"column":12,"offset":892},"indent":[]}},{"type":"text","value":" It is important to remember that everything below can be done with a simple permission level as well. We will create our own custom permission levels but for the purposes of this guide and to be able to learn about Inhibitors, we will be using an inhibitor.","position":{"start":{"line":10,"column":12,"offset":892},"end":{"line":10,"column":270,"offset":1150},"indent":[]}}],"position":{"start":{"line":10,"column":3,"offset":883},"end":{"line":10,"column":270,"offset":1150},"indent":[]}}],"position":{"start":{"line":10,"column":1,"offset":881},"end":{"line":10,"column":270,"offset":1150},"indent":[]}},{"type":"heading","depth":2,"children":[{"type":"text","value":"Creating the File","position":{"start":{"line":12,"column":4,"offset":1155},"end":{"line":12,"column":21,"offset":1172},"indent":[]}}],"position":{"start":{"line":12,"column":1,"offset":1152},"end":{"line":12,"column":21,"offset":1172},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"Let's start by creating a file inside the inhibitors folder called ","position":{"start":{"line":14,"column":1,"offset":1174},"end":{"line":14,"column":68,"offset":1241},"indent":[]}},{"type":"inlineCode","value":"boosted.ts","position":{"start":{"line":14,"column":68,"offset":1241},"end":{"line":14,"column":80,"offset":1253},"indent":[]}},{"type":"text","value":" and paste the following snippet of code:","position":{"start":{"line":14,"column":80,"offset":1253},"end":{"line":14,"column":121,"offset":1294},"indent":[]}}],"position":{"start":{"line":14,"column":1,"offset":1174},"end":{"line":14,"column":121,"offset":1294},"indent":[]}},{"type":"code","lang":"ts","meta":null,"value":"import { botCache } from \"../../mod.ts\";\n\nbotCache.inhibitors.set(\"inhibitorname\", async function (message, command, guild) {\n\t// Your code goes here\n});","position":{"start":{"line":16,"column":1,"offset":1296},"end":{"line":22,"column":4,"offset":1459},"indent":[1,1,1,1,1,1]}},{"type":"paragraph","children":[{"type":"text","value":"Inhibitors can take up to 3 arguments.","position":{"start":{"line":24,"column":1,"offset":1461},"end":{"line":24,"column":39,"offset":1499},"indent":[]}}],"position":{"start":{"line":24,"column":1,"offset":1461},"end":{"line":24,"column":39,"offset":1499},"indent":[]}},{"type":"list","ordered":false,"start":null,"spread":false,"children":[{"type":"listItem","spread":false,"checked":null,"children":[{"type":"paragraph","children":[{"type":"inlineCode","value":"message","position":{"start":{"line":26,"column":3,"offset":1503},"end":{"line":26,"column":12,"offset":1512},"indent":[]}},{"type":"text","value":": The message object that triggered the command.","position":{"start":{"line":26,"column":12,"offset":1512},"end":{"line":26,"column":60,"offset":1560},"indent":[]}}],"position":{"start":{"line":26,"column":3,"offset":1503},"end":{"line":26,"column":60,"offset":1560},"indent":[]}}],"position":{"start":{"line":26,"column":1,"offset":1501},"end":{"line":26,"column":60,"offset":1560},"indent":[]}},{"type":"listItem","spread":false,"checked":null,"children":[{"type":"paragraph","children":[{"type":"inlineCode","value":"command","position":{"start":{"line":27,"column":3,"offset":1563},"end":{"line":27,"column":12,"offset":1572},"indent":[]}},{"type":"text","value":": The command object itself that was triggered.","position":{"start":{"line":27,"column":12,"offset":1572},"end":{"line":27,"column":59,"offset":1619},"indent":[]}}],"position":{"start":{"line":27,"column":3,"offset":1563},"end":{"line":27,"column":59,"offset":1619},"indent":[]}}],"position":{"start":{"line":27,"column":1,"offset":1561},"end":{"line":27,"column":59,"offset":1619},"indent":[]}},{"type":"listItem","spread":false,"checked":null,"children":[{"type":"paragraph","children":[{"type":"inlineCode","value":"guild","position":{"start":{"line":28,"column":3,"offset":1622},"end":{"line":28,"column":10,"offset":1629},"indent":[]}},{"type":"text","value":": The server guild object where this command was ran.","position":{"start":{"line":28,"column":10,"offset":1629},"end":{"line":28,"column":63,"offset":1682},"indent":[]}}],"position":{"start":{"line":28,"column":3,"offset":1622},"end":{"line":28,"column":63,"offset":1682},"indent":[]}}],"position":{"start":{"line":28,"column":1,"offset":1620},"end":{"line":28,"column":63,"offset":1682},"indent":[]}}],"position":{"start":{"line":26,"column":1,"offset":1501},"end":{"line":28,"column":63,"offset":1682},"indent":[1,1]}},{"type":"heading","depth":2,"children":[{"type":"text","value":"Understanding How Inhibitors Function","position":{"start":{"line":30,"column":4,"offset":1687},"end":{"line":30,"column":41,"offset":1724},"indent":[]}}],"position":{"start":{"line":30,"column":1,"offset":1684},"end":{"line":30,"column":41,"offset":1724},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"To block a command you have to return a truthy value.","position":{"start":{"line":32,"column":1,"offset":1726},"end":{"line":32,"column":54,"offset":1779},"indent":[]}}],"position":{"start":{"line":32,"column":1,"offset":1726},"end":{"line":32,"column":54,"offset":1779},"indent":[]}},{"type":"list","ordered":false,"start":null,"spread":false,"children":[{"type":"listItem","spread":false,"checked":null,"children":[{"type":"paragraph","children":[{"type":"strong","children":[{"type":"text","value":"return true;","position":{"start":{"line":33,"column":5,"offset":1784},"end":{"line":33,"column":17,"offset":1796},"indent":[]}}],"position":{"start":{"line":33,"column":3,"offset":1782},"end":{"line":33,"column":19,"offset":1798},"indent":[]}},{"type":"text","value":" If you return true the inhibitor will block the execution of the command.\nTo allow a command return a falsey value.","position":{"start":{"line":33,"column":19,"offset":1798},"end":{"line":34,"column":42,"offset":1914},"indent":[1]}}],"position":{"start":{"line":33,"column":3,"offset":1782},"end":{"line":34,"column":42,"offset":1914},"indent":[1]}}],"position":{"start":{"line":33,"column":1,"offset":1780},"end":{"line":34,"column":42,"offset":1914},"indent":[1]}},{"type":"listItem","spread":false,"checked":null,"children":[{"type":"paragraph","children":[{"type":"strong","children":[{"type":"text","value":"return false;","position":{"start":{"line":35,"column":5,"offset":1919},"end":{"line":35,"column":18,"offset":1932},"indent":[]}}],"position":{"start":{"line":35,"column":3,"offset":1917},"end":{"line":35,"column":20,"offset":1934},"indent":[]}},{"type":"text","value":" If you return false the inhibitor will not block the error.","position":{"start":{"line":35,"column":20,"offset":1934},"end":{"line":35,"column":80,"offset":1994},"indent":[]}}],"position":{"start":{"line":35,"column":3,"offset":1917},"end":{"line":35,"column":80,"offset":1994},"indent":[]}}],"position":{"start":{"line":35,"column":1,"offset":1915},"end":{"line":35,"column":80,"offset":1994},"indent":[]}}],"position":{"start":{"line":33,"column":1,"offset":1780},"end":{"line":35,"column":80,"offset":1994},"indent":[1,1]}},{"type":"code","lang":"ts","meta":null,"value":"// If the command is not VIP only we can allow this command to execute\nif (!command.vipOnly) return false;\n\n// The bot's support server\nconst guild = cache.guilds.get(configs.supportServerID);\n// If the command author is not in the server they won't have the vip role\nconst member = guild.members.get(message.author.id) || await getMember(guild.id, message.author.id);\n// Member doesn't exist so cancel the command\nif (!member) {\n\tsendResponse(message, `sorry, but you can not use this command until you become VIP. **Close the IRIS!!!**`)\n\treturn true;\n}\n\n// If the user has the vip role on the support server given by patreon allow the command\nif (member.roles.includes(configs.roleIDs.patreonVIPRoleID)) return false;\n\n// Alert the user they don't have vip and can't use the command\nsendResponse(message, `sorry, but you can not use this command until you become a VIP. I'm sorry, Teal'c. We'll go to Disneyland next year. I promise.`)\n// Cancel the command since the user does not have vip\nreturn true;","position":{"start":{"line":38,"column":1,"offset":1997},"end":{"line":59,"column":4,"offset":3013},"indent":[1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1]}},{"type":"heading","depth":2,"children":[{"type":"text","value":"Challenges","position":{"start":{"line":61,"column":4,"offset":3018},"end":{"line":61,"column":14,"offset":3028},"indent":[]}}],"position":{"start":{"line":61,"column":1,"offset":3015},"end":{"line":61,"column":14,"offset":3028},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"Hell yes! We just got through the entire inhibitor section. You have now mastered everything related to inhibitors.","position":{"start":{"line":63,"column":1,"offset":3030},"end":{"line":63,"column":116,"offset":3145},"indent":[]}}],"position":{"start":{"line":63,"column":1,"offset":3030},"end":{"line":63,"column":116,"offset":3145},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"You can now try and get a little more practice with inhibitors by trying to challenge yourself and make your own inhibitors. Don't worry if you can't think of any good use cases for inhibitors.","position":{"start":{"line":65,"column":1,"offset":3147},"end":{"line":65,"column":194,"offset":3340},"indent":[]}}],"position":{"start":{"line":65,"column":1,"offset":3147},"end":{"line":65,"column":194,"offset":3340},"indent":[]}},{"type":"export","value":"export const _frontmatter = {\"title\":\"Creating Inhibitors!\",\"metaTitle\":\"Creating An Inhibitor | Discordeno\",\"metaDescription\":\"Let's create our very own bot with Discordeno!\"}","position":{"start":{"line":68,"column":1,"offset":3343},"end":{"line":68,"column":177,"offset":3519},"indent":[]}}],"position":{"start":{"line":1,"column":1,"offset":0},"end":{"line":68,"column":177,"offset":3519}}},"scopeImports":["import * as React from 'react'"],"scopeIdentifiers":["React"],"body":"function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }\n\nfunction _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }\n\nfunction _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }\n\n/* @jsx mdx */\nvar _frontmatter = {\n \"title\": \"Creating Inhibitors!\",\n \"metaTitle\": \"Creating An Inhibitor | Discordeno\",\n \"metaDescription\": \"Let's create our very own bot with Discordeno!\"\n};\nvar layoutProps = {\n _frontmatter: _frontmatter\n};\nvar MDXLayout = \"wrapper\";\nreturn function MDXContent(_ref) {\n var components = _ref.components,\n props = _objectWithoutProperties(_ref, [\"components\"]);\n\n return mdx(MDXLayout, _extends({}, layoutProps, props, {\n components: components,\n mdxType: \"MDXLayout\"\n }), mdx(\"p\", null, \"Woah! You are almost half way done with understanding all of Discordeno. Amazing isn't it? Something you may have noticed in the last section was there were some options that prevented some commands from running like \", mdx(\"inlineCode\", {\n parentName: \"p\"\n }, \"dmOnly\"), \" or the permission options. we created a setting to prevent the monitor from running in certain channels. What if we wanted to do prevent commands from happening? How would we prevent commands from running?\"), mdx(\"h2\", null, \"What is an Inhibitor?\"), mdx(\"p\", null, \"An Inhibitor is very similar to how monitors work. A monitor runs on every message but an inhibitor runs on every command. Remember all those command options like cooldown, permissions, permissionLevel, nsfw, etc... Each and every one of these options has an inhibitor in that checks commands for these settings.\"), mdx(\"p\", null, \"Let's create our own inhibitor that would prevent commands from being used if the user is not a VIP user.\"), mdx(\"blockquote\", null, mdx(\"p\", {\n parentName: \"blockquote\"\n }, mdx(\"strong\", {\n parentName: \"p\"\n }, \"Note:\"), \" It is important to remember that everything below can be done with a simple permission level as well. We will create our own custom permission levels but for the purposes of this guide and to be able to learn about Inhibitors, we will be using an inhibitor.\")), mdx(\"h2\", null, \"Creating the File\"), mdx(\"p\", null, \"Let's start by creating a file inside the inhibitors folder called \", mdx(\"inlineCode\", {\n parentName: \"p\"\n }, \"boosted.ts\"), \" and paste the following snippet of code:\"), mdx(\"pre\", null, mdx(\"code\", _extends({\n parentName: \"pre\"\n }, {\n \"className\": \"language-ts\"\n }), \"import { botCache } from \\\"../../mod.ts\\\";\\n\\nbotCache.inhibitors.set(\\\"inhibitorname\\\", async function (message, command, guild) {\\n // Your code goes here\\n});\\n\")), mdx(\"p\", null, \"Inhibitors can take up to 3 arguments.\"), mdx(\"ul\", null, mdx(\"li\", {\n parentName: \"ul\"\n }, mdx(\"inlineCode\", {\n parentName: \"li\"\n }, \"message\"), \": The message object that triggered the command.\"), mdx(\"li\", {\n parentName: \"ul\"\n }, mdx(\"inlineCode\", {\n parentName: \"li\"\n }, \"command\"), \": The command object itself that was triggered.\"), mdx(\"li\", {\n parentName: \"ul\"\n }, mdx(\"inlineCode\", {\n parentName: \"li\"\n }, \"guild\"), \": The server guild object where this command was ran.\")), mdx(\"h2\", null, \"Understanding How Inhibitors Function\"), mdx(\"p\", null, \"To block a command you have to return a truthy value.\"), mdx(\"ul\", null, mdx(\"li\", {\n parentName: \"ul\"\n }, mdx(\"strong\", {\n parentName: \"li\"\n }, \"return true;\"), \" If you return true the inhibitor will block the execution of the command.\\nTo allow a command return a falsey value.\"), mdx(\"li\", {\n parentName: \"ul\"\n }, mdx(\"strong\", {\n parentName: \"li\"\n }, \"return false;\"), \" If you return false the inhibitor will not block the error.\")), mdx(\"pre\", null, mdx(\"code\", _extends({\n parentName: \"pre\"\n }, {\n \"className\": \"language-ts\"\n }), \"// If the command is not VIP only we can allow this command to execute\\nif (!command.vipOnly) return false;\\n\\n// The bot's support server\\nconst guild = cache.guilds.get(configs.supportServerID);\\n// If the command author is not in the server they won't have the vip role\\nconst member = guild.members.get(message.author.id) || await getMember(guild.id, message.author.id);\\n// Member doesn't exist so cancel the command\\nif (!member) {\\n sendResponse(message, `sorry, but you can not use this command until you become VIP. **Close the IRIS!!!**`)\\n return true;\\n}\\n\\n// If the user has the vip role on the support server given by patreon allow the command\\nif (member.roles.includes(configs.roleIDs.patreonVIPRoleID)) return false;\\n\\n// Alert the user they don't have vip and can't use the command\\nsendResponse(message, `sorry, but you can not use this command until you become a VIP. I'm sorry, Teal'c. We'll go to Disneyland next year. I promise.`)\\n// Cancel the command since the user does not have vip\\nreturn true;\\n\")), mdx(\"h2\", null, \"Challenges\"), mdx(\"p\", null, \"Hell yes! We just got through the entire inhibitor section. You have now mastered everything related to inhibitors.\"), mdx(\"p\", null, \"You can now try and get a little more practice with inhibitors by trying to challenge yourself and make your own inhibitors. Don't worry if you can't think of any good use cases for inhibitors.\"));\n}\n;\nMDXContent.isMDXComponent = true;","rawMDXOutput":"/* @jsx mdx */\nimport { mdx } from '@mdx-js/react';\n/* @jsx mdx */\n\nexport const _frontmatter = {\n \"title\": \"Creating Inhibitors!\",\n \"metaTitle\": \"Creating An Inhibitor | Discordeno\",\n \"metaDescription\": \"Let's create our very own bot with Discordeno!\"\n};\n\nconst layoutProps = {\n _frontmatter\n};\nconst MDXLayout = \"wrapper\"\nexport default function MDXContent({\n components,\n ...props\n}) {\n return \n

{`Woah! You are almost half way done with understanding all of Discordeno. Amazing isn't it? Something you may have noticed in the last section was there were some options that prevented some commands from running like `}{`dmOnly`}{` or the permission options. we created a setting to prevent the monitor from running in certain channels. What if we wanted to do prevent commands from happening? How would we prevent commands from running?`}

\n

{`What is an Inhibitor?`}

\n

{`An Inhibitor is very similar to how monitors work. A monitor runs on every message but an inhibitor runs on every command. Remember all those command options like cooldown, permissions, permissionLevel, nsfw, etc... Each and every one of these options has an inhibitor in that checks commands for these settings.`}

\n

{`Let's create our own inhibitor that would prevent commands from being used if the user is not a VIP user.`}

\n
\n

{`Note:`}{` It is important to remember that everything below can be done with a simple permission level as well. We will create our own custom permission levels but for the purposes of this guide and to be able to learn about Inhibitors, we will be using an inhibitor.`}

\n
\n

{`Creating the File`}

\n

{`Let's start by creating a file inside the inhibitors folder called `}{`boosted.ts`}{` and paste the following snippet of code:`}

\n
{`import { botCache } from \"../../mod.ts\";\n\nbotCache.inhibitors.set(\"inhibitorname\", async function (message, command, guild) {\n    // Your code goes here\n});\n`}
\n

{`Inhibitors can take up to 3 arguments.`}

\n
    \n
  • {`message`}{`: The message object that triggered the command.`}
  • \n
  • {`command`}{`: The command object itself that was triggered.`}
  • \n
  • {`guild`}{`: The server guild object where this command was ran.`}
  • \n
\n

{`Understanding How Inhibitors Function`}

\n

{`To block a command you have to return a truthy value.`}

\n
    \n
  • {`return true;`}{` If you return true the inhibitor will block the execution of the command.\nTo allow a command return a falsey value.`}
  • \n
  • {`return false;`}{` If you return false the inhibitor will not block the error.`}
  • \n
\n
{`// If the command is not VIP only we can allow this command to execute\nif (!command.vipOnly) return false;\n\n// The bot's support server\nconst guild = cache.guilds.get(configs.supportServerID);\n// If the command author is not in the server they won't have the vip role\nconst member = guild.members.get(message.author.id) || await getMember(guild.id, message.author.id);\n// Member doesn't exist so cancel the command\nif (!member) {\n    sendResponse(message, \\`sorry, but you can not use this command until you become VIP. **Close the IRIS!!!**\\`)\n    return true;\n}\n\n// If the user has the vip role on the support server given by patreon allow the command\nif (member.roles.includes(configs.roleIDs.patreonVIPRoleID)) return false;\n\n// Alert the user they don't have vip and can't use the command\nsendResponse(message, \\`sorry, but you can not use this command until you become a VIP. I'm sorry, Teal'c. We'll go to Disneyland next year. I promise.\\`)\n// Cancel the command since the user does not have vip\nreturn true;\n`}
\n

{`Challenges`}

\n

{`Hell yes! We just got through the entire inhibitor section. You have now mastered everything related to inhibitors.`}

\n

{`You can now try and get a little more practice with inhibitors by trying to challenge yourself and make your own inhibitors. Don't worry if you can't think of any good use cases for inhibitors.`}

\n\n
;\n}\n\n;\nMDXContent.isMDXComponent = true;"}} \ No newline at end of file diff --git a/docs/.cache/caches/gatsby-plugin-mdx/diskstore-7b8aaa1037478cb56350f784d9d9542a.json b/docs/.cache/caches/gatsby-plugin-mdx/diskstore-7b8aaa1037478cb56350f784d9d9542a.json new file mode 100644 index 000000000..72369fcbf --- /dev/null +++ b/docs/.cache/caches/gatsby-plugin-mdx/diskstore-7b8aaa1037478cb56350f784d9d9542a.json @@ -0,0 +1 @@ +{"expireTime":9007200851634127000,"key":"gatsby-plugin-mdx-entire-payload-374d4557a7f7c58d11fda1090a8408cd-","val":{"mdast":{"type":"root","children":[{"type":"paragraph","children":[{"type":"text","value":"Woah! You are almost half way done with understanding all of Discordeno. Amazing isn't it? Something you may have noticed in the last section was there were some options that prevented some commands from running like ","position":{"start":{"line":2,"column":1,"offset":1},"end":{"line":2,"column":218,"offset":218},"indent":[]}},{"type":"inlineCode","value":"dmOnly","position":{"start":{"line":2,"column":218,"offset":218},"end":{"line":2,"column":226,"offset":226},"indent":[]}},{"type":"text","value":" or the permission options. we created a setting to prevent the monitor from running in certain channels. What if we wanted to do prevent commands from happening? How would we prevent commands from running?","position":{"start":{"line":2,"column":226,"offset":226},"end":{"line":2,"column":432,"offset":432},"indent":[]}}],"position":{"start":{"line":2,"column":1,"offset":1},"end":{"line":2,"column":432,"offset":432},"indent":[]}},{"type":"heading","depth":2,"children":[{"type":"text","value":"What is an Inhibitor?","position":{"start":{"line":4,"column":4,"offset":437},"end":{"line":4,"column":25,"offset":458},"indent":[]}}],"position":{"start":{"line":4,"column":1,"offset":434},"end":{"line":4,"column":25,"offset":458},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"An Inhibitor is very similar to how monitors work. A monitor runs on every message but an inhibitor runs on every command. Remember all those command options like cooldown, permissions, permissionLevel, nsfw, etc... Each and every one of these options has an inhibitor in that checks commands for these settings.","position":{"start":{"line":6,"column":1,"offset":460},"end":{"line":6,"column":313,"offset":772},"indent":[]}}],"position":{"start":{"line":6,"column":1,"offset":460},"end":{"line":6,"column":313,"offset":772},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"Let's create our own inhibitor that would prevent commands from being used if the user is not a VIP user.","position":{"start":{"line":8,"column":1,"offset":774},"end":{"line":8,"column":106,"offset":879},"indent":[]}}],"position":{"start":{"line":8,"column":1,"offset":774},"end":{"line":8,"column":106,"offset":879},"indent":[]}},{"type":"blockquote","children":[{"type":"paragraph","children":[{"type":"strong","children":[{"type":"text","value":"Note:","position":{"start":{"line":10,"column":5,"offset":885},"end":{"line":10,"column":10,"offset":890},"indent":[]}}],"position":{"start":{"line":10,"column":3,"offset":883},"end":{"line":10,"column":12,"offset":892},"indent":[]}},{"type":"text","value":" It is important to remember that everything below can be done with a simple permission level as well. We will create our own custom permission levels but for the purposes of this guide and to be able to learn about Inhibitors, we will be using an inhibitor.","position":{"start":{"line":10,"column":12,"offset":892},"end":{"line":10,"column":270,"offset":1150},"indent":[]}}],"position":{"start":{"line":10,"column":3,"offset":883},"end":{"line":10,"column":270,"offset":1150},"indent":[]}}],"position":{"start":{"line":10,"column":1,"offset":881},"end":{"line":10,"column":270,"offset":1150},"indent":[]}},{"type":"heading","depth":2,"children":[{"type":"text","value":"Creating the File","position":{"start":{"line":12,"column":4,"offset":1155},"end":{"line":12,"column":21,"offset":1172},"indent":[]}}],"position":{"start":{"line":12,"column":1,"offset":1152},"end":{"line":12,"column":21,"offset":1172},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"Let's start by creating a file inside the inhibitors folder called ","position":{"start":{"line":14,"column":1,"offset":1174},"end":{"line":14,"column":68,"offset":1241},"indent":[]}},{"type":"inlineCode","value":"boosted.ts","position":{"start":{"line":14,"column":68,"offset":1241},"end":{"line":14,"column":80,"offset":1253},"indent":[]}},{"type":"text","value":" and paste the following snippet of code:","position":{"start":{"line":14,"column":80,"offset":1253},"end":{"line":14,"column":121,"offset":1294},"indent":[]}}],"position":{"start":{"line":14,"column":1,"offset":1174},"end":{"line":14,"column":121,"offset":1294},"indent":[]}},{"type":"code","lang":"ts","meta":null,"value":"import { botCache } from \"../../mod.ts\";\n\nbotCache.inhibitors.set(\"inhibitorname\", async function (message, command, guild) {\n\t// Your code goes here\n});","position":{"start":{"line":16,"column":1,"offset":1296},"end":{"line":22,"column":4,"offset":1459},"indent":[1,1,1,1,1,1]}},{"type":"paragraph","children":[{"type":"text","value":"Inhibitors can take up to 3 arguments.","position":{"start":{"line":24,"column":1,"offset":1461},"end":{"line":24,"column":39,"offset":1499},"indent":[]}}],"position":{"start":{"line":24,"column":1,"offset":1461},"end":{"line":24,"column":39,"offset":1499},"indent":[]}},{"type":"list","ordered":false,"start":null,"spread":false,"children":[{"type":"listItem","spread":false,"checked":null,"children":[{"type":"paragraph","children":[{"type":"inlineCode","value":"message","position":{"start":{"line":26,"column":3,"offset":1503},"end":{"line":26,"column":12,"offset":1512},"indent":[]}},{"type":"text","value":": The message object that triggered the command.","position":{"start":{"line":26,"column":12,"offset":1512},"end":{"line":26,"column":60,"offset":1560},"indent":[]}}],"position":{"start":{"line":26,"column":3,"offset":1503},"end":{"line":26,"column":60,"offset":1560},"indent":[]}}],"position":{"start":{"line":26,"column":1,"offset":1501},"end":{"line":26,"column":60,"offset":1560},"indent":[]}},{"type":"listItem","spread":false,"checked":null,"children":[{"type":"paragraph","children":[{"type":"inlineCode","value":"command","position":{"start":{"line":27,"column":3,"offset":1563},"end":{"line":27,"column":12,"offset":1572},"indent":[]}},{"type":"text","value":": The command object itself that was triggered.","position":{"start":{"line":27,"column":12,"offset":1572},"end":{"line":27,"column":59,"offset":1619},"indent":[]}}],"position":{"start":{"line":27,"column":3,"offset":1563},"end":{"line":27,"column":59,"offset":1619},"indent":[]}}],"position":{"start":{"line":27,"column":1,"offset":1561},"end":{"line":27,"column":59,"offset":1619},"indent":[]}},{"type":"listItem","spread":false,"checked":null,"children":[{"type":"paragraph","children":[{"type":"inlineCode","value":"guild","position":{"start":{"line":28,"column":3,"offset":1622},"end":{"line":28,"column":10,"offset":1629},"indent":[]}},{"type":"text","value":": The server guild object where this command was ran.","position":{"start":{"line":28,"column":10,"offset":1629},"end":{"line":28,"column":63,"offset":1682},"indent":[]}}],"position":{"start":{"line":28,"column":3,"offset":1622},"end":{"line":28,"column":63,"offset":1682},"indent":[]}}],"position":{"start":{"line":28,"column":1,"offset":1620},"end":{"line":28,"column":63,"offset":1682},"indent":[]}}],"position":{"start":{"line":26,"column":1,"offset":1501},"end":{"line":28,"column":63,"offset":1682},"indent":[1,1]}},{"type":"heading","depth":2,"children":[{"type":"text","value":"Understanding How Inhibitors Function","position":{"start":{"line":30,"column":4,"offset":1687},"end":{"line":30,"column":41,"offset":1724},"indent":[]}}],"position":{"start":{"line":30,"column":1,"offset":1684},"end":{"line":30,"column":41,"offset":1724},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"To block a command you have to return a truthy value.","position":{"start":{"line":32,"column":1,"offset":1726},"end":{"line":32,"column":54,"offset":1779},"indent":[]}}],"position":{"start":{"line":32,"column":1,"offset":1726},"end":{"line":32,"column":54,"offset":1779},"indent":[]}},{"type":"list","ordered":false,"start":null,"spread":false,"children":[{"type":"listItem","spread":false,"checked":null,"children":[{"type":"paragraph","children":[{"type":"strong","children":[{"type":"text","value":"return true;","position":{"start":{"line":33,"column":5,"offset":1784},"end":{"line":33,"column":17,"offset":1796},"indent":[]}}],"position":{"start":{"line":33,"column":3,"offset":1782},"end":{"line":33,"column":19,"offset":1798},"indent":[]}},{"type":"text","value":" If you return true the inhibitor will block the execution of the command.\nTo allow a command return a falsey value.","position":{"start":{"line":33,"column":19,"offset":1798},"end":{"line":34,"column":42,"offset":1914},"indent":[1]}}],"position":{"start":{"line":33,"column":3,"offset":1782},"end":{"line":34,"column":42,"offset":1914},"indent":[1]}}],"position":{"start":{"line":33,"column":1,"offset":1780},"end":{"line":34,"column":42,"offset":1914},"indent":[1]}},{"type":"listItem","spread":false,"checked":null,"children":[{"type":"paragraph","children":[{"type":"strong","children":[{"type":"text","value":"return false;","position":{"start":{"line":35,"column":5,"offset":1919},"end":{"line":35,"column":18,"offset":1932},"indent":[]}}],"position":{"start":{"line":35,"column":3,"offset":1917},"end":{"line":35,"column":20,"offset":1934},"indent":[]}},{"type":"text","value":" If you return false the inhibitor will not block the error.","position":{"start":{"line":35,"column":20,"offset":1934},"end":{"line":35,"column":80,"offset":1994},"indent":[]}}],"position":{"start":{"line":35,"column":3,"offset":1917},"end":{"line":35,"column":80,"offset":1994},"indent":[]}}],"position":{"start":{"line":35,"column":1,"offset":1915},"end":{"line":35,"column":80,"offset":1994},"indent":[]}}],"position":{"start":{"line":33,"column":1,"offset":1780},"end":{"line":35,"column":80,"offset":1994},"indent":[1,1]}},{"type":"code","lang":"ts","meta":null,"value":"// If the command is not VIP only we can allow this command to execute\nif (!command.vipOnly) return false;\n\n// The bot's support server\nconst guild = cache.guilds.get(configs.supportServerID);\n// Check if the user has the vip role on the support server given by patreon\nconst userIsVIP = await isUserVIP(message.author.id)\n// The user is VIP so we can allow this command to be used\nif (userIsVIP) return false;\n\n// The user is NOT VIP so we throw an error\nthrow `The ${command.name} is only allowed for VIP users.`","position":{"start":{"line":38,"column":1,"offset":1997},"end":{"line":51,"column":4,"offset":2521},"indent":[1,1,1,1,1,1,1,1,1,1,1,1,1]}},{"type":"export","value":"export const _frontmatter = {\"title\":\"Creating Inhibitors!\",\"metaTitle\":\"Creating An Inhibitor | Discordeno\",\"metaDescription\":\"Let's create our very own bot with Discordeno!\"}","position":{"start":{"line":54,"column":1,"offset":2524},"end":{"line":54,"column":177,"offset":2700},"indent":[]}}],"position":{"start":{"line":1,"column":1,"offset":0},"end":{"line":54,"column":177,"offset":2700}}},"scopeImports":["import * as React from 'react'"],"scopeIdentifiers":["React"],"body":"function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }\n\nfunction _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }\n\nfunction _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }\n\n/* @jsx mdx */\nvar _frontmatter = {\n \"title\": \"Creating Inhibitors!\",\n \"metaTitle\": \"Creating An Inhibitor | Discordeno\",\n \"metaDescription\": \"Let's create our very own bot with Discordeno!\"\n};\nvar layoutProps = {\n _frontmatter: _frontmatter\n};\nvar MDXLayout = \"wrapper\";\nreturn function MDXContent(_ref) {\n var components = _ref.components,\n props = _objectWithoutProperties(_ref, [\"components\"]);\n\n return mdx(MDXLayout, _extends({}, layoutProps, props, {\n components: components,\n mdxType: \"MDXLayout\"\n }), mdx(\"p\", null, \"Woah! You are almost half way done with understanding all of Discordeno. Amazing isn't it? Something you may have noticed in the last section was there were some options that prevented some commands from running like \", mdx(\"inlineCode\", {\n parentName: \"p\"\n }, \"dmOnly\"), \" or the permission options. we created a setting to prevent the monitor from running in certain channels. What if we wanted to do prevent commands from happening? How would we prevent commands from running?\"), mdx(\"h2\", null, \"What is an Inhibitor?\"), mdx(\"p\", null, \"An Inhibitor is very similar to how monitors work. A monitor runs on every message but an inhibitor runs on every command. Remember all those command options like cooldown, permissions, permissionLevel, nsfw, etc... Each and every one of these options has an inhibitor in that checks commands for these settings.\"), mdx(\"p\", null, \"Let's create our own inhibitor that would prevent commands from being used if the user is not a VIP user.\"), mdx(\"blockquote\", null, mdx(\"p\", {\n parentName: \"blockquote\"\n }, mdx(\"strong\", {\n parentName: \"p\"\n }, \"Note:\"), \" It is important to remember that everything below can be done with a simple permission level as well. We will create our own custom permission levels but for the purposes of this guide and to be able to learn about Inhibitors, we will be using an inhibitor.\")), mdx(\"h2\", null, \"Creating the File\"), mdx(\"p\", null, \"Let's start by creating a file inside the inhibitors folder called \", mdx(\"inlineCode\", {\n parentName: \"p\"\n }, \"boosted.ts\"), \" and paste the following snippet of code:\"), mdx(\"pre\", null, mdx(\"code\", _extends({\n parentName: \"pre\"\n }, {\n \"className\": \"language-ts\"\n }), \"import { botCache } from \\\"../../mod.ts\\\";\\n\\nbotCache.inhibitors.set(\\\"inhibitorname\\\", async function (message, command, guild) {\\n // Your code goes here\\n});\\n\")), mdx(\"p\", null, \"Inhibitors can take up to 3 arguments.\"), mdx(\"ul\", null, mdx(\"li\", {\n parentName: \"ul\"\n }, mdx(\"inlineCode\", {\n parentName: \"li\"\n }, \"message\"), \": The message object that triggered the command.\"), mdx(\"li\", {\n parentName: \"ul\"\n }, mdx(\"inlineCode\", {\n parentName: \"li\"\n }, \"command\"), \": The command object itself that was triggered.\"), mdx(\"li\", {\n parentName: \"ul\"\n }, mdx(\"inlineCode\", {\n parentName: \"li\"\n }, \"guild\"), \": The server guild object where this command was ran.\")), mdx(\"h2\", null, \"Understanding How Inhibitors Function\"), mdx(\"p\", null, \"To block a command you have to return a truthy value.\"), mdx(\"ul\", null, mdx(\"li\", {\n parentName: \"ul\"\n }, mdx(\"strong\", {\n parentName: \"li\"\n }, \"return true;\"), \" If you return true the inhibitor will block the execution of the command.\\nTo allow a command return a falsey value.\"), mdx(\"li\", {\n parentName: \"ul\"\n }, mdx(\"strong\", {\n parentName: \"li\"\n }, \"return false;\"), \" If you return false the inhibitor will not block the error.\")), mdx(\"pre\", null, mdx(\"code\", _extends({\n parentName: \"pre\"\n }, {\n \"className\": \"language-ts\"\n }), \"// If the command is not VIP only we can allow this command to execute\\nif (!command.vipOnly) return false;\\n\\n// The bot's support server\\nconst guild = cache.guilds.get(configs.supportServerID);\\n// Check if the user has the vip role on the support server given by patreon\\nconst userIsVIP = await isUserVIP(message.author.id)\\n// The user is VIP so we can allow this command to be used\\nif (userIsVIP) return false;\\n\\n// The user is NOT VIP so we throw an error\\nthrow `The ${command.name} is only allowed for VIP users.`\\n\")));\n}\n;\nMDXContent.isMDXComponent = true;","rawMDXOutput":"/* @jsx mdx */\nimport { mdx } from '@mdx-js/react';\n/* @jsx mdx */\n\nexport const _frontmatter = {\n \"title\": \"Creating Inhibitors!\",\n \"metaTitle\": \"Creating An Inhibitor | Discordeno\",\n \"metaDescription\": \"Let's create our very own bot with Discordeno!\"\n};\n\nconst layoutProps = {\n _frontmatter\n};\nconst MDXLayout = \"wrapper\"\nexport default function MDXContent({\n components,\n ...props\n}) {\n return \n

{`Woah! You are almost half way done with understanding all of Discordeno. Amazing isn't it? Something you may have noticed in the last section was there were some options that prevented some commands from running like `}{`dmOnly`}{` or the permission options. we created a setting to prevent the monitor from running in certain channels. What if we wanted to do prevent commands from happening? How would we prevent commands from running?`}

\n

{`What is an Inhibitor?`}

\n

{`An Inhibitor is very similar to how monitors work. A monitor runs on every message but an inhibitor runs on every command. Remember all those command options like cooldown, permissions, permissionLevel, nsfw, etc... Each and every one of these options has an inhibitor in that checks commands for these settings.`}

\n

{`Let's create our own inhibitor that would prevent commands from being used if the user is not a VIP user.`}

\n
\n

{`Note:`}{` It is important to remember that everything below can be done with a simple permission level as well. We will create our own custom permission levels but for the purposes of this guide and to be able to learn about Inhibitors, we will be using an inhibitor.`}

\n
\n

{`Creating the File`}

\n

{`Let's start by creating a file inside the inhibitors folder called `}{`boosted.ts`}{` and paste the following snippet of code:`}

\n
{`import { botCache } from \"../../mod.ts\";\n\nbotCache.inhibitors.set(\"inhibitorname\", async function (message, command, guild) {\n    // Your code goes here\n});\n`}
\n

{`Inhibitors can take up to 3 arguments.`}

\n
    \n
  • {`message`}{`: The message object that triggered the command.`}
  • \n
  • {`command`}{`: The command object itself that was triggered.`}
  • \n
  • {`guild`}{`: The server guild object where this command was ran.`}
  • \n
\n

{`Understanding How Inhibitors Function`}

\n

{`To block a command you have to return a truthy value.`}

\n
    \n
  • {`return true;`}{` If you return true the inhibitor will block the execution of the command.\nTo allow a command return a falsey value.`}
  • \n
  • {`return false;`}{` If you return false the inhibitor will not block the error.`}
  • \n
\n
{`// If the command is not VIP only we can allow this command to execute\nif (!command.vipOnly) return false;\n\n// The bot's support server\nconst guild = cache.guilds.get(configs.supportServerID);\n// Check if the user has the vip role on the support server given by patreon\nconst userIsVIP = await isUserVIP(message.author.id)\n// The user is VIP so we can allow this command to be used\nif (userIsVIP) return false;\n\n// The user is NOT VIP so we throw an error\nthrow \\`The \\${command.name} is only allowed for VIP users.\\`\n`}
\n\n
;\n}\n\n;\nMDXContent.isMDXComponent = true;"}} \ No newline at end of file diff --git a/docs/.cache/caches/gatsby-plugin-mdx/diskstore-7bc9578329298fbb8e415ab47e1c6d57.json b/docs/.cache/caches/gatsby-plugin-mdx/diskstore-7bc9578329298fbb8e415ab47e1c6d57.json new file mode 100644 index 000000000..3ed9b6456 --- /dev/null +++ b/docs/.cache/caches/gatsby-plugin-mdx/diskstore-7bc9578329298fbb8e415ab47e1c6d57.json @@ -0,0 +1 @@ +{"expireTime":9007200851596805000,"key":"gatsby-plugin-mdx-entire-payload-4c892568d2b95bc9cdbc986689b7dade-","val":{"mdast":{"type":"root","children":[{"type":"export","value":"export const _frontmatter = {\"title\":\"Creating The Bot!\",\"metaTitle\":\"Creating A Bot | Discordeno\",\"metaDescription\":\"Let's create our very own bot with Discordeno!\"}","position":{"start":{"line":4,"column":1,"offset":3},"end":{"line":4,"column":167,"offset":169},"indent":[]}}],"position":{"start":{"line":1,"column":1,"offset":0},"end":{"line":4,"column":167,"offset":169}}},"scopeImports":["import * as React from 'react'"],"scopeIdentifiers":["React"],"body":"function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }\n\nfunction _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }\n\nfunction _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }\n\n/* @jsx mdx */\nvar _frontmatter = {\n \"title\": \"Creating The Bot!\",\n \"metaTitle\": \"Creating A Bot | Discordeno\",\n \"metaDescription\": \"Let's create our very own bot with Discordeno!\"\n};\nvar layoutProps = {\n _frontmatter: _frontmatter\n};\nvar MDXLayout = \"wrapper\";\nreturn function MDXContent(_ref) {\n var components = _ref.components,\n props = _objectWithoutProperties(_ref, [\"components\"]);\n\n return mdx(MDXLayout, _extends({}, layoutProps, props, {\n components: components,\n mdxType: \"MDXLayout\"\n }));\n}\n;\nMDXContent.isMDXComponent = true;","rawMDXOutput":"/* @jsx mdx */\nimport { mdx } from '@mdx-js/react';\n/* @jsx mdx */\n\nexport const _frontmatter = {\n \"title\": \"Creating The Bot!\",\n \"metaTitle\": \"Creating A Bot | Discordeno\",\n \"metaDescription\": \"Let's create our very own bot with Discordeno!\"\n};\n\nconst layoutProps = {\n _frontmatter\n};\nconst MDXLayout = \"wrapper\"\nexport default function MDXContent({\n components,\n ...props\n}) {\n return \n\n ;\n}\n\n;\nMDXContent.isMDXComponent = true;"}} \ No newline at end of file diff --git a/docs/.cache/caches/gatsby-plugin-mdx/diskstore-7ceb97a6eec71c23d8606266ce3af052.json b/docs/.cache/caches/gatsby-plugin-mdx/diskstore-7ceb97a6eec71c23d8606266ce3af052.json new file mode 100644 index 000000000..00c043cda --- /dev/null +++ b/docs/.cache/caches/gatsby-plugin-mdx/diskstore-7ceb97a6eec71c23d8606266ce3af052.json @@ -0,0 +1 @@ +{"expireTime":9007200851644265000,"key":"gatsby-plugin-mdx-entire-payload-a7e17f5c395f814773563dce2f1406c6-","val":{"mdast":{"type":"root","children":[{"type":"paragraph","children":[{"type":"text","value":"Discordeno will help make Discord bot development much easier. Don't worry, as you go through this guide it will make a lot more sense.","position":{"start":{"line":2,"column":1,"offset":1},"end":{"line":2,"column":136,"offset":136},"indent":[]}}],"position":{"start":{"line":2,"column":1,"offset":1},"end":{"line":2,"column":136,"offset":136},"indent":[]}},{"type":"heading","depth":2,"children":[{"type":"text","value":"Creating The Bot!","position":{"start":{"line":4,"column":4,"offset":141},"end":{"line":4,"column":21,"offset":158},"indent":[]}}],"position":{"start":{"line":4,"column":1,"offset":138},"end":{"line":4,"column":21,"offset":158},"indent":[]}},{"type":"blockquote","children":[{"type":"paragraph","children":[{"type":"text","value":"This guide is going to assume you already have the basic requirements to make a bot ready. This includes github, git, a code editor like Visual Studio Code. If you don't have these yet please prepare them first before going forward.","position":{"start":{"line":6,"column":3,"offset":162},"end":{"line":6,"column":235,"offset":394},"indent":[]}}],"position":{"start":{"line":6,"column":3,"offset":162},"end":{"line":6,"column":235,"offset":394},"indent":[]}}],"position":{"start":{"line":6,"column":1,"offset":160},"end":{"line":6,"column":235,"offset":394},"indent":[]}},{"type":"list","ordered":false,"start":null,"spread":true,"children":[{"type":"listItem","spread":false,"checked":null,"children":[{"type":"paragraph","children":[{"type":"text","value":"First, create a Discordeno Bot using the ","position":{"start":{"line":8,"column":3,"offset":398},"end":{"line":8,"column":44,"offset":439},"indent":[]}},{"type":"link","title":null,"url":"https://github.com/Skillz4Killz/Discordeno-bot-template","children":[{"type":"text","value":"Generator Boilerplate","position":{"start":{"line":8,"column":45,"offset":440},"end":{"line":8,"column":66,"offset":461},"indent":[]}}],"position":{"start":{"line":8,"column":44,"offset":439},"end":{"line":8,"column":124,"offset":519},"indent":[]}},{"type":"text","value":". Give it any name you like. For the purpose of this guide we will call it, Stargate.","position":{"start":{"line":8,"column":124,"offset":519},"end":{"line":8,"column":209,"offset":604},"indent":[]}}],"position":{"start":{"line":8,"column":3,"offset":398},"end":{"line":8,"column":209,"offset":604},"indent":[]}}],"position":{"start":{"line":8,"column":1,"offset":396},"end":{"line":9,"column":1,"offset":605},"indent":[1]}},{"type":"listItem","spread":false,"checked":null,"children":[{"type":"paragraph","children":[{"type":"text","value":"Then ","position":{"start":{"line":10,"column":3,"offset":608},"end":{"line":10,"column":8,"offset":613},"indent":[]}},{"type":"inlineCode","value":"git clone https://github.com/Skillz4Killz/Stargate.git","position":{"start":{"line":10,"column":8,"offset":613},"end":{"line":10,"column":64,"offset":669},"indent":[]}}],"position":{"start":{"line":10,"column":3,"offset":608},"end":{"line":10,"column":64,"offset":669},"indent":[]}}],"position":{"start":{"line":10,"column":1,"offset":606},"end":{"line":11,"column":1,"offset":670},"indent":[1]}},{"type":"listItem","spread":false,"checked":null,"children":[{"type":"paragraph","children":[{"type":"text","value":"When that is done, go ahead and open up the folder with VSC.","position":{"start":{"line":12,"column":3,"offset":673},"end":{"line":12,"column":63,"offset":733},"indent":[]}}],"position":{"start":{"line":12,"column":3,"offset":673},"end":{"line":12,"column":63,"offset":733},"indent":[]}}],"position":{"start":{"line":12,"column":1,"offset":671},"end":{"line":12,"column":63,"offset":733},"indent":[]}},{"type":"listItem","spread":false,"checked":null,"children":[{"type":"paragraph","children":[{"type":"text","value":"Create a new file called ","position":{"start":{"line":13,"column":3,"offset":736},"end":{"line":13,"column":28,"offset":761},"indent":[]}},{"type":"inlineCode","value":"configs.ts","position":{"start":{"line":13,"column":28,"offset":761},"end":{"line":13,"column":40,"offset":773},"indent":[]}},{"type":"text","value":". Open the ","position":{"start":{"line":13,"column":40,"offset":773},"end":{"line":13,"column":51,"offset":784},"indent":[]}},{"type":"inlineCode","value":"configs.example.ts","position":{"start":{"line":13,"column":51,"offset":784},"end":{"line":13,"column":71,"offset":804},"indent":[]}},{"type":"text","value":" file and copy everything over.","position":{"start":{"line":13,"column":71,"offset":804},"end":{"line":13,"column":102,"offset":835},"indent":[]}}],"position":{"start":{"line":13,"column":3,"offset":736},"end":{"line":13,"column":102,"offset":835},"indent":[]}}],"position":{"start":{"line":13,"column":1,"offset":734},"end":{"line":13,"column":102,"offset":835},"indent":[]}}],"position":{"start":{"line":8,"column":1,"offset":396},"end":{"line":13,"column":102,"offset":835},"indent":[1,1,1,1,1]}},{"type":"paragraph","children":[{"type":"text","value":"Let's take a minute to review all the options we have available to us.","position":{"start":{"line":15,"column":1,"offset":837},"end":{"line":15,"column":71,"offset":907},"indent":[]}}],"position":{"start":{"line":15,"column":1,"offset":837},"end":{"line":15,"column":71,"offset":907},"indent":[]}},{"type":"heading","depth":3,"children":[{"type":"text","value":"Configs File","position":{"start":{"line":17,"column":5,"offset":913},"end":{"line":17,"column":17,"offset":925},"indent":[]}}],"position":{"start":{"line":17,"column":1,"offset":909},"end":{"line":17,"column":17,"offset":925},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"The ","position":{"start":{"line":19,"column":1,"offset":927},"end":{"line":19,"column":5,"offset":931},"indent":[]}},{"type":"inlineCode","value":"configs.ts","position":{"start":{"line":19,"column":5,"offset":931},"end":{"line":19,"column":17,"offset":943},"indent":[]}},{"type":"text","value":" file is where you will keep all your secret info you don't want to share with anyone else. As long as ","position":{"start":{"line":19,"column":17,"offset":943},"end":{"line":19,"column":120,"offset":1046},"indent":[]}},{"type":"inlineCode","value":".gitignore","position":{"start":{"line":19,"column":120,"offset":1046},"end":{"line":19,"column":132,"offset":1058},"indent":[]}},{"type":"text","value":" file is ignoring configs.ts your configurations will be kept private!","position":{"start":{"line":19,"column":132,"offset":1058},"end":{"line":19,"column":202,"offset":1128},"indent":[]}}],"position":{"start":{"line":19,"column":1,"offset":927},"end":{"line":19,"column":202,"offset":1128},"indent":[]}},{"type":"code","lang":"ts","meta":null,"value":"// Step 1: Remove the `.example` from this file name so it is called `configs.ts`\n// Step 2: Add all your bot's information below. The only required one is token and prefix. NOTE: As long as `.gitignore` file is ignoring configs.ts your configurations will be kept private!\n// Step 3: Remove these comments if you like.\n\nexport const configs = {\n // Your bot token goes here\n token: \"\",\n // The default prefix for your bot. Don't worry guilds can change this later.\n prefix: \"!\",\n // This isn't required but you can add bot list api keys here.\n botListTokens: {\n DISCORD_BOT_ORG: \"\",\n BOTS_ON_DISCORD: \"\",\n DISCORD_BOT_LIST: \"\",\n BOTS_FOR_DISCORD: \"\",\n DISCORD_BOATS: \"\",\n DISCORD_BOTS_GG: \"\",\n DISCORD_BOTS_GROUP: \"\",\n },\n // This is the server id for your bot's main server where users can get help/support\n supportServerID: \"\",\n // These are channel ids that will enable some functionality\n channelIDs: {\n // When a translation is missing this is the channel you will be alerted in.\n missingTranslation: \"\",\n // When an error occurs, we will try and log it to this channel\n errorChannelID: \"\"\n },\n // These are the role ids that will enable some functionality.\n roleIDs: {\n // If you have a patreon set up you can add the patreon vip role id here.\n patreonVIPRoleID: \"\",\n },\n // These are the user ids that will enable some functionality.\n userIDs: {\n // The user ids for the support team\n botSupporters: [],\n // The user ids for the other devs on your team\n botDevs: [],\n // The user ids who have complete 100% access to your bot\n botOwners: []\n }\n};\n","position":{"start":{"line":21,"column":1,"offset":1130},"end":{"line":66,"column":4,"offset":2770},"indent":[1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1]}},{"type":"heading","depth":4,"children":[{"type":"text","value":"Token","position":{"start":{"line":68,"column":6,"offset":2777},"end":{"line":68,"column":11,"offset":2782},"indent":[]}}],"position":{"start":{"line":68,"column":1,"offset":2772},"end":{"line":68,"column":11,"offset":2782},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"First, add your bot token. This is ","position":{"start":{"line":70,"column":1,"offset":2784},"end":{"line":70,"column":36,"offset":2819},"indent":[]}},{"type":"strong","children":[{"type":"text","value":"required","position":{"start":{"line":70,"column":38,"offset":2821},"end":{"line":70,"column":46,"offset":2829},"indent":[]}}],"position":{"start":{"line":70,"column":36,"offset":2819},"end":{"line":70,"column":48,"offset":2831},"indent":[]}},{"type":"text","value":" for the bot to start. Review the ","position":{"start":{"line":70,"column":48,"offset":2831},"end":{"line":70,"column":82,"offset":2865},"indent":[]}},{"type":"link","title":null,"url":"https://discordeno.netlify.app/gettingstarted#creatingyourfirstdiscordbotapplication","children":[{"type":"text","value":"instructions","position":{"start":{"line":70,"column":83,"offset":2866},"end":{"line":70,"column":95,"offset":2878},"indent":[]}}],"position":{"start":{"line":70,"column":82,"offset":2865},"end":{"line":70,"column":182,"offset":2965},"indent":[]}},{"type":"text","value":" if you have not made your token yet.","position":{"start":{"line":70,"column":182,"offset":2965},"end":{"line":70,"column":219,"offset":3002},"indent":[]}}],"position":{"start":{"line":70,"column":1,"offset":2784},"end":{"line":70,"column":219,"offset":3002},"indent":[]}},{"type":"heading","depth":4,"children":[{"type":"text","value":"Prefix","position":{"start":{"line":72,"column":6,"offset":3009},"end":{"line":72,"column":12,"offset":3015},"indent":[]}}],"position":{"start":{"line":72,"column":1,"offset":3004},"end":{"line":72,"column":12,"offset":3015},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"The prefix is where you will set the default prefix for your bot. Don't worry, every server will be able to choose their own prefix but we need a default prefix to start.","position":{"start":{"line":74,"column":1,"offset":3017},"end":{"line":74,"column":171,"offset":3187},"indent":[]}}],"position":{"start":{"line":74,"column":1,"offset":3017},"end":{"line":74,"column":171,"offset":3187},"indent":[]}},{"type":"heading","depth":4,"children":[{"type":"text","value":"Bot Lists Tokens","position":{"start":{"line":76,"column":6,"offset":3194},"end":{"line":76,"column":22,"offset":3210},"indent":[]}}],"position":{"start":{"line":76,"column":1,"offset":3189},"end":{"line":76,"column":22,"offset":3210},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"This section of the file is so you can easily have your bot's statistics updated on all the bot lists out there to help you grow your bot. The code is already written to handle this but you will need to do 3 things for each bot list.","position":{"start":{"line":78,"column":1,"offset":3212},"end":{"line":78,"column":234,"offset":3445},"indent":[]}}],"position":{"start":{"line":78,"column":1,"offset":3212},"end":{"line":78,"column":234,"offset":3445},"indent":[]}},{"type":"list","ordered":true,"start":1,"spread":false,"children":[{"type":"listItem","spread":false,"checked":null,"children":[{"type":"paragraph","children":[{"type":"text","value":"Go to the bot list and add your bot to their website. (Each site has it's own instructions)","position":{"start":{"line":80,"column":4,"offset":3450},"end":{"line":80,"column":95,"offset":3541},"indent":[]}}],"position":{"start":{"line":80,"column":4,"offset":3450},"end":{"line":80,"column":95,"offset":3541},"indent":[]}}],"position":{"start":{"line":80,"column":1,"offset":3447},"end":{"line":80,"column":95,"offset":3541},"indent":[]}},{"type":"listItem","spread":false,"checked":null,"children":[{"type":"paragraph","children":[{"type":"text","value":"Create a token for yourself on each website and paste it in your configs.","position":{"start":{"line":81,"column":4,"offset":3545},"end":{"line":81,"column":77,"offset":3618},"indent":[]}}],"position":{"start":{"line":81,"column":4,"offset":3545},"end":{"line":81,"column":77,"offset":3618},"indent":[]}}],"position":{"start":{"line":81,"column":1,"offset":3542},"end":{"line":81,"column":77,"offset":3618},"indent":[]}},{"type":"listItem","spread":false,"checked":null,"children":[{"type":"paragraph","children":[{"type":"text","value":"Enjoy!","position":{"start":{"line":82,"column":4,"offset":3622},"end":{"line":82,"column":10,"offset":3628},"indent":[]}}],"position":{"start":{"line":82,"column":4,"offset":3622},"end":{"line":82,"column":10,"offset":3628},"indent":[]}}],"position":{"start":{"line":82,"column":1,"offset":3619},"end":{"line":82,"column":10,"offset":3628},"indent":[]}}],"position":{"start":{"line":80,"column":1,"offset":3447},"end":{"line":82,"column":10,"offset":3628},"indent":[1,1]}},{"type":"paragraph","children":[{"type":"text","value":"If you wish to customize the code, you will find the bot list tasks in the tasks folder. Don't worry we will discuss this when we get to the tasks section of the guide.","position":{"start":{"line":84,"column":1,"offset":3630},"end":{"line":84,"column":169,"offset":3798},"indent":[]}}],"position":{"start":{"line":84,"column":1,"offset":3630},"end":{"line":84,"column":169,"offset":3798},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"For now just remember, that Discordeno provides you a built in way to update most discord bot lists.","position":{"start":{"line":86,"column":1,"offset":3800},"end":{"line":86,"column":101,"offset":3900},"indent":[]}}],"position":{"start":{"line":86,"column":1,"offset":3800},"end":{"line":86,"column":101,"offset":3900},"indent":[]}},{"type":"heading","depth":4,"children":[{"type":"text","value":"Channel IDs","position":{"start":{"line":88,"column":6,"offset":3907},"end":{"line":88,"column":17,"offset":3918},"indent":[]}}],"position":{"start":{"line":88,"column":1,"offset":3902},"end":{"line":88,"column":17,"offset":3918},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"The channelIDs section holds the channel IDs that are useful for specific features to help give you alerts/notifications. For example, the ","position":{"start":{"line":90,"column":1,"offset":3920},"end":{"line":90,"column":140,"offset":4059},"indent":[]}},{"type":"inlineCode","value":"missingTranslation","position":{"start":{"line":90,"column":140,"offset":4059},"end":{"line":90,"column":160,"offset":4079},"indent":[]}},{"type":"text","value":" channel will be where messages are sent alerting you that somewhere in your code you are trying to use a translation key that you never created.","position":{"start":{"line":90,"column":160,"offset":4079},"end":{"line":90,"column":305,"offset":4224},"indent":[]}}],"position":{"start":{"line":90,"column":1,"offset":3920},"end":{"line":90,"column":305,"offset":4224},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"When you get to around 25,000 Discord servers on your bot, you may want to convert these channel IDs to webhooks.","position":{"start":{"line":92,"column":1,"offset":4226},"end":{"line":92,"column":114,"offset":4339},"indent":[]}}],"position":{"start":{"line":92,"column":1,"offset":4226},"end":{"line":92,"column":114,"offset":4339},"indent":[]}},{"type":"heading","depth":4,"children":[{"type":"text","value":"Role IDs","position":{"start":{"line":94,"column":6,"offset":4346},"end":{"line":94,"column":14,"offset":4354},"indent":[]}}],"position":{"start":{"line":94,"column":1,"offset":4341},"end":{"line":94,"column":14,"offset":4354},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"The roleIDs section holds the role IDs that are useful for specific features. For example, the ","position":{"start":{"line":96,"column":1,"offset":4356},"end":{"line":96,"column":96,"offset":4451},"indent":[]}},{"type":"inlineCode","value":"patreonVIPRoleID","position":{"start":{"line":96,"column":96,"offset":4451},"end":{"line":96,"column":114,"offset":4469},"indent":[]}},{"type":"text","value":" role can be used easily to enable vip features later in this guide.","position":{"start":{"line":96,"column":114,"offset":4469},"end":{"line":96,"column":182,"offset":4537},"indent":[]}}],"position":{"start":{"line":96,"column":1,"offset":4356},"end":{"line":96,"column":182,"offset":4537},"indent":[]}},{"type":"heading","depth":4,"children":[{"type":"text","value":"User IDs","position":{"start":{"line":98,"column":6,"offset":4544},"end":{"line":98,"column":14,"offset":4552},"indent":[]}}],"position":{"start":{"line":98,"column":1,"offset":4539},"end":{"line":98,"column":14,"offset":4552},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"The userIDs section holds the user IDs that are useful for specific features. For example, the ","position":{"start":{"line":100,"column":1,"offset":4554},"end":{"line":100,"column":96,"offset":4649},"indent":[]}},{"type":"inlineCode","value":"missingTranslation","position":{"start":{"line":100,"column":96,"offset":4649},"end":{"line":100,"column":116,"offset":4669},"indent":[]}},{"type":"text","value":" user will be where messages are sent alerting you that somewhere in your code you are trying to use a translation key that you never created.","position":{"start":{"line":100,"column":116,"offset":4669},"end":{"line":100,"column":258,"offset":4811},"indent":[]}}],"position":{"start":{"line":100,"column":1,"offset":4554},"end":{"line":100,"column":258,"offset":4811},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"When you get to around 25,000 Discord servers on your bot, you may want to convert these user IDs to webhooks.","position":{"start":{"line":102,"column":1,"offset":4813},"end":{"line":102,"column":111,"offset":4923},"indent":[]}}],"position":{"start":{"line":102,"column":1,"offset":4813},"end":{"line":102,"column":111,"offset":4923},"indent":[]}},{"type":"heading","depth":2,"children":[{"type":"text","value":"It's Alive!","position":{"start":{"line":104,"column":4,"offset":4928},"end":{"line":104,"column":15,"offset":4939},"indent":[]}}],"position":{"start":{"line":104,"column":1,"offset":4925},"end":{"line":104,"column":15,"offset":4939},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"Oh my god! You now have a bot with a bunch of features already! You don't believe me? Well, seeing is believing, so start the bot.","position":{"start":{"line":106,"column":1,"offset":4941},"end":{"line":106,"column":131,"offset":5071},"indent":[]}}],"position":{"start":{"line":106,"column":1,"offset":4941},"end":{"line":106,"column":131,"offset":5071},"indent":[]}},{"type":"list","ordered":true,"start":1,"spread":false,"children":[{"type":"listItem","spread":false,"checked":null,"children":[{"type":"paragraph","children":[{"type":"text","value":"Invite your bot to a discord server.","position":{"start":{"line":108,"column":4,"offset":5076},"end":{"line":108,"column":40,"offset":5112},"indent":[]}}],"position":{"start":{"line":108,"column":4,"offset":5076},"end":{"line":108,"column":40,"offset":5112},"indent":[]}}],"position":{"start":{"line":108,"column":1,"offset":5073},"end":{"line":108,"column":40,"offset":5112},"indent":[]}},{"type":"listItem","spread":false,"checked":null,"children":[{"type":"paragraph","children":[{"type":"text","value":"Open up the integrated terminal in VSC using ","position":{"start":{"line":109,"column":4,"offset":5116},"end":{"line":109,"column":49,"offset":5161},"indent":[]}},{"type":"strong","children":[{"type":"text","value":"CTRL + `","position":{"start":{"line":109,"column":51,"offset":5163},"end":{"line":109,"column":59,"offset":5171},"indent":[]}}],"position":{"start":{"line":109,"column":49,"offset":5161},"end":{"line":109,"column":61,"offset":5173},"indent":[]}},{"type":"text","value":". If you use a Mac, replace CTRL with CMD.","position":{"start":{"line":109,"column":61,"offset":5173},"end":{"line":109,"column":103,"offset":5215},"indent":[]}}],"position":{"start":{"line":109,"column":4,"offset":5116},"end":{"line":109,"column":103,"offset":5215},"indent":[]}}],"position":{"start":{"line":109,"column":1,"offset":5113},"end":{"line":109,"column":103,"offset":5215},"indent":[]}},{"type":"listItem","spread":false,"checked":null,"children":[{"type":"paragraph","children":[{"type":"text","value":"Run the script below:","position":{"start":{"line":110,"column":4,"offset":5219},"end":{"line":110,"column":25,"offset":5240},"indent":[]}}],"position":{"start":{"line":110,"column":4,"offset":5219},"end":{"line":110,"column":25,"offset":5240},"indent":[]}}],"position":{"start":{"line":110,"column":1,"offset":5216},"end":{"line":110,"column":25,"offset":5240},"indent":[]}}],"position":{"start":{"line":108,"column":1,"offset":5073},"end":{"line":110,"column":25,"offset":5240},"indent":[1,1]}},{"type":"code","lang":"shell","meta":null,"value":"deno run --allow-net --allow-read mod.ts","position":{"start":{"line":112,"column":1,"offset":5242},"end":{"line":114,"column":4,"offset":5295},"indent":[1,1]}},{"type":"paragraph","children":[{"type":"text","value":"The first time you run it, you may see a lot of files being loaded. This is preparing all the magic behind the scene. Once it is ready, you will see something like this:","position":{"start":{"line":116,"column":1,"offset":5297},"end":{"line":116,"column":170,"offset":5466},"indent":[]}}],"position":{"start":{"line":116,"column":1,"offset":5297},"end":{"line":116,"column":170,"offset":5466},"indent":[]}},{"type":"paragraph","children":[{"type":"image","title":null,"url":"https://i.imgur.com/TOXjLgh.png","alt":"image","position":{"start":{"line":118,"column":1,"offset":5468},"end":{"line":118,"column":42,"offset":5509},"indent":[]}}],"position":{"start":{"line":118,"column":1,"offset":5468},"end":{"line":118,"column":42,"offset":5509},"indent":[]}},{"type":"heading","depth":2,"children":[{"type":"text","value":"Understanding What Discordeno Did","position":{"start":{"line":120,"column":4,"offset":5514},"end":{"line":120,"column":37,"offset":5547},"indent":[]}}],"position":{"start":{"line":120,"column":1,"offset":5511},"end":{"line":120,"column":37,"offset":5547},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"Discordeno includes these commands/folders as they are essential for any discord bot to have in order to meet the Discord Bot Best Practices. It also adds a few things that will help make some things easier to build a bot.","position":{"start":{"line":122,"column":1,"offset":5549},"end":{"line":122,"column":223,"offset":5771},"indent":[]}}],"position":{"start":{"line":122,"column":1,"offset":5549},"end":{"line":122,"column":223,"offset":5771},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"We will dive into these deeper in this guide. Let's take it step by step.","position":{"start":{"line":124,"column":1,"offset":5773},"end":{"line":124,"column":74,"offset":5846},"indent":[]}}],"position":{"start":{"line":124,"column":1,"offset":5773},"end":{"line":124,"column":74,"offset":5846},"indent":[]}},{"type":"export","value":"export const _frontmatter = {\"title\":\"Creating The Bot!\",\"metaTitle\":\"Creating A Bot | Discordeno\",\"metaDescription\":\"Let's create our very own bot with Discordeno!\"}","position":{"start":{"line":127,"column":1,"offset":5849},"end":{"line":127,"column":167,"offset":6015},"indent":[]}}],"position":{"start":{"line":1,"column":1,"offset":0},"end":{"line":127,"column":167,"offset":6015}}},"scopeImports":["import * as React from 'react'"],"scopeIdentifiers":["React"],"body":"function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }\n\nfunction _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }\n\nfunction _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }\n\n/* @jsx mdx */\nvar _frontmatter = {\n \"title\": \"Creating The Bot!\",\n \"metaTitle\": \"Creating A Bot | Discordeno\",\n \"metaDescription\": \"Let's create our very own bot with Discordeno!\"\n};\nvar layoutProps = {\n _frontmatter: _frontmatter\n};\nvar MDXLayout = \"wrapper\";\nreturn function MDXContent(_ref) {\n var components = _ref.components,\n props = _objectWithoutProperties(_ref, [\"components\"]);\n\n return mdx(MDXLayout, _extends({}, layoutProps, props, {\n components: components,\n mdxType: \"MDXLayout\"\n }), mdx(\"p\", null, \"Discordeno will help make Discord bot development much easier. Don't worry, as you go through this guide it will make a lot more sense.\"), mdx(\"h2\", null, \"Creating The Bot!\"), mdx(\"blockquote\", null, mdx(\"p\", {\n parentName: \"blockquote\"\n }, \"This guide is going to assume you already have the basic requirements to make a bot ready. This includes github, git, a code editor like Visual Studio Code. If you don't have these yet please prepare them first before going forward.\")), mdx(\"ul\", null, mdx(\"li\", {\n parentName: \"ul\"\n }, mdx(\"p\", {\n parentName: \"li\"\n }, \"First, create a Discordeno Bot using the \", mdx(\"a\", _extends({\n parentName: \"p\"\n }, {\n \"href\": \"https://github.com/Skillz4Killz/Discordeno-bot-template\"\n }), \"Generator Boilerplate\"), \". Give it any name you like. For the purpose of this guide we will call it, Stargate.\")), mdx(\"li\", {\n parentName: \"ul\"\n }, mdx(\"p\", {\n parentName: \"li\"\n }, \"Then \", mdx(\"inlineCode\", {\n parentName: \"p\"\n }, \"git clone https://github.com/Skillz4Killz/Stargate.git\"))), mdx(\"li\", {\n parentName: \"ul\"\n }, mdx(\"p\", {\n parentName: \"li\"\n }, \"When that is done, go ahead and open up the folder with VSC.\")), mdx(\"li\", {\n parentName: \"ul\"\n }, mdx(\"p\", {\n parentName: \"li\"\n }, \"Create a new file called \", mdx(\"inlineCode\", {\n parentName: \"p\"\n }, \"configs.ts\"), \". Open the \", mdx(\"inlineCode\", {\n parentName: \"p\"\n }, \"configs.example.ts\"), \" file and copy everything over.\"))), mdx(\"p\", null, \"Let's take a minute to review all the options we have available to us.\"), mdx(\"h3\", null, \"Configs File\"), mdx(\"p\", null, \"The \", mdx(\"inlineCode\", {\n parentName: \"p\"\n }, \"configs.ts\"), \" file is where you will keep all your secret info you don't want to share with anyone else. As long as \", mdx(\"inlineCode\", {\n parentName: \"p\"\n }, \".gitignore\"), \" file is ignoring configs.ts your configurations will be kept private!\"), mdx(\"pre\", null, mdx(\"code\", _extends({\n parentName: \"pre\"\n }, {\n \"className\": \"language-ts\"\n }), \"// Step 1: Remove the `.example` from this file name so it is called `configs.ts`\\n// Step 2: Add all your bot's information below. The only required one is token and prefix. NOTE: As long as `.gitignore` file is ignoring configs.ts your configurations will be kept private!\\n// Step 3: Remove these comments if you like.\\n\\nexport const configs = {\\n // Your bot token goes here\\n token: \\\"\\\",\\n // The default prefix for your bot. Don't worry guilds can change this later.\\n prefix: \\\"!\\\",\\n // This isn't required but you can add bot list api keys here.\\n botListTokens: {\\n DISCORD_BOT_ORG: \\\"\\\",\\n BOTS_ON_DISCORD: \\\"\\\",\\n DISCORD_BOT_LIST: \\\"\\\",\\n BOTS_FOR_DISCORD: \\\"\\\",\\n DISCORD_BOATS: \\\"\\\",\\n DISCORD_BOTS_GG: \\\"\\\",\\n DISCORD_BOTS_GROUP: \\\"\\\",\\n },\\n // This is the server id for your bot's main server where users can get help/support\\n supportServerID: \\\"\\\",\\n // These are channel ids that will enable some functionality\\n channelIDs: {\\n // When a translation is missing this is the channel you will be alerted in.\\n missingTranslation: \\\"\\\",\\n // When an error occurs, we will try and log it to this channel\\n errorChannelID: \\\"\\\"\\n },\\n // These are the role ids that will enable some functionality.\\n roleIDs: {\\n // If you have a patreon set up you can add the patreon vip role id here.\\n patreonVIPRoleID: \\\"\\\",\\n },\\n // These are the user ids that will enable some functionality.\\n userIDs: {\\n // The user ids for the support team\\n botSupporters: [],\\n // The user ids for the other devs on your team\\n botDevs: [],\\n // The user ids who have complete 100% access to your bot\\n botOwners: []\\n }\\n};\\n\\n\")), mdx(\"h4\", null, \"Token\"), mdx(\"p\", null, \"First, add your bot token. This is \", mdx(\"strong\", {\n parentName: \"p\"\n }, \"required\"), \" for the bot to start. Review the \", mdx(\"a\", _extends({\n parentName: \"p\"\n }, {\n \"href\": \"https://discordeno.netlify.app/gettingstarted#creatingyourfirstdiscordbotapplication\"\n }), \"instructions\"), \" if you have not made your token yet.\"), mdx(\"h4\", null, \"Prefix\"), mdx(\"p\", null, \"The prefix is where you will set the default prefix for your bot. Don't worry, every server will be able to choose their own prefix but we need a default prefix to start.\"), mdx(\"h4\", null, \"Bot Lists Tokens\"), mdx(\"p\", null, \"This section of the file is so you can easily have your bot's statistics updated on all the bot lists out there to help you grow your bot. The code is already written to handle this but you will need to do 3 things for each bot list.\"), mdx(\"ol\", null, mdx(\"li\", {\n parentName: \"ol\"\n }, \"Go to the bot list and add your bot to their website. (Each site has it's own instructions)\"), mdx(\"li\", {\n parentName: \"ol\"\n }, \"Create a token for yourself on each website and paste it in your configs.\"), mdx(\"li\", {\n parentName: \"ol\"\n }, \"Enjoy!\")), mdx(\"p\", null, \"If you wish to customize the code, you will find the bot list tasks in the tasks folder. Don't worry we will discuss this when we get to the tasks section of the guide.\"), mdx(\"p\", null, \"For now just remember, that Discordeno provides you a built in way to update most discord bot lists.\"), mdx(\"h4\", null, \"Channel IDs\"), mdx(\"p\", null, \"The channelIDs section holds the channel IDs that are useful for specific features to help give you alerts/notifications. For example, the \", mdx(\"inlineCode\", {\n parentName: \"p\"\n }, \"missingTranslation\"), \" channel will be where messages are sent alerting you that somewhere in your code you are trying to use a translation key that you never created.\"), mdx(\"p\", null, \"When you get to around 25,000 Discord servers on your bot, you may want to convert these channel IDs to webhooks.\"), mdx(\"h4\", null, \"Role IDs\"), mdx(\"p\", null, \"The roleIDs section holds the role IDs that are useful for specific features. For example, the \", mdx(\"inlineCode\", {\n parentName: \"p\"\n }, \"patreonVIPRoleID\"), \" role can be used easily to enable vip features later in this guide.\"), mdx(\"h4\", null, \"User IDs\"), mdx(\"p\", null, \"The userIDs section holds the user IDs that are useful for specific features. For example, the \", mdx(\"inlineCode\", {\n parentName: \"p\"\n }, \"missingTranslation\"), \" user will be where messages are sent alerting you that somewhere in your code you are trying to use a translation key that you never created.\"), mdx(\"p\", null, \"When you get to around 25,000 Discord servers on your bot, you may want to convert these user IDs to webhooks.\"), mdx(\"h2\", null, \"It's Alive!\"), mdx(\"p\", null, \"Oh my god! You now have a bot with a bunch of features already! You don't believe me? Well, seeing is believing, so start the bot.\"), mdx(\"ol\", null, mdx(\"li\", {\n parentName: \"ol\"\n }, \"Invite your bot to a discord server.\"), mdx(\"li\", {\n parentName: \"ol\"\n }, \"Open up the integrated terminal in VSC using \", mdx(\"strong\", {\n parentName: \"li\"\n }, \"CTRL + `\"), \". If you use a Mac, replace CTRL with CMD.\"), mdx(\"li\", {\n parentName: \"ol\"\n }, \"Run the script below:\")), mdx(\"pre\", null, mdx(\"code\", _extends({\n parentName: \"pre\"\n }, {\n \"className\": \"language-shell\"\n }), \"deno run --allow-net --allow-read mod.ts\\n\")), mdx(\"p\", null, \"The first time you run it, you may see a lot of files being loaded. This is preparing all the magic behind the scene. Once it is ready, you will see something like this:\"), mdx(\"p\", null, mdx(\"img\", _extends({\n parentName: \"p\"\n }, {\n \"src\": \"https://i.imgur.com/TOXjLgh.png\",\n \"alt\": \"image\"\n }))), mdx(\"h2\", null, \"Understanding What Discordeno Did\"), mdx(\"p\", null, \"Discordeno includes these commands/folders as they are essential for any discord bot to have in order to meet the Discord Bot Best Practices. It also adds a few things that will help make some things easier to build a bot.\"), mdx(\"p\", null, \"We will dive into these deeper in this guide. Let's take it step by step.\"));\n}\n;\nMDXContent.isMDXComponent = true;","rawMDXOutput":"/* @jsx mdx */\nimport { mdx } from '@mdx-js/react';\n/* @jsx mdx */\n\nexport const _frontmatter = {\n \"title\": \"Creating The Bot!\",\n \"metaTitle\": \"Creating A Bot | Discordeno\",\n \"metaDescription\": \"Let's create our very own bot with Discordeno!\"\n};\n\nconst layoutProps = {\n _frontmatter\n};\nconst MDXLayout = \"wrapper\"\nexport default function MDXContent({\n components,\n ...props\n}) {\n return \n

{`Discordeno will help make Discord bot development much easier. Don't worry, as you go through this guide it will make a lot more sense.`}

\n

{`Creating The Bot!`}

\n
\n

{`This guide is going to assume you already have the basic requirements to make a bot ready. This includes github, git, a code editor like Visual Studio Code. If you don't have these yet please prepare them first before going forward.`}

\n
\n
    \n
  • \n

    {`First, create a Discordeno Bot using the `}{`Generator Boilerplate`}{`. Give it any name you like. For the purpose of this guide we will call it, Stargate.`}

    \n
  • \n
  • \n

    {`Then `}{`git clone https://github.com/Skillz4Killz/Stargate.git`}

    \n
  • \n
  • \n

    {`When that is done, go ahead and open up the folder with VSC.`}

    \n
  • \n
  • \n

    {`Create a new file called `}{`configs.ts`}{`. Open the `}{`configs.example.ts`}{` file and copy everything over.`}

    \n
  • \n
\n

{`Let's take a minute to review all the options we have available to us.`}

\n

{`Configs File`}

\n

{`The `}{`configs.ts`}{` file is where you will keep all your secret info you don't want to share with anyone else. As long as `}{`.gitignore`}{` file is ignoring configs.ts your configurations will be kept private!`}

\n
{`// Step 1: Remove the \\`.example\\` from this file name so it is called \\`configs.ts\\`\n// Step 2: Add all your bot's information below. The only required one is token and prefix. NOTE: As long as \\`.gitignore\\` file is ignoring configs.ts your configurations will be kept private!\n// Step 3: Remove these comments if you like.\n\nexport const configs = {\n  // Your bot token goes here\n  token: \"\",\n  // The default prefix for your bot. Don't worry guilds can change this later.\n  prefix: \"!\",\n  // This isn't required but you can add bot list api keys here.\n  botListTokens: {\n    DISCORD_BOT_ORG: \"\",\n    BOTS_ON_DISCORD: \"\",\n    DISCORD_BOT_LIST: \"\",\n    BOTS_FOR_DISCORD: \"\",\n    DISCORD_BOATS: \"\",\n    DISCORD_BOTS_GG: \"\",\n    DISCORD_BOTS_GROUP: \"\",\n  },\n  // This is the server id for your bot's main server where users can get help/support\n  supportServerID: \"\",\n  // These are channel ids that will enable some functionality\n  channelIDs: {\n    // When a translation is missing this is the channel you will be alerted in.\n    missingTranslation: \"\",\n    // When an error occurs, we will try and log it to this channel\n    errorChannelID: \"\"\n  },\n  // These are the role ids that will enable some functionality.\n  roleIDs: {\n    // If you have a patreon set up you can add the patreon vip role id here.\n    patreonVIPRoleID: \"\",\n  },\n  // These are the user ids that will enable some functionality.\n  userIDs: {\n    // The user ids for the support team\n    botSupporters: [],\n    // The user ids for the other devs on your team\n    botDevs: [],\n    // The user ids who have complete 100% access to your bot\n    botOwners: []\n  }\n};\n\n`}
\n

{`Token`}

\n

{`First, add your bot token. This is `}{`required`}{` for the bot to start. Review the `}{`instructions`}{` if you have not made your token yet.`}

\n

{`Prefix`}

\n

{`The prefix is where you will set the default prefix for your bot. Don't worry, every server will be able to choose their own prefix but we need a default prefix to start.`}

\n

{`Bot Lists Tokens`}

\n

{`This section of the file is so you can easily have your bot's statistics updated on all the bot lists out there to help you grow your bot. The code is already written to handle this but you will need to do 3 things for each bot list.`}

\n
    \n
  1. {`Go to the bot list and add your bot to their website. (Each site has it's own instructions)`}
  2. \n
  3. {`Create a token for yourself on each website and paste it in your configs.`}
  4. \n
  5. {`Enjoy!`}
  6. \n
\n

{`If you wish to customize the code, you will find the bot list tasks in the tasks folder. Don't worry we will discuss this when we get to the tasks section of the guide.`}

\n

{`For now just remember, that Discordeno provides you a built in way to update most discord bot lists.`}

\n

{`Channel IDs`}

\n

{`The channelIDs section holds the channel IDs that are useful for specific features to help give you alerts/notifications. For example, the `}{`missingTranslation`}{` channel will be where messages are sent alerting you that somewhere in your code you are trying to use a translation key that you never created.`}

\n

{`When you get to around 25,000 Discord servers on your bot, you may want to convert these channel IDs to webhooks.`}

\n

{`Role IDs`}

\n

{`The roleIDs section holds the role IDs that are useful for specific features. For example, the `}{`patreonVIPRoleID`}{` role can be used easily to enable vip features later in this guide.`}

\n

{`User IDs`}

\n

{`The userIDs section holds the user IDs that are useful for specific features. For example, the `}{`missingTranslation`}{` user will be where messages are sent alerting you that somewhere in your code you are trying to use a translation key that you never created.`}

\n

{`When you get to around 25,000 Discord servers on your bot, you may want to convert these user IDs to webhooks.`}

\n

{`It's Alive!`}

\n

{`Oh my god! You now have a bot with a bunch of features already! You don't believe me? Well, seeing is believing, so start the bot.`}

\n
    \n
  1. {`Invite your bot to a discord server.`}
  2. \n
  3. {`Open up the integrated terminal in VSC using `}{`CTRL + \\``}{`. If you use a Mac, replace CTRL with CMD.`}
  4. \n
  5. {`Run the script below:`}
  6. \n
\n
{`deno run --allow-net --allow-read mod.ts\n`}
\n

{`The first time you run it, you may see a lot of files being loaded. This is preparing all the magic behind the scene. Once it is ready, you will see something like this:`}

\n

\n

{`Understanding What Discordeno Did`}

\n

{`Discordeno includes these commands/folders as they are essential for any discord bot to have in order to meet the Discord Bot Best Practices. It also adds a few things that will help make some things easier to build a bot.`}

\n

{`We will dive into these deeper in this guide. Let's take it step by step.`}

\n\n
;\n}\n\n;\nMDXContent.isMDXComponent = true;"}} \ No newline at end of file diff --git a/docs/.cache/caches/gatsby-plugin-mdx/diskstore-7cf5149eab885b394a7e7659efb3896c.json b/docs/.cache/caches/gatsby-plugin-mdx/diskstore-7cf5149eab885b394a7e7659efb3896c.json new file mode 100644 index 000000000..24dfe08cc --- /dev/null +++ b/docs/.cache/caches/gatsby-plugin-mdx/diskstore-7cf5149eab885b394a7e7659efb3896c.json @@ -0,0 +1 @@ +{"expireTime":9007200851596500000,"key":"gatsby-plugin-mdx-entire-payload-92a448de75405ac2373736c162cd5e0d-","val":{"mdast":{"type":"root","children":[{"type":"paragraph","children":[{"type":"text","value":"Discordeno will help make Discord bot development much easier. Don't worry, as you go through this guide it will make a lot more sense.","position":{"start":{"line":2,"column":1,"offset":1},"end":{"line":2,"column":136,"offset":136},"indent":[]}}],"position":{"start":{"line":2,"column":1,"offset":1},"end":{"line":2,"column":136,"offset":136},"indent":[]}},{"type":"heading","depth":2,"children":[{"type":"text","value":"Creating The Bot!","position":{"start":{"line":4,"column":4,"offset":141},"end":{"line":4,"column":21,"offset":158},"indent":[]}}],"position":{"start":{"line":4,"column":1,"offset":138},"end":{"line":4,"column":21,"offset":158},"indent":[]}},{"type":"blockquote","children":[{"type":"paragraph","children":[{"type":"text","value":"This guide is going to assume you already have the basic requirements to make a bot ready. This includes github, git, a code editor like Visual Studio Code. If you don't have these yet please prepare them first before going forward.","position":{"start":{"line":6,"column":3,"offset":162},"end":{"line":6,"column":235,"offset":394},"indent":[]}}],"position":{"start":{"line":6,"column":3,"offset":162},"end":{"line":6,"column":235,"offset":394},"indent":[]}}],"position":{"start":{"line":6,"column":1,"offset":160},"end":{"line":6,"column":235,"offset":394},"indent":[]}},{"type":"list","ordered":false,"start":null,"spread":true,"children":[{"type":"listItem","spread":false,"checked":null,"children":[{"type":"paragraph","children":[{"type":"text","value":"First, create a Discordeno Bot using the ","position":{"start":{"line":8,"column":3,"offset":398},"end":{"line":8,"column":44,"offset":439},"indent":[]}},{"type":"link","title":null,"url":"https://github.com/Skillz4Killz/Discordeno-bot-template","children":[{"type":"text","value":"Generator Boilerplate","position":{"start":{"line":8,"column":45,"offset":440},"end":{"line":8,"column":66,"offset":461},"indent":[]}}],"position":{"start":{"line":8,"column":44,"offset":439},"end":{"line":8,"column":124,"offset":519},"indent":[]}},{"type":"text","value":". Give it any name you like. For the purpose of this guide we will call it, Stargate.","position":{"start":{"line":8,"column":124,"offset":519},"end":{"line":8,"column":209,"offset":604},"indent":[]}}],"position":{"start":{"line":8,"column":3,"offset":398},"end":{"line":8,"column":209,"offset":604},"indent":[]}}],"position":{"start":{"line":8,"column":1,"offset":396},"end":{"line":9,"column":1,"offset":605},"indent":[1]}},{"type":"listItem","spread":false,"checked":null,"children":[{"type":"paragraph","children":[{"type":"text","value":"Then ","position":{"start":{"line":10,"column":3,"offset":608},"end":{"line":10,"column":8,"offset":613},"indent":[]}},{"type":"inlineCode","value":"git clone https://github.com/Skillz4Killz/Stargate.git","position":{"start":{"line":10,"column":8,"offset":613},"end":{"line":10,"column":64,"offset":669},"indent":[]}}],"position":{"start":{"line":10,"column":3,"offset":608},"end":{"line":10,"column":64,"offset":669},"indent":[]}}],"position":{"start":{"line":10,"column":1,"offset":606},"end":{"line":11,"column":1,"offset":670},"indent":[1]}},{"type":"listItem","spread":false,"checked":null,"children":[{"type":"paragraph","children":[{"type":"text","value":"When that is done, go ahead and open up the folder with VSC.","position":{"start":{"line":12,"column":3,"offset":673},"end":{"line":12,"column":63,"offset":733},"indent":[]}}],"position":{"start":{"line":12,"column":3,"offset":673},"end":{"line":12,"column":63,"offset":733},"indent":[]}}],"position":{"start":{"line":12,"column":1,"offset":671},"end":{"line":12,"column":63,"offset":733},"indent":[]}},{"type":"listItem","spread":false,"checked":null,"children":[{"type":"paragraph","children":[{"type":"text","value":"Create a new file called ","position":{"start":{"line":13,"column":3,"offset":736},"end":{"line":13,"column":28,"offset":761},"indent":[]}},{"type":"inlineCode","value":"configs.ts","position":{"start":{"line":13,"column":28,"offset":761},"end":{"line":13,"column":40,"offset":773},"indent":[]}},{"type":"text","value":". Open the ","position":{"start":{"line":13,"column":40,"offset":773},"end":{"line":13,"column":51,"offset":784},"indent":[]}},{"type":"inlineCode","value":"configs.example.ts","position":{"start":{"line":13,"column":51,"offset":784},"end":{"line":13,"column":71,"offset":804},"indent":[]}},{"type":"text","value":" file and copy everything over.","position":{"start":{"line":13,"column":71,"offset":804},"end":{"line":13,"column":102,"offset":835},"indent":[]}}],"position":{"start":{"line":13,"column":3,"offset":736},"end":{"line":13,"column":102,"offset":835},"indent":[]}}],"position":{"start":{"line":13,"column":1,"offset":734},"end":{"line":13,"column":102,"offset":835},"indent":[]}}],"position":{"start":{"line":8,"column":1,"offset":396},"end":{"line":13,"column":102,"offset":835},"indent":[1,1,1,1,1]}},{"type":"paragraph","children":[{"type":"text","value":"Let's take a minute to review all the options we have available to us.","position":{"start":{"line":15,"column":1,"offset":837},"end":{"line":15,"column":71,"offset":907},"indent":[]}}],"position":{"start":{"line":15,"column":1,"offset":837},"end":{"line":15,"column":71,"offset":907},"indent":[]}},{"type":"heading","depth":3,"children":[{"type":"text","value":"Configs File","position":{"start":{"line":17,"column":5,"offset":913},"end":{"line":17,"column":17,"offset":925},"indent":[]}}],"position":{"start":{"line":17,"column":1,"offset":909},"end":{"line":17,"column":17,"offset":925},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"The ","position":{"start":{"line":19,"column":1,"offset":927},"end":{"line":19,"column":5,"offset":931},"indent":[]}},{"type":"inlineCode","value":"configs.ts","position":{"start":{"line":19,"column":5,"offset":931},"end":{"line":19,"column":17,"offset":943},"indent":[]}},{"type":"text","value":" file is where you will keep all your secret info you don't want to share with anyone else. As long as ","position":{"start":{"line":19,"column":17,"offset":943},"end":{"line":19,"column":120,"offset":1046},"indent":[]}},{"type":"inlineCode","value":".gitignore","position":{"start":{"line":19,"column":120,"offset":1046},"end":{"line":19,"column":132,"offset":1058},"indent":[]}},{"type":"text","value":" file is ignoring configs.ts your configurations will be kept private!","position":{"start":{"line":19,"column":132,"offset":1058},"end":{"line":19,"column":202,"offset":1128},"indent":[]}}],"position":{"start":{"line":19,"column":1,"offset":927},"end":{"line":19,"column":202,"offset":1128},"indent":[]}},{"type":"code","lang":"ts","meta":null,"value":"export const configs = {\n token: \"\",\n prefix: \"!\",\n botListTokens: {\n DISCORD_BOT_ORG: \"\",\n BOTS_ON_DISCORD: \"\",\n DISCORD_BOT_LIST: \"\",\n BOTS_FOR_DISCORD: \"\",\n DISCORD_BOATS: \"\",\n DISCORD_BOTS_GG: \"\",\n DISCORD_BOTS_GROUP: \"\",\n },\n channelIDs: {\n missingTranslation: \"\",\n },\n};","position":{"start":{"line":21,"column":1,"offset":1130},"end":{"line":38,"column":4,"offset":1446},"indent":[1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1]}},{"type":"heading","depth":4,"children":[{"type":"text","value":"Token","position":{"start":{"line":40,"column":6,"offset":1453},"end":{"line":40,"column":11,"offset":1458},"indent":[]}}],"position":{"start":{"line":40,"column":1,"offset":1448},"end":{"line":40,"column":11,"offset":1458},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"First, add your bot token. This is ","position":{"start":{"line":42,"column":1,"offset":1460},"end":{"line":42,"column":36,"offset":1495},"indent":[]}},{"type":"strong","children":[{"type":"text","value":"required","position":{"start":{"line":42,"column":38,"offset":1497},"end":{"line":42,"column":46,"offset":1505},"indent":[]}}],"position":{"start":{"line":42,"column":36,"offset":1495},"end":{"line":42,"column":48,"offset":1507},"indent":[]}},{"type":"text","value":" for the bot to start. Review the ","position":{"start":{"line":42,"column":48,"offset":1507},"end":{"line":42,"column":82,"offset":1541},"indent":[]}},{"type":"link","title":null,"url":"https://discordeno.netlify.app/gettingstarted#creatingyourfirstdiscordbotapplication","children":[{"type":"text","value":"instructions","position":{"start":{"line":42,"column":83,"offset":1542},"end":{"line":42,"column":95,"offset":1554},"indent":[]}}],"position":{"start":{"line":42,"column":82,"offset":1541},"end":{"line":42,"column":182,"offset":1641},"indent":[]}},{"type":"text","value":" if you have not made your token yet.","position":{"start":{"line":42,"column":182,"offset":1641},"end":{"line":42,"column":219,"offset":1678},"indent":[]}}],"position":{"start":{"line":42,"column":1,"offset":1460},"end":{"line":42,"column":219,"offset":1678},"indent":[]}},{"type":"heading","depth":4,"children":[{"type":"text","value":"Prefix","position":{"start":{"line":44,"column":6,"offset":1685},"end":{"line":44,"column":12,"offset":1691},"indent":[]}}],"position":{"start":{"line":44,"column":1,"offset":1680},"end":{"line":44,"column":12,"offset":1691},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"The prefix is where you will set the default prefix for your bot. Don't worry, every server will be able to choose their own prefix but we need a default prefix to start.","position":{"start":{"line":46,"column":1,"offset":1693},"end":{"line":46,"column":171,"offset":1863},"indent":[]}}],"position":{"start":{"line":46,"column":1,"offset":1693},"end":{"line":46,"column":171,"offset":1863},"indent":[]}},{"type":"heading","depth":4,"children":[{"type":"text","value":"Bot Lists Tokens","position":{"start":{"line":48,"column":6,"offset":1870},"end":{"line":48,"column":22,"offset":1886},"indent":[]}}],"position":{"start":{"line":48,"column":1,"offset":1865},"end":{"line":48,"column":22,"offset":1886},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"This section of the file is so you can easily have your bot's statistics updated on all the bot lists out there to help you grow your bot. The code is already written to handle this but you will need to do 3 things for each bot list.","position":{"start":{"line":50,"column":1,"offset":1888},"end":{"line":50,"column":234,"offset":2121},"indent":[]}}],"position":{"start":{"line":50,"column":1,"offset":1888},"end":{"line":50,"column":234,"offset":2121},"indent":[]}},{"type":"list","ordered":true,"start":1,"spread":false,"children":[{"type":"listItem","spread":false,"checked":null,"children":[{"type":"paragraph","children":[{"type":"text","value":"Go to the bot list and add your bot to their website. (Each site has it's own instructions)","position":{"start":{"line":52,"column":4,"offset":2126},"end":{"line":52,"column":95,"offset":2217},"indent":[]}}],"position":{"start":{"line":52,"column":4,"offset":2126},"end":{"line":52,"column":95,"offset":2217},"indent":[]}}],"position":{"start":{"line":52,"column":1,"offset":2123},"end":{"line":52,"column":95,"offset":2217},"indent":[]}},{"type":"listItem","spread":false,"checked":null,"children":[{"type":"paragraph","children":[{"type":"text","value":"Create a token for yourself on each website and paste it in your configs.","position":{"start":{"line":53,"column":4,"offset":2221},"end":{"line":53,"column":77,"offset":2294},"indent":[]}}],"position":{"start":{"line":53,"column":4,"offset":2221},"end":{"line":53,"column":77,"offset":2294},"indent":[]}}],"position":{"start":{"line":53,"column":1,"offset":2218},"end":{"line":53,"column":77,"offset":2294},"indent":[]}},{"type":"listItem","spread":false,"checked":null,"children":[{"type":"paragraph","children":[{"type":"text","value":"Enjoy!","position":{"start":{"line":54,"column":4,"offset":2298},"end":{"line":54,"column":10,"offset":2304},"indent":[]}}],"position":{"start":{"line":54,"column":4,"offset":2298},"end":{"line":54,"column":10,"offset":2304},"indent":[]}}],"position":{"start":{"line":54,"column":1,"offset":2295},"end":{"line":54,"column":10,"offset":2304},"indent":[]}}],"position":{"start":{"line":52,"column":1,"offset":2123},"end":{"line":54,"column":10,"offset":2304},"indent":[1,1]}},{"type":"paragraph","children":[{"type":"text","value":"If you wish to customize the code, you will find the bot list tasks in the tasks folder. Don't worry we will discuss this when we get to the tasks section of the guide.","position":{"start":{"line":56,"column":1,"offset":2306},"end":{"line":56,"column":169,"offset":2474},"indent":[]}}],"position":{"start":{"line":56,"column":1,"offset":2306},"end":{"line":56,"column":169,"offset":2474},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"For now just remember, that Discordeno provides you a built in way to update most discord bot lists.","position":{"start":{"line":58,"column":1,"offset":2476},"end":{"line":58,"column":101,"offset":2576},"indent":[]}}],"position":{"start":{"line":58,"column":1,"offset":2476},"end":{"line":58,"column":101,"offset":2576},"indent":[]}},{"type":"heading","depth":4,"children":[{"type":"text","value":"Channel IDs","position":{"start":{"line":60,"column":6,"offset":2583},"end":{"line":60,"column":17,"offset":2594},"indent":[]}}],"position":{"start":{"line":60,"column":1,"offset":2578},"end":{"line":60,"column":17,"offset":2594},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"The channelIDs section holds the useful for specific features to help give you alerts/notifications. For example, the ","position":{"start":{"line":62,"column":1,"offset":2596},"end":{"line":62,"column":119,"offset":2714},"indent":[]}},{"type":"inlineCode","value":"missingTranslation","position":{"start":{"line":62,"column":119,"offset":2714},"end":{"line":62,"column":139,"offset":2734},"indent":[]}},{"type":"text","value":" channel will be where messages are sent alerting you that somewhere in your code you are trying to use a translation key that you never created.","position":{"start":{"line":62,"column":139,"offset":2734},"end":{"line":62,"column":284,"offset":2879},"indent":[]}}],"position":{"start":{"line":62,"column":1,"offset":2596},"end":{"line":62,"column":284,"offset":2879},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"When you get to around 25,000 Discord servers on your bot, you may want to convert these channel IDs to webhooks.","position":{"start":{"line":64,"column":1,"offset":2881},"end":{"line":64,"column":114,"offset":2994},"indent":[]}}],"position":{"start":{"line":64,"column":1,"offset":2881},"end":{"line":64,"column":114,"offset":2994},"indent":[]}},{"type":"heading","depth":2,"children":[{"type":"text","value":"It's Alive!","position":{"start":{"line":66,"column":4,"offset":2999},"end":{"line":66,"column":15,"offset":3010},"indent":[]}}],"position":{"start":{"line":66,"column":1,"offset":2996},"end":{"line":66,"column":15,"offset":3010},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"Oh my god! You now have a bot with a bunch of features already! You don't believe me? Well, seeing is believing, so start the bot.","position":{"start":{"line":68,"column":1,"offset":3012},"end":{"line":68,"column":131,"offset":3142},"indent":[]}}],"position":{"start":{"line":68,"column":1,"offset":3012},"end":{"line":68,"column":131,"offset":3142},"indent":[]}},{"type":"list","ordered":true,"start":1,"spread":false,"children":[{"type":"listItem","spread":false,"checked":null,"children":[{"type":"paragraph","children":[{"type":"text","value":"Invite your bot to a discord server.","position":{"start":{"line":70,"column":4,"offset":3147},"end":{"line":70,"column":40,"offset":3183},"indent":[]}}],"position":{"start":{"line":70,"column":4,"offset":3147},"end":{"line":70,"column":40,"offset":3183},"indent":[]}}],"position":{"start":{"line":70,"column":1,"offset":3144},"end":{"line":70,"column":40,"offset":3183},"indent":[]}},{"type":"listItem","spread":false,"checked":null,"children":[{"type":"paragraph","children":[{"type":"text","value":"Open up the integrated terminal in VSC using ","position":{"start":{"line":71,"column":4,"offset":3187},"end":{"line":71,"column":49,"offset":3232},"indent":[]}},{"type":"strong","children":[{"type":"text","value":"CTRL + `","position":{"start":{"line":71,"column":51,"offset":3234},"end":{"line":71,"column":59,"offset":3242},"indent":[]}}],"position":{"start":{"line":71,"column":49,"offset":3232},"end":{"line":71,"column":61,"offset":3244},"indent":[]}},{"type":"text","value":". If you use a Mac, replace CTRL with CMD.","position":{"start":{"line":71,"column":61,"offset":3244},"end":{"line":71,"column":103,"offset":3286},"indent":[]}}],"position":{"start":{"line":71,"column":4,"offset":3187},"end":{"line":71,"column":103,"offset":3286},"indent":[]}}],"position":{"start":{"line":71,"column":1,"offset":3184},"end":{"line":71,"column":103,"offset":3286},"indent":[]}},{"type":"listItem","spread":false,"checked":null,"children":[{"type":"paragraph","children":[{"type":"text","value":"Run the script below:","position":{"start":{"line":72,"column":4,"offset":3290},"end":{"line":72,"column":25,"offset":3311},"indent":[]}}],"position":{"start":{"line":72,"column":4,"offset":3290},"end":{"line":72,"column":25,"offset":3311},"indent":[]}}],"position":{"start":{"line":72,"column":1,"offset":3287},"end":{"line":72,"column":25,"offset":3311},"indent":[]}}],"position":{"start":{"line":70,"column":1,"offset":3144},"end":{"line":72,"column":25,"offset":3311},"indent":[1,1]}},{"type":"code","lang":"shell","meta":null,"value":"deno run --allow-net --allow-read mod.ts","position":{"start":{"line":74,"column":1,"offset":3313},"end":{"line":76,"column":4,"offset":3366},"indent":[1,1]}},{"type":"paragraph","children":[{"type":"text","value":"The first time you run it, you may see a lot of files being loaded. This is preparing all the magic behind the scene. Once it is ready, you will see something like this:","position":{"start":{"line":78,"column":1,"offset":3368},"end":{"line":78,"column":170,"offset":3537},"indent":[]}}],"position":{"start":{"line":78,"column":1,"offset":3368},"end":{"line":78,"column":170,"offset":3537},"indent":[]}},{"type":"paragraph","children":[{"type":"image","title":null,"url":"https://i.imgur.com/TOXjLgh.png","alt":"image","position":{"start":{"line":80,"column":1,"offset":3539},"end":{"line":80,"column":42,"offset":3580},"indent":[]}}],"position":{"start":{"line":80,"column":1,"offset":3539},"end":{"line":80,"column":42,"offset":3580},"indent":[]}},{"type":"heading","depth":2,"children":[{"type":"text","value":"Understanding What Discordeno Did","position":{"start":{"line":82,"column":4,"offset":3585},"end":{"line":82,"column":37,"offset":3618},"indent":[]}}],"position":{"start":{"line":82,"column":1,"offset":3582},"end":{"line":82,"column":37,"offset":3618},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"Discordeno includes these commands/folders as they are essential for any discord bot to have in order to meet the Discord Bot Best Practices. It also adds a few things that will help make some things easier to build a bot.","position":{"start":{"line":84,"column":1,"offset":3620},"end":{"line":84,"column":223,"offset":3842},"indent":[]}}],"position":{"start":{"line":84,"column":1,"offset":3620},"end":{"line":84,"column":223,"offset":3842},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"We will dive into these deeper in this guide. Let's take it step by step.","position":{"start":{"line":86,"column":1,"offset":3844},"end":{"line":86,"column":74,"offset":3917},"indent":[]}}],"position":{"start":{"line":86,"column":1,"offset":3844},"end":{"line":86,"column":74,"offset":3917},"indent":[]}},{"type":"export","value":"export const _frontmatter = {\"title\":\"Creating The Bot!\",\"metaTitle\":\"Creating A Bot | Discordeno\",\"metaDescription\":\"Let's create our very own bot with Discordeno!\"}","position":{"start":{"line":89,"column":1,"offset":3920},"end":{"line":89,"column":167,"offset":4086},"indent":[]}}],"position":{"start":{"line":1,"column":1,"offset":0},"end":{"line":89,"column":167,"offset":4086}}},"scopeImports":["import * as React from 'react'"],"scopeIdentifiers":["React"],"body":"function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }\n\nfunction _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }\n\nfunction _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }\n\n/* @jsx mdx */\nvar _frontmatter = {\n \"title\": \"Creating The Bot!\",\n \"metaTitle\": \"Creating A Bot | Discordeno\",\n \"metaDescription\": \"Let's create our very own bot with Discordeno!\"\n};\nvar layoutProps = {\n _frontmatter: _frontmatter\n};\nvar MDXLayout = \"wrapper\";\nreturn function MDXContent(_ref) {\n var components = _ref.components,\n props = _objectWithoutProperties(_ref, [\"components\"]);\n\n return mdx(MDXLayout, _extends({}, layoutProps, props, {\n components: components,\n mdxType: \"MDXLayout\"\n }), mdx(\"p\", null, \"Discordeno will help make Discord bot development much easier. Don't worry, as you go through this guide it will make a lot more sense.\"), mdx(\"h2\", null, \"Creating The Bot!\"), mdx(\"blockquote\", null, mdx(\"p\", {\n parentName: \"blockquote\"\n }, \"This guide is going to assume you already have the basic requirements to make a bot ready. This includes github, git, a code editor like Visual Studio Code. If you don't have these yet please prepare them first before going forward.\")), mdx(\"ul\", null, mdx(\"li\", {\n parentName: \"ul\"\n }, mdx(\"p\", {\n parentName: \"li\"\n }, \"First, create a Discordeno Bot using the \", mdx(\"a\", _extends({\n parentName: \"p\"\n }, {\n \"href\": \"https://github.com/Skillz4Killz/Discordeno-bot-template\"\n }), \"Generator Boilerplate\"), \". Give it any name you like. For the purpose of this guide we will call it, Stargate.\")), mdx(\"li\", {\n parentName: \"ul\"\n }, mdx(\"p\", {\n parentName: \"li\"\n }, \"Then \", mdx(\"inlineCode\", {\n parentName: \"p\"\n }, \"git clone https://github.com/Skillz4Killz/Stargate.git\"))), mdx(\"li\", {\n parentName: \"ul\"\n }, mdx(\"p\", {\n parentName: \"li\"\n }, \"When that is done, go ahead and open up the folder with VSC.\")), mdx(\"li\", {\n parentName: \"ul\"\n }, mdx(\"p\", {\n parentName: \"li\"\n }, \"Create a new file called \", mdx(\"inlineCode\", {\n parentName: \"p\"\n }, \"configs.ts\"), \". Open the \", mdx(\"inlineCode\", {\n parentName: \"p\"\n }, \"configs.example.ts\"), \" file and copy everything over.\"))), mdx(\"p\", null, \"Let's take a minute to review all the options we have available to us.\"), mdx(\"h3\", null, \"Configs File\"), mdx(\"p\", null, \"The \", mdx(\"inlineCode\", {\n parentName: \"p\"\n }, \"configs.ts\"), \" file is where you will keep all your secret info you don't want to share with anyone else. As long as \", mdx(\"inlineCode\", {\n parentName: \"p\"\n }, \".gitignore\"), \" file is ignoring configs.ts your configurations will be kept private!\"), mdx(\"pre\", null, mdx(\"code\", _extends({\n parentName: \"pre\"\n }, {\n \"className\": \"language-ts\"\n }), \"export const configs = {\\n token: \\\"\\\",\\n prefix: \\\"!\\\",\\n botListTokens: {\\n DISCORD_BOT_ORG: \\\"\\\",\\n BOTS_ON_DISCORD: \\\"\\\",\\n DISCORD_BOT_LIST: \\\"\\\",\\n BOTS_FOR_DISCORD: \\\"\\\",\\n DISCORD_BOATS: \\\"\\\",\\n DISCORD_BOTS_GG: \\\"\\\",\\n DISCORD_BOTS_GROUP: \\\"\\\",\\n },\\n channelIDs: {\\n missingTranslation: \\\"\\\",\\n },\\n};\\n\")), mdx(\"h4\", null, \"Token\"), mdx(\"p\", null, \"First, add your bot token. This is \", mdx(\"strong\", {\n parentName: \"p\"\n }, \"required\"), \" for the bot to start. Review the \", mdx(\"a\", _extends({\n parentName: \"p\"\n }, {\n \"href\": \"https://discordeno.netlify.app/gettingstarted#creatingyourfirstdiscordbotapplication\"\n }), \"instructions\"), \" if you have not made your token yet.\"), mdx(\"h4\", null, \"Prefix\"), mdx(\"p\", null, \"The prefix is where you will set the default prefix for your bot. Don't worry, every server will be able to choose their own prefix but we need a default prefix to start.\"), mdx(\"h4\", null, \"Bot Lists Tokens\"), mdx(\"p\", null, \"This section of the file is so you can easily have your bot's statistics updated on all the bot lists out there to help you grow your bot. The code is already written to handle this but you will need to do 3 things for each bot list.\"), mdx(\"ol\", null, mdx(\"li\", {\n parentName: \"ol\"\n }, \"Go to the bot list and add your bot to their website. (Each site has it's own instructions)\"), mdx(\"li\", {\n parentName: \"ol\"\n }, \"Create a token for yourself on each website and paste it in your configs.\"), mdx(\"li\", {\n parentName: \"ol\"\n }, \"Enjoy!\")), mdx(\"p\", null, \"If you wish to customize the code, you will find the bot list tasks in the tasks folder. Don't worry we will discuss this when we get to the tasks section of the guide.\"), mdx(\"p\", null, \"For now just remember, that Discordeno provides you a built in way to update most discord bot lists.\"), mdx(\"h4\", null, \"Channel IDs\"), mdx(\"p\", null, \"The channelIDs section holds the useful for specific features to help give you alerts/notifications. For example, the \", mdx(\"inlineCode\", {\n parentName: \"p\"\n }, \"missingTranslation\"), \" channel will be where messages are sent alerting you that somewhere in your code you are trying to use a translation key that you never created.\"), mdx(\"p\", null, \"When you get to around 25,000 Discord servers on your bot, you may want to convert these channel IDs to webhooks.\"), mdx(\"h2\", null, \"It's Alive!\"), mdx(\"p\", null, \"Oh my god! You now have a bot with a bunch of features already! You don't believe me? Well, seeing is believing, so start the bot.\"), mdx(\"ol\", null, mdx(\"li\", {\n parentName: \"ol\"\n }, \"Invite your bot to a discord server.\"), mdx(\"li\", {\n parentName: \"ol\"\n }, \"Open up the integrated terminal in VSC using \", mdx(\"strong\", {\n parentName: \"li\"\n }, \"CTRL + `\"), \". If you use a Mac, replace CTRL with CMD.\"), mdx(\"li\", {\n parentName: \"ol\"\n }, \"Run the script below:\")), mdx(\"pre\", null, mdx(\"code\", _extends({\n parentName: \"pre\"\n }, {\n \"className\": \"language-shell\"\n }), \"deno run --allow-net --allow-read mod.ts\\n\")), mdx(\"p\", null, \"The first time you run it, you may see a lot of files being loaded. This is preparing all the magic behind the scene. Once it is ready, you will see something like this:\"), mdx(\"p\", null, mdx(\"img\", _extends({\n parentName: \"p\"\n }, {\n \"src\": \"https://i.imgur.com/TOXjLgh.png\",\n \"alt\": \"image\"\n }))), mdx(\"h2\", null, \"Understanding What Discordeno Did\"), mdx(\"p\", null, \"Discordeno includes these commands/folders as they are essential for any discord bot to have in order to meet the Discord Bot Best Practices. It also adds a few things that will help make some things easier to build a bot.\"), mdx(\"p\", null, \"We will dive into these deeper in this guide. Let's take it step by step.\"));\n}\n;\nMDXContent.isMDXComponent = true;","rawMDXOutput":"/* @jsx mdx */\nimport { mdx } from '@mdx-js/react';\n/* @jsx mdx */\n\nexport const _frontmatter = {\n \"title\": \"Creating The Bot!\",\n \"metaTitle\": \"Creating A Bot | Discordeno\",\n \"metaDescription\": \"Let's create our very own bot with Discordeno!\"\n};\n\nconst layoutProps = {\n _frontmatter\n};\nconst MDXLayout = \"wrapper\"\nexport default function MDXContent({\n components,\n ...props\n}) {\n return \n

{`Discordeno will help make Discord bot development much easier. Don't worry, as you go through this guide it will make a lot more sense.`}

\n

{`Creating The Bot!`}

\n
\n

{`This guide is going to assume you already have the basic requirements to make a bot ready. This includes github, git, a code editor like Visual Studio Code. If you don't have these yet please prepare them first before going forward.`}

\n
\n
    \n
  • \n

    {`First, create a Discordeno Bot using the `}{`Generator Boilerplate`}{`. Give it any name you like. For the purpose of this guide we will call it, Stargate.`}

    \n
  • \n
  • \n

    {`Then `}{`git clone https://github.com/Skillz4Killz/Stargate.git`}

    \n
  • \n
  • \n

    {`When that is done, go ahead and open up the folder with VSC.`}

    \n
  • \n
  • \n

    {`Create a new file called `}{`configs.ts`}{`. Open the `}{`configs.example.ts`}{` file and copy everything over.`}

    \n
  • \n
\n

{`Let's take a minute to review all the options we have available to us.`}

\n

{`Configs File`}

\n

{`The `}{`configs.ts`}{` file is where you will keep all your secret info you don't want to share with anyone else. As long as `}{`.gitignore`}{` file is ignoring configs.ts your configurations will be kept private!`}

\n
{`export const configs = {\n  token: \"\",\n  prefix: \"!\",\n  botListTokens: {\n    DISCORD_BOT_ORG: \"\",\n    BOTS_ON_DISCORD: \"\",\n    DISCORD_BOT_LIST: \"\",\n    BOTS_FOR_DISCORD: \"\",\n    DISCORD_BOATS: \"\",\n    DISCORD_BOTS_GG: \"\",\n    DISCORD_BOTS_GROUP: \"\",\n  },\n  channelIDs: {\n    missingTranslation: \"\",\n  },\n};\n`}
\n

{`Token`}

\n

{`First, add your bot token. This is `}{`required`}{` for the bot to start. Review the `}{`instructions`}{` if you have not made your token yet.`}

\n

{`Prefix`}

\n

{`The prefix is where you will set the default prefix for your bot. Don't worry, every server will be able to choose their own prefix but we need a default prefix to start.`}

\n

{`Bot Lists Tokens`}

\n

{`This section of the file is so you can easily have your bot's statistics updated on all the bot lists out there to help you grow your bot. The code is already written to handle this but you will need to do 3 things for each bot list.`}

\n
    \n
  1. {`Go to the bot list and add your bot to their website. (Each site has it's own instructions)`}
  2. \n
  3. {`Create a token for yourself on each website and paste it in your configs.`}
  4. \n
  5. {`Enjoy!`}
  6. \n
\n

{`If you wish to customize the code, you will find the bot list tasks in the tasks folder. Don't worry we will discuss this when we get to the tasks section of the guide.`}

\n

{`For now just remember, that Discordeno provides you a built in way to update most discord bot lists.`}

\n

{`Channel IDs`}

\n

{`The channelIDs section holds the useful for specific features to help give you alerts/notifications. For example, the `}{`missingTranslation`}{` channel will be where messages are sent alerting you that somewhere in your code you are trying to use a translation key that you never created.`}

\n

{`When you get to around 25,000 Discord servers on your bot, you may want to convert these channel IDs to webhooks.`}

\n

{`It's Alive!`}

\n

{`Oh my god! You now have a bot with a bunch of features already! You don't believe me? Well, seeing is believing, so start the bot.`}

\n
    \n
  1. {`Invite your bot to a discord server.`}
  2. \n
  3. {`Open up the integrated terminal in VSC using `}{`CTRL + \\``}{`. If you use a Mac, replace CTRL with CMD.`}
  4. \n
  5. {`Run the script below:`}
  6. \n
\n
{`deno run --allow-net --allow-read mod.ts\n`}
\n

{`The first time you run it, you may see a lot of files being loaded. This is preparing all the magic behind the scene. Once it is ready, you will see something like this:`}

\n

\n

{`Understanding What Discordeno Did`}

\n

{`Discordeno includes these commands/folders as they are essential for any discord bot to have in order to meet the Discord Bot Best Practices. It also adds a few things that will help make some things easier to build a bot.`}

\n

{`We will dive into these deeper in this guide. Let's take it step by step.`}

\n\n
;\n}\n\n;\nMDXContent.isMDXComponent = true;"}} \ No newline at end of file diff --git a/docs/.cache/caches/gatsby-plugin-mdx/diskstore-7dce378488ec25253649ceb2d7039248.json b/docs/.cache/caches/gatsby-plugin-mdx/diskstore-7dce378488ec25253649ceb2d7039248.json new file mode 100644 index 000000000..40adddcc8 --- /dev/null +++ b/docs/.cache/caches/gatsby-plugin-mdx/diskstore-7dce378488ec25253649ceb2d7039248.json @@ -0,0 +1 @@ +{"expireTime":9007200851633252000,"key":"gatsby-plugin-mdx-entire-payload-f969e2ace3daba3061f3a801676961ea-","val":{"mdast":{"type":"root","children":[{"type":"paragraph","children":[{"type":"text","value":"Woah! You are almost half way done with understanding all of Discordeno. Amazing isn't it? Something you may have noticed in the last section was there were some options that prevented some commands from running like ","position":{"start":{"line":2,"column":1,"offset":1},"end":{"line":2,"column":218,"offset":218},"indent":[]}},{"type":"inlineCode","value":"dmOnly","position":{"start":{"line":2,"column":218,"offset":218},"end":{"line":2,"column":226,"offset":226},"indent":[]}},{"type":"text","value":" or the permission options. we created a setting to prevent the monitor from running in certain channels. What if we wanted to do prevent commands from happening? How would we prevent commands from running?","position":{"start":{"line":2,"column":226,"offset":226},"end":{"line":2,"column":432,"offset":432},"indent":[]}}],"position":{"start":{"line":2,"column":1,"offset":1},"end":{"line":2,"column":432,"offset":432},"indent":[]}},{"type":"heading","depth":2,"children":[{"type":"text","value":"What is an Inhibitor?","position":{"start":{"line":4,"column":4,"offset":437},"end":{"line":4,"column":25,"offset":458},"indent":[]}}],"position":{"start":{"line":4,"column":1,"offset":434},"end":{"line":4,"column":25,"offset":458},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"An Inhibitor is very similar to how monitors work. A monitor runs on every message but an inhibitor runs on every command. Remember all those command options like cooldown, permissions, permissionLevel, nsfw, etc... Each and every one of these options has an inhibitor in that checks commands for these settings.","position":{"start":{"line":6,"column":1,"offset":460},"end":{"line":6,"column":313,"offset":772},"indent":[]}}],"position":{"start":{"line":6,"column":1,"offset":460},"end":{"line":6,"column":313,"offset":772},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"Let's create our own inhibitor that would prevent commands from being used if the user is not a VIP user.","position":{"start":{"line":8,"column":1,"offset":774},"end":{"line":8,"column":106,"offset":879},"indent":[]}}],"position":{"start":{"line":8,"column":1,"offset":774},"end":{"line":8,"column":106,"offset":879},"indent":[]}},{"type":"blockquote","children":[{"type":"paragraph","children":[{"type":"strong","children":[{"type":"text","value":"Note:","position":{"start":{"line":10,"column":5,"offset":885},"end":{"line":10,"column":10,"offset":890},"indent":[]}}],"position":{"start":{"line":10,"column":3,"offset":883},"end":{"line":10,"column":12,"offset":892},"indent":[]}},{"type":"text","value":" It is important to remember that everything below can be done with a simple permission level as well. We will create our own custom permission levels but for the purposes of this guide and to be able to learn about Inhibitors, we will be using an inhibitor.","position":{"start":{"line":10,"column":12,"offset":892},"end":{"line":10,"column":270,"offset":1150},"indent":[]}}],"position":{"start":{"line":10,"column":3,"offset":883},"end":{"line":10,"column":270,"offset":1150},"indent":[]}}],"position":{"start":{"line":10,"column":1,"offset":881},"end":{"line":10,"column":270,"offset":1150},"indent":[]}},{"type":"heading","depth":2,"children":[{"type":"text","value":"Creating the File","position":{"start":{"line":12,"column":4,"offset":1155},"end":{"line":12,"column":21,"offset":1172},"indent":[]}}],"position":{"start":{"line":12,"column":1,"offset":1152},"end":{"line":12,"column":21,"offset":1172},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"Let's start by creating a file inside the inhibitors folder called ","position":{"start":{"line":14,"column":1,"offset":1174},"end":{"line":14,"column":68,"offset":1241},"indent":[]}},{"type":"inlineCode","value":"vipOnly.ts","position":{"start":{"line":14,"column":68,"offset":1241},"end":{"line":14,"column":80,"offset":1253},"indent":[]}},{"type":"text","value":" and paste the following snippet of code:","position":{"start":{"line":14,"column":80,"offset":1253},"end":{"line":14,"column":121,"offset":1294},"indent":[]}}],"position":{"start":{"line":14,"column":1,"offset":1174},"end":{"line":14,"column":121,"offset":1294},"indent":[]}},{"type":"code","lang":"ts","meta":null,"value":"import { botCache } from \"../../mod.ts\";\n\nbotCache.inhibitors.set(\"inhibitorname\", async function (message, command, guild) {\n\t// Your code goes here\n});","position":{"start":{"line":16,"column":1,"offset":1296},"end":{"line":22,"column":4,"offset":1459},"indent":[1,1,1,1,1,1]}},{"type":"paragraph","children":[{"type":"text","value":"Inhibitors can take up to 3 arguments.","position":{"start":{"line":24,"column":1,"offset":1461},"end":{"line":24,"column":39,"offset":1499},"indent":[]}}],"position":{"start":{"line":24,"column":1,"offset":1461},"end":{"line":24,"column":39,"offset":1499},"indent":[]}},{"type":"list","ordered":false,"start":null,"spread":false,"children":[{"type":"listItem","spread":false,"checked":null,"children":[{"type":"paragraph","children":[{"type":"inlineCode","value":"message","position":{"start":{"line":26,"column":3,"offset":1503},"end":{"line":26,"column":12,"offset":1512},"indent":[]}},{"type":"text","value":": The message object that triggered the command.","position":{"start":{"line":26,"column":12,"offset":1512},"end":{"line":26,"column":60,"offset":1560},"indent":[]}}],"position":{"start":{"line":26,"column":3,"offset":1503},"end":{"line":26,"column":60,"offset":1560},"indent":[]}}],"position":{"start":{"line":26,"column":1,"offset":1501},"end":{"line":26,"column":60,"offset":1560},"indent":[]}},{"type":"listItem","spread":false,"checked":null,"children":[{"type":"paragraph","children":[{"type":"inlineCode","value":"command","position":{"start":{"line":27,"column":3,"offset":1563},"end":{"line":27,"column":12,"offset":1572},"indent":[]}},{"type":"text","value":": The command object itself that was triggered.","position":{"start":{"line":27,"column":12,"offset":1572},"end":{"line":27,"column":59,"offset":1619},"indent":[]}}],"position":{"start":{"line":27,"column":3,"offset":1563},"end":{"line":27,"column":59,"offset":1619},"indent":[]}}],"position":{"start":{"line":27,"column":1,"offset":1561},"end":{"line":27,"column":59,"offset":1619},"indent":[]}},{"type":"listItem","spread":false,"checked":null,"children":[{"type":"paragraph","children":[{"type":"inlineCode","value":"guild","position":{"start":{"line":28,"column":3,"offset":1622},"end":{"line":28,"column":10,"offset":1629},"indent":[]}},{"type":"text","value":": The server guild object where this command was ran.","position":{"start":{"line":28,"column":10,"offset":1629},"end":{"line":28,"column":63,"offset":1682},"indent":[]}}],"position":{"start":{"line":28,"column":3,"offset":1622},"end":{"line":28,"column":63,"offset":1682},"indent":[]}}],"position":{"start":{"line":28,"column":1,"offset":1620},"end":{"line":28,"column":63,"offset":1682},"indent":[]}}],"position":{"start":{"line":26,"column":1,"offset":1501},"end":{"line":28,"column":63,"offset":1682},"indent":[1,1]}},{"type":"heading","depth":2,"children":[{"type":"text","value":"Understanding How Inhibitors Function","position":{"start":{"line":30,"column":4,"offset":1687},"end":{"line":30,"column":41,"offset":1724},"indent":[]}}],"position":{"start":{"line":30,"column":1,"offset":1684},"end":{"line":30,"column":41,"offset":1724},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"To block a command you have to return a truthy value.","position":{"start":{"line":32,"column":1,"offset":1726},"end":{"line":32,"column":54,"offset":1779},"indent":[]}}],"position":{"start":{"line":32,"column":1,"offset":1726},"end":{"line":32,"column":54,"offset":1779},"indent":[]}},{"type":"list","ordered":false,"start":null,"spread":false,"children":[{"type":"listItem","spread":false,"checked":null,"children":[{"type":"paragraph","children":[{"type":"strong","children":[{"type":"text","value":"return true;","position":{"start":{"line":33,"column":5,"offset":1784},"end":{"line":33,"column":17,"offset":1796},"indent":[]}}],"position":{"start":{"line":33,"column":3,"offset":1782},"end":{"line":33,"column":19,"offset":1798},"indent":[]}},{"type":"text","value":" If you return true the inhibitor will block the execution of the command.\nTo allow a command return a falsey value.","position":{"start":{"line":33,"column":19,"offset":1798},"end":{"line":34,"column":42,"offset":1914},"indent":[1]}}],"position":{"start":{"line":33,"column":3,"offset":1782},"end":{"line":34,"column":42,"offset":1914},"indent":[1]}}],"position":{"start":{"line":33,"column":1,"offset":1780},"end":{"line":34,"column":42,"offset":1914},"indent":[1]}},{"type":"listItem","spread":false,"checked":null,"children":[{"type":"paragraph","children":[{"type":"strong","children":[{"type":"text","value":"return false;","position":{"start":{"line":35,"column":5,"offset":1919},"end":{"line":35,"column":18,"offset":1932},"indent":[]}}],"position":{"start":{"line":35,"column":3,"offset":1917},"end":{"line":35,"column":20,"offset":1934},"indent":[]}},{"type":"text","value":" If you return false the inhibitor will not block the error.","position":{"start":{"line":35,"column":20,"offset":1934},"end":{"line":35,"column":80,"offset":1994},"indent":[]}}],"position":{"start":{"line":35,"column":3,"offset":1917},"end":{"line":35,"column":80,"offset":1994},"indent":[]}}],"position":{"start":{"line":35,"column":1,"offset":1915},"end":{"line":35,"column":80,"offset":1994},"indent":[]}}],"position":{"start":{"line":33,"column":1,"offset":1780},"end":{"line":35,"column":80,"offset":1994},"indent":[1,1]}},{"type":"code","lang":"ts","meta":null,"value":"// If the command is not VIP only we can allow this command to execute\nif (!command.vipOnly) return false;\n\n// Check if the user is VIP\nconst userIsVIP = message.author.settings.get(`isVIP`)\n// The user is VIP so we can allow this command to be used\nif (userIsVIP) return false\n// The user is NOT VIP so we throw an error\nthrow `The ${command.name} is only allowed for VIP users.`","position":{"start":{"line":38,"column":1,"offset":1997},"end":{"line":48,"column":4,"offset":2387},"indent":[1,1,1,1,1,1,1,1,1,1]}},{"type":"export","value":"export const _frontmatter = {\"title\":\"Creating Inhibitors!\",\"metaTitle\":\"Creating An Inhibitor | Discordeno\",\"metaDescription\":\"Let's create our very own bot with Discordeno!\"}","position":{"start":{"line":51,"column":1,"offset":2390},"end":{"line":51,"column":177,"offset":2566},"indent":[]}}],"position":{"start":{"line":1,"column":1,"offset":0},"end":{"line":51,"column":177,"offset":2566}}},"scopeImports":["import * as React from 'react'"],"scopeIdentifiers":["React"],"body":"function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }\n\nfunction _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }\n\nfunction _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }\n\n/* @jsx mdx */\nvar _frontmatter = {\n \"title\": \"Creating Inhibitors!\",\n \"metaTitle\": \"Creating An Inhibitor | Discordeno\",\n \"metaDescription\": \"Let's create our very own bot with Discordeno!\"\n};\nvar layoutProps = {\n _frontmatter: _frontmatter\n};\nvar MDXLayout = \"wrapper\";\nreturn function MDXContent(_ref) {\n var components = _ref.components,\n props = _objectWithoutProperties(_ref, [\"components\"]);\n\n return mdx(MDXLayout, _extends({}, layoutProps, props, {\n components: components,\n mdxType: \"MDXLayout\"\n }), mdx(\"p\", null, \"Woah! You are almost half way done with understanding all of Discordeno. Amazing isn't it? Something you may have noticed in the last section was there were some options that prevented some commands from running like \", mdx(\"inlineCode\", {\n parentName: \"p\"\n }, \"dmOnly\"), \" or the permission options. we created a setting to prevent the monitor from running in certain channels. What if we wanted to do prevent commands from happening? How would we prevent commands from running?\"), mdx(\"h2\", null, \"What is an Inhibitor?\"), mdx(\"p\", null, \"An Inhibitor is very similar to how monitors work. A monitor runs on every message but an inhibitor runs on every command. Remember all those command options like cooldown, permissions, permissionLevel, nsfw, etc... Each and every one of these options has an inhibitor in that checks commands for these settings.\"), mdx(\"p\", null, \"Let's create our own inhibitor that would prevent commands from being used if the user is not a VIP user.\"), mdx(\"blockquote\", null, mdx(\"p\", {\n parentName: \"blockquote\"\n }, mdx(\"strong\", {\n parentName: \"p\"\n }, \"Note:\"), \" It is important to remember that everything below can be done with a simple permission level as well. We will create our own custom permission levels but for the purposes of this guide and to be able to learn about Inhibitors, we will be using an inhibitor.\")), mdx(\"h2\", null, \"Creating the File\"), mdx(\"p\", null, \"Let's start by creating a file inside the inhibitors folder called \", mdx(\"inlineCode\", {\n parentName: \"p\"\n }, \"vipOnly.ts\"), \" and paste the following snippet of code:\"), mdx(\"pre\", null, mdx(\"code\", _extends({\n parentName: \"pre\"\n }, {\n \"className\": \"language-ts\"\n }), \"import { botCache } from \\\"../../mod.ts\\\";\\n\\nbotCache.inhibitors.set(\\\"inhibitorname\\\", async function (message, command, guild) {\\n // Your code goes here\\n});\\n\")), mdx(\"p\", null, \"Inhibitors can take up to 3 arguments.\"), mdx(\"ul\", null, mdx(\"li\", {\n parentName: \"ul\"\n }, mdx(\"inlineCode\", {\n parentName: \"li\"\n }, \"message\"), \": The message object that triggered the command.\"), mdx(\"li\", {\n parentName: \"ul\"\n }, mdx(\"inlineCode\", {\n parentName: \"li\"\n }, \"command\"), \": The command object itself that was triggered.\"), mdx(\"li\", {\n parentName: \"ul\"\n }, mdx(\"inlineCode\", {\n parentName: \"li\"\n }, \"guild\"), \": The server guild object where this command was ran.\")), mdx(\"h2\", null, \"Understanding How Inhibitors Function\"), mdx(\"p\", null, \"To block a command you have to return a truthy value.\"), mdx(\"ul\", null, mdx(\"li\", {\n parentName: \"ul\"\n }, mdx(\"strong\", {\n parentName: \"li\"\n }, \"return true;\"), \" If you return true the inhibitor will block the execution of the command.\\nTo allow a command return a falsey value.\"), mdx(\"li\", {\n parentName: \"ul\"\n }, mdx(\"strong\", {\n parentName: \"li\"\n }, \"return false;\"), \" If you return false the inhibitor will not block the error.\")), mdx(\"pre\", null, mdx(\"code\", _extends({\n parentName: \"pre\"\n }, {\n \"className\": \"language-ts\"\n }), \"// If the command is not VIP only we can allow this command to execute\\nif (!command.vipOnly) return false;\\n\\n// Check if the user is VIP\\nconst userIsVIP = message.author.settings.get(`isVIP`)\\n// The user is VIP so we can allow this command to be used\\nif (userIsVIP) return false\\n// The user is NOT VIP so we throw an error\\nthrow `The ${command.name} is only allowed for VIP users.`\\n\")));\n}\n;\nMDXContent.isMDXComponent = true;","rawMDXOutput":"/* @jsx mdx */\nimport { mdx } from '@mdx-js/react';\n/* @jsx mdx */\n\nexport const _frontmatter = {\n \"title\": \"Creating Inhibitors!\",\n \"metaTitle\": \"Creating An Inhibitor | Discordeno\",\n \"metaDescription\": \"Let's create our very own bot with Discordeno!\"\n};\n\nconst layoutProps = {\n _frontmatter\n};\nconst MDXLayout = \"wrapper\"\nexport default function MDXContent({\n components,\n ...props\n}) {\n return \n

{`Woah! You are almost half way done with understanding all of Discordeno. Amazing isn't it? Something you may have noticed in the last section was there were some options that prevented some commands from running like `}{`dmOnly`}{` or the permission options. we created a setting to prevent the monitor from running in certain channels. What if we wanted to do prevent commands from happening? How would we prevent commands from running?`}

\n

{`What is an Inhibitor?`}

\n

{`An Inhibitor is very similar to how monitors work. A monitor runs on every message but an inhibitor runs on every command. Remember all those command options like cooldown, permissions, permissionLevel, nsfw, etc... Each and every one of these options has an inhibitor in that checks commands for these settings.`}

\n

{`Let's create our own inhibitor that would prevent commands from being used if the user is not a VIP user.`}

\n
\n

{`Note:`}{` It is important to remember that everything below can be done with a simple permission level as well. We will create our own custom permission levels but for the purposes of this guide and to be able to learn about Inhibitors, we will be using an inhibitor.`}

\n
\n

{`Creating the File`}

\n

{`Let's start by creating a file inside the inhibitors folder called `}{`vipOnly.ts`}{` and paste the following snippet of code:`}

\n
{`import { botCache } from \"../../mod.ts\";\n\nbotCache.inhibitors.set(\"inhibitorname\", async function (message, command, guild) {\n    // Your code goes here\n});\n`}
\n

{`Inhibitors can take up to 3 arguments.`}

\n
    \n
  • {`message`}{`: The message object that triggered the command.`}
  • \n
  • {`command`}{`: The command object itself that was triggered.`}
  • \n
  • {`guild`}{`: The server guild object where this command was ran.`}
  • \n
\n

{`Understanding How Inhibitors Function`}

\n

{`To block a command you have to return a truthy value.`}

\n
    \n
  • {`return true;`}{` If you return true the inhibitor will block the execution of the command.\nTo allow a command return a falsey value.`}
  • \n
  • {`return false;`}{` If you return false the inhibitor will not block the error.`}
  • \n
\n
{`// If the command is not VIP only we can allow this command to execute\nif (!command.vipOnly) return false;\n\n// Check if the user is VIP\nconst userIsVIP = message.author.settings.get(\\`isVIP\\`)\n// The user is VIP so we can allow this command to be used\nif (userIsVIP) return false\n// The user is NOT VIP so we throw an error\nthrow \\`The \\${command.name} is only allowed for VIP users.\\`\n`}
\n\n
;\n}\n\n;\nMDXContent.isMDXComponent = true;"}} \ No newline at end of file diff --git a/docs/.cache/caches/gatsby-plugin-mdx/diskstore-7f0818e6118769601060e8a3725f99f5.json b/docs/.cache/caches/gatsby-plugin-mdx/diskstore-7f0818e6118769601060e8a3725f99f5.json new file mode 100644 index 000000000..a7fc12e1b --- /dev/null +++ b/docs/.cache/caches/gatsby-plugin-mdx/diskstore-7f0818e6118769601060e8a3725f99f5.json @@ -0,0 +1 @@ +{"expireTime":9007200851596121000,"key":"gatsby-plugin-mdx-entire-payload-f0c85e68678f80cda861581d44788a6f-","val":{"mdast":{"type":"root","children":[{"type":"paragraph","children":[{"type":"text","value":"Discordeno will help make Discord bot development much easier. Don't worry, as you go through this guide it will make a lot more sense.","position":{"start":{"line":2,"column":1,"offset":1},"end":{"line":2,"column":136,"offset":136},"indent":[]}}],"position":{"start":{"line":2,"column":1,"offset":1},"end":{"line":2,"column":136,"offset":136},"indent":[]}},{"type":"heading","depth":2,"children":[{"type":"text","value":"Who Made Discordeno?","position":{"start":{"line":4,"column":4,"offset":141},"end":{"line":4,"column":24,"offset":161},"indent":[]}}],"position":{"start":{"line":4,"column":1,"offset":138},"end":{"line":4,"column":24,"offset":161},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"Skillz4Killz. However, there are a lot of other contributors to the project as well. Join the discord server to meet and learn more about the wonderful team!","position":{"start":{"line":6,"column":1,"offset":163},"end":{"line":6,"column":158,"offset":320},"indent":[]}}],"position":{"start":{"line":6,"column":1,"offset":163},"end":{"line":6,"column":158,"offset":320},"indent":[]}},{"type":"heading","depth":2,"children":[{"type":"text","value":"Why You Should Use Discordeno?","position":{"start":{"line":8,"column":4,"offset":325},"end":{"line":8,"column":34,"offset":355},"indent":[]}}],"position":{"start":{"line":8,"column":1,"offset":322},"end":{"line":8,"column":34,"offset":355},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"Discordeno provides you all the tools that you need to make bot development really easy. All the tools are already made for you to just simply copy and use for yourself. We will go through each and every tool in other sections of this guide.","position":{"start":{"line":10,"column":1,"offset":357},"end":{"line":10,"column":242,"offset":598},"indent":[]}}],"position":{"start":{"line":10,"column":1,"offset":357},"end":{"line":10,"column":242,"offset":598},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"As the old saying goes, the best way to learn to ride a bicycle is to actually try riding a bicycle. So let's try out Discordeno.","position":{"start":{"line":12,"column":1,"offset":600},"end":{"line":12,"column":130,"offset":729},"indent":[]}}],"position":{"start":{"line":12,"column":1,"offset":600},"end":{"line":12,"column":130,"offset":729},"indent":[]}},{"type":"heading","depth":2,"children":[{"type":"text","value":"Creating The Bot!","position":{"start":{"line":14,"column":4,"offset":734},"end":{"line":14,"column":21,"offset":751},"indent":[]}}],"position":{"start":{"line":14,"column":1,"offset":731},"end":{"line":14,"column":21,"offset":751},"indent":[]}},{"type":"blockquote","children":[{"type":"paragraph","children":[{"type":"text","value":"This guide is going to assume you already have the basic requirements to make a bot ready. This includes github, git, a code editor like Visual Studio Code. If you don't have these yet please prepare them first before going forward.","position":{"start":{"line":16,"column":3,"offset":755},"end":{"line":16,"column":235,"offset":987},"indent":[]}}],"position":{"start":{"line":16,"column":3,"offset":755},"end":{"line":16,"column":235,"offset":987},"indent":[]}}],"position":{"start":{"line":16,"column":1,"offset":753},"end":{"line":16,"column":235,"offset":987},"indent":[]}},{"type":"list","ordered":false,"start":null,"spread":true,"children":[{"type":"listItem","spread":false,"checked":null,"children":[{"type":"paragraph","children":[{"type":"text","value":"First, create a Discordeno Bot using the ","position":{"start":{"line":18,"column":3,"offset":991},"end":{"line":18,"column":44,"offset":1032},"indent":[]}},{"type":"link","title":null,"url":"https://github.com/Skillz4Killz/Discordeno-bot-template","children":[{"type":"text","value":"Generator Boilerplate","position":{"start":{"line":18,"column":45,"offset":1033},"end":{"line":18,"column":66,"offset":1054},"indent":[]}}],"position":{"start":{"line":18,"column":44,"offset":1032},"end":{"line":18,"column":124,"offset":1112},"indent":[]}},{"type":"text","value":". Give it any name you like. For the purpose of this guide we will call it, Stargate.","position":{"start":{"line":18,"column":124,"offset":1112},"end":{"line":18,"column":209,"offset":1197},"indent":[]}}],"position":{"start":{"line":18,"column":3,"offset":991},"end":{"line":18,"column":209,"offset":1197},"indent":[]}}],"position":{"start":{"line":18,"column":1,"offset":989},"end":{"line":19,"column":1,"offset":1198},"indent":[1]}},{"type":"listItem","spread":false,"checked":null,"children":[{"type":"paragraph","children":[{"type":"text","value":"Then ","position":{"start":{"line":20,"column":3,"offset":1201},"end":{"line":20,"column":8,"offset":1206},"indent":[]}},{"type":"inlineCode","value":"git clone https://github.com/Skillz4Killz/Stargate.git","position":{"start":{"line":20,"column":8,"offset":1206},"end":{"line":20,"column":64,"offset":1262},"indent":[]}}],"position":{"start":{"line":20,"column":3,"offset":1201},"end":{"line":20,"column":64,"offset":1262},"indent":[]}}],"position":{"start":{"line":20,"column":1,"offset":1199},"end":{"line":21,"column":1,"offset":1263},"indent":[1]}},{"type":"listItem","spread":false,"checked":null,"children":[{"type":"paragraph","children":[{"type":"text","value":"When that is done, go ahead and open up the folder with VSC.","position":{"start":{"line":22,"column":3,"offset":1266},"end":{"line":22,"column":63,"offset":1326},"indent":[]}}],"position":{"start":{"line":22,"column":3,"offset":1266},"end":{"line":22,"column":63,"offset":1326},"indent":[]}}],"position":{"start":{"line":22,"column":1,"offset":1264},"end":{"line":22,"column":63,"offset":1326},"indent":[]}},{"type":"listItem","spread":false,"checked":null,"children":[{"type":"paragraph","children":[{"type":"text","value":"Create a new file called ","position":{"start":{"line":23,"column":3,"offset":1329},"end":{"line":23,"column":28,"offset":1354},"indent":[]}},{"type":"inlineCode","value":"configs.ts","position":{"start":{"line":23,"column":28,"offset":1354},"end":{"line":23,"column":40,"offset":1366},"indent":[]}},{"type":"text","value":". Open the ","position":{"start":{"line":23,"column":40,"offset":1366},"end":{"line":23,"column":51,"offset":1377},"indent":[]}},{"type":"inlineCode","value":"configs.example.ts","position":{"start":{"line":23,"column":51,"offset":1377},"end":{"line":23,"column":71,"offset":1397},"indent":[]}},{"type":"text","value":" file and copy everything over.","position":{"start":{"line":23,"column":71,"offset":1397},"end":{"line":23,"column":102,"offset":1428},"indent":[]}}],"position":{"start":{"line":23,"column":3,"offset":1329},"end":{"line":23,"column":102,"offset":1428},"indent":[]}}],"position":{"start":{"line":23,"column":1,"offset":1327},"end":{"line":23,"column":102,"offset":1428},"indent":[]}}],"position":{"start":{"line":18,"column":1,"offset":989},"end":{"line":23,"column":102,"offset":1428},"indent":[1,1,1,1,1]}},{"type":"paragraph","children":[{"type":"text","value":"Let's take a minute to review all the options we have available to us.","position":{"start":{"line":25,"column":1,"offset":1430},"end":{"line":25,"column":71,"offset":1500},"indent":[]}}],"position":{"start":{"line":25,"column":1,"offset":1430},"end":{"line":25,"column":71,"offset":1500},"indent":[]}},{"type":"heading","depth":3,"children":[{"type":"text","value":"Configs File","position":{"start":{"line":27,"column":5,"offset":1506},"end":{"line":27,"column":17,"offset":1518},"indent":[]}}],"position":{"start":{"line":27,"column":1,"offset":1502},"end":{"line":27,"column":17,"offset":1518},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"The ","position":{"start":{"line":29,"column":1,"offset":1520},"end":{"line":29,"column":5,"offset":1524},"indent":[]}},{"type":"inlineCode","value":"configs.ts","position":{"start":{"line":29,"column":5,"offset":1524},"end":{"line":29,"column":17,"offset":1536},"indent":[]}},{"type":"text","value":" file is where you will keep all your secret info you don't want to share with anyone else. As long as ","position":{"start":{"line":29,"column":17,"offset":1536},"end":{"line":29,"column":120,"offset":1639},"indent":[]}},{"type":"inlineCode","value":".gitignore","position":{"start":{"line":29,"column":120,"offset":1639},"end":{"line":29,"column":132,"offset":1651},"indent":[]}},{"type":"text","value":" file is ignoring configs.ts your configurations will be kept private!","position":{"start":{"line":29,"column":132,"offset":1651},"end":{"line":29,"column":202,"offset":1721},"indent":[]}}],"position":{"start":{"line":29,"column":1,"offset":1520},"end":{"line":29,"column":202,"offset":1721},"indent":[]}},{"type":"code","lang":"ts","meta":null,"value":"export const configs = {\n token: \"\",\n prefix: \"!\",\n botListTokens: {\n DISCORD_BOT_ORG: \"\",\n BOTS_ON_DISCORD: \"\",\n DISCORD_BOT_LIST: \"\",\n BOTS_FOR_DISCORD: \"\",\n DISCORD_BOATS: \"\",\n DISCORD_BOTS_GG: \"\",\n DISCORD_BOTS_GROUP: \"\",\n },\n channelIDs: {\n missingTranslation: \"\",\n },\n};","position":{"start":{"line":31,"column":1,"offset":1723},"end":{"line":48,"column":4,"offset":2039},"indent":[1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1]}},{"type":"heading","depth":4,"children":[{"type":"text","value":"Token","position":{"start":{"line":50,"column":6,"offset":2046},"end":{"line":50,"column":11,"offset":2051},"indent":[]}}],"position":{"start":{"line":50,"column":1,"offset":2041},"end":{"line":50,"column":11,"offset":2051},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"First, add your bot token. This is ","position":{"start":{"line":52,"column":1,"offset":2053},"end":{"line":52,"column":36,"offset":2088},"indent":[]}},{"type":"strong","children":[{"type":"text","value":"required","position":{"start":{"line":52,"column":38,"offset":2090},"end":{"line":52,"column":46,"offset":2098},"indent":[]}}],"position":{"start":{"line":52,"column":36,"offset":2088},"end":{"line":52,"column":48,"offset":2100},"indent":[]}},{"type":"text","value":" for the bot to start. Review the ","position":{"start":{"line":52,"column":48,"offset":2100},"end":{"line":52,"column":82,"offset":2134},"indent":[]}},{"type":"link","title":null,"url":"https://discordeno.netlify.app/gettingstarted#creatingyourfirstdiscordbotapplication","children":[{"type":"text","value":"instructions","position":{"start":{"line":52,"column":83,"offset":2135},"end":{"line":52,"column":95,"offset":2147},"indent":[]}}],"position":{"start":{"line":52,"column":82,"offset":2134},"end":{"line":52,"column":182,"offset":2234},"indent":[]}},{"type":"text","value":" if you have not made your token yet.","position":{"start":{"line":52,"column":182,"offset":2234},"end":{"line":52,"column":219,"offset":2271},"indent":[]}}],"position":{"start":{"line":52,"column":1,"offset":2053},"end":{"line":52,"column":219,"offset":2271},"indent":[]}},{"type":"heading","depth":4,"children":[{"type":"text","value":"Prefix","position":{"start":{"line":54,"column":6,"offset":2278},"end":{"line":54,"column":12,"offset":2284},"indent":[]}}],"position":{"start":{"line":54,"column":1,"offset":2273},"end":{"line":54,"column":12,"offset":2284},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"The prefix is where you will set the default prefix for your bot. Don't worry, every server will be able to choose their own prefix but we need a default prefix to start.","position":{"start":{"line":56,"column":1,"offset":2286},"end":{"line":56,"column":171,"offset":2456},"indent":[]}}],"position":{"start":{"line":56,"column":1,"offset":2286},"end":{"line":56,"column":171,"offset":2456},"indent":[]}},{"type":"heading","depth":4,"children":[{"type":"text","value":"Bot Lists Tokens","position":{"start":{"line":58,"column":6,"offset":2463},"end":{"line":58,"column":22,"offset":2479},"indent":[]}}],"position":{"start":{"line":58,"column":1,"offset":2458},"end":{"line":58,"column":22,"offset":2479},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"This section of the file is so you can easily have your bot's statistics updated on all the bot lists out there to help you grow your bot. The code is already written to handle this but you will need to do 3 things for each bot list.","position":{"start":{"line":60,"column":1,"offset":2481},"end":{"line":60,"column":234,"offset":2714},"indent":[]}}],"position":{"start":{"line":60,"column":1,"offset":2481},"end":{"line":60,"column":234,"offset":2714},"indent":[]}},{"type":"list","ordered":true,"start":1,"spread":false,"children":[{"type":"listItem","spread":false,"checked":null,"children":[{"type":"paragraph","children":[{"type":"text","value":"Go to the bot list and add your bot to their website. (Each site has it's own instructions)","position":{"start":{"line":62,"column":4,"offset":2719},"end":{"line":62,"column":95,"offset":2810},"indent":[]}}],"position":{"start":{"line":62,"column":4,"offset":2719},"end":{"line":62,"column":95,"offset":2810},"indent":[]}}],"position":{"start":{"line":62,"column":1,"offset":2716},"end":{"line":62,"column":95,"offset":2810},"indent":[]}},{"type":"listItem","spread":false,"checked":null,"children":[{"type":"paragraph","children":[{"type":"text","value":"Create a token for yourself on each website and paste it in your configs.","position":{"start":{"line":63,"column":4,"offset":2814},"end":{"line":63,"column":77,"offset":2887},"indent":[]}}],"position":{"start":{"line":63,"column":4,"offset":2814},"end":{"line":63,"column":77,"offset":2887},"indent":[]}}],"position":{"start":{"line":63,"column":1,"offset":2811},"end":{"line":63,"column":77,"offset":2887},"indent":[]}},{"type":"listItem","spread":false,"checked":null,"children":[{"type":"paragraph","children":[{"type":"text","value":"Enjoy!","position":{"start":{"line":64,"column":4,"offset":2891},"end":{"line":64,"column":10,"offset":2897},"indent":[]}}],"position":{"start":{"line":64,"column":4,"offset":2891},"end":{"line":64,"column":10,"offset":2897},"indent":[]}}],"position":{"start":{"line":64,"column":1,"offset":2888},"end":{"line":64,"column":10,"offset":2897},"indent":[]}}],"position":{"start":{"line":62,"column":1,"offset":2716},"end":{"line":64,"column":10,"offset":2897},"indent":[1,1]}},{"type":"paragraph","children":[{"type":"text","value":"If you wish to customize the code, you will find the bot list tasks in the tasks folder. Don't worry we will discuss this when we get to the tasks section of the guide.","position":{"start":{"line":66,"column":1,"offset":2899},"end":{"line":66,"column":169,"offset":3067},"indent":[]}}],"position":{"start":{"line":66,"column":1,"offset":2899},"end":{"line":66,"column":169,"offset":3067},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"For now just remember, that Discordeno provides you a built in way to update most discord bot lists.","position":{"start":{"line":68,"column":1,"offset":3069},"end":{"line":68,"column":101,"offset":3169},"indent":[]}}],"position":{"start":{"line":68,"column":1,"offset":3069},"end":{"line":68,"column":101,"offset":3169},"indent":[]}},{"type":"heading","depth":4,"children":[{"type":"text","value":"Channel IDs","position":{"start":{"line":70,"column":6,"offset":3176},"end":{"line":70,"column":17,"offset":3187},"indent":[]}}],"position":{"start":{"line":70,"column":1,"offset":3171},"end":{"line":70,"column":17,"offset":3187},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"The channelIDs section holds the useful for specific features to help give you alerts/notifications. For example, the ","position":{"start":{"line":72,"column":1,"offset":3189},"end":{"line":72,"column":119,"offset":3307},"indent":[]}},{"type":"inlineCode","value":"missingTranslation","position":{"start":{"line":72,"column":119,"offset":3307},"end":{"line":72,"column":139,"offset":3327},"indent":[]}},{"type":"text","value":" channel will be where messages are sent alerting you that somewhere in your code you are trying to use a translation key that you never created.","position":{"start":{"line":72,"column":139,"offset":3327},"end":{"line":72,"column":284,"offset":3472},"indent":[]}}],"position":{"start":{"line":72,"column":1,"offset":3189},"end":{"line":72,"column":284,"offset":3472},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"When you get to around 25,000 Discord servers on your bot, you may want to convert these channel IDs to webhooks.","position":{"start":{"line":74,"column":1,"offset":3474},"end":{"line":74,"column":114,"offset":3587},"indent":[]}}],"position":{"start":{"line":74,"column":1,"offset":3474},"end":{"line":74,"column":114,"offset":3587},"indent":[]}},{"type":"heading","depth":2,"children":[{"type":"text","value":"It's Alive!","position":{"start":{"line":76,"column":4,"offset":3592},"end":{"line":76,"column":15,"offset":3603},"indent":[]}}],"position":{"start":{"line":76,"column":1,"offset":3589},"end":{"line":76,"column":15,"offset":3603},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"Oh my god! You now have a bot with a bunch of features already! You don't believe me? Well, seeing is believing, so start the bot.","position":{"start":{"line":78,"column":1,"offset":3605},"end":{"line":78,"column":131,"offset":3735},"indent":[]}}],"position":{"start":{"line":78,"column":1,"offset":3605},"end":{"line":78,"column":131,"offset":3735},"indent":[]}},{"type":"list","ordered":true,"start":1,"spread":false,"children":[{"type":"listItem","spread":false,"checked":null,"children":[{"type":"paragraph","children":[{"type":"text","value":"Invite your bot to a discord server.","position":{"start":{"line":80,"column":4,"offset":3740},"end":{"line":80,"column":40,"offset":3776},"indent":[]}}],"position":{"start":{"line":80,"column":4,"offset":3740},"end":{"line":80,"column":40,"offset":3776},"indent":[]}}],"position":{"start":{"line":80,"column":1,"offset":3737},"end":{"line":80,"column":40,"offset":3776},"indent":[]}},{"type":"listItem","spread":false,"checked":null,"children":[{"type":"paragraph","children":[{"type":"text","value":"Open up the integrated terminal in VSC using ","position":{"start":{"line":81,"column":4,"offset":3780},"end":{"line":81,"column":49,"offset":3825},"indent":[]}},{"type":"strong","children":[{"type":"text","value":"CTRL + `","position":{"start":{"line":81,"column":51,"offset":3827},"end":{"line":81,"column":59,"offset":3835},"indent":[]}}],"position":{"start":{"line":81,"column":49,"offset":3825},"end":{"line":81,"column":61,"offset":3837},"indent":[]}},{"type":"text","value":". If you use a Mac, replace CTRL with CMD.","position":{"start":{"line":81,"column":61,"offset":3837},"end":{"line":81,"column":103,"offset":3879},"indent":[]}}],"position":{"start":{"line":81,"column":4,"offset":3780},"end":{"line":81,"column":103,"offset":3879},"indent":[]}}],"position":{"start":{"line":81,"column":1,"offset":3777},"end":{"line":81,"column":103,"offset":3879},"indent":[]}},{"type":"listItem","spread":false,"checked":null,"children":[{"type":"paragraph","children":[{"type":"text","value":"Run the script below:","position":{"start":{"line":82,"column":4,"offset":3883},"end":{"line":82,"column":25,"offset":3904},"indent":[]}}],"position":{"start":{"line":82,"column":4,"offset":3883},"end":{"line":82,"column":25,"offset":3904},"indent":[]}}],"position":{"start":{"line":82,"column":1,"offset":3880},"end":{"line":82,"column":25,"offset":3904},"indent":[]}}],"position":{"start":{"line":80,"column":1,"offset":3737},"end":{"line":82,"column":25,"offset":3904},"indent":[1,1]}},{"type":"code","lang":"shell","meta":null,"value":"deno run --allow-net --allow-read mod.ts","position":{"start":{"line":84,"column":1,"offset":3906},"end":{"line":86,"column":4,"offset":3959},"indent":[1,1]}},{"type":"paragraph","children":[{"type":"text","value":"The first time you run it, you may see a lot of files being loaded. This is preparing all the magic behind the scene. Once it is ready, you will see something like this:","position":{"start":{"line":88,"column":1,"offset":3961},"end":{"line":88,"column":170,"offset":4130},"indent":[]}}],"position":{"start":{"line":88,"column":1,"offset":3961},"end":{"line":88,"column":170,"offset":4130},"indent":[]}},{"type":"paragraph","children":[{"type":"image","title":null,"url":"https://i.imgur.com/TOXjLgh.png","alt":"image","position":{"start":{"line":90,"column":1,"offset":4132},"end":{"line":90,"column":42,"offset":4173},"indent":[]}}],"position":{"start":{"line":90,"column":1,"offset":4132},"end":{"line":90,"column":42,"offset":4173},"indent":[]}},{"type":"heading","depth":2,"children":[{"type":"text","value":"Understanding What Discordeno Did","position":{"start":{"line":92,"column":4,"offset":4178},"end":{"line":92,"column":37,"offset":4211},"indent":[]}}],"position":{"start":{"line":92,"column":1,"offset":4175},"end":{"line":92,"column":37,"offset":4211},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"Discordeno includes these commands/folders as they are essential for any discord bot to have in order to meet the Discord Bot Best Practices. It also adds a few things that will help make some things easier to build a bot.","position":{"start":{"line":94,"column":1,"offset":4213},"end":{"line":94,"column":223,"offset":4435},"indent":[]}}],"position":{"start":{"line":94,"column":1,"offset":4213},"end":{"line":94,"column":223,"offset":4435},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"We will dive into these deeper in this guide. Let's take it step by step.","position":{"start":{"line":96,"column":1,"offset":4437},"end":{"line":96,"column":74,"offset":4510},"indent":[]}}],"position":{"start":{"line":96,"column":1,"offset":4437},"end":{"line":96,"column":74,"offset":4510},"indent":[]}},{"type":"export","value":"export const _frontmatter = {\"title\":\"Creating The Bot!\",\"metaTitle\":\"Creating A Bot | Discordeno\",\"metaDescription\":\"Let's create our very own bot with Discordeno!\"}","position":{"start":{"line":99,"column":1,"offset":4513},"end":{"line":99,"column":167,"offset":4679},"indent":[]}}],"position":{"start":{"line":1,"column":1,"offset":0},"end":{"line":99,"column":167,"offset":4679}}},"scopeImports":["import * as React from 'react'"],"scopeIdentifiers":["React"],"body":"function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }\n\nfunction _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }\n\nfunction _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }\n\n/* @jsx mdx */\nvar _frontmatter = {\n \"title\": \"Creating The Bot!\",\n \"metaTitle\": \"Creating A Bot | Discordeno\",\n \"metaDescription\": \"Let's create our very own bot with Discordeno!\"\n};\nvar layoutProps = {\n _frontmatter: _frontmatter\n};\nvar MDXLayout = \"wrapper\";\nreturn function MDXContent(_ref) {\n var components = _ref.components,\n props = _objectWithoutProperties(_ref, [\"components\"]);\n\n return mdx(MDXLayout, _extends({}, layoutProps, props, {\n components: components,\n mdxType: \"MDXLayout\"\n }), mdx(\"p\", null, \"Discordeno will help make Discord bot development much easier. Don't worry, as you go through this guide it will make a lot more sense.\"), mdx(\"h2\", null, \"Who Made Discordeno?\"), mdx(\"p\", null, \"Skillz4Killz. However, there are a lot of other contributors to the project as well. Join the discord server to meet and learn more about the wonderful team!\"), mdx(\"h2\", null, \"Why You Should Use Discordeno?\"), mdx(\"p\", null, \"Discordeno provides you all the tools that you need to make bot development really easy. All the tools are already made for you to just simply copy and use for yourself. We will go through each and every tool in other sections of this guide.\"), mdx(\"p\", null, \"As the old saying goes, the best way to learn to ride a bicycle is to actually try riding a bicycle. So let's try out Discordeno.\"), mdx(\"h2\", null, \"Creating The Bot!\"), mdx(\"blockquote\", null, mdx(\"p\", {\n parentName: \"blockquote\"\n }, \"This guide is going to assume you already have the basic requirements to make a bot ready. This includes github, git, a code editor like Visual Studio Code. If you don't have these yet please prepare them first before going forward.\")), mdx(\"ul\", null, mdx(\"li\", {\n parentName: \"ul\"\n }, mdx(\"p\", {\n parentName: \"li\"\n }, \"First, create a Discordeno Bot using the \", mdx(\"a\", _extends({\n parentName: \"p\"\n }, {\n \"href\": \"https://github.com/Skillz4Killz/Discordeno-bot-template\"\n }), \"Generator Boilerplate\"), \". Give it any name you like. For the purpose of this guide we will call it, Stargate.\")), mdx(\"li\", {\n parentName: \"ul\"\n }, mdx(\"p\", {\n parentName: \"li\"\n }, \"Then \", mdx(\"inlineCode\", {\n parentName: \"p\"\n }, \"git clone https://github.com/Skillz4Killz/Stargate.git\"))), mdx(\"li\", {\n parentName: \"ul\"\n }, mdx(\"p\", {\n parentName: \"li\"\n }, \"When that is done, go ahead and open up the folder with VSC.\")), mdx(\"li\", {\n parentName: \"ul\"\n }, mdx(\"p\", {\n parentName: \"li\"\n }, \"Create a new file called \", mdx(\"inlineCode\", {\n parentName: \"p\"\n }, \"configs.ts\"), \". Open the \", mdx(\"inlineCode\", {\n parentName: \"p\"\n }, \"configs.example.ts\"), \" file and copy everything over.\"))), mdx(\"p\", null, \"Let's take a minute to review all the options we have available to us.\"), mdx(\"h3\", null, \"Configs File\"), mdx(\"p\", null, \"The \", mdx(\"inlineCode\", {\n parentName: \"p\"\n }, \"configs.ts\"), \" file is where you will keep all your secret info you don't want to share with anyone else. As long as \", mdx(\"inlineCode\", {\n parentName: \"p\"\n }, \".gitignore\"), \" file is ignoring configs.ts your configurations will be kept private!\"), mdx(\"pre\", null, mdx(\"code\", _extends({\n parentName: \"pre\"\n }, {\n \"className\": \"language-ts\"\n }), \"export const configs = {\\n token: \\\"\\\",\\n prefix: \\\"!\\\",\\n botListTokens: {\\n DISCORD_BOT_ORG: \\\"\\\",\\n BOTS_ON_DISCORD: \\\"\\\",\\n DISCORD_BOT_LIST: \\\"\\\",\\n BOTS_FOR_DISCORD: \\\"\\\",\\n DISCORD_BOATS: \\\"\\\",\\n DISCORD_BOTS_GG: \\\"\\\",\\n DISCORD_BOTS_GROUP: \\\"\\\",\\n },\\n channelIDs: {\\n missingTranslation: \\\"\\\",\\n },\\n};\\n\")), mdx(\"h4\", null, \"Token\"), mdx(\"p\", null, \"First, add your bot token. This is \", mdx(\"strong\", {\n parentName: \"p\"\n }, \"required\"), \" for the bot to start. Review the \", mdx(\"a\", _extends({\n parentName: \"p\"\n }, {\n \"href\": \"https://discordeno.netlify.app/gettingstarted#creatingyourfirstdiscordbotapplication\"\n }), \"instructions\"), \" if you have not made your token yet.\"), mdx(\"h4\", null, \"Prefix\"), mdx(\"p\", null, \"The prefix is where you will set the default prefix for your bot. Don't worry, every server will be able to choose their own prefix but we need a default prefix to start.\"), mdx(\"h4\", null, \"Bot Lists Tokens\"), mdx(\"p\", null, \"This section of the file is so you can easily have your bot's statistics updated on all the bot lists out there to help you grow your bot. The code is already written to handle this but you will need to do 3 things for each bot list.\"), mdx(\"ol\", null, mdx(\"li\", {\n parentName: \"ol\"\n }, \"Go to the bot list and add your bot to their website. (Each site has it's own instructions)\"), mdx(\"li\", {\n parentName: \"ol\"\n }, \"Create a token for yourself on each website and paste it in your configs.\"), mdx(\"li\", {\n parentName: \"ol\"\n }, \"Enjoy!\")), mdx(\"p\", null, \"If you wish to customize the code, you will find the bot list tasks in the tasks folder. Don't worry we will discuss this when we get to the tasks section of the guide.\"), mdx(\"p\", null, \"For now just remember, that Discordeno provides you a built in way to update most discord bot lists.\"), mdx(\"h4\", null, \"Channel IDs\"), mdx(\"p\", null, \"The channelIDs section holds the useful for specific features to help give you alerts/notifications. For example, the \", mdx(\"inlineCode\", {\n parentName: \"p\"\n }, \"missingTranslation\"), \" channel will be where messages are sent alerting you that somewhere in your code you are trying to use a translation key that you never created.\"), mdx(\"p\", null, \"When you get to around 25,000 Discord servers on your bot, you may want to convert these channel IDs to webhooks.\"), mdx(\"h2\", null, \"It's Alive!\"), mdx(\"p\", null, \"Oh my god! You now have a bot with a bunch of features already! You don't believe me? Well, seeing is believing, so start the bot.\"), mdx(\"ol\", null, mdx(\"li\", {\n parentName: \"ol\"\n }, \"Invite your bot to a discord server.\"), mdx(\"li\", {\n parentName: \"ol\"\n }, \"Open up the integrated terminal in VSC using \", mdx(\"strong\", {\n parentName: \"li\"\n }, \"CTRL + `\"), \". If you use a Mac, replace CTRL with CMD.\"), mdx(\"li\", {\n parentName: \"ol\"\n }, \"Run the script below:\")), mdx(\"pre\", null, mdx(\"code\", _extends({\n parentName: \"pre\"\n }, {\n \"className\": \"language-shell\"\n }), \"deno run --allow-net --allow-read mod.ts\\n\")), mdx(\"p\", null, \"The first time you run it, you may see a lot of files being loaded. This is preparing all the magic behind the scene. Once it is ready, you will see something like this:\"), mdx(\"p\", null, mdx(\"img\", _extends({\n parentName: \"p\"\n }, {\n \"src\": \"https://i.imgur.com/TOXjLgh.png\",\n \"alt\": \"image\"\n }))), mdx(\"h2\", null, \"Understanding What Discordeno Did\"), mdx(\"p\", null, \"Discordeno includes these commands/folders as they are essential for any discord bot to have in order to meet the Discord Bot Best Practices. It also adds a few things that will help make some things easier to build a bot.\"), mdx(\"p\", null, \"We will dive into these deeper in this guide. Let's take it step by step.\"));\n}\n;\nMDXContent.isMDXComponent = true;","rawMDXOutput":"/* @jsx mdx */\nimport { mdx } from '@mdx-js/react';\n/* @jsx mdx */\n\nexport const _frontmatter = {\n \"title\": \"Creating The Bot!\",\n \"metaTitle\": \"Creating A Bot | Discordeno\",\n \"metaDescription\": \"Let's create our very own bot with Discordeno!\"\n};\n\nconst layoutProps = {\n _frontmatter\n};\nconst MDXLayout = \"wrapper\"\nexport default function MDXContent({\n components,\n ...props\n}) {\n return \n

{`Discordeno will help make Discord bot development much easier. Don't worry, as you go through this guide it will make a lot more sense.`}

\n

{`Who Made Discordeno?`}

\n

{`Skillz4Killz. However, there are a lot of other contributors to the project as well. Join the discord server to meet and learn more about the wonderful team!`}

\n

{`Why You Should Use Discordeno?`}

\n

{`Discordeno provides you all the tools that you need to make bot development really easy. All the tools are already made for you to just simply copy and use for yourself. We will go through each and every tool in other sections of this guide.`}

\n

{`As the old saying goes, the best way to learn to ride a bicycle is to actually try riding a bicycle. So let's try out Discordeno.`}

\n

{`Creating The Bot!`}

\n
\n

{`This guide is going to assume you already have the basic requirements to make a bot ready. This includes github, git, a code editor like Visual Studio Code. If you don't have these yet please prepare them first before going forward.`}

\n
\n
    \n
  • \n

    {`First, create a Discordeno Bot using the `}{`Generator Boilerplate`}{`. Give it any name you like. For the purpose of this guide we will call it, Stargate.`}

    \n
  • \n
  • \n

    {`Then `}{`git clone https://github.com/Skillz4Killz/Stargate.git`}

    \n
  • \n
  • \n

    {`When that is done, go ahead and open up the folder with VSC.`}

    \n
  • \n
  • \n

    {`Create a new file called `}{`configs.ts`}{`. Open the `}{`configs.example.ts`}{` file and copy everything over.`}

    \n
  • \n
\n

{`Let's take a minute to review all the options we have available to us.`}

\n

{`Configs File`}

\n

{`The `}{`configs.ts`}{` file is where you will keep all your secret info you don't want to share with anyone else. As long as `}{`.gitignore`}{` file is ignoring configs.ts your configurations will be kept private!`}

\n
{`export const configs = {\n  token: \"\",\n  prefix: \"!\",\n  botListTokens: {\n    DISCORD_BOT_ORG: \"\",\n    BOTS_ON_DISCORD: \"\",\n    DISCORD_BOT_LIST: \"\",\n    BOTS_FOR_DISCORD: \"\",\n    DISCORD_BOATS: \"\",\n    DISCORD_BOTS_GG: \"\",\n    DISCORD_BOTS_GROUP: \"\",\n  },\n  channelIDs: {\n    missingTranslation: \"\",\n  },\n};\n`}
\n

{`Token`}

\n

{`First, add your bot token. This is `}{`required`}{` for the bot to start. Review the `}{`instructions`}{` if you have not made your token yet.`}

\n

{`Prefix`}

\n

{`The prefix is where you will set the default prefix for your bot. Don't worry, every server will be able to choose their own prefix but we need a default prefix to start.`}

\n

{`Bot Lists Tokens`}

\n

{`This section of the file is so you can easily have your bot's statistics updated on all the bot lists out there to help you grow your bot. The code is already written to handle this but you will need to do 3 things for each bot list.`}

\n
    \n
  1. {`Go to the bot list and add your bot to their website. (Each site has it's own instructions)`}
  2. \n
  3. {`Create a token for yourself on each website and paste it in your configs.`}
  4. \n
  5. {`Enjoy!`}
  6. \n
\n

{`If you wish to customize the code, you will find the bot list tasks in the tasks folder. Don't worry we will discuss this when we get to the tasks section of the guide.`}

\n

{`For now just remember, that Discordeno provides you a built in way to update most discord bot lists.`}

\n

{`Channel IDs`}

\n

{`The channelIDs section holds the useful for specific features to help give you alerts/notifications. For example, the `}{`missingTranslation`}{` channel will be where messages are sent alerting you that somewhere in your code you are trying to use a translation key that you never created.`}

\n

{`When you get to around 25,000 Discord servers on your bot, you may want to convert these channel IDs to webhooks.`}

\n

{`It's Alive!`}

\n

{`Oh my god! You now have a bot with a bunch of features already! You don't believe me? Well, seeing is believing, so start the bot.`}

\n
    \n
  1. {`Invite your bot to a discord server.`}
  2. \n
  3. {`Open up the integrated terminal in VSC using `}{`CTRL + \\``}{`. If you use a Mac, replace CTRL with CMD.`}
  4. \n
  5. {`Run the script below:`}
  6. \n
\n
{`deno run --allow-net --allow-read mod.ts\n`}
\n

{`The first time you run it, you may see a lot of files being loaded. This is preparing all the magic behind the scene. Once it is ready, you will see something like this:`}

\n

\n

{`Understanding What Discordeno Did`}

\n

{`Discordeno includes these commands/folders as they are essential for any discord bot to have in order to meet the Discord Bot Best Practices. It also adds a few things that will help make some things easier to build a bot.`}

\n

{`We will dive into these deeper in this guide. Let's take it step by step.`}

\n\n
;\n}\n\n;\nMDXContent.isMDXComponent = true;"}} \ No newline at end of file diff --git a/docs/.cache/caches/gatsby-plugin-mdx/diskstore-7fd2e1131a8bc0c4793e2efda5519b4b.json b/docs/.cache/caches/gatsby-plugin-mdx/diskstore-7fd2e1131a8bc0c4793e2efda5519b4b.json new file mode 100644 index 000000000..1f02b76ae --- /dev/null +++ b/docs/.cache/caches/gatsby-plugin-mdx/diskstore-7fd2e1131a8bc0c4793e2efda5519b4b.json @@ -0,0 +1 @@ +{"expireTime":9007200851633750000,"key":"gatsby-plugin-mdx-entire-payload-8c38850e142eff1afbce34eb615e79df-","val":{"mdast":{"type":"root","children":[{"type":"paragraph","children":[{"type":"text","value":"Woah! You are almost half way done with understanding all of Discordeno. Amazing isn't it? Something you may have noticed in the last section was there were some options that prevented some commands from running like ","position":{"start":{"line":2,"column":1,"offset":1},"end":{"line":2,"column":218,"offset":218},"indent":[]}},{"type":"inlineCode","value":"dmOnly","position":{"start":{"line":2,"column":218,"offset":218},"end":{"line":2,"column":226,"offset":226},"indent":[]}},{"type":"text","value":" or the permission options. we created a setting to prevent the monitor from running in certain channels. What if we wanted to do prevent commands from happening? How would we prevent commands from running?","position":{"start":{"line":2,"column":226,"offset":226},"end":{"line":2,"column":432,"offset":432},"indent":[]}}],"position":{"start":{"line":2,"column":1,"offset":1},"end":{"line":2,"column":432,"offset":432},"indent":[]}},{"type":"heading","depth":2,"children":[{"type":"text","value":"What is an Inhibitor?","position":{"start":{"line":4,"column":4,"offset":437},"end":{"line":4,"column":25,"offset":458},"indent":[]}}],"position":{"start":{"line":4,"column":1,"offset":434},"end":{"line":4,"column":25,"offset":458},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"An Inhibitor is very similar to how monitors work. A monitor runs on every message but an inhibitor runs on every command. Remember all those command options like cooldown, permissions, permissionLevel, nsfw, etc... Each and every one of these options has an inhibitor in that checks commands for these settings.","position":{"start":{"line":6,"column":1,"offset":460},"end":{"line":6,"column":313,"offset":772},"indent":[]}}],"position":{"start":{"line":6,"column":1,"offset":460},"end":{"line":6,"column":313,"offset":772},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"Let's create our own inhibitor that would prevent commands from being used if the user is not a VIP user.","position":{"start":{"line":8,"column":1,"offset":774},"end":{"line":8,"column":106,"offset":879},"indent":[]}}],"position":{"start":{"line":8,"column":1,"offset":774},"end":{"line":8,"column":106,"offset":879},"indent":[]}},{"type":"blockquote","children":[{"type":"paragraph","children":[{"type":"strong","children":[{"type":"text","value":"Note:","position":{"start":{"line":10,"column":5,"offset":885},"end":{"line":10,"column":10,"offset":890},"indent":[]}}],"position":{"start":{"line":10,"column":3,"offset":883},"end":{"line":10,"column":12,"offset":892},"indent":[]}},{"type":"text","value":" It is important to remember that everything below can be done with a simple permission level as well. We will create our own custom permission levels but for the purposes of this guide and to be able to learn about Inhibitors, we will be using an inhibitor.","position":{"start":{"line":10,"column":12,"offset":892},"end":{"line":10,"column":270,"offset":1150},"indent":[]}}],"position":{"start":{"line":10,"column":3,"offset":883},"end":{"line":10,"column":270,"offset":1150},"indent":[]}}],"position":{"start":{"line":10,"column":1,"offset":881},"end":{"line":10,"column":270,"offset":1150},"indent":[]}},{"type":"heading","depth":2,"children":[{"type":"text","value":"Creating the File","position":{"start":{"line":12,"column":4,"offset":1155},"end":{"line":12,"column":21,"offset":1172},"indent":[]}}],"position":{"start":{"line":12,"column":1,"offset":1152},"end":{"line":12,"column":21,"offset":1172},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"Let's start by creating a file inside the inhibitors folder called ","position":{"start":{"line":14,"column":1,"offset":1174},"end":{"line":14,"column":68,"offset":1241},"indent":[]}},{"type":"inlineCode","value":"vipOnly.ts","position":{"start":{"line":14,"column":68,"offset":1241},"end":{"line":14,"column":80,"offset":1253},"indent":[]}},{"type":"text","value":" and paste the following snippet of code:","position":{"start":{"line":14,"column":80,"offset":1253},"end":{"line":14,"column":121,"offset":1294},"indent":[]}}],"position":{"start":{"line":14,"column":1,"offset":1174},"end":{"line":14,"column":121,"offset":1294},"indent":[]}},{"type":"code","lang":"ts","meta":null,"value":"import { botCache } from \"../../mod.ts\";\n\nbotCache.inhibitors.set(\"inhibitorname\", async function (message, command, guild) {\n\t// Your code goes here\n});","position":{"start":{"line":16,"column":1,"offset":1296},"end":{"line":22,"column":4,"offset":1459},"indent":[1,1,1,1,1,1]}},{"type":"paragraph","children":[{"type":"text","value":"Inhibitors can take up to 3 arguments.","position":{"start":{"line":24,"column":1,"offset":1461},"end":{"line":24,"column":39,"offset":1499},"indent":[]}}],"position":{"start":{"line":24,"column":1,"offset":1461},"end":{"line":24,"column":39,"offset":1499},"indent":[]}},{"type":"list","ordered":false,"start":null,"spread":false,"children":[{"type":"listItem","spread":false,"checked":null,"children":[{"type":"paragraph","children":[{"type":"inlineCode","value":"message","position":{"start":{"line":26,"column":3,"offset":1503},"end":{"line":26,"column":12,"offset":1512},"indent":[]}},{"type":"text","value":": The message object that triggered the command.","position":{"start":{"line":26,"column":12,"offset":1512},"end":{"line":26,"column":60,"offset":1560},"indent":[]}}],"position":{"start":{"line":26,"column":3,"offset":1503},"end":{"line":26,"column":60,"offset":1560},"indent":[]}}],"position":{"start":{"line":26,"column":1,"offset":1501},"end":{"line":26,"column":60,"offset":1560},"indent":[]}},{"type":"listItem","spread":false,"checked":null,"children":[{"type":"paragraph","children":[{"type":"inlineCode","value":"command","position":{"start":{"line":27,"column":3,"offset":1563},"end":{"line":27,"column":12,"offset":1572},"indent":[]}},{"type":"text","value":": The command object itself that was triggered.","position":{"start":{"line":27,"column":12,"offset":1572},"end":{"line":27,"column":59,"offset":1619},"indent":[]}}],"position":{"start":{"line":27,"column":3,"offset":1563},"end":{"line":27,"column":59,"offset":1619},"indent":[]}}],"position":{"start":{"line":27,"column":1,"offset":1561},"end":{"line":27,"column":59,"offset":1619},"indent":[]}},{"type":"listItem","spread":false,"checked":null,"children":[{"type":"paragraph","children":[{"type":"inlineCode","value":"guild","position":{"start":{"line":28,"column":3,"offset":1622},"end":{"line":28,"column":10,"offset":1629},"indent":[]}},{"type":"text","value":": The server guild object where this command was ran.","position":{"start":{"line":28,"column":10,"offset":1629},"end":{"line":28,"column":63,"offset":1682},"indent":[]}}],"position":{"start":{"line":28,"column":3,"offset":1622},"end":{"line":28,"column":63,"offset":1682},"indent":[]}}],"position":{"start":{"line":28,"column":1,"offset":1620},"end":{"line":28,"column":63,"offset":1682},"indent":[]}}],"position":{"start":{"line":26,"column":1,"offset":1501},"end":{"line":28,"column":63,"offset":1682},"indent":[1,1]}},{"type":"heading","depth":2,"children":[{"type":"text","value":"Understanding How Inhibitors Function","position":{"start":{"line":30,"column":4,"offset":1687},"end":{"line":30,"column":41,"offset":1724},"indent":[]}}],"position":{"start":{"line":30,"column":1,"offset":1684},"end":{"line":30,"column":41,"offset":1724},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"To block a command you have to return a truthy value.","position":{"start":{"line":32,"column":1,"offset":1726},"end":{"line":32,"column":54,"offset":1779},"indent":[]}}],"position":{"start":{"line":32,"column":1,"offset":1726},"end":{"line":32,"column":54,"offset":1779},"indent":[]}},{"type":"list","ordered":false,"start":null,"spread":false,"children":[{"type":"listItem","spread":false,"checked":null,"children":[{"type":"paragraph","children":[{"type":"strong","children":[{"type":"text","value":"return true;","position":{"start":{"line":33,"column":5,"offset":1784},"end":{"line":33,"column":17,"offset":1796},"indent":[]}}],"position":{"start":{"line":33,"column":3,"offset":1782},"end":{"line":33,"column":19,"offset":1798},"indent":[]}},{"type":"text","value":" If you return true the inhibitor will block the execution of the command.\nTo allow a command return a falsey value.","position":{"start":{"line":33,"column":19,"offset":1798},"end":{"line":34,"column":42,"offset":1914},"indent":[1]}}],"position":{"start":{"line":33,"column":3,"offset":1782},"end":{"line":34,"column":42,"offset":1914},"indent":[1]}}],"position":{"start":{"line":33,"column":1,"offset":1780},"end":{"line":34,"column":42,"offset":1914},"indent":[1]}},{"type":"listItem","spread":false,"checked":null,"children":[{"type":"paragraph","children":[{"type":"strong","children":[{"type":"text","value":"return false;","position":{"start":{"line":35,"column":5,"offset":1919},"end":{"line":35,"column":18,"offset":1932},"indent":[]}}],"position":{"start":{"line":35,"column":3,"offset":1917},"end":{"line":35,"column":20,"offset":1934},"indent":[]}},{"type":"text","value":" If you return false the inhibitor will not block the error.","position":{"start":{"line":35,"column":20,"offset":1934},"end":{"line":35,"column":80,"offset":1994},"indent":[]}}],"position":{"start":{"line":35,"column":3,"offset":1917},"end":{"line":35,"column":80,"offset":1994},"indent":[]}}],"position":{"start":{"line":35,"column":1,"offset":1915},"end":{"line":35,"column":80,"offset":1994},"indent":[]}}],"position":{"start":{"line":33,"column":1,"offset":1780},"end":{"line":35,"column":80,"offset":1994},"indent":[1,1]}},{"type":"code","lang":"ts","meta":null,"value":"// If the command is not VIP only we can allow this command to execute\nif (!command.vipOnly) return false;\n\n// Check if the user is VIP\nconst userIsVIP = await isUser\n// The user is VIP so we can allow this command to be used\nif (userIsVIP) return false;\n\n// The user is NOT VIP so we throw an error\nthrow `The ${command.name} is only allowed for VIP users.`","position":{"start":{"line":38,"column":1,"offset":1997},"end":{"line":49,"column":4,"offset":2365},"indent":[1,1,1,1,1,1,1,1,1,1,1]}},{"type":"export","value":"export const _frontmatter = {\"title\":\"Creating Inhibitors!\",\"metaTitle\":\"Creating An Inhibitor | Discordeno\",\"metaDescription\":\"Let's create our very own bot with Discordeno!\"}","position":{"start":{"line":52,"column":1,"offset":2368},"end":{"line":52,"column":177,"offset":2544},"indent":[]}}],"position":{"start":{"line":1,"column":1,"offset":0},"end":{"line":52,"column":177,"offset":2544}}},"scopeImports":["import * as React from 'react'"],"scopeIdentifiers":["React"],"body":"function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }\n\nfunction _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }\n\nfunction _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }\n\n/* @jsx mdx */\nvar _frontmatter = {\n \"title\": \"Creating Inhibitors!\",\n \"metaTitle\": \"Creating An Inhibitor | Discordeno\",\n \"metaDescription\": \"Let's create our very own bot with Discordeno!\"\n};\nvar layoutProps = {\n _frontmatter: _frontmatter\n};\nvar MDXLayout = \"wrapper\";\nreturn function MDXContent(_ref) {\n var components = _ref.components,\n props = _objectWithoutProperties(_ref, [\"components\"]);\n\n return mdx(MDXLayout, _extends({}, layoutProps, props, {\n components: components,\n mdxType: \"MDXLayout\"\n }), mdx(\"p\", null, \"Woah! You are almost half way done with understanding all of Discordeno. Amazing isn't it? Something you may have noticed in the last section was there were some options that prevented some commands from running like \", mdx(\"inlineCode\", {\n parentName: \"p\"\n }, \"dmOnly\"), \" or the permission options. we created a setting to prevent the monitor from running in certain channels. What if we wanted to do prevent commands from happening? How would we prevent commands from running?\"), mdx(\"h2\", null, \"What is an Inhibitor?\"), mdx(\"p\", null, \"An Inhibitor is very similar to how monitors work. A monitor runs on every message but an inhibitor runs on every command. Remember all those command options like cooldown, permissions, permissionLevel, nsfw, etc... Each and every one of these options has an inhibitor in that checks commands for these settings.\"), mdx(\"p\", null, \"Let's create our own inhibitor that would prevent commands from being used if the user is not a VIP user.\"), mdx(\"blockquote\", null, mdx(\"p\", {\n parentName: \"blockquote\"\n }, mdx(\"strong\", {\n parentName: \"p\"\n }, \"Note:\"), \" It is important to remember that everything below can be done with a simple permission level as well. We will create our own custom permission levels but for the purposes of this guide and to be able to learn about Inhibitors, we will be using an inhibitor.\")), mdx(\"h2\", null, \"Creating the File\"), mdx(\"p\", null, \"Let's start by creating a file inside the inhibitors folder called \", mdx(\"inlineCode\", {\n parentName: \"p\"\n }, \"vipOnly.ts\"), \" and paste the following snippet of code:\"), mdx(\"pre\", null, mdx(\"code\", _extends({\n parentName: \"pre\"\n }, {\n \"className\": \"language-ts\"\n }), \"import { botCache } from \\\"../../mod.ts\\\";\\n\\nbotCache.inhibitors.set(\\\"inhibitorname\\\", async function (message, command, guild) {\\n // Your code goes here\\n});\\n\")), mdx(\"p\", null, \"Inhibitors can take up to 3 arguments.\"), mdx(\"ul\", null, mdx(\"li\", {\n parentName: \"ul\"\n }, mdx(\"inlineCode\", {\n parentName: \"li\"\n }, \"message\"), \": The message object that triggered the command.\"), mdx(\"li\", {\n parentName: \"ul\"\n }, mdx(\"inlineCode\", {\n parentName: \"li\"\n }, \"command\"), \": The command object itself that was triggered.\"), mdx(\"li\", {\n parentName: \"ul\"\n }, mdx(\"inlineCode\", {\n parentName: \"li\"\n }, \"guild\"), \": The server guild object where this command was ran.\")), mdx(\"h2\", null, \"Understanding How Inhibitors Function\"), mdx(\"p\", null, \"To block a command you have to return a truthy value.\"), mdx(\"ul\", null, mdx(\"li\", {\n parentName: \"ul\"\n }, mdx(\"strong\", {\n parentName: \"li\"\n }, \"return true;\"), \" If you return true the inhibitor will block the execution of the command.\\nTo allow a command return a falsey value.\"), mdx(\"li\", {\n parentName: \"ul\"\n }, mdx(\"strong\", {\n parentName: \"li\"\n }, \"return false;\"), \" If you return false the inhibitor will not block the error.\")), mdx(\"pre\", null, mdx(\"code\", _extends({\n parentName: \"pre\"\n }, {\n \"className\": \"language-ts\"\n }), \"// If the command is not VIP only we can allow this command to execute\\nif (!command.vipOnly) return false;\\n\\n// Check if the user is VIP\\nconst userIsVIP = await isUser\\n// The user is VIP so we can allow this command to be used\\nif (userIsVIP) return false;\\n\\n// The user is NOT VIP so we throw an error\\nthrow `The ${command.name} is only allowed for VIP users.`\\n\")));\n}\n;\nMDXContent.isMDXComponent = true;","rawMDXOutput":"/* @jsx mdx */\nimport { mdx } from '@mdx-js/react';\n/* @jsx mdx */\n\nexport const _frontmatter = {\n \"title\": \"Creating Inhibitors!\",\n \"metaTitle\": \"Creating An Inhibitor | Discordeno\",\n \"metaDescription\": \"Let's create our very own bot with Discordeno!\"\n};\n\nconst layoutProps = {\n _frontmatter\n};\nconst MDXLayout = \"wrapper\"\nexport default function MDXContent({\n components,\n ...props\n}) {\n return \n

{`Woah! You are almost half way done with understanding all of Discordeno. Amazing isn't it? Something you may have noticed in the last section was there were some options that prevented some commands from running like `}{`dmOnly`}{` or the permission options. we created a setting to prevent the monitor from running in certain channels. What if we wanted to do prevent commands from happening? How would we prevent commands from running?`}

\n

{`What is an Inhibitor?`}

\n

{`An Inhibitor is very similar to how monitors work. A monitor runs on every message but an inhibitor runs on every command. Remember all those command options like cooldown, permissions, permissionLevel, nsfw, etc... Each and every one of these options has an inhibitor in that checks commands for these settings.`}

\n

{`Let's create our own inhibitor that would prevent commands from being used if the user is not a VIP user.`}

\n
\n

{`Note:`}{` It is important to remember that everything below can be done with a simple permission level as well. We will create our own custom permission levels but for the purposes of this guide and to be able to learn about Inhibitors, we will be using an inhibitor.`}

\n
\n

{`Creating the File`}

\n

{`Let's start by creating a file inside the inhibitors folder called `}{`vipOnly.ts`}{` and paste the following snippet of code:`}

\n
{`import { botCache } from \"../../mod.ts\";\n\nbotCache.inhibitors.set(\"inhibitorname\", async function (message, command, guild) {\n    // Your code goes here\n});\n`}
\n

{`Inhibitors can take up to 3 arguments.`}

\n
    \n
  • {`message`}{`: The message object that triggered the command.`}
  • \n
  • {`command`}{`: The command object itself that was triggered.`}
  • \n
  • {`guild`}{`: The server guild object where this command was ran.`}
  • \n
\n

{`Understanding How Inhibitors Function`}

\n

{`To block a command you have to return a truthy value.`}

\n
    \n
  • {`return true;`}{` If you return true the inhibitor will block the execution of the command.\nTo allow a command return a falsey value.`}
  • \n
  • {`return false;`}{` If you return false the inhibitor will not block the error.`}
  • \n
\n
{`// If the command is not VIP only we can allow this command to execute\nif (!command.vipOnly) return false;\n\n// Check if the user is VIP\nconst userIsVIP = await isUser\n// The user is VIP so we can allow this command to be used\nif (userIsVIP) return false;\n\n// The user is NOT VIP so we throw an error\nthrow \\`The \\${command.name} is only allowed for VIP users.\\`\n`}
\n\n
;\n}\n\n;\nMDXContent.isMDXComponent = true;"}} \ No newline at end of file diff --git a/docs/.cache/caches/gatsby-plugin-mdx/diskstore-815e75d2440bc4728043ad2952f65839.json b/docs/.cache/caches/gatsby-plugin-mdx/diskstore-815e75d2440bc4728043ad2952f65839.json new file mode 100644 index 000000000..4ac031978 --- /dev/null +++ b/docs/.cache/caches/gatsby-plugin-mdx/diskstore-815e75d2440bc4728043ad2952f65839.json @@ -0,0 +1 @@ +{"expireTime":9007200851635201000,"key":"gatsby-plugin-mdx-entire-payload-3091f2a7dfad3cc652f021e31ecf201e-","val":{"mdast":{"type":"root","children":[{"type":"paragraph","children":[{"type":"text","value":"Woah! You are almost half way done with understanding all of Discordeno. Amazing isn't it? Something you may have noticed in the last section was when the bot started up you could see a bunch of messages like ","position":{"start":{"line":2,"column":1,"offset":1},"end":{"line":2,"column":210,"offset":210},"indent":[]}},{"type":"inlineCode","value":"Loaded X Commands","position":{"start":{"line":2,"column":210,"offset":210},"end":{"line":2,"column":229,"offset":229},"indent":[]}},{"type":"text","value":" and such. Let's jump into this part now and understand how event handling works in Discordeno.","position":{"start":{"line":2,"column":229,"offset":229},"end":{"line":2,"column":324,"offset":324},"indent":[]}}],"position":{"start":{"line":2,"column":1,"offset":1},"end":{"line":2,"column":324,"offset":324},"indent":[]}},{"type":"heading","depth":2,"children":[{"type":"text","value":"What Is An Event?","position":{"start":{"line":4,"column":4,"offset":329},"end":{"line":4,"column":21,"offset":346},"indent":[]}}],"position":{"start":{"line":4,"column":1,"offset":326},"end":{"line":4,"column":21,"offset":346},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"An event in Discordeno is a function that can be called when a specific event occurs. For the most part, events will usually be the ones that are available from ","position":{"start":{"line":6,"column":1,"offset":348},"end":{"line":6,"column":162,"offset":509},"indent":[]}}],"position":{"start":{"line":6,"column":1,"offset":348},"end":{"line":6,"column":162,"offset":509},"indent":[]}},{"type":"export","value":"export const _frontmatter = {\"title\":\"Creating Events!\",\"metaTitle\":\"Creating An Event | Discordeno\",\"metaDescription\":\"Let's create our very own bot with Discordeno!\"}","position":{"start":{"line":9,"column":1,"offset":512},"end":{"line":9,"column":169,"offset":680},"indent":[]}}],"position":{"start":{"line":1,"column":1,"offset":0},"end":{"line":9,"column":169,"offset":680}}},"scopeImports":["import * as React from 'react'"],"scopeIdentifiers":["React"],"body":"function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }\n\nfunction _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }\n\nfunction _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }\n\n/* @jsx mdx */\nvar _frontmatter = {\n \"title\": \"Creating Events!\",\n \"metaTitle\": \"Creating An Event | Discordeno\",\n \"metaDescription\": \"Let's create our very own bot with Discordeno!\"\n};\nvar layoutProps = {\n _frontmatter: _frontmatter\n};\nvar MDXLayout = \"wrapper\";\nreturn function MDXContent(_ref) {\n var components = _ref.components,\n props = _objectWithoutProperties(_ref, [\"components\"]);\n\n return mdx(MDXLayout, _extends({}, layoutProps, props, {\n components: components,\n mdxType: \"MDXLayout\"\n }), mdx(\"p\", null, \"Woah! You are almost half way done with understanding all of Discordeno. Amazing isn't it? Something you may have noticed in the last section was when the bot started up you could see a bunch of messages like \", mdx(\"inlineCode\", {\n parentName: \"p\"\n }, \"Loaded X Commands\"), \" and such. Let's jump into this part now and understand how event handling works in Discordeno.\"), mdx(\"h2\", null, \"What Is An Event?\"), mdx(\"p\", null, \"An event in Discordeno is a function that can be called when a specific event occurs. For the most part, events will usually be the ones that are available from \"));\n}\n;\nMDXContent.isMDXComponent = true;","rawMDXOutput":"/* @jsx mdx */\nimport { mdx } from '@mdx-js/react';\n/* @jsx mdx */\n\nexport const _frontmatter = {\n \"title\": \"Creating Events!\",\n \"metaTitle\": \"Creating An Event | Discordeno\",\n \"metaDescription\": \"Let's create our very own bot with Discordeno!\"\n};\n\nconst layoutProps = {\n _frontmatter\n};\nconst MDXLayout = \"wrapper\"\nexport default function MDXContent({\n components,\n ...props\n}) {\n return \n

{`Woah! You are almost half way done with understanding all of Discordeno. Amazing isn't it? Something you may have noticed in the last section was when the bot started up you could see a bunch of messages like `}{`Loaded X Commands`}{` and such. Let's jump into this part now and understand how event handling works in Discordeno.`}

\n

{`What Is An Event?`}

\n

{`An event in Discordeno is a function that can be called when a specific event occurs. For the most part, events will usually be the ones that are available from `}

\n\n
;\n}\n\n;\nMDXContent.isMDXComponent = true;"}} \ No newline at end of file diff --git a/docs/.cache/caches/gatsby-plugin-mdx/diskstore-8232a7a77e9961ea47a5c3819d571e6b.json b/docs/.cache/caches/gatsby-plugin-mdx/diskstore-8232a7a77e9961ea47a5c3819d571e6b.json new file mode 100644 index 000000000..35123d5cd --- /dev/null +++ b/docs/.cache/caches/gatsby-plugin-mdx/diskstore-8232a7a77e9961ea47a5c3819d571e6b.json @@ -0,0 +1 @@ +{"expireTime":9007200851632079000,"key":"gatsby-plugin-mdx-entire-payload-ab456c3e690e92e173f1974f76712f27-","val":{"mdast":{"type":"root","children":[{"type":"paragraph","children":[{"type":"text","value":"Woah! You are almost half way done with understanding all of Discordeno. Amazing isn't it? Something you may have noticed in the last section was there were some options that prevented some commands from running like ","position":{"start":{"line":2,"column":1,"offset":1},"end":{"line":2,"column":218,"offset":218},"indent":[]}},{"type":"inlineCode","value":"dmOnly","position":{"start":{"line":2,"column":218,"offset":218},"end":{"line":2,"column":226,"offset":226},"indent":[]}},{"type":"text","value":" or the permission options. we created a setting to prevent the monitor from running in certain channels. What if we wanted to do prevent commands from happening? How would we prevent commands from running?","position":{"start":{"line":2,"column":226,"offset":226},"end":{"line":2,"column":432,"offset":432},"indent":[]}}],"position":{"start":{"line":2,"column":1,"offset":1},"end":{"line":2,"column":432,"offset":432},"indent":[]}},{"type":"heading","depth":2,"children":[{"type":"text","value":"What is an Inhibitor?","position":{"start":{"line":4,"column":4,"offset":437},"end":{"line":4,"column":25,"offset":458},"indent":[]}}],"position":{"start":{"line":4,"column":1,"offset":434},"end":{"line":4,"column":25,"offset":458},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"An Inhibitor is very similar to how monitors work. A monitor runs on every message but an inhibitor runs on every command. Remember all those command options like cooldown, enabled, requiredPermissions, permissionLevel, nsfw, requiredSettings, runIn. Each and every one of these options has an inhibitor in Klasa core that checks commands for these settings.\nLet's create our own inhibitor that would prevent commands from being used if the user is not a VIP user.","position":{"start":{"line":6,"column":1,"offset":460},"end":{"line":7,"column":106,"offset":924},"indent":[1]}}],"position":{"start":{"line":6,"column":1,"offset":460},"end":{"line":7,"column":106,"offset":924},"indent":[1]}},{"type":"paragraph","children":[{"type":"text","value":"Note: It is important to remember that everything below can be done with a simple permission level as well. We will create our own custom permission levels but for the purposes of this guide and to be able to learn about Inhibitors, we will be using an inhibitor.","position":{"start":{"line":9,"column":1,"offset":926},"end":{"line":9,"column":264,"offset":1189},"indent":[]}}],"position":{"start":{"line":9,"column":1,"offset":926},"end":{"line":9,"column":264,"offset":1189},"indent":[]}},{"type":"export","value":"export const _frontmatter = {\"title\":\"Creating Inhibitors!\",\"metaTitle\":\"Creating An Inhibitor | Discordeno\",\"metaDescription\":\"Let's create our very own bot with Discordeno!\"}","position":{"start":{"line":12,"column":1,"offset":1192},"end":{"line":12,"column":177,"offset":1368},"indent":[]}}],"position":{"start":{"line":1,"column":1,"offset":0},"end":{"line":12,"column":177,"offset":1368}}},"scopeImports":["import * as React from 'react'"],"scopeIdentifiers":["React"],"body":"function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }\n\nfunction _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }\n\nfunction _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }\n\n/* @jsx mdx */\nvar _frontmatter = {\n \"title\": \"Creating Inhibitors!\",\n \"metaTitle\": \"Creating An Inhibitor | Discordeno\",\n \"metaDescription\": \"Let's create our very own bot with Discordeno!\"\n};\nvar layoutProps = {\n _frontmatter: _frontmatter\n};\nvar MDXLayout = \"wrapper\";\nreturn function MDXContent(_ref) {\n var components = _ref.components,\n props = _objectWithoutProperties(_ref, [\"components\"]);\n\n return mdx(MDXLayout, _extends({}, layoutProps, props, {\n components: components,\n mdxType: \"MDXLayout\"\n }), mdx(\"p\", null, \"Woah! You are almost half way done with understanding all of Discordeno. Amazing isn't it? Something you may have noticed in the last section was there were some options that prevented some commands from running like \", mdx(\"inlineCode\", {\n parentName: \"p\"\n }, \"dmOnly\"), \" or the permission options. we created a setting to prevent the monitor from running in certain channels. What if we wanted to do prevent commands from happening? How would we prevent commands from running?\"), mdx(\"h2\", null, \"What is an Inhibitor?\"), mdx(\"p\", null, \"An Inhibitor is very similar to how monitors work. A monitor runs on every message but an inhibitor runs on every command. Remember all those command options like cooldown, enabled, requiredPermissions, permissionLevel, nsfw, requiredSettings, runIn. Each and every one of these options has an inhibitor in Klasa core that checks commands for these settings.\\nLet's create our own inhibitor that would prevent commands from being used if the user is not a VIP user.\"), mdx(\"p\", null, \"Note: It is important to remember that everything below can be done with a simple permission level as well. We will create our own custom permission levels but for the purposes of this guide and to be able to learn about Inhibitors, we will be using an inhibitor.\"));\n}\n;\nMDXContent.isMDXComponent = true;","rawMDXOutput":"/* @jsx mdx */\nimport { mdx } from '@mdx-js/react';\n/* @jsx mdx */\n\nexport const _frontmatter = {\n \"title\": \"Creating Inhibitors!\",\n \"metaTitle\": \"Creating An Inhibitor | Discordeno\",\n \"metaDescription\": \"Let's create our very own bot with Discordeno!\"\n};\n\nconst layoutProps = {\n _frontmatter\n};\nconst MDXLayout = \"wrapper\"\nexport default function MDXContent({\n components,\n ...props\n}) {\n return \n

{`Woah! You are almost half way done with understanding all of Discordeno. Amazing isn't it? Something you may have noticed in the last section was there were some options that prevented some commands from running like `}{`dmOnly`}{` or the permission options. we created a setting to prevent the monitor from running in certain channels. What if we wanted to do prevent commands from happening? How would we prevent commands from running?`}

\n

{`What is an Inhibitor?`}

\n

{`An Inhibitor is very similar to how monitors work. A monitor runs on every message but an inhibitor runs on every command. Remember all those command options like cooldown, enabled, requiredPermissions, permissionLevel, nsfw, requiredSettings, runIn. Each and every one of these options has an inhibitor in Klasa core that checks commands for these settings.\nLet's create our own inhibitor that would prevent commands from being used if the user is not a VIP user.`}

\n

{`Note: It is important to remember that everything below can be done with a simple permission level as well. We will create our own custom permission levels but for the purposes of this guide and to be able to learn about Inhibitors, we will be using an inhibitor.`}

\n\n
;\n}\n\n;\nMDXContent.isMDXComponent = true;"}} \ No newline at end of file diff --git a/docs/.cache/caches/gatsby-plugin-mdx/diskstore-82fb914e5ec9036bd275d7dd5d223369.json b/docs/.cache/caches/gatsby-plugin-mdx/diskstore-82fb914e5ec9036bd275d7dd5d223369.json new file mode 100644 index 000000000..ad0cd38af --- /dev/null +++ b/docs/.cache/caches/gatsby-plugin-mdx/diskstore-82fb914e5ec9036bd275d7dd5d223369.json @@ -0,0 +1 @@ +{"expireTime":9007200851635360000,"key":"gatsby-plugin-mdx-entire-payload-4ccb46b068638e91b87dae93e841481b-","val":{"mdast":{"type":"root","children":[{"type":"paragraph","children":[{"type":"text","value":"Woah! You are almost half way done with understanding all of Discordeno. Amazing isn't it? Something you may have noticed in the last section was when the bot started up you could see a bunch of messages like ","position":{"start":{"line":2,"column":1,"offset":1},"end":{"line":2,"column":210,"offset":210},"indent":[]}},{"type":"inlineCode","value":"Loaded X Commands","position":{"start":{"line":2,"column":210,"offset":210},"end":{"line":2,"column":229,"offset":229},"indent":[]}},{"type":"text","value":" and such. Let's jump into this part now and understand how event handling works in Discordeno.","position":{"start":{"line":2,"column":229,"offset":229},"end":{"line":2,"column":324,"offset":324},"indent":[]}}],"position":{"start":{"line":2,"column":1,"offset":1},"end":{"line":2,"column":324,"offset":324},"indent":[]}},{"type":"heading","depth":2,"children":[{"type":"text","value":"What Is An Event?","position":{"start":{"line":4,"column":4,"offset":329},"end":{"line":4,"column":21,"offset":346},"indent":[]}}],"position":{"start":{"line":4,"column":1,"offset":326},"end":{"line":4,"column":21,"offset":346},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"An event in Discordeno is a function that can be called when a specific event occurs. For the most part, events will usually be the ones that are available from Discordeno. However, you can create your own custom events as well if you wish.","position":{"start":{"line":6,"column":1,"offset":348},"end":{"line":6,"column":241,"offset":588},"indent":[]}}],"position":{"start":{"line":6,"column":1,"offset":348},"end":{"line":6,"column":241,"offset":588},"indent":[]}},{"type":"heading","depth":2,"children":[{"type":"text","value":"Creating The File","position":{"start":{"line":8,"column":4,"offset":593},"end":{"line":8,"column":21,"offset":610},"indent":[]}}],"position":{"start":{"line":8,"column":1,"offset":590},"end":{"line":8,"column":21,"offset":610},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"Make a new file in the events folder called ","position":{"start":{"line":10,"column":1,"offset":612},"end":{"line":10,"column":45,"offset":656},"indent":[]}},{"type":"inlineCode","value":"discordLog.ts","position":{"start":{"line":10,"column":45,"offset":656},"end":{"line":10,"column":60,"offset":671},"indent":[]}},{"type":"text","value":" that will send a message to a discord channel whenever we get an error so we don't need to always be watching the console to see errors. Once you made the file, go ahead and paste the base event snippet below.","position":{"start":{"line":10,"column":60,"offset":671},"end":{"line":10,"column":270,"offset":881},"indent":[]}}],"position":{"start":{"line":10,"column":1,"offset":612},"end":{"line":10,"column":270,"offset":881},"indent":[]}},{"type":"code","lang":"ts","meta":null,"value":"import { botCache } from \"../../mod.ts\";\n\nbotCache.eventHandlers.ready = function () {\n // Your code goes here\n};","position":{"start":{"line":13,"column":1,"offset":884},"end":{"line":19,"column":4,"offset":1008},"indent":[1,1,1,1,1,1]}},{"type":"export","value":"export const _frontmatter = {\"title\":\"Creating Events!\",\"metaTitle\":\"Creating An Event | Discordeno\",\"metaDescription\":\"Let's create our very own bot with Discordeno!\"}","position":{"start":{"line":22,"column":1,"offset":1011},"end":{"line":22,"column":169,"offset":1179},"indent":[]}}],"position":{"start":{"line":1,"column":1,"offset":0},"end":{"line":22,"column":169,"offset":1179}}},"scopeImports":["import * as React from 'react'"],"scopeIdentifiers":["React"],"body":"function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }\n\nfunction _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }\n\nfunction _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }\n\n/* @jsx mdx */\nvar _frontmatter = {\n \"title\": \"Creating Events!\",\n \"metaTitle\": \"Creating An Event | Discordeno\",\n \"metaDescription\": \"Let's create our very own bot with Discordeno!\"\n};\nvar layoutProps = {\n _frontmatter: _frontmatter\n};\nvar MDXLayout = \"wrapper\";\nreturn function MDXContent(_ref) {\n var components = _ref.components,\n props = _objectWithoutProperties(_ref, [\"components\"]);\n\n return mdx(MDXLayout, _extends({}, layoutProps, props, {\n components: components,\n mdxType: \"MDXLayout\"\n }), mdx(\"p\", null, \"Woah! You are almost half way done with understanding all of Discordeno. Amazing isn't it? Something you may have noticed in the last section was when the bot started up you could see a bunch of messages like \", mdx(\"inlineCode\", {\n parentName: \"p\"\n }, \"Loaded X Commands\"), \" and such. Let's jump into this part now and understand how event handling works in Discordeno.\"), mdx(\"h2\", null, \"What Is An Event?\"), mdx(\"p\", null, \"An event in Discordeno is a function that can be called when a specific event occurs. For the most part, events will usually be the ones that are available from Discordeno. However, you can create your own custom events as well if you wish.\"), mdx(\"h2\", null, \"Creating The File\"), mdx(\"p\", null, \"Make a new file in the events folder called \", mdx(\"inlineCode\", {\n parentName: \"p\"\n }, \"discordLog.ts\"), \" that will send a message to a discord channel whenever we get an error so we don't need to always be watching the console to see errors. Once you made the file, go ahead and paste the base event snippet below.\"), mdx(\"pre\", null, mdx(\"code\", _extends({\n parentName: \"pre\"\n }, {\n \"className\": \"language-ts\"\n }), \"import { botCache } from \\\"../../mod.ts\\\";\\n\\nbotCache.eventHandlers.ready = function () {\\n // Your code goes here\\n};\\n\")));\n}\n;\nMDXContent.isMDXComponent = true;","rawMDXOutput":"/* @jsx mdx */\nimport { mdx } from '@mdx-js/react';\n/* @jsx mdx */\n\nexport const _frontmatter = {\n \"title\": \"Creating Events!\",\n \"metaTitle\": \"Creating An Event | Discordeno\",\n \"metaDescription\": \"Let's create our very own bot with Discordeno!\"\n};\n\nconst layoutProps = {\n _frontmatter\n};\nconst MDXLayout = \"wrapper\"\nexport default function MDXContent({\n components,\n ...props\n}) {\n return \n

{`Woah! You are almost half way done with understanding all of Discordeno. Amazing isn't it? Something you may have noticed in the last section was when the bot started up you could see a bunch of messages like `}{`Loaded X Commands`}{` and such. Let's jump into this part now and understand how event handling works in Discordeno.`}

\n

{`What Is An Event?`}

\n

{`An event in Discordeno is a function that can be called when a specific event occurs. For the most part, events will usually be the ones that are available from Discordeno. However, you can create your own custom events as well if you wish.`}

\n

{`Creating The File`}

\n

{`Make a new file in the events folder called `}{`discordLog.ts`}{` that will send a message to a discord channel whenever we get an error so we don't need to always be watching the console to see errors. Once you made the file, go ahead and paste the base event snippet below.`}

\n
{`import { botCache } from \"../../mod.ts\";\n\nbotCache.eventHandlers.ready = function () {\n  // Your code goes here\n};\n`}
\n\n
;\n}\n\n;\nMDXContent.isMDXComponent = true;"}} \ No newline at end of file diff --git a/docs/.cache/caches/gatsby-plugin-mdx/diskstore-831dfceb538231323dc563f9b0c6fba7.json b/docs/.cache/caches/gatsby-plugin-mdx/diskstore-831dfceb538231323dc563f9b0c6fba7.json new file mode 100644 index 000000000..27f9fcc7f --- /dev/null +++ b/docs/.cache/caches/gatsby-plugin-mdx/diskstore-831dfceb538231323dc563f9b0c6fba7.json @@ -0,0 +1 @@ +{"expireTime":9007200851634315000,"key":"gatsby-plugin-mdx-entire-payload-05d72ae7346c544bbc134e87523cc031-","val":{"mdast":{"type":"root","children":[{"type":"paragraph","children":[{"type":"text","value":"Woah! You are almost half way done with understanding all of Discordeno. Amazing isn't it? Something you may have noticed in the last section was there were some options that prevented some commands from running like ","position":{"start":{"line":2,"column":1,"offset":1},"end":{"line":2,"column":218,"offset":218},"indent":[]}},{"type":"inlineCode","value":"dmOnly","position":{"start":{"line":2,"column":218,"offset":218},"end":{"line":2,"column":226,"offset":226},"indent":[]}},{"type":"text","value":" or the permission options. we created a setting to prevent the monitor from running in certain channels. What if we wanted to do prevent commands from happening? How would we prevent commands from running?","position":{"start":{"line":2,"column":226,"offset":226},"end":{"line":2,"column":432,"offset":432},"indent":[]}}],"position":{"start":{"line":2,"column":1,"offset":1},"end":{"line":2,"column":432,"offset":432},"indent":[]}},{"type":"heading","depth":2,"children":[{"type":"text","value":"What is an Inhibitor?","position":{"start":{"line":4,"column":4,"offset":437},"end":{"line":4,"column":25,"offset":458},"indent":[]}}],"position":{"start":{"line":4,"column":1,"offset":434},"end":{"line":4,"column":25,"offset":458},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"An Inhibitor is very similar to how monitors work. A monitor runs on every message but an inhibitor runs on every command. Remember all those command options like cooldown, permissions, permissionLevel, nsfw, etc... Each and every one of these options has an inhibitor in that checks commands for these settings.","position":{"start":{"line":6,"column":1,"offset":460},"end":{"line":6,"column":313,"offset":772},"indent":[]}}],"position":{"start":{"line":6,"column":1,"offset":460},"end":{"line":6,"column":313,"offset":772},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"Let's create our own inhibitor that would prevent commands from being used if the user is not a VIP user.","position":{"start":{"line":8,"column":1,"offset":774},"end":{"line":8,"column":106,"offset":879},"indent":[]}}],"position":{"start":{"line":8,"column":1,"offset":774},"end":{"line":8,"column":106,"offset":879},"indent":[]}},{"type":"blockquote","children":[{"type":"paragraph","children":[{"type":"strong","children":[{"type":"text","value":"Note:","position":{"start":{"line":10,"column":5,"offset":885},"end":{"line":10,"column":10,"offset":890},"indent":[]}}],"position":{"start":{"line":10,"column":3,"offset":883},"end":{"line":10,"column":12,"offset":892},"indent":[]}},{"type":"text","value":" It is important to remember that everything below can be done with a simple permission level as well. We will create our own custom permission levels but for the purposes of this guide and to be able to learn about Inhibitors, we will be using an inhibitor.","position":{"start":{"line":10,"column":12,"offset":892},"end":{"line":10,"column":270,"offset":1150},"indent":[]}}],"position":{"start":{"line":10,"column":3,"offset":883},"end":{"line":10,"column":270,"offset":1150},"indent":[]}}],"position":{"start":{"line":10,"column":1,"offset":881},"end":{"line":10,"column":270,"offset":1150},"indent":[]}},{"type":"heading","depth":2,"children":[{"type":"text","value":"Creating the File","position":{"start":{"line":12,"column":4,"offset":1155},"end":{"line":12,"column":21,"offset":1172},"indent":[]}}],"position":{"start":{"line":12,"column":1,"offset":1152},"end":{"line":12,"column":21,"offset":1172},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"Let's start by creating a file inside the inhibitors folder called ","position":{"start":{"line":14,"column":1,"offset":1174},"end":{"line":14,"column":68,"offset":1241},"indent":[]}},{"type":"inlineCode","value":"boosted.ts","position":{"start":{"line":14,"column":68,"offset":1241},"end":{"line":14,"column":80,"offset":1253},"indent":[]}},{"type":"text","value":" and paste the following snippet of code:","position":{"start":{"line":14,"column":80,"offset":1253},"end":{"line":14,"column":121,"offset":1294},"indent":[]}}],"position":{"start":{"line":14,"column":1,"offset":1174},"end":{"line":14,"column":121,"offset":1294},"indent":[]}},{"type":"code","lang":"ts","meta":null,"value":"import { botCache } from \"../../mod.ts\";\n\nbotCache.inhibitors.set(\"inhibitorname\", async function (message, command, guild) {\n\t// Your code goes here\n});","position":{"start":{"line":16,"column":1,"offset":1296},"end":{"line":22,"column":4,"offset":1459},"indent":[1,1,1,1,1,1]}},{"type":"paragraph","children":[{"type":"text","value":"Inhibitors can take up to 3 arguments.","position":{"start":{"line":24,"column":1,"offset":1461},"end":{"line":24,"column":39,"offset":1499},"indent":[]}}],"position":{"start":{"line":24,"column":1,"offset":1461},"end":{"line":24,"column":39,"offset":1499},"indent":[]}},{"type":"list","ordered":false,"start":null,"spread":false,"children":[{"type":"listItem","spread":false,"checked":null,"children":[{"type":"paragraph","children":[{"type":"inlineCode","value":"message","position":{"start":{"line":26,"column":3,"offset":1503},"end":{"line":26,"column":12,"offset":1512},"indent":[]}},{"type":"text","value":": The message object that triggered the command.","position":{"start":{"line":26,"column":12,"offset":1512},"end":{"line":26,"column":60,"offset":1560},"indent":[]}}],"position":{"start":{"line":26,"column":3,"offset":1503},"end":{"line":26,"column":60,"offset":1560},"indent":[]}}],"position":{"start":{"line":26,"column":1,"offset":1501},"end":{"line":26,"column":60,"offset":1560},"indent":[]}},{"type":"listItem","spread":false,"checked":null,"children":[{"type":"paragraph","children":[{"type":"inlineCode","value":"command","position":{"start":{"line":27,"column":3,"offset":1563},"end":{"line":27,"column":12,"offset":1572},"indent":[]}},{"type":"text","value":": The command object itself that was triggered.","position":{"start":{"line":27,"column":12,"offset":1572},"end":{"line":27,"column":59,"offset":1619},"indent":[]}}],"position":{"start":{"line":27,"column":3,"offset":1563},"end":{"line":27,"column":59,"offset":1619},"indent":[]}}],"position":{"start":{"line":27,"column":1,"offset":1561},"end":{"line":27,"column":59,"offset":1619},"indent":[]}},{"type":"listItem","spread":false,"checked":null,"children":[{"type":"paragraph","children":[{"type":"inlineCode","value":"guild","position":{"start":{"line":28,"column":3,"offset":1622},"end":{"line":28,"column":10,"offset":1629},"indent":[]}},{"type":"text","value":": The server guild object where this command was ran.","position":{"start":{"line":28,"column":10,"offset":1629},"end":{"line":28,"column":63,"offset":1682},"indent":[]}}],"position":{"start":{"line":28,"column":3,"offset":1622},"end":{"line":28,"column":63,"offset":1682},"indent":[]}}],"position":{"start":{"line":28,"column":1,"offset":1620},"end":{"line":28,"column":63,"offset":1682},"indent":[]}}],"position":{"start":{"line":26,"column":1,"offset":1501},"end":{"line":28,"column":63,"offset":1682},"indent":[1,1]}},{"type":"heading","depth":2,"children":[{"type":"text","value":"Understanding How Inhibitors Function","position":{"start":{"line":30,"column":4,"offset":1687},"end":{"line":30,"column":41,"offset":1724},"indent":[]}}],"position":{"start":{"line":30,"column":1,"offset":1684},"end":{"line":30,"column":41,"offset":1724},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"To block a command you have to return a truthy value.","position":{"start":{"line":32,"column":1,"offset":1726},"end":{"line":32,"column":54,"offset":1779},"indent":[]}}],"position":{"start":{"line":32,"column":1,"offset":1726},"end":{"line":32,"column":54,"offset":1779},"indent":[]}},{"type":"list","ordered":false,"start":null,"spread":false,"children":[{"type":"listItem","spread":false,"checked":null,"children":[{"type":"paragraph","children":[{"type":"strong","children":[{"type":"text","value":"return true;","position":{"start":{"line":33,"column":5,"offset":1784},"end":{"line":33,"column":17,"offset":1796},"indent":[]}}],"position":{"start":{"line":33,"column":3,"offset":1782},"end":{"line":33,"column":19,"offset":1798},"indent":[]}},{"type":"text","value":" If you return true the inhibitor will block the execution of the command.\nTo allow a command return a falsey value.","position":{"start":{"line":33,"column":19,"offset":1798},"end":{"line":34,"column":42,"offset":1914},"indent":[1]}}],"position":{"start":{"line":33,"column":3,"offset":1782},"end":{"line":34,"column":42,"offset":1914},"indent":[1]}}],"position":{"start":{"line":33,"column":1,"offset":1780},"end":{"line":34,"column":42,"offset":1914},"indent":[1]}},{"type":"listItem","spread":false,"checked":null,"children":[{"type":"paragraph","children":[{"type":"strong","children":[{"type":"text","value":"return false;","position":{"start":{"line":35,"column":5,"offset":1919},"end":{"line":35,"column":18,"offset":1932},"indent":[]}}],"position":{"start":{"line":35,"column":3,"offset":1917},"end":{"line":35,"column":20,"offset":1934},"indent":[]}},{"type":"text","value":" If you return false the inhibitor will not block the error.","position":{"start":{"line":35,"column":20,"offset":1934},"end":{"line":35,"column":80,"offset":1994},"indent":[]}}],"position":{"start":{"line":35,"column":3,"offset":1917},"end":{"line":35,"column":80,"offset":1994},"indent":[]}}],"position":{"start":{"line":35,"column":1,"offset":1915},"end":{"line":35,"column":80,"offset":1994},"indent":[]}}],"position":{"start":{"line":33,"column":1,"offset":1780},"end":{"line":35,"column":80,"offset":1994},"indent":[1,1]}},{"type":"code","lang":"ts","meta":null,"value":"// If the command is not VIP only we can allow this command to execute\nif (!command.vipOnly) return false;\n\n// The bot's support server\nconst guild = cache.guilds.get(configs.supportServerID);\n// If the command author is not in the server they won't have the vip role\nconst member = guild.members.get(message.author.id) || await getMember(guild.id, message.author.id);\n// Member doesn't exist so cancel the command\nif (!member) {\n\treturn true;\n}\n\n// If the user has the vip role on the support server given by patreon allow the command\nif (member.roles.includes(configs.patreonVIPRoleID)) return false;\n\n// Cancel the command since the user does not have vip\nreturn true;","position":{"start":{"line":38,"column":1,"offset":1997},"end":{"line":56,"column":4,"offset":2678},"indent":[1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1]}},{"type":"export","value":"export const _frontmatter = {\"title\":\"Creating Inhibitors!\",\"metaTitle\":\"Creating An Inhibitor | Discordeno\",\"metaDescription\":\"Let's create our very own bot with Discordeno!\"}","position":{"start":{"line":59,"column":1,"offset":2681},"end":{"line":59,"column":177,"offset":2857},"indent":[]}}],"position":{"start":{"line":1,"column":1,"offset":0},"end":{"line":59,"column":177,"offset":2857}}},"scopeImports":["import * as React from 'react'"],"scopeIdentifiers":["React"],"body":"function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }\n\nfunction _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }\n\nfunction _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }\n\n/* @jsx mdx */\nvar _frontmatter = {\n \"title\": \"Creating Inhibitors!\",\n \"metaTitle\": \"Creating An Inhibitor | Discordeno\",\n \"metaDescription\": \"Let's create our very own bot with Discordeno!\"\n};\nvar layoutProps = {\n _frontmatter: _frontmatter\n};\nvar MDXLayout = \"wrapper\";\nreturn function MDXContent(_ref) {\n var components = _ref.components,\n props = _objectWithoutProperties(_ref, [\"components\"]);\n\n return mdx(MDXLayout, _extends({}, layoutProps, props, {\n components: components,\n mdxType: \"MDXLayout\"\n }), mdx(\"p\", null, \"Woah! You are almost half way done with understanding all of Discordeno. Amazing isn't it? Something you may have noticed in the last section was there were some options that prevented some commands from running like \", mdx(\"inlineCode\", {\n parentName: \"p\"\n }, \"dmOnly\"), \" or the permission options. we created a setting to prevent the monitor from running in certain channels. What if we wanted to do prevent commands from happening? How would we prevent commands from running?\"), mdx(\"h2\", null, \"What is an Inhibitor?\"), mdx(\"p\", null, \"An Inhibitor is very similar to how monitors work. A monitor runs on every message but an inhibitor runs on every command. Remember all those command options like cooldown, permissions, permissionLevel, nsfw, etc... Each and every one of these options has an inhibitor in that checks commands for these settings.\"), mdx(\"p\", null, \"Let's create our own inhibitor that would prevent commands from being used if the user is not a VIP user.\"), mdx(\"blockquote\", null, mdx(\"p\", {\n parentName: \"blockquote\"\n }, mdx(\"strong\", {\n parentName: \"p\"\n }, \"Note:\"), \" It is important to remember that everything below can be done with a simple permission level as well. We will create our own custom permission levels but for the purposes of this guide and to be able to learn about Inhibitors, we will be using an inhibitor.\")), mdx(\"h2\", null, \"Creating the File\"), mdx(\"p\", null, \"Let's start by creating a file inside the inhibitors folder called \", mdx(\"inlineCode\", {\n parentName: \"p\"\n }, \"boosted.ts\"), \" and paste the following snippet of code:\"), mdx(\"pre\", null, mdx(\"code\", _extends({\n parentName: \"pre\"\n }, {\n \"className\": \"language-ts\"\n }), \"import { botCache } from \\\"../../mod.ts\\\";\\n\\nbotCache.inhibitors.set(\\\"inhibitorname\\\", async function (message, command, guild) {\\n // Your code goes here\\n});\\n\")), mdx(\"p\", null, \"Inhibitors can take up to 3 arguments.\"), mdx(\"ul\", null, mdx(\"li\", {\n parentName: \"ul\"\n }, mdx(\"inlineCode\", {\n parentName: \"li\"\n }, \"message\"), \": The message object that triggered the command.\"), mdx(\"li\", {\n parentName: \"ul\"\n }, mdx(\"inlineCode\", {\n parentName: \"li\"\n }, \"command\"), \": The command object itself that was triggered.\"), mdx(\"li\", {\n parentName: \"ul\"\n }, mdx(\"inlineCode\", {\n parentName: \"li\"\n }, \"guild\"), \": The server guild object where this command was ran.\")), mdx(\"h2\", null, \"Understanding How Inhibitors Function\"), mdx(\"p\", null, \"To block a command you have to return a truthy value.\"), mdx(\"ul\", null, mdx(\"li\", {\n parentName: \"ul\"\n }, mdx(\"strong\", {\n parentName: \"li\"\n }, \"return true;\"), \" If you return true the inhibitor will block the execution of the command.\\nTo allow a command return a falsey value.\"), mdx(\"li\", {\n parentName: \"ul\"\n }, mdx(\"strong\", {\n parentName: \"li\"\n }, \"return false;\"), \" If you return false the inhibitor will not block the error.\")), mdx(\"pre\", null, mdx(\"code\", _extends({\n parentName: \"pre\"\n }, {\n \"className\": \"language-ts\"\n }), \"// If the command is not VIP only we can allow this command to execute\\nif (!command.vipOnly) return false;\\n\\n// The bot's support server\\nconst guild = cache.guilds.get(configs.supportServerID);\\n// If the command author is not in the server they won't have the vip role\\nconst member = guild.members.get(message.author.id) || await getMember(guild.id, message.author.id);\\n// Member doesn't exist so cancel the command\\nif (!member) {\\n return true;\\n}\\n\\n// If the user has the vip role on the support server given by patreon allow the command\\nif (member.roles.includes(configs.patreonVIPRoleID)) return false;\\n\\n// Cancel the command since the user does not have vip\\nreturn true;\\n\")));\n}\n;\nMDXContent.isMDXComponent = true;","rawMDXOutput":"/* @jsx mdx */\nimport { mdx } from '@mdx-js/react';\n/* @jsx mdx */\n\nexport const _frontmatter = {\n \"title\": \"Creating Inhibitors!\",\n \"metaTitle\": \"Creating An Inhibitor | Discordeno\",\n \"metaDescription\": \"Let's create our very own bot with Discordeno!\"\n};\n\nconst layoutProps = {\n _frontmatter\n};\nconst MDXLayout = \"wrapper\"\nexport default function MDXContent({\n components,\n ...props\n}) {\n return \n

{`Woah! You are almost half way done with understanding all of Discordeno. Amazing isn't it? Something you may have noticed in the last section was there were some options that prevented some commands from running like `}{`dmOnly`}{` or the permission options. we created a setting to prevent the monitor from running in certain channels. What if we wanted to do prevent commands from happening? How would we prevent commands from running?`}

\n

{`What is an Inhibitor?`}

\n

{`An Inhibitor is very similar to how monitors work. A monitor runs on every message but an inhibitor runs on every command. Remember all those command options like cooldown, permissions, permissionLevel, nsfw, etc... Each and every one of these options has an inhibitor in that checks commands for these settings.`}

\n

{`Let's create our own inhibitor that would prevent commands from being used if the user is not a VIP user.`}

\n
\n

{`Note:`}{` It is important to remember that everything below can be done with a simple permission level as well. We will create our own custom permission levels but for the purposes of this guide and to be able to learn about Inhibitors, we will be using an inhibitor.`}

\n
\n

{`Creating the File`}

\n

{`Let's start by creating a file inside the inhibitors folder called `}{`boosted.ts`}{` and paste the following snippet of code:`}

\n
{`import { botCache } from \"../../mod.ts\";\n\nbotCache.inhibitors.set(\"inhibitorname\", async function (message, command, guild) {\n    // Your code goes here\n});\n`}
\n

{`Inhibitors can take up to 3 arguments.`}

\n
    \n
  • {`message`}{`: The message object that triggered the command.`}
  • \n
  • {`command`}{`: The command object itself that was triggered.`}
  • \n
  • {`guild`}{`: The server guild object where this command was ran.`}
  • \n
\n

{`Understanding How Inhibitors Function`}

\n

{`To block a command you have to return a truthy value.`}

\n
    \n
  • {`return true;`}{` If you return true the inhibitor will block the execution of the command.\nTo allow a command return a falsey value.`}
  • \n
  • {`return false;`}{` If you return false the inhibitor will not block the error.`}
  • \n
\n
{`// If the command is not VIP only we can allow this command to execute\nif (!command.vipOnly) return false;\n\n// The bot's support server\nconst guild = cache.guilds.get(configs.supportServerID);\n// If the command author is not in the server they won't have the vip role\nconst member = guild.members.get(message.author.id) || await getMember(guild.id, message.author.id);\n// Member doesn't exist so cancel the command\nif (!member) {\n    return true;\n}\n\n// If the user has the vip role on the support server given by patreon allow the command\nif (member.roles.includes(configs.patreonVIPRoleID)) return false;\n\n// Cancel the command since the user does not have vip\nreturn true;\n`}
\n\n
;\n}\n\n;\nMDXContent.isMDXComponent = true;"}} \ No newline at end of file diff --git a/docs/.cache/caches/gatsby-plugin-mdx/diskstore-836f4fa4ecb3909368989d148f191749.json b/docs/.cache/caches/gatsby-plugin-mdx/diskstore-836f4fa4ecb3909368989d148f191749.json new file mode 100644 index 000000000..6b74b9da2 --- /dev/null +++ b/docs/.cache/caches/gatsby-plugin-mdx/diskstore-836f4fa4ecb3909368989d148f191749.json @@ -0,0 +1 @@ +{"expireTime":9007200851633143000,"key":"gatsby-plugin-mdx-entire-payload-e7813f8f58d08c46c40ae7e0161456af-","val":{"mdast":{"type":"root","children":[{"type":"paragraph","children":[{"type":"text","value":"Woah! You are almost half way done with understanding all of Discordeno. Amazing isn't it? Something you may have noticed in the last section was there were some options that prevented some commands from running like ","position":{"start":{"line":2,"column":1,"offset":1},"end":{"line":2,"column":218,"offset":218},"indent":[]}},{"type":"inlineCode","value":"dmOnly","position":{"start":{"line":2,"column":218,"offset":218},"end":{"line":2,"column":226,"offset":226},"indent":[]}},{"type":"text","value":" or the permission options. we created a setting to prevent the monitor from running in certain channels. What if we wanted to do prevent commands from happening? How would we prevent commands from running?","position":{"start":{"line":2,"column":226,"offset":226},"end":{"line":2,"column":432,"offset":432},"indent":[]}}],"position":{"start":{"line":2,"column":1,"offset":1},"end":{"line":2,"column":432,"offset":432},"indent":[]}},{"type":"heading","depth":2,"children":[{"type":"text","value":"What is an Inhibitor?","position":{"start":{"line":4,"column":4,"offset":437},"end":{"line":4,"column":25,"offset":458},"indent":[]}}],"position":{"start":{"line":4,"column":1,"offset":434},"end":{"line":4,"column":25,"offset":458},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"An Inhibitor is very similar to how monitors work. A monitor runs on every message but an inhibitor runs on every command. Remember all those command options like cooldown, permissions, permissionLevel, nsfw, etc... Each and every one of these options has an inhibitor in that checks commands for these settings.","position":{"start":{"line":6,"column":1,"offset":460},"end":{"line":6,"column":313,"offset":772},"indent":[]}}],"position":{"start":{"line":6,"column":1,"offset":460},"end":{"line":6,"column":313,"offset":772},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"Let's create our own inhibitor that would prevent commands from being used if the user is not a VIP user.","position":{"start":{"line":8,"column":1,"offset":774},"end":{"line":8,"column":106,"offset":879},"indent":[]}}],"position":{"start":{"line":8,"column":1,"offset":774},"end":{"line":8,"column":106,"offset":879},"indent":[]}},{"type":"blockquote","children":[{"type":"paragraph","children":[{"type":"strong","children":[{"type":"text","value":"Note:","position":{"start":{"line":10,"column":5,"offset":885},"end":{"line":10,"column":10,"offset":890},"indent":[]}}],"position":{"start":{"line":10,"column":3,"offset":883},"end":{"line":10,"column":12,"offset":892},"indent":[]}},{"type":"text","value":" It is important to remember that everything below can be done with a simple permission level as well. We will create our own custom permission levels but for the purposes of this guide and to be able to learn about Inhibitors, we will be using an inhibitor.","position":{"start":{"line":10,"column":12,"offset":892},"end":{"line":10,"column":270,"offset":1150},"indent":[]}}],"position":{"start":{"line":10,"column":3,"offset":883},"end":{"line":10,"column":270,"offset":1150},"indent":[]}}],"position":{"start":{"line":10,"column":1,"offset":881},"end":{"line":10,"column":270,"offset":1150},"indent":[]}},{"type":"heading","depth":2,"children":[{"type":"text","value":"Creating the File","position":{"start":{"line":12,"column":4,"offset":1155},"end":{"line":12,"column":21,"offset":1172},"indent":[]}}],"position":{"start":{"line":12,"column":1,"offset":1152},"end":{"line":12,"column":21,"offset":1172},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"Let's start by creating a file inside the inhibitors folder called ","position":{"start":{"line":14,"column":1,"offset":1174},"end":{"line":14,"column":68,"offset":1241},"indent":[]}},{"type":"inlineCode","value":"vipOnly.ts","position":{"start":{"line":14,"column":68,"offset":1241},"end":{"line":14,"column":80,"offset":1253},"indent":[]}},{"type":"text","value":" and paste the following snippet of code:","position":{"start":{"line":14,"column":80,"offset":1253},"end":{"line":14,"column":121,"offset":1294},"indent":[]}}],"position":{"start":{"line":14,"column":1,"offset":1174},"end":{"line":14,"column":121,"offset":1294},"indent":[]}},{"type":"code","lang":"ts","meta":null,"value":"import { botCache } from \"../../mod.ts\";\n\nbotCache.inhibitors.set(\"inhibitorname\", async function (message, command, guild) {\n\t// Your code goes here\n});","position":{"start":{"line":16,"column":1,"offset":1296},"end":{"line":22,"column":4,"offset":1459},"indent":[1,1,1,1,1,1]}},{"type":"paragraph","children":[{"type":"text","value":"Inhibitors can take up to 3 arguments.","position":{"start":{"line":24,"column":1,"offset":1461},"end":{"line":24,"column":39,"offset":1499},"indent":[]}}],"position":{"start":{"line":24,"column":1,"offset":1461},"end":{"line":24,"column":39,"offset":1499},"indent":[]}},{"type":"list","ordered":false,"start":null,"spread":false,"children":[{"type":"listItem","spread":false,"checked":null,"children":[{"type":"paragraph","children":[{"type":"inlineCode","value":"message","position":{"start":{"line":26,"column":3,"offset":1503},"end":{"line":26,"column":12,"offset":1512},"indent":[]}},{"type":"text","value":": The message object that triggered the command.","position":{"start":{"line":26,"column":12,"offset":1512},"end":{"line":26,"column":60,"offset":1560},"indent":[]}}],"position":{"start":{"line":26,"column":3,"offset":1503},"end":{"line":26,"column":60,"offset":1560},"indent":[]}}],"position":{"start":{"line":26,"column":1,"offset":1501},"end":{"line":26,"column":60,"offset":1560},"indent":[]}},{"type":"listItem","spread":false,"checked":null,"children":[{"type":"paragraph","children":[{"type":"inlineCode","value":"command","position":{"start":{"line":27,"column":3,"offset":1563},"end":{"line":27,"column":12,"offset":1572},"indent":[]}},{"type":"text","value":": The command object itself that was triggered.","position":{"start":{"line":27,"column":12,"offset":1572},"end":{"line":27,"column":59,"offset":1619},"indent":[]}}],"position":{"start":{"line":27,"column":3,"offset":1563},"end":{"line":27,"column":59,"offset":1619},"indent":[]}}],"position":{"start":{"line":27,"column":1,"offset":1561},"end":{"line":27,"column":59,"offset":1619},"indent":[]}},{"type":"listItem","spread":false,"checked":null,"children":[{"type":"paragraph","children":[{"type":"inlineCode","value":"guild","position":{"start":{"line":28,"column":3,"offset":1622},"end":{"line":28,"column":10,"offset":1629},"indent":[]}},{"type":"text","value":": The server guild object where this command was ran.","position":{"start":{"line":28,"column":10,"offset":1629},"end":{"line":28,"column":63,"offset":1682},"indent":[]}}],"position":{"start":{"line":28,"column":3,"offset":1622},"end":{"line":28,"column":63,"offset":1682},"indent":[]}}],"position":{"start":{"line":28,"column":1,"offset":1620},"end":{"line":28,"column":63,"offset":1682},"indent":[]}}],"position":{"start":{"line":26,"column":1,"offset":1501},"end":{"line":28,"column":63,"offset":1682},"indent":[1,1]}},{"type":"heading","depth":2,"children":[{"type":"text","value":"Understanding How Inhibitors Function","position":{"start":{"line":30,"column":4,"offset":1687},"end":{"line":30,"column":41,"offset":1724},"indent":[]}}],"position":{"start":{"line":30,"column":1,"offset":1684},"end":{"line":30,"column":41,"offset":1724},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"To block a command you have to return a truthy value.","position":{"start":{"line":32,"column":1,"offset":1726},"end":{"line":32,"column":54,"offset":1779},"indent":[]}}],"position":{"start":{"line":32,"column":1,"offset":1726},"end":{"line":32,"column":54,"offset":1779},"indent":[]}},{"type":"list","ordered":false,"start":null,"spread":false,"children":[{"type":"listItem","spread":false,"checked":null,"children":[{"type":"paragraph","children":[{"type":"strong","children":[{"type":"text","value":"return true;","position":{"start":{"line":33,"column":5,"offset":1784},"end":{"line":33,"column":17,"offset":1796},"indent":[]}}],"position":{"start":{"line":33,"column":3,"offset":1782},"end":{"line":33,"column":19,"offset":1798},"indent":[]}},{"type":"text","value":" If you return true the inhibitor will block the execution of the command.\nTo allow a command return a falsey value.","position":{"start":{"line":33,"column":19,"offset":1798},"end":{"line":34,"column":42,"offset":1914},"indent":[1]}}],"position":{"start":{"line":33,"column":3,"offset":1782},"end":{"line":34,"column":42,"offset":1914},"indent":[1]}}],"position":{"start":{"line":33,"column":1,"offset":1780},"end":{"line":34,"column":42,"offset":1914},"indent":[1]}},{"type":"listItem","spread":false,"checked":null,"children":[{"type":"paragraph","children":[{"type":"strong","children":[{"type":"text","value":"return false;","position":{"start":{"line":35,"column":5,"offset":1919},"end":{"line":35,"column":18,"offset":1932},"indent":[]}}],"position":{"start":{"line":35,"column":3,"offset":1917},"end":{"line":35,"column":20,"offset":1934},"indent":[]}},{"type":"text","value":" If you return false the inhibitor will not block the error.","position":{"start":{"line":35,"column":20,"offset":1934},"end":{"line":35,"column":80,"offset":1994},"indent":[]}}],"position":{"start":{"line":35,"column":3,"offset":1917},"end":{"line":35,"column":80,"offset":1994},"indent":[]}}],"position":{"start":{"line":35,"column":1,"offset":1915},"end":{"line":35,"column":80,"offset":1994},"indent":[]}}],"position":{"start":{"line":33,"column":1,"offset":1780},"end":{"line":35,"column":80,"offset":1994},"indent":[1,1]}},{"type":"code","lang":"ts","meta":null,"value":"// If the command is not VIP only we can allow this command\nif (!command.vipOnly) return false;\n\n// Check if the user is VIP\nconst userIsVIP = message.author.settings.get(`isVIP`)\n// The user is VIP so we can allow this command to be used\nif (userIsVIP) return false\n// The user is NOT VIP so we throw an error\nthrow `The ${command.name} is only allowed for VIP users.`","position":{"start":{"line":38,"column":1,"offset":1997},"end":{"line":48,"column":4,"offset":2376},"indent":[1,1,1,1,1,1,1,1,1,1]}},{"type":"export","value":"export const _frontmatter = {\"title\":\"Creating Inhibitors!\",\"metaTitle\":\"Creating An Inhibitor | Discordeno\",\"metaDescription\":\"Let's create our very own bot with Discordeno!\"}","position":{"start":{"line":51,"column":1,"offset":2379},"end":{"line":51,"column":177,"offset":2555},"indent":[]}}],"position":{"start":{"line":1,"column":1,"offset":0},"end":{"line":51,"column":177,"offset":2555}}},"scopeImports":["import * as React from 'react'"],"scopeIdentifiers":["React"],"body":"function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }\n\nfunction _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }\n\nfunction _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }\n\n/* @jsx mdx */\nvar _frontmatter = {\n \"title\": \"Creating Inhibitors!\",\n \"metaTitle\": \"Creating An Inhibitor | Discordeno\",\n \"metaDescription\": \"Let's create our very own bot with Discordeno!\"\n};\nvar layoutProps = {\n _frontmatter: _frontmatter\n};\nvar MDXLayout = \"wrapper\";\nreturn function MDXContent(_ref) {\n var components = _ref.components,\n props = _objectWithoutProperties(_ref, [\"components\"]);\n\n return mdx(MDXLayout, _extends({}, layoutProps, props, {\n components: components,\n mdxType: \"MDXLayout\"\n }), mdx(\"p\", null, \"Woah! You are almost half way done with understanding all of Discordeno. Amazing isn't it? Something you may have noticed in the last section was there were some options that prevented some commands from running like \", mdx(\"inlineCode\", {\n parentName: \"p\"\n }, \"dmOnly\"), \" or the permission options. we created a setting to prevent the monitor from running in certain channels. What if we wanted to do prevent commands from happening? How would we prevent commands from running?\"), mdx(\"h2\", null, \"What is an Inhibitor?\"), mdx(\"p\", null, \"An Inhibitor is very similar to how monitors work. A monitor runs on every message but an inhibitor runs on every command. Remember all those command options like cooldown, permissions, permissionLevel, nsfw, etc... Each and every one of these options has an inhibitor in that checks commands for these settings.\"), mdx(\"p\", null, \"Let's create our own inhibitor that would prevent commands from being used if the user is not a VIP user.\"), mdx(\"blockquote\", null, mdx(\"p\", {\n parentName: \"blockquote\"\n }, mdx(\"strong\", {\n parentName: \"p\"\n }, \"Note:\"), \" It is important to remember that everything below can be done with a simple permission level as well. We will create our own custom permission levels but for the purposes of this guide and to be able to learn about Inhibitors, we will be using an inhibitor.\")), mdx(\"h2\", null, \"Creating the File\"), mdx(\"p\", null, \"Let's start by creating a file inside the inhibitors folder called \", mdx(\"inlineCode\", {\n parentName: \"p\"\n }, \"vipOnly.ts\"), \" and paste the following snippet of code:\"), mdx(\"pre\", null, mdx(\"code\", _extends({\n parentName: \"pre\"\n }, {\n \"className\": \"language-ts\"\n }), \"import { botCache } from \\\"../../mod.ts\\\";\\n\\nbotCache.inhibitors.set(\\\"inhibitorname\\\", async function (message, command, guild) {\\n // Your code goes here\\n});\\n\")), mdx(\"p\", null, \"Inhibitors can take up to 3 arguments.\"), mdx(\"ul\", null, mdx(\"li\", {\n parentName: \"ul\"\n }, mdx(\"inlineCode\", {\n parentName: \"li\"\n }, \"message\"), \": The message object that triggered the command.\"), mdx(\"li\", {\n parentName: \"ul\"\n }, mdx(\"inlineCode\", {\n parentName: \"li\"\n }, \"command\"), \": The command object itself that was triggered.\"), mdx(\"li\", {\n parentName: \"ul\"\n }, mdx(\"inlineCode\", {\n parentName: \"li\"\n }, \"guild\"), \": The server guild object where this command was ran.\")), mdx(\"h2\", null, \"Understanding How Inhibitors Function\"), mdx(\"p\", null, \"To block a command you have to return a truthy value.\"), mdx(\"ul\", null, mdx(\"li\", {\n parentName: \"ul\"\n }, mdx(\"strong\", {\n parentName: \"li\"\n }, \"return true;\"), \" If you return true the inhibitor will block the execution of the command.\\nTo allow a command return a falsey value.\"), mdx(\"li\", {\n parentName: \"ul\"\n }, mdx(\"strong\", {\n parentName: \"li\"\n }, \"return false;\"), \" If you return false the inhibitor will not block the error.\")), mdx(\"pre\", null, mdx(\"code\", _extends({\n parentName: \"pre\"\n }, {\n \"className\": \"language-ts\"\n }), \"// If the command is not VIP only we can allow this command\\nif (!command.vipOnly) return false;\\n\\n// Check if the user is VIP\\nconst userIsVIP = message.author.settings.get(`isVIP`)\\n// The user is VIP so we can allow this command to be used\\nif (userIsVIP) return false\\n// The user is NOT VIP so we throw an error\\nthrow `The ${command.name} is only allowed for VIP users.`\\n\")));\n}\n;\nMDXContent.isMDXComponent = true;","rawMDXOutput":"/* @jsx mdx */\nimport { mdx } from '@mdx-js/react';\n/* @jsx mdx */\n\nexport const _frontmatter = {\n \"title\": \"Creating Inhibitors!\",\n \"metaTitle\": \"Creating An Inhibitor | Discordeno\",\n \"metaDescription\": \"Let's create our very own bot with Discordeno!\"\n};\n\nconst layoutProps = {\n _frontmatter\n};\nconst MDXLayout = \"wrapper\"\nexport default function MDXContent({\n components,\n ...props\n}) {\n return \n

{`Woah! You are almost half way done with understanding all of Discordeno. Amazing isn't it? Something you may have noticed in the last section was there were some options that prevented some commands from running like `}{`dmOnly`}{` or the permission options. we created a setting to prevent the monitor from running in certain channels. What if we wanted to do prevent commands from happening? How would we prevent commands from running?`}

\n

{`What is an Inhibitor?`}

\n

{`An Inhibitor is very similar to how monitors work. A monitor runs on every message but an inhibitor runs on every command. Remember all those command options like cooldown, permissions, permissionLevel, nsfw, etc... Each and every one of these options has an inhibitor in that checks commands for these settings.`}

\n

{`Let's create our own inhibitor that would prevent commands from being used if the user is not a VIP user.`}

\n
\n

{`Note:`}{` It is important to remember that everything below can be done with a simple permission level as well. We will create our own custom permission levels but for the purposes of this guide and to be able to learn about Inhibitors, we will be using an inhibitor.`}

\n
\n

{`Creating the File`}

\n

{`Let's start by creating a file inside the inhibitors folder called `}{`vipOnly.ts`}{` and paste the following snippet of code:`}

\n
{`import { botCache } from \"../../mod.ts\";\n\nbotCache.inhibitors.set(\"inhibitorname\", async function (message, command, guild) {\n    // Your code goes here\n});\n`}
\n

{`Inhibitors can take up to 3 arguments.`}

\n
    \n
  • {`message`}{`: The message object that triggered the command.`}
  • \n
  • {`command`}{`: The command object itself that was triggered.`}
  • \n
  • {`guild`}{`: The server guild object where this command was ran.`}
  • \n
\n

{`Understanding How Inhibitors Function`}

\n

{`To block a command you have to return a truthy value.`}

\n
    \n
  • {`return true;`}{` If you return true the inhibitor will block the execution of the command.\nTo allow a command return a falsey value.`}
  • \n
  • {`return false;`}{` If you return false the inhibitor will not block the error.`}
  • \n
\n
{`// If the command is not VIP only we can allow this command\nif (!command.vipOnly) return false;\n\n// Check if the user is VIP\nconst userIsVIP = message.author.settings.get(\\`isVIP\\`)\n// The user is VIP so we can allow this command to be used\nif (userIsVIP) return false\n// The user is NOT VIP so we throw an error\nthrow \\`The \\${command.name} is only allowed for VIP users.\\`\n`}
\n\n
;\n}\n\n;\nMDXContent.isMDXComponent = true;"}} \ No newline at end of file diff --git a/docs/.cache/caches/gatsby-plugin-mdx/diskstore-8375d5d629cad4caa205c8429309263f.json b/docs/.cache/caches/gatsby-plugin-mdx/diskstore-8375d5d629cad4caa205c8429309263f.json new file mode 100644 index 000000000..2071ce383 --- /dev/null +++ b/docs/.cache/caches/gatsby-plugin-mdx/diskstore-8375d5d629cad4caa205c8429309263f.json @@ -0,0 +1 @@ +{"expireTime":9007200851635354000,"key":"gatsby-plugin-mdx-entire-payload-20a46a6606b5e8fef8f5ce66a904bdfb-","val":{"mdast":{"type":"root","children":[{"type":"paragraph","children":[{"type":"text","value":"Woah! You are almost half way done with understanding all of Discordeno. Amazing isn't it? Something you may have noticed in the last section was when the bot started up you could see a bunch of messages like ","position":{"start":{"line":2,"column":1,"offset":1},"end":{"line":2,"column":210,"offset":210},"indent":[]}},{"type":"inlineCode","value":"Loaded X Commands","position":{"start":{"line":2,"column":210,"offset":210},"end":{"line":2,"column":229,"offset":229},"indent":[]}},{"type":"text","value":" and such. Let's jump into this part now and understand how event handling works in Discordeno.","position":{"start":{"line":2,"column":229,"offset":229},"end":{"line":2,"column":324,"offset":324},"indent":[]}}],"position":{"start":{"line":2,"column":1,"offset":1},"end":{"line":2,"column":324,"offset":324},"indent":[]}},{"type":"heading","depth":2,"children":[{"type":"text","value":"What Is An Event?","position":{"start":{"line":4,"column":4,"offset":329},"end":{"line":4,"column":21,"offset":346},"indent":[]}}],"position":{"start":{"line":4,"column":1,"offset":326},"end":{"line":4,"column":21,"offset":346},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"An event in Discordeno is a function that can be called when a specific event occurs. For the most part, events will usually be the ones that are available from Discordeno. However, you can create your own custom events as well if you wish.","position":{"start":{"line":6,"column":1,"offset":348},"end":{"line":6,"column":241,"offset":588},"indent":[]}}],"position":{"start":{"line":6,"column":1,"offset":348},"end":{"line":6,"column":241,"offset":588},"indent":[]}},{"type":"heading","depth":2,"children":[{"type":"text","value":"Creating The File","position":{"start":{"line":8,"column":4,"offset":593},"end":{"line":8,"column":21,"offset":610},"indent":[]}}],"position":{"start":{"line":8,"column":1,"offset":590},"end":{"line":8,"column":21,"offset":610},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"Make a new file in the events folder called ","position":{"start":{"line":10,"column":1,"offset":612},"end":{"line":10,"column":45,"offset":656},"indent":[]}},{"type":"inlineCode","value":"discordLog.ts","position":{"start":{"line":10,"column":45,"offset":656},"end":{"line":10,"column":60,"offset":671},"indent":[]}},{"type":"text","value":" that will send a message to a discord channel whenever we get an error so we don't need to always be watching the console to see errors. Once you made the file, go ahead and paste the base event snippet below.","position":{"start":{"line":10,"column":60,"offset":671},"end":{"line":10,"column":270,"offset":881},"indent":[]}}],"position":{"start":{"line":10,"column":1,"offset":612},"end":{"line":10,"column":270,"offset":881},"indent":[]}},{"type":"code","lang":"ts","meta":null,"value":"import { botCache } from \"../../mod.ts\";\nimport { cache } from \"https://raw.githubusercontent.com/Skillz4Killz/Discordeno/v7/src/utils/cache.ts\";\n\nbotCache.eventHandlers.ready = function () {\n // Your code goes here\n};\n","position":{"start":{"line":13,"column":1,"offset":884},"end":{"line":21,"column":4,"offset":1114},"indent":[1,1,1,1,1,1,1,1]}},{"type":"export","value":"export const _frontmatter = {\"title\":\"Creating Events!\",\"metaTitle\":\"Creating An Event | Discordeno\",\"metaDescription\":\"Let's create our very own bot with Discordeno!\"}","position":{"start":{"line":24,"column":1,"offset":1117},"end":{"line":24,"column":169,"offset":1285},"indent":[]}}],"position":{"start":{"line":1,"column":1,"offset":0},"end":{"line":24,"column":169,"offset":1285}}},"scopeImports":["import * as React from 'react'"],"scopeIdentifiers":["React"],"body":"function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }\n\nfunction _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }\n\nfunction _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }\n\n/* @jsx mdx */\nvar _frontmatter = {\n \"title\": \"Creating Events!\",\n \"metaTitle\": \"Creating An Event | Discordeno\",\n \"metaDescription\": \"Let's create our very own bot with Discordeno!\"\n};\nvar layoutProps = {\n _frontmatter: _frontmatter\n};\nvar MDXLayout = \"wrapper\";\nreturn function MDXContent(_ref) {\n var components = _ref.components,\n props = _objectWithoutProperties(_ref, [\"components\"]);\n\n return mdx(MDXLayout, _extends({}, layoutProps, props, {\n components: components,\n mdxType: \"MDXLayout\"\n }), mdx(\"p\", null, \"Woah! You are almost half way done with understanding all of Discordeno. Amazing isn't it? Something you may have noticed in the last section was when the bot started up you could see a bunch of messages like \", mdx(\"inlineCode\", {\n parentName: \"p\"\n }, \"Loaded X Commands\"), \" and such. Let's jump into this part now and understand how event handling works in Discordeno.\"), mdx(\"h2\", null, \"What Is An Event?\"), mdx(\"p\", null, \"An event in Discordeno is a function that can be called when a specific event occurs. For the most part, events will usually be the ones that are available from Discordeno. However, you can create your own custom events as well if you wish.\"), mdx(\"h2\", null, \"Creating The File\"), mdx(\"p\", null, \"Make a new file in the events folder called \", mdx(\"inlineCode\", {\n parentName: \"p\"\n }, \"discordLog.ts\"), \" that will send a message to a discord channel whenever we get an error so we don't need to always be watching the console to see errors. Once you made the file, go ahead and paste the base event snippet below.\"), mdx(\"pre\", null, mdx(\"code\", _extends({\n parentName: \"pre\"\n }, {\n \"className\": \"language-ts\"\n }), \"import { botCache } from \\\"../../mod.ts\\\";\\nimport { cache } from \\\"https://raw.githubusercontent.com/Skillz4Killz/Discordeno/v7/src/utils/cache.ts\\\";\\n\\nbotCache.eventHandlers.ready = function () {\\n // Your code goes here\\n};\\n\\n\")));\n}\n;\nMDXContent.isMDXComponent = true;","rawMDXOutput":"/* @jsx mdx */\nimport { mdx } from '@mdx-js/react';\n/* @jsx mdx */\n\nexport const _frontmatter = {\n \"title\": \"Creating Events!\",\n \"metaTitle\": \"Creating An Event | Discordeno\",\n \"metaDescription\": \"Let's create our very own bot with Discordeno!\"\n};\n\nconst layoutProps = {\n _frontmatter\n};\nconst MDXLayout = \"wrapper\"\nexport default function MDXContent({\n components,\n ...props\n}) {\n return \n

{`Woah! You are almost half way done with understanding all of Discordeno. Amazing isn't it? Something you may have noticed in the last section was when the bot started up you could see a bunch of messages like `}{`Loaded X Commands`}{` and such. Let's jump into this part now and understand how event handling works in Discordeno.`}

\n

{`What Is An Event?`}

\n

{`An event in Discordeno is a function that can be called when a specific event occurs. For the most part, events will usually be the ones that are available from Discordeno. However, you can create your own custom events as well if you wish.`}

\n

{`Creating The File`}

\n

{`Make a new file in the events folder called `}{`discordLog.ts`}{` that will send a message to a discord channel whenever we get an error so we don't need to always be watching the console to see errors. Once you made the file, go ahead and paste the base event snippet below.`}

\n
{`import { botCache } from \"../../mod.ts\";\nimport { cache } from \"https://raw.githubusercontent.com/Skillz4Killz/Discordeno/v7/src/utils/cache.ts\";\n\nbotCache.eventHandlers.ready = function () {\n  // Your code goes here\n};\n\n`}
\n\n
;\n}\n\n;\nMDXContent.isMDXComponent = true;"}} \ No newline at end of file diff --git a/docs/.cache/caches/gatsby-plugin-mdx/diskstore-837811b4e69e55144f8688469fa6f922.json b/docs/.cache/caches/gatsby-plugin-mdx/diskstore-837811b4e69e55144f8688469fa6f922.json new file mode 100644 index 000000000..87db07b2b --- /dev/null +++ b/docs/.cache/caches/gatsby-plugin-mdx/diskstore-837811b4e69e55144f8688469fa6f922.json @@ -0,0 +1 @@ +{"expireTime":9007200851634928000,"key":"gatsby-plugin-mdx-entire-payload-7eb45982d239484d94b2811ae2f053db-","val":{"mdast":{"type":"root","children":[{"type":"paragraph","children":[{"type":"text","value":"Woah! You are almost half way done with understanding all of Discordeno. Amazing isn't it? Something you may have noticed in the last section was there were some options that prevented some commands from running like ","position":{"start":{"line":2,"column":1,"offset":1},"end":{"line":2,"column":218,"offset":218},"indent":[]}},{"type":"inlineCode","value":"dmOnly","position":{"start":{"line":2,"column":218,"offset":218},"end":{"line":2,"column":226,"offset":226},"indent":[]}},{"type":"text","value":" or the permission options. we created a setting to prevent the monitor from running in certain channels. What if we wanted to do prevent commands from happening? How would we prevent commands from running?","position":{"start":{"line":2,"column":226,"offset":226},"end":{"line":2,"column":432,"offset":432},"indent":[]}}],"position":{"start":{"line":2,"column":1,"offset":1},"end":{"line":2,"column":432,"offset":432},"indent":[]}},{"type":"heading","depth":2,"children":[{"type":"text","value":"What is an Inhibitor?","position":{"start":{"line":4,"column":4,"offset":437},"end":{"line":4,"column":25,"offset":458},"indent":[]}}],"position":{"start":{"line":4,"column":1,"offset":434},"end":{"line":4,"column":25,"offset":458},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"An Inhibitor is very similar to how monitors work. A monitor runs on every message but an inhibitor runs on every command. Remember all those command options like cooldown, permissions, permissionLevel, nsfw, etc... Each and every one of these options has an inhibitor in that checks commands for these settings.","position":{"start":{"line":6,"column":1,"offset":460},"end":{"line":6,"column":313,"offset":772},"indent":[]}}],"position":{"start":{"line":6,"column":1,"offset":460},"end":{"line":6,"column":313,"offset":772},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"Let's create our own inhibitor that would prevent commands from being used if the user is not a VIP user.","position":{"start":{"line":8,"column":1,"offset":774},"end":{"line":8,"column":106,"offset":879},"indent":[]}}],"position":{"start":{"line":8,"column":1,"offset":774},"end":{"line":8,"column":106,"offset":879},"indent":[]}},{"type":"blockquote","children":[{"type":"paragraph","children":[{"type":"strong","children":[{"type":"text","value":"Note:","position":{"start":{"line":10,"column":5,"offset":885},"end":{"line":10,"column":10,"offset":890},"indent":[]}}],"position":{"start":{"line":10,"column":3,"offset":883},"end":{"line":10,"column":12,"offset":892},"indent":[]}},{"type":"text","value":" It is important to remember that everything below can be done with a simple permission level as well. We will create our own custom permission levels but for the purposes of this guide and to be able to learn about Inhibitors, we will be using an inhibitor.","position":{"start":{"line":10,"column":12,"offset":892},"end":{"line":10,"column":270,"offset":1150},"indent":[]}}],"position":{"start":{"line":10,"column":3,"offset":883},"end":{"line":10,"column":270,"offset":1150},"indent":[]}}],"position":{"start":{"line":10,"column":1,"offset":881},"end":{"line":10,"column":270,"offset":1150},"indent":[]}},{"type":"heading","depth":2,"children":[{"type":"text","value":"Creating the File","position":{"start":{"line":12,"column":4,"offset":1155},"end":{"line":12,"column":21,"offset":1172},"indent":[]}}],"position":{"start":{"line":12,"column":1,"offset":1152},"end":{"line":12,"column":21,"offset":1172},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"Let's start by creating a file inside the inhibitors folder called ","position":{"start":{"line":14,"column":1,"offset":1174},"end":{"line":14,"column":68,"offset":1241},"indent":[]}},{"type":"inlineCode","value":"boosted.ts","position":{"start":{"line":14,"column":68,"offset":1241},"end":{"line":14,"column":80,"offset":1253},"indent":[]}},{"type":"text","value":" and paste the following snippet of code:","position":{"start":{"line":14,"column":80,"offset":1253},"end":{"line":14,"column":121,"offset":1294},"indent":[]}}],"position":{"start":{"line":14,"column":1,"offset":1174},"end":{"line":14,"column":121,"offset":1294},"indent":[]}},{"type":"code","lang":"ts","meta":null,"value":"import { botCache } from \"../../mod.ts\";\n\nbotCache.inhibitors.set(\"inhibitorname\", async function (message, command, guild) {\n\t// Your code goes here\n});","position":{"start":{"line":16,"column":1,"offset":1296},"end":{"line":22,"column":4,"offset":1459},"indent":[1,1,1,1,1,1]}},{"type":"paragraph","children":[{"type":"text","value":"Inhibitors can take up to 3 arguments.","position":{"start":{"line":24,"column":1,"offset":1461},"end":{"line":24,"column":39,"offset":1499},"indent":[]}}],"position":{"start":{"line":24,"column":1,"offset":1461},"end":{"line":24,"column":39,"offset":1499},"indent":[]}},{"type":"list","ordered":false,"start":null,"spread":false,"children":[{"type":"listItem","spread":false,"checked":null,"children":[{"type":"paragraph","children":[{"type":"inlineCode","value":"message","position":{"start":{"line":26,"column":3,"offset":1503},"end":{"line":26,"column":12,"offset":1512},"indent":[]}},{"type":"text","value":": The message object that triggered the command.","position":{"start":{"line":26,"column":12,"offset":1512},"end":{"line":26,"column":60,"offset":1560},"indent":[]}}],"position":{"start":{"line":26,"column":3,"offset":1503},"end":{"line":26,"column":60,"offset":1560},"indent":[]}}],"position":{"start":{"line":26,"column":1,"offset":1501},"end":{"line":26,"column":60,"offset":1560},"indent":[]}},{"type":"listItem","spread":false,"checked":null,"children":[{"type":"paragraph","children":[{"type":"inlineCode","value":"command","position":{"start":{"line":27,"column":3,"offset":1563},"end":{"line":27,"column":12,"offset":1572},"indent":[]}},{"type":"text","value":": The command object itself that was triggered.","position":{"start":{"line":27,"column":12,"offset":1572},"end":{"line":27,"column":59,"offset":1619},"indent":[]}}],"position":{"start":{"line":27,"column":3,"offset":1563},"end":{"line":27,"column":59,"offset":1619},"indent":[]}}],"position":{"start":{"line":27,"column":1,"offset":1561},"end":{"line":27,"column":59,"offset":1619},"indent":[]}},{"type":"listItem","spread":false,"checked":null,"children":[{"type":"paragraph","children":[{"type":"inlineCode","value":"guild","position":{"start":{"line":28,"column":3,"offset":1622},"end":{"line":28,"column":10,"offset":1629},"indent":[]}},{"type":"text","value":": The server guild object where this command was ran.","position":{"start":{"line":28,"column":10,"offset":1629},"end":{"line":28,"column":63,"offset":1682},"indent":[]}}],"position":{"start":{"line":28,"column":3,"offset":1622},"end":{"line":28,"column":63,"offset":1682},"indent":[]}}],"position":{"start":{"line":28,"column":1,"offset":1620},"end":{"line":28,"column":63,"offset":1682},"indent":[]}}],"position":{"start":{"line":26,"column":1,"offset":1501},"end":{"line":28,"column":63,"offset":1682},"indent":[1,1]}},{"type":"heading","depth":2,"children":[{"type":"text","value":"Understanding How Inhibitors Function","position":{"start":{"line":30,"column":4,"offset":1687},"end":{"line":30,"column":41,"offset":1724},"indent":[]}}],"position":{"start":{"line":30,"column":1,"offset":1684},"end":{"line":30,"column":41,"offset":1724},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"To block a command you have to return a truthy value.","position":{"start":{"line":32,"column":1,"offset":1726},"end":{"line":32,"column":54,"offset":1779},"indent":[]}}],"position":{"start":{"line":32,"column":1,"offset":1726},"end":{"line":32,"column":54,"offset":1779},"indent":[]}},{"type":"list","ordered":false,"start":null,"spread":false,"children":[{"type":"listItem","spread":false,"checked":null,"children":[{"type":"paragraph","children":[{"type":"strong","children":[{"type":"text","value":"return true;","position":{"start":{"line":33,"column":5,"offset":1784},"end":{"line":33,"column":17,"offset":1796},"indent":[]}}],"position":{"start":{"line":33,"column":3,"offset":1782},"end":{"line":33,"column":19,"offset":1798},"indent":[]}},{"type":"text","value":" If you return true the inhibitor will block the execution of the command.\nTo allow a command return a falsey value.","position":{"start":{"line":33,"column":19,"offset":1798},"end":{"line":34,"column":42,"offset":1914},"indent":[1]}}],"position":{"start":{"line":33,"column":3,"offset":1782},"end":{"line":34,"column":42,"offset":1914},"indent":[1]}}],"position":{"start":{"line":33,"column":1,"offset":1780},"end":{"line":34,"column":42,"offset":1914},"indent":[1]}},{"type":"listItem","spread":false,"checked":null,"children":[{"type":"paragraph","children":[{"type":"strong","children":[{"type":"text","value":"return false;","position":{"start":{"line":35,"column":5,"offset":1919},"end":{"line":35,"column":18,"offset":1932},"indent":[]}}],"position":{"start":{"line":35,"column":3,"offset":1917},"end":{"line":35,"column":20,"offset":1934},"indent":[]}},{"type":"text","value":" If you return false the inhibitor will not block the error.","position":{"start":{"line":35,"column":20,"offset":1934},"end":{"line":35,"column":80,"offset":1994},"indent":[]}}],"position":{"start":{"line":35,"column":3,"offset":1917},"end":{"line":35,"column":80,"offset":1994},"indent":[]}}],"position":{"start":{"line":35,"column":1,"offset":1915},"end":{"line":35,"column":80,"offset":1994},"indent":[]}}],"position":{"start":{"line":33,"column":1,"offset":1780},"end":{"line":35,"column":80,"offset":1994},"indent":[1,1]}},{"type":"code","lang":"ts","meta":null,"value":"// If the command is not VIP only we can allow this command to execute\nif (!command.vipOnly) return false;\n\n// The bot's support server\nconst guild = cache.guilds.get(configs.supportServerID);\n// If the command author is not in the server they won't have the vip role\nconst member = guild.members.get(message.author.id) || await getMember(guild.id, message.author.id);\n// Member doesn't exist so cancel the command\nif (!member) {\n\tsendResponse(message, `sorry, but you can not use this command until you become VIP. **Close the IRIS!!!**`)\n\treturn true;\n}\n\n// If the user has the vip role on the support server given by patreon allow the command\nif (member.roles.includes(configs.roleIDs.patreonVIPRoleID)) return false;\n\n// Alert the user they don't have vip and can't use the command\nsendResponse(message, `sorry, but you can not use this command until you become a VIP. I'm sorry, Teal'c. We'll go to Disneyland next year. I promise.`)\n// Cancel the command since the user does not have vip\nreturn true;","position":{"start":{"line":38,"column":1,"offset":1997},"end":{"line":59,"column":4,"offset":3013},"indent":[1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1]}},{"type":"heading","depth":2,"children":[{"type":"text","value":"Updating Command Typings","position":{"start":{"line":61,"column":4,"offset":3018},"end":{"line":61,"column":28,"offset":3042},"indent":[]}}],"position":{"start":{"line":61,"column":1,"offset":3015},"end":{"line":61,"column":28,"offset":3042},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"Since we need a new option on our commands we need to add that. Open the ","position":{"start":{"line":63,"column":1,"offset":3044},"end":{"line":63,"column":74,"offset":3117},"indent":[]}},{"type":"inlineCode","value":"src/types/commands.ts","position":{"start":{"line":63,"column":74,"offset":3117},"end":{"line":63,"column":97,"offset":3140},"indent":[]}},{"type":"text","value":" file and add in the following","position":{"start":{"line":63,"column":97,"offset":3140},"end":{"line":63,"column":127,"offset":3170},"indent":[]}}],"position":{"start":{"line":63,"column":1,"offset":3044},"end":{"line":63,"column":127,"offset":3170},"indent":[]}},{"type":"code","lang":"ts","meta":null,"value":" vipOnly?: boolean;","position":{"start":{"line":65,"column":1,"offset":3172},"end":{"line":67,"column":4,"offset":3202},"indent":[1,1]}},{"type":"heading","depth":2,"children":[{"type":"text","value":"Challenges","position":{"start":{"line":71,"column":4,"offset":3209},"end":{"line":71,"column":14,"offset":3219},"indent":[]}}],"position":{"start":{"line":71,"column":1,"offset":3206},"end":{"line":71,"column":14,"offset":3219},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"Hell yes! We just got through the entire inhibitor section. You have now mastered everything related to inhibitors.","position":{"start":{"line":73,"column":1,"offset":3221},"end":{"line":73,"column":116,"offset":3336},"indent":[]}}],"position":{"start":{"line":73,"column":1,"offset":3221},"end":{"line":73,"column":116,"offset":3336},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"You can now try and get a little more practice with inhibitors by trying to challenge yourself and make your own inhibitors. Don't worry if you can't think of any good use cases for inhibitors.","position":{"start":{"line":75,"column":1,"offset":3338},"end":{"line":75,"column":194,"offset":3531},"indent":[]}}],"position":{"start":{"line":75,"column":1,"offset":3338},"end":{"line":75,"column":194,"offset":3531},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"Majority of Discordeno bots do not use many custom inhibitors because most of the necessary/important ones already come built for you in the inhibitors folder.","position":{"start":{"line":77,"column":1,"offset":3533},"end":{"line":77,"column":160,"offset":3692},"indent":[]}}],"position":{"start":{"line":77,"column":1,"offset":3533},"end":{"line":77,"column":160,"offset":3692},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"Next we will try our hands at creating a monitor.","position":{"start":{"line":79,"column":1,"offset":3694},"end":{"line":79,"column":50,"offset":3743},"indent":[]}}],"position":{"start":{"line":79,"column":1,"offset":3694},"end":{"line":79,"column":50,"offset":3743},"indent":[]}},{"type":"export","value":"export const _frontmatter = {\"title\":\"Creating Inhibitors!\",\"metaTitle\":\"Creating An Inhibitor | Discordeno\",\"metaDescription\":\"Let's create our very own bot with Discordeno!\"}","position":{"start":{"line":82,"column":1,"offset":3746},"end":{"line":82,"column":177,"offset":3922},"indent":[]}}],"position":{"start":{"line":1,"column":1,"offset":0},"end":{"line":82,"column":177,"offset":3922}}},"scopeImports":["import * as React from 'react'"],"scopeIdentifiers":["React"],"body":"function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }\n\nfunction _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }\n\nfunction _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }\n\n/* @jsx mdx */\nvar _frontmatter = {\n \"title\": \"Creating Inhibitors!\",\n \"metaTitle\": \"Creating An Inhibitor | Discordeno\",\n \"metaDescription\": \"Let's create our very own bot with Discordeno!\"\n};\nvar layoutProps = {\n _frontmatter: _frontmatter\n};\nvar MDXLayout = \"wrapper\";\nreturn function MDXContent(_ref) {\n var components = _ref.components,\n props = _objectWithoutProperties(_ref, [\"components\"]);\n\n return mdx(MDXLayout, _extends({}, layoutProps, props, {\n components: components,\n mdxType: \"MDXLayout\"\n }), mdx(\"p\", null, \"Woah! You are almost half way done with understanding all of Discordeno. Amazing isn't it? Something you may have noticed in the last section was there were some options that prevented some commands from running like \", mdx(\"inlineCode\", {\n parentName: \"p\"\n }, \"dmOnly\"), \" or the permission options. we created a setting to prevent the monitor from running in certain channels. What if we wanted to do prevent commands from happening? How would we prevent commands from running?\"), mdx(\"h2\", null, \"What is an Inhibitor?\"), mdx(\"p\", null, \"An Inhibitor is very similar to how monitors work. A monitor runs on every message but an inhibitor runs on every command. Remember all those command options like cooldown, permissions, permissionLevel, nsfw, etc... Each and every one of these options has an inhibitor in that checks commands for these settings.\"), mdx(\"p\", null, \"Let's create our own inhibitor that would prevent commands from being used if the user is not a VIP user.\"), mdx(\"blockquote\", null, mdx(\"p\", {\n parentName: \"blockquote\"\n }, mdx(\"strong\", {\n parentName: \"p\"\n }, \"Note:\"), \" It is important to remember that everything below can be done with a simple permission level as well. We will create our own custom permission levels but for the purposes of this guide and to be able to learn about Inhibitors, we will be using an inhibitor.\")), mdx(\"h2\", null, \"Creating the File\"), mdx(\"p\", null, \"Let's start by creating a file inside the inhibitors folder called \", mdx(\"inlineCode\", {\n parentName: \"p\"\n }, \"boosted.ts\"), \" and paste the following snippet of code:\"), mdx(\"pre\", null, mdx(\"code\", _extends({\n parentName: \"pre\"\n }, {\n \"className\": \"language-ts\"\n }), \"import { botCache } from \\\"../../mod.ts\\\";\\n\\nbotCache.inhibitors.set(\\\"inhibitorname\\\", async function (message, command, guild) {\\n // Your code goes here\\n});\\n\")), mdx(\"p\", null, \"Inhibitors can take up to 3 arguments.\"), mdx(\"ul\", null, mdx(\"li\", {\n parentName: \"ul\"\n }, mdx(\"inlineCode\", {\n parentName: \"li\"\n }, \"message\"), \": The message object that triggered the command.\"), mdx(\"li\", {\n parentName: \"ul\"\n }, mdx(\"inlineCode\", {\n parentName: \"li\"\n }, \"command\"), \": The command object itself that was triggered.\"), mdx(\"li\", {\n parentName: \"ul\"\n }, mdx(\"inlineCode\", {\n parentName: \"li\"\n }, \"guild\"), \": The server guild object where this command was ran.\")), mdx(\"h2\", null, \"Understanding How Inhibitors Function\"), mdx(\"p\", null, \"To block a command you have to return a truthy value.\"), mdx(\"ul\", null, mdx(\"li\", {\n parentName: \"ul\"\n }, mdx(\"strong\", {\n parentName: \"li\"\n }, \"return true;\"), \" If you return true the inhibitor will block the execution of the command.\\nTo allow a command return a falsey value.\"), mdx(\"li\", {\n parentName: \"ul\"\n }, mdx(\"strong\", {\n parentName: \"li\"\n }, \"return false;\"), \" If you return false the inhibitor will not block the error.\")), mdx(\"pre\", null, mdx(\"code\", _extends({\n parentName: \"pre\"\n }, {\n \"className\": \"language-ts\"\n }), \"// If the command is not VIP only we can allow this command to execute\\nif (!command.vipOnly) return false;\\n\\n// The bot's support server\\nconst guild = cache.guilds.get(configs.supportServerID);\\n// If the command author is not in the server they won't have the vip role\\nconst member = guild.members.get(message.author.id) || await getMember(guild.id, message.author.id);\\n// Member doesn't exist so cancel the command\\nif (!member) {\\n sendResponse(message, `sorry, but you can not use this command until you become VIP. **Close the IRIS!!!**`)\\n return true;\\n}\\n\\n// If the user has the vip role on the support server given by patreon allow the command\\nif (member.roles.includes(configs.roleIDs.patreonVIPRoleID)) return false;\\n\\n// Alert the user they don't have vip and can't use the command\\nsendResponse(message, `sorry, but you can not use this command until you become a VIP. I'm sorry, Teal'c. We'll go to Disneyland next year. I promise.`)\\n// Cancel the command since the user does not have vip\\nreturn true;\\n\")), mdx(\"h2\", null, \"Updating Command Typings\"), mdx(\"p\", null, \"Since we need a new option on our commands we need to add that. Open the \", mdx(\"inlineCode\", {\n parentName: \"p\"\n }, \"src/types/commands.ts\"), \" file and add in the following\"), mdx(\"pre\", null, mdx(\"code\", _extends({\n parentName: \"pre\"\n }, {\n \"className\": \"language-ts\"\n }), \" vipOnly?: boolean;\\n\")), mdx(\"h2\", null, \"Challenges\"), mdx(\"p\", null, \"Hell yes! We just got through the entire inhibitor section. You have now mastered everything related to inhibitors.\"), mdx(\"p\", null, \"You can now try and get a little more practice with inhibitors by trying to challenge yourself and make your own inhibitors. Don't worry if you can't think of any good use cases for inhibitors.\"), mdx(\"p\", null, \"Majority of Discordeno bots do not use many custom inhibitors because most of the necessary/important ones already come built for you in the inhibitors folder.\"), mdx(\"p\", null, \"Next we will try our hands at creating a monitor.\"));\n}\n;\nMDXContent.isMDXComponent = true;","rawMDXOutput":"/* @jsx mdx */\nimport { mdx } from '@mdx-js/react';\n/* @jsx mdx */\n\nexport const _frontmatter = {\n \"title\": \"Creating Inhibitors!\",\n \"metaTitle\": \"Creating An Inhibitor | Discordeno\",\n \"metaDescription\": \"Let's create our very own bot with Discordeno!\"\n};\n\nconst layoutProps = {\n _frontmatter\n};\nconst MDXLayout = \"wrapper\"\nexport default function MDXContent({\n components,\n ...props\n}) {\n return \n

{`Woah! You are almost half way done with understanding all of Discordeno. Amazing isn't it? Something you may have noticed in the last section was there were some options that prevented some commands from running like `}{`dmOnly`}{` or the permission options. we created a setting to prevent the monitor from running in certain channels. What if we wanted to do prevent commands from happening? How would we prevent commands from running?`}

\n

{`What is an Inhibitor?`}

\n

{`An Inhibitor is very similar to how monitors work. A monitor runs on every message but an inhibitor runs on every command. Remember all those command options like cooldown, permissions, permissionLevel, nsfw, etc... Each and every one of these options has an inhibitor in that checks commands for these settings.`}

\n

{`Let's create our own inhibitor that would prevent commands from being used if the user is not a VIP user.`}

\n
\n

{`Note:`}{` It is important to remember that everything below can be done with a simple permission level as well. We will create our own custom permission levels but for the purposes of this guide and to be able to learn about Inhibitors, we will be using an inhibitor.`}

\n
\n

{`Creating the File`}

\n

{`Let's start by creating a file inside the inhibitors folder called `}{`boosted.ts`}{` and paste the following snippet of code:`}

\n
{`import { botCache } from \"../../mod.ts\";\n\nbotCache.inhibitors.set(\"inhibitorname\", async function (message, command, guild) {\n    // Your code goes here\n});\n`}
\n

{`Inhibitors can take up to 3 arguments.`}

\n
    \n
  • {`message`}{`: The message object that triggered the command.`}
  • \n
  • {`command`}{`: The command object itself that was triggered.`}
  • \n
  • {`guild`}{`: The server guild object where this command was ran.`}
  • \n
\n

{`Understanding How Inhibitors Function`}

\n

{`To block a command you have to return a truthy value.`}

\n
    \n
  • {`return true;`}{` If you return true the inhibitor will block the execution of the command.\nTo allow a command return a falsey value.`}
  • \n
  • {`return false;`}{` If you return false the inhibitor will not block the error.`}
  • \n
\n
{`// If the command is not VIP only we can allow this command to execute\nif (!command.vipOnly) return false;\n\n// The bot's support server\nconst guild = cache.guilds.get(configs.supportServerID);\n// If the command author is not in the server they won't have the vip role\nconst member = guild.members.get(message.author.id) || await getMember(guild.id, message.author.id);\n// Member doesn't exist so cancel the command\nif (!member) {\n    sendResponse(message, \\`sorry, but you can not use this command until you become VIP. **Close the IRIS!!!**\\`)\n    return true;\n}\n\n// If the user has the vip role on the support server given by patreon allow the command\nif (member.roles.includes(configs.roleIDs.patreonVIPRoleID)) return false;\n\n// Alert the user they don't have vip and can't use the command\nsendResponse(message, \\`sorry, but you can not use this command until you become a VIP. I'm sorry, Teal'c. We'll go to Disneyland next year. I promise.\\`)\n// Cancel the command since the user does not have vip\nreturn true;\n`}
\n

{`Updating Command Typings`}

\n

{`Since we need a new option on our commands we need to add that. Open the `}{`src/types/commands.ts`}{` file and add in the following`}

\n
{`  vipOnly?: boolean;\n`}
\n

{`Challenges`}

\n

{`Hell yes! We just got through the entire inhibitor section. You have now mastered everything related to inhibitors.`}

\n

{`You can now try and get a little more practice with inhibitors by trying to challenge yourself and make your own inhibitors. Don't worry if you can't think of any good use cases for inhibitors.`}

\n

{`Majority of Discordeno bots do not use many custom inhibitors because most of the necessary/important ones already come built for you in the inhibitors folder.`}

\n

{`Next we will try our hands at creating a monitor.`}

\n\n
;\n}\n\n;\nMDXContent.isMDXComponent = true;"}} \ No newline at end of file diff --git a/docs/.cache/caches/gatsby-plugin-mdx/diskstore-86a51897ace3a214e556214d0bae2ac0.json b/docs/.cache/caches/gatsby-plugin-mdx/diskstore-86a51897ace3a214e556214d0bae2ac0.json new file mode 100644 index 000000000..f03d5f4d4 --- /dev/null +++ b/docs/.cache/caches/gatsby-plugin-mdx/diskstore-86a51897ace3a214e556214d0bae2ac0.json @@ -0,0 +1 @@ +{"expireTime":9007200851596679000,"key":"gatsby-plugin-mdx-entire-payload-c78c0b2f81e2754531f72f6c9d758808-","val":{"mdast":{"type":"root","children":[{"type":"heading","depth":2,"children":[{"type":"text","value":"Understanding The Goals of This Guide","position":{"start":{"line":2,"column":4,"offset":4},"end":{"line":2,"column":41,"offset":41},"indent":[]}}],"position":{"start":{"line":2,"column":1,"offset":1},"end":{"line":2,"column":41,"offset":41},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"This guide is for advanced Discordeno features.","position":{"start":{"line":4,"column":1,"offset":43},"end":{"line":4,"column":48,"offset":90},"indent":[]}}],"position":{"start":{"line":4,"column":1,"offset":43},"end":{"line":4,"column":48,"offset":90},"indent":[]}},{"type":"export","value":"export const _frontmatter = {\"title\":\"Advanced Guide\",\"metaTitle\":\"Advanced Guide | Discordeno\",\"metaDescription\":\"This guide will help you learn every part of Discordeno, Advanced to create your own bot as you wish.\"}","position":{"start":{"line":7,"column":1,"offset":93},"end":{"line":7,"column":219,"offset":311},"indent":[]}}],"position":{"start":{"line":1,"column":1,"offset":0},"end":{"line":7,"column":219,"offset":311}}},"scopeImports":["import * as React from 'react'"],"scopeIdentifiers":["React"],"body":"function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }\n\nfunction _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }\n\nfunction _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }\n\n/* @jsx mdx */\nvar _frontmatter = {\n \"title\": \"Advanced Guide\",\n \"metaTitle\": \"Advanced Guide | Discordeno\",\n \"metaDescription\": \"This guide will help you learn every part of Discordeno, Advanced to create your own bot as you wish.\"\n};\nvar layoutProps = {\n _frontmatter: _frontmatter\n};\nvar MDXLayout = \"wrapper\";\nreturn function MDXContent(_ref) {\n var components = _ref.components,\n props = _objectWithoutProperties(_ref, [\"components\"]);\n\n return mdx(MDXLayout, _extends({}, layoutProps, props, {\n components: components,\n mdxType: \"MDXLayout\"\n }), mdx(\"h2\", null, \"Understanding The Goals of This Guide\"), mdx(\"p\", null, \"This guide is for advanced Discordeno features.\"));\n}\n;\nMDXContent.isMDXComponent = true;","rawMDXOutput":"/* @jsx mdx */\nimport { mdx } from '@mdx-js/react';\n/* @jsx mdx */\n\nexport const _frontmatter = {\n \"title\": \"Advanced Guide\",\n \"metaTitle\": \"Advanced Guide | Discordeno\",\n \"metaDescription\": \"This guide will help you learn every part of Discordeno, Advanced to create your own bot as you wish.\"\n};\n\nconst layoutProps = {\n _frontmatter\n};\nconst MDXLayout = \"wrapper\"\nexport default function MDXContent({\n components,\n ...props\n}) {\n return \n

{`Understanding The Goals of This Guide`}

\n

{`This guide is for advanced Discordeno features.`}

\n\n
;\n}\n\n;\nMDXContent.isMDXComponent = true;"}} \ No newline at end of file diff --git a/docs/.cache/caches/gatsby-plugin-mdx/diskstore-86f5ca31aff62e4ff6610d03bfb91124.json b/docs/.cache/caches/gatsby-plugin-mdx/diskstore-86f5ca31aff62e4ff6610d03bfb91124.json new file mode 100644 index 000000000..6a84d0fff --- /dev/null +++ b/docs/.cache/caches/gatsby-plugin-mdx/diskstore-86f5ca31aff62e4ff6610d03bfb91124.json @@ -0,0 +1 @@ +{"expireTime":9007200851634002000,"key":"gatsby-plugin-mdx-entire-payload-3aa3f770bc7d46448ee1d13774e6bb28-","val":{"mdast":{"type":"root","children":[{"type":"paragraph","children":[{"type":"text","value":"Woah! You are almost half way done with understanding all of Discordeno. Amazing isn't it? Something you may have noticed in the last section was there were some options that prevented some commands from running like ","position":{"start":{"line":2,"column":1,"offset":1},"end":{"line":2,"column":218,"offset":218},"indent":[]}},{"type":"inlineCode","value":"dmOnly","position":{"start":{"line":2,"column":218,"offset":218},"end":{"line":2,"column":226,"offset":226},"indent":[]}},{"type":"text","value":" or the permission options. we created a setting to prevent the monitor from running in certain channels. What if we wanted to do prevent commands from happening? How would we prevent commands from running?","position":{"start":{"line":2,"column":226,"offset":226},"end":{"line":2,"column":432,"offset":432},"indent":[]}}],"position":{"start":{"line":2,"column":1,"offset":1},"end":{"line":2,"column":432,"offset":432},"indent":[]}},{"type":"heading","depth":2,"children":[{"type":"text","value":"What is an Inhibitor?","position":{"start":{"line":4,"column":4,"offset":437},"end":{"line":4,"column":25,"offset":458},"indent":[]}}],"position":{"start":{"line":4,"column":1,"offset":434},"end":{"line":4,"column":25,"offset":458},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"An Inhibitor is very similar to how monitors work. A monitor runs on every message but an inhibitor runs on every command. Remember all those command options like cooldown, permissions, permissionLevel, nsfw, etc... Each and every one of these options has an inhibitor in that checks commands for these settings.","position":{"start":{"line":6,"column":1,"offset":460},"end":{"line":6,"column":313,"offset":772},"indent":[]}}],"position":{"start":{"line":6,"column":1,"offset":460},"end":{"line":6,"column":313,"offset":772},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"Let's create our own inhibitor that would prevent commands from being used if the user is not a VIP user.","position":{"start":{"line":8,"column":1,"offset":774},"end":{"line":8,"column":106,"offset":879},"indent":[]}}],"position":{"start":{"line":8,"column":1,"offset":774},"end":{"line":8,"column":106,"offset":879},"indent":[]}},{"type":"blockquote","children":[{"type":"paragraph","children":[{"type":"strong","children":[{"type":"text","value":"Note:","position":{"start":{"line":10,"column":5,"offset":885},"end":{"line":10,"column":10,"offset":890},"indent":[]}}],"position":{"start":{"line":10,"column":3,"offset":883},"end":{"line":10,"column":12,"offset":892},"indent":[]}},{"type":"text","value":" It is important to remember that everything below can be done with a simple permission level as well. We will create our own custom permission levels but for the purposes of this guide and to be able to learn about Inhibitors, we will be using an inhibitor.","position":{"start":{"line":10,"column":12,"offset":892},"end":{"line":10,"column":270,"offset":1150},"indent":[]}}],"position":{"start":{"line":10,"column":3,"offset":883},"end":{"line":10,"column":270,"offset":1150},"indent":[]}}],"position":{"start":{"line":10,"column":1,"offset":881},"end":{"line":10,"column":270,"offset":1150},"indent":[]}},{"type":"heading","depth":2,"children":[{"type":"text","value":"Creating the File","position":{"start":{"line":12,"column":4,"offset":1155},"end":{"line":12,"column":21,"offset":1172},"indent":[]}}],"position":{"start":{"line":12,"column":1,"offset":1152},"end":{"line":12,"column":21,"offset":1172},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"Let's start by creating a file inside the inhibitors folder called ","position":{"start":{"line":14,"column":1,"offset":1174},"end":{"line":14,"column":68,"offset":1241},"indent":[]}},{"type":"inlineCode","value":"boosted.ts","position":{"start":{"line":14,"column":68,"offset":1241},"end":{"line":14,"column":80,"offset":1253},"indent":[]}},{"type":"text","value":" and paste the following snippet of code:","position":{"start":{"line":14,"column":80,"offset":1253},"end":{"line":14,"column":121,"offset":1294},"indent":[]}}],"position":{"start":{"line":14,"column":1,"offset":1174},"end":{"line":14,"column":121,"offset":1294},"indent":[]}},{"type":"code","lang":"ts","meta":null,"value":"import { botCache } from \"../../mod.ts\";\n\nbotCache.inhibitors.set(\"inhibitorname\", async function (message, command, guild) {\n\t// Your code goes here\n});","position":{"start":{"line":16,"column":1,"offset":1296},"end":{"line":22,"column":4,"offset":1459},"indent":[1,1,1,1,1,1]}},{"type":"paragraph","children":[{"type":"text","value":"Inhibitors can take up to 3 arguments.","position":{"start":{"line":24,"column":1,"offset":1461},"end":{"line":24,"column":39,"offset":1499},"indent":[]}}],"position":{"start":{"line":24,"column":1,"offset":1461},"end":{"line":24,"column":39,"offset":1499},"indent":[]}},{"type":"list","ordered":false,"start":null,"spread":false,"children":[{"type":"listItem","spread":false,"checked":null,"children":[{"type":"paragraph","children":[{"type":"inlineCode","value":"message","position":{"start":{"line":26,"column":3,"offset":1503},"end":{"line":26,"column":12,"offset":1512},"indent":[]}},{"type":"text","value":": The message object that triggered the command.","position":{"start":{"line":26,"column":12,"offset":1512},"end":{"line":26,"column":60,"offset":1560},"indent":[]}}],"position":{"start":{"line":26,"column":3,"offset":1503},"end":{"line":26,"column":60,"offset":1560},"indent":[]}}],"position":{"start":{"line":26,"column":1,"offset":1501},"end":{"line":26,"column":60,"offset":1560},"indent":[]}},{"type":"listItem","spread":false,"checked":null,"children":[{"type":"paragraph","children":[{"type":"inlineCode","value":"command","position":{"start":{"line":27,"column":3,"offset":1563},"end":{"line":27,"column":12,"offset":1572},"indent":[]}},{"type":"text","value":": The command object itself that was triggered.","position":{"start":{"line":27,"column":12,"offset":1572},"end":{"line":27,"column":59,"offset":1619},"indent":[]}}],"position":{"start":{"line":27,"column":3,"offset":1563},"end":{"line":27,"column":59,"offset":1619},"indent":[]}}],"position":{"start":{"line":27,"column":1,"offset":1561},"end":{"line":27,"column":59,"offset":1619},"indent":[]}},{"type":"listItem","spread":false,"checked":null,"children":[{"type":"paragraph","children":[{"type":"inlineCode","value":"guild","position":{"start":{"line":28,"column":3,"offset":1622},"end":{"line":28,"column":10,"offset":1629},"indent":[]}},{"type":"text","value":": The server guild object where this command was ran.","position":{"start":{"line":28,"column":10,"offset":1629},"end":{"line":28,"column":63,"offset":1682},"indent":[]}}],"position":{"start":{"line":28,"column":3,"offset":1622},"end":{"line":28,"column":63,"offset":1682},"indent":[]}}],"position":{"start":{"line":28,"column":1,"offset":1620},"end":{"line":28,"column":63,"offset":1682},"indent":[]}}],"position":{"start":{"line":26,"column":1,"offset":1501},"end":{"line":28,"column":63,"offset":1682},"indent":[1,1]}},{"type":"heading","depth":2,"children":[{"type":"text","value":"Understanding How Inhibitors Function","position":{"start":{"line":30,"column":4,"offset":1687},"end":{"line":30,"column":41,"offset":1724},"indent":[]}}],"position":{"start":{"line":30,"column":1,"offset":1684},"end":{"line":30,"column":41,"offset":1724},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"To block a command you have to return a truthy value.","position":{"start":{"line":32,"column":1,"offset":1726},"end":{"line":32,"column":54,"offset":1779},"indent":[]}}],"position":{"start":{"line":32,"column":1,"offset":1726},"end":{"line":32,"column":54,"offset":1779},"indent":[]}},{"type":"list","ordered":false,"start":null,"spread":false,"children":[{"type":"listItem","spread":false,"checked":null,"children":[{"type":"paragraph","children":[{"type":"strong","children":[{"type":"text","value":"return true;","position":{"start":{"line":33,"column":5,"offset":1784},"end":{"line":33,"column":17,"offset":1796},"indent":[]}}],"position":{"start":{"line":33,"column":3,"offset":1782},"end":{"line":33,"column":19,"offset":1798},"indent":[]}},{"type":"text","value":" If you return true the inhibitor will block the execution of the command.\nTo allow a command return a falsey value.","position":{"start":{"line":33,"column":19,"offset":1798},"end":{"line":34,"column":42,"offset":1914},"indent":[1]}}],"position":{"start":{"line":33,"column":3,"offset":1782},"end":{"line":34,"column":42,"offset":1914},"indent":[1]}}],"position":{"start":{"line":33,"column":1,"offset":1780},"end":{"line":34,"column":42,"offset":1914},"indent":[1]}},{"type":"listItem","spread":false,"checked":null,"children":[{"type":"paragraph","children":[{"type":"strong","children":[{"type":"text","value":"return false;","position":{"start":{"line":35,"column":5,"offset":1919},"end":{"line":35,"column":18,"offset":1932},"indent":[]}}],"position":{"start":{"line":35,"column":3,"offset":1917},"end":{"line":35,"column":20,"offset":1934},"indent":[]}},{"type":"text","value":" If you return false the inhibitor will not block the error.","position":{"start":{"line":35,"column":20,"offset":1934},"end":{"line":35,"column":80,"offset":1994},"indent":[]}}],"position":{"start":{"line":35,"column":3,"offset":1917},"end":{"line":35,"column":80,"offset":1994},"indent":[]}}],"position":{"start":{"line":35,"column":1,"offset":1915},"end":{"line":35,"column":80,"offset":1994},"indent":[]}}],"position":{"start":{"line":33,"column":1,"offset":1780},"end":{"line":35,"column":80,"offset":1994},"indent":[1,1]}},{"type":"code","lang":"ts","meta":null,"value":"// If the command is not VIP only we can allow this command to execute\nif (!command.boosted) return false;\n\n// Check if the user has boosted this server\nconst userIsVIP = await isUserVIP(message.author.id)\n// The user is VIP so we can allow this command to be used\nif (userIsVIP) return false;\n\n// The user is NOT VIP so we throw an error\nthrow `The ${command.name} is only allowed for VIP users.`","position":{"start":{"line":38,"column":1,"offset":1997},"end":{"line":49,"column":4,"offset":2404},"indent":[1,1,1,1,1,1,1,1,1,1,1]}},{"type":"export","value":"export const _frontmatter = {\"title\":\"Creating Inhibitors!\",\"metaTitle\":\"Creating An Inhibitor | Discordeno\",\"metaDescription\":\"Let's create our very own bot with Discordeno!\"}","position":{"start":{"line":52,"column":1,"offset":2407},"end":{"line":52,"column":177,"offset":2583},"indent":[]}}],"position":{"start":{"line":1,"column":1,"offset":0},"end":{"line":52,"column":177,"offset":2583}}},"scopeImports":["import * as React from 'react'"],"scopeIdentifiers":["React"],"body":"function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }\n\nfunction _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }\n\nfunction _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }\n\n/* @jsx mdx */\nvar _frontmatter = {\n \"title\": \"Creating Inhibitors!\",\n \"metaTitle\": \"Creating An Inhibitor | Discordeno\",\n \"metaDescription\": \"Let's create our very own bot with Discordeno!\"\n};\nvar layoutProps = {\n _frontmatter: _frontmatter\n};\nvar MDXLayout = \"wrapper\";\nreturn function MDXContent(_ref) {\n var components = _ref.components,\n props = _objectWithoutProperties(_ref, [\"components\"]);\n\n return mdx(MDXLayout, _extends({}, layoutProps, props, {\n components: components,\n mdxType: \"MDXLayout\"\n }), mdx(\"p\", null, \"Woah! You are almost half way done with understanding all of Discordeno. Amazing isn't it? Something you may have noticed in the last section was there were some options that prevented some commands from running like \", mdx(\"inlineCode\", {\n parentName: \"p\"\n }, \"dmOnly\"), \" or the permission options. we created a setting to prevent the monitor from running in certain channels. What if we wanted to do prevent commands from happening? How would we prevent commands from running?\"), mdx(\"h2\", null, \"What is an Inhibitor?\"), mdx(\"p\", null, \"An Inhibitor is very similar to how monitors work. A monitor runs on every message but an inhibitor runs on every command. Remember all those command options like cooldown, permissions, permissionLevel, nsfw, etc... Each and every one of these options has an inhibitor in that checks commands for these settings.\"), mdx(\"p\", null, \"Let's create our own inhibitor that would prevent commands from being used if the user is not a VIP user.\"), mdx(\"blockquote\", null, mdx(\"p\", {\n parentName: \"blockquote\"\n }, mdx(\"strong\", {\n parentName: \"p\"\n }, \"Note:\"), \" It is important to remember that everything below can be done with a simple permission level as well. We will create our own custom permission levels but for the purposes of this guide and to be able to learn about Inhibitors, we will be using an inhibitor.\")), mdx(\"h2\", null, \"Creating the File\"), mdx(\"p\", null, \"Let's start by creating a file inside the inhibitors folder called \", mdx(\"inlineCode\", {\n parentName: \"p\"\n }, \"boosted.ts\"), \" and paste the following snippet of code:\"), mdx(\"pre\", null, mdx(\"code\", _extends({\n parentName: \"pre\"\n }, {\n \"className\": \"language-ts\"\n }), \"import { botCache } from \\\"../../mod.ts\\\";\\n\\nbotCache.inhibitors.set(\\\"inhibitorname\\\", async function (message, command, guild) {\\n // Your code goes here\\n});\\n\")), mdx(\"p\", null, \"Inhibitors can take up to 3 arguments.\"), mdx(\"ul\", null, mdx(\"li\", {\n parentName: \"ul\"\n }, mdx(\"inlineCode\", {\n parentName: \"li\"\n }, \"message\"), \": The message object that triggered the command.\"), mdx(\"li\", {\n parentName: \"ul\"\n }, mdx(\"inlineCode\", {\n parentName: \"li\"\n }, \"command\"), \": The command object itself that was triggered.\"), mdx(\"li\", {\n parentName: \"ul\"\n }, mdx(\"inlineCode\", {\n parentName: \"li\"\n }, \"guild\"), \": The server guild object where this command was ran.\")), mdx(\"h2\", null, \"Understanding How Inhibitors Function\"), mdx(\"p\", null, \"To block a command you have to return a truthy value.\"), mdx(\"ul\", null, mdx(\"li\", {\n parentName: \"ul\"\n }, mdx(\"strong\", {\n parentName: \"li\"\n }, \"return true;\"), \" If you return true the inhibitor will block the execution of the command.\\nTo allow a command return a falsey value.\"), mdx(\"li\", {\n parentName: \"ul\"\n }, mdx(\"strong\", {\n parentName: \"li\"\n }, \"return false;\"), \" If you return false the inhibitor will not block the error.\")), mdx(\"pre\", null, mdx(\"code\", _extends({\n parentName: \"pre\"\n }, {\n \"className\": \"language-ts\"\n }), \"// If the command is not VIP only we can allow this command to execute\\nif (!command.boosted) return false;\\n\\n// Check if the user has boosted this server\\nconst userIsVIP = await isUserVIP(message.author.id)\\n// The user is VIP so we can allow this command to be used\\nif (userIsVIP) return false;\\n\\n// The user is NOT VIP so we throw an error\\nthrow `The ${command.name} is only allowed for VIP users.`\\n\")));\n}\n;\nMDXContent.isMDXComponent = true;","rawMDXOutput":"/* @jsx mdx */\nimport { mdx } from '@mdx-js/react';\n/* @jsx mdx */\n\nexport const _frontmatter = {\n \"title\": \"Creating Inhibitors!\",\n \"metaTitle\": \"Creating An Inhibitor | Discordeno\",\n \"metaDescription\": \"Let's create our very own bot with Discordeno!\"\n};\n\nconst layoutProps = {\n _frontmatter\n};\nconst MDXLayout = \"wrapper\"\nexport default function MDXContent({\n components,\n ...props\n}) {\n return \n

{`Woah! You are almost half way done with understanding all of Discordeno. Amazing isn't it? Something you may have noticed in the last section was there were some options that prevented some commands from running like `}{`dmOnly`}{` or the permission options. we created a setting to prevent the monitor from running in certain channels. What if we wanted to do prevent commands from happening? How would we prevent commands from running?`}

\n

{`What is an Inhibitor?`}

\n

{`An Inhibitor is very similar to how monitors work. A monitor runs on every message but an inhibitor runs on every command. Remember all those command options like cooldown, permissions, permissionLevel, nsfw, etc... Each and every one of these options has an inhibitor in that checks commands for these settings.`}

\n

{`Let's create our own inhibitor that would prevent commands from being used if the user is not a VIP user.`}

\n
\n

{`Note:`}{` It is important to remember that everything below can be done with a simple permission level as well. We will create our own custom permission levels but for the purposes of this guide and to be able to learn about Inhibitors, we will be using an inhibitor.`}

\n
\n

{`Creating the File`}

\n

{`Let's start by creating a file inside the inhibitors folder called `}{`boosted.ts`}{` and paste the following snippet of code:`}

\n
{`import { botCache } from \"../../mod.ts\";\n\nbotCache.inhibitors.set(\"inhibitorname\", async function (message, command, guild) {\n    // Your code goes here\n});\n`}
\n

{`Inhibitors can take up to 3 arguments.`}

\n
    \n
  • {`message`}{`: The message object that triggered the command.`}
  • \n
  • {`command`}{`: The command object itself that was triggered.`}
  • \n
  • {`guild`}{`: The server guild object where this command was ran.`}
  • \n
\n

{`Understanding How Inhibitors Function`}

\n

{`To block a command you have to return a truthy value.`}

\n
    \n
  • {`return true;`}{` If you return true the inhibitor will block the execution of the command.\nTo allow a command return a falsey value.`}
  • \n
  • {`return false;`}{` If you return false the inhibitor will not block the error.`}
  • \n
\n
{`// If the command is not VIP only we can allow this command to execute\nif (!command.boosted) return false;\n\n// Check if the user has boosted this server\nconst userIsVIP = await isUserVIP(message.author.id)\n// The user is VIP so we can allow this command to be used\nif (userIsVIP) return false;\n\n// The user is NOT VIP so we throw an error\nthrow \\`The \\${command.name} is only allowed for VIP users.\\`\n`}
\n\n
;\n}\n\n;\nMDXContent.isMDXComponent = true;"}} \ No newline at end of file diff --git a/docs/.cache/caches/gatsby-plugin-mdx/diskstore-87866b163bfadfadae9de8a1f7eda544.json b/docs/.cache/caches/gatsby-plugin-mdx/diskstore-87866b163bfadfadae9de8a1f7eda544.json new file mode 100644 index 000000000..073d43472 --- /dev/null +++ b/docs/.cache/caches/gatsby-plugin-mdx/diskstore-87866b163bfadfadae9de8a1f7eda544.json @@ -0,0 +1 @@ +{"expireTime":9007200851634831000,"key":"gatsby-plugin-mdx-entire-payload-2b2f64fc3f9cbb7ae7e6b82811307e5a-","val":{"mdast":{"type":"root","children":[{"type":"paragraph","children":[{"type":"text","value":"Woah! You are almost half way done with understanding all of Discordeno. Amazing isn't it? Something you may have noticed in the last section was there were some options that prevented some commands from running like ","position":{"start":{"line":2,"column":1,"offset":1},"end":{"line":2,"column":218,"offset":218},"indent":[]}},{"type":"inlineCode","value":"dmOnly","position":{"start":{"line":2,"column":218,"offset":218},"end":{"line":2,"column":226,"offset":226},"indent":[]}},{"type":"text","value":" or the permission options. we created a setting to prevent the monitor from running in certain channels. What if we wanted to do prevent commands from happening? How would we prevent commands from running?","position":{"start":{"line":2,"column":226,"offset":226},"end":{"line":2,"column":432,"offset":432},"indent":[]}}],"position":{"start":{"line":2,"column":1,"offset":1},"end":{"line":2,"column":432,"offset":432},"indent":[]}},{"type":"heading","depth":2,"children":[{"type":"text","value":"What is an Inhibitor?","position":{"start":{"line":4,"column":4,"offset":437},"end":{"line":4,"column":25,"offset":458},"indent":[]}}],"position":{"start":{"line":4,"column":1,"offset":434},"end":{"line":4,"column":25,"offset":458},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"An Inhibitor is very similar to how monitors work. A monitor runs on every message but an inhibitor runs on every command. Remember all those command options like cooldown, permissions, permissionLevel, nsfw, etc... Each and every one of these options has an inhibitor in that checks commands for these settings.","position":{"start":{"line":6,"column":1,"offset":460},"end":{"line":6,"column":313,"offset":772},"indent":[]}}],"position":{"start":{"line":6,"column":1,"offset":460},"end":{"line":6,"column":313,"offset":772},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"Let's create our own inhibitor that would prevent commands from being used if the user is not a VIP user.","position":{"start":{"line":8,"column":1,"offset":774},"end":{"line":8,"column":106,"offset":879},"indent":[]}}],"position":{"start":{"line":8,"column":1,"offset":774},"end":{"line":8,"column":106,"offset":879},"indent":[]}},{"type":"blockquote","children":[{"type":"paragraph","children":[{"type":"strong","children":[{"type":"text","value":"Note:","position":{"start":{"line":10,"column":5,"offset":885},"end":{"line":10,"column":10,"offset":890},"indent":[]}}],"position":{"start":{"line":10,"column":3,"offset":883},"end":{"line":10,"column":12,"offset":892},"indent":[]}},{"type":"text","value":" It is important to remember that everything below can be done with a simple permission level as well. We will create our own custom permission levels but for the purposes of this guide and to be able to learn about Inhibitors, we will be using an inhibitor.","position":{"start":{"line":10,"column":12,"offset":892},"end":{"line":10,"column":270,"offset":1150},"indent":[]}}],"position":{"start":{"line":10,"column":3,"offset":883},"end":{"line":10,"column":270,"offset":1150},"indent":[]}}],"position":{"start":{"line":10,"column":1,"offset":881},"end":{"line":10,"column":270,"offset":1150},"indent":[]}},{"type":"heading","depth":2,"children":[{"type":"text","value":"Creating the File","position":{"start":{"line":12,"column":4,"offset":1155},"end":{"line":12,"column":21,"offset":1172},"indent":[]}}],"position":{"start":{"line":12,"column":1,"offset":1152},"end":{"line":12,"column":21,"offset":1172},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"Let's start by creating a file inside the inhibitors folder called ","position":{"start":{"line":14,"column":1,"offset":1174},"end":{"line":14,"column":68,"offset":1241},"indent":[]}},{"type":"inlineCode","value":"boosted.ts","position":{"start":{"line":14,"column":68,"offset":1241},"end":{"line":14,"column":80,"offset":1253},"indent":[]}},{"type":"text","value":" and paste the following snippet of code:","position":{"start":{"line":14,"column":80,"offset":1253},"end":{"line":14,"column":121,"offset":1294},"indent":[]}}],"position":{"start":{"line":14,"column":1,"offset":1174},"end":{"line":14,"column":121,"offset":1294},"indent":[]}},{"type":"code","lang":"ts","meta":null,"value":"import { botCache } from \"../../mod.ts\";\n\nbotCache.inhibitors.set(\"inhibitorname\", async function (message, command, guild) {\n\t// Your code goes here\n});","position":{"start":{"line":16,"column":1,"offset":1296},"end":{"line":22,"column":4,"offset":1459},"indent":[1,1,1,1,1,1]}},{"type":"paragraph","children":[{"type":"text","value":"Inhibitors can take up to 3 arguments.","position":{"start":{"line":24,"column":1,"offset":1461},"end":{"line":24,"column":39,"offset":1499},"indent":[]}}],"position":{"start":{"line":24,"column":1,"offset":1461},"end":{"line":24,"column":39,"offset":1499},"indent":[]}},{"type":"list","ordered":false,"start":null,"spread":false,"children":[{"type":"listItem","spread":false,"checked":null,"children":[{"type":"paragraph","children":[{"type":"inlineCode","value":"message","position":{"start":{"line":26,"column":3,"offset":1503},"end":{"line":26,"column":12,"offset":1512},"indent":[]}},{"type":"text","value":": The message object that triggered the command.","position":{"start":{"line":26,"column":12,"offset":1512},"end":{"line":26,"column":60,"offset":1560},"indent":[]}}],"position":{"start":{"line":26,"column":3,"offset":1503},"end":{"line":26,"column":60,"offset":1560},"indent":[]}}],"position":{"start":{"line":26,"column":1,"offset":1501},"end":{"line":26,"column":60,"offset":1560},"indent":[]}},{"type":"listItem","spread":false,"checked":null,"children":[{"type":"paragraph","children":[{"type":"inlineCode","value":"command","position":{"start":{"line":27,"column":3,"offset":1563},"end":{"line":27,"column":12,"offset":1572},"indent":[]}},{"type":"text","value":": The command object itself that was triggered.","position":{"start":{"line":27,"column":12,"offset":1572},"end":{"line":27,"column":59,"offset":1619},"indent":[]}}],"position":{"start":{"line":27,"column":3,"offset":1563},"end":{"line":27,"column":59,"offset":1619},"indent":[]}}],"position":{"start":{"line":27,"column":1,"offset":1561},"end":{"line":27,"column":59,"offset":1619},"indent":[]}},{"type":"listItem","spread":false,"checked":null,"children":[{"type":"paragraph","children":[{"type":"inlineCode","value":"guild","position":{"start":{"line":28,"column":3,"offset":1622},"end":{"line":28,"column":10,"offset":1629},"indent":[]}},{"type":"text","value":": The server guild object where this command was ran.","position":{"start":{"line":28,"column":10,"offset":1629},"end":{"line":28,"column":63,"offset":1682},"indent":[]}}],"position":{"start":{"line":28,"column":3,"offset":1622},"end":{"line":28,"column":63,"offset":1682},"indent":[]}}],"position":{"start":{"line":28,"column":1,"offset":1620},"end":{"line":28,"column":63,"offset":1682},"indent":[]}}],"position":{"start":{"line":26,"column":1,"offset":1501},"end":{"line":28,"column":63,"offset":1682},"indent":[1,1]}},{"type":"heading","depth":2,"children":[{"type":"text","value":"Understanding How Inhibitors Function","position":{"start":{"line":30,"column":4,"offset":1687},"end":{"line":30,"column":41,"offset":1724},"indent":[]}}],"position":{"start":{"line":30,"column":1,"offset":1684},"end":{"line":30,"column":41,"offset":1724},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"To block a command you have to return a truthy value.","position":{"start":{"line":32,"column":1,"offset":1726},"end":{"line":32,"column":54,"offset":1779},"indent":[]}}],"position":{"start":{"line":32,"column":1,"offset":1726},"end":{"line":32,"column":54,"offset":1779},"indent":[]}},{"type":"list","ordered":false,"start":null,"spread":false,"children":[{"type":"listItem","spread":false,"checked":null,"children":[{"type":"paragraph","children":[{"type":"strong","children":[{"type":"text","value":"return true;","position":{"start":{"line":33,"column":5,"offset":1784},"end":{"line":33,"column":17,"offset":1796},"indent":[]}}],"position":{"start":{"line":33,"column":3,"offset":1782},"end":{"line":33,"column":19,"offset":1798},"indent":[]}},{"type":"text","value":" If you return true the inhibitor will block the execution of the command.\nTo allow a command return a falsey value.","position":{"start":{"line":33,"column":19,"offset":1798},"end":{"line":34,"column":42,"offset":1914},"indent":[1]}}],"position":{"start":{"line":33,"column":3,"offset":1782},"end":{"line":34,"column":42,"offset":1914},"indent":[1]}}],"position":{"start":{"line":33,"column":1,"offset":1780},"end":{"line":34,"column":42,"offset":1914},"indent":[1]}},{"type":"listItem","spread":false,"checked":null,"children":[{"type":"paragraph","children":[{"type":"strong","children":[{"type":"text","value":"return false;","position":{"start":{"line":35,"column":5,"offset":1919},"end":{"line":35,"column":18,"offset":1932},"indent":[]}}],"position":{"start":{"line":35,"column":3,"offset":1917},"end":{"line":35,"column":20,"offset":1934},"indent":[]}},{"type":"text","value":" If you return false the inhibitor will not block the error.","position":{"start":{"line":35,"column":20,"offset":1934},"end":{"line":35,"column":80,"offset":1994},"indent":[]}}],"position":{"start":{"line":35,"column":3,"offset":1917},"end":{"line":35,"column":80,"offset":1994},"indent":[]}}],"position":{"start":{"line":35,"column":1,"offset":1915},"end":{"line":35,"column":80,"offset":1994},"indent":[]}}],"position":{"start":{"line":33,"column":1,"offset":1780},"end":{"line":35,"column":80,"offset":1994},"indent":[1,1]}},{"type":"code","lang":"ts","meta":null,"value":"// If the command is not VIP only we can allow this command to execute\nif (!command.vipOnly) return false;\n\n// The bot's support server\nconst guild = cache.guilds.get(configs.supportServerID);\n// If the command author is not in the server they won't have the vip role\nconst member = guild.members.get(message.author.id) || await getMember(guild.id, message.author.id);\n// Member doesn't exist so cancel the command\nif (!member) {\n\tsendResponse(message, `sorry, but you can not use this command until you become VIP. **Close the IRIS!!!**`)\n\treturn true;\n}\n\n// If the user has the vip role on the support server given by patreon allow the command\nif (member.roles.includes(configs.roleIDs.patreonVIPRoleID)) return false;\n\n// Alert the user they don't have vip and can't use the command\nsendResponse(message, `sorry, but you can not use this command until you become a VIP. I'm sorry, Teal'c. We'll go to Disneyland next year. I promise.`)\n// Cancel the command since the user does not have vip\nreturn true;","position":{"start":{"line":38,"column":1,"offset":1997},"end":{"line":59,"column":4,"offset":3013},"indent":[1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1]}},{"type":"heading","depth":2,"children":[{"type":"text","value":"Challenges","position":{"start":{"line":61,"column":4,"offset":3018},"end":{"line":61,"column":14,"offset":3028},"indent":[]}}],"position":{"start":{"line":61,"column":1,"offset":3015},"end":{"line":61,"column":14,"offset":3028},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"Hell yes! We just got through the entire inhibitor section. You have now mastered everything related to inhibitors.","position":{"start":{"line":63,"column":1,"offset":3030},"end":{"line":63,"column":116,"offset":3145},"indent":[]}}],"position":{"start":{"line":63,"column":1,"offset":3030},"end":{"line":63,"column":116,"offset":3145},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"You can now try and get a little more practice with inhibitors by trying to challenge yourself and make your own inhibitors. Don't worry if you can't think of any good use cases for inhibitors.","position":{"start":{"line":65,"column":1,"offset":3147},"end":{"line":65,"column":194,"offset":3340},"indent":[]}}],"position":{"start":{"line":65,"column":1,"offset":3147},"end":{"line":65,"column":194,"offset":3340},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"Majority of Discordeno bots do not use many custom inhibitors because most of the necessary/important ones already come built for you in the inhibitors folder.","position":{"start":{"line":67,"column":1,"offset":3342},"end":{"line":67,"column":160,"offset":3501},"indent":[]}}],"position":{"start":{"line":67,"column":1,"offset":3342},"end":{"line":67,"column":160,"offset":3501},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"Next we will try ","position":{"start":{"line":69,"column":1,"offset":3503},"end":{"line":69,"column":18,"offset":3520},"indent":[]}}],"position":{"start":{"line":69,"column":1,"offset":3503},"end":{"line":69,"column":18,"offset":3520},"indent":[]}},{"type":"export","value":"export const _frontmatter = {\"title\":\"Creating Inhibitors!\",\"metaTitle\":\"Creating An Inhibitor | Discordeno\",\"metaDescription\":\"Let's create our very own bot with Discordeno!\"}","position":{"start":{"line":72,"column":1,"offset":3523},"end":{"line":72,"column":177,"offset":3699},"indent":[]}}],"position":{"start":{"line":1,"column":1,"offset":0},"end":{"line":72,"column":177,"offset":3699}}},"scopeImports":["import * as React from 'react'"],"scopeIdentifiers":["React"],"body":"function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }\n\nfunction _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }\n\nfunction _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }\n\n/* @jsx mdx */\nvar _frontmatter = {\n \"title\": \"Creating Inhibitors!\",\n \"metaTitle\": \"Creating An Inhibitor | Discordeno\",\n \"metaDescription\": \"Let's create our very own bot with Discordeno!\"\n};\nvar layoutProps = {\n _frontmatter: _frontmatter\n};\nvar MDXLayout = \"wrapper\";\nreturn function MDXContent(_ref) {\n var components = _ref.components,\n props = _objectWithoutProperties(_ref, [\"components\"]);\n\n return mdx(MDXLayout, _extends({}, layoutProps, props, {\n components: components,\n mdxType: \"MDXLayout\"\n }), mdx(\"p\", null, \"Woah! You are almost half way done with understanding all of Discordeno. Amazing isn't it? Something you may have noticed in the last section was there were some options that prevented some commands from running like \", mdx(\"inlineCode\", {\n parentName: \"p\"\n }, \"dmOnly\"), \" or the permission options. we created a setting to prevent the monitor from running in certain channels. What if we wanted to do prevent commands from happening? How would we prevent commands from running?\"), mdx(\"h2\", null, \"What is an Inhibitor?\"), mdx(\"p\", null, \"An Inhibitor is very similar to how monitors work. A monitor runs on every message but an inhibitor runs on every command. Remember all those command options like cooldown, permissions, permissionLevel, nsfw, etc... Each and every one of these options has an inhibitor in that checks commands for these settings.\"), mdx(\"p\", null, \"Let's create our own inhibitor that would prevent commands from being used if the user is not a VIP user.\"), mdx(\"blockquote\", null, mdx(\"p\", {\n parentName: \"blockquote\"\n }, mdx(\"strong\", {\n parentName: \"p\"\n }, \"Note:\"), \" It is important to remember that everything below can be done with a simple permission level as well. We will create our own custom permission levels but for the purposes of this guide and to be able to learn about Inhibitors, we will be using an inhibitor.\")), mdx(\"h2\", null, \"Creating the File\"), mdx(\"p\", null, \"Let's start by creating a file inside the inhibitors folder called \", mdx(\"inlineCode\", {\n parentName: \"p\"\n }, \"boosted.ts\"), \" and paste the following snippet of code:\"), mdx(\"pre\", null, mdx(\"code\", _extends({\n parentName: \"pre\"\n }, {\n \"className\": \"language-ts\"\n }), \"import { botCache } from \\\"../../mod.ts\\\";\\n\\nbotCache.inhibitors.set(\\\"inhibitorname\\\", async function (message, command, guild) {\\n // Your code goes here\\n});\\n\")), mdx(\"p\", null, \"Inhibitors can take up to 3 arguments.\"), mdx(\"ul\", null, mdx(\"li\", {\n parentName: \"ul\"\n }, mdx(\"inlineCode\", {\n parentName: \"li\"\n }, \"message\"), \": The message object that triggered the command.\"), mdx(\"li\", {\n parentName: \"ul\"\n }, mdx(\"inlineCode\", {\n parentName: \"li\"\n }, \"command\"), \": The command object itself that was triggered.\"), mdx(\"li\", {\n parentName: \"ul\"\n }, mdx(\"inlineCode\", {\n parentName: \"li\"\n }, \"guild\"), \": The server guild object where this command was ran.\")), mdx(\"h2\", null, \"Understanding How Inhibitors Function\"), mdx(\"p\", null, \"To block a command you have to return a truthy value.\"), mdx(\"ul\", null, mdx(\"li\", {\n parentName: \"ul\"\n }, mdx(\"strong\", {\n parentName: \"li\"\n }, \"return true;\"), \" If you return true the inhibitor will block the execution of the command.\\nTo allow a command return a falsey value.\"), mdx(\"li\", {\n parentName: \"ul\"\n }, mdx(\"strong\", {\n parentName: \"li\"\n }, \"return false;\"), \" If you return false the inhibitor will not block the error.\")), mdx(\"pre\", null, mdx(\"code\", _extends({\n parentName: \"pre\"\n }, {\n \"className\": \"language-ts\"\n }), \"// If the command is not VIP only we can allow this command to execute\\nif (!command.vipOnly) return false;\\n\\n// The bot's support server\\nconst guild = cache.guilds.get(configs.supportServerID);\\n// If the command author is not in the server they won't have the vip role\\nconst member = guild.members.get(message.author.id) || await getMember(guild.id, message.author.id);\\n// Member doesn't exist so cancel the command\\nif (!member) {\\n sendResponse(message, `sorry, but you can not use this command until you become VIP. **Close the IRIS!!!**`)\\n return true;\\n}\\n\\n// If the user has the vip role on the support server given by patreon allow the command\\nif (member.roles.includes(configs.roleIDs.patreonVIPRoleID)) return false;\\n\\n// Alert the user they don't have vip and can't use the command\\nsendResponse(message, `sorry, but you can not use this command until you become a VIP. I'm sorry, Teal'c. We'll go to Disneyland next year. I promise.`)\\n// Cancel the command since the user does not have vip\\nreturn true;\\n\")), mdx(\"h2\", null, \"Challenges\"), mdx(\"p\", null, \"Hell yes! We just got through the entire inhibitor section. You have now mastered everything related to inhibitors.\"), mdx(\"p\", null, \"You can now try and get a little more practice with inhibitors by trying to challenge yourself and make your own inhibitors. Don't worry if you can't think of any good use cases for inhibitors.\"), mdx(\"p\", null, \"Majority of Discordeno bots do not use many custom inhibitors because most of the necessary/important ones already come built for you in the inhibitors folder.\"), mdx(\"p\", null, \"Next we will try \"));\n}\n;\nMDXContent.isMDXComponent = true;","rawMDXOutput":"/* @jsx mdx */\nimport { mdx } from '@mdx-js/react';\n/* @jsx mdx */\n\nexport const _frontmatter = {\n \"title\": \"Creating Inhibitors!\",\n \"metaTitle\": \"Creating An Inhibitor | Discordeno\",\n \"metaDescription\": \"Let's create our very own bot with Discordeno!\"\n};\n\nconst layoutProps = {\n _frontmatter\n};\nconst MDXLayout = \"wrapper\"\nexport default function MDXContent({\n components,\n ...props\n}) {\n return \n

{`Woah! You are almost half way done with understanding all of Discordeno. Amazing isn't it? Something you may have noticed in the last section was there were some options that prevented some commands from running like `}{`dmOnly`}{` or the permission options. we created a setting to prevent the monitor from running in certain channels. What if we wanted to do prevent commands from happening? How would we prevent commands from running?`}

\n

{`What is an Inhibitor?`}

\n

{`An Inhibitor is very similar to how monitors work. A monitor runs on every message but an inhibitor runs on every command. Remember all those command options like cooldown, permissions, permissionLevel, nsfw, etc... Each and every one of these options has an inhibitor in that checks commands for these settings.`}

\n

{`Let's create our own inhibitor that would prevent commands from being used if the user is not a VIP user.`}

\n
\n

{`Note:`}{` It is important to remember that everything below can be done with a simple permission level as well. We will create our own custom permission levels but for the purposes of this guide and to be able to learn about Inhibitors, we will be using an inhibitor.`}

\n
\n

{`Creating the File`}

\n

{`Let's start by creating a file inside the inhibitors folder called `}{`boosted.ts`}{` and paste the following snippet of code:`}

\n
{`import { botCache } from \"../../mod.ts\";\n\nbotCache.inhibitors.set(\"inhibitorname\", async function (message, command, guild) {\n    // Your code goes here\n});\n`}
\n

{`Inhibitors can take up to 3 arguments.`}

\n
    \n
  • {`message`}{`: The message object that triggered the command.`}
  • \n
  • {`command`}{`: The command object itself that was triggered.`}
  • \n
  • {`guild`}{`: The server guild object where this command was ran.`}
  • \n
\n

{`Understanding How Inhibitors Function`}

\n

{`To block a command you have to return a truthy value.`}

\n
    \n
  • {`return true;`}{` If you return true the inhibitor will block the execution of the command.\nTo allow a command return a falsey value.`}
  • \n
  • {`return false;`}{` If you return false the inhibitor will not block the error.`}
  • \n
\n
{`// If the command is not VIP only we can allow this command to execute\nif (!command.vipOnly) return false;\n\n// The bot's support server\nconst guild = cache.guilds.get(configs.supportServerID);\n// If the command author is not in the server they won't have the vip role\nconst member = guild.members.get(message.author.id) || await getMember(guild.id, message.author.id);\n// Member doesn't exist so cancel the command\nif (!member) {\n    sendResponse(message, \\`sorry, but you can not use this command until you become VIP. **Close the IRIS!!!**\\`)\n    return true;\n}\n\n// If the user has the vip role on the support server given by patreon allow the command\nif (member.roles.includes(configs.roleIDs.patreonVIPRoleID)) return false;\n\n// Alert the user they don't have vip and can't use the command\nsendResponse(message, \\`sorry, but you can not use this command until you become a VIP. I'm sorry, Teal'c. We'll go to Disneyland next year. I promise.\\`)\n// Cancel the command since the user does not have vip\nreturn true;\n`}
\n

{`Challenges`}

\n

{`Hell yes! We just got through the entire inhibitor section. You have now mastered everything related to inhibitors.`}

\n

{`You can now try and get a little more practice with inhibitors by trying to challenge yourself and make your own inhibitors. Don't worry if you can't think of any good use cases for inhibitors.`}

\n

{`Majority of Discordeno bots do not use many custom inhibitors because most of the necessary/important ones already come built for you in the inhibitors folder.`}

\n

{`Next we will try `}

\n\n
;\n}\n\n;\nMDXContent.isMDXComponent = true;"}} \ No newline at end of file diff --git a/docs/.cache/caches/gatsby-plugin-mdx/diskstore-882d2b403440aad428ee348925648524.json b/docs/.cache/caches/gatsby-plugin-mdx/diskstore-882d2b403440aad428ee348925648524.json new file mode 100644 index 000000000..72be05f75 --- /dev/null +++ b/docs/.cache/caches/gatsby-plugin-mdx/diskstore-882d2b403440aad428ee348925648524.json @@ -0,0 +1 @@ +{"expireTime":9007200851596121000,"key":"gatsby-plugin-mdx-entire-payload-8c9a3e7b594143799f0f3e7bc396b2a5-","val":{"mdast":{"type":"root","children":[{"type":"heading","depth":2,"children":[{"type":"text","value":"Understanding The Goals of This Guide","position":{"start":{"line":2,"column":4,"offset":4},"end":{"line":2,"column":41,"offset":41},"indent":[]}}],"position":{"start":{"line":2,"column":1,"offset":1},"end":{"line":2,"column":41,"offset":41},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"This guide is a step by step simple walkthrough meant for beginner developers but also can be quite useful for advanced developers to learn about Discordeno.","position":{"start":{"line":4,"column":1,"offset":43},"end":{"line":4,"column":158,"offset":200},"indent":[]}}],"position":{"start":{"line":4,"column":1,"offset":43},"end":{"line":4,"column":158,"offset":200},"indent":[]}},{"type":"export","value":"export const _frontmatter = {\"title\":\"Step By Step Guide\",\"metaTitle\":\"Step By Step Guide | Discordeno\",\"metaDescription\":\"This guide will help you learn every part of Discordeno, step by step to create your own bot as you wish.\"}","position":{"start":{"line":7,"column":1,"offset":203},"end":{"line":7,"column":231,"offset":433},"indent":[]}}],"position":{"start":{"line":1,"column":1,"offset":0},"end":{"line":7,"column":231,"offset":433}}},"scopeImports":["import * as React from 'react'"],"scopeIdentifiers":["React"],"body":"function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }\n\nfunction _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }\n\nfunction _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }\n\n/* @jsx mdx */\nvar _frontmatter = {\n \"title\": \"Step By Step Guide\",\n \"metaTitle\": \"Step By Step Guide | Discordeno\",\n \"metaDescription\": \"This guide will help you learn every part of Discordeno, step by step to create your own bot as you wish.\"\n};\nvar layoutProps = {\n _frontmatter: _frontmatter\n};\nvar MDXLayout = \"wrapper\";\nreturn function MDXContent(_ref) {\n var components = _ref.components,\n props = _objectWithoutProperties(_ref, [\"components\"]);\n\n return mdx(MDXLayout, _extends({}, layoutProps, props, {\n components: components,\n mdxType: \"MDXLayout\"\n }), mdx(\"h2\", null, \"Understanding The Goals of This Guide\"), mdx(\"p\", null, \"This guide is a step by step simple walkthrough meant for beginner developers but also can be quite useful for advanced developers to learn about Discordeno.\"));\n}\n;\nMDXContent.isMDXComponent = true;","rawMDXOutput":"/* @jsx mdx */\nimport { mdx } from '@mdx-js/react';\n/* @jsx mdx */\n\nexport const _frontmatter = {\n \"title\": \"Step By Step Guide\",\n \"metaTitle\": \"Step By Step Guide | Discordeno\",\n \"metaDescription\": \"This guide will help you learn every part of Discordeno, step by step to create your own bot as you wish.\"\n};\n\nconst layoutProps = {\n _frontmatter\n};\nconst MDXLayout = \"wrapper\"\nexport default function MDXContent({\n components,\n ...props\n}) {\n return \n

{`Understanding The Goals of This Guide`}

\n

{`This guide is a step by step simple walkthrough meant for beginner developers but also can be quite useful for advanced developers to learn about Discordeno.`}

\n\n
;\n}\n\n;\nMDXContent.isMDXComponent = true;"}} \ No newline at end of file diff --git a/docs/.cache/caches/gatsby-plugin-mdx/diskstore-89728c6b5a3c76f64e7b67015ef49029.json b/docs/.cache/caches/gatsby-plugin-mdx/diskstore-89728c6b5a3c76f64e7b67015ef49029.json new file mode 100644 index 000000000..c96b60644 --- /dev/null +++ b/docs/.cache/caches/gatsby-plugin-mdx/diskstore-89728c6b5a3c76f64e7b67015ef49029.json @@ -0,0 +1 @@ +{"expireTime":9007200851635348000,"key":"gatsby-plugin-mdx-entire-payload-6377ad9dbd4dc2bf221957b81d60d4d7-","val":{"mdast":{"type":"root","children":[{"type":"paragraph","children":[{"type":"text","value":"Woah! You are almost half way done with understanding all of Discordeno. Amazing isn't it? Something you may have noticed in the last section was when the bot started up you could see a bunch of messages like ","position":{"start":{"line":2,"column":1,"offset":1},"end":{"line":2,"column":210,"offset":210},"indent":[]}},{"type":"inlineCode","value":"Loaded X Commands","position":{"start":{"line":2,"column":210,"offset":210},"end":{"line":2,"column":229,"offset":229},"indent":[]}},{"type":"text","value":" and such. Let's jump into this part now and understand how event handling works in Discordeno.","position":{"start":{"line":2,"column":229,"offset":229},"end":{"line":2,"column":324,"offset":324},"indent":[]}}],"position":{"start":{"line":2,"column":1,"offset":1},"end":{"line":2,"column":324,"offset":324},"indent":[]}},{"type":"heading","depth":2,"children":[{"type":"text","value":"What Is An Event?","position":{"start":{"line":4,"column":4,"offset":329},"end":{"line":4,"column":21,"offset":346},"indent":[]}}],"position":{"start":{"line":4,"column":1,"offset":326},"end":{"line":4,"column":21,"offset":346},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"An event in Discordeno is a function that can be called when a specific event occurs. For the most part, events will usually be the ones that are available from Discordeno. However, you can create your own custom events as well if you wish.","position":{"start":{"line":6,"column":1,"offset":348},"end":{"line":6,"column":241,"offset":588},"indent":[]}}],"position":{"start":{"line":6,"column":1,"offset":348},"end":{"line":6,"column":241,"offset":588},"indent":[]}},{"type":"heading","depth":2,"children":[{"type":"text","value":"Creating The File","position":{"start":{"line":8,"column":4,"offset":593},"end":{"line":8,"column":21,"offset":610},"indent":[]}}],"position":{"start":{"line":8,"column":1,"offset":590},"end":{"line":8,"column":21,"offset":610},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"Make a new file in the events folder called ","position":{"start":{"line":10,"column":1,"offset":612},"end":{"line":10,"column":45,"offset":656},"indent":[]}},{"type":"inlineCode","value":"discordLog.ts","position":{"start":{"line":10,"column":45,"offset":656},"end":{"line":10,"column":60,"offset":671},"indent":[]}},{"type":"text","value":" that will send a message to a discord channel whenever we get an error so we don't need to always be watching the console to see errors. Once you made the file, go ahead and paste the base event snippet below.","position":{"start":{"line":10,"column":60,"offset":671},"end":{"line":10,"column":270,"offset":881},"indent":[]}}],"position":{"start":{"line":10,"column":1,"offset":612},"end":{"line":10,"column":270,"offset":881},"indent":[]}},{"type":"code","lang":"ts","meta":null,"value":"import { botCache } from \"../../mod.ts\";\nimport { cache } from \"https://raw.githubusercontent.com/Skillz4Killz/Discordeno/v7/src/utils/cache.ts\";\nimport logger from \"https://raw.githubusercontent.com/Skillz4Killz/Discordeno/v7/src/utils/logger.ts\";\n\nbotCache.eventHandlers.ready = function () {\n // Your code goes here\n};\n","position":{"start":{"line":13,"column":1,"offset":884},"end":{"line":22,"column":4,"offset":1217},"indent":[1,1,1,1,1,1,1,1,1]}},{"type":"export","value":"export const _frontmatter = {\"title\":\"Creating Events!\",\"metaTitle\":\"Creating An Event | Discordeno\",\"metaDescription\":\"Let's create our very own bot with Discordeno!\"}","position":{"start":{"line":25,"column":1,"offset":1220},"end":{"line":25,"column":169,"offset":1388},"indent":[]}}],"position":{"start":{"line":1,"column":1,"offset":0},"end":{"line":25,"column":169,"offset":1388}}},"scopeImports":["import * as React from 'react'"],"scopeIdentifiers":["React"],"body":"function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }\n\nfunction _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }\n\nfunction _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }\n\n/* @jsx mdx */\nvar _frontmatter = {\n \"title\": \"Creating Events!\",\n \"metaTitle\": \"Creating An Event | Discordeno\",\n \"metaDescription\": \"Let's create our very own bot with Discordeno!\"\n};\nvar layoutProps = {\n _frontmatter: _frontmatter\n};\nvar MDXLayout = \"wrapper\";\nreturn function MDXContent(_ref) {\n var components = _ref.components,\n props = _objectWithoutProperties(_ref, [\"components\"]);\n\n return mdx(MDXLayout, _extends({}, layoutProps, props, {\n components: components,\n mdxType: \"MDXLayout\"\n }), mdx(\"p\", null, \"Woah! You are almost half way done with understanding all of Discordeno. Amazing isn't it? Something you may have noticed in the last section was when the bot started up you could see a bunch of messages like \", mdx(\"inlineCode\", {\n parentName: \"p\"\n }, \"Loaded X Commands\"), \" and such. Let's jump into this part now and understand how event handling works in Discordeno.\"), mdx(\"h2\", null, \"What Is An Event?\"), mdx(\"p\", null, \"An event in Discordeno is a function that can be called when a specific event occurs. For the most part, events will usually be the ones that are available from Discordeno. However, you can create your own custom events as well if you wish.\"), mdx(\"h2\", null, \"Creating The File\"), mdx(\"p\", null, \"Make a new file in the events folder called \", mdx(\"inlineCode\", {\n parentName: \"p\"\n }, \"discordLog.ts\"), \" that will send a message to a discord channel whenever we get an error so we don't need to always be watching the console to see errors. Once you made the file, go ahead and paste the base event snippet below.\"), mdx(\"pre\", null, mdx(\"code\", _extends({\n parentName: \"pre\"\n }, {\n \"className\": \"language-ts\"\n }), \"import { botCache } from \\\"../../mod.ts\\\";\\nimport { cache } from \\\"https://raw.githubusercontent.com/Skillz4Killz/Discordeno/v7/src/utils/cache.ts\\\";\\nimport logger from \\\"https://raw.githubusercontent.com/Skillz4Killz/Discordeno/v7/src/utils/logger.ts\\\";\\n\\nbotCache.eventHandlers.ready = function () {\\n // Your code goes here\\n};\\n\\n\")));\n}\n;\nMDXContent.isMDXComponent = true;","rawMDXOutput":"/* @jsx mdx */\nimport { mdx } from '@mdx-js/react';\n/* @jsx mdx */\n\nexport const _frontmatter = {\n \"title\": \"Creating Events!\",\n \"metaTitle\": \"Creating An Event | Discordeno\",\n \"metaDescription\": \"Let's create our very own bot with Discordeno!\"\n};\n\nconst layoutProps = {\n _frontmatter\n};\nconst MDXLayout = \"wrapper\"\nexport default function MDXContent({\n components,\n ...props\n}) {\n return \n

{`Woah! You are almost half way done with understanding all of Discordeno. Amazing isn't it? Something you may have noticed in the last section was when the bot started up you could see a bunch of messages like `}{`Loaded X Commands`}{` and such. Let's jump into this part now and understand how event handling works in Discordeno.`}

\n

{`What Is An Event?`}

\n

{`An event in Discordeno is a function that can be called when a specific event occurs. For the most part, events will usually be the ones that are available from Discordeno. However, you can create your own custom events as well if you wish.`}

\n

{`Creating The File`}

\n

{`Make a new file in the events folder called `}{`discordLog.ts`}{` that will send a message to a discord channel whenever we get an error so we don't need to always be watching the console to see errors. Once you made the file, go ahead and paste the base event snippet below.`}

\n
{`import { botCache } from \"../../mod.ts\";\nimport { cache } from \"https://raw.githubusercontent.com/Skillz4Killz/Discordeno/v7/src/utils/cache.ts\";\nimport logger from \"https://raw.githubusercontent.com/Skillz4Killz/Discordeno/v7/src/utils/logger.ts\";\n\nbotCache.eventHandlers.ready = function () {\n  // Your code goes here\n};\n\n`}
\n\n
;\n}\n\n;\nMDXContent.isMDXComponent = true;"}} \ No newline at end of file diff --git a/docs/.cache/caches/gatsby-plugin-mdx/diskstore-8ab466bafaeed6004ebcce705e3ac5ea.json b/docs/.cache/caches/gatsby-plugin-mdx/diskstore-8ab466bafaeed6004ebcce705e3ac5ea.json new file mode 100644 index 000000000..769365bae --- /dev/null +++ b/docs/.cache/caches/gatsby-plugin-mdx/diskstore-8ab466bafaeed6004ebcce705e3ac5ea.json @@ -0,0 +1 @@ +{"expireTime":9007200851634143000,"key":"gatsby-plugin-mdx-entire-payload-18711f8004a1aa04f7285bb9721401df-","val":{"mdast":{"type":"root","children":[{"type":"paragraph","children":[{"type":"text","value":"Woah! You are almost half way done with understanding all of Discordeno. Amazing isn't it? Something you may have noticed in the last section was there were some options that prevented some commands from running like ","position":{"start":{"line":2,"column":1,"offset":1},"end":{"line":2,"column":218,"offset":218},"indent":[]}},{"type":"inlineCode","value":"dmOnly","position":{"start":{"line":2,"column":218,"offset":218},"end":{"line":2,"column":226,"offset":226},"indent":[]}},{"type":"text","value":" or the permission options. we created a setting to prevent the monitor from running in certain channels. What if we wanted to do prevent commands from happening? How would we prevent commands from running?","position":{"start":{"line":2,"column":226,"offset":226},"end":{"line":2,"column":432,"offset":432},"indent":[]}}],"position":{"start":{"line":2,"column":1,"offset":1},"end":{"line":2,"column":432,"offset":432},"indent":[]}},{"type":"heading","depth":2,"children":[{"type":"text","value":"What is an Inhibitor?","position":{"start":{"line":4,"column":4,"offset":437},"end":{"line":4,"column":25,"offset":458},"indent":[]}}],"position":{"start":{"line":4,"column":1,"offset":434},"end":{"line":4,"column":25,"offset":458},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"An Inhibitor is very similar to how monitors work. A monitor runs on every message but an inhibitor runs on every command. Remember all those command options like cooldown, permissions, permissionLevel, nsfw, etc... Each and every one of these options has an inhibitor in that checks commands for these settings.","position":{"start":{"line":6,"column":1,"offset":460},"end":{"line":6,"column":313,"offset":772},"indent":[]}}],"position":{"start":{"line":6,"column":1,"offset":460},"end":{"line":6,"column":313,"offset":772},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"Let's create our own inhibitor that would prevent commands from being used if the user is not a VIP user.","position":{"start":{"line":8,"column":1,"offset":774},"end":{"line":8,"column":106,"offset":879},"indent":[]}}],"position":{"start":{"line":8,"column":1,"offset":774},"end":{"line":8,"column":106,"offset":879},"indent":[]}},{"type":"blockquote","children":[{"type":"paragraph","children":[{"type":"strong","children":[{"type":"text","value":"Note:","position":{"start":{"line":10,"column":5,"offset":885},"end":{"line":10,"column":10,"offset":890},"indent":[]}}],"position":{"start":{"line":10,"column":3,"offset":883},"end":{"line":10,"column":12,"offset":892},"indent":[]}},{"type":"text","value":" It is important to remember that everything below can be done with a simple permission level as well. We will create our own custom permission levels but for the purposes of this guide and to be able to learn about Inhibitors, we will be using an inhibitor.","position":{"start":{"line":10,"column":12,"offset":892},"end":{"line":10,"column":270,"offset":1150},"indent":[]}}],"position":{"start":{"line":10,"column":3,"offset":883},"end":{"line":10,"column":270,"offset":1150},"indent":[]}}],"position":{"start":{"line":10,"column":1,"offset":881},"end":{"line":10,"column":270,"offset":1150},"indent":[]}},{"type":"heading","depth":2,"children":[{"type":"text","value":"Creating the File","position":{"start":{"line":12,"column":4,"offset":1155},"end":{"line":12,"column":21,"offset":1172},"indent":[]}}],"position":{"start":{"line":12,"column":1,"offset":1152},"end":{"line":12,"column":21,"offset":1172},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"Let's start by creating a file inside the inhibitors folder called ","position":{"start":{"line":14,"column":1,"offset":1174},"end":{"line":14,"column":68,"offset":1241},"indent":[]}},{"type":"inlineCode","value":"boosted.ts","position":{"start":{"line":14,"column":68,"offset":1241},"end":{"line":14,"column":80,"offset":1253},"indent":[]}},{"type":"text","value":" and paste the following snippet of code:","position":{"start":{"line":14,"column":80,"offset":1253},"end":{"line":14,"column":121,"offset":1294},"indent":[]}}],"position":{"start":{"line":14,"column":1,"offset":1174},"end":{"line":14,"column":121,"offset":1294},"indent":[]}},{"type":"code","lang":"ts","meta":null,"value":"import { botCache } from \"../../mod.ts\";\n\nbotCache.inhibitors.set(\"inhibitorname\", async function (message, command, guild) {\n\t// Your code goes here\n});","position":{"start":{"line":16,"column":1,"offset":1296},"end":{"line":22,"column":4,"offset":1459},"indent":[1,1,1,1,1,1]}},{"type":"paragraph","children":[{"type":"text","value":"Inhibitors can take up to 3 arguments.","position":{"start":{"line":24,"column":1,"offset":1461},"end":{"line":24,"column":39,"offset":1499},"indent":[]}}],"position":{"start":{"line":24,"column":1,"offset":1461},"end":{"line":24,"column":39,"offset":1499},"indent":[]}},{"type":"list","ordered":false,"start":null,"spread":false,"children":[{"type":"listItem","spread":false,"checked":null,"children":[{"type":"paragraph","children":[{"type":"inlineCode","value":"message","position":{"start":{"line":26,"column":3,"offset":1503},"end":{"line":26,"column":12,"offset":1512},"indent":[]}},{"type":"text","value":": The message object that triggered the command.","position":{"start":{"line":26,"column":12,"offset":1512},"end":{"line":26,"column":60,"offset":1560},"indent":[]}}],"position":{"start":{"line":26,"column":3,"offset":1503},"end":{"line":26,"column":60,"offset":1560},"indent":[]}}],"position":{"start":{"line":26,"column":1,"offset":1501},"end":{"line":26,"column":60,"offset":1560},"indent":[]}},{"type":"listItem","spread":false,"checked":null,"children":[{"type":"paragraph","children":[{"type":"inlineCode","value":"command","position":{"start":{"line":27,"column":3,"offset":1563},"end":{"line":27,"column":12,"offset":1572},"indent":[]}},{"type":"text","value":": The command object itself that was triggered.","position":{"start":{"line":27,"column":12,"offset":1572},"end":{"line":27,"column":59,"offset":1619},"indent":[]}}],"position":{"start":{"line":27,"column":3,"offset":1563},"end":{"line":27,"column":59,"offset":1619},"indent":[]}}],"position":{"start":{"line":27,"column":1,"offset":1561},"end":{"line":27,"column":59,"offset":1619},"indent":[]}},{"type":"listItem","spread":false,"checked":null,"children":[{"type":"paragraph","children":[{"type":"inlineCode","value":"guild","position":{"start":{"line":28,"column":3,"offset":1622},"end":{"line":28,"column":10,"offset":1629},"indent":[]}},{"type":"text","value":": The server guild object where this command was ran.","position":{"start":{"line":28,"column":10,"offset":1629},"end":{"line":28,"column":63,"offset":1682},"indent":[]}}],"position":{"start":{"line":28,"column":3,"offset":1622},"end":{"line":28,"column":63,"offset":1682},"indent":[]}}],"position":{"start":{"line":28,"column":1,"offset":1620},"end":{"line":28,"column":63,"offset":1682},"indent":[]}}],"position":{"start":{"line":26,"column":1,"offset":1501},"end":{"line":28,"column":63,"offset":1682},"indent":[1,1]}},{"type":"heading","depth":2,"children":[{"type":"text","value":"Understanding How Inhibitors Function","position":{"start":{"line":30,"column":4,"offset":1687},"end":{"line":30,"column":41,"offset":1724},"indent":[]}}],"position":{"start":{"line":30,"column":1,"offset":1684},"end":{"line":30,"column":41,"offset":1724},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"To block a command you have to return a truthy value.","position":{"start":{"line":32,"column":1,"offset":1726},"end":{"line":32,"column":54,"offset":1779},"indent":[]}}],"position":{"start":{"line":32,"column":1,"offset":1726},"end":{"line":32,"column":54,"offset":1779},"indent":[]}},{"type":"list","ordered":false,"start":null,"spread":false,"children":[{"type":"listItem","spread":false,"checked":null,"children":[{"type":"paragraph","children":[{"type":"strong","children":[{"type":"text","value":"return true;","position":{"start":{"line":33,"column":5,"offset":1784},"end":{"line":33,"column":17,"offset":1796},"indent":[]}}],"position":{"start":{"line":33,"column":3,"offset":1782},"end":{"line":33,"column":19,"offset":1798},"indent":[]}},{"type":"text","value":" If you return true the inhibitor will block the execution of the command.\nTo allow a command return a falsey value.","position":{"start":{"line":33,"column":19,"offset":1798},"end":{"line":34,"column":42,"offset":1914},"indent":[1]}}],"position":{"start":{"line":33,"column":3,"offset":1782},"end":{"line":34,"column":42,"offset":1914},"indent":[1]}}],"position":{"start":{"line":33,"column":1,"offset":1780},"end":{"line":34,"column":42,"offset":1914},"indent":[1]}},{"type":"listItem","spread":false,"checked":null,"children":[{"type":"paragraph","children":[{"type":"strong","children":[{"type":"text","value":"return false;","position":{"start":{"line":35,"column":5,"offset":1919},"end":{"line":35,"column":18,"offset":1932},"indent":[]}}],"position":{"start":{"line":35,"column":3,"offset":1917},"end":{"line":35,"column":20,"offset":1934},"indent":[]}},{"type":"text","value":" If you return false the inhibitor will not block the error.","position":{"start":{"line":35,"column":20,"offset":1934},"end":{"line":35,"column":80,"offset":1994},"indent":[]}}],"position":{"start":{"line":35,"column":3,"offset":1917},"end":{"line":35,"column":80,"offset":1994},"indent":[]}}],"position":{"start":{"line":35,"column":1,"offset":1915},"end":{"line":35,"column":80,"offset":1994},"indent":[]}}],"position":{"start":{"line":33,"column":1,"offset":1780},"end":{"line":35,"column":80,"offset":1994},"indent":[1,1]}},{"type":"code","lang":"ts","meta":null,"value":"// If the command is not VIP only we can allow this command to execute\nif (!command.vipOnly) return false;\n\n// The bot's support server\nconst guild = cache.guilds.get(configs.supportServerID);\n// The command author \nconst\n// Check if the user has the vip role on the support server given by patreon\nconst userIsVIP = await isUserVIP(message.author.id)\n// The user is VIP so we can allow this command to be used\nif (userIsVIP) return false;\n\n// The user is NOT VIP so we throw an error\nthrow `The ${command.name} is only allowed for VIP users.`","position":{"start":{"line":38,"column":1,"offset":1997},"end":{"line":53,"column":4,"offset":2550},"indent":[1,1,1,1,1,1,1,1,1,1,1,1,1,1,1]}},{"type":"export","value":"export const _frontmatter = {\"title\":\"Creating Inhibitors!\",\"metaTitle\":\"Creating An Inhibitor | Discordeno\",\"metaDescription\":\"Let's create our very own bot with Discordeno!\"}","position":{"start":{"line":56,"column":1,"offset":2553},"end":{"line":56,"column":177,"offset":2729},"indent":[]}}],"position":{"start":{"line":1,"column":1,"offset":0},"end":{"line":56,"column":177,"offset":2729}}},"scopeImports":["import * as React from 'react'"],"scopeIdentifiers":["React"],"body":"function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }\n\nfunction _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }\n\nfunction _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }\n\n/* @jsx mdx */\nvar _frontmatter = {\n \"title\": \"Creating Inhibitors!\",\n \"metaTitle\": \"Creating An Inhibitor | Discordeno\",\n \"metaDescription\": \"Let's create our very own bot with Discordeno!\"\n};\nvar layoutProps = {\n _frontmatter: _frontmatter\n};\nvar MDXLayout = \"wrapper\";\nreturn function MDXContent(_ref) {\n var components = _ref.components,\n props = _objectWithoutProperties(_ref, [\"components\"]);\n\n return mdx(MDXLayout, _extends({}, layoutProps, props, {\n components: components,\n mdxType: \"MDXLayout\"\n }), mdx(\"p\", null, \"Woah! You are almost half way done with understanding all of Discordeno. Amazing isn't it? Something you may have noticed in the last section was there were some options that prevented some commands from running like \", mdx(\"inlineCode\", {\n parentName: \"p\"\n }, \"dmOnly\"), \" or the permission options. we created a setting to prevent the monitor from running in certain channels. What if we wanted to do prevent commands from happening? How would we prevent commands from running?\"), mdx(\"h2\", null, \"What is an Inhibitor?\"), mdx(\"p\", null, \"An Inhibitor is very similar to how monitors work. A monitor runs on every message but an inhibitor runs on every command. Remember all those command options like cooldown, permissions, permissionLevel, nsfw, etc... Each and every one of these options has an inhibitor in that checks commands for these settings.\"), mdx(\"p\", null, \"Let's create our own inhibitor that would prevent commands from being used if the user is not a VIP user.\"), mdx(\"blockquote\", null, mdx(\"p\", {\n parentName: \"blockquote\"\n }, mdx(\"strong\", {\n parentName: \"p\"\n }, \"Note:\"), \" It is important to remember that everything below can be done with a simple permission level as well. We will create our own custom permission levels but for the purposes of this guide and to be able to learn about Inhibitors, we will be using an inhibitor.\")), mdx(\"h2\", null, \"Creating the File\"), mdx(\"p\", null, \"Let's start by creating a file inside the inhibitors folder called \", mdx(\"inlineCode\", {\n parentName: \"p\"\n }, \"boosted.ts\"), \" and paste the following snippet of code:\"), mdx(\"pre\", null, mdx(\"code\", _extends({\n parentName: \"pre\"\n }, {\n \"className\": \"language-ts\"\n }), \"import { botCache } from \\\"../../mod.ts\\\";\\n\\nbotCache.inhibitors.set(\\\"inhibitorname\\\", async function (message, command, guild) {\\n // Your code goes here\\n});\\n\")), mdx(\"p\", null, \"Inhibitors can take up to 3 arguments.\"), mdx(\"ul\", null, mdx(\"li\", {\n parentName: \"ul\"\n }, mdx(\"inlineCode\", {\n parentName: \"li\"\n }, \"message\"), \": The message object that triggered the command.\"), mdx(\"li\", {\n parentName: \"ul\"\n }, mdx(\"inlineCode\", {\n parentName: \"li\"\n }, \"command\"), \": The command object itself that was triggered.\"), mdx(\"li\", {\n parentName: \"ul\"\n }, mdx(\"inlineCode\", {\n parentName: \"li\"\n }, \"guild\"), \": The server guild object where this command was ran.\")), mdx(\"h2\", null, \"Understanding How Inhibitors Function\"), mdx(\"p\", null, \"To block a command you have to return a truthy value.\"), mdx(\"ul\", null, mdx(\"li\", {\n parentName: \"ul\"\n }, mdx(\"strong\", {\n parentName: \"li\"\n }, \"return true;\"), \" If you return true the inhibitor will block the execution of the command.\\nTo allow a command return a falsey value.\"), mdx(\"li\", {\n parentName: \"ul\"\n }, mdx(\"strong\", {\n parentName: \"li\"\n }, \"return false;\"), \" If you return false the inhibitor will not block the error.\")), mdx(\"pre\", null, mdx(\"code\", _extends({\n parentName: \"pre\"\n }, {\n \"className\": \"language-ts\"\n }), \"// If the command is not VIP only we can allow this command to execute\\nif (!command.vipOnly) return false;\\n\\n// The bot's support server\\nconst guild = cache.guilds.get(configs.supportServerID);\\n// The command author \\nconst\\n// Check if the user has the vip role on the support server given by patreon\\nconst userIsVIP = await isUserVIP(message.author.id)\\n// The user is VIP so we can allow this command to be used\\nif (userIsVIP) return false;\\n\\n// The user is NOT VIP so we throw an error\\nthrow `The ${command.name} is only allowed for VIP users.`\\n\")));\n}\n;\nMDXContent.isMDXComponent = true;","rawMDXOutput":"/* @jsx mdx */\nimport { mdx } from '@mdx-js/react';\n/* @jsx mdx */\n\nexport const _frontmatter = {\n \"title\": \"Creating Inhibitors!\",\n \"metaTitle\": \"Creating An Inhibitor | Discordeno\",\n \"metaDescription\": \"Let's create our very own bot with Discordeno!\"\n};\n\nconst layoutProps = {\n _frontmatter\n};\nconst MDXLayout = \"wrapper\"\nexport default function MDXContent({\n components,\n ...props\n}) {\n return \n

{`Woah! You are almost half way done with understanding all of Discordeno. Amazing isn't it? Something you may have noticed in the last section was there were some options that prevented some commands from running like `}{`dmOnly`}{` or the permission options. we created a setting to prevent the monitor from running in certain channels. What if we wanted to do prevent commands from happening? How would we prevent commands from running?`}

\n

{`What is an Inhibitor?`}

\n

{`An Inhibitor is very similar to how monitors work. A monitor runs on every message but an inhibitor runs on every command. Remember all those command options like cooldown, permissions, permissionLevel, nsfw, etc... Each and every one of these options has an inhibitor in that checks commands for these settings.`}

\n

{`Let's create our own inhibitor that would prevent commands from being used if the user is not a VIP user.`}

\n
\n

{`Note:`}{` It is important to remember that everything below can be done with a simple permission level as well. We will create our own custom permission levels but for the purposes of this guide and to be able to learn about Inhibitors, we will be using an inhibitor.`}

\n
\n

{`Creating the File`}

\n

{`Let's start by creating a file inside the inhibitors folder called `}{`boosted.ts`}{` and paste the following snippet of code:`}

\n
{`import { botCache } from \"../../mod.ts\";\n\nbotCache.inhibitors.set(\"inhibitorname\", async function (message, command, guild) {\n    // Your code goes here\n});\n`}
\n

{`Inhibitors can take up to 3 arguments.`}

\n
    \n
  • {`message`}{`: The message object that triggered the command.`}
  • \n
  • {`command`}{`: The command object itself that was triggered.`}
  • \n
  • {`guild`}{`: The server guild object where this command was ran.`}
  • \n
\n

{`Understanding How Inhibitors Function`}

\n

{`To block a command you have to return a truthy value.`}

\n
    \n
  • {`return true;`}{` If you return true the inhibitor will block the execution of the command.\nTo allow a command return a falsey value.`}
  • \n
  • {`return false;`}{` If you return false the inhibitor will not block the error.`}
  • \n
\n
{`// If the command is not VIP only we can allow this command to execute\nif (!command.vipOnly) return false;\n\n// The bot's support server\nconst guild = cache.guilds.get(configs.supportServerID);\n// The command author \nconst\n// Check if the user has the vip role on the support server given by patreon\nconst userIsVIP = await isUserVIP(message.author.id)\n// The user is VIP so we can allow this command to be used\nif (userIsVIP) return false;\n\n// The user is NOT VIP so we throw an error\nthrow \\`The \\${command.name} is only allowed for VIP users.\\`\n`}
\n\n
;\n}\n\n;\nMDXContent.isMDXComponent = true;"}} \ No newline at end of file diff --git a/docs/.cache/caches/gatsby-plugin-mdx/diskstore-8aeb0fbdcf116e02eda4d7ad64a6cd22.json b/docs/.cache/caches/gatsby-plugin-mdx/diskstore-8aeb0fbdcf116e02eda4d7ad64a6cd22.json new file mode 100644 index 000000000..f8445017d --- /dev/null +++ b/docs/.cache/caches/gatsby-plugin-mdx/diskstore-8aeb0fbdcf116e02eda4d7ad64a6cd22.json @@ -0,0 +1 @@ +{"expireTime":9007200851635178000,"key":"gatsby-plugin-mdx-entire-payload-6dfc1888a9601605e97d9c0219ddd9c6-","val":{"mdast":{"type":"root","children":[{"type":"paragraph","children":[{"type":"text","value":"Woah! You are almost half way done with understanding all of Discordeno. Amazing isn't it? Something you may have noticed in the last section was when the bot started up you could see a bunch of messages like ","position":{"start":{"line":2,"column":1,"offset":1},"end":{"line":2,"column":210,"offset":210},"indent":[]}},{"type":"inlineCode","value":"Loaded X Commands","position":{"start":{"line":2,"column":210,"offset":210},"end":{"line":2,"column":229,"offset":229},"indent":[]}},{"type":"text","value":" and such. Let's jump into this part now and understand how event handling works in Discordeno.","position":{"start":{"line":2,"column":229,"offset":229},"end":{"line":2,"column":324,"offset":324},"indent":[]}}],"position":{"start":{"line":2,"column":1,"offset":1},"end":{"line":2,"column":324,"offset":324},"indent":[]}},{"type":"heading","depth":2,"children":[{"type":"text","value":"What Is An Event?","position":{"start":{"line":4,"column":4,"offset":329},"end":{"line":4,"column":21,"offset":346},"indent":[]}}],"position":{"start":{"line":4,"column":1,"offset":326},"end":{"line":4,"column":21,"offset":346},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"An event in Discordeno is a function that can be called when a specific event occurs. ","position":{"start":{"line":6,"column":1,"offset":348},"end":{"line":6,"column":87,"offset":434},"indent":[]}}],"position":{"start":{"line":6,"column":1,"offset":348},"end":{"line":6,"column":87,"offset":434},"indent":[]}},{"type":"export","value":"export const _frontmatter = {\"title\":\"Creating Events!\",\"metaTitle\":\"Creating An Event | Discordeno\",\"metaDescription\":\"Let's create our very own bot with Discordeno!\"}","position":{"start":{"line":9,"column":1,"offset":437},"end":{"line":9,"column":169,"offset":605},"indent":[]}}],"position":{"start":{"line":1,"column":1,"offset":0},"end":{"line":9,"column":169,"offset":605}}},"scopeImports":["import * as React from 'react'"],"scopeIdentifiers":["React"],"body":"function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }\n\nfunction _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }\n\nfunction _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }\n\n/* @jsx mdx */\nvar _frontmatter = {\n \"title\": \"Creating Events!\",\n \"metaTitle\": \"Creating An Event | Discordeno\",\n \"metaDescription\": \"Let's create our very own bot with Discordeno!\"\n};\nvar layoutProps = {\n _frontmatter: _frontmatter\n};\nvar MDXLayout = \"wrapper\";\nreturn function MDXContent(_ref) {\n var components = _ref.components,\n props = _objectWithoutProperties(_ref, [\"components\"]);\n\n return mdx(MDXLayout, _extends({}, layoutProps, props, {\n components: components,\n mdxType: \"MDXLayout\"\n }), mdx(\"p\", null, \"Woah! You are almost half way done with understanding all of Discordeno. Amazing isn't it? Something you may have noticed in the last section was when the bot started up you could see a bunch of messages like \", mdx(\"inlineCode\", {\n parentName: \"p\"\n }, \"Loaded X Commands\"), \" and such. Let's jump into this part now and understand how event handling works in Discordeno.\"), mdx(\"h2\", null, \"What Is An Event?\"), mdx(\"p\", null, \"An event in Discordeno is a function that can be called when a specific event occurs. \"));\n}\n;\nMDXContent.isMDXComponent = true;","rawMDXOutput":"/* @jsx mdx */\nimport { mdx } from '@mdx-js/react';\n/* @jsx mdx */\n\nexport const _frontmatter = {\n \"title\": \"Creating Events!\",\n \"metaTitle\": \"Creating An Event | Discordeno\",\n \"metaDescription\": \"Let's create our very own bot with Discordeno!\"\n};\n\nconst layoutProps = {\n _frontmatter\n};\nconst MDXLayout = \"wrapper\"\nexport default function MDXContent({\n components,\n ...props\n}) {\n return \n

{`Woah! You are almost half way done with understanding all of Discordeno. Amazing isn't it? Something you may have noticed in the last section was when the bot started up you could see a bunch of messages like `}{`Loaded X Commands`}{` and such. Let's jump into this part now and understand how event handling works in Discordeno.`}

\n

{`What Is An Event?`}

\n

{`An event in Discordeno is a function that can be called when a specific event occurs. `}

\n\n
;\n}\n\n;\nMDXContent.isMDXComponent = true;"}} \ No newline at end of file diff --git a/docs/.cache/caches/gatsby-plugin-mdx/diskstore-8cd370ab88b3e8bdb0d05df678c0c157.json b/docs/.cache/caches/gatsby-plugin-mdx/diskstore-8cd370ab88b3e8bdb0d05df678c0c157.json new file mode 100644 index 000000000..12e23dd33 --- /dev/null +++ b/docs/.cache/caches/gatsby-plugin-mdx/diskstore-8cd370ab88b3e8bdb0d05df678c0c157.json @@ -0,0 +1 @@ +{"expireTime":9007200851635308000,"key":"gatsby-plugin-mdx-entire-payload-fab22586be54928252737b9da10e6c7d-","val":{"mdast":{"type":"root","children":[{"type":"paragraph","children":[{"type":"text","value":"Woah! You are almost half way done with understanding all of Discordeno. Amazing isn't it? Something you may have noticed in the last section was when the bot started up you could see a bunch of messages like ","position":{"start":{"line":2,"column":1,"offset":1},"end":{"line":2,"column":210,"offset":210},"indent":[]}},{"type":"inlineCode","value":"Loaded X Commands","position":{"start":{"line":2,"column":210,"offset":210},"end":{"line":2,"column":229,"offset":229},"indent":[]}},{"type":"text","value":" and such. Let's jump into this part now and understand how event handling works in Discordeno.","position":{"start":{"line":2,"column":229,"offset":229},"end":{"line":2,"column":324,"offset":324},"indent":[]}}],"position":{"start":{"line":2,"column":1,"offset":1},"end":{"line":2,"column":324,"offset":324},"indent":[]}},{"type":"heading","depth":2,"children":[{"type":"text","value":"What Is An Event?","position":{"start":{"line":4,"column":4,"offset":329},"end":{"line":4,"column":21,"offset":346},"indent":[]}}],"position":{"start":{"line":4,"column":1,"offset":326},"end":{"line":4,"column":21,"offset":346},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"An event in Discordeno is a function that can be called when a specific event occurs. For the most part, events will usually be the ones that are available from Discordeno. However, you can create your own custom events as well if you wish.","position":{"start":{"line":6,"column":1,"offset":348},"end":{"line":6,"column":241,"offset":588},"indent":[]}}],"position":{"start":{"line":6,"column":1,"offset":348},"end":{"line":6,"column":241,"offset":588},"indent":[]}},{"type":"heading","depth":2,"children":[{"type":"text","value":"Creating The File","position":{"start":{"line":8,"column":4,"offset":593},"end":{"line":8,"column":21,"offset":610},"indent":[]}}],"position":{"start":{"line":8,"column":1,"offset":590},"end":{"line":8,"column":21,"offset":610},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"Make a new file in the events folder called `discordLog.js that will send a message to a discord channel whenever we get an error so we don't need to always be watching the console to see errors. Once you made the file, go ahead and paste the base event snippet below.","position":{"start":{"line":10,"column":1,"offset":612},"end":{"line":10,"column":269,"offset":880},"indent":[]}}],"position":{"start":{"line":10,"column":1,"offset":612},"end":{"line":10,"column":269,"offset":880},"indent":[]}},{"type":"export","value":"export const _frontmatter = {\"title\":\"Creating Events!\",\"metaTitle\":\"Creating An Event | Discordeno\",\"metaDescription\":\"Let's create our very own bot with Discordeno!\"}","position":{"start":{"line":13,"column":1,"offset":883},"end":{"line":13,"column":169,"offset":1051},"indent":[]}}],"position":{"start":{"line":1,"column":1,"offset":0},"end":{"line":13,"column":169,"offset":1051}}},"scopeImports":["import * as React from 'react'"],"scopeIdentifiers":["React"],"body":"function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }\n\nfunction _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }\n\nfunction _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }\n\n/* @jsx mdx */\nvar _frontmatter = {\n \"title\": \"Creating Events!\",\n \"metaTitle\": \"Creating An Event | Discordeno\",\n \"metaDescription\": \"Let's create our very own bot with Discordeno!\"\n};\nvar layoutProps = {\n _frontmatter: _frontmatter\n};\nvar MDXLayout = \"wrapper\";\nreturn function MDXContent(_ref) {\n var components = _ref.components,\n props = _objectWithoutProperties(_ref, [\"components\"]);\n\n return mdx(MDXLayout, _extends({}, layoutProps, props, {\n components: components,\n mdxType: \"MDXLayout\"\n }), mdx(\"p\", null, \"Woah! You are almost half way done with understanding all of Discordeno. Amazing isn't it? Something you may have noticed in the last section was when the bot started up you could see a bunch of messages like \", mdx(\"inlineCode\", {\n parentName: \"p\"\n }, \"Loaded X Commands\"), \" and such. Let's jump into this part now and understand how event handling works in Discordeno.\"), mdx(\"h2\", null, \"What Is An Event?\"), mdx(\"p\", null, \"An event in Discordeno is a function that can be called when a specific event occurs. For the most part, events will usually be the ones that are available from Discordeno. However, you can create your own custom events as well if you wish.\"), mdx(\"h2\", null, \"Creating The File\"), mdx(\"p\", null, \"Make a new file in the events folder called `discordLog.js that will send a message to a discord channel whenever we get an error so we don't need to always be watching the console to see errors. Once you made the file, go ahead and paste the base event snippet below.\"));\n}\n;\nMDXContent.isMDXComponent = true;","rawMDXOutput":"/* @jsx mdx */\nimport { mdx } from '@mdx-js/react';\n/* @jsx mdx */\n\nexport const _frontmatter = {\n \"title\": \"Creating Events!\",\n \"metaTitle\": \"Creating An Event | Discordeno\",\n \"metaDescription\": \"Let's create our very own bot with Discordeno!\"\n};\n\nconst layoutProps = {\n _frontmatter\n};\nconst MDXLayout = \"wrapper\"\nexport default function MDXContent({\n components,\n ...props\n}) {\n return \n

{`Woah! You are almost half way done with understanding all of Discordeno. Amazing isn't it? Something you may have noticed in the last section was when the bot started up you could see a bunch of messages like `}{`Loaded X Commands`}{` and such. Let's jump into this part now and understand how event handling works in Discordeno.`}

\n

{`What Is An Event?`}

\n

{`An event in Discordeno is a function that can be called when a specific event occurs. For the most part, events will usually be the ones that are available from Discordeno. However, you can create your own custom events as well if you wish.`}

\n

{`Creating The File`}

\n

{`Make a new file in the events folder called \\`discordLog.js that will send a message to a discord channel whenever we get an error so we don't need to always be watching the console to see errors. Once you made the file, go ahead and paste the base event snippet below.`}

\n\n
;\n}\n\n;\nMDXContent.isMDXComponent = true;"}} \ No newline at end of file diff --git a/docs/.cache/caches/gatsby-plugin-mdx/diskstore-8f37e5fb91e478272a82b22be8349649.json b/docs/.cache/caches/gatsby-plugin-mdx/diskstore-8f37e5fb91e478272a82b22be8349649.json new file mode 100644 index 000000000..ea4963265 --- /dev/null +++ b/docs/.cache/caches/gatsby-plugin-mdx/diskstore-8f37e5fb91e478272a82b22be8349649.json @@ -0,0 +1 @@ +{"expireTime":9007200851644210000,"key":"gatsby-plugin-mdx-entire-payload-0d41038ba5a996a23fbcc51e045cf497-","val":{"mdast":{"type":"root","children":[{"type":"paragraph","children":[{"type":"text","value":"Discordeno will help make Discord bot development much easier. Don't worry, as you go through this guide it will make a lot more sense.","position":{"start":{"line":2,"column":1,"offset":1},"end":{"line":2,"column":136,"offset":136},"indent":[]}}],"position":{"start":{"line":2,"column":1,"offset":1},"end":{"line":2,"column":136,"offset":136},"indent":[]}},{"type":"heading","depth":2,"children":[{"type":"text","value":"Creating The Bot!","position":{"start":{"line":4,"column":4,"offset":141},"end":{"line":4,"column":21,"offset":158},"indent":[]}}],"position":{"start":{"line":4,"column":1,"offset":138},"end":{"line":4,"column":21,"offset":158},"indent":[]}},{"type":"blockquote","children":[{"type":"paragraph","children":[{"type":"text","value":"This guide is going to assume you already have the basic requirements to make a bot ready. This includes github, git, a code editor like Visual Studio Code. If you don't have these yet please prepare them first before going forward.","position":{"start":{"line":6,"column":3,"offset":162},"end":{"line":6,"column":235,"offset":394},"indent":[]}}],"position":{"start":{"line":6,"column":3,"offset":162},"end":{"line":6,"column":235,"offset":394},"indent":[]}}],"position":{"start":{"line":6,"column":1,"offset":160},"end":{"line":6,"column":235,"offset":394},"indent":[]}},{"type":"list","ordered":false,"start":null,"spread":true,"children":[{"type":"listItem","spread":false,"checked":null,"children":[{"type":"paragraph","children":[{"type":"text","value":"First, create a Discordeno Bot using the ","position":{"start":{"line":8,"column":3,"offset":398},"end":{"line":8,"column":44,"offset":439},"indent":[]}},{"type":"link","title":null,"url":"https://github.com/Skillz4Killz/Discordeno-bot-template","children":[{"type":"text","value":"Generator Boilerplate","position":{"start":{"line":8,"column":45,"offset":440},"end":{"line":8,"column":66,"offset":461},"indent":[]}}],"position":{"start":{"line":8,"column":44,"offset":439},"end":{"line":8,"column":124,"offset":519},"indent":[]}},{"type":"text","value":". Give it any name you like. For the purpose of this guide we will call it, Stargate.","position":{"start":{"line":8,"column":124,"offset":519},"end":{"line":8,"column":209,"offset":604},"indent":[]}}],"position":{"start":{"line":8,"column":3,"offset":398},"end":{"line":8,"column":209,"offset":604},"indent":[]}}],"position":{"start":{"line":8,"column":1,"offset":396},"end":{"line":9,"column":1,"offset":605},"indent":[1]}},{"type":"listItem","spread":false,"checked":null,"children":[{"type":"paragraph","children":[{"type":"text","value":"Then ","position":{"start":{"line":10,"column":3,"offset":608},"end":{"line":10,"column":8,"offset":613},"indent":[]}},{"type":"inlineCode","value":"git clone https://github.com/Skillz4Killz/Stargate.git","position":{"start":{"line":10,"column":8,"offset":613},"end":{"line":10,"column":64,"offset":669},"indent":[]}}],"position":{"start":{"line":10,"column":3,"offset":608},"end":{"line":10,"column":64,"offset":669},"indent":[]}}],"position":{"start":{"line":10,"column":1,"offset":606},"end":{"line":11,"column":1,"offset":670},"indent":[1]}},{"type":"listItem","spread":false,"checked":null,"children":[{"type":"paragraph","children":[{"type":"text","value":"When that is done, go ahead and open up the folder with VSC.","position":{"start":{"line":12,"column":3,"offset":673},"end":{"line":12,"column":63,"offset":733},"indent":[]}}],"position":{"start":{"line":12,"column":3,"offset":673},"end":{"line":12,"column":63,"offset":733},"indent":[]}}],"position":{"start":{"line":12,"column":1,"offset":671},"end":{"line":12,"column":63,"offset":733},"indent":[]}},{"type":"listItem","spread":false,"checked":null,"children":[{"type":"paragraph","children":[{"type":"text","value":"Create a new file called ","position":{"start":{"line":13,"column":3,"offset":736},"end":{"line":13,"column":28,"offset":761},"indent":[]}},{"type":"inlineCode","value":"configs.ts","position":{"start":{"line":13,"column":28,"offset":761},"end":{"line":13,"column":40,"offset":773},"indent":[]}},{"type":"text","value":". Open the ","position":{"start":{"line":13,"column":40,"offset":773},"end":{"line":13,"column":51,"offset":784},"indent":[]}},{"type":"inlineCode","value":"configs.example.ts","position":{"start":{"line":13,"column":51,"offset":784},"end":{"line":13,"column":71,"offset":804},"indent":[]}},{"type":"text","value":" file and copy everything over.","position":{"start":{"line":13,"column":71,"offset":804},"end":{"line":13,"column":102,"offset":835},"indent":[]}}],"position":{"start":{"line":13,"column":3,"offset":736},"end":{"line":13,"column":102,"offset":835},"indent":[]}}],"position":{"start":{"line":13,"column":1,"offset":734},"end":{"line":13,"column":102,"offset":835},"indent":[]}}],"position":{"start":{"line":8,"column":1,"offset":396},"end":{"line":13,"column":102,"offset":835},"indent":[1,1,1,1,1]}},{"type":"paragraph","children":[{"type":"text","value":"Let's take a minute to review all the options we have available to us.","position":{"start":{"line":15,"column":1,"offset":837},"end":{"line":15,"column":71,"offset":907},"indent":[]}}],"position":{"start":{"line":15,"column":1,"offset":837},"end":{"line":15,"column":71,"offset":907},"indent":[]}},{"type":"heading","depth":3,"children":[{"type":"text","value":"Configs File","position":{"start":{"line":17,"column":5,"offset":913},"end":{"line":17,"column":17,"offset":925},"indent":[]}}],"position":{"start":{"line":17,"column":1,"offset":909},"end":{"line":17,"column":17,"offset":925},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"The ","position":{"start":{"line":19,"column":1,"offset":927},"end":{"line":19,"column":5,"offset":931},"indent":[]}},{"type":"inlineCode","value":"configs.ts","position":{"start":{"line":19,"column":5,"offset":931},"end":{"line":19,"column":17,"offset":943},"indent":[]}},{"type":"text","value":" file is where you will keep all your secret info you don't want to share with anyone else. As long as ","position":{"start":{"line":19,"column":17,"offset":943},"end":{"line":19,"column":120,"offset":1046},"indent":[]}},{"type":"inlineCode","value":".gitignore","position":{"start":{"line":19,"column":120,"offset":1046},"end":{"line":19,"column":132,"offset":1058},"indent":[]}},{"type":"text","value":" file is ignoring configs.ts your configurations will be kept private!","position":{"start":{"line":19,"column":132,"offset":1058},"end":{"line":19,"column":202,"offset":1128},"indent":[]}}],"position":{"start":{"line":19,"column":1,"offset":927},"end":{"line":19,"column":202,"offset":1128},"indent":[]}},{"type":"code","lang":"ts","meta":null,"value":"// Step 1: Remove the `.example` from this file name so it is called `configs.ts`\n// Step 2: Add all your bot's information below. The only required one is token and prefix. NOTE: As long as `.gitignore` file is ignoring configs.ts your configurations will be kept private!\n// Step 3: Remove these comments if you like.\n\nexport const configs = {\n // Your bot token goes here\n token: \"\",\n // The default prefix for your bot. Don't worry guilds can change this later.\n prefix: \"!\",\n // This isn't required but you can add bot list api keys here.\n botListTokens: {\n DISCORD_BOT_ORG: \"\",\n BOTS_ON_DISCORD: \"\",\n DISCORD_BOT_LIST: \"\",\n BOTS_FOR_DISCORD: \"\",\n DISCORD_BOATS: \"\",\n DISCORD_BOTS_GG: \"\",\n DISCORD_BOTS_GROUP: \"\",\n },\n // This is the server id for your bot's main server where users can get help/support\n supportServerID: \"\",\n // These are channel ids that will enable some functionality\n channelIDs: {\n // When a translation is missing this is the channel you will be alerted in.\n missingTranslation: \"\",\n // When an error occurs, we will try and log it to this channel\n errorChannelID: \"\"\n },\n // These are the role ids that will enable some functionality.\n roleIDs: {\n // If you have a patreon set up you can add the patreon vip role id here.\n patreonVIPRoleID: \"\",\n },\n // These are the user ids that will enable some functionality.\n userIDs: {\n // The user ids for the support team\n botSupporters: [],\n // The user ids for the other devs on your team\n botDevs: [],\n // The user ids who have complete 100% access to your bot\n botOwners: []\n }\n};\n","position":{"start":{"line":21,"column":1,"offset":1130},"end":{"line":66,"column":4,"offset":2770},"indent":[1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1]}},{"type":"heading","depth":4,"children":[{"type":"text","value":"Token","position":{"start":{"line":68,"column":6,"offset":2777},"end":{"line":68,"column":11,"offset":2782},"indent":[]}}],"position":{"start":{"line":68,"column":1,"offset":2772},"end":{"line":68,"column":11,"offset":2782},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"First, add your bot token. This is ","position":{"start":{"line":70,"column":1,"offset":2784},"end":{"line":70,"column":36,"offset":2819},"indent":[]}},{"type":"strong","children":[{"type":"text","value":"required","position":{"start":{"line":70,"column":38,"offset":2821},"end":{"line":70,"column":46,"offset":2829},"indent":[]}}],"position":{"start":{"line":70,"column":36,"offset":2819},"end":{"line":70,"column":48,"offset":2831},"indent":[]}},{"type":"text","value":" for the bot to start. Review the ","position":{"start":{"line":70,"column":48,"offset":2831},"end":{"line":70,"column":82,"offset":2865},"indent":[]}},{"type":"link","title":null,"url":"https://discordeno.netlify.app/gettingstarted#creatingyourfirstdiscordbotapplication","children":[{"type":"text","value":"instructions","position":{"start":{"line":70,"column":83,"offset":2866},"end":{"line":70,"column":95,"offset":2878},"indent":[]}}],"position":{"start":{"line":70,"column":82,"offset":2865},"end":{"line":70,"column":182,"offset":2965},"indent":[]}},{"type":"text","value":" if you have not made your token yet.","position":{"start":{"line":70,"column":182,"offset":2965},"end":{"line":70,"column":219,"offset":3002},"indent":[]}}],"position":{"start":{"line":70,"column":1,"offset":2784},"end":{"line":70,"column":219,"offset":3002},"indent":[]}},{"type":"heading","depth":4,"children":[{"type":"text","value":"Prefix","position":{"start":{"line":72,"column":6,"offset":3009},"end":{"line":72,"column":12,"offset":3015},"indent":[]}}],"position":{"start":{"line":72,"column":1,"offset":3004},"end":{"line":72,"column":12,"offset":3015},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"The prefix is where you will set the default prefix for your bot. Don't worry, every server will be able to choose their own prefix but we need a default prefix to start.","position":{"start":{"line":74,"column":1,"offset":3017},"end":{"line":74,"column":171,"offset":3187},"indent":[]}}],"position":{"start":{"line":74,"column":1,"offset":3017},"end":{"line":74,"column":171,"offset":3187},"indent":[]}},{"type":"heading","depth":4,"children":[{"type":"text","value":"Bot Lists Tokens","position":{"start":{"line":76,"column":6,"offset":3194},"end":{"line":76,"column":22,"offset":3210},"indent":[]}}],"position":{"start":{"line":76,"column":1,"offset":3189},"end":{"line":76,"column":22,"offset":3210},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"This section of the file is so you can easily have your bot's statistics updated on all the bot lists out there to help you grow your bot. The code is already written to handle this but you will need to do 3 things for each bot list.","position":{"start":{"line":78,"column":1,"offset":3212},"end":{"line":78,"column":234,"offset":3445},"indent":[]}}],"position":{"start":{"line":78,"column":1,"offset":3212},"end":{"line":78,"column":234,"offset":3445},"indent":[]}},{"type":"list","ordered":true,"start":1,"spread":false,"children":[{"type":"listItem","spread":false,"checked":null,"children":[{"type":"paragraph","children":[{"type":"text","value":"Go to the bot list and add your bot to their website. (Each site has it's own instructions)","position":{"start":{"line":80,"column":4,"offset":3450},"end":{"line":80,"column":95,"offset":3541},"indent":[]}}],"position":{"start":{"line":80,"column":4,"offset":3450},"end":{"line":80,"column":95,"offset":3541},"indent":[]}}],"position":{"start":{"line":80,"column":1,"offset":3447},"end":{"line":80,"column":95,"offset":3541},"indent":[]}},{"type":"listItem","spread":false,"checked":null,"children":[{"type":"paragraph","children":[{"type":"text","value":"Create a token for yourself on each website and paste it in your configs.","position":{"start":{"line":81,"column":4,"offset":3545},"end":{"line":81,"column":77,"offset":3618},"indent":[]}}],"position":{"start":{"line":81,"column":4,"offset":3545},"end":{"line":81,"column":77,"offset":3618},"indent":[]}}],"position":{"start":{"line":81,"column":1,"offset":3542},"end":{"line":81,"column":77,"offset":3618},"indent":[]}},{"type":"listItem","spread":false,"checked":null,"children":[{"type":"paragraph","children":[{"type":"text","value":"Enjoy!","position":{"start":{"line":82,"column":4,"offset":3622},"end":{"line":82,"column":10,"offset":3628},"indent":[]}}],"position":{"start":{"line":82,"column":4,"offset":3622},"end":{"line":82,"column":10,"offset":3628},"indent":[]}}],"position":{"start":{"line":82,"column":1,"offset":3619},"end":{"line":82,"column":10,"offset":3628},"indent":[]}}],"position":{"start":{"line":80,"column":1,"offset":3447},"end":{"line":82,"column":10,"offset":3628},"indent":[1,1]}},{"type":"paragraph","children":[{"type":"text","value":"If you wish to customize the code, you will find the bot list tasks in the tasks folder. Don't worry we will discuss this when we get to the tasks section of the guide.","position":{"start":{"line":84,"column":1,"offset":3630},"end":{"line":84,"column":169,"offset":3798},"indent":[]}}],"position":{"start":{"line":84,"column":1,"offset":3630},"end":{"line":84,"column":169,"offset":3798},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"For now just remember, that Discordeno provides you a built in way to update most discord bot lists.","position":{"start":{"line":86,"column":1,"offset":3800},"end":{"line":86,"column":101,"offset":3900},"indent":[]}}],"position":{"start":{"line":86,"column":1,"offset":3800},"end":{"line":86,"column":101,"offset":3900},"indent":[]}},{"type":"heading","depth":4,"children":[{"type":"text","value":"Channel IDs","position":{"start":{"line":88,"column":6,"offset":3907},"end":{"line":88,"column":17,"offset":3918},"indent":[]}}],"position":{"start":{"line":88,"column":1,"offset":3902},"end":{"line":88,"column":17,"offset":3918},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"The channelIDs section holds the channel IDs that are useful for specific features to help give you alerts/notifications. For example, the ","position":{"start":{"line":90,"column":1,"offset":3920},"end":{"line":90,"column":140,"offset":4059},"indent":[]}},{"type":"inlineCode","value":"missingTranslation","position":{"start":{"line":90,"column":140,"offset":4059},"end":{"line":90,"column":160,"offset":4079},"indent":[]}},{"type":"text","value":" channel will be where messages are sent alerting you that somewhere in your code you are trying to use a translation key that you never created.","position":{"start":{"line":90,"column":160,"offset":4079},"end":{"line":90,"column":305,"offset":4224},"indent":[]}}],"position":{"start":{"line":90,"column":1,"offset":3920},"end":{"line":90,"column":305,"offset":4224},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"When you get to around 25,000 Discord servers on your bot, you may want to convert these channel IDs to webhooks.","position":{"start":{"line":92,"column":1,"offset":4226},"end":{"line":92,"column":114,"offset":4339},"indent":[]}}],"position":{"start":{"line":92,"column":1,"offset":4226},"end":{"line":92,"column":114,"offset":4339},"indent":[]}},{"type":"heading","depth":4,"children":[{"type":"text","value":"Role IDs","position":{"start":{"line":94,"column":6,"offset":4346},"end":{"line":94,"column":14,"offset":4354},"indent":[]}}],"position":{"start":{"line":94,"column":1,"offset":4341},"end":{"line":94,"column":14,"offset":4354},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"The roleIDs section holds the channel IDs that are useful for specific features to help give you alerts/notifications. For example, the ","position":{"start":{"line":96,"column":1,"offset":4356},"end":{"line":96,"column":137,"offset":4492},"indent":[]}},{"type":"inlineCode","value":"missingTranslation","position":{"start":{"line":96,"column":137,"offset":4492},"end":{"line":96,"column":157,"offset":4512},"indent":[]}},{"type":"text","value":" channel will be where messages are sent alerting you that somewhere in your code you are trying to use a translation key that you never created.","position":{"start":{"line":96,"column":157,"offset":4512},"end":{"line":96,"column":302,"offset":4657},"indent":[]}}],"position":{"start":{"line":96,"column":1,"offset":4356},"end":{"line":96,"column":302,"offset":4657},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"When you get to around 25,000 Discord servers on your bot, you may want to convert these channel IDs to webhooks.","position":{"start":{"line":98,"column":1,"offset":4659},"end":{"line":98,"column":114,"offset":4772},"indent":[]}}],"position":{"start":{"line":98,"column":1,"offset":4659},"end":{"line":98,"column":114,"offset":4772},"indent":[]}},{"type":"heading","depth":2,"children":[{"type":"text","value":"It's Alive!","position":{"start":{"line":100,"column":4,"offset":4777},"end":{"line":100,"column":15,"offset":4788},"indent":[]}}],"position":{"start":{"line":100,"column":1,"offset":4774},"end":{"line":100,"column":15,"offset":4788},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"Oh my god! You now have a bot with a bunch of features already! You don't believe me? Well, seeing is believing, so start the bot.","position":{"start":{"line":102,"column":1,"offset":4790},"end":{"line":102,"column":131,"offset":4920},"indent":[]}}],"position":{"start":{"line":102,"column":1,"offset":4790},"end":{"line":102,"column":131,"offset":4920},"indent":[]}},{"type":"list","ordered":true,"start":1,"spread":false,"children":[{"type":"listItem","spread":false,"checked":null,"children":[{"type":"paragraph","children":[{"type":"text","value":"Invite your bot to a discord server.","position":{"start":{"line":104,"column":4,"offset":4925},"end":{"line":104,"column":40,"offset":4961},"indent":[]}}],"position":{"start":{"line":104,"column":4,"offset":4925},"end":{"line":104,"column":40,"offset":4961},"indent":[]}}],"position":{"start":{"line":104,"column":1,"offset":4922},"end":{"line":104,"column":40,"offset":4961},"indent":[]}},{"type":"listItem","spread":false,"checked":null,"children":[{"type":"paragraph","children":[{"type":"text","value":"Open up the integrated terminal in VSC using ","position":{"start":{"line":105,"column":4,"offset":4965},"end":{"line":105,"column":49,"offset":5010},"indent":[]}},{"type":"strong","children":[{"type":"text","value":"CTRL + `","position":{"start":{"line":105,"column":51,"offset":5012},"end":{"line":105,"column":59,"offset":5020},"indent":[]}}],"position":{"start":{"line":105,"column":49,"offset":5010},"end":{"line":105,"column":61,"offset":5022},"indent":[]}},{"type":"text","value":". If you use a Mac, replace CTRL with CMD.","position":{"start":{"line":105,"column":61,"offset":5022},"end":{"line":105,"column":103,"offset":5064},"indent":[]}}],"position":{"start":{"line":105,"column":4,"offset":4965},"end":{"line":105,"column":103,"offset":5064},"indent":[]}}],"position":{"start":{"line":105,"column":1,"offset":4962},"end":{"line":105,"column":103,"offset":5064},"indent":[]}},{"type":"listItem","spread":false,"checked":null,"children":[{"type":"paragraph","children":[{"type":"text","value":"Run the script below:","position":{"start":{"line":106,"column":4,"offset":5068},"end":{"line":106,"column":25,"offset":5089},"indent":[]}}],"position":{"start":{"line":106,"column":4,"offset":5068},"end":{"line":106,"column":25,"offset":5089},"indent":[]}}],"position":{"start":{"line":106,"column":1,"offset":5065},"end":{"line":106,"column":25,"offset":5089},"indent":[]}}],"position":{"start":{"line":104,"column":1,"offset":4922},"end":{"line":106,"column":25,"offset":5089},"indent":[1,1]}},{"type":"code","lang":"shell","meta":null,"value":"deno run --allow-net --allow-read mod.ts","position":{"start":{"line":108,"column":1,"offset":5091},"end":{"line":110,"column":4,"offset":5144},"indent":[1,1]}},{"type":"paragraph","children":[{"type":"text","value":"The first time you run it, you may see a lot of files being loaded. This is preparing all the magic behind the scene. Once it is ready, you will see something like this:","position":{"start":{"line":112,"column":1,"offset":5146},"end":{"line":112,"column":170,"offset":5315},"indent":[]}}],"position":{"start":{"line":112,"column":1,"offset":5146},"end":{"line":112,"column":170,"offset":5315},"indent":[]}},{"type":"paragraph","children":[{"type":"image","title":null,"url":"https://i.imgur.com/TOXjLgh.png","alt":"image","position":{"start":{"line":114,"column":1,"offset":5317},"end":{"line":114,"column":42,"offset":5358},"indent":[]}}],"position":{"start":{"line":114,"column":1,"offset":5317},"end":{"line":114,"column":42,"offset":5358},"indent":[]}},{"type":"heading","depth":2,"children":[{"type":"text","value":"Understanding What Discordeno Did","position":{"start":{"line":116,"column":4,"offset":5363},"end":{"line":116,"column":37,"offset":5396},"indent":[]}}],"position":{"start":{"line":116,"column":1,"offset":5360},"end":{"line":116,"column":37,"offset":5396},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"Discordeno includes these commands/folders as they are essential for any discord bot to have in order to meet the Discord Bot Best Practices. It also adds a few things that will help make some things easier to build a bot.","position":{"start":{"line":118,"column":1,"offset":5398},"end":{"line":118,"column":223,"offset":5620},"indent":[]}}],"position":{"start":{"line":118,"column":1,"offset":5398},"end":{"line":118,"column":223,"offset":5620},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"We will dive into these deeper in this guide. Let's take it step by step.","position":{"start":{"line":120,"column":1,"offset":5622},"end":{"line":120,"column":74,"offset":5695},"indent":[]}}],"position":{"start":{"line":120,"column":1,"offset":5622},"end":{"line":120,"column":74,"offset":5695},"indent":[]}},{"type":"export","value":"export const _frontmatter = {\"title\":\"Creating The Bot!\",\"metaTitle\":\"Creating A Bot | Discordeno\",\"metaDescription\":\"Let's create our very own bot with Discordeno!\"}","position":{"start":{"line":123,"column":1,"offset":5698},"end":{"line":123,"column":167,"offset":5864},"indent":[]}}],"position":{"start":{"line":1,"column":1,"offset":0},"end":{"line":123,"column":167,"offset":5864}}},"scopeImports":["import * as React from 'react'"],"scopeIdentifiers":["React"],"body":"function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }\n\nfunction _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }\n\nfunction _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }\n\n/* @jsx mdx */\nvar _frontmatter = {\n \"title\": \"Creating The Bot!\",\n \"metaTitle\": \"Creating A Bot | Discordeno\",\n \"metaDescription\": \"Let's create our very own bot with Discordeno!\"\n};\nvar layoutProps = {\n _frontmatter: _frontmatter\n};\nvar MDXLayout = \"wrapper\";\nreturn function MDXContent(_ref) {\n var components = _ref.components,\n props = _objectWithoutProperties(_ref, [\"components\"]);\n\n return mdx(MDXLayout, _extends({}, layoutProps, props, {\n components: components,\n mdxType: \"MDXLayout\"\n }), mdx(\"p\", null, \"Discordeno will help make Discord bot development much easier. Don't worry, as you go through this guide it will make a lot more sense.\"), mdx(\"h2\", null, \"Creating The Bot!\"), mdx(\"blockquote\", null, mdx(\"p\", {\n parentName: \"blockquote\"\n }, \"This guide is going to assume you already have the basic requirements to make a bot ready. This includes github, git, a code editor like Visual Studio Code. If you don't have these yet please prepare them first before going forward.\")), mdx(\"ul\", null, mdx(\"li\", {\n parentName: \"ul\"\n }, mdx(\"p\", {\n parentName: \"li\"\n }, \"First, create a Discordeno Bot using the \", mdx(\"a\", _extends({\n parentName: \"p\"\n }, {\n \"href\": \"https://github.com/Skillz4Killz/Discordeno-bot-template\"\n }), \"Generator Boilerplate\"), \". Give it any name you like. For the purpose of this guide we will call it, Stargate.\")), mdx(\"li\", {\n parentName: \"ul\"\n }, mdx(\"p\", {\n parentName: \"li\"\n }, \"Then \", mdx(\"inlineCode\", {\n parentName: \"p\"\n }, \"git clone https://github.com/Skillz4Killz/Stargate.git\"))), mdx(\"li\", {\n parentName: \"ul\"\n }, mdx(\"p\", {\n parentName: \"li\"\n }, \"When that is done, go ahead and open up the folder with VSC.\")), mdx(\"li\", {\n parentName: \"ul\"\n }, mdx(\"p\", {\n parentName: \"li\"\n }, \"Create a new file called \", mdx(\"inlineCode\", {\n parentName: \"p\"\n }, \"configs.ts\"), \". Open the \", mdx(\"inlineCode\", {\n parentName: \"p\"\n }, \"configs.example.ts\"), \" file and copy everything over.\"))), mdx(\"p\", null, \"Let's take a minute to review all the options we have available to us.\"), mdx(\"h3\", null, \"Configs File\"), mdx(\"p\", null, \"The \", mdx(\"inlineCode\", {\n parentName: \"p\"\n }, \"configs.ts\"), \" file is where you will keep all your secret info you don't want to share with anyone else. As long as \", mdx(\"inlineCode\", {\n parentName: \"p\"\n }, \".gitignore\"), \" file is ignoring configs.ts your configurations will be kept private!\"), mdx(\"pre\", null, mdx(\"code\", _extends({\n parentName: \"pre\"\n }, {\n \"className\": \"language-ts\"\n }), \"// Step 1: Remove the `.example` from this file name so it is called `configs.ts`\\n// Step 2: Add all your bot's information below. The only required one is token and prefix. NOTE: As long as `.gitignore` file is ignoring configs.ts your configurations will be kept private!\\n// Step 3: Remove these comments if you like.\\n\\nexport const configs = {\\n // Your bot token goes here\\n token: \\\"\\\",\\n // The default prefix for your bot. Don't worry guilds can change this later.\\n prefix: \\\"!\\\",\\n // This isn't required but you can add bot list api keys here.\\n botListTokens: {\\n DISCORD_BOT_ORG: \\\"\\\",\\n BOTS_ON_DISCORD: \\\"\\\",\\n DISCORD_BOT_LIST: \\\"\\\",\\n BOTS_FOR_DISCORD: \\\"\\\",\\n DISCORD_BOATS: \\\"\\\",\\n DISCORD_BOTS_GG: \\\"\\\",\\n DISCORD_BOTS_GROUP: \\\"\\\",\\n },\\n // This is the server id for your bot's main server where users can get help/support\\n supportServerID: \\\"\\\",\\n // These are channel ids that will enable some functionality\\n channelIDs: {\\n // When a translation is missing this is the channel you will be alerted in.\\n missingTranslation: \\\"\\\",\\n // When an error occurs, we will try and log it to this channel\\n errorChannelID: \\\"\\\"\\n },\\n // These are the role ids that will enable some functionality.\\n roleIDs: {\\n // If you have a patreon set up you can add the patreon vip role id here.\\n patreonVIPRoleID: \\\"\\\",\\n },\\n // These are the user ids that will enable some functionality.\\n userIDs: {\\n // The user ids for the support team\\n botSupporters: [],\\n // The user ids for the other devs on your team\\n botDevs: [],\\n // The user ids who have complete 100% access to your bot\\n botOwners: []\\n }\\n};\\n\\n\")), mdx(\"h4\", null, \"Token\"), mdx(\"p\", null, \"First, add your bot token. This is \", mdx(\"strong\", {\n parentName: \"p\"\n }, \"required\"), \" for the bot to start. Review the \", mdx(\"a\", _extends({\n parentName: \"p\"\n }, {\n \"href\": \"https://discordeno.netlify.app/gettingstarted#creatingyourfirstdiscordbotapplication\"\n }), \"instructions\"), \" if you have not made your token yet.\"), mdx(\"h4\", null, \"Prefix\"), mdx(\"p\", null, \"The prefix is where you will set the default prefix for your bot. Don't worry, every server will be able to choose their own prefix but we need a default prefix to start.\"), mdx(\"h4\", null, \"Bot Lists Tokens\"), mdx(\"p\", null, \"This section of the file is so you can easily have your bot's statistics updated on all the bot lists out there to help you grow your bot. The code is already written to handle this but you will need to do 3 things for each bot list.\"), mdx(\"ol\", null, mdx(\"li\", {\n parentName: \"ol\"\n }, \"Go to the bot list and add your bot to their website. (Each site has it's own instructions)\"), mdx(\"li\", {\n parentName: \"ol\"\n }, \"Create a token for yourself on each website and paste it in your configs.\"), mdx(\"li\", {\n parentName: \"ol\"\n }, \"Enjoy!\")), mdx(\"p\", null, \"If you wish to customize the code, you will find the bot list tasks in the tasks folder. Don't worry we will discuss this when we get to the tasks section of the guide.\"), mdx(\"p\", null, \"For now just remember, that Discordeno provides you a built in way to update most discord bot lists.\"), mdx(\"h4\", null, \"Channel IDs\"), mdx(\"p\", null, \"The channelIDs section holds the channel IDs that are useful for specific features to help give you alerts/notifications. For example, the \", mdx(\"inlineCode\", {\n parentName: \"p\"\n }, \"missingTranslation\"), \" channel will be where messages are sent alerting you that somewhere in your code you are trying to use a translation key that you never created.\"), mdx(\"p\", null, \"When you get to around 25,000 Discord servers on your bot, you may want to convert these channel IDs to webhooks.\"), mdx(\"h4\", null, \"Role IDs\"), mdx(\"p\", null, \"The roleIDs section holds the channel IDs that are useful for specific features to help give you alerts/notifications. For example, the \", mdx(\"inlineCode\", {\n parentName: \"p\"\n }, \"missingTranslation\"), \" channel will be where messages are sent alerting you that somewhere in your code you are trying to use a translation key that you never created.\"), mdx(\"p\", null, \"When you get to around 25,000 Discord servers on your bot, you may want to convert these channel IDs to webhooks.\"), mdx(\"h2\", null, \"It's Alive!\"), mdx(\"p\", null, \"Oh my god! You now have a bot with a bunch of features already! You don't believe me? Well, seeing is believing, so start the bot.\"), mdx(\"ol\", null, mdx(\"li\", {\n parentName: \"ol\"\n }, \"Invite your bot to a discord server.\"), mdx(\"li\", {\n parentName: \"ol\"\n }, \"Open up the integrated terminal in VSC using \", mdx(\"strong\", {\n parentName: \"li\"\n }, \"CTRL + `\"), \". If you use a Mac, replace CTRL with CMD.\"), mdx(\"li\", {\n parentName: \"ol\"\n }, \"Run the script below:\")), mdx(\"pre\", null, mdx(\"code\", _extends({\n parentName: \"pre\"\n }, {\n \"className\": \"language-shell\"\n }), \"deno run --allow-net --allow-read mod.ts\\n\")), mdx(\"p\", null, \"The first time you run it, you may see a lot of files being loaded. This is preparing all the magic behind the scene. Once it is ready, you will see something like this:\"), mdx(\"p\", null, mdx(\"img\", _extends({\n parentName: \"p\"\n }, {\n \"src\": \"https://i.imgur.com/TOXjLgh.png\",\n \"alt\": \"image\"\n }))), mdx(\"h2\", null, \"Understanding What Discordeno Did\"), mdx(\"p\", null, \"Discordeno includes these commands/folders as they are essential for any discord bot to have in order to meet the Discord Bot Best Practices. It also adds a few things that will help make some things easier to build a bot.\"), mdx(\"p\", null, \"We will dive into these deeper in this guide. Let's take it step by step.\"));\n}\n;\nMDXContent.isMDXComponent = true;","rawMDXOutput":"/* @jsx mdx */\nimport { mdx } from '@mdx-js/react';\n/* @jsx mdx */\n\nexport const _frontmatter = {\n \"title\": \"Creating The Bot!\",\n \"metaTitle\": \"Creating A Bot | Discordeno\",\n \"metaDescription\": \"Let's create our very own bot with Discordeno!\"\n};\n\nconst layoutProps = {\n _frontmatter\n};\nconst MDXLayout = \"wrapper\"\nexport default function MDXContent({\n components,\n ...props\n}) {\n return \n

{`Discordeno will help make Discord bot development much easier. Don't worry, as you go through this guide it will make a lot more sense.`}

\n

{`Creating The Bot!`}

\n
\n

{`This guide is going to assume you already have the basic requirements to make a bot ready. This includes github, git, a code editor like Visual Studio Code. If you don't have these yet please prepare them first before going forward.`}

\n
\n
    \n
  • \n

    {`First, create a Discordeno Bot using the `}{`Generator Boilerplate`}{`. Give it any name you like. For the purpose of this guide we will call it, Stargate.`}

    \n
  • \n
  • \n

    {`Then `}{`git clone https://github.com/Skillz4Killz/Stargate.git`}

    \n
  • \n
  • \n

    {`When that is done, go ahead and open up the folder with VSC.`}

    \n
  • \n
  • \n

    {`Create a new file called `}{`configs.ts`}{`. Open the `}{`configs.example.ts`}{` file and copy everything over.`}

    \n
  • \n
\n

{`Let's take a minute to review all the options we have available to us.`}

\n

{`Configs File`}

\n

{`The `}{`configs.ts`}{` file is where you will keep all your secret info you don't want to share with anyone else. As long as `}{`.gitignore`}{` file is ignoring configs.ts your configurations will be kept private!`}

\n
{`// Step 1: Remove the \\`.example\\` from this file name so it is called \\`configs.ts\\`\n// Step 2: Add all your bot's information below. The only required one is token and prefix. NOTE: As long as \\`.gitignore\\` file is ignoring configs.ts your configurations will be kept private!\n// Step 3: Remove these comments if you like.\n\nexport const configs = {\n  // Your bot token goes here\n  token: \"\",\n  // The default prefix for your bot. Don't worry guilds can change this later.\n  prefix: \"!\",\n  // This isn't required but you can add bot list api keys here.\n  botListTokens: {\n    DISCORD_BOT_ORG: \"\",\n    BOTS_ON_DISCORD: \"\",\n    DISCORD_BOT_LIST: \"\",\n    BOTS_FOR_DISCORD: \"\",\n    DISCORD_BOATS: \"\",\n    DISCORD_BOTS_GG: \"\",\n    DISCORD_BOTS_GROUP: \"\",\n  },\n  // This is the server id for your bot's main server where users can get help/support\n  supportServerID: \"\",\n  // These are channel ids that will enable some functionality\n  channelIDs: {\n    // When a translation is missing this is the channel you will be alerted in.\n    missingTranslation: \"\",\n    // When an error occurs, we will try and log it to this channel\n    errorChannelID: \"\"\n  },\n  // These are the role ids that will enable some functionality.\n  roleIDs: {\n    // If you have a patreon set up you can add the patreon vip role id here.\n    patreonVIPRoleID: \"\",\n  },\n  // These are the user ids that will enable some functionality.\n  userIDs: {\n    // The user ids for the support team\n    botSupporters: [],\n    // The user ids for the other devs on your team\n    botDevs: [],\n    // The user ids who have complete 100% access to your bot\n    botOwners: []\n  }\n};\n\n`}
\n

{`Token`}

\n

{`First, add your bot token. This is `}{`required`}{` for the bot to start. Review the `}{`instructions`}{` if you have not made your token yet.`}

\n

{`Prefix`}

\n

{`The prefix is where you will set the default prefix for your bot. Don't worry, every server will be able to choose their own prefix but we need a default prefix to start.`}

\n

{`Bot Lists Tokens`}

\n

{`This section of the file is so you can easily have your bot's statistics updated on all the bot lists out there to help you grow your bot. The code is already written to handle this but you will need to do 3 things for each bot list.`}

\n
    \n
  1. {`Go to the bot list and add your bot to their website. (Each site has it's own instructions)`}
  2. \n
  3. {`Create a token for yourself on each website and paste it in your configs.`}
  4. \n
  5. {`Enjoy!`}
  6. \n
\n

{`If you wish to customize the code, you will find the bot list tasks in the tasks folder. Don't worry we will discuss this when we get to the tasks section of the guide.`}

\n

{`For now just remember, that Discordeno provides you a built in way to update most discord bot lists.`}

\n

{`Channel IDs`}

\n

{`The channelIDs section holds the channel IDs that are useful for specific features to help give you alerts/notifications. For example, the `}{`missingTranslation`}{` channel will be where messages are sent alerting you that somewhere in your code you are trying to use a translation key that you never created.`}

\n

{`When you get to around 25,000 Discord servers on your bot, you may want to convert these channel IDs to webhooks.`}

\n

{`Role IDs`}

\n

{`The roleIDs section holds the channel IDs that are useful for specific features to help give you alerts/notifications. For example, the `}{`missingTranslation`}{` channel will be where messages are sent alerting you that somewhere in your code you are trying to use a translation key that you never created.`}

\n

{`When you get to around 25,000 Discord servers on your bot, you may want to convert these channel IDs to webhooks.`}

\n

{`It's Alive!`}

\n

{`Oh my god! You now have a bot with a bunch of features already! You don't believe me? Well, seeing is believing, so start the bot.`}

\n
    \n
  1. {`Invite your bot to a discord server.`}
  2. \n
  3. {`Open up the integrated terminal in VSC using `}{`CTRL + \\``}{`. If you use a Mac, replace CTRL with CMD.`}
  4. \n
  5. {`Run the script below:`}
  6. \n
\n
{`deno run --allow-net --allow-read mod.ts\n`}
\n

{`The first time you run it, you may see a lot of files being loaded. This is preparing all the magic behind the scene. Once it is ready, you will see something like this:`}

\n

\n

{`Understanding What Discordeno Did`}

\n

{`Discordeno includes these commands/folders as they are essential for any discord bot to have in order to meet the Discord Bot Best Practices. It also adds a few things that will help make some things easier to build a bot.`}

\n

{`We will dive into these deeper in this guide. Let's take it step by step.`}

\n\n
;\n}\n\n;\nMDXContent.isMDXComponent = true;"}} \ No newline at end of file diff --git a/docs/.cache/caches/gatsby-plugin-mdx/diskstore-90aea6765ffd064dc1855c368bc4f35a.json b/docs/.cache/caches/gatsby-plugin-mdx/diskstore-90aea6765ffd064dc1855c368bc4f35a.json new file mode 100644 index 000000000..3b5f131b8 --- /dev/null +++ b/docs/.cache/caches/gatsby-plugin-mdx/diskstore-90aea6765ffd064dc1855c368bc4f35a.json @@ -0,0 +1 @@ +{"expireTime":9007200851644204000,"key":"gatsby-plugin-mdx-entire-payload-ef8f35d5908f025de5991cf265e4242b-","val":{"mdast":{"type":"root","children":[{"type":"paragraph","children":[{"type":"text","value":"Discordeno will help make Discord bot development much easier. Don't worry, as you go through this guide it will make a lot more sense.","position":{"start":{"line":2,"column":1,"offset":1},"end":{"line":2,"column":136,"offset":136},"indent":[]}}],"position":{"start":{"line":2,"column":1,"offset":1},"end":{"line":2,"column":136,"offset":136},"indent":[]}},{"type":"heading","depth":2,"children":[{"type":"text","value":"Creating The Bot!","position":{"start":{"line":4,"column":4,"offset":141},"end":{"line":4,"column":21,"offset":158},"indent":[]}}],"position":{"start":{"line":4,"column":1,"offset":138},"end":{"line":4,"column":21,"offset":158},"indent":[]}},{"type":"blockquote","children":[{"type":"paragraph","children":[{"type":"text","value":"This guide is going to assume you already have the basic requirements to make a bot ready. This includes github, git, a code editor like Visual Studio Code. If you don't have these yet please prepare them first before going forward.","position":{"start":{"line":6,"column":3,"offset":162},"end":{"line":6,"column":235,"offset":394},"indent":[]}}],"position":{"start":{"line":6,"column":3,"offset":162},"end":{"line":6,"column":235,"offset":394},"indent":[]}}],"position":{"start":{"line":6,"column":1,"offset":160},"end":{"line":6,"column":235,"offset":394},"indent":[]}},{"type":"list","ordered":false,"start":null,"spread":true,"children":[{"type":"listItem","spread":false,"checked":null,"children":[{"type":"paragraph","children":[{"type":"text","value":"First, create a Discordeno Bot using the ","position":{"start":{"line":8,"column":3,"offset":398},"end":{"line":8,"column":44,"offset":439},"indent":[]}},{"type":"link","title":null,"url":"https://github.com/Skillz4Killz/Discordeno-bot-template","children":[{"type":"text","value":"Generator Boilerplate","position":{"start":{"line":8,"column":45,"offset":440},"end":{"line":8,"column":66,"offset":461},"indent":[]}}],"position":{"start":{"line":8,"column":44,"offset":439},"end":{"line":8,"column":124,"offset":519},"indent":[]}},{"type":"text","value":". Give it any name you like. For the purpose of this guide we will call it, Stargate.","position":{"start":{"line":8,"column":124,"offset":519},"end":{"line":8,"column":209,"offset":604},"indent":[]}}],"position":{"start":{"line":8,"column":3,"offset":398},"end":{"line":8,"column":209,"offset":604},"indent":[]}}],"position":{"start":{"line":8,"column":1,"offset":396},"end":{"line":9,"column":1,"offset":605},"indent":[1]}},{"type":"listItem","spread":false,"checked":null,"children":[{"type":"paragraph","children":[{"type":"text","value":"Then ","position":{"start":{"line":10,"column":3,"offset":608},"end":{"line":10,"column":8,"offset":613},"indent":[]}},{"type":"inlineCode","value":"git clone https://github.com/Skillz4Killz/Stargate.git","position":{"start":{"line":10,"column":8,"offset":613},"end":{"line":10,"column":64,"offset":669},"indent":[]}}],"position":{"start":{"line":10,"column":3,"offset":608},"end":{"line":10,"column":64,"offset":669},"indent":[]}}],"position":{"start":{"line":10,"column":1,"offset":606},"end":{"line":11,"column":1,"offset":670},"indent":[1]}},{"type":"listItem","spread":false,"checked":null,"children":[{"type":"paragraph","children":[{"type":"text","value":"When that is done, go ahead and open up the folder with VSC.","position":{"start":{"line":12,"column":3,"offset":673},"end":{"line":12,"column":63,"offset":733},"indent":[]}}],"position":{"start":{"line":12,"column":3,"offset":673},"end":{"line":12,"column":63,"offset":733},"indent":[]}}],"position":{"start":{"line":12,"column":1,"offset":671},"end":{"line":12,"column":63,"offset":733},"indent":[]}},{"type":"listItem","spread":false,"checked":null,"children":[{"type":"paragraph","children":[{"type":"text","value":"Create a new file called ","position":{"start":{"line":13,"column":3,"offset":736},"end":{"line":13,"column":28,"offset":761},"indent":[]}},{"type":"inlineCode","value":"configs.ts","position":{"start":{"line":13,"column":28,"offset":761},"end":{"line":13,"column":40,"offset":773},"indent":[]}},{"type":"text","value":". Open the ","position":{"start":{"line":13,"column":40,"offset":773},"end":{"line":13,"column":51,"offset":784},"indent":[]}},{"type":"inlineCode","value":"configs.example.ts","position":{"start":{"line":13,"column":51,"offset":784},"end":{"line":13,"column":71,"offset":804},"indent":[]}},{"type":"text","value":" file and copy everything over.","position":{"start":{"line":13,"column":71,"offset":804},"end":{"line":13,"column":102,"offset":835},"indent":[]}}],"position":{"start":{"line":13,"column":3,"offset":736},"end":{"line":13,"column":102,"offset":835},"indent":[]}}],"position":{"start":{"line":13,"column":1,"offset":734},"end":{"line":13,"column":102,"offset":835},"indent":[]}}],"position":{"start":{"line":8,"column":1,"offset":396},"end":{"line":13,"column":102,"offset":835},"indent":[1,1,1,1,1]}},{"type":"paragraph","children":[{"type":"text","value":"Let's take a minute to review all the options we have available to us.","position":{"start":{"line":15,"column":1,"offset":837},"end":{"line":15,"column":71,"offset":907},"indent":[]}}],"position":{"start":{"line":15,"column":1,"offset":837},"end":{"line":15,"column":71,"offset":907},"indent":[]}},{"type":"heading","depth":3,"children":[{"type":"text","value":"Configs File","position":{"start":{"line":17,"column":5,"offset":913},"end":{"line":17,"column":17,"offset":925},"indent":[]}}],"position":{"start":{"line":17,"column":1,"offset":909},"end":{"line":17,"column":17,"offset":925},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"The ","position":{"start":{"line":19,"column":1,"offset":927},"end":{"line":19,"column":5,"offset":931},"indent":[]}},{"type":"inlineCode","value":"configs.ts","position":{"start":{"line":19,"column":5,"offset":931},"end":{"line":19,"column":17,"offset":943},"indent":[]}},{"type":"text","value":" file is where you will keep all your secret info you don't want to share with anyone else. As long as ","position":{"start":{"line":19,"column":17,"offset":943},"end":{"line":19,"column":120,"offset":1046},"indent":[]}},{"type":"inlineCode","value":".gitignore","position":{"start":{"line":19,"column":120,"offset":1046},"end":{"line":19,"column":132,"offset":1058},"indent":[]}},{"type":"text","value":" file is ignoring configs.ts your configurations will be kept private!","position":{"start":{"line":19,"column":132,"offset":1058},"end":{"line":19,"column":202,"offset":1128},"indent":[]}}],"position":{"start":{"line":19,"column":1,"offset":927},"end":{"line":19,"column":202,"offset":1128},"indent":[]}},{"type":"code","lang":"ts","meta":null,"value":"// Step 1: Remove the `.example` from this file name so it is called `configs.ts`\n// Step 2: Add all your bot's information below. The only required one is token and prefix. NOTE: As long as `.gitignore` file is ignoring configs.ts your configurations will be kept private!\n// Step 3: Remove these comments if you like.\n\nexport const configs = {\n // Your bot token goes here\n token: \"\",\n // The default prefix for your bot. Don't worry guilds can change this later.\n prefix: \"!\",\n // This isn't required but you can add bot list api keys here.\n botListTokens: {\n DISCORD_BOT_ORG: \"\",\n BOTS_ON_DISCORD: \"\",\n DISCORD_BOT_LIST: \"\",\n BOTS_FOR_DISCORD: \"\",\n DISCORD_BOATS: \"\",\n DISCORD_BOTS_GG: \"\",\n DISCORD_BOTS_GROUP: \"\",\n },\n // This is the server id for your bot's main server where users can get help/support\n supportServerID: \"\",\n // These are channel ids that will enable some functionality\n channelIDs: {\n // When a translation is missing this is the channel you will be alerted in.\n missingTranslation: \"\",\n // When an error occurs, we will try and log it to this channel\n errorChannelID: \"\"\n },\n // These are the role ids that will enable some functionality.\n roleIDs: {\n // If you have a patreon set up you can add the patreon vip role id here.\n patreonVIPRoleID: \"\",\n },\n // These are the user ids that will enable some functionality.\n userIDs: {\n // The user ids for the support team\n botSupporters: [],\n // The user ids for the other devs on your team\n botDevs: [],\n // The user ids who have complete 100% access to your bot\n botOwners: []\n }\n};\n","position":{"start":{"line":21,"column":1,"offset":1130},"end":{"line":66,"column":4,"offset":2770},"indent":[1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1]}},{"type":"heading","depth":4,"children":[{"type":"text","value":"Token","position":{"start":{"line":68,"column":6,"offset":2777},"end":{"line":68,"column":11,"offset":2782},"indent":[]}}],"position":{"start":{"line":68,"column":1,"offset":2772},"end":{"line":68,"column":11,"offset":2782},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"First, add your bot token. This is ","position":{"start":{"line":70,"column":1,"offset":2784},"end":{"line":70,"column":36,"offset":2819},"indent":[]}},{"type":"strong","children":[{"type":"text","value":"required","position":{"start":{"line":70,"column":38,"offset":2821},"end":{"line":70,"column":46,"offset":2829},"indent":[]}}],"position":{"start":{"line":70,"column":36,"offset":2819},"end":{"line":70,"column":48,"offset":2831},"indent":[]}},{"type":"text","value":" for the bot to start. Review the ","position":{"start":{"line":70,"column":48,"offset":2831},"end":{"line":70,"column":82,"offset":2865},"indent":[]}},{"type":"link","title":null,"url":"https://discordeno.netlify.app/gettingstarted#creatingyourfirstdiscordbotapplication","children":[{"type":"text","value":"instructions","position":{"start":{"line":70,"column":83,"offset":2866},"end":{"line":70,"column":95,"offset":2878},"indent":[]}}],"position":{"start":{"line":70,"column":82,"offset":2865},"end":{"line":70,"column":182,"offset":2965},"indent":[]}},{"type":"text","value":" if you have not made your token yet.","position":{"start":{"line":70,"column":182,"offset":2965},"end":{"line":70,"column":219,"offset":3002},"indent":[]}}],"position":{"start":{"line":70,"column":1,"offset":2784},"end":{"line":70,"column":219,"offset":3002},"indent":[]}},{"type":"heading","depth":4,"children":[{"type":"text","value":"Prefix","position":{"start":{"line":72,"column":6,"offset":3009},"end":{"line":72,"column":12,"offset":3015},"indent":[]}}],"position":{"start":{"line":72,"column":1,"offset":3004},"end":{"line":72,"column":12,"offset":3015},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"The prefix is where you will set the default prefix for your bot. Don't worry, every server will be able to choose their own prefix but we need a default prefix to start.","position":{"start":{"line":74,"column":1,"offset":3017},"end":{"line":74,"column":171,"offset":3187},"indent":[]}}],"position":{"start":{"line":74,"column":1,"offset":3017},"end":{"line":74,"column":171,"offset":3187},"indent":[]}},{"type":"heading","depth":4,"children":[{"type":"text","value":"Bot Lists Tokens","position":{"start":{"line":76,"column":6,"offset":3194},"end":{"line":76,"column":22,"offset":3210},"indent":[]}}],"position":{"start":{"line":76,"column":1,"offset":3189},"end":{"line":76,"column":22,"offset":3210},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"This section of the file is so you can easily have your bot's statistics updated on all the bot lists out there to help you grow your bot. The code is already written to handle this but you will need to do 3 things for each bot list.","position":{"start":{"line":78,"column":1,"offset":3212},"end":{"line":78,"column":234,"offset":3445},"indent":[]}}],"position":{"start":{"line":78,"column":1,"offset":3212},"end":{"line":78,"column":234,"offset":3445},"indent":[]}},{"type":"list","ordered":true,"start":1,"spread":false,"children":[{"type":"listItem","spread":false,"checked":null,"children":[{"type":"paragraph","children":[{"type":"text","value":"Go to the bot list and add your bot to their website. (Each site has it's own instructions)","position":{"start":{"line":80,"column":4,"offset":3450},"end":{"line":80,"column":95,"offset":3541},"indent":[]}}],"position":{"start":{"line":80,"column":4,"offset":3450},"end":{"line":80,"column":95,"offset":3541},"indent":[]}}],"position":{"start":{"line":80,"column":1,"offset":3447},"end":{"line":80,"column":95,"offset":3541},"indent":[]}},{"type":"listItem","spread":false,"checked":null,"children":[{"type":"paragraph","children":[{"type":"text","value":"Create a token for yourself on each website and paste it in your configs.","position":{"start":{"line":81,"column":4,"offset":3545},"end":{"line":81,"column":77,"offset":3618},"indent":[]}}],"position":{"start":{"line":81,"column":4,"offset":3545},"end":{"line":81,"column":77,"offset":3618},"indent":[]}}],"position":{"start":{"line":81,"column":1,"offset":3542},"end":{"line":81,"column":77,"offset":3618},"indent":[]}},{"type":"listItem","spread":false,"checked":null,"children":[{"type":"paragraph","children":[{"type":"text","value":"Enjoy!","position":{"start":{"line":82,"column":4,"offset":3622},"end":{"line":82,"column":10,"offset":3628},"indent":[]}}],"position":{"start":{"line":82,"column":4,"offset":3622},"end":{"line":82,"column":10,"offset":3628},"indent":[]}}],"position":{"start":{"line":82,"column":1,"offset":3619},"end":{"line":82,"column":10,"offset":3628},"indent":[]}}],"position":{"start":{"line":80,"column":1,"offset":3447},"end":{"line":82,"column":10,"offset":3628},"indent":[1,1]}},{"type":"paragraph","children":[{"type":"text","value":"If you wish to customize the code, you will find the bot list tasks in the tasks folder. Don't worry we will discuss this when we get to the tasks section of the guide.","position":{"start":{"line":84,"column":1,"offset":3630},"end":{"line":84,"column":169,"offset":3798},"indent":[]}}],"position":{"start":{"line":84,"column":1,"offset":3630},"end":{"line":84,"column":169,"offset":3798},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"For now just remember, that Discordeno provides you a built in way to update most discord bot lists.","position":{"start":{"line":86,"column":1,"offset":3800},"end":{"line":86,"column":101,"offset":3900},"indent":[]}}],"position":{"start":{"line":86,"column":1,"offset":3800},"end":{"line":86,"column":101,"offset":3900},"indent":[]}},{"type":"heading","depth":4,"children":[{"type":"text","value":"Channel IDs","position":{"start":{"line":88,"column":6,"offset":3907},"end":{"line":88,"column":17,"offset":3918},"indent":[]}}],"position":{"start":{"line":88,"column":1,"offset":3902},"end":{"line":88,"column":17,"offset":3918},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"The channelIDs section holds the channel IDs that are useful for specific features to help give you alerts/notifications. For example, the ","position":{"start":{"line":90,"column":1,"offset":3920},"end":{"line":90,"column":140,"offset":4059},"indent":[]}},{"type":"inlineCode","value":"missingTranslation","position":{"start":{"line":90,"column":140,"offset":4059},"end":{"line":90,"column":160,"offset":4079},"indent":[]}},{"type":"text","value":" channel will be where messages are sent alerting you that somewhere in your code you are trying to use a translation key that you never created.","position":{"start":{"line":90,"column":160,"offset":4079},"end":{"line":90,"column":305,"offset":4224},"indent":[]}}],"position":{"start":{"line":90,"column":1,"offset":3920},"end":{"line":90,"column":305,"offset":4224},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"When you get to around 25,000 Discord servers on your bot, you may want to convert these channel IDs to webhooks.","position":{"start":{"line":92,"column":1,"offset":4226},"end":{"line":92,"column":114,"offset":4339},"indent":[]}}],"position":{"start":{"line":92,"column":1,"offset":4226},"end":{"line":92,"column":114,"offset":4339},"indent":[]}},{"type":"heading","depth":4,"children":[{"type":"text","value":"Role IDs","position":{"start":{"line":94,"column":6,"offset":4346},"end":{"line":94,"column":14,"offset":4354},"indent":[]}}],"position":{"start":{"line":94,"column":1,"offset":4341},"end":{"line":94,"column":14,"offset":4354},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"The roleIDs section holds the useful for specific features to help give you alerts/notifications. For example, the ","position":{"start":{"line":96,"column":1,"offset":4356},"end":{"line":96,"column":116,"offset":4471},"indent":[]}},{"type":"inlineCode","value":"missingTranslation","position":{"start":{"line":96,"column":116,"offset":4471},"end":{"line":96,"column":136,"offset":4491},"indent":[]}},{"type":"text","value":" channel will be where messages are sent alerting you that somewhere in your code you are trying to use a translation key that you never created.","position":{"start":{"line":96,"column":136,"offset":4491},"end":{"line":96,"column":281,"offset":4636},"indent":[]}}],"position":{"start":{"line":96,"column":1,"offset":4356},"end":{"line":96,"column":281,"offset":4636},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"When you get to around 25,000 Discord servers on your bot, you may want to convert these channel IDs to webhooks.","position":{"start":{"line":98,"column":1,"offset":4638},"end":{"line":98,"column":114,"offset":4751},"indent":[]}}],"position":{"start":{"line":98,"column":1,"offset":4638},"end":{"line":98,"column":114,"offset":4751},"indent":[]}},{"type":"heading","depth":2,"children":[{"type":"text","value":"It's Alive!","position":{"start":{"line":100,"column":4,"offset":4756},"end":{"line":100,"column":15,"offset":4767},"indent":[]}}],"position":{"start":{"line":100,"column":1,"offset":4753},"end":{"line":100,"column":15,"offset":4767},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"Oh my god! You now have a bot with a bunch of features already! You don't believe me? Well, seeing is believing, so start the bot.","position":{"start":{"line":102,"column":1,"offset":4769},"end":{"line":102,"column":131,"offset":4899},"indent":[]}}],"position":{"start":{"line":102,"column":1,"offset":4769},"end":{"line":102,"column":131,"offset":4899},"indent":[]}},{"type":"list","ordered":true,"start":1,"spread":false,"children":[{"type":"listItem","spread":false,"checked":null,"children":[{"type":"paragraph","children":[{"type":"text","value":"Invite your bot to a discord server.","position":{"start":{"line":104,"column":4,"offset":4904},"end":{"line":104,"column":40,"offset":4940},"indent":[]}}],"position":{"start":{"line":104,"column":4,"offset":4904},"end":{"line":104,"column":40,"offset":4940},"indent":[]}}],"position":{"start":{"line":104,"column":1,"offset":4901},"end":{"line":104,"column":40,"offset":4940},"indent":[]}},{"type":"listItem","spread":false,"checked":null,"children":[{"type":"paragraph","children":[{"type":"text","value":"Open up the integrated terminal in VSC using ","position":{"start":{"line":105,"column":4,"offset":4944},"end":{"line":105,"column":49,"offset":4989},"indent":[]}},{"type":"strong","children":[{"type":"text","value":"CTRL + `","position":{"start":{"line":105,"column":51,"offset":4991},"end":{"line":105,"column":59,"offset":4999},"indent":[]}}],"position":{"start":{"line":105,"column":49,"offset":4989},"end":{"line":105,"column":61,"offset":5001},"indent":[]}},{"type":"text","value":". If you use a Mac, replace CTRL with CMD.","position":{"start":{"line":105,"column":61,"offset":5001},"end":{"line":105,"column":103,"offset":5043},"indent":[]}}],"position":{"start":{"line":105,"column":4,"offset":4944},"end":{"line":105,"column":103,"offset":5043},"indent":[]}}],"position":{"start":{"line":105,"column":1,"offset":4941},"end":{"line":105,"column":103,"offset":5043},"indent":[]}},{"type":"listItem","spread":false,"checked":null,"children":[{"type":"paragraph","children":[{"type":"text","value":"Run the script below:","position":{"start":{"line":106,"column":4,"offset":5047},"end":{"line":106,"column":25,"offset":5068},"indent":[]}}],"position":{"start":{"line":106,"column":4,"offset":5047},"end":{"line":106,"column":25,"offset":5068},"indent":[]}}],"position":{"start":{"line":106,"column":1,"offset":5044},"end":{"line":106,"column":25,"offset":5068},"indent":[]}}],"position":{"start":{"line":104,"column":1,"offset":4901},"end":{"line":106,"column":25,"offset":5068},"indent":[1,1]}},{"type":"code","lang":"shell","meta":null,"value":"deno run --allow-net --allow-read mod.ts","position":{"start":{"line":108,"column":1,"offset":5070},"end":{"line":110,"column":4,"offset":5123},"indent":[1,1]}},{"type":"paragraph","children":[{"type":"text","value":"The first time you run it, you may see a lot of files being loaded. This is preparing all the magic behind the scene. Once it is ready, you will see something like this:","position":{"start":{"line":112,"column":1,"offset":5125},"end":{"line":112,"column":170,"offset":5294},"indent":[]}}],"position":{"start":{"line":112,"column":1,"offset":5125},"end":{"line":112,"column":170,"offset":5294},"indent":[]}},{"type":"paragraph","children":[{"type":"image","title":null,"url":"https://i.imgur.com/TOXjLgh.png","alt":"image","position":{"start":{"line":114,"column":1,"offset":5296},"end":{"line":114,"column":42,"offset":5337},"indent":[]}}],"position":{"start":{"line":114,"column":1,"offset":5296},"end":{"line":114,"column":42,"offset":5337},"indent":[]}},{"type":"heading","depth":2,"children":[{"type":"text","value":"Understanding What Discordeno Did","position":{"start":{"line":116,"column":4,"offset":5342},"end":{"line":116,"column":37,"offset":5375},"indent":[]}}],"position":{"start":{"line":116,"column":1,"offset":5339},"end":{"line":116,"column":37,"offset":5375},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"Discordeno includes these commands/folders as they are essential for any discord bot to have in order to meet the Discord Bot Best Practices. It also adds a few things that will help make some things easier to build a bot.","position":{"start":{"line":118,"column":1,"offset":5377},"end":{"line":118,"column":223,"offset":5599},"indent":[]}}],"position":{"start":{"line":118,"column":1,"offset":5377},"end":{"line":118,"column":223,"offset":5599},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"We will dive into these deeper in this guide. Let's take it step by step.","position":{"start":{"line":120,"column":1,"offset":5601},"end":{"line":120,"column":74,"offset":5674},"indent":[]}}],"position":{"start":{"line":120,"column":1,"offset":5601},"end":{"line":120,"column":74,"offset":5674},"indent":[]}},{"type":"export","value":"export const _frontmatter = {\"title\":\"Creating The Bot!\",\"metaTitle\":\"Creating A Bot | Discordeno\",\"metaDescription\":\"Let's create our very own bot with Discordeno!\"}","position":{"start":{"line":123,"column":1,"offset":5677},"end":{"line":123,"column":167,"offset":5843},"indent":[]}}],"position":{"start":{"line":1,"column":1,"offset":0},"end":{"line":123,"column":167,"offset":5843}}},"scopeImports":["import * as React from 'react'"],"scopeIdentifiers":["React"],"body":"function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }\n\nfunction _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }\n\nfunction _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }\n\n/* @jsx mdx */\nvar _frontmatter = {\n \"title\": \"Creating The Bot!\",\n \"metaTitle\": \"Creating A Bot | Discordeno\",\n \"metaDescription\": \"Let's create our very own bot with Discordeno!\"\n};\nvar layoutProps = {\n _frontmatter: _frontmatter\n};\nvar MDXLayout = \"wrapper\";\nreturn function MDXContent(_ref) {\n var components = _ref.components,\n props = _objectWithoutProperties(_ref, [\"components\"]);\n\n return mdx(MDXLayout, _extends({}, layoutProps, props, {\n components: components,\n mdxType: \"MDXLayout\"\n }), mdx(\"p\", null, \"Discordeno will help make Discord bot development much easier. Don't worry, as you go through this guide it will make a lot more sense.\"), mdx(\"h2\", null, \"Creating The Bot!\"), mdx(\"blockquote\", null, mdx(\"p\", {\n parentName: \"blockquote\"\n }, \"This guide is going to assume you already have the basic requirements to make a bot ready. This includes github, git, a code editor like Visual Studio Code. If you don't have these yet please prepare them first before going forward.\")), mdx(\"ul\", null, mdx(\"li\", {\n parentName: \"ul\"\n }, mdx(\"p\", {\n parentName: \"li\"\n }, \"First, create a Discordeno Bot using the \", mdx(\"a\", _extends({\n parentName: \"p\"\n }, {\n \"href\": \"https://github.com/Skillz4Killz/Discordeno-bot-template\"\n }), \"Generator Boilerplate\"), \". Give it any name you like. For the purpose of this guide we will call it, Stargate.\")), mdx(\"li\", {\n parentName: \"ul\"\n }, mdx(\"p\", {\n parentName: \"li\"\n }, \"Then \", mdx(\"inlineCode\", {\n parentName: \"p\"\n }, \"git clone https://github.com/Skillz4Killz/Stargate.git\"))), mdx(\"li\", {\n parentName: \"ul\"\n }, mdx(\"p\", {\n parentName: \"li\"\n }, \"When that is done, go ahead and open up the folder with VSC.\")), mdx(\"li\", {\n parentName: \"ul\"\n }, mdx(\"p\", {\n parentName: \"li\"\n }, \"Create a new file called \", mdx(\"inlineCode\", {\n parentName: \"p\"\n }, \"configs.ts\"), \". Open the \", mdx(\"inlineCode\", {\n parentName: \"p\"\n }, \"configs.example.ts\"), \" file and copy everything over.\"))), mdx(\"p\", null, \"Let's take a minute to review all the options we have available to us.\"), mdx(\"h3\", null, \"Configs File\"), mdx(\"p\", null, \"The \", mdx(\"inlineCode\", {\n parentName: \"p\"\n }, \"configs.ts\"), \" file is where you will keep all your secret info you don't want to share with anyone else. As long as \", mdx(\"inlineCode\", {\n parentName: \"p\"\n }, \".gitignore\"), \" file is ignoring configs.ts your configurations will be kept private!\"), mdx(\"pre\", null, mdx(\"code\", _extends({\n parentName: \"pre\"\n }, {\n \"className\": \"language-ts\"\n }), \"// Step 1: Remove the `.example` from this file name so it is called `configs.ts`\\n// Step 2: Add all your bot's information below. The only required one is token and prefix. NOTE: As long as `.gitignore` file is ignoring configs.ts your configurations will be kept private!\\n// Step 3: Remove these comments if you like.\\n\\nexport const configs = {\\n // Your bot token goes here\\n token: \\\"\\\",\\n // The default prefix for your bot. Don't worry guilds can change this later.\\n prefix: \\\"!\\\",\\n // This isn't required but you can add bot list api keys here.\\n botListTokens: {\\n DISCORD_BOT_ORG: \\\"\\\",\\n BOTS_ON_DISCORD: \\\"\\\",\\n DISCORD_BOT_LIST: \\\"\\\",\\n BOTS_FOR_DISCORD: \\\"\\\",\\n DISCORD_BOATS: \\\"\\\",\\n DISCORD_BOTS_GG: \\\"\\\",\\n DISCORD_BOTS_GROUP: \\\"\\\",\\n },\\n // This is the server id for your bot's main server where users can get help/support\\n supportServerID: \\\"\\\",\\n // These are channel ids that will enable some functionality\\n channelIDs: {\\n // When a translation is missing this is the channel you will be alerted in.\\n missingTranslation: \\\"\\\",\\n // When an error occurs, we will try and log it to this channel\\n errorChannelID: \\\"\\\"\\n },\\n // These are the role ids that will enable some functionality.\\n roleIDs: {\\n // If you have a patreon set up you can add the patreon vip role id here.\\n patreonVIPRoleID: \\\"\\\",\\n },\\n // These are the user ids that will enable some functionality.\\n userIDs: {\\n // The user ids for the support team\\n botSupporters: [],\\n // The user ids for the other devs on your team\\n botDevs: [],\\n // The user ids who have complete 100% access to your bot\\n botOwners: []\\n }\\n};\\n\\n\")), mdx(\"h4\", null, \"Token\"), mdx(\"p\", null, \"First, add your bot token. This is \", mdx(\"strong\", {\n parentName: \"p\"\n }, \"required\"), \" for the bot to start. Review the \", mdx(\"a\", _extends({\n parentName: \"p\"\n }, {\n \"href\": \"https://discordeno.netlify.app/gettingstarted#creatingyourfirstdiscordbotapplication\"\n }), \"instructions\"), \" if you have not made your token yet.\"), mdx(\"h4\", null, \"Prefix\"), mdx(\"p\", null, \"The prefix is where you will set the default prefix for your bot. Don't worry, every server will be able to choose their own prefix but we need a default prefix to start.\"), mdx(\"h4\", null, \"Bot Lists Tokens\"), mdx(\"p\", null, \"This section of the file is so you can easily have your bot's statistics updated on all the bot lists out there to help you grow your bot. The code is already written to handle this but you will need to do 3 things for each bot list.\"), mdx(\"ol\", null, mdx(\"li\", {\n parentName: \"ol\"\n }, \"Go to the bot list and add your bot to their website. (Each site has it's own instructions)\"), mdx(\"li\", {\n parentName: \"ol\"\n }, \"Create a token for yourself on each website and paste it in your configs.\"), mdx(\"li\", {\n parentName: \"ol\"\n }, \"Enjoy!\")), mdx(\"p\", null, \"If you wish to customize the code, you will find the bot list tasks in the tasks folder. Don't worry we will discuss this when we get to the tasks section of the guide.\"), mdx(\"p\", null, \"For now just remember, that Discordeno provides you a built in way to update most discord bot lists.\"), mdx(\"h4\", null, \"Channel IDs\"), mdx(\"p\", null, \"The channelIDs section holds the channel IDs that are useful for specific features to help give you alerts/notifications. For example, the \", mdx(\"inlineCode\", {\n parentName: \"p\"\n }, \"missingTranslation\"), \" channel will be where messages are sent alerting you that somewhere in your code you are trying to use a translation key that you never created.\"), mdx(\"p\", null, \"When you get to around 25,000 Discord servers on your bot, you may want to convert these channel IDs to webhooks.\"), mdx(\"h4\", null, \"Role IDs\"), mdx(\"p\", null, \"The roleIDs section holds the useful for specific features to help give you alerts/notifications. For example, the \", mdx(\"inlineCode\", {\n parentName: \"p\"\n }, \"missingTranslation\"), \" channel will be where messages are sent alerting you that somewhere in your code you are trying to use a translation key that you never created.\"), mdx(\"p\", null, \"When you get to around 25,000 Discord servers on your bot, you may want to convert these channel IDs to webhooks.\"), mdx(\"h2\", null, \"It's Alive!\"), mdx(\"p\", null, \"Oh my god! You now have a bot with a bunch of features already! You don't believe me? Well, seeing is believing, so start the bot.\"), mdx(\"ol\", null, mdx(\"li\", {\n parentName: \"ol\"\n }, \"Invite your bot to a discord server.\"), mdx(\"li\", {\n parentName: \"ol\"\n }, \"Open up the integrated terminal in VSC using \", mdx(\"strong\", {\n parentName: \"li\"\n }, \"CTRL + `\"), \". If you use a Mac, replace CTRL with CMD.\"), mdx(\"li\", {\n parentName: \"ol\"\n }, \"Run the script below:\")), mdx(\"pre\", null, mdx(\"code\", _extends({\n parentName: \"pre\"\n }, {\n \"className\": \"language-shell\"\n }), \"deno run --allow-net --allow-read mod.ts\\n\")), mdx(\"p\", null, \"The first time you run it, you may see a lot of files being loaded. This is preparing all the magic behind the scene. Once it is ready, you will see something like this:\"), mdx(\"p\", null, mdx(\"img\", _extends({\n parentName: \"p\"\n }, {\n \"src\": \"https://i.imgur.com/TOXjLgh.png\",\n \"alt\": \"image\"\n }))), mdx(\"h2\", null, \"Understanding What Discordeno Did\"), mdx(\"p\", null, \"Discordeno includes these commands/folders as they are essential for any discord bot to have in order to meet the Discord Bot Best Practices. It also adds a few things that will help make some things easier to build a bot.\"), mdx(\"p\", null, \"We will dive into these deeper in this guide. Let's take it step by step.\"));\n}\n;\nMDXContent.isMDXComponent = true;","rawMDXOutput":"/* @jsx mdx */\nimport { mdx } from '@mdx-js/react';\n/* @jsx mdx */\n\nexport const _frontmatter = {\n \"title\": \"Creating The Bot!\",\n \"metaTitle\": \"Creating A Bot | Discordeno\",\n \"metaDescription\": \"Let's create our very own bot with Discordeno!\"\n};\n\nconst layoutProps = {\n _frontmatter\n};\nconst MDXLayout = \"wrapper\"\nexport default function MDXContent({\n components,\n ...props\n}) {\n return \n

{`Discordeno will help make Discord bot development much easier. Don't worry, as you go through this guide it will make a lot more sense.`}

\n

{`Creating The Bot!`}

\n
\n

{`This guide is going to assume you already have the basic requirements to make a bot ready. This includes github, git, a code editor like Visual Studio Code. If you don't have these yet please prepare them first before going forward.`}

\n
\n
    \n
  • \n

    {`First, create a Discordeno Bot using the `}{`Generator Boilerplate`}{`. Give it any name you like. For the purpose of this guide we will call it, Stargate.`}

    \n
  • \n
  • \n

    {`Then `}{`git clone https://github.com/Skillz4Killz/Stargate.git`}

    \n
  • \n
  • \n

    {`When that is done, go ahead and open up the folder with VSC.`}

    \n
  • \n
  • \n

    {`Create a new file called `}{`configs.ts`}{`. Open the `}{`configs.example.ts`}{` file and copy everything over.`}

    \n
  • \n
\n

{`Let's take a minute to review all the options we have available to us.`}

\n

{`Configs File`}

\n

{`The `}{`configs.ts`}{` file is where you will keep all your secret info you don't want to share with anyone else. As long as `}{`.gitignore`}{` file is ignoring configs.ts your configurations will be kept private!`}

\n
{`// Step 1: Remove the \\`.example\\` from this file name so it is called \\`configs.ts\\`\n// Step 2: Add all your bot's information below. The only required one is token and prefix. NOTE: As long as \\`.gitignore\\` file is ignoring configs.ts your configurations will be kept private!\n// Step 3: Remove these comments if you like.\n\nexport const configs = {\n  // Your bot token goes here\n  token: \"\",\n  // The default prefix for your bot. Don't worry guilds can change this later.\n  prefix: \"!\",\n  // This isn't required but you can add bot list api keys here.\n  botListTokens: {\n    DISCORD_BOT_ORG: \"\",\n    BOTS_ON_DISCORD: \"\",\n    DISCORD_BOT_LIST: \"\",\n    BOTS_FOR_DISCORD: \"\",\n    DISCORD_BOATS: \"\",\n    DISCORD_BOTS_GG: \"\",\n    DISCORD_BOTS_GROUP: \"\",\n  },\n  // This is the server id for your bot's main server where users can get help/support\n  supportServerID: \"\",\n  // These are channel ids that will enable some functionality\n  channelIDs: {\n    // When a translation is missing this is the channel you will be alerted in.\n    missingTranslation: \"\",\n    // When an error occurs, we will try and log it to this channel\n    errorChannelID: \"\"\n  },\n  // These are the role ids that will enable some functionality.\n  roleIDs: {\n    // If you have a patreon set up you can add the patreon vip role id here.\n    patreonVIPRoleID: \"\",\n  },\n  // These are the user ids that will enable some functionality.\n  userIDs: {\n    // The user ids for the support team\n    botSupporters: [],\n    // The user ids for the other devs on your team\n    botDevs: [],\n    // The user ids who have complete 100% access to your bot\n    botOwners: []\n  }\n};\n\n`}
\n

{`Token`}

\n

{`First, add your bot token. This is `}{`required`}{` for the bot to start. Review the `}{`instructions`}{` if you have not made your token yet.`}

\n

{`Prefix`}

\n

{`The prefix is where you will set the default prefix for your bot. Don't worry, every server will be able to choose their own prefix but we need a default prefix to start.`}

\n

{`Bot Lists Tokens`}

\n

{`This section of the file is so you can easily have your bot's statistics updated on all the bot lists out there to help you grow your bot. The code is already written to handle this but you will need to do 3 things for each bot list.`}

\n
    \n
  1. {`Go to the bot list and add your bot to their website. (Each site has it's own instructions)`}
  2. \n
  3. {`Create a token for yourself on each website and paste it in your configs.`}
  4. \n
  5. {`Enjoy!`}
  6. \n
\n

{`If you wish to customize the code, you will find the bot list tasks in the tasks folder. Don't worry we will discuss this when we get to the tasks section of the guide.`}

\n

{`For now just remember, that Discordeno provides you a built in way to update most discord bot lists.`}

\n

{`Channel IDs`}

\n

{`The channelIDs section holds the channel IDs that are useful for specific features to help give you alerts/notifications. For example, the `}{`missingTranslation`}{` channel will be where messages are sent alerting you that somewhere in your code you are trying to use a translation key that you never created.`}

\n

{`When you get to around 25,000 Discord servers on your bot, you may want to convert these channel IDs to webhooks.`}

\n

{`Role IDs`}

\n

{`The roleIDs section holds the useful for specific features to help give you alerts/notifications. For example, the `}{`missingTranslation`}{` channel will be where messages are sent alerting you that somewhere in your code you are trying to use a translation key that you never created.`}

\n

{`When you get to around 25,000 Discord servers on your bot, you may want to convert these channel IDs to webhooks.`}

\n

{`It's Alive!`}

\n

{`Oh my god! You now have a bot with a bunch of features already! You don't believe me? Well, seeing is believing, so start the bot.`}

\n
    \n
  1. {`Invite your bot to a discord server.`}
  2. \n
  3. {`Open up the integrated terminal in VSC using `}{`CTRL + \\``}{`. If you use a Mac, replace CTRL with CMD.`}
  4. \n
  5. {`Run the script below:`}
  6. \n
\n
{`deno run --allow-net --allow-read mod.ts\n`}
\n

{`The first time you run it, you may see a lot of files being loaded. This is preparing all the magic behind the scene. Once it is ready, you will see something like this:`}

\n

\n

{`Understanding What Discordeno Did`}

\n

{`Discordeno includes these commands/folders as they are essential for any discord bot to have in order to meet the Discord Bot Best Practices. It also adds a few things that will help make some things easier to build a bot.`}

\n

{`We will dive into these deeper in this guide. Let's take it step by step.`}

\n\n
;\n}\n\n;\nMDXContent.isMDXComponent = true;"}} \ No newline at end of file diff --git a/docs/.cache/caches/gatsby-plugin-mdx/diskstore-93e1cced495a2f783d0b731bf610732c.json b/docs/.cache/caches/gatsby-plugin-mdx/diskstore-93e1cced495a2f783d0b731bf610732c.json new file mode 100644 index 000000000..db7de1194 --- /dev/null +++ b/docs/.cache/caches/gatsby-plugin-mdx/diskstore-93e1cced495a2f783d0b731bf610732c.json @@ -0,0 +1 @@ +{"expireTime":9007200851633777000,"key":"gatsby-plugin-mdx-entire-payload-607436ff9eecc54582e1572ade5ebc9b-","val":{"mdast":{"type":"root","children":[{"type":"paragraph","children":[{"type":"text","value":"Woah! You are almost half way done with understanding all of Discordeno. Amazing isn't it? Something you may have noticed in the last section was there were some options that prevented some commands from running like ","position":{"start":{"line":2,"column":1,"offset":1},"end":{"line":2,"column":218,"offset":218},"indent":[]}},{"type":"inlineCode","value":"dmOnly","position":{"start":{"line":2,"column":218,"offset":218},"end":{"line":2,"column":226,"offset":226},"indent":[]}},{"type":"text","value":" or the permission options. we created a setting to prevent the monitor from running in certain channels. What if we wanted to do prevent commands from happening? How would we prevent commands from running?","position":{"start":{"line":2,"column":226,"offset":226},"end":{"line":2,"column":432,"offset":432},"indent":[]}}],"position":{"start":{"line":2,"column":1,"offset":1},"end":{"line":2,"column":432,"offset":432},"indent":[]}},{"type":"heading","depth":2,"children":[{"type":"text","value":"What is an Inhibitor?","position":{"start":{"line":4,"column":4,"offset":437},"end":{"line":4,"column":25,"offset":458},"indent":[]}}],"position":{"start":{"line":4,"column":1,"offset":434},"end":{"line":4,"column":25,"offset":458},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"An Inhibitor is very similar to how monitors work. A monitor runs on every message but an inhibitor runs on every command. Remember all those command options like cooldown, permissions, permissionLevel, nsfw, etc... Each and every one of these options has an inhibitor in that checks commands for these settings.","position":{"start":{"line":6,"column":1,"offset":460},"end":{"line":6,"column":313,"offset":772},"indent":[]}}],"position":{"start":{"line":6,"column":1,"offset":460},"end":{"line":6,"column":313,"offset":772},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"Let's create our own inhibitor that would prevent commands from being used if the user is not a VIP user.","position":{"start":{"line":8,"column":1,"offset":774},"end":{"line":8,"column":106,"offset":879},"indent":[]}}],"position":{"start":{"line":8,"column":1,"offset":774},"end":{"line":8,"column":106,"offset":879},"indent":[]}},{"type":"blockquote","children":[{"type":"paragraph","children":[{"type":"strong","children":[{"type":"text","value":"Note:","position":{"start":{"line":10,"column":5,"offset":885},"end":{"line":10,"column":10,"offset":890},"indent":[]}}],"position":{"start":{"line":10,"column":3,"offset":883},"end":{"line":10,"column":12,"offset":892},"indent":[]}},{"type":"text","value":" It is important to remember that everything below can be done with a simple permission level as well. We will create our own custom permission levels but for the purposes of this guide and to be able to learn about Inhibitors, we will be using an inhibitor.","position":{"start":{"line":10,"column":12,"offset":892},"end":{"line":10,"column":270,"offset":1150},"indent":[]}}],"position":{"start":{"line":10,"column":3,"offset":883},"end":{"line":10,"column":270,"offset":1150},"indent":[]}}],"position":{"start":{"line":10,"column":1,"offset":881},"end":{"line":10,"column":270,"offset":1150},"indent":[]}},{"type":"heading","depth":2,"children":[{"type":"text","value":"Creating the File","position":{"start":{"line":12,"column":4,"offset":1155},"end":{"line":12,"column":21,"offset":1172},"indent":[]}}],"position":{"start":{"line":12,"column":1,"offset":1152},"end":{"line":12,"column":21,"offset":1172},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"Let's start by creating a file inside the inhibitors folder called ","position":{"start":{"line":14,"column":1,"offset":1174},"end":{"line":14,"column":68,"offset":1241},"indent":[]}},{"type":"inlineCode","value":"vipOnly.ts","position":{"start":{"line":14,"column":68,"offset":1241},"end":{"line":14,"column":80,"offset":1253},"indent":[]}},{"type":"text","value":" and paste the following snippet of code:","position":{"start":{"line":14,"column":80,"offset":1253},"end":{"line":14,"column":121,"offset":1294},"indent":[]}}],"position":{"start":{"line":14,"column":1,"offset":1174},"end":{"line":14,"column":121,"offset":1294},"indent":[]}},{"type":"code","lang":"ts","meta":null,"value":"import { botCache } from \"../../mod.ts\";\n\nbotCache.inhibitors.set(\"inhibitorname\", async function (message, command, guild) {\n\t// Your code goes here\n});","position":{"start":{"line":16,"column":1,"offset":1296},"end":{"line":22,"column":4,"offset":1459},"indent":[1,1,1,1,1,1]}},{"type":"paragraph","children":[{"type":"text","value":"Inhibitors can take up to 3 arguments.","position":{"start":{"line":24,"column":1,"offset":1461},"end":{"line":24,"column":39,"offset":1499},"indent":[]}}],"position":{"start":{"line":24,"column":1,"offset":1461},"end":{"line":24,"column":39,"offset":1499},"indent":[]}},{"type":"list","ordered":false,"start":null,"spread":false,"children":[{"type":"listItem","spread":false,"checked":null,"children":[{"type":"paragraph","children":[{"type":"inlineCode","value":"message","position":{"start":{"line":26,"column":3,"offset":1503},"end":{"line":26,"column":12,"offset":1512},"indent":[]}},{"type":"text","value":": The message object that triggered the command.","position":{"start":{"line":26,"column":12,"offset":1512},"end":{"line":26,"column":60,"offset":1560},"indent":[]}}],"position":{"start":{"line":26,"column":3,"offset":1503},"end":{"line":26,"column":60,"offset":1560},"indent":[]}}],"position":{"start":{"line":26,"column":1,"offset":1501},"end":{"line":26,"column":60,"offset":1560},"indent":[]}},{"type":"listItem","spread":false,"checked":null,"children":[{"type":"paragraph","children":[{"type":"inlineCode","value":"command","position":{"start":{"line":27,"column":3,"offset":1563},"end":{"line":27,"column":12,"offset":1572},"indent":[]}},{"type":"text","value":": The command object itself that was triggered.","position":{"start":{"line":27,"column":12,"offset":1572},"end":{"line":27,"column":59,"offset":1619},"indent":[]}}],"position":{"start":{"line":27,"column":3,"offset":1563},"end":{"line":27,"column":59,"offset":1619},"indent":[]}}],"position":{"start":{"line":27,"column":1,"offset":1561},"end":{"line":27,"column":59,"offset":1619},"indent":[]}},{"type":"listItem","spread":false,"checked":null,"children":[{"type":"paragraph","children":[{"type":"inlineCode","value":"guild","position":{"start":{"line":28,"column":3,"offset":1622},"end":{"line":28,"column":10,"offset":1629},"indent":[]}},{"type":"text","value":": The server guild object where this command was ran.","position":{"start":{"line":28,"column":10,"offset":1629},"end":{"line":28,"column":63,"offset":1682},"indent":[]}}],"position":{"start":{"line":28,"column":3,"offset":1622},"end":{"line":28,"column":63,"offset":1682},"indent":[]}}],"position":{"start":{"line":28,"column":1,"offset":1620},"end":{"line":28,"column":63,"offset":1682},"indent":[]}}],"position":{"start":{"line":26,"column":1,"offset":1501},"end":{"line":28,"column":63,"offset":1682},"indent":[1,1]}},{"type":"heading","depth":2,"children":[{"type":"text","value":"Understanding How Inhibitors Function","position":{"start":{"line":30,"column":4,"offset":1687},"end":{"line":30,"column":41,"offset":1724},"indent":[]}}],"position":{"start":{"line":30,"column":1,"offset":1684},"end":{"line":30,"column":41,"offset":1724},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"To block a command you have to return a truthy value.","position":{"start":{"line":32,"column":1,"offset":1726},"end":{"line":32,"column":54,"offset":1779},"indent":[]}}],"position":{"start":{"line":32,"column":1,"offset":1726},"end":{"line":32,"column":54,"offset":1779},"indent":[]}},{"type":"list","ordered":false,"start":null,"spread":false,"children":[{"type":"listItem","spread":false,"checked":null,"children":[{"type":"paragraph","children":[{"type":"strong","children":[{"type":"text","value":"return true;","position":{"start":{"line":33,"column":5,"offset":1784},"end":{"line":33,"column":17,"offset":1796},"indent":[]}}],"position":{"start":{"line":33,"column":3,"offset":1782},"end":{"line":33,"column":19,"offset":1798},"indent":[]}},{"type":"text","value":" If you return true the inhibitor will block the execution of the command.\nTo allow a command return a falsey value.","position":{"start":{"line":33,"column":19,"offset":1798},"end":{"line":34,"column":42,"offset":1914},"indent":[1]}}],"position":{"start":{"line":33,"column":3,"offset":1782},"end":{"line":34,"column":42,"offset":1914},"indent":[1]}}],"position":{"start":{"line":33,"column":1,"offset":1780},"end":{"line":34,"column":42,"offset":1914},"indent":[1]}},{"type":"listItem","spread":false,"checked":null,"children":[{"type":"paragraph","children":[{"type":"strong","children":[{"type":"text","value":"return false;","position":{"start":{"line":35,"column":5,"offset":1919},"end":{"line":35,"column":18,"offset":1932},"indent":[]}}],"position":{"start":{"line":35,"column":3,"offset":1917},"end":{"line":35,"column":20,"offset":1934},"indent":[]}},{"type":"text","value":" If you return false the inhibitor will not block the error.","position":{"start":{"line":35,"column":20,"offset":1934},"end":{"line":35,"column":80,"offset":1994},"indent":[]}}],"position":{"start":{"line":35,"column":3,"offset":1917},"end":{"line":35,"column":80,"offset":1994},"indent":[]}}],"position":{"start":{"line":35,"column":1,"offset":1915},"end":{"line":35,"column":80,"offset":1994},"indent":[]}}],"position":{"start":{"line":33,"column":1,"offset":1780},"end":{"line":35,"column":80,"offset":1994},"indent":[1,1]}},{"type":"code","lang":"ts","meta":null,"value":"// If the command is not VIP only we can allow this command to execute\nif (!command.vipOnly) return false;\n\n// Check if the user is VIP\n// `isUserVIP` is NOT a thing. I am just using it as a placeholder here\nconst userIsVIP = await isUserVIP(message.author.id)\n// The user is VIP so we can allow this command to be used\nif (userIsVIP) return false;\n\n// The user is NOT VIP so we throw an error\nthrow `The ${command.name} is only allowed for VIP users.`","position":{"start":{"line":38,"column":1,"offset":1997},"end":{"line":50,"column":4,"offset":2459},"indent":[1,1,1,1,1,1,1,1,1,1,1,1]}},{"type":"export","value":"export const _frontmatter = {\"title\":\"Creating Inhibitors!\",\"metaTitle\":\"Creating An Inhibitor | Discordeno\",\"metaDescription\":\"Let's create our very own bot with Discordeno!\"}","position":{"start":{"line":53,"column":1,"offset":2462},"end":{"line":53,"column":177,"offset":2638},"indent":[]}}],"position":{"start":{"line":1,"column":1,"offset":0},"end":{"line":53,"column":177,"offset":2638}}},"scopeImports":["import * as React from 'react'"],"scopeIdentifiers":["React"],"body":"function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }\n\nfunction _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }\n\nfunction _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }\n\n/* @jsx mdx */\nvar _frontmatter = {\n \"title\": \"Creating Inhibitors!\",\n \"metaTitle\": \"Creating An Inhibitor | Discordeno\",\n \"metaDescription\": \"Let's create our very own bot with Discordeno!\"\n};\nvar layoutProps = {\n _frontmatter: _frontmatter\n};\nvar MDXLayout = \"wrapper\";\nreturn function MDXContent(_ref) {\n var components = _ref.components,\n props = _objectWithoutProperties(_ref, [\"components\"]);\n\n return mdx(MDXLayout, _extends({}, layoutProps, props, {\n components: components,\n mdxType: \"MDXLayout\"\n }), mdx(\"p\", null, \"Woah! You are almost half way done with understanding all of Discordeno. Amazing isn't it? Something you may have noticed in the last section was there were some options that prevented some commands from running like \", mdx(\"inlineCode\", {\n parentName: \"p\"\n }, \"dmOnly\"), \" or the permission options. we created a setting to prevent the monitor from running in certain channels. What if we wanted to do prevent commands from happening? How would we prevent commands from running?\"), mdx(\"h2\", null, \"What is an Inhibitor?\"), mdx(\"p\", null, \"An Inhibitor is very similar to how monitors work. A monitor runs on every message but an inhibitor runs on every command. Remember all those command options like cooldown, permissions, permissionLevel, nsfw, etc... Each and every one of these options has an inhibitor in that checks commands for these settings.\"), mdx(\"p\", null, \"Let's create our own inhibitor that would prevent commands from being used if the user is not a VIP user.\"), mdx(\"blockquote\", null, mdx(\"p\", {\n parentName: \"blockquote\"\n }, mdx(\"strong\", {\n parentName: \"p\"\n }, \"Note:\"), \" It is important to remember that everything below can be done with a simple permission level as well. We will create our own custom permission levels but for the purposes of this guide and to be able to learn about Inhibitors, we will be using an inhibitor.\")), mdx(\"h2\", null, \"Creating the File\"), mdx(\"p\", null, \"Let's start by creating a file inside the inhibitors folder called \", mdx(\"inlineCode\", {\n parentName: \"p\"\n }, \"vipOnly.ts\"), \" and paste the following snippet of code:\"), mdx(\"pre\", null, mdx(\"code\", _extends({\n parentName: \"pre\"\n }, {\n \"className\": \"language-ts\"\n }), \"import { botCache } from \\\"../../mod.ts\\\";\\n\\nbotCache.inhibitors.set(\\\"inhibitorname\\\", async function (message, command, guild) {\\n // Your code goes here\\n});\\n\")), mdx(\"p\", null, \"Inhibitors can take up to 3 arguments.\"), mdx(\"ul\", null, mdx(\"li\", {\n parentName: \"ul\"\n }, mdx(\"inlineCode\", {\n parentName: \"li\"\n }, \"message\"), \": The message object that triggered the command.\"), mdx(\"li\", {\n parentName: \"ul\"\n }, mdx(\"inlineCode\", {\n parentName: \"li\"\n }, \"command\"), \": The command object itself that was triggered.\"), mdx(\"li\", {\n parentName: \"ul\"\n }, mdx(\"inlineCode\", {\n parentName: \"li\"\n }, \"guild\"), \": The server guild object where this command was ran.\")), mdx(\"h2\", null, \"Understanding How Inhibitors Function\"), mdx(\"p\", null, \"To block a command you have to return a truthy value.\"), mdx(\"ul\", null, mdx(\"li\", {\n parentName: \"ul\"\n }, mdx(\"strong\", {\n parentName: \"li\"\n }, \"return true;\"), \" If you return true the inhibitor will block the execution of the command.\\nTo allow a command return a falsey value.\"), mdx(\"li\", {\n parentName: \"ul\"\n }, mdx(\"strong\", {\n parentName: \"li\"\n }, \"return false;\"), \" If you return false the inhibitor will not block the error.\")), mdx(\"pre\", null, mdx(\"code\", _extends({\n parentName: \"pre\"\n }, {\n \"className\": \"language-ts\"\n }), \"// If the command is not VIP only we can allow this command to execute\\nif (!command.vipOnly) return false;\\n\\n// Check if the user is VIP\\n// `isUserVIP` is NOT a thing. I am just using it as a placeholder here\\nconst userIsVIP = await isUserVIP(message.author.id)\\n// The user is VIP so we can allow this command to be used\\nif (userIsVIP) return false;\\n\\n// The user is NOT VIP so we throw an error\\nthrow `The ${command.name} is only allowed for VIP users.`\\n\")));\n}\n;\nMDXContent.isMDXComponent = true;","rawMDXOutput":"/* @jsx mdx */\nimport { mdx } from '@mdx-js/react';\n/* @jsx mdx */\n\nexport const _frontmatter = {\n \"title\": \"Creating Inhibitors!\",\n \"metaTitle\": \"Creating An Inhibitor | Discordeno\",\n \"metaDescription\": \"Let's create our very own bot with Discordeno!\"\n};\n\nconst layoutProps = {\n _frontmatter\n};\nconst MDXLayout = \"wrapper\"\nexport default function MDXContent({\n components,\n ...props\n}) {\n return \n

{`Woah! You are almost half way done with understanding all of Discordeno. Amazing isn't it? Something you may have noticed in the last section was there were some options that prevented some commands from running like `}{`dmOnly`}{` or the permission options. we created a setting to prevent the monitor from running in certain channels. What if we wanted to do prevent commands from happening? How would we prevent commands from running?`}

\n

{`What is an Inhibitor?`}

\n

{`An Inhibitor is very similar to how monitors work. A monitor runs on every message but an inhibitor runs on every command. Remember all those command options like cooldown, permissions, permissionLevel, nsfw, etc... Each and every one of these options has an inhibitor in that checks commands for these settings.`}

\n

{`Let's create our own inhibitor that would prevent commands from being used if the user is not a VIP user.`}

\n
\n

{`Note:`}{` It is important to remember that everything below can be done with a simple permission level as well. We will create our own custom permission levels but for the purposes of this guide and to be able to learn about Inhibitors, we will be using an inhibitor.`}

\n
\n

{`Creating the File`}

\n

{`Let's start by creating a file inside the inhibitors folder called `}{`vipOnly.ts`}{` and paste the following snippet of code:`}

\n
{`import { botCache } from \"../../mod.ts\";\n\nbotCache.inhibitors.set(\"inhibitorname\", async function (message, command, guild) {\n    // Your code goes here\n});\n`}
\n

{`Inhibitors can take up to 3 arguments.`}

\n
    \n
  • {`message`}{`: The message object that triggered the command.`}
  • \n
  • {`command`}{`: The command object itself that was triggered.`}
  • \n
  • {`guild`}{`: The server guild object where this command was ran.`}
  • \n
\n

{`Understanding How Inhibitors Function`}

\n

{`To block a command you have to return a truthy value.`}

\n
    \n
  • {`return true;`}{` If you return true the inhibitor will block the execution of the command.\nTo allow a command return a falsey value.`}
  • \n
  • {`return false;`}{` If you return false the inhibitor will not block the error.`}
  • \n
\n
{`// If the command is not VIP only we can allow this command to execute\nif (!command.vipOnly) return false;\n\n// Check if the user is VIP\n// \\`isUserVIP\\` is NOT a thing. I am just using it as a placeholder here\nconst userIsVIP = await isUserVIP(message.author.id)\n// The user is VIP so we can allow this command to be used\nif (userIsVIP) return false;\n\n// The user is NOT VIP so we throw an error\nthrow \\`The \\${command.name} is only allowed for VIP users.\\`\n`}
\n\n
;\n}\n\n;\nMDXContent.isMDXComponent = true;"}} \ No newline at end of file diff --git a/docs/.cache/caches/gatsby-plugin-mdx/diskstore-93ed76efa1e16fead411796ef2375e98.json b/docs/.cache/caches/gatsby-plugin-mdx/diskstore-93ed76efa1e16fead411796ef2375e98.json new file mode 100644 index 000000000..b0f3b4e85 --- /dev/null +++ b/docs/.cache/caches/gatsby-plugin-mdx/diskstore-93ed76efa1e16fead411796ef2375e98.json @@ -0,0 +1 @@ +{"expireTime":9007200851634032000,"key":"gatsby-plugin-mdx-entire-payload-7dc2383c9cf2d41ba318edc83ed10ebe-","val":{"mdast":{"type":"root","children":[{"type":"paragraph","children":[{"type":"text","value":"Woah! You are almost half way done with understanding all of Discordeno. Amazing isn't it? Something you may have noticed in the last section was there were some options that prevented some commands from running like ","position":{"start":{"line":2,"column":1,"offset":1},"end":{"line":2,"column":218,"offset":218},"indent":[]}},{"type":"inlineCode","value":"dmOnly","position":{"start":{"line":2,"column":218,"offset":218},"end":{"line":2,"column":226,"offset":226},"indent":[]}},{"type":"text","value":" or the permission options. we created a setting to prevent the monitor from running in certain channels. What if we wanted to do prevent commands from happening? How would we prevent commands from running?","position":{"start":{"line":2,"column":226,"offset":226},"end":{"line":2,"column":432,"offset":432},"indent":[]}}],"position":{"start":{"line":2,"column":1,"offset":1},"end":{"line":2,"column":432,"offset":432},"indent":[]}},{"type":"heading","depth":2,"children":[{"type":"text","value":"What is an Inhibitor?","position":{"start":{"line":4,"column":4,"offset":437},"end":{"line":4,"column":25,"offset":458},"indent":[]}}],"position":{"start":{"line":4,"column":1,"offset":434},"end":{"line":4,"column":25,"offset":458},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"An Inhibitor is very similar to how monitors work. A monitor runs on every message but an inhibitor runs on every command. Remember all those command options like cooldown, permissions, permissionLevel, nsfw, etc... Each and every one of these options has an inhibitor in that checks commands for these settings.","position":{"start":{"line":6,"column":1,"offset":460},"end":{"line":6,"column":313,"offset":772},"indent":[]}}],"position":{"start":{"line":6,"column":1,"offset":460},"end":{"line":6,"column":313,"offset":772},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"Let's create our own inhibitor that would prevent commands from being used if the user is not a VIP user.","position":{"start":{"line":8,"column":1,"offset":774},"end":{"line":8,"column":106,"offset":879},"indent":[]}}],"position":{"start":{"line":8,"column":1,"offset":774},"end":{"line":8,"column":106,"offset":879},"indent":[]}},{"type":"blockquote","children":[{"type":"paragraph","children":[{"type":"strong","children":[{"type":"text","value":"Note:","position":{"start":{"line":10,"column":5,"offset":885},"end":{"line":10,"column":10,"offset":890},"indent":[]}}],"position":{"start":{"line":10,"column":3,"offset":883},"end":{"line":10,"column":12,"offset":892},"indent":[]}},{"type":"text","value":" It is important to remember that everything below can be done with a simple permission level as well. We will create our own custom permission levels but for the purposes of this guide and to be able to learn about Inhibitors, we will be using an inhibitor.","position":{"start":{"line":10,"column":12,"offset":892},"end":{"line":10,"column":270,"offset":1150},"indent":[]}}],"position":{"start":{"line":10,"column":3,"offset":883},"end":{"line":10,"column":270,"offset":1150},"indent":[]}}],"position":{"start":{"line":10,"column":1,"offset":881},"end":{"line":10,"column":270,"offset":1150},"indent":[]}},{"type":"heading","depth":2,"children":[{"type":"text","value":"Creating the File","position":{"start":{"line":12,"column":4,"offset":1155},"end":{"line":12,"column":21,"offset":1172},"indent":[]}}],"position":{"start":{"line":12,"column":1,"offset":1152},"end":{"line":12,"column":21,"offset":1172},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"Let's start by creating a file inside the inhibitors folder called ","position":{"start":{"line":14,"column":1,"offset":1174},"end":{"line":14,"column":68,"offset":1241},"indent":[]}},{"type":"inlineCode","value":"boostRequired.ts","position":{"start":{"line":14,"column":68,"offset":1241},"end":{"line":14,"column":86,"offset":1259},"indent":[]}},{"type":"text","value":" and paste the following snippet of code:","position":{"start":{"line":14,"column":86,"offset":1259},"end":{"line":14,"column":127,"offset":1300},"indent":[]}}],"position":{"start":{"line":14,"column":1,"offset":1174},"end":{"line":14,"column":127,"offset":1300},"indent":[]}},{"type":"code","lang":"ts","meta":null,"value":"import { botCache } from \"../../mod.ts\";\n\nbotCache.inhibitors.set(\"inhibitorname\", async function (message, command, guild) {\n\t// Your code goes here\n});","position":{"start":{"line":16,"column":1,"offset":1302},"end":{"line":22,"column":4,"offset":1465},"indent":[1,1,1,1,1,1]}},{"type":"paragraph","children":[{"type":"text","value":"Inhibitors can take up to 3 arguments.","position":{"start":{"line":24,"column":1,"offset":1467},"end":{"line":24,"column":39,"offset":1505},"indent":[]}}],"position":{"start":{"line":24,"column":1,"offset":1467},"end":{"line":24,"column":39,"offset":1505},"indent":[]}},{"type":"list","ordered":false,"start":null,"spread":false,"children":[{"type":"listItem","spread":false,"checked":null,"children":[{"type":"paragraph","children":[{"type":"inlineCode","value":"message","position":{"start":{"line":26,"column":3,"offset":1509},"end":{"line":26,"column":12,"offset":1518},"indent":[]}},{"type":"text","value":": The message object that triggered the command.","position":{"start":{"line":26,"column":12,"offset":1518},"end":{"line":26,"column":60,"offset":1566},"indent":[]}}],"position":{"start":{"line":26,"column":3,"offset":1509},"end":{"line":26,"column":60,"offset":1566},"indent":[]}}],"position":{"start":{"line":26,"column":1,"offset":1507},"end":{"line":26,"column":60,"offset":1566},"indent":[]}},{"type":"listItem","spread":false,"checked":null,"children":[{"type":"paragraph","children":[{"type":"inlineCode","value":"command","position":{"start":{"line":27,"column":3,"offset":1569},"end":{"line":27,"column":12,"offset":1578},"indent":[]}},{"type":"text","value":": The command object itself that was triggered.","position":{"start":{"line":27,"column":12,"offset":1578},"end":{"line":27,"column":59,"offset":1625},"indent":[]}}],"position":{"start":{"line":27,"column":3,"offset":1569},"end":{"line":27,"column":59,"offset":1625},"indent":[]}}],"position":{"start":{"line":27,"column":1,"offset":1567},"end":{"line":27,"column":59,"offset":1625},"indent":[]}},{"type":"listItem","spread":false,"checked":null,"children":[{"type":"paragraph","children":[{"type":"inlineCode","value":"guild","position":{"start":{"line":28,"column":3,"offset":1628},"end":{"line":28,"column":10,"offset":1635},"indent":[]}},{"type":"text","value":": The server guild object where this command was ran.","position":{"start":{"line":28,"column":10,"offset":1635},"end":{"line":28,"column":63,"offset":1688},"indent":[]}}],"position":{"start":{"line":28,"column":3,"offset":1628},"end":{"line":28,"column":63,"offset":1688},"indent":[]}}],"position":{"start":{"line":28,"column":1,"offset":1626},"end":{"line":28,"column":63,"offset":1688},"indent":[]}}],"position":{"start":{"line":26,"column":1,"offset":1507},"end":{"line":28,"column":63,"offset":1688},"indent":[1,1]}},{"type":"heading","depth":2,"children":[{"type":"text","value":"Understanding How Inhibitors Function","position":{"start":{"line":30,"column":4,"offset":1693},"end":{"line":30,"column":41,"offset":1730},"indent":[]}}],"position":{"start":{"line":30,"column":1,"offset":1690},"end":{"line":30,"column":41,"offset":1730},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"To block a command you have to return a truthy value.","position":{"start":{"line":32,"column":1,"offset":1732},"end":{"line":32,"column":54,"offset":1785},"indent":[]}}],"position":{"start":{"line":32,"column":1,"offset":1732},"end":{"line":32,"column":54,"offset":1785},"indent":[]}},{"type":"list","ordered":false,"start":null,"spread":false,"children":[{"type":"listItem","spread":false,"checked":null,"children":[{"type":"paragraph","children":[{"type":"strong","children":[{"type":"text","value":"return true;","position":{"start":{"line":33,"column":5,"offset":1790},"end":{"line":33,"column":17,"offset":1802},"indent":[]}}],"position":{"start":{"line":33,"column":3,"offset":1788},"end":{"line":33,"column":19,"offset":1804},"indent":[]}},{"type":"text","value":" If you return true the inhibitor will block the execution of the command.\nTo allow a command return a falsey value.","position":{"start":{"line":33,"column":19,"offset":1804},"end":{"line":34,"column":42,"offset":1920},"indent":[1]}}],"position":{"start":{"line":33,"column":3,"offset":1788},"end":{"line":34,"column":42,"offset":1920},"indent":[1]}}],"position":{"start":{"line":33,"column":1,"offset":1786},"end":{"line":34,"column":42,"offset":1920},"indent":[1]}},{"type":"listItem","spread":false,"checked":null,"children":[{"type":"paragraph","children":[{"type":"strong","children":[{"type":"text","value":"return false;","position":{"start":{"line":35,"column":5,"offset":1925},"end":{"line":35,"column":18,"offset":1938},"indent":[]}}],"position":{"start":{"line":35,"column":3,"offset":1923},"end":{"line":35,"column":20,"offset":1940},"indent":[]}},{"type":"text","value":" If you return false the inhibitor will not block the error.","position":{"start":{"line":35,"column":20,"offset":1940},"end":{"line":35,"column":80,"offset":2000},"indent":[]}}],"position":{"start":{"line":35,"column":3,"offset":1923},"end":{"line":35,"column":80,"offset":2000},"indent":[]}}],"position":{"start":{"line":35,"column":1,"offset":1921},"end":{"line":35,"column":80,"offset":2000},"indent":[]}}],"position":{"start":{"line":33,"column":1,"offset":1786},"end":{"line":35,"column":80,"offset":2000},"indent":[1,1]}},{"type":"code","lang":"ts","meta":null,"value":"// If the command does not require we can allow this command to execute\nif (!command.boostRequired) return false;\n\n// Check if the user has boosted this server\nconst userIsVIP = await isUserVIP(message.author.id)\n// The user is VIP so we can allow this command to be used\nif (userIsVIP) return false;\n\n// The user is NOT VIP so we throw an error\nthrow `The ${command.name} is only allowed for VIP users.`","position":{"start":{"line":38,"column":1,"offset":2003},"end":{"line":49,"column":4,"offset":2418},"indent":[1,1,1,1,1,1,1,1,1,1,1]}},{"type":"export","value":"export const _frontmatter = {\"title\":\"Creating Inhibitors!\",\"metaTitle\":\"Creating An Inhibitor | Discordeno\",\"metaDescription\":\"Let's create our very own bot with Discordeno!\"}","position":{"start":{"line":52,"column":1,"offset":2421},"end":{"line":52,"column":177,"offset":2597},"indent":[]}}],"position":{"start":{"line":1,"column":1,"offset":0},"end":{"line":52,"column":177,"offset":2597}}},"scopeImports":["import * as React from 'react'"],"scopeIdentifiers":["React"],"body":"function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }\n\nfunction _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }\n\nfunction _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }\n\n/* @jsx mdx */\nvar _frontmatter = {\n \"title\": \"Creating Inhibitors!\",\n \"metaTitle\": \"Creating An Inhibitor | Discordeno\",\n \"metaDescription\": \"Let's create our very own bot with Discordeno!\"\n};\nvar layoutProps = {\n _frontmatter: _frontmatter\n};\nvar MDXLayout = \"wrapper\";\nreturn function MDXContent(_ref) {\n var components = _ref.components,\n props = _objectWithoutProperties(_ref, [\"components\"]);\n\n return mdx(MDXLayout, _extends({}, layoutProps, props, {\n components: components,\n mdxType: \"MDXLayout\"\n }), mdx(\"p\", null, \"Woah! You are almost half way done with understanding all of Discordeno. Amazing isn't it? Something you may have noticed in the last section was there were some options that prevented some commands from running like \", mdx(\"inlineCode\", {\n parentName: \"p\"\n }, \"dmOnly\"), \" or the permission options. we created a setting to prevent the monitor from running in certain channels. What if we wanted to do prevent commands from happening? How would we prevent commands from running?\"), mdx(\"h2\", null, \"What is an Inhibitor?\"), mdx(\"p\", null, \"An Inhibitor is very similar to how monitors work. A monitor runs on every message but an inhibitor runs on every command. Remember all those command options like cooldown, permissions, permissionLevel, nsfw, etc... Each and every one of these options has an inhibitor in that checks commands for these settings.\"), mdx(\"p\", null, \"Let's create our own inhibitor that would prevent commands from being used if the user is not a VIP user.\"), mdx(\"blockquote\", null, mdx(\"p\", {\n parentName: \"blockquote\"\n }, mdx(\"strong\", {\n parentName: \"p\"\n }, \"Note:\"), \" It is important to remember that everything below can be done with a simple permission level as well. We will create our own custom permission levels but for the purposes of this guide and to be able to learn about Inhibitors, we will be using an inhibitor.\")), mdx(\"h2\", null, \"Creating the File\"), mdx(\"p\", null, \"Let's start by creating a file inside the inhibitors folder called \", mdx(\"inlineCode\", {\n parentName: \"p\"\n }, \"boostRequired.ts\"), \" and paste the following snippet of code:\"), mdx(\"pre\", null, mdx(\"code\", _extends({\n parentName: \"pre\"\n }, {\n \"className\": \"language-ts\"\n }), \"import { botCache } from \\\"../../mod.ts\\\";\\n\\nbotCache.inhibitors.set(\\\"inhibitorname\\\", async function (message, command, guild) {\\n // Your code goes here\\n});\\n\")), mdx(\"p\", null, \"Inhibitors can take up to 3 arguments.\"), mdx(\"ul\", null, mdx(\"li\", {\n parentName: \"ul\"\n }, mdx(\"inlineCode\", {\n parentName: \"li\"\n }, \"message\"), \": The message object that triggered the command.\"), mdx(\"li\", {\n parentName: \"ul\"\n }, mdx(\"inlineCode\", {\n parentName: \"li\"\n }, \"command\"), \": The command object itself that was triggered.\"), mdx(\"li\", {\n parentName: \"ul\"\n }, mdx(\"inlineCode\", {\n parentName: \"li\"\n }, \"guild\"), \": The server guild object where this command was ran.\")), mdx(\"h2\", null, \"Understanding How Inhibitors Function\"), mdx(\"p\", null, \"To block a command you have to return a truthy value.\"), mdx(\"ul\", null, mdx(\"li\", {\n parentName: \"ul\"\n }, mdx(\"strong\", {\n parentName: \"li\"\n }, \"return true;\"), \" If you return true the inhibitor will block the execution of the command.\\nTo allow a command return a falsey value.\"), mdx(\"li\", {\n parentName: \"ul\"\n }, mdx(\"strong\", {\n parentName: \"li\"\n }, \"return false;\"), \" If you return false the inhibitor will not block the error.\")), mdx(\"pre\", null, mdx(\"code\", _extends({\n parentName: \"pre\"\n }, {\n \"className\": \"language-ts\"\n }), \"// If the command does not require we can allow this command to execute\\nif (!command.boostRequired) return false;\\n\\n// Check if the user has boosted this server\\nconst userIsVIP = await isUserVIP(message.author.id)\\n// The user is VIP so we can allow this command to be used\\nif (userIsVIP) return false;\\n\\n// The user is NOT VIP so we throw an error\\nthrow `The ${command.name} is only allowed for VIP users.`\\n\")));\n}\n;\nMDXContent.isMDXComponent = true;","rawMDXOutput":"/* @jsx mdx */\nimport { mdx } from '@mdx-js/react';\n/* @jsx mdx */\n\nexport const _frontmatter = {\n \"title\": \"Creating Inhibitors!\",\n \"metaTitle\": \"Creating An Inhibitor | Discordeno\",\n \"metaDescription\": \"Let's create our very own bot with Discordeno!\"\n};\n\nconst layoutProps = {\n _frontmatter\n};\nconst MDXLayout = \"wrapper\"\nexport default function MDXContent({\n components,\n ...props\n}) {\n return \n

{`Woah! You are almost half way done with understanding all of Discordeno. Amazing isn't it? Something you may have noticed in the last section was there were some options that prevented some commands from running like `}{`dmOnly`}{` or the permission options. we created a setting to prevent the monitor from running in certain channels. What if we wanted to do prevent commands from happening? How would we prevent commands from running?`}

\n

{`What is an Inhibitor?`}

\n

{`An Inhibitor is very similar to how monitors work. A monitor runs on every message but an inhibitor runs on every command. Remember all those command options like cooldown, permissions, permissionLevel, nsfw, etc... Each and every one of these options has an inhibitor in that checks commands for these settings.`}

\n

{`Let's create our own inhibitor that would prevent commands from being used if the user is not a VIP user.`}

\n
\n

{`Note:`}{` It is important to remember that everything below can be done with a simple permission level as well. We will create our own custom permission levels but for the purposes of this guide and to be able to learn about Inhibitors, we will be using an inhibitor.`}

\n
\n

{`Creating the File`}

\n

{`Let's start by creating a file inside the inhibitors folder called `}{`boostRequired.ts`}{` and paste the following snippet of code:`}

\n
{`import { botCache } from \"../../mod.ts\";\n\nbotCache.inhibitors.set(\"inhibitorname\", async function (message, command, guild) {\n    // Your code goes here\n});\n`}
\n

{`Inhibitors can take up to 3 arguments.`}

\n
    \n
  • {`message`}{`: The message object that triggered the command.`}
  • \n
  • {`command`}{`: The command object itself that was triggered.`}
  • \n
  • {`guild`}{`: The server guild object where this command was ran.`}
  • \n
\n

{`Understanding How Inhibitors Function`}

\n

{`To block a command you have to return a truthy value.`}

\n
    \n
  • {`return true;`}{` If you return true the inhibitor will block the execution of the command.\nTo allow a command return a falsey value.`}
  • \n
  • {`return false;`}{` If you return false the inhibitor will not block the error.`}
  • \n
\n
{`// If the command does not require  we can allow this command to execute\nif (!command.boostRequired) return false;\n\n// Check if the user has boosted this server\nconst userIsVIP = await isUserVIP(message.author.id)\n// The user is VIP so we can allow this command to be used\nif (userIsVIP) return false;\n\n// The user is NOT VIP so we throw an error\nthrow \\`The \\${command.name} is only allowed for VIP users.\\`\n`}
\n\n
;\n}\n\n;\nMDXContent.isMDXComponent = true;"}} \ No newline at end of file diff --git a/docs/.cache/caches/gatsby-plugin-mdx/diskstore-9579b93c65f7f53d59b10d47e2b8f499.json b/docs/.cache/caches/gatsby-plugin-mdx/diskstore-9579b93c65f7f53d59b10d47e2b8f499.json new file mode 100644 index 000000000..cdd1e9ac4 --- /dev/null +++ b/docs/.cache/caches/gatsby-plugin-mdx/diskstore-9579b93c65f7f53d59b10d47e2b8f499.json @@ -0,0 +1 @@ +{"expireTime":9007200851644243000,"key":"gatsby-plugin-mdx-entire-payload-f4c3f896f109ae4db491c7d80688da70-","val":{"mdast":{"type":"root","children":[{"type":"paragraph","children":[{"type":"text","value":"Discordeno will help make Discord bot development much easier. Don't worry, as you go through this guide it will make a lot more sense.","position":{"start":{"line":2,"column":1,"offset":1},"end":{"line":2,"column":136,"offset":136},"indent":[]}}],"position":{"start":{"line":2,"column":1,"offset":1},"end":{"line":2,"column":136,"offset":136},"indent":[]}},{"type":"heading","depth":2,"children":[{"type":"text","value":"Creating The Bot!","position":{"start":{"line":4,"column":4,"offset":141},"end":{"line":4,"column":21,"offset":158},"indent":[]}}],"position":{"start":{"line":4,"column":1,"offset":138},"end":{"line":4,"column":21,"offset":158},"indent":[]}},{"type":"blockquote","children":[{"type":"paragraph","children":[{"type":"text","value":"This guide is going to assume you already have the basic requirements to make a bot ready. This includes github, git, a code editor like Visual Studio Code. If you don't have these yet please prepare them first before going forward.","position":{"start":{"line":6,"column":3,"offset":162},"end":{"line":6,"column":235,"offset":394},"indent":[]}}],"position":{"start":{"line":6,"column":3,"offset":162},"end":{"line":6,"column":235,"offset":394},"indent":[]}}],"position":{"start":{"line":6,"column":1,"offset":160},"end":{"line":6,"column":235,"offset":394},"indent":[]}},{"type":"list","ordered":false,"start":null,"spread":true,"children":[{"type":"listItem","spread":false,"checked":null,"children":[{"type":"paragraph","children":[{"type":"text","value":"First, create a Discordeno Bot using the ","position":{"start":{"line":8,"column":3,"offset":398},"end":{"line":8,"column":44,"offset":439},"indent":[]}},{"type":"link","title":null,"url":"https://github.com/Skillz4Killz/Discordeno-bot-template","children":[{"type":"text","value":"Generator Boilerplate","position":{"start":{"line":8,"column":45,"offset":440},"end":{"line":8,"column":66,"offset":461},"indent":[]}}],"position":{"start":{"line":8,"column":44,"offset":439},"end":{"line":8,"column":124,"offset":519},"indent":[]}},{"type":"text","value":". Give it any name you like. For the purpose of this guide we will call it, Stargate.","position":{"start":{"line":8,"column":124,"offset":519},"end":{"line":8,"column":209,"offset":604},"indent":[]}}],"position":{"start":{"line":8,"column":3,"offset":398},"end":{"line":8,"column":209,"offset":604},"indent":[]}}],"position":{"start":{"line":8,"column":1,"offset":396},"end":{"line":9,"column":1,"offset":605},"indent":[1]}},{"type":"listItem","spread":false,"checked":null,"children":[{"type":"paragraph","children":[{"type":"text","value":"Then ","position":{"start":{"line":10,"column":3,"offset":608},"end":{"line":10,"column":8,"offset":613},"indent":[]}},{"type":"inlineCode","value":"git clone https://github.com/Skillz4Killz/Stargate.git","position":{"start":{"line":10,"column":8,"offset":613},"end":{"line":10,"column":64,"offset":669},"indent":[]}}],"position":{"start":{"line":10,"column":3,"offset":608},"end":{"line":10,"column":64,"offset":669},"indent":[]}}],"position":{"start":{"line":10,"column":1,"offset":606},"end":{"line":11,"column":1,"offset":670},"indent":[1]}},{"type":"listItem","spread":false,"checked":null,"children":[{"type":"paragraph","children":[{"type":"text","value":"When that is done, go ahead and open up the folder with VSC.","position":{"start":{"line":12,"column":3,"offset":673},"end":{"line":12,"column":63,"offset":733},"indent":[]}}],"position":{"start":{"line":12,"column":3,"offset":673},"end":{"line":12,"column":63,"offset":733},"indent":[]}}],"position":{"start":{"line":12,"column":1,"offset":671},"end":{"line":12,"column":63,"offset":733},"indent":[]}},{"type":"listItem","spread":false,"checked":null,"children":[{"type":"paragraph","children":[{"type":"text","value":"Create a new file called ","position":{"start":{"line":13,"column":3,"offset":736},"end":{"line":13,"column":28,"offset":761},"indent":[]}},{"type":"inlineCode","value":"configs.ts","position":{"start":{"line":13,"column":28,"offset":761},"end":{"line":13,"column":40,"offset":773},"indent":[]}},{"type":"text","value":". Open the ","position":{"start":{"line":13,"column":40,"offset":773},"end":{"line":13,"column":51,"offset":784},"indent":[]}},{"type":"inlineCode","value":"configs.example.ts","position":{"start":{"line":13,"column":51,"offset":784},"end":{"line":13,"column":71,"offset":804},"indent":[]}},{"type":"text","value":" file and copy everything over.","position":{"start":{"line":13,"column":71,"offset":804},"end":{"line":13,"column":102,"offset":835},"indent":[]}}],"position":{"start":{"line":13,"column":3,"offset":736},"end":{"line":13,"column":102,"offset":835},"indent":[]}}],"position":{"start":{"line":13,"column":1,"offset":734},"end":{"line":13,"column":102,"offset":835},"indent":[]}}],"position":{"start":{"line":8,"column":1,"offset":396},"end":{"line":13,"column":102,"offset":835},"indent":[1,1,1,1,1]}},{"type":"paragraph","children":[{"type":"text","value":"Let's take a minute to review all the options we have available to us.","position":{"start":{"line":15,"column":1,"offset":837},"end":{"line":15,"column":71,"offset":907},"indent":[]}}],"position":{"start":{"line":15,"column":1,"offset":837},"end":{"line":15,"column":71,"offset":907},"indent":[]}},{"type":"heading","depth":3,"children":[{"type":"text","value":"Configs File","position":{"start":{"line":17,"column":5,"offset":913},"end":{"line":17,"column":17,"offset":925},"indent":[]}}],"position":{"start":{"line":17,"column":1,"offset":909},"end":{"line":17,"column":17,"offset":925},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"The ","position":{"start":{"line":19,"column":1,"offset":927},"end":{"line":19,"column":5,"offset":931},"indent":[]}},{"type":"inlineCode","value":"configs.ts","position":{"start":{"line":19,"column":5,"offset":931},"end":{"line":19,"column":17,"offset":943},"indent":[]}},{"type":"text","value":" file is where you will keep all your secret info you don't want to share with anyone else. As long as ","position":{"start":{"line":19,"column":17,"offset":943},"end":{"line":19,"column":120,"offset":1046},"indent":[]}},{"type":"inlineCode","value":".gitignore","position":{"start":{"line":19,"column":120,"offset":1046},"end":{"line":19,"column":132,"offset":1058},"indent":[]}},{"type":"text","value":" file is ignoring configs.ts your configurations will be kept private!","position":{"start":{"line":19,"column":132,"offset":1058},"end":{"line":19,"column":202,"offset":1128},"indent":[]}}],"position":{"start":{"line":19,"column":1,"offset":927},"end":{"line":19,"column":202,"offset":1128},"indent":[]}},{"type":"code","lang":"ts","meta":null,"value":"// Step 1: Remove the `.example` from this file name so it is called `configs.ts`\n// Step 2: Add all your bot's information below. The only required one is token and prefix. NOTE: As long as `.gitignore` file is ignoring configs.ts your configurations will be kept private!\n// Step 3: Remove these comments if you like.\n\nexport const configs = {\n // Your bot token goes here\n token: \"\",\n // The default prefix for your bot. Don't worry guilds can change this later.\n prefix: \"!\",\n // This isn't required but you can add bot list api keys here.\n botListTokens: {\n DISCORD_BOT_ORG: \"\",\n BOTS_ON_DISCORD: \"\",\n DISCORD_BOT_LIST: \"\",\n BOTS_FOR_DISCORD: \"\",\n DISCORD_BOATS: \"\",\n DISCORD_BOTS_GG: \"\",\n DISCORD_BOTS_GROUP: \"\",\n },\n // This is the server id for your bot's main server where users can get help/support\n supportServerID: \"\",\n // These are channel ids that will enable some functionality\n channelIDs: {\n // When a translation is missing this is the channel you will be alerted in.\n missingTranslation: \"\",\n // When an error occurs, we will try and log it to this channel\n errorChannelID: \"\"\n },\n // These are the role ids that will enable some functionality.\n roleIDs: {\n // If you have a patreon set up you can add the patreon vip role id here.\n patreonVIPRoleID: \"\",\n },\n // These are the user ids that will enable some functionality.\n userIDs: {\n // The user ids for the support team\n botSupporters: [],\n // The user ids for the other devs on your team\n botDevs: [],\n // The user ids who have complete 100% access to your bot\n botOwners: []\n }\n};\n","position":{"start":{"line":21,"column":1,"offset":1130},"end":{"line":66,"column":4,"offset":2770},"indent":[1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1]}},{"type":"heading","depth":4,"children":[{"type":"text","value":"Token","position":{"start":{"line":68,"column":6,"offset":2777},"end":{"line":68,"column":11,"offset":2782},"indent":[]}}],"position":{"start":{"line":68,"column":1,"offset":2772},"end":{"line":68,"column":11,"offset":2782},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"First, add your bot token. This is ","position":{"start":{"line":70,"column":1,"offset":2784},"end":{"line":70,"column":36,"offset":2819},"indent":[]}},{"type":"strong","children":[{"type":"text","value":"required","position":{"start":{"line":70,"column":38,"offset":2821},"end":{"line":70,"column":46,"offset":2829},"indent":[]}}],"position":{"start":{"line":70,"column":36,"offset":2819},"end":{"line":70,"column":48,"offset":2831},"indent":[]}},{"type":"text","value":" for the bot to start. Review the ","position":{"start":{"line":70,"column":48,"offset":2831},"end":{"line":70,"column":82,"offset":2865},"indent":[]}},{"type":"link","title":null,"url":"https://discordeno.netlify.app/gettingstarted#creatingyourfirstdiscordbotapplication","children":[{"type":"text","value":"instructions","position":{"start":{"line":70,"column":83,"offset":2866},"end":{"line":70,"column":95,"offset":2878},"indent":[]}}],"position":{"start":{"line":70,"column":82,"offset":2865},"end":{"line":70,"column":182,"offset":2965},"indent":[]}},{"type":"text","value":" if you have not made your token yet.","position":{"start":{"line":70,"column":182,"offset":2965},"end":{"line":70,"column":219,"offset":3002},"indent":[]}}],"position":{"start":{"line":70,"column":1,"offset":2784},"end":{"line":70,"column":219,"offset":3002},"indent":[]}},{"type":"heading","depth":4,"children":[{"type":"text","value":"Prefix","position":{"start":{"line":72,"column":6,"offset":3009},"end":{"line":72,"column":12,"offset":3015},"indent":[]}}],"position":{"start":{"line":72,"column":1,"offset":3004},"end":{"line":72,"column":12,"offset":3015},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"The prefix is where you will set the default prefix for your bot. Don't worry, every server will be able to choose their own prefix but we need a default prefix to start.","position":{"start":{"line":74,"column":1,"offset":3017},"end":{"line":74,"column":171,"offset":3187},"indent":[]}}],"position":{"start":{"line":74,"column":1,"offset":3017},"end":{"line":74,"column":171,"offset":3187},"indent":[]}},{"type":"heading","depth":4,"children":[{"type":"text","value":"Bot Lists Tokens","position":{"start":{"line":76,"column":6,"offset":3194},"end":{"line":76,"column":22,"offset":3210},"indent":[]}}],"position":{"start":{"line":76,"column":1,"offset":3189},"end":{"line":76,"column":22,"offset":3210},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"This section of the file is so you can easily have your bot's statistics updated on all the bot lists out there to help you grow your bot. The code is already written to handle this but you will need to do 3 things for each bot list.","position":{"start":{"line":78,"column":1,"offset":3212},"end":{"line":78,"column":234,"offset":3445},"indent":[]}}],"position":{"start":{"line":78,"column":1,"offset":3212},"end":{"line":78,"column":234,"offset":3445},"indent":[]}},{"type":"list","ordered":true,"start":1,"spread":false,"children":[{"type":"listItem","spread":false,"checked":null,"children":[{"type":"paragraph","children":[{"type":"text","value":"Go to the bot list and add your bot to their website. (Each site has it's own instructions)","position":{"start":{"line":80,"column":4,"offset":3450},"end":{"line":80,"column":95,"offset":3541},"indent":[]}}],"position":{"start":{"line":80,"column":4,"offset":3450},"end":{"line":80,"column":95,"offset":3541},"indent":[]}}],"position":{"start":{"line":80,"column":1,"offset":3447},"end":{"line":80,"column":95,"offset":3541},"indent":[]}},{"type":"listItem","spread":false,"checked":null,"children":[{"type":"paragraph","children":[{"type":"text","value":"Create a token for yourself on each website and paste it in your configs.","position":{"start":{"line":81,"column":4,"offset":3545},"end":{"line":81,"column":77,"offset":3618},"indent":[]}}],"position":{"start":{"line":81,"column":4,"offset":3545},"end":{"line":81,"column":77,"offset":3618},"indent":[]}}],"position":{"start":{"line":81,"column":1,"offset":3542},"end":{"line":81,"column":77,"offset":3618},"indent":[]}},{"type":"listItem","spread":false,"checked":null,"children":[{"type":"paragraph","children":[{"type":"text","value":"Enjoy!","position":{"start":{"line":82,"column":4,"offset":3622},"end":{"line":82,"column":10,"offset":3628},"indent":[]}}],"position":{"start":{"line":82,"column":4,"offset":3622},"end":{"line":82,"column":10,"offset":3628},"indent":[]}}],"position":{"start":{"line":82,"column":1,"offset":3619},"end":{"line":82,"column":10,"offset":3628},"indent":[]}}],"position":{"start":{"line":80,"column":1,"offset":3447},"end":{"line":82,"column":10,"offset":3628},"indent":[1,1]}},{"type":"paragraph","children":[{"type":"text","value":"If you wish to customize the code, you will find the bot list tasks in the tasks folder. Don't worry we will discuss this when we get to the tasks section of the guide.","position":{"start":{"line":84,"column":1,"offset":3630},"end":{"line":84,"column":169,"offset":3798},"indent":[]}}],"position":{"start":{"line":84,"column":1,"offset":3630},"end":{"line":84,"column":169,"offset":3798},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"For now just remember, that Discordeno provides you a built in way to update most discord bot lists.","position":{"start":{"line":86,"column":1,"offset":3800},"end":{"line":86,"column":101,"offset":3900},"indent":[]}}],"position":{"start":{"line":86,"column":1,"offset":3800},"end":{"line":86,"column":101,"offset":3900},"indent":[]}},{"type":"heading","depth":4,"children":[{"type":"text","value":"Channel IDs","position":{"start":{"line":88,"column":6,"offset":3907},"end":{"line":88,"column":17,"offset":3918},"indent":[]}}],"position":{"start":{"line":88,"column":1,"offset":3902},"end":{"line":88,"column":17,"offset":3918},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"The channelIDs section holds the channel IDs that are useful for specific features to help give you alerts/notifications. For example, the ","position":{"start":{"line":90,"column":1,"offset":3920},"end":{"line":90,"column":140,"offset":4059},"indent":[]}},{"type":"inlineCode","value":"missingTranslation","position":{"start":{"line":90,"column":140,"offset":4059},"end":{"line":90,"column":160,"offset":4079},"indent":[]}},{"type":"text","value":" channel will be where messages are sent alerting you that somewhere in your code you are trying to use a translation key that you never created.","position":{"start":{"line":90,"column":160,"offset":4079},"end":{"line":90,"column":305,"offset":4224},"indent":[]}}],"position":{"start":{"line":90,"column":1,"offset":3920},"end":{"line":90,"column":305,"offset":4224},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"When you get to around 25,000 Discord servers on your bot, you may want to convert these channel IDs to webhooks.","position":{"start":{"line":92,"column":1,"offset":4226},"end":{"line":92,"column":114,"offset":4339},"indent":[]}}],"position":{"start":{"line":92,"column":1,"offset":4226},"end":{"line":92,"column":114,"offset":4339},"indent":[]}},{"type":"heading","depth":4,"children":[{"type":"text","value":"Role IDs","position":{"start":{"line":94,"column":6,"offset":4346},"end":{"line":94,"column":14,"offset":4354},"indent":[]}}],"position":{"start":{"line":94,"column":1,"offset":4341},"end":{"line":94,"column":14,"offset":4354},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"The roleIDs section holds the role IDs that are useful for specific features. For example, the ","position":{"start":{"line":96,"column":1,"offset":4356},"end":{"line":96,"column":96,"offset":4451},"indent":[]}},{"type":"inlineCode","value":"patreonVIPRoleID","position":{"start":{"line":96,"column":96,"offset":4451},"end":{"line":96,"column":114,"offset":4469},"indent":[]}},{"type":"text","value":" role can be used easily to enable vip features later in this guide.","position":{"start":{"line":96,"column":114,"offset":4469},"end":{"line":96,"column":182,"offset":4537},"indent":[]}}],"position":{"start":{"line":96,"column":1,"offset":4356},"end":{"line":96,"column":182,"offset":4537},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"When you get to around 25,000 Discord servers on your bot, you may want to convert these channel IDs to webhooks.","position":{"start":{"line":98,"column":1,"offset":4539},"end":{"line":98,"column":114,"offset":4652},"indent":[]}}],"position":{"start":{"line":98,"column":1,"offset":4539},"end":{"line":98,"column":114,"offset":4652},"indent":[]}},{"type":"heading","depth":2,"children":[{"type":"text","value":"It's Alive!","position":{"start":{"line":100,"column":4,"offset":4657},"end":{"line":100,"column":15,"offset":4668},"indent":[]}}],"position":{"start":{"line":100,"column":1,"offset":4654},"end":{"line":100,"column":15,"offset":4668},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"Oh my god! You now have a bot with a bunch of features already! You don't believe me? Well, seeing is believing, so start the bot.","position":{"start":{"line":102,"column":1,"offset":4670},"end":{"line":102,"column":131,"offset":4800},"indent":[]}}],"position":{"start":{"line":102,"column":1,"offset":4670},"end":{"line":102,"column":131,"offset":4800},"indent":[]}},{"type":"list","ordered":true,"start":1,"spread":false,"children":[{"type":"listItem","spread":false,"checked":null,"children":[{"type":"paragraph","children":[{"type":"text","value":"Invite your bot to a discord server.","position":{"start":{"line":104,"column":4,"offset":4805},"end":{"line":104,"column":40,"offset":4841},"indent":[]}}],"position":{"start":{"line":104,"column":4,"offset":4805},"end":{"line":104,"column":40,"offset":4841},"indent":[]}}],"position":{"start":{"line":104,"column":1,"offset":4802},"end":{"line":104,"column":40,"offset":4841},"indent":[]}},{"type":"listItem","spread":false,"checked":null,"children":[{"type":"paragraph","children":[{"type":"text","value":"Open up the integrated terminal in VSC using ","position":{"start":{"line":105,"column":4,"offset":4845},"end":{"line":105,"column":49,"offset":4890},"indent":[]}},{"type":"strong","children":[{"type":"text","value":"CTRL + `","position":{"start":{"line":105,"column":51,"offset":4892},"end":{"line":105,"column":59,"offset":4900},"indent":[]}}],"position":{"start":{"line":105,"column":49,"offset":4890},"end":{"line":105,"column":61,"offset":4902},"indent":[]}},{"type":"text","value":". If you use a Mac, replace CTRL with CMD.","position":{"start":{"line":105,"column":61,"offset":4902},"end":{"line":105,"column":103,"offset":4944},"indent":[]}}],"position":{"start":{"line":105,"column":4,"offset":4845},"end":{"line":105,"column":103,"offset":4944},"indent":[]}}],"position":{"start":{"line":105,"column":1,"offset":4842},"end":{"line":105,"column":103,"offset":4944},"indent":[]}},{"type":"listItem","spread":false,"checked":null,"children":[{"type":"paragraph","children":[{"type":"text","value":"Run the script below:","position":{"start":{"line":106,"column":4,"offset":4948},"end":{"line":106,"column":25,"offset":4969},"indent":[]}}],"position":{"start":{"line":106,"column":4,"offset":4948},"end":{"line":106,"column":25,"offset":4969},"indent":[]}}],"position":{"start":{"line":106,"column":1,"offset":4945},"end":{"line":106,"column":25,"offset":4969},"indent":[]}}],"position":{"start":{"line":104,"column":1,"offset":4802},"end":{"line":106,"column":25,"offset":4969},"indent":[1,1]}},{"type":"code","lang":"shell","meta":null,"value":"deno run --allow-net --allow-read mod.ts","position":{"start":{"line":108,"column":1,"offset":4971},"end":{"line":110,"column":4,"offset":5024},"indent":[1,1]}},{"type":"paragraph","children":[{"type":"text","value":"The first time you run it, you may see a lot of files being loaded. This is preparing all the magic behind the scene. Once it is ready, you will see something like this:","position":{"start":{"line":112,"column":1,"offset":5026},"end":{"line":112,"column":170,"offset":5195},"indent":[]}}],"position":{"start":{"line":112,"column":1,"offset":5026},"end":{"line":112,"column":170,"offset":5195},"indent":[]}},{"type":"paragraph","children":[{"type":"image","title":null,"url":"https://i.imgur.com/TOXjLgh.png","alt":"image","position":{"start":{"line":114,"column":1,"offset":5197},"end":{"line":114,"column":42,"offset":5238},"indent":[]}}],"position":{"start":{"line":114,"column":1,"offset":5197},"end":{"line":114,"column":42,"offset":5238},"indent":[]}},{"type":"heading","depth":2,"children":[{"type":"text","value":"Understanding What Discordeno Did","position":{"start":{"line":116,"column":4,"offset":5243},"end":{"line":116,"column":37,"offset":5276},"indent":[]}}],"position":{"start":{"line":116,"column":1,"offset":5240},"end":{"line":116,"column":37,"offset":5276},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"Discordeno includes these commands/folders as they are essential for any discord bot to have in order to meet the Discord Bot Best Practices. It also adds a few things that will help make some things easier to build a bot.","position":{"start":{"line":118,"column":1,"offset":5278},"end":{"line":118,"column":223,"offset":5500},"indent":[]}}],"position":{"start":{"line":118,"column":1,"offset":5278},"end":{"line":118,"column":223,"offset":5500},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"We will dive into these deeper in this guide. Let's take it step by step.","position":{"start":{"line":120,"column":1,"offset":5502},"end":{"line":120,"column":74,"offset":5575},"indent":[]}}],"position":{"start":{"line":120,"column":1,"offset":5502},"end":{"line":120,"column":74,"offset":5575},"indent":[]}},{"type":"export","value":"export const _frontmatter = {\"title\":\"Creating The Bot!\",\"metaTitle\":\"Creating A Bot | Discordeno\",\"metaDescription\":\"Let's create our very own bot with Discordeno!\"}","position":{"start":{"line":123,"column":1,"offset":5578},"end":{"line":123,"column":167,"offset":5744},"indent":[]}}],"position":{"start":{"line":1,"column":1,"offset":0},"end":{"line":123,"column":167,"offset":5744}}},"scopeImports":["import * as React from 'react'"],"scopeIdentifiers":["React"],"body":"function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }\n\nfunction _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }\n\nfunction _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }\n\n/* @jsx mdx */\nvar _frontmatter = {\n \"title\": \"Creating The Bot!\",\n \"metaTitle\": \"Creating A Bot | Discordeno\",\n \"metaDescription\": \"Let's create our very own bot with Discordeno!\"\n};\nvar layoutProps = {\n _frontmatter: _frontmatter\n};\nvar MDXLayout = \"wrapper\";\nreturn function MDXContent(_ref) {\n var components = _ref.components,\n props = _objectWithoutProperties(_ref, [\"components\"]);\n\n return mdx(MDXLayout, _extends({}, layoutProps, props, {\n components: components,\n mdxType: \"MDXLayout\"\n }), mdx(\"p\", null, \"Discordeno will help make Discord bot development much easier. Don't worry, as you go through this guide it will make a lot more sense.\"), mdx(\"h2\", null, \"Creating The Bot!\"), mdx(\"blockquote\", null, mdx(\"p\", {\n parentName: \"blockquote\"\n }, \"This guide is going to assume you already have the basic requirements to make a bot ready. This includes github, git, a code editor like Visual Studio Code. If you don't have these yet please prepare them first before going forward.\")), mdx(\"ul\", null, mdx(\"li\", {\n parentName: \"ul\"\n }, mdx(\"p\", {\n parentName: \"li\"\n }, \"First, create a Discordeno Bot using the \", mdx(\"a\", _extends({\n parentName: \"p\"\n }, {\n \"href\": \"https://github.com/Skillz4Killz/Discordeno-bot-template\"\n }), \"Generator Boilerplate\"), \". Give it any name you like. For the purpose of this guide we will call it, Stargate.\")), mdx(\"li\", {\n parentName: \"ul\"\n }, mdx(\"p\", {\n parentName: \"li\"\n }, \"Then \", mdx(\"inlineCode\", {\n parentName: \"p\"\n }, \"git clone https://github.com/Skillz4Killz/Stargate.git\"))), mdx(\"li\", {\n parentName: \"ul\"\n }, mdx(\"p\", {\n parentName: \"li\"\n }, \"When that is done, go ahead and open up the folder with VSC.\")), mdx(\"li\", {\n parentName: \"ul\"\n }, mdx(\"p\", {\n parentName: \"li\"\n }, \"Create a new file called \", mdx(\"inlineCode\", {\n parentName: \"p\"\n }, \"configs.ts\"), \". Open the \", mdx(\"inlineCode\", {\n parentName: \"p\"\n }, \"configs.example.ts\"), \" file and copy everything over.\"))), mdx(\"p\", null, \"Let's take a minute to review all the options we have available to us.\"), mdx(\"h3\", null, \"Configs File\"), mdx(\"p\", null, \"The \", mdx(\"inlineCode\", {\n parentName: \"p\"\n }, \"configs.ts\"), \" file is where you will keep all your secret info you don't want to share with anyone else. As long as \", mdx(\"inlineCode\", {\n parentName: \"p\"\n }, \".gitignore\"), \" file is ignoring configs.ts your configurations will be kept private!\"), mdx(\"pre\", null, mdx(\"code\", _extends({\n parentName: \"pre\"\n }, {\n \"className\": \"language-ts\"\n }), \"// Step 1: Remove the `.example` from this file name so it is called `configs.ts`\\n// Step 2: Add all your bot's information below. The only required one is token and prefix. NOTE: As long as `.gitignore` file is ignoring configs.ts your configurations will be kept private!\\n// Step 3: Remove these comments if you like.\\n\\nexport const configs = {\\n // Your bot token goes here\\n token: \\\"\\\",\\n // The default prefix for your bot. Don't worry guilds can change this later.\\n prefix: \\\"!\\\",\\n // This isn't required but you can add bot list api keys here.\\n botListTokens: {\\n DISCORD_BOT_ORG: \\\"\\\",\\n BOTS_ON_DISCORD: \\\"\\\",\\n DISCORD_BOT_LIST: \\\"\\\",\\n BOTS_FOR_DISCORD: \\\"\\\",\\n DISCORD_BOATS: \\\"\\\",\\n DISCORD_BOTS_GG: \\\"\\\",\\n DISCORD_BOTS_GROUP: \\\"\\\",\\n },\\n // This is the server id for your bot's main server where users can get help/support\\n supportServerID: \\\"\\\",\\n // These are channel ids that will enable some functionality\\n channelIDs: {\\n // When a translation is missing this is the channel you will be alerted in.\\n missingTranslation: \\\"\\\",\\n // When an error occurs, we will try and log it to this channel\\n errorChannelID: \\\"\\\"\\n },\\n // These are the role ids that will enable some functionality.\\n roleIDs: {\\n // If you have a patreon set up you can add the patreon vip role id here.\\n patreonVIPRoleID: \\\"\\\",\\n },\\n // These are the user ids that will enable some functionality.\\n userIDs: {\\n // The user ids for the support team\\n botSupporters: [],\\n // The user ids for the other devs on your team\\n botDevs: [],\\n // The user ids who have complete 100% access to your bot\\n botOwners: []\\n }\\n};\\n\\n\")), mdx(\"h4\", null, \"Token\"), mdx(\"p\", null, \"First, add your bot token. This is \", mdx(\"strong\", {\n parentName: \"p\"\n }, \"required\"), \" for the bot to start. Review the \", mdx(\"a\", _extends({\n parentName: \"p\"\n }, {\n \"href\": \"https://discordeno.netlify.app/gettingstarted#creatingyourfirstdiscordbotapplication\"\n }), \"instructions\"), \" if you have not made your token yet.\"), mdx(\"h4\", null, \"Prefix\"), mdx(\"p\", null, \"The prefix is where you will set the default prefix for your bot. Don't worry, every server will be able to choose their own prefix but we need a default prefix to start.\"), mdx(\"h4\", null, \"Bot Lists Tokens\"), mdx(\"p\", null, \"This section of the file is so you can easily have your bot's statistics updated on all the bot lists out there to help you grow your bot. The code is already written to handle this but you will need to do 3 things for each bot list.\"), mdx(\"ol\", null, mdx(\"li\", {\n parentName: \"ol\"\n }, \"Go to the bot list and add your bot to their website. (Each site has it's own instructions)\"), mdx(\"li\", {\n parentName: \"ol\"\n }, \"Create a token for yourself on each website and paste it in your configs.\"), mdx(\"li\", {\n parentName: \"ol\"\n }, \"Enjoy!\")), mdx(\"p\", null, \"If you wish to customize the code, you will find the bot list tasks in the tasks folder. Don't worry we will discuss this when we get to the tasks section of the guide.\"), mdx(\"p\", null, \"For now just remember, that Discordeno provides you a built in way to update most discord bot lists.\"), mdx(\"h4\", null, \"Channel IDs\"), mdx(\"p\", null, \"The channelIDs section holds the channel IDs that are useful for specific features to help give you alerts/notifications. For example, the \", mdx(\"inlineCode\", {\n parentName: \"p\"\n }, \"missingTranslation\"), \" channel will be where messages are sent alerting you that somewhere in your code you are trying to use a translation key that you never created.\"), mdx(\"p\", null, \"When you get to around 25,000 Discord servers on your bot, you may want to convert these channel IDs to webhooks.\"), mdx(\"h4\", null, \"Role IDs\"), mdx(\"p\", null, \"The roleIDs section holds the role IDs that are useful for specific features. For example, the \", mdx(\"inlineCode\", {\n parentName: \"p\"\n }, \"patreonVIPRoleID\"), \" role can be used easily to enable vip features later in this guide.\"), mdx(\"p\", null, \"When you get to around 25,000 Discord servers on your bot, you may want to convert these channel IDs to webhooks.\"), mdx(\"h2\", null, \"It's Alive!\"), mdx(\"p\", null, \"Oh my god! You now have a bot with a bunch of features already! You don't believe me? Well, seeing is believing, so start the bot.\"), mdx(\"ol\", null, mdx(\"li\", {\n parentName: \"ol\"\n }, \"Invite your bot to a discord server.\"), mdx(\"li\", {\n parentName: \"ol\"\n }, \"Open up the integrated terminal in VSC using \", mdx(\"strong\", {\n parentName: \"li\"\n }, \"CTRL + `\"), \". If you use a Mac, replace CTRL with CMD.\"), mdx(\"li\", {\n parentName: \"ol\"\n }, \"Run the script below:\")), mdx(\"pre\", null, mdx(\"code\", _extends({\n parentName: \"pre\"\n }, {\n \"className\": \"language-shell\"\n }), \"deno run --allow-net --allow-read mod.ts\\n\")), mdx(\"p\", null, \"The first time you run it, you may see a lot of files being loaded. This is preparing all the magic behind the scene. Once it is ready, you will see something like this:\"), mdx(\"p\", null, mdx(\"img\", _extends({\n parentName: \"p\"\n }, {\n \"src\": \"https://i.imgur.com/TOXjLgh.png\",\n \"alt\": \"image\"\n }))), mdx(\"h2\", null, \"Understanding What Discordeno Did\"), mdx(\"p\", null, \"Discordeno includes these commands/folders as they are essential for any discord bot to have in order to meet the Discord Bot Best Practices. It also adds a few things that will help make some things easier to build a bot.\"), mdx(\"p\", null, \"We will dive into these deeper in this guide. Let's take it step by step.\"));\n}\n;\nMDXContent.isMDXComponent = true;","rawMDXOutput":"/* @jsx mdx */\nimport { mdx } from '@mdx-js/react';\n/* @jsx mdx */\n\nexport const _frontmatter = {\n \"title\": \"Creating The Bot!\",\n \"metaTitle\": \"Creating A Bot | Discordeno\",\n \"metaDescription\": \"Let's create our very own bot with Discordeno!\"\n};\n\nconst layoutProps = {\n _frontmatter\n};\nconst MDXLayout = \"wrapper\"\nexport default function MDXContent({\n components,\n ...props\n}) {\n return \n

{`Discordeno will help make Discord bot development much easier. Don't worry, as you go through this guide it will make a lot more sense.`}

\n

{`Creating The Bot!`}

\n
\n

{`This guide is going to assume you already have the basic requirements to make a bot ready. This includes github, git, a code editor like Visual Studio Code. If you don't have these yet please prepare them first before going forward.`}

\n
\n
    \n
  • \n

    {`First, create a Discordeno Bot using the `}{`Generator Boilerplate`}{`. Give it any name you like. For the purpose of this guide we will call it, Stargate.`}

    \n
  • \n
  • \n

    {`Then `}{`git clone https://github.com/Skillz4Killz/Stargate.git`}

    \n
  • \n
  • \n

    {`When that is done, go ahead and open up the folder with VSC.`}

    \n
  • \n
  • \n

    {`Create a new file called `}{`configs.ts`}{`. Open the `}{`configs.example.ts`}{` file and copy everything over.`}

    \n
  • \n
\n

{`Let's take a minute to review all the options we have available to us.`}

\n

{`Configs File`}

\n

{`The `}{`configs.ts`}{` file is where you will keep all your secret info you don't want to share with anyone else. As long as `}{`.gitignore`}{` file is ignoring configs.ts your configurations will be kept private!`}

\n
{`// Step 1: Remove the \\`.example\\` from this file name so it is called \\`configs.ts\\`\n// Step 2: Add all your bot's information below. The only required one is token and prefix. NOTE: As long as \\`.gitignore\\` file is ignoring configs.ts your configurations will be kept private!\n// Step 3: Remove these comments if you like.\n\nexport const configs = {\n  // Your bot token goes here\n  token: \"\",\n  // The default prefix for your bot. Don't worry guilds can change this later.\n  prefix: \"!\",\n  // This isn't required but you can add bot list api keys here.\n  botListTokens: {\n    DISCORD_BOT_ORG: \"\",\n    BOTS_ON_DISCORD: \"\",\n    DISCORD_BOT_LIST: \"\",\n    BOTS_FOR_DISCORD: \"\",\n    DISCORD_BOATS: \"\",\n    DISCORD_BOTS_GG: \"\",\n    DISCORD_BOTS_GROUP: \"\",\n  },\n  // This is the server id for your bot's main server where users can get help/support\n  supportServerID: \"\",\n  // These are channel ids that will enable some functionality\n  channelIDs: {\n    // When a translation is missing this is the channel you will be alerted in.\n    missingTranslation: \"\",\n    // When an error occurs, we will try and log it to this channel\n    errorChannelID: \"\"\n  },\n  // These are the role ids that will enable some functionality.\n  roleIDs: {\n    // If you have a patreon set up you can add the patreon vip role id here.\n    patreonVIPRoleID: \"\",\n  },\n  // These are the user ids that will enable some functionality.\n  userIDs: {\n    // The user ids for the support team\n    botSupporters: [],\n    // The user ids for the other devs on your team\n    botDevs: [],\n    // The user ids who have complete 100% access to your bot\n    botOwners: []\n  }\n};\n\n`}
\n

{`Token`}

\n

{`First, add your bot token. This is `}{`required`}{` for the bot to start. Review the `}{`instructions`}{` if you have not made your token yet.`}

\n

{`Prefix`}

\n

{`The prefix is where you will set the default prefix for your bot. Don't worry, every server will be able to choose their own prefix but we need a default prefix to start.`}

\n

{`Bot Lists Tokens`}

\n

{`This section of the file is so you can easily have your bot's statistics updated on all the bot lists out there to help you grow your bot. The code is already written to handle this but you will need to do 3 things for each bot list.`}

\n
    \n
  1. {`Go to the bot list and add your bot to their website. (Each site has it's own instructions)`}
  2. \n
  3. {`Create a token for yourself on each website and paste it in your configs.`}
  4. \n
  5. {`Enjoy!`}
  6. \n
\n

{`If you wish to customize the code, you will find the bot list tasks in the tasks folder. Don't worry we will discuss this when we get to the tasks section of the guide.`}

\n

{`For now just remember, that Discordeno provides you a built in way to update most discord bot lists.`}

\n

{`Channel IDs`}

\n

{`The channelIDs section holds the channel IDs that are useful for specific features to help give you alerts/notifications. For example, the `}{`missingTranslation`}{` channel will be where messages are sent alerting you that somewhere in your code you are trying to use a translation key that you never created.`}

\n

{`When you get to around 25,000 Discord servers on your bot, you may want to convert these channel IDs to webhooks.`}

\n

{`Role IDs`}

\n

{`The roleIDs section holds the role IDs that are useful for specific features. For example, the `}{`patreonVIPRoleID`}{` role can be used easily to enable vip features later in this guide.`}

\n

{`When you get to around 25,000 Discord servers on your bot, you may want to convert these channel IDs to webhooks.`}

\n

{`It's Alive!`}

\n

{`Oh my god! You now have a bot with a bunch of features already! You don't believe me? Well, seeing is believing, so start the bot.`}

\n
    \n
  1. {`Invite your bot to a discord server.`}
  2. \n
  3. {`Open up the integrated terminal in VSC using `}{`CTRL + \\``}{`. If you use a Mac, replace CTRL with CMD.`}
  4. \n
  5. {`Run the script below:`}
  6. \n
\n
{`deno run --allow-net --allow-read mod.ts\n`}
\n

{`The first time you run it, you may see a lot of files being loaded. This is preparing all the magic behind the scene. Once it is ready, you will see something like this:`}

\n

\n

{`Understanding What Discordeno Did`}

\n

{`Discordeno includes these commands/folders as they are essential for any discord bot to have in order to meet the Discord Bot Best Practices. It also adds a few things that will help make some things easier to build a bot.`}

\n

{`We will dive into these deeper in this guide. Let's take it step by step.`}

\n\n
;\n}\n\n;\nMDXContent.isMDXComponent = true;"}} \ No newline at end of file diff --git a/docs/.cache/caches/gatsby-plugin-mdx/diskstore-957f0e96b16acab41790fb5f6abf1cd7.json b/docs/.cache/caches/gatsby-plugin-mdx/diskstore-957f0e96b16acab41790fb5f6abf1cd7.json new file mode 100644 index 000000000..38874458b --- /dev/null +++ b/docs/.cache/caches/gatsby-plugin-mdx/diskstore-957f0e96b16acab41790fb5f6abf1cd7.json @@ -0,0 +1 @@ +{"expireTime":9007200851632816000,"key":"gatsby-plugin-mdx-entire-payload-9202e00be7952cde384762863a9ddb2d-","val":{"mdast":{"type":"root","children":[{"type":"paragraph","children":[{"type":"text","value":"Woah! You are almost half way done with understanding all of Discordeno. Amazing isn't it? Something you may have noticed in the last section was there were some options that prevented some commands from running like ","position":{"start":{"line":2,"column":1,"offset":1},"end":{"line":2,"column":218,"offset":218},"indent":[]}},{"type":"inlineCode","value":"dmOnly","position":{"start":{"line":2,"column":218,"offset":218},"end":{"line":2,"column":226,"offset":226},"indent":[]}},{"type":"text","value":" or the permission options. we created a setting to prevent the monitor from running in certain channels. What if we wanted to do prevent commands from happening? How would we prevent commands from running?","position":{"start":{"line":2,"column":226,"offset":226},"end":{"line":2,"column":432,"offset":432},"indent":[]}}],"position":{"start":{"line":2,"column":1,"offset":1},"end":{"line":2,"column":432,"offset":432},"indent":[]}},{"type":"heading","depth":2,"children":[{"type":"text","value":"What is an Inhibitor?","position":{"start":{"line":4,"column":4,"offset":437},"end":{"line":4,"column":25,"offset":458},"indent":[]}}],"position":{"start":{"line":4,"column":1,"offset":434},"end":{"line":4,"column":25,"offset":458},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"An Inhibitor is very similar to how monitors work. A monitor runs on every message but an inhibitor runs on every command. Remember all those command options like cooldown, permissions, permissionLevel, nsfw, etc... Each and every one of these options has an inhibitor in that checks commands for these settings.","position":{"start":{"line":6,"column":1,"offset":460},"end":{"line":6,"column":313,"offset":772},"indent":[]}}],"position":{"start":{"line":6,"column":1,"offset":460},"end":{"line":6,"column":313,"offset":772},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"Let's create our own inhibitor that would prevent commands from being used if the user is not a VIP user.","position":{"start":{"line":8,"column":1,"offset":774},"end":{"line":8,"column":106,"offset":879},"indent":[]}}],"position":{"start":{"line":8,"column":1,"offset":774},"end":{"line":8,"column":106,"offset":879},"indent":[]}},{"type":"blockquote","children":[{"type":"paragraph","children":[{"type":"strong","children":[{"type":"text","value":"Note:","position":{"start":{"line":10,"column":5,"offset":885},"end":{"line":10,"column":10,"offset":890},"indent":[]}}],"position":{"start":{"line":10,"column":3,"offset":883},"end":{"line":10,"column":12,"offset":892},"indent":[]}},{"type":"text","value":" It is important to remember that everything below can be done with a simple permission level as well. We will create our own custom permission levels but for the purposes of this guide and to be able to learn about Inhibitors, we will be using an inhibitor.","position":{"start":{"line":10,"column":12,"offset":892},"end":{"line":10,"column":270,"offset":1150},"indent":[]}}],"position":{"start":{"line":10,"column":3,"offset":883},"end":{"line":10,"column":270,"offset":1150},"indent":[]}}],"position":{"start":{"line":10,"column":1,"offset":881},"end":{"line":10,"column":270,"offset":1150},"indent":[]}},{"type":"heading","depth":2,"children":[{"type":"text","value":"Creating the File","position":{"start":{"line":12,"column":4,"offset":1155},"end":{"line":12,"column":21,"offset":1172},"indent":[]}}],"position":{"start":{"line":12,"column":1,"offset":1152},"end":{"line":12,"column":21,"offset":1172},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"Let's start by creating a file inside the inhibitors folder called ","position":{"start":{"line":14,"column":1,"offset":1174},"end":{"line":14,"column":68,"offset":1241},"indent":[]}},{"type":"inlineCode","value":"vipOnly.ts","position":{"start":{"line":14,"column":68,"offset":1241},"end":{"line":14,"column":80,"offset":1253},"indent":[]}},{"type":"text","value":" and paste the following snippet of code:","position":{"start":{"line":14,"column":80,"offset":1253},"end":{"line":14,"column":121,"offset":1294},"indent":[]}}],"position":{"start":{"line":14,"column":1,"offset":1174},"end":{"line":14,"column":121,"offset":1294},"indent":[]}},{"type":"code","lang":"ts","meta":null,"value":"import { botCache } from \"../../mod.ts\";\n\nbotCache.inhibitors.set(\"inhibitorname\", async function (message, command, guild) {\n\t// Your code goes here\n});","position":{"start":{"line":16,"column":1,"offset":1296},"end":{"line":22,"column":4,"offset":1459},"indent":[1,1,1,1,1,1]}},{"type":"paragraph","children":[{"type":"text","value":"Inhibitors can take up to 3 arguments.","position":{"start":{"line":24,"column":1,"offset":1461},"end":{"line":24,"column":39,"offset":1499},"indent":[]}}],"position":{"start":{"line":24,"column":1,"offset":1461},"end":{"line":24,"column":39,"offset":1499},"indent":[]}},{"type":"list","ordered":false,"start":null,"spread":false,"children":[{"type":"listItem","spread":false,"checked":null,"children":[{"type":"paragraph","children":[{"type":"inlineCode","value":"message","position":{"start":{"line":26,"column":3,"offset":1503},"end":{"line":26,"column":12,"offset":1512},"indent":[]}},{"type":"text","value":": The message object that triggered the command.","position":{"start":{"line":26,"column":12,"offset":1512},"end":{"line":26,"column":60,"offset":1560},"indent":[]}}],"position":{"start":{"line":26,"column":3,"offset":1503},"end":{"line":26,"column":60,"offset":1560},"indent":[]}}],"position":{"start":{"line":26,"column":1,"offset":1501},"end":{"line":26,"column":60,"offset":1560},"indent":[]}},{"type":"listItem","spread":false,"checked":null,"children":[{"type":"paragraph","children":[{"type":"inlineCode","value":"command","position":{"start":{"line":27,"column":3,"offset":1563},"end":{"line":27,"column":12,"offset":1572},"indent":[]}},{"type":"text","value":": The command object itself that was triggered.","position":{"start":{"line":27,"column":12,"offset":1572},"end":{"line":27,"column":59,"offset":1619},"indent":[]}}],"position":{"start":{"line":27,"column":3,"offset":1563},"end":{"line":27,"column":59,"offset":1619},"indent":[]}}],"position":{"start":{"line":27,"column":1,"offset":1561},"end":{"line":27,"column":59,"offset":1619},"indent":[]}},{"type":"listItem","spread":false,"checked":null,"children":[{"type":"paragraph","children":[{"type":"inlineCode","value":"guild","position":{"start":{"line":28,"column":3,"offset":1622},"end":{"line":28,"column":10,"offset":1629},"indent":[]}},{"type":"text","value":": The server guild object where this command was ran.","position":{"start":{"line":28,"column":10,"offset":1629},"end":{"line":28,"column":63,"offset":1682},"indent":[]}}],"position":{"start":{"line":28,"column":3,"offset":1622},"end":{"line":28,"column":63,"offset":1682},"indent":[]}}],"position":{"start":{"line":28,"column":1,"offset":1620},"end":{"line":28,"column":63,"offset":1682},"indent":[]}}],"position":{"start":{"line":26,"column":1,"offset":1501},"end":{"line":28,"column":63,"offset":1682},"indent":[1,1]}},{"type":"heading","depth":2,"children":[{"type":"text","value":"Understanding How Inhibitors Function","position":{"start":{"line":30,"column":4,"offset":1687},"end":{"line":30,"column":41,"offset":1724},"indent":[]}}],"position":{"start":{"line":30,"column":1,"offset":1684},"end":{"line":30,"column":41,"offset":1724},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"To block a command you have to return a truthy value.","position":{"start":{"line":32,"column":1,"offset":1726},"end":{"line":32,"column":54,"offset":1779},"indent":[]}}],"position":{"start":{"line":32,"column":1,"offset":1726},"end":{"line":32,"column":54,"offset":1779},"indent":[]}},{"type":"code","lang":null,"meta":null,"value":"- **return true;** If you return true the inhibitor will block the execution of the command.","position":{"start":{"line":33,"column":1,"offset":1780},"end":{"line":33,"column":94,"offset":1873},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"To allow a command return a falsey value.","position":{"start":{"line":34,"column":1,"offset":1874},"end":{"line":34,"column":42,"offset":1915},"indent":[]}}],"position":{"start":{"line":34,"column":1,"offset":1874},"end":{"line":34,"column":42,"offset":1915},"indent":[]}},{"type":"code","lang":null,"meta":null,"value":"- **return false;** If you return false the inhibitor will not block the error.","position":{"start":{"line":35,"column":1,"offset":1916},"end":{"line":35,"column":81,"offset":1996},"indent":[]}},{"type":"code","lang":"ts","meta":null,"value":"// If the command is not VIP only we can allow this command\n if (!command.vipOnly) return false\n // Check if the user is VIP\n const userIsVIP = message.author.settings.get(`isVIP`)\n // The user is VIP so we can allow this command to be used\n if (userIsVIP) return false\n // The user is NOT VIP so we throw an error\n throw `The ${command.name} is only allowed for VIP users.`\n\n\nexport const _frontmatter = {\"title\":\"Creating Inhibitors!\",\"metaTitle\":\"Creating An Inhibitor | Discordeno\",\"metaDescription\":\"Let's create our very own bot with Discordeno!\"}","position":{"start":{"line":38,"column":1,"offset":1999},"end":{"line":49,"column":177,"offset":2607},"indent":[1,1,1,1,1,1,1,1,1,1,1]}}],"position":{"start":{"line":1,"column":1,"offset":0},"end":{"line":49,"column":177,"offset":2607}}},"scopeImports":["import * as React from 'react'"],"scopeIdentifiers":["React"],"body":"function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }\n\nfunction _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }\n\nfunction _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }\n\n/* @jsx mdx */\nvar layoutProps = {};\nvar MDXLayout = \"wrapper\";\nreturn function MDXContent(_ref) {\n var components = _ref.components,\n props = _objectWithoutProperties(_ref, [\"components\"]);\n\n return mdx(MDXLayout, _extends({}, layoutProps, props, {\n components: components,\n mdxType: \"MDXLayout\"\n }), mdx(\"p\", null, \"Woah! You are almost half way done with understanding all of Discordeno. Amazing isn't it? Something you may have noticed in the last section was there were some options that prevented some commands from running like \", mdx(\"inlineCode\", {\n parentName: \"p\"\n }, \"dmOnly\"), \" or the permission options. we created a setting to prevent the monitor from running in certain channels. What if we wanted to do prevent commands from happening? How would we prevent commands from running?\"), mdx(\"h2\", null, \"What is an Inhibitor?\"), mdx(\"p\", null, \"An Inhibitor is very similar to how monitors work. A monitor runs on every message but an inhibitor runs on every command. Remember all those command options like cooldown, permissions, permissionLevel, nsfw, etc... Each and every one of these options has an inhibitor in that checks commands for these settings.\"), mdx(\"p\", null, \"Let's create our own inhibitor that would prevent commands from being used if the user is not a VIP user.\"), mdx(\"blockquote\", null, mdx(\"p\", {\n parentName: \"blockquote\"\n }, mdx(\"strong\", {\n parentName: \"p\"\n }, \"Note:\"), \" It is important to remember that everything below can be done with a simple permission level as well. We will create our own custom permission levels but for the purposes of this guide and to be able to learn about Inhibitors, we will be using an inhibitor.\")), mdx(\"h2\", null, \"Creating the File\"), mdx(\"p\", null, \"Let's start by creating a file inside the inhibitors folder called \", mdx(\"inlineCode\", {\n parentName: \"p\"\n }, \"vipOnly.ts\"), \" and paste the following snippet of code:\"), mdx(\"pre\", null, mdx(\"code\", _extends({\n parentName: \"pre\"\n }, {\n \"className\": \"language-ts\"\n }), \"import { botCache } from \\\"../../mod.ts\\\";\\n\\nbotCache.inhibitors.set(\\\"inhibitorname\\\", async function (message, command, guild) {\\n // Your code goes here\\n});\\n\")), mdx(\"p\", null, \"Inhibitors can take up to 3 arguments.\"), mdx(\"ul\", null, mdx(\"li\", {\n parentName: \"ul\"\n }, mdx(\"inlineCode\", {\n parentName: \"li\"\n }, \"message\"), \": The message object that triggered the command.\"), mdx(\"li\", {\n parentName: \"ul\"\n }, mdx(\"inlineCode\", {\n parentName: \"li\"\n }, \"command\"), \": The command object itself that was triggered.\"), mdx(\"li\", {\n parentName: \"ul\"\n }, mdx(\"inlineCode\", {\n parentName: \"li\"\n }, \"guild\"), \": The server guild object where this command was ran.\")), mdx(\"h2\", null, \"Understanding How Inhibitors Function\"), mdx(\"p\", null, \"To block a command you have to return a truthy value.\"), mdx(\"pre\", null, mdx(\"code\", _extends({\n parentName: \"pre\"\n }, {}), \"- **return true;** If you return true the inhibitor will block the execution of the command.\\n\")), mdx(\"p\", null, \"To allow a command return a falsey value.\"), mdx(\"pre\", null, mdx(\"code\", _extends({\n parentName: \"pre\"\n }, {}), \"- **return false;** If you return false the inhibitor will not block the error.\\n\")), mdx(\"pre\", null, mdx(\"code\", _extends({\n parentName: \"pre\"\n }, {\n \"className\": \"language-ts\"\n }), \"// If the command is not VIP only we can allow this command\\n if (!command.vipOnly) return false\\n // Check if the user is VIP\\n const userIsVIP = message.author.settings.get(`isVIP`)\\n // The user is VIP so we can allow this command to be used\\n if (userIsVIP) return false\\n // The user is NOT VIP so we throw an error\\n throw `The ${command.name} is only allowed for VIP users.`\\n\\n\\nexport const _frontmatter = {\\\"title\\\":\\\"Creating Inhibitors!\\\",\\\"metaTitle\\\":\\\"Creating An Inhibitor | Discordeno\\\",\\\"metaDescription\\\":\\\"Let's create our very own bot with Discordeno!\\\"}\\n\")));\n}\n;\nMDXContent.isMDXComponent = true;","rawMDXOutput":"/* @jsx mdx */\nimport { mdx } from '@mdx-js/react';\n/* @jsx mdx */\n\n\n\nconst layoutProps = {\n \n};\nconst MDXLayout = \"wrapper\"\nexport default function MDXContent({\n components,\n ...props\n}) {\n return \n

{`Woah! You are almost half way done with understanding all of Discordeno. Amazing isn't it? Something you may have noticed in the last section was there were some options that prevented some commands from running like `}{`dmOnly`}{` or the permission options. we created a setting to prevent the monitor from running in certain channels. What if we wanted to do prevent commands from happening? How would we prevent commands from running?`}

\n

{`What is an Inhibitor?`}

\n

{`An Inhibitor is very similar to how monitors work. A monitor runs on every message but an inhibitor runs on every command. Remember all those command options like cooldown, permissions, permissionLevel, nsfw, etc... Each and every one of these options has an inhibitor in that checks commands for these settings.`}

\n

{`Let's create our own inhibitor that would prevent commands from being used if the user is not a VIP user.`}

\n
\n

{`Note:`}{` It is important to remember that everything below can be done with a simple permission level as well. We will create our own custom permission levels but for the purposes of this guide and to be able to learn about Inhibitors, we will be using an inhibitor.`}

\n
\n

{`Creating the File`}

\n

{`Let's start by creating a file inside the inhibitors folder called `}{`vipOnly.ts`}{` and paste the following snippet of code:`}

\n
{`import { botCache } from \"../../mod.ts\";\n\nbotCache.inhibitors.set(\"inhibitorname\", async function (message, command, guild) {\n    // Your code goes here\n});\n`}
\n

{`Inhibitors can take up to 3 arguments.`}

\n
    \n
  • {`message`}{`: The message object that triggered the command.`}
  • \n
  • {`command`}{`: The command object itself that was triggered.`}
  • \n
  • {`guild`}{`: The server guild object where this command was ran.`}
  • \n
\n

{`Understanding How Inhibitors Function`}

\n

{`To block a command you have to return a truthy value.`}

\n
{`- **return true;** If you return true the inhibitor will block the execution of the command.\n`}
\n

{`To allow a command return a falsey value.`}

\n
{`- **return false;** If you return false the inhibitor will not block the error.\n`}
\n
{`// If the command is not VIP only we can allow this command\n        if (!command.vipOnly) return false\n        // Check if the user is VIP\n        const userIsVIP = message.author.settings.get(\\`isVIP\\`)\n        // The user is VIP so we can allow this command to be used\n        if (userIsVIP) return false\n        // The user is NOT VIP so we throw an error\n        throw \\`The \\${command.name} is only allowed for VIP users.\\`\n\n\nexport const _frontmatter = {\"title\":\"Creating Inhibitors!\",\"metaTitle\":\"Creating An Inhibitor | Discordeno\",\"metaDescription\":\"Let's create our very own bot with Discordeno!\"}\n`}
\n
;\n}\n\n;\nMDXContent.isMDXComponent = true;"}} \ No newline at end of file diff --git a/docs/.cache/caches/gatsby-plugin-mdx/diskstore-95be68775e17319e434f495d5a7ff08c.json b/docs/.cache/caches/gatsby-plugin-mdx/diskstore-95be68775e17319e434f495d5a7ff08c.json new file mode 100644 index 000000000..08179fdbc --- /dev/null +++ b/docs/.cache/caches/gatsby-plugin-mdx/diskstore-95be68775e17319e434f495d5a7ff08c.json @@ -0,0 +1 @@ +{"expireTime":9007200851596121000,"key":"gatsby-plugin-mdx-entire-payload-fd2811ae61f7169b39d2032c5d3a0319-","val":{"mdast":{"type":"root","children":[{"type":"heading","depth":2,"children":[{"type":"text","value":"Embeds","position":{"start":{"line":2,"column":4,"offset":4},"end":{"line":2,"column":10,"offset":10},"indent":[]}}],"position":{"start":{"line":2,"column":1,"offset":1},"end":{"line":2,"column":10,"offset":10},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"Under Construction","position":{"start":{"line":4,"column":1,"offset":12},"end":{"line":4,"column":19,"offset":30},"indent":[]}}],"position":{"start":{"line":4,"column":1,"offset":12},"end":{"line":4,"column":19,"offset":30},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"This will cover:","position":{"start":{"line":6,"column":1,"offset":32},"end":{"line":6,"column":17,"offset":48},"indent":[]}}],"position":{"start":{"line":6,"column":1,"offset":32},"end":{"line":6,"column":17,"offset":48},"indent":[]}},{"type":"list","ordered":false,"start":null,"spread":false,"children":[{"type":"listItem","spread":false,"checked":null,"children":[{"type":"paragraph","children":[{"type":"text","value":"Sending an Embed","position":{"start":{"line":7,"column":3,"offset":51},"end":{"line":7,"column":19,"offset":67},"indent":[]}}],"position":{"start":{"line":7,"column":3,"offset":51},"end":{"line":7,"column":19,"offset":67},"indent":[]}}],"position":{"start":{"line":7,"column":1,"offset":49},"end":{"line":7,"column":19,"offset":67},"indent":[]}},{"type":"listItem","spread":false,"checked":null,"children":[{"type":"paragraph","children":[{"type":"text","value":"Configuring an Embed in your code","position":{"start":{"line":8,"column":3,"offset":70},"end":{"line":8,"column":36,"offset":103},"indent":[]}}],"position":{"start":{"line":8,"column":3,"offset":70},"end":{"line":8,"column":36,"offset":103},"indent":[]}}],"position":{"start":{"line":8,"column":1,"offset":68},"end":{"line":8,"column":36,"offset":103},"indent":[]}}],"position":{"start":{"line":7,"column":1,"offset":49},"end":{"line":8,"column":36,"offset":103},"indent":[1]}},{"type":"heading","depth":2,"children":[{"type":"text","value":"Fetching","position":{"start":{"line":10,"column":4,"offset":108},"end":{"line":10,"column":12,"offset":116},"indent":[]}}],"position":{"start":{"line":10,"column":1,"offset":105},"end":{"line":10,"column":12,"offset":116},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"Under Construction","position":{"start":{"line":12,"column":1,"offset":118},"end":{"line":12,"column":19,"offset":136},"indent":[]}}],"position":{"start":{"line":12,"column":1,"offset":118},"end":{"line":12,"column":19,"offset":136},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"This will cover:","position":{"start":{"line":14,"column":1,"offset":138},"end":{"line":14,"column":17,"offset":154},"indent":[]}}],"position":{"start":{"line":14,"column":1,"offset":138},"end":{"line":14,"column":17,"offset":154},"indent":[]}},{"type":"list","ordered":false,"start":null,"spread":false,"children":[{"type":"listItem","spread":false,"checked":null,"children":[{"type":"paragraph","children":[{"type":"text","value":"User Info","position":{"start":{"line":15,"column":3,"offset":157},"end":{"line":15,"column":12,"offset":166},"indent":[]}}],"position":{"start":{"line":15,"column":3,"offset":157},"end":{"line":15,"column":12,"offset":166},"indent":[]}}],"position":{"start":{"line":15,"column":1,"offset":155},"end":{"line":15,"column":12,"offset":166},"indent":[]}},{"type":"listItem","spread":false,"checked":null,"children":[{"type":"paragraph","children":[{"type":"text","value":"Server Info","position":{"start":{"line":16,"column":3,"offset":169},"end":{"line":16,"column":14,"offset":180},"indent":[]}}],"position":{"start":{"line":16,"column":3,"offset":169},"end":{"line":16,"column":14,"offset":180},"indent":[]}}],"position":{"start":{"line":16,"column":1,"offset":167},"end":{"line":16,"column":14,"offset":180},"indent":[]}},{"type":"listItem","spread":false,"checked":null,"children":[{"type":"paragraph","children":[{"type":"text","value":"Ping","position":{"start":{"line":17,"column":3,"offset":183},"end":{"line":17,"column":7,"offset":187},"indent":[]}}],"position":{"start":{"line":17,"column":3,"offset":183},"end":{"line":17,"column":7,"offset":187},"indent":[]}}],"position":{"start":{"line":17,"column":1,"offset":181},"end":{"line":17,"column":7,"offset":187},"indent":[]}},{"type":"listItem","spread":false,"checked":null,"children":[{"type":"paragraph","children":[{"type":"text","value":"Role Info","position":{"start":{"line":18,"column":3,"offset":190},"end":{"line":18,"column":12,"offset":199},"indent":[]}}],"position":{"start":{"line":18,"column":3,"offset":190},"end":{"line":18,"column":12,"offset":199},"indent":[]}}],"position":{"start":{"line":18,"column":1,"offset":188},"end":{"line":18,"column":12,"offset":199},"indent":[]}}],"position":{"start":{"line":15,"column":1,"offset":155},"end":{"line":18,"column":12,"offset":199},"indent":[1,1,1]}},{"type":"heading","depth":2,"children":[{"type":"text","value":"Mentions","position":{"start":{"line":20,"column":4,"offset":204},"end":{"line":20,"column":12,"offset":212},"indent":[]}}],"position":{"start":{"line":20,"column":1,"offset":201},"end":{"line":20,"column":12,"offset":212},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"Under Construction","position":{"start":{"line":22,"column":1,"offset":214},"end":{"line":22,"column":19,"offset":232},"indent":[]}}],"position":{"start":{"line":22,"column":1,"offset":214},"end":{"line":22,"column":19,"offset":232},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"This will cover:","position":{"start":{"line":24,"column":1,"offset":234},"end":{"line":24,"column":17,"offset":250},"indent":[]}}],"position":{"start":{"line":24,"column":1,"offset":234},"end":{"line":24,"column":17,"offset":250},"indent":[]}},{"type":"list","ordered":false,"start":null,"spread":false,"children":[{"type":"listItem","spread":false,"checked":null,"children":[{"type":"paragraph","children":[{"type":"text","value":"How to use mentions","position":{"start":{"line":25,"column":3,"offset":253},"end":{"line":25,"column":22,"offset":272},"indent":[]}}],"position":{"start":{"line":25,"column":3,"offset":253},"end":{"line":25,"column":22,"offset":272},"indent":[]}}],"position":{"start":{"line":25,"column":1,"offset":251},"end":{"line":25,"column":22,"offset":272},"indent":[]}},{"type":"listItem","spread":false,"checked":null,"children":[{"type":"paragraph","children":[{"type":"text","value":"Making a Command with mentions","position":{"start":{"line":26,"column":3,"offset":275},"end":{"line":26,"column":33,"offset":305},"indent":[]}}],"position":{"start":{"line":26,"column":3,"offset":275},"end":{"line":26,"column":33,"offset":305},"indent":[]}}],"position":{"start":{"line":26,"column":1,"offset":273},"end":{"line":26,"column":33,"offset":305},"indent":[]}}],"position":{"start":{"line":25,"column":1,"offset":251},"end":{"line":26,"column":33,"offset":305},"indent":[1]}},{"type":"heading","depth":2,"children":[{"type":"text","value":"Permissions","position":{"start":{"line":28,"column":4,"offset":310},"end":{"line":28,"column":15,"offset":321},"indent":[]}}],"position":{"start":{"line":28,"column":1,"offset":307},"end":{"line":28,"column":15,"offset":321},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"Under Constructions","position":{"start":{"line":30,"column":1,"offset":323},"end":{"line":30,"column":20,"offset":342},"indent":[]}}],"position":{"start":{"line":30,"column":1,"offset":323},"end":{"line":30,"column":20,"offset":342},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"This will Cover","position":{"start":{"line":32,"column":1,"offset":344},"end":{"line":32,"column":16,"offset":359},"indent":[]}}],"position":{"start":{"line":32,"column":1,"offset":344},"end":{"line":32,"column":16,"offset":359},"indent":[]}},{"type":"list","ordered":false,"start":null,"spread":false,"children":[{"type":"listItem","spread":false,"checked":null,"children":[{"type":"paragraph","children":[{"type":"text","value":"General Bot Permissions","position":{"start":{"line":33,"column":3,"offset":362},"end":{"line":33,"column":26,"offset":385},"indent":[]}}],"position":{"start":{"line":33,"column":3,"offset":362},"end":{"line":33,"column":26,"offset":385},"indent":[]}}],"position":{"start":{"line":33,"column":1,"offset":360},"end":{"line":33,"column":26,"offset":385},"indent":[]}},{"type":"listItem","spread":false,"checked":null,"children":[{"type":"paragraph","children":[{"type":"text","value":"Types of Permissions","position":{"start":{"line":34,"column":3,"offset":388},"end":{"line":34,"column":23,"offset":408},"indent":[]}}],"position":{"start":{"line":34,"column":3,"offset":388},"end":{"line":34,"column":23,"offset":408},"indent":[]}}],"position":{"start":{"line":34,"column":1,"offset":386},"end":{"line":34,"column":23,"offset":408},"indent":[]}},{"type":"listItem","spread":false,"checked":null,"children":[{"type":"paragraph","children":[{"type":"text","value":"Errors you may get","position":{"start":{"line":35,"column":3,"offset":411},"end":{"line":35,"column":21,"offset":429},"indent":[]}}],"position":{"start":{"line":35,"column":3,"offset":411},"end":{"line":35,"column":21,"offset":429},"indent":[]}}],"position":{"start":{"line":35,"column":1,"offset":409},"end":{"line":35,"column":21,"offset":429},"indent":[]}}],"position":{"start":{"line":33,"column":1,"offset":360},"end":{"line":35,"column":21,"offset":429},"indent":[1,1]}},{"type":"heading","depth":2,"children":[{"type":"text","value":"Reactions","position":{"start":{"line":37,"column":4,"offset":434},"end":{"line":37,"column":13,"offset":443},"indent":[]}}],"position":{"start":{"line":37,"column":1,"offset":431},"end":{"line":37,"column":13,"offset":443},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"Under Construction","position":{"start":{"line":39,"column":1,"offset":445},"end":{"line":39,"column":19,"offset":463},"indent":[]}}],"position":{"start":{"line":39,"column":1,"offset":445},"end":{"line":39,"column":19,"offset":463},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"This will cover:","position":{"start":{"line":41,"column":1,"offset":465},"end":{"line":41,"column":17,"offset":481},"indent":[]}}],"position":{"start":{"line":41,"column":1,"offset":465},"end":{"line":41,"column":17,"offset":481},"indent":[]}},{"type":"list","ordered":false,"start":null,"spread":false,"children":[{"type":"listItem","spread":false,"checked":null,"children":[{"type":"paragraph","children":[{"type":"text","value":"Reactions","position":{"start":{"line":42,"column":3,"offset":484},"end":{"line":42,"column":12,"offset":493},"indent":[]}}],"position":{"start":{"line":42,"column":3,"offset":484},"end":{"line":42,"column":12,"offset":493},"indent":[]}}],"position":{"start":{"line":42,"column":1,"offset":482},"end":{"line":42,"column":12,"offset":493},"indent":[]}},{"type":"listItem","spread":false,"checked":null,"children":[{"type":"paragraph","children":[{"type":"text","value":"Types of Reactions that can be used","position":{"start":{"line":43,"column":3,"offset":496},"end":{"line":43,"column":38,"offset":531},"indent":[]}}],"position":{"start":{"line":43,"column":3,"offset":496},"end":{"line":43,"column":38,"offset":531},"indent":[]}}],"position":{"start":{"line":43,"column":1,"offset":494},"end":{"line":43,"column":38,"offset":531},"indent":[]}},{"type":"listItem","spread":false,"checked":null,"children":[{"type":"paragraph","children":[{"type":"text","value":"Adding Multiple Reactions","position":{"start":{"line":44,"column":3,"offset":534},"end":{"line":44,"column":28,"offset":559},"indent":[]}}],"position":{"start":{"line":44,"column":3,"offset":534},"end":{"line":44,"column":28,"offset":559},"indent":[]}}],"position":{"start":{"line":44,"column":1,"offset":532},"end":{"line":44,"column":28,"offset":559},"indent":[]}}],"position":{"start":{"line":42,"column":1,"offset":482},"end":{"line":44,"column":28,"offset":559},"indent":[1,1]}},{"type":"heading","depth":2,"children":[{"type":"text","value":"Roles","position":{"start":{"line":46,"column":4,"offset":564},"end":{"line":46,"column":9,"offset":569},"indent":[]}}],"position":{"start":{"line":46,"column":1,"offset":561},"end":{"line":46,"column":9,"offset":569},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"Under Construction","position":{"start":{"line":48,"column":1,"offset":571},"end":{"line":48,"column":19,"offset":589},"indent":[]}}],"position":{"start":{"line":48,"column":1,"offset":571},"end":{"line":48,"column":19,"offset":589},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"This will cover:","position":{"start":{"line":50,"column":1,"offset":591},"end":{"line":50,"column":17,"offset":607},"indent":[]}}],"position":{"start":{"line":50,"column":1,"offset":591},"end":{"line":50,"column":17,"offset":607},"indent":[]}},{"type":"list","ordered":false,"start":null,"spread":false,"children":[{"type":"listItem","spread":false,"checked":null,"children":[{"type":"paragraph","children":[{"type":"text","value":"Creating Roles","position":{"start":{"line":51,"column":3,"offset":610},"end":{"line":51,"column":17,"offset":624},"indent":[]}}],"position":{"start":{"line":51,"column":3,"offset":610},"end":{"line":51,"column":17,"offset":624},"indent":[]}}],"position":{"start":{"line":51,"column":1,"offset":608},"end":{"line":51,"column":17,"offset":624},"indent":[]}},{"type":"listItem","spread":false,"checked":null,"children":[{"type":"paragraph","children":[{"type":"text","value":"Editing Roles","position":{"start":{"line":52,"column":3,"offset":627},"end":{"line":52,"column":16,"offset":640},"indent":[]}}],"position":{"start":{"line":52,"column":3,"offset":627},"end":{"line":52,"column":16,"offset":640},"indent":[]}}],"position":{"start":{"line":52,"column":1,"offset":625},"end":{"line":52,"column":16,"offset":640},"indent":[]}},{"type":"listItem","spread":false,"checked":null,"children":[{"type":"paragraph","children":[{"type":"text","value":"How Roles play an important part in Discord Bots.","position":{"start":{"line":53,"column":3,"offset":643},"end":{"line":53,"column":52,"offset":692},"indent":[]}}],"position":{"start":{"line":53,"column":3,"offset":643},"end":{"line":53,"column":52,"offset":692},"indent":[]}}],"position":{"start":{"line":53,"column":1,"offset":641},"end":{"line":53,"column":52,"offset":692},"indent":[]}}],"position":{"start":{"line":51,"column":1,"offset":608},"end":{"line":53,"column":52,"offset":692},"indent":[1,1]}},{"type":"export","value":"export const _frontmatter = {\"title\":\"Guides\",\"metaTitle\":\"Guides | Discordeno\",\"metaDescription\":\"Discordeno is a Third Party Deno Library for interacting with the Discord API.\"}","position":{"start":{"line":56,"column":1,"offset":695},"end":{"line":56,"column":180,"offset":874},"indent":[]}}],"position":{"start":{"line":1,"column":1,"offset":0},"end":{"line":56,"column":180,"offset":874}}},"scopeImports":["import * as React from 'react'"],"scopeIdentifiers":["React"],"body":"function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }\n\nfunction _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }\n\nfunction _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }\n\n/* @jsx mdx */\nvar _frontmatter = {\n \"title\": \"Guides\",\n \"metaTitle\": \"Guides | Discordeno\",\n \"metaDescription\": \"Discordeno is a Third Party Deno Library for interacting with the Discord API.\"\n};\nvar layoutProps = {\n _frontmatter: _frontmatter\n};\nvar MDXLayout = \"wrapper\";\nreturn function MDXContent(_ref) {\n var components = _ref.components,\n props = _objectWithoutProperties(_ref, [\"components\"]);\n\n return mdx(MDXLayout, _extends({}, layoutProps, props, {\n components: components,\n mdxType: \"MDXLayout\"\n }), mdx(\"h2\", null, \"Embeds\"), mdx(\"p\", null, \"Under Construction\"), mdx(\"p\", null, \"This will cover:\"), mdx(\"ul\", null, mdx(\"li\", {\n parentName: \"ul\"\n }, \"Sending an Embed\"), mdx(\"li\", {\n parentName: \"ul\"\n }, \"Configuring an Embed in your code\")), mdx(\"h2\", null, \"Fetching\"), mdx(\"p\", null, \"Under Construction\"), mdx(\"p\", null, \"This will cover:\"), mdx(\"ul\", null, mdx(\"li\", {\n parentName: \"ul\"\n }, \"User Info\"), mdx(\"li\", {\n parentName: \"ul\"\n }, \"Server Info\"), mdx(\"li\", {\n parentName: \"ul\"\n }, \"Ping\"), mdx(\"li\", {\n parentName: \"ul\"\n }, \"Role Info\")), mdx(\"h2\", null, \"Mentions\"), mdx(\"p\", null, \"Under Construction\"), mdx(\"p\", null, \"This will cover:\"), mdx(\"ul\", null, mdx(\"li\", {\n parentName: \"ul\"\n }, \"How to use mentions\"), mdx(\"li\", {\n parentName: \"ul\"\n }, \"Making a Command with mentions\")), mdx(\"h2\", null, \"Permissions\"), mdx(\"p\", null, \"Under Constructions\"), mdx(\"p\", null, \"This will Cover\"), mdx(\"ul\", null, mdx(\"li\", {\n parentName: \"ul\"\n }, \"General Bot Permissions\"), mdx(\"li\", {\n parentName: \"ul\"\n }, \"Types of Permissions\"), mdx(\"li\", {\n parentName: \"ul\"\n }, \"Errors you may get\")), mdx(\"h2\", null, \"Reactions\"), mdx(\"p\", null, \"Under Construction\"), mdx(\"p\", null, \"This will cover:\"), mdx(\"ul\", null, mdx(\"li\", {\n parentName: \"ul\"\n }, \"Reactions\"), mdx(\"li\", {\n parentName: \"ul\"\n }, \"Types of Reactions that can be used\"), mdx(\"li\", {\n parentName: \"ul\"\n }, \"Adding Multiple Reactions\")), mdx(\"h2\", null, \"Roles\"), mdx(\"p\", null, \"Under Construction\"), mdx(\"p\", null, \"This will cover:\"), mdx(\"ul\", null, mdx(\"li\", {\n parentName: \"ul\"\n }, \"Creating Roles\"), mdx(\"li\", {\n parentName: \"ul\"\n }, \"Editing Roles\"), mdx(\"li\", {\n parentName: \"ul\"\n }, \"How Roles play an important part in Discord Bots.\")));\n}\n;\nMDXContent.isMDXComponent = true;","rawMDXOutput":"/* @jsx mdx */\nimport { mdx } from '@mdx-js/react';\n/* @jsx mdx */\n\nexport const _frontmatter = {\n \"title\": \"Guides\",\n \"metaTitle\": \"Guides | Discordeno\",\n \"metaDescription\": \"Discordeno is a Third Party Deno Library for interacting with the Discord API.\"\n};\n\nconst layoutProps = {\n _frontmatter\n};\nconst MDXLayout = \"wrapper\"\nexport default function MDXContent({\n components,\n ...props\n}) {\n return \n

{`Embeds`}

\n

{`Under Construction`}

\n

{`This will cover:`}

\n
    \n
  • {`Sending an Embed`}
  • \n
  • {`Configuring an Embed in your code`}
  • \n
\n

{`Fetching`}

\n

{`Under Construction`}

\n

{`This will cover:`}

\n
    \n
  • {`User Info`}
  • \n
  • {`Server Info`}
  • \n
  • {`Ping`}
  • \n
  • {`Role Info`}
  • \n
\n

{`Mentions`}

\n

{`Under Construction`}

\n

{`This will cover:`}

\n
    \n
  • {`How to use mentions`}
  • \n
  • {`Making a Command with mentions`}
  • \n
\n

{`Permissions`}

\n

{`Under Constructions`}

\n

{`This will Cover`}

\n
    \n
  • {`General Bot Permissions`}
  • \n
  • {`Types of Permissions`}
  • \n
  • {`Errors you may get`}
  • \n
\n

{`Reactions`}

\n

{`Under Construction`}

\n

{`This will cover:`}

\n
    \n
  • {`Reactions`}
  • \n
  • {`Types of Reactions that can be used`}
  • \n
  • {`Adding Multiple Reactions`}
  • \n
\n

{`Roles`}

\n

{`Under Construction`}

\n

{`This will cover:`}

\n
    \n
  • {`Creating Roles`}
  • \n
  • {`Editing Roles`}
  • \n
  • {`How Roles play an important part in Discord Bots.`}
  • \n
\n\n
;\n}\n\n;\nMDXContent.isMDXComponent = true;"}} \ No newline at end of file diff --git a/docs/.cache/caches/gatsby-plugin-mdx/diskstore-96c3cefc21a452d127cb41816d06bb62.json b/docs/.cache/caches/gatsby-plugin-mdx/diskstore-96c3cefc21a452d127cb41816d06bb62.json new file mode 100644 index 000000000..b385ea29a --- /dev/null +++ b/docs/.cache/caches/gatsby-plugin-mdx/diskstore-96c3cefc21a452d127cb41816d06bb62.json @@ -0,0 +1 @@ +{"expireTime":9007200851634941000,"key":"gatsby-plugin-mdx-entire-payload-22995c61294a9fb4c751a70ac44e3b76-","val":{"mdast":{"type":"root","children":[{"type":"paragraph","children":[{"type":"text","value":"Woah! You are almost half way done with understanding all of Discordeno. Amazing isn't it? Something you may have noticed in the last section was there were some options that prevented some commands from running like ","position":{"start":{"line":2,"column":1,"offset":1},"end":{"line":2,"column":218,"offset":218},"indent":[]}},{"type":"inlineCode","value":"dmOnly","position":{"start":{"line":2,"column":218,"offset":218},"end":{"line":2,"column":226,"offset":226},"indent":[]}},{"type":"text","value":" or the permission options. we created a setting to prevent the monitor from running in certain channels. What if we wanted to do prevent commands from happening? How would we prevent commands from running?","position":{"start":{"line":2,"column":226,"offset":226},"end":{"line":2,"column":432,"offset":432},"indent":[]}}],"position":{"start":{"line":2,"column":1,"offset":1},"end":{"line":2,"column":432,"offset":432},"indent":[]}},{"type":"heading","depth":2,"children":[{"type":"text","value":"What is an Inhibitor?","position":{"start":{"line":4,"column":4,"offset":437},"end":{"line":4,"column":25,"offset":458},"indent":[]}}],"position":{"start":{"line":4,"column":1,"offset":434},"end":{"line":4,"column":25,"offset":458},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"An Inhibitor is very similar to how monitors work. A monitor runs on every message but an inhibitor runs on every command. Remember all those command options like cooldown, permissions, permissionLevel, nsfw, etc... Each and every one of these options has an inhibitor in that checks commands for these settings.","position":{"start":{"line":6,"column":1,"offset":460},"end":{"line":6,"column":313,"offset":772},"indent":[]}}],"position":{"start":{"line":6,"column":1,"offset":460},"end":{"line":6,"column":313,"offset":772},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"Let's create our own inhibitor that would prevent commands from being used if the user is not a VIP user.","position":{"start":{"line":8,"column":1,"offset":774},"end":{"line":8,"column":106,"offset":879},"indent":[]}}],"position":{"start":{"line":8,"column":1,"offset":774},"end":{"line":8,"column":106,"offset":879},"indent":[]}},{"type":"blockquote","children":[{"type":"paragraph","children":[{"type":"strong","children":[{"type":"text","value":"Note:","position":{"start":{"line":10,"column":5,"offset":885},"end":{"line":10,"column":10,"offset":890},"indent":[]}}],"position":{"start":{"line":10,"column":3,"offset":883},"end":{"line":10,"column":12,"offset":892},"indent":[]}},{"type":"text","value":" It is important to remember that everything below can be done with a simple permission level as well. We will create our own custom permission levels but for the purposes of this guide and to be able to learn about Inhibitors, we will be using an inhibitor.","position":{"start":{"line":10,"column":12,"offset":892},"end":{"line":10,"column":270,"offset":1150},"indent":[]}}],"position":{"start":{"line":10,"column":3,"offset":883},"end":{"line":10,"column":270,"offset":1150},"indent":[]}}],"position":{"start":{"line":10,"column":1,"offset":881},"end":{"line":10,"column":270,"offset":1150},"indent":[]}},{"type":"heading","depth":2,"children":[{"type":"text","value":"Creating the File","position":{"start":{"line":12,"column":4,"offset":1155},"end":{"line":12,"column":21,"offset":1172},"indent":[]}}],"position":{"start":{"line":12,"column":1,"offset":1152},"end":{"line":12,"column":21,"offset":1172},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"Let's start by creating a file inside the inhibitors folder called ","position":{"start":{"line":14,"column":1,"offset":1174},"end":{"line":14,"column":68,"offset":1241},"indent":[]}},{"type":"inlineCode","value":"boosted.ts","position":{"start":{"line":14,"column":68,"offset":1241},"end":{"line":14,"column":80,"offset":1253},"indent":[]}},{"type":"text","value":" and paste the following snippet of code:","position":{"start":{"line":14,"column":80,"offset":1253},"end":{"line":14,"column":121,"offset":1294},"indent":[]}}],"position":{"start":{"line":14,"column":1,"offset":1174},"end":{"line":14,"column":121,"offset":1294},"indent":[]}},{"type":"code","lang":"ts","meta":null,"value":"import { botCache } from \"../../mod.ts\";\n\nbotCache.inhibitors.set(\"inhibitorname\", async function (message, command, guild) {\n\t// Your code goes here\n});","position":{"start":{"line":16,"column":1,"offset":1296},"end":{"line":22,"column":4,"offset":1459},"indent":[1,1,1,1,1,1]}},{"type":"paragraph","children":[{"type":"text","value":"Inhibitors can take up to 3 arguments.","position":{"start":{"line":24,"column":1,"offset":1461},"end":{"line":24,"column":39,"offset":1499},"indent":[]}}],"position":{"start":{"line":24,"column":1,"offset":1461},"end":{"line":24,"column":39,"offset":1499},"indent":[]}},{"type":"list","ordered":false,"start":null,"spread":false,"children":[{"type":"listItem","spread":false,"checked":null,"children":[{"type":"paragraph","children":[{"type":"inlineCode","value":"message","position":{"start":{"line":26,"column":3,"offset":1503},"end":{"line":26,"column":12,"offset":1512},"indent":[]}},{"type":"text","value":": The message object that triggered the command.","position":{"start":{"line":26,"column":12,"offset":1512},"end":{"line":26,"column":60,"offset":1560},"indent":[]}}],"position":{"start":{"line":26,"column":3,"offset":1503},"end":{"line":26,"column":60,"offset":1560},"indent":[]}}],"position":{"start":{"line":26,"column":1,"offset":1501},"end":{"line":26,"column":60,"offset":1560},"indent":[]}},{"type":"listItem","spread":false,"checked":null,"children":[{"type":"paragraph","children":[{"type":"inlineCode","value":"command","position":{"start":{"line":27,"column":3,"offset":1563},"end":{"line":27,"column":12,"offset":1572},"indent":[]}},{"type":"text","value":": The command object itself that was triggered.","position":{"start":{"line":27,"column":12,"offset":1572},"end":{"line":27,"column":59,"offset":1619},"indent":[]}}],"position":{"start":{"line":27,"column":3,"offset":1563},"end":{"line":27,"column":59,"offset":1619},"indent":[]}}],"position":{"start":{"line":27,"column":1,"offset":1561},"end":{"line":27,"column":59,"offset":1619},"indent":[]}},{"type":"listItem","spread":false,"checked":null,"children":[{"type":"paragraph","children":[{"type":"inlineCode","value":"guild","position":{"start":{"line":28,"column":3,"offset":1622},"end":{"line":28,"column":10,"offset":1629},"indent":[]}},{"type":"text","value":": The server guild object where this command was ran.","position":{"start":{"line":28,"column":10,"offset":1629},"end":{"line":28,"column":63,"offset":1682},"indent":[]}}],"position":{"start":{"line":28,"column":3,"offset":1622},"end":{"line":28,"column":63,"offset":1682},"indent":[]}}],"position":{"start":{"line":28,"column":1,"offset":1620},"end":{"line":28,"column":63,"offset":1682},"indent":[]}}],"position":{"start":{"line":26,"column":1,"offset":1501},"end":{"line":28,"column":63,"offset":1682},"indent":[1,1]}},{"type":"heading","depth":2,"children":[{"type":"text","value":"Understanding How Inhibitors Function","position":{"start":{"line":30,"column":4,"offset":1687},"end":{"line":30,"column":41,"offset":1724},"indent":[]}}],"position":{"start":{"line":30,"column":1,"offset":1684},"end":{"line":30,"column":41,"offset":1724},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"To block a command you have to return a truthy value.","position":{"start":{"line":32,"column":1,"offset":1726},"end":{"line":32,"column":54,"offset":1779},"indent":[]}}],"position":{"start":{"line":32,"column":1,"offset":1726},"end":{"line":32,"column":54,"offset":1779},"indent":[]}},{"type":"list","ordered":false,"start":null,"spread":false,"children":[{"type":"listItem","spread":false,"checked":null,"children":[{"type":"paragraph","children":[{"type":"strong","children":[{"type":"text","value":"return true;","position":{"start":{"line":33,"column":5,"offset":1784},"end":{"line":33,"column":17,"offset":1796},"indent":[]}}],"position":{"start":{"line":33,"column":3,"offset":1782},"end":{"line":33,"column":19,"offset":1798},"indent":[]}},{"type":"text","value":" If you return true the inhibitor will block the execution of the command.\nTo allow a command return a falsey value.","position":{"start":{"line":33,"column":19,"offset":1798},"end":{"line":34,"column":42,"offset":1914},"indent":[1]}}],"position":{"start":{"line":33,"column":3,"offset":1782},"end":{"line":34,"column":42,"offset":1914},"indent":[1]}}],"position":{"start":{"line":33,"column":1,"offset":1780},"end":{"line":34,"column":42,"offset":1914},"indent":[1]}},{"type":"listItem","spread":false,"checked":null,"children":[{"type":"paragraph","children":[{"type":"strong","children":[{"type":"text","value":"return false;","position":{"start":{"line":35,"column":5,"offset":1919},"end":{"line":35,"column":18,"offset":1932},"indent":[]}}],"position":{"start":{"line":35,"column":3,"offset":1917},"end":{"line":35,"column":20,"offset":1934},"indent":[]}},{"type":"text","value":" If you return false the inhibitor will not block the error.","position":{"start":{"line":35,"column":20,"offset":1934},"end":{"line":35,"column":80,"offset":1994},"indent":[]}}],"position":{"start":{"line":35,"column":3,"offset":1917},"end":{"line":35,"column":80,"offset":1994},"indent":[]}}],"position":{"start":{"line":35,"column":1,"offset":1915},"end":{"line":35,"column":80,"offset":1994},"indent":[]}}],"position":{"start":{"line":33,"column":1,"offset":1780},"end":{"line":35,"column":80,"offset":1994},"indent":[1,1]}},{"type":"code","lang":"ts","meta":null,"value":"// If the command is not VIP only we can allow this command to execute\nif (!command.vipOnly) return false;\n\n// The bot's support server\nconst guild = cache.guilds.get(configs.supportServerID);\n// If the command author is not in the server they won't have the vip role\nconst member = guild.members.get(message.author.id) || await getMember(guild.id, message.author.id);\n// Member doesn't exist so cancel the command\nif (!member) {\n\tsendResponse(message, `sorry, but you can not use this command until you become VIP. **Close the IRIS!!!**`)\n\treturn true;\n}\n\n// If the user has the vip role on the support server given by patreon allow the command\nif (member.roles.includes(configs.roleIDs.patreonVIPRoleID)) return false;\n\n// Alert the user they don't have vip and can't use the command\nsendResponse(message, `sorry, but you can not use this command until you become a VIP. I'm sorry, Teal'c. We'll go to Disneyland next year. I promise.`)\n// Cancel the command since the user does not have vip\nreturn true;","position":{"start":{"line":38,"column":1,"offset":1997},"end":{"line":59,"column":4,"offset":3013},"indent":[1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1]}},{"type":"heading","depth":2,"children":[{"type":"text","value":"Updating Command Typings","position":{"start":{"line":61,"column":4,"offset":3018},"end":{"line":61,"column":28,"offset":3042},"indent":[]}}],"position":{"start":{"line":61,"column":1,"offset":3015},"end":{"line":61,"column":28,"offset":3042},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"Since we need a new option on our commands we need to add that. Open the ","position":{"start":{"line":63,"column":1,"offset":3044},"end":{"line":63,"column":74,"offset":3117},"indent":[]}},{"type":"inlineCode","value":"src/types/commands.ts","position":{"start":{"line":63,"column":74,"offset":3117},"end":{"line":63,"column":97,"offset":3140},"indent":[]}},{"type":"text","value":" file and add in the following","position":{"start":{"line":63,"column":97,"offset":3140},"end":{"line":63,"column":127,"offset":3170},"indent":[]}}],"position":{"start":{"line":63,"column":1,"offset":3044},"end":{"line":63,"column":127,"offset":3170},"indent":[]}},{"type":"code","lang":"ts","meta":null,"value":" vipOnly?: boolean;","position":{"start":{"line":65,"column":1,"offset":3172},"end":{"line":67,"column":4,"offset":3202},"indent":[1,1]}},{"type":"paragraph","children":[{"type":"text","value":"Once that is added, you can go into any command and ","position":{"start":{"line":69,"column":1,"offset":3204},"end":{"line":69,"column":53,"offset":3256},"indent":[]}}],"position":{"start":{"line":69,"column":1,"offset":3204},"end":{"line":69,"column":53,"offset":3256},"indent":[]}},{"type":"heading","depth":2,"children":[{"type":"text","value":"Challenges","position":{"start":{"line":71,"column":4,"offset":3261},"end":{"line":71,"column":14,"offset":3271},"indent":[]}}],"position":{"start":{"line":71,"column":1,"offset":3258},"end":{"line":71,"column":14,"offset":3271},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"Hell yes! We just got through the entire inhibitor section. You have now mastered everything related to inhibitors.","position":{"start":{"line":73,"column":1,"offset":3273},"end":{"line":73,"column":116,"offset":3388},"indent":[]}}],"position":{"start":{"line":73,"column":1,"offset":3273},"end":{"line":73,"column":116,"offset":3388},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"You can now try and get a little more practice with inhibitors by trying to challenge yourself and make your own inhibitors. Don't worry if you can't think of any good use cases for inhibitors.","position":{"start":{"line":75,"column":1,"offset":3390},"end":{"line":75,"column":194,"offset":3583},"indent":[]}}],"position":{"start":{"line":75,"column":1,"offset":3390},"end":{"line":75,"column":194,"offset":3583},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"Majority of Discordeno bots do not use many custom inhibitors because most of the necessary/important ones already come built for you in the inhibitors folder.","position":{"start":{"line":77,"column":1,"offset":3585},"end":{"line":77,"column":160,"offset":3744},"indent":[]}}],"position":{"start":{"line":77,"column":1,"offset":3585},"end":{"line":77,"column":160,"offset":3744},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"Next we will try our hands at creating a monitor.","position":{"start":{"line":79,"column":1,"offset":3746},"end":{"line":79,"column":50,"offset":3795},"indent":[]}}],"position":{"start":{"line":79,"column":1,"offset":3746},"end":{"line":79,"column":50,"offset":3795},"indent":[]}},{"type":"export","value":"export const _frontmatter = {\"title\":\"Creating Inhibitors!\",\"metaTitle\":\"Creating An Inhibitor | Discordeno\",\"metaDescription\":\"Let's create our very own bot with Discordeno!\"}","position":{"start":{"line":82,"column":1,"offset":3798},"end":{"line":82,"column":177,"offset":3974},"indent":[]}}],"position":{"start":{"line":1,"column":1,"offset":0},"end":{"line":82,"column":177,"offset":3974}}},"scopeImports":["import * as React from 'react'"],"scopeIdentifiers":["React"],"body":"function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }\n\nfunction _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }\n\nfunction _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }\n\n/* @jsx mdx */\nvar _frontmatter = {\n \"title\": \"Creating Inhibitors!\",\n \"metaTitle\": \"Creating An Inhibitor | Discordeno\",\n \"metaDescription\": \"Let's create our very own bot with Discordeno!\"\n};\nvar layoutProps = {\n _frontmatter: _frontmatter\n};\nvar MDXLayout = \"wrapper\";\nreturn function MDXContent(_ref) {\n var components = _ref.components,\n props = _objectWithoutProperties(_ref, [\"components\"]);\n\n return mdx(MDXLayout, _extends({}, layoutProps, props, {\n components: components,\n mdxType: \"MDXLayout\"\n }), mdx(\"p\", null, \"Woah! You are almost half way done with understanding all of Discordeno. Amazing isn't it? Something you may have noticed in the last section was there were some options that prevented some commands from running like \", mdx(\"inlineCode\", {\n parentName: \"p\"\n }, \"dmOnly\"), \" or the permission options. we created a setting to prevent the monitor from running in certain channels. What if we wanted to do prevent commands from happening? How would we prevent commands from running?\"), mdx(\"h2\", null, \"What is an Inhibitor?\"), mdx(\"p\", null, \"An Inhibitor is very similar to how monitors work. A monitor runs on every message but an inhibitor runs on every command. Remember all those command options like cooldown, permissions, permissionLevel, nsfw, etc... Each and every one of these options has an inhibitor in that checks commands for these settings.\"), mdx(\"p\", null, \"Let's create our own inhibitor that would prevent commands from being used if the user is not a VIP user.\"), mdx(\"blockquote\", null, mdx(\"p\", {\n parentName: \"blockquote\"\n }, mdx(\"strong\", {\n parentName: \"p\"\n }, \"Note:\"), \" It is important to remember that everything below can be done with a simple permission level as well. We will create our own custom permission levels but for the purposes of this guide and to be able to learn about Inhibitors, we will be using an inhibitor.\")), mdx(\"h2\", null, \"Creating the File\"), mdx(\"p\", null, \"Let's start by creating a file inside the inhibitors folder called \", mdx(\"inlineCode\", {\n parentName: \"p\"\n }, \"boosted.ts\"), \" and paste the following snippet of code:\"), mdx(\"pre\", null, mdx(\"code\", _extends({\n parentName: \"pre\"\n }, {\n \"className\": \"language-ts\"\n }), \"import { botCache } from \\\"../../mod.ts\\\";\\n\\nbotCache.inhibitors.set(\\\"inhibitorname\\\", async function (message, command, guild) {\\n // Your code goes here\\n});\\n\")), mdx(\"p\", null, \"Inhibitors can take up to 3 arguments.\"), mdx(\"ul\", null, mdx(\"li\", {\n parentName: \"ul\"\n }, mdx(\"inlineCode\", {\n parentName: \"li\"\n }, \"message\"), \": The message object that triggered the command.\"), mdx(\"li\", {\n parentName: \"ul\"\n }, mdx(\"inlineCode\", {\n parentName: \"li\"\n }, \"command\"), \": The command object itself that was triggered.\"), mdx(\"li\", {\n parentName: \"ul\"\n }, mdx(\"inlineCode\", {\n parentName: \"li\"\n }, \"guild\"), \": The server guild object where this command was ran.\")), mdx(\"h2\", null, \"Understanding How Inhibitors Function\"), mdx(\"p\", null, \"To block a command you have to return a truthy value.\"), mdx(\"ul\", null, mdx(\"li\", {\n parentName: \"ul\"\n }, mdx(\"strong\", {\n parentName: \"li\"\n }, \"return true;\"), \" If you return true the inhibitor will block the execution of the command.\\nTo allow a command return a falsey value.\"), mdx(\"li\", {\n parentName: \"ul\"\n }, mdx(\"strong\", {\n parentName: \"li\"\n }, \"return false;\"), \" If you return false the inhibitor will not block the error.\")), mdx(\"pre\", null, mdx(\"code\", _extends({\n parentName: \"pre\"\n }, {\n \"className\": \"language-ts\"\n }), \"// If the command is not VIP only we can allow this command to execute\\nif (!command.vipOnly) return false;\\n\\n// The bot's support server\\nconst guild = cache.guilds.get(configs.supportServerID);\\n// If the command author is not in the server they won't have the vip role\\nconst member = guild.members.get(message.author.id) || await getMember(guild.id, message.author.id);\\n// Member doesn't exist so cancel the command\\nif (!member) {\\n sendResponse(message, `sorry, but you can not use this command until you become VIP. **Close the IRIS!!!**`)\\n return true;\\n}\\n\\n// If the user has the vip role on the support server given by patreon allow the command\\nif (member.roles.includes(configs.roleIDs.patreonVIPRoleID)) return false;\\n\\n// Alert the user they don't have vip and can't use the command\\nsendResponse(message, `sorry, but you can not use this command until you become a VIP. I'm sorry, Teal'c. We'll go to Disneyland next year. I promise.`)\\n// Cancel the command since the user does not have vip\\nreturn true;\\n\")), mdx(\"h2\", null, \"Updating Command Typings\"), mdx(\"p\", null, \"Since we need a new option on our commands we need to add that. Open the \", mdx(\"inlineCode\", {\n parentName: \"p\"\n }, \"src/types/commands.ts\"), \" file and add in the following\"), mdx(\"pre\", null, mdx(\"code\", _extends({\n parentName: \"pre\"\n }, {\n \"className\": \"language-ts\"\n }), \" vipOnly?: boolean;\\n\")), mdx(\"p\", null, \"Once that is added, you can go into any command and \"), mdx(\"h2\", null, \"Challenges\"), mdx(\"p\", null, \"Hell yes! We just got through the entire inhibitor section. You have now mastered everything related to inhibitors.\"), mdx(\"p\", null, \"You can now try and get a little more practice with inhibitors by trying to challenge yourself and make your own inhibitors. Don't worry if you can't think of any good use cases for inhibitors.\"), mdx(\"p\", null, \"Majority of Discordeno bots do not use many custom inhibitors because most of the necessary/important ones already come built for you in the inhibitors folder.\"), mdx(\"p\", null, \"Next we will try our hands at creating a monitor.\"));\n}\n;\nMDXContent.isMDXComponent = true;","rawMDXOutput":"/* @jsx mdx */\nimport { mdx } from '@mdx-js/react';\n/* @jsx mdx */\n\nexport const _frontmatter = {\n \"title\": \"Creating Inhibitors!\",\n \"metaTitle\": \"Creating An Inhibitor | Discordeno\",\n \"metaDescription\": \"Let's create our very own bot with Discordeno!\"\n};\n\nconst layoutProps = {\n _frontmatter\n};\nconst MDXLayout = \"wrapper\"\nexport default function MDXContent({\n components,\n ...props\n}) {\n return \n

{`Woah! You are almost half way done with understanding all of Discordeno. Amazing isn't it? Something you may have noticed in the last section was there were some options that prevented some commands from running like `}{`dmOnly`}{` or the permission options. we created a setting to prevent the monitor from running in certain channels. What if we wanted to do prevent commands from happening? How would we prevent commands from running?`}

\n

{`What is an Inhibitor?`}

\n

{`An Inhibitor is very similar to how monitors work. A monitor runs on every message but an inhibitor runs on every command. Remember all those command options like cooldown, permissions, permissionLevel, nsfw, etc... Each and every one of these options has an inhibitor in that checks commands for these settings.`}

\n

{`Let's create our own inhibitor that would prevent commands from being used if the user is not a VIP user.`}

\n
\n

{`Note:`}{` It is important to remember that everything below can be done with a simple permission level as well. We will create our own custom permission levels but for the purposes of this guide and to be able to learn about Inhibitors, we will be using an inhibitor.`}

\n
\n

{`Creating the File`}

\n

{`Let's start by creating a file inside the inhibitors folder called `}{`boosted.ts`}{` and paste the following snippet of code:`}

\n
{`import { botCache } from \"../../mod.ts\";\n\nbotCache.inhibitors.set(\"inhibitorname\", async function (message, command, guild) {\n    // Your code goes here\n});\n`}
\n

{`Inhibitors can take up to 3 arguments.`}

\n
    \n
  • {`message`}{`: The message object that triggered the command.`}
  • \n
  • {`command`}{`: The command object itself that was triggered.`}
  • \n
  • {`guild`}{`: The server guild object where this command was ran.`}
  • \n
\n

{`Understanding How Inhibitors Function`}

\n

{`To block a command you have to return a truthy value.`}

\n
    \n
  • {`return true;`}{` If you return true the inhibitor will block the execution of the command.\nTo allow a command return a falsey value.`}
  • \n
  • {`return false;`}{` If you return false the inhibitor will not block the error.`}
  • \n
\n
{`// If the command is not VIP only we can allow this command to execute\nif (!command.vipOnly) return false;\n\n// The bot's support server\nconst guild = cache.guilds.get(configs.supportServerID);\n// If the command author is not in the server they won't have the vip role\nconst member = guild.members.get(message.author.id) || await getMember(guild.id, message.author.id);\n// Member doesn't exist so cancel the command\nif (!member) {\n    sendResponse(message, \\`sorry, but you can not use this command until you become VIP. **Close the IRIS!!!**\\`)\n    return true;\n}\n\n// If the user has the vip role on the support server given by patreon allow the command\nif (member.roles.includes(configs.roleIDs.patreonVIPRoleID)) return false;\n\n// Alert the user they don't have vip and can't use the command\nsendResponse(message, \\`sorry, but you can not use this command until you become a VIP. I'm sorry, Teal'c. We'll go to Disneyland next year. I promise.\\`)\n// Cancel the command since the user does not have vip\nreturn true;\n`}
\n

{`Updating Command Typings`}

\n

{`Since we need a new option on our commands we need to add that. Open the `}{`src/types/commands.ts`}{` file and add in the following`}

\n
{`  vipOnly?: boolean;\n`}
\n

{`Once that is added, you can go into any command and `}

\n

{`Challenges`}

\n

{`Hell yes! We just got through the entire inhibitor section. You have now mastered everything related to inhibitors.`}

\n

{`You can now try and get a little more practice with inhibitors by trying to challenge yourself and make your own inhibitors. Don't worry if you can't think of any good use cases for inhibitors.`}

\n

{`Majority of Discordeno bots do not use many custom inhibitors because most of the necessary/important ones already come built for you in the inhibitors folder.`}

\n

{`Next we will try our hands at creating a monitor.`}

\n\n
;\n}\n\n;\nMDXContent.isMDXComponent = true;"}} \ No newline at end of file diff --git a/docs/.cache/caches/gatsby-plugin-mdx/diskstore-9a37d616d0c39b3996f33076c21a2dd3.json b/docs/.cache/caches/gatsby-plugin-mdx/diskstore-9a37d616d0c39b3996f33076c21a2dd3.json new file mode 100644 index 000000000..b9ce38e9e --- /dev/null +++ b/docs/.cache/caches/gatsby-plugin-mdx/diskstore-9a37d616d0c39b3996f33076c21a2dd3.json @@ -0,0 +1 @@ +{"expireTime":9007200851633135000,"key":"gatsby-plugin-mdx-entire-payload-0d951a9a54f0825a69de4c79fadd59ab-","val":{"mdast":{"type":"root","children":[{"type":"paragraph","children":[{"type":"text","value":"Woah! You are almost half way done with understanding all of Discordeno. Amazing isn't it? Something you may have noticed in the last section was there were some options that prevented some commands from running like ","position":{"start":{"line":2,"column":1,"offset":1},"end":{"line":2,"column":218,"offset":218},"indent":[]}},{"type":"inlineCode","value":"dmOnly","position":{"start":{"line":2,"column":218,"offset":218},"end":{"line":2,"column":226,"offset":226},"indent":[]}},{"type":"text","value":" or the permission options. we created a setting to prevent the monitor from running in certain channels. What if we wanted to do prevent commands from happening? How would we prevent commands from running?","position":{"start":{"line":2,"column":226,"offset":226},"end":{"line":2,"column":432,"offset":432},"indent":[]}}],"position":{"start":{"line":2,"column":1,"offset":1},"end":{"line":2,"column":432,"offset":432},"indent":[]}},{"type":"heading","depth":2,"children":[{"type":"text","value":"What is an Inhibitor?","position":{"start":{"line":4,"column":4,"offset":437},"end":{"line":4,"column":25,"offset":458},"indent":[]}}],"position":{"start":{"line":4,"column":1,"offset":434},"end":{"line":4,"column":25,"offset":458},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"An Inhibitor is very similar to how monitors work. A monitor runs on every message but an inhibitor runs on every command. Remember all those command options like cooldown, permissions, permissionLevel, nsfw, etc... Each and every one of these options has an inhibitor in that checks commands for these settings.","position":{"start":{"line":6,"column":1,"offset":460},"end":{"line":6,"column":313,"offset":772},"indent":[]}}],"position":{"start":{"line":6,"column":1,"offset":460},"end":{"line":6,"column":313,"offset":772},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"Let's create our own inhibitor that would prevent commands from being used if the user is not a VIP user.","position":{"start":{"line":8,"column":1,"offset":774},"end":{"line":8,"column":106,"offset":879},"indent":[]}}],"position":{"start":{"line":8,"column":1,"offset":774},"end":{"line":8,"column":106,"offset":879},"indent":[]}},{"type":"blockquote","children":[{"type":"paragraph","children":[{"type":"strong","children":[{"type":"text","value":"Note:","position":{"start":{"line":10,"column":5,"offset":885},"end":{"line":10,"column":10,"offset":890},"indent":[]}}],"position":{"start":{"line":10,"column":3,"offset":883},"end":{"line":10,"column":12,"offset":892},"indent":[]}},{"type":"text","value":" It is important to remember that everything below can be done with a simple permission level as well. We will create our own custom permission levels but for the purposes of this guide and to be able to learn about Inhibitors, we will be using an inhibitor.","position":{"start":{"line":10,"column":12,"offset":892},"end":{"line":10,"column":270,"offset":1150},"indent":[]}}],"position":{"start":{"line":10,"column":3,"offset":883},"end":{"line":10,"column":270,"offset":1150},"indent":[]}}],"position":{"start":{"line":10,"column":1,"offset":881},"end":{"line":10,"column":270,"offset":1150},"indent":[]}},{"type":"heading","depth":2,"children":[{"type":"text","value":"Creating the File","position":{"start":{"line":12,"column":4,"offset":1155},"end":{"line":12,"column":21,"offset":1172},"indent":[]}}],"position":{"start":{"line":12,"column":1,"offset":1152},"end":{"line":12,"column":21,"offset":1172},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"Let's start by creating a file inside the inhibitors folder called ","position":{"start":{"line":14,"column":1,"offset":1174},"end":{"line":14,"column":68,"offset":1241},"indent":[]}},{"type":"inlineCode","value":"vipOnly.ts","position":{"start":{"line":14,"column":68,"offset":1241},"end":{"line":14,"column":80,"offset":1253},"indent":[]}},{"type":"text","value":" and paste the following snippet of code:","position":{"start":{"line":14,"column":80,"offset":1253},"end":{"line":14,"column":121,"offset":1294},"indent":[]}}],"position":{"start":{"line":14,"column":1,"offset":1174},"end":{"line":14,"column":121,"offset":1294},"indent":[]}},{"type":"code","lang":"ts","meta":null,"value":"import { botCache } from \"../../mod.ts\";\n\nbotCache.inhibitors.set(\"inhibitorname\", async function (message, command, guild) {\n\t// Your code goes here\n});","position":{"start":{"line":16,"column":1,"offset":1296},"end":{"line":22,"column":4,"offset":1459},"indent":[1,1,1,1,1,1]}},{"type":"paragraph","children":[{"type":"text","value":"Inhibitors can take up to 3 arguments.","position":{"start":{"line":24,"column":1,"offset":1461},"end":{"line":24,"column":39,"offset":1499},"indent":[]}}],"position":{"start":{"line":24,"column":1,"offset":1461},"end":{"line":24,"column":39,"offset":1499},"indent":[]}},{"type":"list","ordered":false,"start":null,"spread":false,"children":[{"type":"listItem","spread":false,"checked":null,"children":[{"type":"paragraph","children":[{"type":"inlineCode","value":"message","position":{"start":{"line":26,"column":3,"offset":1503},"end":{"line":26,"column":12,"offset":1512},"indent":[]}},{"type":"text","value":": The message object that triggered the command.","position":{"start":{"line":26,"column":12,"offset":1512},"end":{"line":26,"column":60,"offset":1560},"indent":[]}}],"position":{"start":{"line":26,"column":3,"offset":1503},"end":{"line":26,"column":60,"offset":1560},"indent":[]}}],"position":{"start":{"line":26,"column":1,"offset":1501},"end":{"line":26,"column":60,"offset":1560},"indent":[]}},{"type":"listItem","spread":false,"checked":null,"children":[{"type":"paragraph","children":[{"type":"inlineCode","value":"command","position":{"start":{"line":27,"column":3,"offset":1563},"end":{"line":27,"column":12,"offset":1572},"indent":[]}},{"type":"text","value":": The command object itself that was triggered.","position":{"start":{"line":27,"column":12,"offset":1572},"end":{"line":27,"column":59,"offset":1619},"indent":[]}}],"position":{"start":{"line":27,"column":3,"offset":1563},"end":{"line":27,"column":59,"offset":1619},"indent":[]}}],"position":{"start":{"line":27,"column":1,"offset":1561},"end":{"line":27,"column":59,"offset":1619},"indent":[]}},{"type":"listItem","spread":false,"checked":null,"children":[{"type":"paragraph","children":[{"type":"inlineCode","value":"guild","position":{"start":{"line":28,"column":3,"offset":1622},"end":{"line":28,"column":10,"offset":1629},"indent":[]}},{"type":"text","value":": The server guild object where this command was ran.","position":{"start":{"line":28,"column":10,"offset":1629},"end":{"line":28,"column":63,"offset":1682},"indent":[]}}],"position":{"start":{"line":28,"column":3,"offset":1622},"end":{"line":28,"column":63,"offset":1682},"indent":[]}}],"position":{"start":{"line":28,"column":1,"offset":1620},"end":{"line":28,"column":63,"offset":1682},"indent":[]}}],"position":{"start":{"line":26,"column":1,"offset":1501},"end":{"line":28,"column":63,"offset":1682},"indent":[1,1]}},{"type":"heading","depth":2,"children":[{"type":"text","value":"Understanding How Inhibitors Function","position":{"start":{"line":30,"column":4,"offset":1687},"end":{"line":30,"column":41,"offset":1724},"indent":[]}}],"position":{"start":{"line":30,"column":1,"offset":1684},"end":{"line":30,"column":41,"offset":1724},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"To block a command you have to return a truthy value.\n\t","position":{"start":{"line":32,"column":1,"offset":1726},"end":{"line":33,"column":2,"offset":1781},"indent":[1]}},{"type":"strong","children":[{"type":"text","value":"return true;","position":{"start":{"line":33,"column":4,"offset":1783},"end":{"line":33,"column":16,"offset":1795},"indent":[]}}],"position":{"start":{"line":33,"column":2,"offset":1781},"end":{"line":33,"column":18,"offset":1797},"indent":[]}},{"type":"text","value":" If you return true the inhibitor will block the execution of the command.\nTo allow a command return a falsey value.","position":{"start":{"line":33,"column":18,"offset":1797},"end":{"line":34,"column":42,"offset":1913},"indent":[1]}}],"position":{"start":{"line":32,"column":1,"offset":1726},"end":{"line":34,"column":42,"offset":1913},"indent":[1,1]}},{"type":"list","ordered":false,"start":null,"spread":false,"children":[{"type":"listItem","spread":false,"checked":null,"children":[{"type":"paragraph","children":[{"type":"strong","children":[{"type":"text","value":"return false;","position":{"start":{"line":35,"column":5,"offset":1918},"end":{"line":35,"column":18,"offset":1931},"indent":[]}}],"position":{"start":{"line":35,"column":3,"offset":1916},"end":{"line":35,"column":20,"offset":1933},"indent":[]}},{"type":"text","value":" If you return false the inhibitor will not block the error.","position":{"start":{"line":35,"column":20,"offset":1933},"end":{"line":35,"column":80,"offset":1993},"indent":[]}}],"position":{"start":{"line":35,"column":3,"offset":1916},"end":{"line":35,"column":80,"offset":1993},"indent":[]}}],"position":{"start":{"line":35,"column":1,"offset":1914},"end":{"line":35,"column":80,"offset":1993},"indent":[]}}],"position":{"start":{"line":35,"column":1,"offset":1914},"end":{"line":35,"column":80,"offset":1993},"indent":[]}},{"type":"code","lang":"ts","meta":null,"value":"// If the command is not VIP only we can allow this command\nif (!command.vipOnly) return false;\n\n// Check if the user is VIP\nconst userIsVIP = message.author.settings.get(`isVIP`)\n// The user is VIP so we can allow this command to be used\nif (userIsVIP) return false\n// The user is NOT VIP so we throw an error\nthrow `The ${command.name} is only allowed for VIP users.`","position":{"start":{"line":38,"column":1,"offset":1996},"end":{"line":48,"column":4,"offset":2375},"indent":[1,1,1,1,1,1,1,1,1,1]}},{"type":"export","value":"export const _frontmatter = {\"title\":\"Creating Inhibitors!\",\"metaTitle\":\"Creating An Inhibitor | Discordeno\",\"metaDescription\":\"Let's create our very own bot with Discordeno!\"}","position":{"start":{"line":51,"column":1,"offset":2378},"end":{"line":51,"column":177,"offset":2554},"indent":[]}}],"position":{"start":{"line":1,"column":1,"offset":0},"end":{"line":51,"column":177,"offset":2554}}},"scopeImports":["import * as React from 'react'"],"scopeIdentifiers":["React"],"body":"function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }\n\nfunction _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }\n\nfunction _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }\n\n/* @jsx mdx */\nvar _frontmatter = {\n \"title\": \"Creating Inhibitors!\",\n \"metaTitle\": \"Creating An Inhibitor | Discordeno\",\n \"metaDescription\": \"Let's create our very own bot with Discordeno!\"\n};\nvar layoutProps = {\n _frontmatter: _frontmatter\n};\nvar MDXLayout = \"wrapper\";\nreturn function MDXContent(_ref) {\n var components = _ref.components,\n props = _objectWithoutProperties(_ref, [\"components\"]);\n\n return mdx(MDXLayout, _extends({}, layoutProps, props, {\n components: components,\n mdxType: \"MDXLayout\"\n }), mdx(\"p\", null, \"Woah! You are almost half way done with understanding all of Discordeno. Amazing isn't it? Something you may have noticed in the last section was there were some options that prevented some commands from running like \", mdx(\"inlineCode\", {\n parentName: \"p\"\n }, \"dmOnly\"), \" or the permission options. we created a setting to prevent the monitor from running in certain channels. What if we wanted to do prevent commands from happening? How would we prevent commands from running?\"), mdx(\"h2\", null, \"What is an Inhibitor?\"), mdx(\"p\", null, \"An Inhibitor is very similar to how monitors work. A monitor runs on every message but an inhibitor runs on every command. Remember all those command options like cooldown, permissions, permissionLevel, nsfw, etc... Each and every one of these options has an inhibitor in that checks commands for these settings.\"), mdx(\"p\", null, \"Let's create our own inhibitor that would prevent commands from being used if the user is not a VIP user.\"), mdx(\"blockquote\", null, mdx(\"p\", {\n parentName: \"blockquote\"\n }, mdx(\"strong\", {\n parentName: \"p\"\n }, \"Note:\"), \" It is important to remember that everything below can be done with a simple permission level as well. We will create our own custom permission levels but for the purposes of this guide and to be able to learn about Inhibitors, we will be using an inhibitor.\")), mdx(\"h2\", null, \"Creating the File\"), mdx(\"p\", null, \"Let's start by creating a file inside the inhibitors folder called \", mdx(\"inlineCode\", {\n parentName: \"p\"\n }, \"vipOnly.ts\"), \" and paste the following snippet of code:\"), mdx(\"pre\", null, mdx(\"code\", _extends({\n parentName: \"pre\"\n }, {\n \"className\": \"language-ts\"\n }), \"import { botCache } from \\\"../../mod.ts\\\";\\n\\nbotCache.inhibitors.set(\\\"inhibitorname\\\", async function (message, command, guild) {\\n // Your code goes here\\n});\\n\")), mdx(\"p\", null, \"Inhibitors can take up to 3 arguments.\"), mdx(\"ul\", null, mdx(\"li\", {\n parentName: \"ul\"\n }, mdx(\"inlineCode\", {\n parentName: \"li\"\n }, \"message\"), \": The message object that triggered the command.\"), mdx(\"li\", {\n parentName: \"ul\"\n }, mdx(\"inlineCode\", {\n parentName: \"li\"\n }, \"command\"), \": The command object itself that was triggered.\"), mdx(\"li\", {\n parentName: \"ul\"\n }, mdx(\"inlineCode\", {\n parentName: \"li\"\n }, \"guild\"), \": The server guild object where this command was ran.\")), mdx(\"h2\", null, \"Understanding How Inhibitors Function\"), mdx(\"p\", null, \"To block a command you have to return a truthy value.\\n\", mdx(\"strong\", {\n parentName: \"p\"\n }, \"return true;\"), \" If you return true the inhibitor will block the execution of the command.\\nTo allow a command return a falsey value.\"), mdx(\"ul\", null, mdx(\"li\", {\n parentName: \"ul\"\n }, mdx(\"strong\", {\n parentName: \"li\"\n }, \"return false;\"), \" If you return false the inhibitor will not block the error.\")), mdx(\"pre\", null, mdx(\"code\", _extends({\n parentName: \"pre\"\n }, {\n \"className\": \"language-ts\"\n }), \"// If the command is not VIP only we can allow this command\\nif (!command.vipOnly) return false;\\n\\n// Check if the user is VIP\\nconst userIsVIP = message.author.settings.get(`isVIP`)\\n// The user is VIP so we can allow this command to be used\\nif (userIsVIP) return false\\n// The user is NOT VIP so we throw an error\\nthrow `The ${command.name} is only allowed for VIP users.`\\n\")));\n}\n;\nMDXContent.isMDXComponent = true;","rawMDXOutput":"/* @jsx mdx */\nimport { mdx } from '@mdx-js/react';\n/* @jsx mdx */\n\nexport const _frontmatter = {\n \"title\": \"Creating Inhibitors!\",\n \"metaTitle\": \"Creating An Inhibitor | Discordeno\",\n \"metaDescription\": \"Let's create our very own bot with Discordeno!\"\n};\n\nconst layoutProps = {\n _frontmatter\n};\nconst MDXLayout = \"wrapper\"\nexport default function MDXContent({\n components,\n ...props\n}) {\n return \n

{`Woah! You are almost half way done with understanding all of Discordeno. Amazing isn't it? Something you may have noticed in the last section was there were some options that prevented some commands from running like `}{`dmOnly`}{` or the permission options. we created a setting to prevent the monitor from running in certain channels. What if we wanted to do prevent commands from happening? How would we prevent commands from running?`}

\n

{`What is an Inhibitor?`}

\n

{`An Inhibitor is very similar to how monitors work. A monitor runs on every message but an inhibitor runs on every command. Remember all those command options like cooldown, permissions, permissionLevel, nsfw, etc... Each and every one of these options has an inhibitor in that checks commands for these settings.`}

\n

{`Let's create our own inhibitor that would prevent commands from being used if the user is not a VIP user.`}

\n
\n

{`Note:`}{` It is important to remember that everything below can be done with a simple permission level as well. We will create our own custom permission levels but for the purposes of this guide and to be able to learn about Inhibitors, we will be using an inhibitor.`}

\n
\n

{`Creating the File`}

\n

{`Let's start by creating a file inside the inhibitors folder called `}{`vipOnly.ts`}{` and paste the following snippet of code:`}

\n
{`import { botCache } from \"../../mod.ts\";\n\nbotCache.inhibitors.set(\"inhibitorname\", async function (message, command, guild) {\n    // Your code goes here\n});\n`}
\n

{`Inhibitors can take up to 3 arguments.`}

\n
    \n
  • {`message`}{`: The message object that triggered the command.`}
  • \n
  • {`command`}{`: The command object itself that was triggered.`}
  • \n
  • {`guild`}{`: The server guild object where this command was ran.`}
  • \n
\n

{`Understanding How Inhibitors Function`}

\n

{`To block a command you have to return a truthy value.\n`}{`return true;`}{` If you return true the inhibitor will block the execution of the command.\nTo allow a command return a falsey value.`}

\n
    \n
  • {`return false;`}{` If you return false the inhibitor will not block the error.`}
  • \n
\n
{`// If the command is not VIP only we can allow this command\nif (!command.vipOnly) return false;\n\n// Check if the user is VIP\nconst userIsVIP = message.author.settings.get(\\`isVIP\\`)\n// The user is VIP so we can allow this command to be used\nif (userIsVIP) return false\n// The user is NOT VIP so we throw an error\nthrow \\`The \\${command.name} is only allowed for VIP users.\\`\n`}
\n\n
;\n}\n\n;\nMDXContent.isMDXComponent = true;"}} \ No newline at end of file diff --git a/docs/.cache/caches/gatsby-plugin-mdx/diskstore-9b27620307e2d376af34b3e6c30543e2.json b/docs/.cache/caches/gatsby-plugin-mdx/diskstore-9b27620307e2d376af34b3e6c30543e2.json new file mode 100644 index 000000000..817a58aa9 --- /dev/null +++ b/docs/.cache/caches/gatsby-plugin-mdx/diskstore-9b27620307e2d376af34b3e6c30543e2.json @@ -0,0 +1 @@ +{"expireTime":9007200851634907000,"key":"gatsby-plugin-mdx-entire-payload-8b1941a3eaa2f2a53c08d5c93dd3eaf1-","val":{"mdast":{"type":"root","children":[{"type":"paragraph","children":[{"type":"text","value":"Woah! You are almost half way done with understanding all of Discordeno. Amazing isn't it? Something you may have noticed in the last section was there were some options that prevented some commands from running like ","position":{"start":{"line":2,"column":1,"offset":1},"end":{"line":2,"column":218,"offset":218},"indent":[]}},{"type":"inlineCode","value":"dmOnly","position":{"start":{"line":2,"column":218,"offset":218},"end":{"line":2,"column":226,"offset":226},"indent":[]}},{"type":"text","value":" or the permission options. we created a setting to prevent the monitor from running in certain channels. What if we wanted to do prevent commands from happening? How would we prevent commands from running?","position":{"start":{"line":2,"column":226,"offset":226},"end":{"line":2,"column":432,"offset":432},"indent":[]}}],"position":{"start":{"line":2,"column":1,"offset":1},"end":{"line":2,"column":432,"offset":432},"indent":[]}},{"type":"heading","depth":2,"children":[{"type":"text","value":"What is an Inhibitor?","position":{"start":{"line":4,"column":4,"offset":437},"end":{"line":4,"column":25,"offset":458},"indent":[]}}],"position":{"start":{"line":4,"column":1,"offset":434},"end":{"line":4,"column":25,"offset":458},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"An Inhibitor is very similar to how monitors work. A monitor runs on every message but an inhibitor runs on every command. Remember all those command options like cooldown, permissions, permissionLevel, nsfw, etc... Each and every one of these options has an inhibitor in that checks commands for these settings.","position":{"start":{"line":6,"column":1,"offset":460},"end":{"line":6,"column":313,"offset":772},"indent":[]}}],"position":{"start":{"line":6,"column":1,"offset":460},"end":{"line":6,"column":313,"offset":772},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"Let's create our own inhibitor that would prevent commands from being used if the user is not a VIP user.","position":{"start":{"line":8,"column":1,"offset":774},"end":{"line":8,"column":106,"offset":879},"indent":[]}}],"position":{"start":{"line":8,"column":1,"offset":774},"end":{"line":8,"column":106,"offset":879},"indent":[]}},{"type":"blockquote","children":[{"type":"paragraph","children":[{"type":"strong","children":[{"type":"text","value":"Note:","position":{"start":{"line":10,"column":5,"offset":885},"end":{"line":10,"column":10,"offset":890},"indent":[]}}],"position":{"start":{"line":10,"column":3,"offset":883},"end":{"line":10,"column":12,"offset":892},"indent":[]}},{"type":"text","value":" It is important to remember that everything below can be done with a simple permission level as well. We will create our own custom permission levels but for the purposes of this guide and to be able to learn about Inhibitors, we will be using an inhibitor.","position":{"start":{"line":10,"column":12,"offset":892},"end":{"line":10,"column":270,"offset":1150},"indent":[]}}],"position":{"start":{"line":10,"column":3,"offset":883},"end":{"line":10,"column":270,"offset":1150},"indent":[]}}],"position":{"start":{"line":10,"column":1,"offset":881},"end":{"line":10,"column":270,"offset":1150},"indent":[]}},{"type":"heading","depth":2,"children":[{"type":"text","value":"Creating the File","position":{"start":{"line":12,"column":4,"offset":1155},"end":{"line":12,"column":21,"offset":1172},"indent":[]}}],"position":{"start":{"line":12,"column":1,"offset":1152},"end":{"line":12,"column":21,"offset":1172},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"Let's start by creating a file inside the inhibitors folder called ","position":{"start":{"line":14,"column":1,"offset":1174},"end":{"line":14,"column":68,"offset":1241},"indent":[]}},{"type":"inlineCode","value":"boosted.ts","position":{"start":{"line":14,"column":68,"offset":1241},"end":{"line":14,"column":80,"offset":1253},"indent":[]}},{"type":"text","value":" and paste the following snippet of code:","position":{"start":{"line":14,"column":80,"offset":1253},"end":{"line":14,"column":121,"offset":1294},"indent":[]}}],"position":{"start":{"line":14,"column":1,"offset":1174},"end":{"line":14,"column":121,"offset":1294},"indent":[]}},{"type":"code","lang":"ts","meta":null,"value":"import { botCache } from \"../../mod.ts\";\n\nbotCache.inhibitors.set(\"inhibitorname\", async function (message, command, guild) {\n\t// Your code goes here\n});","position":{"start":{"line":16,"column":1,"offset":1296},"end":{"line":22,"column":4,"offset":1459},"indent":[1,1,1,1,1,1]}},{"type":"paragraph","children":[{"type":"text","value":"Inhibitors can take up to 3 arguments.","position":{"start":{"line":24,"column":1,"offset":1461},"end":{"line":24,"column":39,"offset":1499},"indent":[]}}],"position":{"start":{"line":24,"column":1,"offset":1461},"end":{"line":24,"column":39,"offset":1499},"indent":[]}},{"type":"list","ordered":false,"start":null,"spread":false,"children":[{"type":"listItem","spread":false,"checked":null,"children":[{"type":"paragraph","children":[{"type":"inlineCode","value":"message","position":{"start":{"line":26,"column":3,"offset":1503},"end":{"line":26,"column":12,"offset":1512},"indent":[]}},{"type":"text","value":": The message object that triggered the command.","position":{"start":{"line":26,"column":12,"offset":1512},"end":{"line":26,"column":60,"offset":1560},"indent":[]}}],"position":{"start":{"line":26,"column":3,"offset":1503},"end":{"line":26,"column":60,"offset":1560},"indent":[]}}],"position":{"start":{"line":26,"column":1,"offset":1501},"end":{"line":26,"column":60,"offset":1560},"indent":[]}},{"type":"listItem","spread":false,"checked":null,"children":[{"type":"paragraph","children":[{"type":"inlineCode","value":"command","position":{"start":{"line":27,"column":3,"offset":1563},"end":{"line":27,"column":12,"offset":1572},"indent":[]}},{"type":"text","value":": The command object itself that was triggered.","position":{"start":{"line":27,"column":12,"offset":1572},"end":{"line":27,"column":59,"offset":1619},"indent":[]}}],"position":{"start":{"line":27,"column":3,"offset":1563},"end":{"line":27,"column":59,"offset":1619},"indent":[]}}],"position":{"start":{"line":27,"column":1,"offset":1561},"end":{"line":27,"column":59,"offset":1619},"indent":[]}},{"type":"listItem","spread":false,"checked":null,"children":[{"type":"paragraph","children":[{"type":"inlineCode","value":"guild","position":{"start":{"line":28,"column":3,"offset":1622},"end":{"line":28,"column":10,"offset":1629},"indent":[]}},{"type":"text","value":": The server guild object where this command was ran.","position":{"start":{"line":28,"column":10,"offset":1629},"end":{"line":28,"column":63,"offset":1682},"indent":[]}}],"position":{"start":{"line":28,"column":3,"offset":1622},"end":{"line":28,"column":63,"offset":1682},"indent":[]}}],"position":{"start":{"line":28,"column":1,"offset":1620},"end":{"line":28,"column":63,"offset":1682},"indent":[]}}],"position":{"start":{"line":26,"column":1,"offset":1501},"end":{"line":28,"column":63,"offset":1682},"indent":[1,1]}},{"type":"heading","depth":2,"children":[{"type":"text","value":"Understanding How Inhibitors Function","position":{"start":{"line":30,"column":4,"offset":1687},"end":{"line":30,"column":41,"offset":1724},"indent":[]}}],"position":{"start":{"line":30,"column":1,"offset":1684},"end":{"line":30,"column":41,"offset":1724},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"To block a command you have to return a truthy value.","position":{"start":{"line":32,"column":1,"offset":1726},"end":{"line":32,"column":54,"offset":1779},"indent":[]}}],"position":{"start":{"line":32,"column":1,"offset":1726},"end":{"line":32,"column":54,"offset":1779},"indent":[]}},{"type":"list","ordered":false,"start":null,"spread":false,"children":[{"type":"listItem","spread":false,"checked":null,"children":[{"type":"paragraph","children":[{"type":"strong","children":[{"type":"text","value":"return true;","position":{"start":{"line":33,"column":5,"offset":1784},"end":{"line":33,"column":17,"offset":1796},"indent":[]}}],"position":{"start":{"line":33,"column":3,"offset":1782},"end":{"line":33,"column":19,"offset":1798},"indent":[]}},{"type":"text","value":" If you return true the inhibitor will block the execution of the command.\nTo allow a command return a falsey value.","position":{"start":{"line":33,"column":19,"offset":1798},"end":{"line":34,"column":42,"offset":1914},"indent":[1]}}],"position":{"start":{"line":33,"column":3,"offset":1782},"end":{"line":34,"column":42,"offset":1914},"indent":[1]}}],"position":{"start":{"line":33,"column":1,"offset":1780},"end":{"line":34,"column":42,"offset":1914},"indent":[1]}},{"type":"listItem","spread":false,"checked":null,"children":[{"type":"paragraph","children":[{"type":"strong","children":[{"type":"text","value":"return false;","position":{"start":{"line":35,"column":5,"offset":1919},"end":{"line":35,"column":18,"offset":1932},"indent":[]}}],"position":{"start":{"line":35,"column":3,"offset":1917},"end":{"line":35,"column":20,"offset":1934},"indent":[]}},{"type":"text","value":" If you return false the inhibitor will not block the error.","position":{"start":{"line":35,"column":20,"offset":1934},"end":{"line":35,"column":80,"offset":1994},"indent":[]}}],"position":{"start":{"line":35,"column":3,"offset":1917},"end":{"line":35,"column":80,"offset":1994},"indent":[]}}],"position":{"start":{"line":35,"column":1,"offset":1915},"end":{"line":35,"column":80,"offset":1994},"indent":[]}}],"position":{"start":{"line":33,"column":1,"offset":1780},"end":{"line":35,"column":80,"offset":1994},"indent":[1,1]}},{"type":"code","lang":"ts","meta":null,"value":"// If the command is not VIP only we can allow this command to execute\nif (!command.vipOnly) return false;\n\n// The bot's support server\nconst guild = cache.guilds.get(configs.supportServerID);\n// If the command author is not in the server they won't have the vip role\nconst member = guild.members.get(message.author.id) || await getMember(guild.id, message.author.id);\n// Member doesn't exist so cancel the command\nif (!member) {\n\tsendResponse(message, `sorry, but you can not use this command until you become VIP. **Close the IRIS!!!**`)\n\treturn true;\n}\n\n// If the user has the vip role on the support server given by patreon allow the command\nif (member.roles.includes(configs.roleIDs.patreonVIPRoleID)) return false;\n\n// Alert the user they don't have vip and can't use the command\nsendResponse(message, `sorry, but you can not use this command until you become a VIP. I'm sorry, Teal'c. We'll go to Disneyland next year. I promise.`)\n// Cancel the command since the user does not have vip\nreturn true;","position":{"start":{"line":38,"column":1,"offset":1997},"end":{"line":59,"column":4,"offset":3013},"indent":[1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1]}},{"type":"heading","depth":2,"children":[{"type":"text","value":"Updating Command Typings","position":{"start":{"line":61,"column":4,"offset":3018},"end":{"line":61,"column":28,"offset":3042},"indent":[]}}],"position":{"start":{"line":61,"column":1,"offset":3015},"end":{"line":61,"column":28,"offset":3042},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"Since we need a new option on our commands we need to add that. Open the ","position":{"start":{"line":63,"column":1,"offset":3044},"end":{"line":63,"column":74,"offset":3117},"indent":[]}},{"type":"inlineCode","value":"src/types/commands.ts","position":{"start":{"line":63,"column":74,"offset":3117},"end":{"line":63,"column":97,"offset":3140},"indent":[]}},{"type":"text","value":" file and ","position":{"start":{"line":63,"column":97,"offset":3140},"end":{"line":63,"column":107,"offset":3150},"indent":[]}}],"position":{"start":{"line":63,"column":1,"offset":3044},"end":{"line":63,"column":107,"offset":3150},"indent":[]}},{"type":"heading","depth":2,"children":[{"type":"text","value":"Challenges","position":{"start":{"line":65,"column":4,"offset":3155},"end":{"line":65,"column":14,"offset":3165},"indent":[]}}],"position":{"start":{"line":65,"column":1,"offset":3152},"end":{"line":65,"column":14,"offset":3165},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"Hell yes! We just got through the entire inhibitor section. You have now mastered everything related to inhibitors.","position":{"start":{"line":67,"column":1,"offset":3167},"end":{"line":67,"column":116,"offset":3282},"indent":[]}}],"position":{"start":{"line":67,"column":1,"offset":3167},"end":{"line":67,"column":116,"offset":3282},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"You can now try and get a little more practice with inhibitors by trying to challenge yourself and make your own inhibitors. Don't worry if you can't think of any good use cases for inhibitors.","position":{"start":{"line":69,"column":1,"offset":3284},"end":{"line":69,"column":194,"offset":3477},"indent":[]}}],"position":{"start":{"line":69,"column":1,"offset":3284},"end":{"line":69,"column":194,"offset":3477},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"Majority of Discordeno bots do not use many custom inhibitors because most of the necessary/important ones already come built for you in the inhibitors folder.","position":{"start":{"line":71,"column":1,"offset":3479},"end":{"line":71,"column":160,"offset":3638},"indent":[]}}],"position":{"start":{"line":71,"column":1,"offset":3479},"end":{"line":71,"column":160,"offset":3638},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"Next we will try our hands at creating a monitor.","position":{"start":{"line":73,"column":1,"offset":3640},"end":{"line":73,"column":50,"offset":3689},"indent":[]}}],"position":{"start":{"line":73,"column":1,"offset":3640},"end":{"line":73,"column":50,"offset":3689},"indent":[]}},{"type":"export","value":"export const _frontmatter = {\"title\":\"Creating Inhibitors!\",\"metaTitle\":\"Creating An Inhibitor | Discordeno\",\"metaDescription\":\"Let's create our very own bot with Discordeno!\"}","position":{"start":{"line":76,"column":1,"offset":3692},"end":{"line":76,"column":177,"offset":3868},"indent":[]}}],"position":{"start":{"line":1,"column":1,"offset":0},"end":{"line":76,"column":177,"offset":3868}}},"scopeImports":["import * as React from 'react'"],"scopeIdentifiers":["React"],"body":"function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }\n\nfunction _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }\n\nfunction _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }\n\n/* @jsx mdx */\nvar _frontmatter = {\n \"title\": \"Creating Inhibitors!\",\n \"metaTitle\": \"Creating An Inhibitor | Discordeno\",\n \"metaDescription\": \"Let's create our very own bot with Discordeno!\"\n};\nvar layoutProps = {\n _frontmatter: _frontmatter\n};\nvar MDXLayout = \"wrapper\";\nreturn function MDXContent(_ref) {\n var components = _ref.components,\n props = _objectWithoutProperties(_ref, [\"components\"]);\n\n return mdx(MDXLayout, _extends({}, layoutProps, props, {\n components: components,\n mdxType: \"MDXLayout\"\n }), mdx(\"p\", null, \"Woah! You are almost half way done with understanding all of Discordeno. Amazing isn't it? Something you may have noticed in the last section was there were some options that prevented some commands from running like \", mdx(\"inlineCode\", {\n parentName: \"p\"\n }, \"dmOnly\"), \" or the permission options. we created a setting to prevent the monitor from running in certain channels. What if we wanted to do prevent commands from happening? How would we prevent commands from running?\"), mdx(\"h2\", null, \"What is an Inhibitor?\"), mdx(\"p\", null, \"An Inhibitor is very similar to how monitors work. A monitor runs on every message but an inhibitor runs on every command. Remember all those command options like cooldown, permissions, permissionLevel, nsfw, etc... Each and every one of these options has an inhibitor in that checks commands for these settings.\"), mdx(\"p\", null, \"Let's create our own inhibitor that would prevent commands from being used if the user is not a VIP user.\"), mdx(\"blockquote\", null, mdx(\"p\", {\n parentName: \"blockquote\"\n }, mdx(\"strong\", {\n parentName: \"p\"\n }, \"Note:\"), \" It is important to remember that everything below can be done with a simple permission level as well. We will create our own custom permission levels but for the purposes of this guide and to be able to learn about Inhibitors, we will be using an inhibitor.\")), mdx(\"h2\", null, \"Creating the File\"), mdx(\"p\", null, \"Let's start by creating a file inside the inhibitors folder called \", mdx(\"inlineCode\", {\n parentName: \"p\"\n }, \"boosted.ts\"), \" and paste the following snippet of code:\"), mdx(\"pre\", null, mdx(\"code\", _extends({\n parentName: \"pre\"\n }, {\n \"className\": \"language-ts\"\n }), \"import { botCache } from \\\"../../mod.ts\\\";\\n\\nbotCache.inhibitors.set(\\\"inhibitorname\\\", async function (message, command, guild) {\\n // Your code goes here\\n});\\n\")), mdx(\"p\", null, \"Inhibitors can take up to 3 arguments.\"), mdx(\"ul\", null, mdx(\"li\", {\n parentName: \"ul\"\n }, mdx(\"inlineCode\", {\n parentName: \"li\"\n }, \"message\"), \": The message object that triggered the command.\"), mdx(\"li\", {\n parentName: \"ul\"\n }, mdx(\"inlineCode\", {\n parentName: \"li\"\n }, \"command\"), \": The command object itself that was triggered.\"), mdx(\"li\", {\n parentName: \"ul\"\n }, mdx(\"inlineCode\", {\n parentName: \"li\"\n }, \"guild\"), \": The server guild object where this command was ran.\")), mdx(\"h2\", null, \"Understanding How Inhibitors Function\"), mdx(\"p\", null, \"To block a command you have to return a truthy value.\"), mdx(\"ul\", null, mdx(\"li\", {\n parentName: \"ul\"\n }, mdx(\"strong\", {\n parentName: \"li\"\n }, \"return true;\"), \" If you return true the inhibitor will block the execution of the command.\\nTo allow a command return a falsey value.\"), mdx(\"li\", {\n parentName: \"ul\"\n }, mdx(\"strong\", {\n parentName: \"li\"\n }, \"return false;\"), \" If you return false the inhibitor will not block the error.\")), mdx(\"pre\", null, mdx(\"code\", _extends({\n parentName: \"pre\"\n }, {\n \"className\": \"language-ts\"\n }), \"// If the command is not VIP only we can allow this command to execute\\nif (!command.vipOnly) return false;\\n\\n// The bot's support server\\nconst guild = cache.guilds.get(configs.supportServerID);\\n// If the command author is not in the server they won't have the vip role\\nconst member = guild.members.get(message.author.id) || await getMember(guild.id, message.author.id);\\n// Member doesn't exist so cancel the command\\nif (!member) {\\n sendResponse(message, `sorry, but you can not use this command until you become VIP. **Close the IRIS!!!**`)\\n return true;\\n}\\n\\n// If the user has the vip role on the support server given by patreon allow the command\\nif (member.roles.includes(configs.roleIDs.patreonVIPRoleID)) return false;\\n\\n// Alert the user they don't have vip and can't use the command\\nsendResponse(message, `sorry, but you can not use this command until you become a VIP. I'm sorry, Teal'c. We'll go to Disneyland next year. I promise.`)\\n// Cancel the command since the user does not have vip\\nreturn true;\\n\")), mdx(\"h2\", null, \"Updating Command Typings\"), mdx(\"p\", null, \"Since we need a new option on our commands we need to add that. Open the \", mdx(\"inlineCode\", {\n parentName: \"p\"\n }, \"src/types/commands.ts\"), \" file and \"), mdx(\"h2\", null, \"Challenges\"), mdx(\"p\", null, \"Hell yes! We just got through the entire inhibitor section. You have now mastered everything related to inhibitors.\"), mdx(\"p\", null, \"You can now try and get a little more practice with inhibitors by trying to challenge yourself and make your own inhibitors. Don't worry if you can't think of any good use cases for inhibitors.\"), mdx(\"p\", null, \"Majority of Discordeno bots do not use many custom inhibitors because most of the necessary/important ones already come built for you in the inhibitors folder.\"), mdx(\"p\", null, \"Next we will try our hands at creating a monitor.\"));\n}\n;\nMDXContent.isMDXComponent = true;","rawMDXOutput":"/* @jsx mdx */\nimport { mdx } from '@mdx-js/react';\n/* @jsx mdx */\n\nexport const _frontmatter = {\n \"title\": \"Creating Inhibitors!\",\n \"metaTitle\": \"Creating An Inhibitor | Discordeno\",\n \"metaDescription\": \"Let's create our very own bot with Discordeno!\"\n};\n\nconst layoutProps = {\n _frontmatter\n};\nconst MDXLayout = \"wrapper\"\nexport default function MDXContent({\n components,\n ...props\n}) {\n return \n

{`Woah! You are almost half way done with understanding all of Discordeno. Amazing isn't it? Something you may have noticed in the last section was there were some options that prevented some commands from running like `}{`dmOnly`}{` or the permission options. we created a setting to prevent the monitor from running in certain channels. What if we wanted to do prevent commands from happening? How would we prevent commands from running?`}

\n

{`What is an Inhibitor?`}

\n

{`An Inhibitor is very similar to how monitors work. A monitor runs on every message but an inhibitor runs on every command. Remember all those command options like cooldown, permissions, permissionLevel, nsfw, etc... Each and every one of these options has an inhibitor in that checks commands for these settings.`}

\n

{`Let's create our own inhibitor that would prevent commands from being used if the user is not a VIP user.`}

\n
\n

{`Note:`}{` It is important to remember that everything below can be done with a simple permission level as well. We will create our own custom permission levels but for the purposes of this guide and to be able to learn about Inhibitors, we will be using an inhibitor.`}

\n
\n

{`Creating the File`}

\n

{`Let's start by creating a file inside the inhibitors folder called `}{`boosted.ts`}{` and paste the following snippet of code:`}

\n
{`import { botCache } from \"../../mod.ts\";\n\nbotCache.inhibitors.set(\"inhibitorname\", async function (message, command, guild) {\n    // Your code goes here\n});\n`}
\n

{`Inhibitors can take up to 3 arguments.`}

\n
    \n
  • {`message`}{`: The message object that triggered the command.`}
  • \n
  • {`command`}{`: The command object itself that was triggered.`}
  • \n
  • {`guild`}{`: The server guild object where this command was ran.`}
  • \n
\n

{`Understanding How Inhibitors Function`}

\n

{`To block a command you have to return a truthy value.`}

\n
    \n
  • {`return true;`}{` If you return true the inhibitor will block the execution of the command.\nTo allow a command return a falsey value.`}
  • \n
  • {`return false;`}{` If you return false the inhibitor will not block the error.`}
  • \n
\n
{`// If the command is not VIP only we can allow this command to execute\nif (!command.vipOnly) return false;\n\n// The bot's support server\nconst guild = cache.guilds.get(configs.supportServerID);\n// If the command author is not in the server they won't have the vip role\nconst member = guild.members.get(message.author.id) || await getMember(guild.id, message.author.id);\n// Member doesn't exist so cancel the command\nif (!member) {\n    sendResponse(message, \\`sorry, but you can not use this command until you become VIP. **Close the IRIS!!!**\\`)\n    return true;\n}\n\n// If the user has the vip role on the support server given by patreon allow the command\nif (member.roles.includes(configs.roleIDs.patreonVIPRoleID)) return false;\n\n// Alert the user they don't have vip and can't use the command\nsendResponse(message, \\`sorry, but you can not use this command until you become a VIP. I'm sorry, Teal'c. We'll go to Disneyland next year. I promise.\\`)\n// Cancel the command since the user does not have vip\nreturn true;\n`}
\n

{`Updating Command Typings`}

\n

{`Since we need a new option on our commands we need to add that. Open the `}{`src/types/commands.ts`}{` file and `}

\n

{`Challenges`}

\n

{`Hell yes! We just got through the entire inhibitor section. You have now mastered everything related to inhibitors.`}

\n

{`You can now try and get a little more practice with inhibitors by trying to challenge yourself and make your own inhibitors. Don't worry if you can't think of any good use cases for inhibitors.`}

\n

{`Majority of Discordeno bots do not use many custom inhibitors because most of the necessary/important ones already come built for you in the inhibitors folder.`}

\n

{`Next we will try our hands at creating a monitor.`}

\n\n
;\n}\n\n;\nMDXContent.isMDXComponent = true;"}} \ No newline at end of file diff --git a/docs/.cache/caches/gatsby-plugin-mdx/diskstore-9c35db43ebe234368f04bea3419c0e82.json b/docs/.cache/caches/gatsby-plugin-mdx/diskstore-9c35db43ebe234368f04bea3419c0e82.json new file mode 100644 index 000000000..5009b880b --- /dev/null +++ b/docs/.cache/caches/gatsby-plugin-mdx/diskstore-9c35db43ebe234368f04bea3419c0e82.json @@ -0,0 +1 @@ +{"expireTime":9007200851633766000,"key":"gatsby-plugin-mdx-entire-payload-db1ce229f13404e704f1647662414602-","val":{"mdast":{"type":"root","children":[{"type":"paragraph","children":[{"type":"text","value":"Woah! You are almost half way done with understanding all of Discordeno. Amazing isn't it? Something you may have noticed in the last section was there were some options that prevented some commands from running like ","position":{"start":{"line":2,"column":1,"offset":1},"end":{"line":2,"column":218,"offset":218},"indent":[]}},{"type":"inlineCode","value":"dmOnly","position":{"start":{"line":2,"column":218,"offset":218},"end":{"line":2,"column":226,"offset":226},"indent":[]}},{"type":"text","value":" or the permission options. we created a setting to prevent the monitor from running in certain channels. What if we wanted to do prevent commands from happening? How would we prevent commands from running?","position":{"start":{"line":2,"column":226,"offset":226},"end":{"line":2,"column":432,"offset":432},"indent":[]}}],"position":{"start":{"line":2,"column":1,"offset":1},"end":{"line":2,"column":432,"offset":432},"indent":[]}},{"type":"heading","depth":2,"children":[{"type":"text","value":"What is an Inhibitor?","position":{"start":{"line":4,"column":4,"offset":437},"end":{"line":4,"column":25,"offset":458},"indent":[]}}],"position":{"start":{"line":4,"column":1,"offset":434},"end":{"line":4,"column":25,"offset":458},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"An Inhibitor is very similar to how monitors work. A monitor runs on every message but an inhibitor runs on every command. Remember all those command options like cooldown, permissions, permissionLevel, nsfw, etc... Each and every one of these options has an inhibitor in that checks commands for these settings.","position":{"start":{"line":6,"column":1,"offset":460},"end":{"line":6,"column":313,"offset":772},"indent":[]}}],"position":{"start":{"line":6,"column":1,"offset":460},"end":{"line":6,"column":313,"offset":772},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"Let's create our own inhibitor that would prevent commands from being used if the user is not a VIP user.","position":{"start":{"line":8,"column":1,"offset":774},"end":{"line":8,"column":106,"offset":879},"indent":[]}}],"position":{"start":{"line":8,"column":1,"offset":774},"end":{"line":8,"column":106,"offset":879},"indent":[]}},{"type":"blockquote","children":[{"type":"paragraph","children":[{"type":"strong","children":[{"type":"text","value":"Note:","position":{"start":{"line":10,"column":5,"offset":885},"end":{"line":10,"column":10,"offset":890},"indent":[]}}],"position":{"start":{"line":10,"column":3,"offset":883},"end":{"line":10,"column":12,"offset":892},"indent":[]}},{"type":"text","value":" It is important to remember that everything below can be done with a simple permission level as well. We will create our own custom permission levels but for the purposes of this guide and to be able to learn about Inhibitors, we will be using an inhibitor.","position":{"start":{"line":10,"column":12,"offset":892},"end":{"line":10,"column":270,"offset":1150},"indent":[]}}],"position":{"start":{"line":10,"column":3,"offset":883},"end":{"line":10,"column":270,"offset":1150},"indent":[]}}],"position":{"start":{"line":10,"column":1,"offset":881},"end":{"line":10,"column":270,"offset":1150},"indent":[]}},{"type":"heading","depth":2,"children":[{"type":"text","value":"Creating the File","position":{"start":{"line":12,"column":4,"offset":1155},"end":{"line":12,"column":21,"offset":1172},"indent":[]}}],"position":{"start":{"line":12,"column":1,"offset":1152},"end":{"line":12,"column":21,"offset":1172},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"Let's start by creating a file inside the inhibitors folder called ","position":{"start":{"line":14,"column":1,"offset":1174},"end":{"line":14,"column":68,"offset":1241},"indent":[]}},{"type":"inlineCode","value":"vipOnly.ts","position":{"start":{"line":14,"column":68,"offset":1241},"end":{"line":14,"column":80,"offset":1253},"indent":[]}},{"type":"text","value":" and paste the following snippet of code:","position":{"start":{"line":14,"column":80,"offset":1253},"end":{"line":14,"column":121,"offset":1294},"indent":[]}}],"position":{"start":{"line":14,"column":1,"offset":1174},"end":{"line":14,"column":121,"offset":1294},"indent":[]}},{"type":"code","lang":"ts","meta":null,"value":"import { botCache } from \"../../mod.ts\";\n\nbotCache.inhibitors.set(\"inhibitorname\", async function (message, command, guild) {\n\t// Your code goes here\n});","position":{"start":{"line":16,"column":1,"offset":1296},"end":{"line":22,"column":4,"offset":1459},"indent":[1,1,1,1,1,1]}},{"type":"paragraph","children":[{"type":"text","value":"Inhibitors can take up to 3 arguments.","position":{"start":{"line":24,"column":1,"offset":1461},"end":{"line":24,"column":39,"offset":1499},"indent":[]}}],"position":{"start":{"line":24,"column":1,"offset":1461},"end":{"line":24,"column":39,"offset":1499},"indent":[]}},{"type":"list","ordered":false,"start":null,"spread":false,"children":[{"type":"listItem","spread":false,"checked":null,"children":[{"type":"paragraph","children":[{"type":"inlineCode","value":"message","position":{"start":{"line":26,"column":3,"offset":1503},"end":{"line":26,"column":12,"offset":1512},"indent":[]}},{"type":"text","value":": The message object that triggered the command.","position":{"start":{"line":26,"column":12,"offset":1512},"end":{"line":26,"column":60,"offset":1560},"indent":[]}}],"position":{"start":{"line":26,"column":3,"offset":1503},"end":{"line":26,"column":60,"offset":1560},"indent":[]}}],"position":{"start":{"line":26,"column":1,"offset":1501},"end":{"line":26,"column":60,"offset":1560},"indent":[]}},{"type":"listItem","spread":false,"checked":null,"children":[{"type":"paragraph","children":[{"type":"inlineCode","value":"command","position":{"start":{"line":27,"column":3,"offset":1563},"end":{"line":27,"column":12,"offset":1572},"indent":[]}},{"type":"text","value":": The command object itself that was triggered.","position":{"start":{"line":27,"column":12,"offset":1572},"end":{"line":27,"column":59,"offset":1619},"indent":[]}}],"position":{"start":{"line":27,"column":3,"offset":1563},"end":{"line":27,"column":59,"offset":1619},"indent":[]}}],"position":{"start":{"line":27,"column":1,"offset":1561},"end":{"line":27,"column":59,"offset":1619},"indent":[]}},{"type":"listItem","spread":false,"checked":null,"children":[{"type":"paragraph","children":[{"type":"inlineCode","value":"guild","position":{"start":{"line":28,"column":3,"offset":1622},"end":{"line":28,"column":10,"offset":1629},"indent":[]}},{"type":"text","value":": The server guild object where this command was ran.","position":{"start":{"line":28,"column":10,"offset":1629},"end":{"line":28,"column":63,"offset":1682},"indent":[]}}],"position":{"start":{"line":28,"column":3,"offset":1622},"end":{"line":28,"column":63,"offset":1682},"indent":[]}}],"position":{"start":{"line":28,"column":1,"offset":1620},"end":{"line":28,"column":63,"offset":1682},"indent":[]}}],"position":{"start":{"line":26,"column":1,"offset":1501},"end":{"line":28,"column":63,"offset":1682},"indent":[1,1]}},{"type":"heading","depth":2,"children":[{"type":"text","value":"Understanding How Inhibitors Function","position":{"start":{"line":30,"column":4,"offset":1687},"end":{"line":30,"column":41,"offset":1724},"indent":[]}}],"position":{"start":{"line":30,"column":1,"offset":1684},"end":{"line":30,"column":41,"offset":1724},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"To block a command you have to return a truthy value.","position":{"start":{"line":32,"column":1,"offset":1726},"end":{"line":32,"column":54,"offset":1779},"indent":[]}}],"position":{"start":{"line":32,"column":1,"offset":1726},"end":{"line":32,"column":54,"offset":1779},"indent":[]}},{"type":"list","ordered":false,"start":null,"spread":false,"children":[{"type":"listItem","spread":false,"checked":null,"children":[{"type":"paragraph","children":[{"type":"strong","children":[{"type":"text","value":"return true;","position":{"start":{"line":33,"column":5,"offset":1784},"end":{"line":33,"column":17,"offset":1796},"indent":[]}}],"position":{"start":{"line":33,"column":3,"offset":1782},"end":{"line":33,"column":19,"offset":1798},"indent":[]}},{"type":"text","value":" If you return true the inhibitor will block the execution of the command.\nTo allow a command return a falsey value.","position":{"start":{"line":33,"column":19,"offset":1798},"end":{"line":34,"column":42,"offset":1914},"indent":[1]}}],"position":{"start":{"line":33,"column":3,"offset":1782},"end":{"line":34,"column":42,"offset":1914},"indent":[1]}}],"position":{"start":{"line":33,"column":1,"offset":1780},"end":{"line":34,"column":42,"offset":1914},"indent":[1]}},{"type":"listItem","spread":false,"checked":null,"children":[{"type":"paragraph","children":[{"type":"strong","children":[{"type":"text","value":"return false;","position":{"start":{"line":35,"column":5,"offset":1919},"end":{"line":35,"column":18,"offset":1932},"indent":[]}}],"position":{"start":{"line":35,"column":3,"offset":1917},"end":{"line":35,"column":20,"offset":1934},"indent":[]}},{"type":"text","value":" If you return false the inhibitor will not block the error.","position":{"start":{"line":35,"column":20,"offset":1934},"end":{"line":35,"column":80,"offset":1994},"indent":[]}}],"position":{"start":{"line":35,"column":3,"offset":1917},"end":{"line":35,"column":80,"offset":1994},"indent":[]}}],"position":{"start":{"line":35,"column":1,"offset":1915},"end":{"line":35,"column":80,"offset":1994},"indent":[]}}],"position":{"start":{"line":33,"column":1,"offset":1780},"end":{"line":35,"column":80,"offset":1994},"indent":[1,1]}},{"type":"code","lang":"ts","meta":null,"value":"// If the command is not VIP only we can allow this command to execute\nif (!command.vipOnly) return false;\n\n// Check if the user is VIP\n// `isUserVIP\nconst userIsVIP = await isUserVIP(message.author.id)\n// The user is VIP so we can allow this command to be used\nif (userIsVIP) return false;\n\n// The user is NOT VIP so we throw an error\nthrow `The ${command.name} is only allowed for VIP users.`","position":{"start":{"line":38,"column":1,"offset":1997},"end":{"line":50,"column":4,"offset":2401},"indent":[1,1,1,1,1,1,1,1,1,1,1,1]}},{"type":"export","value":"export const _frontmatter = {\"title\":\"Creating Inhibitors!\",\"metaTitle\":\"Creating An Inhibitor | Discordeno\",\"metaDescription\":\"Let's create our very own bot with Discordeno!\"}","position":{"start":{"line":53,"column":1,"offset":2404},"end":{"line":53,"column":177,"offset":2580},"indent":[]}}],"position":{"start":{"line":1,"column":1,"offset":0},"end":{"line":53,"column":177,"offset":2580}}},"scopeImports":["import * as React from 'react'"],"scopeIdentifiers":["React"],"body":"function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }\n\nfunction _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }\n\nfunction _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }\n\n/* @jsx mdx */\nvar _frontmatter = {\n \"title\": \"Creating Inhibitors!\",\n \"metaTitle\": \"Creating An Inhibitor | Discordeno\",\n \"metaDescription\": \"Let's create our very own bot with Discordeno!\"\n};\nvar layoutProps = {\n _frontmatter: _frontmatter\n};\nvar MDXLayout = \"wrapper\";\nreturn function MDXContent(_ref) {\n var components = _ref.components,\n props = _objectWithoutProperties(_ref, [\"components\"]);\n\n return mdx(MDXLayout, _extends({}, layoutProps, props, {\n components: components,\n mdxType: \"MDXLayout\"\n }), mdx(\"p\", null, \"Woah! You are almost half way done with understanding all of Discordeno. Amazing isn't it? Something you may have noticed in the last section was there were some options that prevented some commands from running like \", mdx(\"inlineCode\", {\n parentName: \"p\"\n }, \"dmOnly\"), \" or the permission options. we created a setting to prevent the monitor from running in certain channels. What if we wanted to do prevent commands from happening? How would we prevent commands from running?\"), mdx(\"h2\", null, \"What is an Inhibitor?\"), mdx(\"p\", null, \"An Inhibitor is very similar to how monitors work. A monitor runs on every message but an inhibitor runs on every command. Remember all those command options like cooldown, permissions, permissionLevel, nsfw, etc... Each and every one of these options has an inhibitor in that checks commands for these settings.\"), mdx(\"p\", null, \"Let's create our own inhibitor that would prevent commands from being used if the user is not a VIP user.\"), mdx(\"blockquote\", null, mdx(\"p\", {\n parentName: \"blockquote\"\n }, mdx(\"strong\", {\n parentName: \"p\"\n }, \"Note:\"), \" It is important to remember that everything below can be done with a simple permission level as well. We will create our own custom permission levels but for the purposes of this guide and to be able to learn about Inhibitors, we will be using an inhibitor.\")), mdx(\"h2\", null, \"Creating the File\"), mdx(\"p\", null, \"Let's start by creating a file inside the inhibitors folder called \", mdx(\"inlineCode\", {\n parentName: \"p\"\n }, \"vipOnly.ts\"), \" and paste the following snippet of code:\"), mdx(\"pre\", null, mdx(\"code\", _extends({\n parentName: \"pre\"\n }, {\n \"className\": \"language-ts\"\n }), \"import { botCache } from \\\"../../mod.ts\\\";\\n\\nbotCache.inhibitors.set(\\\"inhibitorname\\\", async function (message, command, guild) {\\n // Your code goes here\\n});\\n\")), mdx(\"p\", null, \"Inhibitors can take up to 3 arguments.\"), mdx(\"ul\", null, mdx(\"li\", {\n parentName: \"ul\"\n }, mdx(\"inlineCode\", {\n parentName: \"li\"\n }, \"message\"), \": The message object that triggered the command.\"), mdx(\"li\", {\n parentName: \"ul\"\n }, mdx(\"inlineCode\", {\n parentName: \"li\"\n }, \"command\"), \": The command object itself that was triggered.\"), mdx(\"li\", {\n parentName: \"ul\"\n }, mdx(\"inlineCode\", {\n parentName: \"li\"\n }, \"guild\"), \": The server guild object where this command was ran.\")), mdx(\"h2\", null, \"Understanding How Inhibitors Function\"), mdx(\"p\", null, \"To block a command you have to return a truthy value.\"), mdx(\"ul\", null, mdx(\"li\", {\n parentName: \"ul\"\n }, mdx(\"strong\", {\n parentName: \"li\"\n }, \"return true;\"), \" If you return true the inhibitor will block the execution of the command.\\nTo allow a command return a falsey value.\"), mdx(\"li\", {\n parentName: \"ul\"\n }, mdx(\"strong\", {\n parentName: \"li\"\n }, \"return false;\"), \" If you return false the inhibitor will not block the error.\")), mdx(\"pre\", null, mdx(\"code\", _extends({\n parentName: \"pre\"\n }, {\n \"className\": \"language-ts\"\n }), \"// If the command is not VIP only we can allow this command to execute\\nif (!command.vipOnly) return false;\\n\\n// Check if the user is VIP\\n// `isUserVIP\\nconst userIsVIP = await isUserVIP(message.author.id)\\n// The user is VIP so we can allow this command to be used\\nif (userIsVIP) return false;\\n\\n// The user is NOT VIP so we throw an error\\nthrow `The ${command.name} is only allowed for VIP users.`\\n\")));\n}\n;\nMDXContent.isMDXComponent = true;","rawMDXOutput":"/* @jsx mdx */\nimport { mdx } from '@mdx-js/react';\n/* @jsx mdx */\n\nexport const _frontmatter = {\n \"title\": \"Creating Inhibitors!\",\n \"metaTitle\": \"Creating An Inhibitor | Discordeno\",\n \"metaDescription\": \"Let's create our very own bot with Discordeno!\"\n};\n\nconst layoutProps = {\n _frontmatter\n};\nconst MDXLayout = \"wrapper\"\nexport default function MDXContent({\n components,\n ...props\n}) {\n return \n

{`Woah! You are almost half way done with understanding all of Discordeno. Amazing isn't it? Something you may have noticed in the last section was there were some options that prevented some commands from running like `}{`dmOnly`}{` or the permission options. we created a setting to prevent the monitor from running in certain channels. What if we wanted to do prevent commands from happening? How would we prevent commands from running?`}

\n

{`What is an Inhibitor?`}

\n

{`An Inhibitor is very similar to how monitors work. A monitor runs on every message but an inhibitor runs on every command. Remember all those command options like cooldown, permissions, permissionLevel, nsfw, etc... Each and every one of these options has an inhibitor in that checks commands for these settings.`}

\n

{`Let's create our own inhibitor that would prevent commands from being used if the user is not a VIP user.`}

\n
\n

{`Note:`}{` It is important to remember that everything below can be done with a simple permission level as well. We will create our own custom permission levels but for the purposes of this guide and to be able to learn about Inhibitors, we will be using an inhibitor.`}

\n
\n

{`Creating the File`}

\n

{`Let's start by creating a file inside the inhibitors folder called `}{`vipOnly.ts`}{` and paste the following snippet of code:`}

\n
{`import { botCache } from \"../../mod.ts\";\n\nbotCache.inhibitors.set(\"inhibitorname\", async function (message, command, guild) {\n    // Your code goes here\n});\n`}
\n

{`Inhibitors can take up to 3 arguments.`}

\n
    \n
  • {`message`}{`: The message object that triggered the command.`}
  • \n
  • {`command`}{`: The command object itself that was triggered.`}
  • \n
  • {`guild`}{`: The server guild object where this command was ran.`}
  • \n
\n

{`Understanding How Inhibitors Function`}

\n

{`To block a command you have to return a truthy value.`}

\n
    \n
  • {`return true;`}{` If you return true the inhibitor will block the execution of the command.\nTo allow a command return a falsey value.`}
  • \n
  • {`return false;`}{` If you return false the inhibitor will not block the error.`}
  • \n
\n
{`// If the command is not VIP only we can allow this command to execute\nif (!command.vipOnly) return false;\n\n// Check if the user is VIP\n// \\`isUserVIP\nconst userIsVIP = await isUserVIP(message.author.id)\n// The user is VIP so we can allow this command to be used\nif (userIsVIP) return false;\n\n// The user is NOT VIP so we throw an error\nthrow \\`The \\${command.name} is only allowed for VIP users.\\`\n`}
\n\n
;\n}\n\n;\nMDXContent.isMDXComponent = true;"}} \ No newline at end of file diff --git a/docs/.cache/caches/gatsby-plugin-mdx/diskstore-9c570a2fd92c7f30091b8d50d36fbca9.json b/docs/.cache/caches/gatsby-plugin-mdx/diskstore-9c570a2fd92c7f30091b8d50d36fbca9.json new file mode 100644 index 000000000..3b79b01b0 --- /dev/null +++ b/docs/.cache/caches/gatsby-plugin-mdx/diskstore-9c570a2fd92c7f30091b8d50d36fbca9.json @@ -0,0 +1 @@ +{"expireTime":9007200851635090000,"key":"gatsby-plugin-mdx-entire-payload-fd8a99450d26dfc0473b111a7f992a12-","val":{"mdast":{"type":"root","children":[{"type":"paragraph","children":[{"type":"text","value":"Woah! You are almost half way done with understanding all of Discordeno. Amazing isn't it? Something you may have noticed in the last section was there were some options that prevented some commands from running like ","position":{"start":{"line":2,"column":1,"offset":1},"end":{"line":2,"column":218,"offset":218},"indent":[]}},{"type":"inlineCode","value":"dmOnly","position":{"start":{"line":2,"column":218,"offset":218},"end":{"line":2,"column":226,"offset":226},"indent":[]}},{"type":"text","value":" or the permission options. we created a setting to prevent the monitor from running in certain channels. What if we wanted to do prevent commands from happening? How would we prevent commands from running?","position":{"start":{"line":2,"column":226,"offset":226},"end":{"line":2,"column":432,"offset":432},"indent":[]}}],"position":{"start":{"line":2,"column":1,"offset":1},"end":{"line":2,"column":432,"offset":432},"indent":[]}},{"type":"heading","depth":2,"children":[{"type":"text","value":"What Is An Event?","position":{"start":{"line":4,"column":4,"offset":437},"end":{"line":4,"column":21,"offset":454},"indent":[]}}],"position":{"start":{"line":4,"column":1,"offset":434},"end":{"line":4,"column":21,"offset":454},"indent":[]}},{"type":"export","value":"export const _frontmatter = {\"title\":\"Creating Events!\",\"metaTitle\":\"Creating An Event | Discordeno\",\"metaDescription\":\"Let's create our very own bot with Discordeno!\"}","position":{"start":{"line":8,"column":1,"offset":458},"end":{"line":8,"column":169,"offset":626},"indent":[]}}],"position":{"start":{"line":1,"column":1,"offset":0},"end":{"line":8,"column":169,"offset":626}}},"scopeImports":["import * as React from 'react'"],"scopeIdentifiers":["React"],"body":"function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }\n\nfunction _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }\n\nfunction _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }\n\n/* @jsx mdx */\nvar _frontmatter = {\n \"title\": \"Creating Events!\",\n \"metaTitle\": \"Creating An Event | Discordeno\",\n \"metaDescription\": \"Let's create our very own bot with Discordeno!\"\n};\nvar layoutProps = {\n _frontmatter: _frontmatter\n};\nvar MDXLayout = \"wrapper\";\nreturn function MDXContent(_ref) {\n var components = _ref.components,\n props = _objectWithoutProperties(_ref, [\"components\"]);\n\n return mdx(MDXLayout, _extends({}, layoutProps, props, {\n components: components,\n mdxType: \"MDXLayout\"\n }), mdx(\"p\", null, \"Woah! You are almost half way done with understanding all of Discordeno. Amazing isn't it? Something you may have noticed in the last section was there were some options that prevented some commands from running like \", mdx(\"inlineCode\", {\n parentName: \"p\"\n }, \"dmOnly\"), \" or the permission options. we created a setting to prevent the monitor from running in certain channels. What if we wanted to do prevent commands from happening? How would we prevent commands from running?\"), mdx(\"h2\", null, \"What Is An Event?\"));\n}\n;\nMDXContent.isMDXComponent = true;","rawMDXOutput":"/* @jsx mdx */\nimport { mdx } from '@mdx-js/react';\n/* @jsx mdx */\n\nexport const _frontmatter = {\n \"title\": \"Creating Events!\",\n \"metaTitle\": \"Creating An Event | Discordeno\",\n \"metaDescription\": \"Let's create our very own bot with Discordeno!\"\n};\n\nconst layoutProps = {\n _frontmatter\n};\nconst MDXLayout = \"wrapper\"\nexport default function MDXContent({\n components,\n ...props\n}) {\n return \n

{`Woah! You are almost half way done with understanding all of Discordeno. Amazing isn't it? Something you may have noticed in the last section was there were some options that prevented some commands from running like `}{`dmOnly`}{` or the permission options. we created a setting to prevent the monitor from running in certain channels. What if we wanted to do prevent commands from happening? How would we prevent commands from running?`}

\n

{`What Is An Event?`}

\n\n
;\n}\n\n;\nMDXContent.isMDXComponent = true;"}} \ No newline at end of file diff --git a/docs/.cache/caches/gatsby-plugin-mdx/diskstore-9d9f4b39f7019084d7acb8e78111070e.json b/docs/.cache/caches/gatsby-plugin-mdx/diskstore-9d9f4b39f7019084d7acb8e78111070e.json new file mode 100644 index 000000000..058692905 --- /dev/null +++ b/docs/.cache/caches/gatsby-plugin-mdx/diskstore-9d9f4b39f7019084d7acb8e78111070e.json @@ -0,0 +1 @@ +{"expireTime":9007200851634345000,"key":"gatsby-plugin-mdx-entire-payload-c3660c6dec9f813ecc62dce38e175353-","val":{"mdast":{"type":"root","children":[{"type":"paragraph","children":[{"type":"text","value":"Woah! You are almost half way done with understanding all of Discordeno. Amazing isn't it? Something you may have noticed in the last section was there were some options that prevented some commands from running like ","position":{"start":{"line":2,"column":1,"offset":1},"end":{"line":2,"column":218,"offset":218},"indent":[]}},{"type":"inlineCode","value":"dmOnly","position":{"start":{"line":2,"column":218,"offset":218},"end":{"line":2,"column":226,"offset":226},"indent":[]}},{"type":"text","value":" or the permission options. we created a setting to prevent the monitor from running in certain channels. What if we wanted to do prevent commands from happening? How would we prevent commands from running?","position":{"start":{"line":2,"column":226,"offset":226},"end":{"line":2,"column":432,"offset":432},"indent":[]}}],"position":{"start":{"line":2,"column":1,"offset":1},"end":{"line":2,"column":432,"offset":432},"indent":[]}},{"type":"heading","depth":2,"children":[{"type":"text","value":"What is an Inhibitor?","position":{"start":{"line":4,"column":4,"offset":437},"end":{"line":4,"column":25,"offset":458},"indent":[]}}],"position":{"start":{"line":4,"column":1,"offset":434},"end":{"line":4,"column":25,"offset":458},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"An Inhibitor is very similar to how monitors work. A monitor runs on every message but an inhibitor runs on every command. Remember all those command options like cooldown, permissions, permissionLevel, nsfw, etc... Each and every one of these options has an inhibitor in that checks commands for these settings.","position":{"start":{"line":6,"column":1,"offset":460},"end":{"line":6,"column":313,"offset":772},"indent":[]}}],"position":{"start":{"line":6,"column":1,"offset":460},"end":{"line":6,"column":313,"offset":772},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"Let's create our own inhibitor that would prevent commands from being used if the user is not a VIP user.","position":{"start":{"line":8,"column":1,"offset":774},"end":{"line":8,"column":106,"offset":879},"indent":[]}}],"position":{"start":{"line":8,"column":1,"offset":774},"end":{"line":8,"column":106,"offset":879},"indent":[]}},{"type":"blockquote","children":[{"type":"paragraph","children":[{"type":"strong","children":[{"type":"text","value":"Note:","position":{"start":{"line":10,"column":5,"offset":885},"end":{"line":10,"column":10,"offset":890},"indent":[]}}],"position":{"start":{"line":10,"column":3,"offset":883},"end":{"line":10,"column":12,"offset":892},"indent":[]}},{"type":"text","value":" It is important to remember that everything below can be done with a simple permission level as well. We will create our own custom permission levels but for the purposes of this guide and to be able to learn about Inhibitors, we will be using an inhibitor.","position":{"start":{"line":10,"column":12,"offset":892},"end":{"line":10,"column":270,"offset":1150},"indent":[]}}],"position":{"start":{"line":10,"column":3,"offset":883},"end":{"line":10,"column":270,"offset":1150},"indent":[]}}],"position":{"start":{"line":10,"column":1,"offset":881},"end":{"line":10,"column":270,"offset":1150},"indent":[]}},{"type":"heading","depth":2,"children":[{"type":"text","value":"Creating the File","position":{"start":{"line":12,"column":4,"offset":1155},"end":{"line":12,"column":21,"offset":1172},"indent":[]}}],"position":{"start":{"line":12,"column":1,"offset":1152},"end":{"line":12,"column":21,"offset":1172},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"Let's start by creating a file inside the inhibitors folder called ","position":{"start":{"line":14,"column":1,"offset":1174},"end":{"line":14,"column":68,"offset":1241},"indent":[]}},{"type":"inlineCode","value":"boosted.ts","position":{"start":{"line":14,"column":68,"offset":1241},"end":{"line":14,"column":80,"offset":1253},"indent":[]}},{"type":"text","value":" and paste the following snippet of code:","position":{"start":{"line":14,"column":80,"offset":1253},"end":{"line":14,"column":121,"offset":1294},"indent":[]}}],"position":{"start":{"line":14,"column":1,"offset":1174},"end":{"line":14,"column":121,"offset":1294},"indent":[]}},{"type":"code","lang":"ts","meta":null,"value":"import { botCache } from \"../../mod.ts\";\n\nbotCache.inhibitors.set(\"inhibitorname\", async function (message, command, guild) {\n\t// Your code goes here\n});","position":{"start":{"line":16,"column":1,"offset":1296},"end":{"line":22,"column":4,"offset":1459},"indent":[1,1,1,1,1,1]}},{"type":"paragraph","children":[{"type":"text","value":"Inhibitors can take up to 3 arguments.","position":{"start":{"line":24,"column":1,"offset":1461},"end":{"line":24,"column":39,"offset":1499},"indent":[]}}],"position":{"start":{"line":24,"column":1,"offset":1461},"end":{"line":24,"column":39,"offset":1499},"indent":[]}},{"type":"list","ordered":false,"start":null,"spread":false,"children":[{"type":"listItem","spread":false,"checked":null,"children":[{"type":"paragraph","children":[{"type":"inlineCode","value":"message","position":{"start":{"line":26,"column":3,"offset":1503},"end":{"line":26,"column":12,"offset":1512},"indent":[]}},{"type":"text","value":": The message object that triggered the command.","position":{"start":{"line":26,"column":12,"offset":1512},"end":{"line":26,"column":60,"offset":1560},"indent":[]}}],"position":{"start":{"line":26,"column":3,"offset":1503},"end":{"line":26,"column":60,"offset":1560},"indent":[]}}],"position":{"start":{"line":26,"column":1,"offset":1501},"end":{"line":26,"column":60,"offset":1560},"indent":[]}},{"type":"listItem","spread":false,"checked":null,"children":[{"type":"paragraph","children":[{"type":"inlineCode","value":"command","position":{"start":{"line":27,"column":3,"offset":1563},"end":{"line":27,"column":12,"offset":1572},"indent":[]}},{"type":"text","value":": The command object itself that was triggered.","position":{"start":{"line":27,"column":12,"offset":1572},"end":{"line":27,"column":59,"offset":1619},"indent":[]}}],"position":{"start":{"line":27,"column":3,"offset":1563},"end":{"line":27,"column":59,"offset":1619},"indent":[]}}],"position":{"start":{"line":27,"column":1,"offset":1561},"end":{"line":27,"column":59,"offset":1619},"indent":[]}},{"type":"listItem","spread":false,"checked":null,"children":[{"type":"paragraph","children":[{"type":"inlineCode","value":"guild","position":{"start":{"line":28,"column":3,"offset":1622},"end":{"line":28,"column":10,"offset":1629},"indent":[]}},{"type":"text","value":": The server guild object where this command was ran.","position":{"start":{"line":28,"column":10,"offset":1629},"end":{"line":28,"column":63,"offset":1682},"indent":[]}}],"position":{"start":{"line":28,"column":3,"offset":1622},"end":{"line":28,"column":63,"offset":1682},"indent":[]}}],"position":{"start":{"line":28,"column":1,"offset":1620},"end":{"line":28,"column":63,"offset":1682},"indent":[]}}],"position":{"start":{"line":26,"column":1,"offset":1501},"end":{"line":28,"column":63,"offset":1682},"indent":[1,1]}},{"type":"heading","depth":2,"children":[{"type":"text","value":"Understanding How Inhibitors Function","position":{"start":{"line":30,"column":4,"offset":1687},"end":{"line":30,"column":41,"offset":1724},"indent":[]}}],"position":{"start":{"line":30,"column":1,"offset":1684},"end":{"line":30,"column":41,"offset":1724},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"To block a command you have to return a truthy value.","position":{"start":{"line":32,"column":1,"offset":1726},"end":{"line":32,"column":54,"offset":1779},"indent":[]}}],"position":{"start":{"line":32,"column":1,"offset":1726},"end":{"line":32,"column":54,"offset":1779},"indent":[]}},{"type":"list","ordered":false,"start":null,"spread":false,"children":[{"type":"listItem","spread":false,"checked":null,"children":[{"type":"paragraph","children":[{"type":"strong","children":[{"type":"text","value":"return true;","position":{"start":{"line":33,"column":5,"offset":1784},"end":{"line":33,"column":17,"offset":1796},"indent":[]}}],"position":{"start":{"line":33,"column":3,"offset":1782},"end":{"line":33,"column":19,"offset":1798},"indent":[]}},{"type":"text","value":" If you return true the inhibitor will block the execution of the command.\nTo allow a command return a falsey value.","position":{"start":{"line":33,"column":19,"offset":1798},"end":{"line":34,"column":42,"offset":1914},"indent":[1]}}],"position":{"start":{"line":33,"column":3,"offset":1782},"end":{"line":34,"column":42,"offset":1914},"indent":[1]}}],"position":{"start":{"line":33,"column":1,"offset":1780},"end":{"line":34,"column":42,"offset":1914},"indent":[1]}},{"type":"listItem","spread":false,"checked":null,"children":[{"type":"paragraph","children":[{"type":"strong","children":[{"type":"text","value":"return false;","position":{"start":{"line":35,"column":5,"offset":1919},"end":{"line":35,"column":18,"offset":1932},"indent":[]}}],"position":{"start":{"line":35,"column":3,"offset":1917},"end":{"line":35,"column":20,"offset":1934},"indent":[]}},{"type":"text","value":" If you return false the inhibitor will not block the error.","position":{"start":{"line":35,"column":20,"offset":1934},"end":{"line":35,"column":80,"offset":1994},"indent":[]}}],"position":{"start":{"line":35,"column":3,"offset":1917},"end":{"line":35,"column":80,"offset":1994},"indent":[]}}],"position":{"start":{"line":35,"column":1,"offset":1915},"end":{"line":35,"column":80,"offset":1994},"indent":[]}}],"position":{"start":{"line":33,"column":1,"offset":1780},"end":{"line":35,"column":80,"offset":1994},"indent":[1,1]}},{"type":"code","lang":"ts","meta":null,"value":"// If the command is not VIP only we can allow this command to execute\nif (!command.vipOnly) return false;\n\n// The bot's support server\nconst guild = cache.guilds.get(configs.supportServerID);\n// If the command author is not in the server they won't have the vip role\nconst member = guild.members.get(message.author.id) || await getMember(guild.id, message.author.id);\n// Member doesn't exist so cancel the command\nif (!member) {\n\tsendResponse(message, `sorry, but you can not use this command until you become VIP.`)\n\treturn true;\n}\n\n// If the user has the vip role on the support server given by patreon allow the command\nif (member.roles.includes(configs.patreonVIPRoleID)) return false;\n\n// Cancel the command since the user does not have vip\nreturn true;","position":{"start":{"line":38,"column":1,"offset":1997},"end":{"line":57,"column":4,"offset":2766},"indent":[1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1]}},{"type":"export","value":"export const _frontmatter = {\"title\":\"Creating Inhibitors!\",\"metaTitle\":\"Creating An Inhibitor | Discordeno\",\"metaDescription\":\"Let's create our very own bot with Discordeno!\"}","position":{"start":{"line":60,"column":1,"offset":2769},"end":{"line":60,"column":177,"offset":2945},"indent":[]}}],"position":{"start":{"line":1,"column":1,"offset":0},"end":{"line":60,"column":177,"offset":2945}}},"scopeImports":["import * as React from 'react'"],"scopeIdentifiers":["React"],"body":"function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }\n\nfunction _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }\n\nfunction _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }\n\n/* @jsx mdx */\nvar _frontmatter = {\n \"title\": \"Creating Inhibitors!\",\n \"metaTitle\": \"Creating An Inhibitor | Discordeno\",\n \"metaDescription\": \"Let's create our very own bot with Discordeno!\"\n};\nvar layoutProps = {\n _frontmatter: _frontmatter\n};\nvar MDXLayout = \"wrapper\";\nreturn function MDXContent(_ref) {\n var components = _ref.components,\n props = _objectWithoutProperties(_ref, [\"components\"]);\n\n return mdx(MDXLayout, _extends({}, layoutProps, props, {\n components: components,\n mdxType: \"MDXLayout\"\n }), mdx(\"p\", null, \"Woah! You are almost half way done with understanding all of Discordeno. Amazing isn't it? Something you may have noticed in the last section was there were some options that prevented some commands from running like \", mdx(\"inlineCode\", {\n parentName: \"p\"\n }, \"dmOnly\"), \" or the permission options. we created a setting to prevent the monitor from running in certain channels. What if we wanted to do prevent commands from happening? How would we prevent commands from running?\"), mdx(\"h2\", null, \"What is an Inhibitor?\"), mdx(\"p\", null, \"An Inhibitor is very similar to how monitors work. A monitor runs on every message but an inhibitor runs on every command. Remember all those command options like cooldown, permissions, permissionLevel, nsfw, etc... Each and every one of these options has an inhibitor in that checks commands for these settings.\"), mdx(\"p\", null, \"Let's create our own inhibitor that would prevent commands from being used if the user is not a VIP user.\"), mdx(\"blockquote\", null, mdx(\"p\", {\n parentName: \"blockquote\"\n }, mdx(\"strong\", {\n parentName: \"p\"\n }, \"Note:\"), \" It is important to remember that everything below can be done with a simple permission level as well. We will create our own custom permission levels but for the purposes of this guide and to be able to learn about Inhibitors, we will be using an inhibitor.\")), mdx(\"h2\", null, \"Creating the File\"), mdx(\"p\", null, \"Let's start by creating a file inside the inhibitors folder called \", mdx(\"inlineCode\", {\n parentName: \"p\"\n }, \"boosted.ts\"), \" and paste the following snippet of code:\"), mdx(\"pre\", null, mdx(\"code\", _extends({\n parentName: \"pre\"\n }, {\n \"className\": \"language-ts\"\n }), \"import { botCache } from \\\"../../mod.ts\\\";\\n\\nbotCache.inhibitors.set(\\\"inhibitorname\\\", async function (message, command, guild) {\\n // Your code goes here\\n});\\n\")), mdx(\"p\", null, \"Inhibitors can take up to 3 arguments.\"), mdx(\"ul\", null, mdx(\"li\", {\n parentName: \"ul\"\n }, mdx(\"inlineCode\", {\n parentName: \"li\"\n }, \"message\"), \": The message object that triggered the command.\"), mdx(\"li\", {\n parentName: \"ul\"\n }, mdx(\"inlineCode\", {\n parentName: \"li\"\n }, \"command\"), \": The command object itself that was triggered.\"), mdx(\"li\", {\n parentName: \"ul\"\n }, mdx(\"inlineCode\", {\n parentName: \"li\"\n }, \"guild\"), \": The server guild object where this command was ran.\")), mdx(\"h2\", null, \"Understanding How Inhibitors Function\"), mdx(\"p\", null, \"To block a command you have to return a truthy value.\"), mdx(\"ul\", null, mdx(\"li\", {\n parentName: \"ul\"\n }, mdx(\"strong\", {\n parentName: \"li\"\n }, \"return true;\"), \" If you return true the inhibitor will block the execution of the command.\\nTo allow a command return a falsey value.\"), mdx(\"li\", {\n parentName: \"ul\"\n }, mdx(\"strong\", {\n parentName: \"li\"\n }, \"return false;\"), \" If you return false the inhibitor will not block the error.\")), mdx(\"pre\", null, mdx(\"code\", _extends({\n parentName: \"pre\"\n }, {\n \"className\": \"language-ts\"\n }), \"// If the command is not VIP only we can allow this command to execute\\nif (!command.vipOnly) return false;\\n\\n// The bot's support server\\nconst guild = cache.guilds.get(configs.supportServerID);\\n// If the command author is not in the server they won't have the vip role\\nconst member = guild.members.get(message.author.id) || await getMember(guild.id, message.author.id);\\n// Member doesn't exist so cancel the command\\nif (!member) {\\n sendResponse(message, `sorry, but you can not use this command until you become VIP.`)\\n return true;\\n}\\n\\n// If the user has the vip role on the support server given by patreon allow the command\\nif (member.roles.includes(configs.patreonVIPRoleID)) return false;\\n\\n// Cancel the command since the user does not have vip\\nreturn true;\\n\")));\n}\n;\nMDXContent.isMDXComponent = true;","rawMDXOutput":"/* @jsx mdx */\nimport { mdx } from '@mdx-js/react';\n/* @jsx mdx */\n\nexport const _frontmatter = {\n \"title\": \"Creating Inhibitors!\",\n \"metaTitle\": \"Creating An Inhibitor | Discordeno\",\n \"metaDescription\": \"Let's create our very own bot with Discordeno!\"\n};\n\nconst layoutProps = {\n _frontmatter\n};\nconst MDXLayout = \"wrapper\"\nexport default function MDXContent({\n components,\n ...props\n}) {\n return \n

{`Woah! You are almost half way done with understanding all of Discordeno. Amazing isn't it? Something you may have noticed in the last section was there were some options that prevented some commands from running like `}{`dmOnly`}{` or the permission options. we created a setting to prevent the monitor from running in certain channels. What if we wanted to do prevent commands from happening? How would we prevent commands from running?`}

\n

{`What is an Inhibitor?`}

\n

{`An Inhibitor is very similar to how monitors work. A monitor runs on every message but an inhibitor runs on every command. Remember all those command options like cooldown, permissions, permissionLevel, nsfw, etc... Each and every one of these options has an inhibitor in that checks commands for these settings.`}

\n

{`Let's create our own inhibitor that would prevent commands from being used if the user is not a VIP user.`}

\n
\n

{`Note:`}{` It is important to remember that everything below can be done with a simple permission level as well. We will create our own custom permission levels but for the purposes of this guide and to be able to learn about Inhibitors, we will be using an inhibitor.`}

\n
\n

{`Creating the File`}

\n

{`Let's start by creating a file inside the inhibitors folder called `}{`boosted.ts`}{` and paste the following snippet of code:`}

\n
{`import { botCache } from \"../../mod.ts\";\n\nbotCache.inhibitors.set(\"inhibitorname\", async function (message, command, guild) {\n    // Your code goes here\n});\n`}
\n

{`Inhibitors can take up to 3 arguments.`}

\n
    \n
  • {`message`}{`: The message object that triggered the command.`}
  • \n
  • {`command`}{`: The command object itself that was triggered.`}
  • \n
  • {`guild`}{`: The server guild object where this command was ran.`}
  • \n
\n

{`Understanding How Inhibitors Function`}

\n

{`To block a command you have to return a truthy value.`}

\n
    \n
  • {`return true;`}{` If you return true the inhibitor will block the execution of the command.\nTo allow a command return a falsey value.`}
  • \n
  • {`return false;`}{` If you return false the inhibitor will not block the error.`}
  • \n
\n
{`// If the command is not VIP only we can allow this command to execute\nif (!command.vipOnly) return false;\n\n// The bot's support server\nconst guild = cache.guilds.get(configs.supportServerID);\n// If the command author is not in the server they won't have the vip role\nconst member = guild.members.get(message.author.id) || await getMember(guild.id, message.author.id);\n// Member doesn't exist so cancel the command\nif (!member) {\n    sendResponse(message, \\`sorry, but you can not use this command until you become VIP.\\`)\n    return true;\n}\n\n// If the user has the vip role on the support server given by patreon allow the command\nif (member.roles.includes(configs.patreonVIPRoleID)) return false;\n\n// Cancel the command since the user does not have vip\nreturn true;\n`}
\n\n
;\n}\n\n;\nMDXContent.isMDXComponent = true;"}} \ No newline at end of file diff --git a/docs/.cache/caches/gatsby-plugin-mdx/diskstore-9e3152bb6411d1248c048614c29aaafc.json b/docs/.cache/caches/gatsby-plugin-mdx/diskstore-9e3152bb6411d1248c048614c29aaafc.json new file mode 100644 index 000000000..2e7368959 --- /dev/null +++ b/docs/.cache/caches/gatsby-plugin-mdx/diskstore-9e3152bb6411d1248c048614c29aaafc.json @@ -0,0 +1 @@ +{"expireTime":9007200851644254000,"key":"gatsby-plugin-mdx-entire-payload-7ed3186483d8bd59288a7aca186c02a0-","val":{"mdast":{"type":"root","children":[{"type":"paragraph","children":[{"type":"text","value":"Discordeno will help make Discord bot development much easier. Don't worry, as you go through this guide it will make a lot more sense.","position":{"start":{"line":2,"column":1,"offset":1},"end":{"line":2,"column":136,"offset":136},"indent":[]}}],"position":{"start":{"line":2,"column":1,"offset":1},"end":{"line":2,"column":136,"offset":136},"indent":[]}},{"type":"heading","depth":2,"children":[{"type":"text","value":"Creating The Bot!","position":{"start":{"line":4,"column":4,"offset":141},"end":{"line":4,"column":21,"offset":158},"indent":[]}}],"position":{"start":{"line":4,"column":1,"offset":138},"end":{"line":4,"column":21,"offset":158},"indent":[]}},{"type":"blockquote","children":[{"type":"paragraph","children":[{"type":"text","value":"This guide is going to assume you already have the basic requirements to make a bot ready. This includes github, git, a code editor like Visual Studio Code. If you don't have these yet please prepare them first before going forward.","position":{"start":{"line":6,"column":3,"offset":162},"end":{"line":6,"column":235,"offset":394},"indent":[]}}],"position":{"start":{"line":6,"column":3,"offset":162},"end":{"line":6,"column":235,"offset":394},"indent":[]}}],"position":{"start":{"line":6,"column":1,"offset":160},"end":{"line":6,"column":235,"offset":394},"indent":[]}},{"type":"list","ordered":false,"start":null,"spread":true,"children":[{"type":"listItem","spread":false,"checked":null,"children":[{"type":"paragraph","children":[{"type":"text","value":"First, create a Discordeno Bot using the ","position":{"start":{"line":8,"column":3,"offset":398},"end":{"line":8,"column":44,"offset":439},"indent":[]}},{"type":"link","title":null,"url":"https://github.com/Skillz4Killz/Discordeno-bot-template","children":[{"type":"text","value":"Generator Boilerplate","position":{"start":{"line":8,"column":45,"offset":440},"end":{"line":8,"column":66,"offset":461},"indent":[]}}],"position":{"start":{"line":8,"column":44,"offset":439},"end":{"line":8,"column":124,"offset":519},"indent":[]}},{"type":"text","value":". Give it any name you like. For the purpose of this guide we will call it, Stargate.","position":{"start":{"line":8,"column":124,"offset":519},"end":{"line":8,"column":209,"offset":604},"indent":[]}}],"position":{"start":{"line":8,"column":3,"offset":398},"end":{"line":8,"column":209,"offset":604},"indent":[]}}],"position":{"start":{"line":8,"column":1,"offset":396},"end":{"line":9,"column":1,"offset":605},"indent":[1]}},{"type":"listItem","spread":false,"checked":null,"children":[{"type":"paragraph","children":[{"type":"text","value":"Then ","position":{"start":{"line":10,"column":3,"offset":608},"end":{"line":10,"column":8,"offset":613},"indent":[]}},{"type":"inlineCode","value":"git clone https://github.com/Skillz4Killz/Stargate.git","position":{"start":{"line":10,"column":8,"offset":613},"end":{"line":10,"column":64,"offset":669},"indent":[]}}],"position":{"start":{"line":10,"column":3,"offset":608},"end":{"line":10,"column":64,"offset":669},"indent":[]}}],"position":{"start":{"line":10,"column":1,"offset":606},"end":{"line":11,"column":1,"offset":670},"indent":[1]}},{"type":"listItem","spread":false,"checked":null,"children":[{"type":"paragraph","children":[{"type":"text","value":"When that is done, go ahead and open up the folder with VSC.","position":{"start":{"line":12,"column":3,"offset":673},"end":{"line":12,"column":63,"offset":733},"indent":[]}}],"position":{"start":{"line":12,"column":3,"offset":673},"end":{"line":12,"column":63,"offset":733},"indent":[]}}],"position":{"start":{"line":12,"column":1,"offset":671},"end":{"line":12,"column":63,"offset":733},"indent":[]}},{"type":"listItem","spread":false,"checked":null,"children":[{"type":"paragraph","children":[{"type":"text","value":"Create a new file called ","position":{"start":{"line":13,"column":3,"offset":736},"end":{"line":13,"column":28,"offset":761},"indent":[]}},{"type":"inlineCode","value":"configs.ts","position":{"start":{"line":13,"column":28,"offset":761},"end":{"line":13,"column":40,"offset":773},"indent":[]}},{"type":"text","value":". Open the ","position":{"start":{"line":13,"column":40,"offset":773},"end":{"line":13,"column":51,"offset":784},"indent":[]}},{"type":"inlineCode","value":"configs.example.ts","position":{"start":{"line":13,"column":51,"offset":784},"end":{"line":13,"column":71,"offset":804},"indent":[]}},{"type":"text","value":" file and copy everything over.","position":{"start":{"line":13,"column":71,"offset":804},"end":{"line":13,"column":102,"offset":835},"indent":[]}}],"position":{"start":{"line":13,"column":3,"offset":736},"end":{"line":13,"column":102,"offset":835},"indent":[]}}],"position":{"start":{"line":13,"column":1,"offset":734},"end":{"line":13,"column":102,"offset":835},"indent":[]}}],"position":{"start":{"line":8,"column":1,"offset":396},"end":{"line":13,"column":102,"offset":835},"indent":[1,1,1,1,1]}},{"type":"paragraph","children":[{"type":"text","value":"Let's take a minute to review all the options we have available to us.","position":{"start":{"line":15,"column":1,"offset":837},"end":{"line":15,"column":71,"offset":907},"indent":[]}}],"position":{"start":{"line":15,"column":1,"offset":837},"end":{"line":15,"column":71,"offset":907},"indent":[]}},{"type":"heading","depth":3,"children":[{"type":"text","value":"Configs File","position":{"start":{"line":17,"column":5,"offset":913},"end":{"line":17,"column":17,"offset":925},"indent":[]}}],"position":{"start":{"line":17,"column":1,"offset":909},"end":{"line":17,"column":17,"offset":925},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"The ","position":{"start":{"line":19,"column":1,"offset":927},"end":{"line":19,"column":5,"offset":931},"indent":[]}},{"type":"inlineCode","value":"configs.ts","position":{"start":{"line":19,"column":5,"offset":931},"end":{"line":19,"column":17,"offset":943},"indent":[]}},{"type":"text","value":" file is where you will keep all your secret info you don't want to share with anyone else. As long as ","position":{"start":{"line":19,"column":17,"offset":943},"end":{"line":19,"column":120,"offset":1046},"indent":[]}},{"type":"inlineCode","value":".gitignore","position":{"start":{"line":19,"column":120,"offset":1046},"end":{"line":19,"column":132,"offset":1058},"indent":[]}},{"type":"text","value":" file is ignoring configs.ts your configurations will be kept private!","position":{"start":{"line":19,"column":132,"offset":1058},"end":{"line":19,"column":202,"offset":1128},"indent":[]}}],"position":{"start":{"line":19,"column":1,"offset":927},"end":{"line":19,"column":202,"offset":1128},"indent":[]}},{"type":"code","lang":"ts","meta":null,"value":"// Step 1: Remove the `.example` from this file name so it is called `configs.ts`\n// Step 2: Add all your bot's information below. The only required one is token and prefix. NOTE: As long as `.gitignore` file is ignoring configs.ts your configurations will be kept private!\n// Step 3: Remove these comments if you like.\n\nexport const configs = {\n // Your bot token goes here\n token: \"\",\n // The default prefix for your bot. Don't worry guilds can change this later.\n prefix: \"!\",\n // This isn't required but you can add bot list api keys here.\n botListTokens: {\n DISCORD_BOT_ORG: \"\",\n BOTS_ON_DISCORD: \"\",\n DISCORD_BOT_LIST: \"\",\n BOTS_FOR_DISCORD: \"\",\n DISCORD_BOATS: \"\",\n DISCORD_BOTS_GG: \"\",\n DISCORD_BOTS_GROUP: \"\",\n },\n // This is the server id for your bot's main server where users can get help/support\n supportServerID: \"\",\n // These are channel ids that will enable some functionality\n channelIDs: {\n // When a translation is missing this is the channel you will be alerted in.\n missingTranslation: \"\",\n // When an error occurs, we will try and log it to this channel\n errorChannelID: \"\"\n },\n // These are the role ids that will enable some functionality.\n roleIDs: {\n // If you have a patreon set up you can add the patreon vip role id here.\n patreonVIPRoleID: \"\",\n },\n // These are the user ids that will enable some functionality.\n userIDs: {\n // The user ids for the support team\n botSupporters: [],\n // The user ids for the other devs on your team\n botDevs: [],\n // The user ids who have complete 100% access to your bot\n botOwners: []\n }\n};\n","position":{"start":{"line":21,"column":1,"offset":1130},"end":{"line":66,"column":4,"offset":2770},"indent":[1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1]}},{"type":"heading","depth":4,"children":[{"type":"text","value":"Token","position":{"start":{"line":68,"column":6,"offset":2777},"end":{"line":68,"column":11,"offset":2782},"indent":[]}}],"position":{"start":{"line":68,"column":1,"offset":2772},"end":{"line":68,"column":11,"offset":2782},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"First, add your bot token. This is ","position":{"start":{"line":70,"column":1,"offset":2784},"end":{"line":70,"column":36,"offset":2819},"indent":[]}},{"type":"strong","children":[{"type":"text","value":"required","position":{"start":{"line":70,"column":38,"offset":2821},"end":{"line":70,"column":46,"offset":2829},"indent":[]}}],"position":{"start":{"line":70,"column":36,"offset":2819},"end":{"line":70,"column":48,"offset":2831},"indent":[]}},{"type":"text","value":" for the bot to start. Review the ","position":{"start":{"line":70,"column":48,"offset":2831},"end":{"line":70,"column":82,"offset":2865},"indent":[]}},{"type":"link","title":null,"url":"https://discordeno.netlify.app/gettingstarted#creatingyourfirstdiscordbotapplication","children":[{"type":"text","value":"instructions","position":{"start":{"line":70,"column":83,"offset":2866},"end":{"line":70,"column":95,"offset":2878},"indent":[]}}],"position":{"start":{"line":70,"column":82,"offset":2865},"end":{"line":70,"column":182,"offset":2965},"indent":[]}},{"type":"text","value":" if you have not made your token yet.","position":{"start":{"line":70,"column":182,"offset":2965},"end":{"line":70,"column":219,"offset":3002},"indent":[]}}],"position":{"start":{"line":70,"column":1,"offset":2784},"end":{"line":70,"column":219,"offset":3002},"indent":[]}},{"type":"heading","depth":4,"children":[{"type":"text","value":"Prefix","position":{"start":{"line":72,"column":6,"offset":3009},"end":{"line":72,"column":12,"offset":3015},"indent":[]}}],"position":{"start":{"line":72,"column":1,"offset":3004},"end":{"line":72,"column":12,"offset":3015},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"The prefix is where you will set the default prefix for your bot. Don't worry, every server will be able to choose their own prefix but we need a default prefix to start.","position":{"start":{"line":74,"column":1,"offset":3017},"end":{"line":74,"column":171,"offset":3187},"indent":[]}}],"position":{"start":{"line":74,"column":1,"offset":3017},"end":{"line":74,"column":171,"offset":3187},"indent":[]}},{"type":"heading","depth":4,"children":[{"type":"text","value":"Bot Lists Tokens","position":{"start":{"line":76,"column":6,"offset":3194},"end":{"line":76,"column":22,"offset":3210},"indent":[]}}],"position":{"start":{"line":76,"column":1,"offset":3189},"end":{"line":76,"column":22,"offset":3210},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"This section of the file is so you can easily have your bot's statistics updated on all the bot lists out there to help you grow your bot. The code is already written to handle this but you will need to do 3 things for each bot list.","position":{"start":{"line":78,"column":1,"offset":3212},"end":{"line":78,"column":234,"offset":3445},"indent":[]}}],"position":{"start":{"line":78,"column":1,"offset":3212},"end":{"line":78,"column":234,"offset":3445},"indent":[]}},{"type":"list","ordered":true,"start":1,"spread":false,"children":[{"type":"listItem","spread":false,"checked":null,"children":[{"type":"paragraph","children":[{"type":"text","value":"Go to the bot list and add your bot to their website. (Each site has it's own instructions)","position":{"start":{"line":80,"column":4,"offset":3450},"end":{"line":80,"column":95,"offset":3541},"indent":[]}}],"position":{"start":{"line":80,"column":4,"offset":3450},"end":{"line":80,"column":95,"offset":3541},"indent":[]}}],"position":{"start":{"line":80,"column":1,"offset":3447},"end":{"line":80,"column":95,"offset":3541},"indent":[]}},{"type":"listItem","spread":false,"checked":null,"children":[{"type":"paragraph","children":[{"type":"text","value":"Create a token for yourself on each website and paste it in your configs.","position":{"start":{"line":81,"column":4,"offset":3545},"end":{"line":81,"column":77,"offset":3618},"indent":[]}}],"position":{"start":{"line":81,"column":4,"offset":3545},"end":{"line":81,"column":77,"offset":3618},"indent":[]}}],"position":{"start":{"line":81,"column":1,"offset":3542},"end":{"line":81,"column":77,"offset":3618},"indent":[]}},{"type":"listItem","spread":false,"checked":null,"children":[{"type":"paragraph","children":[{"type":"text","value":"Enjoy!","position":{"start":{"line":82,"column":4,"offset":3622},"end":{"line":82,"column":10,"offset":3628},"indent":[]}}],"position":{"start":{"line":82,"column":4,"offset":3622},"end":{"line":82,"column":10,"offset":3628},"indent":[]}}],"position":{"start":{"line":82,"column":1,"offset":3619},"end":{"line":82,"column":10,"offset":3628},"indent":[]}}],"position":{"start":{"line":80,"column":1,"offset":3447},"end":{"line":82,"column":10,"offset":3628},"indent":[1,1]}},{"type":"paragraph","children":[{"type":"text","value":"If you wish to customize the code, you will find the bot list tasks in the tasks folder. Don't worry we will discuss this when we get to the tasks section of the guide.","position":{"start":{"line":84,"column":1,"offset":3630},"end":{"line":84,"column":169,"offset":3798},"indent":[]}}],"position":{"start":{"line":84,"column":1,"offset":3630},"end":{"line":84,"column":169,"offset":3798},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"For now just remember, that Discordeno provides you a built in way to update most discord bot lists.","position":{"start":{"line":86,"column":1,"offset":3800},"end":{"line":86,"column":101,"offset":3900},"indent":[]}}],"position":{"start":{"line":86,"column":1,"offset":3800},"end":{"line":86,"column":101,"offset":3900},"indent":[]}},{"type":"heading","depth":4,"children":[{"type":"text","value":"Channel IDs","position":{"start":{"line":88,"column":6,"offset":3907},"end":{"line":88,"column":17,"offset":3918},"indent":[]}}],"position":{"start":{"line":88,"column":1,"offset":3902},"end":{"line":88,"column":17,"offset":3918},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"The channelIDs section holds the channel IDs that are useful for specific features to help give you alerts/notifications. For example, the ","position":{"start":{"line":90,"column":1,"offset":3920},"end":{"line":90,"column":140,"offset":4059},"indent":[]}},{"type":"inlineCode","value":"missingTranslation","position":{"start":{"line":90,"column":140,"offset":4059},"end":{"line":90,"column":160,"offset":4079},"indent":[]}},{"type":"text","value":" channel will be where messages are sent alerting you that somewhere in your code you are trying to use a translation key that you never created.","position":{"start":{"line":90,"column":160,"offset":4079},"end":{"line":90,"column":305,"offset":4224},"indent":[]}}],"position":{"start":{"line":90,"column":1,"offset":3920},"end":{"line":90,"column":305,"offset":4224},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"When you get to around 25,000 Discord servers on your bot, you may want to convert these channel IDs to webhooks.","position":{"start":{"line":92,"column":1,"offset":4226},"end":{"line":92,"column":114,"offset":4339},"indent":[]}}],"position":{"start":{"line":92,"column":1,"offset":4226},"end":{"line":92,"column":114,"offset":4339},"indent":[]}},{"type":"heading","depth":4,"children":[{"type":"text","value":"Role IDs","position":{"start":{"line":94,"column":6,"offset":4346},"end":{"line":94,"column":14,"offset":4354},"indent":[]}}],"position":{"start":{"line":94,"column":1,"offset":4341},"end":{"line":94,"column":14,"offset":4354},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"The roleIDs section holds the role IDs that are useful for specific features. For example, the ","position":{"start":{"line":96,"column":1,"offset":4356},"end":{"line":96,"column":96,"offset":4451},"indent":[]}},{"type":"inlineCode","value":"patreonVIPRoleID","position":{"start":{"line":96,"column":96,"offset":4451},"end":{"line":96,"column":114,"offset":4469},"indent":[]}},{"type":"text","value":" role can be used easily to enable vip features later in this guide.","position":{"start":{"line":96,"column":114,"offset":4469},"end":{"line":96,"column":182,"offset":4537},"indent":[]}}],"position":{"start":{"line":96,"column":1,"offset":4356},"end":{"line":96,"column":182,"offset":4537},"indent":[]}},{"type":"heading","depth":4,"children":[{"type":"text","value":"User IDs","position":{"start":{"line":98,"column":6,"offset":4544},"end":{"line":98,"column":14,"offset":4552},"indent":[]}}],"position":{"start":{"line":98,"column":1,"offset":4539},"end":{"line":98,"column":14,"offset":4552},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"The channelIDs section holds the channel IDs that are useful for specific features to help give you alerts/notifications. For example, the ","position":{"start":{"line":100,"column":1,"offset":4554},"end":{"line":100,"column":140,"offset":4693},"indent":[]}},{"type":"inlineCode","value":"missingTranslation","position":{"start":{"line":100,"column":140,"offset":4693},"end":{"line":100,"column":160,"offset":4713},"indent":[]}},{"type":"text","value":" channel will be where messages are sent alerting you that somewhere in your code you are trying to use a translation key that you never created.","position":{"start":{"line":100,"column":160,"offset":4713},"end":{"line":100,"column":305,"offset":4858},"indent":[]}}],"position":{"start":{"line":100,"column":1,"offset":4554},"end":{"line":100,"column":305,"offset":4858},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"When you get to around 25,000 Discord servers on your bot, you may want to convert these channel IDs to webhooks.","position":{"start":{"line":102,"column":1,"offset":4860},"end":{"line":102,"column":114,"offset":4973},"indent":[]}}],"position":{"start":{"line":102,"column":1,"offset":4860},"end":{"line":102,"column":114,"offset":4973},"indent":[]}},{"type":"heading","depth":2,"children":[{"type":"text","value":"It's Alive!","position":{"start":{"line":104,"column":4,"offset":4978},"end":{"line":104,"column":15,"offset":4989},"indent":[]}}],"position":{"start":{"line":104,"column":1,"offset":4975},"end":{"line":104,"column":15,"offset":4989},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"Oh my god! You now have a bot with a bunch of features already! You don't believe me? Well, seeing is believing, so start the bot.","position":{"start":{"line":106,"column":1,"offset":4991},"end":{"line":106,"column":131,"offset":5121},"indent":[]}}],"position":{"start":{"line":106,"column":1,"offset":4991},"end":{"line":106,"column":131,"offset":5121},"indent":[]}},{"type":"list","ordered":true,"start":1,"spread":false,"children":[{"type":"listItem","spread":false,"checked":null,"children":[{"type":"paragraph","children":[{"type":"text","value":"Invite your bot to a discord server.","position":{"start":{"line":108,"column":4,"offset":5126},"end":{"line":108,"column":40,"offset":5162},"indent":[]}}],"position":{"start":{"line":108,"column":4,"offset":5126},"end":{"line":108,"column":40,"offset":5162},"indent":[]}}],"position":{"start":{"line":108,"column":1,"offset":5123},"end":{"line":108,"column":40,"offset":5162},"indent":[]}},{"type":"listItem","spread":false,"checked":null,"children":[{"type":"paragraph","children":[{"type":"text","value":"Open up the integrated terminal in VSC using ","position":{"start":{"line":109,"column":4,"offset":5166},"end":{"line":109,"column":49,"offset":5211},"indent":[]}},{"type":"strong","children":[{"type":"text","value":"CTRL + `","position":{"start":{"line":109,"column":51,"offset":5213},"end":{"line":109,"column":59,"offset":5221},"indent":[]}}],"position":{"start":{"line":109,"column":49,"offset":5211},"end":{"line":109,"column":61,"offset":5223},"indent":[]}},{"type":"text","value":". If you use a Mac, replace CTRL with CMD.","position":{"start":{"line":109,"column":61,"offset":5223},"end":{"line":109,"column":103,"offset":5265},"indent":[]}}],"position":{"start":{"line":109,"column":4,"offset":5166},"end":{"line":109,"column":103,"offset":5265},"indent":[]}}],"position":{"start":{"line":109,"column":1,"offset":5163},"end":{"line":109,"column":103,"offset":5265},"indent":[]}},{"type":"listItem","spread":false,"checked":null,"children":[{"type":"paragraph","children":[{"type":"text","value":"Run the script below:","position":{"start":{"line":110,"column":4,"offset":5269},"end":{"line":110,"column":25,"offset":5290},"indent":[]}}],"position":{"start":{"line":110,"column":4,"offset":5269},"end":{"line":110,"column":25,"offset":5290},"indent":[]}}],"position":{"start":{"line":110,"column":1,"offset":5266},"end":{"line":110,"column":25,"offset":5290},"indent":[]}}],"position":{"start":{"line":108,"column":1,"offset":5123},"end":{"line":110,"column":25,"offset":5290},"indent":[1,1]}},{"type":"code","lang":"shell","meta":null,"value":"deno run --allow-net --allow-read mod.ts","position":{"start":{"line":112,"column":1,"offset":5292},"end":{"line":114,"column":4,"offset":5345},"indent":[1,1]}},{"type":"paragraph","children":[{"type":"text","value":"The first time you run it, you may see a lot of files being loaded. This is preparing all the magic behind the scene. Once it is ready, you will see something like this:","position":{"start":{"line":116,"column":1,"offset":5347},"end":{"line":116,"column":170,"offset":5516},"indent":[]}}],"position":{"start":{"line":116,"column":1,"offset":5347},"end":{"line":116,"column":170,"offset":5516},"indent":[]}},{"type":"paragraph","children":[{"type":"image","title":null,"url":"https://i.imgur.com/TOXjLgh.png","alt":"image","position":{"start":{"line":118,"column":1,"offset":5518},"end":{"line":118,"column":42,"offset":5559},"indent":[]}}],"position":{"start":{"line":118,"column":1,"offset":5518},"end":{"line":118,"column":42,"offset":5559},"indent":[]}},{"type":"heading","depth":2,"children":[{"type":"text","value":"Understanding What Discordeno Did","position":{"start":{"line":120,"column":4,"offset":5564},"end":{"line":120,"column":37,"offset":5597},"indent":[]}}],"position":{"start":{"line":120,"column":1,"offset":5561},"end":{"line":120,"column":37,"offset":5597},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"Discordeno includes these commands/folders as they are essential for any discord bot to have in order to meet the Discord Bot Best Practices. It also adds a few things that will help make some things easier to build a bot.","position":{"start":{"line":122,"column":1,"offset":5599},"end":{"line":122,"column":223,"offset":5821},"indent":[]}}],"position":{"start":{"line":122,"column":1,"offset":5599},"end":{"line":122,"column":223,"offset":5821},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"We will dive into these deeper in this guide. Let's take it step by step.","position":{"start":{"line":124,"column":1,"offset":5823},"end":{"line":124,"column":74,"offset":5896},"indent":[]}}],"position":{"start":{"line":124,"column":1,"offset":5823},"end":{"line":124,"column":74,"offset":5896},"indent":[]}},{"type":"export","value":"export const _frontmatter = {\"title\":\"Creating The Bot!\",\"metaTitle\":\"Creating A Bot | Discordeno\",\"metaDescription\":\"Let's create our very own bot with Discordeno!\"}","position":{"start":{"line":127,"column":1,"offset":5899},"end":{"line":127,"column":167,"offset":6065},"indent":[]}}],"position":{"start":{"line":1,"column":1,"offset":0},"end":{"line":127,"column":167,"offset":6065}}},"scopeImports":["import * as React from 'react'"],"scopeIdentifiers":["React"],"body":"function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }\n\nfunction _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }\n\nfunction _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }\n\n/* @jsx mdx */\nvar _frontmatter = {\n \"title\": \"Creating The Bot!\",\n \"metaTitle\": \"Creating A Bot | Discordeno\",\n \"metaDescription\": \"Let's create our very own bot with Discordeno!\"\n};\nvar layoutProps = {\n _frontmatter: _frontmatter\n};\nvar MDXLayout = \"wrapper\";\nreturn function MDXContent(_ref) {\n var components = _ref.components,\n props = _objectWithoutProperties(_ref, [\"components\"]);\n\n return mdx(MDXLayout, _extends({}, layoutProps, props, {\n components: components,\n mdxType: \"MDXLayout\"\n }), mdx(\"p\", null, \"Discordeno will help make Discord bot development much easier. Don't worry, as you go through this guide it will make a lot more sense.\"), mdx(\"h2\", null, \"Creating The Bot!\"), mdx(\"blockquote\", null, mdx(\"p\", {\n parentName: \"blockquote\"\n }, \"This guide is going to assume you already have the basic requirements to make a bot ready. This includes github, git, a code editor like Visual Studio Code. If you don't have these yet please prepare them first before going forward.\")), mdx(\"ul\", null, mdx(\"li\", {\n parentName: \"ul\"\n }, mdx(\"p\", {\n parentName: \"li\"\n }, \"First, create a Discordeno Bot using the \", mdx(\"a\", _extends({\n parentName: \"p\"\n }, {\n \"href\": \"https://github.com/Skillz4Killz/Discordeno-bot-template\"\n }), \"Generator Boilerplate\"), \". Give it any name you like. For the purpose of this guide we will call it, Stargate.\")), mdx(\"li\", {\n parentName: \"ul\"\n }, mdx(\"p\", {\n parentName: \"li\"\n }, \"Then \", mdx(\"inlineCode\", {\n parentName: \"p\"\n }, \"git clone https://github.com/Skillz4Killz/Stargate.git\"))), mdx(\"li\", {\n parentName: \"ul\"\n }, mdx(\"p\", {\n parentName: \"li\"\n }, \"When that is done, go ahead and open up the folder with VSC.\")), mdx(\"li\", {\n parentName: \"ul\"\n }, mdx(\"p\", {\n parentName: \"li\"\n }, \"Create a new file called \", mdx(\"inlineCode\", {\n parentName: \"p\"\n }, \"configs.ts\"), \". Open the \", mdx(\"inlineCode\", {\n parentName: \"p\"\n }, \"configs.example.ts\"), \" file and copy everything over.\"))), mdx(\"p\", null, \"Let's take a minute to review all the options we have available to us.\"), mdx(\"h3\", null, \"Configs File\"), mdx(\"p\", null, \"The \", mdx(\"inlineCode\", {\n parentName: \"p\"\n }, \"configs.ts\"), \" file is where you will keep all your secret info you don't want to share with anyone else. As long as \", mdx(\"inlineCode\", {\n parentName: \"p\"\n }, \".gitignore\"), \" file is ignoring configs.ts your configurations will be kept private!\"), mdx(\"pre\", null, mdx(\"code\", _extends({\n parentName: \"pre\"\n }, {\n \"className\": \"language-ts\"\n }), \"// Step 1: Remove the `.example` from this file name so it is called `configs.ts`\\n// Step 2: Add all your bot's information below. The only required one is token and prefix. NOTE: As long as `.gitignore` file is ignoring configs.ts your configurations will be kept private!\\n// Step 3: Remove these comments if you like.\\n\\nexport const configs = {\\n // Your bot token goes here\\n token: \\\"\\\",\\n // The default prefix for your bot. Don't worry guilds can change this later.\\n prefix: \\\"!\\\",\\n // This isn't required but you can add bot list api keys here.\\n botListTokens: {\\n DISCORD_BOT_ORG: \\\"\\\",\\n BOTS_ON_DISCORD: \\\"\\\",\\n DISCORD_BOT_LIST: \\\"\\\",\\n BOTS_FOR_DISCORD: \\\"\\\",\\n DISCORD_BOATS: \\\"\\\",\\n DISCORD_BOTS_GG: \\\"\\\",\\n DISCORD_BOTS_GROUP: \\\"\\\",\\n },\\n // This is the server id for your bot's main server where users can get help/support\\n supportServerID: \\\"\\\",\\n // These are channel ids that will enable some functionality\\n channelIDs: {\\n // When a translation is missing this is the channel you will be alerted in.\\n missingTranslation: \\\"\\\",\\n // When an error occurs, we will try and log it to this channel\\n errorChannelID: \\\"\\\"\\n },\\n // These are the role ids that will enable some functionality.\\n roleIDs: {\\n // If you have a patreon set up you can add the patreon vip role id here.\\n patreonVIPRoleID: \\\"\\\",\\n },\\n // These are the user ids that will enable some functionality.\\n userIDs: {\\n // The user ids for the support team\\n botSupporters: [],\\n // The user ids for the other devs on your team\\n botDevs: [],\\n // The user ids who have complete 100% access to your bot\\n botOwners: []\\n }\\n};\\n\\n\")), mdx(\"h4\", null, \"Token\"), mdx(\"p\", null, \"First, add your bot token. This is \", mdx(\"strong\", {\n parentName: \"p\"\n }, \"required\"), \" for the bot to start. Review the \", mdx(\"a\", _extends({\n parentName: \"p\"\n }, {\n \"href\": \"https://discordeno.netlify.app/gettingstarted#creatingyourfirstdiscordbotapplication\"\n }), \"instructions\"), \" if you have not made your token yet.\"), mdx(\"h4\", null, \"Prefix\"), mdx(\"p\", null, \"The prefix is where you will set the default prefix for your bot. Don't worry, every server will be able to choose their own prefix but we need a default prefix to start.\"), mdx(\"h4\", null, \"Bot Lists Tokens\"), mdx(\"p\", null, \"This section of the file is so you can easily have your bot's statistics updated on all the bot lists out there to help you grow your bot. The code is already written to handle this but you will need to do 3 things for each bot list.\"), mdx(\"ol\", null, mdx(\"li\", {\n parentName: \"ol\"\n }, \"Go to the bot list and add your bot to their website. (Each site has it's own instructions)\"), mdx(\"li\", {\n parentName: \"ol\"\n }, \"Create a token for yourself on each website and paste it in your configs.\"), mdx(\"li\", {\n parentName: \"ol\"\n }, \"Enjoy!\")), mdx(\"p\", null, \"If you wish to customize the code, you will find the bot list tasks in the tasks folder. Don't worry we will discuss this when we get to the tasks section of the guide.\"), mdx(\"p\", null, \"For now just remember, that Discordeno provides you a built in way to update most discord bot lists.\"), mdx(\"h4\", null, \"Channel IDs\"), mdx(\"p\", null, \"The channelIDs section holds the channel IDs that are useful for specific features to help give you alerts/notifications. For example, the \", mdx(\"inlineCode\", {\n parentName: \"p\"\n }, \"missingTranslation\"), \" channel will be where messages are sent alerting you that somewhere in your code you are trying to use a translation key that you never created.\"), mdx(\"p\", null, \"When you get to around 25,000 Discord servers on your bot, you may want to convert these channel IDs to webhooks.\"), mdx(\"h4\", null, \"Role IDs\"), mdx(\"p\", null, \"The roleIDs section holds the role IDs that are useful for specific features. For example, the \", mdx(\"inlineCode\", {\n parentName: \"p\"\n }, \"patreonVIPRoleID\"), \" role can be used easily to enable vip features later in this guide.\"), mdx(\"h4\", null, \"User IDs\"), mdx(\"p\", null, \"The channelIDs section holds the channel IDs that are useful for specific features to help give you alerts/notifications. For example, the \", mdx(\"inlineCode\", {\n parentName: \"p\"\n }, \"missingTranslation\"), \" channel will be where messages are sent alerting you that somewhere in your code you are trying to use a translation key that you never created.\"), mdx(\"p\", null, \"When you get to around 25,000 Discord servers on your bot, you may want to convert these channel IDs to webhooks.\"), mdx(\"h2\", null, \"It's Alive!\"), mdx(\"p\", null, \"Oh my god! You now have a bot with a bunch of features already! You don't believe me? Well, seeing is believing, so start the bot.\"), mdx(\"ol\", null, mdx(\"li\", {\n parentName: \"ol\"\n }, \"Invite your bot to a discord server.\"), mdx(\"li\", {\n parentName: \"ol\"\n }, \"Open up the integrated terminal in VSC using \", mdx(\"strong\", {\n parentName: \"li\"\n }, \"CTRL + `\"), \". If you use a Mac, replace CTRL with CMD.\"), mdx(\"li\", {\n parentName: \"ol\"\n }, \"Run the script below:\")), mdx(\"pre\", null, mdx(\"code\", _extends({\n parentName: \"pre\"\n }, {\n \"className\": \"language-shell\"\n }), \"deno run --allow-net --allow-read mod.ts\\n\")), mdx(\"p\", null, \"The first time you run it, you may see a lot of files being loaded. This is preparing all the magic behind the scene. Once it is ready, you will see something like this:\"), mdx(\"p\", null, mdx(\"img\", _extends({\n parentName: \"p\"\n }, {\n \"src\": \"https://i.imgur.com/TOXjLgh.png\",\n \"alt\": \"image\"\n }))), mdx(\"h2\", null, \"Understanding What Discordeno Did\"), mdx(\"p\", null, \"Discordeno includes these commands/folders as they are essential for any discord bot to have in order to meet the Discord Bot Best Practices. It also adds a few things that will help make some things easier to build a bot.\"), mdx(\"p\", null, \"We will dive into these deeper in this guide. Let's take it step by step.\"));\n}\n;\nMDXContent.isMDXComponent = true;","rawMDXOutput":"/* @jsx mdx */\nimport { mdx } from '@mdx-js/react';\n/* @jsx mdx */\n\nexport const _frontmatter = {\n \"title\": \"Creating The Bot!\",\n \"metaTitle\": \"Creating A Bot | Discordeno\",\n \"metaDescription\": \"Let's create our very own bot with Discordeno!\"\n};\n\nconst layoutProps = {\n _frontmatter\n};\nconst MDXLayout = \"wrapper\"\nexport default function MDXContent({\n components,\n ...props\n}) {\n return \n

{`Discordeno will help make Discord bot development much easier. Don't worry, as you go through this guide it will make a lot more sense.`}

\n

{`Creating The Bot!`}

\n
\n

{`This guide is going to assume you already have the basic requirements to make a bot ready. This includes github, git, a code editor like Visual Studio Code. If you don't have these yet please prepare them first before going forward.`}

\n
\n
    \n
  • \n

    {`First, create a Discordeno Bot using the `}{`Generator Boilerplate`}{`. Give it any name you like. For the purpose of this guide we will call it, Stargate.`}

    \n
  • \n
  • \n

    {`Then `}{`git clone https://github.com/Skillz4Killz/Stargate.git`}

    \n
  • \n
  • \n

    {`When that is done, go ahead and open up the folder with VSC.`}

    \n
  • \n
  • \n

    {`Create a new file called `}{`configs.ts`}{`. Open the `}{`configs.example.ts`}{` file and copy everything over.`}

    \n
  • \n
\n

{`Let's take a minute to review all the options we have available to us.`}

\n

{`Configs File`}

\n

{`The `}{`configs.ts`}{` file is where you will keep all your secret info you don't want to share with anyone else. As long as `}{`.gitignore`}{` file is ignoring configs.ts your configurations will be kept private!`}

\n
{`// Step 1: Remove the \\`.example\\` from this file name so it is called \\`configs.ts\\`\n// Step 2: Add all your bot's information below. The only required one is token and prefix. NOTE: As long as \\`.gitignore\\` file is ignoring configs.ts your configurations will be kept private!\n// Step 3: Remove these comments if you like.\n\nexport const configs = {\n  // Your bot token goes here\n  token: \"\",\n  // The default prefix for your bot. Don't worry guilds can change this later.\n  prefix: \"!\",\n  // This isn't required but you can add bot list api keys here.\n  botListTokens: {\n    DISCORD_BOT_ORG: \"\",\n    BOTS_ON_DISCORD: \"\",\n    DISCORD_BOT_LIST: \"\",\n    BOTS_FOR_DISCORD: \"\",\n    DISCORD_BOATS: \"\",\n    DISCORD_BOTS_GG: \"\",\n    DISCORD_BOTS_GROUP: \"\",\n  },\n  // This is the server id for your bot's main server where users can get help/support\n  supportServerID: \"\",\n  // These are channel ids that will enable some functionality\n  channelIDs: {\n    // When a translation is missing this is the channel you will be alerted in.\n    missingTranslation: \"\",\n    // When an error occurs, we will try and log it to this channel\n    errorChannelID: \"\"\n  },\n  // These are the role ids that will enable some functionality.\n  roleIDs: {\n    // If you have a patreon set up you can add the patreon vip role id here.\n    patreonVIPRoleID: \"\",\n  },\n  // These are the user ids that will enable some functionality.\n  userIDs: {\n    // The user ids for the support team\n    botSupporters: [],\n    // The user ids for the other devs on your team\n    botDevs: [],\n    // The user ids who have complete 100% access to your bot\n    botOwners: []\n  }\n};\n\n`}
\n

{`Token`}

\n

{`First, add your bot token. This is `}{`required`}{` for the bot to start. Review the `}{`instructions`}{` if you have not made your token yet.`}

\n

{`Prefix`}

\n

{`The prefix is where you will set the default prefix for your bot. Don't worry, every server will be able to choose their own prefix but we need a default prefix to start.`}

\n

{`Bot Lists Tokens`}

\n

{`This section of the file is so you can easily have your bot's statistics updated on all the bot lists out there to help you grow your bot. The code is already written to handle this but you will need to do 3 things for each bot list.`}

\n
    \n
  1. {`Go to the bot list and add your bot to their website. (Each site has it's own instructions)`}
  2. \n
  3. {`Create a token for yourself on each website and paste it in your configs.`}
  4. \n
  5. {`Enjoy!`}
  6. \n
\n

{`If you wish to customize the code, you will find the bot list tasks in the tasks folder. Don't worry we will discuss this when we get to the tasks section of the guide.`}

\n

{`For now just remember, that Discordeno provides you a built in way to update most discord bot lists.`}

\n

{`Channel IDs`}

\n

{`The channelIDs section holds the channel IDs that are useful for specific features to help give you alerts/notifications. For example, the `}{`missingTranslation`}{` channel will be where messages are sent alerting you that somewhere in your code you are trying to use a translation key that you never created.`}

\n

{`When you get to around 25,000 Discord servers on your bot, you may want to convert these channel IDs to webhooks.`}

\n

{`Role IDs`}

\n

{`The roleIDs section holds the role IDs that are useful for specific features. For example, the `}{`patreonVIPRoleID`}{` role can be used easily to enable vip features later in this guide.`}

\n

{`User IDs`}

\n

{`The channelIDs section holds the channel IDs that are useful for specific features to help give you alerts/notifications. For example, the `}{`missingTranslation`}{` channel will be where messages are sent alerting you that somewhere in your code you are trying to use a translation key that you never created.`}

\n

{`When you get to around 25,000 Discord servers on your bot, you may want to convert these channel IDs to webhooks.`}

\n

{`It's Alive!`}

\n

{`Oh my god! You now have a bot with a bunch of features already! You don't believe me? Well, seeing is believing, so start the bot.`}

\n
    \n
  1. {`Invite your bot to a discord server.`}
  2. \n
  3. {`Open up the integrated terminal in VSC using `}{`CTRL + \\``}{`. If you use a Mac, replace CTRL with CMD.`}
  4. \n
  5. {`Run the script below:`}
  6. \n
\n
{`deno run --allow-net --allow-read mod.ts\n`}
\n

{`The first time you run it, you may see a lot of files being loaded. This is preparing all the magic behind the scene. Once it is ready, you will see something like this:`}

\n

\n

{`Understanding What Discordeno Did`}

\n

{`Discordeno includes these commands/folders as they are essential for any discord bot to have in order to meet the Discord Bot Best Practices. It also adds a few things that will help make some things easier to build a bot.`}

\n

{`We will dive into these deeper in this guide. Let's take it step by step.`}

\n\n
;\n}\n\n;\nMDXContent.isMDXComponent = true;"}} \ No newline at end of file diff --git a/docs/.cache/caches/gatsby-plugin-mdx/diskstore-9e5f517f97f91e55a8c34695c20cf08f.json b/docs/.cache/caches/gatsby-plugin-mdx/diskstore-9e5f517f97f91e55a8c34695c20cf08f.json new file mode 100644 index 000000000..6d738c360 --- /dev/null +++ b/docs/.cache/caches/gatsby-plugin-mdx/diskstore-9e5f517f97f91e55a8c34695c20cf08f.json @@ -0,0 +1 @@ +{"expireTime":9007200851634067000,"key":"gatsby-plugin-mdx-entire-payload-c1751713d57aa40758c899e729453ffe-","val":{"mdast":{"type":"root","children":[{"type":"paragraph","children":[{"type":"text","value":"Woah! You are almost half way done with understanding all of Discordeno. Amazing isn't it? Something you may have noticed in the last section was there were some options that prevented some commands from running like ","position":{"start":{"line":2,"column":1,"offset":1},"end":{"line":2,"column":218,"offset":218},"indent":[]}},{"type":"inlineCode","value":"dmOnly","position":{"start":{"line":2,"column":218,"offset":218},"end":{"line":2,"column":226,"offset":226},"indent":[]}},{"type":"text","value":" or the permission options. we created a setting to prevent the monitor from running in certain channels. What if we wanted to do prevent commands from happening? How would we prevent commands from running?","position":{"start":{"line":2,"column":226,"offset":226},"end":{"line":2,"column":432,"offset":432},"indent":[]}}],"position":{"start":{"line":2,"column":1,"offset":1},"end":{"line":2,"column":432,"offset":432},"indent":[]}},{"type":"heading","depth":2,"children":[{"type":"text","value":"What is an Inhibitor?","position":{"start":{"line":4,"column":4,"offset":437},"end":{"line":4,"column":25,"offset":458},"indent":[]}}],"position":{"start":{"line":4,"column":1,"offset":434},"end":{"line":4,"column":25,"offset":458},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"An Inhibitor is very similar to how monitors work. A monitor runs on every message but an inhibitor runs on every command. Remember all those command options like cooldown, permissions, permissionLevel, nsfw, etc... Each and every one of these options has an inhibitor in that checks commands for these settings.","position":{"start":{"line":6,"column":1,"offset":460},"end":{"line":6,"column":313,"offset":772},"indent":[]}}],"position":{"start":{"line":6,"column":1,"offset":460},"end":{"line":6,"column":313,"offset":772},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"Let's create our own inhibitor that would prevent commands from being used if the user is not a VIP user.","position":{"start":{"line":8,"column":1,"offset":774},"end":{"line":8,"column":106,"offset":879},"indent":[]}}],"position":{"start":{"line":8,"column":1,"offset":774},"end":{"line":8,"column":106,"offset":879},"indent":[]}},{"type":"blockquote","children":[{"type":"paragraph","children":[{"type":"strong","children":[{"type":"text","value":"Note:","position":{"start":{"line":10,"column":5,"offset":885},"end":{"line":10,"column":10,"offset":890},"indent":[]}}],"position":{"start":{"line":10,"column":3,"offset":883},"end":{"line":10,"column":12,"offset":892},"indent":[]}},{"type":"text","value":" It is important to remember that everything below can be done with a simple permission level as well. We will create our own custom permission levels but for the purposes of this guide and to be able to learn about Inhibitors, we will be using an inhibitor.","position":{"start":{"line":10,"column":12,"offset":892},"end":{"line":10,"column":270,"offset":1150},"indent":[]}}],"position":{"start":{"line":10,"column":3,"offset":883},"end":{"line":10,"column":270,"offset":1150},"indent":[]}}],"position":{"start":{"line":10,"column":1,"offset":881},"end":{"line":10,"column":270,"offset":1150},"indent":[]}},{"type":"heading","depth":2,"children":[{"type":"text","value":"Creating the File","position":{"start":{"line":12,"column":4,"offset":1155},"end":{"line":12,"column":21,"offset":1172},"indent":[]}}],"position":{"start":{"line":12,"column":1,"offset":1152},"end":{"line":12,"column":21,"offset":1172},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"Let's start by creating a file inside the inhibitors folder called ","position":{"start":{"line":14,"column":1,"offset":1174},"end":{"line":14,"column":68,"offset":1241},"indent":[]}},{"type":"inlineCode","value":"boostRequired.ts","position":{"start":{"line":14,"column":68,"offset":1241},"end":{"line":14,"column":86,"offset":1259},"indent":[]}},{"type":"text","value":" and paste the following snippet of code:","position":{"start":{"line":14,"column":86,"offset":1259},"end":{"line":14,"column":127,"offset":1300},"indent":[]}}],"position":{"start":{"line":14,"column":1,"offset":1174},"end":{"line":14,"column":127,"offset":1300},"indent":[]}},{"type":"code","lang":"ts","meta":null,"value":"import { botCache } from \"../../mod.ts\";\n\nbotCache.inhibitors.set(\"inhibitorname\", async function (message, command, guild) {\n\t// Your code goes here\n});","position":{"start":{"line":16,"column":1,"offset":1302},"end":{"line":22,"column":4,"offset":1465},"indent":[1,1,1,1,1,1]}},{"type":"paragraph","children":[{"type":"text","value":"Inhibitors can take up to 3 arguments.","position":{"start":{"line":24,"column":1,"offset":1467},"end":{"line":24,"column":39,"offset":1505},"indent":[]}}],"position":{"start":{"line":24,"column":1,"offset":1467},"end":{"line":24,"column":39,"offset":1505},"indent":[]}},{"type":"list","ordered":false,"start":null,"spread":false,"children":[{"type":"listItem","spread":false,"checked":null,"children":[{"type":"paragraph","children":[{"type":"inlineCode","value":"message","position":{"start":{"line":26,"column":3,"offset":1509},"end":{"line":26,"column":12,"offset":1518},"indent":[]}},{"type":"text","value":": The message object that triggered the command.","position":{"start":{"line":26,"column":12,"offset":1518},"end":{"line":26,"column":60,"offset":1566},"indent":[]}}],"position":{"start":{"line":26,"column":3,"offset":1509},"end":{"line":26,"column":60,"offset":1566},"indent":[]}}],"position":{"start":{"line":26,"column":1,"offset":1507},"end":{"line":26,"column":60,"offset":1566},"indent":[]}},{"type":"listItem","spread":false,"checked":null,"children":[{"type":"paragraph","children":[{"type":"inlineCode","value":"command","position":{"start":{"line":27,"column":3,"offset":1569},"end":{"line":27,"column":12,"offset":1578},"indent":[]}},{"type":"text","value":": The command object itself that was triggered.","position":{"start":{"line":27,"column":12,"offset":1578},"end":{"line":27,"column":59,"offset":1625},"indent":[]}}],"position":{"start":{"line":27,"column":3,"offset":1569},"end":{"line":27,"column":59,"offset":1625},"indent":[]}}],"position":{"start":{"line":27,"column":1,"offset":1567},"end":{"line":27,"column":59,"offset":1625},"indent":[]}},{"type":"listItem","spread":false,"checked":null,"children":[{"type":"paragraph","children":[{"type":"inlineCode","value":"guild","position":{"start":{"line":28,"column":3,"offset":1628},"end":{"line":28,"column":10,"offset":1635},"indent":[]}},{"type":"text","value":": The server guild object where this command was ran.","position":{"start":{"line":28,"column":10,"offset":1635},"end":{"line":28,"column":63,"offset":1688},"indent":[]}}],"position":{"start":{"line":28,"column":3,"offset":1628},"end":{"line":28,"column":63,"offset":1688},"indent":[]}}],"position":{"start":{"line":28,"column":1,"offset":1626},"end":{"line":28,"column":63,"offset":1688},"indent":[]}}],"position":{"start":{"line":26,"column":1,"offset":1507},"end":{"line":28,"column":63,"offset":1688},"indent":[1,1]}},{"type":"heading","depth":2,"children":[{"type":"text","value":"Understanding How Inhibitors Function","position":{"start":{"line":30,"column":4,"offset":1693},"end":{"line":30,"column":41,"offset":1730},"indent":[]}}],"position":{"start":{"line":30,"column":1,"offset":1690},"end":{"line":30,"column":41,"offset":1730},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"To block a command you have to return a truthy value.","position":{"start":{"line":32,"column":1,"offset":1732},"end":{"line":32,"column":54,"offset":1785},"indent":[]}}],"position":{"start":{"line":32,"column":1,"offset":1732},"end":{"line":32,"column":54,"offset":1785},"indent":[]}},{"type":"list","ordered":false,"start":null,"spread":false,"children":[{"type":"listItem","spread":false,"checked":null,"children":[{"type":"paragraph","children":[{"type":"strong","children":[{"type":"text","value":"return true;","position":{"start":{"line":33,"column":5,"offset":1790},"end":{"line":33,"column":17,"offset":1802},"indent":[]}}],"position":{"start":{"line":33,"column":3,"offset":1788},"end":{"line":33,"column":19,"offset":1804},"indent":[]}},{"type":"text","value":" If you return true the inhibitor will block the execution of the command.\nTo allow a command return a falsey value.","position":{"start":{"line":33,"column":19,"offset":1804},"end":{"line":34,"column":42,"offset":1920},"indent":[1]}}],"position":{"start":{"line":33,"column":3,"offset":1788},"end":{"line":34,"column":42,"offset":1920},"indent":[1]}}],"position":{"start":{"line":33,"column":1,"offset":1786},"end":{"line":34,"column":42,"offset":1920},"indent":[1]}},{"type":"listItem","spread":false,"checked":null,"children":[{"type":"paragraph","children":[{"type":"strong","children":[{"type":"text","value":"return false;","position":{"start":{"line":35,"column":5,"offset":1925},"end":{"line":35,"column":18,"offset":1938},"indent":[]}}],"position":{"start":{"line":35,"column":3,"offset":1923},"end":{"line":35,"column":20,"offset":1940},"indent":[]}},{"type":"text","value":" If you return false the inhibitor will not block the error.","position":{"start":{"line":35,"column":20,"offset":1940},"end":{"line":35,"column":80,"offset":2000},"indent":[]}}],"position":{"start":{"line":35,"column":3,"offset":1923},"end":{"line":35,"column":80,"offset":2000},"indent":[]}}],"position":{"start":{"line":35,"column":1,"offset":1921},"end":{"line":35,"column":80,"offset":2000},"indent":[]}}],"position":{"start":{"line":33,"column":1,"offset":1786},"end":{"line":35,"column":80,"offset":2000},"indent":[1,1]}},{"type":"code","lang":"ts","meta":null,"value":"// If the command does not require a nitro boost we can allow this command to execute\nif (!command.boostRequired) return false;\n\n// Check if the user has boosted this server\nconst userIsVIP = message.member().roles.includes(nitroRoleID);\n// The user is VIP so we can allow this command to be used\nif (userIsVIP) return false;\n\n// The user is NOT VIP so we throw an error\nthrow `The ${command.name} is only allowed for VIP users.`","position":{"start":{"line":38,"column":1,"offset":2003},"end":{"line":49,"column":4,"offset":2442},"indent":[1,1,1,1,1,1,1,1,1,1,1]}},{"type":"export","value":"export const _frontmatter = {\"title\":\"Creating Inhibitors!\",\"metaTitle\":\"Creating An Inhibitor | Discordeno\",\"metaDescription\":\"Let's create our very own bot with Discordeno!\"}","position":{"start":{"line":52,"column":1,"offset":2445},"end":{"line":52,"column":177,"offset":2621},"indent":[]}}],"position":{"start":{"line":1,"column":1,"offset":0},"end":{"line":52,"column":177,"offset":2621}}},"scopeImports":["import * as React from 'react'"],"scopeIdentifiers":["React"],"body":"function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }\n\nfunction _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }\n\nfunction _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }\n\n/* @jsx mdx */\nvar _frontmatter = {\n \"title\": \"Creating Inhibitors!\",\n \"metaTitle\": \"Creating An Inhibitor | Discordeno\",\n \"metaDescription\": \"Let's create our very own bot with Discordeno!\"\n};\nvar layoutProps = {\n _frontmatter: _frontmatter\n};\nvar MDXLayout = \"wrapper\";\nreturn function MDXContent(_ref) {\n var components = _ref.components,\n props = _objectWithoutProperties(_ref, [\"components\"]);\n\n return mdx(MDXLayout, _extends({}, layoutProps, props, {\n components: components,\n mdxType: \"MDXLayout\"\n }), mdx(\"p\", null, \"Woah! You are almost half way done with understanding all of Discordeno. Amazing isn't it? Something you may have noticed in the last section was there were some options that prevented some commands from running like \", mdx(\"inlineCode\", {\n parentName: \"p\"\n }, \"dmOnly\"), \" or the permission options. we created a setting to prevent the monitor from running in certain channels. What if we wanted to do prevent commands from happening? How would we prevent commands from running?\"), mdx(\"h2\", null, \"What is an Inhibitor?\"), mdx(\"p\", null, \"An Inhibitor is very similar to how monitors work. A monitor runs on every message but an inhibitor runs on every command. Remember all those command options like cooldown, permissions, permissionLevel, nsfw, etc... Each and every one of these options has an inhibitor in that checks commands for these settings.\"), mdx(\"p\", null, \"Let's create our own inhibitor that would prevent commands from being used if the user is not a VIP user.\"), mdx(\"blockquote\", null, mdx(\"p\", {\n parentName: \"blockquote\"\n }, mdx(\"strong\", {\n parentName: \"p\"\n }, \"Note:\"), \" It is important to remember that everything below can be done with a simple permission level as well. We will create our own custom permission levels but for the purposes of this guide and to be able to learn about Inhibitors, we will be using an inhibitor.\")), mdx(\"h2\", null, \"Creating the File\"), mdx(\"p\", null, \"Let's start by creating a file inside the inhibitors folder called \", mdx(\"inlineCode\", {\n parentName: \"p\"\n }, \"boostRequired.ts\"), \" and paste the following snippet of code:\"), mdx(\"pre\", null, mdx(\"code\", _extends({\n parentName: \"pre\"\n }, {\n \"className\": \"language-ts\"\n }), \"import { botCache } from \\\"../../mod.ts\\\";\\n\\nbotCache.inhibitors.set(\\\"inhibitorname\\\", async function (message, command, guild) {\\n // Your code goes here\\n});\\n\")), mdx(\"p\", null, \"Inhibitors can take up to 3 arguments.\"), mdx(\"ul\", null, mdx(\"li\", {\n parentName: \"ul\"\n }, mdx(\"inlineCode\", {\n parentName: \"li\"\n }, \"message\"), \": The message object that triggered the command.\"), mdx(\"li\", {\n parentName: \"ul\"\n }, mdx(\"inlineCode\", {\n parentName: \"li\"\n }, \"command\"), \": The command object itself that was triggered.\"), mdx(\"li\", {\n parentName: \"ul\"\n }, mdx(\"inlineCode\", {\n parentName: \"li\"\n }, \"guild\"), \": The server guild object where this command was ran.\")), mdx(\"h2\", null, \"Understanding How Inhibitors Function\"), mdx(\"p\", null, \"To block a command you have to return a truthy value.\"), mdx(\"ul\", null, mdx(\"li\", {\n parentName: \"ul\"\n }, mdx(\"strong\", {\n parentName: \"li\"\n }, \"return true;\"), \" If you return true the inhibitor will block the execution of the command.\\nTo allow a command return a falsey value.\"), mdx(\"li\", {\n parentName: \"ul\"\n }, mdx(\"strong\", {\n parentName: \"li\"\n }, \"return false;\"), \" If you return false the inhibitor will not block the error.\")), mdx(\"pre\", null, mdx(\"code\", _extends({\n parentName: \"pre\"\n }, {\n \"className\": \"language-ts\"\n }), \"// If the command does not require a nitro boost we can allow this command to execute\\nif (!command.boostRequired) return false;\\n\\n// Check if the user has boosted this server\\nconst userIsVIP = message.member().roles.includes(nitroRoleID);\\n// The user is VIP so we can allow this command to be used\\nif (userIsVIP) return false;\\n\\n// The user is NOT VIP so we throw an error\\nthrow `The ${command.name} is only allowed for VIP users.`\\n\")));\n}\n;\nMDXContent.isMDXComponent = true;","rawMDXOutput":"/* @jsx mdx */\nimport { mdx } from '@mdx-js/react';\n/* @jsx mdx */\n\nexport const _frontmatter = {\n \"title\": \"Creating Inhibitors!\",\n \"metaTitle\": \"Creating An Inhibitor | Discordeno\",\n \"metaDescription\": \"Let's create our very own bot with Discordeno!\"\n};\n\nconst layoutProps = {\n _frontmatter\n};\nconst MDXLayout = \"wrapper\"\nexport default function MDXContent({\n components,\n ...props\n}) {\n return \n

{`Woah! You are almost half way done with understanding all of Discordeno. Amazing isn't it? Something you may have noticed in the last section was there were some options that prevented some commands from running like `}{`dmOnly`}{` or the permission options. we created a setting to prevent the monitor from running in certain channels. What if we wanted to do prevent commands from happening? How would we prevent commands from running?`}

\n

{`What is an Inhibitor?`}

\n

{`An Inhibitor is very similar to how monitors work. A monitor runs on every message but an inhibitor runs on every command. Remember all those command options like cooldown, permissions, permissionLevel, nsfw, etc... Each and every one of these options has an inhibitor in that checks commands for these settings.`}

\n

{`Let's create our own inhibitor that would prevent commands from being used if the user is not a VIP user.`}

\n
\n

{`Note:`}{` It is important to remember that everything below can be done with a simple permission level as well. We will create our own custom permission levels but for the purposes of this guide and to be able to learn about Inhibitors, we will be using an inhibitor.`}

\n
\n

{`Creating the File`}

\n

{`Let's start by creating a file inside the inhibitors folder called `}{`boostRequired.ts`}{` and paste the following snippet of code:`}

\n
{`import { botCache } from \"../../mod.ts\";\n\nbotCache.inhibitors.set(\"inhibitorname\", async function (message, command, guild) {\n    // Your code goes here\n});\n`}
\n

{`Inhibitors can take up to 3 arguments.`}

\n
    \n
  • {`message`}{`: The message object that triggered the command.`}
  • \n
  • {`command`}{`: The command object itself that was triggered.`}
  • \n
  • {`guild`}{`: The server guild object where this command was ran.`}
  • \n
\n

{`Understanding How Inhibitors Function`}

\n

{`To block a command you have to return a truthy value.`}

\n
    \n
  • {`return true;`}{` If you return true the inhibitor will block the execution of the command.\nTo allow a command return a falsey value.`}
  • \n
  • {`return false;`}{` If you return false the inhibitor will not block the error.`}
  • \n
\n
{`// If the command does not require a nitro boost we can allow this command to execute\nif (!command.boostRequired) return false;\n\n// Check if the user has boosted this server\nconst userIsVIP = message.member().roles.includes(nitroRoleID);\n// The user is VIP so we can allow this command to be used\nif (userIsVIP) return false;\n\n// The user is NOT VIP so we throw an error\nthrow \\`The \\${command.name} is only allowed for VIP users.\\`\n`}
\n\n
;\n}\n\n;\nMDXContent.isMDXComponent = true;"}} \ No newline at end of file diff --git a/docs/.cache/caches/gatsby-plugin-mdx/diskstore-9f86fa820e9fe16e1b2acba9bd5ea1df.json b/docs/.cache/caches/gatsby-plugin-mdx/diskstore-9f86fa820e9fe16e1b2acba9bd5ea1df.json new file mode 100644 index 000000000..1e94d5b78 --- /dev/null +++ b/docs/.cache/caches/gatsby-plugin-mdx/diskstore-9f86fa820e9fe16e1b2acba9bd5ea1df.json @@ -0,0 +1 @@ +{"expireTime":9007200851634481000,"key":"gatsby-plugin-mdx-entire-payload-ca5172a881054ab7c4d69dc3fc8730ab-","val":{"mdast":{"type":"root","children":[{"type":"paragraph","children":[{"type":"text","value":"Woah! You are almost half way done with understanding all of Discordeno. Amazing isn't it? Something you may have noticed in the last section was there were some options that prevented some commands from running like ","position":{"start":{"line":2,"column":1,"offset":1},"end":{"line":2,"column":218,"offset":218},"indent":[]}},{"type":"inlineCode","value":"dmOnly","position":{"start":{"line":2,"column":218,"offset":218},"end":{"line":2,"column":226,"offset":226},"indent":[]}},{"type":"text","value":" or the permission options. we created a setting to prevent the monitor from running in certain channels. What if we wanted to do prevent commands from happening? How would we prevent commands from running?","position":{"start":{"line":2,"column":226,"offset":226},"end":{"line":2,"column":432,"offset":432},"indent":[]}}],"position":{"start":{"line":2,"column":1,"offset":1},"end":{"line":2,"column":432,"offset":432},"indent":[]}},{"type":"heading","depth":2,"children":[{"type":"text","value":"What is an Inhibitor?","position":{"start":{"line":4,"column":4,"offset":437},"end":{"line":4,"column":25,"offset":458},"indent":[]}}],"position":{"start":{"line":4,"column":1,"offset":434},"end":{"line":4,"column":25,"offset":458},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"An Inhibitor is very similar to how monitors work. A monitor runs on every message but an inhibitor runs on every command. Remember all those command options like cooldown, permissions, permissionLevel, nsfw, etc... Each and every one of these options has an inhibitor in that checks commands for these settings.","position":{"start":{"line":6,"column":1,"offset":460},"end":{"line":6,"column":313,"offset":772},"indent":[]}}],"position":{"start":{"line":6,"column":1,"offset":460},"end":{"line":6,"column":313,"offset":772},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"Let's create our own inhibitor that would prevent commands from being used if the user is not a VIP user.","position":{"start":{"line":8,"column":1,"offset":774},"end":{"line":8,"column":106,"offset":879},"indent":[]}}],"position":{"start":{"line":8,"column":1,"offset":774},"end":{"line":8,"column":106,"offset":879},"indent":[]}},{"type":"blockquote","children":[{"type":"paragraph","children":[{"type":"strong","children":[{"type":"text","value":"Note:","position":{"start":{"line":10,"column":5,"offset":885},"end":{"line":10,"column":10,"offset":890},"indent":[]}}],"position":{"start":{"line":10,"column":3,"offset":883},"end":{"line":10,"column":12,"offset":892},"indent":[]}},{"type":"text","value":" It is important to remember that everything below can be done with a simple permission level as well. We will create our own custom permission levels but for the purposes of this guide and to be able to learn about Inhibitors, we will be using an inhibitor.","position":{"start":{"line":10,"column":12,"offset":892},"end":{"line":10,"column":270,"offset":1150},"indent":[]}}],"position":{"start":{"line":10,"column":3,"offset":883},"end":{"line":10,"column":270,"offset":1150},"indent":[]}}],"position":{"start":{"line":10,"column":1,"offset":881},"end":{"line":10,"column":270,"offset":1150},"indent":[]}},{"type":"heading","depth":2,"children":[{"type":"text","value":"Creating the File","position":{"start":{"line":12,"column":4,"offset":1155},"end":{"line":12,"column":21,"offset":1172},"indent":[]}}],"position":{"start":{"line":12,"column":1,"offset":1152},"end":{"line":12,"column":21,"offset":1172},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"Let's start by creating a file inside the inhibitors folder called ","position":{"start":{"line":14,"column":1,"offset":1174},"end":{"line":14,"column":68,"offset":1241},"indent":[]}},{"type":"inlineCode","value":"boosted.ts","position":{"start":{"line":14,"column":68,"offset":1241},"end":{"line":14,"column":80,"offset":1253},"indent":[]}},{"type":"text","value":" and paste the following snippet of code:","position":{"start":{"line":14,"column":80,"offset":1253},"end":{"line":14,"column":121,"offset":1294},"indent":[]}}],"position":{"start":{"line":14,"column":1,"offset":1174},"end":{"line":14,"column":121,"offset":1294},"indent":[]}},{"type":"code","lang":"ts","meta":null,"value":"import { botCache } from \"../../mod.ts\";\n\nbotCache.inhibitors.set(\"inhibitorname\", async function (message, command, guild) {\n\t// Your code goes here\n});","position":{"start":{"line":16,"column":1,"offset":1296},"end":{"line":22,"column":4,"offset":1459},"indent":[1,1,1,1,1,1]}},{"type":"paragraph","children":[{"type":"text","value":"Inhibitors can take up to 3 arguments.","position":{"start":{"line":24,"column":1,"offset":1461},"end":{"line":24,"column":39,"offset":1499},"indent":[]}}],"position":{"start":{"line":24,"column":1,"offset":1461},"end":{"line":24,"column":39,"offset":1499},"indent":[]}},{"type":"list","ordered":false,"start":null,"spread":false,"children":[{"type":"listItem","spread":false,"checked":null,"children":[{"type":"paragraph","children":[{"type":"inlineCode","value":"message","position":{"start":{"line":26,"column":3,"offset":1503},"end":{"line":26,"column":12,"offset":1512},"indent":[]}},{"type":"text","value":": The message object that triggered the command.","position":{"start":{"line":26,"column":12,"offset":1512},"end":{"line":26,"column":60,"offset":1560},"indent":[]}}],"position":{"start":{"line":26,"column":3,"offset":1503},"end":{"line":26,"column":60,"offset":1560},"indent":[]}}],"position":{"start":{"line":26,"column":1,"offset":1501},"end":{"line":26,"column":60,"offset":1560},"indent":[]}},{"type":"listItem","spread":false,"checked":null,"children":[{"type":"paragraph","children":[{"type":"inlineCode","value":"command","position":{"start":{"line":27,"column":3,"offset":1563},"end":{"line":27,"column":12,"offset":1572},"indent":[]}},{"type":"text","value":": The command object itself that was triggered.","position":{"start":{"line":27,"column":12,"offset":1572},"end":{"line":27,"column":59,"offset":1619},"indent":[]}}],"position":{"start":{"line":27,"column":3,"offset":1563},"end":{"line":27,"column":59,"offset":1619},"indent":[]}}],"position":{"start":{"line":27,"column":1,"offset":1561},"end":{"line":27,"column":59,"offset":1619},"indent":[]}},{"type":"listItem","spread":false,"checked":null,"children":[{"type":"paragraph","children":[{"type":"inlineCode","value":"guild","position":{"start":{"line":28,"column":3,"offset":1622},"end":{"line":28,"column":10,"offset":1629},"indent":[]}},{"type":"text","value":": The server guild object where this command was ran.","position":{"start":{"line":28,"column":10,"offset":1629},"end":{"line":28,"column":63,"offset":1682},"indent":[]}}],"position":{"start":{"line":28,"column":3,"offset":1622},"end":{"line":28,"column":63,"offset":1682},"indent":[]}}],"position":{"start":{"line":28,"column":1,"offset":1620},"end":{"line":28,"column":63,"offset":1682},"indent":[]}}],"position":{"start":{"line":26,"column":1,"offset":1501},"end":{"line":28,"column":63,"offset":1682},"indent":[1,1]}},{"type":"heading","depth":2,"children":[{"type":"text","value":"Understanding How Inhibitors Function","position":{"start":{"line":30,"column":4,"offset":1687},"end":{"line":30,"column":41,"offset":1724},"indent":[]}}],"position":{"start":{"line":30,"column":1,"offset":1684},"end":{"line":30,"column":41,"offset":1724},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"To block a command you have to return a truthy value.","position":{"start":{"line":32,"column":1,"offset":1726},"end":{"line":32,"column":54,"offset":1779},"indent":[]}}],"position":{"start":{"line":32,"column":1,"offset":1726},"end":{"line":32,"column":54,"offset":1779},"indent":[]}},{"type":"list","ordered":false,"start":null,"spread":false,"children":[{"type":"listItem","spread":false,"checked":null,"children":[{"type":"paragraph","children":[{"type":"strong","children":[{"type":"text","value":"return true;","position":{"start":{"line":33,"column":5,"offset":1784},"end":{"line":33,"column":17,"offset":1796},"indent":[]}}],"position":{"start":{"line":33,"column":3,"offset":1782},"end":{"line":33,"column":19,"offset":1798},"indent":[]}},{"type":"text","value":" If you return true the inhibitor will block the execution of the command.\nTo allow a command return a falsey value.","position":{"start":{"line":33,"column":19,"offset":1798},"end":{"line":34,"column":42,"offset":1914},"indent":[1]}}],"position":{"start":{"line":33,"column":3,"offset":1782},"end":{"line":34,"column":42,"offset":1914},"indent":[1]}}],"position":{"start":{"line":33,"column":1,"offset":1780},"end":{"line":34,"column":42,"offset":1914},"indent":[1]}},{"type":"listItem","spread":false,"checked":null,"children":[{"type":"paragraph","children":[{"type":"strong","children":[{"type":"text","value":"return false;","position":{"start":{"line":35,"column":5,"offset":1919},"end":{"line":35,"column":18,"offset":1932},"indent":[]}}],"position":{"start":{"line":35,"column":3,"offset":1917},"end":{"line":35,"column":20,"offset":1934},"indent":[]}},{"type":"text","value":" If you return false the inhibitor will not block the error.","position":{"start":{"line":35,"column":20,"offset":1934},"end":{"line":35,"column":80,"offset":1994},"indent":[]}}],"position":{"start":{"line":35,"column":3,"offset":1917},"end":{"line":35,"column":80,"offset":1994},"indent":[]}}],"position":{"start":{"line":35,"column":1,"offset":1915},"end":{"line":35,"column":80,"offset":1994},"indent":[]}}],"position":{"start":{"line":33,"column":1,"offset":1780},"end":{"line":35,"column":80,"offset":1994},"indent":[1,1]}},{"type":"code","lang":"ts","meta":null,"value":"// If the command is not VIP only we can allow this command to execute\nif (!command.vipOnly) return false;\n\n// The bot's support server\nconst guild = cache.guilds.get(configs.supportServerID);\n// If the command author is not in the server they won't have the vip role\nconst member = guild.members.get(message.author.id) || await getMember(guild.id, message.author.id);\n// Member doesn't exist so cancel the command\nif (!member) {\n\tsendResponse(message, `sorry, but you can not use this command until you become VIP. Close the `)\n\treturn true;\n}\n\n// If the user has the vip role on the support server given by patreon allow the command\nif (member.roles.includes(configs.patreonVIPRoleID)) return false;\n\n// Alert the user they don't have vip and can't use the command\nsendResponse(message, `sorry, but you can not use this command until you become a VIP. I'm sorry, Teal'c. We'll go to Disneyland next year. I promise.`)\n// Cancel the command since the user does not have vip\nreturn true;","position":{"start":{"line":38,"column":1,"offset":1997},"end":{"line":59,"column":4,"offset":2994},"indent":[1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1]}},{"type":"export","value":"export const _frontmatter = {\"title\":\"Creating Inhibitors!\",\"metaTitle\":\"Creating An Inhibitor | Discordeno\",\"metaDescription\":\"Let's create our very own bot with Discordeno!\"}","position":{"start":{"line":62,"column":1,"offset":2997},"end":{"line":62,"column":177,"offset":3173},"indent":[]}}],"position":{"start":{"line":1,"column":1,"offset":0},"end":{"line":62,"column":177,"offset":3173}}},"scopeImports":["import * as React from 'react'"],"scopeIdentifiers":["React"],"body":"function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }\n\nfunction _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }\n\nfunction _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }\n\n/* @jsx mdx */\nvar _frontmatter = {\n \"title\": \"Creating Inhibitors!\",\n \"metaTitle\": \"Creating An Inhibitor | Discordeno\",\n \"metaDescription\": \"Let's create our very own bot with Discordeno!\"\n};\nvar layoutProps = {\n _frontmatter: _frontmatter\n};\nvar MDXLayout = \"wrapper\";\nreturn function MDXContent(_ref) {\n var components = _ref.components,\n props = _objectWithoutProperties(_ref, [\"components\"]);\n\n return mdx(MDXLayout, _extends({}, layoutProps, props, {\n components: components,\n mdxType: \"MDXLayout\"\n }), mdx(\"p\", null, \"Woah! You are almost half way done with understanding all of Discordeno. Amazing isn't it? Something you may have noticed in the last section was there were some options that prevented some commands from running like \", mdx(\"inlineCode\", {\n parentName: \"p\"\n }, \"dmOnly\"), \" or the permission options. we created a setting to prevent the monitor from running in certain channels. What if we wanted to do prevent commands from happening? How would we prevent commands from running?\"), mdx(\"h2\", null, \"What is an Inhibitor?\"), mdx(\"p\", null, \"An Inhibitor is very similar to how monitors work. A monitor runs on every message but an inhibitor runs on every command. Remember all those command options like cooldown, permissions, permissionLevel, nsfw, etc... Each and every one of these options has an inhibitor in that checks commands for these settings.\"), mdx(\"p\", null, \"Let's create our own inhibitor that would prevent commands from being used if the user is not a VIP user.\"), mdx(\"blockquote\", null, mdx(\"p\", {\n parentName: \"blockquote\"\n }, mdx(\"strong\", {\n parentName: \"p\"\n }, \"Note:\"), \" It is important to remember that everything below can be done with a simple permission level as well. We will create our own custom permission levels but for the purposes of this guide and to be able to learn about Inhibitors, we will be using an inhibitor.\")), mdx(\"h2\", null, \"Creating the File\"), mdx(\"p\", null, \"Let's start by creating a file inside the inhibitors folder called \", mdx(\"inlineCode\", {\n parentName: \"p\"\n }, \"boosted.ts\"), \" and paste the following snippet of code:\"), mdx(\"pre\", null, mdx(\"code\", _extends({\n parentName: \"pre\"\n }, {\n \"className\": \"language-ts\"\n }), \"import { botCache } from \\\"../../mod.ts\\\";\\n\\nbotCache.inhibitors.set(\\\"inhibitorname\\\", async function (message, command, guild) {\\n // Your code goes here\\n});\\n\")), mdx(\"p\", null, \"Inhibitors can take up to 3 arguments.\"), mdx(\"ul\", null, mdx(\"li\", {\n parentName: \"ul\"\n }, mdx(\"inlineCode\", {\n parentName: \"li\"\n }, \"message\"), \": The message object that triggered the command.\"), mdx(\"li\", {\n parentName: \"ul\"\n }, mdx(\"inlineCode\", {\n parentName: \"li\"\n }, \"command\"), \": The command object itself that was triggered.\"), mdx(\"li\", {\n parentName: \"ul\"\n }, mdx(\"inlineCode\", {\n parentName: \"li\"\n }, \"guild\"), \": The server guild object where this command was ran.\")), mdx(\"h2\", null, \"Understanding How Inhibitors Function\"), mdx(\"p\", null, \"To block a command you have to return a truthy value.\"), mdx(\"ul\", null, mdx(\"li\", {\n parentName: \"ul\"\n }, mdx(\"strong\", {\n parentName: \"li\"\n }, \"return true;\"), \" If you return true the inhibitor will block the execution of the command.\\nTo allow a command return a falsey value.\"), mdx(\"li\", {\n parentName: \"ul\"\n }, mdx(\"strong\", {\n parentName: \"li\"\n }, \"return false;\"), \" If you return false the inhibitor will not block the error.\")), mdx(\"pre\", null, mdx(\"code\", _extends({\n parentName: \"pre\"\n }, {\n \"className\": \"language-ts\"\n }), \"// If the command is not VIP only we can allow this command to execute\\nif (!command.vipOnly) return false;\\n\\n// The bot's support server\\nconst guild = cache.guilds.get(configs.supportServerID);\\n// If the command author is not in the server they won't have the vip role\\nconst member = guild.members.get(message.author.id) || await getMember(guild.id, message.author.id);\\n// Member doesn't exist so cancel the command\\nif (!member) {\\n sendResponse(message, `sorry, but you can not use this command until you become VIP. Close the `)\\n return true;\\n}\\n\\n// If the user has the vip role on the support server given by patreon allow the command\\nif (member.roles.includes(configs.patreonVIPRoleID)) return false;\\n\\n// Alert the user they don't have vip and can't use the command\\nsendResponse(message, `sorry, but you can not use this command until you become a VIP. I'm sorry, Teal'c. We'll go to Disneyland next year. I promise.`)\\n// Cancel the command since the user does not have vip\\nreturn true;\\n\")));\n}\n;\nMDXContent.isMDXComponent = true;","rawMDXOutput":"/* @jsx mdx */\nimport { mdx } from '@mdx-js/react';\n/* @jsx mdx */\n\nexport const _frontmatter = {\n \"title\": \"Creating Inhibitors!\",\n \"metaTitle\": \"Creating An Inhibitor | Discordeno\",\n \"metaDescription\": \"Let's create our very own bot with Discordeno!\"\n};\n\nconst layoutProps = {\n _frontmatter\n};\nconst MDXLayout = \"wrapper\"\nexport default function MDXContent({\n components,\n ...props\n}) {\n return \n

{`Woah! You are almost half way done with understanding all of Discordeno. Amazing isn't it? Something you may have noticed in the last section was there were some options that prevented some commands from running like `}{`dmOnly`}{` or the permission options. we created a setting to prevent the monitor from running in certain channels. What if we wanted to do prevent commands from happening? How would we prevent commands from running?`}

\n

{`What is an Inhibitor?`}

\n

{`An Inhibitor is very similar to how monitors work. A monitor runs on every message but an inhibitor runs on every command. Remember all those command options like cooldown, permissions, permissionLevel, nsfw, etc... Each and every one of these options has an inhibitor in that checks commands for these settings.`}

\n

{`Let's create our own inhibitor that would prevent commands from being used if the user is not a VIP user.`}

\n
\n

{`Note:`}{` It is important to remember that everything below can be done with a simple permission level as well. We will create our own custom permission levels but for the purposes of this guide and to be able to learn about Inhibitors, we will be using an inhibitor.`}

\n
\n

{`Creating the File`}

\n

{`Let's start by creating a file inside the inhibitors folder called `}{`boosted.ts`}{` and paste the following snippet of code:`}

\n
{`import { botCache } from \"../../mod.ts\";\n\nbotCache.inhibitors.set(\"inhibitorname\", async function (message, command, guild) {\n    // Your code goes here\n});\n`}
\n

{`Inhibitors can take up to 3 arguments.`}

\n
    \n
  • {`message`}{`: The message object that triggered the command.`}
  • \n
  • {`command`}{`: The command object itself that was triggered.`}
  • \n
  • {`guild`}{`: The server guild object where this command was ran.`}
  • \n
\n

{`Understanding How Inhibitors Function`}

\n

{`To block a command you have to return a truthy value.`}

\n
    \n
  • {`return true;`}{` If you return true the inhibitor will block the execution of the command.\nTo allow a command return a falsey value.`}
  • \n
  • {`return false;`}{` If you return false the inhibitor will not block the error.`}
  • \n
\n
{`// If the command is not VIP only we can allow this command to execute\nif (!command.vipOnly) return false;\n\n// The bot's support server\nconst guild = cache.guilds.get(configs.supportServerID);\n// If the command author is not in the server they won't have the vip role\nconst member = guild.members.get(message.author.id) || await getMember(guild.id, message.author.id);\n// Member doesn't exist so cancel the command\nif (!member) {\n    sendResponse(message, \\`sorry, but you can not use this command until you become VIP. Close the \\`)\n    return true;\n}\n\n// If the user has the vip role on the support server given by patreon allow the command\nif (member.roles.includes(configs.patreonVIPRoleID)) return false;\n\n// Alert the user they don't have vip and can't use the command\nsendResponse(message, \\`sorry, but you can not use this command until you become a VIP. I'm sorry, Teal'c. We'll go to Disneyland next year. I promise.\\`)\n// Cancel the command since the user does not have vip\nreturn true;\n`}
\n\n
;\n}\n\n;\nMDXContent.isMDXComponent = true;"}} \ No newline at end of file diff --git a/docs/.cache/caches/gatsby-plugin-mdx/diskstore-9fc0886cdfbc8148f6c87f4be64d39cb.json b/docs/.cache/caches/gatsby-plugin-mdx/diskstore-9fc0886cdfbc8148f6c87f4be64d39cb.json new file mode 100644 index 000000000..a62b73b2a --- /dev/null +++ b/docs/.cache/caches/gatsby-plugin-mdx/diskstore-9fc0886cdfbc8148f6c87f4be64d39cb.json @@ -0,0 +1 @@ +{"expireTime":9007200851596121000,"key":"gatsby-plugin-mdx-entire-payload-18bd325af19234e10c9a0235cea57ca0-","val":{"mdast":{"type":"root","children":[{"type":"heading","depth":2,"children":[{"type":"text","value":"Getting Started","position":{"start":{"line":2,"column":4,"offset":4},"end":{"line":2,"column":19,"offset":19},"indent":[]}}],"position":{"start":{"line":2,"column":1,"offset":1},"end":{"line":2,"column":19,"offset":19},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"Discordeno aims for a simple, easy and stress-free interaction with the Discord API. Always supporting the latest version to ensure stability, consistency and the best developer experience.","position":{"start":{"line":4,"column":1,"offset":21},"end":{"line":4,"column":190,"offset":210},"indent":[]}}],"position":{"start":{"line":4,"column":1,"offset":21},"end":{"line":4,"column":190,"offset":210},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"This website serves as the purpose for introducing Discordeno to developers. The full documentation for all the functions and methods can be visited by clicking the link below:","position":{"start":{"line":6,"column":1,"offset":212},"end":{"line":6,"column":177,"offset":388},"indent":[]}}],"position":{"start":{"line":6,"column":1,"offset":212},"end":{"line":6,"column":177,"offset":388},"indent":[]}},{"type":"paragraph","children":[{"type":"link","title":null,"url":"https://doc.deno.land/https/deno.land/x/discordeno/mod.ts","children":[{"type":"text","value":"View Documentation on Deno","position":{"start":{"line":8,"column":2,"offset":391},"end":{"line":8,"column":28,"offset":417},"indent":[]}}],"position":{"start":{"line":8,"column":1,"offset":390},"end":{"line":8,"column":88,"offset":477},"indent":[]}}],"position":{"start":{"line":8,"column":1,"offset":390},"end":{"line":8,"column":88,"offset":477},"indent":[]}},{"type":"heading","depth":2,"children":[{"type":"text","value":"Useful Links","position":{"start":{"line":10,"column":4,"offset":482},"end":{"line":10,"column":16,"offset":494},"indent":[]}}],"position":{"start":{"line":10,"column":1,"offset":479},"end":{"line":10,"column":16,"offset":494},"indent":[]}},{"type":"list","ordered":false,"start":null,"spread":false,"children":[{"type":"listItem","spread":false,"checked":null,"children":[{"type":"paragraph","children":[{"type":"link","title":null,"url":"https://github.com/Skillz4Killz/Discordeno","children":[{"type":"text","value":"GitHub Repository","position":{"start":{"line":11,"column":4,"offset":498},"end":{"line":11,"column":21,"offset":515},"indent":[]}}],"position":{"start":{"line":11,"column":3,"offset":497},"end":{"line":11,"column":66,"offset":560},"indent":[]}}],"position":{"start":{"line":11,"column":3,"offset":497},"end":{"line":11,"column":66,"offset":560},"indent":[]}}],"position":{"start":{"line":11,"column":1,"offset":495},"end":{"line":11,"column":66,"offset":560},"indent":[]}},{"type":"listItem","spread":false,"checked":null,"children":[{"type":"paragraph","children":[{"type":"link","title":null,"url":"https://deno.land/x/discordeno","children":[{"type":"text","value":"Deno Page","position":{"start":{"line":12,"column":4,"offset":564},"end":{"line":12,"column":13,"offset":573},"indent":[]}}],"position":{"start":{"line":12,"column":3,"offset":563},"end":{"line":12,"column":46,"offset":606},"indent":[]}}],"position":{"start":{"line":12,"column":3,"offset":563},"end":{"line":12,"column":46,"offset":606},"indent":[]}}],"position":{"start":{"line":12,"column":1,"offset":561},"end":{"line":12,"column":46,"offset":606},"indent":[]}},{"type":"listItem","spread":false,"checked":null,"children":[{"type":"paragraph","children":[{"type":"link","title":null,"url":"https://discordeno.js.org/","children":[{"type":"text","value":"Website","position":{"start":{"line":13,"column":4,"offset":610},"end":{"line":13,"column":11,"offset":617},"indent":[]}}],"position":{"start":{"line":13,"column":3,"offset":609},"end":{"line":13,"column":40,"offset":646},"indent":[]}}],"position":{"start":{"line":13,"column":3,"offset":609},"end":{"line":13,"column":40,"offset":646},"indent":[]}}],"position":{"start":{"line":13,"column":1,"offset":607},"end":{"line":13,"column":40,"offset":646},"indent":[]}}],"position":{"start":{"line":11,"column":1,"offset":495},"end":{"line":13,"column":40,"offset":646},"indent":[1,1]}},{"type":"heading","depth":2,"children":[{"type":"text","value":"Requirements","position":{"start":{"line":15,"column":4,"offset":651},"end":{"line":15,"column":16,"offset":663},"indent":[]}}],"position":{"start":{"line":15,"column":1,"offset":648},"end":{"line":15,"column":16,"offset":663},"indent":[]}},{"type":"list","ordered":false,"start":null,"spread":false,"children":[{"type":"listItem","spread":false,"checked":null,"children":[{"type":"paragraph","children":[{"type":"strong","children":[{"type":"text","value":"Deno 1.0","position":{"start":{"line":17,"column":5,"offset":669},"end":{"line":17,"column":13,"offset":677},"indent":[]}}],"position":{"start":{"line":17,"column":3,"offset":667},"end":{"line":17,"column":15,"offset":679},"indent":[]}},{"type":"text","value":" or higher","position":{"start":{"line":17,"column":15,"offset":679},"end":{"line":17,"column":25,"offset":689},"indent":[]}}],"position":{"start":{"line":17,"column":3,"offset":667},"end":{"line":17,"column":25,"offset":689},"indent":[]}}],"position":{"start":{"line":17,"column":1,"offset":665},"end":{"line":17,"column":25,"offset":689},"indent":[]}}],"position":{"start":{"line":17,"column":1,"offset":665},"end":{"line":17,"column":25,"offset":689},"indent":[]}},{"type":"heading","depth":2,"children":[{"type":"text","value":"Creating your First Discord Bot Application","position":{"start":{"line":19,"column":4,"offset":694},"end":{"line":19,"column":47,"offset":737},"indent":[]}}],"position":{"start":{"line":19,"column":1,"offset":691},"end":{"line":19,"column":47,"offset":737},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"Plenty of guides are available on how to create a Discord Bot Application.","position":{"start":{"line":21,"column":1,"offset":739},"end":{"line":21,"column":75,"offset":813},"indent":[]}}],"position":{"start":{"line":21,"column":1,"offset":739},"end":{"line":21,"column":75,"offset":813},"indent":[]}},{"type":"list","ordered":true,"start":1,"spread":false,"children":[{"type":"listItem","spread":false,"checked":null,"children":[{"type":"paragraph","children":[{"type":"link","title":null,"url":"https://discord.com/developers/applications","children":[{"type":"text","value":"Creating an Application","position":{"start":{"line":23,"column":5,"offset":819},"end":{"line":23,"column":28,"offset":842},"indent":[]}}],"position":{"start":{"line":23,"column":4,"offset":818},"end":{"line":23,"column":74,"offset":888},"indent":[]}},{"type":"text","value":" on the Developer Portal, name something cool and pick a sweet icon!","position":{"start":{"line":23,"column":74,"offset":888},"end":{"line":23,"column":142,"offset":956},"indent":[]}}],"position":{"start":{"line":23,"column":4,"offset":818},"end":{"line":23,"column":142,"offset":956},"indent":[]}}],"position":{"start":{"line":23,"column":1,"offset":815},"end":{"line":23,"column":142,"offset":956},"indent":[]}},{"type":"listItem","spread":false,"checked":null,"children":[{"type":"paragraph","children":[{"type":"text","value":"After creating an application. Save the ","position":{"start":{"line":24,"column":4,"offset":960},"end":{"line":24,"column":44,"offset":1000},"indent":[]}},{"type":"strong","children":[{"type":"text","value":"Client ID.","position":{"start":{"line":24,"column":46,"offset":1002},"end":{"line":24,"column":56,"offset":1012},"indent":[]}}],"position":{"start":{"line":24,"column":44,"offset":1000},"end":{"line":24,"column":58,"offset":1014},"indent":[]}},{"type":"text","value":" Thats the unique identifier for a Discord Bot.","position":{"start":{"line":24,"column":58,"offset":1014},"end":{"line":24,"column":105,"offset":1061},"indent":[]}}],"position":{"start":{"line":24,"column":4,"offset":960},"end":{"line":24,"column":105,"offset":1061},"indent":[]}}],"position":{"start":{"line":24,"column":1,"offset":957},"end":{"line":24,"column":105,"offset":1061},"indent":[]}},{"type":"listItem","spread":false,"checked":null,"children":[{"type":"paragraph","children":[{"type":"text","value":"Now, go and create a bot by clicking the ","position":{"start":{"line":25,"column":4,"offset":1065},"end":{"line":25,"column":45,"offset":1106},"indent":[]}},{"type":"strong","children":[{"type":"text","value":"Bot","position":{"start":{"line":25,"column":47,"offset":1108},"end":{"line":25,"column":50,"offset":1111},"indent":[]}}],"position":{"start":{"line":25,"column":45,"offset":1106},"end":{"line":25,"column":52,"offset":1113},"indent":[]}},{"type":"text","value":" tab. You will see a ","position":{"start":{"line":25,"column":52,"offset":1113},"end":{"line":25,"column":73,"offset":1134},"indent":[]}},{"type":"strong","children":[{"type":"text","value":"Token","position":{"start":{"line":25,"column":75,"offset":1136},"end":{"line":25,"column":80,"offset":1141},"indent":[]}}],"position":{"start":{"line":25,"column":73,"offset":1134},"end":{"line":25,"column":82,"offset":1143},"indent":[]}},{"type":"text","value":" section and thats the Discord Bot's token. ","position":{"start":{"line":25,"column":82,"offset":1143},"end":{"line":25,"column":126,"offset":1187},"indent":[]}},{"type":"strong","children":[{"type":"text","value":"Make sure you don't share that token with anyone!!!","position":{"start":{"line":25,"column":128,"offset":1189},"end":{"line":25,"column":179,"offset":1240},"indent":[]}}],"position":{"start":{"line":25,"column":126,"offset":1187},"end":{"line":25,"column":181,"offset":1242},"indent":[]}}],"position":{"start":{"line":25,"column":4,"offset":1065},"end":{"line":25,"column":181,"offset":1242},"indent":[]}}],"position":{"start":{"line":25,"column":1,"offset":1062},"end":{"line":25,"column":181,"offset":1242},"indent":[]}},{"type":"listItem","spread":false,"checked":null,"children":[{"type":"paragraph","children":[{"type":"text","value":"Invite the bot to the server, you can use the ","position":{"start":{"line":26,"column":4,"offset":1246},"end":{"line":26,"column":50,"offset":1292},"indent":[]}},{"type":"strong","children":[{"type":"link","title":null,"url":"https://discordapi.com/permissions.html#0","children":[{"type":"text","value":"Discord Permissions Calculator","position":{"start":{"line":26,"column":53,"offset":1295},"end":{"line":26,"column":83,"offset":1325},"indent":[]}}],"position":{"start":{"line":26,"column":52,"offset":1294},"end":{"line":26,"column":127,"offset":1369},"indent":[]}}],"position":{"start":{"line":26,"column":50,"offset":1292},"end":{"line":26,"column":129,"offset":1371},"indent":[]}},{"type":"text","value":" for creating the invite link with custom permissions. By default, ","position":{"start":{"line":26,"column":129,"offset":1371},"end":{"line":26,"column":196,"offset":1438},"indent":[]}},{"type":"inlineCode","value":"0","position":{"start":{"line":26,"column":196,"offset":1438},"end":{"line":26,"column":199,"offset":1441},"indent":[]}},{"type":"text","value":" means no permissions and ","position":{"start":{"line":26,"column":199,"offset":1441},"end":{"line":26,"column":225,"offset":1467},"indent":[]}},{"type":"inlineCode","value":"8","position":{"start":{"line":26,"column":225,"offset":1467},"end":{"line":26,"column":228,"offset":1470},"indent":[]}},{"type":"text","value":" means Administrator.","position":{"start":{"line":26,"column":228,"offset":1470},"end":{"line":26,"column":249,"offset":1491},"indent":[]}}],"position":{"start":{"line":26,"column":4,"offset":1246},"end":{"line":26,"column":249,"offset":1491},"indent":[]}}],"position":{"start":{"line":26,"column":1,"offset":1243},"end":{"line":26,"column":249,"offset":1491},"indent":[]}}],"position":{"start":{"line":23,"column":1,"offset":815},"end":{"line":26,"column":249,"offset":1491},"indent":[1,1,1]}},{"type":"paragraph","children":[{"type":"text","value":"Now you've created an Application but it will need some code in order for it to be online. Thats when Discordeno comes in handy!","position":{"start":{"line":28,"column":1,"offset":1493},"end":{"line":28,"column":129,"offset":1621},"indent":[]}}],"position":{"start":{"line":28,"column":1,"offset":1493},"end":{"line":28,"column":129,"offset":1621},"indent":[]}},{"type":"blockquote","children":[{"type":"paragraph","children":[{"type":"text","value":"Make sure you store your tokens in a file that is NOT deployed by adding it to the .gitignore file. ","position":{"start":{"line":30,"column":3,"offset":1625},"end":{"line":30,"column":103,"offset":1725},"indent":[]}},{"type":"strong","children":[{"type":"text","value":"Don't share your bot token with anybody.","position":{"start":{"line":30,"column":105,"offset":1727},"end":{"line":30,"column":145,"offset":1767},"indent":[]}}],"position":{"start":{"line":30,"column":103,"offset":1725},"end":{"line":30,"column":147,"offset":1769},"indent":[]}}],"position":{"start":{"line":30,"column":3,"offset":1625},"end":{"line":30,"column":147,"offset":1769},"indent":[]}}],"position":{"start":{"line":30,"column":1,"offset":1623},"end":{"line":30,"column":147,"offset":1769},"indent":[]}},{"type":"heading","depth":2,"children":[{"type":"text","value":"Installation","position":{"start":{"line":32,"column":4,"offset":1774},"end":{"line":32,"column":16,"offset":1786},"indent":[]}}],"position":{"start":{"line":32,"column":1,"offset":1771},"end":{"line":32,"column":16,"offset":1786},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"You can install Discordeno by importing:","position":{"start":{"line":34,"column":1,"offset":1788},"end":{"line":34,"column":41,"offset":1828},"indent":[]}}],"position":{"start":{"line":34,"column":1,"offset":1788},"end":{"line":34,"column":41,"offset":1828},"indent":[]}},{"type":"code","lang":"ts","meta":null,"value":"import Client from \"https://raw.githubusercontent.com/Skillz4Killz/Discordeno/v7/src/module/client.ts\";","position":{"start":{"line":35,"column":1,"offset":1829},"end":{"line":37,"column":4,"offset":1942},"indent":[1,1]}},{"type":"heading","depth":2,"children":[{"type":"text","value":"Example Usage","position":{"start":{"line":39,"column":4,"offset":1947},"end":{"line":39,"column":17,"offset":1960},"indent":[]}}],"position":{"start":{"line":39,"column":1,"offset":1944},"end":{"line":39,"column":17,"offset":1960},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"Starting with Discordeno is very simple, you can start from scratch without any boilerplates/frameworks: Add this snippet of code into a new TypeScript file:","position":{"start":{"line":41,"column":1,"offset":1962},"end":{"line":41,"column":158,"offset":2119},"indent":[]}}],"position":{"start":{"line":41,"column":1,"offset":1962},"end":{"line":41,"column":158,"offset":2119},"indent":[]}},{"type":"code","lang":"ts","meta":null,"value":"import Client from \"https://raw.githubusercontent.com/Skillz4Killz/Discordeno/v7/src/module/client.ts\";\nimport { sendMessage } from \"https://raw.githubusercontent.com/Skillz4Killz/Discordeno/v7/src/handlers/channel.ts\";\nimport { Intents } from \"https://raw.githubusercontent.com/Skillz4Killz/Discordeno/v7/src/types/options.ts\";\nimport config from \"./config.ts\";\n\nClient({\n token: config.token,\n intents: [Intents.GUILD_MESSAGES, Intents.GUILDS],\n eventHandlers: {\n ready: () => {\n console.log(`Logged!`);\n },\n messageCreate: (message) => {\n if (message.content === \"!ping\") {\n sendMessage(message.channel, \"Pong\");\n }\n }\n }\n});","position":{"start":{"line":43,"column":1,"offset":2121},"end":{"line":63,"column":4,"offset":2847},"indent":[1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1]}},{"type":"paragraph","children":[{"type":"text","value":"Alternatively, you can use boilerplate template repositories that were created by wonderful developers. This will get the base of your bot pre-built for you. Overtime, developers create other command frameworks for this library and they will be listed here:","position":{"start":{"line":65,"column":1,"offset":2849},"end":{"line":65,"column":258,"offset":3106},"indent":[]}}],"position":{"start":{"line":65,"column":1,"offset":2849},"end":{"line":65,"column":258,"offset":3106},"indent":[]}},{"type":"table","align":[null,null,null,null],"children":[{"type":"tableRow","children":[{"type":"tableCell","children":[{"type":"text","value":"Bot Name","position":{"start":{"line":67,"column":3,"offset":3110},"end":{"line":67,"column":11,"offset":3118},"indent":[]}}],"position":{"start":{"line":67,"column":3,"offset":3110},"end":{"line":67,"column":23,"offset":3130},"indent":[]}},{"type":"tableCell","children":[{"type":"text","value":"Developer","position":{"start":{"line":67,"column":26,"offset":3133},"end":{"line":67,"column":35,"offset":3142},"indent":[]}}],"position":{"start":{"line":67,"column":26,"offset":3133},"end":{"line":67,"column":43,"offset":3150},"indent":[]}},{"type":"tableCell","children":[{"type":"text","value":"Links","position":{"start":{"line":67,"column":46,"offset":3153},"end":{"line":67,"column":51,"offset":3158},"indent":[]}}],"position":{"start":{"line":67,"column":46,"offset":3153},"end":{"line":67,"column":157,"offset":3264},"indent":[]}},{"type":"tableCell","children":[{"type":"text","value":"Description","position":{"start":{"line":67,"column":160,"offset":3267},"end":{"line":67,"column":171,"offset":3278},"indent":[]}}],"position":{"start":{"line":67,"column":160,"offset":3267},"end":{"line":67,"column":245,"offset":3352},"indent":[]}}],"position":{"start":{"line":67,"column":1,"offset":3108},"end":{"line":67,"column":247,"offset":3354},"indent":[]}},{"type":"tableRow","children":[{"type":"tableCell","children":[{"type":"text","value":"Official Boilerplate","position":{"start":{"line":69,"column":3,"offset":3604},"end":{"line":69,"column":23,"offset":3624},"indent":[]}}],"position":{"start":{"line":69,"column":3,"offset":3604},"end":{"line":69,"column":23,"offset":3624},"indent":[]}},{"type":"tableCell","children":[{"type":"text","value":"Skillz4Killz#4500","position":{"start":{"line":69,"column":26,"offset":3627},"end":{"line":69,"column":43,"offset":3644},"indent":[]}}],"position":{"start":{"line":69,"column":26,"offset":3627},"end":{"line":69,"column":43,"offset":3644},"indent":[]}},{"type":"tableCell","children":[{"type":"link","title":null,"url":"https://github.com/Skillz4Killz/Discordeno-bot-template","children":[{"type":"text","value":"GitHub","position":{"start":{"line":69,"column":47,"offset":3648},"end":{"line":69,"column":53,"offset":3654},"indent":[]}}],"position":{"start":{"line":69,"column":46,"offset":3647},"end":{"line":69,"column":111,"offset":3712},"indent":[]}},{"type":"text","value":", ","position":{"start":{"line":69,"column":111,"offset":3712},"end":{"line":69,"column":113,"offset":3714},"indent":[]}},{"type":"link","title":null,"url":"https://discord.gg/J4NqJ72","children":[{"type":"text","value":"Support Server","position":{"start":{"line":69,"column":114,"offset":3715},"end":{"line":69,"column":128,"offset":3729},"indent":[]}}],"position":{"start":{"line":69,"column":113,"offset":3714},"end":{"line":69,"column":157,"offset":3758},"indent":[]}}],"position":{"start":{"line":69,"column":46,"offset":3647},"end":{"line":69,"column":157,"offset":3758},"indent":[]}},{"type":"tableCell","children":[{"type":"text","value":"This is a very minimalistic design for a boilerplate for your bot to get you started.","position":{"start":{"line":69,"column":160,"offset":3761},"end":{"line":69,"column":245,"offset":3846},"indent":[]}}],"position":{"start":{"line":69,"column":160,"offset":3761},"end":{"line":69,"column":245,"offset":3846},"indent":[]}}],"position":{"start":{"line":69,"column":1,"offset":3602},"end":{"line":69,"column":247,"offset":3848},"indent":[]}},{"type":"tableRow","children":[{"type":"tableCell","children":[{"type":"text","value":"DenoBot","position":{"start":{"line":70,"column":3,"offset":3851},"end":{"line":70,"column":10,"offset":3858},"indent":[]}}],"position":{"start":{"line":70,"column":3,"offset":3851},"end":{"line":70,"column":23,"offset":3871},"indent":[]}},{"type":"tableCell","children":[{"type":"text","value":"NTM Nathan#0001","position":{"start":{"line":70,"column":26,"offset":3874},"end":{"line":70,"column":41,"offset":3889},"indent":[]}}],"position":{"start":{"line":70,"column":26,"offset":3874},"end":{"line":70,"column":43,"offset":3891},"indent":[]}},{"type":"tableCell","children":[{"type":"link","title":null,"url":"https://github.com/ntm-development/DenoBot","children":[{"type":"text","value":"GitHub","position":{"start":{"line":70,"column":47,"offset":3895},"end":{"line":70,"column":53,"offset":3901},"indent":[]}}],"position":{"start":{"line":70,"column":46,"offset":3894},"end":{"line":70,"column":98,"offset":3946},"indent":[]}},{"type":"text","value":", ","position":{"start":{"line":70,"column":98,"offset":3946},"end":{"line":70,"column":100,"offset":3948},"indent":[]}},{"type":"link","title":null,"url":"https://discord.com/invite/G2rb53z","children":[{"type":"text","value":"Support Server","position":{"start":{"line":70,"column":101,"offset":3949},"end":{"line":70,"column":115,"offset":3963},"indent":[]}}],"position":{"start":{"line":70,"column":100,"offset":3948},"end":{"line":70,"column":152,"offset":4000},"indent":[]}}],"position":{"start":{"line":70,"column":46,"offset":3894},"end":{"line":70,"column":157,"offset":4005},"indent":[]}},{"type":"tableCell","children":[{"type":"text","value":"Another boilerplate example of the first one, with more commands and improvements.","position":{"start":{"line":70,"column":160,"offset":4008},"end":{"line":70,"column":242,"offset":4090},"indent":[]}}],"position":{"start":{"line":70,"column":160,"offset":4008},"end":{"line":70,"column":245,"offset":4093},"indent":[]}}],"position":{"start":{"line":70,"column":1,"offset":3849},"end":{"line":70,"column":247,"offset":4095},"indent":[]}}],"position":{"start":{"line":67,"column":1,"offset":3108},"end":{"line":70,"column":247,"offset":4095},"indent":[1,1,1]}},{"type":"paragraph","children":[{"type":"text","value":"Open Sourced Bots:\n| Bot Name | Developer | Links |\n| ----------------- | ---------- | ---------------------------------------------------------- |\n| discordeno-mattis | Mattis6666 | ","position":{"start":{"line":72,"column":1,"offset":4097},"end":{"line":75,"column":36,"offset":4343},"indent":[1,1,1]}},{"type":"link","title":null,"url":"https://github.com/Mattis6666/discordeno-mattis/","children":[{"type":"text","value":"Github","position":{"start":{"line":75,"column":37,"offset":4344},"end":{"line":75,"column":43,"offset":4350},"indent":[]}}],"position":{"start":{"line":75,"column":36,"offset":4343},"end":{"line":75,"column":94,"offset":4401},"indent":[]}},{"type":"text","value":" |","position":{"start":{"line":75,"column":94,"offset":4401},"end":{"line":75,"column":96,"offset":4403},"indent":[]}}],"position":{"start":{"line":72,"column":1,"offset":4097},"end":{"line":75,"column":96,"offset":4403},"indent":[1,1,1]}},{"type":"heading","depth":2,"children":[{"type":"text","value":"Tutorials","position":{"start":{"line":78,"column":4,"offset":4409},"end":{"line":78,"column":13,"offset":4418},"indent":[]}}],"position":{"start":{"line":78,"column":1,"offset":4406},"end":{"line":78,"column":13,"offset":4418},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"Below you will find youtube playlists that display channels using Discordeno for their tutorials.","position":{"start":{"line":79,"column":1,"offset":4419},"end":{"line":79,"column":98,"offset":4516},"indent":[]}}],"position":{"start":{"line":79,"column":1,"offset":4419},"end":{"line":79,"column":98,"offset":4516},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"Web-Mystery Tutorials:","position":{"start":{"line":81,"column":1,"offset":4518},"end":{"line":81,"column":23,"offset":4540},"indent":[]}}],"position":{"start":{"line":81,"column":1,"offset":4518},"end":{"line":81,"column":23,"offset":4540},"indent":[]}},{"type":"list","ordered":false,"start":null,"spread":false,"children":[{"type":"listItem","spread":false,"checked":null,"children":[{"type":"jsx","value":"Making a Discord bot with Deno and Discordeno","position":{"start":{"line":82,"column":3,"offset":4543},"end":{"line":82,"column":150,"offset":4690},"indent":[]}}],"position":{"start":{"line":82,"column":1,"offset":4541},"end":{"line":82,"column":150,"offset":4690},"indent":[]}},{"type":"listItem","spread":false,"checked":null,"children":[{"type":"jsx","value":"Running a Discord bot written in Deno in Docker","position":{"start":{"line":83,"column":3,"offset":4693},"end":{"line":83,"column":153,"offset":4843},"indent":[]}}],"position":{"start":{"line":83,"column":1,"offset":4691},"end":{"line":83,"column":153,"offset":4843},"indent":[]}}],"position":{"start":{"line":82,"column":1,"offset":4541},"end":{"line":83,"column":153,"offset":4843},"indent":[1]}},{"type":"paragraph","children":[{"type":"text","value":"YouTube Tutorials:","position":{"start":{"line":85,"column":1,"offset":4845},"end":{"line":85,"column":19,"offset":4863},"indent":[]}}],"position":{"start":{"line":85,"column":1,"offset":4845},"end":{"line":85,"column":19,"offset":4863},"indent":[]}},{"type":"list","ordered":false,"start":null,"spread":false,"children":[{"type":"listItem","spread":false,"checked":null,"children":[{"type":"paragraph","children":[{"type":"text","value":"Coming soon to ","position":{"start":{"line":86,"column":3,"offset":4866},"end":{"line":86,"column":18,"offset":4881},"indent":[]}},{"type":"link","title":null,"url":"https://www.youtube.com/channel/UCkOFck-WCQtolha4NJuK7zA/","children":[{"type":"text","value":"NTM Development","position":{"start":{"line":86,"column":19,"offset":4882},"end":{"line":86,"column":34,"offset":4897},"indent":[]}}],"position":{"start":{"line":86,"column":18,"offset":4881},"end":{"line":86,"column":94,"offset":4957},"indent":[]}}],"position":{"start":{"line":86,"column":3,"offset":4866},"end":{"line":86,"column":94,"offset":4957},"indent":[]}}],"position":{"start":{"line":86,"column":1,"offset":4864},"end":{"line":86,"column":94,"offset":4957},"indent":[]}}],"position":{"start":{"line":86,"column":1,"offset":4864},"end":{"line":86,"column":94,"offset":4957},"indent":[]}},{"type":"thematicBreak","position":{"start":{"line":88,"column":1,"offset":4959},"end":{"line":88,"column":4,"offset":4962},"indent":[]}},{"type":"heading","depth":2,"children":[{"type":"text","value":"Development Team","position":{"start":{"line":90,"column":4,"offset":4967},"end":{"line":90,"column":20,"offset":4983},"indent":[]}}],"position":{"start":{"line":90,"column":1,"offset":4964},"end":{"line":90,"column":20,"offset":4983},"indent":[]}},{"type":"paragraph","children":[{"type":"strong","children":[{"type":"text","value":"Skillz4Killz","position":{"start":{"line":92,"column":3,"offset":4987},"end":{"line":92,"column":15,"offset":4999},"indent":[]}}],"position":{"start":{"line":92,"column":1,"offset":4985},"end":{"line":92,"column":17,"offset":5001},"indent":[]}},{"type":"text","value":" (Creator and Developer)","position":{"start":{"line":92,"column":17,"offset":5001},"end":{"line":92,"column":41,"offset":5025},"indent":[]}}],"position":{"start":{"line":92,"column":1,"offset":4985},"end":{"line":92,"column":41,"offset":5025},"indent":[]}},{"type":"list","ordered":false,"start":null,"spread":false,"children":[{"type":"listItem","spread":false,"checked":null,"children":[{"type":"paragraph","children":[{"type":"text","value":"GitHub: ","position":{"start":{"line":94,"column":3,"offset":5029},"end":{"line":94,"column":11,"offset":5037},"indent":[]}},{"type":"link","title":null,"url":"https://github.com/skillz4killz","children":[{"type":"text","value":"@Skillz4Killz","position":{"start":{"line":94,"column":12,"offset":5038},"end":{"line":94,"column":25,"offset":5051},"indent":[]}}],"position":{"start":{"line":94,"column":11,"offset":5037},"end":{"line":94,"column":59,"offset":5085},"indent":[]}}],"position":{"start":{"line":94,"column":3,"offset":5029},"end":{"line":94,"column":59,"offset":5085},"indent":[]}}],"position":{"start":{"line":94,"column":1,"offset":5027},"end":{"line":94,"column":59,"offset":5085},"indent":[]}}],"position":{"start":{"line":94,"column":1,"offset":5027},"end":{"line":94,"column":59,"offset":5085},"indent":[]}},{"type":"heading","depth":2,"children":[{"type":"text","value":"Contributors","position":{"start":{"line":96,"column":4,"offset":5090},"end":{"line":96,"column":16,"offset":5102},"indent":[]}}],"position":{"start":{"line":96,"column":1,"offset":5087},"end":{"line":96,"column":16,"offset":5102},"indent":[]}},{"type":"paragraph","children":[{"type":"strong","children":[{"type":"text","value":"NTM Nathan","position":{"start":{"line":98,"column":3,"offset":5106},"end":{"line":98,"column":13,"offset":5116},"indent":[]}}],"position":{"start":{"line":98,"column":1,"offset":5104},"end":{"line":98,"column":15,"offset":5118},"indent":[]}},{"type":"text","value":" (Documentation Developer)","position":{"start":{"line":98,"column":15,"offset":5118},"end":{"line":98,"column":41,"offset":5144},"indent":[]}}],"position":{"start":{"line":98,"column":1,"offset":5104},"end":{"line":98,"column":41,"offset":5144},"indent":[]}},{"type":"list","ordered":false,"start":null,"spread":false,"children":[{"type":"listItem","spread":false,"checked":null,"children":[{"type":"paragraph","children":[{"type":"text","value":"Website: ","position":{"start":{"line":100,"column":3,"offset":5148},"end":{"line":100,"column":12,"offset":5157},"indent":[]}},{"type":"link","title":null,"url":"https://dev.ntmnathan.com/","children":[{"type":"text","value":"https://dev.ntmnathan.com/","position":{"start":{"line":100,"column":12,"offset":5157},"end":{"line":100,"column":38,"offset":5183},"indent":[]}}],"position":{"start":{"line":100,"column":12,"offset":5157},"end":{"line":100,"column":38,"offset":5183},"indent":[]}}],"position":{"start":{"line":100,"column":3,"offset":5148},"end":{"line":100,"column":38,"offset":5183},"indent":[]}}],"position":{"start":{"line":100,"column":1,"offset":5146},"end":{"line":100,"column":38,"offset":5183},"indent":[]}},{"type":"listItem","spread":false,"checked":null,"children":[{"type":"paragraph","children":[{"type":"text","value":"GitHub: ","position":{"start":{"line":101,"column":3,"offset":5186},"end":{"line":101,"column":11,"offset":5194},"indent":[]}},{"type":"link","title":null,"url":"https://github.com/NTMNathan","children":[{"type":"text","value":"@NTMNathan","position":{"start":{"line":101,"column":12,"offset":5195},"end":{"line":101,"column":22,"offset":5205},"indent":[]}}],"position":{"start":{"line":101,"column":11,"offset":5194},"end":{"line":101,"column":53,"offset":5236},"indent":[]}}],"position":{"start":{"line":101,"column":3,"offset":5186},"end":{"line":101,"column":53,"offset":5236},"indent":[]}}],"position":{"start":{"line":101,"column":1,"offset":5184},"end":{"line":101,"column":53,"offset":5236},"indent":[]}}],"position":{"start":{"line":100,"column":1,"offset":5146},"end":{"line":101,"column":53,"offset":5236},"indent":[1]}},{"type":"paragraph","children":[{"type":"strong","children":[{"type":"text","value":"EternallLight","position":{"start":{"line":103,"column":3,"offset":5240},"end":{"line":103,"column":16,"offset":5253},"indent":[]}}],"position":{"start":{"line":103,"column":1,"offset":5238},"end":{"line":103,"column":18,"offset":5255},"indent":[]}}],"position":{"start":{"line":103,"column":1,"offset":5238},"end":{"line":103,"column":18,"offset":5255},"indent":[]}},{"type":"list","ordered":false,"start":null,"spread":false,"children":[{"type":"listItem","spread":false,"checked":null,"children":[{"type":"paragraph","children":[{"type":"text","value":"Website: ","position":{"start":{"line":105,"column":3,"offset":5259},"end":{"line":105,"column":12,"offset":5268},"indent":[]}},{"type":"link","title":null,"url":"https://web-mystery.com/","children":[{"type":"text","value":"https://web-mystery.com/","position":{"start":{"line":105,"column":12,"offset":5268},"end":{"line":105,"column":36,"offset":5292},"indent":[]}}],"position":{"start":{"line":105,"column":12,"offset":5268},"end":{"line":105,"column":36,"offset":5292},"indent":[]}}],"position":{"start":{"line":105,"column":3,"offset":5259},"end":{"line":105,"column":36,"offset":5292},"indent":[]}}],"position":{"start":{"line":105,"column":1,"offset":5257},"end":{"line":105,"column":36,"offset":5292},"indent":[]}},{"type":"listItem","spread":false,"checked":null,"children":[{"type":"paragraph","children":[{"type":"text","value":"GitHub: ","position":{"start":{"line":106,"column":3,"offset":5295},"end":{"line":106,"column":11,"offset":5303},"indent":[]}},{"type":"link","title":null,"url":"https://github.com/EternallLight","children":[{"type":"text","value":"@EternallLight","position":{"start":{"line":106,"column":12,"offset":5304},"end":{"line":106,"column":26,"offset":5318},"indent":[]}}],"position":{"start":{"line":106,"column":11,"offset":5303},"end":{"line":106,"column":61,"offset":5353},"indent":[]}}],"position":{"start":{"line":106,"column":3,"offset":5295},"end":{"line":106,"column":61,"offset":5353},"indent":[]}}],"position":{"start":{"line":106,"column":1,"offset":5293},"end":{"line":106,"column":61,"offset":5353},"indent":[]}}],"position":{"start":{"line":105,"column":1,"offset":5257},"end":{"line":106,"column":61,"offset":5353},"indent":[1]}},{"type":"paragraph","children":[{"type":"strong","children":[{"type":"text","value":"Androz2091","position":{"start":{"line":108,"column":3,"offset":5357},"end":{"line":108,"column":13,"offset":5367},"indent":[]}}],"position":{"start":{"line":108,"column":1,"offset":5355},"end":{"line":108,"column":15,"offset":5369},"indent":[]}}],"position":{"start":{"line":108,"column":1,"offset":5355},"end":{"line":108,"column":15,"offset":5369},"indent":[]}},{"type":"list","ordered":false,"start":null,"spread":false,"children":[{"type":"listItem","spread":false,"checked":null,"children":[{"type":"paragraph","children":[{"type":"text","value":"GitHub: ","position":{"start":{"line":110,"column":3,"offset":5373},"end":{"line":110,"column":11,"offset":5381},"indent":[]}},{"type":"link","title":null,"url":"https://github.com/Androz2091","children":[{"type":"text","value":"@Androz2091","position":{"start":{"line":110,"column":12,"offset":5382},"end":{"line":110,"column":23,"offset":5393},"indent":[]}}],"position":{"start":{"line":110,"column":11,"offset":5381},"end":{"line":110,"column":55,"offset":5425},"indent":[]}}],"position":{"start":{"line":110,"column":3,"offset":5373},"end":{"line":110,"column":55,"offset":5425},"indent":[]}}],"position":{"start":{"line":110,"column":1,"offset":5371},"end":{"line":110,"column":55,"offset":5425},"indent":[]}}],"position":{"start":{"line":110,"column":1,"offset":5371},"end":{"line":110,"column":55,"offset":5425},"indent":[]}},{"type":"thematicBreak","position":{"start":{"line":112,"column":1,"offset":5427},"end":{"line":112,"column":4,"offset":5430},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"If you would like to join everyone else on the contribution list, feel free to join the ","position":{"start":{"line":113,"column":1,"offset":5431},"end":{"line":113,"column":89,"offset":5519},"indent":[]}},{"type":"link","title":null,"url":"https://discord.gg/J4NqJ72","children":[{"type":"text","value":"Support Server","position":{"start":{"line":113,"column":90,"offset":5520},"end":{"line":113,"column":104,"offset":5534},"indent":[]}}],"position":{"start":{"line":113,"column":89,"offset":5519},"end":{"line":113,"column":133,"offset":5563},"indent":[]}},{"type":"text","value":" for ","position":{"start":{"line":113,"column":133,"offset":5563},"end":{"line":113,"column":138,"offset":5568},"indent":[]}},{"type":"strong","children":[{"type":"text","value":"Discordeno!","position":{"start":{"line":113,"column":140,"offset":5570},"end":{"line":113,"column":151,"offset":5581},"indent":[]}}],"position":{"start":{"line":113,"column":138,"offset":5568},"end":{"line":113,"column":153,"offset":5583},"indent":[]}}],"position":{"start":{"line":113,"column":1,"offset":5431},"end":{"line":113,"column":153,"offset":5583},"indent":[]}},{"type":"export","value":"export const _frontmatter = {\"title\":\"Getting Started\",\"metaTitle\":\"Getting Started | Discordeno\",\"metaDescription\":\"Discordeno aims for a simple, easy and stress-free interaction with the Discord API. Always supporting the latest version to ensure stability, consistency and the best developer experience.\"}","position":{"start":{"line":117,"column":1,"offset":5587},"end":{"line":117,"column":309,"offset":5895},"indent":[]}}],"position":{"start":{"line":1,"column":1,"offset":0},"end":{"line":117,"column":309,"offset":5895}}},"scopeImports":["import * as React from 'react'"],"scopeIdentifiers":["React"],"body":"function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }\n\nfunction _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }\n\nfunction _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }\n\n/* @jsx mdx */\nvar _frontmatter = {\n \"title\": \"Getting Started\",\n \"metaTitle\": \"Getting Started | Discordeno\",\n \"metaDescription\": \"Discordeno aims for a simple, easy and stress-free interaction with the Discord API. Always supporting the latest version to ensure stability, consistency and the best developer experience.\"\n};\nvar layoutProps = {\n _frontmatter: _frontmatter\n};\nvar MDXLayout = \"wrapper\";\nreturn function MDXContent(_ref) {\n var components = _ref.components,\n props = _objectWithoutProperties(_ref, [\"components\"]);\n\n return mdx(MDXLayout, _extends({}, layoutProps, props, {\n components: components,\n mdxType: \"MDXLayout\"\n }), mdx(\"h2\", null, \"Getting Started\"), mdx(\"p\", null, \"Discordeno aims for a simple, easy and stress-free interaction with the Discord API. Always supporting the latest version to ensure stability, consistency and the best developer experience.\"), mdx(\"p\", null, \"This website serves as the purpose for introducing Discordeno to developers. The full documentation for all the functions and methods can be visited by clicking the link below:\"), mdx(\"p\", null, mdx(\"a\", _extends({\n parentName: \"p\"\n }, {\n \"href\": \"https://doc.deno.land/https/deno.land/x/discordeno/mod.ts\"\n }), \"View Documentation on Deno\")), mdx(\"h2\", null, \"Useful Links\"), mdx(\"ul\", null, mdx(\"li\", {\n parentName: \"ul\"\n }, mdx(\"a\", _extends({\n parentName: \"li\"\n }, {\n \"href\": \"https://github.com/Skillz4Killz/Discordeno\"\n }), \"GitHub Repository\")), mdx(\"li\", {\n parentName: \"ul\"\n }, mdx(\"a\", _extends({\n parentName: \"li\"\n }, {\n \"href\": \"https://deno.land/x/discordeno\"\n }), \"Deno Page\")), mdx(\"li\", {\n parentName: \"ul\"\n }, mdx(\"a\", _extends({\n parentName: \"li\"\n }, {\n \"href\": \"https://discordeno.js.org/\"\n }), \"Website\"))), mdx(\"h2\", null, \"Requirements\"), mdx(\"ul\", null, mdx(\"li\", {\n parentName: \"ul\"\n }, mdx(\"strong\", {\n parentName: \"li\"\n }, \"Deno 1.0\"), \" or higher\")), mdx(\"h2\", null, \"Creating your First Discord Bot Application\"), mdx(\"p\", null, \"Plenty of guides are available on how to create a Discord Bot Application.\"), mdx(\"ol\", null, mdx(\"li\", {\n parentName: \"ol\"\n }, mdx(\"a\", _extends({\n parentName: \"li\"\n }, {\n \"href\": \"https://discord.com/developers/applications\"\n }), \"Creating an Application\"), \" on the Developer Portal, name something cool and pick a sweet icon!\"), mdx(\"li\", {\n parentName: \"ol\"\n }, \"After creating an application. Save the \", mdx(\"strong\", {\n parentName: \"li\"\n }, \"Client ID.\"), \" Thats the unique identifier for a Discord Bot.\"), mdx(\"li\", {\n parentName: \"ol\"\n }, \"Now, go and create a bot by clicking the \", mdx(\"strong\", {\n parentName: \"li\"\n }, \"Bot\"), \" tab. You will see a \", mdx(\"strong\", {\n parentName: \"li\"\n }, \"Token\"), \" section and thats the Discord Bot's token. \", mdx(\"strong\", {\n parentName: \"li\"\n }, \"Make sure you don't share that token with anyone!!!\")), mdx(\"li\", {\n parentName: \"ol\"\n }, \"Invite the bot to the server, you can use the \", mdx(\"strong\", {\n parentName: \"li\"\n }, mdx(\"a\", _extends({\n parentName: \"strong\"\n }, {\n \"href\": \"https://discordapi.com/permissions.html#0\"\n }), \"Discord Permissions Calculator\")), \" for creating the invite link with custom permissions. By default, \", mdx(\"inlineCode\", {\n parentName: \"li\"\n }, \"0\"), \" means no permissions and \", mdx(\"inlineCode\", {\n parentName: \"li\"\n }, \"8\"), \" means Administrator.\")), mdx(\"p\", null, \"Now you've created an Application but it will need some code in order for it to be online. Thats when Discordeno comes in handy!\"), mdx(\"blockquote\", null, mdx(\"p\", {\n parentName: \"blockquote\"\n }, \"Make sure you store your tokens in a file that is NOT deployed by adding it to the .gitignore file. \", mdx(\"strong\", {\n parentName: \"p\"\n }, \"Don't share your bot token with anybody.\"))), mdx(\"h2\", null, \"Installation\"), mdx(\"p\", null, \"You can install Discordeno by importing:\"), mdx(\"pre\", null, mdx(\"code\", _extends({\n parentName: \"pre\"\n }, {\n \"className\": \"language-ts\"\n }), \"import Client from \\\"https://raw.githubusercontent.com/Skillz4Killz/Discordeno/v7/src/module/client.ts\\\";\\n\")), mdx(\"h2\", null, \"Example Usage\"), mdx(\"p\", null, \"Starting with Discordeno is very simple, you can start from scratch without any boilerplates/frameworks: Add this snippet of code into a new TypeScript file:\"), mdx(\"pre\", null, mdx(\"code\", _extends({\n parentName: \"pre\"\n }, {\n \"className\": \"language-ts\"\n }), \"import Client from \\\"https://raw.githubusercontent.com/Skillz4Killz/Discordeno/v7/src/module/client.ts\\\";\\nimport { sendMessage } from \\\"https://raw.githubusercontent.com/Skillz4Killz/Discordeno/v7/src/handlers/channel.ts\\\";\\nimport { Intents } from \\\"https://raw.githubusercontent.com/Skillz4Killz/Discordeno/v7/src/types/options.ts\\\";\\nimport config from \\\"./config.ts\\\";\\n\\nClient({\\n token: config.token,\\n intents: [Intents.GUILD_MESSAGES, Intents.GUILDS],\\n eventHandlers: {\\n ready: () => {\\n console.log(`Logged!`);\\n },\\n messageCreate: (message) => {\\n if (message.content === \\\"!ping\\\") {\\n sendMessage(message.channel, \\\"Pong\\\");\\n }\\n }\\n }\\n});\\n\")), mdx(\"p\", null, \"Alternatively, you can use boilerplate template repositories that were created by wonderful developers. This will get the base of your bot pre-built for you. Overtime, developers create other command frameworks for this library and they will be listed here:\"), mdx(\"table\", null, mdx(\"thead\", {\n parentName: \"table\"\n }, mdx(\"tr\", {\n parentName: \"thead\"\n }, mdx(\"th\", _extends({\n parentName: \"tr\"\n }, {\n \"align\": null\n }), \"Bot Name\"), mdx(\"th\", _extends({\n parentName: \"tr\"\n }, {\n \"align\": null\n }), \"Developer\"), mdx(\"th\", _extends({\n parentName: \"tr\"\n }, {\n \"align\": null\n }), \"Links\"), mdx(\"th\", _extends({\n parentName: \"tr\"\n }, {\n \"align\": null\n }), \"Description\"))), mdx(\"tbody\", {\n parentName: \"table\"\n }, mdx(\"tr\", {\n parentName: \"tbody\"\n }, mdx(\"td\", _extends({\n parentName: \"tr\"\n }, {\n \"align\": null\n }), \"Official Boilerplate\"), mdx(\"td\", _extends({\n parentName: \"tr\"\n }, {\n \"align\": null\n }), \"Skillz4Killz#4500\"), mdx(\"td\", _extends({\n parentName: \"tr\"\n }, {\n \"align\": null\n }), mdx(\"a\", _extends({\n parentName: \"td\"\n }, {\n \"href\": \"https://github.com/Skillz4Killz/Discordeno-bot-template\"\n }), \"GitHub\"), \", \", mdx(\"a\", _extends({\n parentName: \"td\"\n }, {\n \"href\": \"https://discord.gg/J4NqJ72\"\n }), \"Support Server\")), mdx(\"td\", _extends({\n parentName: \"tr\"\n }, {\n \"align\": null\n }), \"This is a very minimalistic design for a boilerplate for your bot to get you started.\")), mdx(\"tr\", {\n parentName: \"tbody\"\n }, mdx(\"td\", _extends({\n parentName: \"tr\"\n }, {\n \"align\": null\n }), \"DenoBot\"), mdx(\"td\", _extends({\n parentName: \"tr\"\n }, {\n \"align\": null\n }), \"NTM Nathan#0001\"), mdx(\"td\", _extends({\n parentName: \"tr\"\n }, {\n \"align\": null\n }), mdx(\"a\", _extends({\n parentName: \"td\"\n }, {\n \"href\": \"https://github.com/ntm-development/DenoBot\"\n }), \"GitHub\"), \", \", mdx(\"a\", _extends({\n parentName: \"td\"\n }, {\n \"href\": \"https://discord.com/invite/G2rb53z\"\n }), \"Support Server\")), mdx(\"td\", _extends({\n parentName: \"tr\"\n }, {\n \"align\": null\n }), \"Another boilerplate example of the first one, with more commands and improvements.\")))), mdx(\"p\", null, \"Open Sourced Bots:\\n| Bot Name | Developer | Links |\\n| ----------------- | ---------- | ---------------------------------------------------------- |\\n| discordeno-mattis | Mattis6666 | \", mdx(\"a\", _extends({\n parentName: \"p\"\n }, {\n \"href\": \"https://github.com/Mattis6666/discordeno-mattis/\"\n }), \"Github\"), \" |\"), mdx(\"h2\", null, \"Tutorials\"), mdx(\"p\", null, \"Below you will find youtube playlists that display channels using Discordeno for their tutorials.\"), mdx(\"p\", null, \"Web-Mystery Tutorials:\"), mdx(\"ul\", null, mdx(\"li\", {\n parentName: \"ul\"\n }, mdx(\"a\", {\n href: \"https://web-mystery.com/articles/making-discord-bot-deno-and-discordeno\",\n target: \"_blank\"\n }, \"Making a Discord bot with Deno and Discordeno\")), mdx(\"li\", {\n parentName: \"ul\"\n }, mdx(\"a\", {\n href: \"https://web-mystery.com/articles/running-discord-bot-written-deno-docker\",\n target: \"_blank\"\n }, \"Running a Discord bot written in Deno in Docker\"))), mdx(\"p\", null, \"YouTube Tutorials:\"), mdx(\"ul\", null, mdx(\"li\", {\n parentName: \"ul\"\n }, \"Coming soon to \", mdx(\"a\", _extends({\n parentName: \"li\"\n }, {\n \"href\": \"https://www.youtube.com/channel/UCkOFck-WCQtolha4NJuK7zA/\"\n }), \"NTM Development\"))), mdx(\"hr\", null), mdx(\"h2\", null, \"Development Team\"), mdx(\"p\", null, mdx(\"strong\", {\n parentName: \"p\"\n }, \"Skillz4Killz\"), \" (Creator and Developer)\"), mdx(\"ul\", null, mdx(\"li\", {\n parentName: \"ul\"\n }, \"GitHub: \", mdx(\"a\", _extends({\n parentName: \"li\"\n }, {\n \"href\": \"https://github.com/skillz4killz\"\n }), \"@Skillz4Killz\"))), mdx(\"h2\", null, \"Contributors\"), mdx(\"p\", null, mdx(\"strong\", {\n parentName: \"p\"\n }, \"NTM Nathan\"), \" (Documentation Developer)\"), mdx(\"ul\", null, mdx(\"li\", {\n parentName: \"ul\"\n }, \"Website: \", mdx(\"a\", _extends({\n parentName: \"li\"\n }, {\n \"href\": \"https://dev.ntmnathan.com/\"\n }), \"https://dev.ntmnathan.com/\")), mdx(\"li\", {\n parentName: \"ul\"\n }, \"GitHub: \", mdx(\"a\", _extends({\n parentName: \"li\"\n }, {\n \"href\": \"https://github.com/NTMNathan\"\n }), \"@NTMNathan\"))), mdx(\"p\", null, mdx(\"strong\", {\n parentName: \"p\"\n }, \"EternallLight\")), mdx(\"ul\", null, mdx(\"li\", {\n parentName: \"ul\"\n }, \"Website: \", mdx(\"a\", _extends({\n parentName: \"li\"\n }, {\n \"href\": \"https://web-mystery.com/\"\n }), \"https://web-mystery.com/\")), mdx(\"li\", {\n parentName: \"ul\"\n }, \"GitHub: \", mdx(\"a\", _extends({\n parentName: \"li\"\n }, {\n \"href\": \"https://github.com/EternallLight\"\n }), \"@EternallLight\"))), mdx(\"p\", null, mdx(\"strong\", {\n parentName: \"p\"\n }, \"Androz2091\")), mdx(\"ul\", null, mdx(\"li\", {\n parentName: \"ul\"\n }, \"GitHub: \", mdx(\"a\", _extends({\n parentName: \"li\"\n }, {\n \"href\": \"https://github.com/Androz2091\"\n }), \"@Androz2091\"))), mdx(\"hr\", null), mdx(\"p\", null, \"If you would like to join everyone else on the contribution list, feel free to join the \", mdx(\"a\", _extends({\n parentName: \"p\"\n }, {\n \"href\": \"https://discord.gg/J4NqJ72\"\n }), \"Support Server\"), \" for \", mdx(\"strong\", {\n parentName: \"p\"\n }, \"Discordeno!\")));\n}\n;\nMDXContent.isMDXComponent = true;","rawMDXOutput":"/* @jsx mdx */\nimport { mdx } from '@mdx-js/react';\n/* @jsx mdx */\n\nexport const _frontmatter = {\n \"title\": \"Getting Started\",\n \"metaTitle\": \"Getting Started | Discordeno\",\n \"metaDescription\": \"Discordeno aims for a simple, easy and stress-free interaction with the Discord API. Always supporting the latest version to ensure stability, consistency and the best developer experience.\"\n};\n\nconst layoutProps = {\n _frontmatter\n};\nconst MDXLayout = \"wrapper\"\nexport default function MDXContent({\n components,\n ...props\n}) {\n return \n

{`Getting Started`}

\n

{`Discordeno aims for a simple, easy and stress-free interaction with the Discord API. Always supporting the latest version to ensure stability, consistency and the best developer experience.`}

\n

{`This website serves as the purpose for introducing Discordeno to developers. The full documentation for all the functions and methods can be visited by clicking the link below:`}

\n

{`View Documentation on Deno`}

\n

{`Useful Links`}

\n \n

{`Requirements`}

\n
    \n
  • {`Deno 1.0`}{` or higher`}
  • \n
\n

{`Creating your First Discord Bot Application`}

\n

{`Plenty of guides are available on how to create a Discord Bot Application.`}

\n
    \n
  1. {`Creating an Application`}{` on the Developer Portal, name something cool and pick a sweet icon!`}
  2. \n
  3. {`After creating an application. Save the `}{`Client ID.`}{` Thats the unique identifier for a Discord Bot.`}
  4. \n
  5. {`Now, go and create a bot by clicking the `}{`Bot`}{` tab. You will see a `}{`Token`}{` section and thats the Discord Bot's token. `}{`Make sure you don't share that token with anyone!!!`}
  6. \n
  7. {`Invite the bot to the server, you can use the `}{`Discord Permissions Calculator`}{` for creating the invite link with custom permissions. By default, `}{`0`}{` means no permissions and `}{`8`}{` means Administrator.`}
  8. \n
\n

{`Now you've created an Application but it will need some code in order for it to be online. Thats when Discordeno comes in handy!`}

\n
\n

{`Make sure you store your tokens in a file that is NOT deployed by adding it to the .gitignore file. `}{`Don't share your bot token with anybody.`}

\n
\n

{`Installation`}

\n

{`You can install Discordeno by importing:`}

\n
{`import Client from \"https://raw.githubusercontent.com/Skillz4Killz/Discordeno/v7/src/module/client.ts\";\n`}
\n

{`Example Usage`}

\n

{`Starting with Discordeno is very simple, you can start from scratch without any boilerplates/frameworks: Add this snippet of code into a new TypeScript file:`}

\n
{`import Client from \"https://raw.githubusercontent.com/Skillz4Killz/Discordeno/v7/src/module/client.ts\";\nimport { sendMessage } from \"https://raw.githubusercontent.com/Skillz4Killz/Discordeno/v7/src/handlers/channel.ts\";\nimport { Intents } from \"https://raw.githubusercontent.com/Skillz4Killz/Discordeno/v7/src/types/options.ts\";\nimport config from \"./config.ts\";\n\nClient({\n    token: config.token,\n    intents: [Intents.GUILD_MESSAGES, Intents.GUILDS],\n    eventHandlers: {\n        ready: () => {\n            console.log(\\`Logged!\\`);\n        },\n        messageCreate: (message) => {\n            if (message.content === \"!ping\") {\n                sendMessage(message.channel, \"Pong\");\n            }\n        }\n    }\n});\n`}
\n

{`Alternatively, you can use boilerplate template repositories that were created by wonderful developers. This will get the base of your bot pre-built for you. Overtime, developers create other command frameworks for this library and they will be listed here:`}

\n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n
{`Bot Name`}{`Developer`}{`Links`}{`Description`}
{`Official Boilerplate`}{`Skillz4Killz#4500`}{`GitHub`}{`, `}{`Support Server`}{`This is a very minimalistic design for a boilerplate for your bot to get you started.`}
{`DenoBot`}{`NTM Nathan#0001`}{`GitHub`}{`, `}{`Support Server`}{`Another boilerplate example of the first one, with more commands and improvements.`}
\n

{`Open Sourced Bots:\n| Bot Name | Developer | Links |\n| ----------------- | ---------- | ---------------------------------------------------------- |\n| discordeno-mattis | Mattis6666 | `}{`Github`}{` |`}

\n

{`Tutorials`}

\n

{`Below you will find youtube playlists that display channels using Discordeno for their tutorials.`}

\n

{`Web-Mystery Tutorials:`}

\n \n

{`YouTube Tutorials:`}

\n \n
\n

{`Development Team`}

\n

{`Skillz4Killz`}{` (Creator and Developer)`}

\n \n

{`Contributors`}

\n

{`NTM Nathan`}{` (Documentation Developer)`}

\n \n

{`EternallLight`}

\n \n

{`Androz2091`}

\n \n
\n

{`If you would like to join everyone else on the contribution list, feel free to join the `}{`Support Server`}{` for `}{`Discordeno!`}

\n\n
;\n}\n\n;\nMDXContent.isMDXComponent = true;"}} \ No newline at end of file diff --git a/docs/.cache/caches/gatsby-plugin-mdx/diskstore-9fcf8aa9565636f55fa5b58db2acec9d.json b/docs/.cache/caches/gatsby-plugin-mdx/diskstore-9fcf8aa9565636f55fa5b58db2acec9d.json new file mode 100644 index 000000000..bcf55599a --- /dev/null +++ b/docs/.cache/caches/gatsby-plugin-mdx/diskstore-9fcf8aa9565636f55fa5b58db2acec9d.json @@ -0,0 +1 @@ +{"expireTime":9007200851635042000,"key":"gatsby-plugin-mdx-entire-payload-09bc79a0e032bba1953495033634261c-","val":{"mdast":{"type":"root","children":[{"type":"paragraph","children":[{"type":"text","value":"Woah! You are almost half way done with understanding all of Discordeno. Amazing isn't it? Something you may have noticed in the last section was there were some options that prevented some commands from running like ","position":{"start":{"line":2,"column":1,"offset":1},"end":{"line":2,"column":218,"offset":218},"indent":[]}},{"type":"inlineCode","value":"dmOnly","position":{"start":{"line":2,"column":218,"offset":218},"end":{"line":2,"column":226,"offset":226},"indent":[]}},{"type":"text","value":" or the permission options. we created a setting to prevent the monitor from running in certain channels. What if we wanted to do prevent commands from happening? How would we prevent commands from running?","position":{"start":{"line":2,"column":226,"offset":226},"end":{"line":2,"column":432,"offset":432},"indent":[]}}],"position":{"start":{"line":2,"column":1,"offset":1},"end":{"line":2,"column":432,"offset":432},"indent":[]}},{"type":"heading","depth":2,"children":[{"type":"text","value":"What is an Inhibitor?","position":{"start":{"line":4,"column":4,"offset":437},"end":{"line":4,"column":25,"offset":458},"indent":[]}}],"position":{"start":{"line":4,"column":1,"offset":434},"end":{"line":4,"column":25,"offset":458},"indent":[]}},{"type":"export","value":"export const _frontmatter = {\"title\":\"Creating Events!\",\"metaTitle\":\"Creating An Inhibitor | Discordeno\",\"metaDescription\":\"Let's create our very own bot with Discordeno!\"}","position":{"start":{"line":8,"column":1,"offset":462},"end":{"line":8,"column":173,"offset":634},"indent":[]}}],"position":{"start":{"line":1,"column":1,"offset":0},"end":{"line":8,"column":173,"offset":634}}},"scopeImports":["import * as React from 'react'"],"scopeIdentifiers":["React"],"body":"function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }\n\nfunction _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }\n\nfunction _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }\n\n/* @jsx mdx */\nvar _frontmatter = {\n \"title\": \"Creating Events!\",\n \"metaTitle\": \"Creating An Inhibitor | Discordeno\",\n \"metaDescription\": \"Let's create our very own bot with Discordeno!\"\n};\nvar layoutProps = {\n _frontmatter: _frontmatter\n};\nvar MDXLayout = \"wrapper\";\nreturn function MDXContent(_ref) {\n var components = _ref.components,\n props = _objectWithoutProperties(_ref, [\"components\"]);\n\n return mdx(MDXLayout, _extends({}, layoutProps, props, {\n components: components,\n mdxType: \"MDXLayout\"\n }), mdx(\"p\", null, \"Woah! You are almost half way done with understanding all of Discordeno. Amazing isn't it? Something you may have noticed in the last section was there were some options that prevented some commands from running like \", mdx(\"inlineCode\", {\n parentName: \"p\"\n }, \"dmOnly\"), \" or the permission options. we created a setting to prevent the monitor from running in certain channels. What if we wanted to do prevent commands from happening? How would we prevent commands from running?\"), mdx(\"h2\", null, \"What is an Inhibitor?\"));\n}\n;\nMDXContent.isMDXComponent = true;","rawMDXOutput":"/* @jsx mdx */\nimport { mdx } from '@mdx-js/react';\n/* @jsx mdx */\n\nexport const _frontmatter = {\n \"title\": \"Creating Events!\",\n \"metaTitle\": \"Creating An Inhibitor | Discordeno\",\n \"metaDescription\": \"Let's create our very own bot with Discordeno!\"\n};\n\nconst layoutProps = {\n _frontmatter\n};\nconst MDXLayout = \"wrapper\"\nexport default function MDXContent({\n components,\n ...props\n}) {\n return \n

{`Woah! You are almost half way done with understanding all of Discordeno. Amazing isn't it? Something you may have noticed in the last section was there were some options that prevented some commands from running like `}{`dmOnly`}{` or the permission options. we created a setting to prevent the monitor from running in certain channels. What if we wanted to do prevent commands from happening? How would we prevent commands from running?`}

\n

{`What is an Inhibitor?`}

\n\n
;\n}\n\n;\nMDXContent.isMDXComponent = true;"}} \ No newline at end of file diff --git a/docs/.cache/caches/gatsby-plugin-mdx/diskstore-a1c7fd9f2a3a839efbae3bb259368a36.json b/docs/.cache/caches/gatsby-plugin-mdx/diskstore-a1c7fd9f2a3a839efbae3bb259368a36.json new file mode 100644 index 000000000..60368a026 --- /dev/null +++ b/docs/.cache/caches/gatsby-plugin-mdx/diskstore-a1c7fd9f2a3a839efbae3bb259368a36.json @@ -0,0 +1 @@ +{"expireTime":9007200851634330000,"key":"gatsby-plugin-mdx-entire-payload-2d11175339428c9847bc6cec2415dae3-","val":{"mdast":{"type":"root","children":[{"type":"paragraph","children":[{"type":"text","value":"Woah! You are almost half way done with understanding all of Discordeno. Amazing isn't it? Something you may have noticed in the last section was there were some options that prevented some commands from running like ","position":{"start":{"line":2,"column":1,"offset":1},"end":{"line":2,"column":218,"offset":218},"indent":[]}},{"type":"inlineCode","value":"dmOnly","position":{"start":{"line":2,"column":218,"offset":218},"end":{"line":2,"column":226,"offset":226},"indent":[]}},{"type":"text","value":" or the permission options. we created a setting to prevent the monitor from running in certain channels. What if we wanted to do prevent commands from happening? How would we prevent commands from running?","position":{"start":{"line":2,"column":226,"offset":226},"end":{"line":2,"column":432,"offset":432},"indent":[]}}],"position":{"start":{"line":2,"column":1,"offset":1},"end":{"line":2,"column":432,"offset":432},"indent":[]}},{"type":"heading","depth":2,"children":[{"type":"text","value":"What is an Inhibitor?","position":{"start":{"line":4,"column":4,"offset":437},"end":{"line":4,"column":25,"offset":458},"indent":[]}}],"position":{"start":{"line":4,"column":1,"offset":434},"end":{"line":4,"column":25,"offset":458},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"An Inhibitor is very similar to how monitors work. A monitor runs on every message but an inhibitor runs on every command. Remember all those command options like cooldown, permissions, permissionLevel, nsfw, etc... Each and every one of these options has an inhibitor in that checks commands for these settings.","position":{"start":{"line":6,"column":1,"offset":460},"end":{"line":6,"column":313,"offset":772},"indent":[]}}],"position":{"start":{"line":6,"column":1,"offset":460},"end":{"line":6,"column":313,"offset":772},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"Let's create our own inhibitor that would prevent commands from being used if the user is not a VIP user.","position":{"start":{"line":8,"column":1,"offset":774},"end":{"line":8,"column":106,"offset":879},"indent":[]}}],"position":{"start":{"line":8,"column":1,"offset":774},"end":{"line":8,"column":106,"offset":879},"indent":[]}},{"type":"blockquote","children":[{"type":"paragraph","children":[{"type":"strong","children":[{"type":"text","value":"Note:","position":{"start":{"line":10,"column":5,"offset":885},"end":{"line":10,"column":10,"offset":890},"indent":[]}}],"position":{"start":{"line":10,"column":3,"offset":883},"end":{"line":10,"column":12,"offset":892},"indent":[]}},{"type":"text","value":" It is important to remember that everything below can be done with a simple permission level as well. We will create our own custom permission levels but for the purposes of this guide and to be able to learn about Inhibitors, we will be using an inhibitor.","position":{"start":{"line":10,"column":12,"offset":892},"end":{"line":10,"column":270,"offset":1150},"indent":[]}}],"position":{"start":{"line":10,"column":3,"offset":883},"end":{"line":10,"column":270,"offset":1150},"indent":[]}}],"position":{"start":{"line":10,"column":1,"offset":881},"end":{"line":10,"column":270,"offset":1150},"indent":[]}},{"type":"heading","depth":2,"children":[{"type":"text","value":"Creating the File","position":{"start":{"line":12,"column":4,"offset":1155},"end":{"line":12,"column":21,"offset":1172},"indent":[]}}],"position":{"start":{"line":12,"column":1,"offset":1152},"end":{"line":12,"column":21,"offset":1172},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"Let's start by creating a file inside the inhibitors folder called ","position":{"start":{"line":14,"column":1,"offset":1174},"end":{"line":14,"column":68,"offset":1241},"indent":[]}},{"type":"inlineCode","value":"boosted.ts","position":{"start":{"line":14,"column":68,"offset":1241},"end":{"line":14,"column":80,"offset":1253},"indent":[]}},{"type":"text","value":" and paste the following snippet of code:","position":{"start":{"line":14,"column":80,"offset":1253},"end":{"line":14,"column":121,"offset":1294},"indent":[]}}],"position":{"start":{"line":14,"column":1,"offset":1174},"end":{"line":14,"column":121,"offset":1294},"indent":[]}},{"type":"code","lang":"ts","meta":null,"value":"import { botCache } from \"../../mod.ts\";\n\nbotCache.inhibitors.set(\"inhibitorname\", async function (message, command, guild) {\n\t// Your code goes here\n});","position":{"start":{"line":16,"column":1,"offset":1296},"end":{"line":22,"column":4,"offset":1459},"indent":[1,1,1,1,1,1]}},{"type":"paragraph","children":[{"type":"text","value":"Inhibitors can take up to 3 arguments.","position":{"start":{"line":24,"column":1,"offset":1461},"end":{"line":24,"column":39,"offset":1499},"indent":[]}}],"position":{"start":{"line":24,"column":1,"offset":1461},"end":{"line":24,"column":39,"offset":1499},"indent":[]}},{"type":"list","ordered":false,"start":null,"spread":false,"children":[{"type":"listItem","spread":false,"checked":null,"children":[{"type":"paragraph","children":[{"type":"inlineCode","value":"message","position":{"start":{"line":26,"column":3,"offset":1503},"end":{"line":26,"column":12,"offset":1512},"indent":[]}},{"type":"text","value":": The message object that triggered the command.","position":{"start":{"line":26,"column":12,"offset":1512},"end":{"line":26,"column":60,"offset":1560},"indent":[]}}],"position":{"start":{"line":26,"column":3,"offset":1503},"end":{"line":26,"column":60,"offset":1560},"indent":[]}}],"position":{"start":{"line":26,"column":1,"offset":1501},"end":{"line":26,"column":60,"offset":1560},"indent":[]}},{"type":"listItem","spread":false,"checked":null,"children":[{"type":"paragraph","children":[{"type":"inlineCode","value":"command","position":{"start":{"line":27,"column":3,"offset":1563},"end":{"line":27,"column":12,"offset":1572},"indent":[]}},{"type":"text","value":": The command object itself that was triggered.","position":{"start":{"line":27,"column":12,"offset":1572},"end":{"line":27,"column":59,"offset":1619},"indent":[]}}],"position":{"start":{"line":27,"column":3,"offset":1563},"end":{"line":27,"column":59,"offset":1619},"indent":[]}}],"position":{"start":{"line":27,"column":1,"offset":1561},"end":{"line":27,"column":59,"offset":1619},"indent":[]}},{"type":"listItem","spread":false,"checked":null,"children":[{"type":"paragraph","children":[{"type":"inlineCode","value":"guild","position":{"start":{"line":28,"column":3,"offset":1622},"end":{"line":28,"column":10,"offset":1629},"indent":[]}},{"type":"text","value":": The server guild object where this command was ran.","position":{"start":{"line":28,"column":10,"offset":1629},"end":{"line":28,"column":63,"offset":1682},"indent":[]}}],"position":{"start":{"line":28,"column":3,"offset":1622},"end":{"line":28,"column":63,"offset":1682},"indent":[]}}],"position":{"start":{"line":28,"column":1,"offset":1620},"end":{"line":28,"column":63,"offset":1682},"indent":[]}}],"position":{"start":{"line":26,"column":1,"offset":1501},"end":{"line":28,"column":63,"offset":1682},"indent":[1,1]}},{"type":"heading","depth":2,"children":[{"type":"text","value":"Understanding How Inhibitors Function","position":{"start":{"line":30,"column":4,"offset":1687},"end":{"line":30,"column":41,"offset":1724},"indent":[]}}],"position":{"start":{"line":30,"column":1,"offset":1684},"end":{"line":30,"column":41,"offset":1724},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"To block a command you have to return a truthy value.","position":{"start":{"line":32,"column":1,"offset":1726},"end":{"line":32,"column":54,"offset":1779},"indent":[]}}],"position":{"start":{"line":32,"column":1,"offset":1726},"end":{"line":32,"column":54,"offset":1779},"indent":[]}},{"type":"list","ordered":false,"start":null,"spread":false,"children":[{"type":"listItem","spread":false,"checked":null,"children":[{"type":"paragraph","children":[{"type":"strong","children":[{"type":"text","value":"return true;","position":{"start":{"line":33,"column":5,"offset":1784},"end":{"line":33,"column":17,"offset":1796},"indent":[]}}],"position":{"start":{"line":33,"column":3,"offset":1782},"end":{"line":33,"column":19,"offset":1798},"indent":[]}},{"type":"text","value":" If you return true the inhibitor will block the execution of the command.\nTo allow a command return a falsey value.","position":{"start":{"line":33,"column":19,"offset":1798},"end":{"line":34,"column":42,"offset":1914},"indent":[1]}}],"position":{"start":{"line":33,"column":3,"offset":1782},"end":{"line":34,"column":42,"offset":1914},"indent":[1]}}],"position":{"start":{"line":33,"column":1,"offset":1780},"end":{"line":34,"column":42,"offset":1914},"indent":[1]}},{"type":"listItem","spread":false,"checked":null,"children":[{"type":"paragraph","children":[{"type":"strong","children":[{"type":"text","value":"return false;","position":{"start":{"line":35,"column":5,"offset":1919},"end":{"line":35,"column":18,"offset":1932},"indent":[]}}],"position":{"start":{"line":35,"column":3,"offset":1917},"end":{"line":35,"column":20,"offset":1934},"indent":[]}},{"type":"text","value":" If you return false the inhibitor will not block the error.","position":{"start":{"line":35,"column":20,"offset":1934},"end":{"line":35,"column":80,"offset":1994},"indent":[]}}],"position":{"start":{"line":35,"column":3,"offset":1917},"end":{"line":35,"column":80,"offset":1994},"indent":[]}}],"position":{"start":{"line":35,"column":1,"offset":1915},"end":{"line":35,"column":80,"offset":1994},"indent":[]}}],"position":{"start":{"line":33,"column":1,"offset":1780},"end":{"line":35,"column":80,"offset":1994},"indent":[1,1]}},{"type":"code","lang":"ts","meta":null,"value":"// If the command is not VIP only we can allow this command to execute\nif (!command.vipOnly) return false;\n\n// The bot's support server\nconst guild = cache.guilds.get(configs.supportServerID);\n// If the command author is not in the server they won't have the vip role\nconst member = guild.members.get(message.author.id) || await getMember(guild.id, message.author.id);\n// Member doesn't exist so cancel the command\nif (!member) {\n\tsendResponse(message, ``)\n\treturn true;\n}\n\n// If the user has the vip role on the support server given by patreon allow the command\nif (member.roles.includes(configs.patreonVIPRoleID)) return false;\n\n// Cancel the command since the user does not have vip\nreturn true;","position":{"start":{"line":38,"column":1,"offset":1997},"end":{"line":57,"column":4,"offset":2705},"indent":[1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1]}},{"type":"export","value":"export const _frontmatter = {\"title\":\"Creating Inhibitors!\",\"metaTitle\":\"Creating An Inhibitor | Discordeno\",\"metaDescription\":\"Let's create our very own bot with Discordeno!\"}","position":{"start":{"line":60,"column":1,"offset":2708},"end":{"line":60,"column":177,"offset":2884},"indent":[]}}],"position":{"start":{"line":1,"column":1,"offset":0},"end":{"line":60,"column":177,"offset":2884}}},"scopeImports":["import * as React from 'react'"],"scopeIdentifiers":["React"],"body":"function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }\n\nfunction _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }\n\nfunction _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }\n\n/* @jsx mdx */\nvar _frontmatter = {\n \"title\": \"Creating Inhibitors!\",\n \"metaTitle\": \"Creating An Inhibitor | Discordeno\",\n \"metaDescription\": \"Let's create our very own bot with Discordeno!\"\n};\nvar layoutProps = {\n _frontmatter: _frontmatter\n};\nvar MDXLayout = \"wrapper\";\nreturn function MDXContent(_ref) {\n var components = _ref.components,\n props = _objectWithoutProperties(_ref, [\"components\"]);\n\n return mdx(MDXLayout, _extends({}, layoutProps, props, {\n components: components,\n mdxType: \"MDXLayout\"\n }), mdx(\"p\", null, \"Woah! You are almost half way done with understanding all of Discordeno. Amazing isn't it? Something you may have noticed in the last section was there were some options that prevented some commands from running like \", mdx(\"inlineCode\", {\n parentName: \"p\"\n }, \"dmOnly\"), \" or the permission options. we created a setting to prevent the monitor from running in certain channels. What if we wanted to do prevent commands from happening? How would we prevent commands from running?\"), mdx(\"h2\", null, \"What is an Inhibitor?\"), mdx(\"p\", null, \"An Inhibitor is very similar to how monitors work. A monitor runs on every message but an inhibitor runs on every command. Remember all those command options like cooldown, permissions, permissionLevel, nsfw, etc... Each and every one of these options has an inhibitor in that checks commands for these settings.\"), mdx(\"p\", null, \"Let's create our own inhibitor that would prevent commands from being used if the user is not a VIP user.\"), mdx(\"blockquote\", null, mdx(\"p\", {\n parentName: \"blockquote\"\n }, mdx(\"strong\", {\n parentName: \"p\"\n }, \"Note:\"), \" It is important to remember that everything below can be done with a simple permission level as well. We will create our own custom permission levels but for the purposes of this guide and to be able to learn about Inhibitors, we will be using an inhibitor.\")), mdx(\"h2\", null, \"Creating the File\"), mdx(\"p\", null, \"Let's start by creating a file inside the inhibitors folder called \", mdx(\"inlineCode\", {\n parentName: \"p\"\n }, \"boosted.ts\"), \" and paste the following snippet of code:\"), mdx(\"pre\", null, mdx(\"code\", _extends({\n parentName: \"pre\"\n }, {\n \"className\": \"language-ts\"\n }), \"import { botCache } from \\\"../../mod.ts\\\";\\n\\nbotCache.inhibitors.set(\\\"inhibitorname\\\", async function (message, command, guild) {\\n // Your code goes here\\n});\\n\")), mdx(\"p\", null, \"Inhibitors can take up to 3 arguments.\"), mdx(\"ul\", null, mdx(\"li\", {\n parentName: \"ul\"\n }, mdx(\"inlineCode\", {\n parentName: \"li\"\n }, \"message\"), \": The message object that triggered the command.\"), mdx(\"li\", {\n parentName: \"ul\"\n }, mdx(\"inlineCode\", {\n parentName: \"li\"\n }, \"command\"), \": The command object itself that was triggered.\"), mdx(\"li\", {\n parentName: \"ul\"\n }, mdx(\"inlineCode\", {\n parentName: \"li\"\n }, \"guild\"), \": The server guild object where this command was ran.\")), mdx(\"h2\", null, \"Understanding How Inhibitors Function\"), mdx(\"p\", null, \"To block a command you have to return a truthy value.\"), mdx(\"ul\", null, mdx(\"li\", {\n parentName: \"ul\"\n }, mdx(\"strong\", {\n parentName: \"li\"\n }, \"return true;\"), \" If you return true the inhibitor will block the execution of the command.\\nTo allow a command return a falsey value.\"), mdx(\"li\", {\n parentName: \"ul\"\n }, mdx(\"strong\", {\n parentName: \"li\"\n }, \"return false;\"), \" If you return false the inhibitor will not block the error.\")), mdx(\"pre\", null, mdx(\"code\", _extends({\n parentName: \"pre\"\n }, {\n \"className\": \"language-ts\"\n }), \"// If the command is not VIP only we can allow this command to execute\\nif (!command.vipOnly) return false;\\n\\n// The bot's support server\\nconst guild = cache.guilds.get(configs.supportServerID);\\n// If the command author is not in the server they won't have the vip role\\nconst member = guild.members.get(message.author.id) || await getMember(guild.id, message.author.id);\\n// Member doesn't exist so cancel the command\\nif (!member) {\\n sendResponse(message, ``)\\n return true;\\n}\\n\\n// If the user has the vip role on the support server given by patreon allow the command\\nif (member.roles.includes(configs.patreonVIPRoleID)) return false;\\n\\n// Cancel the command since the user does not have vip\\nreturn true;\\n\")));\n}\n;\nMDXContent.isMDXComponent = true;","rawMDXOutput":"/* @jsx mdx */\nimport { mdx } from '@mdx-js/react';\n/* @jsx mdx */\n\nexport const _frontmatter = {\n \"title\": \"Creating Inhibitors!\",\n \"metaTitle\": \"Creating An Inhibitor | Discordeno\",\n \"metaDescription\": \"Let's create our very own bot with Discordeno!\"\n};\n\nconst layoutProps = {\n _frontmatter\n};\nconst MDXLayout = \"wrapper\"\nexport default function MDXContent({\n components,\n ...props\n}) {\n return \n

{`Woah! You are almost half way done with understanding all of Discordeno. Amazing isn't it? Something you may have noticed in the last section was there were some options that prevented some commands from running like `}{`dmOnly`}{` or the permission options. we created a setting to prevent the monitor from running in certain channels. What if we wanted to do prevent commands from happening? How would we prevent commands from running?`}

\n

{`What is an Inhibitor?`}

\n

{`An Inhibitor is very similar to how monitors work. A monitor runs on every message but an inhibitor runs on every command. Remember all those command options like cooldown, permissions, permissionLevel, nsfw, etc... Each and every one of these options has an inhibitor in that checks commands for these settings.`}

\n

{`Let's create our own inhibitor that would prevent commands from being used if the user is not a VIP user.`}

\n
\n

{`Note:`}{` It is important to remember that everything below can be done with a simple permission level as well. We will create our own custom permission levels but for the purposes of this guide and to be able to learn about Inhibitors, we will be using an inhibitor.`}

\n
\n

{`Creating the File`}

\n

{`Let's start by creating a file inside the inhibitors folder called `}{`boosted.ts`}{` and paste the following snippet of code:`}

\n
{`import { botCache } from \"../../mod.ts\";\n\nbotCache.inhibitors.set(\"inhibitorname\", async function (message, command, guild) {\n    // Your code goes here\n});\n`}
\n

{`Inhibitors can take up to 3 arguments.`}

\n
    \n
  • {`message`}{`: The message object that triggered the command.`}
  • \n
  • {`command`}{`: The command object itself that was triggered.`}
  • \n
  • {`guild`}{`: The server guild object where this command was ran.`}
  • \n
\n

{`Understanding How Inhibitors Function`}

\n

{`To block a command you have to return a truthy value.`}

\n
    \n
  • {`return true;`}{` If you return true the inhibitor will block the execution of the command.\nTo allow a command return a falsey value.`}
  • \n
  • {`return false;`}{` If you return false the inhibitor will not block the error.`}
  • \n
\n
{`// If the command is not VIP only we can allow this command to execute\nif (!command.vipOnly) return false;\n\n// The bot's support server\nconst guild = cache.guilds.get(configs.supportServerID);\n// If the command author is not in the server they won't have the vip role\nconst member = guild.members.get(message.author.id) || await getMember(guild.id, message.author.id);\n// Member doesn't exist so cancel the command\nif (!member) {\n    sendResponse(message, \\`\\`)\n    return true;\n}\n\n// If the user has the vip role on the support server given by patreon allow the command\nif (member.roles.includes(configs.patreonVIPRoleID)) return false;\n\n// Cancel the command since the user does not have vip\nreturn true;\n`}
\n\n
;\n}\n\n;\nMDXContent.isMDXComponent = true;"}} \ No newline at end of file diff --git a/docs/.cache/caches/gatsby-plugin-mdx/diskstore-a2b1cd729c26406912f27b96f9b42a63.json b/docs/.cache/caches/gatsby-plugin-mdx/diskstore-a2b1cd729c26406912f27b96f9b42a63.json new file mode 100644 index 000000000..00f96248e --- /dev/null +++ b/docs/.cache/caches/gatsby-plugin-mdx/diskstore-a2b1cd729c26406912f27b96f9b42a63.json @@ -0,0 +1 @@ +{"expireTime":9007200851634269000,"key":"gatsby-plugin-mdx-entire-payload-5a7dbc73045ad24c93a26b39c1f011e0-","val":{"mdast":{"type":"root","children":[{"type":"paragraph","children":[{"type":"text","value":"Woah! You are almost half way done with understanding all of Discordeno. Amazing isn't it? Something you may have noticed in the last section was there were some options that prevented some commands from running like ","position":{"start":{"line":2,"column":1,"offset":1},"end":{"line":2,"column":218,"offset":218},"indent":[]}},{"type":"inlineCode","value":"dmOnly","position":{"start":{"line":2,"column":218,"offset":218},"end":{"line":2,"column":226,"offset":226},"indent":[]}},{"type":"text","value":" or the permission options. we created a setting to prevent the monitor from running in certain channels. What if we wanted to do prevent commands from happening? How would we prevent commands from running?","position":{"start":{"line":2,"column":226,"offset":226},"end":{"line":2,"column":432,"offset":432},"indent":[]}}],"position":{"start":{"line":2,"column":1,"offset":1},"end":{"line":2,"column":432,"offset":432},"indent":[]}},{"type":"heading","depth":2,"children":[{"type":"text","value":"What is an Inhibitor?","position":{"start":{"line":4,"column":4,"offset":437},"end":{"line":4,"column":25,"offset":458},"indent":[]}}],"position":{"start":{"line":4,"column":1,"offset":434},"end":{"line":4,"column":25,"offset":458},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"An Inhibitor is very similar to how monitors work. A monitor runs on every message but an inhibitor runs on every command. Remember all those command options like cooldown, permissions, permissionLevel, nsfw, etc... Each and every one of these options has an inhibitor in that checks commands for these settings.","position":{"start":{"line":6,"column":1,"offset":460},"end":{"line":6,"column":313,"offset":772},"indent":[]}}],"position":{"start":{"line":6,"column":1,"offset":460},"end":{"line":6,"column":313,"offset":772},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"Let's create our own inhibitor that would prevent commands from being used if the user is not a VIP user.","position":{"start":{"line":8,"column":1,"offset":774},"end":{"line":8,"column":106,"offset":879},"indent":[]}}],"position":{"start":{"line":8,"column":1,"offset":774},"end":{"line":8,"column":106,"offset":879},"indent":[]}},{"type":"blockquote","children":[{"type":"paragraph","children":[{"type":"strong","children":[{"type":"text","value":"Note:","position":{"start":{"line":10,"column":5,"offset":885},"end":{"line":10,"column":10,"offset":890},"indent":[]}}],"position":{"start":{"line":10,"column":3,"offset":883},"end":{"line":10,"column":12,"offset":892},"indent":[]}},{"type":"text","value":" It is important to remember that everything below can be done with a simple permission level as well. We will create our own custom permission levels but for the purposes of this guide and to be able to learn about Inhibitors, we will be using an inhibitor.","position":{"start":{"line":10,"column":12,"offset":892},"end":{"line":10,"column":270,"offset":1150},"indent":[]}}],"position":{"start":{"line":10,"column":3,"offset":883},"end":{"line":10,"column":270,"offset":1150},"indent":[]}}],"position":{"start":{"line":10,"column":1,"offset":881},"end":{"line":10,"column":270,"offset":1150},"indent":[]}},{"type":"heading","depth":2,"children":[{"type":"text","value":"Creating the File","position":{"start":{"line":12,"column":4,"offset":1155},"end":{"line":12,"column":21,"offset":1172},"indent":[]}}],"position":{"start":{"line":12,"column":1,"offset":1152},"end":{"line":12,"column":21,"offset":1172},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"Let's start by creating a file inside the inhibitors folder called ","position":{"start":{"line":14,"column":1,"offset":1174},"end":{"line":14,"column":68,"offset":1241},"indent":[]}},{"type":"inlineCode","value":"boosted.ts","position":{"start":{"line":14,"column":68,"offset":1241},"end":{"line":14,"column":80,"offset":1253},"indent":[]}},{"type":"text","value":" and paste the following snippet of code:","position":{"start":{"line":14,"column":80,"offset":1253},"end":{"line":14,"column":121,"offset":1294},"indent":[]}}],"position":{"start":{"line":14,"column":1,"offset":1174},"end":{"line":14,"column":121,"offset":1294},"indent":[]}},{"type":"code","lang":"ts","meta":null,"value":"import { botCache } from \"../../mod.ts\";\n\nbotCache.inhibitors.set(\"inhibitorname\", async function (message, command, guild) {\n\t// Your code goes here\n});","position":{"start":{"line":16,"column":1,"offset":1296},"end":{"line":22,"column":4,"offset":1459},"indent":[1,1,1,1,1,1]}},{"type":"paragraph","children":[{"type":"text","value":"Inhibitors can take up to 3 arguments.","position":{"start":{"line":24,"column":1,"offset":1461},"end":{"line":24,"column":39,"offset":1499},"indent":[]}}],"position":{"start":{"line":24,"column":1,"offset":1461},"end":{"line":24,"column":39,"offset":1499},"indent":[]}},{"type":"list","ordered":false,"start":null,"spread":false,"children":[{"type":"listItem","spread":false,"checked":null,"children":[{"type":"paragraph","children":[{"type":"inlineCode","value":"message","position":{"start":{"line":26,"column":3,"offset":1503},"end":{"line":26,"column":12,"offset":1512},"indent":[]}},{"type":"text","value":": The message object that triggered the command.","position":{"start":{"line":26,"column":12,"offset":1512},"end":{"line":26,"column":60,"offset":1560},"indent":[]}}],"position":{"start":{"line":26,"column":3,"offset":1503},"end":{"line":26,"column":60,"offset":1560},"indent":[]}}],"position":{"start":{"line":26,"column":1,"offset":1501},"end":{"line":26,"column":60,"offset":1560},"indent":[]}},{"type":"listItem","spread":false,"checked":null,"children":[{"type":"paragraph","children":[{"type":"inlineCode","value":"command","position":{"start":{"line":27,"column":3,"offset":1563},"end":{"line":27,"column":12,"offset":1572},"indent":[]}},{"type":"text","value":": The command object itself that was triggered.","position":{"start":{"line":27,"column":12,"offset":1572},"end":{"line":27,"column":59,"offset":1619},"indent":[]}}],"position":{"start":{"line":27,"column":3,"offset":1563},"end":{"line":27,"column":59,"offset":1619},"indent":[]}}],"position":{"start":{"line":27,"column":1,"offset":1561},"end":{"line":27,"column":59,"offset":1619},"indent":[]}},{"type":"listItem","spread":false,"checked":null,"children":[{"type":"paragraph","children":[{"type":"inlineCode","value":"guild","position":{"start":{"line":28,"column":3,"offset":1622},"end":{"line":28,"column":10,"offset":1629},"indent":[]}},{"type":"text","value":": The server guild object where this command was ran.","position":{"start":{"line":28,"column":10,"offset":1629},"end":{"line":28,"column":63,"offset":1682},"indent":[]}}],"position":{"start":{"line":28,"column":3,"offset":1622},"end":{"line":28,"column":63,"offset":1682},"indent":[]}}],"position":{"start":{"line":28,"column":1,"offset":1620},"end":{"line":28,"column":63,"offset":1682},"indent":[]}}],"position":{"start":{"line":26,"column":1,"offset":1501},"end":{"line":28,"column":63,"offset":1682},"indent":[1,1]}},{"type":"heading","depth":2,"children":[{"type":"text","value":"Understanding How Inhibitors Function","position":{"start":{"line":30,"column":4,"offset":1687},"end":{"line":30,"column":41,"offset":1724},"indent":[]}}],"position":{"start":{"line":30,"column":1,"offset":1684},"end":{"line":30,"column":41,"offset":1724},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"To block a command you have to return a truthy value.","position":{"start":{"line":32,"column":1,"offset":1726},"end":{"line":32,"column":54,"offset":1779},"indent":[]}}],"position":{"start":{"line":32,"column":1,"offset":1726},"end":{"line":32,"column":54,"offset":1779},"indent":[]}},{"type":"list","ordered":false,"start":null,"spread":false,"children":[{"type":"listItem","spread":false,"checked":null,"children":[{"type":"paragraph","children":[{"type":"strong","children":[{"type":"text","value":"return true;","position":{"start":{"line":33,"column":5,"offset":1784},"end":{"line":33,"column":17,"offset":1796},"indent":[]}}],"position":{"start":{"line":33,"column":3,"offset":1782},"end":{"line":33,"column":19,"offset":1798},"indent":[]}},{"type":"text","value":" If you return true the inhibitor will block the execution of the command.\nTo allow a command return a falsey value.","position":{"start":{"line":33,"column":19,"offset":1798},"end":{"line":34,"column":42,"offset":1914},"indent":[1]}}],"position":{"start":{"line":33,"column":3,"offset":1782},"end":{"line":34,"column":42,"offset":1914},"indent":[1]}}],"position":{"start":{"line":33,"column":1,"offset":1780},"end":{"line":34,"column":42,"offset":1914},"indent":[1]}},{"type":"listItem","spread":false,"checked":null,"children":[{"type":"paragraph","children":[{"type":"strong","children":[{"type":"text","value":"return false;","position":{"start":{"line":35,"column":5,"offset":1919},"end":{"line":35,"column":18,"offset":1932},"indent":[]}}],"position":{"start":{"line":35,"column":3,"offset":1917},"end":{"line":35,"column":20,"offset":1934},"indent":[]}},{"type":"text","value":" If you return false the inhibitor will not block the error.","position":{"start":{"line":35,"column":20,"offset":1934},"end":{"line":35,"column":80,"offset":1994},"indent":[]}}],"position":{"start":{"line":35,"column":3,"offset":1917},"end":{"line":35,"column":80,"offset":1994},"indent":[]}}],"position":{"start":{"line":35,"column":1,"offset":1915},"end":{"line":35,"column":80,"offset":1994},"indent":[]}}],"position":{"start":{"line":33,"column":1,"offset":1780},"end":{"line":35,"column":80,"offset":1994},"indent":[1,1]}},{"type":"code","lang":"ts","meta":null,"value":"// If the command is not VIP only we can allow this command to execute\nif (!command.vipOnly) return false;\n\n// The bot's support server\nconst guild = cache.guilds.get(configs.supportServerID);\n// If the command author is not in the server they won't have the vip role\nconst member = guild.members.get(message.author.id) || await getMember(guild.id, message.author.id);\n// Member doesn't exist so cancel the command\nif (!member) return true;\n\n// If the user has the vip role on the support server given by patreon allow the command\nif (member.roles.includes(configs.vipRoleID)) return false;\n\n// The user is NOT VIP so we throw an error\nthrow `The ${command.name} is only allowed for VIP users.`","position":{"start":{"line":38,"column":1,"offset":1997},"end":{"line":54,"column":4,"offset":2701},"indent":[1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1]}},{"type":"export","value":"export const _frontmatter = {\"title\":\"Creating Inhibitors!\",\"metaTitle\":\"Creating An Inhibitor | Discordeno\",\"metaDescription\":\"Let's create our very own bot with Discordeno!\"}","position":{"start":{"line":57,"column":1,"offset":2704},"end":{"line":57,"column":177,"offset":2880},"indent":[]}}],"position":{"start":{"line":1,"column":1,"offset":0},"end":{"line":57,"column":177,"offset":2880}}},"scopeImports":["import * as React from 'react'"],"scopeIdentifiers":["React"],"body":"function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }\n\nfunction _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }\n\nfunction _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }\n\n/* @jsx mdx */\nvar _frontmatter = {\n \"title\": \"Creating Inhibitors!\",\n \"metaTitle\": \"Creating An Inhibitor | Discordeno\",\n \"metaDescription\": \"Let's create our very own bot with Discordeno!\"\n};\nvar layoutProps = {\n _frontmatter: _frontmatter\n};\nvar MDXLayout = \"wrapper\";\nreturn function MDXContent(_ref) {\n var components = _ref.components,\n props = _objectWithoutProperties(_ref, [\"components\"]);\n\n return mdx(MDXLayout, _extends({}, layoutProps, props, {\n components: components,\n mdxType: \"MDXLayout\"\n }), mdx(\"p\", null, \"Woah! You are almost half way done with understanding all of Discordeno. Amazing isn't it? Something you may have noticed in the last section was there were some options that prevented some commands from running like \", mdx(\"inlineCode\", {\n parentName: \"p\"\n }, \"dmOnly\"), \" or the permission options. we created a setting to prevent the monitor from running in certain channels. What if we wanted to do prevent commands from happening? How would we prevent commands from running?\"), mdx(\"h2\", null, \"What is an Inhibitor?\"), mdx(\"p\", null, \"An Inhibitor is very similar to how monitors work. A monitor runs on every message but an inhibitor runs on every command. Remember all those command options like cooldown, permissions, permissionLevel, nsfw, etc... Each and every one of these options has an inhibitor in that checks commands for these settings.\"), mdx(\"p\", null, \"Let's create our own inhibitor that would prevent commands from being used if the user is not a VIP user.\"), mdx(\"blockquote\", null, mdx(\"p\", {\n parentName: \"blockquote\"\n }, mdx(\"strong\", {\n parentName: \"p\"\n }, \"Note:\"), \" It is important to remember that everything below can be done with a simple permission level as well. We will create our own custom permission levels but for the purposes of this guide and to be able to learn about Inhibitors, we will be using an inhibitor.\")), mdx(\"h2\", null, \"Creating the File\"), mdx(\"p\", null, \"Let's start by creating a file inside the inhibitors folder called \", mdx(\"inlineCode\", {\n parentName: \"p\"\n }, \"boosted.ts\"), \" and paste the following snippet of code:\"), mdx(\"pre\", null, mdx(\"code\", _extends({\n parentName: \"pre\"\n }, {\n \"className\": \"language-ts\"\n }), \"import { botCache } from \\\"../../mod.ts\\\";\\n\\nbotCache.inhibitors.set(\\\"inhibitorname\\\", async function (message, command, guild) {\\n // Your code goes here\\n});\\n\")), mdx(\"p\", null, \"Inhibitors can take up to 3 arguments.\"), mdx(\"ul\", null, mdx(\"li\", {\n parentName: \"ul\"\n }, mdx(\"inlineCode\", {\n parentName: \"li\"\n }, \"message\"), \": The message object that triggered the command.\"), mdx(\"li\", {\n parentName: \"ul\"\n }, mdx(\"inlineCode\", {\n parentName: \"li\"\n }, \"command\"), \": The command object itself that was triggered.\"), mdx(\"li\", {\n parentName: \"ul\"\n }, mdx(\"inlineCode\", {\n parentName: \"li\"\n }, \"guild\"), \": The server guild object where this command was ran.\")), mdx(\"h2\", null, \"Understanding How Inhibitors Function\"), mdx(\"p\", null, \"To block a command you have to return a truthy value.\"), mdx(\"ul\", null, mdx(\"li\", {\n parentName: \"ul\"\n }, mdx(\"strong\", {\n parentName: \"li\"\n }, \"return true;\"), \" If you return true the inhibitor will block the execution of the command.\\nTo allow a command return a falsey value.\"), mdx(\"li\", {\n parentName: \"ul\"\n }, mdx(\"strong\", {\n parentName: \"li\"\n }, \"return false;\"), \" If you return false the inhibitor will not block the error.\")), mdx(\"pre\", null, mdx(\"code\", _extends({\n parentName: \"pre\"\n }, {\n \"className\": \"language-ts\"\n }), \"// If the command is not VIP only we can allow this command to execute\\nif (!command.vipOnly) return false;\\n\\n// The bot's support server\\nconst guild = cache.guilds.get(configs.supportServerID);\\n// If the command author is not in the server they won't have the vip role\\nconst member = guild.members.get(message.author.id) || await getMember(guild.id, message.author.id);\\n// Member doesn't exist so cancel the command\\nif (!member) return true;\\n\\n// If the user has the vip role on the support server given by patreon allow the command\\nif (member.roles.includes(configs.vipRoleID)) return false;\\n\\n// The user is NOT VIP so we throw an error\\nthrow `The ${command.name} is only allowed for VIP users.`\\n\")));\n}\n;\nMDXContent.isMDXComponent = true;","rawMDXOutput":"/* @jsx mdx */\nimport { mdx } from '@mdx-js/react';\n/* @jsx mdx */\n\nexport const _frontmatter = {\n \"title\": \"Creating Inhibitors!\",\n \"metaTitle\": \"Creating An Inhibitor | Discordeno\",\n \"metaDescription\": \"Let's create our very own bot with Discordeno!\"\n};\n\nconst layoutProps = {\n _frontmatter\n};\nconst MDXLayout = \"wrapper\"\nexport default function MDXContent({\n components,\n ...props\n}) {\n return \n

{`Woah! You are almost half way done with understanding all of Discordeno. Amazing isn't it? Something you may have noticed in the last section was there were some options that prevented some commands from running like `}{`dmOnly`}{` or the permission options. we created a setting to prevent the monitor from running in certain channels. What if we wanted to do prevent commands from happening? How would we prevent commands from running?`}

\n

{`What is an Inhibitor?`}

\n

{`An Inhibitor is very similar to how monitors work. A monitor runs on every message but an inhibitor runs on every command. Remember all those command options like cooldown, permissions, permissionLevel, nsfw, etc... Each and every one of these options has an inhibitor in that checks commands for these settings.`}

\n

{`Let's create our own inhibitor that would prevent commands from being used if the user is not a VIP user.`}

\n
\n

{`Note:`}{` It is important to remember that everything below can be done with a simple permission level as well. We will create our own custom permission levels but for the purposes of this guide and to be able to learn about Inhibitors, we will be using an inhibitor.`}

\n
\n

{`Creating the File`}

\n

{`Let's start by creating a file inside the inhibitors folder called `}{`boosted.ts`}{` and paste the following snippet of code:`}

\n
{`import { botCache } from \"../../mod.ts\";\n\nbotCache.inhibitors.set(\"inhibitorname\", async function (message, command, guild) {\n    // Your code goes here\n});\n`}
\n

{`Inhibitors can take up to 3 arguments.`}

\n
    \n
  • {`message`}{`: The message object that triggered the command.`}
  • \n
  • {`command`}{`: The command object itself that was triggered.`}
  • \n
  • {`guild`}{`: The server guild object where this command was ran.`}
  • \n
\n

{`Understanding How Inhibitors Function`}

\n

{`To block a command you have to return a truthy value.`}

\n
    \n
  • {`return true;`}{` If you return true the inhibitor will block the execution of the command.\nTo allow a command return a falsey value.`}
  • \n
  • {`return false;`}{` If you return false the inhibitor will not block the error.`}
  • \n
\n
{`// If the command is not VIP only we can allow this command to execute\nif (!command.vipOnly) return false;\n\n// The bot's support server\nconst guild = cache.guilds.get(configs.supportServerID);\n// If the command author is not in the server they won't have the vip role\nconst member = guild.members.get(message.author.id) || await getMember(guild.id, message.author.id);\n// Member doesn't exist so cancel the command\nif (!member) return true;\n\n// If the user has the vip role on the support server given by patreon allow the command\nif (member.roles.includes(configs.vipRoleID)) return false;\n\n// The user is NOT VIP so we throw an error\nthrow \\`The \\${command.name} is only allowed for VIP users.\\`\n`}
\n\n
;\n}\n\n;\nMDXContent.isMDXComponent = true;"}} \ No newline at end of file diff --git a/docs/.cache/caches/gatsby-plugin-mdx/diskstore-a3edef28539a644dcce547dcfb8618ce.json b/docs/.cache/caches/gatsby-plugin-mdx/diskstore-a3edef28539a644dcce547dcfb8618ce.json new file mode 100644 index 000000000..ea5cb5af1 --- /dev/null +++ b/docs/.cache/caches/gatsby-plugin-mdx/diskstore-a3edef28539a644dcce547dcfb8618ce.json @@ -0,0 +1 @@ +{"expireTime":9007200851634245000,"key":"gatsby-plugin-mdx-entire-payload-f014d2b229e45931fce9fbe4a54c9603-","val":{"mdast":{"type":"root","children":[{"type":"paragraph","children":[{"type":"text","value":"Woah! You are almost half way done with understanding all of Discordeno. Amazing isn't it? Something you may have noticed in the last section was there were some options that prevented some commands from running like ","position":{"start":{"line":2,"column":1,"offset":1},"end":{"line":2,"column":218,"offset":218},"indent":[]}},{"type":"inlineCode","value":"dmOnly","position":{"start":{"line":2,"column":218,"offset":218},"end":{"line":2,"column":226,"offset":226},"indent":[]}},{"type":"text","value":" or the permission options. we created a setting to prevent the monitor from running in certain channels. What if we wanted to do prevent commands from happening? How would we prevent commands from running?","position":{"start":{"line":2,"column":226,"offset":226},"end":{"line":2,"column":432,"offset":432},"indent":[]}}],"position":{"start":{"line":2,"column":1,"offset":1},"end":{"line":2,"column":432,"offset":432},"indent":[]}},{"type":"heading","depth":2,"children":[{"type":"text","value":"What is an Inhibitor?","position":{"start":{"line":4,"column":4,"offset":437},"end":{"line":4,"column":25,"offset":458},"indent":[]}}],"position":{"start":{"line":4,"column":1,"offset":434},"end":{"line":4,"column":25,"offset":458},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"An Inhibitor is very similar to how monitors work. A monitor runs on every message but an inhibitor runs on every command. Remember all those command options like cooldown, permissions, permissionLevel, nsfw, etc... Each and every one of these options has an inhibitor in that checks commands for these settings.","position":{"start":{"line":6,"column":1,"offset":460},"end":{"line":6,"column":313,"offset":772},"indent":[]}}],"position":{"start":{"line":6,"column":1,"offset":460},"end":{"line":6,"column":313,"offset":772},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"Let's create our own inhibitor that would prevent commands from being used if the user is not a VIP user.","position":{"start":{"line":8,"column":1,"offset":774},"end":{"line":8,"column":106,"offset":879},"indent":[]}}],"position":{"start":{"line":8,"column":1,"offset":774},"end":{"line":8,"column":106,"offset":879},"indent":[]}},{"type":"blockquote","children":[{"type":"paragraph","children":[{"type":"strong","children":[{"type":"text","value":"Note:","position":{"start":{"line":10,"column":5,"offset":885},"end":{"line":10,"column":10,"offset":890},"indent":[]}}],"position":{"start":{"line":10,"column":3,"offset":883},"end":{"line":10,"column":12,"offset":892},"indent":[]}},{"type":"text","value":" It is important to remember that everything below can be done with a simple permission level as well. We will create our own custom permission levels but for the purposes of this guide and to be able to learn about Inhibitors, we will be using an inhibitor.","position":{"start":{"line":10,"column":12,"offset":892},"end":{"line":10,"column":270,"offset":1150},"indent":[]}}],"position":{"start":{"line":10,"column":3,"offset":883},"end":{"line":10,"column":270,"offset":1150},"indent":[]}}],"position":{"start":{"line":10,"column":1,"offset":881},"end":{"line":10,"column":270,"offset":1150},"indent":[]}},{"type":"heading","depth":2,"children":[{"type":"text","value":"Creating the File","position":{"start":{"line":12,"column":4,"offset":1155},"end":{"line":12,"column":21,"offset":1172},"indent":[]}}],"position":{"start":{"line":12,"column":1,"offset":1152},"end":{"line":12,"column":21,"offset":1172},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"Let's start by creating a file inside the inhibitors folder called ","position":{"start":{"line":14,"column":1,"offset":1174},"end":{"line":14,"column":68,"offset":1241},"indent":[]}},{"type":"inlineCode","value":"boosted.ts","position":{"start":{"line":14,"column":68,"offset":1241},"end":{"line":14,"column":80,"offset":1253},"indent":[]}},{"type":"text","value":" and paste the following snippet of code:","position":{"start":{"line":14,"column":80,"offset":1253},"end":{"line":14,"column":121,"offset":1294},"indent":[]}}],"position":{"start":{"line":14,"column":1,"offset":1174},"end":{"line":14,"column":121,"offset":1294},"indent":[]}},{"type":"code","lang":"ts","meta":null,"value":"import { botCache } from \"../../mod.ts\";\n\nbotCache.inhibitors.set(\"inhibitorname\", async function (message, command, guild) {\n\t// Your code goes here\n});","position":{"start":{"line":16,"column":1,"offset":1296},"end":{"line":22,"column":4,"offset":1459},"indent":[1,1,1,1,1,1]}},{"type":"paragraph","children":[{"type":"text","value":"Inhibitors can take up to 3 arguments.","position":{"start":{"line":24,"column":1,"offset":1461},"end":{"line":24,"column":39,"offset":1499},"indent":[]}}],"position":{"start":{"line":24,"column":1,"offset":1461},"end":{"line":24,"column":39,"offset":1499},"indent":[]}},{"type":"list","ordered":false,"start":null,"spread":false,"children":[{"type":"listItem","spread":false,"checked":null,"children":[{"type":"paragraph","children":[{"type":"inlineCode","value":"message","position":{"start":{"line":26,"column":3,"offset":1503},"end":{"line":26,"column":12,"offset":1512},"indent":[]}},{"type":"text","value":": The message object that triggered the command.","position":{"start":{"line":26,"column":12,"offset":1512},"end":{"line":26,"column":60,"offset":1560},"indent":[]}}],"position":{"start":{"line":26,"column":3,"offset":1503},"end":{"line":26,"column":60,"offset":1560},"indent":[]}}],"position":{"start":{"line":26,"column":1,"offset":1501},"end":{"line":26,"column":60,"offset":1560},"indent":[]}},{"type":"listItem","spread":false,"checked":null,"children":[{"type":"paragraph","children":[{"type":"inlineCode","value":"command","position":{"start":{"line":27,"column":3,"offset":1563},"end":{"line":27,"column":12,"offset":1572},"indent":[]}},{"type":"text","value":": The command object itself that was triggered.","position":{"start":{"line":27,"column":12,"offset":1572},"end":{"line":27,"column":59,"offset":1619},"indent":[]}}],"position":{"start":{"line":27,"column":3,"offset":1563},"end":{"line":27,"column":59,"offset":1619},"indent":[]}}],"position":{"start":{"line":27,"column":1,"offset":1561},"end":{"line":27,"column":59,"offset":1619},"indent":[]}},{"type":"listItem","spread":false,"checked":null,"children":[{"type":"paragraph","children":[{"type":"inlineCode","value":"guild","position":{"start":{"line":28,"column":3,"offset":1622},"end":{"line":28,"column":10,"offset":1629},"indent":[]}},{"type":"text","value":": The server guild object where this command was ran.","position":{"start":{"line":28,"column":10,"offset":1629},"end":{"line":28,"column":63,"offset":1682},"indent":[]}}],"position":{"start":{"line":28,"column":3,"offset":1622},"end":{"line":28,"column":63,"offset":1682},"indent":[]}}],"position":{"start":{"line":28,"column":1,"offset":1620},"end":{"line":28,"column":63,"offset":1682},"indent":[]}}],"position":{"start":{"line":26,"column":1,"offset":1501},"end":{"line":28,"column":63,"offset":1682},"indent":[1,1]}},{"type":"heading","depth":2,"children":[{"type":"text","value":"Understanding How Inhibitors Function","position":{"start":{"line":30,"column":4,"offset":1687},"end":{"line":30,"column":41,"offset":1724},"indent":[]}}],"position":{"start":{"line":30,"column":1,"offset":1684},"end":{"line":30,"column":41,"offset":1724},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"To block a command you have to return a truthy value.","position":{"start":{"line":32,"column":1,"offset":1726},"end":{"line":32,"column":54,"offset":1779},"indent":[]}}],"position":{"start":{"line":32,"column":1,"offset":1726},"end":{"line":32,"column":54,"offset":1779},"indent":[]}},{"type":"list","ordered":false,"start":null,"spread":false,"children":[{"type":"listItem","spread":false,"checked":null,"children":[{"type":"paragraph","children":[{"type":"strong","children":[{"type":"text","value":"return true;","position":{"start":{"line":33,"column":5,"offset":1784},"end":{"line":33,"column":17,"offset":1796},"indent":[]}}],"position":{"start":{"line":33,"column":3,"offset":1782},"end":{"line":33,"column":19,"offset":1798},"indent":[]}},{"type":"text","value":" If you return true the inhibitor will block the execution of the command.\nTo allow a command return a falsey value.","position":{"start":{"line":33,"column":19,"offset":1798},"end":{"line":34,"column":42,"offset":1914},"indent":[1]}}],"position":{"start":{"line":33,"column":3,"offset":1782},"end":{"line":34,"column":42,"offset":1914},"indent":[1]}}],"position":{"start":{"line":33,"column":1,"offset":1780},"end":{"line":34,"column":42,"offset":1914},"indent":[1]}},{"type":"listItem","spread":false,"checked":null,"children":[{"type":"paragraph","children":[{"type":"strong","children":[{"type":"text","value":"return false;","position":{"start":{"line":35,"column":5,"offset":1919},"end":{"line":35,"column":18,"offset":1932},"indent":[]}}],"position":{"start":{"line":35,"column":3,"offset":1917},"end":{"line":35,"column":20,"offset":1934},"indent":[]}},{"type":"text","value":" If you return false the inhibitor will not block the error.","position":{"start":{"line":35,"column":20,"offset":1934},"end":{"line":35,"column":80,"offset":1994},"indent":[]}}],"position":{"start":{"line":35,"column":3,"offset":1917},"end":{"line":35,"column":80,"offset":1994},"indent":[]}}],"position":{"start":{"line":35,"column":1,"offset":1915},"end":{"line":35,"column":80,"offset":1994},"indent":[]}}],"position":{"start":{"line":33,"column":1,"offset":1780},"end":{"line":35,"column":80,"offset":1994},"indent":[1,1]}},{"type":"code","lang":"ts","meta":null,"value":"// If the command is not VIP only we can allow this command to execute\nif (!command.vipOnly) return false;\n\n// The bot's support server\nconst guild = cache.guilds.get(configs.supportServerID);\n// If the command author is not in the server they won't have the vip role\nconst member = guild.members.get(message.author.id) || await getMember(guild.id, message.author.id);\n// Member doesn't exist so cancel the command\nif (!member) return true;\n\nif the user has the vip role on the support server given by patreon\nif (userIsVIP) return false;\n\n// The user is NOT VIP so we throw an error\nthrow `The ${command.name} is only allowed for VIP users.`","position":{"start":{"line":38,"column":1,"offset":1997},"end":{"line":54,"column":4,"offset":2649},"indent":[1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1]}},{"type":"export","value":"export const _frontmatter = {\"title\":\"Creating Inhibitors!\",\"metaTitle\":\"Creating An Inhibitor | Discordeno\",\"metaDescription\":\"Let's create our very own bot with Discordeno!\"}","position":{"start":{"line":57,"column":1,"offset":2652},"end":{"line":57,"column":177,"offset":2828},"indent":[]}}],"position":{"start":{"line":1,"column":1,"offset":0},"end":{"line":57,"column":177,"offset":2828}}},"scopeImports":["import * as React from 'react'"],"scopeIdentifiers":["React"],"body":"function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }\n\nfunction _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }\n\nfunction _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }\n\n/* @jsx mdx */\nvar _frontmatter = {\n \"title\": \"Creating Inhibitors!\",\n \"metaTitle\": \"Creating An Inhibitor | Discordeno\",\n \"metaDescription\": \"Let's create our very own bot with Discordeno!\"\n};\nvar layoutProps = {\n _frontmatter: _frontmatter\n};\nvar MDXLayout = \"wrapper\";\nreturn function MDXContent(_ref) {\n var components = _ref.components,\n props = _objectWithoutProperties(_ref, [\"components\"]);\n\n return mdx(MDXLayout, _extends({}, layoutProps, props, {\n components: components,\n mdxType: \"MDXLayout\"\n }), mdx(\"p\", null, \"Woah! You are almost half way done with understanding all of Discordeno. Amazing isn't it? Something you may have noticed in the last section was there were some options that prevented some commands from running like \", mdx(\"inlineCode\", {\n parentName: \"p\"\n }, \"dmOnly\"), \" or the permission options. we created a setting to prevent the monitor from running in certain channels. What if we wanted to do prevent commands from happening? How would we prevent commands from running?\"), mdx(\"h2\", null, \"What is an Inhibitor?\"), mdx(\"p\", null, \"An Inhibitor is very similar to how monitors work. A monitor runs on every message but an inhibitor runs on every command. Remember all those command options like cooldown, permissions, permissionLevel, nsfw, etc... Each and every one of these options has an inhibitor in that checks commands for these settings.\"), mdx(\"p\", null, \"Let's create our own inhibitor that would prevent commands from being used if the user is not a VIP user.\"), mdx(\"blockquote\", null, mdx(\"p\", {\n parentName: \"blockquote\"\n }, mdx(\"strong\", {\n parentName: \"p\"\n }, \"Note:\"), \" It is important to remember that everything below can be done with a simple permission level as well. We will create our own custom permission levels but for the purposes of this guide and to be able to learn about Inhibitors, we will be using an inhibitor.\")), mdx(\"h2\", null, \"Creating the File\"), mdx(\"p\", null, \"Let's start by creating a file inside the inhibitors folder called \", mdx(\"inlineCode\", {\n parentName: \"p\"\n }, \"boosted.ts\"), \" and paste the following snippet of code:\"), mdx(\"pre\", null, mdx(\"code\", _extends({\n parentName: \"pre\"\n }, {\n \"className\": \"language-ts\"\n }), \"import { botCache } from \\\"../../mod.ts\\\";\\n\\nbotCache.inhibitors.set(\\\"inhibitorname\\\", async function (message, command, guild) {\\n // Your code goes here\\n});\\n\")), mdx(\"p\", null, \"Inhibitors can take up to 3 arguments.\"), mdx(\"ul\", null, mdx(\"li\", {\n parentName: \"ul\"\n }, mdx(\"inlineCode\", {\n parentName: \"li\"\n }, \"message\"), \": The message object that triggered the command.\"), mdx(\"li\", {\n parentName: \"ul\"\n }, mdx(\"inlineCode\", {\n parentName: \"li\"\n }, \"command\"), \": The command object itself that was triggered.\"), mdx(\"li\", {\n parentName: \"ul\"\n }, mdx(\"inlineCode\", {\n parentName: \"li\"\n }, \"guild\"), \": The server guild object where this command was ran.\")), mdx(\"h2\", null, \"Understanding How Inhibitors Function\"), mdx(\"p\", null, \"To block a command you have to return a truthy value.\"), mdx(\"ul\", null, mdx(\"li\", {\n parentName: \"ul\"\n }, mdx(\"strong\", {\n parentName: \"li\"\n }, \"return true;\"), \" If you return true the inhibitor will block the execution of the command.\\nTo allow a command return a falsey value.\"), mdx(\"li\", {\n parentName: \"ul\"\n }, mdx(\"strong\", {\n parentName: \"li\"\n }, \"return false;\"), \" If you return false the inhibitor will not block the error.\")), mdx(\"pre\", null, mdx(\"code\", _extends({\n parentName: \"pre\"\n }, {\n \"className\": \"language-ts\"\n }), \"// If the command is not VIP only we can allow this command to execute\\nif (!command.vipOnly) return false;\\n\\n// The bot's support server\\nconst guild = cache.guilds.get(configs.supportServerID);\\n// If the command author is not in the server they won't have the vip role\\nconst member = guild.members.get(message.author.id) || await getMember(guild.id, message.author.id);\\n// Member doesn't exist so cancel the command\\nif (!member) return true;\\n\\nif the user has the vip role on the support server given by patreon\\nif (userIsVIP) return false;\\n\\n// The user is NOT VIP so we throw an error\\nthrow `The ${command.name} is only allowed for VIP users.`\\n\")));\n}\n;\nMDXContent.isMDXComponent = true;","rawMDXOutput":"/* @jsx mdx */\nimport { mdx } from '@mdx-js/react';\n/* @jsx mdx */\n\nexport const _frontmatter = {\n \"title\": \"Creating Inhibitors!\",\n \"metaTitle\": \"Creating An Inhibitor | Discordeno\",\n \"metaDescription\": \"Let's create our very own bot with Discordeno!\"\n};\n\nconst layoutProps = {\n _frontmatter\n};\nconst MDXLayout = \"wrapper\"\nexport default function MDXContent({\n components,\n ...props\n}) {\n return \n

{`Woah! You are almost half way done with understanding all of Discordeno. Amazing isn't it? Something you may have noticed in the last section was there were some options that prevented some commands from running like `}{`dmOnly`}{` or the permission options. we created a setting to prevent the monitor from running in certain channels. What if we wanted to do prevent commands from happening? How would we prevent commands from running?`}

\n

{`What is an Inhibitor?`}

\n

{`An Inhibitor is very similar to how monitors work. A monitor runs on every message but an inhibitor runs on every command. Remember all those command options like cooldown, permissions, permissionLevel, nsfw, etc... Each and every one of these options has an inhibitor in that checks commands for these settings.`}

\n

{`Let's create our own inhibitor that would prevent commands from being used if the user is not a VIP user.`}

\n
\n

{`Note:`}{` It is important to remember that everything below can be done with a simple permission level as well. We will create our own custom permission levels but for the purposes of this guide and to be able to learn about Inhibitors, we will be using an inhibitor.`}

\n
\n

{`Creating the File`}

\n

{`Let's start by creating a file inside the inhibitors folder called `}{`boosted.ts`}{` and paste the following snippet of code:`}

\n
{`import { botCache } from \"../../mod.ts\";\n\nbotCache.inhibitors.set(\"inhibitorname\", async function (message, command, guild) {\n    // Your code goes here\n});\n`}
\n

{`Inhibitors can take up to 3 arguments.`}

\n
    \n
  • {`message`}{`: The message object that triggered the command.`}
  • \n
  • {`command`}{`: The command object itself that was triggered.`}
  • \n
  • {`guild`}{`: The server guild object where this command was ran.`}
  • \n
\n

{`Understanding How Inhibitors Function`}

\n

{`To block a command you have to return a truthy value.`}

\n
    \n
  • {`return true;`}{` If you return true the inhibitor will block the execution of the command.\nTo allow a command return a falsey value.`}
  • \n
  • {`return false;`}{` If you return false the inhibitor will not block the error.`}
  • \n
\n
{`// If the command is not VIP only we can allow this command to execute\nif (!command.vipOnly) return false;\n\n// The bot's support server\nconst guild = cache.guilds.get(configs.supportServerID);\n// If the command author is not in the server they won't have the vip role\nconst member = guild.members.get(message.author.id) || await getMember(guild.id, message.author.id);\n// Member doesn't exist so cancel the command\nif (!member) return true;\n\nif the user has the vip role on the support server given by patreon\nif (userIsVIP) return false;\n\n// The user is NOT VIP so we throw an error\nthrow \\`The \\${command.name} is only allowed for VIP users.\\`\n`}
\n\n
;\n}\n\n;\nMDXContent.isMDXComponent = true;"}} \ No newline at end of file diff --git a/docs/.cache/caches/gatsby-plugin-mdx/diskstore-a40bfb7aaed68f24c0c77f8251f6cc93.json b/docs/.cache/caches/gatsby-plugin-mdx/diskstore-a40bfb7aaed68f24c0c77f8251f6cc93.json new file mode 100644 index 000000000..b5d6c492b --- /dev/null +++ b/docs/.cache/caches/gatsby-plugin-mdx/diskstore-a40bfb7aaed68f24c0c77f8251f6cc93.json @@ -0,0 +1 @@ +{"expireTime":9007200851634049000,"key":"gatsby-plugin-mdx-entire-payload-d8ea7cf549e0fbbc73af87f66b46f5db-","val":{"mdast":{"type":"root","children":[{"type":"paragraph","children":[{"type":"text","value":"Woah! You are almost half way done with understanding all of Discordeno. Amazing isn't it? Something you may have noticed in the last section was there were some options that prevented some commands from running like ","position":{"start":{"line":2,"column":1,"offset":1},"end":{"line":2,"column":218,"offset":218},"indent":[]}},{"type":"inlineCode","value":"dmOnly","position":{"start":{"line":2,"column":218,"offset":218},"end":{"line":2,"column":226,"offset":226},"indent":[]}},{"type":"text","value":" or the permission options. we created a setting to prevent the monitor from running in certain channels. What if we wanted to do prevent commands from happening? How would we prevent commands from running?","position":{"start":{"line":2,"column":226,"offset":226},"end":{"line":2,"column":432,"offset":432},"indent":[]}}],"position":{"start":{"line":2,"column":1,"offset":1},"end":{"line":2,"column":432,"offset":432},"indent":[]}},{"type":"heading","depth":2,"children":[{"type":"text","value":"What is an Inhibitor?","position":{"start":{"line":4,"column":4,"offset":437},"end":{"line":4,"column":25,"offset":458},"indent":[]}}],"position":{"start":{"line":4,"column":1,"offset":434},"end":{"line":4,"column":25,"offset":458},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"An Inhibitor is very similar to how monitors work. A monitor runs on every message but an inhibitor runs on every command. Remember all those command options like cooldown, permissions, permissionLevel, nsfw, etc... Each and every one of these options has an inhibitor in that checks commands for these settings.","position":{"start":{"line":6,"column":1,"offset":460},"end":{"line":6,"column":313,"offset":772},"indent":[]}}],"position":{"start":{"line":6,"column":1,"offset":460},"end":{"line":6,"column":313,"offset":772},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"Let's create our own inhibitor that would prevent commands from being used if the user is not a VIP user.","position":{"start":{"line":8,"column":1,"offset":774},"end":{"line":8,"column":106,"offset":879},"indent":[]}}],"position":{"start":{"line":8,"column":1,"offset":774},"end":{"line":8,"column":106,"offset":879},"indent":[]}},{"type":"blockquote","children":[{"type":"paragraph","children":[{"type":"strong","children":[{"type":"text","value":"Note:","position":{"start":{"line":10,"column":5,"offset":885},"end":{"line":10,"column":10,"offset":890},"indent":[]}}],"position":{"start":{"line":10,"column":3,"offset":883},"end":{"line":10,"column":12,"offset":892},"indent":[]}},{"type":"text","value":" It is important to remember that everything below can be done with a simple permission level as well. We will create our own custom permission levels but for the purposes of this guide and to be able to learn about Inhibitors, we will be using an inhibitor.","position":{"start":{"line":10,"column":12,"offset":892},"end":{"line":10,"column":270,"offset":1150},"indent":[]}}],"position":{"start":{"line":10,"column":3,"offset":883},"end":{"line":10,"column":270,"offset":1150},"indent":[]}}],"position":{"start":{"line":10,"column":1,"offset":881},"end":{"line":10,"column":270,"offset":1150},"indent":[]}},{"type":"heading","depth":2,"children":[{"type":"text","value":"Creating the File","position":{"start":{"line":12,"column":4,"offset":1155},"end":{"line":12,"column":21,"offset":1172},"indent":[]}}],"position":{"start":{"line":12,"column":1,"offset":1152},"end":{"line":12,"column":21,"offset":1172},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"Let's start by creating a file inside the inhibitors folder called ","position":{"start":{"line":14,"column":1,"offset":1174},"end":{"line":14,"column":68,"offset":1241},"indent":[]}},{"type":"inlineCode","value":"boostRequired.ts","position":{"start":{"line":14,"column":68,"offset":1241},"end":{"line":14,"column":86,"offset":1259},"indent":[]}},{"type":"text","value":" and paste the following snippet of code:","position":{"start":{"line":14,"column":86,"offset":1259},"end":{"line":14,"column":127,"offset":1300},"indent":[]}}],"position":{"start":{"line":14,"column":1,"offset":1174},"end":{"line":14,"column":127,"offset":1300},"indent":[]}},{"type":"code","lang":"ts","meta":null,"value":"import { botCache } from \"../../mod.ts\";\n\nbotCache.inhibitors.set(\"inhibitorname\", async function (message, command, guild) {\n\t// Your code goes here\n});","position":{"start":{"line":16,"column":1,"offset":1302},"end":{"line":22,"column":4,"offset":1465},"indent":[1,1,1,1,1,1]}},{"type":"paragraph","children":[{"type":"text","value":"Inhibitors can take up to 3 arguments.","position":{"start":{"line":24,"column":1,"offset":1467},"end":{"line":24,"column":39,"offset":1505},"indent":[]}}],"position":{"start":{"line":24,"column":1,"offset":1467},"end":{"line":24,"column":39,"offset":1505},"indent":[]}},{"type":"list","ordered":false,"start":null,"spread":false,"children":[{"type":"listItem","spread":false,"checked":null,"children":[{"type":"paragraph","children":[{"type":"inlineCode","value":"message","position":{"start":{"line":26,"column":3,"offset":1509},"end":{"line":26,"column":12,"offset":1518},"indent":[]}},{"type":"text","value":": The message object that triggered the command.","position":{"start":{"line":26,"column":12,"offset":1518},"end":{"line":26,"column":60,"offset":1566},"indent":[]}}],"position":{"start":{"line":26,"column":3,"offset":1509},"end":{"line":26,"column":60,"offset":1566},"indent":[]}}],"position":{"start":{"line":26,"column":1,"offset":1507},"end":{"line":26,"column":60,"offset":1566},"indent":[]}},{"type":"listItem","spread":false,"checked":null,"children":[{"type":"paragraph","children":[{"type":"inlineCode","value":"command","position":{"start":{"line":27,"column":3,"offset":1569},"end":{"line":27,"column":12,"offset":1578},"indent":[]}},{"type":"text","value":": The command object itself that was triggered.","position":{"start":{"line":27,"column":12,"offset":1578},"end":{"line":27,"column":59,"offset":1625},"indent":[]}}],"position":{"start":{"line":27,"column":3,"offset":1569},"end":{"line":27,"column":59,"offset":1625},"indent":[]}}],"position":{"start":{"line":27,"column":1,"offset":1567},"end":{"line":27,"column":59,"offset":1625},"indent":[]}},{"type":"listItem","spread":false,"checked":null,"children":[{"type":"paragraph","children":[{"type":"inlineCode","value":"guild","position":{"start":{"line":28,"column":3,"offset":1628},"end":{"line":28,"column":10,"offset":1635},"indent":[]}},{"type":"text","value":": The server guild object where this command was ran.","position":{"start":{"line":28,"column":10,"offset":1635},"end":{"line":28,"column":63,"offset":1688},"indent":[]}}],"position":{"start":{"line":28,"column":3,"offset":1628},"end":{"line":28,"column":63,"offset":1688},"indent":[]}}],"position":{"start":{"line":28,"column":1,"offset":1626},"end":{"line":28,"column":63,"offset":1688},"indent":[]}}],"position":{"start":{"line":26,"column":1,"offset":1507},"end":{"line":28,"column":63,"offset":1688},"indent":[1,1]}},{"type":"heading","depth":2,"children":[{"type":"text","value":"Understanding How Inhibitors Function","position":{"start":{"line":30,"column":4,"offset":1693},"end":{"line":30,"column":41,"offset":1730},"indent":[]}}],"position":{"start":{"line":30,"column":1,"offset":1690},"end":{"line":30,"column":41,"offset":1730},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"To block a command you have to return a truthy value.","position":{"start":{"line":32,"column":1,"offset":1732},"end":{"line":32,"column":54,"offset":1785},"indent":[]}}],"position":{"start":{"line":32,"column":1,"offset":1732},"end":{"line":32,"column":54,"offset":1785},"indent":[]}},{"type":"list","ordered":false,"start":null,"spread":false,"children":[{"type":"listItem","spread":false,"checked":null,"children":[{"type":"paragraph","children":[{"type":"strong","children":[{"type":"text","value":"return true;","position":{"start":{"line":33,"column":5,"offset":1790},"end":{"line":33,"column":17,"offset":1802},"indent":[]}}],"position":{"start":{"line":33,"column":3,"offset":1788},"end":{"line":33,"column":19,"offset":1804},"indent":[]}},{"type":"text","value":" If you return true the inhibitor will block the execution of the command.\nTo allow a command return a falsey value.","position":{"start":{"line":33,"column":19,"offset":1804},"end":{"line":34,"column":42,"offset":1920},"indent":[1]}}],"position":{"start":{"line":33,"column":3,"offset":1788},"end":{"line":34,"column":42,"offset":1920},"indent":[1]}}],"position":{"start":{"line":33,"column":1,"offset":1786},"end":{"line":34,"column":42,"offset":1920},"indent":[1]}},{"type":"listItem","spread":false,"checked":null,"children":[{"type":"paragraph","children":[{"type":"strong","children":[{"type":"text","value":"return false;","position":{"start":{"line":35,"column":5,"offset":1925},"end":{"line":35,"column":18,"offset":1938},"indent":[]}}],"position":{"start":{"line":35,"column":3,"offset":1923},"end":{"line":35,"column":20,"offset":1940},"indent":[]}},{"type":"text","value":" If you return false the inhibitor will not block the error.","position":{"start":{"line":35,"column":20,"offset":1940},"end":{"line":35,"column":80,"offset":2000},"indent":[]}}],"position":{"start":{"line":35,"column":3,"offset":1923},"end":{"line":35,"column":80,"offset":2000},"indent":[]}}],"position":{"start":{"line":35,"column":1,"offset":1921},"end":{"line":35,"column":80,"offset":2000},"indent":[]}}],"position":{"start":{"line":33,"column":1,"offset":1786},"end":{"line":35,"column":80,"offset":2000},"indent":[1,1]}},{"type":"code","lang":"ts","meta":null,"value":"// If the command does not require a nitro boost we can allow this command to execute\nif (!command.boostRequired) return false;\n\n// Check if the user has boosted this server\nconst userIsVIP = m\n// The user is VIP so we can allow this command to be used\nif (userIsVIP) return false;\n\n// The user is NOT VIP so we throw an error\nthrow `The ${command.name} is only allowed for VIP users.`","position":{"start":{"line":38,"column":1,"offset":2003},"end":{"line":49,"column":4,"offset":2398},"indent":[1,1,1,1,1,1,1,1,1,1,1]}},{"type":"export","value":"export const _frontmatter = {\"title\":\"Creating Inhibitors!\",\"metaTitle\":\"Creating An Inhibitor | Discordeno\",\"metaDescription\":\"Let's create our very own bot with Discordeno!\"}","position":{"start":{"line":52,"column":1,"offset":2401},"end":{"line":52,"column":177,"offset":2577},"indent":[]}}],"position":{"start":{"line":1,"column":1,"offset":0},"end":{"line":52,"column":177,"offset":2577}}},"scopeImports":["import * as React from 'react'"],"scopeIdentifiers":["React"],"body":"function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }\n\nfunction _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }\n\nfunction _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }\n\n/* @jsx mdx */\nvar _frontmatter = {\n \"title\": \"Creating Inhibitors!\",\n \"metaTitle\": \"Creating An Inhibitor | Discordeno\",\n \"metaDescription\": \"Let's create our very own bot with Discordeno!\"\n};\nvar layoutProps = {\n _frontmatter: _frontmatter\n};\nvar MDXLayout = \"wrapper\";\nreturn function MDXContent(_ref) {\n var components = _ref.components,\n props = _objectWithoutProperties(_ref, [\"components\"]);\n\n return mdx(MDXLayout, _extends({}, layoutProps, props, {\n components: components,\n mdxType: \"MDXLayout\"\n }), mdx(\"p\", null, \"Woah! You are almost half way done with understanding all of Discordeno. Amazing isn't it? Something you may have noticed in the last section was there were some options that prevented some commands from running like \", mdx(\"inlineCode\", {\n parentName: \"p\"\n }, \"dmOnly\"), \" or the permission options. we created a setting to prevent the monitor from running in certain channels. What if we wanted to do prevent commands from happening? How would we prevent commands from running?\"), mdx(\"h2\", null, \"What is an Inhibitor?\"), mdx(\"p\", null, \"An Inhibitor is very similar to how monitors work. A monitor runs on every message but an inhibitor runs on every command. Remember all those command options like cooldown, permissions, permissionLevel, nsfw, etc... Each and every one of these options has an inhibitor in that checks commands for these settings.\"), mdx(\"p\", null, \"Let's create our own inhibitor that would prevent commands from being used if the user is not a VIP user.\"), mdx(\"blockquote\", null, mdx(\"p\", {\n parentName: \"blockquote\"\n }, mdx(\"strong\", {\n parentName: \"p\"\n }, \"Note:\"), \" It is important to remember that everything below can be done with a simple permission level as well. We will create our own custom permission levels but for the purposes of this guide and to be able to learn about Inhibitors, we will be using an inhibitor.\")), mdx(\"h2\", null, \"Creating the File\"), mdx(\"p\", null, \"Let's start by creating a file inside the inhibitors folder called \", mdx(\"inlineCode\", {\n parentName: \"p\"\n }, \"boostRequired.ts\"), \" and paste the following snippet of code:\"), mdx(\"pre\", null, mdx(\"code\", _extends({\n parentName: \"pre\"\n }, {\n \"className\": \"language-ts\"\n }), \"import { botCache } from \\\"../../mod.ts\\\";\\n\\nbotCache.inhibitors.set(\\\"inhibitorname\\\", async function (message, command, guild) {\\n // Your code goes here\\n});\\n\")), mdx(\"p\", null, \"Inhibitors can take up to 3 arguments.\"), mdx(\"ul\", null, mdx(\"li\", {\n parentName: \"ul\"\n }, mdx(\"inlineCode\", {\n parentName: \"li\"\n }, \"message\"), \": The message object that triggered the command.\"), mdx(\"li\", {\n parentName: \"ul\"\n }, mdx(\"inlineCode\", {\n parentName: \"li\"\n }, \"command\"), \": The command object itself that was triggered.\"), mdx(\"li\", {\n parentName: \"ul\"\n }, mdx(\"inlineCode\", {\n parentName: \"li\"\n }, \"guild\"), \": The server guild object where this command was ran.\")), mdx(\"h2\", null, \"Understanding How Inhibitors Function\"), mdx(\"p\", null, \"To block a command you have to return a truthy value.\"), mdx(\"ul\", null, mdx(\"li\", {\n parentName: \"ul\"\n }, mdx(\"strong\", {\n parentName: \"li\"\n }, \"return true;\"), \" If you return true the inhibitor will block the execution of the command.\\nTo allow a command return a falsey value.\"), mdx(\"li\", {\n parentName: \"ul\"\n }, mdx(\"strong\", {\n parentName: \"li\"\n }, \"return false;\"), \" If you return false the inhibitor will not block the error.\")), mdx(\"pre\", null, mdx(\"code\", _extends({\n parentName: \"pre\"\n }, {\n \"className\": \"language-ts\"\n }), \"// If the command does not require a nitro boost we can allow this command to execute\\nif (!command.boostRequired) return false;\\n\\n// Check if the user has boosted this server\\nconst userIsVIP = m\\n// The user is VIP so we can allow this command to be used\\nif (userIsVIP) return false;\\n\\n// The user is NOT VIP so we throw an error\\nthrow `The ${command.name} is only allowed for VIP users.`\\n\")));\n}\n;\nMDXContent.isMDXComponent = true;","rawMDXOutput":"/* @jsx mdx */\nimport { mdx } from '@mdx-js/react';\n/* @jsx mdx */\n\nexport const _frontmatter = {\n \"title\": \"Creating Inhibitors!\",\n \"metaTitle\": \"Creating An Inhibitor | Discordeno\",\n \"metaDescription\": \"Let's create our very own bot with Discordeno!\"\n};\n\nconst layoutProps = {\n _frontmatter\n};\nconst MDXLayout = \"wrapper\"\nexport default function MDXContent({\n components,\n ...props\n}) {\n return \n

{`Woah! You are almost half way done with understanding all of Discordeno. Amazing isn't it? Something you may have noticed in the last section was there were some options that prevented some commands from running like `}{`dmOnly`}{` or the permission options. we created a setting to prevent the monitor from running in certain channels. What if we wanted to do prevent commands from happening? How would we prevent commands from running?`}

\n

{`What is an Inhibitor?`}

\n

{`An Inhibitor is very similar to how monitors work. A monitor runs on every message but an inhibitor runs on every command. Remember all those command options like cooldown, permissions, permissionLevel, nsfw, etc... Each and every one of these options has an inhibitor in that checks commands for these settings.`}

\n

{`Let's create our own inhibitor that would prevent commands from being used if the user is not a VIP user.`}

\n
\n

{`Note:`}{` It is important to remember that everything below can be done with a simple permission level as well. We will create our own custom permission levels but for the purposes of this guide and to be able to learn about Inhibitors, we will be using an inhibitor.`}

\n
\n

{`Creating the File`}

\n

{`Let's start by creating a file inside the inhibitors folder called `}{`boostRequired.ts`}{` and paste the following snippet of code:`}

\n
{`import { botCache } from \"../../mod.ts\";\n\nbotCache.inhibitors.set(\"inhibitorname\", async function (message, command, guild) {\n    // Your code goes here\n});\n`}
\n

{`Inhibitors can take up to 3 arguments.`}

\n
    \n
  • {`message`}{`: The message object that triggered the command.`}
  • \n
  • {`command`}{`: The command object itself that was triggered.`}
  • \n
  • {`guild`}{`: The server guild object where this command was ran.`}
  • \n
\n

{`Understanding How Inhibitors Function`}

\n

{`To block a command you have to return a truthy value.`}

\n
    \n
  • {`return true;`}{` If you return true the inhibitor will block the execution of the command.\nTo allow a command return a falsey value.`}
  • \n
  • {`return false;`}{` If you return false the inhibitor will not block the error.`}
  • \n
\n
{`// If the command does not require a nitro boost we can allow this command to execute\nif (!command.boostRequired) return false;\n\n// Check if the user has boosted this server\nconst userIsVIP = m\n// The user is VIP so we can allow this command to be used\nif (userIsVIP) return false;\n\n// The user is NOT VIP so we throw an error\nthrow \\`The \\${command.name} is only allowed for VIP users.\\`\n`}
\n\n
;\n}\n\n;\nMDXContent.isMDXComponent = true;"}} \ No newline at end of file diff --git a/docs/.cache/caches/gatsby-plugin-mdx/diskstore-a410cb7b25513d5de696c2edab60222e.json b/docs/.cache/caches/gatsby-plugin-mdx/diskstore-a410cb7b25513d5de696c2edab60222e.json new file mode 100644 index 000000000..9622b0c88 --- /dev/null +++ b/docs/.cache/caches/gatsby-plugin-mdx/diskstore-a410cb7b25513d5de696c2edab60222e.json @@ -0,0 +1 @@ +{"expireTime":9007200851634918000,"key":"gatsby-plugin-mdx-entire-payload-7dd1436aa9f268c3048f0884608b7f11-","val":{"mdast":{"type":"root","children":[{"type":"paragraph","children":[{"type":"text","value":"Woah! You are almost half way done with understanding all of Discordeno. Amazing isn't it? Something you may have noticed in the last section was there were some options that prevented some commands from running like ","position":{"start":{"line":2,"column":1,"offset":1},"end":{"line":2,"column":218,"offset":218},"indent":[]}},{"type":"inlineCode","value":"dmOnly","position":{"start":{"line":2,"column":218,"offset":218},"end":{"line":2,"column":226,"offset":226},"indent":[]}},{"type":"text","value":" or the permission options. we created a setting to prevent the monitor from running in certain channels. What if we wanted to do prevent commands from happening? How would we prevent commands from running?","position":{"start":{"line":2,"column":226,"offset":226},"end":{"line":2,"column":432,"offset":432},"indent":[]}}],"position":{"start":{"line":2,"column":1,"offset":1},"end":{"line":2,"column":432,"offset":432},"indent":[]}},{"type":"heading","depth":2,"children":[{"type":"text","value":"What is an Inhibitor?","position":{"start":{"line":4,"column":4,"offset":437},"end":{"line":4,"column":25,"offset":458},"indent":[]}}],"position":{"start":{"line":4,"column":1,"offset":434},"end":{"line":4,"column":25,"offset":458},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"An Inhibitor is very similar to how monitors work. A monitor runs on every message but an inhibitor runs on every command. Remember all those command options like cooldown, permissions, permissionLevel, nsfw, etc... Each and every one of these options has an inhibitor in that checks commands for these settings.","position":{"start":{"line":6,"column":1,"offset":460},"end":{"line":6,"column":313,"offset":772},"indent":[]}}],"position":{"start":{"line":6,"column":1,"offset":460},"end":{"line":6,"column":313,"offset":772},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"Let's create our own inhibitor that would prevent commands from being used if the user is not a VIP user.","position":{"start":{"line":8,"column":1,"offset":774},"end":{"line":8,"column":106,"offset":879},"indent":[]}}],"position":{"start":{"line":8,"column":1,"offset":774},"end":{"line":8,"column":106,"offset":879},"indent":[]}},{"type":"blockquote","children":[{"type":"paragraph","children":[{"type":"strong","children":[{"type":"text","value":"Note:","position":{"start":{"line":10,"column":5,"offset":885},"end":{"line":10,"column":10,"offset":890},"indent":[]}}],"position":{"start":{"line":10,"column":3,"offset":883},"end":{"line":10,"column":12,"offset":892},"indent":[]}},{"type":"text","value":" It is important to remember that everything below can be done with a simple permission level as well. We will create our own custom permission levels but for the purposes of this guide and to be able to learn about Inhibitors, we will be using an inhibitor.","position":{"start":{"line":10,"column":12,"offset":892},"end":{"line":10,"column":270,"offset":1150},"indent":[]}}],"position":{"start":{"line":10,"column":3,"offset":883},"end":{"line":10,"column":270,"offset":1150},"indent":[]}}],"position":{"start":{"line":10,"column":1,"offset":881},"end":{"line":10,"column":270,"offset":1150},"indent":[]}},{"type":"heading","depth":2,"children":[{"type":"text","value":"Creating the File","position":{"start":{"line":12,"column":4,"offset":1155},"end":{"line":12,"column":21,"offset":1172},"indent":[]}}],"position":{"start":{"line":12,"column":1,"offset":1152},"end":{"line":12,"column":21,"offset":1172},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"Let's start by creating a file inside the inhibitors folder called ","position":{"start":{"line":14,"column":1,"offset":1174},"end":{"line":14,"column":68,"offset":1241},"indent":[]}},{"type":"inlineCode","value":"boosted.ts","position":{"start":{"line":14,"column":68,"offset":1241},"end":{"line":14,"column":80,"offset":1253},"indent":[]}},{"type":"text","value":" and paste the following snippet of code:","position":{"start":{"line":14,"column":80,"offset":1253},"end":{"line":14,"column":121,"offset":1294},"indent":[]}}],"position":{"start":{"line":14,"column":1,"offset":1174},"end":{"line":14,"column":121,"offset":1294},"indent":[]}},{"type":"code","lang":"ts","meta":null,"value":"import { botCache } from \"../../mod.ts\";\n\nbotCache.inhibitors.set(\"inhibitorname\", async function (message, command, guild) {\n\t// Your code goes here\n});","position":{"start":{"line":16,"column":1,"offset":1296},"end":{"line":22,"column":4,"offset":1459},"indent":[1,1,1,1,1,1]}},{"type":"paragraph","children":[{"type":"text","value":"Inhibitors can take up to 3 arguments.","position":{"start":{"line":24,"column":1,"offset":1461},"end":{"line":24,"column":39,"offset":1499},"indent":[]}}],"position":{"start":{"line":24,"column":1,"offset":1461},"end":{"line":24,"column":39,"offset":1499},"indent":[]}},{"type":"list","ordered":false,"start":null,"spread":false,"children":[{"type":"listItem","spread":false,"checked":null,"children":[{"type":"paragraph","children":[{"type":"inlineCode","value":"message","position":{"start":{"line":26,"column":3,"offset":1503},"end":{"line":26,"column":12,"offset":1512},"indent":[]}},{"type":"text","value":": The message object that triggered the command.","position":{"start":{"line":26,"column":12,"offset":1512},"end":{"line":26,"column":60,"offset":1560},"indent":[]}}],"position":{"start":{"line":26,"column":3,"offset":1503},"end":{"line":26,"column":60,"offset":1560},"indent":[]}}],"position":{"start":{"line":26,"column":1,"offset":1501},"end":{"line":26,"column":60,"offset":1560},"indent":[]}},{"type":"listItem","spread":false,"checked":null,"children":[{"type":"paragraph","children":[{"type":"inlineCode","value":"command","position":{"start":{"line":27,"column":3,"offset":1563},"end":{"line":27,"column":12,"offset":1572},"indent":[]}},{"type":"text","value":": The command object itself that was triggered.","position":{"start":{"line":27,"column":12,"offset":1572},"end":{"line":27,"column":59,"offset":1619},"indent":[]}}],"position":{"start":{"line":27,"column":3,"offset":1563},"end":{"line":27,"column":59,"offset":1619},"indent":[]}}],"position":{"start":{"line":27,"column":1,"offset":1561},"end":{"line":27,"column":59,"offset":1619},"indent":[]}},{"type":"listItem","spread":false,"checked":null,"children":[{"type":"paragraph","children":[{"type":"inlineCode","value":"guild","position":{"start":{"line":28,"column":3,"offset":1622},"end":{"line":28,"column":10,"offset":1629},"indent":[]}},{"type":"text","value":": The server guild object where this command was ran.","position":{"start":{"line":28,"column":10,"offset":1629},"end":{"line":28,"column":63,"offset":1682},"indent":[]}}],"position":{"start":{"line":28,"column":3,"offset":1622},"end":{"line":28,"column":63,"offset":1682},"indent":[]}}],"position":{"start":{"line":28,"column":1,"offset":1620},"end":{"line":28,"column":63,"offset":1682},"indent":[]}}],"position":{"start":{"line":26,"column":1,"offset":1501},"end":{"line":28,"column":63,"offset":1682},"indent":[1,1]}},{"type":"heading","depth":2,"children":[{"type":"text","value":"Understanding How Inhibitors Function","position":{"start":{"line":30,"column":4,"offset":1687},"end":{"line":30,"column":41,"offset":1724},"indent":[]}}],"position":{"start":{"line":30,"column":1,"offset":1684},"end":{"line":30,"column":41,"offset":1724},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"To block a command you have to return a truthy value.","position":{"start":{"line":32,"column":1,"offset":1726},"end":{"line":32,"column":54,"offset":1779},"indent":[]}}],"position":{"start":{"line":32,"column":1,"offset":1726},"end":{"line":32,"column":54,"offset":1779},"indent":[]}},{"type":"list","ordered":false,"start":null,"spread":false,"children":[{"type":"listItem","spread":false,"checked":null,"children":[{"type":"paragraph","children":[{"type":"strong","children":[{"type":"text","value":"return true;","position":{"start":{"line":33,"column":5,"offset":1784},"end":{"line":33,"column":17,"offset":1796},"indent":[]}}],"position":{"start":{"line":33,"column":3,"offset":1782},"end":{"line":33,"column":19,"offset":1798},"indent":[]}},{"type":"text","value":" If you return true the inhibitor will block the execution of the command.\nTo allow a command return a falsey value.","position":{"start":{"line":33,"column":19,"offset":1798},"end":{"line":34,"column":42,"offset":1914},"indent":[1]}}],"position":{"start":{"line":33,"column":3,"offset":1782},"end":{"line":34,"column":42,"offset":1914},"indent":[1]}}],"position":{"start":{"line":33,"column":1,"offset":1780},"end":{"line":34,"column":42,"offset":1914},"indent":[1]}},{"type":"listItem","spread":false,"checked":null,"children":[{"type":"paragraph","children":[{"type":"strong","children":[{"type":"text","value":"return false;","position":{"start":{"line":35,"column":5,"offset":1919},"end":{"line":35,"column":18,"offset":1932},"indent":[]}}],"position":{"start":{"line":35,"column":3,"offset":1917},"end":{"line":35,"column":20,"offset":1934},"indent":[]}},{"type":"text","value":" If you return false the inhibitor will not block the error.","position":{"start":{"line":35,"column":20,"offset":1934},"end":{"line":35,"column":80,"offset":1994},"indent":[]}}],"position":{"start":{"line":35,"column":3,"offset":1917},"end":{"line":35,"column":80,"offset":1994},"indent":[]}}],"position":{"start":{"line":35,"column":1,"offset":1915},"end":{"line":35,"column":80,"offset":1994},"indent":[]}}],"position":{"start":{"line":33,"column":1,"offset":1780},"end":{"line":35,"column":80,"offset":1994},"indent":[1,1]}},{"type":"code","lang":"ts","meta":null,"value":"// If the command is not VIP only we can allow this command to execute\nif (!command.vipOnly) return false;\n\n// The bot's support server\nconst guild = cache.guilds.get(configs.supportServerID);\n// If the command author is not in the server they won't have the vip role\nconst member = guild.members.get(message.author.id) || await getMember(guild.id, message.author.id);\n// Member doesn't exist so cancel the command\nif (!member) {\n\tsendResponse(message, `sorry, but you can not use this command until you become VIP. **Close the IRIS!!!**`)\n\treturn true;\n}\n\n// If the user has the vip role on the support server given by patreon allow the command\nif (member.roles.includes(configs.roleIDs.patreonVIPRoleID)) return false;\n\n// Alert the user they don't have vip and can't use the command\nsendResponse(message, `sorry, but you can not use this command until you become a VIP. I'm sorry, Teal'c. We'll go to Disneyland next year. I promise.`)\n// Cancel the command since the user does not have vip\nreturn true;","position":{"start":{"line":38,"column":1,"offset":1997},"end":{"line":59,"column":4,"offset":3013},"indent":[1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1]}},{"type":"heading","depth":2,"children":[{"type":"text","value":"Updating Command Typings","position":{"start":{"line":61,"column":4,"offset":3018},"end":{"line":61,"column":28,"offset":3042},"indent":[]}}],"position":{"start":{"line":61,"column":1,"offset":3015},"end":{"line":61,"column":28,"offset":3042},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"Since we need a new option on our commands we need to add that. Open the ","position":{"start":{"line":63,"column":1,"offset":3044},"end":{"line":63,"column":74,"offset":3117},"indent":[]}},{"type":"inlineCode","value":"src/types/commands.ts","position":{"start":{"line":63,"column":74,"offset":3117},"end":{"line":63,"column":97,"offset":3140},"indent":[]}},{"type":"text","value":" file and add in the following","position":{"start":{"line":63,"column":97,"offset":3140},"end":{"line":63,"column":127,"offset":3170},"indent":[]}}],"position":{"start":{"line":63,"column":1,"offset":3044},"end":{"line":63,"column":127,"offset":3170},"indent":[]}},{"type":"code","lang":"ts","meta":null,"value":"","position":{"start":{"line":65,"column":1,"offset":3172},"end":{"line":67,"column":4,"offset":3182},"indent":[1,1]}},{"type":"heading","depth":2,"children":[{"type":"text","value":"Challenges","position":{"start":{"line":69,"column":4,"offset":3187},"end":{"line":69,"column":14,"offset":3197},"indent":[]}}],"position":{"start":{"line":69,"column":1,"offset":3184},"end":{"line":69,"column":14,"offset":3197},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"Hell yes! We just got through the entire inhibitor section. You have now mastered everything related to inhibitors.","position":{"start":{"line":71,"column":1,"offset":3199},"end":{"line":71,"column":116,"offset":3314},"indent":[]}}],"position":{"start":{"line":71,"column":1,"offset":3199},"end":{"line":71,"column":116,"offset":3314},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"You can now try and get a little more practice with inhibitors by trying to challenge yourself and make your own inhibitors. Don't worry if you can't think of any good use cases for inhibitors.","position":{"start":{"line":73,"column":1,"offset":3316},"end":{"line":73,"column":194,"offset":3509},"indent":[]}}],"position":{"start":{"line":73,"column":1,"offset":3316},"end":{"line":73,"column":194,"offset":3509},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"Majority of Discordeno bots do not use many custom inhibitors because most of the necessary/important ones already come built for you in the inhibitors folder.","position":{"start":{"line":75,"column":1,"offset":3511},"end":{"line":75,"column":160,"offset":3670},"indent":[]}}],"position":{"start":{"line":75,"column":1,"offset":3511},"end":{"line":75,"column":160,"offset":3670},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"Next we will try our hands at creating a monitor.","position":{"start":{"line":77,"column":1,"offset":3672},"end":{"line":77,"column":50,"offset":3721},"indent":[]}}],"position":{"start":{"line":77,"column":1,"offset":3672},"end":{"line":77,"column":50,"offset":3721},"indent":[]}},{"type":"export","value":"export const _frontmatter = {\"title\":\"Creating Inhibitors!\",\"metaTitle\":\"Creating An Inhibitor | Discordeno\",\"metaDescription\":\"Let's create our very own bot with Discordeno!\"}","position":{"start":{"line":80,"column":1,"offset":3724},"end":{"line":80,"column":177,"offset":3900},"indent":[]}}],"position":{"start":{"line":1,"column":1,"offset":0},"end":{"line":80,"column":177,"offset":3900}}},"scopeImports":["import * as React from 'react'"],"scopeIdentifiers":["React"],"body":"function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }\n\nfunction _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }\n\nfunction _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }\n\n/* @jsx mdx */\nvar _frontmatter = {\n \"title\": \"Creating Inhibitors!\",\n \"metaTitle\": \"Creating An Inhibitor | Discordeno\",\n \"metaDescription\": \"Let's create our very own bot with Discordeno!\"\n};\nvar layoutProps = {\n _frontmatter: _frontmatter\n};\nvar MDXLayout = \"wrapper\";\nreturn function MDXContent(_ref) {\n var components = _ref.components,\n props = _objectWithoutProperties(_ref, [\"components\"]);\n\n return mdx(MDXLayout, _extends({}, layoutProps, props, {\n components: components,\n mdxType: \"MDXLayout\"\n }), mdx(\"p\", null, \"Woah! You are almost half way done with understanding all of Discordeno. Amazing isn't it? Something you may have noticed in the last section was there were some options that prevented some commands from running like \", mdx(\"inlineCode\", {\n parentName: \"p\"\n }, \"dmOnly\"), \" or the permission options. we created a setting to prevent the monitor from running in certain channels. What if we wanted to do prevent commands from happening? How would we prevent commands from running?\"), mdx(\"h2\", null, \"What is an Inhibitor?\"), mdx(\"p\", null, \"An Inhibitor is very similar to how monitors work. A monitor runs on every message but an inhibitor runs on every command. Remember all those command options like cooldown, permissions, permissionLevel, nsfw, etc... Each and every one of these options has an inhibitor in that checks commands for these settings.\"), mdx(\"p\", null, \"Let's create our own inhibitor that would prevent commands from being used if the user is not a VIP user.\"), mdx(\"blockquote\", null, mdx(\"p\", {\n parentName: \"blockquote\"\n }, mdx(\"strong\", {\n parentName: \"p\"\n }, \"Note:\"), \" It is important to remember that everything below can be done with a simple permission level as well. We will create our own custom permission levels but for the purposes of this guide and to be able to learn about Inhibitors, we will be using an inhibitor.\")), mdx(\"h2\", null, \"Creating the File\"), mdx(\"p\", null, \"Let's start by creating a file inside the inhibitors folder called \", mdx(\"inlineCode\", {\n parentName: \"p\"\n }, \"boosted.ts\"), \" and paste the following snippet of code:\"), mdx(\"pre\", null, mdx(\"code\", _extends({\n parentName: \"pre\"\n }, {\n \"className\": \"language-ts\"\n }), \"import { botCache } from \\\"../../mod.ts\\\";\\n\\nbotCache.inhibitors.set(\\\"inhibitorname\\\", async function (message, command, guild) {\\n // Your code goes here\\n});\\n\")), mdx(\"p\", null, \"Inhibitors can take up to 3 arguments.\"), mdx(\"ul\", null, mdx(\"li\", {\n parentName: \"ul\"\n }, mdx(\"inlineCode\", {\n parentName: \"li\"\n }, \"message\"), \": The message object that triggered the command.\"), mdx(\"li\", {\n parentName: \"ul\"\n }, mdx(\"inlineCode\", {\n parentName: \"li\"\n }, \"command\"), \": The command object itself that was triggered.\"), mdx(\"li\", {\n parentName: \"ul\"\n }, mdx(\"inlineCode\", {\n parentName: \"li\"\n }, \"guild\"), \": The server guild object where this command was ran.\")), mdx(\"h2\", null, \"Understanding How Inhibitors Function\"), mdx(\"p\", null, \"To block a command you have to return a truthy value.\"), mdx(\"ul\", null, mdx(\"li\", {\n parentName: \"ul\"\n }, mdx(\"strong\", {\n parentName: \"li\"\n }, \"return true;\"), \" If you return true the inhibitor will block the execution of the command.\\nTo allow a command return a falsey value.\"), mdx(\"li\", {\n parentName: \"ul\"\n }, mdx(\"strong\", {\n parentName: \"li\"\n }, \"return false;\"), \" If you return false the inhibitor will not block the error.\")), mdx(\"pre\", null, mdx(\"code\", _extends({\n parentName: \"pre\"\n }, {\n \"className\": \"language-ts\"\n }), \"// If the command is not VIP only we can allow this command to execute\\nif (!command.vipOnly) return false;\\n\\n// The bot's support server\\nconst guild = cache.guilds.get(configs.supportServerID);\\n// If the command author is not in the server they won't have the vip role\\nconst member = guild.members.get(message.author.id) || await getMember(guild.id, message.author.id);\\n// Member doesn't exist so cancel the command\\nif (!member) {\\n sendResponse(message, `sorry, but you can not use this command until you become VIP. **Close the IRIS!!!**`)\\n return true;\\n}\\n\\n// If the user has the vip role on the support server given by patreon allow the command\\nif (member.roles.includes(configs.roleIDs.patreonVIPRoleID)) return false;\\n\\n// Alert the user they don't have vip and can't use the command\\nsendResponse(message, `sorry, but you can not use this command until you become a VIP. I'm sorry, Teal'c. We'll go to Disneyland next year. I promise.`)\\n// Cancel the command since the user does not have vip\\nreturn true;\\n\")), mdx(\"h2\", null, \"Updating Command Typings\"), mdx(\"p\", null, \"Since we need a new option on our commands we need to add that. Open the \", mdx(\"inlineCode\", {\n parentName: \"p\"\n }, \"src/types/commands.ts\"), \" file and add in the following\"), mdx(\"pre\", null, mdx(\"code\", _extends({\n parentName: \"pre\"\n }, {\n \"className\": \"language-ts\"\n }), \"\")), mdx(\"h2\", null, \"Challenges\"), mdx(\"p\", null, \"Hell yes! We just got through the entire inhibitor section. You have now mastered everything related to inhibitors.\"), mdx(\"p\", null, \"You can now try and get a little more practice with inhibitors by trying to challenge yourself and make your own inhibitors. Don't worry if you can't think of any good use cases for inhibitors.\"), mdx(\"p\", null, \"Majority of Discordeno bots do not use many custom inhibitors because most of the necessary/important ones already come built for you in the inhibitors folder.\"), mdx(\"p\", null, \"Next we will try our hands at creating a monitor.\"));\n}\n;\nMDXContent.isMDXComponent = true;","rawMDXOutput":"/* @jsx mdx */\nimport { mdx } from '@mdx-js/react';\n/* @jsx mdx */\n\nexport const _frontmatter = {\n \"title\": \"Creating Inhibitors!\",\n \"metaTitle\": \"Creating An Inhibitor | Discordeno\",\n \"metaDescription\": \"Let's create our very own bot with Discordeno!\"\n};\n\nconst layoutProps = {\n _frontmatter\n};\nconst MDXLayout = \"wrapper\"\nexport default function MDXContent({\n components,\n ...props\n}) {\n return \n

{`Woah! You are almost half way done with understanding all of Discordeno. Amazing isn't it? Something you may have noticed in the last section was there were some options that prevented some commands from running like `}{`dmOnly`}{` or the permission options. we created a setting to prevent the monitor from running in certain channels. What if we wanted to do prevent commands from happening? How would we prevent commands from running?`}

\n

{`What is an Inhibitor?`}

\n

{`An Inhibitor is very similar to how monitors work. A monitor runs on every message but an inhibitor runs on every command. Remember all those command options like cooldown, permissions, permissionLevel, nsfw, etc... Each and every one of these options has an inhibitor in that checks commands for these settings.`}

\n

{`Let's create our own inhibitor that would prevent commands from being used if the user is not a VIP user.`}

\n
\n

{`Note:`}{` It is important to remember that everything below can be done with a simple permission level as well. We will create our own custom permission levels but for the purposes of this guide and to be able to learn about Inhibitors, we will be using an inhibitor.`}

\n
\n

{`Creating the File`}

\n

{`Let's start by creating a file inside the inhibitors folder called `}{`boosted.ts`}{` and paste the following snippet of code:`}

\n
{`import { botCache } from \"../../mod.ts\";\n\nbotCache.inhibitors.set(\"inhibitorname\", async function (message, command, guild) {\n    // Your code goes here\n});\n`}
\n

{`Inhibitors can take up to 3 arguments.`}

\n
    \n
  • {`message`}{`: The message object that triggered the command.`}
  • \n
  • {`command`}{`: The command object itself that was triggered.`}
  • \n
  • {`guild`}{`: The server guild object where this command was ran.`}
  • \n
\n

{`Understanding How Inhibitors Function`}

\n

{`To block a command you have to return a truthy value.`}

\n
    \n
  • {`return true;`}{` If you return true the inhibitor will block the execution of the command.\nTo allow a command return a falsey value.`}
  • \n
  • {`return false;`}{` If you return false the inhibitor will not block the error.`}
  • \n
\n
{`// If the command is not VIP only we can allow this command to execute\nif (!command.vipOnly) return false;\n\n// The bot's support server\nconst guild = cache.guilds.get(configs.supportServerID);\n// If the command author is not in the server they won't have the vip role\nconst member = guild.members.get(message.author.id) || await getMember(guild.id, message.author.id);\n// Member doesn't exist so cancel the command\nif (!member) {\n    sendResponse(message, \\`sorry, but you can not use this command until you become VIP. **Close the IRIS!!!**\\`)\n    return true;\n}\n\n// If the user has the vip role on the support server given by patreon allow the command\nif (member.roles.includes(configs.roleIDs.patreonVIPRoleID)) return false;\n\n// Alert the user they don't have vip and can't use the command\nsendResponse(message, \\`sorry, but you can not use this command until you become a VIP. I'm sorry, Teal'c. We'll go to Disneyland next year. I promise.\\`)\n// Cancel the command since the user does not have vip\nreturn true;\n`}
\n

{`Updating Command Typings`}

\n

{`Since we need a new option on our commands we need to add that. Open the `}{`src/types/commands.ts`}{` file and add in the following`}

\n
{``}
\n

{`Challenges`}

\n

{`Hell yes! We just got through the entire inhibitor section. You have now mastered everything related to inhibitors.`}

\n

{`You can now try and get a little more practice with inhibitors by trying to challenge yourself and make your own inhibitors. Don't worry if you can't think of any good use cases for inhibitors.`}

\n

{`Majority of Discordeno bots do not use many custom inhibitors because most of the necessary/important ones already come built for you in the inhibitors folder.`}

\n

{`Next we will try our hands at creating a monitor.`}

\n\n
;\n}\n\n;\nMDXContent.isMDXComponent = true;"}} \ No newline at end of file diff --git a/docs/.cache/caches/gatsby-plugin-mdx/diskstore-a563fbde30ec53b454886209421786f4.json b/docs/.cache/caches/gatsby-plugin-mdx/diskstore-a563fbde30ec53b454886209421786f4.json new file mode 100644 index 000000000..930e9cfaf --- /dev/null +++ b/docs/.cache/caches/gatsby-plugin-mdx/diskstore-a563fbde30ec53b454886209421786f4.json @@ -0,0 +1 @@ +{"expireTime":9007200851634897000,"key":"gatsby-plugin-mdx-entire-payload-bfb29bdf842d165fb0f267c88432e639-","val":{"mdast":{"type":"root","children":[{"type":"paragraph","children":[{"type":"text","value":"Woah! You are almost half way done with understanding all of Discordeno. Amazing isn't it? Something you may have noticed in the last section was there were some options that prevented some commands from running like ","position":{"start":{"line":2,"column":1,"offset":1},"end":{"line":2,"column":218,"offset":218},"indent":[]}},{"type":"inlineCode","value":"dmOnly","position":{"start":{"line":2,"column":218,"offset":218},"end":{"line":2,"column":226,"offset":226},"indent":[]}},{"type":"text","value":" or the permission options. we created a setting to prevent the monitor from running in certain channels. What if we wanted to do prevent commands from happening? How would we prevent commands from running?","position":{"start":{"line":2,"column":226,"offset":226},"end":{"line":2,"column":432,"offset":432},"indent":[]}}],"position":{"start":{"line":2,"column":1,"offset":1},"end":{"line":2,"column":432,"offset":432},"indent":[]}},{"type":"heading","depth":2,"children":[{"type":"text","value":"What is an Inhibitor?","position":{"start":{"line":4,"column":4,"offset":437},"end":{"line":4,"column":25,"offset":458},"indent":[]}}],"position":{"start":{"line":4,"column":1,"offset":434},"end":{"line":4,"column":25,"offset":458},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"An Inhibitor is very similar to how monitors work. A monitor runs on every message but an inhibitor runs on every command. Remember all those command options like cooldown, permissions, permissionLevel, nsfw, etc... Each and every one of these options has an inhibitor in that checks commands for these settings.","position":{"start":{"line":6,"column":1,"offset":460},"end":{"line":6,"column":313,"offset":772},"indent":[]}}],"position":{"start":{"line":6,"column":1,"offset":460},"end":{"line":6,"column":313,"offset":772},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"Let's create our own inhibitor that would prevent commands from being used if the user is not a VIP user.","position":{"start":{"line":8,"column":1,"offset":774},"end":{"line":8,"column":106,"offset":879},"indent":[]}}],"position":{"start":{"line":8,"column":1,"offset":774},"end":{"line":8,"column":106,"offset":879},"indent":[]}},{"type":"blockquote","children":[{"type":"paragraph","children":[{"type":"strong","children":[{"type":"text","value":"Note:","position":{"start":{"line":10,"column":5,"offset":885},"end":{"line":10,"column":10,"offset":890},"indent":[]}}],"position":{"start":{"line":10,"column":3,"offset":883},"end":{"line":10,"column":12,"offset":892},"indent":[]}},{"type":"text","value":" It is important to remember that everything below can be done with a simple permission level as well. We will create our own custom permission levels but for the purposes of this guide and to be able to learn about Inhibitors, we will be using an inhibitor.","position":{"start":{"line":10,"column":12,"offset":892},"end":{"line":10,"column":270,"offset":1150},"indent":[]}}],"position":{"start":{"line":10,"column":3,"offset":883},"end":{"line":10,"column":270,"offset":1150},"indent":[]}}],"position":{"start":{"line":10,"column":1,"offset":881},"end":{"line":10,"column":270,"offset":1150},"indent":[]}},{"type":"heading","depth":2,"children":[{"type":"text","value":"Creating the File","position":{"start":{"line":12,"column":4,"offset":1155},"end":{"line":12,"column":21,"offset":1172},"indent":[]}}],"position":{"start":{"line":12,"column":1,"offset":1152},"end":{"line":12,"column":21,"offset":1172},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"Let's start by creating a file inside the inhibitors folder called ","position":{"start":{"line":14,"column":1,"offset":1174},"end":{"line":14,"column":68,"offset":1241},"indent":[]}},{"type":"inlineCode","value":"boosted.ts","position":{"start":{"line":14,"column":68,"offset":1241},"end":{"line":14,"column":80,"offset":1253},"indent":[]}},{"type":"text","value":" and paste the following snippet of code:","position":{"start":{"line":14,"column":80,"offset":1253},"end":{"line":14,"column":121,"offset":1294},"indent":[]}}],"position":{"start":{"line":14,"column":1,"offset":1174},"end":{"line":14,"column":121,"offset":1294},"indent":[]}},{"type":"code","lang":"ts","meta":null,"value":"import { botCache } from \"../../mod.ts\";\n\nbotCache.inhibitors.set(\"inhibitorname\", async function (message, command, guild) {\n\t// Your code goes here\n});","position":{"start":{"line":16,"column":1,"offset":1296},"end":{"line":22,"column":4,"offset":1459},"indent":[1,1,1,1,1,1]}},{"type":"paragraph","children":[{"type":"text","value":"Inhibitors can take up to 3 arguments.","position":{"start":{"line":24,"column":1,"offset":1461},"end":{"line":24,"column":39,"offset":1499},"indent":[]}}],"position":{"start":{"line":24,"column":1,"offset":1461},"end":{"line":24,"column":39,"offset":1499},"indent":[]}},{"type":"list","ordered":false,"start":null,"spread":false,"children":[{"type":"listItem","spread":false,"checked":null,"children":[{"type":"paragraph","children":[{"type":"inlineCode","value":"message","position":{"start":{"line":26,"column":3,"offset":1503},"end":{"line":26,"column":12,"offset":1512},"indent":[]}},{"type":"text","value":": The message object that triggered the command.","position":{"start":{"line":26,"column":12,"offset":1512},"end":{"line":26,"column":60,"offset":1560},"indent":[]}}],"position":{"start":{"line":26,"column":3,"offset":1503},"end":{"line":26,"column":60,"offset":1560},"indent":[]}}],"position":{"start":{"line":26,"column":1,"offset":1501},"end":{"line":26,"column":60,"offset":1560},"indent":[]}},{"type":"listItem","spread":false,"checked":null,"children":[{"type":"paragraph","children":[{"type":"inlineCode","value":"command","position":{"start":{"line":27,"column":3,"offset":1563},"end":{"line":27,"column":12,"offset":1572},"indent":[]}},{"type":"text","value":": The command object itself that was triggered.","position":{"start":{"line":27,"column":12,"offset":1572},"end":{"line":27,"column":59,"offset":1619},"indent":[]}}],"position":{"start":{"line":27,"column":3,"offset":1563},"end":{"line":27,"column":59,"offset":1619},"indent":[]}}],"position":{"start":{"line":27,"column":1,"offset":1561},"end":{"line":27,"column":59,"offset":1619},"indent":[]}},{"type":"listItem","spread":false,"checked":null,"children":[{"type":"paragraph","children":[{"type":"inlineCode","value":"guild","position":{"start":{"line":28,"column":3,"offset":1622},"end":{"line":28,"column":10,"offset":1629},"indent":[]}},{"type":"text","value":": The server guild object where this command was ran.","position":{"start":{"line":28,"column":10,"offset":1629},"end":{"line":28,"column":63,"offset":1682},"indent":[]}}],"position":{"start":{"line":28,"column":3,"offset":1622},"end":{"line":28,"column":63,"offset":1682},"indent":[]}}],"position":{"start":{"line":28,"column":1,"offset":1620},"end":{"line":28,"column":63,"offset":1682},"indent":[]}}],"position":{"start":{"line":26,"column":1,"offset":1501},"end":{"line":28,"column":63,"offset":1682},"indent":[1,1]}},{"type":"heading","depth":2,"children":[{"type":"text","value":"Understanding How Inhibitors Function","position":{"start":{"line":30,"column":4,"offset":1687},"end":{"line":30,"column":41,"offset":1724},"indent":[]}}],"position":{"start":{"line":30,"column":1,"offset":1684},"end":{"line":30,"column":41,"offset":1724},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"To block a command you have to return a truthy value.","position":{"start":{"line":32,"column":1,"offset":1726},"end":{"line":32,"column":54,"offset":1779},"indent":[]}}],"position":{"start":{"line":32,"column":1,"offset":1726},"end":{"line":32,"column":54,"offset":1779},"indent":[]}},{"type":"list","ordered":false,"start":null,"spread":false,"children":[{"type":"listItem","spread":false,"checked":null,"children":[{"type":"paragraph","children":[{"type":"strong","children":[{"type":"text","value":"return true;","position":{"start":{"line":33,"column":5,"offset":1784},"end":{"line":33,"column":17,"offset":1796},"indent":[]}}],"position":{"start":{"line":33,"column":3,"offset":1782},"end":{"line":33,"column":19,"offset":1798},"indent":[]}},{"type":"text","value":" If you return true the inhibitor will block the execution of the command.\nTo allow a command return a falsey value.","position":{"start":{"line":33,"column":19,"offset":1798},"end":{"line":34,"column":42,"offset":1914},"indent":[1]}}],"position":{"start":{"line":33,"column":3,"offset":1782},"end":{"line":34,"column":42,"offset":1914},"indent":[1]}}],"position":{"start":{"line":33,"column":1,"offset":1780},"end":{"line":34,"column":42,"offset":1914},"indent":[1]}},{"type":"listItem","spread":false,"checked":null,"children":[{"type":"paragraph","children":[{"type":"strong","children":[{"type":"text","value":"return false;","position":{"start":{"line":35,"column":5,"offset":1919},"end":{"line":35,"column":18,"offset":1932},"indent":[]}}],"position":{"start":{"line":35,"column":3,"offset":1917},"end":{"line":35,"column":20,"offset":1934},"indent":[]}},{"type":"text","value":" If you return false the inhibitor will not block the error.","position":{"start":{"line":35,"column":20,"offset":1934},"end":{"line":35,"column":80,"offset":1994},"indent":[]}}],"position":{"start":{"line":35,"column":3,"offset":1917},"end":{"line":35,"column":80,"offset":1994},"indent":[]}}],"position":{"start":{"line":35,"column":1,"offset":1915},"end":{"line":35,"column":80,"offset":1994},"indent":[]}}],"position":{"start":{"line":33,"column":1,"offset":1780},"end":{"line":35,"column":80,"offset":1994},"indent":[1,1]}},{"type":"code","lang":"ts","meta":null,"value":"// If the command is not VIP only we can allow this command to execute\nif (!command.vipOnly) return false;\n\n// The bot's support server\nconst guild = cache.guilds.get(configs.supportServerID);\n// If the command author is not in the server they won't have the vip role\nconst member = guild.members.get(message.author.id) || await getMember(guild.id, message.author.id);\n// Member doesn't exist so cancel the command\nif (!member) {\n\tsendResponse(message, `sorry, but you can not use this command until you become VIP. **Close the IRIS!!!**`)\n\treturn true;\n}\n\n// If the user has the vip role on the support server given by patreon allow the command\nif (member.roles.includes(configs.roleIDs.patreonVIPRoleID)) return false;\n\n// Alert the user they don't have vip and can't use the command\nsendResponse(message, `sorry, but you can not use this command until you become a VIP. I'm sorry, Teal'c. We'll go to Disneyland next year. I promise.`)\n// Cancel the command since the user does not have vip\nreturn true;","position":{"start":{"line":38,"column":1,"offset":1997},"end":{"line":59,"column":4,"offset":3013},"indent":[1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1]}},{"type":"heading","depth":2,"children":[{"type":"text","value":"Updating Command Typings","position":{"start":{"line":61,"column":4,"offset":3018},"end":{"line":61,"column":28,"offset":3042},"indent":[]}}],"position":{"start":{"line":61,"column":1,"offset":3015},"end":{"line":61,"column":28,"offset":3042},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"Since we need a new option on our commands we need to add that. Open the","position":{"start":{"line":63,"column":1,"offset":3044},"end":{"line":63,"column":73,"offset":3116},"indent":[]}}],"position":{"start":{"line":63,"column":1,"offset":3044},"end":{"line":63,"column":73,"offset":3116},"indent":[]}},{"type":"heading","depth":2,"children":[{"type":"text","value":"Challenges","position":{"start":{"line":65,"column":4,"offset":3121},"end":{"line":65,"column":14,"offset":3131},"indent":[]}}],"position":{"start":{"line":65,"column":1,"offset":3118},"end":{"line":65,"column":14,"offset":3131},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"Hell yes! We just got through the entire inhibitor section. You have now mastered everything related to inhibitors.","position":{"start":{"line":67,"column":1,"offset":3133},"end":{"line":67,"column":116,"offset":3248},"indent":[]}}],"position":{"start":{"line":67,"column":1,"offset":3133},"end":{"line":67,"column":116,"offset":3248},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"You can now try and get a little more practice with inhibitors by trying to challenge yourself and make your own inhibitors. Don't worry if you can't think of any good use cases for inhibitors.","position":{"start":{"line":69,"column":1,"offset":3250},"end":{"line":69,"column":194,"offset":3443},"indent":[]}}],"position":{"start":{"line":69,"column":1,"offset":3250},"end":{"line":69,"column":194,"offset":3443},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"Majority of Discordeno bots do not use many custom inhibitors because most of the necessary/important ones already come built for you in the inhibitors folder.","position":{"start":{"line":71,"column":1,"offset":3445},"end":{"line":71,"column":160,"offset":3604},"indent":[]}}],"position":{"start":{"line":71,"column":1,"offset":3445},"end":{"line":71,"column":160,"offset":3604},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"Next we will try our hands at creating a monitor.","position":{"start":{"line":73,"column":1,"offset":3606},"end":{"line":73,"column":50,"offset":3655},"indent":[]}}],"position":{"start":{"line":73,"column":1,"offset":3606},"end":{"line":73,"column":50,"offset":3655},"indent":[]}},{"type":"export","value":"export const _frontmatter = {\"title\":\"Creating Inhibitors!\",\"metaTitle\":\"Creating An Inhibitor | Discordeno\",\"metaDescription\":\"Let's create our very own bot with Discordeno!\"}","position":{"start":{"line":76,"column":1,"offset":3658},"end":{"line":76,"column":177,"offset":3834},"indent":[]}}],"position":{"start":{"line":1,"column":1,"offset":0},"end":{"line":76,"column":177,"offset":3834}}},"scopeImports":["import * as React from 'react'"],"scopeIdentifiers":["React"],"body":"function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }\n\nfunction _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }\n\nfunction _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }\n\n/* @jsx mdx */\nvar _frontmatter = {\n \"title\": \"Creating Inhibitors!\",\n \"metaTitle\": \"Creating An Inhibitor | Discordeno\",\n \"metaDescription\": \"Let's create our very own bot with Discordeno!\"\n};\nvar layoutProps = {\n _frontmatter: _frontmatter\n};\nvar MDXLayout = \"wrapper\";\nreturn function MDXContent(_ref) {\n var components = _ref.components,\n props = _objectWithoutProperties(_ref, [\"components\"]);\n\n return mdx(MDXLayout, _extends({}, layoutProps, props, {\n components: components,\n mdxType: \"MDXLayout\"\n }), mdx(\"p\", null, \"Woah! You are almost half way done with understanding all of Discordeno. Amazing isn't it? Something you may have noticed in the last section was there were some options that prevented some commands from running like \", mdx(\"inlineCode\", {\n parentName: \"p\"\n }, \"dmOnly\"), \" or the permission options. we created a setting to prevent the monitor from running in certain channels. What if we wanted to do prevent commands from happening? How would we prevent commands from running?\"), mdx(\"h2\", null, \"What is an Inhibitor?\"), mdx(\"p\", null, \"An Inhibitor is very similar to how monitors work. A monitor runs on every message but an inhibitor runs on every command. Remember all those command options like cooldown, permissions, permissionLevel, nsfw, etc... Each and every one of these options has an inhibitor in that checks commands for these settings.\"), mdx(\"p\", null, \"Let's create our own inhibitor that would prevent commands from being used if the user is not a VIP user.\"), mdx(\"blockquote\", null, mdx(\"p\", {\n parentName: \"blockquote\"\n }, mdx(\"strong\", {\n parentName: \"p\"\n }, \"Note:\"), \" It is important to remember that everything below can be done with a simple permission level as well. We will create our own custom permission levels but for the purposes of this guide and to be able to learn about Inhibitors, we will be using an inhibitor.\")), mdx(\"h2\", null, \"Creating the File\"), mdx(\"p\", null, \"Let's start by creating a file inside the inhibitors folder called \", mdx(\"inlineCode\", {\n parentName: \"p\"\n }, \"boosted.ts\"), \" and paste the following snippet of code:\"), mdx(\"pre\", null, mdx(\"code\", _extends({\n parentName: \"pre\"\n }, {\n \"className\": \"language-ts\"\n }), \"import { botCache } from \\\"../../mod.ts\\\";\\n\\nbotCache.inhibitors.set(\\\"inhibitorname\\\", async function (message, command, guild) {\\n // Your code goes here\\n});\\n\")), mdx(\"p\", null, \"Inhibitors can take up to 3 arguments.\"), mdx(\"ul\", null, mdx(\"li\", {\n parentName: \"ul\"\n }, mdx(\"inlineCode\", {\n parentName: \"li\"\n }, \"message\"), \": The message object that triggered the command.\"), mdx(\"li\", {\n parentName: \"ul\"\n }, mdx(\"inlineCode\", {\n parentName: \"li\"\n }, \"command\"), \": The command object itself that was triggered.\"), mdx(\"li\", {\n parentName: \"ul\"\n }, mdx(\"inlineCode\", {\n parentName: \"li\"\n }, \"guild\"), \": The server guild object where this command was ran.\")), mdx(\"h2\", null, \"Understanding How Inhibitors Function\"), mdx(\"p\", null, \"To block a command you have to return a truthy value.\"), mdx(\"ul\", null, mdx(\"li\", {\n parentName: \"ul\"\n }, mdx(\"strong\", {\n parentName: \"li\"\n }, \"return true;\"), \" If you return true the inhibitor will block the execution of the command.\\nTo allow a command return a falsey value.\"), mdx(\"li\", {\n parentName: \"ul\"\n }, mdx(\"strong\", {\n parentName: \"li\"\n }, \"return false;\"), \" If you return false the inhibitor will not block the error.\")), mdx(\"pre\", null, mdx(\"code\", _extends({\n parentName: \"pre\"\n }, {\n \"className\": \"language-ts\"\n }), \"// If the command is not VIP only we can allow this command to execute\\nif (!command.vipOnly) return false;\\n\\n// The bot's support server\\nconst guild = cache.guilds.get(configs.supportServerID);\\n// If the command author is not in the server they won't have the vip role\\nconst member = guild.members.get(message.author.id) || await getMember(guild.id, message.author.id);\\n// Member doesn't exist so cancel the command\\nif (!member) {\\n sendResponse(message, `sorry, but you can not use this command until you become VIP. **Close the IRIS!!!**`)\\n return true;\\n}\\n\\n// If the user has the vip role on the support server given by patreon allow the command\\nif (member.roles.includes(configs.roleIDs.patreonVIPRoleID)) return false;\\n\\n// Alert the user they don't have vip and can't use the command\\nsendResponse(message, `sorry, but you can not use this command until you become a VIP. I'm sorry, Teal'c. We'll go to Disneyland next year. I promise.`)\\n// Cancel the command since the user does not have vip\\nreturn true;\\n\")), mdx(\"h2\", null, \"Updating Command Typings\"), mdx(\"p\", null, \"Since we need a new option on our commands we need to add that. Open the\"), mdx(\"h2\", null, \"Challenges\"), mdx(\"p\", null, \"Hell yes! We just got through the entire inhibitor section. You have now mastered everything related to inhibitors.\"), mdx(\"p\", null, \"You can now try and get a little more practice with inhibitors by trying to challenge yourself and make your own inhibitors. Don't worry if you can't think of any good use cases for inhibitors.\"), mdx(\"p\", null, \"Majority of Discordeno bots do not use many custom inhibitors because most of the necessary/important ones already come built for you in the inhibitors folder.\"), mdx(\"p\", null, \"Next we will try our hands at creating a monitor.\"));\n}\n;\nMDXContent.isMDXComponent = true;","rawMDXOutput":"/* @jsx mdx */\nimport { mdx } from '@mdx-js/react';\n/* @jsx mdx */\n\nexport const _frontmatter = {\n \"title\": \"Creating Inhibitors!\",\n \"metaTitle\": \"Creating An Inhibitor | Discordeno\",\n \"metaDescription\": \"Let's create our very own bot with Discordeno!\"\n};\n\nconst layoutProps = {\n _frontmatter\n};\nconst MDXLayout = \"wrapper\"\nexport default function MDXContent({\n components,\n ...props\n}) {\n return \n

{`Woah! You are almost half way done with understanding all of Discordeno. Amazing isn't it? Something you may have noticed in the last section was there were some options that prevented some commands from running like `}{`dmOnly`}{` or the permission options. we created a setting to prevent the monitor from running in certain channels. What if we wanted to do prevent commands from happening? How would we prevent commands from running?`}

\n

{`What is an Inhibitor?`}

\n

{`An Inhibitor is very similar to how monitors work. A monitor runs on every message but an inhibitor runs on every command. Remember all those command options like cooldown, permissions, permissionLevel, nsfw, etc... Each and every one of these options has an inhibitor in that checks commands for these settings.`}

\n

{`Let's create our own inhibitor that would prevent commands from being used if the user is not a VIP user.`}

\n
\n

{`Note:`}{` It is important to remember that everything below can be done with a simple permission level as well. We will create our own custom permission levels but for the purposes of this guide and to be able to learn about Inhibitors, we will be using an inhibitor.`}

\n
\n

{`Creating the File`}

\n

{`Let's start by creating a file inside the inhibitors folder called `}{`boosted.ts`}{` and paste the following snippet of code:`}

\n
{`import { botCache } from \"../../mod.ts\";\n\nbotCache.inhibitors.set(\"inhibitorname\", async function (message, command, guild) {\n    // Your code goes here\n});\n`}
\n

{`Inhibitors can take up to 3 arguments.`}

\n
    \n
  • {`message`}{`: The message object that triggered the command.`}
  • \n
  • {`command`}{`: The command object itself that was triggered.`}
  • \n
  • {`guild`}{`: The server guild object where this command was ran.`}
  • \n
\n

{`Understanding How Inhibitors Function`}

\n

{`To block a command you have to return a truthy value.`}

\n
    \n
  • {`return true;`}{` If you return true the inhibitor will block the execution of the command.\nTo allow a command return a falsey value.`}
  • \n
  • {`return false;`}{` If you return false the inhibitor will not block the error.`}
  • \n
\n
{`// If the command is not VIP only we can allow this command to execute\nif (!command.vipOnly) return false;\n\n// The bot's support server\nconst guild = cache.guilds.get(configs.supportServerID);\n// If the command author is not in the server they won't have the vip role\nconst member = guild.members.get(message.author.id) || await getMember(guild.id, message.author.id);\n// Member doesn't exist so cancel the command\nif (!member) {\n    sendResponse(message, \\`sorry, but you can not use this command until you become VIP. **Close the IRIS!!!**\\`)\n    return true;\n}\n\n// If the user has the vip role on the support server given by patreon allow the command\nif (member.roles.includes(configs.roleIDs.patreonVIPRoleID)) return false;\n\n// Alert the user they don't have vip and can't use the command\nsendResponse(message, \\`sorry, but you can not use this command until you become a VIP. I'm sorry, Teal'c. We'll go to Disneyland next year. I promise.\\`)\n// Cancel the command since the user does not have vip\nreturn true;\n`}
\n

{`Updating Command Typings`}

\n

{`Since we need a new option on our commands we need to add that. Open the`}

\n

{`Challenges`}

\n

{`Hell yes! We just got through the entire inhibitor section. You have now mastered everything related to inhibitors.`}

\n

{`You can now try and get a little more practice with inhibitors by trying to challenge yourself and make your own inhibitors. Don't worry if you can't think of any good use cases for inhibitors.`}

\n

{`Majority of Discordeno bots do not use many custom inhibitors because most of the necessary/important ones already come built for you in the inhibitors folder.`}

\n

{`Next we will try our hands at creating a monitor.`}

\n\n
;\n}\n\n;\nMDXContent.isMDXComponent = true;"}} \ No newline at end of file diff --git a/docs/.cache/caches/gatsby-plugin-mdx/diskstore-a64e6583e36462c2f995ac0719e123c1.json b/docs/.cache/caches/gatsby-plugin-mdx/diskstore-a64e6583e36462c2f995ac0719e123c1.json new file mode 100644 index 000000000..0419abe98 --- /dev/null +++ b/docs/.cache/caches/gatsby-plugin-mdx/diskstore-a64e6583e36462c2f995ac0719e123c1.json @@ -0,0 +1 @@ +{"expireTime":9007200851634212000,"key":"gatsby-plugin-mdx-entire-payload-4db9ef2accb868d18935c90047a68582-","val":{"mdast":{"type":"root","children":[{"type":"paragraph","children":[{"type":"text","value":"Woah! You are almost half way done with understanding all of Discordeno. Amazing isn't it? Something you may have noticed in the last section was there were some options that prevented some commands from running like ","position":{"start":{"line":2,"column":1,"offset":1},"end":{"line":2,"column":218,"offset":218},"indent":[]}},{"type":"inlineCode","value":"dmOnly","position":{"start":{"line":2,"column":218,"offset":218},"end":{"line":2,"column":226,"offset":226},"indent":[]}},{"type":"text","value":" or the permission options. we created a setting to prevent the monitor from running in certain channels. What if we wanted to do prevent commands from happening? How would we prevent commands from running?","position":{"start":{"line":2,"column":226,"offset":226},"end":{"line":2,"column":432,"offset":432},"indent":[]}}],"position":{"start":{"line":2,"column":1,"offset":1},"end":{"line":2,"column":432,"offset":432},"indent":[]}},{"type":"heading","depth":2,"children":[{"type":"text","value":"What is an Inhibitor?","position":{"start":{"line":4,"column":4,"offset":437},"end":{"line":4,"column":25,"offset":458},"indent":[]}}],"position":{"start":{"line":4,"column":1,"offset":434},"end":{"line":4,"column":25,"offset":458},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"An Inhibitor is very similar to how monitors work. A monitor runs on every message but an inhibitor runs on every command. Remember all those command options like cooldown, permissions, permissionLevel, nsfw, etc... Each and every one of these options has an inhibitor in that checks commands for these settings.","position":{"start":{"line":6,"column":1,"offset":460},"end":{"line":6,"column":313,"offset":772},"indent":[]}}],"position":{"start":{"line":6,"column":1,"offset":460},"end":{"line":6,"column":313,"offset":772},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"Let's create our own inhibitor that would prevent commands from being used if the user is not a VIP user.","position":{"start":{"line":8,"column":1,"offset":774},"end":{"line":8,"column":106,"offset":879},"indent":[]}}],"position":{"start":{"line":8,"column":1,"offset":774},"end":{"line":8,"column":106,"offset":879},"indent":[]}},{"type":"blockquote","children":[{"type":"paragraph","children":[{"type":"strong","children":[{"type":"text","value":"Note:","position":{"start":{"line":10,"column":5,"offset":885},"end":{"line":10,"column":10,"offset":890},"indent":[]}}],"position":{"start":{"line":10,"column":3,"offset":883},"end":{"line":10,"column":12,"offset":892},"indent":[]}},{"type":"text","value":" It is important to remember that everything below can be done with a simple permission level as well. We will create our own custom permission levels but for the purposes of this guide and to be able to learn about Inhibitors, we will be using an inhibitor.","position":{"start":{"line":10,"column":12,"offset":892},"end":{"line":10,"column":270,"offset":1150},"indent":[]}}],"position":{"start":{"line":10,"column":3,"offset":883},"end":{"line":10,"column":270,"offset":1150},"indent":[]}}],"position":{"start":{"line":10,"column":1,"offset":881},"end":{"line":10,"column":270,"offset":1150},"indent":[]}},{"type":"heading","depth":2,"children":[{"type":"text","value":"Creating the File","position":{"start":{"line":12,"column":4,"offset":1155},"end":{"line":12,"column":21,"offset":1172},"indent":[]}}],"position":{"start":{"line":12,"column":1,"offset":1152},"end":{"line":12,"column":21,"offset":1172},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"Let's start by creating a file inside the inhibitors folder called ","position":{"start":{"line":14,"column":1,"offset":1174},"end":{"line":14,"column":68,"offset":1241},"indent":[]}},{"type":"inlineCode","value":"boosted.ts","position":{"start":{"line":14,"column":68,"offset":1241},"end":{"line":14,"column":80,"offset":1253},"indent":[]}},{"type":"text","value":" and paste the following snippet of code:","position":{"start":{"line":14,"column":80,"offset":1253},"end":{"line":14,"column":121,"offset":1294},"indent":[]}}],"position":{"start":{"line":14,"column":1,"offset":1174},"end":{"line":14,"column":121,"offset":1294},"indent":[]}},{"type":"code","lang":"ts","meta":null,"value":"import { botCache } from \"../../mod.ts\";\n\nbotCache.inhibitors.set(\"inhibitorname\", async function (message, command, guild) {\n\t// Your code goes here\n});","position":{"start":{"line":16,"column":1,"offset":1296},"end":{"line":22,"column":4,"offset":1459},"indent":[1,1,1,1,1,1]}},{"type":"paragraph","children":[{"type":"text","value":"Inhibitors can take up to 3 arguments.","position":{"start":{"line":24,"column":1,"offset":1461},"end":{"line":24,"column":39,"offset":1499},"indent":[]}}],"position":{"start":{"line":24,"column":1,"offset":1461},"end":{"line":24,"column":39,"offset":1499},"indent":[]}},{"type":"list","ordered":false,"start":null,"spread":false,"children":[{"type":"listItem","spread":false,"checked":null,"children":[{"type":"paragraph","children":[{"type":"inlineCode","value":"message","position":{"start":{"line":26,"column":3,"offset":1503},"end":{"line":26,"column":12,"offset":1512},"indent":[]}},{"type":"text","value":": The message object that triggered the command.","position":{"start":{"line":26,"column":12,"offset":1512},"end":{"line":26,"column":60,"offset":1560},"indent":[]}}],"position":{"start":{"line":26,"column":3,"offset":1503},"end":{"line":26,"column":60,"offset":1560},"indent":[]}}],"position":{"start":{"line":26,"column":1,"offset":1501},"end":{"line":26,"column":60,"offset":1560},"indent":[]}},{"type":"listItem","spread":false,"checked":null,"children":[{"type":"paragraph","children":[{"type":"inlineCode","value":"command","position":{"start":{"line":27,"column":3,"offset":1563},"end":{"line":27,"column":12,"offset":1572},"indent":[]}},{"type":"text","value":": The command object itself that was triggered.","position":{"start":{"line":27,"column":12,"offset":1572},"end":{"line":27,"column":59,"offset":1619},"indent":[]}}],"position":{"start":{"line":27,"column":3,"offset":1563},"end":{"line":27,"column":59,"offset":1619},"indent":[]}}],"position":{"start":{"line":27,"column":1,"offset":1561},"end":{"line":27,"column":59,"offset":1619},"indent":[]}},{"type":"listItem","spread":false,"checked":null,"children":[{"type":"paragraph","children":[{"type":"inlineCode","value":"guild","position":{"start":{"line":28,"column":3,"offset":1622},"end":{"line":28,"column":10,"offset":1629},"indent":[]}},{"type":"text","value":": The server guild object where this command was ran.","position":{"start":{"line":28,"column":10,"offset":1629},"end":{"line":28,"column":63,"offset":1682},"indent":[]}}],"position":{"start":{"line":28,"column":3,"offset":1622},"end":{"line":28,"column":63,"offset":1682},"indent":[]}}],"position":{"start":{"line":28,"column":1,"offset":1620},"end":{"line":28,"column":63,"offset":1682},"indent":[]}}],"position":{"start":{"line":26,"column":1,"offset":1501},"end":{"line":28,"column":63,"offset":1682},"indent":[1,1]}},{"type":"heading","depth":2,"children":[{"type":"text","value":"Understanding How Inhibitors Function","position":{"start":{"line":30,"column":4,"offset":1687},"end":{"line":30,"column":41,"offset":1724},"indent":[]}}],"position":{"start":{"line":30,"column":1,"offset":1684},"end":{"line":30,"column":41,"offset":1724},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"To block a command you have to return a truthy value.","position":{"start":{"line":32,"column":1,"offset":1726},"end":{"line":32,"column":54,"offset":1779},"indent":[]}}],"position":{"start":{"line":32,"column":1,"offset":1726},"end":{"line":32,"column":54,"offset":1779},"indent":[]}},{"type":"list","ordered":false,"start":null,"spread":false,"children":[{"type":"listItem","spread":false,"checked":null,"children":[{"type":"paragraph","children":[{"type":"strong","children":[{"type":"text","value":"return true;","position":{"start":{"line":33,"column":5,"offset":1784},"end":{"line":33,"column":17,"offset":1796},"indent":[]}}],"position":{"start":{"line":33,"column":3,"offset":1782},"end":{"line":33,"column":19,"offset":1798},"indent":[]}},{"type":"text","value":" If you return true the inhibitor will block the execution of the command.\nTo allow a command return a falsey value.","position":{"start":{"line":33,"column":19,"offset":1798},"end":{"line":34,"column":42,"offset":1914},"indent":[1]}}],"position":{"start":{"line":33,"column":3,"offset":1782},"end":{"line":34,"column":42,"offset":1914},"indent":[1]}}],"position":{"start":{"line":33,"column":1,"offset":1780},"end":{"line":34,"column":42,"offset":1914},"indent":[1]}},{"type":"listItem","spread":false,"checked":null,"children":[{"type":"paragraph","children":[{"type":"strong","children":[{"type":"text","value":"return false;","position":{"start":{"line":35,"column":5,"offset":1919},"end":{"line":35,"column":18,"offset":1932},"indent":[]}}],"position":{"start":{"line":35,"column":3,"offset":1917},"end":{"line":35,"column":20,"offset":1934},"indent":[]}},{"type":"text","value":" If you return false the inhibitor will not block the error.","position":{"start":{"line":35,"column":20,"offset":1934},"end":{"line":35,"column":80,"offset":1994},"indent":[]}}],"position":{"start":{"line":35,"column":3,"offset":1917},"end":{"line":35,"column":80,"offset":1994},"indent":[]}}],"position":{"start":{"line":35,"column":1,"offset":1915},"end":{"line":35,"column":80,"offset":1994},"indent":[]}}],"position":{"start":{"line":33,"column":1,"offset":1780},"end":{"line":35,"column":80,"offset":1994},"indent":[1,1]}},{"type":"code","lang":"ts","meta":null,"value":"// If the command is not VIP only we can allow this command to execute\nif (!command.vipOnly) return false;\n\n// The bot's support server\nconst guild = cache.guilds.get(configs.supportServerID);\n// If the command author is not in the server they won't have the vip role\nconst member = guild.members.get(message.author.id) || await getMember();\n// Member doesn't exist so cancel the command\nif (!member) return true;\n// Check if the user has the vip role on the support server given by patreon\nconst userIsVIP = await isUserVIP(message.author.id)\n// The user is VIP so we can allow this command to be used\nif (userIsVIP) return false;\n\n// The user is NOT VIP so we throw an error\nthrow `The ${command.name} is only allowed for VIP users.`","position":{"start":{"line":38,"column":1,"offset":1997},"end":{"line":55,"column":4,"offset":2742},"indent":[1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1]}},{"type":"export","value":"export const _frontmatter = {\"title\":\"Creating Inhibitors!\",\"metaTitle\":\"Creating An Inhibitor | Discordeno\",\"metaDescription\":\"Let's create our very own bot with Discordeno!\"}","position":{"start":{"line":58,"column":1,"offset":2745},"end":{"line":58,"column":177,"offset":2921},"indent":[]}}],"position":{"start":{"line":1,"column":1,"offset":0},"end":{"line":58,"column":177,"offset":2921}}},"scopeImports":["import * as React from 'react'"],"scopeIdentifiers":["React"],"body":"function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }\n\nfunction _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }\n\nfunction _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }\n\n/* @jsx mdx */\nvar _frontmatter = {\n \"title\": \"Creating Inhibitors!\",\n \"metaTitle\": \"Creating An Inhibitor | Discordeno\",\n \"metaDescription\": \"Let's create our very own bot with Discordeno!\"\n};\nvar layoutProps = {\n _frontmatter: _frontmatter\n};\nvar MDXLayout = \"wrapper\";\nreturn function MDXContent(_ref) {\n var components = _ref.components,\n props = _objectWithoutProperties(_ref, [\"components\"]);\n\n return mdx(MDXLayout, _extends({}, layoutProps, props, {\n components: components,\n mdxType: \"MDXLayout\"\n }), mdx(\"p\", null, \"Woah! You are almost half way done with understanding all of Discordeno. Amazing isn't it? Something you may have noticed in the last section was there were some options that prevented some commands from running like \", mdx(\"inlineCode\", {\n parentName: \"p\"\n }, \"dmOnly\"), \" or the permission options. we created a setting to prevent the monitor from running in certain channels. What if we wanted to do prevent commands from happening? How would we prevent commands from running?\"), mdx(\"h2\", null, \"What is an Inhibitor?\"), mdx(\"p\", null, \"An Inhibitor is very similar to how monitors work. A monitor runs on every message but an inhibitor runs on every command. Remember all those command options like cooldown, permissions, permissionLevel, nsfw, etc... Each and every one of these options has an inhibitor in that checks commands for these settings.\"), mdx(\"p\", null, \"Let's create our own inhibitor that would prevent commands from being used if the user is not a VIP user.\"), mdx(\"blockquote\", null, mdx(\"p\", {\n parentName: \"blockquote\"\n }, mdx(\"strong\", {\n parentName: \"p\"\n }, \"Note:\"), \" It is important to remember that everything below can be done with a simple permission level as well. We will create our own custom permission levels but for the purposes of this guide and to be able to learn about Inhibitors, we will be using an inhibitor.\")), mdx(\"h2\", null, \"Creating the File\"), mdx(\"p\", null, \"Let's start by creating a file inside the inhibitors folder called \", mdx(\"inlineCode\", {\n parentName: \"p\"\n }, \"boosted.ts\"), \" and paste the following snippet of code:\"), mdx(\"pre\", null, mdx(\"code\", _extends({\n parentName: \"pre\"\n }, {\n \"className\": \"language-ts\"\n }), \"import { botCache } from \\\"../../mod.ts\\\";\\n\\nbotCache.inhibitors.set(\\\"inhibitorname\\\", async function (message, command, guild) {\\n // Your code goes here\\n});\\n\")), mdx(\"p\", null, \"Inhibitors can take up to 3 arguments.\"), mdx(\"ul\", null, mdx(\"li\", {\n parentName: \"ul\"\n }, mdx(\"inlineCode\", {\n parentName: \"li\"\n }, \"message\"), \": The message object that triggered the command.\"), mdx(\"li\", {\n parentName: \"ul\"\n }, mdx(\"inlineCode\", {\n parentName: \"li\"\n }, \"command\"), \": The command object itself that was triggered.\"), mdx(\"li\", {\n parentName: \"ul\"\n }, mdx(\"inlineCode\", {\n parentName: \"li\"\n }, \"guild\"), \": The server guild object where this command was ran.\")), mdx(\"h2\", null, \"Understanding How Inhibitors Function\"), mdx(\"p\", null, \"To block a command you have to return a truthy value.\"), mdx(\"ul\", null, mdx(\"li\", {\n parentName: \"ul\"\n }, mdx(\"strong\", {\n parentName: \"li\"\n }, \"return true;\"), \" If you return true the inhibitor will block the execution of the command.\\nTo allow a command return a falsey value.\"), mdx(\"li\", {\n parentName: \"ul\"\n }, mdx(\"strong\", {\n parentName: \"li\"\n }, \"return false;\"), \" If you return false the inhibitor will not block the error.\")), mdx(\"pre\", null, mdx(\"code\", _extends({\n parentName: \"pre\"\n }, {\n \"className\": \"language-ts\"\n }), \"// If the command is not VIP only we can allow this command to execute\\nif (!command.vipOnly) return false;\\n\\n// The bot's support server\\nconst guild = cache.guilds.get(configs.supportServerID);\\n// If the command author is not in the server they won't have the vip role\\nconst member = guild.members.get(message.author.id) || await getMember();\\n// Member doesn't exist so cancel the command\\nif (!member) return true;\\n// Check if the user has the vip role on the support server given by patreon\\nconst userIsVIP = await isUserVIP(message.author.id)\\n// The user is VIP so we can allow this command to be used\\nif (userIsVIP) return false;\\n\\n// The user is NOT VIP so we throw an error\\nthrow `The ${command.name} is only allowed for VIP users.`\\n\")));\n}\n;\nMDXContent.isMDXComponent = true;","rawMDXOutput":"/* @jsx mdx */\nimport { mdx } from '@mdx-js/react';\n/* @jsx mdx */\n\nexport const _frontmatter = {\n \"title\": \"Creating Inhibitors!\",\n \"metaTitle\": \"Creating An Inhibitor | Discordeno\",\n \"metaDescription\": \"Let's create our very own bot with Discordeno!\"\n};\n\nconst layoutProps = {\n _frontmatter\n};\nconst MDXLayout = \"wrapper\"\nexport default function MDXContent({\n components,\n ...props\n}) {\n return \n

{`Woah! You are almost half way done with understanding all of Discordeno. Amazing isn't it? Something you may have noticed in the last section was there were some options that prevented some commands from running like `}{`dmOnly`}{` or the permission options. we created a setting to prevent the monitor from running in certain channels. What if we wanted to do prevent commands from happening? How would we prevent commands from running?`}

\n

{`What is an Inhibitor?`}

\n

{`An Inhibitor is very similar to how monitors work. A monitor runs on every message but an inhibitor runs on every command. Remember all those command options like cooldown, permissions, permissionLevel, nsfw, etc... Each and every one of these options has an inhibitor in that checks commands for these settings.`}

\n

{`Let's create our own inhibitor that would prevent commands from being used if the user is not a VIP user.`}

\n
\n

{`Note:`}{` It is important to remember that everything below can be done with a simple permission level as well. We will create our own custom permission levels but for the purposes of this guide and to be able to learn about Inhibitors, we will be using an inhibitor.`}

\n
\n

{`Creating the File`}

\n

{`Let's start by creating a file inside the inhibitors folder called `}{`boosted.ts`}{` and paste the following snippet of code:`}

\n
{`import { botCache } from \"../../mod.ts\";\n\nbotCache.inhibitors.set(\"inhibitorname\", async function (message, command, guild) {\n    // Your code goes here\n});\n`}
\n

{`Inhibitors can take up to 3 arguments.`}

\n
    \n
  • {`message`}{`: The message object that triggered the command.`}
  • \n
  • {`command`}{`: The command object itself that was triggered.`}
  • \n
  • {`guild`}{`: The server guild object where this command was ran.`}
  • \n
\n

{`Understanding How Inhibitors Function`}

\n

{`To block a command you have to return a truthy value.`}

\n
    \n
  • {`return true;`}{` If you return true the inhibitor will block the execution of the command.\nTo allow a command return a falsey value.`}
  • \n
  • {`return false;`}{` If you return false the inhibitor will not block the error.`}
  • \n
\n
{`// If the command is not VIP only we can allow this command to execute\nif (!command.vipOnly) return false;\n\n// The bot's support server\nconst guild = cache.guilds.get(configs.supportServerID);\n// If the command author is not in the server they won't have the vip role\nconst member = guild.members.get(message.author.id) || await getMember();\n// Member doesn't exist so cancel the command\nif (!member) return true;\n// Check if the user has the vip role on the support server given by patreon\nconst userIsVIP = await isUserVIP(message.author.id)\n// The user is VIP so we can allow this command to be used\nif (userIsVIP) return false;\n\n// The user is NOT VIP so we throw an error\nthrow \\`The \\${command.name} is only allowed for VIP users.\\`\n`}
\n\n
;\n}\n\n;\nMDXContent.isMDXComponent = true;"}} \ No newline at end of file diff --git a/docs/.cache/caches/gatsby-plugin-mdx/diskstore-a749d978085d1a19343e9ef2e01906d0.json b/docs/.cache/caches/gatsby-plugin-mdx/diskstore-a749d978085d1a19343e9ef2e01906d0.json new file mode 100644 index 000000000..4cece5903 --- /dev/null +++ b/docs/.cache/caches/gatsby-plugin-mdx/diskstore-a749d978085d1a19343e9ef2e01906d0.json @@ -0,0 +1 @@ +{"expireTime":9007200851634295000,"key":"gatsby-plugin-mdx-entire-payload-fdc40bbe41b772e208f3de4222e8856f-","val":{"mdast":{"type":"root","children":[{"type":"paragraph","children":[{"type":"text","value":"Woah! You are almost half way done with understanding all of Discordeno. Amazing isn't it? Something you may have noticed in the last section was there were some options that prevented some commands from running like ","position":{"start":{"line":2,"column":1,"offset":1},"end":{"line":2,"column":218,"offset":218},"indent":[]}},{"type":"inlineCode","value":"dmOnly","position":{"start":{"line":2,"column":218,"offset":218},"end":{"line":2,"column":226,"offset":226},"indent":[]}},{"type":"text","value":" or the permission options. we created a setting to prevent the monitor from running in certain channels. What if we wanted to do prevent commands from happening? How would we prevent commands from running?","position":{"start":{"line":2,"column":226,"offset":226},"end":{"line":2,"column":432,"offset":432},"indent":[]}}],"position":{"start":{"line":2,"column":1,"offset":1},"end":{"line":2,"column":432,"offset":432},"indent":[]}},{"type":"heading","depth":2,"children":[{"type":"text","value":"What is an Inhibitor?","position":{"start":{"line":4,"column":4,"offset":437},"end":{"line":4,"column":25,"offset":458},"indent":[]}}],"position":{"start":{"line":4,"column":1,"offset":434},"end":{"line":4,"column":25,"offset":458},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"An Inhibitor is very similar to how monitors work. A monitor runs on every message but an inhibitor runs on every command. Remember all those command options like cooldown, permissions, permissionLevel, nsfw, etc... Each and every one of these options has an inhibitor in that checks commands for these settings.","position":{"start":{"line":6,"column":1,"offset":460},"end":{"line":6,"column":313,"offset":772},"indent":[]}}],"position":{"start":{"line":6,"column":1,"offset":460},"end":{"line":6,"column":313,"offset":772},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"Let's create our own inhibitor that would prevent commands from being used if the user is not a VIP user.","position":{"start":{"line":8,"column":1,"offset":774},"end":{"line":8,"column":106,"offset":879},"indent":[]}}],"position":{"start":{"line":8,"column":1,"offset":774},"end":{"line":8,"column":106,"offset":879},"indent":[]}},{"type":"blockquote","children":[{"type":"paragraph","children":[{"type":"strong","children":[{"type":"text","value":"Note:","position":{"start":{"line":10,"column":5,"offset":885},"end":{"line":10,"column":10,"offset":890},"indent":[]}}],"position":{"start":{"line":10,"column":3,"offset":883},"end":{"line":10,"column":12,"offset":892},"indent":[]}},{"type":"text","value":" It is important to remember that everything below can be done with a simple permission level as well. We will create our own custom permission levels but for the purposes of this guide and to be able to learn about Inhibitors, we will be using an inhibitor.","position":{"start":{"line":10,"column":12,"offset":892},"end":{"line":10,"column":270,"offset":1150},"indent":[]}}],"position":{"start":{"line":10,"column":3,"offset":883},"end":{"line":10,"column":270,"offset":1150},"indent":[]}}],"position":{"start":{"line":10,"column":1,"offset":881},"end":{"line":10,"column":270,"offset":1150},"indent":[]}},{"type":"heading","depth":2,"children":[{"type":"text","value":"Creating the File","position":{"start":{"line":12,"column":4,"offset":1155},"end":{"line":12,"column":21,"offset":1172},"indent":[]}}],"position":{"start":{"line":12,"column":1,"offset":1152},"end":{"line":12,"column":21,"offset":1172},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"Let's start by creating a file inside the inhibitors folder called ","position":{"start":{"line":14,"column":1,"offset":1174},"end":{"line":14,"column":68,"offset":1241},"indent":[]}},{"type":"inlineCode","value":"boosted.ts","position":{"start":{"line":14,"column":68,"offset":1241},"end":{"line":14,"column":80,"offset":1253},"indent":[]}},{"type":"text","value":" and paste the following snippet of code:","position":{"start":{"line":14,"column":80,"offset":1253},"end":{"line":14,"column":121,"offset":1294},"indent":[]}}],"position":{"start":{"line":14,"column":1,"offset":1174},"end":{"line":14,"column":121,"offset":1294},"indent":[]}},{"type":"code","lang":"ts","meta":null,"value":"import { botCache } from \"../../mod.ts\";\n\nbotCache.inhibitors.set(\"inhibitorname\", async function (message, command, guild) {\n\t// Your code goes here\n});","position":{"start":{"line":16,"column":1,"offset":1296},"end":{"line":22,"column":4,"offset":1459},"indent":[1,1,1,1,1,1]}},{"type":"paragraph","children":[{"type":"text","value":"Inhibitors can take up to 3 arguments.","position":{"start":{"line":24,"column":1,"offset":1461},"end":{"line":24,"column":39,"offset":1499},"indent":[]}}],"position":{"start":{"line":24,"column":1,"offset":1461},"end":{"line":24,"column":39,"offset":1499},"indent":[]}},{"type":"list","ordered":false,"start":null,"spread":false,"children":[{"type":"listItem","spread":false,"checked":null,"children":[{"type":"paragraph","children":[{"type":"inlineCode","value":"message","position":{"start":{"line":26,"column":3,"offset":1503},"end":{"line":26,"column":12,"offset":1512},"indent":[]}},{"type":"text","value":": The message object that triggered the command.","position":{"start":{"line":26,"column":12,"offset":1512},"end":{"line":26,"column":60,"offset":1560},"indent":[]}}],"position":{"start":{"line":26,"column":3,"offset":1503},"end":{"line":26,"column":60,"offset":1560},"indent":[]}}],"position":{"start":{"line":26,"column":1,"offset":1501},"end":{"line":26,"column":60,"offset":1560},"indent":[]}},{"type":"listItem","spread":false,"checked":null,"children":[{"type":"paragraph","children":[{"type":"inlineCode","value":"command","position":{"start":{"line":27,"column":3,"offset":1563},"end":{"line":27,"column":12,"offset":1572},"indent":[]}},{"type":"text","value":": The command object itself that was triggered.","position":{"start":{"line":27,"column":12,"offset":1572},"end":{"line":27,"column":59,"offset":1619},"indent":[]}}],"position":{"start":{"line":27,"column":3,"offset":1563},"end":{"line":27,"column":59,"offset":1619},"indent":[]}}],"position":{"start":{"line":27,"column":1,"offset":1561},"end":{"line":27,"column":59,"offset":1619},"indent":[]}},{"type":"listItem","spread":false,"checked":null,"children":[{"type":"paragraph","children":[{"type":"inlineCode","value":"guild","position":{"start":{"line":28,"column":3,"offset":1622},"end":{"line":28,"column":10,"offset":1629},"indent":[]}},{"type":"text","value":": The server guild object where this command was ran.","position":{"start":{"line":28,"column":10,"offset":1629},"end":{"line":28,"column":63,"offset":1682},"indent":[]}}],"position":{"start":{"line":28,"column":3,"offset":1622},"end":{"line":28,"column":63,"offset":1682},"indent":[]}}],"position":{"start":{"line":28,"column":1,"offset":1620},"end":{"line":28,"column":63,"offset":1682},"indent":[]}}],"position":{"start":{"line":26,"column":1,"offset":1501},"end":{"line":28,"column":63,"offset":1682},"indent":[1,1]}},{"type":"heading","depth":2,"children":[{"type":"text","value":"Understanding How Inhibitors Function","position":{"start":{"line":30,"column":4,"offset":1687},"end":{"line":30,"column":41,"offset":1724},"indent":[]}}],"position":{"start":{"line":30,"column":1,"offset":1684},"end":{"line":30,"column":41,"offset":1724},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"To block a command you have to return a truthy value.","position":{"start":{"line":32,"column":1,"offset":1726},"end":{"line":32,"column":54,"offset":1779},"indent":[]}}],"position":{"start":{"line":32,"column":1,"offset":1726},"end":{"line":32,"column":54,"offset":1779},"indent":[]}},{"type":"list","ordered":false,"start":null,"spread":false,"children":[{"type":"listItem","spread":false,"checked":null,"children":[{"type":"paragraph","children":[{"type":"strong","children":[{"type":"text","value":"return true;","position":{"start":{"line":33,"column":5,"offset":1784},"end":{"line":33,"column":17,"offset":1796},"indent":[]}}],"position":{"start":{"line":33,"column":3,"offset":1782},"end":{"line":33,"column":19,"offset":1798},"indent":[]}},{"type":"text","value":" If you return true the inhibitor will block the execution of the command.\nTo allow a command return a falsey value.","position":{"start":{"line":33,"column":19,"offset":1798},"end":{"line":34,"column":42,"offset":1914},"indent":[1]}}],"position":{"start":{"line":33,"column":3,"offset":1782},"end":{"line":34,"column":42,"offset":1914},"indent":[1]}}],"position":{"start":{"line":33,"column":1,"offset":1780},"end":{"line":34,"column":42,"offset":1914},"indent":[1]}},{"type":"listItem","spread":false,"checked":null,"children":[{"type":"paragraph","children":[{"type":"strong","children":[{"type":"text","value":"return false;","position":{"start":{"line":35,"column":5,"offset":1919},"end":{"line":35,"column":18,"offset":1932},"indent":[]}}],"position":{"start":{"line":35,"column":3,"offset":1917},"end":{"line":35,"column":20,"offset":1934},"indent":[]}},{"type":"text","value":" If you return false the inhibitor will not block the error.","position":{"start":{"line":35,"column":20,"offset":1934},"end":{"line":35,"column":80,"offset":1994},"indent":[]}}],"position":{"start":{"line":35,"column":3,"offset":1917},"end":{"line":35,"column":80,"offset":1994},"indent":[]}}],"position":{"start":{"line":35,"column":1,"offset":1915},"end":{"line":35,"column":80,"offset":1994},"indent":[]}}],"position":{"start":{"line":33,"column":1,"offset":1780},"end":{"line":35,"column":80,"offset":1994},"indent":[1,1]}},{"type":"code","lang":"ts","meta":null,"value":"// If the command is not VIP only we can allow this command to execute\nif (!command.vipOnly) return false;\n\n// The bot's support server\nconst guild = cache.guilds.get(configs.supportServerID);\n// If the command author is not in the server they won't have the vip role\nconst member = guild.members.get(message.author.id) || await getMember(guild.id, message.author.id);\n// Member doesn't exist so cancel the command\nif (!member) return true;\n\n// If the user has the vip role on the support server given by patreon allow the command\nif (member.roles.includes(configs.patreonVIPRoleID)) return false;\n\n// Cancel the command since the user does not have vip\nreturn true;","position":{"start":{"line":38,"column":1,"offset":1997},"end":{"line":54,"column":4,"offset":2673},"indent":[1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1]}},{"type":"export","value":"export const _frontmatter = {\"title\":\"Creating Inhibitors!\",\"metaTitle\":\"Creating An Inhibitor | Discordeno\",\"metaDescription\":\"Let's create our very own bot with Discordeno!\"}","position":{"start":{"line":57,"column":1,"offset":2676},"end":{"line":57,"column":177,"offset":2852},"indent":[]}}],"position":{"start":{"line":1,"column":1,"offset":0},"end":{"line":57,"column":177,"offset":2852}}},"scopeImports":["import * as React from 'react'"],"scopeIdentifiers":["React"],"body":"function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }\n\nfunction _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }\n\nfunction _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }\n\n/* @jsx mdx */\nvar _frontmatter = {\n \"title\": \"Creating Inhibitors!\",\n \"metaTitle\": \"Creating An Inhibitor | Discordeno\",\n \"metaDescription\": \"Let's create our very own bot with Discordeno!\"\n};\nvar layoutProps = {\n _frontmatter: _frontmatter\n};\nvar MDXLayout = \"wrapper\";\nreturn function MDXContent(_ref) {\n var components = _ref.components,\n props = _objectWithoutProperties(_ref, [\"components\"]);\n\n return mdx(MDXLayout, _extends({}, layoutProps, props, {\n components: components,\n mdxType: \"MDXLayout\"\n }), mdx(\"p\", null, \"Woah! You are almost half way done with understanding all of Discordeno. Amazing isn't it? Something you may have noticed in the last section was there were some options that prevented some commands from running like \", mdx(\"inlineCode\", {\n parentName: \"p\"\n }, \"dmOnly\"), \" or the permission options. we created a setting to prevent the monitor from running in certain channels. What if we wanted to do prevent commands from happening? How would we prevent commands from running?\"), mdx(\"h2\", null, \"What is an Inhibitor?\"), mdx(\"p\", null, \"An Inhibitor is very similar to how monitors work. A monitor runs on every message but an inhibitor runs on every command. Remember all those command options like cooldown, permissions, permissionLevel, nsfw, etc... Each and every one of these options has an inhibitor in that checks commands for these settings.\"), mdx(\"p\", null, \"Let's create our own inhibitor that would prevent commands from being used if the user is not a VIP user.\"), mdx(\"blockquote\", null, mdx(\"p\", {\n parentName: \"blockquote\"\n }, mdx(\"strong\", {\n parentName: \"p\"\n }, \"Note:\"), \" It is important to remember that everything below can be done with a simple permission level as well. We will create our own custom permission levels but for the purposes of this guide and to be able to learn about Inhibitors, we will be using an inhibitor.\")), mdx(\"h2\", null, \"Creating the File\"), mdx(\"p\", null, \"Let's start by creating a file inside the inhibitors folder called \", mdx(\"inlineCode\", {\n parentName: \"p\"\n }, \"boosted.ts\"), \" and paste the following snippet of code:\"), mdx(\"pre\", null, mdx(\"code\", _extends({\n parentName: \"pre\"\n }, {\n \"className\": \"language-ts\"\n }), \"import { botCache } from \\\"../../mod.ts\\\";\\n\\nbotCache.inhibitors.set(\\\"inhibitorname\\\", async function (message, command, guild) {\\n // Your code goes here\\n});\\n\")), mdx(\"p\", null, \"Inhibitors can take up to 3 arguments.\"), mdx(\"ul\", null, mdx(\"li\", {\n parentName: \"ul\"\n }, mdx(\"inlineCode\", {\n parentName: \"li\"\n }, \"message\"), \": The message object that triggered the command.\"), mdx(\"li\", {\n parentName: \"ul\"\n }, mdx(\"inlineCode\", {\n parentName: \"li\"\n }, \"command\"), \": The command object itself that was triggered.\"), mdx(\"li\", {\n parentName: \"ul\"\n }, mdx(\"inlineCode\", {\n parentName: \"li\"\n }, \"guild\"), \": The server guild object where this command was ran.\")), mdx(\"h2\", null, \"Understanding How Inhibitors Function\"), mdx(\"p\", null, \"To block a command you have to return a truthy value.\"), mdx(\"ul\", null, mdx(\"li\", {\n parentName: \"ul\"\n }, mdx(\"strong\", {\n parentName: \"li\"\n }, \"return true;\"), \" If you return true the inhibitor will block the execution of the command.\\nTo allow a command return a falsey value.\"), mdx(\"li\", {\n parentName: \"ul\"\n }, mdx(\"strong\", {\n parentName: \"li\"\n }, \"return false;\"), \" If you return false the inhibitor will not block the error.\")), mdx(\"pre\", null, mdx(\"code\", _extends({\n parentName: \"pre\"\n }, {\n \"className\": \"language-ts\"\n }), \"// If the command is not VIP only we can allow this command to execute\\nif (!command.vipOnly) return false;\\n\\n// The bot's support server\\nconst guild = cache.guilds.get(configs.supportServerID);\\n// If the command author is not in the server they won't have the vip role\\nconst member = guild.members.get(message.author.id) || await getMember(guild.id, message.author.id);\\n// Member doesn't exist so cancel the command\\nif (!member) return true;\\n\\n// If the user has the vip role on the support server given by patreon allow the command\\nif (member.roles.includes(configs.patreonVIPRoleID)) return false;\\n\\n// Cancel the command since the user does not have vip\\nreturn true;\\n\")));\n}\n;\nMDXContent.isMDXComponent = true;","rawMDXOutput":"/* @jsx mdx */\nimport { mdx } from '@mdx-js/react';\n/* @jsx mdx */\n\nexport const _frontmatter = {\n \"title\": \"Creating Inhibitors!\",\n \"metaTitle\": \"Creating An Inhibitor | Discordeno\",\n \"metaDescription\": \"Let's create our very own bot with Discordeno!\"\n};\n\nconst layoutProps = {\n _frontmatter\n};\nconst MDXLayout = \"wrapper\"\nexport default function MDXContent({\n components,\n ...props\n}) {\n return \n

{`Woah! You are almost half way done with understanding all of Discordeno. Amazing isn't it? Something you may have noticed in the last section was there were some options that prevented some commands from running like `}{`dmOnly`}{` or the permission options. we created a setting to prevent the monitor from running in certain channels. What if we wanted to do prevent commands from happening? How would we prevent commands from running?`}

\n

{`What is an Inhibitor?`}

\n

{`An Inhibitor is very similar to how monitors work. A monitor runs on every message but an inhibitor runs on every command. Remember all those command options like cooldown, permissions, permissionLevel, nsfw, etc... Each and every one of these options has an inhibitor in that checks commands for these settings.`}

\n

{`Let's create our own inhibitor that would prevent commands from being used if the user is not a VIP user.`}

\n
\n

{`Note:`}{` It is important to remember that everything below can be done with a simple permission level as well. We will create our own custom permission levels but for the purposes of this guide and to be able to learn about Inhibitors, we will be using an inhibitor.`}

\n
\n

{`Creating the File`}

\n

{`Let's start by creating a file inside the inhibitors folder called `}{`boosted.ts`}{` and paste the following snippet of code:`}

\n
{`import { botCache } from \"../../mod.ts\";\n\nbotCache.inhibitors.set(\"inhibitorname\", async function (message, command, guild) {\n    // Your code goes here\n});\n`}
\n

{`Inhibitors can take up to 3 arguments.`}

\n
    \n
  • {`message`}{`: The message object that triggered the command.`}
  • \n
  • {`command`}{`: The command object itself that was triggered.`}
  • \n
  • {`guild`}{`: The server guild object where this command was ran.`}
  • \n
\n

{`Understanding How Inhibitors Function`}

\n

{`To block a command you have to return a truthy value.`}

\n
    \n
  • {`return true;`}{` If you return true the inhibitor will block the execution of the command.\nTo allow a command return a falsey value.`}
  • \n
  • {`return false;`}{` If you return false the inhibitor will not block the error.`}
  • \n
\n
{`// If the command is not VIP only we can allow this command to execute\nif (!command.vipOnly) return false;\n\n// The bot's support server\nconst guild = cache.guilds.get(configs.supportServerID);\n// If the command author is not in the server they won't have the vip role\nconst member = guild.members.get(message.author.id) || await getMember(guild.id, message.author.id);\n// Member doesn't exist so cancel the command\nif (!member) return true;\n\n// If the user has the vip role on the support server given by patreon allow the command\nif (member.roles.includes(configs.patreonVIPRoleID)) return false;\n\n// Cancel the command since the user does not have vip\nreturn true;\n`}
\n\n
;\n}\n\n;\nMDXContent.isMDXComponent = true;"}} \ No newline at end of file diff --git a/docs/.cache/caches/gatsby-plugin-mdx/diskstore-a93254839716a1a78aa72d0d2c436bad.json b/docs/.cache/caches/gatsby-plugin-mdx/diskstore-a93254839716a1a78aa72d0d2c436bad.json new file mode 100644 index 000000000..6b59cd600 --- /dev/null +++ b/docs/.cache/caches/gatsby-plugin-mdx/diskstore-a93254839716a1a78aa72d0d2c436bad.json @@ -0,0 +1 @@ +{"expireTime":9007200851632140000,"key":"gatsby-plugin-mdx-entire-payload-f793c1b00582f5db4cb91af86dbe5717-","val":{"mdast":{"type":"root","children":[{"type":"paragraph","children":[{"type":"text","value":"Woah! You are almost half way done with understanding all of Discordeno. Amazing isn't it? Something you may have noticed in the last section was there were some options that prevented some commands from running like ","position":{"start":{"line":2,"column":1,"offset":1},"end":{"line":2,"column":218,"offset":218},"indent":[]}},{"type":"inlineCode","value":"dmOnly","position":{"start":{"line":2,"column":218,"offset":218},"end":{"line":2,"column":226,"offset":226},"indent":[]}},{"type":"text","value":" or the permission options. we created a setting to prevent the monitor from running in certain channels. What if we wanted to do prevent commands from happening? How would we prevent commands from running?","position":{"start":{"line":2,"column":226,"offset":226},"end":{"line":2,"column":432,"offset":432},"indent":[]}}],"position":{"start":{"line":2,"column":1,"offset":1},"end":{"line":2,"column":432,"offset":432},"indent":[]}},{"type":"heading","depth":2,"children":[{"type":"text","value":"What is an Inhibitor?","position":{"start":{"line":4,"column":4,"offset":437},"end":{"line":4,"column":25,"offset":458},"indent":[]}}],"position":{"start":{"line":4,"column":1,"offset":434},"end":{"line":4,"column":25,"offset":458},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"An Inhibitor is very similar to how monitors work. A monitor runs on every message but an inhibitor runs on every command. Remember all those command options like cooldown, permissions, permissionLevel, nsfw, etc... Each and every one of these options has an inhibitor in that checks commands for these settings.","position":{"start":{"line":6,"column":1,"offset":460},"end":{"line":6,"column":313,"offset":772},"indent":[]}}],"position":{"start":{"line":6,"column":1,"offset":460},"end":{"line":6,"column":313,"offset":772},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"Let's create our own inhibitor that would prevent commands from being used if th.","position":{"start":{"line":8,"column":1,"offset":774},"end":{"line":8,"column":82,"offset":855},"indent":[]}}],"position":{"start":{"line":8,"column":1,"offset":774},"end":{"line":8,"column":82,"offset":855},"indent":[]}},{"type":"blockquote","children":[{"type":"paragraph","children":[{"type":"strong","children":[{"type":"text","value":"Note:","position":{"start":{"line":10,"column":5,"offset":861},"end":{"line":10,"column":10,"offset":866},"indent":[]}}],"position":{"start":{"line":10,"column":3,"offset":859},"end":{"line":10,"column":12,"offset":868},"indent":[]}},{"type":"text","value":" It is important to remember that everything below can be done with a simple permission level as well. We will create our own custom permission levels but for the purposes of this guide and to be able to learn about Inhibitors, we will be using an inhibitor.","position":{"start":{"line":10,"column":12,"offset":868},"end":{"line":10,"column":270,"offset":1126},"indent":[]}}],"position":{"start":{"line":10,"column":3,"offset":859},"end":{"line":10,"column":270,"offset":1126},"indent":[]}}],"position":{"start":{"line":10,"column":1,"offset":857},"end":{"line":10,"column":270,"offset":1126},"indent":[]}},{"type":"export","value":"export const _frontmatter = {\"title\":\"Creating Inhibitors!\",\"metaTitle\":\"Creating An Inhibitor | Discordeno\",\"metaDescription\":\"Let's create our very own bot with Discordeno!\"}","position":{"start":{"line":13,"column":1,"offset":1129},"end":{"line":13,"column":177,"offset":1305},"indent":[]}}],"position":{"start":{"line":1,"column":1,"offset":0},"end":{"line":13,"column":177,"offset":1305}}},"scopeImports":["import * as React from 'react'"],"scopeIdentifiers":["React"],"body":"function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }\n\nfunction _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }\n\nfunction _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }\n\n/* @jsx mdx */\nvar _frontmatter = {\n \"title\": \"Creating Inhibitors!\",\n \"metaTitle\": \"Creating An Inhibitor | Discordeno\",\n \"metaDescription\": \"Let's create our very own bot with Discordeno!\"\n};\nvar layoutProps = {\n _frontmatter: _frontmatter\n};\nvar MDXLayout = \"wrapper\";\nreturn function MDXContent(_ref) {\n var components = _ref.components,\n props = _objectWithoutProperties(_ref, [\"components\"]);\n\n return mdx(MDXLayout, _extends({}, layoutProps, props, {\n components: components,\n mdxType: \"MDXLayout\"\n }), mdx(\"p\", null, \"Woah! You are almost half way done with understanding all of Discordeno. Amazing isn't it? Something you may have noticed in the last section was there were some options that prevented some commands from running like \", mdx(\"inlineCode\", {\n parentName: \"p\"\n }, \"dmOnly\"), \" or the permission options. we created a setting to prevent the monitor from running in certain channels. What if we wanted to do prevent commands from happening? How would we prevent commands from running?\"), mdx(\"h2\", null, \"What is an Inhibitor?\"), mdx(\"p\", null, \"An Inhibitor is very similar to how monitors work. A monitor runs on every message but an inhibitor runs on every command. Remember all those command options like cooldown, permissions, permissionLevel, nsfw, etc... Each and every one of these options has an inhibitor in that checks commands for these settings.\"), mdx(\"p\", null, \"Let's create our own inhibitor that would prevent commands from being used if th.\"), mdx(\"blockquote\", null, mdx(\"p\", {\n parentName: \"blockquote\"\n }, mdx(\"strong\", {\n parentName: \"p\"\n }, \"Note:\"), \" It is important to remember that everything below can be done with a simple permission level as well. We will create our own custom permission levels but for the purposes of this guide and to be able to learn about Inhibitors, we will be using an inhibitor.\")));\n}\n;\nMDXContent.isMDXComponent = true;","rawMDXOutput":"/* @jsx mdx */\nimport { mdx } from '@mdx-js/react';\n/* @jsx mdx */\n\nexport const _frontmatter = {\n \"title\": \"Creating Inhibitors!\",\n \"metaTitle\": \"Creating An Inhibitor | Discordeno\",\n \"metaDescription\": \"Let's create our very own bot with Discordeno!\"\n};\n\nconst layoutProps = {\n _frontmatter\n};\nconst MDXLayout = \"wrapper\"\nexport default function MDXContent({\n components,\n ...props\n}) {\n return \n

{`Woah! You are almost half way done with understanding all of Discordeno. Amazing isn't it? Something you may have noticed in the last section was there were some options that prevented some commands from running like `}{`dmOnly`}{` or the permission options. we created a setting to prevent the monitor from running in certain channels. What if we wanted to do prevent commands from happening? How would we prevent commands from running?`}

\n

{`What is an Inhibitor?`}

\n

{`An Inhibitor is very similar to how monitors work. A monitor runs on every message but an inhibitor runs on every command. Remember all those command options like cooldown, permissions, permissionLevel, nsfw, etc... Each and every one of these options has an inhibitor in that checks commands for these settings.`}

\n

{`Let's create our own inhibitor that would prevent commands from being used if th.`}

\n
\n

{`Note:`}{` It is important to remember that everything below can be done with a simple permission level as well. We will create our own custom permission levels but for the purposes of this guide and to be able to learn about Inhibitors, we will be using an inhibitor.`}

\n
\n\n
;\n}\n\n;\nMDXContent.isMDXComponent = true;"}} \ No newline at end of file diff --git a/docs/.cache/caches/gatsby-plugin-mdx/diskstore-a940b4d7ec548d7b13ba82ca3f50a54f.json b/docs/.cache/caches/gatsby-plugin-mdx/diskstore-a940b4d7ec548d7b13ba82ca3f50a54f.json new file mode 100644 index 000000000..2782860f4 --- /dev/null +++ b/docs/.cache/caches/gatsby-plugin-mdx/diskstore-a940b4d7ec548d7b13ba82ca3f50a54f.json @@ -0,0 +1 @@ +{"expireTime":9007200851634179000,"key":"gatsby-plugin-mdx-entire-payload-a76485bda2f235aa4c963af3b1d10326-","val":{"mdast":{"type":"root","children":[{"type":"paragraph","children":[{"type":"text","value":"Woah! You are almost half way done with understanding all of Discordeno. Amazing isn't it? Something you may have noticed in the last section was there were some options that prevented some commands from running like ","position":{"start":{"line":2,"column":1,"offset":1},"end":{"line":2,"column":218,"offset":218},"indent":[]}},{"type":"inlineCode","value":"dmOnly","position":{"start":{"line":2,"column":218,"offset":218},"end":{"line":2,"column":226,"offset":226},"indent":[]}},{"type":"text","value":" or the permission options. we created a setting to prevent the monitor from running in certain channels. What if we wanted to do prevent commands from happening? How would we prevent commands from running?","position":{"start":{"line":2,"column":226,"offset":226},"end":{"line":2,"column":432,"offset":432},"indent":[]}}],"position":{"start":{"line":2,"column":1,"offset":1},"end":{"line":2,"column":432,"offset":432},"indent":[]}},{"type":"heading","depth":2,"children":[{"type":"text","value":"What is an Inhibitor?","position":{"start":{"line":4,"column":4,"offset":437},"end":{"line":4,"column":25,"offset":458},"indent":[]}}],"position":{"start":{"line":4,"column":1,"offset":434},"end":{"line":4,"column":25,"offset":458},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"An Inhibitor is very similar to how monitors work. A monitor runs on every message but an inhibitor runs on every command. Remember all those command options like cooldown, permissions, permissionLevel, nsfw, etc... Each and every one of these options has an inhibitor in that checks commands for these settings.","position":{"start":{"line":6,"column":1,"offset":460},"end":{"line":6,"column":313,"offset":772},"indent":[]}}],"position":{"start":{"line":6,"column":1,"offset":460},"end":{"line":6,"column":313,"offset":772},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"Let's create our own inhibitor that would prevent commands from being used if the user is not a VIP user.","position":{"start":{"line":8,"column":1,"offset":774},"end":{"line":8,"column":106,"offset":879},"indent":[]}}],"position":{"start":{"line":8,"column":1,"offset":774},"end":{"line":8,"column":106,"offset":879},"indent":[]}},{"type":"blockquote","children":[{"type":"paragraph","children":[{"type":"strong","children":[{"type":"text","value":"Note:","position":{"start":{"line":10,"column":5,"offset":885},"end":{"line":10,"column":10,"offset":890},"indent":[]}}],"position":{"start":{"line":10,"column":3,"offset":883},"end":{"line":10,"column":12,"offset":892},"indent":[]}},{"type":"text","value":" It is important to remember that everything below can be done with a simple permission level as well. We will create our own custom permission levels but for the purposes of this guide and to be able to learn about Inhibitors, we will be using an inhibitor.","position":{"start":{"line":10,"column":12,"offset":892},"end":{"line":10,"column":270,"offset":1150},"indent":[]}}],"position":{"start":{"line":10,"column":3,"offset":883},"end":{"line":10,"column":270,"offset":1150},"indent":[]}}],"position":{"start":{"line":10,"column":1,"offset":881},"end":{"line":10,"column":270,"offset":1150},"indent":[]}},{"type":"heading","depth":2,"children":[{"type":"text","value":"Creating the File","position":{"start":{"line":12,"column":4,"offset":1155},"end":{"line":12,"column":21,"offset":1172},"indent":[]}}],"position":{"start":{"line":12,"column":1,"offset":1152},"end":{"line":12,"column":21,"offset":1172},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"Let's start by creating a file inside the inhibitors folder called ","position":{"start":{"line":14,"column":1,"offset":1174},"end":{"line":14,"column":68,"offset":1241},"indent":[]}},{"type":"inlineCode","value":"boosted.ts","position":{"start":{"line":14,"column":68,"offset":1241},"end":{"line":14,"column":80,"offset":1253},"indent":[]}},{"type":"text","value":" and paste the following snippet of code:","position":{"start":{"line":14,"column":80,"offset":1253},"end":{"line":14,"column":121,"offset":1294},"indent":[]}}],"position":{"start":{"line":14,"column":1,"offset":1174},"end":{"line":14,"column":121,"offset":1294},"indent":[]}},{"type":"code","lang":"ts","meta":null,"value":"import { botCache } from \"../../mod.ts\";\n\nbotCache.inhibitors.set(\"inhibitorname\", async function (message, command, guild) {\n\t// Your code goes here\n});","position":{"start":{"line":16,"column":1,"offset":1296},"end":{"line":22,"column":4,"offset":1459},"indent":[1,1,1,1,1,1]}},{"type":"paragraph","children":[{"type":"text","value":"Inhibitors can take up to 3 arguments.","position":{"start":{"line":24,"column":1,"offset":1461},"end":{"line":24,"column":39,"offset":1499},"indent":[]}}],"position":{"start":{"line":24,"column":1,"offset":1461},"end":{"line":24,"column":39,"offset":1499},"indent":[]}},{"type":"list","ordered":false,"start":null,"spread":false,"children":[{"type":"listItem","spread":false,"checked":null,"children":[{"type":"paragraph","children":[{"type":"inlineCode","value":"message","position":{"start":{"line":26,"column":3,"offset":1503},"end":{"line":26,"column":12,"offset":1512},"indent":[]}},{"type":"text","value":": The message object that triggered the command.","position":{"start":{"line":26,"column":12,"offset":1512},"end":{"line":26,"column":60,"offset":1560},"indent":[]}}],"position":{"start":{"line":26,"column":3,"offset":1503},"end":{"line":26,"column":60,"offset":1560},"indent":[]}}],"position":{"start":{"line":26,"column":1,"offset":1501},"end":{"line":26,"column":60,"offset":1560},"indent":[]}},{"type":"listItem","spread":false,"checked":null,"children":[{"type":"paragraph","children":[{"type":"inlineCode","value":"command","position":{"start":{"line":27,"column":3,"offset":1563},"end":{"line":27,"column":12,"offset":1572},"indent":[]}},{"type":"text","value":": The command object itself that was triggered.","position":{"start":{"line":27,"column":12,"offset":1572},"end":{"line":27,"column":59,"offset":1619},"indent":[]}}],"position":{"start":{"line":27,"column":3,"offset":1563},"end":{"line":27,"column":59,"offset":1619},"indent":[]}}],"position":{"start":{"line":27,"column":1,"offset":1561},"end":{"line":27,"column":59,"offset":1619},"indent":[]}},{"type":"listItem","spread":false,"checked":null,"children":[{"type":"paragraph","children":[{"type":"inlineCode","value":"guild","position":{"start":{"line":28,"column":3,"offset":1622},"end":{"line":28,"column":10,"offset":1629},"indent":[]}},{"type":"text","value":": The server guild object where this command was ran.","position":{"start":{"line":28,"column":10,"offset":1629},"end":{"line":28,"column":63,"offset":1682},"indent":[]}}],"position":{"start":{"line":28,"column":3,"offset":1622},"end":{"line":28,"column":63,"offset":1682},"indent":[]}}],"position":{"start":{"line":28,"column":1,"offset":1620},"end":{"line":28,"column":63,"offset":1682},"indent":[]}}],"position":{"start":{"line":26,"column":1,"offset":1501},"end":{"line":28,"column":63,"offset":1682},"indent":[1,1]}},{"type":"heading","depth":2,"children":[{"type":"text","value":"Understanding How Inhibitors Function","position":{"start":{"line":30,"column":4,"offset":1687},"end":{"line":30,"column":41,"offset":1724},"indent":[]}}],"position":{"start":{"line":30,"column":1,"offset":1684},"end":{"line":30,"column":41,"offset":1724},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"To block a command you have to return a truthy value.","position":{"start":{"line":32,"column":1,"offset":1726},"end":{"line":32,"column":54,"offset":1779},"indent":[]}}],"position":{"start":{"line":32,"column":1,"offset":1726},"end":{"line":32,"column":54,"offset":1779},"indent":[]}},{"type":"list","ordered":false,"start":null,"spread":false,"children":[{"type":"listItem","spread":false,"checked":null,"children":[{"type":"paragraph","children":[{"type":"strong","children":[{"type":"text","value":"return true;","position":{"start":{"line":33,"column":5,"offset":1784},"end":{"line":33,"column":17,"offset":1796},"indent":[]}}],"position":{"start":{"line":33,"column":3,"offset":1782},"end":{"line":33,"column":19,"offset":1798},"indent":[]}},{"type":"text","value":" If you return true the inhibitor will block the execution of the command.\nTo allow a command return a falsey value.","position":{"start":{"line":33,"column":19,"offset":1798},"end":{"line":34,"column":42,"offset":1914},"indent":[1]}}],"position":{"start":{"line":33,"column":3,"offset":1782},"end":{"line":34,"column":42,"offset":1914},"indent":[1]}}],"position":{"start":{"line":33,"column":1,"offset":1780},"end":{"line":34,"column":42,"offset":1914},"indent":[1]}},{"type":"listItem","spread":false,"checked":null,"children":[{"type":"paragraph","children":[{"type":"strong","children":[{"type":"text","value":"return false;","position":{"start":{"line":35,"column":5,"offset":1919},"end":{"line":35,"column":18,"offset":1932},"indent":[]}}],"position":{"start":{"line":35,"column":3,"offset":1917},"end":{"line":35,"column":20,"offset":1934},"indent":[]}},{"type":"text","value":" If you return false the inhibitor will not block the error.","position":{"start":{"line":35,"column":20,"offset":1934},"end":{"line":35,"column":80,"offset":1994},"indent":[]}}],"position":{"start":{"line":35,"column":3,"offset":1917},"end":{"line":35,"column":80,"offset":1994},"indent":[]}}],"position":{"start":{"line":35,"column":1,"offset":1915},"end":{"line":35,"column":80,"offset":1994},"indent":[]}}],"position":{"start":{"line":33,"column":1,"offset":1780},"end":{"line":35,"column":80,"offset":1994},"indent":[1,1]}},{"type":"code","lang":"ts","meta":null,"value":"// If the command is not VIP only we can allow this command to execute\nif (!command.vipOnly) return false;\n\n// The bot's support server\nconst guild = cache.guilds.get(configs.supportServerID);\n// If the command author is not in the server they won't have the vip role so cancel the command\nconst member = guild.members.get(message.author.id);\nif (!member) return true;\n// Check if the user has the vip role on the support server given by patreon\nconst userIsVIP = await isUserVIP(message.author.id)\n// The user is VIP so we can allow this command to be used\nif (userIsVIP) return false;\n\n// The user is NOT VIP so we throw an error\nthrow `The ${command.name} is only allowed for VIP users.`","position":{"start":{"line":38,"column":1,"offset":1997},"end":{"line":54,"column":4,"offset":2697},"indent":[1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1]}},{"type":"export","value":"export const _frontmatter = {\"title\":\"Creating Inhibitors!\",\"metaTitle\":\"Creating An Inhibitor | Discordeno\",\"metaDescription\":\"Let's create our very own bot with Discordeno!\"}","position":{"start":{"line":57,"column":1,"offset":2700},"end":{"line":57,"column":177,"offset":2876},"indent":[]}}],"position":{"start":{"line":1,"column":1,"offset":0},"end":{"line":57,"column":177,"offset":2876}}},"scopeImports":["import * as React from 'react'"],"scopeIdentifiers":["React"],"body":"function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }\n\nfunction _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }\n\nfunction _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }\n\n/* @jsx mdx */\nvar _frontmatter = {\n \"title\": \"Creating Inhibitors!\",\n \"metaTitle\": \"Creating An Inhibitor | Discordeno\",\n \"metaDescription\": \"Let's create our very own bot with Discordeno!\"\n};\nvar layoutProps = {\n _frontmatter: _frontmatter\n};\nvar MDXLayout = \"wrapper\";\nreturn function MDXContent(_ref) {\n var components = _ref.components,\n props = _objectWithoutProperties(_ref, [\"components\"]);\n\n return mdx(MDXLayout, _extends({}, layoutProps, props, {\n components: components,\n mdxType: \"MDXLayout\"\n }), mdx(\"p\", null, \"Woah! You are almost half way done with understanding all of Discordeno. Amazing isn't it? Something you may have noticed in the last section was there were some options that prevented some commands from running like \", mdx(\"inlineCode\", {\n parentName: \"p\"\n }, \"dmOnly\"), \" or the permission options. we created a setting to prevent the monitor from running in certain channels. What if we wanted to do prevent commands from happening? How would we prevent commands from running?\"), mdx(\"h2\", null, \"What is an Inhibitor?\"), mdx(\"p\", null, \"An Inhibitor is very similar to how monitors work. A monitor runs on every message but an inhibitor runs on every command. Remember all those command options like cooldown, permissions, permissionLevel, nsfw, etc... Each and every one of these options has an inhibitor in that checks commands for these settings.\"), mdx(\"p\", null, \"Let's create our own inhibitor that would prevent commands from being used if the user is not a VIP user.\"), mdx(\"blockquote\", null, mdx(\"p\", {\n parentName: \"blockquote\"\n }, mdx(\"strong\", {\n parentName: \"p\"\n }, \"Note:\"), \" It is important to remember that everything below can be done with a simple permission level as well. We will create our own custom permission levels but for the purposes of this guide and to be able to learn about Inhibitors, we will be using an inhibitor.\")), mdx(\"h2\", null, \"Creating the File\"), mdx(\"p\", null, \"Let's start by creating a file inside the inhibitors folder called \", mdx(\"inlineCode\", {\n parentName: \"p\"\n }, \"boosted.ts\"), \" and paste the following snippet of code:\"), mdx(\"pre\", null, mdx(\"code\", _extends({\n parentName: \"pre\"\n }, {\n \"className\": \"language-ts\"\n }), \"import { botCache } from \\\"../../mod.ts\\\";\\n\\nbotCache.inhibitors.set(\\\"inhibitorname\\\", async function (message, command, guild) {\\n // Your code goes here\\n});\\n\")), mdx(\"p\", null, \"Inhibitors can take up to 3 arguments.\"), mdx(\"ul\", null, mdx(\"li\", {\n parentName: \"ul\"\n }, mdx(\"inlineCode\", {\n parentName: \"li\"\n }, \"message\"), \": The message object that triggered the command.\"), mdx(\"li\", {\n parentName: \"ul\"\n }, mdx(\"inlineCode\", {\n parentName: \"li\"\n }, \"command\"), \": The command object itself that was triggered.\"), mdx(\"li\", {\n parentName: \"ul\"\n }, mdx(\"inlineCode\", {\n parentName: \"li\"\n }, \"guild\"), \": The server guild object where this command was ran.\")), mdx(\"h2\", null, \"Understanding How Inhibitors Function\"), mdx(\"p\", null, \"To block a command you have to return a truthy value.\"), mdx(\"ul\", null, mdx(\"li\", {\n parentName: \"ul\"\n }, mdx(\"strong\", {\n parentName: \"li\"\n }, \"return true;\"), \" If you return true the inhibitor will block the execution of the command.\\nTo allow a command return a falsey value.\"), mdx(\"li\", {\n parentName: \"ul\"\n }, mdx(\"strong\", {\n parentName: \"li\"\n }, \"return false;\"), \" If you return false the inhibitor will not block the error.\")), mdx(\"pre\", null, mdx(\"code\", _extends({\n parentName: \"pre\"\n }, {\n \"className\": \"language-ts\"\n }), \"// If the command is not VIP only we can allow this command to execute\\nif (!command.vipOnly) return false;\\n\\n// The bot's support server\\nconst guild = cache.guilds.get(configs.supportServerID);\\n// If the command author is not in the server they won't have the vip role so cancel the command\\nconst member = guild.members.get(message.author.id);\\nif (!member) return true;\\n// Check if the user has the vip role on the support server given by patreon\\nconst userIsVIP = await isUserVIP(message.author.id)\\n// The user is VIP so we can allow this command to be used\\nif (userIsVIP) return false;\\n\\n// The user is NOT VIP so we throw an error\\nthrow `The ${command.name} is only allowed for VIP users.`\\n\")));\n}\n;\nMDXContent.isMDXComponent = true;","rawMDXOutput":"/* @jsx mdx */\nimport { mdx } from '@mdx-js/react';\n/* @jsx mdx */\n\nexport const _frontmatter = {\n \"title\": \"Creating Inhibitors!\",\n \"metaTitle\": \"Creating An Inhibitor | Discordeno\",\n \"metaDescription\": \"Let's create our very own bot with Discordeno!\"\n};\n\nconst layoutProps = {\n _frontmatter\n};\nconst MDXLayout = \"wrapper\"\nexport default function MDXContent({\n components,\n ...props\n}) {\n return \n

{`Woah! You are almost half way done with understanding all of Discordeno. Amazing isn't it? Something you may have noticed in the last section was there were some options that prevented some commands from running like `}{`dmOnly`}{` or the permission options. we created a setting to prevent the monitor from running in certain channels. What if we wanted to do prevent commands from happening? How would we prevent commands from running?`}

\n

{`What is an Inhibitor?`}

\n

{`An Inhibitor is very similar to how monitors work. A monitor runs on every message but an inhibitor runs on every command. Remember all those command options like cooldown, permissions, permissionLevel, nsfw, etc... Each and every one of these options has an inhibitor in that checks commands for these settings.`}

\n

{`Let's create our own inhibitor that would prevent commands from being used if the user is not a VIP user.`}

\n
\n

{`Note:`}{` It is important to remember that everything below can be done with a simple permission level as well. We will create our own custom permission levels but for the purposes of this guide and to be able to learn about Inhibitors, we will be using an inhibitor.`}

\n
\n

{`Creating the File`}

\n

{`Let's start by creating a file inside the inhibitors folder called `}{`boosted.ts`}{` and paste the following snippet of code:`}

\n
{`import { botCache } from \"../../mod.ts\";\n\nbotCache.inhibitors.set(\"inhibitorname\", async function (message, command, guild) {\n    // Your code goes here\n});\n`}
\n

{`Inhibitors can take up to 3 arguments.`}

\n
    \n
  • {`message`}{`: The message object that triggered the command.`}
  • \n
  • {`command`}{`: The command object itself that was triggered.`}
  • \n
  • {`guild`}{`: The server guild object where this command was ran.`}
  • \n
\n

{`Understanding How Inhibitors Function`}

\n

{`To block a command you have to return a truthy value.`}

\n
    \n
  • {`return true;`}{` If you return true the inhibitor will block the execution of the command.\nTo allow a command return a falsey value.`}
  • \n
  • {`return false;`}{` If you return false the inhibitor will not block the error.`}
  • \n
\n
{`// If the command is not VIP only we can allow this command to execute\nif (!command.vipOnly) return false;\n\n// The bot's support server\nconst guild = cache.guilds.get(configs.supportServerID);\n// If the command author is not in the server they won't have the vip role so cancel the command\nconst member = guild.members.get(message.author.id);\nif (!member) return true;\n// Check if the user has the vip role on the support server given by patreon\nconst userIsVIP = await isUserVIP(message.author.id)\n// The user is VIP so we can allow this command to be used\nif (userIsVIP) return false;\n\n// The user is NOT VIP so we throw an error\nthrow \\`The \\${command.name} is only allowed for VIP users.\\`\n`}
\n\n
;\n}\n\n;\nMDXContent.isMDXComponent = true;"}} \ No newline at end of file diff --git a/docs/.cache/caches/gatsby-plugin-mdx/diskstore-aa79913840d590ada89951e5811b2ca4.json b/docs/.cache/caches/gatsby-plugin-mdx/diskstore-aa79913840d590ada89951e5811b2ca4.json new file mode 100644 index 000000000..e29e6700e --- /dev/null +++ b/docs/.cache/caches/gatsby-plugin-mdx/diskstore-aa79913840d590ada89951e5811b2ca4.json @@ -0,0 +1 @@ +{"expireTime":9007200851596241000,"key":"gatsby-plugin-mdx-entire-payload-f8b491bd5a19b812570926bd67da8056-","val":{"mdast":{"type":"root","children":[{"type":"paragraph","children":[{"type":"text","value":"Discordeno will help make Discord bot development much easier. Don't worry, as you go through this guide it will make a lot more sense.","position":{"start":{"line":2,"column":1,"offset":1},"end":{"line":2,"column":136,"offset":136},"indent":[]}}],"position":{"start":{"line":2,"column":1,"offset":1},"end":{"line":2,"column":136,"offset":136},"indent":[]}},{"type":"heading","depth":2,"children":[{"type":"text","value":"Who Made Discordeno?","position":{"start":{"line":4,"column":4,"offset":141},"end":{"line":4,"column":24,"offset":161},"indent":[]}}],"position":{"start":{"line":4,"column":1,"offset":138},"end":{"line":4,"column":24,"offset":161},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"Skillz4Killz. However, there are a lot of other contributors to the project as well. Join the discord server to meet and learn more about the wonderful team!","position":{"start":{"line":6,"column":1,"offset":163},"end":{"line":6,"column":158,"offset":320},"indent":[]}}],"position":{"start":{"line":6,"column":1,"offset":163},"end":{"line":6,"column":158,"offset":320},"indent":[]}},{"type":"heading","depth":2,"children":[{"type":"text","value":"Why You Should Use Discordeno?","position":{"start":{"line":8,"column":4,"offset":325},"end":{"line":8,"column":34,"offset":355},"indent":[]}}],"position":{"start":{"line":8,"column":1,"offset":322},"end":{"line":8,"column":34,"offset":355},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"Discordeno provides you all the tools that you need to make bot development really easy. All the tools are already made for you to just simply copy and use for yourself. We will go through each and every tool in other sections of this guide.","position":{"start":{"line":10,"column":1,"offset":357},"end":{"line":10,"column":242,"offset":598},"indent":[]}}],"position":{"start":{"line":10,"column":1,"offset":357},"end":{"line":10,"column":242,"offset":598},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"As the old saying goes, the best way to learn to ride a bicycle is to actually try riding a bicycle. So let's try out Discordeno.","position":{"start":{"line":12,"column":1,"offset":600},"end":{"line":12,"column":130,"offset":729},"indent":[]}}],"position":{"start":{"line":12,"column":1,"offset":600},"end":{"line":12,"column":130,"offset":729},"indent":[]}},{"type":"heading","depth":2,"children":[{"type":"text","value":"Creating The Bot!","position":{"start":{"line":14,"column":4,"offset":734},"end":{"line":14,"column":21,"offset":751},"indent":[]}}],"position":{"start":{"line":14,"column":1,"offset":731},"end":{"line":14,"column":21,"offset":751},"indent":[]}},{"type":"blockquote","children":[{"type":"paragraph","children":[{"type":"text","value":"This guide is going to assume you already have the basic requirements to make a bot ready. This includes github, git, a code editor like Visual Studio Code. If you don't have these yet please prepare them first before going forward.","position":{"start":{"line":16,"column":3,"offset":755},"end":{"line":16,"column":235,"offset":987},"indent":[]}}],"position":{"start":{"line":16,"column":3,"offset":755},"end":{"line":16,"column":235,"offset":987},"indent":[]}}],"position":{"start":{"line":16,"column":1,"offset":753},"end":{"line":16,"column":235,"offset":987},"indent":[]}},{"type":"list","ordered":false,"start":null,"spread":true,"children":[{"type":"listItem","spread":false,"checked":null,"children":[{"type":"paragraph","children":[{"type":"text","value":"First, create a Discordeno Bot using the ","position":{"start":{"line":18,"column":3,"offset":991},"end":{"line":18,"column":44,"offset":1032},"indent":[]}},{"type":"link","title":null,"url":"https://github.com/Skillz4Killz/Discordeno-bot-template","children":[{"type":"text","value":"Generator Boilerplate","position":{"start":{"line":18,"column":45,"offset":1033},"end":{"line":18,"column":66,"offset":1054},"indent":[]}}],"position":{"start":{"line":18,"column":44,"offset":1032},"end":{"line":18,"column":124,"offset":1112},"indent":[]}},{"type":"text","value":". Give it any name you like. For the purpose of this guide we will call it, Stargate.","position":{"start":{"line":18,"column":124,"offset":1112},"end":{"line":18,"column":209,"offset":1197},"indent":[]}}],"position":{"start":{"line":18,"column":3,"offset":991},"end":{"line":18,"column":209,"offset":1197},"indent":[]}}],"position":{"start":{"line":18,"column":1,"offset":989},"end":{"line":19,"column":1,"offset":1198},"indent":[1]}},{"type":"listItem","spread":false,"checked":null,"children":[{"type":"paragraph","children":[{"type":"text","value":"Then ","position":{"start":{"line":20,"column":3,"offset":1201},"end":{"line":20,"column":8,"offset":1206},"indent":[]}},{"type":"inlineCode","value":"git clone https://github.com/Skillz4Killz/Stargate.git","position":{"start":{"line":20,"column":8,"offset":1206},"end":{"line":20,"column":64,"offset":1262},"indent":[]}}],"position":{"start":{"line":20,"column":3,"offset":1201},"end":{"line":20,"column":64,"offset":1262},"indent":[]}}],"position":{"start":{"line":20,"column":1,"offset":1199},"end":{"line":21,"column":1,"offset":1263},"indent":[1]}},{"type":"listItem","spread":false,"checked":null,"children":[{"type":"paragraph","children":[{"type":"text","value":"When that is done, go ahead and open up the folder with VSC.","position":{"start":{"line":22,"column":3,"offset":1266},"end":{"line":22,"column":63,"offset":1326},"indent":[]}}],"position":{"start":{"line":22,"column":3,"offset":1266},"end":{"line":22,"column":63,"offset":1326},"indent":[]}}],"position":{"start":{"line":22,"column":1,"offset":1264},"end":{"line":22,"column":63,"offset":1326},"indent":[]}},{"type":"listItem","spread":false,"checked":null,"children":[{"type":"paragraph","children":[{"type":"text","value":"Create a new file called ","position":{"start":{"line":23,"column":3,"offset":1329},"end":{"line":23,"column":28,"offset":1354},"indent":[]}},{"type":"inlineCode","value":"configs.ts","position":{"start":{"line":23,"column":28,"offset":1354},"end":{"line":23,"column":40,"offset":1366},"indent":[]}},{"type":"text","value":". Open the ","position":{"start":{"line":23,"column":40,"offset":1366},"end":{"line":23,"column":51,"offset":1377},"indent":[]}},{"type":"inlineCode","value":"configs.example.ts","position":{"start":{"line":23,"column":51,"offset":1377},"end":{"line":23,"column":71,"offset":1397},"indent":[]}},{"type":"text","value":" file and copy everything over.","position":{"start":{"line":23,"column":71,"offset":1397},"end":{"line":23,"column":102,"offset":1428},"indent":[]}}],"position":{"start":{"line":23,"column":3,"offset":1329},"end":{"line":23,"column":102,"offset":1428},"indent":[]}}],"position":{"start":{"line":23,"column":1,"offset":1327},"end":{"line":23,"column":102,"offset":1428},"indent":[]}}],"position":{"start":{"line":18,"column":1,"offset":989},"end":{"line":23,"column":102,"offset":1428},"indent":[1,1,1,1,1]}},{"type":"paragraph","children":[{"type":"text","value":"Let's take a minute to review all the options we have available to us.","position":{"start":{"line":25,"column":1,"offset":1430},"end":{"line":25,"column":71,"offset":1500},"indent":[]}}],"position":{"start":{"line":25,"column":1,"offset":1430},"end":{"line":25,"column":71,"offset":1500},"indent":[]}},{"type":"heading","depth":3,"children":[{"type":"text","value":"Configs File","position":{"start":{"line":27,"column":5,"offset":1506},"end":{"line":27,"column":17,"offset":1518},"indent":[]}}],"position":{"start":{"line":27,"column":1,"offset":1502},"end":{"line":27,"column":17,"offset":1518},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"The ","position":{"start":{"line":29,"column":1,"offset":1520},"end":{"line":29,"column":5,"offset":1524},"indent":[]}},{"type":"inlineCode","value":"configs.ts","position":{"start":{"line":29,"column":5,"offset":1524},"end":{"line":29,"column":17,"offset":1536},"indent":[]}},{"type":"text","value":" file is where you will keep all your secret info you don't want to share with anyone else. As long as ","position":{"start":{"line":29,"column":17,"offset":1536},"end":{"line":29,"column":120,"offset":1639},"indent":[]}},{"type":"inlineCode","value":".gitignore","position":{"start":{"line":29,"column":120,"offset":1639},"end":{"line":29,"column":132,"offset":1651},"indent":[]}},{"type":"text","value":" file is ignoring configs.ts your configurations will be kept private!","position":{"start":{"line":29,"column":132,"offset":1651},"end":{"line":29,"column":202,"offset":1721},"indent":[]}}],"position":{"start":{"line":29,"column":1,"offset":1520},"end":{"line":29,"column":202,"offset":1721},"indent":[]}},{"type":"code","lang":"ts","meta":null,"value":"export const configs = {\n token: \"\",\n prefix: \"!\",\n botListTokens: {\n DISCORD_BOT_ORG: \"\",\n BOTS_ON_DISCORD: \"\",\n DISCORD_BOT_LIST: \"\",\n BOTS_FOR_DISCORD: \"\",\n DISCORD_BOATS: \"\",\n DISCORD_BOTS_GG: \"\",\n DISCORD_BOTS_GROUP: \"\",\n },\n channelIDs: {\n missingTranslation: \"\",\n },\n};","position":{"start":{"line":31,"column":1,"offset":1723},"end":{"line":48,"column":4,"offset":2039},"indent":[1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1]}},{"type":"heading","depth":4,"children":[{"type":"text","value":"Token","position":{"start":{"line":50,"column":6,"offset":2046},"end":{"line":50,"column":11,"offset":2051},"indent":[]}}],"position":{"start":{"line":50,"column":1,"offset":2041},"end":{"line":50,"column":11,"offset":2051},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"First, add your bot token. This is ","position":{"start":{"line":52,"column":1,"offset":2053},"end":{"line":52,"column":36,"offset":2088},"indent":[]}},{"type":"strong","children":[{"type":"text","value":"required","position":{"start":{"line":52,"column":38,"offset":2090},"end":{"line":52,"column":46,"offset":2098},"indent":[]}}],"position":{"start":{"line":52,"column":36,"offset":2088},"end":{"line":52,"column":48,"offset":2100},"indent":[]}},{"type":"text","value":" for the bot to start. Review the ","position":{"start":{"line":52,"column":48,"offset":2100},"end":{"line":52,"column":82,"offset":2134},"indent":[]}},{"type":"link","title":null,"url":"https://discordeno.netlify.app/gettingstarted#creatingyourfirstdiscordbotapplication","children":[{"type":"text","value":"instructions","position":{"start":{"line":52,"column":83,"offset":2135},"end":{"line":52,"column":95,"offset":2147},"indent":[]}}],"position":{"start":{"line":52,"column":82,"offset":2134},"end":{"line":52,"column":182,"offset":2234},"indent":[]}},{"type":"text","value":" if you have not made your token yet.","position":{"start":{"line":52,"column":182,"offset":2234},"end":{"line":52,"column":219,"offset":2271},"indent":[]}}],"position":{"start":{"line":52,"column":1,"offset":2053},"end":{"line":52,"column":219,"offset":2271},"indent":[]}},{"type":"heading","depth":4,"children":[{"type":"text","value":"Prefix","position":{"start":{"line":54,"column":6,"offset":2278},"end":{"line":54,"column":12,"offset":2284},"indent":[]}}],"position":{"start":{"line":54,"column":1,"offset":2273},"end":{"line":54,"column":12,"offset":2284},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"The prefix is where you will set the default prefix for your bot. Don't worry, every server will be able to choose their own prefix but we need a default prefix to start.","position":{"start":{"line":56,"column":1,"offset":2286},"end":{"line":56,"column":171,"offset":2456},"indent":[]}}],"position":{"start":{"line":56,"column":1,"offset":2286},"end":{"line":56,"column":171,"offset":2456},"indent":[]}},{"type":"heading","depth":4,"children":[{"type":"text","value":"Bot Lists Tokens","position":{"start":{"line":58,"column":6,"offset":2463},"end":{"line":58,"column":22,"offset":2479},"indent":[]}}],"position":{"start":{"line":58,"column":1,"offset":2458},"end":{"line":58,"column":22,"offset":2479},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"This section of the file is so you can easily have your bot's statistics updated on all the bot lists out there to help you grow your bot. The code is already written to handle this but you will need to do 3 things for each bot list.","position":{"start":{"line":60,"column":1,"offset":2481},"end":{"line":60,"column":234,"offset":2714},"indent":[]}}],"position":{"start":{"line":60,"column":1,"offset":2481},"end":{"line":60,"column":234,"offset":2714},"indent":[]}},{"type":"list","ordered":true,"start":1,"spread":false,"children":[{"type":"listItem","spread":false,"checked":null,"children":[{"type":"paragraph","children":[{"type":"text","value":"Go to the bot list and add your bot to their website. (Each site has it's own instructions)","position":{"start":{"line":62,"column":4,"offset":2719},"end":{"line":62,"column":95,"offset":2810},"indent":[]}}],"position":{"start":{"line":62,"column":4,"offset":2719},"end":{"line":62,"column":95,"offset":2810},"indent":[]}}],"position":{"start":{"line":62,"column":1,"offset":2716},"end":{"line":62,"column":95,"offset":2810},"indent":[]}},{"type":"listItem","spread":false,"checked":null,"children":[{"type":"paragraph","children":[{"type":"text","value":"Create a token for yourself on each website and paste it in your configs.","position":{"start":{"line":63,"column":4,"offset":2814},"end":{"line":63,"column":77,"offset":2887},"indent":[]}}],"position":{"start":{"line":63,"column":4,"offset":2814},"end":{"line":63,"column":77,"offset":2887},"indent":[]}}],"position":{"start":{"line":63,"column":1,"offset":2811},"end":{"line":63,"column":77,"offset":2887},"indent":[]}},{"type":"listItem","spread":false,"checked":null,"children":[{"type":"paragraph","children":[{"type":"text","value":"Enjoy!","position":{"start":{"line":64,"column":4,"offset":2891},"end":{"line":64,"column":10,"offset":2897},"indent":[]}}],"position":{"start":{"line":64,"column":4,"offset":2891},"end":{"line":64,"column":10,"offset":2897},"indent":[]}}],"position":{"start":{"line":64,"column":1,"offset":2888},"end":{"line":64,"column":10,"offset":2897},"indent":[]}}],"position":{"start":{"line":62,"column":1,"offset":2716},"end":{"line":64,"column":10,"offset":2897},"indent":[1,1]}},{"type":"paragraph","children":[{"type":"text","value":"If you wish to customize the code, you will find the bot list tasks in the tasks folder. Don't worry we will discuss this when we get to the tasks section of the guide.","position":{"start":{"line":66,"column":1,"offset":2899},"end":{"line":66,"column":169,"offset":3067},"indent":[]}}],"position":{"start":{"line":66,"column":1,"offset":2899},"end":{"line":66,"column":169,"offset":3067},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"For now just remember, that Discordeno provides you a built in way to update most discord bot lists.","position":{"start":{"line":68,"column":1,"offset":3069},"end":{"line":68,"column":101,"offset":3169},"indent":[]}}],"position":{"start":{"line":68,"column":1,"offset":3069},"end":{"line":68,"column":101,"offset":3169},"indent":[]}},{"type":"heading","depth":4,"children":[{"type":"text","value":"Channel IDs","position":{"start":{"line":70,"column":6,"offset":3176},"end":{"line":70,"column":17,"offset":3187},"indent":[]}}],"position":{"start":{"line":70,"column":1,"offset":3171},"end":{"line":70,"column":17,"offset":3187},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"The channelIDs section holds the useful for specific features to help give you alerts/notifications. For example, the ","position":{"start":{"line":72,"column":1,"offset":3189},"end":{"line":72,"column":119,"offset":3307},"indent":[]}},{"type":"inlineCode","value":"missingTranslation","position":{"start":{"line":72,"column":119,"offset":3307},"end":{"line":72,"column":139,"offset":3327},"indent":[]}},{"type":"text","value":" channel will be where messages are sent alerting you that somewhere in your code you are trying to use a translation key that you never created.","position":{"start":{"line":72,"column":139,"offset":3327},"end":{"line":72,"column":284,"offset":3472},"indent":[]}}],"position":{"start":{"line":72,"column":1,"offset":3189},"end":{"line":72,"column":284,"offset":3472},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"When you get to around 25,000 Discord servers on your bot, you may want to convert these channel IDs to webhooks.","position":{"start":{"line":74,"column":1,"offset":3474},"end":{"line":74,"column":114,"offset":3587},"indent":[]}}],"position":{"start":{"line":74,"column":1,"offset":3474},"end":{"line":74,"column":114,"offset":3587},"indent":[]}},{"type":"heading","depth":2,"children":[{"type":"text","value":"It's Alive!","position":{"start":{"line":76,"column":4,"offset":3592},"end":{"line":76,"column":15,"offset":3603},"indent":[]}}],"position":{"start":{"line":76,"column":1,"offset":3589},"end":{"line":76,"column":15,"offset":3603},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"Oh my god! You now have a bot with a bunch of features already! You don't believe me? Well, seeing is believing, so start the bot.","position":{"start":{"line":78,"column":1,"offset":3605},"end":{"line":78,"column":131,"offset":3735},"indent":[]}}],"position":{"start":{"line":78,"column":1,"offset":3605},"end":{"line":78,"column":131,"offset":3735},"indent":[]}},{"type":"list","ordered":true,"start":1,"spread":false,"children":[{"type":"listItem","spread":false,"checked":null,"children":[{"type":"paragraph","children":[{"type":"text","value":"Invite your bot to a discord server.","position":{"start":{"line":80,"column":4,"offset":3740},"end":{"line":80,"column":40,"offset":3776},"indent":[]}}],"position":{"start":{"line":80,"column":4,"offset":3740},"end":{"line":80,"column":40,"offset":3776},"indent":[]}}],"position":{"start":{"line":80,"column":1,"offset":3737},"end":{"line":80,"column":40,"offset":3776},"indent":[]}},{"type":"listItem","spread":false,"checked":null,"children":[{"type":"paragraph","children":[{"type":"text","value":"Open up the integrated terminal in VSC using ","position":{"start":{"line":81,"column":4,"offset":3780},"end":{"line":81,"column":49,"offset":3825},"indent":[]}},{"type":"strong","children":[{"type":"text","value":"CTRL + `","position":{"start":{"line":81,"column":51,"offset":3827},"end":{"line":81,"column":59,"offset":3835},"indent":[]}}],"position":{"start":{"line":81,"column":49,"offset":3825},"end":{"line":81,"column":61,"offset":3837},"indent":[]}},{"type":"text","value":". If you use a Mac, replace CTRL with CMD.","position":{"start":{"line":81,"column":61,"offset":3837},"end":{"line":81,"column":103,"offset":3879},"indent":[]}}],"position":{"start":{"line":81,"column":4,"offset":3780},"end":{"line":81,"column":103,"offset":3879},"indent":[]}}],"position":{"start":{"line":81,"column":1,"offset":3777},"end":{"line":81,"column":103,"offset":3879},"indent":[]}},{"type":"listItem","spread":false,"checked":null,"children":[{"type":"paragraph","children":[{"type":"text","value":"Run the script below:","position":{"start":{"line":82,"column":4,"offset":3883},"end":{"line":82,"column":25,"offset":3904},"indent":[]}}],"position":{"start":{"line":82,"column":4,"offset":3883},"end":{"line":82,"column":25,"offset":3904},"indent":[]}}],"position":{"start":{"line":82,"column":1,"offset":3880},"end":{"line":82,"column":25,"offset":3904},"indent":[]}}],"position":{"start":{"line":80,"column":1,"offset":3737},"end":{"line":82,"column":25,"offset":3904},"indent":[1,1]}},{"type":"code","lang":"shell","meta":null,"value":"deno run --allow-net --allow-read mod.ts","position":{"start":{"line":84,"column":1,"offset":3906},"end":{"line":86,"column":4,"offset":3959},"indent":[1,1]}},{"type":"paragraph","children":[{"type":"text","value":"The first time you run it, you may see a lot of files being loaded. This is preparing all the magic behind the scene. Once it is ready, you will see something like this:","position":{"start":{"line":88,"column":1,"offset":3961},"end":{"line":88,"column":170,"offset":4130},"indent":[]}}],"position":{"start":{"line":88,"column":1,"offset":3961},"end":{"line":88,"column":170,"offset":4130},"indent":[]}},{"type":"paragraph","children":[{"type":"image","title":null,"url":"https://i.imgur.com/TOXjLgh.png","alt":"image","position":{"start":{"line":90,"column":1,"offset":4132},"end":{"line":90,"column":42,"offset":4173},"indent":[]}}],"position":{"start":{"line":90,"column":1,"offset":4132},"end":{"line":90,"column":42,"offset":4173},"indent":[]}},{"type":"heading","depth":2,"children":[{"type":"text","value":"Understanding What Discordeno Did","position":{"start":{"line":92,"column":4,"offset":4178},"end":{"line":92,"column":37,"offset":4211},"indent":[]}}],"position":{"start":{"line":92,"column":1,"offset":4175},"end":{"line":92,"column":37,"offset":4211},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"Discordeno includes these commands/folders as they are essential for any discord bot to have in order to meet the Discord Bot Best Practices. It also adds a few things that will help make some things easier to build a bot.","position":{"start":{"line":94,"column":1,"offset":4213},"end":{"line":94,"column":223,"offset":4435},"indent":[]}}],"position":{"start":{"line":94,"column":1,"offset":4213},"end":{"line":94,"column":223,"offset":4435},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"We will dive into these deeper in this guide. Let's take it step by step.","position":{"start":{"line":96,"column":1,"offset":4437},"end":{"line":96,"column":74,"offset":4510},"indent":[]}}],"position":{"start":{"line":96,"column":1,"offset":4437},"end":{"line":96,"column":74,"offset":4510},"indent":[]}},{"type":"export","value":"export const _frontmatter = {\"title\":\"Creating The Bot!\",\"metaTitle\":\"Creating A Bot | Discordeno\",\"metaDescription\":\"Let's create our very own bot with Discordeno!\"}","position":{"start":{"line":99,"column":1,"offset":4513},"end":{"line":99,"column":167,"offset":4679},"indent":[]}}],"position":{"start":{"line":1,"column":1,"offset":0},"end":{"line":99,"column":167,"offset":4679}}},"scopeImports":["import * as React from 'react'"],"scopeIdentifiers":["React"],"body":"function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }\n\nfunction _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }\n\nfunction _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }\n\n/* @jsx mdx */\nvar _frontmatter = {\n \"title\": \"Creating The Bot!\",\n \"metaTitle\": \"Creating A Bot | Discordeno\",\n \"metaDescription\": \"Let's create our very own bot with Discordeno!\"\n};\nvar layoutProps = {\n _frontmatter: _frontmatter\n};\nvar MDXLayout = \"wrapper\";\nreturn function MDXContent(_ref) {\n var components = _ref.components,\n props = _objectWithoutProperties(_ref, [\"components\"]);\n\n return mdx(MDXLayout, _extends({}, layoutProps, props, {\n components: components,\n mdxType: \"MDXLayout\"\n }), mdx(\"p\", null, \"Discordeno will help make Discord bot development much easier. Don't worry, as you go through this guide it will make a lot more sense.\"), mdx(\"h2\", null, \"Who Made Discordeno?\"), mdx(\"p\", null, \"Skillz4Killz. However, there are a lot of other contributors to the project as well. Join the discord server to meet and learn more about the wonderful team!\"), mdx(\"h2\", null, \"Why You Should Use Discordeno?\"), mdx(\"p\", null, \"Discordeno provides you all the tools that you need to make bot development really easy. All the tools are already made for you to just simply copy and use for yourself. We will go through each and every tool in other sections of this guide.\"), mdx(\"p\", null, \"As the old saying goes, the best way to learn to ride a bicycle is to actually try riding a bicycle. So let's try out Discordeno.\"), mdx(\"h2\", null, \"Creating The Bot!\"), mdx(\"blockquote\", null, mdx(\"p\", {\n parentName: \"blockquote\"\n }, \"This guide is going to assume you already have the basic requirements to make a bot ready. This includes github, git, a code editor like Visual Studio Code. If you don't have these yet please prepare them first before going forward.\")), mdx(\"ul\", null, mdx(\"li\", {\n parentName: \"ul\"\n }, mdx(\"p\", {\n parentName: \"li\"\n }, \"First, create a Discordeno Bot using the \", mdx(\"a\", _extends({\n parentName: \"p\"\n }, {\n \"href\": \"https://github.com/Skillz4Killz/Discordeno-bot-template\"\n }), \"Generator Boilerplate\"), \". Give it any name you like. For the purpose of this guide we will call it, Stargate.\")), mdx(\"li\", {\n parentName: \"ul\"\n }, mdx(\"p\", {\n parentName: \"li\"\n }, \"Then \", mdx(\"inlineCode\", {\n parentName: \"p\"\n }, \"git clone https://github.com/Skillz4Killz/Stargate.git\"))), mdx(\"li\", {\n parentName: \"ul\"\n }, mdx(\"p\", {\n parentName: \"li\"\n }, \"When that is done, go ahead and open up the folder with VSC.\")), mdx(\"li\", {\n parentName: \"ul\"\n }, mdx(\"p\", {\n parentName: \"li\"\n }, \"Create a new file called \", mdx(\"inlineCode\", {\n parentName: \"p\"\n }, \"configs.ts\"), \". Open the \", mdx(\"inlineCode\", {\n parentName: \"p\"\n }, \"configs.example.ts\"), \" file and copy everything over.\"))), mdx(\"p\", null, \"Let's take a minute to review all the options we have available to us.\"), mdx(\"h3\", null, \"Configs File\"), mdx(\"p\", null, \"The \", mdx(\"inlineCode\", {\n parentName: \"p\"\n }, \"configs.ts\"), \" file is where you will keep all your secret info you don't want to share with anyone else. As long as \", mdx(\"inlineCode\", {\n parentName: \"p\"\n }, \".gitignore\"), \" file is ignoring configs.ts your configurations will be kept private!\"), mdx(\"pre\", null, mdx(\"code\", _extends({\n parentName: \"pre\"\n }, {\n \"className\": \"language-ts\"\n }), \"export const configs = {\\n token: \\\"\\\",\\n prefix: \\\"!\\\",\\n botListTokens: {\\n DISCORD_BOT_ORG: \\\"\\\",\\n BOTS_ON_DISCORD: \\\"\\\",\\n DISCORD_BOT_LIST: \\\"\\\",\\n BOTS_FOR_DISCORD: \\\"\\\",\\n DISCORD_BOATS: \\\"\\\",\\n DISCORD_BOTS_GG: \\\"\\\",\\n DISCORD_BOTS_GROUP: \\\"\\\",\\n },\\n channelIDs: {\\n missingTranslation: \\\"\\\",\\n },\\n};\\n\")), mdx(\"h4\", null, \"Token\"), mdx(\"p\", null, \"First, add your bot token. This is \", mdx(\"strong\", {\n parentName: \"p\"\n }, \"required\"), \" for the bot to start. Review the \", mdx(\"a\", _extends({\n parentName: \"p\"\n }, {\n \"href\": \"https://discordeno.netlify.app/gettingstarted#creatingyourfirstdiscordbotapplication\"\n }), \"instructions\"), \" if you have not made your token yet.\"), mdx(\"h4\", null, \"Prefix\"), mdx(\"p\", null, \"The prefix is where you will set the default prefix for your bot. Don't worry, every server will be able to choose their own prefix but we need a default prefix to start.\"), mdx(\"h4\", null, \"Bot Lists Tokens\"), mdx(\"p\", null, \"This section of the file is so you can easily have your bot's statistics updated on all the bot lists out there to help you grow your bot. The code is already written to handle this but you will need to do 3 things for each bot list.\"), mdx(\"ol\", null, mdx(\"li\", {\n parentName: \"ol\"\n }, \"Go to the bot list and add your bot to their website. (Each site has it's own instructions)\"), mdx(\"li\", {\n parentName: \"ol\"\n }, \"Create a token for yourself on each website and paste it in your configs.\"), mdx(\"li\", {\n parentName: \"ol\"\n }, \"Enjoy!\")), mdx(\"p\", null, \"If you wish to customize the code, you will find the bot list tasks in the tasks folder. Don't worry we will discuss this when we get to the tasks section of the guide.\"), mdx(\"p\", null, \"For now just remember, that Discordeno provides you a built in way to update most discord bot lists.\"), mdx(\"h4\", null, \"Channel IDs\"), mdx(\"p\", null, \"The channelIDs section holds the useful for specific features to help give you alerts/notifications. For example, the \", mdx(\"inlineCode\", {\n parentName: \"p\"\n }, \"missingTranslation\"), \" channel will be where messages are sent alerting you that somewhere in your code you are trying to use a translation key that you never created.\"), mdx(\"p\", null, \"When you get to around 25,000 Discord servers on your bot, you may want to convert these channel IDs to webhooks.\"), mdx(\"h2\", null, \"It's Alive!\"), mdx(\"p\", null, \"Oh my god! You now have a bot with a bunch of features already! You don't believe me? Well, seeing is believing, so start the bot.\"), mdx(\"ol\", null, mdx(\"li\", {\n parentName: \"ol\"\n }, \"Invite your bot to a discord server.\"), mdx(\"li\", {\n parentName: \"ol\"\n }, \"Open up the integrated terminal in VSC using \", mdx(\"strong\", {\n parentName: \"li\"\n }, \"CTRL + `\"), \". If you use a Mac, replace CTRL with CMD.\"), mdx(\"li\", {\n parentName: \"ol\"\n }, \"Run the script below:\")), mdx(\"pre\", null, mdx(\"code\", _extends({\n parentName: \"pre\"\n }, {\n \"className\": \"language-shell\"\n }), \"deno run --allow-net --allow-read mod.ts\\n\")), mdx(\"p\", null, \"The first time you run it, you may see a lot of files being loaded. This is preparing all the magic behind the scene. Once it is ready, you will see something like this:\"), mdx(\"p\", null, mdx(\"img\", _extends({\n parentName: \"p\"\n }, {\n \"src\": \"https://i.imgur.com/TOXjLgh.png\",\n \"alt\": \"image\"\n }))), mdx(\"h2\", null, \"Understanding What Discordeno Did\"), mdx(\"p\", null, \"Discordeno includes these commands/folders as they are essential for any discord bot to have in order to meet the Discord Bot Best Practices. It also adds a few things that will help make some things easier to build a bot.\"), mdx(\"p\", null, \"We will dive into these deeper in this guide. Let's take it step by step.\"));\n}\n;\nMDXContent.isMDXComponent = true;","rawMDXOutput":"/* @jsx mdx */\nimport { mdx } from '@mdx-js/react';\n/* @jsx mdx */\n\nexport const _frontmatter = {\n \"title\": \"Creating The Bot!\",\n \"metaTitle\": \"Creating A Bot | Discordeno\",\n \"metaDescription\": \"Let's create our very own bot with Discordeno!\"\n};\n\nconst layoutProps = {\n _frontmatter\n};\nconst MDXLayout = \"wrapper\"\nexport default function MDXContent({\n components,\n ...props\n}) {\n return \n

{`Discordeno will help make Discord bot development much easier. Don't worry, as you go through this guide it will make a lot more sense.`}

\n

{`Who Made Discordeno?`}

\n

{`Skillz4Killz. However, there are a lot of other contributors to the project as well. Join the discord server to meet and learn more about the wonderful team!`}

\n

{`Why You Should Use Discordeno?`}

\n

{`Discordeno provides you all the tools that you need to make bot development really easy. All the tools are already made for you to just simply copy and use for yourself. We will go through each and every tool in other sections of this guide.`}

\n

{`As the old saying goes, the best way to learn to ride a bicycle is to actually try riding a bicycle. So let's try out Discordeno.`}

\n

{`Creating The Bot!`}

\n
\n

{`This guide is going to assume you already have the basic requirements to make a bot ready. This includes github, git, a code editor like Visual Studio Code. If you don't have these yet please prepare them first before going forward.`}

\n
\n
    \n
  • \n

    {`First, create a Discordeno Bot using the `}{`Generator Boilerplate`}{`. Give it any name you like. For the purpose of this guide we will call it, Stargate.`}

    \n
  • \n
  • \n

    {`Then `}{`git clone https://github.com/Skillz4Killz/Stargate.git`}

    \n
  • \n
  • \n

    {`When that is done, go ahead and open up the folder with VSC.`}

    \n
  • \n
  • \n

    {`Create a new file called `}{`configs.ts`}{`. Open the `}{`configs.example.ts`}{` file and copy everything over.`}

    \n
  • \n
\n

{`Let's take a minute to review all the options we have available to us.`}

\n

{`Configs File`}

\n

{`The `}{`configs.ts`}{` file is where you will keep all your secret info you don't want to share with anyone else. As long as `}{`.gitignore`}{` file is ignoring configs.ts your configurations will be kept private!`}

\n
{`export const configs = {\n  token: \"\",\n  prefix: \"!\",\n  botListTokens: {\n    DISCORD_BOT_ORG: \"\",\n    BOTS_ON_DISCORD: \"\",\n    DISCORD_BOT_LIST: \"\",\n    BOTS_FOR_DISCORD: \"\",\n    DISCORD_BOATS: \"\",\n    DISCORD_BOTS_GG: \"\",\n    DISCORD_BOTS_GROUP: \"\",\n  },\n  channelIDs: {\n    missingTranslation: \"\",\n  },\n};\n`}
\n

{`Token`}

\n

{`First, add your bot token. This is `}{`required`}{` for the bot to start. Review the `}{`instructions`}{` if you have not made your token yet.`}

\n

{`Prefix`}

\n

{`The prefix is where you will set the default prefix for your bot. Don't worry, every server will be able to choose their own prefix but we need a default prefix to start.`}

\n

{`Bot Lists Tokens`}

\n

{`This section of the file is so you can easily have your bot's statistics updated on all the bot lists out there to help you grow your bot. The code is already written to handle this but you will need to do 3 things for each bot list.`}

\n
    \n
  1. {`Go to the bot list and add your bot to their website. (Each site has it's own instructions)`}
  2. \n
  3. {`Create a token for yourself on each website and paste it in your configs.`}
  4. \n
  5. {`Enjoy!`}
  6. \n
\n

{`If you wish to customize the code, you will find the bot list tasks in the tasks folder. Don't worry we will discuss this when we get to the tasks section of the guide.`}

\n

{`For now just remember, that Discordeno provides you a built in way to update most discord bot lists.`}

\n

{`Channel IDs`}

\n

{`The channelIDs section holds the useful for specific features to help give you alerts/notifications. For example, the `}{`missingTranslation`}{` channel will be where messages are sent alerting you that somewhere in your code you are trying to use a translation key that you never created.`}

\n

{`When you get to around 25,000 Discord servers on your bot, you may want to convert these channel IDs to webhooks.`}

\n

{`It's Alive!`}

\n

{`Oh my god! You now have a bot with a bunch of features already! You don't believe me? Well, seeing is believing, so start the bot.`}

\n
    \n
  1. {`Invite your bot to a discord server.`}
  2. \n
  3. {`Open up the integrated terminal in VSC using `}{`CTRL + \\``}{`. If you use a Mac, replace CTRL with CMD.`}
  4. \n
  5. {`Run the script below:`}
  6. \n
\n
{`deno run --allow-net --allow-read mod.ts\n`}
\n

{`The first time you run it, you may see a lot of files being loaded. This is preparing all the magic behind the scene. Once it is ready, you will see something like this:`}

\n

\n

{`Understanding What Discordeno Did`}

\n

{`Discordeno includes these commands/folders as they are essential for any discord bot to have in order to meet the Discord Bot Best Practices. It also adds a few things that will help make some things easier to build a bot.`}

\n

{`We will dive into these deeper in this guide. Let's take it step by step.`}

\n\n
;\n}\n\n;\nMDXContent.isMDXComponent = true;"}} \ No newline at end of file diff --git a/docs/.cache/caches/gatsby-plugin-mdx/diskstore-ab10729ae432bc6806b8f9aec80b80fa.json b/docs/.cache/caches/gatsby-plugin-mdx/diskstore-ab10729ae432bc6806b8f9aec80b80fa.json new file mode 100644 index 000000000..08164e303 --- /dev/null +++ b/docs/.cache/caches/gatsby-plugin-mdx/diskstore-ab10729ae432bc6806b8f9aec80b80fa.json @@ -0,0 +1 @@ +{"expireTime":9007200851635305000,"key":"gatsby-plugin-mdx-entire-payload-37eda9461cc4fbef70166cbc520d1390-","val":{"mdast":{"type":"root","children":[{"type":"paragraph","children":[{"type":"text","value":"Woah! You are almost half way done with understanding all of Discordeno. Amazing isn't it? Something you may have noticed in the last section was when the bot started up you could see a bunch of messages like ","position":{"start":{"line":2,"column":1,"offset":1},"end":{"line":2,"column":210,"offset":210},"indent":[]}},{"type":"inlineCode","value":"Loaded X Commands","position":{"start":{"line":2,"column":210,"offset":210},"end":{"line":2,"column":229,"offset":229},"indent":[]}},{"type":"text","value":" and such. Let's jump into this part now and understand how event handling works in Discordeno.","position":{"start":{"line":2,"column":229,"offset":229},"end":{"line":2,"column":324,"offset":324},"indent":[]}}],"position":{"start":{"line":2,"column":1,"offset":1},"end":{"line":2,"column":324,"offset":324},"indent":[]}},{"type":"heading","depth":2,"children":[{"type":"text","value":"What Is An Event?","position":{"start":{"line":4,"column":4,"offset":329},"end":{"line":4,"column":21,"offset":346},"indent":[]}}],"position":{"start":{"line":4,"column":1,"offset":326},"end":{"line":4,"column":21,"offset":346},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"An event in Discordeno is a function that can be called when a specific event occurs. For the most part, events will usually be the ones that are available from Discordeno. However, you can create your own custom events as well if you wish.","position":{"start":{"line":6,"column":1,"offset":348},"end":{"line":6,"column":241,"offset":588},"indent":[]}}],"position":{"start":{"line":6,"column":1,"offset":348},"end":{"line":6,"column":241,"offset":588},"indent":[]}},{"type":"heading","depth":2,"children":[{"type":"text","value":"Creating The File","position":{"start":{"line":8,"column":4,"offset":593},"end":{"line":8,"column":21,"offset":610},"indent":[]}}],"position":{"start":{"line":8,"column":1,"offset":590},"end":{"line":8,"column":21,"offset":610},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"Make a new file in the events folder called discordLog.js that will send a message to a discord channel whenever we get an error so we don't need to always be watching the console to see errors. Once you made the file, go ahead and paste the base event snippet below.","position":{"start":{"line":10,"column":1,"offset":612},"end":{"line":10,"column":268,"offset":879},"indent":[]}}],"position":{"start":{"line":10,"column":1,"offset":612},"end":{"line":10,"column":268,"offset":879},"indent":[]}},{"type":"export","value":"export const _frontmatter = {\"title\":\"Creating Events!\",\"metaTitle\":\"Creating An Event | Discordeno\",\"metaDescription\":\"Let's create our very own bot with Discordeno!\"}","position":{"start":{"line":13,"column":1,"offset":882},"end":{"line":13,"column":169,"offset":1050},"indent":[]}}],"position":{"start":{"line":1,"column":1,"offset":0},"end":{"line":13,"column":169,"offset":1050}}},"scopeImports":["import * as React from 'react'"],"scopeIdentifiers":["React"],"body":"function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }\n\nfunction _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }\n\nfunction _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }\n\n/* @jsx mdx */\nvar _frontmatter = {\n \"title\": \"Creating Events!\",\n \"metaTitle\": \"Creating An Event | Discordeno\",\n \"metaDescription\": \"Let's create our very own bot with Discordeno!\"\n};\nvar layoutProps = {\n _frontmatter: _frontmatter\n};\nvar MDXLayout = \"wrapper\";\nreturn function MDXContent(_ref) {\n var components = _ref.components,\n props = _objectWithoutProperties(_ref, [\"components\"]);\n\n return mdx(MDXLayout, _extends({}, layoutProps, props, {\n components: components,\n mdxType: \"MDXLayout\"\n }), mdx(\"p\", null, \"Woah! You are almost half way done with understanding all of Discordeno. Amazing isn't it? Something you may have noticed in the last section was when the bot started up you could see a bunch of messages like \", mdx(\"inlineCode\", {\n parentName: \"p\"\n }, \"Loaded X Commands\"), \" and such. Let's jump into this part now and understand how event handling works in Discordeno.\"), mdx(\"h2\", null, \"What Is An Event?\"), mdx(\"p\", null, \"An event in Discordeno is a function that can be called when a specific event occurs. For the most part, events will usually be the ones that are available from Discordeno. However, you can create your own custom events as well if you wish.\"), mdx(\"h2\", null, \"Creating The File\"), mdx(\"p\", null, \"Make a new file in the events folder called discordLog.js that will send a message to a discord channel whenever we get an error so we don't need to always be watching the console to see errors. Once you made the file, go ahead and paste the base event snippet below.\"));\n}\n;\nMDXContent.isMDXComponent = true;","rawMDXOutput":"/* @jsx mdx */\nimport { mdx } from '@mdx-js/react';\n/* @jsx mdx */\n\nexport const _frontmatter = {\n \"title\": \"Creating Events!\",\n \"metaTitle\": \"Creating An Event | Discordeno\",\n \"metaDescription\": \"Let's create our very own bot with Discordeno!\"\n};\n\nconst layoutProps = {\n _frontmatter\n};\nconst MDXLayout = \"wrapper\"\nexport default function MDXContent({\n components,\n ...props\n}) {\n return \n

{`Woah! You are almost half way done with understanding all of Discordeno. Amazing isn't it? Something you may have noticed in the last section was when the bot started up you could see a bunch of messages like `}{`Loaded X Commands`}{` and such. Let's jump into this part now and understand how event handling works in Discordeno.`}

\n

{`What Is An Event?`}

\n

{`An event in Discordeno is a function that can be called when a specific event occurs. For the most part, events will usually be the ones that are available from Discordeno. However, you can create your own custom events as well if you wish.`}

\n

{`Creating The File`}

\n

{`Make a new file in the events folder called discordLog.js that will send a message to a discord channel whenever we get an error so we don't need to always be watching the console to see errors. Once you made the file, go ahead and paste the base event snippet below.`}

\n\n
;\n}\n\n;\nMDXContent.isMDXComponent = true;"}} \ No newline at end of file diff --git a/docs/.cache/caches/gatsby-plugin-mdx/diskstore-ab32531e84c1f96f119bc121757ce267.json b/docs/.cache/caches/gatsby-plugin-mdx/diskstore-ab32531e84c1f96f119bc121757ce267.json new file mode 100644 index 000000000..2aa01c21c --- /dev/null +++ b/docs/.cache/caches/gatsby-plugin-mdx/diskstore-ab32531e84c1f96f119bc121757ce267.json @@ -0,0 +1 @@ +{"expireTime":9007200851634161000,"key":"gatsby-plugin-mdx-entire-payload-da79751078bdf18974676d85e58d9f08-","val":{"mdast":{"type":"root","children":[{"type":"paragraph","children":[{"type":"text","value":"Woah! You are almost half way done with understanding all of Discordeno. Amazing isn't it? Something you may have noticed in the last section was there were some options that prevented some commands from running like ","position":{"start":{"line":2,"column":1,"offset":1},"end":{"line":2,"column":218,"offset":218},"indent":[]}},{"type":"inlineCode","value":"dmOnly","position":{"start":{"line":2,"column":218,"offset":218},"end":{"line":2,"column":226,"offset":226},"indent":[]}},{"type":"text","value":" or the permission options. we created a setting to prevent the monitor from running in certain channels. What if we wanted to do prevent commands from happening? How would we prevent commands from running?","position":{"start":{"line":2,"column":226,"offset":226},"end":{"line":2,"column":432,"offset":432},"indent":[]}}],"position":{"start":{"line":2,"column":1,"offset":1},"end":{"line":2,"column":432,"offset":432},"indent":[]}},{"type":"heading","depth":2,"children":[{"type":"text","value":"What is an Inhibitor?","position":{"start":{"line":4,"column":4,"offset":437},"end":{"line":4,"column":25,"offset":458},"indent":[]}}],"position":{"start":{"line":4,"column":1,"offset":434},"end":{"line":4,"column":25,"offset":458},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"An Inhibitor is very similar to how monitors work. A monitor runs on every message but an inhibitor runs on every command. Remember all those command options like cooldown, permissions, permissionLevel, nsfw, etc... Each and every one of these options has an inhibitor in that checks commands for these settings.","position":{"start":{"line":6,"column":1,"offset":460},"end":{"line":6,"column":313,"offset":772},"indent":[]}}],"position":{"start":{"line":6,"column":1,"offset":460},"end":{"line":6,"column":313,"offset":772},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"Let's create our own inhibitor that would prevent commands from being used if the user is not a VIP user.","position":{"start":{"line":8,"column":1,"offset":774},"end":{"line":8,"column":106,"offset":879},"indent":[]}}],"position":{"start":{"line":8,"column":1,"offset":774},"end":{"line":8,"column":106,"offset":879},"indent":[]}},{"type":"blockquote","children":[{"type":"paragraph","children":[{"type":"strong","children":[{"type":"text","value":"Note:","position":{"start":{"line":10,"column":5,"offset":885},"end":{"line":10,"column":10,"offset":890},"indent":[]}}],"position":{"start":{"line":10,"column":3,"offset":883},"end":{"line":10,"column":12,"offset":892},"indent":[]}},{"type":"text","value":" It is important to remember that everything below can be done with a simple permission level as well. We will create our own custom permission levels but for the purposes of this guide and to be able to learn about Inhibitors, we will be using an inhibitor.","position":{"start":{"line":10,"column":12,"offset":892},"end":{"line":10,"column":270,"offset":1150},"indent":[]}}],"position":{"start":{"line":10,"column":3,"offset":883},"end":{"line":10,"column":270,"offset":1150},"indent":[]}}],"position":{"start":{"line":10,"column":1,"offset":881},"end":{"line":10,"column":270,"offset":1150},"indent":[]}},{"type":"heading","depth":2,"children":[{"type":"text","value":"Creating the File","position":{"start":{"line":12,"column":4,"offset":1155},"end":{"line":12,"column":21,"offset":1172},"indent":[]}}],"position":{"start":{"line":12,"column":1,"offset":1152},"end":{"line":12,"column":21,"offset":1172},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"Let's start by creating a file inside the inhibitors folder called ","position":{"start":{"line":14,"column":1,"offset":1174},"end":{"line":14,"column":68,"offset":1241},"indent":[]}},{"type":"inlineCode","value":"boosted.ts","position":{"start":{"line":14,"column":68,"offset":1241},"end":{"line":14,"column":80,"offset":1253},"indent":[]}},{"type":"text","value":" and paste the following snippet of code:","position":{"start":{"line":14,"column":80,"offset":1253},"end":{"line":14,"column":121,"offset":1294},"indent":[]}}],"position":{"start":{"line":14,"column":1,"offset":1174},"end":{"line":14,"column":121,"offset":1294},"indent":[]}},{"type":"code","lang":"ts","meta":null,"value":"import { botCache } from \"../../mod.ts\";\n\nbotCache.inhibitors.set(\"inhibitorname\", async function (message, command, guild) {\n\t// Your code goes here\n});","position":{"start":{"line":16,"column":1,"offset":1296},"end":{"line":22,"column":4,"offset":1459},"indent":[1,1,1,1,1,1]}},{"type":"paragraph","children":[{"type":"text","value":"Inhibitors can take up to 3 arguments.","position":{"start":{"line":24,"column":1,"offset":1461},"end":{"line":24,"column":39,"offset":1499},"indent":[]}}],"position":{"start":{"line":24,"column":1,"offset":1461},"end":{"line":24,"column":39,"offset":1499},"indent":[]}},{"type":"list","ordered":false,"start":null,"spread":false,"children":[{"type":"listItem","spread":false,"checked":null,"children":[{"type":"paragraph","children":[{"type":"inlineCode","value":"message","position":{"start":{"line":26,"column":3,"offset":1503},"end":{"line":26,"column":12,"offset":1512},"indent":[]}},{"type":"text","value":": The message object that triggered the command.","position":{"start":{"line":26,"column":12,"offset":1512},"end":{"line":26,"column":60,"offset":1560},"indent":[]}}],"position":{"start":{"line":26,"column":3,"offset":1503},"end":{"line":26,"column":60,"offset":1560},"indent":[]}}],"position":{"start":{"line":26,"column":1,"offset":1501},"end":{"line":26,"column":60,"offset":1560},"indent":[]}},{"type":"listItem","spread":false,"checked":null,"children":[{"type":"paragraph","children":[{"type":"inlineCode","value":"command","position":{"start":{"line":27,"column":3,"offset":1563},"end":{"line":27,"column":12,"offset":1572},"indent":[]}},{"type":"text","value":": The command object itself that was triggered.","position":{"start":{"line":27,"column":12,"offset":1572},"end":{"line":27,"column":59,"offset":1619},"indent":[]}}],"position":{"start":{"line":27,"column":3,"offset":1563},"end":{"line":27,"column":59,"offset":1619},"indent":[]}}],"position":{"start":{"line":27,"column":1,"offset":1561},"end":{"line":27,"column":59,"offset":1619},"indent":[]}},{"type":"listItem","spread":false,"checked":null,"children":[{"type":"paragraph","children":[{"type":"inlineCode","value":"guild","position":{"start":{"line":28,"column":3,"offset":1622},"end":{"line":28,"column":10,"offset":1629},"indent":[]}},{"type":"text","value":": The server guild object where this command was ran.","position":{"start":{"line":28,"column":10,"offset":1629},"end":{"line":28,"column":63,"offset":1682},"indent":[]}}],"position":{"start":{"line":28,"column":3,"offset":1622},"end":{"line":28,"column":63,"offset":1682},"indent":[]}}],"position":{"start":{"line":28,"column":1,"offset":1620},"end":{"line":28,"column":63,"offset":1682},"indent":[]}}],"position":{"start":{"line":26,"column":1,"offset":1501},"end":{"line":28,"column":63,"offset":1682},"indent":[1,1]}},{"type":"heading","depth":2,"children":[{"type":"text","value":"Understanding How Inhibitors Function","position":{"start":{"line":30,"column":4,"offset":1687},"end":{"line":30,"column":41,"offset":1724},"indent":[]}}],"position":{"start":{"line":30,"column":1,"offset":1684},"end":{"line":30,"column":41,"offset":1724},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"To block a command you have to return a truthy value.","position":{"start":{"line":32,"column":1,"offset":1726},"end":{"line":32,"column":54,"offset":1779},"indent":[]}}],"position":{"start":{"line":32,"column":1,"offset":1726},"end":{"line":32,"column":54,"offset":1779},"indent":[]}},{"type":"list","ordered":false,"start":null,"spread":false,"children":[{"type":"listItem","spread":false,"checked":null,"children":[{"type":"paragraph","children":[{"type":"strong","children":[{"type":"text","value":"return true;","position":{"start":{"line":33,"column":5,"offset":1784},"end":{"line":33,"column":17,"offset":1796},"indent":[]}}],"position":{"start":{"line":33,"column":3,"offset":1782},"end":{"line":33,"column":19,"offset":1798},"indent":[]}},{"type":"text","value":" If you return true the inhibitor will block the execution of the command.\nTo allow a command return a falsey value.","position":{"start":{"line":33,"column":19,"offset":1798},"end":{"line":34,"column":42,"offset":1914},"indent":[1]}}],"position":{"start":{"line":33,"column":3,"offset":1782},"end":{"line":34,"column":42,"offset":1914},"indent":[1]}}],"position":{"start":{"line":33,"column":1,"offset":1780},"end":{"line":34,"column":42,"offset":1914},"indent":[1]}},{"type":"listItem","spread":false,"checked":null,"children":[{"type":"paragraph","children":[{"type":"strong","children":[{"type":"text","value":"return false;","position":{"start":{"line":35,"column":5,"offset":1919},"end":{"line":35,"column":18,"offset":1932},"indent":[]}}],"position":{"start":{"line":35,"column":3,"offset":1917},"end":{"line":35,"column":20,"offset":1934},"indent":[]}},{"type":"text","value":" If you return false the inhibitor will not block the error.","position":{"start":{"line":35,"column":20,"offset":1934},"end":{"line":35,"column":80,"offset":1994},"indent":[]}}],"position":{"start":{"line":35,"column":3,"offset":1917},"end":{"line":35,"column":80,"offset":1994},"indent":[]}}],"position":{"start":{"line":35,"column":1,"offset":1915},"end":{"line":35,"column":80,"offset":1994},"indent":[]}}],"position":{"start":{"line":33,"column":1,"offset":1780},"end":{"line":35,"column":80,"offset":1994},"indent":[1,1]}},{"type":"code","lang":"ts","meta":null,"value":"// If the command is not VIP only we can allow this command to execute\nif (!command.vipOnly) return false;\n\n// The bot's support server\nconst guild = cache.guilds.get(configs.supportServerID);\n// If the command author is not in the server they won't have the vip role so cancel the command\nconst me\n// Check if the user has the vip role on the support server given by patreon\nconst userIsVIP = await isUserVIP(message.author.id)\n// The user is VIP so we can allow this command to be used\nif (userIsVIP) return false;\n\n// The user is NOT VIP so we throw an error\nthrow `The ${command.name} is only allowed for VIP users.`","position":{"start":{"line":38,"column":1,"offset":1997},"end":{"line":53,"column":4,"offset":2627},"indent":[1,1,1,1,1,1,1,1,1,1,1,1,1,1,1]}},{"type":"export","value":"export const _frontmatter = {\"title\":\"Creating Inhibitors!\",\"metaTitle\":\"Creating An Inhibitor | Discordeno\",\"metaDescription\":\"Let's create our very own bot with Discordeno!\"}","position":{"start":{"line":56,"column":1,"offset":2630},"end":{"line":56,"column":177,"offset":2806},"indent":[]}}],"position":{"start":{"line":1,"column":1,"offset":0},"end":{"line":56,"column":177,"offset":2806}}},"scopeImports":["import * as React from 'react'"],"scopeIdentifiers":["React"],"body":"function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }\n\nfunction _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }\n\nfunction _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }\n\n/* @jsx mdx */\nvar _frontmatter = {\n \"title\": \"Creating Inhibitors!\",\n \"metaTitle\": \"Creating An Inhibitor | Discordeno\",\n \"metaDescription\": \"Let's create our very own bot with Discordeno!\"\n};\nvar layoutProps = {\n _frontmatter: _frontmatter\n};\nvar MDXLayout = \"wrapper\";\nreturn function MDXContent(_ref) {\n var components = _ref.components,\n props = _objectWithoutProperties(_ref, [\"components\"]);\n\n return mdx(MDXLayout, _extends({}, layoutProps, props, {\n components: components,\n mdxType: \"MDXLayout\"\n }), mdx(\"p\", null, \"Woah! You are almost half way done with understanding all of Discordeno. Amazing isn't it? Something you may have noticed in the last section was there were some options that prevented some commands from running like \", mdx(\"inlineCode\", {\n parentName: \"p\"\n }, \"dmOnly\"), \" or the permission options. we created a setting to prevent the monitor from running in certain channels. What if we wanted to do prevent commands from happening? How would we prevent commands from running?\"), mdx(\"h2\", null, \"What is an Inhibitor?\"), mdx(\"p\", null, \"An Inhibitor is very similar to how monitors work. A monitor runs on every message but an inhibitor runs on every command. Remember all those command options like cooldown, permissions, permissionLevel, nsfw, etc... Each and every one of these options has an inhibitor in that checks commands for these settings.\"), mdx(\"p\", null, \"Let's create our own inhibitor that would prevent commands from being used if the user is not a VIP user.\"), mdx(\"blockquote\", null, mdx(\"p\", {\n parentName: \"blockquote\"\n }, mdx(\"strong\", {\n parentName: \"p\"\n }, \"Note:\"), \" It is important to remember that everything below can be done with a simple permission level as well. We will create our own custom permission levels but for the purposes of this guide and to be able to learn about Inhibitors, we will be using an inhibitor.\")), mdx(\"h2\", null, \"Creating the File\"), mdx(\"p\", null, \"Let's start by creating a file inside the inhibitors folder called \", mdx(\"inlineCode\", {\n parentName: \"p\"\n }, \"boosted.ts\"), \" and paste the following snippet of code:\"), mdx(\"pre\", null, mdx(\"code\", _extends({\n parentName: \"pre\"\n }, {\n \"className\": \"language-ts\"\n }), \"import { botCache } from \\\"../../mod.ts\\\";\\n\\nbotCache.inhibitors.set(\\\"inhibitorname\\\", async function (message, command, guild) {\\n // Your code goes here\\n});\\n\")), mdx(\"p\", null, \"Inhibitors can take up to 3 arguments.\"), mdx(\"ul\", null, mdx(\"li\", {\n parentName: \"ul\"\n }, mdx(\"inlineCode\", {\n parentName: \"li\"\n }, \"message\"), \": The message object that triggered the command.\"), mdx(\"li\", {\n parentName: \"ul\"\n }, mdx(\"inlineCode\", {\n parentName: \"li\"\n }, \"command\"), \": The command object itself that was triggered.\"), mdx(\"li\", {\n parentName: \"ul\"\n }, mdx(\"inlineCode\", {\n parentName: \"li\"\n }, \"guild\"), \": The server guild object where this command was ran.\")), mdx(\"h2\", null, \"Understanding How Inhibitors Function\"), mdx(\"p\", null, \"To block a command you have to return a truthy value.\"), mdx(\"ul\", null, mdx(\"li\", {\n parentName: \"ul\"\n }, mdx(\"strong\", {\n parentName: \"li\"\n }, \"return true;\"), \" If you return true the inhibitor will block the execution of the command.\\nTo allow a command return a falsey value.\"), mdx(\"li\", {\n parentName: \"ul\"\n }, mdx(\"strong\", {\n parentName: \"li\"\n }, \"return false;\"), \" If you return false the inhibitor will not block the error.\")), mdx(\"pre\", null, mdx(\"code\", _extends({\n parentName: \"pre\"\n }, {\n \"className\": \"language-ts\"\n }), \"// If the command is not VIP only we can allow this command to execute\\nif (!command.vipOnly) return false;\\n\\n// The bot's support server\\nconst guild = cache.guilds.get(configs.supportServerID);\\n// If the command author is not in the server they won't have the vip role so cancel the command\\nconst me\\n// Check if the user has the vip role on the support server given by patreon\\nconst userIsVIP = await isUserVIP(message.author.id)\\n// The user is VIP so we can allow this command to be used\\nif (userIsVIP) return false;\\n\\n// The user is NOT VIP so we throw an error\\nthrow `The ${command.name} is only allowed for VIP users.`\\n\")));\n}\n;\nMDXContent.isMDXComponent = true;","rawMDXOutput":"/* @jsx mdx */\nimport { mdx } from '@mdx-js/react';\n/* @jsx mdx */\n\nexport const _frontmatter = {\n \"title\": \"Creating Inhibitors!\",\n \"metaTitle\": \"Creating An Inhibitor | Discordeno\",\n \"metaDescription\": \"Let's create our very own bot with Discordeno!\"\n};\n\nconst layoutProps = {\n _frontmatter\n};\nconst MDXLayout = \"wrapper\"\nexport default function MDXContent({\n components,\n ...props\n}) {\n return \n

{`Woah! You are almost half way done with understanding all of Discordeno. Amazing isn't it? Something you may have noticed in the last section was there were some options that prevented some commands from running like `}{`dmOnly`}{` or the permission options. we created a setting to prevent the monitor from running in certain channels. What if we wanted to do prevent commands from happening? How would we prevent commands from running?`}

\n

{`What is an Inhibitor?`}

\n

{`An Inhibitor is very similar to how monitors work. A monitor runs on every message but an inhibitor runs on every command. Remember all those command options like cooldown, permissions, permissionLevel, nsfw, etc... Each and every one of these options has an inhibitor in that checks commands for these settings.`}

\n

{`Let's create our own inhibitor that would prevent commands from being used if the user is not a VIP user.`}

\n
\n

{`Note:`}{` It is important to remember that everything below can be done with a simple permission level as well. We will create our own custom permission levels but for the purposes of this guide and to be able to learn about Inhibitors, we will be using an inhibitor.`}

\n
\n

{`Creating the File`}

\n

{`Let's start by creating a file inside the inhibitors folder called `}{`boosted.ts`}{` and paste the following snippet of code:`}

\n
{`import { botCache } from \"../../mod.ts\";\n\nbotCache.inhibitors.set(\"inhibitorname\", async function (message, command, guild) {\n    // Your code goes here\n});\n`}
\n

{`Inhibitors can take up to 3 arguments.`}

\n
    \n
  • {`message`}{`: The message object that triggered the command.`}
  • \n
  • {`command`}{`: The command object itself that was triggered.`}
  • \n
  • {`guild`}{`: The server guild object where this command was ran.`}
  • \n
\n

{`Understanding How Inhibitors Function`}

\n

{`To block a command you have to return a truthy value.`}

\n
    \n
  • {`return true;`}{` If you return true the inhibitor will block the execution of the command.\nTo allow a command return a falsey value.`}
  • \n
  • {`return false;`}{` If you return false the inhibitor will not block the error.`}
  • \n
\n
{`// If the command is not VIP only we can allow this command to execute\nif (!command.vipOnly) return false;\n\n// The bot's support server\nconst guild = cache.guilds.get(configs.supportServerID);\n// If the command author is not in the server they won't have the vip role so cancel the command\nconst me\n// Check if the user has the vip role on the support server given by patreon\nconst userIsVIP = await isUserVIP(message.author.id)\n// The user is VIP so we can allow this command to be used\nif (userIsVIP) return false;\n\n// The user is NOT VIP so we throw an error\nthrow \\`The \\${command.name} is only allowed for VIP users.\\`\n`}
\n\n
;\n}\n\n;\nMDXContent.isMDXComponent = true;"}} \ No newline at end of file diff --git a/docs/.cache/caches/gatsby-plugin-mdx/diskstore-b25e501e373f5af2184e3848f895b33d.json b/docs/.cache/caches/gatsby-plugin-mdx/diskstore-b25e501e373f5af2184e3848f895b33d.json new file mode 100644 index 000000000..01d41700c --- /dev/null +++ b/docs/.cache/caches/gatsby-plugin-mdx/diskstore-b25e501e373f5af2184e3848f895b33d.json @@ -0,0 +1 @@ +{"expireTime":9007200851632102000,"key":"gatsby-plugin-mdx-entire-payload-5387355a2d23eb8ac51f0845730051db-","val":{"mdast":{"type":"root","children":[{"type":"paragraph","children":[{"type":"text","value":"Woah! You are almost half way done with understanding all of Discordeno. Amazing isn't it? Something you may have noticed in the last section was there were some options that prevented some commands from running like ","position":{"start":{"line":2,"column":1,"offset":1},"end":{"line":2,"column":218,"offset":218},"indent":[]}},{"type":"inlineCode","value":"dmOnly","position":{"start":{"line":2,"column":218,"offset":218},"end":{"line":2,"column":226,"offset":226},"indent":[]}},{"type":"text","value":" or the permission options. we created a setting to prevent the monitor from running in certain channels. What if we wanted to do prevent commands from happening? How would we prevent commands from running?","position":{"start":{"line":2,"column":226,"offset":226},"end":{"line":2,"column":432,"offset":432},"indent":[]}}],"position":{"start":{"line":2,"column":1,"offset":1},"end":{"line":2,"column":432,"offset":432},"indent":[]}},{"type":"heading","depth":2,"children":[{"type":"text","value":"What is an Inhibitor?","position":{"start":{"line":4,"column":4,"offset":437},"end":{"line":4,"column":25,"offset":458},"indent":[]}}],"position":{"start":{"line":4,"column":1,"offset":434},"end":{"line":4,"column":25,"offset":458},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"An Inhibitor is very similar to how monitors work. A monitor runs on every message but an inhibitor runs on every command. Remember all those command options like cooldown, permissions, permissionLevel, nsfw, requiredSettings, runIn. Each and every one of these options has an inhibitor in Klasa core that checks commands for these settings.\nLet's create our own inhibitor that would prevent commands from being used if the user is not a VIP user.","position":{"start":{"line":6,"column":1,"offset":460},"end":{"line":7,"column":106,"offset":907},"indent":[1]}}],"position":{"start":{"line":6,"column":1,"offset":460},"end":{"line":7,"column":106,"offset":907},"indent":[1]}},{"type":"blockquote","children":[{"type":"paragraph","children":[{"type":"strong","children":[{"type":"text","value":"Note:","position":{"start":{"line":9,"column":5,"offset":913},"end":{"line":9,"column":10,"offset":918},"indent":[]}}],"position":{"start":{"line":9,"column":3,"offset":911},"end":{"line":9,"column":12,"offset":920},"indent":[]}},{"type":"text","value":" It is important to remember that everything below can be done with a simple permission level as well. We will create our own custom permission levels but for the purposes of this guide and to be able to learn about Inhibitors, we will be using an inhibitor.","position":{"start":{"line":9,"column":12,"offset":920},"end":{"line":9,"column":270,"offset":1178},"indent":[]}}],"position":{"start":{"line":9,"column":3,"offset":911},"end":{"line":9,"column":270,"offset":1178},"indent":[]}}],"position":{"start":{"line":9,"column":1,"offset":909},"end":{"line":9,"column":270,"offset":1178},"indent":[]}},{"type":"export","value":"export const _frontmatter = {\"title\":\"Creating Inhibitors!\",\"metaTitle\":\"Creating An Inhibitor | Discordeno\",\"metaDescription\":\"Let's create our very own bot with Discordeno!\"}","position":{"start":{"line":12,"column":1,"offset":1181},"end":{"line":12,"column":177,"offset":1357},"indent":[]}}],"position":{"start":{"line":1,"column":1,"offset":0},"end":{"line":12,"column":177,"offset":1357}}},"scopeImports":["import * as React from 'react'"],"scopeIdentifiers":["React"],"body":"function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }\n\nfunction _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }\n\nfunction _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }\n\n/* @jsx mdx */\nvar _frontmatter = {\n \"title\": \"Creating Inhibitors!\",\n \"metaTitle\": \"Creating An Inhibitor | Discordeno\",\n \"metaDescription\": \"Let's create our very own bot with Discordeno!\"\n};\nvar layoutProps = {\n _frontmatter: _frontmatter\n};\nvar MDXLayout = \"wrapper\";\nreturn function MDXContent(_ref) {\n var components = _ref.components,\n props = _objectWithoutProperties(_ref, [\"components\"]);\n\n return mdx(MDXLayout, _extends({}, layoutProps, props, {\n components: components,\n mdxType: \"MDXLayout\"\n }), mdx(\"p\", null, \"Woah! You are almost half way done with understanding all of Discordeno. Amazing isn't it? Something you may have noticed in the last section was there were some options that prevented some commands from running like \", mdx(\"inlineCode\", {\n parentName: \"p\"\n }, \"dmOnly\"), \" or the permission options. we created a setting to prevent the monitor from running in certain channels. What if we wanted to do prevent commands from happening? How would we prevent commands from running?\"), mdx(\"h2\", null, \"What is an Inhibitor?\"), mdx(\"p\", null, \"An Inhibitor is very similar to how monitors work. A monitor runs on every message but an inhibitor runs on every command. Remember all those command options like cooldown, permissions, permissionLevel, nsfw, requiredSettings, runIn. Each and every one of these options has an inhibitor in Klasa core that checks commands for these settings.\\nLet's create our own inhibitor that would prevent commands from being used if the user is not a VIP user.\"), mdx(\"blockquote\", null, mdx(\"p\", {\n parentName: \"blockquote\"\n }, mdx(\"strong\", {\n parentName: \"p\"\n }, \"Note:\"), \" It is important to remember that everything below can be done with a simple permission level as well. We will create our own custom permission levels but for the purposes of this guide and to be able to learn about Inhibitors, we will be using an inhibitor.\")));\n}\n;\nMDXContent.isMDXComponent = true;","rawMDXOutput":"/* @jsx mdx */\nimport { mdx } from '@mdx-js/react';\n/* @jsx mdx */\n\nexport const _frontmatter = {\n \"title\": \"Creating Inhibitors!\",\n \"metaTitle\": \"Creating An Inhibitor | Discordeno\",\n \"metaDescription\": \"Let's create our very own bot with Discordeno!\"\n};\n\nconst layoutProps = {\n _frontmatter\n};\nconst MDXLayout = \"wrapper\"\nexport default function MDXContent({\n components,\n ...props\n}) {\n return \n

{`Woah! You are almost half way done with understanding all of Discordeno. Amazing isn't it? Something you may have noticed in the last section was there were some options that prevented some commands from running like `}{`dmOnly`}{` or the permission options. we created a setting to prevent the monitor from running in certain channels. What if we wanted to do prevent commands from happening? How would we prevent commands from running?`}

\n

{`What is an Inhibitor?`}

\n

{`An Inhibitor is very similar to how monitors work. A monitor runs on every message but an inhibitor runs on every command. Remember all those command options like cooldown, permissions, permissionLevel, nsfw, requiredSettings, runIn. Each and every one of these options has an inhibitor in Klasa core that checks commands for these settings.\nLet's create our own inhibitor that would prevent commands from being used if the user is not a VIP user.`}

\n
\n

{`Note:`}{` It is important to remember that everything below can be done with a simple permission level as well. We will create our own custom permission levels but for the purposes of this guide and to be able to learn about Inhibitors, we will be using an inhibitor.`}

\n
\n\n
;\n}\n\n;\nMDXContent.isMDXComponent = true;"}} \ No newline at end of file diff --git a/docs/.cache/caches/gatsby-plugin-mdx/diskstore-b300efacc5c8bad6009cea0638f8580e.json b/docs/.cache/caches/gatsby-plugin-mdx/diskstore-b300efacc5c8bad6009cea0638f8580e.json new file mode 100644 index 000000000..364d88975 --- /dev/null +++ b/docs/.cache/caches/gatsby-plugin-mdx/diskstore-b300efacc5c8bad6009cea0638f8580e.json @@ -0,0 +1 @@ +{"expireTime":9007200851634616000,"key":"gatsby-plugin-mdx-entire-payload-9b1939aff12dd549191f4fd8049f07e4-","val":{"mdast":{"type":"root","children":[{"type":"paragraph","children":[{"type":"text","value":"Woah! You are almost half way done with understanding all of Discordeno. Amazing isn't it? Something you may have noticed in the last section was there were some options that prevented some commands from running like ","position":{"start":{"line":2,"column":1,"offset":1},"end":{"line":2,"column":218,"offset":218},"indent":[]}},{"type":"inlineCode","value":"dmOnly","position":{"start":{"line":2,"column":218,"offset":218},"end":{"line":2,"column":226,"offset":226},"indent":[]}},{"type":"text","value":" or the permission options. we created a setting to prevent the monitor from running in certain channels. What if we wanted to do prevent commands from happening? How would we prevent commands from running?","position":{"start":{"line":2,"column":226,"offset":226},"end":{"line":2,"column":432,"offset":432},"indent":[]}}],"position":{"start":{"line":2,"column":1,"offset":1},"end":{"line":2,"column":432,"offset":432},"indent":[]}},{"type":"heading","depth":2,"children":[{"type":"text","value":"What is an Inhibitor?","position":{"start":{"line":4,"column":4,"offset":437},"end":{"line":4,"column":25,"offset":458},"indent":[]}}],"position":{"start":{"line":4,"column":1,"offset":434},"end":{"line":4,"column":25,"offset":458},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"An Inhibitor is very similar to how monitors work. A monitor runs on every message but an inhibitor runs on every command. Remember all those command options like cooldown, permissions, permissionLevel, nsfw, etc... Each and every one of these options has an inhibitor in that checks commands for these settings.","position":{"start":{"line":6,"column":1,"offset":460},"end":{"line":6,"column":313,"offset":772},"indent":[]}}],"position":{"start":{"line":6,"column":1,"offset":460},"end":{"line":6,"column":313,"offset":772},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"Let's create our own inhibitor that would prevent commands from being used if the user is not a VIP user.","position":{"start":{"line":8,"column":1,"offset":774},"end":{"line":8,"column":106,"offset":879},"indent":[]}}],"position":{"start":{"line":8,"column":1,"offset":774},"end":{"line":8,"column":106,"offset":879},"indent":[]}},{"type":"blockquote","children":[{"type":"paragraph","children":[{"type":"strong","children":[{"type":"text","value":"Note:","position":{"start":{"line":10,"column":5,"offset":885},"end":{"line":10,"column":10,"offset":890},"indent":[]}}],"position":{"start":{"line":10,"column":3,"offset":883},"end":{"line":10,"column":12,"offset":892},"indent":[]}},{"type":"text","value":" It is important to remember that everything below can be done with a simple permission level as well. We will create our own custom permission levels but for the purposes of this guide and to be able to learn about Inhibitors, we will be using an inhibitor.","position":{"start":{"line":10,"column":12,"offset":892},"end":{"line":10,"column":270,"offset":1150},"indent":[]}}],"position":{"start":{"line":10,"column":3,"offset":883},"end":{"line":10,"column":270,"offset":1150},"indent":[]}}],"position":{"start":{"line":10,"column":1,"offset":881},"end":{"line":10,"column":270,"offset":1150},"indent":[]}},{"type":"heading","depth":2,"children":[{"type":"text","value":"Creating the File","position":{"start":{"line":12,"column":4,"offset":1155},"end":{"line":12,"column":21,"offset":1172},"indent":[]}}],"position":{"start":{"line":12,"column":1,"offset":1152},"end":{"line":12,"column":21,"offset":1172},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"Let's start by creating a file inside the inhibitors folder called ","position":{"start":{"line":14,"column":1,"offset":1174},"end":{"line":14,"column":68,"offset":1241},"indent":[]}},{"type":"inlineCode","value":"boosted.ts","position":{"start":{"line":14,"column":68,"offset":1241},"end":{"line":14,"column":80,"offset":1253},"indent":[]}},{"type":"text","value":" and paste the following snippet of code:","position":{"start":{"line":14,"column":80,"offset":1253},"end":{"line":14,"column":121,"offset":1294},"indent":[]}}],"position":{"start":{"line":14,"column":1,"offset":1174},"end":{"line":14,"column":121,"offset":1294},"indent":[]}},{"type":"code","lang":"ts","meta":null,"value":"import { botCache } from \"../../mod.ts\";\n\nbotCache.inhibitors.set(\"inhibitorname\", async function (message, command, guild) {\n\t// Your code goes here\n});","position":{"start":{"line":16,"column":1,"offset":1296},"end":{"line":22,"column":4,"offset":1459},"indent":[1,1,1,1,1,1]}},{"type":"paragraph","children":[{"type":"text","value":"Inhibitors can take up to 3 arguments.","position":{"start":{"line":24,"column":1,"offset":1461},"end":{"line":24,"column":39,"offset":1499},"indent":[]}}],"position":{"start":{"line":24,"column":1,"offset":1461},"end":{"line":24,"column":39,"offset":1499},"indent":[]}},{"type":"list","ordered":false,"start":null,"spread":false,"children":[{"type":"listItem","spread":false,"checked":null,"children":[{"type":"paragraph","children":[{"type":"inlineCode","value":"message","position":{"start":{"line":26,"column":3,"offset":1503},"end":{"line":26,"column":12,"offset":1512},"indent":[]}},{"type":"text","value":": The message object that triggered the command.","position":{"start":{"line":26,"column":12,"offset":1512},"end":{"line":26,"column":60,"offset":1560},"indent":[]}}],"position":{"start":{"line":26,"column":3,"offset":1503},"end":{"line":26,"column":60,"offset":1560},"indent":[]}}],"position":{"start":{"line":26,"column":1,"offset":1501},"end":{"line":26,"column":60,"offset":1560},"indent":[]}},{"type":"listItem","spread":false,"checked":null,"children":[{"type":"paragraph","children":[{"type":"inlineCode","value":"command","position":{"start":{"line":27,"column":3,"offset":1563},"end":{"line":27,"column":12,"offset":1572},"indent":[]}},{"type":"text","value":": The command object itself that was triggered.","position":{"start":{"line":27,"column":12,"offset":1572},"end":{"line":27,"column":59,"offset":1619},"indent":[]}}],"position":{"start":{"line":27,"column":3,"offset":1563},"end":{"line":27,"column":59,"offset":1619},"indent":[]}}],"position":{"start":{"line":27,"column":1,"offset":1561},"end":{"line":27,"column":59,"offset":1619},"indent":[]}},{"type":"listItem","spread":false,"checked":null,"children":[{"type":"paragraph","children":[{"type":"inlineCode","value":"guild","position":{"start":{"line":28,"column":3,"offset":1622},"end":{"line":28,"column":10,"offset":1629},"indent":[]}},{"type":"text","value":": The server guild object where this command was ran.","position":{"start":{"line":28,"column":10,"offset":1629},"end":{"line":28,"column":63,"offset":1682},"indent":[]}}],"position":{"start":{"line":28,"column":3,"offset":1622},"end":{"line":28,"column":63,"offset":1682},"indent":[]}}],"position":{"start":{"line":28,"column":1,"offset":1620},"end":{"line":28,"column":63,"offset":1682},"indent":[]}}],"position":{"start":{"line":26,"column":1,"offset":1501},"end":{"line":28,"column":63,"offset":1682},"indent":[1,1]}},{"type":"heading","depth":2,"children":[{"type":"text","value":"Understanding How Inhibitors Function","position":{"start":{"line":30,"column":4,"offset":1687},"end":{"line":30,"column":41,"offset":1724},"indent":[]}}],"position":{"start":{"line":30,"column":1,"offset":1684},"end":{"line":30,"column":41,"offset":1724},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"To block a command you have to return a truthy value.","position":{"start":{"line":32,"column":1,"offset":1726},"end":{"line":32,"column":54,"offset":1779},"indent":[]}}],"position":{"start":{"line":32,"column":1,"offset":1726},"end":{"line":32,"column":54,"offset":1779},"indent":[]}},{"type":"list","ordered":false,"start":null,"spread":false,"children":[{"type":"listItem","spread":false,"checked":null,"children":[{"type":"paragraph","children":[{"type":"strong","children":[{"type":"text","value":"return true;","position":{"start":{"line":33,"column":5,"offset":1784},"end":{"line":33,"column":17,"offset":1796},"indent":[]}}],"position":{"start":{"line":33,"column":3,"offset":1782},"end":{"line":33,"column":19,"offset":1798},"indent":[]}},{"type":"text","value":" If you return true the inhibitor will block the execution of the command.\nTo allow a command return a falsey value.","position":{"start":{"line":33,"column":19,"offset":1798},"end":{"line":34,"column":42,"offset":1914},"indent":[1]}}],"position":{"start":{"line":33,"column":3,"offset":1782},"end":{"line":34,"column":42,"offset":1914},"indent":[1]}}],"position":{"start":{"line":33,"column":1,"offset":1780},"end":{"line":34,"column":42,"offset":1914},"indent":[1]}},{"type":"listItem","spread":false,"checked":null,"children":[{"type":"paragraph","children":[{"type":"strong","children":[{"type":"text","value":"return false;","position":{"start":{"line":35,"column":5,"offset":1919},"end":{"line":35,"column":18,"offset":1932},"indent":[]}}],"position":{"start":{"line":35,"column":3,"offset":1917},"end":{"line":35,"column":20,"offset":1934},"indent":[]}},{"type":"text","value":" If you return false the inhibitor will not block the error.","position":{"start":{"line":35,"column":20,"offset":1934},"end":{"line":35,"column":80,"offset":1994},"indent":[]}}],"position":{"start":{"line":35,"column":3,"offset":1917},"end":{"line":35,"column":80,"offset":1994},"indent":[]}}],"position":{"start":{"line":35,"column":1,"offset":1915},"end":{"line":35,"column":80,"offset":1994},"indent":[]}}],"position":{"start":{"line":33,"column":1,"offset":1780},"end":{"line":35,"column":80,"offset":1994},"indent":[1,1]}},{"type":"code","lang":"ts","meta":null,"value":"// If the command is not VIP only we can allow this command to execute\nif (!command.vipOnly) return false;\n\n// The bot's support server\nconst guild = cache.guilds.get(configs.supportServerID);\n// If the command author is not in the server they won't have the vip role\nconst member = guild.members.get(message.author.id) || await getMember(guild.id, message.author.id);\n// Member doesn't exist so cancel the command\nif (!member) {\n\tsendResponse(message, `sorry, but you can not use this command until you become VIP. **Close the IRIS!!!**`)\n\treturn true;\n}\n\n// If the user has the vip role on the support server given by patreon allow the command\nif (member.roles.includes(configs.roleIDs.patreonVIPRoleID)) return false;\n\n// Alert the user they don't have vip and can't use the command\nsendResponse(message, `sorry, but you can not use this command until you become a VIP. I'm sorry, Teal'c. We'll go to Disneyland next year. I promise.`)\n// Cancel the command since the user does not have vip\nreturn true;","position":{"start":{"line":38,"column":1,"offset":1997},"end":{"line":59,"column":4,"offset":3013},"indent":[1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1]}},{"type":"export","value":"export const _frontmatter = {\"title\":\"Creating Inhibitors!\",\"metaTitle\":\"Creating An Inhibitor | Discordeno\",\"metaDescription\":\"Let's create our very own bot with Discordeno!\"}","position":{"start":{"line":62,"column":1,"offset":3016},"end":{"line":62,"column":177,"offset":3192},"indent":[]}}],"position":{"start":{"line":1,"column":1,"offset":0},"end":{"line":62,"column":177,"offset":3192}}},"scopeImports":["import * as React from 'react'"],"scopeIdentifiers":["React"],"body":"function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }\n\nfunction _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }\n\nfunction _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }\n\n/* @jsx mdx */\nvar _frontmatter = {\n \"title\": \"Creating Inhibitors!\",\n \"metaTitle\": \"Creating An Inhibitor | Discordeno\",\n \"metaDescription\": \"Let's create our very own bot with Discordeno!\"\n};\nvar layoutProps = {\n _frontmatter: _frontmatter\n};\nvar MDXLayout = \"wrapper\";\nreturn function MDXContent(_ref) {\n var components = _ref.components,\n props = _objectWithoutProperties(_ref, [\"components\"]);\n\n return mdx(MDXLayout, _extends({}, layoutProps, props, {\n components: components,\n mdxType: \"MDXLayout\"\n }), mdx(\"p\", null, \"Woah! You are almost half way done with understanding all of Discordeno. Amazing isn't it? Something you may have noticed in the last section was there were some options that prevented some commands from running like \", mdx(\"inlineCode\", {\n parentName: \"p\"\n }, \"dmOnly\"), \" or the permission options. we created a setting to prevent the monitor from running in certain channels. What if we wanted to do prevent commands from happening? How would we prevent commands from running?\"), mdx(\"h2\", null, \"What is an Inhibitor?\"), mdx(\"p\", null, \"An Inhibitor is very similar to how monitors work. A monitor runs on every message but an inhibitor runs on every command. Remember all those command options like cooldown, permissions, permissionLevel, nsfw, etc... Each and every one of these options has an inhibitor in that checks commands for these settings.\"), mdx(\"p\", null, \"Let's create our own inhibitor that would prevent commands from being used if the user is not a VIP user.\"), mdx(\"blockquote\", null, mdx(\"p\", {\n parentName: \"blockquote\"\n }, mdx(\"strong\", {\n parentName: \"p\"\n }, \"Note:\"), \" It is important to remember that everything below can be done with a simple permission level as well. We will create our own custom permission levels but for the purposes of this guide and to be able to learn about Inhibitors, we will be using an inhibitor.\")), mdx(\"h2\", null, \"Creating the File\"), mdx(\"p\", null, \"Let's start by creating a file inside the inhibitors folder called \", mdx(\"inlineCode\", {\n parentName: \"p\"\n }, \"boosted.ts\"), \" and paste the following snippet of code:\"), mdx(\"pre\", null, mdx(\"code\", _extends({\n parentName: \"pre\"\n }, {\n \"className\": \"language-ts\"\n }), \"import { botCache } from \\\"../../mod.ts\\\";\\n\\nbotCache.inhibitors.set(\\\"inhibitorname\\\", async function (message, command, guild) {\\n // Your code goes here\\n});\\n\")), mdx(\"p\", null, \"Inhibitors can take up to 3 arguments.\"), mdx(\"ul\", null, mdx(\"li\", {\n parentName: \"ul\"\n }, mdx(\"inlineCode\", {\n parentName: \"li\"\n }, \"message\"), \": The message object that triggered the command.\"), mdx(\"li\", {\n parentName: \"ul\"\n }, mdx(\"inlineCode\", {\n parentName: \"li\"\n }, \"command\"), \": The command object itself that was triggered.\"), mdx(\"li\", {\n parentName: \"ul\"\n }, mdx(\"inlineCode\", {\n parentName: \"li\"\n }, \"guild\"), \": The server guild object where this command was ran.\")), mdx(\"h2\", null, \"Understanding How Inhibitors Function\"), mdx(\"p\", null, \"To block a command you have to return a truthy value.\"), mdx(\"ul\", null, mdx(\"li\", {\n parentName: \"ul\"\n }, mdx(\"strong\", {\n parentName: \"li\"\n }, \"return true;\"), \" If you return true the inhibitor will block the execution of the command.\\nTo allow a command return a falsey value.\"), mdx(\"li\", {\n parentName: \"ul\"\n }, mdx(\"strong\", {\n parentName: \"li\"\n }, \"return false;\"), \" If you return false the inhibitor will not block the error.\")), mdx(\"pre\", null, mdx(\"code\", _extends({\n parentName: \"pre\"\n }, {\n \"className\": \"language-ts\"\n }), \"// If the command is not VIP only we can allow this command to execute\\nif (!command.vipOnly) return false;\\n\\n// The bot's support server\\nconst guild = cache.guilds.get(configs.supportServerID);\\n// If the command author is not in the server they won't have the vip role\\nconst member = guild.members.get(message.author.id) || await getMember(guild.id, message.author.id);\\n// Member doesn't exist so cancel the command\\nif (!member) {\\n sendResponse(message, `sorry, but you can not use this command until you become VIP. **Close the IRIS!!!**`)\\n return true;\\n}\\n\\n// If the user has the vip role on the support server given by patreon allow the command\\nif (member.roles.includes(configs.roleIDs.patreonVIPRoleID)) return false;\\n\\n// Alert the user they don't have vip and can't use the command\\nsendResponse(message, `sorry, but you can not use this command until you become a VIP. I'm sorry, Teal'c. We'll go to Disneyland next year. I promise.`)\\n// Cancel the command since the user does not have vip\\nreturn true;\\n\")));\n}\n;\nMDXContent.isMDXComponent = true;","rawMDXOutput":"/* @jsx mdx */\nimport { mdx } from '@mdx-js/react';\n/* @jsx mdx */\n\nexport const _frontmatter = {\n \"title\": \"Creating Inhibitors!\",\n \"metaTitle\": \"Creating An Inhibitor | Discordeno\",\n \"metaDescription\": \"Let's create our very own bot with Discordeno!\"\n};\n\nconst layoutProps = {\n _frontmatter\n};\nconst MDXLayout = \"wrapper\"\nexport default function MDXContent({\n components,\n ...props\n}) {\n return \n

{`Woah! You are almost half way done with understanding all of Discordeno. Amazing isn't it? Something you may have noticed in the last section was there were some options that prevented some commands from running like `}{`dmOnly`}{` or the permission options. we created a setting to prevent the monitor from running in certain channels. What if we wanted to do prevent commands from happening? How would we prevent commands from running?`}

\n

{`What is an Inhibitor?`}

\n

{`An Inhibitor is very similar to how monitors work. A monitor runs on every message but an inhibitor runs on every command. Remember all those command options like cooldown, permissions, permissionLevel, nsfw, etc... Each and every one of these options has an inhibitor in that checks commands for these settings.`}

\n

{`Let's create our own inhibitor that would prevent commands from being used if the user is not a VIP user.`}

\n
\n

{`Note:`}{` It is important to remember that everything below can be done with a simple permission level as well. We will create our own custom permission levels but for the purposes of this guide and to be able to learn about Inhibitors, we will be using an inhibitor.`}

\n
\n

{`Creating the File`}

\n

{`Let's start by creating a file inside the inhibitors folder called `}{`boosted.ts`}{` and paste the following snippet of code:`}

\n
{`import { botCache } from \"../../mod.ts\";\n\nbotCache.inhibitors.set(\"inhibitorname\", async function (message, command, guild) {\n    // Your code goes here\n});\n`}
\n

{`Inhibitors can take up to 3 arguments.`}

\n
    \n
  • {`message`}{`: The message object that triggered the command.`}
  • \n
  • {`command`}{`: The command object itself that was triggered.`}
  • \n
  • {`guild`}{`: The server guild object where this command was ran.`}
  • \n
\n

{`Understanding How Inhibitors Function`}

\n

{`To block a command you have to return a truthy value.`}

\n
    \n
  • {`return true;`}{` If you return true the inhibitor will block the execution of the command.\nTo allow a command return a falsey value.`}
  • \n
  • {`return false;`}{` If you return false the inhibitor will not block the error.`}
  • \n
\n
{`// If the command is not VIP only we can allow this command to execute\nif (!command.vipOnly) return false;\n\n// The bot's support server\nconst guild = cache.guilds.get(configs.supportServerID);\n// If the command author is not in the server they won't have the vip role\nconst member = guild.members.get(message.author.id) || await getMember(guild.id, message.author.id);\n// Member doesn't exist so cancel the command\nif (!member) {\n    sendResponse(message, \\`sorry, but you can not use this command until you become VIP. **Close the IRIS!!!**\\`)\n    return true;\n}\n\n// If the user has the vip role on the support server given by patreon allow the command\nif (member.roles.includes(configs.roleIDs.patreonVIPRoleID)) return false;\n\n// Alert the user they don't have vip and can't use the command\nsendResponse(message, \\`sorry, but you can not use this command until you become a VIP. I'm sorry, Teal'c. We'll go to Disneyland next year. I promise.\\`)\n// Cancel the command since the user does not have vip\nreturn true;\n`}
\n\n
;\n}\n\n;\nMDXContent.isMDXComponent = true;"}} \ No newline at end of file diff --git a/docs/.cache/caches/gatsby-plugin-mdx/diskstore-b3ffb1fd6badd0f83fb6dffe9217e372.json b/docs/.cache/caches/gatsby-plugin-mdx/diskstore-b3ffb1fd6badd0f83fb6dffe9217e372.json new file mode 100644 index 000000000..6014ff6e0 --- /dev/null +++ b/docs/.cache/caches/gatsby-plugin-mdx/diskstore-b3ffb1fd6badd0f83fb6dffe9217e372.json @@ -0,0 +1 @@ +{"expireTime":9007200851634280000,"key":"gatsby-plugin-mdx-entire-payload-fa6eb0f58c0e9876031758eaadd3a8c8-","val":{"mdast":{"type":"root","children":[{"type":"paragraph","children":[{"type":"text","value":"Woah! You are almost half way done with understanding all of Discordeno. Amazing isn't it? Something you may have noticed in the last section was there were some options that prevented some commands from running like ","position":{"start":{"line":2,"column":1,"offset":1},"end":{"line":2,"column":218,"offset":218},"indent":[]}},{"type":"inlineCode","value":"dmOnly","position":{"start":{"line":2,"column":218,"offset":218},"end":{"line":2,"column":226,"offset":226},"indent":[]}},{"type":"text","value":" or the permission options. we created a setting to prevent the monitor from running in certain channels. What if we wanted to do prevent commands from happening? How would we prevent commands from running?","position":{"start":{"line":2,"column":226,"offset":226},"end":{"line":2,"column":432,"offset":432},"indent":[]}}],"position":{"start":{"line":2,"column":1,"offset":1},"end":{"line":2,"column":432,"offset":432},"indent":[]}},{"type":"heading","depth":2,"children":[{"type":"text","value":"What is an Inhibitor?","position":{"start":{"line":4,"column":4,"offset":437},"end":{"line":4,"column":25,"offset":458},"indent":[]}}],"position":{"start":{"line":4,"column":1,"offset":434},"end":{"line":4,"column":25,"offset":458},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"An Inhibitor is very similar to how monitors work. A monitor runs on every message but an inhibitor runs on every command. Remember all those command options like cooldown, permissions, permissionLevel, nsfw, etc... Each and every one of these options has an inhibitor in that checks commands for these settings.","position":{"start":{"line":6,"column":1,"offset":460},"end":{"line":6,"column":313,"offset":772},"indent":[]}}],"position":{"start":{"line":6,"column":1,"offset":460},"end":{"line":6,"column":313,"offset":772},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"Let's create our own inhibitor that would prevent commands from being used if the user is not a VIP user.","position":{"start":{"line":8,"column":1,"offset":774},"end":{"line":8,"column":106,"offset":879},"indent":[]}}],"position":{"start":{"line":8,"column":1,"offset":774},"end":{"line":8,"column":106,"offset":879},"indent":[]}},{"type":"blockquote","children":[{"type":"paragraph","children":[{"type":"strong","children":[{"type":"text","value":"Note:","position":{"start":{"line":10,"column":5,"offset":885},"end":{"line":10,"column":10,"offset":890},"indent":[]}}],"position":{"start":{"line":10,"column":3,"offset":883},"end":{"line":10,"column":12,"offset":892},"indent":[]}},{"type":"text","value":" It is important to remember that everything below can be done with a simple permission level as well. We will create our own custom permission levels but for the purposes of this guide and to be able to learn about Inhibitors, we will be using an inhibitor.","position":{"start":{"line":10,"column":12,"offset":892},"end":{"line":10,"column":270,"offset":1150},"indent":[]}}],"position":{"start":{"line":10,"column":3,"offset":883},"end":{"line":10,"column":270,"offset":1150},"indent":[]}}],"position":{"start":{"line":10,"column":1,"offset":881},"end":{"line":10,"column":270,"offset":1150},"indent":[]}},{"type":"heading","depth":2,"children":[{"type":"text","value":"Creating the File","position":{"start":{"line":12,"column":4,"offset":1155},"end":{"line":12,"column":21,"offset":1172},"indent":[]}}],"position":{"start":{"line":12,"column":1,"offset":1152},"end":{"line":12,"column":21,"offset":1172},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"Let's start by creating a file inside the inhibitors folder called ","position":{"start":{"line":14,"column":1,"offset":1174},"end":{"line":14,"column":68,"offset":1241},"indent":[]}},{"type":"inlineCode","value":"boosted.ts","position":{"start":{"line":14,"column":68,"offset":1241},"end":{"line":14,"column":80,"offset":1253},"indent":[]}},{"type":"text","value":" and paste the following snippet of code:","position":{"start":{"line":14,"column":80,"offset":1253},"end":{"line":14,"column":121,"offset":1294},"indent":[]}}],"position":{"start":{"line":14,"column":1,"offset":1174},"end":{"line":14,"column":121,"offset":1294},"indent":[]}},{"type":"code","lang":"ts","meta":null,"value":"import { botCache } from \"../../mod.ts\";\n\nbotCache.inhibitors.set(\"inhibitorname\", async function (message, command, guild) {\n\t// Your code goes here\n});","position":{"start":{"line":16,"column":1,"offset":1296},"end":{"line":22,"column":4,"offset":1459},"indent":[1,1,1,1,1,1]}},{"type":"paragraph","children":[{"type":"text","value":"Inhibitors can take up to 3 arguments.","position":{"start":{"line":24,"column":1,"offset":1461},"end":{"line":24,"column":39,"offset":1499},"indent":[]}}],"position":{"start":{"line":24,"column":1,"offset":1461},"end":{"line":24,"column":39,"offset":1499},"indent":[]}},{"type":"list","ordered":false,"start":null,"spread":false,"children":[{"type":"listItem","spread":false,"checked":null,"children":[{"type":"paragraph","children":[{"type":"inlineCode","value":"message","position":{"start":{"line":26,"column":3,"offset":1503},"end":{"line":26,"column":12,"offset":1512},"indent":[]}},{"type":"text","value":": The message object that triggered the command.","position":{"start":{"line":26,"column":12,"offset":1512},"end":{"line":26,"column":60,"offset":1560},"indent":[]}}],"position":{"start":{"line":26,"column":3,"offset":1503},"end":{"line":26,"column":60,"offset":1560},"indent":[]}}],"position":{"start":{"line":26,"column":1,"offset":1501},"end":{"line":26,"column":60,"offset":1560},"indent":[]}},{"type":"listItem","spread":false,"checked":null,"children":[{"type":"paragraph","children":[{"type":"inlineCode","value":"command","position":{"start":{"line":27,"column":3,"offset":1563},"end":{"line":27,"column":12,"offset":1572},"indent":[]}},{"type":"text","value":": The command object itself that was triggered.","position":{"start":{"line":27,"column":12,"offset":1572},"end":{"line":27,"column":59,"offset":1619},"indent":[]}}],"position":{"start":{"line":27,"column":3,"offset":1563},"end":{"line":27,"column":59,"offset":1619},"indent":[]}}],"position":{"start":{"line":27,"column":1,"offset":1561},"end":{"line":27,"column":59,"offset":1619},"indent":[]}},{"type":"listItem","spread":false,"checked":null,"children":[{"type":"paragraph","children":[{"type":"inlineCode","value":"guild","position":{"start":{"line":28,"column":3,"offset":1622},"end":{"line":28,"column":10,"offset":1629},"indent":[]}},{"type":"text","value":": The server guild object where this command was ran.","position":{"start":{"line":28,"column":10,"offset":1629},"end":{"line":28,"column":63,"offset":1682},"indent":[]}}],"position":{"start":{"line":28,"column":3,"offset":1622},"end":{"line":28,"column":63,"offset":1682},"indent":[]}}],"position":{"start":{"line":28,"column":1,"offset":1620},"end":{"line":28,"column":63,"offset":1682},"indent":[]}}],"position":{"start":{"line":26,"column":1,"offset":1501},"end":{"line":28,"column":63,"offset":1682},"indent":[1,1]}},{"type":"heading","depth":2,"children":[{"type":"text","value":"Understanding How Inhibitors Function","position":{"start":{"line":30,"column":4,"offset":1687},"end":{"line":30,"column":41,"offset":1724},"indent":[]}}],"position":{"start":{"line":30,"column":1,"offset":1684},"end":{"line":30,"column":41,"offset":1724},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"To block a command you have to return a truthy value.","position":{"start":{"line":32,"column":1,"offset":1726},"end":{"line":32,"column":54,"offset":1779},"indent":[]}}],"position":{"start":{"line":32,"column":1,"offset":1726},"end":{"line":32,"column":54,"offset":1779},"indent":[]}},{"type":"list","ordered":false,"start":null,"spread":false,"children":[{"type":"listItem","spread":false,"checked":null,"children":[{"type":"paragraph","children":[{"type":"strong","children":[{"type":"text","value":"return true;","position":{"start":{"line":33,"column":5,"offset":1784},"end":{"line":33,"column":17,"offset":1796},"indent":[]}}],"position":{"start":{"line":33,"column":3,"offset":1782},"end":{"line":33,"column":19,"offset":1798},"indent":[]}},{"type":"text","value":" If you return true the inhibitor will block the execution of the command.\nTo allow a command return a falsey value.","position":{"start":{"line":33,"column":19,"offset":1798},"end":{"line":34,"column":42,"offset":1914},"indent":[1]}}],"position":{"start":{"line":33,"column":3,"offset":1782},"end":{"line":34,"column":42,"offset":1914},"indent":[1]}}],"position":{"start":{"line":33,"column":1,"offset":1780},"end":{"line":34,"column":42,"offset":1914},"indent":[1]}},{"type":"listItem","spread":false,"checked":null,"children":[{"type":"paragraph","children":[{"type":"strong","children":[{"type":"text","value":"return false;","position":{"start":{"line":35,"column":5,"offset":1919},"end":{"line":35,"column":18,"offset":1932},"indent":[]}}],"position":{"start":{"line":35,"column":3,"offset":1917},"end":{"line":35,"column":20,"offset":1934},"indent":[]}},{"type":"text","value":" If you return false the inhibitor will not block the error.","position":{"start":{"line":35,"column":20,"offset":1934},"end":{"line":35,"column":80,"offset":1994},"indent":[]}}],"position":{"start":{"line":35,"column":3,"offset":1917},"end":{"line":35,"column":80,"offset":1994},"indent":[]}}],"position":{"start":{"line":35,"column":1,"offset":1915},"end":{"line":35,"column":80,"offset":1994},"indent":[]}}],"position":{"start":{"line":33,"column":1,"offset":1780},"end":{"line":35,"column":80,"offset":1994},"indent":[1,1]}},{"type":"code","lang":"ts","meta":null,"value":"// If the command is not VIP only we can allow this command to execute\nif (!command.vipOnly) return false;\n\n// The bot's support server\nconst guild = cache.guilds.get(configs.supportServerID);\n// If the command author is not in the server they won't have the vip role\nconst member = guild.members.get(message.author.id) || await getMember(guild.id, message.author.id);\n// Member doesn't exist so cancel the command\nif (!member) return true;\n\n// If the user has the vip role on the support server given by patreon allow the command\nif (member.roles.includes(configs.patreonVIPRoleID)) return false;\n\n\n// The user is NOT VIP so we throw an error\nthrow `The ${command.name} is only allowed for VIP users.`","position":{"start":{"line":38,"column":1,"offset":1997},"end":{"line":55,"column":4,"offset":2709},"indent":[1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1]}},{"type":"export","value":"export const _frontmatter = {\"title\":\"Creating Inhibitors!\",\"metaTitle\":\"Creating An Inhibitor | Discordeno\",\"metaDescription\":\"Let's create our very own bot with Discordeno!\"}","position":{"start":{"line":58,"column":1,"offset":2712},"end":{"line":58,"column":177,"offset":2888},"indent":[]}}],"position":{"start":{"line":1,"column":1,"offset":0},"end":{"line":58,"column":177,"offset":2888}}},"scopeImports":["import * as React from 'react'"],"scopeIdentifiers":["React"],"body":"function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }\n\nfunction _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }\n\nfunction _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }\n\n/* @jsx mdx */\nvar _frontmatter = {\n \"title\": \"Creating Inhibitors!\",\n \"metaTitle\": \"Creating An Inhibitor | Discordeno\",\n \"metaDescription\": \"Let's create our very own bot with Discordeno!\"\n};\nvar layoutProps = {\n _frontmatter: _frontmatter\n};\nvar MDXLayout = \"wrapper\";\nreturn function MDXContent(_ref) {\n var components = _ref.components,\n props = _objectWithoutProperties(_ref, [\"components\"]);\n\n return mdx(MDXLayout, _extends({}, layoutProps, props, {\n components: components,\n mdxType: \"MDXLayout\"\n }), mdx(\"p\", null, \"Woah! You are almost half way done with understanding all of Discordeno. Amazing isn't it? Something you may have noticed in the last section was there were some options that prevented some commands from running like \", mdx(\"inlineCode\", {\n parentName: \"p\"\n }, \"dmOnly\"), \" or the permission options. we created a setting to prevent the monitor from running in certain channels. What if we wanted to do prevent commands from happening? How would we prevent commands from running?\"), mdx(\"h2\", null, \"What is an Inhibitor?\"), mdx(\"p\", null, \"An Inhibitor is very similar to how monitors work. A monitor runs on every message but an inhibitor runs on every command. Remember all those command options like cooldown, permissions, permissionLevel, nsfw, etc... Each and every one of these options has an inhibitor in that checks commands for these settings.\"), mdx(\"p\", null, \"Let's create our own inhibitor that would prevent commands from being used if the user is not a VIP user.\"), mdx(\"blockquote\", null, mdx(\"p\", {\n parentName: \"blockquote\"\n }, mdx(\"strong\", {\n parentName: \"p\"\n }, \"Note:\"), \" It is important to remember that everything below can be done with a simple permission level as well. We will create our own custom permission levels but for the purposes of this guide and to be able to learn about Inhibitors, we will be using an inhibitor.\")), mdx(\"h2\", null, \"Creating the File\"), mdx(\"p\", null, \"Let's start by creating a file inside the inhibitors folder called \", mdx(\"inlineCode\", {\n parentName: \"p\"\n }, \"boosted.ts\"), \" and paste the following snippet of code:\"), mdx(\"pre\", null, mdx(\"code\", _extends({\n parentName: \"pre\"\n }, {\n \"className\": \"language-ts\"\n }), \"import { botCache } from \\\"../../mod.ts\\\";\\n\\nbotCache.inhibitors.set(\\\"inhibitorname\\\", async function (message, command, guild) {\\n // Your code goes here\\n});\\n\")), mdx(\"p\", null, \"Inhibitors can take up to 3 arguments.\"), mdx(\"ul\", null, mdx(\"li\", {\n parentName: \"ul\"\n }, mdx(\"inlineCode\", {\n parentName: \"li\"\n }, \"message\"), \": The message object that triggered the command.\"), mdx(\"li\", {\n parentName: \"ul\"\n }, mdx(\"inlineCode\", {\n parentName: \"li\"\n }, \"command\"), \": The command object itself that was triggered.\"), mdx(\"li\", {\n parentName: \"ul\"\n }, mdx(\"inlineCode\", {\n parentName: \"li\"\n }, \"guild\"), \": The server guild object where this command was ran.\")), mdx(\"h2\", null, \"Understanding How Inhibitors Function\"), mdx(\"p\", null, \"To block a command you have to return a truthy value.\"), mdx(\"ul\", null, mdx(\"li\", {\n parentName: \"ul\"\n }, mdx(\"strong\", {\n parentName: \"li\"\n }, \"return true;\"), \" If you return true the inhibitor will block the execution of the command.\\nTo allow a command return a falsey value.\"), mdx(\"li\", {\n parentName: \"ul\"\n }, mdx(\"strong\", {\n parentName: \"li\"\n }, \"return false;\"), \" If you return false the inhibitor will not block the error.\")), mdx(\"pre\", null, mdx(\"code\", _extends({\n parentName: \"pre\"\n }, {\n \"className\": \"language-ts\"\n }), \"// If the command is not VIP only we can allow this command to execute\\nif (!command.vipOnly) return false;\\n\\n// The bot's support server\\nconst guild = cache.guilds.get(configs.supportServerID);\\n// If the command author is not in the server they won't have the vip role\\nconst member = guild.members.get(message.author.id) || await getMember(guild.id, message.author.id);\\n// Member doesn't exist so cancel the command\\nif (!member) return true;\\n\\n// If the user has the vip role on the support server given by patreon allow the command\\nif (member.roles.includes(configs.patreonVIPRoleID)) return false;\\n\\n\\n// The user is NOT VIP so we throw an error\\nthrow `The ${command.name} is only allowed for VIP users.`\\n\")));\n}\n;\nMDXContent.isMDXComponent = true;","rawMDXOutput":"/* @jsx mdx */\nimport { mdx } from '@mdx-js/react';\n/* @jsx mdx */\n\nexport const _frontmatter = {\n \"title\": \"Creating Inhibitors!\",\n \"metaTitle\": \"Creating An Inhibitor | Discordeno\",\n \"metaDescription\": \"Let's create our very own bot with Discordeno!\"\n};\n\nconst layoutProps = {\n _frontmatter\n};\nconst MDXLayout = \"wrapper\"\nexport default function MDXContent({\n components,\n ...props\n}) {\n return \n

{`Woah! You are almost half way done with understanding all of Discordeno. Amazing isn't it? Something you may have noticed in the last section was there were some options that prevented some commands from running like `}{`dmOnly`}{` or the permission options. we created a setting to prevent the monitor from running in certain channels. What if we wanted to do prevent commands from happening? How would we prevent commands from running?`}

\n

{`What is an Inhibitor?`}

\n

{`An Inhibitor is very similar to how monitors work. A monitor runs on every message but an inhibitor runs on every command. Remember all those command options like cooldown, permissions, permissionLevel, nsfw, etc... Each and every one of these options has an inhibitor in that checks commands for these settings.`}

\n

{`Let's create our own inhibitor that would prevent commands from being used if the user is not a VIP user.`}

\n
\n

{`Note:`}{` It is important to remember that everything below can be done with a simple permission level as well. We will create our own custom permission levels but for the purposes of this guide and to be able to learn about Inhibitors, we will be using an inhibitor.`}

\n
\n

{`Creating the File`}

\n

{`Let's start by creating a file inside the inhibitors folder called `}{`boosted.ts`}{` and paste the following snippet of code:`}

\n
{`import { botCache } from \"../../mod.ts\";\n\nbotCache.inhibitors.set(\"inhibitorname\", async function (message, command, guild) {\n    // Your code goes here\n});\n`}
\n

{`Inhibitors can take up to 3 arguments.`}

\n
    \n
  • {`message`}{`: The message object that triggered the command.`}
  • \n
  • {`command`}{`: The command object itself that was triggered.`}
  • \n
  • {`guild`}{`: The server guild object where this command was ran.`}
  • \n
\n

{`Understanding How Inhibitors Function`}

\n

{`To block a command you have to return a truthy value.`}

\n
    \n
  • {`return true;`}{` If you return true the inhibitor will block the execution of the command.\nTo allow a command return a falsey value.`}
  • \n
  • {`return false;`}{` If you return false the inhibitor will not block the error.`}
  • \n
\n
{`// If the command is not VIP only we can allow this command to execute\nif (!command.vipOnly) return false;\n\n// The bot's support server\nconst guild = cache.guilds.get(configs.supportServerID);\n// If the command author is not in the server they won't have the vip role\nconst member = guild.members.get(message.author.id) || await getMember(guild.id, message.author.id);\n// Member doesn't exist so cancel the command\nif (!member) return true;\n\n// If the user has the vip role on the support server given by patreon allow the command\nif (member.roles.includes(configs.patreonVIPRoleID)) return false;\n\n\n// The user is NOT VIP so we throw an error\nthrow \\`The \\${command.name} is only allowed for VIP users.\\`\n`}
\n\n
;\n}\n\n;\nMDXContent.isMDXComponent = true;"}} \ No newline at end of file diff --git a/docs/.cache/caches/gatsby-plugin-mdx/diskstore-b65d68433ee0fc259ad6ce888d901f33.json b/docs/.cache/caches/gatsby-plugin-mdx/diskstore-b65d68433ee0fc259ad6ce888d901f33.json new file mode 100644 index 000000000..5ff255971 --- /dev/null +++ b/docs/.cache/caches/gatsby-plugin-mdx/diskstore-b65d68433ee0fc259ad6ce888d901f33.json @@ -0,0 +1 @@ +{"expireTime":9007200851634905000,"key":"gatsby-plugin-mdx-entire-payload-45ba98d17875271887312030899f0f53-","val":{"mdast":{"type":"root","children":[{"type":"paragraph","children":[{"type":"text","value":"Woah! You are almost half way done with understanding all of Discordeno. Amazing isn't it? Something you may have noticed in the last section was there were some options that prevented some commands from running like ","position":{"start":{"line":2,"column":1,"offset":1},"end":{"line":2,"column":218,"offset":218},"indent":[]}},{"type":"inlineCode","value":"dmOnly","position":{"start":{"line":2,"column":218,"offset":218},"end":{"line":2,"column":226,"offset":226},"indent":[]}},{"type":"text","value":" or the permission options. we created a setting to prevent the monitor from running in certain channels. What if we wanted to do prevent commands from happening? How would we prevent commands from running?","position":{"start":{"line":2,"column":226,"offset":226},"end":{"line":2,"column":432,"offset":432},"indent":[]}}],"position":{"start":{"line":2,"column":1,"offset":1},"end":{"line":2,"column":432,"offset":432},"indent":[]}},{"type":"heading","depth":2,"children":[{"type":"text","value":"What is an Inhibitor?","position":{"start":{"line":4,"column":4,"offset":437},"end":{"line":4,"column":25,"offset":458},"indent":[]}}],"position":{"start":{"line":4,"column":1,"offset":434},"end":{"line":4,"column":25,"offset":458},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"An Inhibitor is very similar to how monitors work. A monitor runs on every message but an inhibitor runs on every command. Remember all those command options like cooldown, permissions, permissionLevel, nsfw, etc... Each and every one of these options has an inhibitor in that checks commands for these settings.","position":{"start":{"line":6,"column":1,"offset":460},"end":{"line":6,"column":313,"offset":772},"indent":[]}}],"position":{"start":{"line":6,"column":1,"offset":460},"end":{"line":6,"column":313,"offset":772},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"Let's create our own inhibitor that would prevent commands from being used if the user is not a VIP user.","position":{"start":{"line":8,"column":1,"offset":774},"end":{"line":8,"column":106,"offset":879},"indent":[]}}],"position":{"start":{"line":8,"column":1,"offset":774},"end":{"line":8,"column":106,"offset":879},"indent":[]}},{"type":"blockquote","children":[{"type":"paragraph","children":[{"type":"strong","children":[{"type":"text","value":"Note:","position":{"start":{"line":10,"column":5,"offset":885},"end":{"line":10,"column":10,"offset":890},"indent":[]}}],"position":{"start":{"line":10,"column":3,"offset":883},"end":{"line":10,"column":12,"offset":892},"indent":[]}},{"type":"text","value":" It is important to remember that everything below can be done with a simple permission level as well. We will create our own custom permission levels but for the purposes of this guide and to be able to learn about Inhibitors, we will be using an inhibitor.","position":{"start":{"line":10,"column":12,"offset":892},"end":{"line":10,"column":270,"offset":1150},"indent":[]}}],"position":{"start":{"line":10,"column":3,"offset":883},"end":{"line":10,"column":270,"offset":1150},"indent":[]}}],"position":{"start":{"line":10,"column":1,"offset":881},"end":{"line":10,"column":270,"offset":1150},"indent":[]}},{"type":"heading","depth":2,"children":[{"type":"text","value":"Creating the File","position":{"start":{"line":12,"column":4,"offset":1155},"end":{"line":12,"column":21,"offset":1172},"indent":[]}}],"position":{"start":{"line":12,"column":1,"offset":1152},"end":{"line":12,"column":21,"offset":1172},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"Let's start by creating a file inside the inhibitors folder called ","position":{"start":{"line":14,"column":1,"offset":1174},"end":{"line":14,"column":68,"offset":1241},"indent":[]}},{"type":"inlineCode","value":"boosted.ts","position":{"start":{"line":14,"column":68,"offset":1241},"end":{"line":14,"column":80,"offset":1253},"indent":[]}},{"type":"text","value":" and paste the following snippet of code:","position":{"start":{"line":14,"column":80,"offset":1253},"end":{"line":14,"column":121,"offset":1294},"indent":[]}}],"position":{"start":{"line":14,"column":1,"offset":1174},"end":{"line":14,"column":121,"offset":1294},"indent":[]}},{"type":"code","lang":"ts","meta":null,"value":"import { botCache } from \"../../mod.ts\";\n\nbotCache.inhibitors.set(\"inhibitorname\", async function (message, command, guild) {\n\t// Your code goes here\n});","position":{"start":{"line":16,"column":1,"offset":1296},"end":{"line":22,"column":4,"offset":1459},"indent":[1,1,1,1,1,1]}},{"type":"paragraph","children":[{"type":"text","value":"Inhibitors can take up to 3 arguments.","position":{"start":{"line":24,"column":1,"offset":1461},"end":{"line":24,"column":39,"offset":1499},"indent":[]}}],"position":{"start":{"line":24,"column":1,"offset":1461},"end":{"line":24,"column":39,"offset":1499},"indent":[]}},{"type":"list","ordered":false,"start":null,"spread":false,"children":[{"type":"listItem","spread":false,"checked":null,"children":[{"type":"paragraph","children":[{"type":"inlineCode","value":"message","position":{"start":{"line":26,"column":3,"offset":1503},"end":{"line":26,"column":12,"offset":1512},"indent":[]}},{"type":"text","value":": The message object that triggered the command.","position":{"start":{"line":26,"column":12,"offset":1512},"end":{"line":26,"column":60,"offset":1560},"indent":[]}}],"position":{"start":{"line":26,"column":3,"offset":1503},"end":{"line":26,"column":60,"offset":1560},"indent":[]}}],"position":{"start":{"line":26,"column":1,"offset":1501},"end":{"line":26,"column":60,"offset":1560},"indent":[]}},{"type":"listItem","spread":false,"checked":null,"children":[{"type":"paragraph","children":[{"type":"inlineCode","value":"command","position":{"start":{"line":27,"column":3,"offset":1563},"end":{"line":27,"column":12,"offset":1572},"indent":[]}},{"type":"text","value":": The command object itself that was triggered.","position":{"start":{"line":27,"column":12,"offset":1572},"end":{"line":27,"column":59,"offset":1619},"indent":[]}}],"position":{"start":{"line":27,"column":3,"offset":1563},"end":{"line":27,"column":59,"offset":1619},"indent":[]}}],"position":{"start":{"line":27,"column":1,"offset":1561},"end":{"line":27,"column":59,"offset":1619},"indent":[]}},{"type":"listItem","spread":false,"checked":null,"children":[{"type":"paragraph","children":[{"type":"inlineCode","value":"guild","position":{"start":{"line":28,"column":3,"offset":1622},"end":{"line":28,"column":10,"offset":1629},"indent":[]}},{"type":"text","value":": The server guild object where this command was ran.","position":{"start":{"line":28,"column":10,"offset":1629},"end":{"line":28,"column":63,"offset":1682},"indent":[]}}],"position":{"start":{"line":28,"column":3,"offset":1622},"end":{"line":28,"column":63,"offset":1682},"indent":[]}}],"position":{"start":{"line":28,"column":1,"offset":1620},"end":{"line":28,"column":63,"offset":1682},"indent":[]}}],"position":{"start":{"line":26,"column":1,"offset":1501},"end":{"line":28,"column":63,"offset":1682},"indent":[1,1]}},{"type":"heading","depth":2,"children":[{"type":"text","value":"Understanding How Inhibitors Function","position":{"start":{"line":30,"column":4,"offset":1687},"end":{"line":30,"column":41,"offset":1724},"indent":[]}}],"position":{"start":{"line":30,"column":1,"offset":1684},"end":{"line":30,"column":41,"offset":1724},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"To block a command you have to return a truthy value.","position":{"start":{"line":32,"column":1,"offset":1726},"end":{"line":32,"column":54,"offset":1779},"indent":[]}}],"position":{"start":{"line":32,"column":1,"offset":1726},"end":{"line":32,"column":54,"offset":1779},"indent":[]}},{"type":"list","ordered":false,"start":null,"spread":false,"children":[{"type":"listItem","spread":false,"checked":null,"children":[{"type":"paragraph","children":[{"type":"strong","children":[{"type":"text","value":"return true;","position":{"start":{"line":33,"column":5,"offset":1784},"end":{"line":33,"column":17,"offset":1796},"indent":[]}}],"position":{"start":{"line":33,"column":3,"offset":1782},"end":{"line":33,"column":19,"offset":1798},"indent":[]}},{"type":"text","value":" If you return true the inhibitor will block the execution of the command.\nTo allow a command return a falsey value.","position":{"start":{"line":33,"column":19,"offset":1798},"end":{"line":34,"column":42,"offset":1914},"indent":[1]}}],"position":{"start":{"line":33,"column":3,"offset":1782},"end":{"line":34,"column":42,"offset":1914},"indent":[1]}}],"position":{"start":{"line":33,"column":1,"offset":1780},"end":{"line":34,"column":42,"offset":1914},"indent":[1]}},{"type":"listItem","spread":false,"checked":null,"children":[{"type":"paragraph","children":[{"type":"strong","children":[{"type":"text","value":"return false;","position":{"start":{"line":35,"column":5,"offset":1919},"end":{"line":35,"column":18,"offset":1932},"indent":[]}}],"position":{"start":{"line":35,"column":3,"offset":1917},"end":{"line":35,"column":20,"offset":1934},"indent":[]}},{"type":"text","value":" If you return false the inhibitor will not block the error.","position":{"start":{"line":35,"column":20,"offset":1934},"end":{"line":35,"column":80,"offset":1994},"indent":[]}}],"position":{"start":{"line":35,"column":3,"offset":1917},"end":{"line":35,"column":80,"offset":1994},"indent":[]}}],"position":{"start":{"line":35,"column":1,"offset":1915},"end":{"line":35,"column":80,"offset":1994},"indent":[]}}],"position":{"start":{"line":33,"column":1,"offset":1780},"end":{"line":35,"column":80,"offset":1994},"indent":[1,1]}},{"type":"code","lang":"ts","meta":null,"value":"// If the command is not VIP only we can allow this command to execute\nif (!command.vipOnly) return false;\n\n// The bot's support server\nconst guild = cache.guilds.get(configs.supportServerID);\n// If the command author is not in the server they won't have the vip role\nconst member = guild.members.get(message.author.id) || await getMember(guild.id, message.author.id);\n// Member doesn't exist so cancel the command\nif (!member) {\n\tsendResponse(message, `sorry, but you can not use this command until you become VIP. **Close the IRIS!!!**`)\n\treturn true;\n}\n\n// If the user has the vip role on the support server given by patreon allow the command\nif (member.roles.includes(configs.roleIDs.patreonVIPRoleID)) return false;\n\n// Alert the user they don't have vip and can't use the command\nsendResponse(message, `sorry, but you can not use this command until you become a VIP. I'm sorry, Teal'c. We'll go to Disneyland next year. I promise.`)\n// Cancel the command since the user does not have vip\nreturn true;","position":{"start":{"line":38,"column":1,"offset":1997},"end":{"line":59,"column":4,"offset":3013},"indent":[1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1]}},{"type":"heading","depth":2,"children":[{"type":"text","value":"Updating Command Typings","position":{"start":{"line":61,"column":4,"offset":3018},"end":{"line":61,"column":28,"offset":3042},"indent":[]}}],"position":{"start":{"line":61,"column":1,"offset":3015},"end":{"line":61,"column":28,"offset":3042},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"Since we need a new option on our commands we need to add that. Open the ","position":{"start":{"line":63,"column":1,"offset":3044},"end":{"line":63,"column":74,"offset":3117},"indent":[]}},{"type":"inlineCode","value":"src/types/commands.ts","position":{"start":{"line":63,"column":74,"offset":3117},"end":{"line":63,"column":97,"offset":3140},"indent":[]}}],"position":{"start":{"line":63,"column":1,"offset":3044},"end":{"line":63,"column":97,"offset":3140},"indent":[]}},{"type":"heading","depth":2,"children":[{"type":"text","value":"Challenges","position":{"start":{"line":65,"column":4,"offset":3145},"end":{"line":65,"column":14,"offset":3155},"indent":[]}}],"position":{"start":{"line":65,"column":1,"offset":3142},"end":{"line":65,"column":14,"offset":3155},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"Hell yes! We just got through the entire inhibitor section. You have now mastered everything related to inhibitors.","position":{"start":{"line":67,"column":1,"offset":3157},"end":{"line":67,"column":116,"offset":3272},"indent":[]}}],"position":{"start":{"line":67,"column":1,"offset":3157},"end":{"line":67,"column":116,"offset":3272},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"You can now try and get a little more practice with inhibitors by trying to challenge yourself and make your own inhibitors. Don't worry if you can't think of any good use cases for inhibitors.","position":{"start":{"line":69,"column":1,"offset":3274},"end":{"line":69,"column":194,"offset":3467},"indent":[]}}],"position":{"start":{"line":69,"column":1,"offset":3274},"end":{"line":69,"column":194,"offset":3467},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"Majority of Discordeno bots do not use many custom inhibitors because most of the necessary/important ones already come built for you in the inhibitors folder.","position":{"start":{"line":71,"column":1,"offset":3469},"end":{"line":71,"column":160,"offset":3628},"indent":[]}}],"position":{"start":{"line":71,"column":1,"offset":3469},"end":{"line":71,"column":160,"offset":3628},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"Next we will try our hands at creating a monitor.","position":{"start":{"line":73,"column":1,"offset":3630},"end":{"line":73,"column":50,"offset":3679},"indent":[]}}],"position":{"start":{"line":73,"column":1,"offset":3630},"end":{"line":73,"column":50,"offset":3679},"indent":[]}},{"type":"export","value":"export const _frontmatter = {\"title\":\"Creating Inhibitors!\",\"metaTitle\":\"Creating An Inhibitor | Discordeno\",\"metaDescription\":\"Let's create our very own bot with Discordeno!\"}","position":{"start":{"line":76,"column":1,"offset":3682},"end":{"line":76,"column":177,"offset":3858},"indent":[]}}],"position":{"start":{"line":1,"column":1,"offset":0},"end":{"line":76,"column":177,"offset":3858}}},"scopeImports":["import * as React from 'react'"],"scopeIdentifiers":["React"],"body":"function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }\n\nfunction _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }\n\nfunction _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }\n\n/* @jsx mdx */\nvar _frontmatter = {\n \"title\": \"Creating Inhibitors!\",\n \"metaTitle\": \"Creating An Inhibitor | Discordeno\",\n \"metaDescription\": \"Let's create our very own bot with Discordeno!\"\n};\nvar layoutProps = {\n _frontmatter: _frontmatter\n};\nvar MDXLayout = \"wrapper\";\nreturn function MDXContent(_ref) {\n var components = _ref.components,\n props = _objectWithoutProperties(_ref, [\"components\"]);\n\n return mdx(MDXLayout, _extends({}, layoutProps, props, {\n components: components,\n mdxType: \"MDXLayout\"\n }), mdx(\"p\", null, \"Woah! You are almost half way done with understanding all of Discordeno. Amazing isn't it? Something you may have noticed in the last section was there were some options that prevented some commands from running like \", mdx(\"inlineCode\", {\n parentName: \"p\"\n }, \"dmOnly\"), \" or the permission options. we created a setting to prevent the monitor from running in certain channels. What if we wanted to do prevent commands from happening? How would we prevent commands from running?\"), mdx(\"h2\", null, \"What is an Inhibitor?\"), mdx(\"p\", null, \"An Inhibitor is very similar to how monitors work. A monitor runs on every message but an inhibitor runs on every command. Remember all those command options like cooldown, permissions, permissionLevel, nsfw, etc... Each and every one of these options has an inhibitor in that checks commands for these settings.\"), mdx(\"p\", null, \"Let's create our own inhibitor that would prevent commands from being used if the user is not a VIP user.\"), mdx(\"blockquote\", null, mdx(\"p\", {\n parentName: \"blockquote\"\n }, mdx(\"strong\", {\n parentName: \"p\"\n }, \"Note:\"), \" It is important to remember that everything below can be done with a simple permission level as well. We will create our own custom permission levels but for the purposes of this guide and to be able to learn about Inhibitors, we will be using an inhibitor.\")), mdx(\"h2\", null, \"Creating the File\"), mdx(\"p\", null, \"Let's start by creating a file inside the inhibitors folder called \", mdx(\"inlineCode\", {\n parentName: \"p\"\n }, \"boosted.ts\"), \" and paste the following snippet of code:\"), mdx(\"pre\", null, mdx(\"code\", _extends({\n parentName: \"pre\"\n }, {\n \"className\": \"language-ts\"\n }), \"import { botCache } from \\\"../../mod.ts\\\";\\n\\nbotCache.inhibitors.set(\\\"inhibitorname\\\", async function (message, command, guild) {\\n // Your code goes here\\n});\\n\")), mdx(\"p\", null, \"Inhibitors can take up to 3 arguments.\"), mdx(\"ul\", null, mdx(\"li\", {\n parentName: \"ul\"\n }, mdx(\"inlineCode\", {\n parentName: \"li\"\n }, \"message\"), \": The message object that triggered the command.\"), mdx(\"li\", {\n parentName: \"ul\"\n }, mdx(\"inlineCode\", {\n parentName: \"li\"\n }, \"command\"), \": The command object itself that was triggered.\"), mdx(\"li\", {\n parentName: \"ul\"\n }, mdx(\"inlineCode\", {\n parentName: \"li\"\n }, \"guild\"), \": The server guild object where this command was ran.\")), mdx(\"h2\", null, \"Understanding How Inhibitors Function\"), mdx(\"p\", null, \"To block a command you have to return a truthy value.\"), mdx(\"ul\", null, mdx(\"li\", {\n parentName: \"ul\"\n }, mdx(\"strong\", {\n parentName: \"li\"\n }, \"return true;\"), \" If you return true the inhibitor will block the execution of the command.\\nTo allow a command return a falsey value.\"), mdx(\"li\", {\n parentName: \"ul\"\n }, mdx(\"strong\", {\n parentName: \"li\"\n }, \"return false;\"), \" If you return false the inhibitor will not block the error.\")), mdx(\"pre\", null, mdx(\"code\", _extends({\n parentName: \"pre\"\n }, {\n \"className\": \"language-ts\"\n }), \"// If the command is not VIP only we can allow this command to execute\\nif (!command.vipOnly) return false;\\n\\n// The bot's support server\\nconst guild = cache.guilds.get(configs.supportServerID);\\n// If the command author is not in the server they won't have the vip role\\nconst member = guild.members.get(message.author.id) || await getMember(guild.id, message.author.id);\\n// Member doesn't exist so cancel the command\\nif (!member) {\\n sendResponse(message, `sorry, but you can not use this command until you become VIP. **Close the IRIS!!!**`)\\n return true;\\n}\\n\\n// If the user has the vip role on the support server given by patreon allow the command\\nif (member.roles.includes(configs.roleIDs.patreonVIPRoleID)) return false;\\n\\n// Alert the user they don't have vip and can't use the command\\nsendResponse(message, `sorry, but you can not use this command until you become a VIP. I'm sorry, Teal'c. We'll go to Disneyland next year. I promise.`)\\n// Cancel the command since the user does not have vip\\nreturn true;\\n\")), mdx(\"h2\", null, \"Updating Command Typings\"), mdx(\"p\", null, \"Since we need a new option on our commands we need to add that. Open the \", mdx(\"inlineCode\", {\n parentName: \"p\"\n }, \"src/types/commands.ts\")), mdx(\"h2\", null, \"Challenges\"), mdx(\"p\", null, \"Hell yes! We just got through the entire inhibitor section. You have now mastered everything related to inhibitors.\"), mdx(\"p\", null, \"You can now try and get a little more practice with inhibitors by trying to challenge yourself and make your own inhibitors. Don't worry if you can't think of any good use cases for inhibitors.\"), mdx(\"p\", null, \"Majority of Discordeno bots do not use many custom inhibitors because most of the necessary/important ones already come built for you in the inhibitors folder.\"), mdx(\"p\", null, \"Next we will try our hands at creating a monitor.\"));\n}\n;\nMDXContent.isMDXComponent = true;","rawMDXOutput":"/* @jsx mdx */\nimport { mdx } from '@mdx-js/react';\n/* @jsx mdx */\n\nexport const _frontmatter = {\n \"title\": \"Creating Inhibitors!\",\n \"metaTitle\": \"Creating An Inhibitor | Discordeno\",\n \"metaDescription\": \"Let's create our very own bot with Discordeno!\"\n};\n\nconst layoutProps = {\n _frontmatter\n};\nconst MDXLayout = \"wrapper\"\nexport default function MDXContent({\n components,\n ...props\n}) {\n return \n

{`Woah! You are almost half way done with understanding all of Discordeno. Amazing isn't it? Something you may have noticed in the last section was there were some options that prevented some commands from running like `}{`dmOnly`}{` or the permission options. we created a setting to prevent the monitor from running in certain channels. What if we wanted to do prevent commands from happening? How would we prevent commands from running?`}

\n

{`What is an Inhibitor?`}

\n

{`An Inhibitor is very similar to how monitors work. A monitor runs on every message but an inhibitor runs on every command. Remember all those command options like cooldown, permissions, permissionLevel, nsfw, etc... Each and every one of these options has an inhibitor in that checks commands for these settings.`}

\n

{`Let's create our own inhibitor that would prevent commands from being used if the user is not a VIP user.`}

\n
\n

{`Note:`}{` It is important to remember that everything below can be done with a simple permission level as well. We will create our own custom permission levels but for the purposes of this guide and to be able to learn about Inhibitors, we will be using an inhibitor.`}

\n
\n

{`Creating the File`}

\n

{`Let's start by creating a file inside the inhibitors folder called `}{`boosted.ts`}{` and paste the following snippet of code:`}

\n
{`import { botCache } from \"../../mod.ts\";\n\nbotCache.inhibitors.set(\"inhibitorname\", async function (message, command, guild) {\n    // Your code goes here\n});\n`}
\n

{`Inhibitors can take up to 3 arguments.`}

\n
    \n
  • {`message`}{`: The message object that triggered the command.`}
  • \n
  • {`command`}{`: The command object itself that was triggered.`}
  • \n
  • {`guild`}{`: The server guild object where this command was ran.`}
  • \n
\n

{`Understanding How Inhibitors Function`}

\n

{`To block a command you have to return a truthy value.`}

\n
    \n
  • {`return true;`}{` If you return true the inhibitor will block the execution of the command.\nTo allow a command return a falsey value.`}
  • \n
  • {`return false;`}{` If you return false the inhibitor will not block the error.`}
  • \n
\n
{`// If the command is not VIP only we can allow this command to execute\nif (!command.vipOnly) return false;\n\n// The bot's support server\nconst guild = cache.guilds.get(configs.supportServerID);\n// If the command author is not in the server they won't have the vip role\nconst member = guild.members.get(message.author.id) || await getMember(guild.id, message.author.id);\n// Member doesn't exist so cancel the command\nif (!member) {\n    sendResponse(message, \\`sorry, but you can not use this command until you become VIP. **Close the IRIS!!!**\\`)\n    return true;\n}\n\n// If the user has the vip role on the support server given by patreon allow the command\nif (member.roles.includes(configs.roleIDs.patreonVIPRoleID)) return false;\n\n// Alert the user they don't have vip and can't use the command\nsendResponse(message, \\`sorry, but you can not use this command until you become a VIP. I'm sorry, Teal'c. We'll go to Disneyland next year. I promise.\\`)\n// Cancel the command since the user does not have vip\nreturn true;\n`}
\n

{`Updating Command Typings`}

\n

{`Since we need a new option on our commands we need to add that. Open the `}{`src/types/commands.ts`}

\n

{`Challenges`}

\n

{`Hell yes! We just got through the entire inhibitor section. You have now mastered everything related to inhibitors.`}

\n

{`You can now try and get a little more practice with inhibitors by trying to challenge yourself and make your own inhibitors. Don't worry if you can't think of any good use cases for inhibitors.`}

\n

{`Majority of Discordeno bots do not use many custom inhibitors because most of the necessary/important ones already come built for you in the inhibitors folder.`}

\n

{`Next we will try our hands at creating a monitor.`}

\n\n
;\n}\n\n;\nMDXContent.isMDXComponent = true;"}} \ No newline at end of file diff --git a/docs/.cache/caches/gatsby-plugin-mdx/diskstore-b7e41a04d04ac13b5a9c6c8861b8d11a.json b/docs/.cache/caches/gatsby-plugin-mdx/diskstore-b7e41a04d04ac13b5a9c6c8861b8d11a.json new file mode 100644 index 000000000..e8239381f --- /dev/null +++ b/docs/.cache/caches/gatsby-plugin-mdx/diskstore-b7e41a04d04ac13b5a9c6c8861b8d11a.json @@ -0,0 +1 @@ +{"expireTime":9007200851596121000,"key":"gatsby-plugin-mdx-entire-payload-c0f5c3500a17b375f7e6c545774dbf28-","val":{"mdast":{"type":"root","children":[{"type":"paragraph","children":[{"type":"text","value":"A Third Party Deno library for interacting with the Discord API.","position":{"start":{"line":2,"column":1,"offset":1},"end":{"line":2,"column":65,"offset":65},"indent":[]}}],"position":{"start":{"line":2,"column":1,"offset":1},"end":{"line":2,"column":65,"offset":65},"indent":[]}},{"type":"heading","depth":2,"children":[{"type":"text","value":"Best TypeScript Support!","position":{"start":{"line":4,"column":4,"offset":70},"end":{"line":4,"column":28,"offset":94},"indent":[]}}],"position":{"start":{"line":4,"column":1,"offset":67},"end":{"line":4,"column":28,"offset":94},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"First class support for Typescript! Never compile your code again in order to run it. Automated typings so they are never inaccurate or out of date.","position":{"start":{"line":5,"column":1,"offset":95},"end":{"line":5,"column":149,"offset":243},"indent":[]}}],"position":{"start":{"line":5,"column":1,"offset":95},"end":{"line":5,"column":149,"offset":243},"indent":[]}},{"type":"heading","depth":2,"children":[{"type":"text","value":"Stable Library","position":{"start":{"line":7,"column":4,"offset":248},"end":{"line":7,"column":18,"offset":262},"indent":[]}}],"position":{"start":{"line":7,"column":1,"offset":245},"end":{"line":7,"column":18,"offset":262},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"Discordeno is one of the most stable libraries ever. One of the biggest issues with almost every library(I have used) is stability. None of the libraries gave much love and attention to Typescript developers the way it deserves which caused TypeScript bots to break.","position":{"start":{"line":8,"column":1,"offset":263},"end":{"line":8,"column":267,"offset":529},"indent":[]}}],"position":{"start":{"line":8,"column":1,"offset":263},"end":{"line":8,"column":267,"offset":529},"indent":[]}},{"type":"heading","depth":2,"children":[{"type":"text","value":"Easy To Use Boilerplates","position":{"start":{"line":10,"column":4,"offset":534},"end":{"line":10,"column":28,"offset":558},"indent":[]}}],"position":{"start":{"line":10,"column":1,"offset":531},"end":{"line":10,"column":28,"offset":558},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"Several bot boilerplates are available to get up and running very quickly. The Official boilerplate provides the most necessary features for almost any bot to make coding bots extremely easy. You focus on building features and not on building the base for a bot.","position":{"start":{"line":11,"column":1,"offset":559},"end":{"line":11,"column":263,"offset":821},"indent":[]}}],"position":{"start":{"line":11,"column":1,"offset":559},"end":{"line":11,"column":263,"offset":821},"indent":[]}},{"type":"heading","depth":1,"children":[{"type":"text","value":"Security","position":{"start":{"line":13,"column":3,"offset":825},"end":{"line":13,"column":11,"offset":833},"indent":[]}}],"position":{"start":{"line":13,"column":1,"offset":823},"end":{"line":13,"column":11,"offset":833},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"Checks all missing permissions necessary before sending a request to the API so that your bot's token do not get globally banned by Discord. Discordeno does not support self-bot functionality like other libraries either.","position":{"start":{"line":14,"column":1,"offset":834},"end":{"line":14,"column":221,"offset":1054},"indent":[]}}],"position":{"start":{"line":14,"column":1,"offset":834},"end":{"line":14,"column":221,"offset":1054},"indent":[]}},{"type":"heading","depth":1,"children":[{"type":"text","value":"Documentation","position":{"start":{"line":16,"column":3,"offset":1058},"end":{"line":16,"column":16,"offset":1071},"indent":[]}}],"position":{"start":{"line":16,"column":1,"offset":1056},"end":{"line":16,"column":16,"offset":1071},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"All of Discord API Documentation available inside your VSC while you code. The entire libraries documentation is automatically available to you through intellisense.","position":{"start":{"line":17,"column":1,"offset":1072},"end":{"line":17,"column":166,"offset":1237},"indent":[]}}],"position":{"start":{"line":17,"column":1,"offset":1072},"end":{"line":17,"column":166,"offset":1237},"indent":[]}},{"type":"heading","depth":1,"children":[{"type":"text","value":"Minimalistic","position":{"start":{"line":19,"column":3,"offset":1241},"end":{"line":19,"column":15,"offset":1253},"indent":[]}}],"position":{"start":{"line":19,"column":1,"offset":1239},"end":{"line":19,"column":15,"offset":1253},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"Discordeno will always prefer defaults that Discord recommends or in the cases where Discord does not care we choose the best option for the majority of developers.","position":{"start":{"line":20,"column":1,"offset":1254},"end":{"line":20,"column":165,"offset":1418},"indent":[]}}],"position":{"start":{"line":20,"column":1,"offset":1254},"end":{"line":20,"column":165,"offset":1418},"indent":[]}},{"type":"heading","depth":1,"children":[{"type":"text","value":"Functional API","position":{"start":{"line":22,"column":3,"offset":1422},"end":{"line":22,"column":17,"offset":1436},"indent":[]}}],"position":{"start":{"line":22,"column":1,"offset":1420},"end":{"line":22,"column":17,"offset":1436},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"This will overall make a cleaner and more performant API, while removing the headaches of extending built-in classes, and inheritance. Avoid potential of memory leaks or bot crashes because of too many listeners or other silly issues.","position":{"start":{"line":23,"column":1,"offset":1437},"end":{"line":23,"column":235,"offset":1671},"indent":[]}}],"position":{"start":{"line":23,"column":1,"offset":1437},"end":{"line":23,"column":235,"offset":1671},"indent":[]}},{"type":"heading","depth":1,"children":[{"type":"text","value":"Latest & Greatest JavaScript","position":{"start":{"line":25,"column":3,"offset":1675},"end":{"line":25,"column":31,"offset":1703},"indent":[]}}],"position":{"start":{"line":25,"column":1,"offset":1673},"end":{"line":25,"column":31,"offset":1703},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"Discordeno uses the latest and greatest JavaScript/TypeScript available. A lot of libraries still use JavaScript standards from 4-6 years ago because of backwards compatibility. Backwards compatibility is the death of code. It causes clutter and uglyness to pile up and makes developers lazier.","position":{"start":{"line":26,"column":1,"offset":1704},"end":{"line":26,"column":295,"offset":1998},"indent":[]}}],"position":{"start":{"line":26,"column":1,"offset":1704},"end":{"line":26,"column":295,"offset":1998},"indent":[]}},{"type":"heading","depth":1,"children":[{"type":"text","value":"Actively Maintained","position":{"start":{"line":28,"column":3,"offset":2002},"end":{"line":28,"column":22,"offset":2021},"indent":[]}}],"position":{"start":{"line":28,"column":1,"offset":2000},"end":{"line":28,"column":22,"offset":2021},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"Discordeno is actively being maintained. Some of the other libraries original developers have quit or no longer actively maintain it and leave it to the community to maintain the library.","position":{"start":{"line":29,"column":1,"offset":2022},"end":{"line":29,"column":188,"offset":2209},"indent":[]}}],"position":{"start":{"line":29,"column":1,"offset":2022},"end":{"line":29,"column":188,"offset":2209},"indent":[]}},{"type":"export","value":"export const _frontmatter = {\"title\":\"Discordeno\",\"metaTitle\":\"Home | Discordeno\",\"metaDescription\":\"Discordeno is a Third Party Deno Library for interacting with the Discord API.\"}","position":{"start":{"line":32,"column":1,"offset":2212},"end":{"line":32,"column":182,"offset":2393},"indent":[]}}],"position":{"start":{"line":1,"column":1,"offset":0},"end":{"line":32,"column":182,"offset":2393}}},"scopeImports":["import * as React from 'react'"],"scopeIdentifiers":["React"],"body":"function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }\n\nfunction _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }\n\nfunction _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }\n\n/* @jsx mdx */\nvar _frontmatter = {\n \"title\": \"Discordeno\",\n \"metaTitle\": \"Home | Discordeno\",\n \"metaDescription\": \"Discordeno is a Third Party Deno Library for interacting with the Discord API.\"\n};\nvar layoutProps = {\n _frontmatter: _frontmatter\n};\nvar MDXLayout = \"wrapper\";\nreturn function MDXContent(_ref) {\n var components = _ref.components,\n props = _objectWithoutProperties(_ref, [\"components\"]);\n\n return mdx(MDXLayout, _extends({}, layoutProps, props, {\n components: components,\n mdxType: \"MDXLayout\"\n }), mdx(\"p\", null, \"A Third Party Deno library for interacting with the Discord API.\"), mdx(\"h2\", null, \"Best TypeScript Support!\"), mdx(\"p\", null, \"First class support for Typescript! Never compile your code again in order to run it. Automated typings so they are never inaccurate or out of date.\"), mdx(\"h2\", null, \"Stable Library\"), mdx(\"p\", null, \"Discordeno is one of the most stable libraries ever. One of the biggest issues with almost every library(I have used) is stability. None of the libraries gave much love and attention to Typescript developers the way it deserves which caused TypeScript bots to break.\"), mdx(\"h2\", null, \"Easy To Use Boilerplates\"), mdx(\"p\", null, \"Several bot boilerplates are available to get up and running very quickly. The Official boilerplate provides the most necessary features for almost any bot to make coding bots extremely easy. You focus on building features and not on building the base for a bot.\"), mdx(\"h1\", null, \"Security\"), mdx(\"p\", null, \"Checks all missing permissions necessary before sending a request to the API so that your bot's token do not get globally banned by Discord. Discordeno does not support self-bot functionality like other libraries either.\"), mdx(\"h1\", null, \"Documentation\"), mdx(\"p\", null, \"All of Discord API Documentation available inside your VSC while you code. The entire libraries documentation is automatically available to you through intellisense.\"), mdx(\"h1\", null, \"Minimalistic\"), mdx(\"p\", null, \"Discordeno will always prefer defaults that Discord recommends or in the cases where Discord does not care we choose the best option for the majority of developers.\"), mdx(\"h1\", null, \"Functional API\"), mdx(\"p\", null, \"This will overall make a cleaner and more performant API, while removing the headaches of extending built-in classes, and inheritance. Avoid potential of memory leaks or bot crashes because of too many listeners or other silly issues.\"), mdx(\"h1\", null, \"Latest & Greatest JavaScript\"), mdx(\"p\", null, \"Discordeno uses the latest and greatest JavaScript/TypeScript available. A lot of libraries still use JavaScript standards from 4-6 years ago because of backwards compatibility. Backwards compatibility is the death of code. It causes clutter and uglyness to pile up and makes developers lazier.\"), mdx(\"h1\", null, \"Actively Maintained\"), mdx(\"p\", null, \"Discordeno is actively being maintained. Some of the other libraries original developers have quit or no longer actively maintain it and leave it to the community to maintain the library.\"));\n}\n;\nMDXContent.isMDXComponent = true;","rawMDXOutput":"/* @jsx mdx */\nimport { mdx } from '@mdx-js/react';\n/* @jsx mdx */\n\nexport const _frontmatter = {\n \"title\": \"Discordeno\",\n \"metaTitle\": \"Home | Discordeno\",\n \"metaDescription\": \"Discordeno is a Third Party Deno Library for interacting with the Discord API.\"\n};\n\nconst layoutProps = {\n _frontmatter\n};\nconst MDXLayout = \"wrapper\"\nexport default function MDXContent({\n components,\n ...props\n}) {\n return \n

{`A Third Party Deno library for interacting with the Discord API.`}

\n

{`Best TypeScript Support!`}

\n

{`First class support for Typescript! Never compile your code again in order to run it. Automated typings so they are never inaccurate or out of date.`}

\n

{`Stable Library`}

\n

{`Discordeno is one of the most stable libraries ever. One of the biggest issues with almost every library(I have used) is stability. None of the libraries gave much love and attention to Typescript developers the way it deserves which caused TypeScript bots to break.`}

\n

{`Easy To Use Boilerplates`}

\n

{`Several bot boilerplates are available to get up and running very quickly. The Official boilerplate provides the most necessary features for almost any bot to make coding bots extremely easy. You focus on building features and not on building the base for a bot.`}

\n

{`Security`}

\n

{`Checks all missing permissions necessary before sending a request to the API so that your bot's token do not get globally banned by Discord. Discordeno does not support self-bot functionality like other libraries either.`}

\n

{`Documentation`}

\n

{`All of Discord API Documentation available inside your VSC while you code. The entire libraries documentation is automatically available to you through intellisense.`}

\n

{`Minimalistic`}

\n

{`Discordeno will always prefer defaults that Discord recommends or in the cases where Discord does not care we choose the best option for the majority of developers.`}

\n

{`Functional API`}

\n

{`This will overall make a cleaner and more performant API, while removing the headaches of extending built-in classes, and inheritance. Avoid potential of memory leaks or bot crashes because of too many listeners or other silly issues.`}

\n

{`Latest & Greatest JavaScript`}

\n

{`Discordeno uses the latest and greatest JavaScript/TypeScript available. A lot of libraries still use JavaScript standards from 4-6 years ago because of backwards compatibility. Backwards compatibility is the death of code. It causes clutter and uglyness to pile up and makes developers lazier.`}

\n

{`Actively Maintained`}

\n

{`Discordeno is actively being maintained. Some of the other libraries original developers have quit or no longer actively maintain it and leave it to the community to maintain the library.`}

\n\n
;\n}\n\n;\nMDXContent.isMDXComponent = true;"}} \ No newline at end of file diff --git a/docs/.cache/caches/gatsby-plugin-mdx/diskstore-ba6ca7f27f0d72cdd8c54b4f555f31f1.json b/docs/.cache/caches/gatsby-plugin-mdx/diskstore-ba6ca7f27f0d72cdd8c54b4f555f31f1.json new file mode 100644 index 000000000..1f9bfbe42 --- /dev/null +++ b/docs/.cache/caches/gatsby-plugin-mdx/diskstore-ba6ca7f27f0d72cdd8c54b4f555f31f1.json @@ -0,0 +1 @@ +{"expireTime":9007200851632175000,"key":"gatsby-plugin-mdx-entire-payload-dfe169d6c022c511b6787aab9a16db81-","val":{"mdast":{"type":"root","children":[{"type":"paragraph","children":[{"type":"text","value":"Woah! You are almost half way done with understanding all of Discordeno. Amazing isn't it? Something you may have noticed in the last section was there were some options that prevented some commands from running like ","position":{"start":{"line":2,"column":1,"offset":1},"end":{"line":2,"column":218,"offset":218},"indent":[]}},{"type":"inlineCode","value":"dmOnly","position":{"start":{"line":2,"column":218,"offset":218},"end":{"line":2,"column":226,"offset":226},"indent":[]}},{"type":"text","value":" or the permission options. we created a setting to prevent the monitor from running in certain channels. What if we wanted to do prevent commands from happening? How would we prevent commands from running?","position":{"start":{"line":2,"column":226,"offset":226},"end":{"line":2,"column":432,"offset":432},"indent":[]}}],"position":{"start":{"line":2,"column":1,"offset":1},"end":{"line":2,"column":432,"offset":432},"indent":[]}},{"type":"heading","depth":2,"children":[{"type":"text","value":"What is an Inhibitor?","position":{"start":{"line":4,"column":4,"offset":437},"end":{"line":4,"column":25,"offset":458},"indent":[]}}],"position":{"start":{"line":4,"column":1,"offset":434},"end":{"line":4,"column":25,"offset":458},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"An Inhibitor is very similar to how monitors work. A monitor runs on every message but an inhibitor runs on every command. Remember all those command options like cooldown, permissions, permissionLevel, nsfw, etc... Each and every one of these options has an inhibitor in that checks commands for these settings.","position":{"start":{"line":6,"column":1,"offset":460},"end":{"line":6,"column":313,"offset":772},"indent":[]}}],"position":{"start":{"line":6,"column":1,"offset":460},"end":{"line":6,"column":313,"offset":772},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"Let's create our own inhibitor that would prevent commands from being used if the user is not a VIP user.","position":{"start":{"line":8,"column":1,"offset":774},"end":{"line":8,"column":106,"offset":879},"indent":[]}}],"position":{"start":{"line":8,"column":1,"offset":774},"end":{"line":8,"column":106,"offset":879},"indent":[]}},{"type":"blockquote","children":[{"type":"paragraph","children":[{"type":"strong","children":[{"type":"text","value":"Note:","position":{"start":{"line":10,"column":5,"offset":885},"end":{"line":10,"column":10,"offset":890},"indent":[]}}],"position":{"start":{"line":10,"column":3,"offset":883},"end":{"line":10,"column":12,"offset":892},"indent":[]}},{"type":"text","value":" It is important to remember that everything below can be done with a simple permission level as well. We will create our own custom permission levels but for the purposes of this guide and to be able to learn about Inhibitors, we will be using an inhibitor.","position":{"start":{"line":10,"column":12,"offset":892},"end":{"line":10,"column":270,"offset":1150},"indent":[]}}],"position":{"start":{"line":10,"column":3,"offset":883},"end":{"line":10,"column":270,"offset":1150},"indent":[]}}],"position":{"start":{"line":10,"column":1,"offset":881},"end":{"line":10,"column":270,"offset":1150},"indent":[]}},{"type":"heading","depth":2,"children":[{"type":"text","value":"Creating the File","position":{"start":{"line":12,"column":4,"offset":1155},"end":{"line":12,"column":21,"offset":1172},"indent":[]}}],"position":{"start":{"line":12,"column":1,"offset":1152},"end":{"line":12,"column":21,"offset":1172},"indent":[]}},{"type":"export","value":"export const _frontmatter = {\"title\":\"Creating Inhibitors!\",\"metaTitle\":\"Creating An Inhibitor | Discordeno\",\"metaDescription\":\"Let's create our very own bot with Discordeno!\"}","position":{"start":{"line":15,"column":1,"offset":1175},"end":{"line":15,"column":177,"offset":1351},"indent":[]}}],"position":{"start":{"line":1,"column":1,"offset":0},"end":{"line":15,"column":177,"offset":1351}}},"scopeImports":["import * as React from 'react'"],"scopeIdentifiers":["React"],"body":"function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }\n\nfunction _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }\n\nfunction _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }\n\n/* @jsx mdx */\nvar _frontmatter = {\n \"title\": \"Creating Inhibitors!\",\n \"metaTitle\": \"Creating An Inhibitor | Discordeno\",\n \"metaDescription\": \"Let's create our very own bot with Discordeno!\"\n};\nvar layoutProps = {\n _frontmatter: _frontmatter\n};\nvar MDXLayout = \"wrapper\";\nreturn function MDXContent(_ref) {\n var components = _ref.components,\n props = _objectWithoutProperties(_ref, [\"components\"]);\n\n return mdx(MDXLayout, _extends({}, layoutProps, props, {\n components: components,\n mdxType: \"MDXLayout\"\n }), mdx(\"p\", null, \"Woah! You are almost half way done with understanding all of Discordeno. Amazing isn't it? Something you may have noticed in the last section was there were some options that prevented some commands from running like \", mdx(\"inlineCode\", {\n parentName: \"p\"\n }, \"dmOnly\"), \" or the permission options. we created a setting to prevent the monitor from running in certain channels. What if we wanted to do prevent commands from happening? How would we prevent commands from running?\"), mdx(\"h2\", null, \"What is an Inhibitor?\"), mdx(\"p\", null, \"An Inhibitor is very similar to how monitors work. A monitor runs on every message but an inhibitor runs on every command. Remember all those command options like cooldown, permissions, permissionLevel, nsfw, etc... Each and every one of these options has an inhibitor in that checks commands for these settings.\"), mdx(\"p\", null, \"Let's create our own inhibitor that would prevent commands from being used if the user is not a VIP user.\"), mdx(\"blockquote\", null, mdx(\"p\", {\n parentName: \"blockquote\"\n }, mdx(\"strong\", {\n parentName: \"p\"\n }, \"Note:\"), \" It is important to remember that everything below can be done with a simple permission level as well. We will create our own custom permission levels but for the purposes of this guide and to be able to learn about Inhibitors, we will be using an inhibitor.\")), mdx(\"h2\", null, \"Creating the File\"));\n}\n;\nMDXContent.isMDXComponent = true;","rawMDXOutput":"/* @jsx mdx */\nimport { mdx } from '@mdx-js/react';\n/* @jsx mdx */\n\nexport const _frontmatter = {\n \"title\": \"Creating Inhibitors!\",\n \"metaTitle\": \"Creating An Inhibitor | Discordeno\",\n \"metaDescription\": \"Let's create our very own bot with Discordeno!\"\n};\n\nconst layoutProps = {\n _frontmatter\n};\nconst MDXLayout = \"wrapper\"\nexport default function MDXContent({\n components,\n ...props\n}) {\n return \n

{`Woah! You are almost half way done with understanding all of Discordeno. Amazing isn't it? Something you may have noticed in the last section was there were some options that prevented some commands from running like `}{`dmOnly`}{` or the permission options. we created a setting to prevent the monitor from running in certain channels. What if we wanted to do prevent commands from happening? How would we prevent commands from running?`}

\n

{`What is an Inhibitor?`}

\n

{`An Inhibitor is very similar to how monitors work. A monitor runs on every message but an inhibitor runs on every command. Remember all those command options like cooldown, permissions, permissionLevel, nsfw, etc... Each and every one of these options has an inhibitor in that checks commands for these settings.`}

\n

{`Let's create our own inhibitor that would prevent commands from being used if the user is not a VIP user.`}

\n
\n

{`Note:`}{` It is important to remember that everything below can be done with a simple permission level as well. We will create our own custom permission levels but for the purposes of this guide and to be able to learn about Inhibitors, we will be using an inhibitor.`}

\n
\n

{`Creating the File`}

\n\n
;\n}\n\n;\nMDXContent.isMDXComponent = true;"}} \ No newline at end of file diff --git a/docs/.cache/caches/gatsby-plugin-mdx/diskstore-bbc05335acd004cce5258beedef0dd00.json b/docs/.cache/caches/gatsby-plugin-mdx/diskstore-bbc05335acd004cce5258beedef0dd00.json new file mode 100644 index 000000000..a7fd6438a --- /dev/null +++ b/docs/.cache/caches/gatsby-plugin-mdx/diskstore-bbc05335acd004cce5258beedef0dd00.json @@ -0,0 +1 @@ +{"expireTime":9007200851644193000,"key":"gatsby-plugin-mdx-entire-payload-46b8c89f5adc20333d21f77ab9d997ac-","val":{"mdast":{"type":"root","children":[{"type":"paragraph","children":[{"type":"text","value":"Discordeno will help make Discord bot development much easier. Don't worry, as you go through this guide it will make a lot more sense.","position":{"start":{"line":2,"column":1,"offset":1},"end":{"line":2,"column":136,"offset":136},"indent":[]}}],"position":{"start":{"line":2,"column":1,"offset":1},"end":{"line":2,"column":136,"offset":136},"indent":[]}},{"type":"heading","depth":2,"children":[{"type":"text","value":"Creating The Bot!","position":{"start":{"line":4,"column":4,"offset":141},"end":{"line":4,"column":21,"offset":158},"indent":[]}}],"position":{"start":{"line":4,"column":1,"offset":138},"end":{"line":4,"column":21,"offset":158},"indent":[]}},{"type":"blockquote","children":[{"type":"paragraph","children":[{"type":"text","value":"This guide is going to assume you already have the basic requirements to make a bot ready. This includes github, git, a code editor like Visual Studio Code. If you don't have these yet please prepare them first before going forward.","position":{"start":{"line":6,"column":3,"offset":162},"end":{"line":6,"column":235,"offset":394},"indent":[]}}],"position":{"start":{"line":6,"column":3,"offset":162},"end":{"line":6,"column":235,"offset":394},"indent":[]}}],"position":{"start":{"line":6,"column":1,"offset":160},"end":{"line":6,"column":235,"offset":394},"indent":[]}},{"type":"list","ordered":false,"start":null,"spread":true,"children":[{"type":"listItem","spread":false,"checked":null,"children":[{"type":"paragraph","children":[{"type":"text","value":"First, create a Discordeno Bot using the ","position":{"start":{"line":8,"column":3,"offset":398},"end":{"line":8,"column":44,"offset":439},"indent":[]}},{"type":"link","title":null,"url":"https://github.com/Skillz4Killz/Discordeno-bot-template","children":[{"type":"text","value":"Generator Boilerplate","position":{"start":{"line":8,"column":45,"offset":440},"end":{"line":8,"column":66,"offset":461},"indent":[]}}],"position":{"start":{"line":8,"column":44,"offset":439},"end":{"line":8,"column":124,"offset":519},"indent":[]}},{"type":"text","value":". Give it any name you like. For the purpose of this guide we will call it, Stargate.","position":{"start":{"line":8,"column":124,"offset":519},"end":{"line":8,"column":209,"offset":604},"indent":[]}}],"position":{"start":{"line":8,"column":3,"offset":398},"end":{"line":8,"column":209,"offset":604},"indent":[]}}],"position":{"start":{"line":8,"column":1,"offset":396},"end":{"line":9,"column":1,"offset":605},"indent":[1]}},{"type":"listItem","spread":false,"checked":null,"children":[{"type":"paragraph","children":[{"type":"text","value":"Then ","position":{"start":{"line":10,"column":3,"offset":608},"end":{"line":10,"column":8,"offset":613},"indent":[]}},{"type":"inlineCode","value":"git clone https://github.com/Skillz4Killz/Stargate.git","position":{"start":{"line":10,"column":8,"offset":613},"end":{"line":10,"column":64,"offset":669},"indent":[]}}],"position":{"start":{"line":10,"column":3,"offset":608},"end":{"line":10,"column":64,"offset":669},"indent":[]}}],"position":{"start":{"line":10,"column":1,"offset":606},"end":{"line":11,"column":1,"offset":670},"indent":[1]}},{"type":"listItem","spread":false,"checked":null,"children":[{"type":"paragraph","children":[{"type":"text","value":"When that is done, go ahead and open up the folder with VSC.","position":{"start":{"line":12,"column":3,"offset":673},"end":{"line":12,"column":63,"offset":733},"indent":[]}}],"position":{"start":{"line":12,"column":3,"offset":673},"end":{"line":12,"column":63,"offset":733},"indent":[]}}],"position":{"start":{"line":12,"column":1,"offset":671},"end":{"line":12,"column":63,"offset":733},"indent":[]}},{"type":"listItem","spread":false,"checked":null,"children":[{"type":"paragraph","children":[{"type":"text","value":"Create a new file called ","position":{"start":{"line":13,"column":3,"offset":736},"end":{"line":13,"column":28,"offset":761},"indent":[]}},{"type":"inlineCode","value":"configs.ts","position":{"start":{"line":13,"column":28,"offset":761},"end":{"line":13,"column":40,"offset":773},"indent":[]}},{"type":"text","value":". Open the ","position":{"start":{"line":13,"column":40,"offset":773},"end":{"line":13,"column":51,"offset":784},"indent":[]}},{"type":"inlineCode","value":"configs.example.ts","position":{"start":{"line":13,"column":51,"offset":784},"end":{"line":13,"column":71,"offset":804},"indent":[]}},{"type":"text","value":" file and copy everything over.","position":{"start":{"line":13,"column":71,"offset":804},"end":{"line":13,"column":102,"offset":835},"indent":[]}}],"position":{"start":{"line":13,"column":3,"offset":736},"end":{"line":13,"column":102,"offset":835},"indent":[]}}],"position":{"start":{"line":13,"column":1,"offset":734},"end":{"line":13,"column":102,"offset":835},"indent":[]}}],"position":{"start":{"line":8,"column":1,"offset":396},"end":{"line":13,"column":102,"offset":835},"indent":[1,1,1,1,1]}},{"type":"paragraph","children":[{"type":"text","value":"Let's take a minute to review all the options we have available to us.","position":{"start":{"line":15,"column":1,"offset":837},"end":{"line":15,"column":71,"offset":907},"indent":[]}}],"position":{"start":{"line":15,"column":1,"offset":837},"end":{"line":15,"column":71,"offset":907},"indent":[]}},{"type":"heading","depth":3,"children":[{"type":"text","value":"Configs File","position":{"start":{"line":17,"column":5,"offset":913},"end":{"line":17,"column":17,"offset":925},"indent":[]}}],"position":{"start":{"line":17,"column":1,"offset":909},"end":{"line":17,"column":17,"offset":925},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"The ","position":{"start":{"line":19,"column":1,"offset":927},"end":{"line":19,"column":5,"offset":931},"indent":[]}},{"type":"inlineCode","value":"configs.ts","position":{"start":{"line":19,"column":5,"offset":931},"end":{"line":19,"column":17,"offset":943},"indent":[]}},{"type":"text","value":" file is where you will keep all your secret info you don't want to share with anyone else. As long as ","position":{"start":{"line":19,"column":17,"offset":943},"end":{"line":19,"column":120,"offset":1046},"indent":[]}},{"type":"inlineCode","value":".gitignore","position":{"start":{"line":19,"column":120,"offset":1046},"end":{"line":19,"column":132,"offset":1058},"indent":[]}},{"type":"text","value":" file is ignoring configs.ts your configurations will be kept private!","position":{"start":{"line":19,"column":132,"offset":1058},"end":{"line":19,"column":202,"offset":1128},"indent":[]}}],"position":{"start":{"line":19,"column":1,"offset":927},"end":{"line":19,"column":202,"offset":1128},"indent":[]}},{"type":"code","lang":"ts","meta":null,"value":"// Step 1: Remove the `.example` from this file name so it is called `configs.ts`\n// Step 2: Add all your bot's information below. The only required one is token and prefix. NOTE: As long as `.gitignore` file is ignoring configs.ts your configurations will be kept private!\n// Step 3: Remove these comments if you like.\n\nexport const configs = {\n // Your bot token goes here\n token: \"\",\n // The default prefix for your bot. Don't worry guilds can change this later.\n prefix: \"!\",\n // This isn't required but you can add bot list api keys here.\n botListTokens: {\n DISCORD_BOT_ORG: \"\",\n BOTS_ON_DISCORD: \"\",\n DISCORD_BOT_LIST: \"\",\n BOTS_FOR_DISCORD: \"\",\n DISCORD_BOATS: \"\",\n DISCORD_BOTS_GG: \"\",\n DISCORD_BOTS_GROUP: \"\",\n },\n // This is the server id for your bot's main server where users can get help/support\n supportServerID: \"\",\n // These are channel ids that will enable some functionality\n channelIDs: {\n // When a translation is missing this is the channel you will be alerted in.\n missingTranslation: \"\",\n // When an error occurs, we will try and log it to this channel\n errorChannelID: \"\"\n },\n // These are the role ids that will enable some functionality.\n roleIDs: {\n // If you have a patreon set up you can add the patreon vip role id here.\n patreonVIPRoleID: \"\",\n },\n // These are the user ids that will enable some functionality.\n userIDs: {\n // The user ids for the support team\n botSupporters: [],\n // The user ids for the other devs on your team\n botDevs: [],\n // The user ids who have complete 100% access to your bot\n botOwners: []\n }\n};\n","position":{"start":{"line":21,"column":1,"offset":1130},"end":{"line":66,"column":4,"offset":2770},"indent":[1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1]}},{"type":"heading","depth":4,"children":[{"type":"text","value":"Token","position":{"start":{"line":68,"column":6,"offset":2777},"end":{"line":68,"column":11,"offset":2782},"indent":[]}}],"position":{"start":{"line":68,"column":1,"offset":2772},"end":{"line":68,"column":11,"offset":2782},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"First, add your bot token. This is ","position":{"start":{"line":70,"column":1,"offset":2784},"end":{"line":70,"column":36,"offset":2819},"indent":[]}},{"type":"strong","children":[{"type":"text","value":"required","position":{"start":{"line":70,"column":38,"offset":2821},"end":{"line":70,"column":46,"offset":2829},"indent":[]}}],"position":{"start":{"line":70,"column":36,"offset":2819},"end":{"line":70,"column":48,"offset":2831},"indent":[]}},{"type":"text","value":" for the bot to start. Review the ","position":{"start":{"line":70,"column":48,"offset":2831},"end":{"line":70,"column":82,"offset":2865},"indent":[]}},{"type":"link","title":null,"url":"https://discordeno.netlify.app/gettingstarted#creatingyourfirstdiscordbotapplication","children":[{"type":"text","value":"instructions","position":{"start":{"line":70,"column":83,"offset":2866},"end":{"line":70,"column":95,"offset":2878},"indent":[]}}],"position":{"start":{"line":70,"column":82,"offset":2865},"end":{"line":70,"column":182,"offset":2965},"indent":[]}},{"type":"text","value":" if you have not made your token yet.","position":{"start":{"line":70,"column":182,"offset":2965},"end":{"line":70,"column":219,"offset":3002},"indent":[]}}],"position":{"start":{"line":70,"column":1,"offset":2784},"end":{"line":70,"column":219,"offset":3002},"indent":[]}},{"type":"heading","depth":4,"children":[{"type":"text","value":"Prefix","position":{"start":{"line":72,"column":6,"offset":3009},"end":{"line":72,"column":12,"offset":3015},"indent":[]}}],"position":{"start":{"line":72,"column":1,"offset":3004},"end":{"line":72,"column":12,"offset":3015},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"The prefix is where you will set the default prefix for your bot. Don't worry, every server will be able to choose their own prefix but we need a default prefix to start.","position":{"start":{"line":74,"column":1,"offset":3017},"end":{"line":74,"column":171,"offset":3187},"indent":[]}}],"position":{"start":{"line":74,"column":1,"offset":3017},"end":{"line":74,"column":171,"offset":3187},"indent":[]}},{"type":"heading","depth":4,"children":[{"type":"text","value":"Bot Lists Tokens","position":{"start":{"line":76,"column":6,"offset":3194},"end":{"line":76,"column":22,"offset":3210},"indent":[]}}],"position":{"start":{"line":76,"column":1,"offset":3189},"end":{"line":76,"column":22,"offset":3210},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"This section of the file is so you can easily have your bot's statistics updated on all the bot lists out there to help you grow your bot. The code is already written to handle this but you will need to do 3 things for each bot list.","position":{"start":{"line":78,"column":1,"offset":3212},"end":{"line":78,"column":234,"offset":3445},"indent":[]}}],"position":{"start":{"line":78,"column":1,"offset":3212},"end":{"line":78,"column":234,"offset":3445},"indent":[]}},{"type":"list","ordered":true,"start":1,"spread":false,"children":[{"type":"listItem","spread":false,"checked":null,"children":[{"type":"paragraph","children":[{"type":"text","value":"Go to the bot list and add your bot to their website. (Each site has it's own instructions)","position":{"start":{"line":80,"column":4,"offset":3450},"end":{"line":80,"column":95,"offset":3541},"indent":[]}}],"position":{"start":{"line":80,"column":4,"offset":3450},"end":{"line":80,"column":95,"offset":3541},"indent":[]}}],"position":{"start":{"line":80,"column":1,"offset":3447},"end":{"line":80,"column":95,"offset":3541},"indent":[]}},{"type":"listItem","spread":false,"checked":null,"children":[{"type":"paragraph","children":[{"type":"text","value":"Create a token for yourself on each website and paste it in your configs.","position":{"start":{"line":81,"column":4,"offset":3545},"end":{"line":81,"column":77,"offset":3618},"indent":[]}}],"position":{"start":{"line":81,"column":4,"offset":3545},"end":{"line":81,"column":77,"offset":3618},"indent":[]}}],"position":{"start":{"line":81,"column":1,"offset":3542},"end":{"line":81,"column":77,"offset":3618},"indent":[]}},{"type":"listItem","spread":false,"checked":null,"children":[{"type":"paragraph","children":[{"type":"text","value":"Enjoy!","position":{"start":{"line":82,"column":4,"offset":3622},"end":{"line":82,"column":10,"offset":3628},"indent":[]}}],"position":{"start":{"line":82,"column":4,"offset":3622},"end":{"line":82,"column":10,"offset":3628},"indent":[]}}],"position":{"start":{"line":82,"column":1,"offset":3619},"end":{"line":82,"column":10,"offset":3628},"indent":[]}}],"position":{"start":{"line":80,"column":1,"offset":3447},"end":{"line":82,"column":10,"offset":3628},"indent":[1,1]}},{"type":"paragraph","children":[{"type":"text","value":"If you wish to customize the code, you will find the bot list tasks in the tasks folder. Don't worry we will discuss this when we get to the tasks section of the guide.","position":{"start":{"line":84,"column":1,"offset":3630},"end":{"line":84,"column":169,"offset":3798},"indent":[]}}],"position":{"start":{"line":84,"column":1,"offset":3630},"end":{"line":84,"column":169,"offset":3798},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"For now just remember, that Discordeno provides you a built in way to update most discord bot lists.","position":{"start":{"line":86,"column":1,"offset":3800},"end":{"line":86,"column":101,"offset":3900},"indent":[]}}],"position":{"start":{"line":86,"column":1,"offset":3800},"end":{"line":86,"column":101,"offset":3900},"indent":[]}},{"type":"heading","depth":4,"children":[{"type":"text","value":"Channel IDs","position":{"start":{"line":88,"column":6,"offset":3907},"end":{"line":88,"column":17,"offset":3918},"indent":[]}}],"position":{"start":{"line":88,"column":1,"offset":3902},"end":{"line":88,"column":17,"offset":3918},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"The channelIDs section holds the useful for specific features to help give you alerts/notifications. For example, the ","position":{"start":{"line":90,"column":1,"offset":3920},"end":{"line":90,"column":119,"offset":4038},"indent":[]}},{"type":"inlineCode","value":"missingTranslation","position":{"start":{"line":90,"column":119,"offset":4038},"end":{"line":90,"column":139,"offset":4058},"indent":[]}},{"type":"text","value":" channel will be where messages are sent alerting you that somewhere in your code you are trying to use a translation key that you never created.","position":{"start":{"line":90,"column":139,"offset":4058},"end":{"line":90,"column":284,"offset":4203},"indent":[]}}],"position":{"start":{"line":90,"column":1,"offset":3920},"end":{"line":90,"column":284,"offset":4203},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"When you get to around 25,000 Discord servers on your bot, you may want to convert these channel IDs to webhooks.","position":{"start":{"line":92,"column":1,"offset":4205},"end":{"line":92,"column":114,"offset":4318},"indent":[]}}],"position":{"start":{"line":92,"column":1,"offset":4205},"end":{"line":92,"column":114,"offset":4318},"indent":[]}},{"type":"heading","depth":4,"children":[{"type":"text","value":"Role IDs","position":{"start":{"line":94,"column":6,"offset":4325},"end":{"line":94,"column":14,"offset":4333},"indent":[]}}],"position":{"start":{"line":94,"column":1,"offset":4320},"end":{"line":94,"column":14,"offset":4333},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"The roleIDs section holds the useful for specific features to help give you alerts/notifications. For example, the ","position":{"start":{"line":96,"column":1,"offset":4335},"end":{"line":96,"column":116,"offset":4450},"indent":[]}},{"type":"inlineCode","value":"missingTranslation","position":{"start":{"line":96,"column":116,"offset":4450},"end":{"line":96,"column":136,"offset":4470},"indent":[]}},{"type":"text","value":" channel will be where messages are sent alerting you that somewhere in your code you are trying to use a translation key that you never created.","position":{"start":{"line":96,"column":136,"offset":4470},"end":{"line":96,"column":281,"offset":4615},"indent":[]}}],"position":{"start":{"line":96,"column":1,"offset":4335},"end":{"line":96,"column":281,"offset":4615},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"When you get to around 25,000 Discord servers on your bot, you may want to convert these channel IDs to webhooks.","position":{"start":{"line":98,"column":1,"offset":4617},"end":{"line":98,"column":114,"offset":4730},"indent":[]}}],"position":{"start":{"line":98,"column":1,"offset":4617},"end":{"line":98,"column":114,"offset":4730},"indent":[]}},{"type":"heading","depth":2,"children":[{"type":"text","value":"It's Alive!","position":{"start":{"line":100,"column":4,"offset":4735},"end":{"line":100,"column":15,"offset":4746},"indent":[]}}],"position":{"start":{"line":100,"column":1,"offset":4732},"end":{"line":100,"column":15,"offset":4746},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"Oh my god! You now have a bot with a bunch of features already! You don't believe me? Well, seeing is believing, so start the bot.","position":{"start":{"line":102,"column":1,"offset":4748},"end":{"line":102,"column":131,"offset":4878},"indent":[]}}],"position":{"start":{"line":102,"column":1,"offset":4748},"end":{"line":102,"column":131,"offset":4878},"indent":[]}},{"type":"list","ordered":true,"start":1,"spread":false,"children":[{"type":"listItem","spread":false,"checked":null,"children":[{"type":"paragraph","children":[{"type":"text","value":"Invite your bot to a discord server.","position":{"start":{"line":104,"column":4,"offset":4883},"end":{"line":104,"column":40,"offset":4919},"indent":[]}}],"position":{"start":{"line":104,"column":4,"offset":4883},"end":{"line":104,"column":40,"offset":4919},"indent":[]}}],"position":{"start":{"line":104,"column":1,"offset":4880},"end":{"line":104,"column":40,"offset":4919},"indent":[]}},{"type":"listItem","spread":false,"checked":null,"children":[{"type":"paragraph","children":[{"type":"text","value":"Open up the integrated terminal in VSC using ","position":{"start":{"line":105,"column":4,"offset":4923},"end":{"line":105,"column":49,"offset":4968},"indent":[]}},{"type":"strong","children":[{"type":"text","value":"CTRL + `","position":{"start":{"line":105,"column":51,"offset":4970},"end":{"line":105,"column":59,"offset":4978},"indent":[]}}],"position":{"start":{"line":105,"column":49,"offset":4968},"end":{"line":105,"column":61,"offset":4980},"indent":[]}},{"type":"text","value":". If you use a Mac, replace CTRL with CMD.","position":{"start":{"line":105,"column":61,"offset":4980},"end":{"line":105,"column":103,"offset":5022},"indent":[]}}],"position":{"start":{"line":105,"column":4,"offset":4923},"end":{"line":105,"column":103,"offset":5022},"indent":[]}}],"position":{"start":{"line":105,"column":1,"offset":4920},"end":{"line":105,"column":103,"offset":5022},"indent":[]}},{"type":"listItem","spread":false,"checked":null,"children":[{"type":"paragraph","children":[{"type":"text","value":"Run the script below:","position":{"start":{"line":106,"column":4,"offset":5026},"end":{"line":106,"column":25,"offset":5047},"indent":[]}}],"position":{"start":{"line":106,"column":4,"offset":5026},"end":{"line":106,"column":25,"offset":5047},"indent":[]}}],"position":{"start":{"line":106,"column":1,"offset":5023},"end":{"line":106,"column":25,"offset":5047},"indent":[]}}],"position":{"start":{"line":104,"column":1,"offset":4880},"end":{"line":106,"column":25,"offset":5047},"indent":[1,1]}},{"type":"code","lang":"shell","meta":null,"value":"deno run --allow-net --allow-read mod.ts","position":{"start":{"line":108,"column":1,"offset":5049},"end":{"line":110,"column":4,"offset":5102},"indent":[1,1]}},{"type":"paragraph","children":[{"type":"text","value":"The first time you run it, you may see a lot of files being loaded. This is preparing all the magic behind the scene. Once it is ready, you will see something like this:","position":{"start":{"line":112,"column":1,"offset":5104},"end":{"line":112,"column":170,"offset":5273},"indent":[]}}],"position":{"start":{"line":112,"column":1,"offset":5104},"end":{"line":112,"column":170,"offset":5273},"indent":[]}},{"type":"paragraph","children":[{"type":"image","title":null,"url":"https://i.imgur.com/TOXjLgh.png","alt":"image","position":{"start":{"line":114,"column":1,"offset":5275},"end":{"line":114,"column":42,"offset":5316},"indent":[]}}],"position":{"start":{"line":114,"column":1,"offset":5275},"end":{"line":114,"column":42,"offset":5316},"indent":[]}},{"type":"heading","depth":2,"children":[{"type":"text","value":"Understanding What Discordeno Did","position":{"start":{"line":116,"column":4,"offset":5321},"end":{"line":116,"column":37,"offset":5354},"indent":[]}}],"position":{"start":{"line":116,"column":1,"offset":5318},"end":{"line":116,"column":37,"offset":5354},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"Discordeno includes these commands/folders as they are essential for any discord bot to have in order to meet the Discord Bot Best Practices. It also adds a few things that will help make some things easier to build a bot.","position":{"start":{"line":118,"column":1,"offset":5356},"end":{"line":118,"column":223,"offset":5578},"indent":[]}}],"position":{"start":{"line":118,"column":1,"offset":5356},"end":{"line":118,"column":223,"offset":5578},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"We will dive into these deeper in this guide. Let's take it step by step.","position":{"start":{"line":120,"column":1,"offset":5580},"end":{"line":120,"column":74,"offset":5653},"indent":[]}}],"position":{"start":{"line":120,"column":1,"offset":5580},"end":{"line":120,"column":74,"offset":5653},"indent":[]}},{"type":"export","value":"export const _frontmatter = {\"title\":\"Creating The Bot!\",\"metaTitle\":\"Creating A Bot | Discordeno\",\"metaDescription\":\"Let's create our very own bot with Discordeno!\"}","position":{"start":{"line":123,"column":1,"offset":5656},"end":{"line":123,"column":167,"offset":5822},"indent":[]}}],"position":{"start":{"line":1,"column":1,"offset":0},"end":{"line":123,"column":167,"offset":5822}}},"scopeImports":["import * as React from 'react'"],"scopeIdentifiers":["React"],"body":"function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }\n\nfunction _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }\n\nfunction _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }\n\n/* @jsx mdx */\nvar _frontmatter = {\n \"title\": \"Creating The Bot!\",\n \"metaTitle\": \"Creating A Bot | Discordeno\",\n \"metaDescription\": \"Let's create our very own bot with Discordeno!\"\n};\nvar layoutProps = {\n _frontmatter: _frontmatter\n};\nvar MDXLayout = \"wrapper\";\nreturn function MDXContent(_ref) {\n var components = _ref.components,\n props = _objectWithoutProperties(_ref, [\"components\"]);\n\n return mdx(MDXLayout, _extends({}, layoutProps, props, {\n components: components,\n mdxType: \"MDXLayout\"\n }), mdx(\"p\", null, \"Discordeno will help make Discord bot development much easier. Don't worry, as you go through this guide it will make a lot more sense.\"), mdx(\"h2\", null, \"Creating The Bot!\"), mdx(\"blockquote\", null, mdx(\"p\", {\n parentName: \"blockquote\"\n }, \"This guide is going to assume you already have the basic requirements to make a bot ready. This includes github, git, a code editor like Visual Studio Code. If you don't have these yet please prepare them first before going forward.\")), mdx(\"ul\", null, mdx(\"li\", {\n parentName: \"ul\"\n }, mdx(\"p\", {\n parentName: \"li\"\n }, \"First, create a Discordeno Bot using the \", mdx(\"a\", _extends({\n parentName: \"p\"\n }, {\n \"href\": \"https://github.com/Skillz4Killz/Discordeno-bot-template\"\n }), \"Generator Boilerplate\"), \". Give it any name you like. For the purpose of this guide we will call it, Stargate.\")), mdx(\"li\", {\n parentName: \"ul\"\n }, mdx(\"p\", {\n parentName: \"li\"\n }, \"Then \", mdx(\"inlineCode\", {\n parentName: \"p\"\n }, \"git clone https://github.com/Skillz4Killz/Stargate.git\"))), mdx(\"li\", {\n parentName: \"ul\"\n }, mdx(\"p\", {\n parentName: \"li\"\n }, \"When that is done, go ahead and open up the folder with VSC.\")), mdx(\"li\", {\n parentName: \"ul\"\n }, mdx(\"p\", {\n parentName: \"li\"\n }, \"Create a new file called \", mdx(\"inlineCode\", {\n parentName: \"p\"\n }, \"configs.ts\"), \". Open the \", mdx(\"inlineCode\", {\n parentName: \"p\"\n }, \"configs.example.ts\"), \" file and copy everything over.\"))), mdx(\"p\", null, \"Let's take a minute to review all the options we have available to us.\"), mdx(\"h3\", null, \"Configs File\"), mdx(\"p\", null, \"The \", mdx(\"inlineCode\", {\n parentName: \"p\"\n }, \"configs.ts\"), \" file is where you will keep all your secret info you don't want to share with anyone else. As long as \", mdx(\"inlineCode\", {\n parentName: \"p\"\n }, \".gitignore\"), \" file is ignoring configs.ts your configurations will be kept private!\"), mdx(\"pre\", null, mdx(\"code\", _extends({\n parentName: \"pre\"\n }, {\n \"className\": \"language-ts\"\n }), \"// Step 1: Remove the `.example` from this file name so it is called `configs.ts`\\n// Step 2: Add all your bot's information below. The only required one is token and prefix. NOTE: As long as `.gitignore` file is ignoring configs.ts your configurations will be kept private!\\n// Step 3: Remove these comments if you like.\\n\\nexport const configs = {\\n // Your bot token goes here\\n token: \\\"\\\",\\n // The default prefix for your bot. Don't worry guilds can change this later.\\n prefix: \\\"!\\\",\\n // This isn't required but you can add bot list api keys here.\\n botListTokens: {\\n DISCORD_BOT_ORG: \\\"\\\",\\n BOTS_ON_DISCORD: \\\"\\\",\\n DISCORD_BOT_LIST: \\\"\\\",\\n BOTS_FOR_DISCORD: \\\"\\\",\\n DISCORD_BOATS: \\\"\\\",\\n DISCORD_BOTS_GG: \\\"\\\",\\n DISCORD_BOTS_GROUP: \\\"\\\",\\n },\\n // This is the server id for your bot's main server where users can get help/support\\n supportServerID: \\\"\\\",\\n // These are channel ids that will enable some functionality\\n channelIDs: {\\n // When a translation is missing this is the channel you will be alerted in.\\n missingTranslation: \\\"\\\",\\n // When an error occurs, we will try and log it to this channel\\n errorChannelID: \\\"\\\"\\n },\\n // These are the role ids that will enable some functionality.\\n roleIDs: {\\n // If you have a patreon set up you can add the patreon vip role id here.\\n patreonVIPRoleID: \\\"\\\",\\n },\\n // These are the user ids that will enable some functionality.\\n userIDs: {\\n // The user ids for the support team\\n botSupporters: [],\\n // The user ids for the other devs on your team\\n botDevs: [],\\n // The user ids who have complete 100% access to your bot\\n botOwners: []\\n }\\n};\\n\\n\")), mdx(\"h4\", null, \"Token\"), mdx(\"p\", null, \"First, add your bot token. This is \", mdx(\"strong\", {\n parentName: \"p\"\n }, \"required\"), \" for the bot to start. Review the \", mdx(\"a\", _extends({\n parentName: \"p\"\n }, {\n \"href\": \"https://discordeno.netlify.app/gettingstarted#creatingyourfirstdiscordbotapplication\"\n }), \"instructions\"), \" if you have not made your token yet.\"), mdx(\"h4\", null, \"Prefix\"), mdx(\"p\", null, \"The prefix is where you will set the default prefix for your bot. Don't worry, every server will be able to choose their own prefix but we need a default prefix to start.\"), mdx(\"h4\", null, \"Bot Lists Tokens\"), mdx(\"p\", null, \"This section of the file is so you can easily have your bot's statistics updated on all the bot lists out there to help you grow your bot. The code is already written to handle this but you will need to do 3 things for each bot list.\"), mdx(\"ol\", null, mdx(\"li\", {\n parentName: \"ol\"\n }, \"Go to the bot list and add your bot to their website. (Each site has it's own instructions)\"), mdx(\"li\", {\n parentName: \"ol\"\n }, \"Create a token for yourself on each website and paste it in your configs.\"), mdx(\"li\", {\n parentName: \"ol\"\n }, \"Enjoy!\")), mdx(\"p\", null, \"If you wish to customize the code, you will find the bot list tasks in the tasks folder. Don't worry we will discuss this when we get to the tasks section of the guide.\"), mdx(\"p\", null, \"For now just remember, that Discordeno provides you a built in way to update most discord bot lists.\"), mdx(\"h4\", null, \"Channel IDs\"), mdx(\"p\", null, \"The channelIDs section holds the useful for specific features to help give you alerts/notifications. For example, the \", mdx(\"inlineCode\", {\n parentName: \"p\"\n }, \"missingTranslation\"), \" channel will be where messages are sent alerting you that somewhere in your code you are trying to use a translation key that you never created.\"), mdx(\"p\", null, \"When you get to around 25,000 Discord servers on your bot, you may want to convert these channel IDs to webhooks.\"), mdx(\"h4\", null, \"Role IDs\"), mdx(\"p\", null, \"The roleIDs section holds the useful for specific features to help give you alerts/notifications. For example, the \", mdx(\"inlineCode\", {\n parentName: \"p\"\n }, \"missingTranslation\"), \" channel will be where messages are sent alerting you that somewhere in your code you are trying to use a translation key that you never created.\"), mdx(\"p\", null, \"When you get to around 25,000 Discord servers on your bot, you may want to convert these channel IDs to webhooks.\"), mdx(\"h2\", null, \"It's Alive!\"), mdx(\"p\", null, \"Oh my god! You now have a bot with a bunch of features already! You don't believe me? Well, seeing is believing, so start the bot.\"), mdx(\"ol\", null, mdx(\"li\", {\n parentName: \"ol\"\n }, \"Invite your bot to a discord server.\"), mdx(\"li\", {\n parentName: \"ol\"\n }, \"Open up the integrated terminal in VSC using \", mdx(\"strong\", {\n parentName: \"li\"\n }, \"CTRL + `\"), \". If you use a Mac, replace CTRL with CMD.\"), mdx(\"li\", {\n parentName: \"ol\"\n }, \"Run the script below:\")), mdx(\"pre\", null, mdx(\"code\", _extends({\n parentName: \"pre\"\n }, {\n \"className\": \"language-shell\"\n }), \"deno run --allow-net --allow-read mod.ts\\n\")), mdx(\"p\", null, \"The first time you run it, you may see a lot of files being loaded. This is preparing all the magic behind the scene. Once it is ready, you will see something like this:\"), mdx(\"p\", null, mdx(\"img\", _extends({\n parentName: \"p\"\n }, {\n \"src\": \"https://i.imgur.com/TOXjLgh.png\",\n \"alt\": \"image\"\n }))), mdx(\"h2\", null, \"Understanding What Discordeno Did\"), mdx(\"p\", null, \"Discordeno includes these commands/folders as they are essential for any discord bot to have in order to meet the Discord Bot Best Practices. It also adds a few things that will help make some things easier to build a bot.\"), mdx(\"p\", null, \"We will dive into these deeper in this guide. Let's take it step by step.\"));\n}\n;\nMDXContent.isMDXComponent = true;","rawMDXOutput":"/* @jsx mdx */\nimport { mdx } from '@mdx-js/react';\n/* @jsx mdx */\n\nexport const _frontmatter = {\n \"title\": \"Creating The Bot!\",\n \"metaTitle\": \"Creating A Bot | Discordeno\",\n \"metaDescription\": \"Let's create our very own bot with Discordeno!\"\n};\n\nconst layoutProps = {\n _frontmatter\n};\nconst MDXLayout = \"wrapper\"\nexport default function MDXContent({\n components,\n ...props\n}) {\n return \n

{`Discordeno will help make Discord bot development much easier. Don't worry, as you go through this guide it will make a lot more sense.`}

\n

{`Creating The Bot!`}

\n
\n

{`This guide is going to assume you already have the basic requirements to make a bot ready. This includes github, git, a code editor like Visual Studio Code. If you don't have these yet please prepare them first before going forward.`}

\n
\n
    \n
  • \n

    {`First, create a Discordeno Bot using the `}{`Generator Boilerplate`}{`. Give it any name you like. For the purpose of this guide we will call it, Stargate.`}

    \n
  • \n
  • \n

    {`Then `}{`git clone https://github.com/Skillz4Killz/Stargate.git`}

    \n
  • \n
  • \n

    {`When that is done, go ahead and open up the folder with VSC.`}

    \n
  • \n
  • \n

    {`Create a new file called `}{`configs.ts`}{`. Open the `}{`configs.example.ts`}{` file and copy everything over.`}

    \n
  • \n
\n

{`Let's take a minute to review all the options we have available to us.`}

\n

{`Configs File`}

\n

{`The `}{`configs.ts`}{` file is where you will keep all your secret info you don't want to share with anyone else. As long as `}{`.gitignore`}{` file is ignoring configs.ts your configurations will be kept private!`}

\n
{`// Step 1: Remove the \\`.example\\` from this file name so it is called \\`configs.ts\\`\n// Step 2: Add all your bot's information below. The only required one is token and prefix. NOTE: As long as \\`.gitignore\\` file is ignoring configs.ts your configurations will be kept private!\n// Step 3: Remove these comments if you like.\n\nexport const configs = {\n  // Your bot token goes here\n  token: \"\",\n  // The default prefix for your bot. Don't worry guilds can change this later.\n  prefix: \"!\",\n  // This isn't required but you can add bot list api keys here.\n  botListTokens: {\n    DISCORD_BOT_ORG: \"\",\n    BOTS_ON_DISCORD: \"\",\n    DISCORD_BOT_LIST: \"\",\n    BOTS_FOR_DISCORD: \"\",\n    DISCORD_BOATS: \"\",\n    DISCORD_BOTS_GG: \"\",\n    DISCORD_BOTS_GROUP: \"\",\n  },\n  // This is the server id for your bot's main server where users can get help/support\n  supportServerID: \"\",\n  // These are channel ids that will enable some functionality\n  channelIDs: {\n    // When a translation is missing this is the channel you will be alerted in.\n    missingTranslation: \"\",\n    // When an error occurs, we will try and log it to this channel\n    errorChannelID: \"\"\n  },\n  // These are the role ids that will enable some functionality.\n  roleIDs: {\n    // If you have a patreon set up you can add the patreon vip role id here.\n    patreonVIPRoleID: \"\",\n  },\n  // These are the user ids that will enable some functionality.\n  userIDs: {\n    // The user ids for the support team\n    botSupporters: [],\n    // The user ids for the other devs on your team\n    botDevs: [],\n    // The user ids who have complete 100% access to your bot\n    botOwners: []\n  }\n};\n\n`}
\n

{`Token`}

\n

{`First, add your bot token. This is `}{`required`}{` for the bot to start. Review the `}{`instructions`}{` if you have not made your token yet.`}

\n

{`Prefix`}

\n

{`The prefix is where you will set the default prefix for your bot. Don't worry, every server will be able to choose their own prefix but we need a default prefix to start.`}

\n

{`Bot Lists Tokens`}

\n

{`This section of the file is so you can easily have your bot's statistics updated on all the bot lists out there to help you grow your bot. The code is already written to handle this but you will need to do 3 things for each bot list.`}

\n
    \n
  1. {`Go to the bot list and add your bot to their website. (Each site has it's own instructions)`}
  2. \n
  3. {`Create a token for yourself on each website and paste it in your configs.`}
  4. \n
  5. {`Enjoy!`}
  6. \n
\n

{`If you wish to customize the code, you will find the bot list tasks in the tasks folder. Don't worry we will discuss this when we get to the tasks section of the guide.`}

\n

{`For now just remember, that Discordeno provides you a built in way to update most discord bot lists.`}

\n

{`Channel IDs`}

\n

{`The channelIDs section holds the useful for specific features to help give you alerts/notifications. For example, the `}{`missingTranslation`}{` channel will be where messages are sent alerting you that somewhere in your code you are trying to use a translation key that you never created.`}

\n

{`When you get to around 25,000 Discord servers on your bot, you may want to convert these channel IDs to webhooks.`}

\n

{`Role IDs`}

\n

{`The roleIDs section holds the useful for specific features to help give you alerts/notifications. For example, the `}{`missingTranslation`}{` channel will be where messages are sent alerting you that somewhere in your code you are trying to use a translation key that you never created.`}

\n

{`When you get to around 25,000 Discord servers on your bot, you may want to convert these channel IDs to webhooks.`}

\n

{`It's Alive!`}

\n

{`Oh my god! You now have a bot with a bunch of features already! You don't believe me? Well, seeing is believing, so start the bot.`}

\n
    \n
  1. {`Invite your bot to a discord server.`}
  2. \n
  3. {`Open up the integrated terminal in VSC using `}{`CTRL + \\``}{`. If you use a Mac, replace CTRL with CMD.`}
  4. \n
  5. {`Run the script below:`}
  6. \n
\n
{`deno run --allow-net --allow-read mod.ts\n`}
\n

{`The first time you run it, you may see a lot of files being loaded. This is preparing all the magic behind the scene. Once it is ready, you will see something like this:`}

\n

\n

{`Understanding What Discordeno Did`}

\n

{`Discordeno includes these commands/folders as they are essential for any discord bot to have in order to meet the Discord Bot Best Practices. It also adds a few things that will help make some things easier to build a bot.`}

\n

{`We will dive into these deeper in this guide. Let's take it step by step.`}

\n\n
;\n}\n\n;\nMDXContent.isMDXComponent = true;"}} \ No newline at end of file diff --git a/docs/.cache/caches/gatsby-plugin-mdx/diskstore-bbe13e974d5ee3d14e72aef622ecee47.json b/docs/.cache/caches/gatsby-plugin-mdx/diskstore-bbe13e974d5ee3d14e72aef622ecee47.json new file mode 100644 index 000000000..71876e8ec --- /dev/null +++ b/docs/.cache/caches/gatsby-plugin-mdx/diskstore-bbe13e974d5ee3d14e72aef622ecee47.json @@ -0,0 +1 @@ +{"expireTime":9007200851634173000,"key":"gatsby-plugin-mdx-entire-payload-46b4bed132aafc6ff66271082238b092-","val":{"mdast":{"type":"root","children":[{"type":"paragraph","children":[{"type":"text","value":"Woah! You are almost half way done with understanding all of Discordeno. Amazing isn't it? Something you may have noticed in the last section was there were some options that prevented some commands from running like ","position":{"start":{"line":2,"column":1,"offset":1},"end":{"line":2,"column":218,"offset":218},"indent":[]}},{"type":"inlineCode","value":"dmOnly","position":{"start":{"line":2,"column":218,"offset":218},"end":{"line":2,"column":226,"offset":226},"indent":[]}},{"type":"text","value":" or the permission options. we created a setting to prevent the monitor from running in certain channels. What if we wanted to do prevent commands from happening? How would we prevent commands from running?","position":{"start":{"line":2,"column":226,"offset":226},"end":{"line":2,"column":432,"offset":432},"indent":[]}}],"position":{"start":{"line":2,"column":1,"offset":1},"end":{"line":2,"column":432,"offset":432},"indent":[]}},{"type":"heading","depth":2,"children":[{"type":"text","value":"What is an Inhibitor?","position":{"start":{"line":4,"column":4,"offset":437},"end":{"line":4,"column":25,"offset":458},"indent":[]}}],"position":{"start":{"line":4,"column":1,"offset":434},"end":{"line":4,"column":25,"offset":458},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"An Inhibitor is very similar to how monitors work. A monitor runs on every message but an inhibitor runs on every command. Remember all those command options like cooldown, permissions, permissionLevel, nsfw, etc... Each and every one of these options has an inhibitor in that checks commands for these settings.","position":{"start":{"line":6,"column":1,"offset":460},"end":{"line":6,"column":313,"offset":772},"indent":[]}}],"position":{"start":{"line":6,"column":1,"offset":460},"end":{"line":6,"column":313,"offset":772},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"Let's create our own inhibitor that would prevent commands from being used if the user is not a VIP user.","position":{"start":{"line":8,"column":1,"offset":774},"end":{"line":8,"column":106,"offset":879},"indent":[]}}],"position":{"start":{"line":8,"column":1,"offset":774},"end":{"line":8,"column":106,"offset":879},"indent":[]}},{"type":"blockquote","children":[{"type":"paragraph","children":[{"type":"strong","children":[{"type":"text","value":"Note:","position":{"start":{"line":10,"column":5,"offset":885},"end":{"line":10,"column":10,"offset":890},"indent":[]}}],"position":{"start":{"line":10,"column":3,"offset":883},"end":{"line":10,"column":12,"offset":892},"indent":[]}},{"type":"text","value":" It is important to remember that everything below can be done with a simple permission level as well. We will create our own custom permission levels but for the purposes of this guide and to be able to learn about Inhibitors, we will be using an inhibitor.","position":{"start":{"line":10,"column":12,"offset":892},"end":{"line":10,"column":270,"offset":1150},"indent":[]}}],"position":{"start":{"line":10,"column":3,"offset":883},"end":{"line":10,"column":270,"offset":1150},"indent":[]}}],"position":{"start":{"line":10,"column":1,"offset":881},"end":{"line":10,"column":270,"offset":1150},"indent":[]}},{"type":"heading","depth":2,"children":[{"type":"text","value":"Creating the File","position":{"start":{"line":12,"column":4,"offset":1155},"end":{"line":12,"column":21,"offset":1172},"indent":[]}}],"position":{"start":{"line":12,"column":1,"offset":1152},"end":{"line":12,"column":21,"offset":1172},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"Let's start by creating a file inside the inhibitors folder called ","position":{"start":{"line":14,"column":1,"offset":1174},"end":{"line":14,"column":68,"offset":1241},"indent":[]}},{"type":"inlineCode","value":"boosted.ts","position":{"start":{"line":14,"column":68,"offset":1241},"end":{"line":14,"column":80,"offset":1253},"indent":[]}},{"type":"text","value":" and paste the following snippet of code:","position":{"start":{"line":14,"column":80,"offset":1253},"end":{"line":14,"column":121,"offset":1294},"indent":[]}}],"position":{"start":{"line":14,"column":1,"offset":1174},"end":{"line":14,"column":121,"offset":1294},"indent":[]}},{"type":"code","lang":"ts","meta":null,"value":"import { botCache } from \"../../mod.ts\";\n\nbotCache.inhibitors.set(\"inhibitorname\", async function (message, command, guild) {\n\t// Your code goes here\n});","position":{"start":{"line":16,"column":1,"offset":1296},"end":{"line":22,"column":4,"offset":1459},"indent":[1,1,1,1,1,1]}},{"type":"paragraph","children":[{"type":"text","value":"Inhibitors can take up to 3 arguments.","position":{"start":{"line":24,"column":1,"offset":1461},"end":{"line":24,"column":39,"offset":1499},"indent":[]}}],"position":{"start":{"line":24,"column":1,"offset":1461},"end":{"line":24,"column":39,"offset":1499},"indent":[]}},{"type":"list","ordered":false,"start":null,"spread":false,"children":[{"type":"listItem","spread":false,"checked":null,"children":[{"type":"paragraph","children":[{"type":"inlineCode","value":"message","position":{"start":{"line":26,"column":3,"offset":1503},"end":{"line":26,"column":12,"offset":1512},"indent":[]}},{"type":"text","value":": The message object that triggered the command.","position":{"start":{"line":26,"column":12,"offset":1512},"end":{"line":26,"column":60,"offset":1560},"indent":[]}}],"position":{"start":{"line":26,"column":3,"offset":1503},"end":{"line":26,"column":60,"offset":1560},"indent":[]}}],"position":{"start":{"line":26,"column":1,"offset":1501},"end":{"line":26,"column":60,"offset":1560},"indent":[]}},{"type":"listItem","spread":false,"checked":null,"children":[{"type":"paragraph","children":[{"type":"inlineCode","value":"command","position":{"start":{"line":27,"column":3,"offset":1563},"end":{"line":27,"column":12,"offset":1572},"indent":[]}},{"type":"text","value":": The command object itself that was triggered.","position":{"start":{"line":27,"column":12,"offset":1572},"end":{"line":27,"column":59,"offset":1619},"indent":[]}}],"position":{"start":{"line":27,"column":3,"offset":1563},"end":{"line":27,"column":59,"offset":1619},"indent":[]}}],"position":{"start":{"line":27,"column":1,"offset":1561},"end":{"line":27,"column":59,"offset":1619},"indent":[]}},{"type":"listItem","spread":false,"checked":null,"children":[{"type":"paragraph","children":[{"type":"inlineCode","value":"guild","position":{"start":{"line":28,"column":3,"offset":1622},"end":{"line":28,"column":10,"offset":1629},"indent":[]}},{"type":"text","value":": The server guild object where this command was ran.","position":{"start":{"line":28,"column":10,"offset":1629},"end":{"line":28,"column":63,"offset":1682},"indent":[]}}],"position":{"start":{"line":28,"column":3,"offset":1622},"end":{"line":28,"column":63,"offset":1682},"indent":[]}}],"position":{"start":{"line":28,"column":1,"offset":1620},"end":{"line":28,"column":63,"offset":1682},"indent":[]}}],"position":{"start":{"line":26,"column":1,"offset":1501},"end":{"line":28,"column":63,"offset":1682},"indent":[1,1]}},{"type":"heading","depth":2,"children":[{"type":"text","value":"Understanding How Inhibitors Function","position":{"start":{"line":30,"column":4,"offset":1687},"end":{"line":30,"column":41,"offset":1724},"indent":[]}}],"position":{"start":{"line":30,"column":1,"offset":1684},"end":{"line":30,"column":41,"offset":1724},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"To block a command you have to return a truthy value.","position":{"start":{"line":32,"column":1,"offset":1726},"end":{"line":32,"column":54,"offset":1779},"indent":[]}}],"position":{"start":{"line":32,"column":1,"offset":1726},"end":{"line":32,"column":54,"offset":1779},"indent":[]}},{"type":"list","ordered":false,"start":null,"spread":false,"children":[{"type":"listItem","spread":false,"checked":null,"children":[{"type":"paragraph","children":[{"type":"strong","children":[{"type":"text","value":"return true;","position":{"start":{"line":33,"column":5,"offset":1784},"end":{"line":33,"column":17,"offset":1796},"indent":[]}}],"position":{"start":{"line":33,"column":3,"offset":1782},"end":{"line":33,"column":19,"offset":1798},"indent":[]}},{"type":"text","value":" If you return true the inhibitor will block the execution of the command.\nTo allow a command return a falsey value.","position":{"start":{"line":33,"column":19,"offset":1798},"end":{"line":34,"column":42,"offset":1914},"indent":[1]}}],"position":{"start":{"line":33,"column":3,"offset":1782},"end":{"line":34,"column":42,"offset":1914},"indent":[1]}}],"position":{"start":{"line":33,"column":1,"offset":1780},"end":{"line":34,"column":42,"offset":1914},"indent":[1]}},{"type":"listItem","spread":false,"checked":null,"children":[{"type":"paragraph","children":[{"type":"strong","children":[{"type":"text","value":"return false;","position":{"start":{"line":35,"column":5,"offset":1919},"end":{"line":35,"column":18,"offset":1932},"indent":[]}}],"position":{"start":{"line":35,"column":3,"offset":1917},"end":{"line":35,"column":20,"offset":1934},"indent":[]}},{"type":"text","value":" If you return false the inhibitor will not block the error.","position":{"start":{"line":35,"column":20,"offset":1934},"end":{"line":35,"column":80,"offset":1994},"indent":[]}}],"position":{"start":{"line":35,"column":3,"offset":1917},"end":{"line":35,"column":80,"offset":1994},"indent":[]}}],"position":{"start":{"line":35,"column":1,"offset":1915},"end":{"line":35,"column":80,"offset":1994},"indent":[]}}],"position":{"start":{"line":33,"column":1,"offset":1780},"end":{"line":35,"column":80,"offset":1994},"indent":[1,1]}},{"type":"code","lang":"ts","meta":null,"value":"// If the command is not VIP only we can allow this command to execute\nif (!command.vipOnly) return false;\n\n// The bot's support server\nconst guild = cache.guilds.get(configs.supportServerID);\n// If the command author is not in the server they won't have the vip role so cancel the command\nconst member = guild.members.get(message.author.id);\n\n\n// Check if the user has the vip role on the support server given by patreon\nconst userIsVIP = await isUserVIP(message.author.id)\n// The user is VIP so we can allow this command to be used\nif (userIsVIP) return false;\n\n// The user is NOT VIP so we throw an error\nthrow `The ${command.name} is only allowed for VIP users.`","position":{"start":{"line":38,"column":1,"offset":1997},"end":{"line":55,"column":4,"offset":2673},"indent":[1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1]}},{"type":"export","value":"export const _frontmatter = {\"title\":\"Creating Inhibitors!\",\"metaTitle\":\"Creating An Inhibitor | Discordeno\",\"metaDescription\":\"Let's create our very own bot with Discordeno!\"}","position":{"start":{"line":58,"column":1,"offset":2676},"end":{"line":58,"column":177,"offset":2852},"indent":[]}}],"position":{"start":{"line":1,"column":1,"offset":0},"end":{"line":58,"column":177,"offset":2852}}},"scopeImports":["import * as React from 'react'"],"scopeIdentifiers":["React"],"body":"function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }\n\nfunction _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }\n\nfunction _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }\n\n/* @jsx mdx */\nvar _frontmatter = {\n \"title\": \"Creating Inhibitors!\",\n \"metaTitle\": \"Creating An Inhibitor | Discordeno\",\n \"metaDescription\": \"Let's create our very own bot with Discordeno!\"\n};\nvar layoutProps = {\n _frontmatter: _frontmatter\n};\nvar MDXLayout = \"wrapper\";\nreturn function MDXContent(_ref) {\n var components = _ref.components,\n props = _objectWithoutProperties(_ref, [\"components\"]);\n\n return mdx(MDXLayout, _extends({}, layoutProps, props, {\n components: components,\n mdxType: \"MDXLayout\"\n }), mdx(\"p\", null, \"Woah! You are almost half way done with understanding all of Discordeno. Amazing isn't it? Something you may have noticed in the last section was there were some options that prevented some commands from running like \", mdx(\"inlineCode\", {\n parentName: \"p\"\n }, \"dmOnly\"), \" or the permission options. we created a setting to prevent the monitor from running in certain channels. What if we wanted to do prevent commands from happening? How would we prevent commands from running?\"), mdx(\"h2\", null, \"What is an Inhibitor?\"), mdx(\"p\", null, \"An Inhibitor is very similar to how monitors work. A monitor runs on every message but an inhibitor runs on every command. Remember all those command options like cooldown, permissions, permissionLevel, nsfw, etc... Each and every one of these options has an inhibitor in that checks commands for these settings.\"), mdx(\"p\", null, \"Let's create our own inhibitor that would prevent commands from being used if the user is not a VIP user.\"), mdx(\"blockquote\", null, mdx(\"p\", {\n parentName: \"blockquote\"\n }, mdx(\"strong\", {\n parentName: \"p\"\n }, \"Note:\"), \" It is important to remember that everything below can be done with a simple permission level as well. We will create our own custom permission levels but for the purposes of this guide and to be able to learn about Inhibitors, we will be using an inhibitor.\")), mdx(\"h2\", null, \"Creating the File\"), mdx(\"p\", null, \"Let's start by creating a file inside the inhibitors folder called \", mdx(\"inlineCode\", {\n parentName: \"p\"\n }, \"boosted.ts\"), \" and paste the following snippet of code:\"), mdx(\"pre\", null, mdx(\"code\", _extends({\n parentName: \"pre\"\n }, {\n \"className\": \"language-ts\"\n }), \"import { botCache } from \\\"../../mod.ts\\\";\\n\\nbotCache.inhibitors.set(\\\"inhibitorname\\\", async function (message, command, guild) {\\n // Your code goes here\\n});\\n\")), mdx(\"p\", null, \"Inhibitors can take up to 3 arguments.\"), mdx(\"ul\", null, mdx(\"li\", {\n parentName: \"ul\"\n }, mdx(\"inlineCode\", {\n parentName: \"li\"\n }, \"message\"), \": The message object that triggered the command.\"), mdx(\"li\", {\n parentName: \"ul\"\n }, mdx(\"inlineCode\", {\n parentName: \"li\"\n }, \"command\"), \": The command object itself that was triggered.\"), mdx(\"li\", {\n parentName: \"ul\"\n }, mdx(\"inlineCode\", {\n parentName: \"li\"\n }, \"guild\"), \": The server guild object where this command was ran.\")), mdx(\"h2\", null, \"Understanding How Inhibitors Function\"), mdx(\"p\", null, \"To block a command you have to return a truthy value.\"), mdx(\"ul\", null, mdx(\"li\", {\n parentName: \"ul\"\n }, mdx(\"strong\", {\n parentName: \"li\"\n }, \"return true;\"), \" If you return true the inhibitor will block the execution of the command.\\nTo allow a command return a falsey value.\"), mdx(\"li\", {\n parentName: \"ul\"\n }, mdx(\"strong\", {\n parentName: \"li\"\n }, \"return false;\"), \" If you return false the inhibitor will not block the error.\")), mdx(\"pre\", null, mdx(\"code\", _extends({\n parentName: \"pre\"\n }, {\n \"className\": \"language-ts\"\n }), \"// If the command is not VIP only we can allow this command to execute\\nif (!command.vipOnly) return false;\\n\\n// The bot's support server\\nconst guild = cache.guilds.get(configs.supportServerID);\\n// If the command author is not in the server they won't have the vip role so cancel the command\\nconst member = guild.members.get(message.author.id);\\n\\n\\n// Check if the user has the vip role on the support server given by patreon\\nconst userIsVIP = await isUserVIP(message.author.id)\\n// The user is VIP so we can allow this command to be used\\nif (userIsVIP) return false;\\n\\n// The user is NOT VIP so we throw an error\\nthrow `The ${command.name} is only allowed for VIP users.`\\n\")));\n}\n;\nMDXContent.isMDXComponent = true;","rawMDXOutput":"/* @jsx mdx */\nimport { mdx } from '@mdx-js/react';\n/* @jsx mdx */\n\nexport const _frontmatter = {\n \"title\": \"Creating Inhibitors!\",\n \"metaTitle\": \"Creating An Inhibitor | Discordeno\",\n \"metaDescription\": \"Let's create our very own bot with Discordeno!\"\n};\n\nconst layoutProps = {\n _frontmatter\n};\nconst MDXLayout = \"wrapper\"\nexport default function MDXContent({\n components,\n ...props\n}) {\n return \n

{`Woah! You are almost half way done with understanding all of Discordeno. Amazing isn't it? Something you may have noticed in the last section was there were some options that prevented some commands from running like `}{`dmOnly`}{` or the permission options. we created a setting to prevent the monitor from running in certain channels. What if we wanted to do prevent commands from happening? How would we prevent commands from running?`}

\n

{`What is an Inhibitor?`}

\n

{`An Inhibitor is very similar to how monitors work. A monitor runs on every message but an inhibitor runs on every command. Remember all those command options like cooldown, permissions, permissionLevel, nsfw, etc... Each and every one of these options has an inhibitor in that checks commands for these settings.`}

\n

{`Let's create our own inhibitor that would prevent commands from being used if the user is not a VIP user.`}

\n
\n

{`Note:`}{` It is important to remember that everything below can be done with a simple permission level as well. We will create our own custom permission levels but for the purposes of this guide and to be able to learn about Inhibitors, we will be using an inhibitor.`}

\n
\n

{`Creating the File`}

\n

{`Let's start by creating a file inside the inhibitors folder called `}{`boosted.ts`}{` and paste the following snippet of code:`}

\n
{`import { botCache } from \"../../mod.ts\";\n\nbotCache.inhibitors.set(\"inhibitorname\", async function (message, command, guild) {\n    // Your code goes here\n});\n`}
\n

{`Inhibitors can take up to 3 arguments.`}

\n
    \n
  • {`message`}{`: The message object that triggered the command.`}
  • \n
  • {`command`}{`: The command object itself that was triggered.`}
  • \n
  • {`guild`}{`: The server guild object where this command was ran.`}
  • \n
\n

{`Understanding How Inhibitors Function`}

\n

{`To block a command you have to return a truthy value.`}

\n
    \n
  • {`return true;`}{` If you return true the inhibitor will block the execution of the command.\nTo allow a command return a falsey value.`}
  • \n
  • {`return false;`}{` If you return false the inhibitor will not block the error.`}
  • \n
\n
{`// If the command is not VIP only we can allow this command to execute\nif (!command.vipOnly) return false;\n\n// The bot's support server\nconst guild = cache.guilds.get(configs.supportServerID);\n// If the command author is not in the server they won't have the vip role so cancel the command\nconst member = guild.members.get(message.author.id);\n\n\n// Check if the user has the vip role on the support server given by patreon\nconst userIsVIP = await isUserVIP(message.author.id)\n// The user is VIP so we can allow this command to be used\nif (userIsVIP) return false;\n\n// The user is NOT VIP so we throw an error\nthrow \\`The \\${command.name} is only allowed for VIP users.\\`\n`}
\n\n
;\n}\n\n;\nMDXContent.isMDXComponent = true;"}} \ No newline at end of file diff --git a/docs/.cache/caches/gatsby-plugin-mdx/diskstore-bc1dade7eb3711769ba8bdd2da853f34.json b/docs/.cache/caches/gatsby-plugin-mdx/diskstore-bc1dade7eb3711769ba8bdd2da853f34.json new file mode 100644 index 000000000..fea0bcba0 --- /dev/null +++ b/docs/.cache/caches/gatsby-plugin-mdx/diskstore-bc1dade7eb3711769ba8bdd2da853f34.json @@ -0,0 +1 @@ +{"expireTime":9007200851632114000,"key":"gatsby-plugin-mdx-entire-payload-5ebd6ef62d6a957769924040abe7a797-","val":{"mdast":{"type":"root","children":[{"type":"paragraph","children":[{"type":"text","value":"Woah! You are almost half way done with understanding all of Discordeno. Amazing isn't it? Something you may have noticed in the last section was there were some options that prevented some commands from running like ","position":{"start":{"line":2,"column":1,"offset":1},"end":{"line":2,"column":218,"offset":218},"indent":[]}},{"type":"inlineCode","value":"dmOnly","position":{"start":{"line":2,"column":218,"offset":218},"end":{"line":2,"column":226,"offset":226},"indent":[]}},{"type":"text","value":" or the permission options. we created a setting to prevent the monitor from running in certain channels. What if we wanted to do prevent commands from happening? How would we prevent commands from running?","position":{"start":{"line":2,"column":226,"offset":226},"end":{"line":2,"column":432,"offset":432},"indent":[]}}],"position":{"start":{"line":2,"column":1,"offset":1},"end":{"line":2,"column":432,"offset":432},"indent":[]}},{"type":"heading","depth":2,"children":[{"type":"text","value":"What is an Inhibitor?","position":{"start":{"line":4,"column":4,"offset":437},"end":{"line":4,"column":25,"offset":458},"indent":[]}}],"position":{"start":{"line":4,"column":1,"offset":434},"end":{"line":4,"column":25,"offset":458},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"An Inhibitor is very similar to how monitors work. A monitor runs on every message but an inhibitor runs on every command. Remember all those command options like cooldown, permissions, permissionLevel, nsfw, etc. Each and every one of these options has an inhibitor in Klasa core that checks commands for these settings.\nLet's create our own inhibitor that would prevent commands from being used if the user is not a VIP user.","position":{"start":{"line":6,"column":1,"offset":460},"end":{"line":7,"column":106,"offset":887},"indent":[1]}}],"position":{"start":{"line":6,"column":1,"offset":460},"end":{"line":7,"column":106,"offset":887},"indent":[1]}},{"type":"blockquote","children":[{"type":"paragraph","children":[{"type":"strong","children":[{"type":"text","value":"Note:","position":{"start":{"line":9,"column":5,"offset":893},"end":{"line":9,"column":10,"offset":898},"indent":[]}}],"position":{"start":{"line":9,"column":3,"offset":891},"end":{"line":9,"column":12,"offset":900},"indent":[]}},{"type":"text","value":" It is important to remember that everything below can be done with a simple permission level as well. We will create our own custom permission levels but for the purposes of this guide and to be able to learn about Inhibitors, we will be using an inhibitor.","position":{"start":{"line":9,"column":12,"offset":900},"end":{"line":9,"column":270,"offset":1158},"indent":[]}}],"position":{"start":{"line":9,"column":3,"offset":891},"end":{"line":9,"column":270,"offset":1158},"indent":[]}}],"position":{"start":{"line":9,"column":1,"offset":889},"end":{"line":9,"column":270,"offset":1158},"indent":[]}},{"type":"export","value":"export const _frontmatter = {\"title\":\"Creating Inhibitors!\",\"metaTitle\":\"Creating An Inhibitor | Discordeno\",\"metaDescription\":\"Let's create our very own bot with Discordeno!\"}","position":{"start":{"line":12,"column":1,"offset":1161},"end":{"line":12,"column":177,"offset":1337},"indent":[]}}],"position":{"start":{"line":1,"column":1,"offset":0},"end":{"line":12,"column":177,"offset":1337}}},"scopeImports":["import * as React from 'react'"],"scopeIdentifiers":["React"],"body":"function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }\n\nfunction _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }\n\nfunction _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }\n\n/* @jsx mdx */\nvar _frontmatter = {\n \"title\": \"Creating Inhibitors!\",\n \"metaTitle\": \"Creating An Inhibitor | Discordeno\",\n \"metaDescription\": \"Let's create our very own bot with Discordeno!\"\n};\nvar layoutProps = {\n _frontmatter: _frontmatter\n};\nvar MDXLayout = \"wrapper\";\nreturn function MDXContent(_ref) {\n var components = _ref.components,\n props = _objectWithoutProperties(_ref, [\"components\"]);\n\n return mdx(MDXLayout, _extends({}, layoutProps, props, {\n components: components,\n mdxType: \"MDXLayout\"\n }), mdx(\"p\", null, \"Woah! You are almost half way done with understanding all of Discordeno. Amazing isn't it? Something you may have noticed in the last section was there were some options that prevented some commands from running like \", mdx(\"inlineCode\", {\n parentName: \"p\"\n }, \"dmOnly\"), \" or the permission options. we created a setting to prevent the monitor from running in certain channels. What if we wanted to do prevent commands from happening? How would we prevent commands from running?\"), mdx(\"h2\", null, \"What is an Inhibitor?\"), mdx(\"p\", null, \"An Inhibitor is very similar to how monitors work. A monitor runs on every message but an inhibitor runs on every command. Remember all those command options like cooldown, permissions, permissionLevel, nsfw, etc. Each and every one of these options has an inhibitor in Klasa core that checks commands for these settings.\\nLet's create our own inhibitor that would prevent commands from being used if the user is not a VIP user.\"), mdx(\"blockquote\", null, mdx(\"p\", {\n parentName: \"blockquote\"\n }, mdx(\"strong\", {\n parentName: \"p\"\n }, \"Note:\"), \" It is important to remember that everything below can be done with a simple permission level as well. We will create our own custom permission levels but for the purposes of this guide and to be able to learn about Inhibitors, we will be using an inhibitor.\")));\n}\n;\nMDXContent.isMDXComponent = true;","rawMDXOutput":"/* @jsx mdx */\nimport { mdx } from '@mdx-js/react';\n/* @jsx mdx */\n\nexport const _frontmatter = {\n \"title\": \"Creating Inhibitors!\",\n \"metaTitle\": \"Creating An Inhibitor | Discordeno\",\n \"metaDescription\": \"Let's create our very own bot with Discordeno!\"\n};\n\nconst layoutProps = {\n _frontmatter\n};\nconst MDXLayout = \"wrapper\"\nexport default function MDXContent({\n components,\n ...props\n}) {\n return \n

{`Woah! You are almost half way done with understanding all of Discordeno. Amazing isn't it? Something you may have noticed in the last section was there were some options that prevented some commands from running like `}{`dmOnly`}{` or the permission options. we created a setting to prevent the monitor from running in certain channels. What if we wanted to do prevent commands from happening? How would we prevent commands from running?`}

\n

{`What is an Inhibitor?`}

\n

{`An Inhibitor is very similar to how monitors work. A monitor runs on every message but an inhibitor runs on every command. Remember all those command options like cooldown, permissions, permissionLevel, nsfw, etc. Each and every one of these options has an inhibitor in Klasa core that checks commands for these settings.\nLet's create our own inhibitor that would prevent commands from being used if the user is not a VIP user.`}

\n
\n

{`Note:`}{` It is important to remember that everything below can be done with a simple permission level as well. We will create our own custom permission levels but for the purposes of this guide and to be able to learn about Inhibitors, we will be using an inhibitor.`}

\n
\n\n
;\n}\n\n;\nMDXContent.isMDXComponent = true;"}} \ No newline at end of file diff --git a/docs/.cache/caches/gatsby-plugin-mdx/diskstore-bee30d4ed0ab5e78080d24e5c193d58f.json b/docs/.cache/caches/gatsby-plugin-mdx/diskstore-bee30d4ed0ab5e78080d24e5c193d58f.json new file mode 100644 index 000000000..df4fb5047 --- /dev/null +++ b/docs/.cache/caches/gatsby-plugin-mdx/diskstore-bee30d4ed0ab5e78080d24e5c193d58f.json @@ -0,0 +1 @@ +{"expireTime":9007200851596863000,"key":"gatsby-plugin-mdx-entire-payload-5404d67bf0b0dea0701fe22e3dc7c053-","val":{"mdast":{"type":"root","children":[{"type":"paragraph","children":[{"type":"text","value":"Woah! You are almost half way done with understanding all of Discordeno. Amazing isn't it? Something you may have noticed in the last section was there were some options that prevented some commands from running like ","position":{"start":{"line":2,"column":1,"offset":1},"end":{"line":2,"column":218,"offset":218},"indent":[]}},{"type":"inlineCode","value":"dmOnly","position":{"start":{"line":2,"column":218,"offset":218},"end":{"line":2,"column":226,"offset":226},"indent":[]}},{"type":"text","value":" or the permission options. we created a setting to prevent the monitor from running in certain channels. What if we wanted to do prevent commands from happening? How would we prevent commands from running?","position":{"start":{"line":2,"column":226,"offset":226},"end":{"line":2,"column":432,"offset":432},"indent":[]}}],"position":{"start":{"line":2,"column":1,"offset":1},"end":{"line":2,"column":432,"offset":432},"indent":[]}},{"type":"export","value":"export const _frontmatter = {\"title\":\"Creating Inhibitors!\",\"metaTitle\":\"Creating An Inhibitor | Discordeno\",\"metaDescription\":\"Let's create our very own bot with Discordeno!\"}","position":{"start":{"line":5,"column":1,"offset":435},"end":{"line":5,"column":177,"offset":611},"indent":[]}}],"position":{"start":{"line":1,"column":1,"offset":0},"end":{"line":5,"column":177,"offset":611}}},"scopeImports":["import * as React from 'react'"],"scopeIdentifiers":["React"],"body":"function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }\n\nfunction _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }\n\nfunction _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }\n\n/* @jsx mdx */\nvar _frontmatter = {\n \"title\": \"Creating Inhibitors!\",\n \"metaTitle\": \"Creating An Inhibitor | Discordeno\",\n \"metaDescription\": \"Let's create our very own bot with Discordeno!\"\n};\nvar layoutProps = {\n _frontmatter: _frontmatter\n};\nvar MDXLayout = \"wrapper\";\nreturn function MDXContent(_ref) {\n var components = _ref.components,\n props = _objectWithoutProperties(_ref, [\"components\"]);\n\n return mdx(MDXLayout, _extends({}, layoutProps, props, {\n components: components,\n mdxType: \"MDXLayout\"\n }), mdx(\"p\", null, \"Woah! You are almost half way done with understanding all of Discordeno. Amazing isn't it? Something you may have noticed in the last section was there were some options that prevented some commands from running like \", mdx(\"inlineCode\", {\n parentName: \"p\"\n }, \"dmOnly\"), \" or the permission options. we created a setting to prevent the monitor from running in certain channels. What if we wanted to do prevent commands from happening? How would we prevent commands from running?\"));\n}\n;\nMDXContent.isMDXComponent = true;","rawMDXOutput":"/* @jsx mdx */\nimport { mdx } from '@mdx-js/react';\n/* @jsx mdx */\n\nexport const _frontmatter = {\n \"title\": \"Creating Inhibitors!\",\n \"metaTitle\": \"Creating An Inhibitor | Discordeno\",\n \"metaDescription\": \"Let's create our very own bot with Discordeno!\"\n};\n\nconst layoutProps = {\n _frontmatter\n};\nconst MDXLayout = \"wrapper\"\nexport default function MDXContent({\n components,\n ...props\n}) {\n return \n

{`Woah! You are almost half way done with understanding all of Discordeno. Amazing isn't it? Something you may have noticed in the last section was there were some options that prevented some commands from running like `}{`dmOnly`}{` or the permission options. we created a setting to prevent the monitor from running in certain channels. What if we wanted to do prevent commands from happening? How would we prevent commands from running?`}

\n\n
;\n}\n\n;\nMDXContent.isMDXComponent = true;"}} \ No newline at end of file diff --git a/docs/.cache/caches/gatsby-plugin-mdx/diskstore-c38821458db3f7ea1dc608d769784f70.json b/docs/.cache/caches/gatsby-plugin-mdx/diskstore-c38821458db3f7ea1dc608d769784f70.json new file mode 100644 index 000000000..ec0e87ae7 --- /dev/null +++ b/docs/.cache/caches/gatsby-plugin-mdx/diskstore-c38821458db3f7ea1dc608d769784f70.json @@ -0,0 +1 @@ +{"expireTime":9007200851634189000,"key":"gatsby-plugin-mdx-entire-payload-348b7f584b9a0ada5f2611642b2f0556-","val":{"mdast":{"type":"root","children":[{"type":"paragraph","children":[{"type":"text","value":"Woah! You are almost half way done with understanding all of Discordeno. Amazing isn't it? Something you may have noticed in the last section was there were some options that prevented some commands from running like ","position":{"start":{"line":2,"column":1,"offset":1},"end":{"line":2,"column":218,"offset":218},"indent":[]}},{"type":"inlineCode","value":"dmOnly","position":{"start":{"line":2,"column":218,"offset":218},"end":{"line":2,"column":226,"offset":226},"indent":[]}},{"type":"text","value":" or the permission options. we created a setting to prevent the monitor from running in certain channels. What if we wanted to do prevent commands from happening? How would we prevent commands from running?","position":{"start":{"line":2,"column":226,"offset":226},"end":{"line":2,"column":432,"offset":432},"indent":[]}}],"position":{"start":{"line":2,"column":1,"offset":1},"end":{"line":2,"column":432,"offset":432},"indent":[]}},{"type":"heading","depth":2,"children":[{"type":"text","value":"What is an Inhibitor?","position":{"start":{"line":4,"column":4,"offset":437},"end":{"line":4,"column":25,"offset":458},"indent":[]}}],"position":{"start":{"line":4,"column":1,"offset":434},"end":{"line":4,"column":25,"offset":458},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"An Inhibitor is very similar to how monitors work. A monitor runs on every message but an inhibitor runs on every command. Remember all those command options like cooldown, permissions, permissionLevel, nsfw, etc... Each and every one of these options has an inhibitor in that checks commands for these settings.","position":{"start":{"line":6,"column":1,"offset":460},"end":{"line":6,"column":313,"offset":772},"indent":[]}}],"position":{"start":{"line":6,"column":1,"offset":460},"end":{"line":6,"column":313,"offset":772},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"Let's create our own inhibitor that would prevent commands from being used if the user is not a VIP user.","position":{"start":{"line":8,"column":1,"offset":774},"end":{"line":8,"column":106,"offset":879},"indent":[]}}],"position":{"start":{"line":8,"column":1,"offset":774},"end":{"line":8,"column":106,"offset":879},"indent":[]}},{"type":"blockquote","children":[{"type":"paragraph","children":[{"type":"strong","children":[{"type":"text","value":"Note:","position":{"start":{"line":10,"column":5,"offset":885},"end":{"line":10,"column":10,"offset":890},"indent":[]}}],"position":{"start":{"line":10,"column":3,"offset":883},"end":{"line":10,"column":12,"offset":892},"indent":[]}},{"type":"text","value":" It is important to remember that everything below can be done with a simple permission level as well. We will create our own custom permission levels but for the purposes of this guide and to be able to learn about Inhibitors, we will be using an inhibitor.","position":{"start":{"line":10,"column":12,"offset":892},"end":{"line":10,"column":270,"offset":1150},"indent":[]}}],"position":{"start":{"line":10,"column":3,"offset":883},"end":{"line":10,"column":270,"offset":1150},"indent":[]}}],"position":{"start":{"line":10,"column":1,"offset":881},"end":{"line":10,"column":270,"offset":1150},"indent":[]}},{"type":"heading","depth":2,"children":[{"type":"text","value":"Creating the File","position":{"start":{"line":12,"column":4,"offset":1155},"end":{"line":12,"column":21,"offset":1172},"indent":[]}}],"position":{"start":{"line":12,"column":1,"offset":1152},"end":{"line":12,"column":21,"offset":1172},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"Let's start by creating a file inside the inhibitors folder called ","position":{"start":{"line":14,"column":1,"offset":1174},"end":{"line":14,"column":68,"offset":1241},"indent":[]}},{"type":"inlineCode","value":"boosted.ts","position":{"start":{"line":14,"column":68,"offset":1241},"end":{"line":14,"column":80,"offset":1253},"indent":[]}},{"type":"text","value":" and paste the following snippet of code:","position":{"start":{"line":14,"column":80,"offset":1253},"end":{"line":14,"column":121,"offset":1294},"indent":[]}}],"position":{"start":{"line":14,"column":1,"offset":1174},"end":{"line":14,"column":121,"offset":1294},"indent":[]}},{"type":"code","lang":"ts","meta":null,"value":"import { botCache } from \"../../mod.ts\";\n\nbotCache.inhibitors.set(\"inhibitorname\", async function (message, command, guild) {\n\t// Your code goes here\n});","position":{"start":{"line":16,"column":1,"offset":1296},"end":{"line":22,"column":4,"offset":1459},"indent":[1,1,1,1,1,1]}},{"type":"paragraph","children":[{"type":"text","value":"Inhibitors can take up to 3 arguments.","position":{"start":{"line":24,"column":1,"offset":1461},"end":{"line":24,"column":39,"offset":1499},"indent":[]}}],"position":{"start":{"line":24,"column":1,"offset":1461},"end":{"line":24,"column":39,"offset":1499},"indent":[]}},{"type":"list","ordered":false,"start":null,"spread":false,"children":[{"type":"listItem","spread":false,"checked":null,"children":[{"type":"paragraph","children":[{"type":"inlineCode","value":"message","position":{"start":{"line":26,"column":3,"offset":1503},"end":{"line":26,"column":12,"offset":1512},"indent":[]}},{"type":"text","value":": The message object that triggered the command.","position":{"start":{"line":26,"column":12,"offset":1512},"end":{"line":26,"column":60,"offset":1560},"indent":[]}}],"position":{"start":{"line":26,"column":3,"offset":1503},"end":{"line":26,"column":60,"offset":1560},"indent":[]}}],"position":{"start":{"line":26,"column":1,"offset":1501},"end":{"line":26,"column":60,"offset":1560},"indent":[]}},{"type":"listItem","spread":false,"checked":null,"children":[{"type":"paragraph","children":[{"type":"inlineCode","value":"command","position":{"start":{"line":27,"column":3,"offset":1563},"end":{"line":27,"column":12,"offset":1572},"indent":[]}},{"type":"text","value":": The command object itself that was triggered.","position":{"start":{"line":27,"column":12,"offset":1572},"end":{"line":27,"column":59,"offset":1619},"indent":[]}}],"position":{"start":{"line":27,"column":3,"offset":1563},"end":{"line":27,"column":59,"offset":1619},"indent":[]}}],"position":{"start":{"line":27,"column":1,"offset":1561},"end":{"line":27,"column":59,"offset":1619},"indent":[]}},{"type":"listItem","spread":false,"checked":null,"children":[{"type":"paragraph","children":[{"type":"inlineCode","value":"guild","position":{"start":{"line":28,"column":3,"offset":1622},"end":{"line":28,"column":10,"offset":1629},"indent":[]}},{"type":"text","value":": The server guild object where this command was ran.","position":{"start":{"line":28,"column":10,"offset":1629},"end":{"line":28,"column":63,"offset":1682},"indent":[]}}],"position":{"start":{"line":28,"column":3,"offset":1622},"end":{"line":28,"column":63,"offset":1682},"indent":[]}}],"position":{"start":{"line":28,"column":1,"offset":1620},"end":{"line":28,"column":63,"offset":1682},"indent":[]}}],"position":{"start":{"line":26,"column":1,"offset":1501},"end":{"line":28,"column":63,"offset":1682},"indent":[1,1]}},{"type":"heading","depth":2,"children":[{"type":"text","value":"Understanding How Inhibitors Function","position":{"start":{"line":30,"column":4,"offset":1687},"end":{"line":30,"column":41,"offset":1724},"indent":[]}}],"position":{"start":{"line":30,"column":1,"offset":1684},"end":{"line":30,"column":41,"offset":1724},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"To block a command you have to return a truthy value.","position":{"start":{"line":32,"column":1,"offset":1726},"end":{"line":32,"column":54,"offset":1779},"indent":[]}}],"position":{"start":{"line":32,"column":1,"offset":1726},"end":{"line":32,"column":54,"offset":1779},"indent":[]}},{"type":"list","ordered":false,"start":null,"spread":false,"children":[{"type":"listItem","spread":false,"checked":null,"children":[{"type":"paragraph","children":[{"type":"strong","children":[{"type":"text","value":"return true;","position":{"start":{"line":33,"column":5,"offset":1784},"end":{"line":33,"column":17,"offset":1796},"indent":[]}}],"position":{"start":{"line":33,"column":3,"offset":1782},"end":{"line":33,"column":19,"offset":1798},"indent":[]}},{"type":"text","value":" If you return true the inhibitor will block the execution of the command.\nTo allow a command return a falsey value.","position":{"start":{"line":33,"column":19,"offset":1798},"end":{"line":34,"column":42,"offset":1914},"indent":[1]}}],"position":{"start":{"line":33,"column":3,"offset":1782},"end":{"line":34,"column":42,"offset":1914},"indent":[1]}}],"position":{"start":{"line":33,"column":1,"offset":1780},"end":{"line":34,"column":42,"offset":1914},"indent":[1]}},{"type":"listItem","spread":false,"checked":null,"children":[{"type":"paragraph","children":[{"type":"strong","children":[{"type":"text","value":"return false;","position":{"start":{"line":35,"column":5,"offset":1919},"end":{"line":35,"column":18,"offset":1932},"indent":[]}}],"position":{"start":{"line":35,"column":3,"offset":1917},"end":{"line":35,"column":20,"offset":1934},"indent":[]}},{"type":"text","value":" If you return false the inhibitor will not block the error.","position":{"start":{"line":35,"column":20,"offset":1934},"end":{"line":35,"column":80,"offset":1994},"indent":[]}}],"position":{"start":{"line":35,"column":3,"offset":1917},"end":{"line":35,"column":80,"offset":1994},"indent":[]}}],"position":{"start":{"line":35,"column":1,"offset":1915},"end":{"line":35,"column":80,"offset":1994},"indent":[]}}],"position":{"start":{"line":33,"column":1,"offset":1780},"end":{"line":35,"column":80,"offset":1994},"indent":[1,1]}},{"type":"code","lang":"ts","meta":null,"value":"// If the command is not VIP only we can allow this command to execute\nif (!command.vipOnly) return false;\n\n// The bot's support server\nconst guild = cache.guilds.get(configs.supportServerID);\n// If the command author is not in the server they won't have the vip role\nconst member = guild.members.get(message.author.id);\n// Member dso cancel the command\nif (!member) return true;\n// Check if the user has the vip role on the support server given by patreon\nconst userIsVIP = await isUserVIP(message.author.id)\n// The user is VIP so we can allow this command to be used\nif (userIsVIP) return false;\n\n// The user is NOT VIP so we throw an error\nthrow `The ${command.name} is only allowed for VIP users.`","position":{"start":{"line":38,"column":1,"offset":1997},"end":{"line":55,"column":4,"offset":2708},"indent":[1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1]}},{"type":"export","value":"export const _frontmatter = {\"title\":\"Creating Inhibitors!\",\"metaTitle\":\"Creating An Inhibitor | Discordeno\",\"metaDescription\":\"Let's create our very own bot with Discordeno!\"}","position":{"start":{"line":58,"column":1,"offset":2711},"end":{"line":58,"column":177,"offset":2887},"indent":[]}}],"position":{"start":{"line":1,"column":1,"offset":0},"end":{"line":58,"column":177,"offset":2887}}},"scopeImports":["import * as React from 'react'"],"scopeIdentifiers":["React"],"body":"function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }\n\nfunction _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }\n\nfunction _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }\n\n/* @jsx mdx */\nvar _frontmatter = {\n \"title\": \"Creating Inhibitors!\",\n \"metaTitle\": \"Creating An Inhibitor | Discordeno\",\n \"metaDescription\": \"Let's create our very own bot with Discordeno!\"\n};\nvar layoutProps = {\n _frontmatter: _frontmatter\n};\nvar MDXLayout = \"wrapper\";\nreturn function MDXContent(_ref) {\n var components = _ref.components,\n props = _objectWithoutProperties(_ref, [\"components\"]);\n\n return mdx(MDXLayout, _extends({}, layoutProps, props, {\n components: components,\n mdxType: \"MDXLayout\"\n }), mdx(\"p\", null, \"Woah! You are almost half way done with understanding all of Discordeno. Amazing isn't it? Something you may have noticed in the last section was there were some options that prevented some commands from running like \", mdx(\"inlineCode\", {\n parentName: \"p\"\n }, \"dmOnly\"), \" or the permission options. we created a setting to prevent the monitor from running in certain channels. What if we wanted to do prevent commands from happening? How would we prevent commands from running?\"), mdx(\"h2\", null, \"What is an Inhibitor?\"), mdx(\"p\", null, \"An Inhibitor is very similar to how monitors work. A monitor runs on every message but an inhibitor runs on every command. Remember all those command options like cooldown, permissions, permissionLevel, nsfw, etc... Each and every one of these options has an inhibitor in that checks commands for these settings.\"), mdx(\"p\", null, \"Let's create our own inhibitor that would prevent commands from being used if the user is not a VIP user.\"), mdx(\"blockquote\", null, mdx(\"p\", {\n parentName: \"blockquote\"\n }, mdx(\"strong\", {\n parentName: \"p\"\n }, \"Note:\"), \" It is important to remember that everything below can be done with a simple permission level as well. We will create our own custom permission levels but for the purposes of this guide and to be able to learn about Inhibitors, we will be using an inhibitor.\")), mdx(\"h2\", null, \"Creating the File\"), mdx(\"p\", null, \"Let's start by creating a file inside the inhibitors folder called \", mdx(\"inlineCode\", {\n parentName: \"p\"\n }, \"boosted.ts\"), \" and paste the following snippet of code:\"), mdx(\"pre\", null, mdx(\"code\", _extends({\n parentName: \"pre\"\n }, {\n \"className\": \"language-ts\"\n }), \"import { botCache } from \\\"../../mod.ts\\\";\\n\\nbotCache.inhibitors.set(\\\"inhibitorname\\\", async function (message, command, guild) {\\n // Your code goes here\\n});\\n\")), mdx(\"p\", null, \"Inhibitors can take up to 3 arguments.\"), mdx(\"ul\", null, mdx(\"li\", {\n parentName: \"ul\"\n }, mdx(\"inlineCode\", {\n parentName: \"li\"\n }, \"message\"), \": The message object that triggered the command.\"), mdx(\"li\", {\n parentName: \"ul\"\n }, mdx(\"inlineCode\", {\n parentName: \"li\"\n }, \"command\"), \": The command object itself that was triggered.\"), mdx(\"li\", {\n parentName: \"ul\"\n }, mdx(\"inlineCode\", {\n parentName: \"li\"\n }, \"guild\"), \": The server guild object where this command was ran.\")), mdx(\"h2\", null, \"Understanding How Inhibitors Function\"), mdx(\"p\", null, \"To block a command you have to return a truthy value.\"), mdx(\"ul\", null, mdx(\"li\", {\n parentName: \"ul\"\n }, mdx(\"strong\", {\n parentName: \"li\"\n }, \"return true;\"), \" If you return true the inhibitor will block the execution of the command.\\nTo allow a command return a falsey value.\"), mdx(\"li\", {\n parentName: \"ul\"\n }, mdx(\"strong\", {\n parentName: \"li\"\n }, \"return false;\"), \" If you return false the inhibitor will not block the error.\")), mdx(\"pre\", null, mdx(\"code\", _extends({\n parentName: \"pre\"\n }, {\n \"className\": \"language-ts\"\n }), \"// If the command is not VIP only we can allow this command to execute\\nif (!command.vipOnly) return false;\\n\\n// The bot's support server\\nconst guild = cache.guilds.get(configs.supportServerID);\\n// If the command author is not in the server they won't have the vip role\\nconst member = guild.members.get(message.author.id);\\n// Member dso cancel the command\\nif (!member) return true;\\n// Check if the user has the vip role on the support server given by patreon\\nconst userIsVIP = await isUserVIP(message.author.id)\\n// The user is VIP so we can allow this command to be used\\nif (userIsVIP) return false;\\n\\n// The user is NOT VIP so we throw an error\\nthrow `The ${command.name} is only allowed for VIP users.`\\n\")));\n}\n;\nMDXContent.isMDXComponent = true;","rawMDXOutput":"/* @jsx mdx */\nimport { mdx } from '@mdx-js/react';\n/* @jsx mdx */\n\nexport const _frontmatter = {\n \"title\": \"Creating Inhibitors!\",\n \"metaTitle\": \"Creating An Inhibitor | Discordeno\",\n \"metaDescription\": \"Let's create our very own bot with Discordeno!\"\n};\n\nconst layoutProps = {\n _frontmatter\n};\nconst MDXLayout = \"wrapper\"\nexport default function MDXContent({\n components,\n ...props\n}) {\n return \n

{`Woah! You are almost half way done with understanding all of Discordeno. Amazing isn't it? Something you may have noticed in the last section was there were some options that prevented some commands from running like `}{`dmOnly`}{` or the permission options. we created a setting to prevent the monitor from running in certain channels. What if we wanted to do prevent commands from happening? How would we prevent commands from running?`}

\n

{`What is an Inhibitor?`}

\n

{`An Inhibitor is very similar to how monitors work. A monitor runs on every message but an inhibitor runs on every command. Remember all those command options like cooldown, permissions, permissionLevel, nsfw, etc... Each and every one of these options has an inhibitor in that checks commands for these settings.`}

\n

{`Let's create our own inhibitor that would prevent commands from being used if the user is not a VIP user.`}

\n
\n

{`Note:`}{` It is important to remember that everything below can be done with a simple permission level as well. We will create our own custom permission levels but for the purposes of this guide and to be able to learn about Inhibitors, we will be using an inhibitor.`}

\n
\n

{`Creating the File`}

\n

{`Let's start by creating a file inside the inhibitors folder called `}{`boosted.ts`}{` and paste the following snippet of code:`}

\n
{`import { botCache } from \"../../mod.ts\";\n\nbotCache.inhibitors.set(\"inhibitorname\", async function (message, command, guild) {\n    // Your code goes here\n});\n`}
\n

{`Inhibitors can take up to 3 arguments.`}

\n
    \n
  • {`message`}{`: The message object that triggered the command.`}
  • \n
  • {`command`}{`: The command object itself that was triggered.`}
  • \n
  • {`guild`}{`: The server guild object where this command was ran.`}
  • \n
\n

{`Understanding How Inhibitors Function`}

\n

{`To block a command you have to return a truthy value.`}

\n
    \n
  • {`return true;`}{` If you return true the inhibitor will block the execution of the command.\nTo allow a command return a falsey value.`}
  • \n
  • {`return false;`}{` If you return false the inhibitor will not block the error.`}
  • \n
\n
{`// If the command is not VIP only we can allow this command to execute\nif (!command.vipOnly) return false;\n\n// The bot's support server\nconst guild = cache.guilds.get(configs.supportServerID);\n// If the command author is not in the server they won't have the vip role\nconst member = guild.members.get(message.author.id);\n// Member dso cancel the command\nif (!member) return true;\n// Check if the user has the vip role on the support server given by patreon\nconst userIsVIP = await isUserVIP(message.author.id)\n// The user is VIP so we can allow this command to be used\nif (userIsVIP) return false;\n\n// The user is NOT VIP so we throw an error\nthrow \\`The \\${command.name} is only allowed for VIP users.\\`\n`}
\n\n
;\n}\n\n;\nMDXContent.isMDXComponent = true;"}} \ No newline at end of file diff --git a/docs/.cache/caches/gatsby-plugin-mdx/diskstore-c38955e72fcba00329def8d75a8530d5.json b/docs/.cache/caches/gatsby-plugin-mdx/diskstore-c38955e72fcba00329def8d75a8530d5.json new file mode 100644 index 000000000..a6597201a --- /dev/null +++ b/docs/.cache/caches/gatsby-plugin-mdx/diskstore-c38955e72fcba00329def8d75a8530d5.json @@ -0,0 +1 @@ +{"expireTime":9007200851634113000,"key":"gatsby-plugin-mdx-entire-payload-e97e9ab65e4f3a00f0a54cf6cb31a1a8-","val":{"mdast":{"type":"root","children":[{"type":"paragraph","children":[{"type":"text","value":"Woah! You are almost half way done with understanding all of Discordeno. Amazing isn't it? Something you may have noticed in the last section was there were some options that prevented some commands from running like ","position":{"start":{"line":2,"column":1,"offset":1},"end":{"line":2,"column":218,"offset":218},"indent":[]}},{"type":"inlineCode","value":"dmOnly","position":{"start":{"line":2,"column":218,"offset":218},"end":{"line":2,"column":226,"offset":226},"indent":[]}},{"type":"text","value":" or the permission options. we created a setting to prevent the monitor from running in certain channels. What if we wanted to do prevent commands from happening? How would we prevent commands from running?","position":{"start":{"line":2,"column":226,"offset":226},"end":{"line":2,"column":432,"offset":432},"indent":[]}}],"position":{"start":{"line":2,"column":1,"offset":1},"end":{"line":2,"column":432,"offset":432},"indent":[]}},{"type":"heading","depth":2,"children":[{"type":"text","value":"What is an Inhibitor?","position":{"start":{"line":4,"column":4,"offset":437},"end":{"line":4,"column":25,"offset":458},"indent":[]}}],"position":{"start":{"line":4,"column":1,"offset":434},"end":{"line":4,"column":25,"offset":458},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"An Inhibitor is very similar to how monitors work. A monitor runs on every message but an inhibitor runs on every command. Remember all those command options like cooldown, permissions, permissionLevel, nsfw, etc... Each and every one of these options has an inhibitor in that checks commands for these settings.","position":{"start":{"line":6,"column":1,"offset":460},"end":{"line":6,"column":313,"offset":772},"indent":[]}}],"position":{"start":{"line":6,"column":1,"offset":460},"end":{"line":6,"column":313,"offset":772},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"Let's create our own inhibitor that would prevent commands from being used if the user is not a VIP user.","position":{"start":{"line":8,"column":1,"offset":774},"end":{"line":8,"column":106,"offset":879},"indent":[]}}],"position":{"start":{"line":8,"column":1,"offset":774},"end":{"line":8,"column":106,"offset":879},"indent":[]}},{"type":"blockquote","children":[{"type":"paragraph","children":[{"type":"strong","children":[{"type":"text","value":"Note:","position":{"start":{"line":10,"column":5,"offset":885},"end":{"line":10,"column":10,"offset":890},"indent":[]}}],"position":{"start":{"line":10,"column":3,"offset":883},"end":{"line":10,"column":12,"offset":892},"indent":[]}},{"type":"text","value":" It is important to remember that everything below can be done with a simple permission level as well. We will create our own custom permission levels but for the purposes of this guide and to be able to learn about Inhibitors, we will be using an inhibitor.","position":{"start":{"line":10,"column":12,"offset":892},"end":{"line":10,"column":270,"offset":1150},"indent":[]}}],"position":{"start":{"line":10,"column":3,"offset":883},"end":{"line":10,"column":270,"offset":1150},"indent":[]}}],"position":{"start":{"line":10,"column":1,"offset":881},"end":{"line":10,"column":270,"offset":1150},"indent":[]}},{"type":"heading","depth":2,"children":[{"type":"text","value":"Creating the File","position":{"start":{"line":12,"column":4,"offset":1155},"end":{"line":12,"column":21,"offset":1172},"indent":[]}}],"position":{"start":{"line":12,"column":1,"offset":1152},"end":{"line":12,"column":21,"offset":1172},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"Let's start by creating a file inside the inhibitors folder called ","position":{"start":{"line":14,"column":1,"offset":1174},"end":{"line":14,"column":68,"offset":1241},"indent":[]}},{"type":"inlineCode","value":"boosted.ts","position":{"start":{"line":14,"column":68,"offset":1241},"end":{"line":14,"column":80,"offset":1253},"indent":[]}},{"type":"text","value":" and paste the following snippet of code:","position":{"start":{"line":14,"column":80,"offset":1253},"end":{"line":14,"column":121,"offset":1294},"indent":[]}}],"position":{"start":{"line":14,"column":1,"offset":1174},"end":{"line":14,"column":121,"offset":1294},"indent":[]}},{"type":"code","lang":"ts","meta":null,"value":"import { botCache } from \"../../mod.ts\";\n\nbotCache.inhibitors.set(\"inhibitorname\", async function (message, command, guild) {\n\t// Your code goes here\n});","position":{"start":{"line":16,"column":1,"offset":1296},"end":{"line":22,"column":4,"offset":1459},"indent":[1,1,1,1,1,1]}},{"type":"paragraph","children":[{"type":"text","value":"Inhibitors can take up to 3 arguments.","position":{"start":{"line":24,"column":1,"offset":1461},"end":{"line":24,"column":39,"offset":1499},"indent":[]}}],"position":{"start":{"line":24,"column":1,"offset":1461},"end":{"line":24,"column":39,"offset":1499},"indent":[]}},{"type":"list","ordered":false,"start":null,"spread":false,"children":[{"type":"listItem","spread":false,"checked":null,"children":[{"type":"paragraph","children":[{"type":"inlineCode","value":"message","position":{"start":{"line":26,"column":3,"offset":1503},"end":{"line":26,"column":12,"offset":1512},"indent":[]}},{"type":"text","value":": The message object that triggered the command.","position":{"start":{"line":26,"column":12,"offset":1512},"end":{"line":26,"column":60,"offset":1560},"indent":[]}}],"position":{"start":{"line":26,"column":3,"offset":1503},"end":{"line":26,"column":60,"offset":1560},"indent":[]}}],"position":{"start":{"line":26,"column":1,"offset":1501},"end":{"line":26,"column":60,"offset":1560},"indent":[]}},{"type":"listItem","spread":false,"checked":null,"children":[{"type":"paragraph","children":[{"type":"inlineCode","value":"command","position":{"start":{"line":27,"column":3,"offset":1563},"end":{"line":27,"column":12,"offset":1572},"indent":[]}},{"type":"text","value":": The command object itself that was triggered.","position":{"start":{"line":27,"column":12,"offset":1572},"end":{"line":27,"column":59,"offset":1619},"indent":[]}}],"position":{"start":{"line":27,"column":3,"offset":1563},"end":{"line":27,"column":59,"offset":1619},"indent":[]}}],"position":{"start":{"line":27,"column":1,"offset":1561},"end":{"line":27,"column":59,"offset":1619},"indent":[]}},{"type":"listItem","spread":false,"checked":null,"children":[{"type":"paragraph","children":[{"type":"inlineCode","value":"guild","position":{"start":{"line":28,"column":3,"offset":1622},"end":{"line":28,"column":10,"offset":1629},"indent":[]}},{"type":"text","value":": The server guild object where this command was ran.","position":{"start":{"line":28,"column":10,"offset":1629},"end":{"line":28,"column":63,"offset":1682},"indent":[]}}],"position":{"start":{"line":28,"column":3,"offset":1622},"end":{"line":28,"column":63,"offset":1682},"indent":[]}}],"position":{"start":{"line":28,"column":1,"offset":1620},"end":{"line":28,"column":63,"offset":1682},"indent":[]}}],"position":{"start":{"line":26,"column":1,"offset":1501},"end":{"line":28,"column":63,"offset":1682},"indent":[1,1]}},{"type":"heading","depth":2,"children":[{"type":"text","value":"Understanding How Inhibitors Function","position":{"start":{"line":30,"column":4,"offset":1687},"end":{"line":30,"column":41,"offset":1724},"indent":[]}}],"position":{"start":{"line":30,"column":1,"offset":1684},"end":{"line":30,"column":41,"offset":1724},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"To block a command you have to return a truthy value.","position":{"start":{"line":32,"column":1,"offset":1726},"end":{"line":32,"column":54,"offset":1779},"indent":[]}}],"position":{"start":{"line":32,"column":1,"offset":1726},"end":{"line":32,"column":54,"offset":1779},"indent":[]}},{"type":"list","ordered":false,"start":null,"spread":false,"children":[{"type":"listItem","spread":false,"checked":null,"children":[{"type":"paragraph","children":[{"type":"strong","children":[{"type":"text","value":"return true;","position":{"start":{"line":33,"column":5,"offset":1784},"end":{"line":33,"column":17,"offset":1796},"indent":[]}}],"position":{"start":{"line":33,"column":3,"offset":1782},"end":{"line":33,"column":19,"offset":1798},"indent":[]}},{"type":"text","value":" If you return true the inhibitor will block the execution of the command.\nTo allow a command return a falsey value.","position":{"start":{"line":33,"column":19,"offset":1798},"end":{"line":34,"column":42,"offset":1914},"indent":[1]}}],"position":{"start":{"line":33,"column":3,"offset":1782},"end":{"line":34,"column":42,"offset":1914},"indent":[1]}}],"position":{"start":{"line":33,"column":1,"offset":1780},"end":{"line":34,"column":42,"offset":1914},"indent":[1]}},{"type":"listItem","spread":false,"checked":null,"children":[{"type":"paragraph","children":[{"type":"strong","children":[{"type":"text","value":"return false;","position":{"start":{"line":35,"column":5,"offset":1919},"end":{"line":35,"column":18,"offset":1932},"indent":[]}}],"position":{"start":{"line":35,"column":3,"offset":1917},"end":{"line":35,"column":20,"offset":1934},"indent":[]}},{"type":"text","value":" If you return false the inhibitor will not block the error.","position":{"start":{"line":35,"column":20,"offset":1934},"end":{"line":35,"column":80,"offset":1994},"indent":[]}}],"position":{"start":{"line":35,"column":3,"offset":1917},"end":{"line":35,"column":80,"offset":1994},"indent":[]}}],"position":{"start":{"line":35,"column":1,"offset":1915},"end":{"line":35,"column":80,"offset":1994},"indent":[]}}],"position":{"start":{"line":33,"column":1,"offset":1780},"end":{"line":35,"column":80,"offset":1994},"indent":[1,1]}},{"type":"code","lang":"ts","meta":null,"value":"// If the command is not VIP only we can allow this command to execute\nif (!command.vipOnly) return false;\n\n// The bot's support server\nconst guild = cache.guilds.get()\n// Check if the user has the vip role on the support server given by patreon\nconst userIsVIP = await isUserVIP(message.author.id)\n// The user is VIP so we can allow this command to be used\nif (userIsVIP) return false;\n\n// The user is NOT VIP so we throw an error\nthrow `The ${command.name} is only allowed for VIP users.`","position":{"start":{"line":38,"column":1,"offset":1997},"end":{"line":51,"column":4,"offset":2497},"indent":[1,1,1,1,1,1,1,1,1,1,1,1,1]}},{"type":"export","value":"export const _frontmatter = {\"title\":\"Creating Inhibitors!\",\"metaTitle\":\"Creating An Inhibitor | Discordeno\",\"metaDescription\":\"Let's create our very own bot with Discordeno!\"}","position":{"start":{"line":54,"column":1,"offset":2500},"end":{"line":54,"column":177,"offset":2676},"indent":[]}}],"position":{"start":{"line":1,"column":1,"offset":0},"end":{"line":54,"column":177,"offset":2676}}},"scopeImports":["import * as React from 'react'"],"scopeIdentifiers":["React"],"body":"function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }\n\nfunction _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }\n\nfunction _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }\n\n/* @jsx mdx */\nvar _frontmatter = {\n \"title\": \"Creating Inhibitors!\",\n \"metaTitle\": \"Creating An Inhibitor | Discordeno\",\n \"metaDescription\": \"Let's create our very own bot with Discordeno!\"\n};\nvar layoutProps = {\n _frontmatter: _frontmatter\n};\nvar MDXLayout = \"wrapper\";\nreturn function MDXContent(_ref) {\n var components = _ref.components,\n props = _objectWithoutProperties(_ref, [\"components\"]);\n\n return mdx(MDXLayout, _extends({}, layoutProps, props, {\n components: components,\n mdxType: \"MDXLayout\"\n }), mdx(\"p\", null, \"Woah! You are almost half way done with understanding all of Discordeno. Amazing isn't it? Something you may have noticed in the last section was there were some options that prevented some commands from running like \", mdx(\"inlineCode\", {\n parentName: \"p\"\n }, \"dmOnly\"), \" or the permission options. we created a setting to prevent the monitor from running in certain channels. What if we wanted to do prevent commands from happening? How would we prevent commands from running?\"), mdx(\"h2\", null, \"What is an Inhibitor?\"), mdx(\"p\", null, \"An Inhibitor is very similar to how monitors work. A monitor runs on every message but an inhibitor runs on every command. Remember all those command options like cooldown, permissions, permissionLevel, nsfw, etc... Each and every one of these options has an inhibitor in that checks commands for these settings.\"), mdx(\"p\", null, \"Let's create our own inhibitor that would prevent commands from being used if the user is not a VIP user.\"), mdx(\"blockquote\", null, mdx(\"p\", {\n parentName: \"blockquote\"\n }, mdx(\"strong\", {\n parentName: \"p\"\n }, \"Note:\"), \" It is important to remember that everything below can be done with a simple permission level as well. We will create our own custom permission levels but for the purposes of this guide and to be able to learn about Inhibitors, we will be using an inhibitor.\")), mdx(\"h2\", null, \"Creating the File\"), mdx(\"p\", null, \"Let's start by creating a file inside the inhibitors folder called \", mdx(\"inlineCode\", {\n parentName: \"p\"\n }, \"boosted.ts\"), \" and paste the following snippet of code:\"), mdx(\"pre\", null, mdx(\"code\", _extends({\n parentName: \"pre\"\n }, {\n \"className\": \"language-ts\"\n }), \"import { botCache } from \\\"../../mod.ts\\\";\\n\\nbotCache.inhibitors.set(\\\"inhibitorname\\\", async function (message, command, guild) {\\n // Your code goes here\\n});\\n\")), mdx(\"p\", null, \"Inhibitors can take up to 3 arguments.\"), mdx(\"ul\", null, mdx(\"li\", {\n parentName: \"ul\"\n }, mdx(\"inlineCode\", {\n parentName: \"li\"\n }, \"message\"), \": The message object that triggered the command.\"), mdx(\"li\", {\n parentName: \"ul\"\n }, mdx(\"inlineCode\", {\n parentName: \"li\"\n }, \"command\"), \": The command object itself that was triggered.\"), mdx(\"li\", {\n parentName: \"ul\"\n }, mdx(\"inlineCode\", {\n parentName: \"li\"\n }, \"guild\"), \": The server guild object where this command was ran.\")), mdx(\"h2\", null, \"Understanding How Inhibitors Function\"), mdx(\"p\", null, \"To block a command you have to return a truthy value.\"), mdx(\"ul\", null, mdx(\"li\", {\n parentName: \"ul\"\n }, mdx(\"strong\", {\n parentName: \"li\"\n }, \"return true;\"), \" If you return true the inhibitor will block the execution of the command.\\nTo allow a command return a falsey value.\"), mdx(\"li\", {\n parentName: \"ul\"\n }, mdx(\"strong\", {\n parentName: \"li\"\n }, \"return false;\"), \" If you return false the inhibitor will not block the error.\")), mdx(\"pre\", null, mdx(\"code\", _extends({\n parentName: \"pre\"\n }, {\n \"className\": \"language-ts\"\n }), \"// If the command is not VIP only we can allow this command to execute\\nif (!command.vipOnly) return false;\\n\\n// The bot's support server\\nconst guild = cache.guilds.get()\\n// Check if the user has the vip role on the support server given by patreon\\nconst userIsVIP = await isUserVIP(message.author.id)\\n// The user is VIP so we can allow this command to be used\\nif (userIsVIP) return false;\\n\\n// The user is NOT VIP so we throw an error\\nthrow `The ${command.name} is only allowed for VIP users.`\\n\")));\n}\n;\nMDXContent.isMDXComponent = true;","rawMDXOutput":"/* @jsx mdx */\nimport { mdx } from '@mdx-js/react';\n/* @jsx mdx */\n\nexport const _frontmatter = {\n \"title\": \"Creating Inhibitors!\",\n \"metaTitle\": \"Creating An Inhibitor | Discordeno\",\n \"metaDescription\": \"Let's create our very own bot with Discordeno!\"\n};\n\nconst layoutProps = {\n _frontmatter\n};\nconst MDXLayout = \"wrapper\"\nexport default function MDXContent({\n components,\n ...props\n}) {\n return \n

{`Woah! You are almost half way done with understanding all of Discordeno. Amazing isn't it? Something you may have noticed in the last section was there were some options that prevented some commands from running like `}{`dmOnly`}{` or the permission options. we created a setting to prevent the monitor from running in certain channels. What if we wanted to do prevent commands from happening? How would we prevent commands from running?`}

\n

{`What is an Inhibitor?`}

\n

{`An Inhibitor is very similar to how monitors work. A monitor runs on every message but an inhibitor runs on every command. Remember all those command options like cooldown, permissions, permissionLevel, nsfw, etc... Each and every one of these options has an inhibitor in that checks commands for these settings.`}

\n

{`Let's create our own inhibitor that would prevent commands from being used if the user is not a VIP user.`}

\n
\n

{`Note:`}{` It is important to remember that everything below can be done with a simple permission level as well. We will create our own custom permission levels but for the purposes of this guide and to be able to learn about Inhibitors, we will be using an inhibitor.`}

\n
\n

{`Creating the File`}

\n

{`Let's start by creating a file inside the inhibitors folder called `}{`boosted.ts`}{` and paste the following snippet of code:`}

\n
{`import { botCache } from \"../../mod.ts\";\n\nbotCache.inhibitors.set(\"inhibitorname\", async function (message, command, guild) {\n    // Your code goes here\n});\n`}
\n

{`Inhibitors can take up to 3 arguments.`}

\n
    \n
  • {`message`}{`: The message object that triggered the command.`}
  • \n
  • {`command`}{`: The command object itself that was triggered.`}
  • \n
  • {`guild`}{`: The server guild object where this command was ran.`}
  • \n
\n

{`Understanding How Inhibitors Function`}

\n

{`To block a command you have to return a truthy value.`}

\n
    \n
  • {`return true;`}{` If you return true the inhibitor will block the execution of the command.\nTo allow a command return a falsey value.`}
  • \n
  • {`return false;`}{` If you return false the inhibitor will not block the error.`}
  • \n
\n
{`// If the command is not VIP only we can allow this command to execute\nif (!command.vipOnly) return false;\n\n// The bot's support server\nconst guild = cache.guilds.get()\n// Check if the user has the vip role on the support server given by patreon\nconst userIsVIP = await isUserVIP(message.author.id)\n// The user is VIP so we can allow this command to be used\nif (userIsVIP) return false;\n\n// The user is NOT VIP so we throw an error\nthrow \\`The \\${command.name} is only allowed for VIP users.\\`\n`}
\n\n
;\n}\n\n;\nMDXContent.isMDXComponent = true;"}} \ No newline at end of file diff --git a/docs/.cache/caches/gatsby-plugin-mdx/diskstore-c3aca1602f527e43d4c80728e4432b73.json b/docs/.cache/caches/gatsby-plugin-mdx/diskstore-c3aca1602f527e43d4c80728e4432b73.json new file mode 100644 index 000000000..e48b28dc3 --- /dev/null +++ b/docs/.cache/caches/gatsby-plugin-mdx/diskstore-c3aca1602f527e43d4c80728e4432b73.json @@ -0,0 +1 @@ +{"expireTime":9007200851634338000,"key":"gatsby-plugin-mdx-entire-payload-304172247c782ffa08412e9a9e2abc7f-","val":{"mdast":{"type":"root","children":[{"type":"paragraph","children":[{"type":"text","value":"Woah! You are almost half way done with understanding all of Discordeno. Amazing isn't it? Something you may have noticed in the last section was there were some options that prevented some commands from running like ","position":{"start":{"line":2,"column":1,"offset":1},"end":{"line":2,"column":218,"offset":218},"indent":[]}},{"type":"inlineCode","value":"dmOnly","position":{"start":{"line":2,"column":218,"offset":218},"end":{"line":2,"column":226,"offset":226},"indent":[]}},{"type":"text","value":" or the permission options. we created a setting to prevent the monitor from running in certain channels. What if we wanted to do prevent commands from happening? How would we prevent commands from running?","position":{"start":{"line":2,"column":226,"offset":226},"end":{"line":2,"column":432,"offset":432},"indent":[]}}],"position":{"start":{"line":2,"column":1,"offset":1},"end":{"line":2,"column":432,"offset":432},"indent":[]}},{"type":"heading","depth":2,"children":[{"type":"text","value":"What is an Inhibitor?","position":{"start":{"line":4,"column":4,"offset":437},"end":{"line":4,"column":25,"offset":458},"indent":[]}}],"position":{"start":{"line":4,"column":1,"offset":434},"end":{"line":4,"column":25,"offset":458},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"An Inhibitor is very similar to how monitors work. A monitor runs on every message but an inhibitor runs on every command. Remember all those command options like cooldown, permissions, permissionLevel, nsfw, etc... Each and every one of these options has an inhibitor in that checks commands for these settings.","position":{"start":{"line":6,"column":1,"offset":460},"end":{"line":6,"column":313,"offset":772},"indent":[]}}],"position":{"start":{"line":6,"column":1,"offset":460},"end":{"line":6,"column":313,"offset":772},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"Let's create our own inhibitor that would prevent commands from being used if the user is not a VIP user.","position":{"start":{"line":8,"column":1,"offset":774},"end":{"line":8,"column":106,"offset":879},"indent":[]}}],"position":{"start":{"line":8,"column":1,"offset":774},"end":{"line":8,"column":106,"offset":879},"indent":[]}},{"type":"blockquote","children":[{"type":"paragraph","children":[{"type":"strong","children":[{"type":"text","value":"Note:","position":{"start":{"line":10,"column":5,"offset":885},"end":{"line":10,"column":10,"offset":890},"indent":[]}}],"position":{"start":{"line":10,"column":3,"offset":883},"end":{"line":10,"column":12,"offset":892},"indent":[]}},{"type":"text","value":" It is important to remember that everything below can be done with a simple permission level as well. We will create our own custom permission levels but for the purposes of this guide and to be able to learn about Inhibitors, we will be using an inhibitor.","position":{"start":{"line":10,"column":12,"offset":892},"end":{"line":10,"column":270,"offset":1150},"indent":[]}}],"position":{"start":{"line":10,"column":3,"offset":883},"end":{"line":10,"column":270,"offset":1150},"indent":[]}}],"position":{"start":{"line":10,"column":1,"offset":881},"end":{"line":10,"column":270,"offset":1150},"indent":[]}},{"type":"heading","depth":2,"children":[{"type":"text","value":"Creating the File","position":{"start":{"line":12,"column":4,"offset":1155},"end":{"line":12,"column":21,"offset":1172},"indent":[]}}],"position":{"start":{"line":12,"column":1,"offset":1152},"end":{"line":12,"column":21,"offset":1172},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"Let's start by creating a file inside the inhibitors folder called ","position":{"start":{"line":14,"column":1,"offset":1174},"end":{"line":14,"column":68,"offset":1241},"indent":[]}},{"type":"inlineCode","value":"boosted.ts","position":{"start":{"line":14,"column":68,"offset":1241},"end":{"line":14,"column":80,"offset":1253},"indent":[]}},{"type":"text","value":" and paste the following snippet of code:","position":{"start":{"line":14,"column":80,"offset":1253},"end":{"line":14,"column":121,"offset":1294},"indent":[]}}],"position":{"start":{"line":14,"column":1,"offset":1174},"end":{"line":14,"column":121,"offset":1294},"indent":[]}},{"type":"code","lang":"ts","meta":null,"value":"import { botCache } from \"../../mod.ts\";\n\nbotCache.inhibitors.set(\"inhibitorname\", async function (message, command, guild) {\n\t// Your code goes here\n});","position":{"start":{"line":16,"column":1,"offset":1296},"end":{"line":22,"column":4,"offset":1459},"indent":[1,1,1,1,1,1]}},{"type":"paragraph","children":[{"type":"text","value":"Inhibitors can take up to 3 arguments.","position":{"start":{"line":24,"column":1,"offset":1461},"end":{"line":24,"column":39,"offset":1499},"indent":[]}}],"position":{"start":{"line":24,"column":1,"offset":1461},"end":{"line":24,"column":39,"offset":1499},"indent":[]}},{"type":"list","ordered":false,"start":null,"spread":false,"children":[{"type":"listItem","spread":false,"checked":null,"children":[{"type":"paragraph","children":[{"type":"inlineCode","value":"message","position":{"start":{"line":26,"column":3,"offset":1503},"end":{"line":26,"column":12,"offset":1512},"indent":[]}},{"type":"text","value":": The message object that triggered the command.","position":{"start":{"line":26,"column":12,"offset":1512},"end":{"line":26,"column":60,"offset":1560},"indent":[]}}],"position":{"start":{"line":26,"column":3,"offset":1503},"end":{"line":26,"column":60,"offset":1560},"indent":[]}}],"position":{"start":{"line":26,"column":1,"offset":1501},"end":{"line":26,"column":60,"offset":1560},"indent":[]}},{"type":"listItem","spread":false,"checked":null,"children":[{"type":"paragraph","children":[{"type":"inlineCode","value":"command","position":{"start":{"line":27,"column":3,"offset":1563},"end":{"line":27,"column":12,"offset":1572},"indent":[]}},{"type":"text","value":": The command object itself that was triggered.","position":{"start":{"line":27,"column":12,"offset":1572},"end":{"line":27,"column":59,"offset":1619},"indent":[]}}],"position":{"start":{"line":27,"column":3,"offset":1563},"end":{"line":27,"column":59,"offset":1619},"indent":[]}}],"position":{"start":{"line":27,"column":1,"offset":1561},"end":{"line":27,"column":59,"offset":1619},"indent":[]}},{"type":"listItem","spread":false,"checked":null,"children":[{"type":"paragraph","children":[{"type":"inlineCode","value":"guild","position":{"start":{"line":28,"column":3,"offset":1622},"end":{"line":28,"column":10,"offset":1629},"indent":[]}},{"type":"text","value":": The server guild object where this command was ran.","position":{"start":{"line":28,"column":10,"offset":1629},"end":{"line":28,"column":63,"offset":1682},"indent":[]}}],"position":{"start":{"line":28,"column":3,"offset":1622},"end":{"line":28,"column":63,"offset":1682},"indent":[]}}],"position":{"start":{"line":28,"column":1,"offset":1620},"end":{"line":28,"column":63,"offset":1682},"indent":[]}}],"position":{"start":{"line":26,"column":1,"offset":1501},"end":{"line":28,"column":63,"offset":1682},"indent":[1,1]}},{"type":"heading","depth":2,"children":[{"type":"text","value":"Understanding How Inhibitors Function","position":{"start":{"line":30,"column":4,"offset":1687},"end":{"line":30,"column":41,"offset":1724},"indent":[]}}],"position":{"start":{"line":30,"column":1,"offset":1684},"end":{"line":30,"column":41,"offset":1724},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"To block a command you have to return a truthy value.","position":{"start":{"line":32,"column":1,"offset":1726},"end":{"line":32,"column":54,"offset":1779},"indent":[]}}],"position":{"start":{"line":32,"column":1,"offset":1726},"end":{"line":32,"column":54,"offset":1779},"indent":[]}},{"type":"list","ordered":false,"start":null,"spread":false,"children":[{"type":"listItem","spread":false,"checked":null,"children":[{"type":"paragraph","children":[{"type":"strong","children":[{"type":"text","value":"return true;","position":{"start":{"line":33,"column":5,"offset":1784},"end":{"line":33,"column":17,"offset":1796},"indent":[]}}],"position":{"start":{"line":33,"column":3,"offset":1782},"end":{"line":33,"column":19,"offset":1798},"indent":[]}},{"type":"text","value":" If you return true the inhibitor will block the execution of the command.\nTo allow a command return a falsey value.","position":{"start":{"line":33,"column":19,"offset":1798},"end":{"line":34,"column":42,"offset":1914},"indent":[1]}}],"position":{"start":{"line":33,"column":3,"offset":1782},"end":{"line":34,"column":42,"offset":1914},"indent":[1]}}],"position":{"start":{"line":33,"column":1,"offset":1780},"end":{"line":34,"column":42,"offset":1914},"indent":[1]}},{"type":"listItem","spread":false,"checked":null,"children":[{"type":"paragraph","children":[{"type":"strong","children":[{"type":"text","value":"return false;","position":{"start":{"line":35,"column":5,"offset":1919},"end":{"line":35,"column":18,"offset":1932},"indent":[]}}],"position":{"start":{"line":35,"column":3,"offset":1917},"end":{"line":35,"column":20,"offset":1934},"indent":[]}},{"type":"text","value":" If you return false the inhibitor will not block the error.","position":{"start":{"line":35,"column":20,"offset":1934},"end":{"line":35,"column":80,"offset":1994},"indent":[]}}],"position":{"start":{"line":35,"column":3,"offset":1917},"end":{"line":35,"column":80,"offset":1994},"indent":[]}}],"position":{"start":{"line":35,"column":1,"offset":1915},"end":{"line":35,"column":80,"offset":1994},"indent":[]}}],"position":{"start":{"line":33,"column":1,"offset":1780},"end":{"line":35,"column":80,"offset":1994},"indent":[1,1]}},{"type":"code","lang":"ts","meta":null,"value":"// If the command is not VIP only we can allow this command to execute\nif (!command.vipOnly) return false;\n\n// The bot's support server\nconst guild = cache.guilds.get(configs.supportServerID);\n// If the command author is not in the server they won't have the vip role\nconst member = guild.members.get(message.author.id) || await getMember(guild.id, message.author.id);\n// Member doesn't exist so cancel the command\nif (!member) {\n\tsendResponse(message, `sorry, but you can not use the `)\n\treturn true;\n}\n\n// If the user has the vip role on the support server given by patreon allow the command\nif (member.roles.includes(configs.patreonVIPRoleID)) return false;\n\n// Cancel the command since the user does not have vip\nreturn true;","position":{"start":{"line":38,"column":1,"offset":1997},"end":{"line":57,"column":4,"offset":2736},"indent":[1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1]}},{"type":"export","value":"export const _frontmatter = {\"title\":\"Creating Inhibitors!\",\"metaTitle\":\"Creating An Inhibitor | Discordeno\",\"metaDescription\":\"Let's create our very own bot with Discordeno!\"}","position":{"start":{"line":60,"column":1,"offset":2739},"end":{"line":60,"column":177,"offset":2915},"indent":[]}}],"position":{"start":{"line":1,"column":1,"offset":0},"end":{"line":60,"column":177,"offset":2915}}},"scopeImports":["import * as React from 'react'"],"scopeIdentifiers":["React"],"body":"function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }\n\nfunction _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }\n\nfunction _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }\n\n/* @jsx mdx */\nvar _frontmatter = {\n \"title\": \"Creating Inhibitors!\",\n \"metaTitle\": \"Creating An Inhibitor | Discordeno\",\n \"metaDescription\": \"Let's create our very own bot with Discordeno!\"\n};\nvar layoutProps = {\n _frontmatter: _frontmatter\n};\nvar MDXLayout = \"wrapper\";\nreturn function MDXContent(_ref) {\n var components = _ref.components,\n props = _objectWithoutProperties(_ref, [\"components\"]);\n\n return mdx(MDXLayout, _extends({}, layoutProps, props, {\n components: components,\n mdxType: \"MDXLayout\"\n }), mdx(\"p\", null, \"Woah! You are almost half way done with understanding all of Discordeno. Amazing isn't it? Something you may have noticed in the last section was there were some options that prevented some commands from running like \", mdx(\"inlineCode\", {\n parentName: \"p\"\n }, \"dmOnly\"), \" or the permission options. we created a setting to prevent the monitor from running in certain channels. What if we wanted to do prevent commands from happening? How would we prevent commands from running?\"), mdx(\"h2\", null, \"What is an Inhibitor?\"), mdx(\"p\", null, \"An Inhibitor is very similar to how monitors work. A monitor runs on every message but an inhibitor runs on every command. Remember all those command options like cooldown, permissions, permissionLevel, nsfw, etc... Each and every one of these options has an inhibitor in that checks commands for these settings.\"), mdx(\"p\", null, \"Let's create our own inhibitor that would prevent commands from being used if the user is not a VIP user.\"), mdx(\"blockquote\", null, mdx(\"p\", {\n parentName: \"blockquote\"\n }, mdx(\"strong\", {\n parentName: \"p\"\n }, \"Note:\"), \" It is important to remember that everything below can be done with a simple permission level as well. We will create our own custom permission levels but for the purposes of this guide and to be able to learn about Inhibitors, we will be using an inhibitor.\")), mdx(\"h2\", null, \"Creating the File\"), mdx(\"p\", null, \"Let's start by creating a file inside the inhibitors folder called \", mdx(\"inlineCode\", {\n parentName: \"p\"\n }, \"boosted.ts\"), \" and paste the following snippet of code:\"), mdx(\"pre\", null, mdx(\"code\", _extends({\n parentName: \"pre\"\n }, {\n \"className\": \"language-ts\"\n }), \"import { botCache } from \\\"../../mod.ts\\\";\\n\\nbotCache.inhibitors.set(\\\"inhibitorname\\\", async function (message, command, guild) {\\n // Your code goes here\\n});\\n\")), mdx(\"p\", null, \"Inhibitors can take up to 3 arguments.\"), mdx(\"ul\", null, mdx(\"li\", {\n parentName: \"ul\"\n }, mdx(\"inlineCode\", {\n parentName: \"li\"\n }, \"message\"), \": The message object that triggered the command.\"), mdx(\"li\", {\n parentName: \"ul\"\n }, mdx(\"inlineCode\", {\n parentName: \"li\"\n }, \"command\"), \": The command object itself that was triggered.\"), mdx(\"li\", {\n parentName: \"ul\"\n }, mdx(\"inlineCode\", {\n parentName: \"li\"\n }, \"guild\"), \": The server guild object where this command was ran.\")), mdx(\"h2\", null, \"Understanding How Inhibitors Function\"), mdx(\"p\", null, \"To block a command you have to return a truthy value.\"), mdx(\"ul\", null, mdx(\"li\", {\n parentName: \"ul\"\n }, mdx(\"strong\", {\n parentName: \"li\"\n }, \"return true;\"), \" If you return true the inhibitor will block the execution of the command.\\nTo allow a command return a falsey value.\"), mdx(\"li\", {\n parentName: \"ul\"\n }, mdx(\"strong\", {\n parentName: \"li\"\n }, \"return false;\"), \" If you return false the inhibitor will not block the error.\")), mdx(\"pre\", null, mdx(\"code\", _extends({\n parentName: \"pre\"\n }, {\n \"className\": \"language-ts\"\n }), \"// If the command is not VIP only we can allow this command to execute\\nif (!command.vipOnly) return false;\\n\\n// The bot's support server\\nconst guild = cache.guilds.get(configs.supportServerID);\\n// If the command author is not in the server they won't have the vip role\\nconst member = guild.members.get(message.author.id) || await getMember(guild.id, message.author.id);\\n// Member doesn't exist so cancel the command\\nif (!member) {\\n sendResponse(message, `sorry, but you can not use the `)\\n return true;\\n}\\n\\n// If the user has the vip role on the support server given by patreon allow the command\\nif (member.roles.includes(configs.patreonVIPRoleID)) return false;\\n\\n// Cancel the command since the user does not have vip\\nreturn true;\\n\")));\n}\n;\nMDXContent.isMDXComponent = true;","rawMDXOutput":"/* @jsx mdx */\nimport { mdx } from '@mdx-js/react';\n/* @jsx mdx */\n\nexport const _frontmatter = {\n \"title\": \"Creating Inhibitors!\",\n \"metaTitle\": \"Creating An Inhibitor | Discordeno\",\n \"metaDescription\": \"Let's create our very own bot with Discordeno!\"\n};\n\nconst layoutProps = {\n _frontmatter\n};\nconst MDXLayout = \"wrapper\"\nexport default function MDXContent({\n components,\n ...props\n}) {\n return \n

{`Woah! You are almost half way done with understanding all of Discordeno. Amazing isn't it? Something you may have noticed in the last section was there were some options that prevented some commands from running like `}{`dmOnly`}{` or the permission options. we created a setting to prevent the monitor from running in certain channels. What if we wanted to do prevent commands from happening? How would we prevent commands from running?`}

\n

{`What is an Inhibitor?`}

\n

{`An Inhibitor is very similar to how monitors work. A monitor runs on every message but an inhibitor runs on every command. Remember all those command options like cooldown, permissions, permissionLevel, nsfw, etc... Each and every one of these options has an inhibitor in that checks commands for these settings.`}

\n

{`Let's create our own inhibitor that would prevent commands from being used if the user is not a VIP user.`}

\n
\n

{`Note:`}{` It is important to remember that everything below can be done with a simple permission level as well. We will create our own custom permission levels but for the purposes of this guide and to be able to learn about Inhibitors, we will be using an inhibitor.`}

\n
\n

{`Creating the File`}

\n

{`Let's start by creating a file inside the inhibitors folder called `}{`boosted.ts`}{` and paste the following snippet of code:`}

\n
{`import { botCache } from \"../../mod.ts\";\n\nbotCache.inhibitors.set(\"inhibitorname\", async function (message, command, guild) {\n    // Your code goes here\n});\n`}
\n

{`Inhibitors can take up to 3 arguments.`}

\n
    \n
  • {`message`}{`: The message object that triggered the command.`}
  • \n
  • {`command`}{`: The command object itself that was triggered.`}
  • \n
  • {`guild`}{`: The server guild object where this command was ran.`}
  • \n
\n

{`Understanding How Inhibitors Function`}

\n

{`To block a command you have to return a truthy value.`}

\n
    \n
  • {`return true;`}{` If you return true the inhibitor will block the execution of the command.\nTo allow a command return a falsey value.`}
  • \n
  • {`return false;`}{` If you return false the inhibitor will not block the error.`}
  • \n
\n
{`// If the command is not VIP only we can allow this command to execute\nif (!command.vipOnly) return false;\n\n// The bot's support server\nconst guild = cache.guilds.get(configs.supportServerID);\n// If the command author is not in the server they won't have the vip role\nconst member = guild.members.get(message.author.id) || await getMember(guild.id, message.author.id);\n// Member doesn't exist so cancel the command\nif (!member) {\n    sendResponse(message, \\`sorry, but you can not use the \\`)\n    return true;\n}\n\n// If the user has the vip role on the support server given by patreon allow the command\nif (member.roles.includes(configs.patreonVIPRoleID)) return false;\n\n// Cancel the command since the user does not have vip\nreturn true;\n`}
\n\n
;\n}\n\n;\nMDXContent.isMDXComponent = true;"}} \ No newline at end of file diff --git a/docs/.cache/caches/gatsby-plugin-mdx/diskstore-c4b7da4be44fb94a3e299eb2d7b5e869.json b/docs/.cache/caches/gatsby-plugin-mdx/diskstore-c4b7da4be44fb94a3e299eb2d7b5e869.json new file mode 100644 index 000000000..0b5eae548 --- /dev/null +++ b/docs/.cache/caches/gatsby-plugin-mdx/diskstore-c4b7da4be44fb94a3e299eb2d7b5e869.json @@ -0,0 +1 @@ +{"expireTime":9007200851632120000,"key":"gatsby-plugin-mdx-entire-payload-a5a83c9c12701cd0ae630fd67e4eabed-","val":{"mdast":{"type":"root","children":[{"type":"paragraph","children":[{"type":"text","value":"Woah! You are almost half way done with understanding all of Discordeno. Amazing isn't it? Something you may have noticed in the last section was there were some options that prevented some commands from running like ","position":{"start":{"line":2,"column":1,"offset":1},"end":{"line":2,"column":218,"offset":218},"indent":[]}},{"type":"inlineCode","value":"dmOnly","position":{"start":{"line":2,"column":218,"offset":218},"end":{"line":2,"column":226,"offset":226},"indent":[]}},{"type":"text","value":" or the permission options. we created a setting to prevent the monitor from running in certain channels. What if we wanted to do prevent commands from happening? How would we prevent commands from running?","position":{"start":{"line":2,"column":226,"offset":226},"end":{"line":2,"column":432,"offset":432},"indent":[]}}],"position":{"start":{"line":2,"column":1,"offset":1},"end":{"line":2,"column":432,"offset":432},"indent":[]}},{"type":"heading","depth":2,"children":[{"type":"text","value":"What is an Inhibitor?","position":{"start":{"line":4,"column":4,"offset":437},"end":{"line":4,"column":25,"offset":458},"indent":[]}}],"position":{"start":{"line":4,"column":1,"offset":434},"end":{"line":4,"column":25,"offset":458},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"An Inhibitor is very similar to how monitors work. A monitor runs on every message but an inhibitor runs on every command. Remember all those command options like cooldown, permissions, permissionLevel, nsfw, etc... Each and every one of these options has an inhibitor in Klasa core that checks commands for these settings.","position":{"start":{"line":6,"column":1,"offset":460},"end":{"line":6,"column":324,"offset":783},"indent":[]}}],"position":{"start":{"line":6,"column":1,"offset":460},"end":{"line":6,"column":324,"offset":783},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"Let's create our own inhibitor that would prevent commands from being used if the user is not a VIP user.","position":{"start":{"line":8,"column":1,"offset":785},"end":{"line":8,"column":106,"offset":890},"indent":[]}}],"position":{"start":{"line":8,"column":1,"offset":785},"end":{"line":8,"column":106,"offset":890},"indent":[]}},{"type":"blockquote","children":[{"type":"paragraph","children":[{"type":"strong","children":[{"type":"text","value":"Note:","position":{"start":{"line":10,"column":5,"offset":896},"end":{"line":10,"column":10,"offset":901},"indent":[]}}],"position":{"start":{"line":10,"column":3,"offset":894},"end":{"line":10,"column":12,"offset":903},"indent":[]}},{"type":"text","value":" It is important to remember that everything below can be done with a simple permission level as well. We will create our own custom permission levels but for the purposes of this guide and to be able to learn about Inhibitors, we will be using an inhibitor.","position":{"start":{"line":10,"column":12,"offset":903},"end":{"line":10,"column":270,"offset":1161},"indent":[]}}],"position":{"start":{"line":10,"column":3,"offset":894},"end":{"line":10,"column":270,"offset":1161},"indent":[]}}],"position":{"start":{"line":10,"column":1,"offset":892},"end":{"line":10,"column":270,"offset":1161},"indent":[]}},{"type":"export","value":"export const _frontmatter = {\"title\":\"Creating Inhibitors!\",\"metaTitle\":\"Creating An Inhibitor | Discordeno\",\"metaDescription\":\"Let's create our very own bot with Discordeno!\"}","position":{"start":{"line":13,"column":1,"offset":1164},"end":{"line":13,"column":177,"offset":1340},"indent":[]}}],"position":{"start":{"line":1,"column":1,"offset":0},"end":{"line":13,"column":177,"offset":1340}}},"scopeImports":["import * as React from 'react'"],"scopeIdentifiers":["React"],"body":"function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }\n\nfunction _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }\n\nfunction _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }\n\n/* @jsx mdx */\nvar _frontmatter = {\n \"title\": \"Creating Inhibitors!\",\n \"metaTitle\": \"Creating An Inhibitor | Discordeno\",\n \"metaDescription\": \"Let's create our very own bot with Discordeno!\"\n};\nvar layoutProps = {\n _frontmatter: _frontmatter\n};\nvar MDXLayout = \"wrapper\";\nreturn function MDXContent(_ref) {\n var components = _ref.components,\n props = _objectWithoutProperties(_ref, [\"components\"]);\n\n return mdx(MDXLayout, _extends({}, layoutProps, props, {\n components: components,\n mdxType: \"MDXLayout\"\n }), mdx(\"p\", null, \"Woah! You are almost half way done with understanding all of Discordeno. Amazing isn't it? Something you may have noticed in the last section was there were some options that prevented some commands from running like \", mdx(\"inlineCode\", {\n parentName: \"p\"\n }, \"dmOnly\"), \" or the permission options. we created a setting to prevent the monitor from running in certain channels. What if we wanted to do prevent commands from happening? How would we prevent commands from running?\"), mdx(\"h2\", null, \"What is an Inhibitor?\"), mdx(\"p\", null, \"An Inhibitor is very similar to how monitors work. A monitor runs on every message but an inhibitor runs on every command. Remember all those command options like cooldown, permissions, permissionLevel, nsfw, etc... Each and every one of these options has an inhibitor in Klasa core that checks commands for these settings.\"), mdx(\"p\", null, \"Let's create our own inhibitor that would prevent commands from being used if the user is not a VIP user.\"), mdx(\"blockquote\", null, mdx(\"p\", {\n parentName: \"blockquote\"\n }, mdx(\"strong\", {\n parentName: \"p\"\n }, \"Note:\"), \" It is important to remember that everything below can be done with a simple permission level as well. We will create our own custom permission levels but for the purposes of this guide and to be able to learn about Inhibitors, we will be using an inhibitor.\")));\n}\n;\nMDXContent.isMDXComponent = true;","rawMDXOutput":"/* @jsx mdx */\nimport { mdx } from '@mdx-js/react';\n/* @jsx mdx */\n\nexport const _frontmatter = {\n \"title\": \"Creating Inhibitors!\",\n \"metaTitle\": \"Creating An Inhibitor | Discordeno\",\n \"metaDescription\": \"Let's create our very own bot with Discordeno!\"\n};\n\nconst layoutProps = {\n _frontmatter\n};\nconst MDXLayout = \"wrapper\"\nexport default function MDXContent({\n components,\n ...props\n}) {\n return \n

{`Woah! You are almost half way done with understanding all of Discordeno. Amazing isn't it? Something you may have noticed in the last section was there were some options that prevented some commands from running like `}{`dmOnly`}{` or the permission options. we created a setting to prevent the monitor from running in certain channels. What if we wanted to do prevent commands from happening? How would we prevent commands from running?`}

\n

{`What is an Inhibitor?`}

\n

{`An Inhibitor is very similar to how monitors work. A monitor runs on every message but an inhibitor runs on every command. Remember all those command options like cooldown, permissions, permissionLevel, nsfw, etc... Each and every one of these options has an inhibitor in Klasa core that checks commands for these settings.`}

\n

{`Let's create our own inhibitor that would prevent commands from being used if the user is not a VIP user.`}

\n
\n

{`Note:`}{` It is important to remember that everything below can be done with a simple permission level as well. We will create our own custom permission levels but for the purposes of this guide and to be able to learn about Inhibitors, we will be using an inhibitor.`}

\n
\n\n
;\n}\n\n;\nMDXContent.isMDXComponent = true;"}} \ No newline at end of file diff --git a/docs/.cache/caches/gatsby-plugin-mdx/diskstore-c4d657a394d00a7bba2c191b6572ea9c.json b/docs/.cache/caches/gatsby-plugin-mdx/diskstore-c4d657a394d00a7bba2c191b6572ea9c.json new file mode 100644 index 000000000..8014def73 --- /dev/null +++ b/docs/.cache/caches/gatsby-plugin-mdx/diskstore-c4d657a394d00a7bba2c191b6572ea9c.json @@ -0,0 +1 @@ +{"expireTime":9007200851634182000,"key":"gatsby-plugin-mdx-entire-payload-9e8352417ee0ec54391da54200871c14-","val":{"mdast":{"type":"root","children":[{"type":"paragraph","children":[{"type":"text","value":"Woah! You are almost half way done with understanding all of Discordeno. Amazing isn't it? Something you may have noticed in the last section was there were some options that prevented some commands from running like ","position":{"start":{"line":2,"column":1,"offset":1},"end":{"line":2,"column":218,"offset":218},"indent":[]}},{"type":"inlineCode","value":"dmOnly","position":{"start":{"line":2,"column":218,"offset":218},"end":{"line":2,"column":226,"offset":226},"indent":[]}},{"type":"text","value":" or the permission options. we created a setting to prevent the monitor from running in certain channels. What if we wanted to do prevent commands from happening? How would we prevent commands from running?","position":{"start":{"line":2,"column":226,"offset":226},"end":{"line":2,"column":432,"offset":432},"indent":[]}}],"position":{"start":{"line":2,"column":1,"offset":1},"end":{"line":2,"column":432,"offset":432},"indent":[]}},{"type":"heading","depth":2,"children":[{"type":"text","value":"What is an Inhibitor?","position":{"start":{"line":4,"column":4,"offset":437},"end":{"line":4,"column":25,"offset":458},"indent":[]}}],"position":{"start":{"line":4,"column":1,"offset":434},"end":{"line":4,"column":25,"offset":458},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"An Inhibitor is very similar to how monitors work. A monitor runs on every message but an inhibitor runs on every command. Remember all those command options like cooldown, permissions, permissionLevel, nsfw, etc... Each and every one of these options has an inhibitor in that checks commands for these settings.","position":{"start":{"line":6,"column":1,"offset":460},"end":{"line":6,"column":313,"offset":772},"indent":[]}}],"position":{"start":{"line":6,"column":1,"offset":460},"end":{"line":6,"column":313,"offset":772},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"Let's create our own inhibitor that would prevent commands from being used if the user is not a VIP user.","position":{"start":{"line":8,"column":1,"offset":774},"end":{"line":8,"column":106,"offset":879},"indent":[]}}],"position":{"start":{"line":8,"column":1,"offset":774},"end":{"line":8,"column":106,"offset":879},"indent":[]}},{"type":"blockquote","children":[{"type":"paragraph","children":[{"type":"strong","children":[{"type":"text","value":"Note:","position":{"start":{"line":10,"column":5,"offset":885},"end":{"line":10,"column":10,"offset":890},"indent":[]}}],"position":{"start":{"line":10,"column":3,"offset":883},"end":{"line":10,"column":12,"offset":892},"indent":[]}},{"type":"text","value":" It is important to remember that everything below can be done with a simple permission level as well. We will create our own custom permission levels but for the purposes of this guide and to be able to learn about Inhibitors, we will be using an inhibitor.","position":{"start":{"line":10,"column":12,"offset":892},"end":{"line":10,"column":270,"offset":1150},"indent":[]}}],"position":{"start":{"line":10,"column":3,"offset":883},"end":{"line":10,"column":270,"offset":1150},"indent":[]}}],"position":{"start":{"line":10,"column":1,"offset":881},"end":{"line":10,"column":270,"offset":1150},"indent":[]}},{"type":"heading","depth":2,"children":[{"type":"text","value":"Creating the File","position":{"start":{"line":12,"column":4,"offset":1155},"end":{"line":12,"column":21,"offset":1172},"indent":[]}}],"position":{"start":{"line":12,"column":1,"offset":1152},"end":{"line":12,"column":21,"offset":1172},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"Let's start by creating a file inside the inhibitors folder called ","position":{"start":{"line":14,"column":1,"offset":1174},"end":{"line":14,"column":68,"offset":1241},"indent":[]}},{"type":"inlineCode","value":"boosted.ts","position":{"start":{"line":14,"column":68,"offset":1241},"end":{"line":14,"column":80,"offset":1253},"indent":[]}},{"type":"text","value":" and paste the following snippet of code:","position":{"start":{"line":14,"column":80,"offset":1253},"end":{"line":14,"column":121,"offset":1294},"indent":[]}}],"position":{"start":{"line":14,"column":1,"offset":1174},"end":{"line":14,"column":121,"offset":1294},"indent":[]}},{"type":"code","lang":"ts","meta":null,"value":"import { botCache } from \"../../mod.ts\";\n\nbotCache.inhibitors.set(\"inhibitorname\", async function (message, command, guild) {\n\t// Your code goes here\n});","position":{"start":{"line":16,"column":1,"offset":1296},"end":{"line":22,"column":4,"offset":1459},"indent":[1,1,1,1,1,1]}},{"type":"paragraph","children":[{"type":"text","value":"Inhibitors can take up to 3 arguments.","position":{"start":{"line":24,"column":1,"offset":1461},"end":{"line":24,"column":39,"offset":1499},"indent":[]}}],"position":{"start":{"line":24,"column":1,"offset":1461},"end":{"line":24,"column":39,"offset":1499},"indent":[]}},{"type":"list","ordered":false,"start":null,"spread":false,"children":[{"type":"listItem","spread":false,"checked":null,"children":[{"type":"paragraph","children":[{"type":"inlineCode","value":"message","position":{"start":{"line":26,"column":3,"offset":1503},"end":{"line":26,"column":12,"offset":1512},"indent":[]}},{"type":"text","value":": The message object that triggered the command.","position":{"start":{"line":26,"column":12,"offset":1512},"end":{"line":26,"column":60,"offset":1560},"indent":[]}}],"position":{"start":{"line":26,"column":3,"offset":1503},"end":{"line":26,"column":60,"offset":1560},"indent":[]}}],"position":{"start":{"line":26,"column":1,"offset":1501},"end":{"line":26,"column":60,"offset":1560},"indent":[]}},{"type":"listItem","spread":false,"checked":null,"children":[{"type":"paragraph","children":[{"type":"inlineCode","value":"command","position":{"start":{"line":27,"column":3,"offset":1563},"end":{"line":27,"column":12,"offset":1572},"indent":[]}},{"type":"text","value":": The command object itself that was triggered.","position":{"start":{"line":27,"column":12,"offset":1572},"end":{"line":27,"column":59,"offset":1619},"indent":[]}}],"position":{"start":{"line":27,"column":3,"offset":1563},"end":{"line":27,"column":59,"offset":1619},"indent":[]}}],"position":{"start":{"line":27,"column":1,"offset":1561},"end":{"line":27,"column":59,"offset":1619},"indent":[]}},{"type":"listItem","spread":false,"checked":null,"children":[{"type":"paragraph","children":[{"type":"inlineCode","value":"guild","position":{"start":{"line":28,"column":3,"offset":1622},"end":{"line":28,"column":10,"offset":1629},"indent":[]}},{"type":"text","value":": The server guild object where this command was ran.","position":{"start":{"line":28,"column":10,"offset":1629},"end":{"line":28,"column":63,"offset":1682},"indent":[]}}],"position":{"start":{"line":28,"column":3,"offset":1622},"end":{"line":28,"column":63,"offset":1682},"indent":[]}}],"position":{"start":{"line":28,"column":1,"offset":1620},"end":{"line":28,"column":63,"offset":1682},"indent":[]}}],"position":{"start":{"line":26,"column":1,"offset":1501},"end":{"line":28,"column":63,"offset":1682},"indent":[1,1]}},{"type":"heading","depth":2,"children":[{"type":"text","value":"Understanding How Inhibitors Function","position":{"start":{"line":30,"column":4,"offset":1687},"end":{"line":30,"column":41,"offset":1724},"indent":[]}}],"position":{"start":{"line":30,"column":1,"offset":1684},"end":{"line":30,"column":41,"offset":1724},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"To block a command you have to return a truthy value.","position":{"start":{"line":32,"column":1,"offset":1726},"end":{"line":32,"column":54,"offset":1779},"indent":[]}}],"position":{"start":{"line":32,"column":1,"offset":1726},"end":{"line":32,"column":54,"offset":1779},"indent":[]}},{"type":"list","ordered":false,"start":null,"spread":false,"children":[{"type":"listItem","spread":false,"checked":null,"children":[{"type":"paragraph","children":[{"type":"strong","children":[{"type":"text","value":"return true;","position":{"start":{"line":33,"column":5,"offset":1784},"end":{"line":33,"column":17,"offset":1796},"indent":[]}}],"position":{"start":{"line":33,"column":3,"offset":1782},"end":{"line":33,"column":19,"offset":1798},"indent":[]}},{"type":"text","value":" If you return true the inhibitor will block the execution of the command.\nTo allow a command return a falsey value.","position":{"start":{"line":33,"column":19,"offset":1798},"end":{"line":34,"column":42,"offset":1914},"indent":[1]}}],"position":{"start":{"line":33,"column":3,"offset":1782},"end":{"line":34,"column":42,"offset":1914},"indent":[1]}}],"position":{"start":{"line":33,"column":1,"offset":1780},"end":{"line":34,"column":42,"offset":1914},"indent":[1]}},{"type":"listItem","spread":false,"checked":null,"children":[{"type":"paragraph","children":[{"type":"strong","children":[{"type":"text","value":"return false;","position":{"start":{"line":35,"column":5,"offset":1919},"end":{"line":35,"column":18,"offset":1932},"indent":[]}}],"position":{"start":{"line":35,"column":3,"offset":1917},"end":{"line":35,"column":20,"offset":1934},"indent":[]}},{"type":"text","value":" If you return false the inhibitor will not block the error.","position":{"start":{"line":35,"column":20,"offset":1934},"end":{"line":35,"column":80,"offset":1994},"indent":[]}}],"position":{"start":{"line":35,"column":3,"offset":1917},"end":{"line":35,"column":80,"offset":1994},"indent":[]}}],"position":{"start":{"line":35,"column":1,"offset":1915},"end":{"line":35,"column":80,"offset":1994},"indent":[]}}],"position":{"start":{"line":33,"column":1,"offset":1780},"end":{"line":35,"column":80,"offset":1994},"indent":[1,1]}},{"type":"code","lang":"ts","meta":null,"value":"// If the command is not VIP only we can allow this command to execute\nif (!command.vipOnly) return false;\n\n// The bot's support server\nconst guild = cache.guilds.get(configs.supportServerID);\n// If the command author is not in the server they won't have the vip role \nconst member = guild.members.get(message.author.id);\nif (!member) return true;\n// Check if the user has the vip role on the support server given by patreon\nconst userIsVIP = await isUserVIP(message.author.id)\n// The user is VIP so we can allow this command to be used\nif (userIsVIP) return false;\n\n// The user is NOT VIP so we throw an error\nthrow `The ${command.name} is only allowed for VIP users.`","position":{"start":{"line":38,"column":1,"offset":1997},"end":{"line":54,"column":4,"offset":2676},"indent":[1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1]}},{"type":"export","value":"export const _frontmatter = {\"title\":\"Creating Inhibitors!\",\"metaTitle\":\"Creating An Inhibitor | Discordeno\",\"metaDescription\":\"Let's create our very own bot with Discordeno!\"}","position":{"start":{"line":57,"column":1,"offset":2679},"end":{"line":57,"column":177,"offset":2855},"indent":[]}}],"position":{"start":{"line":1,"column":1,"offset":0},"end":{"line":57,"column":177,"offset":2855}}},"scopeImports":["import * as React from 'react'"],"scopeIdentifiers":["React"],"body":"function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }\n\nfunction _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }\n\nfunction _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }\n\n/* @jsx mdx */\nvar _frontmatter = {\n \"title\": \"Creating Inhibitors!\",\n \"metaTitle\": \"Creating An Inhibitor | Discordeno\",\n \"metaDescription\": \"Let's create our very own bot with Discordeno!\"\n};\nvar layoutProps = {\n _frontmatter: _frontmatter\n};\nvar MDXLayout = \"wrapper\";\nreturn function MDXContent(_ref) {\n var components = _ref.components,\n props = _objectWithoutProperties(_ref, [\"components\"]);\n\n return mdx(MDXLayout, _extends({}, layoutProps, props, {\n components: components,\n mdxType: \"MDXLayout\"\n }), mdx(\"p\", null, \"Woah! You are almost half way done with understanding all of Discordeno. Amazing isn't it? Something you may have noticed in the last section was there were some options that prevented some commands from running like \", mdx(\"inlineCode\", {\n parentName: \"p\"\n }, \"dmOnly\"), \" or the permission options. we created a setting to prevent the monitor from running in certain channels. What if we wanted to do prevent commands from happening? How would we prevent commands from running?\"), mdx(\"h2\", null, \"What is an Inhibitor?\"), mdx(\"p\", null, \"An Inhibitor is very similar to how monitors work. A monitor runs on every message but an inhibitor runs on every command. Remember all those command options like cooldown, permissions, permissionLevel, nsfw, etc... Each and every one of these options has an inhibitor in that checks commands for these settings.\"), mdx(\"p\", null, \"Let's create our own inhibitor that would prevent commands from being used if the user is not a VIP user.\"), mdx(\"blockquote\", null, mdx(\"p\", {\n parentName: \"blockquote\"\n }, mdx(\"strong\", {\n parentName: \"p\"\n }, \"Note:\"), \" It is important to remember that everything below can be done with a simple permission level as well. We will create our own custom permission levels but for the purposes of this guide and to be able to learn about Inhibitors, we will be using an inhibitor.\")), mdx(\"h2\", null, \"Creating the File\"), mdx(\"p\", null, \"Let's start by creating a file inside the inhibitors folder called \", mdx(\"inlineCode\", {\n parentName: \"p\"\n }, \"boosted.ts\"), \" and paste the following snippet of code:\"), mdx(\"pre\", null, mdx(\"code\", _extends({\n parentName: \"pre\"\n }, {\n \"className\": \"language-ts\"\n }), \"import { botCache } from \\\"../../mod.ts\\\";\\n\\nbotCache.inhibitors.set(\\\"inhibitorname\\\", async function (message, command, guild) {\\n // Your code goes here\\n});\\n\")), mdx(\"p\", null, \"Inhibitors can take up to 3 arguments.\"), mdx(\"ul\", null, mdx(\"li\", {\n parentName: \"ul\"\n }, mdx(\"inlineCode\", {\n parentName: \"li\"\n }, \"message\"), \": The message object that triggered the command.\"), mdx(\"li\", {\n parentName: \"ul\"\n }, mdx(\"inlineCode\", {\n parentName: \"li\"\n }, \"command\"), \": The command object itself that was triggered.\"), mdx(\"li\", {\n parentName: \"ul\"\n }, mdx(\"inlineCode\", {\n parentName: \"li\"\n }, \"guild\"), \": The server guild object where this command was ran.\")), mdx(\"h2\", null, \"Understanding How Inhibitors Function\"), mdx(\"p\", null, \"To block a command you have to return a truthy value.\"), mdx(\"ul\", null, mdx(\"li\", {\n parentName: \"ul\"\n }, mdx(\"strong\", {\n parentName: \"li\"\n }, \"return true;\"), \" If you return true the inhibitor will block the execution of the command.\\nTo allow a command return a falsey value.\"), mdx(\"li\", {\n parentName: \"ul\"\n }, mdx(\"strong\", {\n parentName: \"li\"\n }, \"return false;\"), \" If you return false the inhibitor will not block the error.\")), mdx(\"pre\", null, mdx(\"code\", _extends({\n parentName: \"pre\"\n }, {\n \"className\": \"language-ts\"\n }), \"// If the command is not VIP only we can allow this command to execute\\nif (!command.vipOnly) return false;\\n\\n// The bot's support server\\nconst guild = cache.guilds.get(configs.supportServerID);\\n// If the command author is not in the server they won't have the vip role \\nconst member = guild.members.get(message.author.id);\\nif (!member) return true;\\n// Check if the user has the vip role on the support server given by patreon\\nconst userIsVIP = await isUserVIP(message.author.id)\\n// The user is VIP so we can allow this command to be used\\nif (userIsVIP) return false;\\n\\n// The user is NOT VIP so we throw an error\\nthrow `The ${command.name} is only allowed for VIP users.`\\n\")));\n}\n;\nMDXContent.isMDXComponent = true;","rawMDXOutput":"/* @jsx mdx */\nimport { mdx } from '@mdx-js/react';\n/* @jsx mdx */\n\nexport const _frontmatter = {\n \"title\": \"Creating Inhibitors!\",\n \"metaTitle\": \"Creating An Inhibitor | Discordeno\",\n \"metaDescription\": \"Let's create our very own bot with Discordeno!\"\n};\n\nconst layoutProps = {\n _frontmatter\n};\nconst MDXLayout = \"wrapper\"\nexport default function MDXContent({\n components,\n ...props\n}) {\n return \n

{`Woah! You are almost half way done with understanding all of Discordeno. Amazing isn't it? Something you may have noticed in the last section was there were some options that prevented some commands from running like `}{`dmOnly`}{` or the permission options. we created a setting to prevent the monitor from running in certain channels. What if we wanted to do prevent commands from happening? How would we prevent commands from running?`}

\n

{`What is an Inhibitor?`}

\n

{`An Inhibitor is very similar to how monitors work. A monitor runs on every message but an inhibitor runs on every command. Remember all those command options like cooldown, permissions, permissionLevel, nsfw, etc... Each and every one of these options has an inhibitor in that checks commands for these settings.`}

\n

{`Let's create our own inhibitor that would prevent commands from being used if the user is not a VIP user.`}

\n
\n

{`Note:`}{` It is important to remember that everything below can be done with a simple permission level as well. We will create our own custom permission levels but for the purposes of this guide and to be able to learn about Inhibitors, we will be using an inhibitor.`}

\n
\n

{`Creating the File`}

\n

{`Let's start by creating a file inside the inhibitors folder called `}{`boosted.ts`}{` and paste the following snippet of code:`}

\n
{`import { botCache } from \"../../mod.ts\";\n\nbotCache.inhibitors.set(\"inhibitorname\", async function (message, command, guild) {\n    // Your code goes here\n});\n`}
\n

{`Inhibitors can take up to 3 arguments.`}

\n
    \n
  • {`message`}{`: The message object that triggered the command.`}
  • \n
  • {`command`}{`: The command object itself that was triggered.`}
  • \n
  • {`guild`}{`: The server guild object where this command was ran.`}
  • \n
\n

{`Understanding How Inhibitors Function`}

\n

{`To block a command you have to return a truthy value.`}

\n
    \n
  • {`return true;`}{` If you return true the inhibitor will block the execution of the command.\nTo allow a command return a falsey value.`}
  • \n
  • {`return false;`}{` If you return false the inhibitor will not block the error.`}
  • \n
\n
{`// If the command is not VIP only we can allow this command to execute\nif (!command.vipOnly) return false;\n\n// The bot's support server\nconst guild = cache.guilds.get(configs.supportServerID);\n// If the command author is not in the server they won't have the vip role \nconst member = guild.members.get(message.author.id);\nif (!member) return true;\n// Check if the user has the vip role on the support server given by patreon\nconst userIsVIP = await isUserVIP(message.author.id)\n// The user is VIP so we can allow this command to be used\nif (userIsVIP) return false;\n\n// The user is NOT VIP so we throw an error\nthrow \\`The \\${command.name} is only allowed for VIP users.\\`\n`}
\n\n
;\n}\n\n;\nMDXContent.isMDXComponent = true;"}} \ No newline at end of file diff --git a/docs/.cache/caches/gatsby-plugin-mdx/diskstore-c5964f96ac27ef706978573c962d5b28.json b/docs/.cache/caches/gatsby-plugin-mdx/diskstore-c5964f96ac27ef706978573c962d5b28.json new file mode 100644 index 000000000..c02881999 --- /dev/null +++ b/docs/.cache/caches/gatsby-plugin-mdx/diskstore-c5964f96ac27ef706978573c962d5b28.json @@ -0,0 +1 @@ +{"expireTime":9007200851634335000,"key":"gatsby-plugin-mdx-entire-payload-de9d16bd438171c60a4b4cfdac5f600c-","val":{"mdast":{"type":"root","children":[{"type":"paragraph","children":[{"type":"text","value":"Woah! You are almost half way done with understanding all of Discordeno. Amazing isn't it? Something you may have noticed in the last section was there were some options that prevented some commands from running like ","position":{"start":{"line":2,"column":1,"offset":1},"end":{"line":2,"column":218,"offset":218},"indent":[]}},{"type":"inlineCode","value":"dmOnly","position":{"start":{"line":2,"column":218,"offset":218},"end":{"line":2,"column":226,"offset":226},"indent":[]}},{"type":"text","value":" or the permission options. we created a setting to prevent the monitor from running in certain channels. What if we wanted to do prevent commands from happening? How would we prevent commands from running?","position":{"start":{"line":2,"column":226,"offset":226},"end":{"line":2,"column":432,"offset":432},"indent":[]}}],"position":{"start":{"line":2,"column":1,"offset":1},"end":{"line":2,"column":432,"offset":432},"indent":[]}},{"type":"heading","depth":2,"children":[{"type":"text","value":"What is an Inhibitor?","position":{"start":{"line":4,"column":4,"offset":437},"end":{"line":4,"column":25,"offset":458},"indent":[]}}],"position":{"start":{"line":4,"column":1,"offset":434},"end":{"line":4,"column":25,"offset":458},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"An Inhibitor is very similar to how monitors work. A monitor runs on every message but an inhibitor runs on every command. Remember all those command options like cooldown, permissions, permissionLevel, nsfw, etc... Each and every one of these options has an inhibitor in that checks commands for these settings.","position":{"start":{"line":6,"column":1,"offset":460},"end":{"line":6,"column":313,"offset":772},"indent":[]}}],"position":{"start":{"line":6,"column":1,"offset":460},"end":{"line":6,"column":313,"offset":772},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"Let's create our own inhibitor that would prevent commands from being used if the user is not a VIP user.","position":{"start":{"line":8,"column":1,"offset":774},"end":{"line":8,"column":106,"offset":879},"indent":[]}}],"position":{"start":{"line":8,"column":1,"offset":774},"end":{"line":8,"column":106,"offset":879},"indent":[]}},{"type":"blockquote","children":[{"type":"paragraph","children":[{"type":"strong","children":[{"type":"text","value":"Note:","position":{"start":{"line":10,"column":5,"offset":885},"end":{"line":10,"column":10,"offset":890},"indent":[]}}],"position":{"start":{"line":10,"column":3,"offset":883},"end":{"line":10,"column":12,"offset":892},"indent":[]}},{"type":"text","value":" It is important to remember that everything below can be done with a simple permission level as well. We will create our own custom permission levels but for the purposes of this guide and to be able to learn about Inhibitors, we will be using an inhibitor.","position":{"start":{"line":10,"column":12,"offset":892},"end":{"line":10,"column":270,"offset":1150},"indent":[]}}],"position":{"start":{"line":10,"column":3,"offset":883},"end":{"line":10,"column":270,"offset":1150},"indent":[]}}],"position":{"start":{"line":10,"column":1,"offset":881},"end":{"line":10,"column":270,"offset":1150},"indent":[]}},{"type":"heading","depth":2,"children":[{"type":"text","value":"Creating the File","position":{"start":{"line":12,"column":4,"offset":1155},"end":{"line":12,"column":21,"offset":1172},"indent":[]}}],"position":{"start":{"line":12,"column":1,"offset":1152},"end":{"line":12,"column":21,"offset":1172},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"Let's start by creating a file inside the inhibitors folder called ","position":{"start":{"line":14,"column":1,"offset":1174},"end":{"line":14,"column":68,"offset":1241},"indent":[]}},{"type":"inlineCode","value":"boosted.ts","position":{"start":{"line":14,"column":68,"offset":1241},"end":{"line":14,"column":80,"offset":1253},"indent":[]}},{"type":"text","value":" and paste the following snippet of code:","position":{"start":{"line":14,"column":80,"offset":1253},"end":{"line":14,"column":121,"offset":1294},"indent":[]}}],"position":{"start":{"line":14,"column":1,"offset":1174},"end":{"line":14,"column":121,"offset":1294},"indent":[]}},{"type":"code","lang":"ts","meta":null,"value":"import { botCache } from \"../../mod.ts\";\n\nbotCache.inhibitors.set(\"inhibitorname\", async function (message, command, guild) {\n\t// Your code goes here\n});","position":{"start":{"line":16,"column":1,"offset":1296},"end":{"line":22,"column":4,"offset":1459},"indent":[1,1,1,1,1,1]}},{"type":"paragraph","children":[{"type":"text","value":"Inhibitors can take up to 3 arguments.","position":{"start":{"line":24,"column":1,"offset":1461},"end":{"line":24,"column":39,"offset":1499},"indent":[]}}],"position":{"start":{"line":24,"column":1,"offset":1461},"end":{"line":24,"column":39,"offset":1499},"indent":[]}},{"type":"list","ordered":false,"start":null,"spread":false,"children":[{"type":"listItem","spread":false,"checked":null,"children":[{"type":"paragraph","children":[{"type":"inlineCode","value":"message","position":{"start":{"line":26,"column":3,"offset":1503},"end":{"line":26,"column":12,"offset":1512},"indent":[]}},{"type":"text","value":": The message object that triggered the command.","position":{"start":{"line":26,"column":12,"offset":1512},"end":{"line":26,"column":60,"offset":1560},"indent":[]}}],"position":{"start":{"line":26,"column":3,"offset":1503},"end":{"line":26,"column":60,"offset":1560},"indent":[]}}],"position":{"start":{"line":26,"column":1,"offset":1501},"end":{"line":26,"column":60,"offset":1560},"indent":[]}},{"type":"listItem","spread":false,"checked":null,"children":[{"type":"paragraph","children":[{"type":"inlineCode","value":"command","position":{"start":{"line":27,"column":3,"offset":1563},"end":{"line":27,"column":12,"offset":1572},"indent":[]}},{"type":"text","value":": The command object itself that was triggered.","position":{"start":{"line":27,"column":12,"offset":1572},"end":{"line":27,"column":59,"offset":1619},"indent":[]}}],"position":{"start":{"line":27,"column":3,"offset":1563},"end":{"line":27,"column":59,"offset":1619},"indent":[]}}],"position":{"start":{"line":27,"column":1,"offset":1561},"end":{"line":27,"column":59,"offset":1619},"indent":[]}},{"type":"listItem","spread":false,"checked":null,"children":[{"type":"paragraph","children":[{"type":"inlineCode","value":"guild","position":{"start":{"line":28,"column":3,"offset":1622},"end":{"line":28,"column":10,"offset":1629},"indent":[]}},{"type":"text","value":": The server guild object where this command was ran.","position":{"start":{"line":28,"column":10,"offset":1629},"end":{"line":28,"column":63,"offset":1682},"indent":[]}}],"position":{"start":{"line":28,"column":3,"offset":1622},"end":{"line":28,"column":63,"offset":1682},"indent":[]}}],"position":{"start":{"line":28,"column":1,"offset":1620},"end":{"line":28,"column":63,"offset":1682},"indent":[]}}],"position":{"start":{"line":26,"column":1,"offset":1501},"end":{"line":28,"column":63,"offset":1682},"indent":[1,1]}},{"type":"heading","depth":2,"children":[{"type":"text","value":"Understanding How Inhibitors Function","position":{"start":{"line":30,"column":4,"offset":1687},"end":{"line":30,"column":41,"offset":1724},"indent":[]}}],"position":{"start":{"line":30,"column":1,"offset":1684},"end":{"line":30,"column":41,"offset":1724},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"To block a command you have to return a truthy value.","position":{"start":{"line":32,"column":1,"offset":1726},"end":{"line":32,"column":54,"offset":1779},"indent":[]}}],"position":{"start":{"line":32,"column":1,"offset":1726},"end":{"line":32,"column":54,"offset":1779},"indent":[]}},{"type":"list","ordered":false,"start":null,"spread":false,"children":[{"type":"listItem","spread":false,"checked":null,"children":[{"type":"paragraph","children":[{"type":"strong","children":[{"type":"text","value":"return true;","position":{"start":{"line":33,"column":5,"offset":1784},"end":{"line":33,"column":17,"offset":1796},"indent":[]}}],"position":{"start":{"line":33,"column":3,"offset":1782},"end":{"line":33,"column":19,"offset":1798},"indent":[]}},{"type":"text","value":" If you return true the inhibitor will block the execution of the command.\nTo allow a command return a falsey value.","position":{"start":{"line":33,"column":19,"offset":1798},"end":{"line":34,"column":42,"offset":1914},"indent":[1]}}],"position":{"start":{"line":33,"column":3,"offset":1782},"end":{"line":34,"column":42,"offset":1914},"indent":[1]}}],"position":{"start":{"line":33,"column":1,"offset":1780},"end":{"line":34,"column":42,"offset":1914},"indent":[1]}},{"type":"listItem","spread":false,"checked":null,"children":[{"type":"paragraph","children":[{"type":"strong","children":[{"type":"text","value":"return false;","position":{"start":{"line":35,"column":5,"offset":1919},"end":{"line":35,"column":18,"offset":1932},"indent":[]}}],"position":{"start":{"line":35,"column":3,"offset":1917},"end":{"line":35,"column":20,"offset":1934},"indent":[]}},{"type":"text","value":" If you return false the inhibitor will not block the error.","position":{"start":{"line":35,"column":20,"offset":1934},"end":{"line":35,"column":80,"offset":1994},"indent":[]}}],"position":{"start":{"line":35,"column":3,"offset":1917},"end":{"line":35,"column":80,"offset":1994},"indent":[]}}],"position":{"start":{"line":35,"column":1,"offset":1915},"end":{"line":35,"column":80,"offset":1994},"indent":[]}}],"position":{"start":{"line":33,"column":1,"offset":1780},"end":{"line":35,"column":80,"offset":1994},"indent":[1,1]}},{"type":"code","lang":"ts","meta":null,"value":"// If the command is not VIP only we can allow this command to execute\nif (!command.vipOnly) return false;\n\n// The bot's support server\nconst guild = cache.guilds.get(configs.supportServerID);\n// If the command author is not in the server they won't have the vip role\nconst member = guild.members.get(message.author.id) || await getMember(guild.id, message.author.id);\n// Member doesn't exist so cancel the command\nif (!member) {\n\tsendResponse(message, `sorry, but you can `)\n\treturn true;\n}\n\n// If the user has the vip role on the support server given by patreon allow the command\nif (member.roles.includes(configs.patreonVIPRoleID)) return false;\n\n// Cancel the command since the user does not have vip\nreturn true;","position":{"start":{"line":38,"column":1,"offset":1997},"end":{"line":57,"column":4,"offset":2724},"indent":[1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1]}},{"type":"export","value":"export const _frontmatter = {\"title\":\"Creating Inhibitors!\",\"metaTitle\":\"Creating An Inhibitor | Discordeno\",\"metaDescription\":\"Let's create our very own bot with Discordeno!\"}","position":{"start":{"line":60,"column":1,"offset":2727},"end":{"line":60,"column":177,"offset":2903},"indent":[]}}],"position":{"start":{"line":1,"column":1,"offset":0},"end":{"line":60,"column":177,"offset":2903}}},"scopeImports":["import * as React from 'react'"],"scopeIdentifiers":["React"],"body":"function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }\n\nfunction _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }\n\nfunction _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }\n\n/* @jsx mdx */\nvar _frontmatter = {\n \"title\": \"Creating Inhibitors!\",\n \"metaTitle\": \"Creating An Inhibitor | Discordeno\",\n \"metaDescription\": \"Let's create our very own bot with Discordeno!\"\n};\nvar layoutProps = {\n _frontmatter: _frontmatter\n};\nvar MDXLayout = \"wrapper\";\nreturn function MDXContent(_ref) {\n var components = _ref.components,\n props = _objectWithoutProperties(_ref, [\"components\"]);\n\n return mdx(MDXLayout, _extends({}, layoutProps, props, {\n components: components,\n mdxType: \"MDXLayout\"\n }), mdx(\"p\", null, \"Woah! You are almost half way done with understanding all of Discordeno. Amazing isn't it? Something you may have noticed in the last section was there were some options that prevented some commands from running like \", mdx(\"inlineCode\", {\n parentName: \"p\"\n }, \"dmOnly\"), \" or the permission options. we created a setting to prevent the monitor from running in certain channels. What if we wanted to do prevent commands from happening? How would we prevent commands from running?\"), mdx(\"h2\", null, \"What is an Inhibitor?\"), mdx(\"p\", null, \"An Inhibitor is very similar to how monitors work. A monitor runs on every message but an inhibitor runs on every command. Remember all those command options like cooldown, permissions, permissionLevel, nsfw, etc... Each and every one of these options has an inhibitor in that checks commands for these settings.\"), mdx(\"p\", null, \"Let's create our own inhibitor that would prevent commands from being used if the user is not a VIP user.\"), mdx(\"blockquote\", null, mdx(\"p\", {\n parentName: \"blockquote\"\n }, mdx(\"strong\", {\n parentName: \"p\"\n }, \"Note:\"), \" It is important to remember that everything below can be done with a simple permission level as well. We will create our own custom permission levels but for the purposes of this guide and to be able to learn about Inhibitors, we will be using an inhibitor.\")), mdx(\"h2\", null, \"Creating the File\"), mdx(\"p\", null, \"Let's start by creating a file inside the inhibitors folder called \", mdx(\"inlineCode\", {\n parentName: \"p\"\n }, \"boosted.ts\"), \" and paste the following snippet of code:\"), mdx(\"pre\", null, mdx(\"code\", _extends({\n parentName: \"pre\"\n }, {\n \"className\": \"language-ts\"\n }), \"import { botCache } from \\\"../../mod.ts\\\";\\n\\nbotCache.inhibitors.set(\\\"inhibitorname\\\", async function (message, command, guild) {\\n // Your code goes here\\n});\\n\")), mdx(\"p\", null, \"Inhibitors can take up to 3 arguments.\"), mdx(\"ul\", null, mdx(\"li\", {\n parentName: \"ul\"\n }, mdx(\"inlineCode\", {\n parentName: \"li\"\n }, \"message\"), \": The message object that triggered the command.\"), mdx(\"li\", {\n parentName: \"ul\"\n }, mdx(\"inlineCode\", {\n parentName: \"li\"\n }, \"command\"), \": The command object itself that was triggered.\"), mdx(\"li\", {\n parentName: \"ul\"\n }, mdx(\"inlineCode\", {\n parentName: \"li\"\n }, \"guild\"), \": The server guild object where this command was ran.\")), mdx(\"h2\", null, \"Understanding How Inhibitors Function\"), mdx(\"p\", null, \"To block a command you have to return a truthy value.\"), mdx(\"ul\", null, mdx(\"li\", {\n parentName: \"ul\"\n }, mdx(\"strong\", {\n parentName: \"li\"\n }, \"return true;\"), \" If you return true the inhibitor will block the execution of the command.\\nTo allow a command return a falsey value.\"), mdx(\"li\", {\n parentName: \"ul\"\n }, mdx(\"strong\", {\n parentName: \"li\"\n }, \"return false;\"), \" If you return false the inhibitor will not block the error.\")), mdx(\"pre\", null, mdx(\"code\", _extends({\n parentName: \"pre\"\n }, {\n \"className\": \"language-ts\"\n }), \"// If the command is not VIP only we can allow this command to execute\\nif (!command.vipOnly) return false;\\n\\n// The bot's support server\\nconst guild = cache.guilds.get(configs.supportServerID);\\n// If the command author is not in the server they won't have the vip role\\nconst member = guild.members.get(message.author.id) || await getMember(guild.id, message.author.id);\\n// Member doesn't exist so cancel the command\\nif (!member) {\\n sendResponse(message, `sorry, but you can `)\\n return true;\\n}\\n\\n// If the user has the vip role on the support server given by patreon allow the command\\nif (member.roles.includes(configs.patreonVIPRoleID)) return false;\\n\\n// Cancel the command since the user does not have vip\\nreturn true;\\n\")));\n}\n;\nMDXContent.isMDXComponent = true;","rawMDXOutput":"/* @jsx mdx */\nimport { mdx } from '@mdx-js/react';\n/* @jsx mdx */\n\nexport const _frontmatter = {\n \"title\": \"Creating Inhibitors!\",\n \"metaTitle\": \"Creating An Inhibitor | Discordeno\",\n \"metaDescription\": \"Let's create our very own bot with Discordeno!\"\n};\n\nconst layoutProps = {\n _frontmatter\n};\nconst MDXLayout = \"wrapper\"\nexport default function MDXContent({\n components,\n ...props\n}) {\n return \n

{`Woah! You are almost half way done with understanding all of Discordeno. Amazing isn't it? Something you may have noticed in the last section was there were some options that prevented some commands from running like `}{`dmOnly`}{` or the permission options. we created a setting to prevent the monitor from running in certain channels. What if we wanted to do prevent commands from happening? How would we prevent commands from running?`}

\n

{`What is an Inhibitor?`}

\n

{`An Inhibitor is very similar to how monitors work. A monitor runs on every message but an inhibitor runs on every command. Remember all those command options like cooldown, permissions, permissionLevel, nsfw, etc... Each and every one of these options has an inhibitor in that checks commands for these settings.`}

\n

{`Let's create our own inhibitor that would prevent commands from being used if the user is not a VIP user.`}

\n
\n

{`Note:`}{` It is important to remember that everything below can be done with a simple permission level as well. We will create our own custom permission levels but for the purposes of this guide and to be able to learn about Inhibitors, we will be using an inhibitor.`}

\n
\n

{`Creating the File`}

\n

{`Let's start by creating a file inside the inhibitors folder called `}{`boosted.ts`}{` and paste the following snippet of code:`}

\n
{`import { botCache } from \"../../mod.ts\";\n\nbotCache.inhibitors.set(\"inhibitorname\", async function (message, command, guild) {\n    // Your code goes here\n});\n`}
\n

{`Inhibitors can take up to 3 arguments.`}

\n
    \n
  • {`message`}{`: The message object that triggered the command.`}
  • \n
  • {`command`}{`: The command object itself that was triggered.`}
  • \n
  • {`guild`}{`: The server guild object where this command was ran.`}
  • \n
\n

{`Understanding How Inhibitors Function`}

\n

{`To block a command you have to return a truthy value.`}

\n
    \n
  • {`return true;`}{` If you return true the inhibitor will block the execution of the command.\nTo allow a command return a falsey value.`}
  • \n
  • {`return false;`}{` If you return false the inhibitor will not block the error.`}
  • \n
\n
{`// If the command is not VIP only we can allow this command to execute\nif (!command.vipOnly) return false;\n\n// The bot's support server\nconst guild = cache.guilds.get(configs.supportServerID);\n// If the command author is not in the server they won't have the vip role\nconst member = guild.members.get(message.author.id) || await getMember(guild.id, message.author.id);\n// Member doesn't exist so cancel the command\nif (!member) {\n    sendResponse(message, \\`sorry, but you can \\`)\n    return true;\n}\n\n// If the user has the vip role on the support server given by patreon allow the command\nif (member.roles.includes(configs.patreonVIPRoleID)) return false;\n\n// Cancel the command since the user does not have vip\nreturn true;\n`}
\n\n
;\n}\n\n;\nMDXContent.isMDXComponent = true;"}} \ No newline at end of file diff --git a/docs/.cache/caches/gatsby-plugin-mdx/diskstore-c73955a38b6ba81c00ac6fab3fe402fc.json b/docs/.cache/caches/gatsby-plugin-mdx/diskstore-c73955a38b6ba81c00ac6fab3fe402fc.json new file mode 100644 index 000000000..16f8bc087 --- /dev/null +++ b/docs/.cache/caches/gatsby-plugin-mdx/diskstore-c73955a38b6ba81c00ac6fab3fe402fc.json @@ -0,0 +1 @@ +{"expireTime":9007200851635209000,"key":"gatsby-plugin-mdx-entire-payload-09a9e16cb5d4dc4cdda123a1f8ffa2d9-","val":{"mdast":{"type":"root","children":[{"type":"paragraph","children":[{"type":"text","value":"Woah! You are almost half way done with understanding all of Discordeno. Amazing isn't it? Something you may have noticed in the last section was when the bot started up you could see a bunch of messages like ","position":{"start":{"line":2,"column":1,"offset":1},"end":{"line":2,"column":210,"offset":210},"indent":[]}},{"type":"inlineCode","value":"Loaded X Commands","position":{"start":{"line":2,"column":210,"offset":210},"end":{"line":2,"column":229,"offset":229},"indent":[]}},{"type":"text","value":" and such. Let's jump into this part now and understand how event handling works in Discordeno.","position":{"start":{"line":2,"column":229,"offset":229},"end":{"line":2,"column":324,"offset":324},"indent":[]}}],"position":{"start":{"line":2,"column":1,"offset":1},"end":{"line":2,"column":324,"offset":324},"indent":[]}},{"type":"heading","depth":2,"children":[{"type":"text","value":"What Is An Event?","position":{"start":{"line":4,"column":4,"offset":329},"end":{"line":4,"column":21,"offset":346},"indent":[]}}],"position":{"start":{"line":4,"column":1,"offset":326},"end":{"line":4,"column":21,"offset":346},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"An event in Discordeno is a function that can be called when a specific event occurs. For the most part, events will usually be the ones that are available from the library ","position":{"start":{"line":6,"column":1,"offset":348},"end":{"line":6,"column":174,"offset":521},"indent":[]}}],"position":{"start":{"line":6,"column":1,"offset":348},"end":{"line":6,"column":174,"offset":521},"indent":[]}},{"type":"export","value":"export const _frontmatter = {\"title\":\"Creating Events!\",\"metaTitle\":\"Creating An Event | Discordeno\",\"metaDescription\":\"Let's create our very own bot with Discordeno!\"}","position":{"start":{"line":9,"column":1,"offset":524},"end":{"line":9,"column":169,"offset":692},"indent":[]}}],"position":{"start":{"line":1,"column":1,"offset":0},"end":{"line":9,"column":169,"offset":692}}},"scopeImports":["import * as React from 'react'"],"scopeIdentifiers":["React"],"body":"function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }\n\nfunction _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }\n\nfunction _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }\n\n/* @jsx mdx */\nvar _frontmatter = {\n \"title\": \"Creating Events!\",\n \"metaTitle\": \"Creating An Event | Discordeno\",\n \"metaDescription\": \"Let's create our very own bot with Discordeno!\"\n};\nvar layoutProps = {\n _frontmatter: _frontmatter\n};\nvar MDXLayout = \"wrapper\";\nreturn function MDXContent(_ref) {\n var components = _ref.components,\n props = _objectWithoutProperties(_ref, [\"components\"]);\n\n return mdx(MDXLayout, _extends({}, layoutProps, props, {\n components: components,\n mdxType: \"MDXLayout\"\n }), mdx(\"p\", null, \"Woah! You are almost half way done with understanding all of Discordeno. Amazing isn't it? Something you may have noticed in the last section was when the bot started up you could see a bunch of messages like \", mdx(\"inlineCode\", {\n parentName: \"p\"\n }, \"Loaded X Commands\"), \" and such. Let's jump into this part now and understand how event handling works in Discordeno.\"), mdx(\"h2\", null, \"What Is An Event?\"), mdx(\"p\", null, \"An event in Discordeno is a function that can be called when a specific event occurs. For the most part, events will usually be the ones that are available from the library \"));\n}\n;\nMDXContent.isMDXComponent = true;","rawMDXOutput":"/* @jsx mdx */\nimport { mdx } from '@mdx-js/react';\n/* @jsx mdx */\n\nexport const _frontmatter = {\n \"title\": \"Creating Events!\",\n \"metaTitle\": \"Creating An Event | Discordeno\",\n \"metaDescription\": \"Let's create our very own bot with Discordeno!\"\n};\n\nconst layoutProps = {\n _frontmatter\n};\nconst MDXLayout = \"wrapper\"\nexport default function MDXContent({\n components,\n ...props\n}) {\n return \n

{`Woah! You are almost half way done with understanding all of Discordeno. Amazing isn't it? Something you may have noticed in the last section was when the bot started up you could see a bunch of messages like `}{`Loaded X Commands`}{` and such. Let's jump into this part now and understand how event handling works in Discordeno.`}

\n

{`What Is An Event?`}

\n

{`An event in Discordeno is a function that can be called when a specific event occurs. For the most part, events will usually be the ones that are available from the library `}

\n\n
;\n}\n\n;\nMDXContent.isMDXComponent = true;"}} \ No newline at end of file diff --git a/docs/.cache/caches/gatsby-plugin-mdx/diskstore-c77e6b93ef93afe695da165a4bea7d70.json b/docs/.cache/caches/gatsby-plugin-mdx/diskstore-c77e6b93ef93afe695da165a4bea7d70.json new file mode 100644 index 000000000..46b091575 --- /dev/null +++ b/docs/.cache/caches/gatsby-plugin-mdx/diskstore-c77e6b93ef93afe695da165a4bea7d70.json @@ -0,0 +1 @@ +{"expireTime":9007200851632147000,"key":"gatsby-plugin-mdx-entire-payload-0ac8fc208486d982d39a0ef366f866d4-","val":{"mdast":{"type":"root","children":[{"type":"paragraph","children":[{"type":"text","value":"Woah! You are almost half way done with understanding all of Discordeno. Amazing isn't it? Something you may have noticed in the last section was there were some options that prevented some commands from running like ","position":{"start":{"line":2,"column":1,"offset":1},"end":{"line":2,"column":218,"offset":218},"indent":[]}},{"type":"inlineCode","value":"dmOnly","position":{"start":{"line":2,"column":218,"offset":218},"end":{"line":2,"column":226,"offset":226},"indent":[]}},{"type":"text","value":" or the permission options. we created a setting to prevent the monitor from running in certain channels. What if we wanted to do prevent commands from happening? How would we prevent commands from running?","position":{"start":{"line":2,"column":226,"offset":226},"end":{"line":2,"column":432,"offset":432},"indent":[]}}],"position":{"start":{"line":2,"column":1,"offset":1},"end":{"line":2,"column":432,"offset":432},"indent":[]}},{"type":"heading","depth":2,"children":[{"type":"text","value":"What is an Inhibitor?","position":{"start":{"line":4,"column":4,"offset":437},"end":{"line":4,"column":25,"offset":458},"indent":[]}}],"position":{"start":{"line":4,"column":1,"offset":434},"end":{"line":4,"column":25,"offset":458},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"An Inhibitor is very similar to how monitors work. A monitor runs on every message but an inhibitor runs on every command. Remember all those command options like cooldown, permissions, permissionLevel, nsfw, etc... Each and every one of these options has an inhibitor in that checks commands for these settings.","position":{"start":{"line":6,"column":1,"offset":460},"end":{"line":6,"column":313,"offset":772},"indent":[]}}],"position":{"start":{"line":6,"column":1,"offset":460},"end":{"line":6,"column":313,"offset":772},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"Let's create our own inhibitor that would prevent commands from being used if the user is not a VIP user.","position":{"start":{"line":8,"column":1,"offset":774},"end":{"line":8,"column":106,"offset":879},"indent":[]}}],"position":{"start":{"line":8,"column":1,"offset":774},"end":{"line":8,"column":106,"offset":879},"indent":[]}},{"type":"blockquote","children":[{"type":"paragraph","children":[{"type":"strong","children":[{"type":"text","value":"Note:","position":{"start":{"line":10,"column":5,"offset":885},"end":{"line":10,"column":10,"offset":890},"indent":[]}}],"position":{"start":{"line":10,"column":3,"offset":883},"end":{"line":10,"column":12,"offset":892},"indent":[]}},{"type":"text","value":" It is important to remember that everything below can be done with a simple permission level as well. We will create our own custom permission levels but for the purposes of this guide and to be able to learn about Inhibitors, we will be using an inhibitor.","position":{"start":{"line":10,"column":12,"offset":892},"end":{"line":10,"column":270,"offset":1150},"indent":[]}}],"position":{"start":{"line":10,"column":3,"offset":883},"end":{"line":10,"column":270,"offset":1150},"indent":[]}}],"position":{"start":{"line":10,"column":1,"offset":881},"end":{"line":10,"column":270,"offset":1150},"indent":[]}},{"type":"export","value":"export const _frontmatter = {\"title\":\"Creating Inhibitors!\",\"metaTitle\":\"Creating An Inhibitor | Discordeno\",\"metaDescription\":\"Let's create our very own bot with Discordeno!\"}","position":{"start":{"line":14,"column":1,"offset":1154},"end":{"line":14,"column":177,"offset":1330},"indent":[]}}],"position":{"start":{"line":1,"column":1,"offset":0},"end":{"line":14,"column":177,"offset":1330}}},"scopeImports":["import * as React from 'react'"],"scopeIdentifiers":["React"],"body":"function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }\n\nfunction _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }\n\nfunction _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }\n\n/* @jsx mdx */\nvar _frontmatter = {\n \"title\": \"Creating Inhibitors!\",\n \"metaTitle\": \"Creating An Inhibitor | Discordeno\",\n \"metaDescription\": \"Let's create our very own bot with Discordeno!\"\n};\nvar layoutProps = {\n _frontmatter: _frontmatter\n};\nvar MDXLayout = \"wrapper\";\nreturn function MDXContent(_ref) {\n var components = _ref.components,\n props = _objectWithoutProperties(_ref, [\"components\"]);\n\n return mdx(MDXLayout, _extends({}, layoutProps, props, {\n components: components,\n mdxType: \"MDXLayout\"\n }), mdx(\"p\", null, \"Woah! You are almost half way done with understanding all of Discordeno. Amazing isn't it? Something you may have noticed in the last section was there were some options that prevented some commands from running like \", mdx(\"inlineCode\", {\n parentName: \"p\"\n }, \"dmOnly\"), \" or the permission options. we created a setting to prevent the monitor from running in certain channels. What if we wanted to do prevent commands from happening? How would we prevent commands from running?\"), mdx(\"h2\", null, \"What is an Inhibitor?\"), mdx(\"p\", null, \"An Inhibitor is very similar to how monitors work. A monitor runs on every message but an inhibitor runs on every command. Remember all those command options like cooldown, permissions, permissionLevel, nsfw, etc... Each and every one of these options has an inhibitor in that checks commands for these settings.\"), mdx(\"p\", null, \"Let's create our own inhibitor that would prevent commands from being used if the user is not a VIP user.\"), mdx(\"blockquote\", null, mdx(\"p\", {\n parentName: \"blockquote\"\n }, mdx(\"strong\", {\n parentName: \"p\"\n }, \"Note:\"), \" It is important to remember that everything below can be done with a simple permission level as well. We will create our own custom permission levels but for the purposes of this guide and to be able to learn about Inhibitors, we will be using an inhibitor.\")));\n}\n;\nMDXContent.isMDXComponent = true;","rawMDXOutput":"/* @jsx mdx */\nimport { mdx } from '@mdx-js/react';\n/* @jsx mdx */\n\nexport const _frontmatter = {\n \"title\": \"Creating Inhibitors!\",\n \"metaTitle\": \"Creating An Inhibitor | Discordeno\",\n \"metaDescription\": \"Let's create our very own bot with Discordeno!\"\n};\n\nconst layoutProps = {\n _frontmatter\n};\nconst MDXLayout = \"wrapper\"\nexport default function MDXContent({\n components,\n ...props\n}) {\n return \n

{`Woah! You are almost half way done with understanding all of Discordeno. Amazing isn't it? Something you may have noticed in the last section was there were some options that prevented some commands from running like `}{`dmOnly`}{` or the permission options. we created a setting to prevent the monitor from running in certain channels. What if we wanted to do prevent commands from happening? How would we prevent commands from running?`}

\n

{`What is an Inhibitor?`}

\n

{`An Inhibitor is very similar to how monitors work. A monitor runs on every message but an inhibitor runs on every command. Remember all those command options like cooldown, permissions, permissionLevel, nsfw, etc... Each and every one of these options has an inhibitor in that checks commands for these settings.`}

\n

{`Let's create our own inhibitor that would prevent commands from being used if the user is not a VIP user.`}

\n
\n

{`Note:`}{` It is important to remember that everything below can be done with a simple permission level as well. We will create our own custom permission levels but for the purposes of this guide and to be able to learn about Inhibitors, we will be using an inhibitor.`}

\n
\n\n
;\n}\n\n;\nMDXContent.isMDXComponent = true;"}} \ No newline at end of file diff --git a/docs/.cache/caches/gatsby-plugin-mdx/diskstore-c799fa361d4435d2813d74ae9e90955b.json b/docs/.cache/caches/gatsby-plugin-mdx/diskstore-c799fa361d4435d2813d74ae9e90955b.json new file mode 100644 index 000000000..7777ad417 --- /dev/null +++ b/docs/.cache/caches/gatsby-plugin-mdx/diskstore-c799fa361d4435d2813d74ae9e90955b.json @@ -0,0 +1 @@ +{"expireTime":9007200851596810000,"key":"gatsby-plugin-mdx-entire-payload-272269c2d49f526a39a25e13f11dac50-","val":{"mdast":{"type":"root","children":[{"type":"export","value":"export const _frontmatter = {\"title\":\"Creating Inhibitors!\",\"metaTitle\":\"Creating A Bot | Discordeno\",\"metaDescription\":\"Let's create our very own bot with Discordeno!\"}","position":{"start":{"line":4,"column":1,"offset":3},"end":{"line":4,"column":170,"offset":172},"indent":[]}}],"position":{"start":{"line":1,"column":1,"offset":0},"end":{"line":4,"column":170,"offset":172}}},"scopeImports":["import * as React from 'react'"],"scopeIdentifiers":["React"],"body":"function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }\n\nfunction _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }\n\nfunction _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }\n\n/* @jsx mdx */\nvar _frontmatter = {\n \"title\": \"Creating Inhibitors!\",\n \"metaTitle\": \"Creating A Bot | Discordeno\",\n \"metaDescription\": \"Let's create our very own bot with Discordeno!\"\n};\nvar layoutProps = {\n _frontmatter: _frontmatter\n};\nvar MDXLayout = \"wrapper\";\nreturn function MDXContent(_ref) {\n var components = _ref.components,\n props = _objectWithoutProperties(_ref, [\"components\"]);\n\n return mdx(MDXLayout, _extends({}, layoutProps, props, {\n components: components,\n mdxType: \"MDXLayout\"\n }));\n}\n;\nMDXContent.isMDXComponent = true;","rawMDXOutput":"/* @jsx mdx */\nimport { mdx } from '@mdx-js/react';\n/* @jsx mdx */\n\nexport const _frontmatter = {\n \"title\": \"Creating Inhibitors!\",\n \"metaTitle\": \"Creating A Bot | Discordeno\",\n \"metaDescription\": \"Let's create our very own bot with Discordeno!\"\n};\n\nconst layoutProps = {\n _frontmatter\n};\nconst MDXLayout = \"wrapper\"\nexport default function MDXContent({\n components,\n ...props\n}) {\n return \n\n ;\n}\n\n;\nMDXContent.isMDXComponent = true;"}} \ No newline at end of file diff --git a/docs/.cache/caches/gatsby-plugin-mdx/diskstore-c955cdaffbf2e74516b25ffb6dd5f47c.json b/docs/.cache/caches/gatsby-plugin-mdx/diskstore-c955cdaffbf2e74516b25ffb6dd5f47c.json new file mode 100644 index 000000000..7fecb42e8 --- /dev/null +++ b/docs/.cache/caches/gatsby-plugin-mdx/diskstore-c955cdaffbf2e74516b25ffb6dd5f47c.json @@ -0,0 +1 @@ +{"expireTime":9007200851635310000,"key":"gatsby-plugin-mdx-entire-payload-2c972badd09db6d4f1e1977e600ecc54-","val":{"mdast":{"type":"root","children":[{"type":"paragraph","children":[{"type":"text","value":"Woah! You are almost half way done with understanding all of Discordeno. Amazing isn't it? Something you may have noticed in the last section was when the bot started up you could see a bunch of messages like ","position":{"start":{"line":2,"column":1,"offset":1},"end":{"line":2,"column":210,"offset":210},"indent":[]}},{"type":"inlineCode","value":"Loaded X Commands","position":{"start":{"line":2,"column":210,"offset":210},"end":{"line":2,"column":229,"offset":229},"indent":[]}},{"type":"text","value":" and such. Let's jump into this part now and understand how event handling works in Discordeno.","position":{"start":{"line":2,"column":229,"offset":229},"end":{"line":2,"column":324,"offset":324},"indent":[]}}],"position":{"start":{"line":2,"column":1,"offset":1},"end":{"line":2,"column":324,"offset":324},"indent":[]}},{"type":"heading","depth":2,"children":[{"type":"text","value":"What Is An Event?","position":{"start":{"line":4,"column":4,"offset":329},"end":{"line":4,"column":21,"offset":346},"indent":[]}}],"position":{"start":{"line":4,"column":1,"offset":326},"end":{"line":4,"column":21,"offset":346},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"An event in Discordeno is a function that can be called when a specific event occurs. For the most part, events will usually be the ones that are available from Discordeno. However, you can create your own custom events as well if you wish.","position":{"start":{"line":6,"column":1,"offset":348},"end":{"line":6,"column":241,"offset":588},"indent":[]}}],"position":{"start":{"line":6,"column":1,"offset":348},"end":{"line":6,"column":241,"offset":588},"indent":[]}},{"type":"heading","depth":2,"children":[{"type":"text","value":"Creating The File","position":{"start":{"line":8,"column":4,"offset":593},"end":{"line":8,"column":21,"offset":610},"indent":[]}}],"position":{"start":{"line":8,"column":1,"offset":590},"end":{"line":8,"column":21,"offset":610},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"Make a new file in the events folder called ","position":{"start":{"line":10,"column":1,"offset":612},"end":{"line":10,"column":45,"offset":656},"indent":[]}},{"type":"inlineCode","value":"discordLog.ts","position":{"start":{"line":10,"column":45,"offset":656},"end":{"line":10,"column":60,"offset":671},"indent":[]}},{"type":"text","value":" that will send a message to a discord channel whenever we get an error so we don't need to always be watching the console to see errors. Once you made the file, go ahead and paste the base event snippet below.","position":{"start":{"line":10,"column":60,"offset":671},"end":{"line":10,"column":270,"offset":881},"indent":[]}}],"position":{"start":{"line":10,"column":1,"offset":612},"end":{"line":10,"column":270,"offset":881},"indent":[]}},{"type":"export","value":"export const _frontmatter = {\"title\":\"Creating Events!\",\"metaTitle\":\"Creating An Event | Discordeno\",\"metaDescription\":\"Let's create our very own bot with Discordeno!\"}","position":{"start":{"line":13,"column":1,"offset":884},"end":{"line":13,"column":169,"offset":1052},"indent":[]}}],"position":{"start":{"line":1,"column":1,"offset":0},"end":{"line":13,"column":169,"offset":1052}}},"scopeImports":["import * as React from 'react'"],"scopeIdentifiers":["React"],"body":"function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }\n\nfunction _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }\n\nfunction _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }\n\n/* @jsx mdx */\nvar _frontmatter = {\n \"title\": \"Creating Events!\",\n \"metaTitle\": \"Creating An Event | Discordeno\",\n \"metaDescription\": \"Let's create our very own bot with Discordeno!\"\n};\nvar layoutProps = {\n _frontmatter: _frontmatter\n};\nvar MDXLayout = \"wrapper\";\nreturn function MDXContent(_ref) {\n var components = _ref.components,\n props = _objectWithoutProperties(_ref, [\"components\"]);\n\n return mdx(MDXLayout, _extends({}, layoutProps, props, {\n components: components,\n mdxType: \"MDXLayout\"\n }), mdx(\"p\", null, \"Woah! You are almost half way done with understanding all of Discordeno. Amazing isn't it? Something you may have noticed in the last section was when the bot started up you could see a bunch of messages like \", mdx(\"inlineCode\", {\n parentName: \"p\"\n }, \"Loaded X Commands\"), \" and such. Let's jump into this part now and understand how event handling works in Discordeno.\"), mdx(\"h2\", null, \"What Is An Event?\"), mdx(\"p\", null, \"An event in Discordeno is a function that can be called when a specific event occurs. For the most part, events will usually be the ones that are available from Discordeno. However, you can create your own custom events as well if you wish.\"), mdx(\"h2\", null, \"Creating The File\"), mdx(\"p\", null, \"Make a new file in the events folder called \", mdx(\"inlineCode\", {\n parentName: \"p\"\n }, \"discordLog.ts\"), \" that will send a message to a discord channel whenever we get an error so we don't need to always be watching the console to see errors. Once you made the file, go ahead and paste the base event snippet below.\"));\n}\n;\nMDXContent.isMDXComponent = true;","rawMDXOutput":"/* @jsx mdx */\nimport { mdx } from '@mdx-js/react';\n/* @jsx mdx */\n\nexport const _frontmatter = {\n \"title\": \"Creating Events!\",\n \"metaTitle\": \"Creating An Event | Discordeno\",\n \"metaDescription\": \"Let's create our very own bot with Discordeno!\"\n};\n\nconst layoutProps = {\n _frontmatter\n};\nconst MDXLayout = \"wrapper\"\nexport default function MDXContent({\n components,\n ...props\n}) {\n return \n

{`Woah! You are almost half way done with understanding all of Discordeno. Amazing isn't it? Something you may have noticed in the last section was when the bot started up you could see a bunch of messages like `}{`Loaded X Commands`}{` and such. Let's jump into this part now and understand how event handling works in Discordeno.`}

\n

{`What Is An Event?`}

\n

{`An event in Discordeno is a function that can be called when a specific event occurs. For the most part, events will usually be the ones that are available from Discordeno. However, you can create your own custom events as well if you wish.`}

\n

{`Creating The File`}

\n

{`Make a new file in the events folder called `}{`discordLog.ts`}{` that will send a message to a discord channel whenever we get an error so we don't need to always be watching the console to see errors. Once you made the file, go ahead and paste the base event snippet below.`}

\n\n
;\n}\n\n;\nMDXContent.isMDXComponent = true;"}} \ No newline at end of file diff --git a/docs/.cache/caches/gatsby-plugin-mdx/diskstore-cc35f6439ecf46b8ca62e054cbe9f9bb.json b/docs/.cache/caches/gatsby-plugin-mdx/diskstore-cc35f6439ecf46b8ca62e054cbe9f9bb.json new file mode 100644 index 000000000..c0d9b22bf --- /dev/null +++ b/docs/.cache/caches/gatsby-plugin-mdx/diskstore-cc35f6439ecf46b8ca62e054cbe9f9bb.json @@ -0,0 +1 @@ +{"expireTime":9007200851596319000,"key":"gatsby-plugin-mdx-entire-payload-aa400604352508ac295c6cc9479374d7-","val":{"mdast":{"type":"root","children":[{"type":"paragraph","children":[{"type":"text","value":"Discordeno will help make Discord bot development much easier. Don't worry, as you go through this guide it will make a lot more sense.","position":{"start":{"line":2,"column":1,"offset":1},"end":{"line":2,"column":136,"offset":136},"indent":[]}}],"position":{"start":{"line":2,"column":1,"offset":1},"end":{"line":2,"column":136,"offset":136},"indent":[]}},{"type":"heading","depth":2,"children":[{"type":"text","value":"Who Made Discordeno?","position":{"start":{"line":4,"column":4,"offset":141},"end":{"line":4,"column":24,"offset":161},"indent":[]}}],"position":{"start":{"line":4,"column":1,"offset":138},"end":{"line":4,"column":24,"offset":161},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"Skillz4Killz. However, there are a lot of other contributors to the project as well. Join the discord server to meet and learn more about the wonderful team!","position":{"start":{"line":6,"column":1,"offset":163},"end":{"line":6,"column":158,"offset":320},"indent":[]}}],"position":{"start":{"line":6,"column":1,"offset":163},"end":{"line":6,"column":158,"offset":320},"indent":[]}},{"type":"heading","depth":2,"children":[{"type":"text","value":"Why You Should Use Discordeno?","position":{"start":{"line":8,"column":4,"offset":325},"end":{"line":8,"column":34,"offset":355},"indent":[]}}],"position":{"start":{"line":8,"column":1,"offset":322},"end":{"line":8,"column":34,"offset":355},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"Discordeno provides you all the tools that you need to make bot development really easy. All the tools are already made for you to just simply copy and use for yourself. We will go through each and every tool in other sections of this guide.","position":{"start":{"line":10,"column":1,"offset":357},"end":{"line":10,"column":242,"offset":598},"indent":[]}}],"position":{"start":{"line":10,"column":1,"offset":357},"end":{"line":10,"column":242,"offset":598},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"As the old saying goes, the best way to learn to ride a bicycle is to actually try riding a bicycle. So let's try out Discordeno.","position":{"start":{"line":12,"column":1,"offset":600},"end":{"line":12,"column":130,"offset":729},"indent":[]}}],"position":{"start":{"line":12,"column":1,"offset":600},"end":{"line":12,"column":130,"offset":729},"indent":[]}},{"type":"heading","depth":2,"children":[{"type":"text","value":"Creating The Bot!","position":{"start":{"line":14,"column":4,"offset":734},"end":{"line":14,"column":21,"offset":751},"indent":[]}}],"position":{"start":{"line":14,"column":1,"offset":731},"end":{"line":14,"column":21,"offset":751},"indent":[]}},{"type":"blockquote","children":[{"type":"paragraph","children":[{"type":"text","value":"This guide is going to assume you already have the basic requirements to make a bot ready. This includes github, git, a code editor like Visual Studio Code. If you don't have these yet please prepare them first before going forward.","position":{"start":{"line":16,"column":3,"offset":755},"end":{"line":16,"column":235,"offset":987},"indent":[]}}],"position":{"start":{"line":16,"column":3,"offset":755},"end":{"line":16,"column":235,"offset":987},"indent":[]}}],"position":{"start":{"line":16,"column":1,"offset":753},"end":{"line":16,"column":235,"offset":987},"indent":[]}},{"type":"list","ordered":false,"start":null,"spread":true,"children":[{"type":"listItem","spread":false,"checked":null,"children":[{"type":"paragraph","children":[{"type":"text","value":"First, create a Discordeno Bot using the ","position":{"start":{"line":18,"column":3,"offset":991},"end":{"line":18,"column":44,"offset":1032},"indent":[]}},{"type":"link","title":null,"url":"https://github.com/Skillz4Killz/Discordeno-bot-template","children":[{"type":"text","value":"Generator Boilerplate","position":{"start":{"line":18,"column":45,"offset":1033},"end":{"line":18,"column":66,"offset":1054},"indent":[]}}],"position":{"start":{"line":18,"column":44,"offset":1032},"end":{"line":18,"column":124,"offset":1112},"indent":[]}},{"type":"text","value":". Give it any name you like. For the purpose of this guide we will call it, Stargate.","position":{"start":{"line":18,"column":124,"offset":1112},"end":{"line":18,"column":209,"offset":1197},"indent":[]}}],"position":{"start":{"line":18,"column":3,"offset":991},"end":{"line":18,"column":209,"offset":1197},"indent":[]}}],"position":{"start":{"line":18,"column":1,"offset":989},"end":{"line":19,"column":1,"offset":1198},"indent":[1]}},{"type":"listItem","spread":false,"checked":null,"children":[{"type":"paragraph","children":[{"type":"text","value":"Then ","position":{"start":{"line":20,"column":3,"offset":1201},"end":{"line":20,"column":8,"offset":1206},"indent":[]}},{"type":"inlineCode","value":"git clone https://github.com/Skillz4Killz/Stargate.git","position":{"start":{"line":20,"column":8,"offset":1206},"end":{"line":20,"column":64,"offset":1262},"indent":[]}}],"position":{"start":{"line":20,"column":3,"offset":1201},"end":{"line":20,"column":64,"offset":1262},"indent":[]}}],"position":{"start":{"line":20,"column":1,"offset":1199},"end":{"line":21,"column":1,"offset":1263},"indent":[1]}},{"type":"listItem","spread":false,"checked":null,"children":[{"type":"paragraph","children":[{"type":"text","value":"When that is done, go ahead and open up the folder with VSC.","position":{"start":{"line":22,"column":3,"offset":1266},"end":{"line":22,"column":63,"offset":1326},"indent":[]}}],"position":{"start":{"line":22,"column":3,"offset":1266},"end":{"line":22,"column":63,"offset":1326},"indent":[]}}],"position":{"start":{"line":22,"column":1,"offset":1264},"end":{"line":22,"column":63,"offset":1326},"indent":[]}},{"type":"listItem","spread":false,"checked":null,"children":[{"type":"paragraph","children":[{"type":"text","value":"Create a new file called ","position":{"start":{"line":23,"column":3,"offset":1329},"end":{"line":23,"column":28,"offset":1354},"indent":[]}},{"type":"inlineCode","value":"configs.ts","position":{"start":{"line":23,"column":28,"offset":1354},"end":{"line":23,"column":40,"offset":1366},"indent":[]}},{"type":"text","value":". Open the ","position":{"start":{"line":23,"column":40,"offset":1366},"end":{"line":23,"column":51,"offset":1377},"indent":[]}},{"type":"inlineCode","value":"configs.example.ts","position":{"start":{"line":23,"column":51,"offset":1377},"end":{"line":23,"column":71,"offset":1397},"indent":[]}},{"type":"text","value":" file and copy everything over.","position":{"start":{"line":23,"column":71,"offset":1397},"end":{"line":23,"column":102,"offset":1428},"indent":[]}}],"position":{"start":{"line":23,"column":3,"offset":1329},"end":{"line":23,"column":102,"offset":1428},"indent":[]}}],"position":{"start":{"line":23,"column":1,"offset":1327},"end":{"line":23,"column":102,"offset":1428},"indent":[]}}],"position":{"start":{"line":18,"column":1,"offset":989},"end":{"line":23,"column":102,"offset":1428},"indent":[1,1,1,1,1]}},{"type":"paragraph","children":[{"type":"text","value":"Let's take a minute to review all the options we have available to us.","position":{"start":{"line":25,"column":1,"offset":1430},"end":{"line":25,"column":71,"offset":1500},"indent":[]}}],"position":{"start":{"line":25,"column":1,"offset":1430},"end":{"line":25,"column":71,"offset":1500},"indent":[]}},{"type":"heading","depth":3,"children":[{"type":"text","value":"Configs File","position":{"start":{"line":27,"column":5,"offset":1506},"end":{"line":27,"column":17,"offset":1518},"indent":[]}}],"position":{"start":{"line":27,"column":1,"offset":1502},"end":{"line":27,"column":17,"offset":1518},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"The ","position":{"start":{"line":29,"column":1,"offset":1520},"end":{"line":29,"column":5,"offset":1524},"indent":[]}},{"type":"inlineCode","value":"configs.ts","position":{"start":{"line":29,"column":5,"offset":1524},"end":{"line":29,"column":17,"offset":1536},"indent":[]}},{"type":"text","value":" file is where you will keep all your secret info you don't want to share with anyone else. As long as ","position":{"start":{"line":29,"column":17,"offset":1536},"end":{"line":29,"column":120,"offset":1639},"indent":[]}},{"type":"inlineCode","value":".gitignore","position":{"start":{"line":29,"column":120,"offset":1639},"end":{"line":29,"column":132,"offset":1651},"indent":[]}},{"type":"text","value":" file is ignoring configs.ts your configurations will be kept private!","position":{"start":{"line":29,"column":132,"offset":1651},"end":{"line":29,"column":202,"offset":1721},"indent":[]}}],"position":{"start":{"line":29,"column":1,"offset":1520},"end":{"line":29,"column":202,"offset":1721},"indent":[]}},{"type":"code","lang":"ts","meta":null,"value":"export const configs = {\n token: \"\",\n prefix: \"!\",\n botListTokens: {\n DISCORD_BOT_ORG: \"\",\n BOTS_ON_DISCORD: \"\",\n DISCORD_BOT_LIST: \"\",\n BOTS_FOR_DISCORD: \"\",\n DISCORD_BOATS: \"\",\n DISCORD_BOTS_GG: \"\",\n DISCORD_BOTS_GROUP: \"\",\n },\n channelIDs: {\n missingTranslation: \"\",\n },\n};","position":{"start":{"line":31,"column":1,"offset":1723},"end":{"line":48,"column":4,"offset":2039},"indent":[1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1]}},{"type":"heading","depth":4,"children":[{"type":"text","value":"Token","position":{"start":{"line":50,"column":6,"offset":2046},"end":{"line":50,"column":11,"offset":2051},"indent":[]}}],"position":{"start":{"line":50,"column":1,"offset":2041},"end":{"line":50,"column":11,"offset":2051},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"First, add your bot token. This is ","position":{"start":{"line":52,"column":1,"offset":2053},"end":{"line":52,"column":36,"offset":2088},"indent":[]}},{"type":"strong","children":[{"type":"text","value":"required","position":{"start":{"line":52,"column":38,"offset":2090},"end":{"line":52,"column":46,"offset":2098},"indent":[]}}],"position":{"start":{"line":52,"column":36,"offset":2088},"end":{"line":52,"column":48,"offset":2100},"indent":[]}},{"type":"text","value":" for the bot to start. Review the ","position":{"start":{"line":52,"column":48,"offset":2100},"end":{"line":52,"column":82,"offset":2134},"indent":[]}},{"type":"link","title":null,"url":"https://discordeno.netlify.app/gettingstarted#creatingyourfirstdiscordbotapplication","children":[{"type":"text","value":"instructions","position":{"start":{"line":52,"column":83,"offset":2135},"end":{"line":52,"column":95,"offset":2147},"indent":[]}}],"position":{"start":{"line":52,"column":82,"offset":2134},"end":{"line":52,"column":182,"offset":2234},"indent":[]}},{"type":"text","value":" if you have not made your token yet.","position":{"start":{"line":52,"column":182,"offset":2234},"end":{"line":52,"column":219,"offset":2271},"indent":[]}}],"position":{"start":{"line":52,"column":1,"offset":2053},"end":{"line":52,"column":219,"offset":2271},"indent":[]}},{"type":"heading","depth":4,"children":[{"type":"text","value":"Prefix","position":{"start":{"line":54,"column":6,"offset":2278},"end":{"line":54,"column":12,"offset":2284},"indent":[]}}],"position":{"start":{"line":54,"column":1,"offset":2273},"end":{"line":54,"column":12,"offset":2284},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"The prefix is where you will set the default prefix for your bot. Don't worry, every server will be able to choose their own prefix but we need a default prefix to start.","position":{"start":{"line":56,"column":1,"offset":2286},"end":{"line":56,"column":171,"offset":2456},"indent":[]}}],"position":{"start":{"line":56,"column":1,"offset":2286},"end":{"line":56,"column":171,"offset":2456},"indent":[]}},{"type":"heading","depth":4,"children":[{"type":"text","value":"Bot Lists Tokens","position":{"start":{"line":58,"column":6,"offset":2463},"end":{"line":58,"column":22,"offset":2479},"indent":[]}}],"position":{"start":{"line":58,"column":1,"offset":2458},"end":{"line":58,"column":22,"offset":2479},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"This section of the file is so you can easily have your bot's statistics updated on all the bot lists out there to help you grow your bot. The code is already written to handle this but you will need to do 3 things for each bot list.","position":{"start":{"line":60,"column":1,"offset":2481},"end":{"line":60,"column":234,"offset":2714},"indent":[]}}],"position":{"start":{"line":60,"column":1,"offset":2481},"end":{"line":60,"column":234,"offset":2714},"indent":[]}},{"type":"list","ordered":true,"start":1,"spread":false,"children":[{"type":"listItem","spread":false,"checked":null,"children":[{"type":"paragraph","children":[{"type":"text","value":"Go to the bot list and add your bot to their website. (Each site has it's own instructions)","position":{"start":{"line":62,"column":4,"offset":2719},"end":{"line":62,"column":95,"offset":2810},"indent":[]}}],"position":{"start":{"line":62,"column":4,"offset":2719},"end":{"line":62,"column":95,"offset":2810},"indent":[]}}],"position":{"start":{"line":62,"column":1,"offset":2716},"end":{"line":62,"column":95,"offset":2810},"indent":[]}},{"type":"listItem","spread":false,"checked":null,"children":[{"type":"paragraph","children":[{"type":"text","value":"Create a token for yourself on each website and paste it in your configs.","position":{"start":{"line":63,"column":4,"offset":2814},"end":{"line":63,"column":77,"offset":2887},"indent":[]}}],"position":{"start":{"line":63,"column":4,"offset":2814},"end":{"line":63,"column":77,"offset":2887},"indent":[]}}],"position":{"start":{"line":63,"column":1,"offset":2811},"end":{"line":63,"column":77,"offset":2887},"indent":[]}},{"type":"listItem","spread":false,"checked":null,"children":[{"type":"paragraph","children":[{"type":"text","value":"Enjoy!","position":{"start":{"line":64,"column":4,"offset":2891},"end":{"line":64,"column":10,"offset":2897},"indent":[]}}],"position":{"start":{"line":64,"column":4,"offset":2891},"end":{"line":64,"column":10,"offset":2897},"indent":[]}}],"position":{"start":{"line":64,"column":1,"offset":2888},"end":{"line":64,"column":10,"offset":2897},"indent":[]}}],"position":{"start":{"line":62,"column":1,"offset":2716},"end":{"line":64,"column":10,"offset":2897},"indent":[1,1]}},{"type":"paragraph","children":[{"type":"text","value":"If you wish to customize the code, you will find the bot list tasks in the tasks folder. Don't worry we will discuss this when we get to the tasks section of the guide.","position":{"start":{"line":66,"column":1,"offset":2899},"end":{"line":66,"column":169,"offset":3067},"indent":[]}}],"position":{"start":{"line":66,"column":1,"offset":2899},"end":{"line":66,"column":169,"offset":3067},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"For now just remember, that Discordeno provides you a built in way to update most discord bot lists.","position":{"start":{"line":68,"column":1,"offset":3069},"end":{"line":68,"column":101,"offset":3169},"indent":[]}}],"position":{"start":{"line":68,"column":1,"offset":3069},"end":{"line":68,"column":101,"offset":3169},"indent":[]}},{"type":"heading","depth":4,"children":[{"type":"text","value":"Channel IDs","position":{"start":{"line":70,"column":6,"offset":3176},"end":{"line":70,"column":17,"offset":3187},"indent":[]}}],"position":{"start":{"line":70,"column":1,"offset":3171},"end":{"line":70,"column":17,"offset":3187},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"The channelIDs section holds the useful for specific features to help give you alerts/notifications. For example, the ","position":{"start":{"line":72,"column":1,"offset":3189},"end":{"line":72,"column":119,"offset":3307},"indent":[]}},{"type":"inlineCode","value":"missingTranslation","position":{"start":{"line":72,"column":119,"offset":3307},"end":{"line":72,"column":139,"offset":3327},"indent":[]}},{"type":"text","value":" channel will be where messages are sent alerting you that somewhere in your code you are trying to use a translation key that you never created.","position":{"start":{"line":72,"column":139,"offset":3327},"end":{"line":72,"column":284,"offset":3472},"indent":[]}}],"position":{"start":{"line":72,"column":1,"offset":3189},"end":{"line":72,"column":284,"offset":3472},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"When you get to around 25,000 Discord servers on your bot, you may want to convert these channel IDs to webhooks.","position":{"start":{"line":74,"column":1,"offset":3474},"end":{"line":74,"column":114,"offset":3587},"indent":[]}}],"position":{"start":{"line":74,"column":1,"offset":3474},"end":{"line":74,"column":114,"offset":3587},"indent":[]}},{"type":"heading","depth":2,"children":[{"type":"text","value":"It's Alive!","position":{"start":{"line":76,"column":4,"offset":3592},"end":{"line":76,"column":15,"offset":3603},"indent":[]}}],"position":{"start":{"line":76,"column":1,"offset":3589},"end":{"line":76,"column":15,"offset":3603},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"Oh my god! You now have a bot with a bunch of features already! You don't believe me? Well, seeing is believing, so start the bot.","position":{"start":{"line":78,"column":1,"offset":3605},"end":{"line":78,"column":131,"offset":3735},"indent":[]}}],"position":{"start":{"line":78,"column":1,"offset":3605},"end":{"line":78,"column":131,"offset":3735},"indent":[]}},{"type":"list","ordered":true,"start":1,"spread":false,"children":[{"type":"listItem","spread":false,"checked":null,"children":[{"type":"paragraph","children":[{"type":"text","value":"Invite your bot to a discord server.","position":{"start":{"line":80,"column":4,"offset":3740},"end":{"line":80,"column":40,"offset":3776},"indent":[]}}],"position":{"start":{"line":80,"column":4,"offset":3740},"end":{"line":80,"column":40,"offset":3776},"indent":[]}}],"position":{"start":{"line":80,"column":1,"offset":3737},"end":{"line":80,"column":40,"offset":3776},"indent":[]}},{"type":"listItem","spread":false,"checked":null,"children":[{"type":"paragraph","children":[{"type":"text","value":"Open up the integrated terminal in VSC using ","position":{"start":{"line":81,"column":4,"offset":3780},"end":{"line":81,"column":49,"offset":3825},"indent":[]}},{"type":"strong","children":[{"type":"text","value":"CTRL + `","position":{"start":{"line":81,"column":51,"offset":3827},"end":{"line":81,"column":59,"offset":3835},"indent":[]}}],"position":{"start":{"line":81,"column":49,"offset":3825},"end":{"line":81,"column":61,"offset":3837},"indent":[]}},{"type":"text","value":". If you use a Mac, replace CTRL with CMD.","position":{"start":{"line":81,"column":61,"offset":3837},"end":{"line":81,"column":103,"offset":3879},"indent":[]}}],"position":{"start":{"line":81,"column":4,"offset":3780},"end":{"line":81,"column":103,"offset":3879},"indent":[]}}],"position":{"start":{"line":81,"column":1,"offset":3777},"end":{"line":81,"column":103,"offset":3879},"indent":[]}},{"type":"listItem","spread":false,"checked":null,"children":[{"type":"paragraph","children":[{"type":"text","value":"Run the script below:","position":{"start":{"line":82,"column":4,"offset":3883},"end":{"line":82,"column":25,"offset":3904},"indent":[]}}],"position":{"start":{"line":82,"column":4,"offset":3883},"end":{"line":82,"column":25,"offset":3904},"indent":[]}}],"position":{"start":{"line":82,"column":1,"offset":3880},"end":{"line":82,"column":25,"offset":3904},"indent":[]}}],"position":{"start":{"line":80,"column":1,"offset":3737},"end":{"line":82,"column":25,"offset":3904},"indent":[1,1]}},{"type":"code","lang":"shell","meta":null,"value":"deno run --allow-net --allow-read mod.ts","position":{"start":{"line":84,"column":1,"offset":3906},"end":{"line":86,"column":4,"offset":3959},"indent":[1,1]}},{"type":"paragraph","children":[{"type":"text","value":"The first time you run it, you may see a lot of files being loaded. This is preparing all the magic behind the scene. Once it is ready, you will see something like this:","position":{"start":{"line":88,"column":1,"offset":3961},"end":{"line":88,"column":170,"offset":4130},"indent":[]}}],"position":{"start":{"line":88,"column":1,"offset":3961},"end":{"line":88,"column":170,"offset":4130},"indent":[]}},{"type":"paragraph","children":[{"type":"image","title":null,"url":"https://i.imgur.com/TOXjLgh.png","alt":"image","position":{"start":{"line":90,"column":1,"offset":4132},"end":{"line":90,"column":42,"offset":4173},"indent":[]}}],"position":{"start":{"line":90,"column":1,"offset":4132},"end":{"line":90,"column":42,"offset":4173},"indent":[]}},{"type":"heading","depth":2,"children":[{"type":"text","value":"Understanding What Discordeno Did","position":{"start":{"line":92,"column":4,"offset":4178},"end":{"line":92,"column":37,"offset":4211},"indent":[]}}],"position":{"start":{"line":92,"column":1,"offset":4175},"end":{"line":92,"column":37,"offset":4211},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"Discordeno includes these commands/folders as they are essential for any discord bot to have in order to meet the Discord Bot Best Practices. It also adds a few things that will help make some things easier to build a bot.","position":{"start":{"line":94,"column":1,"offset":4213},"end":{"line":94,"column":223,"offset":4435},"indent":[]}}],"position":{"start":{"line":94,"column":1,"offset":4213},"end":{"line":94,"column":223,"offset":4435},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"We will dive into these deeper in this guide. Let's take it step by step.","position":{"start":{"line":96,"column":1,"offset":4437},"end":{"line":96,"column":74,"offset":4510},"indent":[]}}],"position":{"start":{"line":96,"column":1,"offset":4437},"end":{"line":96,"column":74,"offset":4510},"indent":[]}},{"type":"export","value":"export const _frontmatter = {\"title\":\"Creating The Bot!\",\"metaTitle\":\"Creating A Bot | Discordeno\",\"metaDescription\":\"Let's create our very own bot with Discordeno!\"}","position":{"start":{"line":99,"column":1,"offset":4513},"end":{"line":99,"column":167,"offset":4679},"indent":[]}}],"position":{"start":{"line":1,"column":1,"offset":0},"end":{"line":99,"column":167,"offset":4679}}},"scopeImports":["import * as React from 'react'"],"scopeIdentifiers":["React"],"body":"function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }\n\nfunction _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }\n\nfunction _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }\n\n/* @jsx mdx */\nvar _frontmatter = {\n \"title\": \"Creating The Bot!\",\n \"metaTitle\": \"Creating A Bot | Discordeno\",\n \"metaDescription\": \"Let's create our very own bot with Discordeno!\"\n};\nvar layoutProps = {\n _frontmatter: _frontmatter\n};\nvar MDXLayout = \"wrapper\";\nreturn function MDXContent(_ref) {\n var components = _ref.components,\n props = _objectWithoutProperties(_ref, [\"components\"]);\n\n return mdx(MDXLayout, _extends({}, layoutProps, props, {\n components: components,\n mdxType: \"MDXLayout\"\n }), mdx(\"p\", null, \"Discordeno will help make Discord bot development much easier. Don't worry, as you go through this guide it will make a lot more sense.\"), mdx(\"h2\", null, \"Who Made Discordeno?\"), mdx(\"p\", null, \"Skillz4Killz. However, there are a lot of other contributors to the project as well. Join the discord server to meet and learn more about the wonderful team!\"), mdx(\"h2\", null, \"Why You Should Use Discordeno?\"), mdx(\"p\", null, \"Discordeno provides you all the tools that you need to make bot development really easy. All the tools are already made for you to just simply copy and use for yourself. We will go through each and every tool in other sections of this guide.\"), mdx(\"p\", null, \"As the old saying goes, the best way to learn to ride a bicycle is to actually try riding a bicycle. So let's try out Discordeno.\"), mdx(\"h2\", null, \"Creating The Bot!\"), mdx(\"blockquote\", null, mdx(\"p\", {\n parentName: \"blockquote\"\n }, \"This guide is going to assume you already have the basic requirements to make a bot ready. This includes github, git, a code editor like Visual Studio Code. If you don't have these yet please prepare them first before going forward.\")), mdx(\"ul\", null, mdx(\"li\", {\n parentName: \"ul\"\n }, mdx(\"p\", {\n parentName: \"li\"\n }, \"First, create a Discordeno Bot using the \", mdx(\"a\", _extends({\n parentName: \"p\"\n }, {\n \"href\": \"https://github.com/Skillz4Killz/Discordeno-bot-template\"\n }), \"Generator Boilerplate\"), \". Give it any name you like. For the purpose of this guide we will call it, Stargate.\")), mdx(\"li\", {\n parentName: \"ul\"\n }, mdx(\"p\", {\n parentName: \"li\"\n }, \"Then \", mdx(\"inlineCode\", {\n parentName: \"p\"\n }, \"git clone https://github.com/Skillz4Killz/Stargate.git\"))), mdx(\"li\", {\n parentName: \"ul\"\n }, mdx(\"p\", {\n parentName: \"li\"\n }, \"When that is done, go ahead and open up the folder with VSC.\")), mdx(\"li\", {\n parentName: \"ul\"\n }, mdx(\"p\", {\n parentName: \"li\"\n }, \"Create a new file called \", mdx(\"inlineCode\", {\n parentName: \"p\"\n }, \"configs.ts\"), \". Open the \", mdx(\"inlineCode\", {\n parentName: \"p\"\n }, \"configs.example.ts\"), \" file and copy everything over.\"))), mdx(\"p\", null, \"Let's take a minute to review all the options we have available to us.\"), mdx(\"h3\", null, \"Configs File\"), mdx(\"p\", null, \"The \", mdx(\"inlineCode\", {\n parentName: \"p\"\n }, \"configs.ts\"), \" file is where you will keep all your secret info you don't want to share with anyone else. As long as \", mdx(\"inlineCode\", {\n parentName: \"p\"\n }, \".gitignore\"), \" file is ignoring configs.ts your configurations will be kept private!\"), mdx(\"pre\", null, mdx(\"code\", _extends({\n parentName: \"pre\"\n }, {\n \"className\": \"language-ts\"\n }), \"export const configs = {\\n token: \\\"\\\",\\n prefix: \\\"!\\\",\\n botListTokens: {\\n DISCORD_BOT_ORG: \\\"\\\",\\n BOTS_ON_DISCORD: \\\"\\\",\\n DISCORD_BOT_LIST: \\\"\\\",\\n BOTS_FOR_DISCORD: \\\"\\\",\\n DISCORD_BOATS: \\\"\\\",\\n DISCORD_BOTS_GG: \\\"\\\",\\n DISCORD_BOTS_GROUP: \\\"\\\",\\n },\\n channelIDs: {\\n missingTranslation: \\\"\\\",\\n },\\n};\\n\")), mdx(\"h4\", null, \"Token\"), mdx(\"p\", null, \"First, add your bot token. This is \", mdx(\"strong\", {\n parentName: \"p\"\n }, \"required\"), \" for the bot to start. Review the \", mdx(\"a\", _extends({\n parentName: \"p\"\n }, {\n \"href\": \"https://discordeno.netlify.app/gettingstarted#creatingyourfirstdiscordbotapplication\"\n }), \"instructions\"), \" if you have not made your token yet.\"), mdx(\"h4\", null, \"Prefix\"), mdx(\"p\", null, \"The prefix is where you will set the default prefix for your bot. Don't worry, every server will be able to choose their own prefix but we need a default prefix to start.\"), mdx(\"h4\", null, \"Bot Lists Tokens\"), mdx(\"p\", null, \"This section of the file is so you can easily have your bot's statistics updated on all the bot lists out there to help you grow your bot. The code is already written to handle this but you will need to do 3 things for each bot list.\"), mdx(\"ol\", null, mdx(\"li\", {\n parentName: \"ol\"\n }, \"Go to the bot list and add your bot to their website. (Each site has it's own instructions)\"), mdx(\"li\", {\n parentName: \"ol\"\n }, \"Create a token for yourself on each website and paste it in your configs.\"), mdx(\"li\", {\n parentName: \"ol\"\n }, \"Enjoy!\")), mdx(\"p\", null, \"If you wish to customize the code, you will find the bot list tasks in the tasks folder. Don't worry we will discuss this when we get to the tasks section of the guide.\"), mdx(\"p\", null, \"For now just remember, that Discordeno provides you a built in way to update most discord bot lists.\"), mdx(\"h4\", null, \"Channel IDs\"), mdx(\"p\", null, \"The channelIDs section holds the useful for specific features to help give you alerts/notifications. For example, the \", mdx(\"inlineCode\", {\n parentName: \"p\"\n }, \"missingTranslation\"), \" channel will be where messages are sent alerting you that somewhere in your code you are trying to use a translation key that you never created.\"), mdx(\"p\", null, \"When you get to around 25,000 Discord servers on your bot, you may want to convert these channel IDs to webhooks.\"), mdx(\"h2\", null, \"It's Alive!\"), mdx(\"p\", null, \"Oh my god! You now have a bot with a bunch of features already! You don't believe me? Well, seeing is believing, so start the bot.\"), mdx(\"ol\", null, mdx(\"li\", {\n parentName: \"ol\"\n }, \"Invite your bot to a discord server.\"), mdx(\"li\", {\n parentName: \"ol\"\n }, \"Open up the integrated terminal in VSC using \", mdx(\"strong\", {\n parentName: \"li\"\n }, \"CTRL + `\"), \". If you use a Mac, replace CTRL with CMD.\"), mdx(\"li\", {\n parentName: \"ol\"\n }, \"Run the script below:\")), mdx(\"pre\", null, mdx(\"code\", _extends({\n parentName: \"pre\"\n }, {\n \"className\": \"language-shell\"\n }), \"deno run --allow-net --allow-read mod.ts\\n\")), mdx(\"p\", null, \"The first time you run it, you may see a lot of files being loaded. This is preparing all the magic behind the scene. Once it is ready, you will see something like this:\"), mdx(\"p\", null, mdx(\"img\", _extends({\n parentName: \"p\"\n }, {\n \"src\": \"https://i.imgur.com/TOXjLgh.png\",\n \"alt\": \"image\"\n }))), mdx(\"h2\", null, \"Understanding What Discordeno Did\"), mdx(\"p\", null, \"Discordeno includes these commands/folders as they are essential for any discord bot to have in order to meet the Discord Bot Best Practices. It also adds a few things that will help make some things easier to build a bot.\"), mdx(\"p\", null, \"We will dive into these deeper in this guide. Let's take it step by step.\"));\n}\n;\nMDXContent.isMDXComponent = true;","rawMDXOutput":"/* @jsx mdx */\nimport { mdx } from '@mdx-js/react';\n/* @jsx mdx */\n\nexport const _frontmatter = {\n \"title\": \"Creating The Bot!\",\n \"metaTitle\": \"Creating A Bot | Discordeno\",\n \"metaDescription\": \"Let's create our very own bot with Discordeno!\"\n};\n\nconst layoutProps = {\n _frontmatter\n};\nconst MDXLayout = \"wrapper\"\nexport default function MDXContent({\n components,\n ...props\n}) {\n return \n

{`Discordeno will help make Discord bot development much easier. Don't worry, as you go through this guide it will make a lot more sense.`}

\n

{`Who Made Discordeno?`}

\n

{`Skillz4Killz. However, there are a lot of other contributors to the project as well. Join the discord server to meet and learn more about the wonderful team!`}

\n

{`Why You Should Use Discordeno?`}

\n

{`Discordeno provides you all the tools that you need to make bot development really easy. All the tools are already made for you to just simply copy and use for yourself. We will go through each and every tool in other sections of this guide.`}

\n

{`As the old saying goes, the best way to learn to ride a bicycle is to actually try riding a bicycle. So let's try out Discordeno.`}

\n

{`Creating The Bot!`}

\n
\n

{`This guide is going to assume you already have the basic requirements to make a bot ready. This includes github, git, a code editor like Visual Studio Code. If you don't have these yet please prepare them first before going forward.`}

\n
\n
    \n
  • \n

    {`First, create a Discordeno Bot using the `}{`Generator Boilerplate`}{`. Give it any name you like. For the purpose of this guide we will call it, Stargate.`}

    \n
  • \n
  • \n

    {`Then `}{`git clone https://github.com/Skillz4Killz/Stargate.git`}

    \n
  • \n
  • \n

    {`When that is done, go ahead and open up the folder with VSC.`}

    \n
  • \n
  • \n

    {`Create a new file called `}{`configs.ts`}{`. Open the `}{`configs.example.ts`}{` file and copy everything over.`}

    \n
  • \n
\n

{`Let's take a minute to review all the options we have available to us.`}

\n

{`Configs File`}

\n

{`The `}{`configs.ts`}{` file is where you will keep all your secret info you don't want to share with anyone else. As long as `}{`.gitignore`}{` file is ignoring configs.ts your configurations will be kept private!`}

\n
{`export const configs = {\n  token: \"\",\n  prefix: \"!\",\n  botListTokens: {\n    DISCORD_BOT_ORG: \"\",\n    BOTS_ON_DISCORD: \"\",\n    DISCORD_BOT_LIST: \"\",\n    BOTS_FOR_DISCORD: \"\",\n    DISCORD_BOATS: \"\",\n    DISCORD_BOTS_GG: \"\",\n    DISCORD_BOTS_GROUP: \"\",\n  },\n  channelIDs: {\n    missingTranslation: \"\",\n  },\n};\n`}
\n

{`Token`}

\n

{`First, add your bot token. This is `}{`required`}{` for the bot to start. Review the `}{`instructions`}{` if you have not made your token yet.`}

\n

{`Prefix`}

\n

{`The prefix is where you will set the default prefix for your bot. Don't worry, every server will be able to choose their own prefix but we need a default prefix to start.`}

\n

{`Bot Lists Tokens`}

\n

{`This section of the file is so you can easily have your bot's statistics updated on all the bot lists out there to help you grow your bot. The code is already written to handle this but you will need to do 3 things for each bot list.`}

\n
    \n
  1. {`Go to the bot list and add your bot to their website. (Each site has it's own instructions)`}
  2. \n
  3. {`Create a token for yourself on each website and paste it in your configs.`}
  4. \n
  5. {`Enjoy!`}
  6. \n
\n

{`If you wish to customize the code, you will find the bot list tasks in the tasks folder. Don't worry we will discuss this when we get to the tasks section of the guide.`}

\n

{`For now just remember, that Discordeno provides you a built in way to update most discord bot lists.`}

\n

{`Channel IDs`}

\n

{`The channelIDs section holds the useful for specific features to help give you alerts/notifications. For example, the `}{`missingTranslation`}{` channel will be where messages are sent alerting you that somewhere in your code you are trying to use a translation key that you never created.`}

\n

{`When you get to around 25,000 Discord servers on your bot, you may want to convert these channel IDs to webhooks.`}

\n

{`It's Alive!`}

\n

{`Oh my god! You now have a bot with a bunch of features already! You don't believe me? Well, seeing is believing, so start the bot.`}

\n
    \n
  1. {`Invite your bot to a discord server.`}
  2. \n
  3. {`Open up the integrated terminal in VSC using `}{`CTRL + \\``}{`. If you use a Mac, replace CTRL with CMD.`}
  4. \n
  5. {`Run the script below:`}
  6. \n
\n
{`deno run --allow-net --allow-read mod.ts\n`}
\n

{`The first time you run it, you may see a lot of files being loaded. This is preparing all the magic behind the scene. Once it is ready, you will see something like this:`}

\n

\n

{`Understanding What Discordeno Did`}

\n

{`Discordeno includes these commands/folders as they are essential for any discord bot to have in order to meet the Discord Bot Best Practices. It also adds a few things that will help make some things easier to build a bot.`}

\n

{`We will dive into these deeper in this guide. Let's take it step by step.`}

\n\n
;\n}\n\n;\nMDXContent.isMDXComponent = true;"}} \ No newline at end of file diff --git a/docs/.cache/caches/gatsby-plugin-mdx/diskstore-ccb8fd4d70cc7606904ce728015a8c91.json b/docs/.cache/caches/gatsby-plugin-mdx/diskstore-ccb8fd4d70cc7606904ce728015a8c91.json new file mode 100644 index 000000000..ab479e9ee --- /dev/null +++ b/docs/.cache/caches/gatsby-plugin-mdx/diskstore-ccb8fd4d70cc7606904ce728015a8c91.json @@ -0,0 +1 @@ +{"expireTime":9007200851634670000,"key":"gatsby-plugin-mdx-entire-payload-12b26e2c5d3d912af74868f93b133f5a-","val":{"mdast":{"type":"root","children":[{"type":"paragraph","children":[{"type":"text","value":"Woah! You are almost half way done with understanding all of Discordeno. Amazing isn't it? Something you may have noticed in the last section was there were some options that prevented some commands from running like ","position":{"start":{"line":2,"column":1,"offset":1},"end":{"line":2,"column":218,"offset":218},"indent":[]}},{"type":"inlineCode","value":"dmOnly","position":{"start":{"line":2,"column":218,"offset":218},"end":{"line":2,"column":226,"offset":226},"indent":[]}},{"type":"text","value":" or the permission options. we created a setting to prevent the monitor from running in certain channels. What if we wanted to do prevent commands from happening? How would we prevent commands from running?","position":{"start":{"line":2,"column":226,"offset":226},"end":{"line":2,"column":432,"offset":432},"indent":[]}}],"position":{"start":{"line":2,"column":1,"offset":1},"end":{"line":2,"column":432,"offset":432},"indent":[]}},{"type":"heading","depth":2,"children":[{"type":"text","value":"What is an Inhibitor?","position":{"start":{"line":4,"column":4,"offset":437},"end":{"line":4,"column":25,"offset":458},"indent":[]}}],"position":{"start":{"line":4,"column":1,"offset":434},"end":{"line":4,"column":25,"offset":458},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"An Inhibitor is very similar to how monitors work. A monitor runs on every message but an inhibitor runs on every command. Remember all those command options like cooldown, permissions, permissionLevel, nsfw, etc... Each and every one of these options has an inhibitor in that checks commands for these settings.","position":{"start":{"line":6,"column":1,"offset":460},"end":{"line":6,"column":313,"offset":772},"indent":[]}}],"position":{"start":{"line":6,"column":1,"offset":460},"end":{"line":6,"column":313,"offset":772},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"Let's create our own inhibitor that would prevent commands from being used if the user is not a VIP user.","position":{"start":{"line":8,"column":1,"offset":774},"end":{"line":8,"column":106,"offset":879},"indent":[]}}],"position":{"start":{"line":8,"column":1,"offset":774},"end":{"line":8,"column":106,"offset":879},"indent":[]}},{"type":"blockquote","children":[{"type":"paragraph","children":[{"type":"strong","children":[{"type":"text","value":"Note:","position":{"start":{"line":10,"column":5,"offset":885},"end":{"line":10,"column":10,"offset":890},"indent":[]}}],"position":{"start":{"line":10,"column":3,"offset":883},"end":{"line":10,"column":12,"offset":892},"indent":[]}},{"type":"text","value":" It is important to remember that everything below can be done with a simple permission level as well. We will create our own custom permission levels but for the purposes of this guide and to be able to learn about Inhibitors, we will be using an inhibitor.","position":{"start":{"line":10,"column":12,"offset":892},"end":{"line":10,"column":270,"offset":1150},"indent":[]}}],"position":{"start":{"line":10,"column":3,"offset":883},"end":{"line":10,"column":270,"offset":1150},"indent":[]}}],"position":{"start":{"line":10,"column":1,"offset":881},"end":{"line":10,"column":270,"offset":1150},"indent":[]}},{"type":"heading","depth":2,"children":[{"type":"text","value":"Creating the File","position":{"start":{"line":12,"column":4,"offset":1155},"end":{"line":12,"column":21,"offset":1172},"indent":[]}}],"position":{"start":{"line":12,"column":1,"offset":1152},"end":{"line":12,"column":21,"offset":1172},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"Let's start by creating a file inside the inhibitors folder called ","position":{"start":{"line":14,"column":1,"offset":1174},"end":{"line":14,"column":68,"offset":1241},"indent":[]}},{"type":"inlineCode","value":"boosted.ts","position":{"start":{"line":14,"column":68,"offset":1241},"end":{"line":14,"column":80,"offset":1253},"indent":[]}},{"type":"text","value":" and paste the following snippet of code:","position":{"start":{"line":14,"column":80,"offset":1253},"end":{"line":14,"column":121,"offset":1294},"indent":[]}}],"position":{"start":{"line":14,"column":1,"offset":1174},"end":{"line":14,"column":121,"offset":1294},"indent":[]}},{"type":"code","lang":"ts","meta":null,"value":"import { botCache } from \"../../mod.ts\";\n\nbotCache.inhibitors.set(\"inhibitorname\", async function (message, command, guild) {\n\t// Your code goes here\n});","position":{"start":{"line":16,"column":1,"offset":1296},"end":{"line":22,"column":4,"offset":1459},"indent":[1,1,1,1,1,1]}},{"type":"paragraph","children":[{"type":"text","value":"Inhibitors can take up to 3 arguments.","position":{"start":{"line":24,"column":1,"offset":1461},"end":{"line":24,"column":39,"offset":1499},"indent":[]}}],"position":{"start":{"line":24,"column":1,"offset":1461},"end":{"line":24,"column":39,"offset":1499},"indent":[]}},{"type":"list","ordered":false,"start":null,"spread":false,"children":[{"type":"listItem","spread":false,"checked":null,"children":[{"type":"paragraph","children":[{"type":"inlineCode","value":"message","position":{"start":{"line":26,"column":3,"offset":1503},"end":{"line":26,"column":12,"offset":1512},"indent":[]}},{"type":"text","value":": The message object that triggered the command.","position":{"start":{"line":26,"column":12,"offset":1512},"end":{"line":26,"column":60,"offset":1560},"indent":[]}}],"position":{"start":{"line":26,"column":3,"offset":1503},"end":{"line":26,"column":60,"offset":1560},"indent":[]}}],"position":{"start":{"line":26,"column":1,"offset":1501},"end":{"line":26,"column":60,"offset":1560},"indent":[]}},{"type":"listItem","spread":false,"checked":null,"children":[{"type":"paragraph","children":[{"type":"inlineCode","value":"command","position":{"start":{"line":27,"column":3,"offset":1563},"end":{"line":27,"column":12,"offset":1572},"indent":[]}},{"type":"text","value":": The command object itself that was triggered.","position":{"start":{"line":27,"column":12,"offset":1572},"end":{"line":27,"column":59,"offset":1619},"indent":[]}}],"position":{"start":{"line":27,"column":3,"offset":1563},"end":{"line":27,"column":59,"offset":1619},"indent":[]}}],"position":{"start":{"line":27,"column":1,"offset":1561},"end":{"line":27,"column":59,"offset":1619},"indent":[]}},{"type":"listItem","spread":false,"checked":null,"children":[{"type":"paragraph","children":[{"type":"inlineCode","value":"guild","position":{"start":{"line":28,"column":3,"offset":1622},"end":{"line":28,"column":10,"offset":1629},"indent":[]}},{"type":"text","value":": The server guild object where this command was ran.","position":{"start":{"line":28,"column":10,"offset":1629},"end":{"line":28,"column":63,"offset":1682},"indent":[]}}],"position":{"start":{"line":28,"column":3,"offset":1622},"end":{"line":28,"column":63,"offset":1682},"indent":[]}}],"position":{"start":{"line":28,"column":1,"offset":1620},"end":{"line":28,"column":63,"offset":1682},"indent":[]}}],"position":{"start":{"line":26,"column":1,"offset":1501},"end":{"line":28,"column":63,"offset":1682},"indent":[1,1]}},{"type":"heading","depth":2,"children":[{"type":"text","value":"Understanding How Inhibitors Function","position":{"start":{"line":30,"column":4,"offset":1687},"end":{"line":30,"column":41,"offset":1724},"indent":[]}}],"position":{"start":{"line":30,"column":1,"offset":1684},"end":{"line":30,"column":41,"offset":1724},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"To block a command you have to return a truthy value.","position":{"start":{"line":32,"column":1,"offset":1726},"end":{"line":32,"column":54,"offset":1779},"indent":[]}}],"position":{"start":{"line":32,"column":1,"offset":1726},"end":{"line":32,"column":54,"offset":1779},"indent":[]}},{"type":"list","ordered":false,"start":null,"spread":false,"children":[{"type":"listItem","spread":false,"checked":null,"children":[{"type":"paragraph","children":[{"type":"strong","children":[{"type":"text","value":"return true;","position":{"start":{"line":33,"column":5,"offset":1784},"end":{"line":33,"column":17,"offset":1796},"indent":[]}}],"position":{"start":{"line":33,"column":3,"offset":1782},"end":{"line":33,"column":19,"offset":1798},"indent":[]}},{"type":"text","value":" If you return true the inhibitor will block the execution of the command.\nTo allow a command return a falsey value.","position":{"start":{"line":33,"column":19,"offset":1798},"end":{"line":34,"column":42,"offset":1914},"indent":[1]}}],"position":{"start":{"line":33,"column":3,"offset":1782},"end":{"line":34,"column":42,"offset":1914},"indent":[1]}}],"position":{"start":{"line":33,"column":1,"offset":1780},"end":{"line":34,"column":42,"offset":1914},"indent":[1]}},{"type":"listItem","spread":false,"checked":null,"children":[{"type":"paragraph","children":[{"type":"strong","children":[{"type":"text","value":"return false;","position":{"start":{"line":35,"column":5,"offset":1919},"end":{"line":35,"column":18,"offset":1932},"indent":[]}}],"position":{"start":{"line":35,"column":3,"offset":1917},"end":{"line":35,"column":20,"offset":1934},"indent":[]}},{"type":"text","value":" If you return false the inhibitor will not block the error.","position":{"start":{"line":35,"column":20,"offset":1934},"end":{"line":35,"column":80,"offset":1994},"indent":[]}}],"position":{"start":{"line":35,"column":3,"offset":1917},"end":{"line":35,"column":80,"offset":1994},"indent":[]}}],"position":{"start":{"line":35,"column":1,"offset":1915},"end":{"line":35,"column":80,"offset":1994},"indent":[]}}],"position":{"start":{"line":33,"column":1,"offset":1780},"end":{"line":35,"column":80,"offset":1994},"indent":[1,1]}},{"type":"code","lang":"ts","meta":null,"value":"// If the command is not VIP only we can allow this command to execute\nif (!command.vipOnly) return false;\n\n// The bot's support server\nconst guild = cache.guilds.get(configs.supportServerID);\n// If the command author is not in the server they won't have the vip role\nconst member = guild.members.get(message.author.id) || await getMember(guild.id, message.author.id);\n// Member doesn't exist so cancel the command\nif (!member) {\n\tsendResponse(message, `sorry, but you can not use this command until you become VIP. **Close the IRIS!!!**`)\n\treturn true;\n}\n\n// If the user has the vip role on the support server given by patreon allow the command\nif (member.roles.includes(configs.roleIDs.patreonVIPRoleID)) return false;\n\n// Alert the user they don't have vip and can't use the command\nsendResponse(message, `sorry, but you can not use this command until you become a VIP. I'm sorry, Teal'c. We'll go to Disneyland next year. I promise.`)\n// Cancel the command since the user does not have vip\nreturn true;","position":{"start":{"line":38,"column":1,"offset":1997},"end":{"line":59,"column":4,"offset":3013},"indent":[1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1]}},{"type":"export","value":"export const _frontmatter = {\"title\":\"Creating Inhibitors!\",\"metaTitle\":\"Creating An Inhibitor | Discordeno\",\"metaDescription\":\"Let's create our very own bot with Discordeno!\"}","position":{"start":{"line":63,"column":1,"offset":3017},"end":{"line":63,"column":177,"offset":3193},"indent":[]}}],"position":{"start":{"line":1,"column":1,"offset":0},"end":{"line":63,"column":177,"offset":3193}}},"scopeImports":["import * as React from 'react'"],"scopeIdentifiers":["React"],"body":"function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }\n\nfunction _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }\n\nfunction _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }\n\n/* @jsx mdx */\nvar _frontmatter = {\n \"title\": \"Creating Inhibitors!\",\n \"metaTitle\": \"Creating An Inhibitor | Discordeno\",\n \"metaDescription\": \"Let's create our very own bot with Discordeno!\"\n};\nvar layoutProps = {\n _frontmatter: _frontmatter\n};\nvar MDXLayout = \"wrapper\";\nreturn function MDXContent(_ref) {\n var components = _ref.components,\n props = _objectWithoutProperties(_ref, [\"components\"]);\n\n return mdx(MDXLayout, _extends({}, layoutProps, props, {\n components: components,\n mdxType: \"MDXLayout\"\n }), mdx(\"p\", null, \"Woah! You are almost half way done with understanding all of Discordeno. Amazing isn't it? Something you may have noticed in the last section was there were some options that prevented some commands from running like \", mdx(\"inlineCode\", {\n parentName: \"p\"\n }, \"dmOnly\"), \" or the permission options. we created a setting to prevent the monitor from running in certain channels. What if we wanted to do prevent commands from happening? How would we prevent commands from running?\"), mdx(\"h2\", null, \"What is an Inhibitor?\"), mdx(\"p\", null, \"An Inhibitor is very similar to how monitors work. A monitor runs on every message but an inhibitor runs on every command. Remember all those command options like cooldown, permissions, permissionLevel, nsfw, etc... Each and every one of these options has an inhibitor in that checks commands for these settings.\"), mdx(\"p\", null, \"Let's create our own inhibitor that would prevent commands from being used if the user is not a VIP user.\"), mdx(\"blockquote\", null, mdx(\"p\", {\n parentName: \"blockquote\"\n }, mdx(\"strong\", {\n parentName: \"p\"\n }, \"Note:\"), \" It is important to remember that everything below can be done with a simple permission level as well. We will create our own custom permission levels but for the purposes of this guide and to be able to learn about Inhibitors, we will be using an inhibitor.\")), mdx(\"h2\", null, \"Creating the File\"), mdx(\"p\", null, \"Let's start by creating a file inside the inhibitors folder called \", mdx(\"inlineCode\", {\n parentName: \"p\"\n }, \"boosted.ts\"), \" and paste the following snippet of code:\"), mdx(\"pre\", null, mdx(\"code\", _extends({\n parentName: \"pre\"\n }, {\n \"className\": \"language-ts\"\n }), \"import { botCache } from \\\"../../mod.ts\\\";\\n\\nbotCache.inhibitors.set(\\\"inhibitorname\\\", async function (message, command, guild) {\\n // Your code goes here\\n});\\n\")), mdx(\"p\", null, \"Inhibitors can take up to 3 arguments.\"), mdx(\"ul\", null, mdx(\"li\", {\n parentName: \"ul\"\n }, mdx(\"inlineCode\", {\n parentName: \"li\"\n }, \"message\"), \": The message object that triggered the command.\"), mdx(\"li\", {\n parentName: \"ul\"\n }, mdx(\"inlineCode\", {\n parentName: \"li\"\n }, \"command\"), \": The command object itself that was triggered.\"), mdx(\"li\", {\n parentName: \"ul\"\n }, mdx(\"inlineCode\", {\n parentName: \"li\"\n }, \"guild\"), \": The server guild object where this command was ran.\")), mdx(\"h2\", null, \"Understanding How Inhibitors Function\"), mdx(\"p\", null, \"To block a command you have to return a truthy value.\"), mdx(\"ul\", null, mdx(\"li\", {\n parentName: \"ul\"\n }, mdx(\"strong\", {\n parentName: \"li\"\n }, \"return true;\"), \" If you return true the inhibitor will block the execution of the command.\\nTo allow a command return a falsey value.\"), mdx(\"li\", {\n parentName: \"ul\"\n }, mdx(\"strong\", {\n parentName: \"li\"\n }, \"return false;\"), \" If you return false the inhibitor will not block the error.\")), mdx(\"pre\", null, mdx(\"code\", _extends({\n parentName: \"pre\"\n }, {\n \"className\": \"language-ts\"\n }), \"// If the command is not VIP only we can allow this command to execute\\nif (!command.vipOnly) return false;\\n\\n// The bot's support server\\nconst guild = cache.guilds.get(configs.supportServerID);\\n// If the command author is not in the server they won't have the vip role\\nconst member = guild.members.get(message.author.id) || await getMember(guild.id, message.author.id);\\n// Member doesn't exist so cancel the command\\nif (!member) {\\n sendResponse(message, `sorry, but you can not use this command until you become VIP. **Close the IRIS!!!**`)\\n return true;\\n}\\n\\n// If the user has the vip role on the support server given by patreon allow the command\\nif (member.roles.includes(configs.roleIDs.patreonVIPRoleID)) return false;\\n\\n// Alert the user they don't have vip and can't use the command\\nsendResponse(message, `sorry, but you can not use this command until you become a VIP. I'm sorry, Teal'c. We'll go to Disneyland next year. I promise.`)\\n// Cancel the command since the user does not have vip\\nreturn true;\\n\")));\n}\n;\nMDXContent.isMDXComponent = true;","rawMDXOutput":"/* @jsx mdx */\nimport { mdx } from '@mdx-js/react';\n/* @jsx mdx */\n\nexport const _frontmatter = {\n \"title\": \"Creating Inhibitors!\",\n \"metaTitle\": \"Creating An Inhibitor | Discordeno\",\n \"metaDescription\": \"Let's create our very own bot with Discordeno!\"\n};\n\nconst layoutProps = {\n _frontmatter\n};\nconst MDXLayout = \"wrapper\"\nexport default function MDXContent({\n components,\n ...props\n}) {\n return \n

{`Woah! You are almost half way done with understanding all of Discordeno. Amazing isn't it? Something you may have noticed in the last section was there were some options that prevented some commands from running like `}{`dmOnly`}{` or the permission options. we created a setting to prevent the monitor from running in certain channels. What if we wanted to do prevent commands from happening? How would we prevent commands from running?`}

\n

{`What is an Inhibitor?`}

\n

{`An Inhibitor is very similar to how monitors work. A monitor runs on every message but an inhibitor runs on every command. Remember all those command options like cooldown, permissions, permissionLevel, nsfw, etc... Each and every one of these options has an inhibitor in that checks commands for these settings.`}

\n

{`Let's create our own inhibitor that would prevent commands from being used if the user is not a VIP user.`}

\n
\n

{`Note:`}{` It is important to remember that everything below can be done with a simple permission level as well. We will create our own custom permission levels but for the purposes of this guide and to be able to learn about Inhibitors, we will be using an inhibitor.`}

\n
\n

{`Creating the File`}

\n

{`Let's start by creating a file inside the inhibitors folder called `}{`boosted.ts`}{` and paste the following snippet of code:`}

\n
{`import { botCache } from \"../../mod.ts\";\n\nbotCache.inhibitors.set(\"inhibitorname\", async function (message, command, guild) {\n    // Your code goes here\n});\n`}
\n

{`Inhibitors can take up to 3 arguments.`}

\n
    \n
  • {`message`}{`: The message object that triggered the command.`}
  • \n
  • {`command`}{`: The command object itself that was triggered.`}
  • \n
  • {`guild`}{`: The server guild object where this command was ran.`}
  • \n
\n

{`Understanding How Inhibitors Function`}

\n

{`To block a command you have to return a truthy value.`}

\n
    \n
  • {`return true;`}{` If you return true the inhibitor will block the execution of the command.\nTo allow a command return a falsey value.`}
  • \n
  • {`return false;`}{` If you return false the inhibitor will not block the error.`}
  • \n
\n
{`// If the command is not VIP only we can allow this command to execute\nif (!command.vipOnly) return false;\n\n// The bot's support server\nconst guild = cache.guilds.get(configs.supportServerID);\n// If the command author is not in the server they won't have the vip role\nconst member = guild.members.get(message.author.id) || await getMember(guild.id, message.author.id);\n// Member doesn't exist so cancel the command\nif (!member) {\n    sendResponse(message, \\`sorry, but you can not use this command until you become VIP. **Close the IRIS!!!**\\`)\n    return true;\n}\n\n// If the user has the vip role on the support server given by patreon allow the command\nif (member.roles.includes(configs.roleIDs.patreonVIPRoleID)) return false;\n\n// Alert the user they don't have vip and can't use the command\nsendResponse(message, \\`sorry, but you can not use this command until you become a VIP. I'm sorry, Teal'c. We'll go to Disneyland next year. I promise.\\`)\n// Cancel the command since the user does not have vip\nreturn true;\n`}
\n\n
;\n}\n\n;\nMDXContent.isMDXComponent = true;"}} \ No newline at end of file diff --git a/docs/.cache/caches/gatsby-plugin-mdx/diskstore-cd1a389ab235a607ffce55177cad7015.json b/docs/.cache/caches/gatsby-plugin-mdx/diskstore-cd1a389ab235a607ffce55177cad7015.json new file mode 100644 index 000000000..0b06722a1 --- /dev/null +++ b/docs/.cache/caches/gatsby-plugin-mdx/diskstore-cd1a389ab235a607ffce55177cad7015.json @@ -0,0 +1 @@ +{"expireTime":9007200851634275000,"key":"gatsby-plugin-mdx-entire-payload-b47907b89130e55a630da6124c98b351-","val":{"mdast":{"type":"root","children":[{"type":"paragraph","children":[{"type":"text","value":"Woah! You are almost half way done with understanding all of Discordeno. Amazing isn't it? Something you may have noticed in the last section was there were some options that prevented some commands from running like ","position":{"start":{"line":2,"column":1,"offset":1},"end":{"line":2,"column":218,"offset":218},"indent":[]}},{"type":"inlineCode","value":"dmOnly","position":{"start":{"line":2,"column":218,"offset":218},"end":{"line":2,"column":226,"offset":226},"indent":[]}},{"type":"text","value":" or the permission options. we created a setting to prevent the monitor from running in certain channels. What if we wanted to do prevent commands from happening? How would we prevent commands from running?","position":{"start":{"line":2,"column":226,"offset":226},"end":{"line":2,"column":432,"offset":432},"indent":[]}}],"position":{"start":{"line":2,"column":1,"offset":1},"end":{"line":2,"column":432,"offset":432},"indent":[]}},{"type":"heading","depth":2,"children":[{"type":"text","value":"What is an Inhibitor?","position":{"start":{"line":4,"column":4,"offset":437},"end":{"line":4,"column":25,"offset":458},"indent":[]}}],"position":{"start":{"line":4,"column":1,"offset":434},"end":{"line":4,"column":25,"offset":458},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"An Inhibitor is very similar to how monitors work. A monitor runs on every message but an inhibitor runs on every command. Remember all those command options like cooldown, permissions, permissionLevel, nsfw, etc... Each and every one of these options has an inhibitor in that checks commands for these settings.","position":{"start":{"line":6,"column":1,"offset":460},"end":{"line":6,"column":313,"offset":772},"indent":[]}}],"position":{"start":{"line":6,"column":1,"offset":460},"end":{"line":6,"column":313,"offset":772},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"Let's create our own inhibitor that would prevent commands from being used if the user is not a VIP user.","position":{"start":{"line":8,"column":1,"offset":774},"end":{"line":8,"column":106,"offset":879},"indent":[]}}],"position":{"start":{"line":8,"column":1,"offset":774},"end":{"line":8,"column":106,"offset":879},"indent":[]}},{"type":"blockquote","children":[{"type":"paragraph","children":[{"type":"strong","children":[{"type":"text","value":"Note:","position":{"start":{"line":10,"column":5,"offset":885},"end":{"line":10,"column":10,"offset":890},"indent":[]}}],"position":{"start":{"line":10,"column":3,"offset":883},"end":{"line":10,"column":12,"offset":892},"indent":[]}},{"type":"text","value":" It is important to remember that everything below can be done with a simple permission level as well. We will create our own custom permission levels but for the purposes of this guide and to be able to learn about Inhibitors, we will be using an inhibitor.","position":{"start":{"line":10,"column":12,"offset":892},"end":{"line":10,"column":270,"offset":1150},"indent":[]}}],"position":{"start":{"line":10,"column":3,"offset":883},"end":{"line":10,"column":270,"offset":1150},"indent":[]}}],"position":{"start":{"line":10,"column":1,"offset":881},"end":{"line":10,"column":270,"offset":1150},"indent":[]}},{"type":"heading","depth":2,"children":[{"type":"text","value":"Creating the File","position":{"start":{"line":12,"column":4,"offset":1155},"end":{"line":12,"column":21,"offset":1172},"indent":[]}}],"position":{"start":{"line":12,"column":1,"offset":1152},"end":{"line":12,"column":21,"offset":1172},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"Let's start by creating a file inside the inhibitors folder called ","position":{"start":{"line":14,"column":1,"offset":1174},"end":{"line":14,"column":68,"offset":1241},"indent":[]}},{"type":"inlineCode","value":"boosted.ts","position":{"start":{"line":14,"column":68,"offset":1241},"end":{"line":14,"column":80,"offset":1253},"indent":[]}},{"type":"text","value":" and paste the following snippet of code:","position":{"start":{"line":14,"column":80,"offset":1253},"end":{"line":14,"column":121,"offset":1294},"indent":[]}}],"position":{"start":{"line":14,"column":1,"offset":1174},"end":{"line":14,"column":121,"offset":1294},"indent":[]}},{"type":"code","lang":"ts","meta":null,"value":"import { botCache } from \"../../mod.ts\";\n\nbotCache.inhibitors.set(\"inhibitorname\", async function (message, command, guild) {\n\t// Your code goes here\n});","position":{"start":{"line":16,"column":1,"offset":1296},"end":{"line":22,"column":4,"offset":1459},"indent":[1,1,1,1,1,1]}},{"type":"paragraph","children":[{"type":"text","value":"Inhibitors can take up to 3 arguments.","position":{"start":{"line":24,"column":1,"offset":1461},"end":{"line":24,"column":39,"offset":1499},"indent":[]}}],"position":{"start":{"line":24,"column":1,"offset":1461},"end":{"line":24,"column":39,"offset":1499},"indent":[]}},{"type":"list","ordered":false,"start":null,"spread":false,"children":[{"type":"listItem","spread":false,"checked":null,"children":[{"type":"paragraph","children":[{"type":"inlineCode","value":"message","position":{"start":{"line":26,"column":3,"offset":1503},"end":{"line":26,"column":12,"offset":1512},"indent":[]}},{"type":"text","value":": The message object that triggered the command.","position":{"start":{"line":26,"column":12,"offset":1512},"end":{"line":26,"column":60,"offset":1560},"indent":[]}}],"position":{"start":{"line":26,"column":3,"offset":1503},"end":{"line":26,"column":60,"offset":1560},"indent":[]}}],"position":{"start":{"line":26,"column":1,"offset":1501},"end":{"line":26,"column":60,"offset":1560},"indent":[]}},{"type":"listItem","spread":false,"checked":null,"children":[{"type":"paragraph","children":[{"type":"inlineCode","value":"command","position":{"start":{"line":27,"column":3,"offset":1563},"end":{"line":27,"column":12,"offset":1572},"indent":[]}},{"type":"text","value":": The command object itself that was triggered.","position":{"start":{"line":27,"column":12,"offset":1572},"end":{"line":27,"column":59,"offset":1619},"indent":[]}}],"position":{"start":{"line":27,"column":3,"offset":1563},"end":{"line":27,"column":59,"offset":1619},"indent":[]}}],"position":{"start":{"line":27,"column":1,"offset":1561},"end":{"line":27,"column":59,"offset":1619},"indent":[]}},{"type":"listItem","spread":false,"checked":null,"children":[{"type":"paragraph","children":[{"type":"inlineCode","value":"guild","position":{"start":{"line":28,"column":3,"offset":1622},"end":{"line":28,"column":10,"offset":1629},"indent":[]}},{"type":"text","value":": The server guild object where this command was ran.","position":{"start":{"line":28,"column":10,"offset":1629},"end":{"line":28,"column":63,"offset":1682},"indent":[]}}],"position":{"start":{"line":28,"column":3,"offset":1622},"end":{"line":28,"column":63,"offset":1682},"indent":[]}}],"position":{"start":{"line":28,"column":1,"offset":1620},"end":{"line":28,"column":63,"offset":1682},"indent":[]}}],"position":{"start":{"line":26,"column":1,"offset":1501},"end":{"line":28,"column":63,"offset":1682},"indent":[1,1]}},{"type":"heading","depth":2,"children":[{"type":"text","value":"Understanding How Inhibitors Function","position":{"start":{"line":30,"column":4,"offset":1687},"end":{"line":30,"column":41,"offset":1724},"indent":[]}}],"position":{"start":{"line":30,"column":1,"offset":1684},"end":{"line":30,"column":41,"offset":1724},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"To block a command you have to return a truthy value.","position":{"start":{"line":32,"column":1,"offset":1726},"end":{"line":32,"column":54,"offset":1779},"indent":[]}}],"position":{"start":{"line":32,"column":1,"offset":1726},"end":{"line":32,"column":54,"offset":1779},"indent":[]}},{"type":"list","ordered":false,"start":null,"spread":false,"children":[{"type":"listItem","spread":false,"checked":null,"children":[{"type":"paragraph","children":[{"type":"strong","children":[{"type":"text","value":"return true;","position":{"start":{"line":33,"column":5,"offset":1784},"end":{"line":33,"column":17,"offset":1796},"indent":[]}}],"position":{"start":{"line":33,"column":3,"offset":1782},"end":{"line":33,"column":19,"offset":1798},"indent":[]}},{"type":"text","value":" If you return true the inhibitor will block the execution of the command.\nTo allow a command return a falsey value.","position":{"start":{"line":33,"column":19,"offset":1798},"end":{"line":34,"column":42,"offset":1914},"indent":[1]}}],"position":{"start":{"line":33,"column":3,"offset":1782},"end":{"line":34,"column":42,"offset":1914},"indent":[1]}}],"position":{"start":{"line":33,"column":1,"offset":1780},"end":{"line":34,"column":42,"offset":1914},"indent":[1]}},{"type":"listItem","spread":false,"checked":null,"children":[{"type":"paragraph","children":[{"type":"strong","children":[{"type":"text","value":"return false;","position":{"start":{"line":35,"column":5,"offset":1919},"end":{"line":35,"column":18,"offset":1932},"indent":[]}}],"position":{"start":{"line":35,"column":3,"offset":1917},"end":{"line":35,"column":20,"offset":1934},"indent":[]}},{"type":"text","value":" If you return false the inhibitor will not block the error.","position":{"start":{"line":35,"column":20,"offset":1934},"end":{"line":35,"column":80,"offset":1994},"indent":[]}}],"position":{"start":{"line":35,"column":3,"offset":1917},"end":{"line":35,"column":80,"offset":1994},"indent":[]}}],"position":{"start":{"line":35,"column":1,"offset":1915},"end":{"line":35,"column":80,"offset":1994},"indent":[]}}],"position":{"start":{"line":33,"column":1,"offset":1780},"end":{"line":35,"column":80,"offset":1994},"indent":[1,1]}},{"type":"code","lang":"ts","meta":null,"value":"// If the command is not VIP only we can allow this command to execute\nif (!command.vipOnly) return false;\n\n// The bot's support server\nconst guild = cache.guilds.get(configs.supportServerID);\n// If the command author is not in the server they won't have the vip role\nconst member = guild.members.get(message.author.id) || await getMember(guild.id, message.author.id);\n// Member doesn't exist so cancel the command\nif (!member) return true;\n\n// If the user has the vip role on the support server given by patreon allow the command\nif (member.roles.includes(configs.patreonVIPRoleID)) return false;\n\n// The user is NOT VIP so we throw an error\nthrow `The ${command.name} is only allowed for VIP users.`","position":{"start":{"line":38,"column":1,"offset":1997},"end":{"line":54,"column":4,"offset":2708},"indent":[1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1]}},{"type":"export","value":"export const _frontmatter = {\"title\":\"Creating Inhibitors!\",\"metaTitle\":\"Creating An Inhibitor | Discordeno\",\"metaDescription\":\"Let's create our very own bot with Discordeno!\"}","position":{"start":{"line":57,"column":1,"offset":2711},"end":{"line":57,"column":177,"offset":2887},"indent":[]}}],"position":{"start":{"line":1,"column":1,"offset":0},"end":{"line":57,"column":177,"offset":2887}}},"scopeImports":["import * as React from 'react'"],"scopeIdentifiers":["React"],"body":"function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }\n\nfunction _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }\n\nfunction _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }\n\n/* @jsx mdx */\nvar _frontmatter = {\n \"title\": \"Creating Inhibitors!\",\n \"metaTitle\": \"Creating An Inhibitor | Discordeno\",\n \"metaDescription\": \"Let's create our very own bot with Discordeno!\"\n};\nvar layoutProps = {\n _frontmatter: _frontmatter\n};\nvar MDXLayout = \"wrapper\";\nreturn function MDXContent(_ref) {\n var components = _ref.components,\n props = _objectWithoutProperties(_ref, [\"components\"]);\n\n return mdx(MDXLayout, _extends({}, layoutProps, props, {\n components: components,\n mdxType: \"MDXLayout\"\n }), mdx(\"p\", null, \"Woah! You are almost half way done with understanding all of Discordeno. Amazing isn't it? Something you may have noticed in the last section was there were some options that prevented some commands from running like \", mdx(\"inlineCode\", {\n parentName: \"p\"\n }, \"dmOnly\"), \" or the permission options. we created a setting to prevent the monitor from running in certain channels. What if we wanted to do prevent commands from happening? How would we prevent commands from running?\"), mdx(\"h2\", null, \"What is an Inhibitor?\"), mdx(\"p\", null, \"An Inhibitor is very similar to how monitors work. A monitor runs on every message but an inhibitor runs on every command. Remember all those command options like cooldown, permissions, permissionLevel, nsfw, etc... Each and every one of these options has an inhibitor in that checks commands for these settings.\"), mdx(\"p\", null, \"Let's create our own inhibitor that would prevent commands from being used if the user is not a VIP user.\"), mdx(\"blockquote\", null, mdx(\"p\", {\n parentName: \"blockquote\"\n }, mdx(\"strong\", {\n parentName: \"p\"\n }, \"Note:\"), \" It is important to remember that everything below can be done with a simple permission level as well. We will create our own custom permission levels but for the purposes of this guide and to be able to learn about Inhibitors, we will be using an inhibitor.\")), mdx(\"h2\", null, \"Creating the File\"), mdx(\"p\", null, \"Let's start by creating a file inside the inhibitors folder called \", mdx(\"inlineCode\", {\n parentName: \"p\"\n }, \"boosted.ts\"), \" and paste the following snippet of code:\"), mdx(\"pre\", null, mdx(\"code\", _extends({\n parentName: \"pre\"\n }, {\n \"className\": \"language-ts\"\n }), \"import { botCache } from \\\"../../mod.ts\\\";\\n\\nbotCache.inhibitors.set(\\\"inhibitorname\\\", async function (message, command, guild) {\\n // Your code goes here\\n});\\n\")), mdx(\"p\", null, \"Inhibitors can take up to 3 arguments.\"), mdx(\"ul\", null, mdx(\"li\", {\n parentName: \"ul\"\n }, mdx(\"inlineCode\", {\n parentName: \"li\"\n }, \"message\"), \": The message object that triggered the command.\"), mdx(\"li\", {\n parentName: \"ul\"\n }, mdx(\"inlineCode\", {\n parentName: \"li\"\n }, \"command\"), \": The command object itself that was triggered.\"), mdx(\"li\", {\n parentName: \"ul\"\n }, mdx(\"inlineCode\", {\n parentName: \"li\"\n }, \"guild\"), \": The server guild object where this command was ran.\")), mdx(\"h2\", null, \"Understanding How Inhibitors Function\"), mdx(\"p\", null, \"To block a command you have to return a truthy value.\"), mdx(\"ul\", null, mdx(\"li\", {\n parentName: \"ul\"\n }, mdx(\"strong\", {\n parentName: \"li\"\n }, \"return true;\"), \" If you return true the inhibitor will block the execution of the command.\\nTo allow a command return a falsey value.\"), mdx(\"li\", {\n parentName: \"ul\"\n }, mdx(\"strong\", {\n parentName: \"li\"\n }, \"return false;\"), \" If you return false the inhibitor will not block the error.\")), mdx(\"pre\", null, mdx(\"code\", _extends({\n parentName: \"pre\"\n }, {\n \"className\": \"language-ts\"\n }), \"// If the command is not VIP only we can allow this command to execute\\nif (!command.vipOnly) return false;\\n\\n// The bot's support server\\nconst guild = cache.guilds.get(configs.supportServerID);\\n// If the command author is not in the server they won't have the vip role\\nconst member = guild.members.get(message.author.id) || await getMember(guild.id, message.author.id);\\n// Member doesn't exist so cancel the command\\nif (!member) return true;\\n\\n// If the user has the vip role on the support server given by patreon allow the command\\nif (member.roles.includes(configs.patreonVIPRoleID)) return false;\\n\\n// The user is NOT VIP so we throw an error\\nthrow `The ${command.name} is only allowed for VIP users.`\\n\")));\n}\n;\nMDXContent.isMDXComponent = true;","rawMDXOutput":"/* @jsx mdx */\nimport { mdx } from '@mdx-js/react';\n/* @jsx mdx */\n\nexport const _frontmatter = {\n \"title\": \"Creating Inhibitors!\",\n \"metaTitle\": \"Creating An Inhibitor | Discordeno\",\n \"metaDescription\": \"Let's create our very own bot with Discordeno!\"\n};\n\nconst layoutProps = {\n _frontmatter\n};\nconst MDXLayout = \"wrapper\"\nexport default function MDXContent({\n components,\n ...props\n}) {\n return \n

{`Woah! You are almost half way done with understanding all of Discordeno. Amazing isn't it? Something you may have noticed in the last section was there were some options that prevented some commands from running like `}{`dmOnly`}{` or the permission options. we created a setting to prevent the monitor from running in certain channels. What if we wanted to do prevent commands from happening? How would we prevent commands from running?`}

\n

{`What is an Inhibitor?`}

\n

{`An Inhibitor is very similar to how monitors work. A monitor runs on every message but an inhibitor runs on every command. Remember all those command options like cooldown, permissions, permissionLevel, nsfw, etc... Each and every one of these options has an inhibitor in that checks commands for these settings.`}

\n

{`Let's create our own inhibitor that would prevent commands from being used if the user is not a VIP user.`}

\n
\n

{`Note:`}{` It is important to remember that everything below can be done with a simple permission level as well. We will create our own custom permission levels but for the purposes of this guide and to be able to learn about Inhibitors, we will be using an inhibitor.`}

\n
\n

{`Creating the File`}

\n

{`Let's start by creating a file inside the inhibitors folder called `}{`boosted.ts`}{` and paste the following snippet of code:`}

\n
{`import { botCache } from \"../../mod.ts\";\n\nbotCache.inhibitors.set(\"inhibitorname\", async function (message, command, guild) {\n    // Your code goes here\n});\n`}
\n

{`Inhibitors can take up to 3 arguments.`}

\n
    \n
  • {`message`}{`: The message object that triggered the command.`}
  • \n
  • {`command`}{`: The command object itself that was triggered.`}
  • \n
  • {`guild`}{`: The server guild object where this command was ran.`}
  • \n
\n

{`Understanding How Inhibitors Function`}

\n

{`To block a command you have to return a truthy value.`}

\n
    \n
  • {`return true;`}{` If you return true the inhibitor will block the execution of the command.\nTo allow a command return a falsey value.`}
  • \n
  • {`return false;`}{` If you return false the inhibitor will not block the error.`}
  • \n
\n
{`// If the command is not VIP only we can allow this command to execute\nif (!command.vipOnly) return false;\n\n// The bot's support server\nconst guild = cache.guilds.get(configs.supportServerID);\n// If the command author is not in the server they won't have the vip role\nconst member = guild.members.get(message.author.id) || await getMember(guild.id, message.author.id);\n// Member doesn't exist so cancel the command\nif (!member) return true;\n\n// If the user has the vip role on the support server given by patreon allow the command\nif (member.roles.includes(configs.patreonVIPRoleID)) return false;\n\n// The user is NOT VIP so we throw an error\nthrow \\`The \\${command.name} is only allowed for VIP users.\\`\n`}
\n\n
;\n}\n\n;\nMDXContent.isMDXComponent = true;"}} \ No newline at end of file diff --git a/docs/.cache/caches/gatsby-plugin-mdx/diskstore-cd1ed76bbd7e068062d29b89fb5e2406.json b/docs/.cache/caches/gatsby-plugin-mdx/diskstore-cd1ed76bbd7e068062d29b89fb5e2406.json new file mode 100644 index 000000000..4118980ab --- /dev/null +++ b/docs/.cache/caches/gatsby-plugin-mdx/diskstore-cd1ed76bbd7e068062d29b89fb5e2406.json @@ -0,0 +1 @@ +{"expireTime":9007200851634786000,"key":"gatsby-plugin-mdx-entire-payload-b0c960750a7a47bcf51c6f8885360b46-","val":{"mdast":{"type":"root","children":[{"type":"paragraph","children":[{"type":"text","value":"Woah! You are almost half way done with understanding all of Discordeno. Amazing isn't it? Something you may have noticed in the last section was there were some options that prevented some commands from running like ","position":{"start":{"line":2,"column":1,"offset":1},"end":{"line":2,"column":218,"offset":218},"indent":[]}},{"type":"inlineCode","value":"dmOnly","position":{"start":{"line":2,"column":218,"offset":218},"end":{"line":2,"column":226,"offset":226},"indent":[]}},{"type":"text","value":" or the permission options. we created a setting to prevent the monitor from running in certain channels. What if we wanted to do prevent commands from happening? How would we prevent commands from running?","position":{"start":{"line":2,"column":226,"offset":226},"end":{"line":2,"column":432,"offset":432},"indent":[]}}],"position":{"start":{"line":2,"column":1,"offset":1},"end":{"line":2,"column":432,"offset":432},"indent":[]}},{"type":"heading","depth":2,"children":[{"type":"text","value":"What is an Inhibitor?","position":{"start":{"line":4,"column":4,"offset":437},"end":{"line":4,"column":25,"offset":458},"indent":[]}}],"position":{"start":{"line":4,"column":1,"offset":434},"end":{"line":4,"column":25,"offset":458},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"An Inhibitor is very similar to how monitors work. A monitor runs on every message but an inhibitor runs on every command. Remember all those command options like cooldown, permissions, permissionLevel, nsfw, etc... Each and every one of these options has an inhibitor in that checks commands for these settings.","position":{"start":{"line":6,"column":1,"offset":460},"end":{"line":6,"column":313,"offset":772},"indent":[]}}],"position":{"start":{"line":6,"column":1,"offset":460},"end":{"line":6,"column":313,"offset":772},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"Let's create our own inhibitor that would prevent commands from being used if the user is not a VIP user.","position":{"start":{"line":8,"column":1,"offset":774},"end":{"line":8,"column":106,"offset":879},"indent":[]}}],"position":{"start":{"line":8,"column":1,"offset":774},"end":{"line":8,"column":106,"offset":879},"indent":[]}},{"type":"blockquote","children":[{"type":"paragraph","children":[{"type":"strong","children":[{"type":"text","value":"Note:","position":{"start":{"line":10,"column":5,"offset":885},"end":{"line":10,"column":10,"offset":890},"indent":[]}}],"position":{"start":{"line":10,"column":3,"offset":883},"end":{"line":10,"column":12,"offset":892},"indent":[]}},{"type":"text","value":" It is important to remember that everything below can be done with a simple permission level as well. We will create our own custom permission levels but for the purposes of this guide and to be able to learn about Inhibitors, we will be using an inhibitor.","position":{"start":{"line":10,"column":12,"offset":892},"end":{"line":10,"column":270,"offset":1150},"indent":[]}}],"position":{"start":{"line":10,"column":3,"offset":883},"end":{"line":10,"column":270,"offset":1150},"indent":[]}}],"position":{"start":{"line":10,"column":1,"offset":881},"end":{"line":10,"column":270,"offset":1150},"indent":[]}},{"type":"heading","depth":2,"children":[{"type":"text","value":"Creating the File","position":{"start":{"line":12,"column":4,"offset":1155},"end":{"line":12,"column":21,"offset":1172},"indent":[]}}],"position":{"start":{"line":12,"column":1,"offset":1152},"end":{"line":12,"column":21,"offset":1172},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"Let's start by creating a file inside the inhibitors folder called ","position":{"start":{"line":14,"column":1,"offset":1174},"end":{"line":14,"column":68,"offset":1241},"indent":[]}},{"type":"inlineCode","value":"boosted.ts","position":{"start":{"line":14,"column":68,"offset":1241},"end":{"line":14,"column":80,"offset":1253},"indent":[]}},{"type":"text","value":" and paste the following snippet of code:","position":{"start":{"line":14,"column":80,"offset":1253},"end":{"line":14,"column":121,"offset":1294},"indent":[]}}],"position":{"start":{"line":14,"column":1,"offset":1174},"end":{"line":14,"column":121,"offset":1294},"indent":[]}},{"type":"code","lang":"ts","meta":null,"value":"import { botCache } from \"../../mod.ts\";\n\nbotCache.inhibitors.set(\"inhibitorname\", async function (message, command, guild) {\n\t// Your code goes here\n});","position":{"start":{"line":16,"column":1,"offset":1296},"end":{"line":22,"column":4,"offset":1459},"indent":[1,1,1,1,1,1]}},{"type":"paragraph","children":[{"type":"text","value":"Inhibitors can take up to 3 arguments.","position":{"start":{"line":24,"column":1,"offset":1461},"end":{"line":24,"column":39,"offset":1499},"indent":[]}}],"position":{"start":{"line":24,"column":1,"offset":1461},"end":{"line":24,"column":39,"offset":1499},"indent":[]}},{"type":"list","ordered":false,"start":null,"spread":false,"children":[{"type":"listItem","spread":false,"checked":null,"children":[{"type":"paragraph","children":[{"type":"inlineCode","value":"message","position":{"start":{"line":26,"column":3,"offset":1503},"end":{"line":26,"column":12,"offset":1512},"indent":[]}},{"type":"text","value":": The message object that triggered the command.","position":{"start":{"line":26,"column":12,"offset":1512},"end":{"line":26,"column":60,"offset":1560},"indent":[]}}],"position":{"start":{"line":26,"column":3,"offset":1503},"end":{"line":26,"column":60,"offset":1560},"indent":[]}}],"position":{"start":{"line":26,"column":1,"offset":1501},"end":{"line":26,"column":60,"offset":1560},"indent":[]}},{"type":"listItem","spread":false,"checked":null,"children":[{"type":"paragraph","children":[{"type":"inlineCode","value":"command","position":{"start":{"line":27,"column":3,"offset":1563},"end":{"line":27,"column":12,"offset":1572},"indent":[]}},{"type":"text","value":": The command object itself that was triggered.","position":{"start":{"line":27,"column":12,"offset":1572},"end":{"line":27,"column":59,"offset":1619},"indent":[]}}],"position":{"start":{"line":27,"column":3,"offset":1563},"end":{"line":27,"column":59,"offset":1619},"indent":[]}}],"position":{"start":{"line":27,"column":1,"offset":1561},"end":{"line":27,"column":59,"offset":1619},"indent":[]}},{"type":"listItem","spread":false,"checked":null,"children":[{"type":"paragraph","children":[{"type":"inlineCode","value":"guild","position":{"start":{"line":28,"column":3,"offset":1622},"end":{"line":28,"column":10,"offset":1629},"indent":[]}},{"type":"text","value":": The server guild object where this command was ran.","position":{"start":{"line":28,"column":10,"offset":1629},"end":{"line":28,"column":63,"offset":1682},"indent":[]}}],"position":{"start":{"line":28,"column":3,"offset":1622},"end":{"line":28,"column":63,"offset":1682},"indent":[]}}],"position":{"start":{"line":28,"column":1,"offset":1620},"end":{"line":28,"column":63,"offset":1682},"indent":[]}}],"position":{"start":{"line":26,"column":1,"offset":1501},"end":{"line":28,"column":63,"offset":1682},"indent":[1,1]}},{"type":"heading","depth":2,"children":[{"type":"text","value":"Understanding How Inhibitors Function","position":{"start":{"line":30,"column":4,"offset":1687},"end":{"line":30,"column":41,"offset":1724},"indent":[]}}],"position":{"start":{"line":30,"column":1,"offset":1684},"end":{"line":30,"column":41,"offset":1724},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"To block a command you have to return a truthy value.","position":{"start":{"line":32,"column":1,"offset":1726},"end":{"line":32,"column":54,"offset":1779},"indent":[]}}],"position":{"start":{"line":32,"column":1,"offset":1726},"end":{"line":32,"column":54,"offset":1779},"indent":[]}},{"type":"list","ordered":false,"start":null,"spread":false,"children":[{"type":"listItem","spread":false,"checked":null,"children":[{"type":"paragraph","children":[{"type":"strong","children":[{"type":"text","value":"return true;","position":{"start":{"line":33,"column":5,"offset":1784},"end":{"line":33,"column":17,"offset":1796},"indent":[]}}],"position":{"start":{"line":33,"column":3,"offset":1782},"end":{"line":33,"column":19,"offset":1798},"indent":[]}},{"type":"text","value":" If you return true the inhibitor will block the execution of the command.\nTo allow a command return a falsey value.","position":{"start":{"line":33,"column":19,"offset":1798},"end":{"line":34,"column":42,"offset":1914},"indent":[1]}}],"position":{"start":{"line":33,"column":3,"offset":1782},"end":{"line":34,"column":42,"offset":1914},"indent":[1]}}],"position":{"start":{"line":33,"column":1,"offset":1780},"end":{"line":34,"column":42,"offset":1914},"indent":[1]}},{"type":"listItem","spread":false,"checked":null,"children":[{"type":"paragraph","children":[{"type":"strong","children":[{"type":"text","value":"return false;","position":{"start":{"line":35,"column":5,"offset":1919},"end":{"line":35,"column":18,"offset":1932},"indent":[]}}],"position":{"start":{"line":35,"column":3,"offset":1917},"end":{"line":35,"column":20,"offset":1934},"indent":[]}},{"type":"text","value":" If you return false the inhibitor will not block the error.","position":{"start":{"line":35,"column":20,"offset":1934},"end":{"line":35,"column":80,"offset":1994},"indent":[]}}],"position":{"start":{"line":35,"column":3,"offset":1917},"end":{"line":35,"column":80,"offset":1994},"indent":[]}}],"position":{"start":{"line":35,"column":1,"offset":1915},"end":{"line":35,"column":80,"offset":1994},"indent":[]}}],"position":{"start":{"line":33,"column":1,"offset":1780},"end":{"line":35,"column":80,"offset":1994},"indent":[1,1]}},{"type":"code","lang":"ts","meta":null,"value":"// If the command is not VIP only we can allow this command to execute\nif (!command.vipOnly) return false;\n\n// The bot's support server\nconst guild = cache.guilds.get(configs.supportServerID);\n// If the command author is not in the server they won't have the vip role\nconst member = guild.members.get(message.author.id) || await getMember(guild.id, message.author.id);\n// Member doesn't exist so cancel the command\nif (!member) {\n\tsendResponse(message, `sorry, but you can not use this command until you become VIP. **Close the IRIS!!!**`)\n\treturn true;\n}\n\n// If the user has the vip role on the support server given by patreon allow the command\nif (member.roles.includes(configs.roleIDs.patreonVIPRoleID)) return false;\n\n// Alert the user they don't have vip and can't use the command\nsendResponse(message, `sorry, but you can not use this command until you become a VIP. I'm sorry, Teal'c. We'll go to Disneyland next year. I promise.`)\n// Cancel the command since the user does not have vip\nreturn true;","position":{"start":{"line":38,"column":1,"offset":1997},"end":{"line":59,"column":4,"offset":3013},"indent":[1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1]}},{"type":"heading","depth":2,"children":[{"type":"text","value":"Challenges","position":{"start":{"line":61,"column":4,"offset":3018},"end":{"line":61,"column":14,"offset":3028},"indent":[]}}],"position":{"start":{"line":61,"column":1,"offset":3015},"end":{"line":61,"column":14,"offset":3028},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"Hell yes! We just got through the entire inhibitor section. You have now mastered everything related to inhibitors.\nYou can now try and get a little more practice with inhibitors by trying to challenge yourself and make your own inhibitors. Don't worry if you can't think of any good use cases for inhibitors. ","position":{"start":{"line":63,"column":1,"offset":3030},"end":{"line":64,"column":195,"offset":3340},"indent":[1]}}],"position":{"start":{"line":63,"column":1,"offset":3030},"end":{"line":64,"column":195,"offset":3340},"indent":[1]}},{"type":"export","value":"export const _frontmatter = {\"title\":\"Creating Inhibitors!\",\"metaTitle\":\"Creating An Inhibitor | Discordeno\",\"metaDescription\":\"Let's create our very own bot with Discordeno!\"}","position":{"start":{"line":67,"column":1,"offset":3343},"end":{"line":67,"column":177,"offset":3519},"indent":[]}}],"position":{"start":{"line":1,"column":1,"offset":0},"end":{"line":67,"column":177,"offset":3519}}},"scopeImports":["import * as React from 'react'"],"scopeIdentifiers":["React"],"body":"function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }\n\nfunction _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }\n\nfunction _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }\n\n/* @jsx mdx */\nvar _frontmatter = {\n \"title\": \"Creating Inhibitors!\",\n \"metaTitle\": \"Creating An Inhibitor | Discordeno\",\n \"metaDescription\": \"Let's create our very own bot with Discordeno!\"\n};\nvar layoutProps = {\n _frontmatter: _frontmatter\n};\nvar MDXLayout = \"wrapper\";\nreturn function MDXContent(_ref) {\n var components = _ref.components,\n props = _objectWithoutProperties(_ref, [\"components\"]);\n\n return mdx(MDXLayout, _extends({}, layoutProps, props, {\n components: components,\n mdxType: \"MDXLayout\"\n }), mdx(\"p\", null, \"Woah! You are almost half way done with understanding all of Discordeno. Amazing isn't it? Something you may have noticed in the last section was there were some options that prevented some commands from running like \", mdx(\"inlineCode\", {\n parentName: \"p\"\n }, \"dmOnly\"), \" or the permission options. we created a setting to prevent the monitor from running in certain channels. What if we wanted to do prevent commands from happening? How would we prevent commands from running?\"), mdx(\"h2\", null, \"What is an Inhibitor?\"), mdx(\"p\", null, \"An Inhibitor is very similar to how monitors work. A monitor runs on every message but an inhibitor runs on every command. Remember all those command options like cooldown, permissions, permissionLevel, nsfw, etc... Each and every one of these options has an inhibitor in that checks commands for these settings.\"), mdx(\"p\", null, \"Let's create our own inhibitor that would prevent commands from being used if the user is not a VIP user.\"), mdx(\"blockquote\", null, mdx(\"p\", {\n parentName: \"blockquote\"\n }, mdx(\"strong\", {\n parentName: \"p\"\n }, \"Note:\"), \" It is important to remember that everything below can be done with a simple permission level as well. We will create our own custom permission levels but for the purposes of this guide and to be able to learn about Inhibitors, we will be using an inhibitor.\")), mdx(\"h2\", null, \"Creating the File\"), mdx(\"p\", null, \"Let's start by creating a file inside the inhibitors folder called \", mdx(\"inlineCode\", {\n parentName: \"p\"\n }, \"boosted.ts\"), \" and paste the following snippet of code:\"), mdx(\"pre\", null, mdx(\"code\", _extends({\n parentName: \"pre\"\n }, {\n \"className\": \"language-ts\"\n }), \"import { botCache } from \\\"../../mod.ts\\\";\\n\\nbotCache.inhibitors.set(\\\"inhibitorname\\\", async function (message, command, guild) {\\n // Your code goes here\\n});\\n\")), mdx(\"p\", null, \"Inhibitors can take up to 3 arguments.\"), mdx(\"ul\", null, mdx(\"li\", {\n parentName: \"ul\"\n }, mdx(\"inlineCode\", {\n parentName: \"li\"\n }, \"message\"), \": The message object that triggered the command.\"), mdx(\"li\", {\n parentName: \"ul\"\n }, mdx(\"inlineCode\", {\n parentName: \"li\"\n }, \"command\"), \": The command object itself that was triggered.\"), mdx(\"li\", {\n parentName: \"ul\"\n }, mdx(\"inlineCode\", {\n parentName: \"li\"\n }, \"guild\"), \": The server guild object where this command was ran.\")), mdx(\"h2\", null, \"Understanding How Inhibitors Function\"), mdx(\"p\", null, \"To block a command you have to return a truthy value.\"), mdx(\"ul\", null, mdx(\"li\", {\n parentName: \"ul\"\n }, mdx(\"strong\", {\n parentName: \"li\"\n }, \"return true;\"), \" If you return true the inhibitor will block the execution of the command.\\nTo allow a command return a falsey value.\"), mdx(\"li\", {\n parentName: \"ul\"\n }, mdx(\"strong\", {\n parentName: \"li\"\n }, \"return false;\"), \" If you return false the inhibitor will not block the error.\")), mdx(\"pre\", null, mdx(\"code\", _extends({\n parentName: \"pre\"\n }, {\n \"className\": \"language-ts\"\n }), \"// If the command is not VIP only we can allow this command to execute\\nif (!command.vipOnly) return false;\\n\\n// The bot's support server\\nconst guild = cache.guilds.get(configs.supportServerID);\\n// If the command author is not in the server they won't have the vip role\\nconst member = guild.members.get(message.author.id) || await getMember(guild.id, message.author.id);\\n// Member doesn't exist so cancel the command\\nif (!member) {\\n sendResponse(message, `sorry, but you can not use this command until you become VIP. **Close the IRIS!!!**`)\\n return true;\\n}\\n\\n// If the user has the vip role on the support server given by patreon allow the command\\nif (member.roles.includes(configs.roleIDs.patreonVIPRoleID)) return false;\\n\\n// Alert the user they don't have vip and can't use the command\\nsendResponse(message, `sorry, but you can not use this command until you become a VIP. I'm sorry, Teal'c. We'll go to Disneyland next year. I promise.`)\\n// Cancel the command since the user does not have vip\\nreturn true;\\n\")), mdx(\"h2\", null, \"Challenges\"), mdx(\"p\", null, \"Hell yes! We just got through the entire inhibitor section. You have now mastered everything related to inhibitors.\\nYou can now try and get a little more practice with inhibitors by trying to challenge yourself and make your own inhibitors. Don't worry if you can't think of any good use cases for inhibitors. \"));\n}\n;\nMDXContent.isMDXComponent = true;","rawMDXOutput":"/* @jsx mdx */\nimport { mdx } from '@mdx-js/react';\n/* @jsx mdx */\n\nexport const _frontmatter = {\n \"title\": \"Creating Inhibitors!\",\n \"metaTitle\": \"Creating An Inhibitor | Discordeno\",\n \"metaDescription\": \"Let's create our very own bot with Discordeno!\"\n};\n\nconst layoutProps = {\n _frontmatter\n};\nconst MDXLayout = \"wrapper\"\nexport default function MDXContent({\n components,\n ...props\n}) {\n return \n

{`Woah! You are almost half way done with understanding all of Discordeno. Amazing isn't it? Something you may have noticed in the last section was there were some options that prevented some commands from running like `}{`dmOnly`}{` or the permission options. we created a setting to prevent the monitor from running in certain channels. What if we wanted to do prevent commands from happening? How would we prevent commands from running?`}

\n

{`What is an Inhibitor?`}

\n

{`An Inhibitor is very similar to how monitors work. A monitor runs on every message but an inhibitor runs on every command. Remember all those command options like cooldown, permissions, permissionLevel, nsfw, etc... Each and every one of these options has an inhibitor in that checks commands for these settings.`}

\n

{`Let's create our own inhibitor that would prevent commands from being used if the user is not a VIP user.`}

\n
\n

{`Note:`}{` It is important to remember that everything below can be done with a simple permission level as well. We will create our own custom permission levels but for the purposes of this guide and to be able to learn about Inhibitors, we will be using an inhibitor.`}

\n
\n

{`Creating the File`}

\n

{`Let's start by creating a file inside the inhibitors folder called `}{`boosted.ts`}{` and paste the following snippet of code:`}

\n
{`import { botCache } from \"../../mod.ts\";\n\nbotCache.inhibitors.set(\"inhibitorname\", async function (message, command, guild) {\n    // Your code goes here\n});\n`}
\n

{`Inhibitors can take up to 3 arguments.`}

\n
    \n
  • {`message`}{`: The message object that triggered the command.`}
  • \n
  • {`command`}{`: The command object itself that was triggered.`}
  • \n
  • {`guild`}{`: The server guild object where this command was ran.`}
  • \n
\n

{`Understanding How Inhibitors Function`}

\n

{`To block a command you have to return a truthy value.`}

\n
    \n
  • {`return true;`}{` If you return true the inhibitor will block the execution of the command.\nTo allow a command return a falsey value.`}
  • \n
  • {`return false;`}{` If you return false the inhibitor will not block the error.`}
  • \n
\n
{`// If the command is not VIP only we can allow this command to execute\nif (!command.vipOnly) return false;\n\n// The bot's support server\nconst guild = cache.guilds.get(configs.supportServerID);\n// If the command author is not in the server they won't have the vip role\nconst member = guild.members.get(message.author.id) || await getMember(guild.id, message.author.id);\n// Member doesn't exist so cancel the command\nif (!member) {\n    sendResponse(message, \\`sorry, but you can not use this command until you become VIP. **Close the IRIS!!!**\\`)\n    return true;\n}\n\n// If the user has the vip role on the support server given by patreon allow the command\nif (member.roles.includes(configs.roleIDs.patreonVIPRoleID)) return false;\n\n// Alert the user they don't have vip and can't use the command\nsendResponse(message, \\`sorry, but you can not use this command until you become a VIP. I'm sorry, Teal'c. We'll go to Disneyland next year. I promise.\\`)\n// Cancel the command since the user does not have vip\nreturn true;\n`}
\n

{`Challenges`}

\n

{`Hell yes! We just got through the entire inhibitor section. You have now mastered everything related to inhibitors.\nYou can now try and get a little more practice with inhibitors by trying to challenge yourself and make your own inhibitors. Don't worry if you can't think of any good use cases for inhibitors. `}

\n\n
;\n}\n\n;\nMDXContent.isMDXComponent = true;"}} \ No newline at end of file diff --git a/docs/.cache/caches/gatsby-plugin-mdx/diskstore-ced8a65b2547dc4ecd07eb7e553cf209.json b/docs/.cache/caches/gatsby-plugin-mdx/diskstore-ced8a65b2547dc4ecd07eb7e553cf209.json new file mode 100644 index 000000000..91d781376 --- /dev/null +++ b/docs/.cache/caches/gatsby-plugin-mdx/diskstore-ced8a65b2547dc4ecd07eb7e553cf209.json @@ -0,0 +1 @@ +{"expireTime":9007200851634489000,"key":"gatsby-plugin-mdx-entire-payload-e1d49c2d3b2c401e12e79f1cf65474f3-","val":{"mdast":{"type":"root","children":[{"type":"paragraph","children":[{"type":"text","value":"Woah! You are almost half way done with understanding all of Discordeno. Amazing isn't it? Something you may have noticed in the last section was there were some options that prevented some commands from running like ","position":{"start":{"line":2,"column":1,"offset":1},"end":{"line":2,"column":218,"offset":218},"indent":[]}},{"type":"inlineCode","value":"dmOnly","position":{"start":{"line":2,"column":218,"offset":218},"end":{"line":2,"column":226,"offset":226},"indent":[]}},{"type":"text","value":" or the permission options. we created a setting to prevent the monitor from running in certain channels. What if we wanted to do prevent commands from happening? How would we prevent commands from running?","position":{"start":{"line":2,"column":226,"offset":226},"end":{"line":2,"column":432,"offset":432},"indent":[]}}],"position":{"start":{"line":2,"column":1,"offset":1},"end":{"line":2,"column":432,"offset":432},"indent":[]}},{"type":"heading","depth":2,"children":[{"type":"text","value":"What is an Inhibitor?","position":{"start":{"line":4,"column":4,"offset":437},"end":{"line":4,"column":25,"offset":458},"indent":[]}}],"position":{"start":{"line":4,"column":1,"offset":434},"end":{"line":4,"column":25,"offset":458},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"An Inhibitor is very similar to how monitors work. A monitor runs on every message but an inhibitor runs on every command. Remember all those command options like cooldown, permissions, permissionLevel, nsfw, etc... Each and every one of these options has an inhibitor in that checks commands for these settings.","position":{"start":{"line":6,"column":1,"offset":460},"end":{"line":6,"column":313,"offset":772},"indent":[]}}],"position":{"start":{"line":6,"column":1,"offset":460},"end":{"line":6,"column":313,"offset":772},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"Let's create our own inhibitor that would prevent commands from being used if the user is not a VIP user.","position":{"start":{"line":8,"column":1,"offset":774},"end":{"line":8,"column":106,"offset":879},"indent":[]}}],"position":{"start":{"line":8,"column":1,"offset":774},"end":{"line":8,"column":106,"offset":879},"indent":[]}},{"type":"blockquote","children":[{"type":"paragraph","children":[{"type":"strong","children":[{"type":"text","value":"Note:","position":{"start":{"line":10,"column":5,"offset":885},"end":{"line":10,"column":10,"offset":890},"indent":[]}}],"position":{"start":{"line":10,"column":3,"offset":883},"end":{"line":10,"column":12,"offset":892},"indent":[]}},{"type":"text","value":" It is important to remember that everything below can be done with a simple permission level as well. We will create our own custom permission levels but for the purposes of this guide and to be able to learn about Inhibitors, we will be using an inhibitor.","position":{"start":{"line":10,"column":12,"offset":892},"end":{"line":10,"column":270,"offset":1150},"indent":[]}}],"position":{"start":{"line":10,"column":3,"offset":883},"end":{"line":10,"column":270,"offset":1150},"indent":[]}}],"position":{"start":{"line":10,"column":1,"offset":881},"end":{"line":10,"column":270,"offset":1150},"indent":[]}},{"type":"heading","depth":2,"children":[{"type":"text","value":"Creating the File","position":{"start":{"line":12,"column":4,"offset":1155},"end":{"line":12,"column":21,"offset":1172},"indent":[]}}],"position":{"start":{"line":12,"column":1,"offset":1152},"end":{"line":12,"column":21,"offset":1172},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"Let's start by creating a file inside the inhibitors folder called ","position":{"start":{"line":14,"column":1,"offset":1174},"end":{"line":14,"column":68,"offset":1241},"indent":[]}},{"type":"inlineCode","value":"boosted.ts","position":{"start":{"line":14,"column":68,"offset":1241},"end":{"line":14,"column":80,"offset":1253},"indent":[]}},{"type":"text","value":" and paste the following snippet of code:","position":{"start":{"line":14,"column":80,"offset":1253},"end":{"line":14,"column":121,"offset":1294},"indent":[]}}],"position":{"start":{"line":14,"column":1,"offset":1174},"end":{"line":14,"column":121,"offset":1294},"indent":[]}},{"type":"code","lang":"ts","meta":null,"value":"import { botCache } from \"../../mod.ts\";\n\nbotCache.inhibitors.set(\"inhibitorname\", async function (message, command, guild) {\n\t// Your code goes here\n});","position":{"start":{"line":16,"column":1,"offset":1296},"end":{"line":22,"column":4,"offset":1459},"indent":[1,1,1,1,1,1]}},{"type":"paragraph","children":[{"type":"text","value":"Inhibitors can take up to 3 arguments.","position":{"start":{"line":24,"column":1,"offset":1461},"end":{"line":24,"column":39,"offset":1499},"indent":[]}}],"position":{"start":{"line":24,"column":1,"offset":1461},"end":{"line":24,"column":39,"offset":1499},"indent":[]}},{"type":"list","ordered":false,"start":null,"spread":false,"children":[{"type":"listItem","spread":false,"checked":null,"children":[{"type":"paragraph","children":[{"type":"inlineCode","value":"message","position":{"start":{"line":26,"column":3,"offset":1503},"end":{"line":26,"column":12,"offset":1512},"indent":[]}},{"type":"text","value":": The message object that triggered the command.","position":{"start":{"line":26,"column":12,"offset":1512},"end":{"line":26,"column":60,"offset":1560},"indent":[]}}],"position":{"start":{"line":26,"column":3,"offset":1503},"end":{"line":26,"column":60,"offset":1560},"indent":[]}}],"position":{"start":{"line":26,"column":1,"offset":1501},"end":{"line":26,"column":60,"offset":1560},"indent":[]}},{"type":"listItem","spread":false,"checked":null,"children":[{"type":"paragraph","children":[{"type":"inlineCode","value":"command","position":{"start":{"line":27,"column":3,"offset":1563},"end":{"line":27,"column":12,"offset":1572},"indent":[]}},{"type":"text","value":": The command object itself that was triggered.","position":{"start":{"line":27,"column":12,"offset":1572},"end":{"line":27,"column":59,"offset":1619},"indent":[]}}],"position":{"start":{"line":27,"column":3,"offset":1563},"end":{"line":27,"column":59,"offset":1619},"indent":[]}}],"position":{"start":{"line":27,"column":1,"offset":1561},"end":{"line":27,"column":59,"offset":1619},"indent":[]}},{"type":"listItem","spread":false,"checked":null,"children":[{"type":"paragraph","children":[{"type":"inlineCode","value":"guild","position":{"start":{"line":28,"column":3,"offset":1622},"end":{"line":28,"column":10,"offset":1629},"indent":[]}},{"type":"text","value":": The server guild object where this command was ran.","position":{"start":{"line":28,"column":10,"offset":1629},"end":{"line":28,"column":63,"offset":1682},"indent":[]}}],"position":{"start":{"line":28,"column":3,"offset":1622},"end":{"line":28,"column":63,"offset":1682},"indent":[]}}],"position":{"start":{"line":28,"column":1,"offset":1620},"end":{"line":28,"column":63,"offset":1682},"indent":[]}}],"position":{"start":{"line":26,"column":1,"offset":1501},"end":{"line":28,"column":63,"offset":1682},"indent":[1,1]}},{"type":"heading","depth":2,"children":[{"type":"text","value":"Understanding How Inhibitors Function","position":{"start":{"line":30,"column":4,"offset":1687},"end":{"line":30,"column":41,"offset":1724},"indent":[]}}],"position":{"start":{"line":30,"column":1,"offset":1684},"end":{"line":30,"column":41,"offset":1724},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"To block a command you have to return a truthy value.","position":{"start":{"line":32,"column":1,"offset":1726},"end":{"line":32,"column":54,"offset":1779},"indent":[]}}],"position":{"start":{"line":32,"column":1,"offset":1726},"end":{"line":32,"column":54,"offset":1779},"indent":[]}},{"type":"list","ordered":false,"start":null,"spread":false,"children":[{"type":"listItem","spread":false,"checked":null,"children":[{"type":"paragraph","children":[{"type":"strong","children":[{"type":"text","value":"return true;","position":{"start":{"line":33,"column":5,"offset":1784},"end":{"line":33,"column":17,"offset":1796},"indent":[]}}],"position":{"start":{"line":33,"column":3,"offset":1782},"end":{"line":33,"column":19,"offset":1798},"indent":[]}},{"type":"text","value":" If you return true the inhibitor will block the execution of the command.\nTo allow a command return a falsey value.","position":{"start":{"line":33,"column":19,"offset":1798},"end":{"line":34,"column":42,"offset":1914},"indent":[1]}}],"position":{"start":{"line":33,"column":3,"offset":1782},"end":{"line":34,"column":42,"offset":1914},"indent":[1]}}],"position":{"start":{"line":33,"column":1,"offset":1780},"end":{"line":34,"column":42,"offset":1914},"indent":[1]}},{"type":"listItem","spread":false,"checked":null,"children":[{"type":"paragraph","children":[{"type":"strong","children":[{"type":"text","value":"return false;","position":{"start":{"line":35,"column":5,"offset":1919},"end":{"line":35,"column":18,"offset":1932},"indent":[]}}],"position":{"start":{"line":35,"column":3,"offset":1917},"end":{"line":35,"column":20,"offset":1934},"indent":[]}},{"type":"text","value":" If you return false the inhibitor will not block the error.","position":{"start":{"line":35,"column":20,"offset":1934},"end":{"line":35,"column":80,"offset":1994},"indent":[]}}],"position":{"start":{"line":35,"column":3,"offset":1917},"end":{"line":35,"column":80,"offset":1994},"indent":[]}}],"position":{"start":{"line":35,"column":1,"offset":1915},"end":{"line":35,"column":80,"offset":1994},"indent":[]}}],"position":{"start":{"line":33,"column":1,"offset":1780},"end":{"line":35,"column":80,"offset":1994},"indent":[1,1]}},{"type":"code","lang":"ts","meta":null,"value":"// If the command is not VIP only we can allow this command to execute\nif (!command.vipOnly) return false;\n\n// The bot's support server\nconst guild = cache.guilds.get(configs.supportServerID);\n// If the command author is not in the server they won't have the vip role\nconst member = guild.members.get(message.author.id) || await getMember(guild.id, message.author.id);\n// Member doesn't exist so cancel the command\nif (!member) {\n\tsendResponse(message, `sorry, but you can not use this command until you become VIP. **Close the IRIS!!!**`)\n\treturn true;\n}\n\n// If the user has the vip role on the support server given by patreon allow the command\nif (member.roles.includes(configs.patreonVIPRoleID)) return false;\n\n// Alert the user they don't have vip and can't use the command\nsendResponse(message, `sorry, but you can not use this command until you become a VIP. I'm sorry, Teal'c. We'll go to Disneyland next year. I promise.`)\n// Cancel the command since the user does not have vip\nreturn true;","position":{"start":{"line":38,"column":1,"offset":1997},"end":{"line":59,"column":4,"offset":3005},"indent":[1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1]}},{"type":"export","value":"export const _frontmatter = {\"title\":\"Creating Inhibitors!\",\"metaTitle\":\"Creating An Inhibitor | Discordeno\",\"metaDescription\":\"Let's create our very own bot with Discordeno!\"}","position":{"start":{"line":62,"column":1,"offset":3008},"end":{"line":62,"column":177,"offset":3184},"indent":[]}}],"position":{"start":{"line":1,"column":1,"offset":0},"end":{"line":62,"column":177,"offset":3184}}},"scopeImports":["import * as React from 'react'"],"scopeIdentifiers":["React"],"body":"function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }\n\nfunction _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }\n\nfunction _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }\n\n/* @jsx mdx */\nvar _frontmatter = {\n \"title\": \"Creating Inhibitors!\",\n \"metaTitle\": \"Creating An Inhibitor | Discordeno\",\n \"metaDescription\": \"Let's create our very own bot with Discordeno!\"\n};\nvar layoutProps = {\n _frontmatter: _frontmatter\n};\nvar MDXLayout = \"wrapper\";\nreturn function MDXContent(_ref) {\n var components = _ref.components,\n props = _objectWithoutProperties(_ref, [\"components\"]);\n\n return mdx(MDXLayout, _extends({}, layoutProps, props, {\n components: components,\n mdxType: \"MDXLayout\"\n }), mdx(\"p\", null, \"Woah! You are almost half way done with understanding all of Discordeno. Amazing isn't it? Something you may have noticed in the last section was there were some options that prevented some commands from running like \", mdx(\"inlineCode\", {\n parentName: \"p\"\n }, \"dmOnly\"), \" or the permission options. we created a setting to prevent the monitor from running in certain channels. What if we wanted to do prevent commands from happening? How would we prevent commands from running?\"), mdx(\"h2\", null, \"What is an Inhibitor?\"), mdx(\"p\", null, \"An Inhibitor is very similar to how monitors work. A monitor runs on every message but an inhibitor runs on every command. Remember all those command options like cooldown, permissions, permissionLevel, nsfw, etc... Each and every one of these options has an inhibitor in that checks commands for these settings.\"), mdx(\"p\", null, \"Let's create our own inhibitor that would prevent commands from being used if the user is not a VIP user.\"), mdx(\"blockquote\", null, mdx(\"p\", {\n parentName: \"blockquote\"\n }, mdx(\"strong\", {\n parentName: \"p\"\n }, \"Note:\"), \" It is important to remember that everything below can be done with a simple permission level as well. We will create our own custom permission levels but for the purposes of this guide and to be able to learn about Inhibitors, we will be using an inhibitor.\")), mdx(\"h2\", null, \"Creating the File\"), mdx(\"p\", null, \"Let's start by creating a file inside the inhibitors folder called \", mdx(\"inlineCode\", {\n parentName: \"p\"\n }, \"boosted.ts\"), \" and paste the following snippet of code:\"), mdx(\"pre\", null, mdx(\"code\", _extends({\n parentName: \"pre\"\n }, {\n \"className\": \"language-ts\"\n }), \"import { botCache } from \\\"../../mod.ts\\\";\\n\\nbotCache.inhibitors.set(\\\"inhibitorname\\\", async function (message, command, guild) {\\n // Your code goes here\\n});\\n\")), mdx(\"p\", null, \"Inhibitors can take up to 3 arguments.\"), mdx(\"ul\", null, mdx(\"li\", {\n parentName: \"ul\"\n }, mdx(\"inlineCode\", {\n parentName: \"li\"\n }, \"message\"), \": The message object that triggered the command.\"), mdx(\"li\", {\n parentName: \"ul\"\n }, mdx(\"inlineCode\", {\n parentName: \"li\"\n }, \"command\"), \": The command object itself that was triggered.\"), mdx(\"li\", {\n parentName: \"ul\"\n }, mdx(\"inlineCode\", {\n parentName: \"li\"\n }, \"guild\"), \": The server guild object where this command was ran.\")), mdx(\"h2\", null, \"Understanding How Inhibitors Function\"), mdx(\"p\", null, \"To block a command you have to return a truthy value.\"), mdx(\"ul\", null, mdx(\"li\", {\n parentName: \"ul\"\n }, mdx(\"strong\", {\n parentName: \"li\"\n }, \"return true;\"), \" If you return true the inhibitor will block the execution of the command.\\nTo allow a command return a falsey value.\"), mdx(\"li\", {\n parentName: \"ul\"\n }, mdx(\"strong\", {\n parentName: \"li\"\n }, \"return false;\"), \" If you return false the inhibitor will not block the error.\")), mdx(\"pre\", null, mdx(\"code\", _extends({\n parentName: \"pre\"\n }, {\n \"className\": \"language-ts\"\n }), \"// If the command is not VIP only we can allow this command to execute\\nif (!command.vipOnly) return false;\\n\\n// The bot's support server\\nconst guild = cache.guilds.get(configs.supportServerID);\\n// If the command author is not in the server they won't have the vip role\\nconst member = guild.members.get(message.author.id) || await getMember(guild.id, message.author.id);\\n// Member doesn't exist so cancel the command\\nif (!member) {\\n sendResponse(message, `sorry, but you can not use this command until you become VIP. **Close the IRIS!!!**`)\\n return true;\\n}\\n\\n// If the user has the vip role on the support server given by patreon allow the command\\nif (member.roles.includes(configs.patreonVIPRoleID)) return false;\\n\\n// Alert the user they don't have vip and can't use the command\\nsendResponse(message, `sorry, but you can not use this command until you become a VIP. I'm sorry, Teal'c. We'll go to Disneyland next year. I promise.`)\\n// Cancel the command since the user does not have vip\\nreturn true;\\n\")));\n}\n;\nMDXContent.isMDXComponent = true;","rawMDXOutput":"/* @jsx mdx */\nimport { mdx } from '@mdx-js/react';\n/* @jsx mdx */\n\nexport const _frontmatter = {\n \"title\": \"Creating Inhibitors!\",\n \"metaTitle\": \"Creating An Inhibitor | Discordeno\",\n \"metaDescription\": \"Let's create our very own bot with Discordeno!\"\n};\n\nconst layoutProps = {\n _frontmatter\n};\nconst MDXLayout = \"wrapper\"\nexport default function MDXContent({\n components,\n ...props\n}) {\n return \n

{`Woah! You are almost half way done with understanding all of Discordeno. Amazing isn't it? Something you may have noticed in the last section was there were some options that prevented some commands from running like `}{`dmOnly`}{` or the permission options. we created a setting to prevent the monitor from running in certain channels. What if we wanted to do prevent commands from happening? How would we prevent commands from running?`}

\n

{`What is an Inhibitor?`}

\n

{`An Inhibitor is very similar to how monitors work. A monitor runs on every message but an inhibitor runs on every command. Remember all those command options like cooldown, permissions, permissionLevel, nsfw, etc... Each and every one of these options has an inhibitor in that checks commands for these settings.`}

\n

{`Let's create our own inhibitor that would prevent commands from being used if the user is not a VIP user.`}

\n
\n

{`Note:`}{` It is important to remember that everything below can be done with a simple permission level as well. We will create our own custom permission levels but for the purposes of this guide and to be able to learn about Inhibitors, we will be using an inhibitor.`}

\n
\n

{`Creating the File`}

\n

{`Let's start by creating a file inside the inhibitors folder called `}{`boosted.ts`}{` and paste the following snippet of code:`}

\n
{`import { botCache } from \"../../mod.ts\";\n\nbotCache.inhibitors.set(\"inhibitorname\", async function (message, command, guild) {\n    // Your code goes here\n});\n`}
\n

{`Inhibitors can take up to 3 arguments.`}

\n
    \n
  • {`message`}{`: The message object that triggered the command.`}
  • \n
  • {`command`}{`: The command object itself that was triggered.`}
  • \n
  • {`guild`}{`: The server guild object where this command was ran.`}
  • \n
\n

{`Understanding How Inhibitors Function`}

\n

{`To block a command you have to return a truthy value.`}

\n
    \n
  • {`return true;`}{` If you return true the inhibitor will block the execution of the command.\nTo allow a command return a falsey value.`}
  • \n
  • {`return false;`}{` If you return false the inhibitor will not block the error.`}
  • \n
\n
{`// If the command is not VIP only we can allow this command to execute\nif (!command.vipOnly) return false;\n\n// The bot's support server\nconst guild = cache.guilds.get(configs.supportServerID);\n// If the command author is not in the server they won't have the vip role\nconst member = guild.members.get(message.author.id) || await getMember(guild.id, message.author.id);\n// Member doesn't exist so cancel the command\nif (!member) {\n    sendResponse(message, \\`sorry, but you can not use this command until you become VIP. **Close the IRIS!!!**\\`)\n    return true;\n}\n\n// If the user has the vip role on the support server given by patreon allow the command\nif (member.roles.includes(configs.patreonVIPRoleID)) return false;\n\n// Alert the user they don't have vip and can't use the command\nsendResponse(message, \\`sorry, but you can not use this command until you become a VIP. I'm sorry, Teal'c. We'll go to Disneyland next year. I promise.\\`)\n// Cancel the command since the user does not have vip\nreturn true;\n`}
\n\n
;\n}\n\n;\nMDXContent.isMDXComponent = true;"}} \ No newline at end of file diff --git a/docs/.cache/caches/gatsby-plugin-mdx/diskstore-cfd4225219eb57ca4e1b297ced12d60e.json b/docs/.cache/caches/gatsby-plugin-mdx/diskstore-cfd4225219eb57ca4e1b297ced12d60e.json new file mode 100644 index 000000000..925500887 --- /dev/null +++ b/docs/.cache/caches/gatsby-plugin-mdx/diskstore-cfd4225219eb57ca4e1b297ced12d60e.json @@ -0,0 +1 @@ +{"expireTime":9007200851634092000,"key":"gatsby-plugin-mdx-entire-payload-9ea52f02ae2c38b3604b81abe8b4fb63-","val":{"mdast":{"type":"root","children":[{"type":"paragraph","children":[{"type":"text","value":"Woah! You are almost half way done with understanding all of Discordeno. Amazing isn't it? Something you may have noticed in the last section was there were some options that prevented some commands from running like ","position":{"start":{"line":2,"column":1,"offset":1},"end":{"line":2,"column":218,"offset":218},"indent":[]}},{"type":"inlineCode","value":"dmOnly","position":{"start":{"line":2,"column":218,"offset":218},"end":{"line":2,"column":226,"offset":226},"indent":[]}},{"type":"text","value":" or the permission options. we created a setting to prevent the monitor from running in certain channels. What if we wanted to do prevent commands from happening? How would we prevent commands from running?","position":{"start":{"line":2,"column":226,"offset":226},"end":{"line":2,"column":432,"offset":432},"indent":[]}}],"position":{"start":{"line":2,"column":1,"offset":1},"end":{"line":2,"column":432,"offset":432},"indent":[]}},{"type":"heading","depth":2,"children":[{"type":"text","value":"What is an Inhibitor?","position":{"start":{"line":4,"column":4,"offset":437},"end":{"line":4,"column":25,"offset":458},"indent":[]}}],"position":{"start":{"line":4,"column":1,"offset":434},"end":{"line":4,"column":25,"offset":458},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"An Inhibitor is very similar to how monitors work. A monitor runs on every message but an inhibitor runs on every command. Remember all those command options like cooldown, permissions, permissionLevel, nsfw, etc... Each and every one of these options has an inhibitor in that checks commands for these settings.","position":{"start":{"line":6,"column":1,"offset":460},"end":{"line":6,"column":313,"offset":772},"indent":[]}}],"position":{"start":{"line":6,"column":1,"offset":460},"end":{"line":6,"column":313,"offset":772},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"Let's create our own inhibitor that would prevent commands from being used if the user is not a VIP user.","position":{"start":{"line":8,"column":1,"offset":774},"end":{"line":8,"column":106,"offset":879},"indent":[]}}],"position":{"start":{"line":8,"column":1,"offset":774},"end":{"line":8,"column":106,"offset":879},"indent":[]}},{"type":"blockquote","children":[{"type":"paragraph","children":[{"type":"strong","children":[{"type":"text","value":"Note:","position":{"start":{"line":10,"column":5,"offset":885},"end":{"line":10,"column":10,"offset":890},"indent":[]}}],"position":{"start":{"line":10,"column":3,"offset":883},"end":{"line":10,"column":12,"offset":892},"indent":[]}},{"type":"text","value":" It is important to remember that everything below can be done with a simple permission level as well. We will create our own custom permission levels but for the purposes of this guide and to be able to learn about Inhibitors, we will be using an inhibitor.","position":{"start":{"line":10,"column":12,"offset":892},"end":{"line":10,"column":270,"offset":1150},"indent":[]}}],"position":{"start":{"line":10,"column":3,"offset":883},"end":{"line":10,"column":270,"offset":1150},"indent":[]}}],"position":{"start":{"line":10,"column":1,"offset":881},"end":{"line":10,"column":270,"offset":1150},"indent":[]}},{"type":"heading","depth":2,"children":[{"type":"text","value":"Creating the File","position":{"start":{"line":12,"column":4,"offset":1155},"end":{"line":12,"column":21,"offset":1172},"indent":[]}}],"position":{"start":{"line":12,"column":1,"offset":1152},"end":{"line":12,"column":21,"offset":1172},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"Let's start by creating a file inside the inhibitors folder called ","position":{"start":{"line":14,"column":1,"offset":1174},"end":{"line":14,"column":68,"offset":1241},"indent":[]}},{"type":"inlineCode","value":"boosted.ts","position":{"start":{"line":14,"column":68,"offset":1241},"end":{"line":14,"column":80,"offset":1253},"indent":[]}},{"type":"text","value":" and paste the following snippet of code:","position":{"start":{"line":14,"column":80,"offset":1253},"end":{"line":14,"column":121,"offset":1294},"indent":[]}}],"position":{"start":{"line":14,"column":1,"offset":1174},"end":{"line":14,"column":121,"offset":1294},"indent":[]}},{"type":"code","lang":"ts","meta":null,"value":"import { botCache } from \"../../mod.ts\";\n\nbotCache.inhibitors.set(\"inhibitorname\", async function (message, command, guild) {\n\t// Your code goes here\n});","position":{"start":{"line":16,"column":1,"offset":1296},"end":{"line":22,"column":4,"offset":1459},"indent":[1,1,1,1,1,1]}},{"type":"paragraph","children":[{"type":"text","value":"Inhibitors can take up to 3 arguments.","position":{"start":{"line":24,"column":1,"offset":1461},"end":{"line":24,"column":39,"offset":1499},"indent":[]}}],"position":{"start":{"line":24,"column":1,"offset":1461},"end":{"line":24,"column":39,"offset":1499},"indent":[]}},{"type":"list","ordered":false,"start":null,"spread":false,"children":[{"type":"listItem","spread":false,"checked":null,"children":[{"type":"paragraph","children":[{"type":"inlineCode","value":"message","position":{"start":{"line":26,"column":3,"offset":1503},"end":{"line":26,"column":12,"offset":1512},"indent":[]}},{"type":"text","value":": The message object that triggered the command.","position":{"start":{"line":26,"column":12,"offset":1512},"end":{"line":26,"column":60,"offset":1560},"indent":[]}}],"position":{"start":{"line":26,"column":3,"offset":1503},"end":{"line":26,"column":60,"offset":1560},"indent":[]}}],"position":{"start":{"line":26,"column":1,"offset":1501},"end":{"line":26,"column":60,"offset":1560},"indent":[]}},{"type":"listItem","spread":false,"checked":null,"children":[{"type":"paragraph","children":[{"type":"inlineCode","value":"command","position":{"start":{"line":27,"column":3,"offset":1563},"end":{"line":27,"column":12,"offset":1572},"indent":[]}},{"type":"text","value":": The command object itself that was triggered.","position":{"start":{"line":27,"column":12,"offset":1572},"end":{"line":27,"column":59,"offset":1619},"indent":[]}}],"position":{"start":{"line":27,"column":3,"offset":1563},"end":{"line":27,"column":59,"offset":1619},"indent":[]}}],"position":{"start":{"line":27,"column":1,"offset":1561},"end":{"line":27,"column":59,"offset":1619},"indent":[]}},{"type":"listItem","spread":false,"checked":null,"children":[{"type":"paragraph","children":[{"type":"inlineCode","value":"guild","position":{"start":{"line":28,"column":3,"offset":1622},"end":{"line":28,"column":10,"offset":1629},"indent":[]}},{"type":"text","value":": The server guild object where this command was ran.","position":{"start":{"line":28,"column":10,"offset":1629},"end":{"line":28,"column":63,"offset":1682},"indent":[]}}],"position":{"start":{"line":28,"column":3,"offset":1622},"end":{"line":28,"column":63,"offset":1682},"indent":[]}}],"position":{"start":{"line":28,"column":1,"offset":1620},"end":{"line":28,"column":63,"offset":1682},"indent":[]}}],"position":{"start":{"line":26,"column":1,"offset":1501},"end":{"line":28,"column":63,"offset":1682},"indent":[1,1]}},{"type":"heading","depth":2,"children":[{"type":"text","value":"Understanding How Inhibitors Function","position":{"start":{"line":30,"column":4,"offset":1687},"end":{"line":30,"column":41,"offset":1724},"indent":[]}}],"position":{"start":{"line":30,"column":1,"offset":1684},"end":{"line":30,"column":41,"offset":1724},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"To block a command you have to return a truthy value.","position":{"start":{"line":32,"column":1,"offset":1726},"end":{"line":32,"column":54,"offset":1779},"indent":[]}}],"position":{"start":{"line":32,"column":1,"offset":1726},"end":{"line":32,"column":54,"offset":1779},"indent":[]}},{"type":"list","ordered":false,"start":null,"spread":false,"children":[{"type":"listItem","spread":false,"checked":null,"children":[{"type":"paragraph","children":[{"type":"strong","children":[{"type":"text","value":"return true;","position":{"start":{"line":33,"column":5,"offset":1784},"end":{"line":33,"column":17,"offset":1796},"indent":[]}}],"position":{"start":{"line":33,"column":3,"offset":1782},"end":{"line":33,"column":19,"offset":1798},"indent":[]}},{"type":"text","value":" If you return true the inhibitor will block the execution of the command.\nTo allow a command return a falsey value.","position":{"start":{"line":33,"column":19,"offset":1798},"end":{"line":34,"column":42,"offset":1914},"indent":[1]}}],"position":{"start":{"line":33,"column":3,"offset":1782},"end":{"line":34,"column":42,"offset":1914},"indent":[1]}}],"position":{"start":{"line":33,"column":1,"offset":1780},"end":{"line":34,"column":42,"offset":1914},"indent":[1]}},{"type":"listItem","spread":false,"checked":null,"children":[{"type":"paragraph","children":[{"type":"strong","children":[{"type":"text","value":"return false;","position":{"start":{"line":35,"column":5,"offset":1919},"end":{"line":35,"column":18,"offset":1932},"indent":[]}}],"position":{"start":{"line":35,"column":3,"offset":1917},"end":{"line":35,"column":20,"offset":1934},"indent":[]}},{"type":"text","value":" If you return false the inhibitor will not block the error.","position":{"start":{"line":35,"column":20,"offset":1934},"end":{"line":35,"column":80,"offset":1994},"indent":[]}}],"position":{"start":{"line":35,"column":3,"offset":1917},"end":{"line":35,"column":80,"offset":1994},"indent":[]}}],"position":{"start":{"line":35,"column":1,"offset":1915},"end":{"line":35,"column":80,"offset":1994},"indent":[]}}],"position":{"start":{"line":33,"column":1,"offset":1780},"end":{"line":35,"column":80,"offset":1994},"indent":[1,1]}},{"type":"code","lang":"ts","meta":null,"value":"// If the command is not VIP only we can allow this command to execute\nif (!command.vipOnly) return false;\n\n// Check if the user has the vip role on the support server given by patreon\n\nconst userIsVIP = await isUserVIP(message.author.id)\n// The user is VIP so we can allow this command to be used\nif (userIsVIP) return false;\n\n// The user is NOT VIP so we throw an error\nthrow `The ${command.name} is only allowed for VIP users.`","position":{"start":{"line":38,"column":1,"offset":1997},"end":{"line":50,"column":4,"offset":2437},"indent":[1,1,1,1,1,1,1,1,1,1,1,1]}},{"type":"export","value":"export const _frontmatter = {\"title\":\"Creating Inhibitors!\",\"metaTitle\":\"Creating An Inhibitor | Discordeno\",\"metaDescription\":\"Let's create our very own bot with Discordeno!\"}","position":{"start":{"line":53,"column":1,"offset":2440},"end":{"line":53,"column":177,"offset":2616},"indent":[]}}],"position":{"start":{"line":1,"column":1,"offset":0},"end":{"line":53,"column":177,"offset":2616}}},"scopeImports":["import * as React from 'react'"],"scopeIdentifiers":["React"],"body":"function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }\n\nfunction _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }\n\nfunction _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }\n\n/* @jsx mdx */\nvar _frontmatter = {\n \"title\": \"Creating Inhibitors!\",\n \"metaTitle\": \"Creating An Inhibitor | Discordeno\",\n \"metaDescription\": \"Let's create our very own bot with Discordeno!\"\n};\nvar layoutProps = {\n _frontmatter: _frontmatter\n};\nvar MDXLayout = \"wrapper\";\nreturn function MDXContent(_ref) {\n var components = _ref.components,\n props = _objectWithoutProperties(_ref, [\"components\"]);\n\n return mdx(MDXLayout, _extends({}, layoutProps, props, {\n components: components,\n mdxType: \"MDXLayout\"\n }), mdx(\"p\", null, \"Woah! You are almost half way done with understanding all of Discordeno. Amazing isn't it? Something you may have noticed in the last section was there were some options that prevented some commands from running like \", mdx(\"inlineCode\", {\n parentName: \"p\"\n }, \"dmOnly\"), \" or the permission options. we created a setting to prevent the monitor from running in certain channels. What if we wanted to do prevent commands from happening? How would we prevent commands from running?\"), mdx(\"h2\", null, \"What is an Inhibitor?\"), mdx(\"p\", null, \"An Inhibitor is very similar to how monitors work. A monitor runs on every message but an inhibitor runs on every command. Remember all those command options like cooldown, permissions, permissionLevel, nsfw, etc... Each and every one of these options has an inhibitor in that checks commands for these settings.\"), mdx(\"p\", null, \"Let's create our own inhibitor that would prevent commands from being used if the user is not a VIP user.\"), mdx(\"blockquote\", null, mdx(\"p\", {\n parentName: \"blockquote\"\n }, mdx(\"strong\", {\n parentName: \"p\"\n }, \"Note:\"), \" It is important to remember that everything below can be done with a simple permission level as well. We will create our own custom permission levels but for the purposes of this guide and to be able to learn about Inhibitors, we will be using an inhibitor.\")), mdx(\"h2\", null, \"Creating the File\"), mdx(\"p\", null, \"Let's start by creating a file inside the inhibitors folder called \", mdx(\"inlineCode\", {\n parentName: \"p\"\n }, \"boosted.ts\"), \" and paste the following snippet of code:\"), mdx(\"pre\", null, mdx(\"code\", _extends({\n parentName: \"pre\"\n }, {\n \"className\": \"language-ts\"\n }), \"import { botCache } from \\\"../../mod.ts\\\";\\n\\nbotCache.inhibitors.set(\\\"inhibitorname\\\", async function (message, command, guild) {\\n // Your code goes here\\n});\\n\")), mdx(\"p\", null, \"Inhibitors can take up to 3 arguments.\"), mdx(\"ul\", null, mdx(\"li\", {\n parentName: \"ul\"\n }, mdx(\"inlineCode\", {\n parentName: \"li\"\n }, \"message\"), \": The message object that triggered the command.\"), mdx(\"li\", {\n parentName: \"ul\"\n }, mdx(\"inlineCode\", {\n parentName: \"li\"\n }, \"command\"), \": The command object itself that was triggered.\"), mdx(\"li\", {\n parentName: \"ul\"\n }, mdx(\"inlineCode\", {\n parentName: \"li\"\n }, \"guild\"), \": The server guild object where this command was ran.\")), mdx(\"h2\", null, \"Understanding How Inhibitors Function\"), mdx(\"p\", null, \"To block a command you have to return a truthy value.\"), mdx(\"ul\", null, mdx(\"li\", {\n parentName: \"ul\"\n }, mdx(\"strong\", {\n parentName: \"li\"\n }, \"return true;\"), \" If you return true the inhibitor will block the execution of the command.\\nTo allow a command return a falsey value.\"), mdx(\"li\", {\n parentName: \"ul\"\n }, mdx(\"strong\", {\n parentName: \"li\"\n }, \"return false;\"), \" If you return false the inhibitor will not block the error.\")), mdx(\"pre\", null, mdx(\"code\", _extends({\n parentName: \"pre\"\n }, {\n \"className\": \"language-ts\"\n }), \"// If the command is not VIP only we can allow this command to execute\\nif (!command.vipOnly) return false;\\n\\n// Check if the user has the vip role on the support server given by patreon\\n\\nconst userIsVIP = await isUserVIP(message.author.id)\\n// The user is VIP so we can allow this command to be used\\nif (userIsVIP) return false;\\n\\n// The user is NOT VIP so we throw an error\\nthrow `The ${command.name} is only allowed for VIP users.`\\n\")));\n}\n;\nMDXContent.isMDXComponent = true;","rawMDXOutput":"/* @jsx mdx */\nimport { mdx } from '@mdx-js/react';\n/* @jsx mdx */\n\nexport const _frontmatter = {\n \"title\": \"Creating Inhibitors!\",\n \"metaTitle\": \"Creating An Inhibitor | Discordeno\",\n \"metaDescription\": \"Let's create our very own bot with Discordeno!\"\n};\n\nconst layoutProps = {\n _frontmatter\n};\nconst MDXLayout = \"wrapper\"\nexport default function MDXContent({\n components,\n ...props\n}) {\n return \n

{`Woah! You are almost half way done with understanding all of Discordeno. Amazing isn't it? Something you may have noticed in the last section was there were some options that prevented some commands from running like `}{`dmOnly`}{` or the permission options. we created a setting to prevent the monitor from running in certain channels. What if we wanted to do prevent commands from happening? How would we prevent commands from running?`}

\n

{`What is an Inhibitor?`}

\n

{`An Inhibitor is very similar to how monitors work. A monitor runs on every message but an inhibitor runs on every command. Remember all those command options like cooldown, permissions, permissionLevel, nsfw, etc... Each and every one of these options has an inhibitor in that checks commands for these settings.`}

\n

{`Let's create our own inhibitor that would prevent commands from being used if the user is not a VIP user.`}

\n
\n

{`Note:`}{` It is important to remember that everything below can be done with a simple permission level as well. We will create our own custom permission levels but for the purposes of this guide and to be able to learn about Inhibitors, we will be using an inhibitor.`}

\n
\n

{`Creating the File`}

\n

{`Let's start by creating a file inside the inhibitors folder called `}{`boosted.ts`}{` and paste the following snippet of code:`}

\n
{`import { botCache } from \"../../mod.ts\";\n\nbotCache.inhibitors.set(\"inhibitorname\", async function (message, command, guild) {\n    // Your code goes here\n});\n`}
\n

{`Inhibitors can take up to 3 arguments.`}

\n
    \n
  • {`message`}{`: The message object that triggered the command.`}
  • \n
  • {`command`}{`: The command object itself that was triggered.`}
  • \n
  • {`guild`}{`: The server guild object where this command was ran.`}
  • \n
\n

{`Understanding How Inhibitors Function`}

\n

{`To block a command you have to return a truthy value.`}

\n
    \n
  • {`return true;`}{` If you return true the inhibitor will block the execution of the command.\nTo allow a command return a falsey value.`}
  • \n
  • {`return false;`}{` If you return false the inhibitor will not block the error.`}
  • \n
\n
{`// If the command is not VIP only we can allow this command to execute\nif (!command.vipOnly) return false;\n\n// Check if the user has the vip role on the support server given by patreon\n\nconst userIsVIP = await isUserVIP(message.author.id)\n// The user is VIP so we can allow this command to be used\nif (userIsVIP) return false;\n\n// The user is NOT VIP so we throw an error\nthrow \\`The \\${command.name} is only allowed for VIP users.\\`\n`}
\n\n
;\n}\n\n;\nMDXContent.isMDXComponent = true;"}} \ No newline at end of file diff --git a/docs/.cache/caches/gatsby-plugin-mdx/diskstore-d0206f0c19b6e19f320bdee5a8aabc4e.json b/docs/.cache/caches/gatsby-plugin-mdx/diskstore-d0206f0c19b6e19f320bdee5a8aabc4e.json new file mode 100644 index 000000000..803f2c74f --- /dev/null +++ b/docs/.cache/caches/gatsby-plugin-mdx/diskstore-d0206f0c19b6e19f320bdee5a8aabc4e.json @@ -0,0 +1 @@ +{"expireTime":9007200851635121000,"key":"gatsby-plugin-mdx-entire-payload-e82d20b4fa27c49077e60a68f205e5f2-","val":{"mdast":{"type":"root","children":[{"type":"paragraph","children":[{"type":"text","value":"Woah! You are almost half way done with understanding all of Discordeno. Amazing isn't it? Something you may have noticed in the last section was when the bot started up you could see a bunch of messages like `Loaded X ","position":{"start":{"line":2,"column":1,"offset":1},"end":{"line":2,"column":220,"offset":220},"indent":[]}}],"position":{"start":{"line":2,"column":1,"offset":1},"end":{"line":2,"column":220,"offset":220},"indent":[]}},{"type":"heading","depth":2,"children":[{"type":"text","value":"What Is An Event?","position":{"start":{"line":4,"column":4,"offset":225},"end":{"line":4,"column":21,"offset":242},"indent":[]}}],"position":{"start":{"line":4,"column":1,"offset":222},"end":{"line":4,"column":21,"offset":242},"indent":[]}},{"type":"export","value":"export const _frontmatter = {\"title\":\"Creating Events!\",\"metaTitle\":\"Creating An Event | Discordeno\",\"metaDescription\":\"Let's create our very own bot with Discordeno!\"}","position":{"start":{"line":8,"column":1,"offset":246},"end":{"line":8,"column":169,"offset":414},"indent":[]}}],"position":{"start":{"line":1,"column":1,"offset":0},"end":{"line":8,"column":169,"offset":414}}},"scopeImports":["import * as React from 'react'"],"scopeIdentifiers":["React"],"body":"function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }\n\nfunction _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }\n\nfunction _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }\n\n/* @jsx mdx */\nvar _frontmatter = {\n \"title\": \"Creating Events!\",\n \"metaTitle\": \"Creating An Event | Discordeno\",\n \"metaDescription\": \"Let's create our very own bot with Discordeno!\"\n};\nvar layoutProps = {\n _frontmatter: _frontmatter\n};\nvar MDXLayout = \"wrapper\";\nreturn function MDXContent(_ref) {\n var components = _ref.components,\n props = _objectWithoutProperties(_ref, [\"components\"]);\n\n return mdx(MDXLayout, _extends({}, layoutProps, props, {\n components: components,\n mdxType: \"MDXLayout\"\n }), mdx(\"p\", null, \"Woah! You are almost half way done with understanding all of Discordeno. Amazing isn't it? Something you may have noticed in the last section was when the bot started up you could see a bunch of messages like `Loaded X \"), mdx(\"h2\", null, \"What Is An Event?\"));\n}\n;\nMDXContent.isMDXComponent = true;","rawMDXOutput":"/* @jsx mdx */\nimport { mdx } from '@mdx-js/react';\n/* @jsx mdx */\n\nexport const _frontmatter = {\n \"title\": \"Creating Events!\",\n \"metaTitle\": \"Creating An Event | Discordeno\",\n \"metaDescription\": \"Let's create our very own bot with Discordeno!\"\n};\n\nconst layoutProps = {\n _frontmatter\n};\nconst MDXLayout = \"wrapper\"\nexport default function MDXContent({\n components,\n ...props\n}) {\n return \n

{`Woah! You are almost half way done with understanding all of Discordeno. Amazing isn't it? Something you may have noticed in the last section was when the bot started up you could see a bunch of messages like \\`Loaded X `}

\n

{`What Is An Event?`}

\n\n
;\n}\n\n;\nMDXContent.isMDXComponent = true;"}} \ No newline at end of file diff --git a/docs/.cache/caches/gatsby-plugin-mdx/diskstore-d1b5c8a2fe19315f0574266d275505c1.json b/docs/.cache/caches/gatsby-plugin-mdx/diskstore-d1b5c8a2fe19315f0574266d275505c1.json new file mode 100644 index 000000000..79ced3f95 --- /dev/null +++ b/docs/.cache/caches/gatsby-plugin-mdx/diskstore-d1b5c8a2fe19315f0574266d275505c1.json @@ -0,0 +1 @@ +{"expireTime":9007200851642145000,"key":"gatsby-plugin-mdx-entire-payload-f7ae7373f6499fef16cf20577031996a-","val":{"mdast":{"type":"root","children":[{"type":"paragraph","children":[{"type":"text","value":"Holy bananza! You even got the entire languages complete. You are well on your way to mastering 23 different languages. Now we are going to down and dirty with monitors.","position":{"start":{"line":2,"column":1,"offset":1},"end":{"line":2,"column":170,"offset":170},"indent":[]}}],"position":{"start":{"line":2,"column":1,"offset":1},"end":{"line":2,"column":170,"offset":170},"indent":[]}},{"type":"heading","depth":2,"children":[{"type":"text","value":"What is a monitor?","position":{"start":{"line":4,"column":4,"offset":175},"end":{"line":4,"column":22,"offset":193},"indent":[]}}],"position":{"start":{"line":4,"column":1,"offset":172},"end":{"line":4,"column":22,"offset":193},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"Monitors are functions that will run on every single message that is sent in every channel that your bot has permissions to read. When you want to do something on every single message that is sent, the best way to do that is to create a new monitor.","position":{"start":{"line":6,"column":1,"offset":195},"end":{"line":6,"column":250,"offset":444},"indent":[]}}],"position":{"start":{"line":6,"column":1,"offset":195},"end":{"line":6,"column":250,"offset":444},"indent":[]}},{"type":"heading","depth":2,"children":[{"type":"text","value":"Command Handler Monitor","position":{"start":{"line":8,"column":4,"offset":449},"end":{"line":8,"column":27,"offset":472},"indent":[]}}],"position":{"start":{"line":8,"column":1,"offset":446},"end":{"line":8,"column":27,"offset":472},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"Discordeno come built with a monitor called ","position":{"start":{"line":10,"column":1,"offset":474},"end":{"line":10,"column":45,"offset":518},"indent":[]}},{"type":"inlineCode","value":"commandHandler","position":{"start":{"line":10,"column":45,"offset":518},"end":{"line":10,"column":61,"offset":534},"indent":[]}},{"type":"text","value":". This monitor runs on every message sent and figures out if it is a command and executes the command. If it is a valid command with a valid prefix, Discordeno runs that command.","position":{"start":{"line":10,"column":61,"offset":534},"end":{"line":10,"column":239,"offset":712},"indent":[]}}],"position":{"start":{"line":10,"column":1,"offset":474},"end":{"line":10,"column":239,"offset":712},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"Let's try and create our own monitor so we can understand it better. Suppose we wanted to build a filter that would delete any message which included a discord invite link.","position":{"start":{"line":12,"column":1,"offset":714},"end":{"line":12,"column":173,"offset":886},"indent":[]}}],"position":{"start":{"line":12,"column":1,"offset":714},"end":{"line":12,"column":173,"offset":886},"indent":[]}},{"type":"heading","depth":2,"children":[{"type":"text","value":"Creating Invite Filter Monitor","position":{"start":{"line":14,"column":4,"offset":891},"end":{"line":14,"column":34,"offset":921},"indent":[]}}],"position":{"start":{"line":14,"column":1,"offset":888},"end":{"line":14,"column":34,"offset":921},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"To start, we make a new file in the monitors folder called ","position":{"start":{"line":16,"column":1,"offset":923},"end":{"line":16,"column":60,"offset":982},"indent":[]}},{"type":"inlineCode","value":"inviteFilter.ts","position":{"start":{"line":16,"column":60,"offset":982},"end":{"line":16,"column":77,"offset":999},"indent":[]}},{"type":"text","value":". Then you can paste in the following base monitor snippet.","position":{"start":{"line":16,"column":77,"offset":999},"end":{"line":16,"column":136,"offset":1058},"indent":[]}}],"position":{"start":{"line":16,"column":1,"offset":923},"end":{"line":16,"column":136,"offset":1058},"indent":[]}},{"type":"code","lang":"ts","meta":null,"value":"import { botCache } from \"../../mod.ts\";\n\nbotCache.monitors.set(\"monitorname\", {\n\tname: \"monitorname\",\n ignoreBots: true,\n ignoreOthers: false,\n ignoreEdits: false,\n ignoreDM: true,\n userServerPermissions: [],\n userChannelPermissions: [],\n botServerPermissions: [],\n botChannelPermissions: [],\n execute: async function (message) {\n\t\t// Your code goes here\n },\n});","position":{"start":{"line":18,"column":1,"offset":1060},"end":{"line":35,"column":4,"offset":1443},"indent":[1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1]}},{"type":"heading","depth":2,"children":[{"type":"text","value":"Understanding Monitor Options","position":{"start":{"line":37,"column":4,"offset":1448},"end":{"line":37,"column":33,"offset":1477},"indent":[]}}],"position":{"start":{"line":37,"column":1,"offset":1445},"end":{"line":37,"column":33,"offset":1477},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"The monitor options are very similar in functionality with the command options.","position":{"start":{"line":39,"column":1,"offset":1479},"end":{"line":39,"column":80,"offset":1558},"indent":[]}}],"position":{"start":{"line":39,"column":1,"offset":1479},"end":{"line":39,"column":80,"offset":1558},"indent":[]}},{"type":"heading","depth":3,"children":[{"type":"text","value":"Monitor Name","position":{"start":{"line":41,"column":5,"offset":1564},"end":{"line":41,"column":17,"offset":1576},"indent":[]}}],"position":{"start":{"line":41,"column":1,"offset":1560},"end":{"line":41,"column":17,"offset":1576},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"Similar to the command name, we will specify a unique name for the monitors. In this case let's call it inviteFilter","position":{"start":{"line":43,"column":1,"offset":1578},"end":{"line":43,"column":117,"offset":1694},"indent":[]}}],"position":{"start":{"line":43,"column":1,"offset":1578},"end":{"line":43,"column":117,"offset":1694},"indent":[]}},{"type":"code","lang":"ts","meta":null,"value":"botCache.monitors.set(\"monitorname\", {\n\tname: \"monitorname\",","position":{"start":{"line":45,"column":1,"offset":1696},"end":{"line":48,"column":4,"offset":1766},"indent":[1,1,1]}},{"type":"heading","depth":3,"children":[{"type":"text","value":"Ignore Options","position":{"start":{"line":50,"column":5,"offset":1772},"end":{"line":50,"column":19,"offset":1786},"indent":[]}}],"position":{"start":{"line":50,"column":1,"offset":1768},"end":{"line":50,"column":19,"offset":1786},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"The ignore options are filters that you can use to enable/disable the monitor from running in those specific circumstances. The default option for each monitor is shown in the base snippet above.","position":{"start":{"line":52,"column":1,"offset":1788},"end":{"line":52,"column":196,"offset":1983},"indent":[]}}],"position":{"start":{"line":52,"column":1,"offset":1788},"end":{"line":52,"column":196,"offset":1983},"indent":[]}},{"type":"list","ordered":false,"start":null,"spread":false,"children":[{"type":"listItem","spread":false,"checked":null,"children":[{"type":"paragraph","children":[{"type":"strong","children":[{"type":"text","value":"ignoreBots","position":{"start":{"line":54,"column":5,"offset":1989},"end":{"line":54,"column":15,"offset":1999},"indent":[]}}],"position":{"start":{"line":54,"column":3,"offset":1987},"end":{"line":54,"column":17,"offset":2001},"indent":[]}},{"type":"text","value":": Should this monitor run on a message sent by a bot. In our example, if we set this false then no bot would be allowed to post links in the server. Since we don't want other bot's posting invite links either we can simply just set this to ","position":{"start":{"line":54,"column":17,"offset":2001},"end":{"line":54,"column":257,"offset":2241},"indent":[]}},{"type":"inlineCode","value":"false","position":{"start":{"line":54,"column":257,"offset":2241},"end":{"line":54,"column":264,"offset":2248},"indent":[]}},{"type":"text","value":".","position":{"start":{"line":54,"column":264,"offset":2248},"end":{"line":54,"column":265,"offset":2249},"indent":[]}}],"position":{"start":{"line":54,"column":3,"offset":1987},"end":{"line":54,"column":265,"offset":2249},"indent":[]}}],"position":{"start":{"line":54,"column":1,"offset":1985},"end":{"line":54,"column":265,"offset":2249},"indent":[]}},{"type":"listItem","spread":false,"checked":null,"children":[{"type":"paragraph","children":[{"type":"strong","children":[{"type":"text","value":"ignoreOthers","position":{"start":{"line":55,"column":5,"offset":2254},"end":{"line":55,"column":17,"offset":2266},"indent":[]}}],"position":{"start":{"line":55,"column":3,"offset":2252},"end":{"line":55,"column":19,"offset":2268},"indent":[]}},{"type":"text","value":": Should this monitor run on other USERS. If we set this as false, then any user will not be allowed to post discord links. Since the default option for this is already ","position":{"start":{"line":55,"column":19,"offset":2268},"end":{"line":55,"column":188,"offset":2437},"indent":[]}},{"type":"inlineCode","value":"false","position":{"start":{"line":55,"column":188,"offset":2437},"end":{"line":55,"column":195,"offset":2444},"indent":[]}},{"type":"text","value":", let's go ahead and just delete this line.","position":{"start":{"line":55,"column":195,"offset":2444},"end":{"line":55,"column":238,"offset":2487},"indent":[]}}],"position":{"start":{"line":55,"column":3,"offset":2252},"end":{"line":55,"column":238,"offset":2487},"indent":[]}}],"position":{"start":{"line":55,"column":1,"offset":2250},"end":{"line":55,"column":238,"offset":2487},"indent":[]}},{"type":"listItem","spread":false,"checked":null,"children":[{"type":"paragraph","children":[{"type":"strong","children":[{"type":"text","value":"ignoreEdits","position":{"start":{"line":56,"column":5,"offset":2492},"end":{"line":56,"column":16,"offset":2503},"indent":[]}}],"position":{"start":{"line":56,"column":3,"offset":2490},"end":{"line":56,"column":18,"offset":2505},"indent":[]}},{"type":"text","value":": Should this monitor run on edited messaged. If we set this as false, then it would also be filtering messages that are edited. It would be important to prevent users from editing a message and posting a discord invite link so let's keep this ","position":{"start":{"line":56,"column":18,"offset":2505},"end":{"line":56,"column":262,"offset":2749},"indent":[]}},{"type":"inlineCode","value":"false","position":{"start":{"line":56,"column":262,"offset":2749},"end":{"line":56,"column":269,"offset":2756},"indent":[]}},{"type":"text","value":". Since the default is false, we can just delete this line.","position":{"start":{"line":56,"column":269,"offset":2756},"end":{"line":56,"column":328,"offset":2815},"indent":[]}}],"position":{"start":{"line":56,"column":3,"offset":2490},"end":{"line":56,"column":328,"offset":2815},"indent":[]}}],"position":{"start":{"line":56,"column":1,"offset":2488},"end":{"line":56,"column":328,"offset":2815},"indent":[]}},{"type":"listItem","spread":false,"checked":null,"children":[{"type":"paragraph","children":[{"type":"strong","children":[{"type":"text","value":"ignoreDM","position":{"start":{"line":57,"column":5,"offset":2820},"end":{"line":57,"column":13,"offset":2828},"indent":[]}}],"position":{"start":{"line":57,"column":3,"offset":2818},"end":{"line":57,"column":15,"offset":2830},"indent":[]}},{"type":"text","value":": Should this monitor run on direct messages. If we set this as false, then this monitor would not run when the bot is sent a dm. Since we don't care if the users send our bot a dm with an invite link we can just simply set this to ","position":{"start":{"line":57,"column":15,"offset":2830},"end":{"line":57,"column":247,"offset":3062},"indent":[]}},{"type":"inlineCode","value":"true","position":{"start":{"line":57,"column":247,"offset":3062},"end":{"line":57,"column":253,"offset":3068},"indent":[]}},{"type":"text","value":" Since the default is ","position":{"start":{"line":57,"column":253,"offset":3068},"end":{"line":57,"column":275,"offset":3090},"indent":[]}},{"type":"inlineCode","value":"true","position":{"start":{"line":57,"column":275,"offset":3090},"end":{"line":57,"column":281,"offset":3096},"indent":[]}},{"type":"text","value":" for this option we can simple delete this line.","position":{"start":{"line":57,"column":281,"offset":3096},"end":{"line":57,"column":329,"offset":3144},"indent":[]}}],"position":{"start":{"line":57,"column":3,"offset":2818},"end":{"line":57,"column":329,"offset":3144},"indent":[]}}],"position":{"start":{"line":57,"column":1,"offset":2816},"end":{"line":57,"column":329,"offset":3144},"indent":[]}}],"position":{"start":{"line":54,"column":1,"offset":1985},"end":{"line":57,"column":329,"offset":3144},"indent":[1,1,1]}},{"type":"paragraph","children":[{"type":"text","value":"The default options were chosen for what the majority of monitors will use to help keep your code clean and clear.","position":{"start":{"line":59,"column":1,"offset":3146},"end":{"line":59,"column":115,"offset":3260},"indent":[]}}],"position":{"start":{"line":59,"column":1,"offset":3146},"end":{"line":59,"column":115,"offset":3260},"indent":[]}},{"type":"heading","depth":2,"children":[{"type":"text","value":"Permission Options","position":{"start":{"line":61,"column":4,"offset":3265},"end":{"line":61,"column":22,"offset":3283},"indent":[]}}],"position":{"start":{"line":61,"column":1,"offset":3262},"end":{"line":61,"column":22,"offset":3283},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"The permission options are the exact same from the commands guide. These options first make sure that either the bot or user has those necessary permissions to run this monitor. For example, our invite filter would mean we need ","position":{"start":{"line":63,"column":1,"offset":3285},"end":{"line":63,"column":229,"offset":3513},"indent":[]}},{"type":"strong","children":[{"type":"text","value":"MANAGE MESSAGES","position":{"start":{"line":63,"column":231,"offset":3515},"end":{"line":63,"column":246,"offset":3530},"indent":[]}}],"position":{"start":{"line":63,"column":229,"offset":3513},"end":{"line":63,"column":248,"offset":3532},"indent":[]}},{"type":"text","value":" permission so we can delete messages sent with an invite URL.","position":{"start":{"line":63,"column":248,"offset":3532},"end":{"line":63,"column":310,"offset":3594},"indent":[]}}],"position":{"start":{"line":63,"column":1,"offset":3285},"end":{"line":63,"column":310,"offset":3594},"indent":[]}},{"type":"code","lang":"ts","meta":null,"value":" botChannelPermissions: [\"MANAGE_MESSAGES\"]","position":{"start":{"line":65,"column":1,"offset":3596},"end":{"line":67,"column":4,"offset":3650},"indent":[1,1]}},{"type":"heading","depth":2,"children":[{"type":"text","value":"Adding The Code","position":{"start":{"line":69,"column":4,"offset":3655},"end":{"line":69,"column":19,"offset":3670},"indent":[]}}],"position":{"start":{"line":69,"column":1,"offset":3652},"end":{"line":69,"column":19,"offset":3670},"indent":[]}},{"type":"code","lang":"ts","meta":null,"value":"import { botCache } from \"../../mod.ts\";\nimport { deleteMessage } from \"https://raw.githubusercontent.com/Skillz4Killz/Discordeno/v7/src/handlers/message.ts\";\nimport { translate } from \"../utils/i18next.ts\";\nimport { sendAlertResponse } from \"../utils/helpers.ts\";\n\nbotCache.monitors.set(\"inviteFilter\", {\n name: \"inviteFilter\",\n ignoreBots: false,\n botChannelPermissions: [\"MANAGE_MESSAGES\"],\n execute: async function (message) {\n // Use a regex to test if the content of the message has a valid discord invite link\n const hasInviteLink =\n /(https?:\\/\\/)?(www\\.)?(discord\\.(gg|li|me|io)|discordapp\\.com\\/invite)\\/.+/\n .test(message.content);\n // If the message does not have an invite link cancel out.\n if (!hasInviteLink) return;\n\n // This message has an invite link, so delete the message.\n try {\n // Delete the invite link\n deleteMessage(\n message,\n translate(message.guildID, `monitors/invitefilter:DELETE_REASON`),\n );\n\t\t\t// Send a message to the user so they know why the message was deleted. Then delete the response after 5 seconds to prevent spam.\n\t\t\tsendAlertResponse(message, translate(message.guildID, \"monitors/invitefilter:DELETE_ALERT_MESSAGE\"), 5)\n } catch (error) {\n return botCache.eventHandlers.discordLog(error)\n }\n },\n});","position":{"start":{"line":71,"column":1,"offset":3672},"end":{"line":103,"column":4,"offset":5000},"indent":[1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1]}},{"type":"paragraph","children":[{"type":"text","value":"Nice! Now take some time and add these translation keys to their appropriate files. ","position":{"start":{"line":105,"column":1,"offset":5002},"end":{"line":105,"column":85,"offset":5086},"indent":[]}}],"position":{"start":{"line":105,"column":1,"offset":5002},"end":{"line":105,"column":85,"offset":5086},"indent":[]}},{"type":"export","value":"export const _frontmatter = {\"title\":\"Creating Monitors!\",\"metaTitle\":\"Creating A Monitor | Discordeno\",\"metaDescription\":\"Let's create our very own bot with Discordeno!\"}","position":{"start":{"line":108,"column":1,"offset":5089},"end":{"line":108,"column":172,"offset":5260},"indent":[]}}],"position":{"start":{"line":1,"column":1,"offset":0},"end":{"line":108,"column":172,"offset":5260}}},"scopeImports":["import * as React from 'react'"],"scopeIdentifiers":["React"],"body":"function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }\n\nfunction _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }\n\nfunction _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }\n\n/* @jsx mdx */\nvar _frontmatter = {\n \"title\": \"Creating Monitors!\",\n \"metaTitle\": \"Creating A Monitor | Discordeno\",\n \"metaDescription\": \"Let's create our very own bot with Discordeno!\"\n};\nvar layoutProps = {\n _frontmatter: _frontmatter\n};\nvar MDXLayout = \"wrapper\";\nreturn function MDXContent(_ref) {\n var components = _ref.components,\n props = _objectWithoutProperties(_ref, [\"components\"]);\n\n return mdx(MDXLayout, _extends({}, layoutProps, props, {\n components: components,\n mdxType: \"MDXLayout\"\n }), mdx(\"p\", null, \"Holy bananza! You even got the entire languages complete. You are well on your way to mastering 23 different languages. Now we are going to down and dirty with monitors.\"), mdx(\"h2\", null, \"What is a monitor?\"), mdx(\"p\", null, \"Monitors are functions that will run on every single message that is sent in every channel that your bot has permissions to read. When you want to do something on every single message that is sent, the best way to do that is to create a new monitor.\"), mdx(\"h2\", null, \"Command Handler Monitor\"), mdx(\"p\", null, \"Discordeno come built with a monitor called \", mdx(\"inlineCode\", {\n parentName: \"p\"\n }, \"commandHandler\"), \". This monitor runs on every message sent and figures out if it is a command and executes the command. If it is a valid command with a valid prefix, Discordeno runs that command.\"), mdx(\"p\", null, \"Let's try and create our own monitor so we can understand it better. Suppose we wanted to build a filter that would delete any message which included a discord invite link.\"), mdx(\"h2\", null, \"Creating Invite Filter Monitor\"), mdx(\"p\", null, \"To start, we make a new file in the monitors folder called \", mdx(\"inlineCode\", {\n parentName: \"p\"\n }, \"inviteFilter.ts\"), \". Then you can paste in the following base monitor snippet.\"), mdx(\"pre\", null, mdx(\"code\", _extends({\n parentName: \"pre\"\n }, {\n \"className\": \"language-ts\"\n }), \"import { botCache } from \\\"../../mod.ts\\\";\\n\\nbotCache.monitors.set(\\\"monitorname\\\", {\\n name: \\\"monitorname\\\",\\n ignoreBots: true,\\n ignoreOthers: false,\\n ignoreEdits: false,\\n ignoreDM: true,\\n userServerPermissions: [],\\n userChannelPermissions: [],\\n botServerPermissions: [],\\n botChannelPermissions: [],\\n execute: async function (message) {\\n // Your code goes here\\n },\\n});\\n\")), mdx(\"h2\", null, \"Understanding Monitor Options\"), mdx(\"p\", null, \"The monitor options are very similar in functionality with the command options.\"), mdx(\"h3\", null, \"Monitor Name\"), mdx(\"p\", null, \"Similar to the command name, we will specify a unique name for the monitors. In this case let's call it inviteFilter\"), mdx(\"pre\", null, mdx(\"code\", _extends({\n parentName: \"pre\"\n }, {\n \"className\": \"language-ts\"\n }), \"botCache.monitors.set(\\\"monitorname\\\", {\\n name: \\\"monitorname\\\",\\n\")), mdx(\"h3\", null, \"Ignore Options\"), mdx(\"p\", null, \"The ignore options are filters that you can use to enable/disable the monitor from running in those specific circumstances. The default option for each monitor is shown in the base snippet above.\"), mdx(\"ul\", null, mdx(\"li\", {\n parentName: \"ul\"\n }, mdx(\"strong\", {\n parentName: \"li\"\n }, \"ignoreBots\"), \": Should this monitor run on a message sent by a bot. In our example, if we set this false then no bot would be allowed to post links in the server. Since we don't want other bot's posting invite links either we can simply just set this to \", mdx(\"inlineCode\", {\n parentName: \"li\"\n }, \"false\"), \".\"), mdx(\"li\", {\n parentName: \"ul\"\n }, mdx(\"strong\", {\n parentName: \"li\"\n }, \"ignoreOthers\"), \": Should this monitor run on other USERS. If we set this as false, then any user will not be allowed to post discord links. Since the default option for this is already \", mdx(\"inlineCode\", {\n parentName: \"li\"\n }, \"false\"), \", let's go ahead and just delete this line.\"), mdx(\"li\", {\n parentName: \"ul\"\n }, mdx(\"strong\", {\n parentName: \"li\"\n }, \"ignoreEdits\"), \": Should this monitor run on edited messaged. If we set this as false, then it would also be filtering messages that are edited. It would be important to prevent users from editing a message and posting a discord invite link so let's keep this \", mdx(\"inlineCode\", {\n parentName: \"li\"\n }, \"false\"), \". Since the default is false, we can just delete this line.\"), mdx(\"li\", {\n parentName: \"ul\"\n }, mdx(\"strong\", {\n parentName: \"li\"\n }, \"ignoreDM\"), \": Should this monitor run on direct messages. If we set this as false, then this monitor would not run when the bot is sent a dm. Since we don't care if the users send our bot a dm with an invite link we can just simply set this to \", mdx(\"inlineCode\", {\n parentName: \"li\"\n }, \"true\"), \" Since the default is \", mdx(\"inlineCode\", {\n parentName: \"li\"\n }, \"true\"), \" for this option we can simple delete this line.\")), mdx(\"p\", null, \"The default options were chosen for what the majority of monitors will use to help keep your code clean and clear.\"), mdx(\"h2\", null, \"Permission Options\"), mdx(\"p\", null, \"The permission options are the exact same from the commands guide. These options first make sure that either the bot or user has those necessary permissions to run this monitor. For example, our invite filter would mean we need \", mdx(\"strong\", {\n parentName: \"p\"\n }, \"MANAGE MESSAGES\"), \" permission so we can delete messages sent with an invite URL.\"), mdx(\"pre\", null, mdx(\"code\", _extends({\n parentName: \"pre\"\n }, {\n \"className\": \"language-ts\"\n }), \" botChannelPermissions: [\\\"MANAGE_MESSAGES\\\"]\\n\")), mdx(\"h2\", null, \"Adding The Code\"), mdx(\"pre\", null, mdx(\"code\", _extends({\n parentName: \"pre\"\n }, {\n \"className\": \"language-ts\"\n }), \"import { botCache } from \\\"../../mod.ts\\\";\\nimport { deleteMessage } from \\\"https://raw.githubusercontent.com/Skillz4Killz/Discordeno/v7/src/handlers/message.ts\\\";\\nimport { translate } from \\\"../utils/i18next.ts\\\";\\nimport { sendAlertResponse } from \\\"../utils/helpers.ts\\\";\\n\\nbotCache.monitors.set(\\\"inviteFilter\\\", {\\n name: \\\"inviteFilter\\\",\\n ignoreBots: false,\\n botChannelPermissions: [\\\"MANAGE_MESSAGES\\\"],\\n execute: async function (message) {\\n // Use a regex to test if the content of the message has a valid discord invite link\\n const hasInviteLink =\\n /(https?:\\\\/\\\\/)?(www\\\\.)?(discord\\\\.(gg|li|me|io)|discordapp\\\\.com\\\\/invite)\\\\/.+/\\n .test(message.content);\\n // If the message does not have an invite link cancel out.\\n if (!hasInviteLink) return;\\n\\n // This message has an invite link, so delete the message.\\n try {\\n // Delete the invite link\\n deleteMessage(\\n message,\\n translate(message.guildID, `monitors/invitefilter:DELETE_REASON`),\\n );\\n // Send a message to the user so they know why the message was deleted. Then delete the response after 5 seconds to prevent spam.\\n sendAlertResponse(message, translate(message.guildID, \\\"monitors/invitefilter:DELETE_ALERT_MESSAGE\\\"), 5)\\n } catch (error) {\\n return botCache.eventHandlers.discordLog(error)\\n }\\n },\\n});\\n\")), mdx(\"p\", null, \"Nice! Now take some time and add these translation keys to their appropriate files. \"));\n}\n;\nMDXContent.isMDXComponent = true;","rawMDXOutput":"/* @jsx mdx */\nimport { mdx } from '@mdx-js/react';\n/* @jsx mdx */\n\nexport const _frontmatter = {\n \"title\": \"Creating Monitors!\",\n \"metaTitle\": \"Creating A Monitor | Discordeno\",\n \"metaDescription\": \"Let's create our very own bot with Discordeno!\"\n};\n\nconst layoutProps = {\n _frontmatter\n};\nconst MDXLayout = \"wrapper\"\nexport default function MDXContent({\n components,\n ...props\n}) {\n return \n

{`Holy bananza! You even got the entire languages complete. You are well on your way to mastering 23 different languages. Now we are going to down and dirty with monitors.`}

\n

{`What is a monitor?`}

\n

{`Monitors are functions that will run on every single message that is sent in every channel that your bot has permissions to read. When you want to do something on every single message that is sent, the best way to do that is to create a new monitor.`}

\n

{`Command Handler Monitor`}

\n

{`Discordeno come built with a monitor called `}{`commandHandler`}{`. This monitor runs on every message sent and figures out if it is a command and executes the command. If it is a valid command with a valid prefix, Discordeno runs that command.`}

\n

{`Let's try and create our own monitor so we can understand it better. Suppose we wanted to build a filter that would delete any message which included a discord invite link.`}

\n

{`Creating Invite Filter Monitor`}

\n

{`To start, we make a new file in the monitors folder called `}{`inviteFilter.ts`}{`. Then you can paste in the following base monitor snippet.`}

\n
{`import { botCache } from \"../../mod.ts\";\n\nbotCache.monitors.set(\"monitorname\", {\n    name: \"monitorname\",\n  ignoreBots: true,\n  ignoreOthers: false,\n  ignoreEdits: false,\n  ignoreDM: true,\n  userServerPermissions: [],\n  userChannelPermissions: [],\n  botServerPermissions: [],\n  botChannelPermissions: [],\n  execute: async function (message) {\n        // Your code goes here\n  },\n});\n`}
\n

{`Understanding Monitor Options`}

\n

{`The monitor options are very similar in functionality with the command options.`}

\n

{`Monitor Name`}

\n

{`Similar to the command name, we will specify a unique name for the monitors. In this case let's call it inviteFilter`}

\n
{`botCache.monitors.set(\"monitorname\", {\n    name: \"monitorname\",\n`}
\n

{`Ignore Options`}

\n

{`The ignore options are filters that you can use to enable/disable the monitor from running in those specific circumstances. The default option for each monitor is shown in the base snippet above.`}

\n
    \n
  • {`ignoreBots`}{`: Should this monitor run on a message sent by a bot. In our example, if we set this false then no bot would be allowed to post links in the server. Since we don't want other bot's posting invite links either we can simply just set this to `}{`false`}{`.`}
  • \n
  • {`ignoreOthers`}{`: Should this monitor run on other USERS. If we set this as false, then any user will not be allowed to post discord links. Since the default option for this is already `}{`false`}{`, let's go ahead and just delete this line.`}
  • \n
  • {`ignoreEdits`}{`: Should this monitor run on edited messaged. If we set this as false, then it would also be filtering messages that are edited. It would be important to prevent users from editing a message and posting a discord invite link so let's keep this `}{`false`}{`. Since the default is false, we can just delete this line.`}
  • \n
  • {`ignoreDM`}{`: Should this monitor run on direct messages. If we set this as false, then this monitor would not run when the bot is sent a dm. Since we don't care if the users send our bot a dm with an invite link we can just simply set this to `}{`true`}{` Since the default is `}{`true`}{` for this option we can simple delete this line.`}
  • \n
\n

{`The default options were chosen for what the majority of monitors will use to help keep your code clean and clear.`}

\n

{`Permission Options`}

\n

{`The permission options are the exact same from the commands guide. These options first make sure that either the bot or user has those necessary permissions to run this monitor. For example, our invite filter would mean we need `}{`MANAGE MESSAGES`}{` permission so we can delete messages sent with an invite URL.`}

\n
{`  botChannelPermissions: [\"MANAGE_MESSAGES\"]\n`}
\n

{`Adding The Code`}

\n
{`import { botCache } from \"../../mod.ts\";\nimport { deleteMessage } from \"https://raw.githubusercontent.com/Skillz4Killz/Discordeno/v7/src/handlers/message.ts\";\nimport { translate } from \"../utils/i18next.ts\";\nimport { sendAlertResponse } from \"../utils/helpers.ts\";\n\nbotCache.monitors.set(\"inviteFilter\", {\n  name: \"inviteFilter\",\n  ignoreBots: false,\n  botChannelPermissions: [\"MANAGE_MESSAGES\"],\n  execute: async function (message) {\n    // Use a regex to test if the content of the message has a valid discord invite link\n    const hasInviteLink =\n      /(https?:\\\\/\\\\/)?(www\\\\.)?(discord\\\\.(gg|li|me|io)|discordapp\\\\.com\\\\/invite)\\\\/.+/\n        .test(message.content);\n    // If the message does not have an invite link cancel out.\n    if (!hasInviteLink) return;\n\n    // This message has an invite link, so delete the message.\n    try {\n      // Delete the invite link\n      deleteMessage(\n        message,\n        translate(message.guildID, \\`monitors/invitefilter:DELETE_REASON\\`),\n      );\n            // Send a message to the user so they know why the message was deleted. Then delete the response after 5 seconds to prevent spam.\n            sendAlertResponse(message, translate(message.guildID, \"monitors/invitefilter:DELETE_ALERT_MESSAGE\"), 5)\n    } catch (error) {\n      return botCache.eventHandlers.discordLog(error)\n    }\n  },\n});\n`}
\n

{`Nice! Now take some time and add these translation keys to their appropriate files. `}

\n\n
;\n}\n\n;\nMDXContent.isMDXComponent = true;"}} \ No newline at end of file diff --git a/docs/.cache/caches/gatsby-plugin-mdx/diskstore-d32158d46c75b3c16cf387d06c3bde0f.json b/docs/.cache/caches/gatsby-plugin-mdx/diskstore-d32158d46c75b3c16cf387d06c3bde0f.json new file mode 100644 index 000000000..9e66cda2b --- /dev/null +++ b/docs/.cache/caches/gatsby-plugin-mdx/diskstore-d32158d46c75b3c16cf387d06c3bde0f.json @@ -0,0 +1 @@ +{"expireTime":9007200851634192000,"key":"gatsby-plugin-mdx-entire-payload-d33d63a59c17e284e5486770e7e4ff57-","val":{"mdast":{"type":"root","children":[{"type":"paragraph","children":[{"type":"text","value":"Woah! You are almost half way done with understanding all of Discordeno. Amazing isn't it? Something you may have noticed in the last section was there were some options that prevented some commands from running like ","position":{"start":{"line":2,"column":1,"offset":1},"end":{"line":2,"column":218,"offset":218},"indent":[]}},{"type":"inlineCode","value":"dmOnly","position":{"start":{"line":2,"column":218,"offset":218},"end":{"line":2,"column":226,"offset":226},"indent":[]}},{"type":"text","value":" or the permission options. we created a setting to prevent the monitor from running in certain channels. What if we wanted to do prevent commands from happening? How would we prevent commands from running?","position":{"start":{"line":2,"column":226,"offset":226},"end":{"line":2,"column":432,"offset":432},"indent":[]}}],"position":{"start":{"line":2,"column":1,"offset":1},"end":{"line":2,"column":432,"offset":432},"indent":[]}},{"type":"heading","depth":2,"children":[{"type":"text","value":"What is an Inhibitor?","position":{"start":{"line":4,"column":4,"offset":437},"end":{"line":4,"column":25,"offset":458},"indent":[]}}],"position":{"start":{"line":4,"column":1,"offset":434},"end":{"line":4,"column":25,"offset":458},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"An Inhibitor is very similar to how monitors work. A monitor runs on every message but an inhibitor runs on every command. Remember all those command options like cooldown, permissions, permissionLevel, nsfw, etc... Each and every one of these options has an inhibitor in that checks commands for these settings.","position":{"start":{"line":6,"column":1,"offset":460},"end":{"line":6,"column":313,"offset":772},"indent":[]}}],"position":{"start":{"line":6,"column":1,"offset":460},"end":{"line":6,"column":313,"offset":772},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"Let's create our own inhibitor that would prevent commands from being used if the user is not a VIP user.","position":{"start":{"line":8,"column":1,"offset":774},"end":{"line":8,"column":106,"offset":879},"indent":[]}}],"position":{"start":{"line":8,"column":1,"offset":774},"end":{"line":8,"column":106,"offset":879},"indent":[]}},{"type":"blockquote","children":[{"type":"paragraph","children":[{"type":"strong","children":[{"type":"text","value":"Note:","position":{"start":{"line":10,"column":5,"offset":885},"end":{"line":10,"column":10,"offset":890},"indent":[]}}],"position":{"start":{"line":10,"column":3,"offset":883},"end":{"line":10,"column":12,"offset":892},"indent":[]}},{"type":"text","value":" It is important to remember that everything below can be done with a simple permission level as well. We will create our own custom permission levels but for the purposes of this guide and to be able to learn about Inhibitors, we will be using an inhibitor.","position":{"start":{"line":10,"column":12,"offset":892},"end":{"line":10,"column":270,"offset":1150},"indent":[]}}],"position":{"start":{"line":10,"column":3,"offset":883},"end":{"line":10,"column":270,"offset":1150},"indent":[]}}],"position":{"start":{"line":10,"column":1,"offset":881},"end":{"line":10,"column":270,"offset":1150},"indent":[]}},{"type":"heading","depth":2,"children":[{"type":"text","value":"Creating the File","position":{"start":{"line":12,"column":4,"offset":1155},"end":{"line":12,"column":21,"offset":1172},"indent":[]}}],"position":{"start":{"line":12,"column":1,"offset":1152},"end":{"line":12,"column":21,"offset":1172},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"Let's start by creating a file inside the inhibitors folder called ","position":{"start":{"line":14,"column":1,"offset":1174},"end":{"line":14,"column":68,"offset":1241},"indent":[]}},{"type":"inlineCode","value":"boosted.ts","position":{"start":{"line":14,"column":68,"offset":1241},"end":{"line":14,"column":80,"offset":1253},"indent":[]}},{"type":"text","value":" and paste the following snippet of code:","position":{"start":{"line":14,"column":80,"offset":1253},"end":{"line":14,"column":121,"offset":1294},"indent":[]}}],"position":{"start":{"line":14,"column":1,"offset":1174},"end":{"line":14,"column":121,"offset":1294},"indent":[]}},{"type":"code","lang":"ts","meta":null,"value":"import { botCache } from \"../../mod.ts\";\n\nbotCache.inhibitors.set(\"inhibitorname\", async function (message, command, guild) {\n\t// Your code goes here\n});","position":{"start":{"line":16,"column":1,"offset":1296},"end":{"line":22,"column":4,"offset":1459},"indent":[1,1,1,1,1,1]}},{"type":"paragraph","children":[{"type":"text","value":"Inhibitors can take up to 3 arguments.","position":{"start":{"line":24,"column":1,"offset":1461},"end":{"line":24,"column":39,"offset":1499},"indent":[]}}],"position":{"start":{"line":24,"column":1,"offset":1461},"end":{"line":24,"column":39,"offset":1499},"indent":[]}},{"type":"list","ordered":false,"start":null,"spread":false,"children":[{"type":"listItem","spread":false,"checked":null,"children":[{"type":"paragraph","children":[{"type":"inlineCode","value":"message","position":{"start":{"line":26,"column":3,"offset":1503},"end":{"line":26,"column":12,"offset":1512},"indent":[]}},{"type":"text","value":": The message object that triggered the command.","position":{"start":{"line":26,"column":12,"offset":1512},"end":{"line":26,"column":60,"offset":1560},"indent":[]}}],"position":{"start":{"line":26,"column":3,"offset":1503},"end":{"line":26,"column":60,"offset":1560},"indent":[]}}],"position":{"start":{"line":26,"column":1,"offset":1501},"end":{"line":26,"column":60,"offset":1560},"indent":[]}},{"type":"listItem","spread":false,"checked":null,"children":[{"type":"paragraph","children":[{"type":"inlineCode","value":"command","position":{"start":{"line":27,"column":3,"offset":1563},"end":{"line":27,"column":12,"offset":1572},"indent":[]}},{"type":"text","value":": The command object itself that was triggered.","position":{"start":{"line":27,"column":12,"offset":1572},"end":{"line":27,"column":59,"offset":1619},"indent":[]}}],"position":{"start":{"line":27,"column":3,"offset":1563},"end":{"line":27,"column":59,"offset":1619},"indent":[]}}],"position":{"start":{"line":27,"column":1,"offset":1561},"end":{"line":27,"column":59,"offset":1619},"indent":[]}},{"type":"listItem","spread":false,"checked":null,"children":[{"type":"paragraph","children":[{"type":"inlineCode","value":"guild","position":{"start":{"line":28,"column":3,"offset":1622},"end":{"line":28,"column":10,"offset":1629},"indent":[]}},{"type":"text","value":": The server guild object where this command was ran.","position":{"start":{"line":28,"column":10,"offset":1629},"end":{"line":28,"column":63,"offset":1682},"indent":[]}}],"position":{"start":{"line":28,"column":3,"offset":1622},"end":{"line":28,"column":63,"offset":1682},"indent":[]}}],"position":{"start":{"line":28,"column":1,"offset":1620},"end":{"line":28,"column":63,"offset":1682},"indent":[]}}],"position":{"start":{"line":26,"column":1,"offset":1501},"end":{"line":28,"column":63,"offset":1682},"indent":[1,1]}},{"type":"heading","depth":2,"children":[{"type":"text","value":"Understanding How Inhibitors Function","position":{"start":{"line":30,"column":4,"offset":1687},"end":{"line":30,"column":41,"offset":1724},"indent":[]}}],"position":{"start":{"line":30,"column":1,"offset":1684},"end":{"line":30,"column":41,"offset":1724},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"To block a command you have to return a truthy value.","position":{"start":{"line":32,"column":1,"offset":1726},"end":{"line":32,"column":54,"offset":1779},"indent":[]}}],"position":{"start":{"line":32,"column":1,"offset":1726},"end":{"line":32,"column":54,"offset":1779},"indent":[]}},{"type":"list","ordered":false,"start":null,"spread":false,"children":[{"type":"listItem","spread":false,"checked":null,"children":[{"type":"paragraph","children":[{"type":"strong","children":[{"type":"text","value":"return true;","position":{"start":{"line":33,"column":5,"offset":1784},"end":{"line":33,"column":17,"offset":1796},"indent":[]}}],"position":{"start":{"line":33,"column":3,"offset":1782},"end":{"line":33,"column":19,"offset":1798},"indent":[]}},{"type":"text","value":" If you return true the inhibitor will block the execution of the command.\nTo allow a command return a falsey value.","position":{"start":{"line":33,"column":19,"offset":1798},"end":{"line":34,"column":42,"offset":1914},"indent":[1]}}],"position":{"start":{"line":33,"column":3,"offset":1782},"end":{"line":34,"column":42,"offset":1914},"indent":[1]}}],"position":{"start":{"line":33,"column":1,"offset":1780},"end":{"line":34,"column":42,"offset":1914},"indent":[1]}},{"type":"listItem","spread":false,"checked":null,"children":[{"type":"paragraph","children":[{"type":"strong","children":[{"type":"text","value":"return false;","position":{"start":{"line":35,"column":5,"offset":1919},"end":{"line":35,"column":18,"offset":1932},"indent":[]}}],"position":{"start":{"line":35,"column":3,"offset":1917},"end":{"line":35,"column":20,"offset":1934},"indent":[]}},{"type":"text","value":" If you return false the inhibitor will not block the error.","position":{"start":{"line":35,"column":20,"offset":1934},"end":{"line":35,"column":80,"offset":1994},"indent":[]}}],"position":{"start":{"line":35,"column":3,"offset":1917},"end":{"line":35,"column":80,"offset":1994},"indent":[]}}],"position":{"start":{"line":35,"column":1,"offset":1915},"end":{"line":35,"column":80,"offset":1994},"indent":[]}}],"position":{"start":{"line":33,"column":1,"offset":1780},"end":{"line":35,"column":80,"offset":1994},"indent":[1,1]}},{"type":"code","lang":"ts","meta":null,"value":"// If the command is not VIP only we can allow this command to execute\nif (!command.vipOnly) return false;\n\n// The bot's support server\nconst guild = cache.guilds.get(configs.supportServerID);\n// If the command author is not in the server they won't have the vip role\nconst member = guild.members.get(message.author.id);\n// Member doesn't exist so cancel the command\nif (!member) return true;\n// Check if the user has the vip role on the support server given by patreon\nconst userIsVIP = await isUserVIP(message.author.id)\n// The user is VIP so we can allow this command to be used\nif (userIsVIP) return false;\n\n// The user is NOT VIP so we throw an error\nthrow `The ${command.name} is only allowed for VIP users.`","position":{"start":{"line":38,"column":1,"offset":1997},"end":{"line":55,"column":4,"offset":2721},"indent":[1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1]}},{"type":"export","value":"export const _frontmatter = {\"title\":\"Creating Inhibitors!\",\"metaTitle\":\"Creating An Inhibitor | Discordeno\",\"metaDescription\":\"Let's create our very own bot with Discordeno!\"}","position":{"start":{"line":58,"column":1,"offset":2724},"end":{"line":58,"column":177,"offset":2900},"indent":[]}}],"position":{"start":{"line":1,"column":1,"offset":0},"end":{"line":58,"column":177,"offset":2900}}},"scopeImports":["import * as React from 'react'"],"scopeIdentifiers":["React"],"body":"function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }\n\nfunction _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }\n\nfunction _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }\n\n/* @jsx mdx */\nvar _frontmatter = {\n \"title\": \"Creating Inhibitors!\",\n \"metaTitle\": \"Creating An Inhibitor | Discordeno\",\n \"metaDescription\": \"Let's create our very own bot with Discordeno!\"\n};\nvar layoutProps = {\n _frontmatter: _frontmatter\n};\nvar MDXLayout = \"wrapper\";\nreturn function MDXContent(_ref) {\n var components = _ref.components,\n props = _objectWithoutProperties(_ref, [\"components\"]);\n\n return mdx(MDXLayout, _extends({}, layoutProps, props, {\n components: components,\n mdxType: \"MDXLayout\"\n }), mdx(\"p\", null, \"Woah! You are almost half way done with understanding all of Discordeno. Amazing isn't it? Something you may have noticed in the last section was there were some options that prevented some commands from running like \", mdx(\"inlineCode\", {\n parentName: \"p\"\n }, \"dmOnly\"), \" or the permission options. we created a setting to prevent the monitor from running in certain channels. What if we wanted to do prevent commands from happening? How would we prevent commands from running?\"), mdx(\"h2\", null, \"What is an Inhibitor?\"), mdx(\"p\", null, \"An Inhibitor is very similar to how monitors work. A monitor runs on every message but an inhibitor runs on every command. Remember all those command options like cooldown, permissions, permissionLevel, nsfw, etc... Each and every one of these options has an inhibitor in that checks commands for these settings.\"), mdx(\"p\", null, \"Let's create our own inhibitor that would prevent commands from being used if the user is not a VIP user.\"), mdx(\"blockquote\", null, mdx(\"p\", {\n parentName: \"blockquote\"\n }, mdx(\"strong\", {\n parentName: \"p\"\n }, \"Note:\"), \" It is important to remember that everything below can be done with a simple permission level as well. We will create our own custom permission levels but for the purposes of this guide and to be able to learn about Inhibitors, we will be using an inhibitor.\")), mdx(\"h2\", null, \"Creating the File\"), mdx(\"p\", null, \"Let's start by creating a file inside the inhibitors folder called \", mdx(\"inlineCode\", {\n parentName: \"p\"\n }, \"boosted.ts\"), \" and paste the following snippet of code:\"), mdx(\"pre\", null, mdx(\"code\", _extends({\n parentName: \"pre\"\n }, {\n \"className\": \"language-ts\"\n }), \"import { botCache } from \\\"../../mod.ts\\\";\\n\\nbotCache.inhibitors.set(\\\"inhibitorname\\\", async function (message, command, guild) {\\n // Your code goes here\\n});\\n\")), mdx(\"p\", null, \"Inhibitors can take up to 3 arguments.\"), mdx(\"ul\", null, mdx(\"li\", {\n parentName: \"ul\"\n }, mdx(\"inlineCode\", {\n parentName: \"li\"\n }, \"message\"), \": The message object that triggered the command.\"), mdx(\"li\", {\n parentName: \"ul\"\n }, mdx(\"inlineCode\", {\n parentName: \"li\"\n }, \"command\"), \": The command object itself that was triggered.\"), mdx(\"li\", {\n parentName: \"ul\"\n }, mdx(\"inlineCode\", {\n parentName: \"li\"\n }, \"guild\"), \": The server guild object where this command was ran.\")), mdx(\"h2\", null, \"Understanding How Inhibitors Function\"), mdx(\"p\", null, \"To block a command you have to return a truthy value.\"), mdx(\"ul\", null, mdx(\"li\", {\n parentName: \"ul\"\n }, mdx(\"strong\", {\n parentName: \"li\"\n }, \"return true;\"), \" If you return true the inhibitor will block the execution of the command.\\nTo allow a command return a falsey value.\"), mdx(\"li\", {\n parentName: \"ul\"\n }, mdx(\"strong\", {\n parentName: \"li\"\n }, \"return false;\"), \" If you return false the inhibitor will not block the error.\")), mdx(\"pre\", null, mdx(\"code\", _extends({\n parentName: \"pre\"\n }, {\n \"className\": \"language-ts\"\n }), \"// If the command is not VIP only we can allow this command to execute\\nif (!command.vipOnly) return false;\\n\\n// The bot's support server\\nconst guild = cache.guilds.get(configs.supportServerID);\\n// If the command author is not in the server they won't have the vip role\\nconst member = guild.members.get(message.author.id);\\n// Member doesn't exist so cancel the command\\nif (!member) return true;\\n// Check if the user has the vip role on the support server given by patreon\\nconst userIsVIP = await isUserVIP(message.author.id)\\n// The user is VIP so we can allow this command to be used\\nif (userIsVIP) return false;\\n\\n// The user is NOT VIP so we throw an error\\nthrow `The ${command.name} is only allowed for VIP users.`\\n\")));\n}\n;\nMDXContent.isMDXComponent = true;","rawMDXOutput":"/* @jsx mdx */\nimport { mdx } from '@mdx-js/react';\n/* @jsx mdx */\n\nexport const _frontmatter = {\n \"title\": \"Creating Inhibitors!\",\n \"metaTitle\": \"Creating An Inhibitor | Discordeno\",\n \"metaDescription\": \"Let's create our very own bot with Discordeno!\"\n};\n\nconst layoutProps = {\n _frontmatter\n};\nconst MDXLayout = \"wrapper\"\nexport default function MDXContent({\n components,\n ...props\n}) {\n return \n

{`Woah! You are almost half way done with understanding all of Discordeno. Amazing isn't it? Something you may have noticed in the last section was there were some options that prevented some commands from running like `}{`dmOnly`}{` or the permission options. we created a setting to prevent the monitor from running in certain channels. What if we wanted to do prevent commands from happening? How would we prevent commands from running?`}

\n

{`What is an Inhibitor?`}

\n

{`An Inhibitor is very similar to how monitors work. A monitor runs on every message but an inhibitor runs on every command. Remember all those command options like cooldown, permissions, permissionLevel, nsfw, etc... Each and every one of these options has an inhibitor in that checks commands for these settings.`}

\n

{`Let's create our own inhibitor that would prevent commands from being used if the user is not a VIP user.`}

\n
\n

{`Note:`}{` It is important to remember that everything below can be done with a simple permission level as well. We will create our own custom permission levels but for the purposes of this guide and to be able to learn about Inhibitors, we will be using an inhibitor.`}

\n
\n

{`Creating the File`}

\n

{`Let's start by creating a file inside the inhibitors folder called `}{`boosted.ts`}{` and paste the following snippet of code:`}

\n
{`import { botCache } from \"../../mod.ts\";\n\nbotCache.inhibitors.set(\"inhibitorname\", async function (message, command, guild) {\n    // Your code goes here\n});\n`}
\n

{`Inhibitors can take up to 3 arguments.`}

\n
    \n
  • {`message`}{`: The message object that triggered the command.`}
  • \n
  • {`command`}{`: The command object itself that was triggered.`}
  • \n
  • {`guild`}{`: The server guild object where this command was ran.`}
  • \n
\n

{`Understanding How Inhibitors Function`}

\n

{`To block a command you have to return a truthy value.`}

\n
    \n
  • {`return true;`}{` If you return true the inhibitor will block the execution of the command.\nTo allow a command return a falsey value.`}
  • \n
  • {`return false;`}{` If you return false the inhibitor will not block the error.`}
  • \n
\n
{`// If the command is not VIP only we can allow this command to execute\nif (!command.vipOnly) return false;\n\n// The bot's support server\nconst guild = cache.guilds.get(configs.supportServerID);\n// If the command author is not in the server they won't have the vip role\nconst member = guild.members.get(message.author.id);\n// Member doesn't exist so cancel the command\nif (!member) return true;\n// Check if the user has the vip role on the support server given by patreon\nconst userIsVIP = await isUserVIP(message.author.id)\n// The user is VIP so we can allow this command to be used\nif (userIsVIP) return false;\n\n// The user is NOT VIP so we throw an error\nthrow \\`The \\${command.name} is only allowed for VIP users.\\`\n`}
\n\n
;\n}\n\n;\nMDXContent.isMDXComponent = true;"}} \ No newline at end of file diff --git a/docs/.cache/caches/gatsby-plugin-mdx/diskstore-d47347e3e7b72f57e523655de5c24457.json b/docs/.cache/caches/gatsby-plugin-mdx/diskstore-d47347e3e7b72f57e523655de5c24457.json new file mode 100644 index 000000000..0a39dc19f --- /dev/null +++ b/docs/.cache/caches/gatsby-plugin-mdx/diskstore-d47347e3e7b72f57e523655de5c24457.json @@ -0,0 +1 @@ +{"expireTime":9007200851634260000,"key":"gatsby-plugin-mdx-entire-payload-a8df9176c5dfa773a138a50771069436-","val":{"mdast":{"type":"root","children":[{"type":"paragraph","children":[{"type":"text","value":"Woah! You are almost half way done with understanding all of Discordeno. Amazing isn't it? Something you may have noticed in the last section was there were some options that prevented some commands from running like ","position":{"start":{"line":2,"column":1,"offset":1},"end":{"line":2,"column":218,"offset":218},"indent":[]}},{"type":"inlineCode","value":"dmOnly","position":{"start":{"line":2,"column":218,"offset":218},"end":{"line":2,"column":226,"offset":226},"indent":[]}},{"type":"text","value":" or the permission options. we created a setting to prevent the monitor from running in certain channels. What if we wanted to do prevent commands from happening? How would we prevent commands from running?","position":{"start":{"line":2,"column":226,"offset":226},"end":{"line":2,"column":432,"offset":432},"indent":[]}}],"position":{"start":{"line":2,"column":1,"offset":1},"end":{"line":2,"column":432,"offset":432},"indent":[]}},{"type":"heading","depth":2,"children":[{"type":"text","value":"What is an Inhibitor?","position":{"start":{"line":4,"column":4,"offset":437},"end":{"line":4,"column":25,"offset":458},"indent":[]}}],"position":{"start":{"line":4,"column":1,"offset":434},"end":{"line":4,"column":25,"offset":458},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"An Inhibitor is very similar to how monitors work. A monitor runs on every message but an inhibitor runs on every command. Remember all those command options like cooldown, permissions, permissionLevel, nsfw, etc... Each and every one of these options has an inhibitor in that checks commands for these settings.","position":{"start":{"line":6,"column":1,"offset":460},"end":{"line":6,"column":313,"offset":772},"indent":[]}}],"position":{"start":{"line":6,"column":1,"offset":460},"end":{"line":6,"column":313,"offset":772},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"Let's create our own inhibitor that would prevent commands from being used if the user is not a VIP user.","position":{"start":{"line":8,"column":1,"offset":774},"end":{"line":8,"column":106,"offset":879},"indent":[]}}],"position":{"start":{"line":8,"column":1,"offset":774},"end":{"line":8,"column":106,"offset":879},"indent":[]}},{"type":"blockquote","children":[{"type":"paragraph","children":[{"type":"strong","children":[{"type":"text","value":"Note:","position":{"start":{"line":10,"column":5,"offset":885},"end":{"line":10,"column":10,"offset":890},"indent":[]}}],"position":{"start":{"line":10,"column":3,"offset":883},"end":{"line":10,"column":12,"offset":892},"indent":[]}},{"type":"text","value":" It is important to remember that everything below can be done with a simple permission level as well. We will create our own custom permission levels but for the purposes of this guide and to be able to learn about Inhibitors, we will be using an inhibitor.","position":{"start":{"line":10,"column":12,"offset":892},"end":{"line":10,"column":270,"offset":1150},"indent":[]}}],"position":{"start":{"line":10,"column":3,"offset":883},"end":{"line":10,"column":270,"offset":1150},"indent":[]}}],"position":{"start":{"line":10,"column":1,"offset":881},"end":{"line":10,"column":270,"offset":1150},"indent":[]}},{"type":"heading","depth":2,"children":[{"type":"text","value":"Creating the File","position":{"start":{"line":12,"column":4,"offset":1155},"end":{"line":12,"column":21,"offset":1172},"indent":[]}}],"position":{"start":{"line":12,"column":1,"offset":1152},"end":{"line":12,"column":21,"offset":1172},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"Let's start by creating a file inside the inhibitors folder called ","position":{"start":{"line":14,"column":1,"offset":1174},"end":{"line":14,"column":68,"offset":1241},"indent":[]}},{"type":"inlineCode","value":"boosted.ts","position":{"start":{"line":14,"column":68,"offset":1241},"end":{"line":14,"column":80,"offset":1253},"indent":[]}},{"type":"text","value":" and paste the following snippet of code:","position":{"start":{"line":14,"column":80,"offset":1253},"end":{"line":14,"column":121,"offset":1294},"indent":[]}}],"position":{"start":{"line":14,"column":1,"offset":1174},"end":{"line":14,"column":121,"offset":1294},"indent":[]}},{"type":"code","lang":"ts","meta":null,"value":"import { botCache } from \"../../mod.ts\";\n\nbotCache.inhibitors.set(\"inhibitorname\", async function (message, command, guild) {\n\t// Your code goes here\n});","position":{"start":{"line":16,"column":1,"offset":1296},"end":{"line":22,"column":4,"offset":1459},"indent":[1,1,1,1,1,1]}},{"type":"paragraph","children":[{"type":"text","value":"Inhibitors can take up to 3 arguments.","position":{"start":{"line":24,"column":1,"offset":1461},"end":{"line":24,"column":39,"offset":1499},"indent":[]}}],"position":{"start":{"line":24,"column":1,"offset":1461},"end":{"line":24,"column":39,"offset":1499},"indent":[]}},{"type":"list","ordered":false,"start":null,"spread":false,"children":[{"type":"listItem","spread":false,"checked":null,"children":[{"type":"paragraph","children":[{"type":"inlineCode","value":"message","position":{"start":{"line":26,"column":3,"offset":1503},"end":{"line":26,"column":12,"offset":1512},"indent":[]}},{"type":"text","value":": The message object that triggered the command.","position":{"start":{"line":26,"column":12,"offset":1512},"end":{"line":26,"column":60,"offset":1560},"indent":[]}}],"position":{"start":{"line":26,"column":3,"offset":1503},"end":{"line":26,"column":60,"offset":1560},"indent":[]}}],"position":{"start":{"line":26,"column":1,"offset":1501},"end":{"line":26,"column":60,"offset":1560},"indent":[]}},{"type":"listItem","spread":false,"checked":null,"children":[{"type":"paragraph","children":[{"type":"inlineCode","value":"command","position":{"start":{"line":27,"column":3,"offset":1563},"end":{"line":27,"column":12,"offset":1572},"indent":[]}},{"type":"text","value":": The command object itself that was triggered.","position":{"start":{"line":27,"column":12,"offset":1572},"end":{"line":27,"column":59,"offset":1619},"indent":[]}}],"position":{"start":{"line":27,"column":3,"offset":1563},"end":{"line":27,"column":59,"offset":1619},"indent":[]}}],"position":{"start":{"line":27,"column":1,"offset":1561},"end":{"line":27,"column":59,"offset":1619},"indent":[]}},{"type":"listItem","spread":false,"checked":null,"children":[{"type":"paragraph","children":[{"type":"inlineCode","value":"guild","position":{"start":{"line":28,"column":3,"offset":1622},"end":{"line":28,"column":10,"offset":1629},"indent":[]}},{"type":"text","value":": The server guild object where this command was ran.","position":{"start":{"line":28,"column":10,"offset":1629},"end":{"line":28,"column":63,"offset":1682},"indent":[]}}],"position":{"start":{"line":28,"column":3,"offset":1622},"end":{"line":28,"column":63,"offset":1682},"indent":[]}}],"position":{"start":{"line":28,"column":1,"offset":1620},"end":{"line":28,"column":63,"offset":1682},"indent":[]}}],"position":{"start":{"line":26,"column":1,"offset":1501},"end":{"line":28,"column":63,"offset":1682},"indent":[1,1]}},{"type":"heading","depth":2,"children":[{"type":"text","value":"Understanding How Inhibitors Function","position":{"start":{"line":30,"column":4,"offset":1687},"end":{"line":30,"column":41,"offset":1724},"indent":[]}}],"position":{"start":{"line":30,"column":1,"offset":1684},"end":{"line":30,"column":41,"offset":1724},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"To block a command you have to return a truthy value.","position":{"start":{"line":32,"column":1,"offset":1726},"end":{"line":32,"column":54,"offset":1779},"indent":[]}}],"position":{"start":{"line":32,"column":1,"offset":1726},"end":{"line":32,"column":54,"offset":1779},"indent":[]}},{"type":"list","ordered":false,"start":null,"spread":false,"children":[{"type":"listItem","spread":false,"checked":null,"children":[{"type":"paragraph","children":[{"type":"strong","children":[{"type":"text","value":"return true;","position":{"start":{"line":33,"column":5,"offset":1784},"end":{"line":33,"column":17,"offset":1796},"indent":[]}}],"position":{"start":{"line":33,"column":3,"offset":1782},"end":{"line":33,"column":19,"offset":1798},"indent":[]}},{"type":"text","value":" If you return true the inhibitor will block the execution of the command.\nTo allow a command return a falsey value.","position":{"start":{"line":33,"column":19,"offset":1798},"end":{"line":34,"column":42,"offset":1914},"indent":[1]}}],"position":{"start":{"line":33,"column":3,"offset":1782},"end":{"line":34,"column":42,"offset":1914},"indent":[1]}}],"position":{"start":{"line":33,"column":1,"offset":1780},"end":{"line":34,"column":42,"offset":1914},"indent":[1]}},{"type":"listItem","spread":false,"checked":null,"children":[{"type":"paragraph","children":[{"type":"strong","children":[{"type":"text","value":"return false;","position":{"start":{"line":35,"column":5,"offset":1919},"end":{"line":35,"column":18,"offset":1932},"indent":[]}}],"position":{"start":{"line":35,"column":3,"offset":1917},"end":{"line":35,"column":20,"offset":1934},"indent":[]}},{"type":"text","value":" If you return false the inhibitor will not block the error.","position":{"start":{"line":35,"column":20,"offset":1934},"end":{"line":35,"column":80,"offset":1994},"indent":[]}}],"position":{"start":{"line":35,"column":3,"offset":1917},"end":{"line":35,"column":80,"offset":1994},"indent":[]}}],"position":{"start":{"line":35,"column":1,"offset":1915},"end":{"line":35,"column":80,"offset":1994},"indent":[]}}],"position":{"start":{"line":33,"column":1,"offset":1780},"end":{"line":35,"column":80,"offset":1994},"indent":[1,1]}},{"type":"code","lang":"ts","meta":null,"value":"// If the command is not VIP only we can allow this command to execute\nif (!command.vipOnly) return false;\n\n// The bot's support server\nconst guild = cache.guilds.get(configs.supportServerID);\n// If the command author is not in the server they won't have the vip role\nconst member = guild.members.get(message.author.id) || await getMember(guild.id, message.author.id);\n// Member doesn't exist so cancel the command\nif (!member) return true;\n\n// If the user has the vip role on the support server given by patreon allow the command\nif (member.roles.includes()) return false;\n\n// The user is NOT VIP so we throw an error\nthrow `The ${command.name} is only allowed for VIP users.`","position":{"start":{"line":38,"column":1,"offset":1997},"end":{"line":54,"column":4,"offset":2684},"indent":[1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1]}},{"type":"export","value":"export const _frontmatter = {\"title\":\"Creating Inhibitors!\",\"metaTitle\":\"Creating An Inhibitor | Discordeno\",\"metaDescription\":\"Let's create our very own bot with Discordeno!\"}","position":{"start":{"line":57,"column":1,"offset":2687},"end":{"line":57,"column":177,"offset":2863},"indent":[]}}],"position":{"start":{"line":1,"column":1,"offset":0},"end":{"line":57,"column":177,"offset":2863}}},"scopeImports":["import * as React from 'react'"],"scopeIdentifiers":["React"],"body":"function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }\n\nfunction _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }\n\nfunction _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }\n\n/* @jsx mdx */\nvar _frontmatter = {\n \"title\": \"Creating Inhibitors!\",\n \"metaTitle\": \"Creating An Inhibitor | Discordeno\",\n \"metaDescription\": \"Let's create our very own bot with Discordeno!\"\n};\nvar layoutProps = {\n _frontmatter: _frontmatter\n};\nvar MDXLayout = \"wrapper\";\nreturn function MDXContent(_ref) {\n var components = _ref.components,\n props = _objectWithoutProperties(_ref, [\"components\"]);\n\n return mdx(MDXLayout, _extends({}, layoutProps, props, {\n components: components,\n mdxType: \"MDXLayout\"\n }), mdx(\"p\", null, \"Woah! You are almost half way done with understanding all of Discordeno. Amazing isn't it? Something you may have noticed in the last section was there were some options that prevented some commands from running like \", mdx(\"inlineCode\", {\n parentName: \"p\"\n }, \"dmOnly\"), \" or the permission options. we created a setting to prevent the monitor from running in certain channels. What if we wanted to do prevent commands from happening? How would we prevent commands from running?\"), mdx(\"h2\", null, \"What is an Inhibitor?\"), mdx(\"p\", null, \"An Inhibitor is very similar to how monitors work. A monitor runs on every message but an inhibitor runs on every command. Remember all those command options like cooldown, permissions, permissionLevel, nsfw, etc... Each and every one of these options has an inhibitor in that checks commands for these settings.\"), mdx(\"p\", null, \"Let's create our own inhibitor that would prevent commands from being used if the user is not a VIP user.\"), mdx(\"blockquote\", null, mdx(\"p\", {\n parentName: \"blockquote\"\n }, mdx(\"strong\", {\n parentName: \"p\"\n }, \"Note:\"), \" It is important to remember that everything below can be done with a simple permission level as well. We will create our own custom permission levels but for the purposes of this guide and to be able to learn about Inhibitors, we will be using an inhibitor.\")), mdx(\"h2\", null, \"Creating the File\"), mdx(\"p\", null, \"Let's start by creating a file inside the inhibitors folder called \", mdx(\"inlineCode\", {\n parentName: \"p\"\n }, \"boosted.ts\"), \" and paste the following snippet of code:\"), mdx(\"pre\", null, mdx(\"code\", _extends({\n parentName: \"pre\"\n }, {\n \"className\": \"language-ts\"\n }), \"import { botCache } from \\\"../../mod.ts\\\";\\n\\nbotCache.inhibitors.set(\\\"inhibitorname\\\", async function (message, command, guild) {\\n // Your code goes here\\n});\\n\")), mdx(\"p\", null, \"Inhibitors can take up to 3 arguments.\"), mdx(\"ul\", null, mdx(\"li\", {\n parentName: \"ul\"\n }, mdx(\"inlineCode\", {\n parentName: \"li\"\n }, \"message\"), \": The message object that triggered the command.\"), mdx(\"li\", {\n parentName: \"ul\"\n }, mdx(\"inlineCode\", {\n parentName: \"li\"\n }, \"command\"), \": The command object itself that was triggered.\"), mdx(\"li\", {\n parentName: \"ul\"\n }, mdx(\"inlineCode\", {\n parentName: \"li\"\n }, \"guild\"), \": The server guild object where this command was ran.\")), mdx(\"h2\", null, \"Understanding How Inhibitors Function\"), mdx(\"p\", null, \"To block a command you have to return a truthy value.\"), mdx(\"ul\", null, mdx(\"li\", {\n parentName: \"ul\"\n }, mdx(\"strong\", {\n parentName: \"li\"\n }, \"return true;\"), \" If you return true the inhibitor will block the execution of the command.\\nTo allow a command return a falsey value.\"), mdx(\"li\", {\n parentName: \"ul\"\n }, mdx(\"strong\", {\n parentName: \"li\"\n }, \"return false;\"), \" If you return false the inhibitor will not block the error.\")), mdx(\"pre\", null, mdx(\"code\", _extends({\n parentName: \"pre\"\n }, {\n \"className\": \"language-ts\"\n }), \"// If the command is not VIP only we can allow this command to execute\\nif (!command.vipOnly) return false;\\n\\n// The bot's support server\\nconst guild = cache.guilds.get(configs.supportServerID);\\n// If the command author is not in the server they won't have the vip role\\nconst member = guild.members.get(message.author.id) || await getMember(guild.id, message.author.id);\\n// Member doesn't exist so cancel the command\\nif (!member) return true;\\n\\n// If the user has the vip role on the support server given by patreon allow the command\\nif (member.roles.includes()) return false;\\n\\n// The user is NOT VIP so we throw an error\\nthrow `The ${command.name} is only allowed for VIP users.`\\n\")));\n}\n;\nMDXContent.isMDXComponent = true;","rawMDXOutput":"/* @jsx mdx */\nimport { mdx } from '@mdx-js/react';\n/* @jsx mdx */\n\nexport const _frontmatter = {\n \"title\": \"Creating Inhibitors!\",\n \"metaTitle\": \"Creating An Inhibitor | Discordeno\",\n \"metaDescription\": \"Let's create our very own bot with Discordeno!\"\n};\n\nconst layoutProps = {\n _frontmatter\n};\nconst MDXLayout = \"wrapper\"\nexport default function MDXContent({\n components,\n ...props\n}) {\n return \n

{`Woah! You are almost half way done with understanding all of Discordeno. Amazing isn't it? Something you may have noticed in the last section was there were some options that prevented some commands from running like `}{`dmOnly`}{` or the permission options. we created a setting to prevent the monitor from running in certain channels. What if we wanted to do prevent commands from happening? How would we prevent commands from running?`}

\n

{`What is an Inhibitor?`}

\n

{`An Inhibitor is very similar to how monitors work. A monitor runs on every message but an inhibitor runs on every command. Remember all those command options like cooldown, permissions, permissionLevel, nsfw, etc... Each and every one of these options has an inhibitor in that checks commands for these settings.`}

\n

{`Let's create our own inhibitor that would prevent commands from being used if the user is not a VIP user.`}

\n
\n

{`Note:`}{` It is important to remember that everything below can be done with a simple permission level as well. We will create our own custom permission levels but for the purposes of this guide and to be able to learn about Inhibitors, we will be using an inhibitor.`}

\n
\n

{`Creating the File`}

\n

{`Let's start by creating a file inside the inhibitors folder called `}{`boosted.ts`}{` and paste the following snippet of code:`}

\n
{`import { botCache } from \"../../mod.ts\";\n\nbotCache.inhibitors.set(\"inhibitorname\", async function (message, command, guild) {\n    // Your code goes here\n});\n`}
\n

{`Inhibitors can take up to 3 arguments.`}

\n
    \n
  • {`message`}{`: The message object that triggered the command.`}
  • \n
  • {`command`}{`: The command object itself that was triggered.`}
  • \n
  • {`guild`}{`: The server guild object where this command was ran.`}
  • \n
\n

{`Understanding How Inhibitors Function`}

\n

{`To block a command you have to return a truthy value.`}

\n
    \n
  • {`return true;`}{` If you return true the inhibitor will block the execution of the command.\nTo allow a command return a falsey value.`}
  • \n
  • {`return false;`}{` If you return false the inhibitor will not block the error.`}
  • \n
\n
{`// If the command is not VIP only we can allow this command to execute\nif (!command.vipOnly) return false;\n\n// The bot's support server\nconst guild = cache.guilds.get(configs.supportServerID);\n// If the command author is not in the server they won't have the vip role\nconst member = guild.members.get(message.author.id) || await getMember(guild.id, message.author.id);\n// Member doesn't exist so cancel the command\nif (!member) return true;\n\n// If the user has the vip role on the support server given by patreon allow the command\nif (member.roles.includes()) return false;\n\n// The user is NOT VIP so we throw an error\nthrow \\`The \\${command.name} is only allowed for VIP users.\\`\n`}
\n\n
;\n}\n\n;\nMDXContent.isMDXComponent = true;"}} \ No newline at end of file diff --git a/docs/.cache/caches/gatsby-plugin-mdx/diskstore-d66eaf1ed8c4b7320e3f11eb5c756df5.json b/docs/.cache/caches/gatsby-plugin-mdx/diskstore-d66eaf1ed8c4b7320e3f11eb5c756df5.json new file mode 100644 index 000000000..94ecb4c9f --- /dev/null +++ b/docs/.cache/caches/gatsby-plugin-mdx/diskstore-d66eaf1ed8c4b7320e3f11eb5c756df5.json @@ -0,0 +1 @@ +{"expireTime":9007200851633968000,"key":"gatsby-plugin-mdx-entire-payload-a0b2b41f98ddb3719e8fc61effb0c3e6-","val":{"mdast":{"type":"root","children":[{"type":"paragraph","children":[{"type":"text","value":"Woah! You are almost half way done with understanding all of Discordeno. Amazing isn't it? Something you may have noticed in the last section was there were some options that prevented some commands from running like ","position":{"start":{"line":2,"column":1,"offset":1},"end":{"line":2,"column":218,"offset":218},"indent":[]}},{"type":"inlineCode","value":"dmOnly","position":{"start":{"line":2,"column":218,"offset":218},"end":{"line":2,"column":226,"offset":226},"indent":[]}},{"type":"text","value":" or the permission options. we created a setting to prevent the monitor from running in certain channels. What if we wanted to do prevent commands from happening? How would we prevent commands from running?","position":{"start":{"line":2,"column":226,"offset":226},"end":{"line":2,"column":432,"offset":432},"indent":[]}}],"position":{"start":{"line":2,"column":1,"offset":1},"end":{"line":2,"column":432,"offset":432},"indent":[]}},{"type":"heading","depth":2,"children":[{"type":"text","value":"What is an Inhibitor?","position":{"start":{"line":4,"column":4,"offset":437},"end":{"line":4,"column":25,"offset":458},"indent":[]}}],"position":{"start":{"line":4,"column":1,"offset":434},"end":{"line":4,"column":25,"offset":458},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"An Inhibitor is very similar to how monitors work. A monitor runs on every message but an inhibitor runs on every command. Remember all those command options like cooldown, permissions, permissionLevel, nsfw, etc... Each and every one of these options has an inhibitor in that checks commands for these settings.","position":{"start":{"line":6,"column":1,"offset":460},"end":{"line":6,"column":313,"offset":772},"indent":[]}}],"position":{"start":{"line":6,"column":1,"offset":460},"end":{"line":6,"column":313,"offset":772},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"Let's create our own inhibitor that would prevent commands from being used if the user is not a VIP user.","position":{"start":{"line":8,"column":1,"offset":774},"end":{"line":8,"column":106,"offset":879},"indent":[]}}],"position":{"start":{"line":8,"column":1,"offset":774},"end":{"line":8,"column":106,"offset":879},"indent":[]}},{"type":"blockquote","children":[{"type":"paragraph","children":[{"type":"strong","children":[{"type":"text","value":"Note:","position":{"start":{"line":10,"column":5,"offset":885},"end":{"line":10,"column":10,"offset":890},"indent":[]}}],"position":{"start":{"line":10,"column":3,"offset":883},"end":{"line":10,"column":12,"offset":892},"indent":[]}},{"type":"text","value":" It is important to remember that everything below can be done with a simple permission level as well. We will create our own custom permission levels but for the purposes of this guide and to be able to learn about Inhibitors, we will be using an inhibitor.","position":{"start":{"line":10,"column":12,"offset":892},"end":{"line":10,"column":270,"offset":1150},"indent":[]}}],"position":{"start":{"line":10,"column":3,"offset":883},"end":{"line":10,"column":270,"offset":1150},"indent":[]}}],"position":{"start":{"line":10,"column":1,"offset":881},"end":{"line":10,"column":270,"offset":1150},"indent":[]}},{"type":"heading","depth":2,"children":[{"type":"text","value":"Creating the File","position":{"start":{"line":12,"column":4,"offset":1155},"end":{"line":12,"column":21,"offset":1172},"indent":[]}}],"position":{"start":{"line":12,"column":1,"offset":1152},"end":{"line":12,"column":21,"offset":1172},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"Let's start by creating a file inside the inhibitors folder called ","position":{"start":{"line":14,"column":1,"offset":1174},"end":{"line":14,"column":68,"offset":1241},"indent":[]}},{"type":"inlineCode","value":"boosted.ts","position":{"start":{"line":14,"column":68,"offset":1241},"end":{"line":14,"column":80,"offset":1253},"indent":[]}},{"type":"text","value":" and paste the following snippet of code:","position":{"start":{"line":14,"column":80,"offset":1253},"end":{"line":14,"column":121,"offset":1294},"indent":[]}}],"position":{"start":{"line":14,"column":1,"offset":1174},"end":{"line":14,"column":121,"offset":1294},"indent":[]}},{"type":"code","lang":"ts","meta":null,"value":"import { botCache } from \"../../mod.ts\";\n\nbotCache.inhibitors.set(\"inhibitorname\", async function (message, command, guild) {\n\t// Your code goes here\n});","position":{"start":{"line":16,"column":1,"offset":1296},"end":{"line":22,"column":4,"offset":1459},"indent":[1,1,1,1,1,1]}},{"type":"paragraph","children":[{"type":"text","value":"Inhibitors can take up to 3 arguments.","position":{"start":{"line":24,"column":1,"offset":1461},"end":{"line":24,"column":39,"offset":1499},"indent":[]}}],"position":{"start":{"line":24,"column":1,"offset":1461},"end":{"line":24,"column":39,"offset":1499},"indent":[]}},{"type":"list","ordered":false,"start":null,"spread":false,"children":[{"type":"listItem","spread":false,"checked":null,"children":[{"type":"paragraph","children":[{"type":"inlineCode","value":"message","position":{"start":{"line":26,"column":3,"offset":1503},"end":{"line":26,"column":12,"offset":1512},"indent":[]}},{"type":"text","value":": The message object that triggered the command.","position":{"start":{"line":26,"column":12,"offset":1512},"end":{"line":26,"column":60,"offset":1560},"indent":[]}}],"position":{"start":{"line":26,"column":3,"offset":1503},"end":{"line":26,"column":60,"offset":1560},"indent":[]}}],"position":{"start":{"line":26,"column":1,"offset":1501},"end":{"line":26,"column":60,"offset":1560},"indent":[]}},{"type":"listItem","spread":false,"checked":null,"children":[{"type":"paragraph","children":[{"type":"inlineCode","value":"command","position":{"start":{"line":27,"column":3,"offset":1563},"end":{"line":27,"column":12,"offset":1572},"indent":[]}},{"type":"text","value":": The command object itself that was triggered.","position":{"start":{"line":27,"column":12,"offset":1572},"end":{"line":27,"column":59,"offset":1619},"indent":[]}}],"position":{"start":{"line":27,"column":3,"offset":1563},"end":{"line":27,"column":59,"offset":1619},"indent":[]}}],"position":{"start":{"line":27,"column":1,"offset":1561},"end":{"line":27,"column":59,"offset":1619},"indent":[]}},{"type":"listItem","spread":false,"checked":null,"children":[{"type":"paragraph","children":[{"type":"inlineCode","value":"guild","position":{"start":{"line":28,"column":3,"offset":1622},"end":{"line":28,"column":10,"offset":1629},"indent":[]}},{"type":"text","value":": The server guild object where this command was ran.","position":{"start":{"line":28,"column":10,"offset":1629},"end":{"line":28,"column":63,"offset":1682},"indent":[]}}],"position":{"start":{"line":28,"column":3,"offset":1622},"end":{"line":28,"column":63,"offset":1682},"indent":[]}}],"position":{"start":{"line":28,"column":1,"offset":1620},"end":{"line":28,"column":63,"offset":1682},"indent":[]}}],"position":{"start":{"line":26,"column":1,"offset":1501},"end":{"line":28,"column":63,"offset":1682},"indent":[1,1]}},{"type":"heading","depth":2,"children":[{"type":"text","value":"Understanding How Inhibitors Function","position":{"start":{"line":30,"column":4,"offset":1687},"end":{"line":30,"column":41,"offset":1724},"indent":[]}}],"position":{"start":{"line":30,"column":1,"offset":1684},"end":{"line":30,"column":41,"offset":1724},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"To block a command you have to return a truthy value.","position":{"start":{"line":32,"column":1,"offset":1726},"end":{"line":32,"column":54,"offset":1779},"indent":[]}}],"position":{"start":{"line":32,"column":1,"offset":1726},"end":{"line":32,"column":54,"offset":1779},"indent":[]}},{"type":"list","ordered":false,"start":null,"spread":false,"children":[{"type":"listItem","spread":false,"checked":null,"children":[{"type":"paragraph","children":[{"type":"strong","children":[{"type":"text","value":"return true;","position":{"start":{"line":33,"column":5,"offset":1784},"end":{"line":33,"column":17,"offset":1796},"indent":[]}}],"position":{"start":{"line":33,"column":3,"offset":1782},"end":{"line":33,"column":19,"offset":1798},"indent":[]}},{"type":"text","value":" If you return true the inhibitor will block the execution of the command.\nTo allow a command return a falsey value.","position":{"start":{"line":33,"column":19,"offset":1798},"end":{"line":34,"column":42,"offset":1914},"indent":[1]}}],"position":{"start":{"line":33,"column":3,"offset":1782},"end":{"line":34,"column":42,"offset":1914},"indent":[1]}}],"position":{"start":{"line":33,"column":1,"offset":1780},"end":{"line":34,"column":42,"offset":1914},"indent":[1]}},{"type":"listItem","spread":false,"checked":null,"children":[{"type":"paragraph","children":[{"type":"strong","children":[{"type":"text","value":"return false;","position":{"start":{"line":35,"column":5,"offset":1919},"end":{"line":35,"column":18,"offset":1932},"indent":[]}}],"position":{"start":{"line":35,"column":3,"offset":1917},"end":{"line":35,"column":20,"offset":1934},"indent":[]}},{"type":"text","value":" If you return false the inhibitor will not block the error.","position":{"start":{"line":35,"column":20,"offset":1934},"end":{"line":35,"column":80,"offset":1994},"indent":[]}}],"position":{"start":{"line":35,"column":3,"offset":1917},"end":{"line":35,"column":80,"offset":1994},"indent":[]}}],"position":{"start":{"line":35,"column":1,"offset":1915},"end":{"line":35,"column":80,"offset":1994},"indent":[]}}],"position":{"start":{"line":33,"column":1,"offset":1780},"end":{"line":35,"column":80,"offset":1994},"indent":[1,1]}},{"type":"code","lang":"ts","meta":null,"value":"// If the command is not VIP only we can allow this command to execute\nif (!command.vipOnly) return false;\n\n// Check if the user is VIP\n// `isUserVIP` is NOT a thing. I am just using it as a placeholder here\nconst userIsVIP = await isUserVIP(message.author.id)\n// The user is VIP so we can allow this command to be used\nif (userIsVIP) return false;\n\n// The user is NOT VIP so we throw an error\nthrow `The ${command.name} is only allowed for VIP users.`","position":{"start":{"line":38,"column":1,"offset":1997},"end":{"line":50,"column":4,"offset":2459},"indent":[1,1,1,1,1,1,1,1,1,1,1,1]}},{"type":"export","value":"export const _frontmatter = {\"title\":\"Creating Inhibitors!\",\"metaTitle\":\"Creating An Inhibitor | Discordeno\",\"metaDescription\":\"Let's create our very own bot with Discordeno!\"}","position":{"start":{"line":53,"column":1,"offset":2462},"end":{"line":53,"column":177,"offset":2638},"indent":[]}}],"position":{"start":{"line":1,"column":1,"offset":0},"end":{"line":53,"column":177,"offset":2638}}},"scopeImports":["import * as React from 'react'"],"scopeIdentifiers":["React"],"body":"function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }\n\nfunction _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }\n\nfunction _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }\n\n/* @jsx mdx */\nvar _frontmatter = {\n \"title\": \"Creating Inhibitors!\",\n \"metaTitle\": \"Creating An Inhibitor | Discordeno\",\n \"metaDescription\": \"Let's create our very own bot with Discordeno!\"\n};\nvar layoutProps = {\n _frontmatter: _frontmatter\n};\nvar MDXLayout = \"wrapper\";\nreturn function MDXContent(_ref) {\n var components = _ref.components,\n props = _objectWithoutProperties(_ref, [\"components\"]);\n\n return mdx(MDXLayout, _extends({}, layoutProps, props, {\n components: components,\n mdxType: \"MDXLayout\"\n }), mdx(\"p\", null, \"Woah! You are almost half way done with understanding all of Discordeno. Amazing isn't it? Something you may have noticed in the last section was there were some options that prevented some commands from running like \", mdx(\"inlineCode\", {\n parentName: \"p\"\n }, \"dmOnly\"), \" or the permission options. we created a setting to prevent the monitor from running in certain channels. What if we wanted to do prevent commands from happening? How would we prevent commands from running?\"), mdx(\"h2\", null, \"What is an Inhibitor?\"), mdx(\"p\", null, \"An Inhibitor is very similar to how monitors work. A monitor runs on every message but an inhibitor runs on every command. Remember all those command options like cooldown, permissions, permissionLevel, nsfw, etc... Each and every one of these options has an inhibitor in that checks commands for these settings.\"), mdx(\"p\", null, \"Let's create our own inhibitor that would prevent commands from being used if the user is not a VIP user.\"), mdx(\"blockquote\", null, mdx(\"p\", {\n parentName: \"blockquote\"\n }, mdx(\"strong\", {\n parentName: \"p\"\n }, \"Note:\"), \" It is important to remember that everything below can be done with a simple permission level as well. We will create our own custom permission levels but for the purposes of this guide and to be able to learn about Inhibitors, we will be using an inhibitor.\")), mdx(\"h2\", null, \"Creating the File\"), mdx(\"p\", null, \"Let's start by creating a file inside the inhibitors folder called \", mdx(\"inlineCode\", {\n parentName: \"p\"\n }, \"boosted.ts\"), \" and paste the following snippet of code:\"), mdx(\"pre\", null, mdx(\"code\", _extends({\n parentName: \"pre\"\n }, {\n \"className\": \"language-ts\"\n }), \"import { botCache } from \\\"../../mod.ts\\\";\\n\\nbotCache.inhibitors.set(\\\"inhibitorname\\\", async function (message, command, guild) {\\n // Your code goes here\\n});\\n\")), mdx(\"p\", null, \"Inhibitors can take up to 3 arguments.\"), mdx(\"ul\", null, mdx(\"li\", {\n parentName: \"ul\"\n }, mdx(\"inlineCode\", {\n parentName: \"li\"\n }, \"message\"), \": The message object that triggered the command.\"), mdx(\"li\", {\n parentName: \"ul\"\n }, mdx(\"inlineCode\", {\n parentName: \"li\"\n }, \"command\"), \": The command object itself that was triggered.\"), mdx(\"li\", {\n parentName: \"ul\"\n }, mdx(\"inlineCode\", {\n parentName: \"li\"\n }, \"guild\"), \": The server guild object where this command was ran.\")), mdx(\"h2\", null, \"Understanding How Inhibitors Function\"), mdx(\"p\", null, \"To block a command you have to return a truthy value.\"), mdx(\"ul\", null, mdx(\"li\", {\n parentName: \"ul\"\n }, mdx(\"strong\", {\n parentName: \"li\"\n }, \"return true;\"), \" If you return true the inhibitor will block the execution of the command.\\nTo allow a command return a falsey value.\"), mdx(\"li\", {\n parentName: \"ul\"\n }, mdx(\"strong\", {\n parentName: \"li\"\n }, \"return false;\"), \" If you return false the inhibitor will not block the error.\")), mdx(\"pre\", null, mdx(\"code\", _extends({\n parentName: \"pre\"\n }, {\n \"className\": \"language-ts\"\n }), \"// If the command is not VIP only we can allow this command to execute\\nif (!command.vipOnly) return false;\\n\\n// Check if the user is VIP\\n// `isUserVIP` is NOT a thing. I am just using it as a placeholder here\\nconst userIsVIP = await isUserVIP(message.author.id)\\n// The user is VIP so we can allow this command to be used\\nif (userIsVIP) return false;\\n\\n// The user is NOT VIP so we throw an error\\nthrow `The ${command.name} is only allowed for VIP users.`\\n\")));\n}\n;\nMDXContent.isMDXComponent = true;","rawMDXOutput":"/* @jsx mdx */\nimport { mdx } from '@mdx-js/react';\n/* @jsx mdx */\n\nexport const _frontmatter = {\n \"title\": \"Creating Inhibitors!\",\n \"metaTitle\": \"Creating An Inhibitor | Discordeno\",\n \"metaDescription\": \"Let's create our very own bot with Discordeno!\"\n};\n\nconst layoutProps = {\n _frontmatter\n};\nconst MDXLayout = \"wrapper\"\nexport default function MDXContent({\n components,\n ...props\n}) {\n return \n

{`Woah! You are almost half way done with understanding all of Discordeno. Amazing isn't it? Something you may have noticed in the last section was there were some options that prevented some commands from running like `}{`dmOnly`}{` or the permission options. we created a setting to prevent the monitor from running in certain channels. What if we wanted to do prevent commands from happening? How would we prevent commands from running?`}

\n

{`What is an Inhibitor?`}

\n

{`An Inhibitor is very similar to how monitors work. A monitor runs on every message but an inhibitor runs on every command. Remember all those command options like cooldown, permissions, permissionLevel, nsfw, etc... Each and every one of these options has an inhibitor in that checks commands for these settings.`}

\n

{`Let's create our own inhibitor that would prevent commands from being used if the user is not a VIP user.`}

\n
\n

{`Note:`}{` It is important to remember that everything below can be done with a simple permission level as well. We will create our own custom permission levels but for the purposes of this guide and to be able to learn about Inhibitors, we will be using an inhibitor.`}

\n
\n

{`Creating the File`}

\n

{`Let's start by creating a file inside the inhibitors folder called `}{`boosted.ts`}{` and paste the following snippet of code:`}

\n
{`import { botCache } from \"../../mod.ts\";\n\nbotCache.inhibitors.set(\"inhibitorname\", async function (message, command, guild) {\n    // Your code goes here\n});\n`}
\n

{`Inhibitors can take up to 3 arguments.`}

\n
    \n
  • {`message`}{`: The message object that triggered the command.`}
  • \n
  • {`command`}{`: The command object itself that was triggered.`}
  • \n
  • {`guild`}{`: The server guild object where this command was ran.`}
  • \n
\n

{`Understanding How Inhibitors Function`}

\n

{`To block a command you have to return a truthy value.`}

\n
    \n
  • {`return true;`}{` If you return true the inhibitor will block the execution of the command.\nTo allow a command return a falsey value.`}
  • \n
  • {`return false;`}{` If you return false the inhibitor will not block the error.`}
  • \n
\n
{`// If the command is not VIP only we can allow this command to execute\nif (!command.vipOnly) return false;\n\n// Check if the user is VIP\n// \\`isUserVIP\\` is NOT a thing. I am just using it as a placeholder here\nconst userIsVIP = await isUserVIP(message.author.id)\n// The user is VIP so we can allow this command to be used\nif (userIsVIP) return false;\n\n// The user is NOT VIP so we throw an error\nthrow \\`The \\${command.name} is only allowed for VIP users.\\`\n`}
\n\n
;\n}\n\n;\nMDXContent.isMDXComponent = true;"}} \ No newline at end of file diff --git a/docs/.cache/caches/gatsby-plugin-mdx/diskstore-d704f79611bc66f6e420fea792eb973e.json b/docs/.cache/caches/gatsby-plugin-mdx/diskstore-d704f79611bc66f6e420fea792eb973e.json new file mode 100644 index 000000000..d4c3bbdd0 --- /dev/null +++ b/docs/.cache/caches/gatsby-plugin-mdx/diskstore-d704f79611bc66f6e420fea792eb973e.json @@ -0,0 +1 @@ +{"expireTime":9007200851596798000,"key":"gatsby-plugin-mdx-entire-payload-d576a156fd03b4e9bc673a9b93a7c294-","val":{"mdast":{"type":"root","children":[{"type":"export","value":"export const _frontmatter = {}","position":{"start":{"line":3,"column":1,"offset":2},"end":{"line":3,"column":31,"offset":32},"indent":[]}}],"position":{"start":{"line":1,"column":1,"offset":0},"end":{"line":3,"column":31,"offset":32}}},"scopeImports":["import * as React from 'react'"],"scopeIdentifiers":["React"],"body":"function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }\n\nfunction _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }\n\nfunction _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }\n\n/* @jsx mdx */\nvar _frontmatter = {};\nvar layoutProps = {\n _frontmatter: _frontmatter\n};\nvar MDXLayout = \"wrapper\";\nreturn function MDXContent(_ref) {\n var components = _ref.components,\n props = _objectWithoutProperties(_ref, [\"components\"]);\n\n return mdx(MDXLayout, _extends({}, layoutProps, props, {\n components: components,\n mdxType: \"MDXLayout\"\n }));\n}\n;\nMDXContent.isMDXComponent = true;","rawMDXOutput":"/* @jsx mdx */\nimport { mdx } from '@mdx-js/react';\n/* @jsx mdx */\n\nexport const _frontmatter = {};\n\nconst layoutProps = {\n _frontmatter\n};\nconst MDXLayout = \"wrapper\"\nexport default function MDXContent({\n components,\n ...props\n}) {\n return \n\n ;\n}\n\n;\nMDXContent.isMDXComponent = true;"}} \ No newline at end of file diff --git a/docs/.cache/caches/gatsby-plugin-mdx/diskstore-d8b82ea2d5e9b8cf0ed2fb0b9c4d110c.json b/docs/.cache/caches/gatsby-plugin-mdx/diskstore-d8b82ea2d5e9b8cf0ed2fb0b9c4d110c.json new file mode 100644 index 000000000..033e9dd8f --- /dev/null +++ b/docs/.cache/caches/gatsby-plugin-mdx/diskstore-d8b82ea2d5e9b8cf0ed2fb0b9c4d110c.json @@ -0,0 +1 @@ +{"expireTime":9007200851633758000,"key":"gatsby-plugin-mdx-entire-payload-049f5df2be8aa4b7c59185f32d3512ec-","val":{"mdast":{"type":"root","children":[{"type":"paragraph","children":[{"type":"text","value":"Woah! You are almost half way done with understanding all of Discordeno. Amazing isn't it? Something you may have noticed in the last section was there were some options that prevented some commands from running like ","position":{"start":{"line":2,"column":1,"offset":1},"end":{"line":2,"column":218,"offset":218},"indent":[]}},{"type":"inlineCode","value":"dmOnly","position":{"start":{"line":2,"column":218,"offset":218},"end":{"line":2,"column":226,"offset":226},"indent":[]}},{"type":"text","value":" or the permission options. we created a setting to prevent the monitor from running in certain channels. What if we wanted to do prevent commands from happening? How would we prevent commands from running?","position":{"start":{"line":2,"column":226,"offset":226},"end":{"line":2,"column":432,"offset":432},"indent":[]}}],"position":{"start":{"line":2,"column":1,"offset":1},"end":{"line":2,"column":432,"offset":432},"indent":[]}},{"type":"heading","depth":2,"children":[{"type":"text","value":"What is an Inhibitor?","position":{"start":{"line":4,"column":4,"offset":437},"end":{"line":4,"column":25,"offset":458},"indent":[]}}],"position":{"start":{"line":4,"column":1,"offset":434},"end":{"line":4,"column":25,"offset":458},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"An Inhibitor is very similar to how monitors work. A monitor runs on every message but an inhibitor runs on every command. Remember all those command options like cooldown, permissions, permissionLevel, nsfw, etc... Each and every one of these options has an inhibitor in that checks commands for these settings.","position":{"start":{"line":6,"column":1,"offset":460},"end":{"line":6,"column":313,"offset":772},"indent":[]}}],"position":{"start":{"line":6,"column":1,"offset":460},"end":{"line":6,"column":313,"offset":772},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"Let's create our own inhibitor that would prevent commands from being used if the user is not a VIP user.","position":{"start":{"line":8,"column":1,"offset":774},"end":{"line":8,"column":106,"offset":879},"indent":[]}}],"position":{"start":{"line":8,"column":1,"offset":774},"end":{"line":8,"column":106,"offset":879},"indent":[]}},{"type":"blockquote","children":[{"type":"paragraph","children":[{"type":"strong","children":[{"type":"text","value":"Note:","position":{"start":{"line":10,"column":5,"offset":885},"end":{"line":10,"column":10,"offset":890},"indent":[]}}],"position":{"start":{"line":10,"column":3,"offset":883},"end":{"line":10,"column":12,"offset":892},"indent":[]}},{"type":"text","value":" It is important to remember that everything below can be done with a simple permission level as well. We will create our own custom permission levels but for the purposes of this guide and to be able to learn about Inhibitors, we will be using an inhibitor.","position":{"start":{"line":10,"column":12,"offset":892},"end":{"line":10,"column":270,"offset":1150},"indent":[]}}],"position":{"start":{"line":10,"column":3,"offset":883},"end":{"line":10,"column":270,"offset":1150},"indent":[]}}],"position":{"start":{"line":10,"column":1,"offset":881},"end":{"line":10,"column":270,"offset":1150},"indent":[]}},{"type":"heading","depth":2,"children":[{"type":"text","value":"Creating the File","position":{"start":{"line":12,"column":4,"offset":1155},"end":{"line":12,"column":21,"offset":1172},"indent":[]}}],"position":{"start":{"line":12,"column":1,"offset":1152},"end":{"line":12,"column":21,"offset":1172},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"Let's start by creating a file inside the inhibitors folder called ","position":{"start":{"line":14,"column":1,"offset":1174},"end":{"line":14,"column":68,"offset":1241},"indent":[]}},{"type":"inlineCode","value":"vipOnly.ts","position":{"start":{"line":14,"column":68,"offset":1241},"end":{"line":14,"column":80,"offset":1253},"indent":[]}},{"type":"text","value":" and paste the following snippet of code:","position":{"start":{"line":14,"column":80,"offset":1253},"end":{"line":14,"column":121,"offset":1294},"indent":[]}}],"position":{"start":{"line":14,"column":1,"offset":1174},"end":{"line":14,"column":121,"offset":1294},"indent":[]}},{"type":"code","lang":"ts","meta":null,"value":"import { botCache } from \"../../mod.ts\";\n\nbotCache.inhibitors.set(\"inhibitorname\", async function (message, command, guild) {\n\t// Your code goes here\n});","position":{"start":{"line":16,"column":1,"offset":1296},"end":{"line":22,"column":4,"offset":1459},"indent":[1,1,1,1,1,1]}},{"type":"paragraph","children":[{"type":"text","value":"Inhibitors can take up to 3 arguments.","position":{"start":{"line":24,"column":1,"offset":1461},"end":{"line":24,"column":39,"offset":1499},"indent":[]}}],"position":{"start":{"line":24,"column":1,"offset":1461},"end":{"line":24,"column":39,"offset":1499},"indent":[]}},{"type":"list","ordered":false,"start":null,"spread":false,"children":[{"type":"listItem","spread":false,"checked":null,"children":[{"type":"paragraph","children":[{"type":"inlineCode","value":"message","position":{"start":{"line":26,"column":3,"offset":1503},"end":{"line":26,"column":12,"offset":1512},"indent":[]}},{"type":"text","value":": The message object that triggered the command.","position":{"start":{"line":26,"column":12,"offset":1512},"end":{"line":26,"column":60,"offset":1560},"indent":[]}}],"position":{"start":{"line":26,"column":3,"offset":1503},"end":{"line":26,"column":60,"offset":1560},"indent":[]}}],"position":{"start":{"line":26,"column":1,"offset":1501},"end":{"line":26,"column":60,"offset":1560},"indent":[]}},{"type":"listItem","spread":false,"checked":null,"children":[{"type":"paragraph","children":[{"type":"inlineCode","value":"command","position":{"start":{"line":27,"column":3,"offset":1563},"end":{"line":27,"column":12,"offset":1572},"indent":[]}},{"type":"text","value":": The command object itself that was triggered.","position":{"start":{"line":27,"column":12,"offset":1572},"end":{"line":27,"column":59,"offset":1619},"indent":[]}}],"position":{"start":{"line":27,"column":3,"offset":1563},"end":{"line":27,"column":59,"offset":1619},"indent":[]}}],"position":{"start":{"line":27,"column":1,"offset":1561},"end":{"line":27,"column":59,"offset":1619},"indent":[]}},{"type":"listItem","spread":false,"checked":null,"children":[{"type":"paragraph","children":[{"type":"inlineCode","value":"guild","position":{"start":{"line":28,"column":3,"offset":1622},"end":{"line":28,"column":10,"offset":1629},"indent":[]}},{"type":"text","value":": The server guild object where this command was ran.","position":{"start":{"line":28,"column":10,"offset":1629},"end":{"line":28,"column":63,"offset":1682},"indent":[]}}],"position":{"start":{"line":28,"column":3,"offset":1622},"end":{"line":28,"column":63,"offset":1682},"indent":[]}}],"position":{"start":{"line":28,"column":1,"offset":1620},"end":{"line":28,"column":63,"offset":1682},"indent":[]}}],"position":{"start":{"line":26,"column":1,"offset":1501},"end":{"line":28,"column":63,"offset":1682},"indent":[1,1]}},{"type":"heading","depth":2,"children":[{"type":"text","value":"Understanding How Inhibitors Function","position":{"start":{"line":30,"column":4,"offset":1687},"end":{"line":30,"column":41,"offset":1724},"indent":[]}}],"position":{"start":{"line":30,"column":1,"offset":1684},"end":{"line":30,"column":41,"offset":1724},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"To block a command you have to return a truthy value.","position":{"start":{"line":32,"column":1,"offset":1726},"end":{"line":32,"column":54,"offset":1779},"indent":[]}}],"position":{"start":{"line":32,"column":1,"offset":1726},"end":{"line":32,"column":54,"offset":1779},"indent":[]}},{"type":"list","ordered":false,"start":null,"spread":false,"children":[{"type":"listItem","spread":false,"checked":null,"children":[{"type":"paragraph","children":[{"type":"strong","children":[{"type":"text","value":"return true;","position":{"start":{"line":33,"column":5,"offset":1784},"end":{"line":33,"column":17,"offset":1796},"indent":[]}}],"position":{"start":{"line":33,"column":3,"offset":1782},"end":{"line":33,"column":19,"offset":1798},"indent":[]}},{"type":"text","value":" If you return true the inhibitor will block the execution of the command.\nTo allow a command return a falsey value.","position":{"start":{"line":33,"column":19,"offset":1798},"end":{"line":34,"column":42,"offset":1914},"indent":[1]}}],"position":{"start":{"line":33,"column":3,"offset":1782},"end":{"line":34,"column":42,"offset":1914},"indent":[1]}}],"position":{"start":{"line":33,"column":1,"offset":1780},"end":{"line":34,"column":42,"offset":1914},"indent":[1]}},{"type":"listItem","spread":false,"checked":null,"children":[{"type":"paragraph","children":[{"type":"strong","children":[{"type":"text","value":"return false;","position":{"start":{"line":35,"column":5,"offset":1919},"end":{"line":35,"column":18,"offset":1932},"indent":[]}}],"position":{"start":{"line":35,"column":3,"offset":1917},"end":{"line":35,"column":20,"offset":1934},"indent":[]}},{"type":"text","value":" If you return false the inhibitor will not block the error.","position":{"start":{"line":35,"column":20,"offset":1934},"end":{"line":35,"column":80,"offset":1994},"indent":[]}}],"position":{"start":{"line":35,"column":3,"offset":1917},"end":{"line":35,"column":80,"offset":1994},"indent":[]}}],"position":{"start":{"line":35,"column":1,"offset":1915},"end":{"line":35,"column":80,"offset":1994},"indent":[]}}],"position":{"start":{"line":33,"column":1,"offset":1780},"end":{"line":35,"column":80,"offset":1994},"indent":[1,1]}},{"type":"code","lang":"ts","meta":null,"value":"// If the command is not VIP only we can allow this command to execute\nif (!command.vipOnly) return false;\n\n// Check if the user is VIP\nconst userIsVIP = await isUserVIP(message.author.id)\n// The user is VIP so we can allow this command to be used\nif (userIsVIP) return false;\n\n// The user is NOT VIP so we throw an error\nthrow `The ${command.name} is only allowed for VIP users.`","position":{"start":{"line":38,"column":1,"offset":1997},"end":{"line":49,"column":4,"offset":2387},"indent":[1,1,1,1,1,1,1,1,1,1,1]}},{"type":"export","value":"export const _frontmatter = {\"title\":\"Creating Inhibitors!\",\"metaTitle\":\"Creating An Inhibitor | Discordeno\",\"metaDescription\":\"Let's create our very own bot with Discordeno!\"}","position":{"start":{"line":52,"column":1,"offset":2390},"end":{"line":52,"column":177,"offset":2566},"indent":[]}}],"position":{"start":{"line":1,"column":1,"offset":0},"end":{"line":52,"column":177,"offset":2566}}},"scopeImports":["import * as React from 'react'"],"scopeIdentifiers":["React"],"body":"function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }\n\nfunction _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }\n\nfunction _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }\n\n/* @jsx mdx */\nvar _frontmatter = {\n \"title\": \"Creating Inhibitors!\",\n \"metaTitle\": \"Creating An Inhibitor | Discordeno\",\n \"metaDescription\": \"Let's create our very own bot with Discordeno!\"\n};\nvar layoutProps = {\n _frontmatter: _frontmatter\n};\nvar MDXLayout = \"wrapper\";\nreturn function MDXContent(_ref) {\n var components = _ref.components,\n props = _objectWithoutProperties(_ref, [\"components\"]);\n\n return mdx(MDXLayout, _extends({}, layoutProps, props, {\n components: components,\n mdxType: \"MDXLayout\"\n }), mdx(\"p\", null, \"Woah! You are almost half way done with understanding all of Discordeno. Amazing isn't it? Something you may have noticed in the last section was there were some options that prevented some commands from running like \", mdx(\"inlineCode\", {\n parentName: \"p\"\n }, \"dmOnly\"), \" or the permission options. we created a setting to prevent the monitor from running in certain channels. What if we wanted to do prevent commands from happening? How would we prevent commands from running?\"), mdx(\"h2\", null, \"What is an Inhibitor?\"), mdx(\"p\", null, \"An Inhibitor is very similar to how monitors work. A monitor runs on every message but an inhibitor runs on every command. Remember all those command options like cooldown, permissions, permissionLevel, nsfw, etc... Each and every one of these options has an inhibitor in that checks commands for these settings.\"), mdx(\"p\", null, \"Let's create our own inhibitor that would prevent commands from being used if the user is not a VIP user.\"), mdx(\"blockquote\", null, mdx(\"p\", {\n parentName: \"blockquote\"\n }, mdx(\"strong\", {\n parentName: \"p\"\n }, \"Note:\"), \" It is important to remember that everything below can be done with a simple permission level as well. We will create our own custom permission levels but for the purposes of this guide and to be able to learn about Inhibitors, we will be using an inhibitor.\")), mdx(\"h2\", null, \"Creating the File\"), mdx(\"p\", null, \"Let's start by creating a file inside the inhibitors folder called \", mdx(\"inlineCode\", {\n parentName: \"p\"\n }, \"vipOnly.ts\"), \" and paste the following snippet of code:\"), mdx(\"pre\", null, mdx(\"code\", _extends({\n parentName: \"pre\"\n }, {\n \"className\": \"language-ts\"\n }), \"import { botCache } from \\\"../../mod.ts\\\";\\n\\nbotCache.inhibitors.set(\\\"inhibitorname\\\", async function (message, command, guild) {\\n // Your code goes here\\n});\\n\")), mdx(\"p\", null, \"Inhibitors can take up to 3 arguments.\"), mdx(\"ul\", null, mdx(\"li\", {\n parentName: \"ul\"\n }, mdx(\"inlineCode\", {\n parentName: \"li\"\n }, \"message\"), \": The message object that triggered the command.\"), mdx(\"li\", {\n parentName: \"ul\"\n }, mdx(\"inlineCode\", {\n parentName: \"li\"\n }, \"command\"), \": The command object itself that was triggered.\"), mdx(\"li\", {\n parentName: \"ul\"\n }, mdx(\"inlineCode\", {\n parentName: \"li\"\n }, \"guild\"), \": The server guild object where this command was ran.\")), mdx(\"h2\", null, \"Understanding How Inhibitors Function\"), mdx(\"p\", null, \"To block a command you have to return a truthy value.\"), mdx(\"ul\", null, mdx(\"li\", {\n parentName: \"ul\"\n }, mdx(\"strong\", {\n parentName: \"li\"\n }, \"return true;\"), \" If you return true the inhibitor will block the execution of the command.\\nTo allow a command return a falsey value.\"), mdx(\"li\", {\n parentName: \"ul\"\n }, mdx(\"strong\", {\n parentName: \"li\"\n }, \"return false;\"), \" If you return false the inhibitor will not block the error.\")), mdx(\"pre\", null, mdx(\"code\", _extends({\n parentName: \"pre\"\n }, {\n \"className\": \"language-ts\"\n }), \"// If the command is not VIP only we can allow this command to execute\\nif (!command.vipOnly) return false;\\n\\n// Check if the user is VIP\\nconst userIsVIP = await isUserVIP(message.author.id)\\n// The user is VIP so we can allow this command to be used\\nif (userIsVIP) return false;\\n\\n// The user is NOT VIP so we throw an error\\nthrow `The ${command.name} is only allowed for VIP users.`\\n\")));\n}\n;\nMDXContent.isMDXComponent = true;","rawMDXOutput":"/* @jsx mdx */\nimport { mdx } from '@mdx-js/react';\n/* @jsx mdx */\n\nexport const _frontmatter = {\n \"title\": \"Creating Inhibitors!\",\n \"metaTitle\": \"Creating An Inhibitor | Discordeno\",\n \"metaDescription\": \"Let's create our very own bot with Discordeno!\"\n};\n\nconst layoutProps = {\n _frontmatter\n};\nconst MDXLayout = \"wrapper\"\nexport default function MDXContent({\n components,\n ...props\n}) {\n return \n

{`Woah! You are almost half way done with understanding all of Discordeno. Amazing isn't it? Something you may have noticed in the last section was there were some options that prevented some commands from running like `}{`dmOnly`}{` or the permission options. we created a setting to prevent the monitor from running in certain channels. What if we wanted to do prevent commands from happening? How would we prevent commands from running?`}

\n

{`What is an Inhibitor?`}

\n

{`An Inhibitor is very similar to how monitors work. A monitor runs on every message but an inhibitor runs on every command. Remember all those command options like cooldown, permissions, permissionLevel, nsfw, etc... Each and every one of these options has an inhibitor in that checks commands for these settings.`}

\n

{`Let's create our own inhibitor that would prevent commands from being used if the user is not a VIP user.`}

\n
\n

{`Note:`}{` It is important to remember that everything below can be done with a simple permission level as well. We will create our own custom permission levels but for the purposes of this guide and to be able to learn about Inhibitors, we will be using an inhibitor.`}

\n
\n

{`Creating the File`}

\n

{`Let's start by creating a file inside the inhibitors folder called `}{`vipOnly.ts`}{` and paste the following snippet of code:`}

\n
{`import { botCache } from \"../../mod.ts\";\n\nbotCache.inhibitors.set(\"inhibitorname\", async function (message, command, guild) {\n    // Your code goes here\n});\n`}
\n

{`Inhibitors can take up to 3 arguments.`}

\n
    \n
  • {`message`}{`: The message object that triggered the command.`}
  • \n
  • {`command`}{`: The command object itself that was triggered.`}
  • \n
  • {`guild`}{`: The server guild object where this command was ran.`}
  • \n
\n

{`Understanding How Inhibitors Function`}

\n

{`To block a command you have to return a truthy value.`}

\n
    \n
  • {`return true;`}{` If you return true the inhibitor will block the execution of the command.\nTo allow a command return a falsey value.`}
  • \n
  • {`return false;`}{` If you return false the inhibitor will not block the error.`}
  • \n
\n
{`// If the command is not VIP only we can allow this command to execute\nif (!command.vipOnly) return false;\n\n// Check if the user is VIP\nconst userIsVIP = await isUserVIP(message.author.id)\n// The user is VIP so we can allow this command to be used\nif (userIsVIP) return false;\n\n// The user is NOT VIP so we throw an error\nthrow \\`The \\${command.name} is only allowed for VIP users.\\`\n`}
\n\n
;\n}\n\n;\nMDXContent.isMDXComponent = true;"}} \ No newline at end of file diff --git a/docs/.cache/caches/gatsby-plugin-mdx/diskstore-d9b8ce7d728e6c46d9674a9b92a1d571.json b/docs/.cache/caches/gatsby-plugin-mdx/diskstore-d9b8ce7d728e6c46d9674a9b92a1d571.json new file mode 100644 index 000000000..101d5b005 --- /dev/null +++ b/docs/.cache/caches/gatsby-plugin-mdx/diskstore-d9b8ce7d728e6c46d9674a9b92a1d571.json @@ -0,0 +1 @@ +{"expireTime":9007200851635215000,"key":"gatsby-plugin-mdx-entire-payload-d9ffc13b0e386f7c32e24af970511f5e-","val":{"mdast":{"type":"root","children":[{"type":"paragraph","children":[{"type":"text","value":"Woah! You are almost half way done with understanding all of Discordeno. Amazing isn't it? Something you may have noticed in the last section was when the bot started up you could see a bunch of messages like ","position":{"start":{"line":2,"column":1,"offset":1},"end":{"line":2,"column":210,"offset":210},"indent":[]}},{"type":"inlineCode","value":"Loaded X Commands","position":{"start":{"line":2,"column":210,"offset":210},"end":{"line":2,"column":229,"offset":229},"indent":[]}},{"type":"text","value":" and such. Let's jump into this part now and understand how event handling works in Discordeno.","position":{"start":{"line":2,"column":229,"offset":229},"end":{"line":2,"column":324,"offset":324},"indent":[]}}],"position":{"start":{"line":2,"column":1,"offset":1},"end":{"line":2,"column":324,"offset":324},"indent":[]}},{"type":"heading","depth":2,"children":[{"type":"text","value":"What Is An Event?","position":{"start":{"line":4,"column":4,"offset":329},"end":{"line":4,"column":21,"offset":346},"indent":[]}}],"position":{"start":{"line":4,"column":1,"offset":326},"end":{"line":4,"column":21,"offset":346},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"An event in Discordeno is a function that can be called when a specific event occurs. For the most part, events will usually be the ones that are available from Discordeno.","position":{"start":{"line":6,"column":1,"offset":348},"end":{"line":6,"column":173,"offset":520},"indent":[]}}],"position":{"start":{"line":6,"column":1,"offset":348},"end":{"line":6,"column":173,"offset":520},"indent":[]}},{"type":"export","value":"export const _frontmatter = {\"title\":\"Creating Events!\",\"metaTitle\":\"Creating An Event | Discordeno\",\"metaDescription\":\"Let's create our very own bot with Discordeno!\"}","position":{"start":{"line":9,"column":1,"offset":523},"end":{"line":9,"column":169,"offset":691},"indent":[]}}],"position":{"start":{"line":1,"column":1,"offset":0},"end":{"line":9,"column":169,"offset":691}}},"scopeImports":["import * as React from 'react'"],"scopeIdentifiers":["React"],"body":"function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }\n\nfunction _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }\n\nfunction _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }\n\n/* @jsx mdx */\nvar _frontmatter = {\n \"title\": \"Creating Events!\",\n \"metaTitle\": \"Creating An Event | Discordeno\",\n \"metaDescription\": \"Let's create our very own bot with Discordeno!\"\n};\nvar layoutProps = {\n _frontmatter: _frontmatter\n};\nvar MDXLayout = \"wrapper\";\nreturn function MDXContent(_ref) {\n var components = _ref.components,\n props = _objectWithoutProperties(_ref, [\"components\"]);\n\n return mdx(MDXLayout, _extends({}, layoutProps, props, {\n components: components,\n mdxType: \"MDXLayout\"\n }), mdx(\"p\", null, \"Woah! You are almost half way done with understanding all of Discordeno. Amazing isn't it? Something you may have noticed in the last section was when the bot started up you could see a bunch of messages like \", mdx(\"inlineCode\", {\n parentName: \"p\"\n }, \"Loaded X Commands\"), \" and such. Let's jump into this part now and understand how event handling works in Discordeno.\"), mdx(\"h2\", null, \"What Is An Event?\"), mdx(\"p\", null, \"An event in Discordeno is a function that can be called when a specific event occurs. For the most part, events will usually be the ones that are available from Discordeno.\"));\n}\n;\nMDXContent.isMDXComponent = true;","rawMDXOutput":"/* @jsx mdx */\nimport { mdx } from '@mdx-js/react';\n/* @jsx mdx */\n\nexport const _frontmatter = {\n \"title\": \"Creating Events!\",\n \"metaTitle\": \"Creating An Event | Discordeno\",\n \"metaDescription\": \"Let's create our very own bot with Discordeno!\"\n};\n\nconst layoutProps = {\n _frontmatter\n};\nconst MDXLayout = \"wrapper\"\nexport default function MDXContent({\n components,\n ...props\n}) {\n return \n

{`Woah! You are almost half way done with understanding all of Discordeno. Amazing isn't it? Something you may have noticed in the last section was when the bot started up you could see a bunch of messages like `}{`Loaded X Commands`}{` and such. Let's jump into this part now and understand how event handling works in Discordeno.`}

\n

{`What Is An Event?`}

\n

{`An event in Discordeno is a function that can be called when a specific event occurs. For the most part, events will usually be the ones that are available from Discordeno.`}

\n\n
;\n}\n\n;\nMDXContent.isMDXComponent = true;"}} \ No newline at end of file diff --git a/docs/.cache/caches/gatsby-plugin-mdx/diskstore-da47700eed50f4e18f76c4c755dd4382.json b/docs/.cache/caches/gatsby-plugin-mdx/diskstore-da47700eed50f4e18f76c4c755dd4382.json new file mode 100644 index 000000000..bef92d2bc --- /dev/null +++ b/docs/.cache/caches/gatsby-plugin-mdx/diskstore-da47700eed50f4e18f76c4c755dd4382.json @@ -0,0 +1 @@ +{"expireTime":9007200851632071000,"key":"gatsby-plugin-mdx-entire-payload-c3c8b2b1a891b7e5571f1ec5b0b32d4d-","val":{"mdast":{"type":"root","children":[{"type":"paragraph","children":[{"type":"text","value":"Woah! You are almost half way done with understanding all of Discordeno. Amazing isn't it? Something you may have noticed in the last section was there were some options that prevented some commands from running like ","position":{"start":{"line":2,"column":1,"offset":1},"end":{"line":2,"column":218,"offset":218},"indent":[]}},{"type":"inlineCode","value":"dmOnly","position":{"start":{"line":2,"column":218,"offset":218},"end":{"line":2,"column":226,"offset":226},"indent":[]}},{"type":"text","value":" or the permission options. we created a setting to prevent the monitor from running in certain channels. What if we wanted to do prevent commands from happening? How would we prevent commands from running?","position":{"start":{"line":2,"column":226,"offset":226},"end":{"line":2,"column":432,"offset":432},"indent":[]}}],"position":{"start":{"line":2,"column":1,"offset":1},"end":{"line":2,"column":432,"offset":432},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"What is an Inhibitor?\nAn Inhibitor is very similar to how monitors work. A monitor runs on every message but an inhibitor runs on every command. Remember all those command options like cooldown, enabled, requiredPermissions, permissionLevel, nsfw, requiredSettings, runIn. Each and every one of these options has an inhibitor in Klasa core that checks commands for these settings.\nLet's create our own inhibitor that would prevent commands from being used if the user is not a VIP user.","position":{"start":{"line":4,"column":1,"offset":434},"end":{"line":6,"column":106,"offset":920},"indent":[1,1]}}],"position":{"start":{"line":4,"column":1,"offset":434},"end":{"line":6,"column":106,"offset":920},"indent":[1,1]}},{"type":"export","value":"export const _frontmatter = {\"title\":\"Creating Inhibitors!\",\"metaTitle\":\"Creating An Inhibitor | Discordeno\",\"metaDescription\":\"Let's create our very own bot with Discordeno!\"}","position":{"start":{"line":9,"column":1,"offset":923},"end":{"line":9,"column":177,"offset":1099},"indent":[]}}],"position":{"start":{"line":1,"column":1,"offset":0},"end":{"line":9,"column":177,"offset":1099}}},"scopeImports":["import * as React from 'react'"],"scopeIdentifiers":["React"],"body":"function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }\n\nfunction _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }\n\nfunction _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }\n\n/* @jsx mdx */\nvar _frontmatter = {\n \"title\": \"Creating Inhibitors!\",\n \"metaTitle\": \"Creating An Inhibitor | Discordeno\",\n \"metaDescription\": \"Let's create our very own bot with Discordeno!\"\n};\nvar layoutProps = {\n _frontmatter: _frontmatter\n};\nvar MDXLayout = \"wrapper\";\nreturn function MDXContent(_ref) {\n var components = _ref.components,\n props = _objectWithoutProperties(_ref, [\"components\"]);\n\n return mdx(MDXLayout, _extends({}, layoutProps, props, {\n components: components,\n mdxType: \"MDXLayout\"\n }), mdx(\"p\", null, \"Woah! You are almost half way done with understanding all of Discordeno. Amazing isn't it? Something you may have noticed in the last section was there were some options that prevented some commands from running like \", mdx(\"inlineCode\", {\n parentName: \"p\"\n }, \"dmOnly\"), \" or the permission options. we created a setting to prevent the monitor from running in certain channels. What if we wanted to do prevent commands from happening? How would we prevent commands from running?\"), mdx(\"p\", null, \"What is an Inhibitor?\\nAn Inhibitor is very similar to how monitors work. A monitor runs on every message but an inhibitor runs on every command. Remember all those command options like cooldown, enabled, requiredPermissions, permissionLevel, nsfw, requiredSettings, runIn. Each and every one of these options has an inhibitor in Klasa core that checks commands for these settings.\\nLet's create our own inhibitor that would prevent commands from being used if the user is not a VIP user.\"));\n}\n;\nMDXContent.isMDXComponent = true;","rawMDXOutput":"/* @jsx mdx */\nimport { mdx } from '@mdx-js/react';\n/* @jsx mdx */\n\nexport const _frontmatter = {\n \"title\": \"Creating Inhibitors!\",\n \"metaTitle\": \"Creating An Inhibitor | Discordeno\",\n \"metaDescription\": \"Let's create our very own bot with Discordeno!\"\n};\n\nconst layoutProps = {\n _frontmatter\n};\nconst MDXLayout = \"wrapper\"\nexport default function MDXContent({\n components,\n ...props\n}) {\n return \n

{`Woah! You are almost half way done with understanding all of Discordeno. Amazing isn't it? Something you may have noticed in the last section was there were some options that prevented some commands from running like `}{`dmOnly`}{` or the permission options. we created a setting to prevent the monitor from running in certain channels. What if we wanted to do prevent commands from happening? How would we prevent commands from running?`}

\n

{`What is an Inhibitor?\nAn Inhibitor is very similar to how monitors work. A monitor runs on every message but an inhibitor runs on every command. Remember all those command options like cooldown, enabled, requiredPermissions, permissionLevel, nsfw, requiredSettings, runIn. Each and every one of these options has an inhibitor in Klasa core that checks commands for these settings.\nLet's create our own inhibitor that would prevent commands from being used if the user is not a VIP user.`}

\n\n
;\n}\n\n;\nMDXContent.isMDXComponent = true;"}} \ No newline at end of file diff --git a/docs/.cache/caches/gatsby-plugin-mdx/diskstore-de28827b10baa5522f7d3b4720bde0a1.json b/docs/.cache/caches/gatsby-plugin-mdx/diskstore-de28827b10baa5522f7d3b4720bde0a1.json new file mode 100644 index 000000000..5c899dae3 --- /dev/null +++ b/docs/.cache/caches/gatsby-plugin-mdx/diskstore-de28827b10baa5522f7d3b4720bde0a1.json @@ -0,0 +1 @@ +{"expireTime":9007200851634925000,"key":"gatsby-plugin-mdx-entire-payload-5892041d6ac8afc166829355fee369d6-","val":{"mdast":{"type":"root","children":[{"type":"paragraph","children":[{"type":"text","value":"Woah! You are almost half way done with understanding all of Discordeno. Amazing isn't it? Something you may have noticed in the last section was there were some options that prevented some commands from running like ","position":{"start":{"line":2,"column":1,"offset":1},"end":{"line":2,"column":218,"offset":218},"indent":[]}},{"type":"inlineCode","value":"dmOnly","position":{"start":{"line":2,"column":218,"offset":218},"end":{"line":2,"column":226,"offset":226},"indent":[]}},{"type":"text","value":" or the permission options. we created a setting to prevent the monitor from running in certain channels. What if we wanted to do prevent commands from happening? How would we prevent commands from running?","position":{"start":{"line":2,"column":226,"offset":226},"end":{"line":2,"column":432,"offset":432},"indent":[]}}],"position":{"start":{"line":2,"column":1,"offset":1},"end":{"line":2,"column":432,"offset":432},"indent":[]}},{"type":"heading","depth":2,"children":[{"type":"text","value":"What is an Inhibitor?","position":{"start":{"line":4,"column":4,"offset":437},"end":{"line":4,"column":25,"offset":458},"indent":[]}}],"position":{"start":{"line":4,"column":1,"offset":434},"end":{"line":4,"column":25,"offset":458},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"An Inhibitor is very similar to how monitors work. A monitor runs on every message but an inhibitor runs on every command. Remember all those command options like cooldown, permissions, permissionLevel, nsfw, etc... Each and every one of these options has an inhibitor in that checks commands for these settings.","position":{"start":{"line":6,"column":1,"offset":460},"end":{"line":6,"column":313,"offset":772},"indent":[]}}],"position":{"start":{"line":6,"column":1,"offset":460},"end":{"line":6,"column":313,"offset":772},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"Let's create our own inhibitor that would prevent commands from being used if the user is not a VIP user.","position":{"start":{"line":8,"column":1,"offset":774},"end":{"line":8,"column":106,"offset":879},"indent":[]}}],"position":{"start":{"line":8,"column":1,"offset":774},"end":{"line":8,"column":106,"offset":879},"indent":[]}},{"type":"blockquote","children":[{"type":"paragraph","children":[{"type":"strong","children":[{"type":"text","value":"Note:","position":{"start":{"line":10,"column":5,"offset":885},"end":{"line":10,"column":10,"offset":890},"indent":[]}}],"position":{"start":{"line":10,"column":3,"offset":883},"end":{"line":10,"column":12,"offset":892},"indent":[]}},{"type":"text","value":" It is important to remember that everything below can be done with a simple permission level as well. We will create our own custom permission levels but for the purposes of this guide and to be able to learn about Inhibitors, we will be using an inhibitor.","position":{"start":{"line":10,"column":12,"offset":892},"end":{"line":10,"column":270,"offset":1150},"indent":[]}}],"position":{"start":{"line":10,"column":3,"offset":883},"end":{"line":10,"column":270,"offset":1150},"indent":[]}}],"position":{"start":{"line":10,"column":1,"offset":881},"end":{"line":10,"column":270,"offset":1150},"indent":[]}},{"type":"heading","depth":2,"children":[{"type":"text","value":"Creating the File","position":{"start":{"line":12,"column":4,"offset":1155},"end":{"line":12,"column":21,"offset":1172},"indent":[]}}],"position":{"start":{"line":12,"column":1,"offset":1152},"end":{"line":12,"column":21,"offset":1172},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"Let's start by creating a file inside the inhibitors folder called ","position":{"start":{"line":14,"column":1,"offset":1174},"end":{"line":14,"column":68,"offset":1241},"indent":[]}},{"type":"inlineCode","value":"boosted.ts","position":{"start":{"line":14,"column":68,"offset":1241},"end":{"line":14,"column":80,"offset":1253},"indent":[]}},{"type":"text","value":" and paste the following snippet of code:","position":{"start":{"line":14,"column":80,"offset":1253},"end":{"line":14,"column":121,"offset":1294},"indent":[]}}],"position":{"start":{"line":14,"column":1,"offset":1174},"end":{"line":14,"column":121,"offset":1294},"indent":[]}},{"type":"code","lang":"ts","meta":null,"value":"import { botCache } from \"../../mod.ts\";\n\nbotCache.inhibitors.set(\"inhibitorname\", async function (message, command, guild) {\n\t// Your code goes here\n});","position":{"start":{"line":16,"column":1,"offset":1296},"end":{"line":22,"column":4,"offset":1459},"indent":[1,1,1,1,1,1]}},{"type":"paragraph","children":[{"type":"text","value":"Inhibitors can take up to 3 arguments.","position":{"start":{"line":24,"column":1,"offset":1461},"end":{"line":24,"column":39,"offset":1499},"indent":[]}}],"position":{"start":{"line":24,"column":1,"offset":1461},"end":{"line":24,"column":39,"offset":1499},"indent":[]}},{"type":"list","ordered":false,"start":null,"spread":false,"children":[{"type":"listItem","spread":false,"checked":null,"children":[{"type":"paragraph","children":[{"type":"inlineCode","value":"message","position":{"start":{"line":26,"column":3,"offset":1503},"end":{"line":26,"column":12,"offset":1512},"indent":[]}},{"type":"text","value":": The message object that triggered the command.","position":{"start":{"line":26,"column":12,"offset":1512},"end":{"line":26,"column":60,"offset":1560},"indent":[]}}],"position":{"start":{"line":26,"column":3,"offset":1503},"end":{"line":26,"column":60,"offset":1560},"indent":[]}}],"position":{"start":{"line":26,"column":1,"offset":1501},"end":{"line":26,"column":60,"offset":1560},"indent":[]}},{"type":"listItem","spread":false,"checked":null,"children":[{"type":"paragraph","children":[{"type":"inlineCode","value":"command","position":{"start":{"line":27,"column":3,"offset":1563},"end":{"line":27,"column":12,"offset":1572},"indent":[]}},{"type":"text","value":": The command object itself that was triggered.","position":{"start":{"line":27,"column":12,"offset":1572},"end":{"line":27,"column":59,"offset":1619},"indent":[]}}],"position":{"start":{"line":27,"column":3,"offset":1563},"end":{"line":27,"column":59,"offset":1619},"indent":[]}}],"position":{"start":{"line":27,"column":1,"offset":1561},"end":{"line":27,"column":59,"offset":1619},"indent":[]}},{"type":"listItem","spread":false,"checked":null,"children":[{"type":"paragraph","children":[{"type":"inlineCode","value":"guild","position":{"start":{"line":28,"column":3,"offset":1622},"end":{"line":28,"column":10,"offset":1629},"indent":[]}},{"type":"text","value":": The server guild object where this command was ran.","position":{"start":{"line":28,"column":10,"offset":1629},"end":{"line":28,"column":63,"offset":1682},"indent":[]}}],"position":{"start":{"line":28,"column":3,"offset":1622},"end":{"line":28,"column":63,"offset":1682},"indent":[]}}],"position":{"start":{"line":28,"column":1,"offset":1620},"end":{"line":28,"column":63,"offset":1682},"indent":[]}}],"position":{"start":{"line":26,"column":1,"offset":1501},"end":{"line":28,"column":63,"offset":1682},"indent":[1,1]}},{"type":"heading","depth":2,"children":[{"type":"text","value":"Understanding How Inhibitors Function","position":{"start":{"line":30,"column":4,"offset":1687},"end":{"line":30,"column":41,"offset":1724},"indent":[]}}],"position":{"start":{"line":30,"column":1,"offset":1684},"end":{"line":30,"column":41,"offset":1724},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"To block a command you have to return a truthy value.","position":{"start":{"line":32,"column":1,"offset":1726},"end":{"line":32,"column":54,"offset":1779},"indent":[]}}],"position":{"start":{"line":32,"column":1,"offset":1726},"end":{"line":32,"column":54,"offset":1779},"indent":[]}},{"type":"list","ordered":false,"start":null,"spread":false,"children":[{"type":"listItem","spread":false,"checked":null,"children":[{"type":"paragraph","children":[{"type":"strong","children":[{"type":"text","value":"return true;","position":{"start":{"line":33,"column":5,"offset":1784},"end":{"line":33,"column":17,"offset":1796},"indent":[]}}],"position":{"start":{"line":33,"column":3,"offset":1782},"end":{"line":33,"column":19,"offset":1798},"indent":[]}},{"type":"text","value":" If you return true the inhibitor will block the execution of the command.\nTo allow a command return a falsey value.","position":{"start":{"line":33,"column":19,"offset":1798},"end":{"line":34,"column":42,"offset":1914},"indent":[1]}}],"position":{"start":{"line":33,"column":3,"offset":1782},"end":{"line":34,"column":42,"offset":1914},"indent":[1]}}],"position":{"start":{"line":33,"column":1,"offset":1780},"end":{"line":34,"column":42,"offset":1914},"indent":[1]}},{"type":"listItem","spread":false,"checked":null,"children":[{"type":"paragraph","children":[{"type":"strong","children":[{"type":"text","value":"return false;","position":{"start":{"line":35,"column":5,"offset":1919},"end":{"line":35,"column":18,"offset":1932},"indent":[]}}],"position":{"start":{"line":35,"column":3,"offset":1917},"end":{"line":35,"column":20,"offset":1934},"indent":[]}},{"type":"text","value":" If you return false the inhibitor will not block the error.","position":{"start":{"line":35,"column":20,"offset":1934},"end":{"line":35,"column":80,"offset":1994},"indent":[]}}],"position":{"start":{"line":35,"column":3,"offset":1917},"end":{"line":35,"column":80,"offset":1994},"indent":[]}}],"position":{"start":{"line":35,"column":1,"offset":1915},"end":{"line":35,"column":80,"offset":1994},"indent":[]}}],"position":{"start":{"line":33,"column":1,"offset":1780},"end":{"line":35,"column":80,"offset":1994},"indent":[1,1]}},{"type":"code","lang":"ts","meta":null,"value":"// If the command is not VIP only we can allow this command to execute\nif (!command.vipOnly) return false;\n\n// The bot's support server\nconst guild = cache.guilds.get(configs.supportServerID);\n// If the command author is not in the server they won't have the vip role\nconst member = guild.members.get(message.author.id) || await getMember(guild.id, message.author.id);\n// Member doesn't exist so cancel the command\nif (!member) {\n\tsendResponse(message, `sorry, but you can not use this command until you become VIP. **Close the IRIS!!!**`)\n\treturn true;\n}\n\n// If the user has the vip role on the support server given by patreon allow the command\nif (member.roles.includes(configs.roleIDs.patreonVIPRoleID)) return false;\n\n// Alert the user they don't have vip and can't use the command\nsendResponse(message, `sorry, but you can not use this command until you become a VIP. I'm sorry, Teal'c. We'll go to Disneyland next year. I promise.`)\n// Cancel the command since the user does not have vip\nreturn true;","position":{"start":{"line":38,"column":1,"offset":1997},"end":{"line":59,"column":4,"offset":3013},"indent":[1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1]}},{"type":"heading","depth":2,"children":[{"type":"text","value":"Updating Command Typings","position":{"start":{"line":61,"column":4,"offset":3018},"end":{"line":61,"column":28,"offset":3042},"indent":[]}}],"position":{"start":{"line":61,"column":1,"offset":3015},"end":{"line":61,"column":28,"offset":3042},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"Since we need a new option on our commands we need to add that. Open the ","position":{"start":{"line":63,"column":1,"offset":3044},"end":{"line":63,"column":74,"offset":3117},"indent":[]}},{"type":"inlineCode","value":"src/types/commands.ts","position":{"start":{"line":63,"column":74,"offset":3117},"end":{"line":63,"column":97,"offset":3140},"indent":[]}},{"type":"text","value":" file and add in the following","position":{"start":{"line":63,"column":97,"offset":3140},"end":{"line":63,"column":127,"offset":3170},"indent":[]}}],"position":{"start":{"line":63,"column":1,"offset":3044},"end":{"line":63,"column":127,"offset":3170},"indent":[]}},{"type":"code","lang":"ts","meta":null,"value":" vipOnly?: boolean;","position":{"start":{"line":65,"column":1,"offset":3172},"end":{"line":67,"column":4,"offset":3202},"indent":[1,1]}},{"type":"heading","depth":2,"children":[{"type":"text","value":"Challenges","position":{"start":{"line":69,"column":4,"offset":3207},"end":{"line":69,"column":14,"offset":3217},"indent":[]}}],"position":{"start":{"line":69,"column":1,"offset":3204},"end":{"line":69,"column":14,"offset":3217},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"Hell yes! We just got through the entire inhibitor section. You have now mastered everything related to inhibitors.","position":{"start":{"line":71,"column":1,"offset":3219},"end":{"line":71,"column":116,"offset":3334},"indent":[]}}],"position":{"start":{"line":71,"column":1,"offset":3219},"end":{"line":71,"column":116,"offset":3334},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"You can now try and get a little more practice with inhibitors by trying to challenge yourself and make your own inhibitors. Don't worry if you can't think of any good use cases for inhibitors.","position":{"start":{"line":73,"column":1,"offset":3336},"end":{"line":73,"column":194,"offset":3529},"indent":[]}}],"position":{"start":{"line":73,"column":1,"offset":3336},"end":{"line":73,"column":194,"offset":3529},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"Majority of Discordeno bots do not use many custom inhibitors because most of the necessary/important ones already come built for you in the inhibitors folder.","position":{"start":{"line":75,"column":1,"offset":3531},"end":{"line":75,"column":160,"offset":3690},"indent":[]}}],"position":{"start":{"line":75,"column":1,"offset":3531},"end":{"line":75,"column":160,"offset":3690},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"Next we will try our hands at creating a monitor.","position":{"start":{"line":77,"column":1,"offset":3692},"end":{"line":77,"column":50,"offset":3741},"indent":[]}}],"position":{"start":{"line":77,"column":1,"offset":3692},"end":{"line":77,"column":50,"offset":3741},"indent":[]}},{"type":"export","value":"export const _frontmatter = {\"title\":\"Creating Inhibitors!\",\"metaTitle\":\"Creating An Inhibitor | Discordeno\",\"metaDescription\":\"Let's create our very own bot with Discordeno!\"}","position":{"start":{"line":80,"column":1,"offset":3744},"end":{"line":80,"column":177,"offset":3920},"indent":[]}}],"position":{"start":{"line":1,"column":1,"offset":0},"end":{"line":80,"column":177,"offset":3920}}},"scopeImports":["import * as React from 'react'"],"scopeIdentifiers":["React"],"body":"function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }\n\nfunction _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }\n\nfunction _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }\n\n/* @jsx mdx */\nvar _frontmatter = {\n \"title\": \"Creating Inhibitors!\",\n \"metaTitle\": \"Creating An Inhibitor | Discordeno\",\n \"metaDescription\": \"Let's create our very own bot with Discordeno!\"\n};\nvar layoutProps = {\n _frontmatter: _frontmatter\n};\nvar MDXLayout = \"wrapper\";\nreturn function MDXContent(_ref) {\n var components = _ref.components,\n props = _objectWithoutProperties(_ref, [\"components\"]);\n\n return mdx(MDXLayout, _extends({}, layoutProps, props, {\n components: components,\n mdxType: \"MDXLayout\"\n }), mdx(\"p\", null, \"Woah! You are almost half way done with understanding all of Discordeno. Amazing isn't it? Something you may have noticed in the last section was there were some options that prevented some commands from running like \", mdx(\"inlineCode\", {\n parentName: \"p\"\n }, \"dmOnly\"), \" or the permission options. we created a setting to prevent the monitor from running in certain channels. What if we wanted to do prevent commands from happening? How would we prevent commands from running?\"), mdx(\"h2\", null, \"What is an Inhibitor?\"), mdx(\"p\", null, \"An Inhibitor is very similar to how monitors work. A monitor runs on every message but an inhibitor runs on every command. Remember all those command options like cooldown, permissions, permissionLevel, nsfw, etc... Each and every one of these options has an inhibitor in that checks commands for these settings.\"), mdx(\"p\", null, \"Let's create our own inhibitor that would prevent commands from being used if the user is not a VIP user.\"), mdx(\"blockquote\", null, mdx(\"p\", {\n parentName: \"blockquote\"\n }, mdx(\"strong\", {\n parentName: \"p\"\n }, \"Note:\"), \" It is important to remember that everything below can be done with a simple permission level as well. We will create our own custom permission levels but for the purposes of this guide and to be able to learn about Inhibitors, we will be using an inhibitor.\")), mdx(\"h2\", null, \"Creating the File\"), mdx(\"p\", null, \"Let's start by creating a file inside the inhibitors folder called \", mdx(\"inlineCode\", {\n parentName: \"p\"\n }, \"boosted.ts\"), \" and paste the following snippet of code:\"), mdx(\"pre\", null, mdx(\"code\", _extends({\n parentName: \"pre\"\n }, {\n \"className\": \"language-ts\"\n }), \"import { botCache } from \\\"../../mod.ts\\\";\\n\\nbotCache.inhibitors.set(\\\"inhibitorname\\\", async function (message, command, guild) {\\n // Your code goes here\\n});\\n\")), mdx(\"p\", null, \"Inhibitors can take up to 3 arguments.\"), mdx(\"ul\", null, mdx(\"li\", {\n parentName: \"ul\"\n }, mdx(\"inlineCode\", {\n parentName: \"li\"\n }, \"message\"), \": The message object that triggered the command.\"), mdx(\"li\", {\n parentName: \"ul\"\n }, mdx(\"inlineCode\", {\n parentName: \"li\"\n }, \"command\"), \": The command object itself that was triggered.\"), mdx(\"li\", {\n parentName: \"ul\"\n }, mdx(\"inlineCode\", {\n parentName: \"li\"\n }, \"guild\"), \": The server guild object where this command was ran.\")), mdx(\"h2\", null, \"Understanding How Inhibitors Function\"), mdx(\"p\", null, \"To block a command you have to return a truthy value.\"), mdx(\"ul\", null, mdx(\"li\", {\n parentName: \"ul\"\n }, mdx(\"strong\", {\n parentName: \"li\"\n }, \"return true;\"), \" If you return true the inhibitor will block the execution of the command.\\nTo allow a command return a falsey value.\"), mdx(\"li\", {\n parentName: \"ul\"\n }, mdx(\"strong\", {\n parentName: \"li\"\n }, \"return false;\"), \" If you return false the inhibitor will not block the error.\")), mdx(\"pre\", null, mdx(\"code\", _extends({\n parentName: \"pre\"\n }, {\n \"className\": \"language-ts\"\n }), \"// If the command is not VIP only we can allow this command to execute\\nif (!command.vipOnly) return false;\\n\\n// The bot's support server\\nconst guild = cache.guilds.get(configs.supportServerID);\\n// If the command author is not in the server they won't have the vip role\\nconst member = guild.members.get(message.author.id) || await getMember(guild.id, message.author.id);\\n// Member doesn't exist so cancel the command\\nif (!member) {\\n sendResponse(message, `sorry, but you can not use this command until you become VIP. **Close the IRIS!!!**`)\\n return true;\\n}\\n\\n// If the user has the vip role on the support server given by patreon allow the command\\nif (member.roles.includes(configs.roleIDs.patreonVIPRoleID)) return false;\\n\\n// Alert the user they don't have vip and can't use the command\\nsendResponse(message, `sorry, but you can not use this command until you become a VIP. I'm sorry, Teal'c. We'll go to Disneyland next year. I promise.`)\\n// Cancel the command since the user does not have vip\\nreturn true;\\n\")), mdx(\"h2\", null, \"Updating Command Typings\"), mdx(\"p\", null, \"Since we need a new option on our commands we need to add that. Open the \", mdx(\"inlineCode\", {\n parentName: \"p\"\n }, \"src/types/commands.ts\"), \" file and add in the following\"), mdx(\"pre\", null, mdx(\"code\", _extends({\n parentName: \"pre\"\n }, {\n \"className\": \"language-ts\"\n }), \" vipOnly?: boolean;\\n\")), mdx(\"h2\", null, \"Challenges\"), mdx(\"p\", null, \"Hell yes! We just got through the entire inhibitor section. You have now mastered everything related to inhibitors.\"), mdx(\"p\", null, \"You can now try and get a little more practice with inhibitors by trying to challenge yourself and make your own inhibitors. Don't worry if you can't think of any good use cases for inhibitors.\"), mdx(\"p\", null, \"Majority of Discordeno bots do not use many custom inhibitors because most of the necessary/important ones already come built for you in the inhibitors folder.\"), mdx(\"p\", null, \"Next we will try our hands at creating a monitor.\"));\n}\n;\nMDXContent.isMDXComponent = true;","rawMDXOutput":"/* @jsx mdx */\nimport { mdx } from '@mdx-js/react';\n/* @jsx mdx */\n\nexport const _frontmatter = {\n \"title\": \"Creating Inhibitors!\",\n \"metaTitle\": \"Creating An Inhibitor | Discordeno\",\n \"metaDescription\": \"Let's create our very own bot with Discordeno!\"\n};\n\nconst layoutProps = {\n _frontmatter\n};\nconst MDXLayout = \"wrapper\"\nexport default function MDXContent({\n components,\n ...props\n}) {\n return \n

{`Woah! You are almost half way done with understanding all of Discordeno. Amazing isn't it? Something you may have noticed in the last section was there were some options that prevented some commands from running like `}{`dmOnly`}{` or the permission options. we created a setting to prevent the monitor from running in certain channels. What if we wanted to do prevent commands from happening? How would we prevent commands from running?`}

\n

{`What is an Inhibitor?`}

\n

{`An Inhibitor is very similar to how monitors work. A monitor runs on every message but an inhibitor runs on every command. Remember all those command options like cooldown, permissions, permissionLevel, nsfw, etc... Each and every one of these options has an inhibitor in that checks commands for these settings.`}

\n

{`Let's create our own inhibitor that would prevent commands from being used if the user is not a VIP user.`}

\n
\n

{`Note:`}{` It is important to remember that everything below can be done with a simple permission level as well. We will create our own custom permission levels but for the purposes of this guide and to be able to learn about Inhibitors, we will be using an inhibitor.`}

\n
\n

{`Creating the File`}

\n

{`Let's start by creating a file inside the inhibitors folder called `}{`boosted.ts`}{` and paste the following snippet of code:`}

\n
{`import { botCache } from \"../../mod.ts\";\n\nbotCache.inhibitors.set(\"inhibitorname\", async function (message, command, guild) {\n    // Your code goes here\n});\n`}
\n

{`Inhibitors can take up to 3 arguments.`}

\n
    \n
  • {`message`}{`: The message object that triggered the command.`}
  • \n
  • {`command`}{`: The command object itself that was triggered.`}
  • \n
  • {`guild`}{`: The server guild object where this command was ran.`}
  • \n
\n

{`Understanding How Inhibitors Function`}

\n

{`To block a command you have to return a truthy value.`}

\n
    \n
  • {`return true;`}{` If you return true the inhibitor will block the execution of the command.\nTo allow a command return a falsey value.`}
  • \n
  • {`return false;`}{` If you return false the inhibitor will not block the error.`}
  • \n
\n
{`// If the command is not VIP only we can allow this command to execute\nif (!command.vipOnly) return false;\n\n// The bot's support server\nconst guild = cache.guilds.get(configs.supportServerID);\n// If the command author is not in the server they won't have the vip role\nconst member = guild.members.get(message.author.id) || await getMember(guild.id, message.author.id);\n// Member doesn't exist so cancel the command\nif (!member) {\n    sendResponse(message, \\`sorry, but you can not use this command until you become VIP. **Close the IRIS!!!**\\`)\n    return true;\n}\n\n// If the user has the vip role on the support server given by patreon allow the command\nif (member.roles.includes(configs.roleIDs.patreonVIPRoleID)) return false;\n\n// Alert the user they don't have vip and can't use the command\nsendResponse(message, \\`sorry, but you can not use this command until you become a VIP. I'm sorry, Teal'c. We'll go to Disneyland next year. I promise.\\`)\n// Cancel the command since the user does not have vip\nreturn true;\n`}
\n

{`Updating Command Typings`}

\n

{`Since we need a new option on our commands we need to add that. Open the `}{`src/types/commands.ts`}{` file and add in the following`}

\n
{`  vipOnly?: boolean;\n`}
\n

{`Challenges`}

\n

{`Hell yes! We just got through the entire inhibitor section. You have now mastered everything related to inhibitors.`}

\n

{`You can now try and get a little more practice with inhibitors by trying to challenge yourself and make your own inhibitors. Don't worry if you can't think of any good use cases for inhibitors.`}

\n

{`Majority of Discordeno bots do not use many custom inhibitors because most of the necessary/important ones already come built for you in the inhibitors folder.`}

\n

{`Next we will try our hands at creating a monitor.`}

\n\n
;\n}\n\n;\nMDXContent.isMDXComponent = true;"}} \ No newline at end of file diff --git a/docs/.cache/caches/gatsby-plugin-mdx/diskstore-deed356d84abb4c8a335e584506101f0.json b/docs/.cache/caches/gatsby-plugin-mdx/diskstore-deed356d84abb4c8a335e584506101f0.json new file mode 100644 index 000000000..5cfe59699 --- /dev/null +++ b/docs/.cache/caches/gatsby-plugin-mdx/diskstore-deed356d84abb4c8a335e584506101f0.json @@ -0,0 +1 @@ +{"expireTime":9007200851632827000,"key":"gatsby-plugin-mdx-entire-payload-c4c46712f7c89b7af1e339a94fbdf7a9-","val":{"mdast":{"type":"root","children":[{"type":"paragraph","children":[{"type":"text","value":"Woah! You are almost half way done with understanding all of Discordeno. Amazing isn't it? Something you may have noticed in the last section was there were some options that prevented some commands from running like ","position":{"start":{"line":2,"column":1,"offset":1},"end":{"line":2,"column":218,"offset":218},"indent":[]}},{"type":"inlineCode","value":"dmOnly","position":{"start":{"line":2,"column":218,"offset":218},"end":{"line":2,"column":226,"offset":226},"indent":[]}},{"type":"text","value":" or the permission options. we created a setting to prevent the monitor from running in certain channels. What if we wanted to do prevent commands from happening? How would we prevent commands from running?","position":{"start":{"line":2,"column":226,"offset":226},"end":{"line":2,"column":432,"offset":432},"indent":[]}}],"position":{"start":{"line":2,"column":1,"offset":1},"end":{"line":2,"column":432,"offset":432},"indent":[]}},{"type":"heading","depth":2,"children":[{"type":"text","value":"What is an Inhibitor?","position":{"start":{"line":4,"column":4,"offset":437},"end":{"line":4,"column":25,"offset":458},"indent":[]}}],"position":{"start":{"line":4,"column":1,"offset":434},"end":{"line":4,"column":25,"offset":458},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"An Inhibitor is very similar to how monitors work. A monitor runs on every message but an inhibitor runs on every command. Remember all those command options like cooldown, permissions, permissionLevel, nsfw, etc... Each and every one of these options has an inhibitor in that checks commands for these settings.","position":{"start":{"line":6,"column":1,"offset":460},"end":{"line":6,"column":313,"offset":772},"indent":[]}}],"position":{"start":{"line":6,"column":1,"offset":460},"end":{"line":6,"column":313,"offset":772},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"Let's create our own inhibitor that would prevent commands from being used if the user is not a VIP user.","position":{"start":{"line":8,"column":1,"offset":774},"end":{"line":8,"column":106,"offset":879},"indent":[]}}],"position":{"start":{"line":8,"column":1,"offset":774},"end":{"line":8,"column":106,"offset":879},"indent":[]}},{"type":"blockquote","children":[{"type":"paragraph","children":[{"type":"strong","children":[{"type":"text","value":"Note:","position":{"start":{"line":10,"column":5,"offset":885},"end":{"line":10,"column":10,"offset":890},"indent":[]}}],"position":{"start":{"line":10,"column":3,"offset":883},"end":{"line":10,"column":12,"offset":892},"indent":[]}},{"type":"text","value":" It is important to remember that everything below can be done with a simple permission level as well. We will create our own custom permission levels but for the purposes of this guide and to be able to learn about Inhibitors, we will be using an inhibitor.","position":{"start":{"line":10,"column":12,"offset":892},"end":{"line":10,"column":270,"offset":1150},"indent":[]}}],"position":{"start":{"line":10,"column":3,"offset":883},"end":{"line":10,"column":270,"offset":1150},"indent":[]}}],"position":{"start":{"line":10,"column":1,"offset":881},"end":{"line":10,"column":270,"offset":1150},"indent":[]}},{"type":"heading","depth":2,"children":[{"type":"text","value":"Creating the File","position":{"start":{"line":12,"column":4,"offset":1155},"end":{"line":12,"column":21,"offset":1172},"indent":[]}}],"position":{"start":{"line":12,"column":1,"offset":1152},"end":{"line":12,"column":21,"offset":1172},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"Let's start by creating a file inside the inhibitors folder called ","position":{"start":{"line":14,"column":1,"offset":1174},"end":{"line":14,"column":68,"offset":1241},"indent":[]}},{"type":"inlineCode","value":"vipOnly.ts","position":{"start":{"line":14,"column":68,"offset":1241},"end":{"line":14,"column":80,"offset":1253},"indent":[]}},{"type":"text","value":" and paste the following snippet of code:","position":{"start":{"line":14,"column":80,"offset":1253},"end":{"line":14,"column":121,"offset":1294},"indent":[]}}],"position":{"start":{"line":14,"column":1,"offset":1174},"end":{"line":14,"column":121,"offset":1294},"indent":[]}},{"type":"code","lang":"ts","meta":null,"value":"import { botCache } from \"../../mod.ts\";\n\nbotCache.inhibitors.set(\"inhibitorname\", async function (message, command, guild) {\n\t// Your code goes here\n});","position":{"start":{"line":16,"column":1,"offset":1296},"end":{"line":22,"column":4,"offset":1459},"indent":[1,1,1,1,1,1]}},{"type":"paragraph","children":[{"type":"text","value":"Inhibitors can take up to 3 arguments.","position":{"start":{"line":24,"column":1,"offset":1461},"end":{"line":24,"column":39,"offset":1499},"indent":[]}}],"position":{"start":{"line":24,"column":1,"offset":1461},"end":{"line":24,"column":39,"offset":1499},"indent":[]}},{"type":"list","ordered":false,"start":null,"spread":false,"children":[{"type":"listItem","spread":false,"checked":null,"children":[{"type":"paragraph","children":[{"type":"inlineCode","value":"message","position":{"start":{"line":26,"column":3,"offset":1503},"end":{"line":26,"column":12,"offset":1512},"indent":[]}},{"type":"text","value":": The message object that triggered the command.","position":{"start":{"line":26,"column":12,"offset":1512},"end":{"line":26,"column":60,"offset":1560},"indent":[]}}],"position":{"start":{"line":26,"column":3,"offset":1503},"end":{"line":26,"column":60,"offset":1560},"indent":[]}}],"position":{"start":{"line":26,"column":1,"offset":1501},"end":{"line":26,"column":60,"offset":1560},"indent":[]}},{"type":"listItem","spread":false,"checked":null,"children":[{"type":"paragraph","children":[{"type":"inlineCode","value":"command","position":{"start":{"line":27,"column":3,"offset":1563},"end":{"line":27,"column":12,"offset":1572},"indent":[]}},{"type":"text","value":": The command object itself that was triggered.","position":{"start":{"line":27,"column":12,"offset":1572},"end":{"line":27,"column":59,"offset":1619},"indent":[]}}],"position":{"start":{"line":27,"column":3,"offset":1563},"end":{"line":27,"column":59,"offset":1619},"indent":[]}}],"position":{"start":{"line":27,"column":1,"offset":1561},"end":{"line":27,"column":59,"offset":1619},"indent":[]}},{"type":"listItem","spread":false,"checked":null,"children":[{"type":"paragraph","children":[{"type":"inlineCode","value":"guild","position":{"start":{"line":28,"column":3,"offset":1622},"end":{"line":28,"column":10,"offset":1629},"indent":[]}},{"type":"text","value":": The server guild object where this command was ran.","position":{"start":{"line":28,"column":10,"offset":1629},"end":{"line":28,"column":63,"offset":1682},"indent":[]}}],"position":{"start":{"line":28,"column":3,"offset":1622},"end":{"line":28,"column":63,"offset":1682},"indent":[]}}],"position":{"start":{"line":28,"column":1,"offset":1620},"end":{"line":28,"column":63,"offset":1682},"indent":[]}}],"position":{"start":{"line":26,"column":1,"offset":1501},"end":{"line":28,"column":63,"offset":1682},"indent":[1,1]}},{"type":"heading","depth":2,"children":[{"type":"text","value":"Understanding How Inhibitors Function","position":{"start":{"line":30,"column":4,"offset":1687},"end":{"line":30,"column":41,"offset":1724},"indent":[]}}],"position":{"start":{"line":30,"column":1,"offset":1684},"end":{"line":30,"column":41,"offset":1724},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"To block a command you have to return a truthy value.","position":{"start":{"line":32,"column":1,"offset":1726},"end":{"line":32,"column":54,"offset":1779},"indent":[]}}],"position":{"start":{"line":32,"column":1,"offset":1726},"end":{"line":32,"column":54,"offset":1779},"indent":[]}},{"type":"code","lang":null,"meta":null,"value":"- **return true;** If you return true the inhibitor will block the execution of the command.","position":{"start":{"line":33,"column":1,"offset":1780},"end":{"line":33,"column":94,"offset":1873},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"To allow a command return a falsey value.","position":{"start":{"line":34,"column":1,"offset":1874},"end":{"line":34,"column":42,"offset":1915},"indent":[]}}],"position":{"start":{"line":34,"column":1,"offset":1874},"end":{"line":34,"column":42,"offset":1915},"indent":[]}},{"type":"code","lang":null,"meta":null,"value":"- **return false;** If you return false the inhibitor will not block the error.","position":{"start":{"line":35,"column":1,"offset":1916},"end":{"line":35,"column":81,"offset":1996},"indent":[]}},{"type":"code","lang":"ts","meta":null,"value":"// If the command is not VIP only we can allow this command\nif (!command.vipOnly) return false;\n\n// Check if the user is VIP\nconst userIsVIP = message.author.settings.get(`isVIP`)\n// The user is VIP so we can allow this command to be used\nif (userIsVIP) return false\n// The user is NOT VIP so we throw an error\nthrow `The ${command.name} is only allowed for VIP users.`","position":{"start":{"line":38,"column":1,"offset":1999},"end":{"line":48,"column":4,"offset":2378},"indent":[1,1,1,1,1,1,1,1,1,1]}},{"type":"export","value":"export const _frontmatter = {\"title\":\"Creating Inhibitors!\",\"metaTitle\":\"Creating An Inhibitor | Discordeno\",\"metaDescription\":\"Let's create our very own bot with Discordeno!\"}","position":{"start":{"line":51,"column":1,"offset":2381},"end":{"line":51,"column":177,"offset":2557},"indent":[]}}],"position":{"start":{"line":1,"column":1,"offset":0},"end":{"line":51,"column":177,"offset":2557}}},"scopeImports":["import * as React from 'react'"],"scopeIdentifiers":["React"],"body":"function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }\n\nfunction _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }\n\nfunction _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }\n\n/* @jsx mdx */\nvar _frontmatter = {\n \"title\": \"Creating Inhibitors!\",\n \"metaTitle\": \"Creating An Inhibitor | Discordeno\",\n \"metaDescription\": \"Let's create our very own bot with Discordeno!\"\n};\nvar layoutProps = {\n _frontmatter: _frontmatter\n};\nvar MDXLayout = \"wrapper\";\nreturn function MDXContent(_ref) {\n var components = _ref.components,\n props = _objectWithoutProperties(_ref, [\"components\"]);\n\n return mdx(MDXLayout, _extends({}, layoutProps, props, {\n components: components,\n mdxType: \"MDXLayout\"\n }), mdx(\"p\", null, \"Woah! You are almost half way done with understanding all of Discordeno. Amazing isn't it? Something you may have noticed in the last section was there were some options that prevented some commands from running like \", mdx(\"inlineCode\", {\n parentName: \"p\"\n }, \"dmOnly\"), \" or the permission options. we created a setting to prevent the monitor from running in certain channels. What if we wanted to do prevent commands from happening? How would we prevent commands from running?\"), mdx(\"h2\", null, \"What is an Inhibitor?\"), mdx(\"p\", null, \"An Inhibitor is very similar to how monitors work. A monitor runs on every message but an inhibitor runs on every command. Remember all those command options like cooldown, permissions, permissionLevel, nsfw, etc... Each and every one of these options has an inhibitor in that checks commands for these settings.\"), mdx(\"p\", null, \"Let's create our own inhibitor that would prevent commands from being used if the user is not a VIP user.\"), mdx(\"blockquote\", null, mdx(\"p\", {\n parentName: \"blockquote\"\n }, mdx(\"strong\", {\n parentName: \"p\"\n }, \"Note:\"), \" It is important to remember that everything below can be done with a simple permission level as well. We will create our own custom permission levels but for the purposes of this guide and to be able to learn about Inhibitors, we will be using an inhibitor.\")), mdx(\"h2\", null, \"Creating the File\"), mdx(\"p\", null, \"Let's start by creating a file inside the inhibitors folder called \", mdx(\"inlineCode\", {\n parentName: \"p\"\n }, \"vipOnly.ts\"), \" and paste the following snippet of code:\"), mdx(\"pre\", null, mdx(\"code\", _extends({\n parentName: \"pre\"\n }, {\n \"className\": \"language-ts\"\n }), \"import { botCache } from \\\"../../mod.ts\\\";\\n\\nbotCache.inhibitors.set(\\\"inhibitorname\\\", async function (message, command, guild) {\\n // Your code goes here\\n});\\n\")), mdx(\"p\", null, \"Inhibitors can take up to 3 arguments.\"), mdx(\"ul\", null, mdx(\"li\", {\n parentName: \"ul\"\n }, mdx(\"inlineCode\", {\n parentName: \"li\"\n }, \"message\"), \": The message object that triggered the command.\"), mdx(\"li\", {\n parentName: \"ul\"\n }, mdx(\"inlineCode\", {\n parentName: \"li\"\n }, \"command\"), \": The command object itself that was triggered.\"), mdx(\"li\", {\n parentName: \"ul\"\n }, mdx(\"inlineCode\", {\n parentName: \"li\"\n }, \"guild\"), \": The server guild object where this command was ran.\")), mdx(\"h2\", null, \"Understanding How Inhibitors Function\"), mdx(\"p\", null, \"To block a command you have to return a truthy value.\"), mdx(\"pre\", null, mdx(\"code\", _extends({\n parentName: \"pre\"\n }, {}), \"- **return true;** If you return true the inhibitor will block the execution of the command.\\n\")), mdx(\"p\", null, \"To allow a command return a falsey value.\"), mdx(\"pre\", null, mdx(\"code\", _extends({\n parentName: \"pre\"\n }, {}), \"- **return false;** If you return false the inhibitor will not block the error.\\n\")), mdx(\"pre\", null, mdx(\"code\", _extends({\n parentName: \"pre\"\n }, {\n \"className\": \"language-ts\"\n }), \"// If the command is not VIP only we can allow this command\\nif (!command.vipOnly) return false;\\n\\n// Check if the user is VIP\\nconst userIsVIP = message.author.settings.get(`isVIP`)\\n// The user is VIP so we can allow this command to be used\\nif (userIsVIP) return false\\n// The user is NOT VIP so we throw an error\\nthrow `The ${command.name} is only allowed for VIP users.`\\n\")));\n}\n;\nMDXContent.isMDXComponent = true;","rawMDXOutput":"/* @jsx mdx */\nimport { mdx } from '@mdx-js/react';\n/* @jsx mdx */\n\nexport const _frontmatter = {\n \"title\": \"Creating Inhibitors!\",\n \"metaTitle\": \"Creating An Inhibitor | Discordeno\",\n \"metaDescription\": \"Let's create our very own bot with Discordeno!\"\n};\n\nconst layoutProps = {\n _frontmatter\n};\nconst MDXLayout = \"wrapper\"\nexport default function MDXContent({\n components,\n ...props\n}) {\n return \n

{`Woah! You are almost half way done with understanding all of Discordeno. Amazing isn't it? Something you may have noticed in the last section was there were some options that prevented some commands from running like `}{`dmOnly`}{` or the permission options. we created a setting to prevent the monitor from running in certain channels. What if we wanted to do prevent commands from happening? How would we prevent commands from running?`}

\n

{`What is an Inhibitor?`}

\n

{`An Inhibitor is very similar to how monitors work. A monitor runs on every message but an inhibitor runs on every command. Remember all those command options like cooldown, permissions, permissionLevel, nsfw, etc... Each and every one of these options has an inhibitor in that checks commands for these settings.`}

\n

{`Let's create our own inhibitor that would prevent commands from being used if the user is not a VIP user.`}

\n
\n

{`Note:`}{` It is important to remember that everything below can be done with a simple permission level as well. We will create our own custom permission levels but for the purposes of this guide and to be able to learn about Inhibitors, we will be using an inhibitor.`}

\n
\n

{`Creating the File`}

\n

{`Let's start by creating a file inside the inhibitors folder called `}{`vipOnly.ts`}{` and paste the following snippet of code:`}

\n
{`import { botCache } from \"../../mod.ts\";\n\nbotCache.inhibitors.set(\"inhibitorname\", async function (message, command, guild) {\n    // Your code goes here\n});\n`}
\n

{`Inhibitors can take up to 3 arguments.`}

\n
    \n
  • {`message`}{`: The message object that triggered the command.`}
  • \n
  • {`command`}{`: The command object itself that was triggered.`}
  • \n
  • {`guild`}{`: The server guild object where this command was ran.`}
  • \n
\n

{`Understanding How Inhibitors Function`}

\n

{`To block a command you have to return a truthy value.`}

\n
{`- **return true;** If you return true the inhibitor will block the execution of the command.\n`}
\n

{`To allow a command return a falsey value.`}

\n
{`- **return false;** If you return false the inhibitor will not block the error.\n`}
\n
{`// If the command is not VIP only we can allow this command\nif (!command.vipOnly) return false;\n\n// Check if the user is VIP\nconst userIsVIP = message.author.settings.get(\\`isVIP\\`)\n// The user is VIP so we can allow this command to be used\nif (userIsVIP) return false\n// The user is NOT VIP so we throw an error\nthrow \\`The \\${command.name} is only allowed for VIP users.\\`\n`}
\n\n
;\n}\n\n;\nMDXContent.isMDXComponent = true;"}} \ No newline at end of file diff --git a/docs/.cache/caches/gatsby-plugin-mdx/diskstore-dfd0afb8c5df2e9c84e86ae949dcc032.json b/docs/.cache/caches/gatsby-plugin-mdx/diskstore-dfd0afb8c5df2e9c84e86ae949dcc032.json new file mode 100644 index 000000000..784c6681f --- /dev/null +++ b/docs/.cache/caches/gatsby-plugin-mdx/diskstore-dfd0afb8c5df2e9c84e86ae949dcc032.json @@ -0,0 +1 @@ +{"expireTime":9007200851634097000,"key":"gatsby-plugin-mdx-entire-payload-baabed7e41f859a08e966cb9bcdcce35-","val":{"mdast":{"type":"root","children":[{"type":"paragraph","children":[{"type":"text","value":"Woah! You are almost half way done with understanding all of Discordeno. Amazing isn't it? Something you may have noticed in the last section was there were some options that prevented some commands from running like ","position":{"start":{"line":2,"column":1,"offset":1},"end":{"line":2,"column":218,"offset":218},"indent":[]}},{"type":"inlineCode","value":"dmOnly","position":{"start":{"line":2,"column":218,"offset":218},"end":{"line":2,"column":226,"offset":226},"indent":[]}},{"type":"text","value":" or the permission options. we created a setting to prevent the monitor from running in certain channels. What if we wanted to do prevent commands from happening? How would we prevent commands from running?","position":{"start":{"line":2,"column":226,"offset":226},"end":{"line":2,"column":432,"offset":432},"indent":[]}}],"position":{"start":{"line":2,"column":1,"offset":1},"end":{"line":2,"column":432,"offset":432},"indent":[]}},{"type":"heading","depth":2,"children":[{"type":"text","value":"What is an Inhibitor?","position":{"start":{"line":4,"column":4,"offset":437},"end":{"line":4,"column":25,"offset":458},"indent":[]}}],"position":{"start":{"line":4,"column":1,"offset":434},"end":{"line":4,"column":25,"offset":458},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"An Inhibitor is very similar to how monitors work. A monitor runs on every message but an inhibitor runs on every command. Remember all those command options like cooldown, permissions, permissionLevel, nsfw, etc... Each and every one of these options has an inhibitor in that checks commands for these settings.","position":{"start":{"line":6,"column":1,"offset":460},"end":{"line":6,"column":313,"offset":772},"indent":[]}}],"position":{"start":{"line":6,"column":1,"offset":460},"end":{"line":6,"column":313,"offset":772},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"Let's create our own inhibitor that would prevent commands from being used if the user is not a VIP user.","position":{"start":{"line":8,"column":1,"offset":774},"end":{"line":8,"column":106,"offset":879},"indent":[]}}],"position":{"start":{"line":8,"column":1,"offset":774},"end":{"line":8,"column":106,"offset":879},"indent":[]}},{"type":"blockquote","children":[{"type":"paragraph","children":[{"type":"strong","children":[{"type":"text","value":"Note:","position":{"start":{"line":10,"column":5,"offset":885},"end":{"line":10,"column":10,"offset":890},"indent":[]}}],"position":{"start":{"line":10,"column":3,"offset":883},"end":{"line":10,"column":12,"offset":892},"indent":[]}},{"type":"text","value":" It is important to remember that everything below can be done with a simple permission level as well. We will create our own custom permission levels but for the purposes of this guide and to be able to learn about Inhibitors, we will be using an inhibitor.","position":{"start":{"line":10,"column":12,"offset":892},"end":{"line":10,"column":270,"offset":1150},"indent":[]}}],"position":{"start":{"line":10,"column":3,"offset":883},"end":{"line":10,"column":270,"offset":1150},"indent":[]}}],"position":{"start":{"line":10,"column":1,"offset":881},"end":{"line":10,"column":270,"offset":1150},"indent":[]}},{"type":"heading","depth":2,"children":[{"type":"text","value":"Creating the File","position":{"start":{"line":12,"column":4,"offset":1155},"end":{"line":12,"column":21,"offset":1172},"indent":[]}}],"position":{"start":{"line":12,"column":1,"offset":1152},"end":{"line":12,"column":21,"offset":1172},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"Let's start by creating a file inside the inhibitors folder called ","position":{"start":{"line":14,"column":1,"offset":1174},"end":{"line":14,"column":68,"offset":1241},"indent":[]}},{"type":"inlineCode","value":"boosted.ts","position":{"start":{"line":14,"column":68,"offset":1241},"end":{"line":14,"column":80,"offset":1253},"indent":[]}},{"type":"text","value":" and paste the following snippet of code:","position":{"start":{"line":14,"column":80,"offset":1253},"end":{"line":14,"column":121,"offset":1294},"indent":[]}}],"position":{"start":{"line":14,"column":1,"offset":1174},"end":{"line":14,"column":121,"offset":1294},"indent":[]}},{"type":"code","lang":"ts","meta":null,"value":"import { botCache } from \"../../mod.ts\";\n\nbotCache.inhibitors.set(\"inhibitorname\", async function (message, command, guild) {\n\t// Your code goes here\n});","position":{"start":{"line":16,"column":1,"offset":1296},"end":{"line":22,"column":4,"offset":1459},"indent":[1,1,1,1,1,1]}},{"type":"paragraph","children":[{"type":"text","value":"Inhibitors can take up to 3 arguments.","position":{"start":{"line":24,"column":1,"offset":1461},"end":{"line":24,"column":39,"offset":1499},"indent":[]}}],"position":{"start":{"line":24,"column":1,"offset":1461},"end":{"line":24,"column":39,"offset":1499},"indent":[]}},{"type":"list","ordered":false,"start":null,"spread":false,"children":[{"type":"listItem","spread":false,"checked":null,"children":[{"type":"paragraph","children":[{"type":"inlineCode","value":"message","position":{"start":{"line":26,"column":3,"offset":1503},"end":{"line":26,"column":12,"offset":1512},"indent":[]}},{"type":"text","value":": The message object that triggered the command.","position":{"start":{"line":26,"column":12,"offset":1512},"end":{"line":26,"column":60,"offset":1560},"indent":[]}}],"position":{"start":{"line":26,"column":3,"offset":1503},"end":{"line":26,"column":60,"offset":1560},"indent":[]}}],"position":{"start":{"line":26,"column":1,"offset":1501},"end":{"line":26,"column":60,"offset":1560},"indent":[]}},{"type":"listItem","spread":false,"checked":null,"children":[{"type":"paragraph","children":[{"type":"inlineCode","value":"command","position":{"start":{"line":27,"column":3,"offset":1563},"end":{"line":27,"column":12,"offset":1572},"indent":[]}},{"type":"text","value":": The command object itself that was triggered.","position":{"start":{"line":27,"column":12,"offset":1572},"end":{"line":27,"column":59,"offset":1619},"indent":[]}}],"position":{"start":{"line":27,"column":3,"offset":1563},"end":{"line":27,"column":59,"offset":1619},"indent":[]}}],"position":{"start":{"line":27,"column":1,"offset":1561},"end":{"line":27,"column":59,"offset":1619},"indent":[]}},{"type":"listItem","spread":false,"checked":null,"children":[{"type":"paragraph","children":[{"type":"inlineCode","value":"guild","position":{"start":{"line":28,"column":3,"offset":1622},"end":{"line":28,"column":10,"offset":1629},"indent":[]}},{"type":"text","value":": The server guild object where this command was ran.","position":{"start":{"line":28,"column":10,"offset":1629},"end":{"line":28,"column":63,"offset":1682},"indent":[]}}],"position":{"start":{"line":28,"column":3,"offset":1622},"end":{"line":28,"column":63,"offset":1682},"indent":[]}}],"position":{"start":{"line":28,"column":1,"offset":1620},"end":{"line":28,"column":63,"offset":1682},"indent":[]}}],"position":{"start":{"line":26,"column":1,"offset":1501},"end":{"line":28,"column":63,"offset":1682},"indent":[1,1]}},{"type":"heading","depth":2,"children":[{"type":"text","value":"Understanding How Inhibitors Function","position":{"start":{"line":30,"column":4,"offset":1687},"end":{"line":30,"column":41,"offset":1724},"indent":[]}}],"position":{"start":{"line":30,"column":1,"offset":1684},"end":{"line":30,"column":41,"offset":1724},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"To block a command you have to return a truthy value.","position":{"start":{"line":32,"column":1,"offset":1726},"end":{"line":32,"column":54,"offset":1779},"indent":[]}}],"position":{"start":{"line":32,"column":1,"offset":1726},"end":{"line":32,"column":54,"offset":1779},"indent":[]}},{"type":"list","ordered":false,"start":null,"spread":false,"children":[{"type":"listItem","spread":false,"checked":null,"children":[{"type":"paragraph","children":[{"type":"strong","children":[{"type":"text","value":"return true;","position":{"start":{"line":33,"column":5,"offset":1784},"end":{"line":33,"column":17,"offset":1796},"indent":[]}}],"position":{"start":{"line":33,"column":3,"offset":1782},"end":{"line":33,"column":19,"offset":1798},"indent":[]}},{"type":"text","value":" If you return true the inhibitor will block the execution of the command.\nTo allow a command return a falsey value.","position":{"start":{"line":33,"column":19,"offset":1798},"end":{"line":34,"column":42,"offset":1914},"indent":[1]}}],"position":{"start":{"line":33,"column":3,"offset":1782},"end":{"line":34,"column":42,"offset":1914},"indent":[1]}}],"position":{"start":{"line":33,"column":1,"offset":1780},"end":{"line":34,"column":42,"offset":1914},"indent":[1]}},{"type":"listItem","spread":false,"checked":null,"children":[{"type":"paragraph","children":[{"type":"strong","children":[{"type":"text","value":"return false;","position":{"start":{"line":35,"column":5,"offset":1919},"end":{"line":35,"column":18,"offset":1932},"indent":[]}}],"position":{"start":{"line":35,"column":3,"offset":1917},"end":{"line":35,"column":20,"offset":1934},"indent":[]}},{"type":"text","value":" If you return false the inhibitor will not block the error.","position":{"start":{"line":35,"column":20,"offset":1934},"end":{"line":35,"column":80,"offset":1994},"indent":[]}}],"position":{"start":{"line":35,"column":3,"offset":1917},"end":{"line":35,"column":80,"offset":1994},"indent":[]}}],"position":{"start":{"line":35,"column":1,"offset":1915},"end":{"line":35,"column":80,"offset":1994},"indent":[]}}],"position":{"start":{"line":33,"column":1,"offset":1780},"end":{"line":35,"column":80,"offset":1994},"indent":[1,1]}},{"type":"code","lang":"ts","meta":null,"value":"// If the command is not VIP only we can allow this command to execute\nif (!command.vipOnly) return false;\n\n// Check if the user has the vip role on the support server given by patreon\nconst guild =\nconst userIsVIP = await isUserVIP(message.author.id)\n// The user is VIP so we can allow this command to be used\nif (userIsVIP) return false;\n\n// The user is NOT VIP so we throw an error\nthrow `The ${command.name} is only allowed for VIP users.`","position":{"start":{"line":38,"column":1,"offset":1997},"end":{"line":50,"column":4,"offset":2450},"indent":[1,1,1,1,1,1,1,1,1,1,1,1]}},{"type":"export","value":"export const _frontmatter = {\"title\":\"Creating Inhibitors!\",\"metaTitle\":\"Creating An Inhibitor | Discordeno\",\"metaDescription\":\"Let's create our very own bot with Discordeno!\"}","position":{"start":{"line":53,"column":1,"offset":2453},"end":{"line":53,"column":177,"offset":2629},"indent":[]}}],"position":{"start":{"line":1,"column":1,"offset":0},"end":{"line":53,"column":177,"offset":2629}}},"scopeImports":["import * as React from 'react'"],"scopeIdentifiers":["React"],"body":"function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }\n\nfunction _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }\n\nfunction _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }\n\n/* @jsx mdx */\nvar _frontmatter = {\n \"title\": \"Creating Inhibitors!\",\n \"metaTitle\": \"Creating An Inhibitor | Discordeno\",\n \"metaDescription\": \"Let's create our very own bot with Discordeno!\"\n};\nvar layoutProps = {\n _frontmatter: _frontmatter\n};\nvar MDXLayout = \"wrapper\";\nreturn function MDXContent(_ref) {\n var components = _ref.components,\n props = _objectWithoutProperties(_ref, [\"components\"]);\n\n return mdx(MDXLayout, _extends({}, layoutProps, props, {\n components: components,\n mdxType: \"MDXLayout\"\n }), mdx(\"p\", null, \"Woah! You are almost half way done with understanding all of Discordeno. Amazing isn't it? Something you may have noticed in the last section was there were some options that prevented some commands from running like \", mdx(\"inlineCode\", {\n parentName: \"p\"\n }, \"dmOnly\"), \" or the permission options. we created a setting to prevent the monitor from running in certain channels. What if we wanted to do prevent commands from happening? How would we prevent commands from running?\"), mdx(\"h2\", null, \"What is an Inhibitor?\"), mdx(\"p\", null, \"An Inhibitor is very similar to how monitors work. A monitor runs on every message but an inhibitor runs on every command. Remember all those command options like cooldown, permissions, permissionLevel, nsfw, etc... Each and every one of these options has an inhibitor in that checks commands for these settings.\"), mdx(\"p\", null, \"Let's create our own inhibitor that would prevent commands from being used if the user is not a VIP user.\"), mdx(\"blockquote\", null, mdx(\"p\", {\n parentName: \"blockquote\"\n }, mdx(\"strong\", {\n parentName: \"p\"\n }, \"Note:\"), \" It is important to remember that everything below can be done with a simple permission level as well. We will create our own custom permission levels but for the purposes of this guide and to be able to learn about Inhibitors, we will be using an inhibitor.\")), mdx(\"h2\", null, \"Creating the File\"), mdx(\"p\", null, \"Let's start by creating a file inside the inhibitors folder called \", mdx(\"inlineCode\", {\n parentName: \"p\"\n }, \"boosted.ts\"), \" and paste the following snippet of code:\"), mdx(\"pre\", null, mdx(\"code\", _extends({\n parentName: \"pre\"\n }, {\n \"className\": \"language-ts\"\n }), \"import { botCache } from \\\"../../mod.ts\\\";\\n\\nbotCache.inhibitors.set(\\\"inhibitorname\\\", async function (message, command, guild) {\\n // Your code goes here\\n});\\n\")), mdx(\"p\", null, \"Inhibitors can take up to 3 arguments.\"), mdx(\"ul\", null, mdx(\"li\", {\n parentName: \"ul\"\n }, mdx(\"inlineCode\", {\n parentName: \"li\"\n }, \"message\"), \": The message object that triggered the command.\"), mdx(\"li\", {\n parentName: \"ul\"\n }, mdx(\"inlineCode\", {\n parentName: \"li\"\n }, \"command\"), \": The command object itself that was triggered.\"), mdx(\"li\", {\n parentName: \"ul\"\n }, mdx(\"inlineCode\", {\n parentName: \"li\"\n }, \"guild\"), \": The server guild object where this command was ran.\")), mdx(\"h2\", null, \"Understanding How Inhibitors Function\"), mdx(\"p\", null, \"To block a command you have to return a truthy value.\"), mdx(\"ul\", null, mdx(\"li\", {\n parentName: \"ul\"\n }, mdx(\"strong\", {\n parentName: \"li\"\n }, \"return true;\"), \" If you return true the inhibitor will block the execution of the command.\\nTo allow a command return a falsey value.\"), mdx(\"li\", {\n parentName: \"ul\"\n }, mdx(\"strong\", {\n parentName: \"li\"\n }, \"return false;\"), \" If you return false the inhibitor will not block the error.\")), mdx(\"pre\", null, mdx(\"code\", _extends({\n parentName: \"pre\"\n }, {\n \"className\": \"language-ts\"\n }), \"// If the command is not VIP only we can allow this command to execute\\nif (!command.vipOnly) return false;\\n\\n// Check if the user has the vip role on the support server given by patreon\\nconst guild =\\nconst userIsVIP = await isUserVIP(message.author.id)\\n// The user is VIP so we can allow this command to be used\\nif (userIsVIP) return false;\\n\\n// The user is NOT VIP so we throw an error\\nthrow `The ${command.name} is only allowed for VIP users.`\\n\")));\n}\n;\nMDXContent.isMDXComponent = true;","rawMDXOutput":"/* @jsx mdx */\nimport { mdx } from '@mdx-js/react';\n/* @jsx mdx */\n\nexport const _frontmatter = {\n \"title\": \"Creating Inhibitors!\",\n \"metaTitle\": \"Creating An Inhibitor | Discordeno\",\n \"metaDescription\": \"Let's create our very own bot with Discordeno!\"\n};\n\nconst layoutProps = {\n _frontmatter\n};\nconst MDXLayout = \"wrapper\"\nexport default function MDXContent({\n components,\n ...props\n}) {\n return \n

{`Woah! You are almost half way done with understanding all of Discordeno. Amazing isn't it? Something you may have noticed in the last section was there were some options that prevented some commands from running like `}{`dmOnly`}{` or the permission options. we created a setting to prevent the monitor from running in certain channels. What if we wanted to do prevent commands from happening? How would we prevent commands from running?`}

\n

{`What is an Inhibitor?`}

\n

{`An Inhibitor is very similar to how monitors work. A monitor runs on every message but an inhibitor runs on every command. Remember all those command options like cooldown, permissions, permissionLevel, nsfw, etc... Each and every one of these options has an inhibitor in that checks commands for these settings.`}

\n

{`Let's create our own inhibitor that would prevent commands from being used if the user is not a VIP user.`}

\n
\n

{`Note:`}{` It is important to remember that everything below can be done with a simple permission level as well. We will create our own custom permission levels but for the purposes of this guide and to be able to learn about Inhibitors, we will be using an inhibitor.`}

\n
\n

{`Creating the File`}

\n

{`Let's start by creating a file inside the inhibitors folder called `}{`boosted.ts`}{` and paste the following snippet of code:`}

\n
{`import { botCache } from \"../../mod.ts\";\n\nbotCache.inhibitors.set(\"inhibitorname\", async function (message, command, guild) {\n    // Your code goes here\n});\n`}
\n

{`Inhibitors can take up to 3 arguments.`}

\n
    \n
  • {`message`}{`: The message object that triggered the command.`}
  • \n
  • {`command`}{`: The command object itself that was triggered.`}
  • \n
  • {`guild`}{`: The server guild object where this command was ran.`}
  • \n
\n

{`Understanding How Inhibitors Function`}

\n

{`To block a command you have to return a truthy value.`}

\n
    \n
  • {`return true;`}{` If you return true the inhibitor will block the execution of the command.\nTo allow a command return a falsey value.`}
  • \n
  • {`return false;`}{` If you return false the inhibitor will not block the error.`}
  • \n
\n
{`// If the command is not VIP only we can allow this command to execute\nif (!command.vipOnly) return false;\n\n// Check if the user has the vip role on the support server given by patreon\nconst guild =\nconst userIsVIP = await isUserVIP(message.author.id)\n// The user is VIP so we can allow this command to be used\nif (userIsVIP) return false;\n\n// The user is NOT VIP so we throw an error\nthrow \\`The \\${command.name} is only allowed for VIP users.\\`\n`}
\n\n
;\n}\n\n;\nMDXContent.isMDXComponent = true;"}} \ No newline at end of file diff --git a/docs/.cache/caches/gatsby-plugin-mdx/diskstore-e25228a50d456a7313b86cd103dbc0a3.json b/docs/.cache/caches/gatsby-plugin-mdx/diskstore-e25228a50d456a7313b86cd103dbc0a3.json new file mode 100644 index 000000000..7f5aa5eb8 --- /dev/null +++ b/docs/.cache/caches/gatsby-plugin-mdx/diskstore-e25228a50d456a7313b86cd103dbc0a3.json @@ -0,0 +1 @@ +{"expireTime":9007200851634434000,"key":"gatsby-plugin-mdx-entire-payload-d1210528f5df53e022d0a8b5aabf9d11-","val":{"mdast":{"type":"root","children":[{"type":"paragraph","children":[{"type":"text","value":"Woah! You are almost half way done with understanding all of Discordeno. Amazing isn't it? Something you may have noticed in the last section was there were some options that prevented some commands from running like ","position":{"start":{"line":2,"column":1,"offset":1},"end":{"line":2,"column":218,"offset":218},"indent":[]}},{"type":"inlineCode","value":"dmOnly","position":{"start":{"line":2,"column":218,"offset":218},"end":{"line":2,"column":226,"offset":226},"indent":[]}},{"type":"text","value":" or the permission options. we created a setting to prevent the monitor from running in certain channels. What if we wanted to do prevent commands from happening? How would we prevent commands from running?","position":{"start":{"line":2,"column":226,"offset":226},"end":{"line":2,"column":432,"offset":432},"indent":[]}}],"position":{"start":{"line":2,"column":1,"offset":1},"end":{"line":2,"column":432,"offset":432},"indent":[]}},{"type":"heading","depth":2,"children":[{"type":"text","value":"What is an Inhibitor?","position":{"start":{"line":4,"column":4,"offset":437},"end":{"line":4,"column":25,"offset":458},"indent":[]}}],"position":{"start":{"line":4,"column":1,"offset":434},"end":{"line":4,"column":25,"offset":458},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"An Inhibitor is very similar to how monitors work. A monitor runs on every message but an inhibitor runs on every command. Remember all those command options like cooldown, permissions, permissionLevel, nsfw, etc... Each and every one of these options has an inhibitor in that checks commands for these settings.","position":{"start":{"line":6,"column":1,"offset":460},"end":{"line":6,"column":313,"offset":772},"indent":[]}}],"position":{"start":{"line":6,"column":1,"offset":460},"end":{"line":6,"column":313,"offset":772},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"Let's create our own inhibitor that would prevent commands from being used if the user is not a VIP user.","position":{"start":{"line":8,"column":1,"offset":774},"end":{"line":8,"column":106,"offset":879},"indent":[]}}],"position":{"start":{"line":8,"column":1,"offset":774},"end":{"line":8,"column":106,"offset":879},"indent":[]}},{"type":"blockquote","children":[{"type":"paragraph","children":[{"type":"strong","children":[{"type":"text","value":"Note:","position":{"start":{"line":10,"column":5,"offset":885},"end":{"line":10,"column":10,"offset":890},"indent":[]}}],"position":{"start":{"line":10,"column":3,"offset":883},"end":{"line":10,"column":12,"offset":892},"indent":[]}},{"type":"text","value":" It is important to remember that everything below can be done with a simple permission level as well. We will create our own custom permission levels but for the purposes of this guide and to be able to learn about Inhibitors, we will be using an inhibitor.","position":{"start":{"line":10,"column":12,"offset":892},"end":{"line":10,"column":270,"offset":1150},"indent":[]}}],"position":{"start":{"line":10,"column":3,"offset":883},"end":{"line":10,"column":270,"offset":1150},"indent":[]}}],"position":{"start":{"line":10,"column":1,"offset":881},"end":{"line":10,"column":270,"offset":1150},"indent":[]}},{"type":"heading","depth":2,"children":[{"type":"text","value":"Creating the File","position":{"start":{"line":12,"column":4,"offset":1155},"end":{"line":12,"column":21,"offset":1172},"indent":[]}}],"position":{"start":{"line":12,"column":1,"offset":1152},"end":{"line":12,"column":21,"offset":1172},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"Let's start by creating a file inside the inhibitors folder called ","position":{"start":{"line":14,"column":1,"offset":1174},"end":{"line":14,"column":68,"offset":1241},"indent":[]}},{"type":"inlineCode","value":"boosted.ts","position":{"start":{"line":14,"column":68,"offset":1241},"end":{"line":14,"column":80,"offset":1253},"indent":[]}},{"type":"text","value":" and paste the following snippet of code:","position":{"start":{"line":14,"column":80,"offset":1253},"end":{"line":14,"column":121,"offset":1294},"indent":[]}}],"position":{"start":{"line":14,"column":1,"offset":1174},"end":{"line":14,"column":121,"offset":1294},"indent":[]}},{"type":"code","lang":"ts","meta":null,"value":"import { botCache } from \"../../mod.ts\";\n\nbotCache.inhibitors.set(\"inhibitorname\", async function (message, command, guild) {\n\t// Your code goes here\n});","position":{"start":{"line":16,"column":1,"offset":1296},"end":{"line":22,"column":4,"offset":1459},"indent":[1,1,1,1,1,1]}},{"type":"paragraph","children":[{"type":"text","value":"Inhibitors can take up to 3 arguments.","position":{"start":{"line":24,"column":1,"offset":1461},"end":{"line":24,"column":39,"offset":1499},"indent":[]}}],"position":{"start":{"line":24,"column":1,"offset":1461},"end":{"line":24,"column":39,"offset":1499},"indent":[]}},{"type":"list","ordered":false,"start":null,"spread":false,"children":[{"type":"listItem","spread":false,"checked":null,"children":[{"type":"paragraph","children":[{"type":"inlineCode","value":"message","position":{"start":{"line":26,"column":3,"offset":1503},"end":{"line":26,"column":12,"offset":1512},"indent":[]}},{"type":"text","value":": The message object that triggered the command.","position":{"start":{"line":26,"column":12,"offset":1512},"end":{"line":26,"column":60,"offset":1560},"indent":[]}}],"position":{"start":{"line":26,"column":3,"offset":1503},"end":{"line":26,"column":60,"offset":1560},"indent":[]}}],"position":{"start":{"line":26,"column":1,"offset":1501},"end":{"line":26,"column":60,"offset":1560},"indent":[]}},{"type":"listItem","spread":false,"checked":null,"children":[{"type":"paragraph","children":[{"type":"inlineCode","value":"command","position":{"start":{"line":27,"column":3,"offset":1563},"end":{"line":27,"column":12,"offset":1572},"indent":[]}},{"type":"text","value":": The command object itself that was triggered.","position":{"start":{"line":27,"column":12,"offset":1572},"end":{"line":27,"column":59,"offset":1619},"indent":[]}}],"position":{"start":{"line":27,"column":3,"offset":1563},"end":{"line":27,"column":59,"offset":1619},"indent":[]}}],"position":{"start":{"line":27,"column":1,"offset":1561},"end":{"line":27,"column":59,"offset":1619},"indent":[]}},{"type":"listItem","spread":false,"checked":null,"children":[{"type":"paragraph","children":[{"type":"inlineCode","value":"guild","position":{"start":{"line":28,"column":3,"offset":1622},"end":{"line":28,"column":10,"offset":1629},"indent":[]}},{"type":"text","value":": The server guild object where this command was ran.","position":{"start":{"line":28,"column":10,"offset":1629},"end":{"line":28,"column":63,"offset":1682},"indent":[]}}],"position":{"start":{"line":28,"column":3,"offset":1622},"end":{"line":28,"column":63,"offset":1682},"indent":[]}}],"position":{"start":{"line":28,"column":1,"offset":1620},"end":{"line":28,"column":63,"offset":1682},"indent":[]}}],"position":{"start":{"line":26,"column":1,"offset":1501},"end":{"line":28,"column":63,"offset":1682},"indent":[1,1]}},{"type":"heading","depth":2,"children":[{"type":"text","value":"Understanding How Inhibitors Function","position":{"start":{"line":30,"column":4,"offset":1687},"end":{"line":30,"column":41,"offset":1724},"indent":[]}}],"position":{"start":{"line":30,"column":1,"offset":1684},"end":{"line":30,"column":41,"offset":1724},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"To block a command you have to return a truthy value.","position":{"start":{"line":32,"column":1,"offset":1726},"end":{"line":32,"column":54,"offset":1779},"indent":[]}}],"position":{"start":{"line":32,"column":1,"offset":1726},"end":{"line":32,"column":54,"offset":1779},"indent":[]}},{"type":"list","ordered":false,"start":null,"spread":false,"children":[{"type":"listItem","spread":false,"checked":null,"children":[{"type":"paragraph","children":[{"type":"strong","children":[{"type":"text","value":"return true;","position":{"start":{"line":33,"column":5,"offset":1784},"end":{"line":33,"column":17,"offset":1796},"indent":[]}}],"position":{"start":{"line":33,"column":3,"offset":1782},"end":{"line":33,"column":19,"offset":1798},"indent":[]}},{"type":"text","value":" If you return true the inhibitor will block the execution of the command.\nTo allow a command return a falsey value.","position":{"start":{"line":33,"column":19,"offset":1798},"end":{"line":34,"column":42,"offset":1914},"indent":[1]}}],"position":{"start":{"line":33,"column":3,"offset":1782},"end":{"line":34,"column":42,"offset":1914},"indent":[1]}}],"position":{"start":{"line":33,"column":1,"offset":1780},"end":{"line":34,"column":42,"offset":1914},"indent":[1]}},{"type":"listItem","spread":false,"checked":null,"children":[{"type":"paragraph","children":[{"type":"strong","children":[{"type":"text","value":"return false;","position":{"start":{"line":35,"column":5,"offset":1919},"end":{"line":35,"column":18,"offset":1932},"indent":[]}}],"position":{"start":{"line":35,"column":3,"offset":1917},"end":{"line":35,"column":20,"offset":1934},"indent":[]}},{"type":"text","value":" If you return false the inhibitor will not block the error.","position":{"start":{"line":35,"column":20,"offset":1934},"end":{"line":35,"column":80,"offset":1994},"indent":[]}}],"position":{"start":{"line":35,"column":3,"offset":1917},"end":{"line":35,"column":80,"offset":1994},"indent":[]}}],"position":{"start":{"line":35,"column":1,"offset":1915},"end":{"line":35,"column":80,"offset":1994},"indent":[]}}],"position":{"start":{"line":33,"column":1,"offset":1780},"end":{"line":35,"column":80,"offset":1994},"indent":[1,1]}},{"type":"code","lang":"ts","meta":null,"value":"// If the command is not VIP only we can allow this command to execute\nif (!command.vipOnly) return false;\n\n// The bot's support server\nconst guild = cache.guilds.get(configs.supportServerID);\n// If the command author is not in the server they won't have the vip role\nconst member = guild.members.get(message.author.id) || await getMember(guild.id, message.author.id);\n// Member doesn't exist so cancel the command\nif (!member) {\n\tsendResponse(message, `sorry, but you can not use this command until you become VIP.`)\n\treturn true;\n}\n\n// If the user has the vip role on the support server given by patreon allow the command\nif (member.roles.includes(configs.patreonVIPRoleID)) return false;\n\n// Alert the user they don't have vip and can't use the command\nsendResponse(message, `sorry, but you can not use this command until you become a VIP. I'm sorry, Teal'c. We'll go to Disneyland next year. I promise.`)\n// Cancel the command since the user does not have vip\nreturn true;","position":{"start":{"line":38,"column":1,"offset":1997},"end":{"line":59,"column":4,"offset":2983},"indent":[1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1]}},{"type":"export","value":"export const _frontmatter = {\"title\":\"Creating Inhibitors!\",\"metaTitle\":\"Creating An Inhibitor | Discordeno\",\"metaDescription\":\"Let's create our very own bot with Discordeno!\"}","position":{"start":{"line":62,"column":1,"offset":2986},"end":{"line":62,"column":177,"offset":3162},"indent":[]}}],"position":{"start":{"line":1,"column":1,"offset":0},"end":{"line":62,"column":177,"offset":3162}}},"scopeImports":["import * as React from 'react'"],"scopeIdentifiers":["React"],"body":"function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }\n\nfunction _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }\n\nfunction _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }\n\n/* @jsx mdx */\nvar _frontmatter = {\n \"title\": \"Creating Inhibitors!\",\n \"metaTitle\": \"Creating An Inhibitor | Discordeno\",\n \"metaDescription\": \"Let's create our very own bot with Discordeno!\"\n};\nvar layoutProps = {\n _frontmatter: _frontmatter\n};\nvar MDXLayout = \"wrapper\";\nreturn function MDXContent(_ref) {\n var components = _ref.components,\n props = _objectWithoutProperties(_ref, [\"components\"]);\n\n return mdx(MDXLayout, _extends({}, layoutProps, props, {\n components: components,\n mdxType: \"MDXLayout\"\n }), mdx(\"p\", null, \"Woah! You are almost half way done with understanding all of Discordeno. Amazing isn't it? Something you may have noticed in the last section was there were some options that prevented some commands from running like \", mdx(\"inlineCode\", {\n parentName: \"p\"\n }, \"dmOnly\"), \" or the permission options. we created a setting to prevent the monitor from running in certain channels. What if we wanted to do prevent commands from happening? How would we prevent commands from running?\"), mdx(\"h2\", null, \"What is an Inhibitor?\"), mdx(\"p\", null, \"An Inhibitor is very similar to how monitors work. A monitor runs on every message but an inhibitor runs on every command. Remember all those command options like cooldown, permissions, permissionLevel, nsfw, etc... Each and every one of these options has an inhibitor in that checks commands for these settings.\"), mdx(\"p\", null, \"Let's create our own inhibitor that would prevent commands from being used if the user is not a VIP user.\"), mdx(\"blockquote\", null, mdx(\"p\", {\n parentName: \"blockquote\"\n }, mdx(\"strong\", {\n parentName: \"p\"\n }, \"Note:\"), \" It is important to remember that everything below can be done with a simple permission level as well. We will create our own custom permission levels but for the purposes of this guide and to be able to learn about Inhibitors, we will be using an inhibitor.\")), mdx(\"h2\", null, \"Creating the File\"), mdx(\"p\", null, \"Let's start by creating a file inside the inhibitors folder called \", mdx(\"inlineCode\", {\n parentName: \"p\"\n }, \"boosted.ts\"), \" and paste the following snippet of code:\"), mdx(\"pre\", null, mdx(\"code\", _extends({\n parentName: \"pre\"\n }, {\n \"className\": \"language-ts\"\n }), \"import { botCache } from \\\"../../mod.ts\\\";\\n\\nbotCache.inhibitors.set(\\\"inhibitorname\\\", async function (message, command, guild) {\\n // Your code goes here\\n});\\n\")), mdx(\"p\", null, \"Inhibitors can take up to 3 arguments.\"), mdx(\"ul\", null, mdx(\"li\", {\n parentName: \"ul\"\n }, mdx(\"inlineCode\", {\n parentName: \"li\"\n }, \"message\"), \": The message object that triggered the command.\"), mdx(\"li\", {\n parentName: \"ul\"\n }, mdx(\"inlineCode\", {\n parentName: \"li\"\n }, \"command\"), \": The command object itself that was triggered.\"), mdx(\"li\", {\n parentName: \"ul\"\n }, mdx(\"inlineCode\", {\n parentName: \"li\"\n }, \"guild\"), \": The server guild object where this command was ran.\")), mdx(\"h2\", null, \"Understanding How Inhibitors Function\"), mdx(\"p\", null, \"To block a command you have to return a truthy value.\"), mdx(\"ul\", null, mdx(\"li\", {\n parentName: \"ul\"\n }, mdx(\"strong\", {\n parentName: \"li\"\n }, \"return true;\"), \" If you return true the inhibitor will block the execution of the command.\\nTo allow a command return a falsey value.\"), mdx(\"li\", {\n parentName: \"ul\"\n }, mdx(\"strong\", {\n parentName: \"li\"\n }, \"return false;\"), \" If you return false the inhibitor will not block the error.\")), mdx(\"pre\", null, mdx(\"code\", _extends({\n parentName: \"pre\"\n }, {\n \"className\": \"language-ts\"\n }), \"// If the command is not VIP only we can allow this command to execute\\nif (!command.vipOnly) return false;\\n\\n// The bot's support server\\nconst guild = cache.guilds.get(configs.supportServerID);\\n// If the command author is not in the server they won't have the vip role\\nconst member = guild.members.get(message.author.id) || await getMember(guild.id, message.author.id);\\n// Member doesn't exist so cancel the command\\nif (!member) {\\n sendResponse(message, `sorry, but you can not use this command until you become VIP.`)\\n return true;\\n}\\n\\n// If the user has the vip role on the support server given by patreon allow the command\\nif (member.roles.includes(configs.patreonVIPRoleID)) return false;\\n\\n// Alert the user they don't have vip and can't use the command\\nsendResponse(message, `sorry, but you can not use this command until you become a VIP. I'm sorry, Teal'c. We'll go to Disneyland next year. I promise.`)\\n// Cancel the command since the user does not have vip\\nreturn true;\\n\")));\n}\n;\nMDXContent.isMDXComponent = true;","rawMDXOutput":"/* @jsx mdx */\nimport { mdx } from '@mdx-js/react';\n/* @jsx mdx */\n\nexport const _frontmatter = {\n \"title\": \"Creating Inhibitors!\",\n \"metaTitle\": \"Creating An Inhibitor | Discordeno\",\n \"metaDescription\": \"Let's create our very own bot with Discordeno!\"\n};\n\nconst layoutProps = {\n _frontmatter\n};\nconst MDXLayout = \"wrapper\"\nexport default function MDXContent({\n components,\n ...props\n}) {\n return \n

{`Woah! You are almost half way done with understanding all of Discordeno. Amazing isn't it? Something you may have noticed in the last section was there were some options that prevented some commands from running like `}{`dmOnly`}{` or the permission options. we created a setting to prevent the monitor from running in certain channels. What if we wanted to do prevent commands from happening? How would we prevent commands from running?`}

\n

{`What is an Inhibitor?`}

\n

{`An Inhibitor is very similar to how monitors work. A monitor runs on every message but an inhibitor runs on every command. Remember all those command options like cooldown, permissions, permissionLevel, nsfw, etc... Each and every one of these options has an inhibitor in that checks commands for these settings.`}

\n

{`Let's create our own inhibitor that would prevent commands from being used if the user is not a VIP user.`}

\n
\n

{`Note:`}{` It is important to remember that everything below can be done with a simple permission level as well. We will create our own custom permission levels but for the purposes of this guide and to be able to learn about Inhibitors, we will be using an inhibitor.`}

\n
\n

{`Creating the File`}

\n

{`Let's start by creating a file inside the inhibitors folder called `}{`boosted.ts`}{` and paste the following snippet of code:`}

\n
{`import { botCache } from \"../../mod.ts\";\n\nbotCache.inhibitors.set(\"inhibitorname\", async function (message, command, guild) {\n    // Your code goes here\n});\n`}
\n

{`Inhibitors can take up to 3 arguments.`}

\n
    \n
  • {`message`}{`: The message object that triggered the command.`}
  • \n
  • {`command`}{`: The command object itself that was triggered.`}
  • \n
  • {`guild`}{`: The server guild object where this command was ran.`}
  • \n
\n

{`Understanding How Inhibitors Function`}

\n

{`To block a command you have to return a truthy value.`}

\n
    \n
  • {`return true;`}{` If you return true the inhibitor will block the execution of the command.\nTo allow a command return a falsey value.`}
  • \n
  • {`return false;`}{` If you return false the inhibitor will not block the error.`}
  • \n
\n
{`// If the command is not VIP only we can allow this command to execute\nif (!command.vipOnly) return false;\n\n// The bot's support server\nconst guild = cache.guilds.get(configs.supportServerID);\n// If the command author is not in the server they won't have the vip role\nconst member = guild.members.get(message.author.id) || await getMember(guild.id, message.author.id);\n// Member doesn't exist so cancel the command\nif (!member) {\n    sendResponse(message, \\`sorry, but you can not use this command until you become VIP.\\`)\n    return true;\n}\n\n// If the user has the vip role on the support server given by patreon allow the command\nif (member.roles.includes(configs.patreonVIPRoleID)) return false;\n\n// Alert the user they don't have vip and can't use the command\nsendResponse(message, \\`sorry, but you can not use this command until you become a VIP. I'm sorry, Teal'c. We'll go to Disneyland next year. I promise.\\`)\n// Cancel the command since the user does not have vip\nreturn true;\n`}
\n\n
;\n}\n\n;\nMDXContent.isMDXComponent = true;"}} \ No newline at end of file diff --git a/docs/.cache/caches/gatsby-plugin-mdx/diskstore-e3033b62c546c2e4d949a920bdc38728.json b/docs/.cache/caches/gatsby-plugin-mdx/diskstore-e3033b62c546c2e4d949a920bdc38728.json new file mode 100644 index 000000000..16361dfa1 --- /dev/null +++ b/docs/.cache/caches/gatsby-plugin-mdx/diskstore-e3033b62c546c2e4d949a920bdc38728.json @@ -0,0 +1 @@ +{"expireTime":9007200851634009000,"key":"gatsby-plugin-mdx-entire-payload-c328e2f78d53d59f7c68eec668fc0440-","val":{"mdast":{"type":"root","children":[{"type":"paragraph","children":[{"type":"text","value":"Woah! You are almost half way done with understanding all of Discordeno. Amazing isn't it? Something you may have noticed in the last section was there were some options that prevented some commands from running like ","position":{"start":{"line":2,"column":1,"offset":1},"end":{"line":2,"column":218,"offset":218},"indent":[]}},{"type":"inlineCode","value":"dmOnly","position":{"start":{"line":2,"column":218,"offset":218},"end":{"line":2,"column":226,"offset":226},"indent":[]}},{"type":"text","value":" or the permission options. we created a setting to prevent the monitor from running in certain channels. What if we wanted to do prevent commands from happening? How would we prevent commands from running?","position":{"start":{"line":2,"column":226,"offset":226},"end":{"line":2,"column":432,"offset":432},"indent":[]}}],"position":{"start":{"line":2,"column":1,"offset":1},"end":{"line":2,"column":432,"offset":432},"indent":[]}},{"type":"heading","depth":2,"children":[{"type":"text","value":"What is an Inhibitor?","position":{"start":{"line":4,"column":4,"offset":437},"end":{"line":4,"column":25,"offset":458},"indent":[]}}],"position":{"start":{"line":4,"column":1,"offset":434},"end":{"line":4,"column":25,"offset":458},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"An Inhibitor is very similar to how monitors work. A monitor runs on every message but an inhibitor runs on every command. Remember all those command options like cooldown, permissions, permissionLevel, nsfw, etc... Each and every one of these options has an inhibitor in that checks commands for these settings.","position":{"start":{"line":6,"column":1,"offset":460},"end":{"line":6,"column":313,"offset":772},"indent":[]}}],"position":{"start":{"line":6,"column":1,"offset":460},"end":{"line":6,"column":313,"offset":772},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"Let's create our own inhibitor that would prevent commands from being used if the user is not a VIP user.","position":{"start":{"line":8,"column":1,"offset":774},"end":{"line":8,"column":106,"offset":879},"indent":[]}}],"position":{"start":{"line":8,"column":1,"offset":774},"end":{"line":8,"column":106,"offset":879},"indent":[]}},{"type":"blockquote","children":[{"type":"paragraph","children":[{"type":"strong","children":[{"type":"text","value":"Note:","position":{"start":{"line":10,"column":5,"offset":885},"end":{"line":10,"column":10,"offset":890},"indent":[]}}],"position":{"start":{"line":10,"column":3,"offset":883},"end":{"line":10,"column":12,"offset":892},"indent":[]}},{"type":"text","value":" It is important to remember that everything below can be done with a simple permission level as well. We will create our own custom permission levels but for the purposes of this guide and to be able to learn about Inhibitors, we will be using an inhibitor.","position":{"start":{"line":10,"column":12,"offset":892},"end":{"line":10,"column":270,"offset":1150},"indent":[]}}],"position":{"start":{"line":10,"column":3,"offset":883},"end":{"line":10,"column":270,"offset":1150},"indent":[]}}],"position":{"start":{"line":10,"column":1,"offset":881},"end":{"line":10,"column":270,"offset":1150},"indent":[]}},{"type":"heading","depth":2,"children":[{"type":"text","value":"Creating the File","position":{"start":{"line":12,"column":4,"offset":1155},"end":{"line":12,"column":21,"offset":1172},"indent":[]}}],"position":{"start":{"line":12,"column":1,"offset":1152},"end":{"line":12,"column":21,"offset":1172},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"Let's start by creating a file inside the inhibitors folder called ","position":{"start":{"line":14,"column":1,"offset":1174},"end":{"line":14,"column":68,"offset":1241},"indent":[]}},{"type":"inlineCode","value":"boosted.ts","position":{"start":{"line":14,"column":68,"offset":1241},"end":{"line":14,"column":80,"offset":1253},"indent":[]}},{"type":"text","value":" and paste the following snippet of code:","position":{"start":{"line":14,"column":80,"offset":1253},"end":{"line":14,"column":121,"offset":1294},"indent":[]}}],"position":{"start":{"line":14,"column":1,"offset":1174},"end":{"line":14,"column":121,"offset":1294},"indent":[]}},{"type":"code","lang":"ts","meta":null,"value":"import { botCache } from \"../../mod.ts\";\n\nbotCache.inhibitors.set(\"inhibitorname\", async function (message, command, guild) {\n\t// Your code goes here\n});","position":{"start":{"line":16,"column":1,"offset":1296},"end":{"line":22,"column":4,"offset":1459},"indent":[1,1,1,1,1,1]}},{"type":"paragraph","children":[{"type":"text","value":"Inhibitors can take up to 3 arguments.","position":{"start":{"line":24,"column":1,"offset":1461},"end":{"line":24,"column":39,"offset":1499},"indent":[]}}],"position":{"start":{"line":24,"column":1,"offset":1461},"end":{"line":24,"column":39,"offset":1499},"indent":[]}},{"type":"list","ordered":false,"start":null,"spread":false,"children":[{"type":"listItem","spread":false,"checked":null,"children":[{"type":"paragraph","children":[{"type":"inlineCode","value":"message","position":{"start":{"line":26,"column":3,"offset":1503},"end":{"line":26,"column":12,"offset":1512},"indent":[]}},{"type":"text","value":": The message object that triggered the command.","position":{"start":{"line":26,"column":12,"offset":1512},"end":{"line":26,"column":60,"offset":1560},"indent":[]}}],"position":{"start":{"line":26,"column":3,"offset":1503},"end":{"line":26,"column":60,"offset":1560},"indent":[]}}],"position":{"start":{"line":26,"column":1,"offset":1501},"end":{"line":26,"column":60,"offset":1560},"indent":[]}},{"type":"listItem","spread":false,"checked":null,"children":[{"type":"paragraph","children":[{"type":"inlineCode","value":"command","position":{"start":{"line":27,"column":3,"offset":1563},"end":{"line":27,"column":12,"offset":1572},"indent":[]}},{"type":"text","value":": The command object itself that was triggered.","position":{"start":{"line":27,"column":12,"offset":1572},"end":{"line":27,"column":59,"offset":1619},"indent":[]}}],"position":{"start":{"line":27,"column":3,"offset":1563},"end":{"line":27,"column":59,"offset":1619},"indent":[]}}],"position":{"start":{"line":27,"column":1,"offset":1561},"end":{"line":27,"column":59,"offset":1619},"indent":[]}},{"type":"listItem","spread":false,"checked":null,"children":[{"type":"paragraph","children":[{"type":"inlineCode","value":"guild","position":{"start":{"line":28,"column":3,"offset":1622},"end":{"line":28,"column":10,"offset":1629},"indent":[]}},{"type":"text","value":": The server guild object where this command was ran.","position":{"start":{"line":28,"column":10,"offset":1629},"end":{"line":28,"column":63,"offset":1682},"indent":[]}}],"position":{"start":{"line":28,"column":3,"offset":1622},"end":{"line":28,"column":63,"offset":1682},"indent":[]}}],"position":{"start":{"line":28,"column":1,"offset":1620},"end":{"line":28,"column":63,"offset":1682},"indent":[]}}],"position":{"start":{"line":26,"column":1,"offset":1501},"end":{"line":28,"column":63,"offset":1682},"indent":[1,1]}},{"type":"heading","depth":2,"children":[{"type":"text","value":"Understanding How Inhibitors Function","position":{"start":{"line":30,"column":4,"offset":1687},"end":{"line":30,"column":41,"offset":1724},"indent":[]}}],"position":{"start":{"line":30,"column":1,"offset":1684},"end":{"line":30,"column":41,"offset":1724},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"To block a command you have to return a truthy value.","position":{"start":{"line":32,"column":1,"offset":1726},"end":{"line":32,"column":54,"offset":1779},"indent":[]}}],"position":{"start":{"line":32,"column":1,"offset":1726},"end":{"line":32,"column":54,"offset":1779},"indent":[]}},{"type":"list","ordered":false,"start":null,"spread":false,"children":[{"type":"listItem","spread":false,"checked":null,"children":[{"type":"paragraph","children":[{"type":"strong","children":[{"type":"text","value":"return true;","position":{"start":{"line":33,"column":5,"offset":1784},"end":{"line":33,"column":17,"offset":1796},"indent":[]}}],"position":{"start":{"line":33,"column":3,"offset":1782},"end":{"line":33,"column":19,"offset":1798},"indent":[]}},{"type":"text","value":" If you return true the inhibitor will block the execution of the command.\nTo allow a command return a falsey value.","position":{"start":{"line":33,"column":19,"offset":1798},"end":{"line":34,"column":42,"offset":1914},"indent":[1]}}],"position":{"start":{"line":33,"column":3,"offset":1782},"end":{"line":34,"column":42,"offset":1914},"indent":[1]}}],"position":{"start":{"line":33,"column":1,"offset":1780},"end":{"line":34,"column":42,"offset":1914},"indent":[1]}},{"type":"listItem","spread":false,"checked":null,"children":[{"type":"paragraph","children":[{"type":"strong","children":[{"type":"text","value":"return false;","position":{"start":{"line":35,"column":5,"offset":1919},"end":{"line":35,"column":18,"offset":1932},"indent":[]}}],"position":{"start":{"line":35,"column":3,"offset":1917},"end":{"line":35,"column":20,"offset":1934},"indent":[]}},{"type":"text","value":" If you return false the inhibitor will not block the error.","position":{"start":{"line":35,"column":20,"offset":1934},"end":{"line":35,"column":80,"offset":1994},"indent":[]}}],"position":{"start":{"line":35,"column":3,"offset":1917},"end":{"line":35,"column":80,"offset":1994},"indent":[]}}],"position":{"start":{"line":35,"column":1,"offset":1915},"end":{"line":35,"column":80,"offset":1994},"indent":[]}}],"position":{"start":{"line":33,"column":1,"offset":1780},"end":{"line":35,"column":80,"offset":1994},"indent":[1,1]}},{"type":"code","lang":"ts","meta":null,"value":"// If the command is not VIP only we can allow this command to execute\nif (!command.boost) return false;\n\n// Check if the user has boosted this server\nconst userIsVIP = await isUserVIP(message.author.id)\n// The user is VIP so we can allow this command to be used\nif (userIsVIP) return false;\n\n// The user is NOT VIP so we throw an error\nthrow `The ${command.name} is only allowed for VIP users.`","position":{"start":{"line":38,"column":1,"offset":1997},"end":{"line":49,"column":4,"offset":2402},"indent":[1,1,1,1,1,1,1,1,1,1,1]}},{"type":"export","value":"export const _frontmatter = {\"title\":\"Creating Inhibitors!\",\"metaTitle\":\"Creating An Inhibitor | Discordeno\",\"metaDescription\":\"Let's create our very own bot with Discordeno!\"}","position":{"start":{"line":52,"column":1,"offset":2405},"end":{"line":52,"column":177,"offset":2581},"indent":[]}}],"position":{"start":{"line":1,"column":1,"offset":0},"end":{"line":52,"column":177,"offset":2581}}},"scopeImports":["import * as React from 'react'"],"scopeIdentifiers":["React"],"body":"function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }\n\nfunction _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }\n\nfunction _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }\n\n/* @jsx mdx */\nvar _frontmatter = {\n \"title\": \"Creating Inhibitors!\",\n \"metaTitle\": \"Creating An Inhibitor | Discordeno\",\n \"metaDescription\": \"Let's create our very own bot with Discordeno!\"\n};\nvar layoutProps = {\n _frontmatter: _frontmatter\n};\nvar MDXLayout = \"wrapper\";\nreturn function MDXContent(_ref) {\n var components = _ref.components,\n props = _objectWithoutProperties(_ref, [\"components\"]);\n\n return mdx(MDXLayout, _extends({}, layoutProps, props, {\n components: components,\n mdxType: \"MDXLayout\"\n }), mdx(\"p\", null, \"Woah! You are almost half way done with understanding all of Discordeno. Amazing isn't it? Something you may have noticed in the last section was there were some options that prevented some commands from running like \", mdx(\"inlineCode\", {\n parentName: \"p\"\n }, \"dmOnly\"), \" or the permission options. we created a setting to prevent the monitor from running in certain channels. What if we wanted to do prevent commands from happening? How would we prevent commands from running?\"), mdx(\"h2\", null, \"What is an Inhibitor?\"), mdx(\"p\", null, \"An Inhibitor is very similar to how monitors work. A monitor runs on every message but an inhibitor runs on every command. Remember all those command options like cooldown, permissions, permissionLevel, nsfw, etc... Each and every one of these options has an inhibitor in that checks commands for these settings.\"), mdx(\"p\", null, \"Let's create our own inhibitor that would prevent commands from being used if the user is not a VIP user.\"), mdx(\"blockquote\", null, mdx(\"p\", {\n parentName: \"blockquote\"\n }, mdx(\"strong\", {\n parentName: \"p\"\n }, \"Note:\"), \" It is important to remember that everything below can be done with a simple permission level as well. We will create our own custom permission levels but for the purposes of this guide and to be able to learn about Inhibitors, we will be using an inhibitor.\")), mdx(\"h2\", null, \"Creating the File\"), mdx(\"p\", null, \"Let's start by creating a file inside the inhibitors folder called \", mdx(\"inlineCode\", {\n parentName: \"p\"\n }, \"boosted.ts\"), \" and paste the following snippet of code:\"), mdx(\"pre\", null, mdx(\"code\", _extends({\n parentName: \"pre\"\n }, {\n \"className\": \"language-ts\"\n }), \"import { botCache } from \\\"../../mod.ts\\\";\\n\\nbotCache.inhibitors.set(\\\"inhibitorname\\\", async function (message, command, guild) {\\n // Your code goes here\\n});\\n\")), mdx(\"p\", null, \"Inhibitors can take up to 3 arguments.\"), mdx(\"ul\", null, mdx(\"li\", {\n parentName: \"ul\"\n }, mdx(\"inlineCode\", {\n parentName: \"li\"\n }, \"message\"), \": The message object that triggered the command.\"), mdx(\"li\", {\n parentName: \"ul\"\n }, mdx(\"inlineCode\", {\n parentName: \"li\"\n }, \"command\"), \": The command object itself that was triggered.\"), mdx(\"li\", {\n parentName: \"ul\"\n }, mdx(\"inlineCode\", {\n parentName: \"li\"\n }, \"guild\"), \": The server guild object where this command was ran.\")), mdx(\"h2\", null, \"Understanding How Inhibitors Function\"), mdx(\"p\", null, \"To block a command you have to return a truthy value.\"), mdx(\"ul\", null, mdx(\"li\", {\n parentName: \"ul\"\n }, mdx(\"strong\", {\n parentName: \"li\"\n }, \"return true;\"), \" If you return true the inhibitor will block the execution of the command.\\nTo allow a command return a falsey value.\"), mdx(\"li\", {\n parentName: \"ul\"\n }, mdx(\"strong\", {\n parentName: \"li\"\n }, \"return false;\"), \" If you return false the inhibitor will not block the error.\")), mdx(\"pre\", null, mdx(\"code\", _extends({\n parentName: \"pre\"\n }, {\n \"className\": \"language-ts\"\n }), \"// If the command is not VIP only we can allow this command to execute\\nif (!command.boost) return false;\\n\\n// Check if the user has boosted this server\\nconst userIsVIP = await isUserVIP(message.author.id)\\n// The user is VIP so we can allow this command to be used\\nif (userIsVIP) return false;\\n\\n// The user is NOT VIP so we throw an error\\nthrow `The ${command.name} is only allowed for VIP users.`\\n\")));\n}\n;\nMDXContent.isMDXComponent = true;","rawMDXOutput":"/* @jsx mdx */\nimport { mdx } from '@mdx-js/react';\n/* @jsx mdx */\n\nexport const _frontmatter = {\n \"title\": \"Creating Inhibitors!\",\n \"metaTitle\": \"Creating An Inhibitor | Discordeno\",\n \"metaDescription\": \"Let's create our very own bot with Discordeno!\"\n};\n\nconst layoutProps = {\n _frontmatter\n};\nconst MDXLayout = \"wrapper\"\nexport default function MDXContent({\n components,\n ...props\n}) {\n return \n

{`Woah! You are almost half way done with understanding all of Discordeno. Amazing isn't it? Something you may have noticed in the last section was there were some options that prevented some commands from running like `}{`dmOnly`}{` or the permission options. we created a setting to prevent the monitor from running in certain channels. What if we wanted to do prevent commands from happening? How would we prevent commands from running?`}

\n

{`What is an Inhibitor?`}

\n

{`An Inhibitor is very similar to how monitors work. A monitor runs on every message but an inhibitor runs on every command. Remember all those command options like cooldown, permissions, permissionLevel, nsfw, etc... Each and every one of these options has an inhibitor in that checks commands for these settings.`}

\n

{`Let's create our own inhibitor that would prevent commands from being used if the user is not a VIP user.`}

\n
\n

{`Note:`}{` It is important to remember that everything below can be done with a simple permission level as well. We will create our own custom permission levels but for the purposes of this guide and to be able to learn about Inhibitors, we will be using an inhibitor.`}

\n
\n

{`Creating the File`}

\n

{`Let's start by creating a file inside the inhibitors folder called `}{`boosted.ts`}{` and paste the following snippet of code:`}

\n
{`import { botCache } from \"../../mod.ts\";\n\nbotCache.inhibitors.set(\"inhibitorname\", async function (message, command, guild) {\n    // Your code goes here\n});\n`}
\n

{`Inhibitors can take up to 3 arguments.`}

\n
    \n
  • {`message`}{`: The message object that triggered the command.`}
  • \n
  • {`command`}{`: The command object itself that was triggered.`}
  • \n
  • {`guild`}{`: The server guild object where this command was ran.`}
  • \n
\n

{`Understanding How Inhibitors Function`}

\n

{`To block a command you have to return a truthy value.`}

\n
    \n
  • {`return true;`}{` If you return true the inhibitor will block the execution of the command.\nTo allow a command return a falsey value.`}
  • \n
  • {`return false;`}{` If you return false the inhibitor will not block the error.`}
  • \n
\n
{`// If the command is not VIP only we can allow this command to execute\nif (!command.boost) return false;\n\n// Check if the user has boosted this server\nconst userIsVIP = await isUserVIP(message.author.id)\n// The user is VIP so we can allow this command to be used\nif (userIsVIP) return false;\n\n// The user is NOT VIP so we throw an error\nthrow \\`The \\${command.name} is only allowed for VIP users.\\`\n`}
\n\n
;\n}\n\n;\nMDXContent.isMDXComponent = true;"}} \ No newline at end of file diff --git a/docs/.cache/caches/gatsby-plugin-mdx/diskstore-e718c442bc0a9e7c49a5993824e7f563.json b/docs/.cache/caches/gatsby-plugin-mdx/diskstore-e718c442bc0a9e7c49a5993824e7f563.json new file mode 100644 index 000000000..94a1cb0e2 --- /dev/null +++ b/docs/.cache/caches/gatsby-plugin-mdx/diskstore-e718c442bc0a9e7c49a5993824e7f563.json @@ -0,0 +1 @@ +{"expireTime":9007200851633752000,"key":"gatsby-plugin-mdx-entire-payload-46091c6d5227640e637121a36fc4757c-","val":{"mdast":{"type":"root","children":[{"type":"paragraph","children":[{"type":"text","value":"Woah! You are almost half way done with understanding all of Discordeno. Amazing isn't it? Something you may have noticed in the last section was there were some options that prevented some commands from running like ","position":{"start":{"line":2,"column":1,"offset":1},"end":{"line":2,"column":218,"offset":218},"indent":[]}},{"type":"inlineCode","value":"dmOnly","position":{"start":{"line":2,"column":218,"offset":218},"end":{"line":2,"column":226,"offset":226},"indent":[]}},{"type":"text","value":" or the permission options. we created a setting to prevent the monitor from running in certain channels. What if we wanted to do prevent commands from happening? How would we prevent commands from running?","position":{"start":{"line":2,"column":226,"offset":226},"end":{"line":2,"column":432,"offset":432},"indent":[]}}],"position":{"start":{"line":2,"column":1,"offset":1},"end":{"line":2,"column":432,"offset":432},"indent":[]}},{"type":"heading","depth":2,"children":[{"type":"text","value":"What is an Inhibitor?","position":{"start":{"line":4,"column":4,"offset":437},"end":{"line":4,"column":25,"offset":458},"indent":[]}}],"position":{"start":{"line":4,"column":1,"offset":434},"end":{"line":4,"column":25,"offset":458},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"An Inhibitor is very similar to how monitors work. A monitor runs on every message but an inhibitor runs on every command. Remember all those command options like cooldown, permissions, permissionLevel, nsfw, etc... Each and every one of these options has an inhibitor in that checks commands for these settings.","position":{"start":{"line":6,"column":1,"offset":460},"end":{"line":6,"column":313,"offset":772},"indent":[]}}],"position":{"start":{"line":6,"column":1,"offset":460},"end":{"line":6,"column":313,"offset":772},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"Let's create our own inhibitor that would prevent commands from being used if the user is not a VIP user.","position":{"start":{"line":8,"column":1,"offset":774},"end":{"line":8,"column":106,"offset":879},"indent":[]}}],"position":{"start":{"line":8,"column":1,"offset":774},"end":{"line":8,"column":106,"offset":879},"indent":[]}},{"type":"blockquote","children":[{"type":"paragraph","children":[{"type":"strong","children":[{"type":"text","value":"Note:","position":{"start":{"line":10,"column":5,"offset":885},"end":{"line":10,"column":10,"offset":890},"indent":[]}}],"position":{"start":{"line":10,"column":3,"offset":883},"end":{"line":10,"column":12,"offset":892},"indent":[]}},{"type":"text","value":" It is important to remember that everything below can be done with a simple permission level as well. We will create our own custom permission levels but for the purposes of this guide and to be able to learn about Inhibitors, we will be using an inhibitor.","position":{"start":{"line":10,"column":12,"offset":892},"end":{"line":10,"column":270,"offset":1150},"indent":[]}}],"position":{"start":{"line":10,"column":3,"offset":883},"end":{"line":10,"column":270,"offset":1150},"indent":[]}}],"position":{"start":{"line":10,"column":1,"offset":881},"end":{"line":10,"column":270,"offset":1150},"indent":[]}},{"type":"heading","depth":2,"children":[{"type":"text","value":"Creating the File","position":{"start":{"line":12,"column":4,"offset":1155},"end":{"line":12,"column":21,"offset":1172},"indent":[]}}],"position":{"start":{"line":12,"column":1,"offset":1152},"end":{"line":12,"column":21,"offset":1172},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"Let's start by creating a file inside the inhibitors folder called ","position":{"start":{"line":14,"column":1,"offset":1174},"end":{"line":14,"column":68,"offset":1241},"indent":[]}},{"type":"inlineCode","value":"vipOnly.ts","position":{"start":{"line":14,"column":68,"offset":1241},"end":{"line":14,"column":80,"offset":1253},"indent":[]}},{"type":"text","value":" and paste the following snippet of code:","position":{"start":{"line":14,"column":80,"offset":1253},"end":{"line":14,"column":121,"offset":1294},"indent":[]}}],"position":{"start":{"line":14,"column":1,"offset":1174},"end":{"line":14,"column":121,"offset":1294},"indent":[]}},{"type":"code","lang":"ts","meta":null,"value":"import { botCache } from \"../../mod.ts\";\n\nbotCache.inhibitors.set(\"inhibitorname\", async function (message, command, guild) {\n\t// Your code goes here\n});","position":{"start":{"line":16,"column":1,"offset":1296},"end":{"line":22,"column":4,"offset":1459},"indent":[1,1,1,1,1,1]}},{"type":"paragraph","children":[{"type":"text","value":"Inhibitors can take up to 3 arguments.","position":{"start":{"line":24,"column":1,"offset":1461},"end":{"line":24,"column":39,"offset":1499},"indent":[]}}],"position":{"start":{"line":24,"column":1,"offset":1461},"end":{"line":24,"column":39,"offset":1499},"indent":[]}},{"type":"list","ordered":false,"start":null,"spread":false,"children":[{"type":"listItem","spread":false,"checked":null,"children":[{"type":"paragraph","children":[{"type":"inlineCode","value":"message","position":{"start":{"line":26,"column":3,"offset":1503},"end":{"line":26,"column":12,"offset":1512},"indent":[]}},{"type":"text","value":": The message object that triggered the command.","position":{"start":{"line":26,"column":12,"offset":1512},"end":{"line":26,"column":60,"offset":1560},"indent":[]}}],"position":{"start":{"line":26,"column":3,"offset":1503},"end":{"line":26,"column":60,"offset":1560},"indent":[]}}],"position":{"start":{"line":26,"column":1,"offset":1501},"end":{"line":26,"column":60,"offset":1560},"indent":[]}},{"type":"listItem","spread":false,"checked":null,"children":[{"type":"paragraph","children":[{"type":"inlineCode","value":"command","position":{"start":{"line":27,"column":3,"offset":1563},"end":{"line":27,"column":12,"offset":1572},"indent":[]}},{"type":"text","value":": The command object itself that was triggered.","position":{"start":{"line":27,"column":12,"offset":1572},"end":{"line":27,"column":59,"offset":1619},"indent":[]}}],"position":{"start":{"line":27,"column":3,"offset":1563},"end":{"line":27,"column":59,"offset":1619},"indent":[]}}],"position":{"start":{"line":27,"column":1,"offset":1561},"end":{"line":27,"column":59,"offset":1619},"indent":[]}},{"type":"listItem","spread":false,"checked":null,"children":[{"type":"paragraph","children":[{"type":"inlineCode","value":"guild","position":{"start":{"line":28,"column":3,"offset":1622},"end":{"line":28,"column":10,"offset":1629},"indent":[]}},{"type":"text","value":": The server guild object where this command was ran.","position":{"start":{"line":28,"column":10,"offset":1629},"end":{"line":28,"column":63,"offset":1682},"indent":[]}}],"position":{"start":{"line":28,"column":3,"offset":1622},"end":{"line":28,"column":63,"offset":1682},"indent":[]}}],"position":{"start":{"line":28,"column":1,"offset":1620},"end":{"line":28,"column":63,"offset":1682},"indent":[]}}],"position":{"start":{"line":26,"column":1,"offset":1501},"end":{"line":28,"column":63,"offset":1682},"indent":[1,1]}},{"type":"heading","depth":2,"children":[{"type":"text","value":"Understanding How Inhibitors Function","position":{"start":{"line":30,"column":4,"offset":1687},"end":{"line":30,"column":41,"offset":1724},"indent":[]}}],"position":{"start":{"line":30,"column":1,"offset":1684},"end":{"line":30,"column":41,"offset":1724},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"To block a command you have to return a truthy value.","position":{"start":{"line":32,"column":1,"offset":1726},"end":{"line":32,"column":54,"offset":1779},"indent":[]}}],"position":{"start":{"line":32,"column":1,"offset":1726},"end":{"line":32,"column":54,"offset":1779},"indent":[]}},{"type":"list","ordered":false,"start":null,"spread":false,"children":[{"type":"listItem","spread":false,"checked":null,"children":[{"type":"paragraph","children":[{"type":"strong","children":[{"type":"text","value":"return true;","position":{"start":{"line":33,"column":5,"offset":1784},"end":{"line":33,"column":17,"offset":1796},"indent":[]}}],"position":{"start":{"line":33,"column":3,"offset":1782},"end":{"line":33,"column":19,"offset":1798},"indent":[]}},{"type":"text","value":" If you return true the inhibitor will block the execution of the command.\nTo allow a command return a falsey value.","position":{"start":{"line":33,"column":19,"offset":1798},"end":{"line":34,"column":42,"offset":1914},"indent":[1]}}],"position":{"start":{"line":33,"column":3,"offset":1782},"end":{"line":34,"column":42,"offset":1914},"indent":[1]}}],"position":{"start":{"line":33,"column":1,"offset":1780},"end":{"line":34,"column":42,"offset":1914},"indent":[1]}},{"type":"listItem","spread":false,"checked":null,"children":[{"type":"paragraph","children":[{"type":"strong","children":[{"type":"text","value":"return false;","position":{"start":{"line":35,"column":5,"offset":1919},"end":{"line":35,"column":18,"offset":1932},"indent":[]}}],"position":{"start":{"line":35,"column":3,"offset":1917},"end":{"line":35,"column":20,"offset":1934},"indent":[]}},{"type":"text","value":" If you return false the inhibitor will not block the error.","position":{"start":{"line":35,"column":20,"offset":1934},"end":{"line":35,"column":80,"offset":1994},"indent":[]}}],"position":{"start":{"line":35,"column":3,"offset":1917},"end":{"line":35,"column":80,"offset":1994},"indent":[]}}],"position":{"start":{"line":35,"column":1,"offset":1915},"end":{"line":35,"column":80,"offset":1994},"indent":[]}}],"position":{"start":{"line":33,"column":1,"offset":1780},"end":{"line":35,"column":80,"offset":1994},"indent":[1,1]}},{"type":"code","lang":"ts","meta":null,"value":"// If the command is not VIP only we can allow this command to execute\nif (!command.vipOnly) return false;\n\n// Check if the user is VIP\nconst userIsVIP = await isUserVIP()\n// The user is VIP so we can allow this command to be used\nif (userIsVIP) return false;\n\n// The user is NOT VIP so we throw an error\nthrow `The ${command.name} is only allowed for VIP users.`","position":{"start":{"line":38,"column":1,"offset":1997},"end":{"line":49,"column":4,"offset":2370},"indent":[1,1,1,1,1,1,1,1,1,1,1]}},{"type":"export","value":"export const _frontmatter = {\"title\":\"Creating Inhibitors!\",\"metaTitle\":\"Creating An Inhibitor | Discordeno\",\"metaDescription\":\"Let's create our very own bot with Discordeno!\"}","position":{"start":{"line":52,"column":1,"offset":2373},"end":{"line":52,"column":177,"offset":2549},"indent":[]}}],"position":{"start":{"line":1,"column":1,"offset":0},"end":{"line":52,"column":177,"offset":2549}}},"scopeImports":["import * as React from 'react'"],"scopeIdentifiers":["React"],"body":"function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }\n\nfunction _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }\n\nfunction _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }\n\n/* @jsx mdx */\nvar _frontmatter = {\n \"title\": \"Creating Inhibitors!\",\n \"metaTitle\": \"Creating An Inhibitor | Discordeno\",\n \"metaDescription\": \"Let's create our very own bot with Discordeno!\"\n};\nvar layoutProps = {\n _frontmatter: _frontmatter\n};\nvar MDXLayout = \"wrapper\";\nreturn function MDXContent(_ref) {\n var components = _ref.components,\n props = _objectWithoutProperties(_ref, [\"components\"]);\n\n return mdx(MDXLayout, _extends({}, layoutProps, props, {\n components: components,\n mdxType: \"MDXLayout\"\n }), mdx(\"p\", null, \"Woah! You are almost half way done with understanding all of Discordeno. Amazing isn't it? Something you may have noticed in the last section was there were some options that prevented some commands from running like \", mdx(\"inlineCode\", {\n parentName: \"p\"\n }, \"dmOnly\"), \" or the permission options. we created a setting to prevent the monitor from running in certain channels. What if we wanted to do prevent commands from happening? How would we prevent commands from running?\"), mdx(\"h2\", null, \"What is an Inhibitor?\"), mdx(\"p\", null, \"An Inhibitor is very similar to how monitors work. A monitor runs on every message but an inhibitor runs on every command. Remember all those command options like cooldown, permissions, permissionLevel, nsfw, etc... Each and every one of these options has an inhibitor in that checks commands for these settings.\"), mdx(\"p\", null, \"Let's create our own inhibitor that would prevent commands from being used if the user is not a VIP user.\"), mdx(\"blockquote\", null, mdx(\"p\", {\n parentName: \"blockquote\"\n }, mdx(\"strong\", {\n parentName: \"p\"\n }, \"Note:\"), \" It is important to remember that everything below can be done with a simple permission level as well. We will create our own custom permission levels but for the purposes of this guide and to be able to learn about Inhibitors, we will be using an inhibitor.\")), mdx(\"h2\", null, \"Creating the File\"), mdx(\"p\", null, \"Let's start by creating a file inside the inhibitors folder called \", mdx(\"inlineCode\", {\n parentName: \"p\"\n }, \"vipOnly.ts\"), \" and paste the following snippet of code:\"), mdx(\"pre\", null, mdx(\"code\", _extends({\n parentName: \"pre\"\n }, {\n \"className\": \"language-ts\"\n }), \"import { botCache } from \\\"../../mod.ts\\\";\\n\\nbotCache.inhibitors.set(\\\"inhibitorname\\\", async function (message, command, guild) {\\n // Your code goes here\\n});\\n\")), mdx(\"p\", null, \"Inhibitors can take up to 3 arguments.\"), mdx(\"ul\", null, mdx(\"li\", {\n parentName: \"ul\"\n }, mdx(\"inlineCode\", {\n parentName: \"li\"\n }, \"message\"), \": The message object that triggered the command.\"), mdx(\"li\", {\n parentName: \"ul\"\n }, mdx(\"inlineCode\", {\n parentName: \"li\"\n }, \"command\"), \": The command object itself that was triggered.\"), mdx(\"li\", {\n parentName: \"ul\"\n }, mdx(\"inlineCode\", {\n parentName: \"li\"\n }, \"guild\"), \": The server guild object where this command was ran.\")), mdx(\"h2\", null, \"Understanding How Inhibitors Function\"), mdx(\"p\", null, \"To block a command you have to return a truthy value.\"), mdx(\"ul\", null, mdx(\"li\", {\n parentName: \"ul\"\n }, mdx(\"strong\", {\n parentName: \"li\"\n }, \"return true;\"), \" If you return true the inhibitor will block the execution of the command.\\nTo allow a command return a falsey value.\"), mdx(\"li\", {\n parentName: \"ul\"\n }, mdx(\"strong\", {\n parentName: \"li\"\n }, \"return false;\"), \" If you return false the inhibitor will not block the error.\")), mdx(\"pre\", null, mdx(\"code\", _extends({\n parentName: \"pre\"\n }, {\n \"className\": \"language-ts\"\n }), \"// If the command is not VIP only we can allow this command to execute\\nif (!command.vipOnly) return false;\\n\\n// Check if the user is VIP\\nconst userIsVIP = await isUserVIP()\\n// The user is VIP so we can allow this command to be used\\nif (userIsVIP) return false;\\n\\n// The user is NOT VIP so we throw an error\\nthrow `The ${command.name} is only allowed for VIP users.`\\n\")));\n}\n;\nMDXContent.isMDXComponent = true;","rawMDXOutput":"/* @jsx mdx */\nimport { mdx } from '@mdx-js/react';\n/* @jsx mdx */\n\nexport const _frontmatter = {\n \"title\": \"Creating Inhibitors!\",\n \"metaTitle\": \"Creating An Inhibitor | Discordeno\",\n \"metaDescription\": \"Let's create our very own bot with Discordeno!\"\n};\n\nconst layoutProps = {\n _frontmatter\n};\nconst MDXLayout = \"wrapper\"\nexport default function MDXContent({\n components,\n ...props\n}) {\n return \n

{`Woah! You are almost half way done with understanding all of Discordeno. Amazing isn't it? Something you may have noticed in the last section was there were some options that prevented some commands from running like `}{`dmOnly`}{` or the permission options. we created a setting to prevent the monitor from running in certain channels. What if we wanted to do prevent commands from happening? How would we prevent commands from running?`}

\n

{`What is an Inhibitor?`}

\n

{`An Inhibitor is very similar to how monitors work. A monitor runs on every message but an inhibitor runs on every command. Remember all those command options like cooldown, permissions, permissionLevel, nsfw, etc... Each and every one of these options has an inhibitor in that checks commands for these settings.`}

\n

{`Let's create our own inhibitor that would prevent commands from being used if the user is not a VIP user.`}

\n
\n

{`Note:`}{` It is important to remember that everything below can be done with a simple permission level as well. We will create our own custom permission levels but for the purposes of this guide and to be able to learn about Inhibitors, we will be using an inhibitor.`}

\n
\n

{`Creating the File`}

\n

{`Let's start by creating a file inside the inhibitors folder called `}{`vipOnly.ts`}{` and paste the following snippet of code:`}

\n
{`import { botCache } from \"../../mod.ts\";\n\nbotCache.inhibitors.set(\"inhibitorname\", async function (message, command, guild) {\n    // Your code goes here\n});\n`}
\n

{`Inhibitors can take up to 3 arguments.`}

\n
    \n
  • {`message`}{`: The message object that triggered the command.`}
  • \n
  • {`command`}{`: The command object itself that was triggered.`}
  • \n
  • {`guild`}{`: The server guild object where this command was ran.`}
  • \n
\n

{`Understanding How Inhibitors Function`}

\n

{`To block a command you have to return a truthy value.`}

\n
    \n
  • {`return true;`}{` If you return true the inhibitor will block the execution of the command.\nTo allow a command return a falsey value.`}
  • \n
  • {`return false;`}{` If you return false the inhibitor will not block the error.`}
  • \n
\n
{`// If the command is not VIP only we can allow this command to execute\nif (!command.vipOnly) return false;\n\n// Check if the user is VIP\nconst userIsVIP = await isUserVIP()\n// The user is VIP so we can allow this command to be used\nif (userIsVIP) return false;\n\n// The user is NOT VIP so we throw an error\nthrow \\`The \\${command.name} is only allowed for VIP users.\\`\n`}
\n\n
;\n}\n\n;\nMDXContent.isMDXComponent = true;"}} \ No newline at end of file diff --git a/docs/.cache/caches/gatsby-plugin-mdx/diskstore-e73d84b99c51e5e80c2727e4ec78d056.json b/docs/.cache/caches/gatsby-plugin-mdx/diskstore-e73d84b99c51e5e80c2727e4ec78d056.json new file mode 100644 index 000000000..6fe26ce69 --- /dev/null +++ b/docs/.cache/caches/gatsby-plugin-mdx/diskstore-e73d84b99c51e5e80c2727e4ec78d056.json @@ -0,0 +1 @@ +{"expireTime":9007200851635233000,"key":"gatsby-plugin-mdx-entire-payload-80e3f014223b0de84d4af05c5a2c0b6e-","val":{"mdast":{"type":"root","children":[{"type":"paragraph","children":[{"type":"text","value":"Woah! You are almost half way done with understanding all of Discordeno. Amazing isn't it? Something you may have noticed in the last section was when the bot started up you could see a bunch of messages like ","position":{"start":{"line":2,"column":1,"offset":1},"end":{"line":2,"column":210,"offset":210},"indent":[]}},{"type":"inlineCode","value":"Loaded X Commands","position":{"start":{"line":2,"column":210,"offset":210},"end":{"line":2,"column":229,"offset":229},"indent":[]}},{"type":"text","value":" and such. Let's jump into this part now and understand how event handling works in Discordeno.","position":{"start":{"line":2,"column":229,"offset":229},"end":{"line":2,"column":324,"offset":324},"indent":[]}}],"position":{"start":{"line":2,"column":1,"offset":1},"end":{"line":2,"column":324,"offset":324},"indent":[]}},{"type":"heading","depth":2,"children":[{"type":"text","value":"What Is An Event?","position":{"start":{"line":4,"column":4,"offset":329},"end":{"line":4,"column":21,"offset":346},"indent":[]}}],"position":{"start":{"line":4,"column":1,"offset":326},"end":{"line":4,"column":21,"offset":346},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"An event in Discordeno is a function that can be called when a specific event occurs. For the most part, events will usually be the ones that are available from Discordeno. However, you can create your own custom events as well if you wish.","position":{"start":{"line":6,"column":1,"offset":348},"end":{"line":6,"column":241,"offset":588},"indent":[]}}],"position":{"start":{"line":6,"column":1,"offset":348},"end":{"line":6,"column":241,"offset":588},"indent":[]}},{"type":"export","value":"export const _frontmatter = {\"title\":\"Creating Events!\",\"metaTitle\":\"Creating An Event | Discordeno\",\"metaDescription\":\"Let's create our very own bot with Discordeno!\"}","position":{"start":{"line":9,"column":1,"offset":591},"end":{"line":9,"column":169,"offset":759},"indent":[]}}],"position":{"start":{"line":1,"column":1,"offset":0},"end":{"line":9,"column":169,"offset":759}}},"scopeImports":["import * as React from 'react'"],"scopeIdentifiers":["React"],"body":"function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }\n\nfunction _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }\n\nfunction _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }\n\n/* @jsx mdx */\nvar _frontmatter = {\n \"title\": \"Creating Events!\",\n \"metaTitle\": \"Creating An Event | Discordeno\",\n \"metaDescription\": \"Let's create our very own bot with Discordeno!\"\n};\nvar layoutProps = {\n _frontmatter: _frontmatter\n};\nvar MDXLayout = \"wrapper\";\nreturn function MDXContent(_ref) {\n var components = _ref.components,\n props = _objectWithoutProperties(_ref, [\"components\"]);\n\n return mdx(MDXLayout, _extends({}, layoutProps, props, {\n components: components,\n mdxType: \"MDXLayout\"\n }), mdx(\"p\", null, \"Woah! You are almost half way done with understanding all of Discordeno. Amazing isn't it? Something you may have noticed in the last section was when the bot started up you could see a bunch of messages like \", mdx(\"inlineCode\", {\n parentName: \"p\"\n }, \"Loaded X Commands\"), \" and such. Let's jump into this part now and understand how event handling works in Discordeno.\"), mdx(\"h2\", null, \"What Is An Event?\"), mdx(\"p\", null, \"An event in Discordeno is a function that can be called when a specific event occurs. For the most part, events will usually be the ones that are available from Discordeno. However, you can create your own custom events as well if you wish.\"));\n}\n;\nMDXContent.isMDXComponent = true;","rawMDXOutput":"/* @jsx mdx */\nimport { mdx } from '@mdx-js/react';\n/* @jsx mdx */\n\nexport const _frontmatter = {\n \"title\": \"Creating Events!\",\n \"metaTitle\": \"Creating An Event | Discordeno\",\n \"metaDescription\": \"Let's create our very own bot with Discordeno!\"\n};\n\nconst layoutProps = {\n _frontmatter\n};\nconst MDXLayout = \"wrapper\"\nexport default function MDXContent({\n components,\n ...props\n}) {\n return \n

{`Woah! You are almost half way done with understanding all of Discordeno. Amazing isn't it? Something you may have noticed in the last section was when the bot started up you could see a bunch of messages like `}{`Loaded X Commands`}{` and such. Let's jump into this part now and understand how event handling works in Discordeno.`}

\n

{`What Is An Event?`}

\n

{`An event in Discordeno is a function that can be called when a specific event occurs. For the most part, events will usually be the ones that are available from Discordeno. However, you can create your own custom events as well if you wish.`}

\n\n
;\n}\n\n;\nMDXContent.isMDXComponent = true;"}} \ No newline at end of file diff --git a/docs/.cache/caches/gatsby-plugin-mdx/diskstore-e7eb20663aa447727162e1101ea1f493.json b/docs/.cache/caches/gatsby-plugin-mdx/diskstore-e7eb20663aa447727162e1101ea1f493.json new file mode 100644 index 000000000..1e4c65ba7 --- /dev/null +++ b/docs/.cache/caches/gatsby-plugin-mdx/diskstore-e7eb20663aa447727162e1101ea1f493.json @@ -0,0 +1 @@ +{"expireTime":9007200851634231000,"key":"gatsby-plugin-mdx-entire-payload-379b3ebfea36422429845daf6b1bbed6-","val":{"mdast":{"type":"root","children":[{"type":"paragraph","children":[{"type":"text","value":"Woah! You are almost half way done with understanding all of Discordeno. Amazing isn't it? Something you may have noticed in the last section was there were some options that prevented some commands from running like ","position":{"start":{"line":2,"column":1,"offset":1},"end":{"line":2,"column":218,"offset":218},"indent":[]}},{"type":"inlineCode","value":"dmOnly","position":{"start":{"line":2,"column":218,"offset":218},"end":{"line":2,"column":226,"offset":226},"indent":[]}},{"type":"text","value":" or the permission options. we created a setting to prevent the monitor from running in certain channels. What if we wanted to do prevent commands from happening? How would we prevent commands from running?","position":{"start":{"line":2,"column":226,"offset":226},"end":{"line":2,"column":432,"offset":432},"indent":[]}}],"position":{"start":{"line":2,"column":1,"offset":1},"end":{"line":2,"column":432,"offset":432},"indent":[]}},{"type":"heading","depth":2,"children":[{"type":"text","value":"What is an Inhibitor?","position":{"start":{"line":4,"column":4,"offset":437},"end":{"line":4,"column":25,"offset":458},"indent":[]}}],"position":{"start":{"line":4,"column":1,"offset":434},"end":{"line":4,"column":25,"offset":458},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"An Inhibitor is very similar to how monitors work. A monitor runs on every message but an inhibitor runs on every command. Remember all those command options like cooldown, permissions, permissionLevel, nsfw, etc... Each and every one of these options has an inhibitor in that checks commands for these settings.","position":{"start":{"line":6,"column":1,"offset":460},"end":{"line":6,"column":313,"offset":772},"indent":[]}}],"position":{"start":{"line":6,"column":1,"offset":460},"end":{"line":6,"column":313,"offset":772},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"Let's create our own inhibitor that would prevent commands from being used if the user is not a VIP user.","position":{"start":{"line":8,"column":1,"offset":774},"end":{"line":8,"column":106,"offset":879},"indent":[]}}],"position":{"start":{"line":8,"column":1,"offset":774},"end":{"line":8,"column":106,"offset":879},"indent":[]}},{"type":"blockquote","children":[{"type":"paragraph","children":[{"type":"strong","children":[{"type":"text","value":"Note:","position":{"start":{"line":10,"column":5,"offset":885},"end":{"line":10,"column":10,"offset":890},"indent":[]}}],"position":{"start":{"line":10,"column":3,"offset":883},"end":{"line":10,"column":12,"offset":892},"indent":[]}},{"type":"text","value":" It is important to remember that everything below can be done with a simple permission level as well. We will create our own custom permission levels but for the purposes of this guide and to be able to learn about Inhibitors, we will be using an inhibitor.","position":{"start":{"line":10,"column":12,"offset":892},"end":{"line":10,"column":270,"offset":1150},"indent":[]}}],"position":{"start":{"line":10,"column":3,"offset":883},"end":{"line":10,"column":270,"offset":1150},"indent":[]}}],"position":{"start":{"line":10,"column":1,"offset":881},"end":{"line":10,"column":270,"offset":1150},"indent":[]}},{"type":"heading","depth":2,"children":[{"type":"text","value":"Creating the File","position":{"start":{"line":12,"column":4,"offset":1155},"end":{"line":12,"column":21,"offset":1172},"indent":[]}}],"position":{"start":{"line":12,"column":1,"offset":1152},"end":{"line":12,"column":21,"offset":1172},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"Let's start by creating a file inside the inhibitors folder called ","position":{"start":{"line":14,"column":1,"offset":1174},"end":{"line":14,"column":68,"offset":1241},"indent":[]}},{"type":"inlineCode","value":"boosted.ts","position":{"start":{"line":14,"column":68,"offset":1241},"end":{"line":14,"column":80,"offset":1253},"indent":[]}},{"type":"text","value":" and paste the following snippet of code:","position":{"start":{"line":14,"column":80,"offset":1253},"end":{"line":14,"column":121,"offset":1294},"indent":[]}}],"position":{"start":{"line":14,"column":1,"offset":1174},"end":{"line":14,"column":121,"offset":1294},"indent":[]}},{"type":"code","lang":"ts","meta":null,"value":"import { botCache } from \"../../mod.ts\";\n\nbotCache.inhibitors.set(\"inhibitorname\", async function (message, command, guild) {\n\t// Your code goes here\n});","position":{"start":{"line":16,"column":1,"offset":1296},"end":{"line":22,"column":4,"offset":1459},"indent":[1,1,1,1,1,1]}},{"type":"paragraph","children":[{"type":"text","value":"Inhibitors can take up to 3 arguments.","position":{"start":{"line":24,"column":1,"offset":1461},"end":{"line":24,"column":39,"offset":1499},"indent":[]}}],"position":{"start":{"line":24,"column":1,"offset":1461},"end":{"line":24,"column":39,"offset":1499},"indent":[]}},{"type":"list","ordered":false,"start":null,"spread":false,"children":[{"type":"listItem","spread":false,"checked":null,"children":[{"type":"paragraph","children":[{"type":"inlineCode","value":"message","position":{"start":{"line":26,"column":3,"offset":1503},"end":{"line":26,"column":12,"offset":1512},"indent":[]}},{"type":"text","value":": The message object that triggered the command.","position":{"start":{"line":26,"column":12,"offset":1512},"end":{"line":26,"column":60,"offset":1560},"indent":[]}}],"position":{"start":{"line":26,"column":3,"offset":1503},"end":{"line":26,"column":60,"offset":1560},"indent":[]}}],"position":{"start":{"line":26,"column":1,"offset":1501},"end":{"line":26,"column":60,"offset":1560},"indent":[]}},{"type":"listItem","spread":false,"checked":null,"children":[{"type":"paragraph","children":[{"type":"inlineCode","value":"command","position":{"start":{"line":27,"column":3,"offset":1563},"end":{"line":27,"column":12,"offset":1572},"indent":[]}},{"type":"text","value":": The command object itself that was triggered.","position":{"start":{"line":27,"column":12,"offset":1572},"end":{"line":27,"column":59,"offset":1619},"indent":[]}}],"position":{"start":{"line":27,"column":3,"offset":1563},"end":{"line":27,"column":59,"offset":1619},"indent":[]}}],"position":{"start":{"line":27,"column":1,"offset":1561},"end":{"line":27,"column":59,"offset":1619},"indent":[]}},{"type":"listItem","spread":false,"checked":null,"children":[{"type":"paragraph","children":[{"type":"inlineCode","value":"guild","position":{"start":{"line":28,"column":3,"offset":1622},"end":{"line":28,"column":10,"offset":1629},"indent":[]}},{"type":"text","value":": The server guild object where this command was ran.","position":{"start":{"line":28,"column":10,"offset":1629},"end":{"line":28,"column":63,"offset":1682},"indent":[]}}],"position":{"start":{"line":28,"column":3,"offset":1622},"end":{"line":28,"column":63,"offset":1682},"indent":[]}}],"position":{"start":{"line":28,"column":1,"offset":1620},"end":{"line":28,"column":63,"offset":1682},"indent":[]}}],"position":{"start":{"line":26,"column":1,"offset":1501},"end":{"line":28,"column":63,"offset":1682},"indent":[1,1]}},{"type":"heading","depth":2,"children":[{"type":"text","value":"Understanding How Inhibitors Function","position":{"start":{"line":30,"column":4,"offset":1687},"end":{"line":30,"column":41,"offset":1724},"indent":[]}}],"position":{"start":{"line":30,"column":1,"offset":1684},"end":{"line":30,"column":41,"offset":1724},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"To block a command you have to return a truthy value.","position":{"start":{"line":32,"column":1,"offset":1726},"end":{"line":32,"column":54,"offset":1779},"indent":[]}}],"position":{"start":{"line":32,"column":1,"offset":1726},"end":{"line":32,"column":54,"offset":1779},"indent":[]}},{"type":"list","ordered":false,"start":null,"spread":false,"children":[{"type":"listItem","spread":false,"checked":null,"children":[{"type":"paragraph","children":[{"type":"strong","children":[{"type":"text","value":"return true;","position":{"start":{"line":33,"column":5,"offset":1784},"end":{"line":33,"column":17,"offset":1796},"indent":[]}}],"position":{"start":{"line":33,"column":3,"offset":1782},"end":{"line":33,"column":19,"offset":1798},"indent":[]}},{"type":"text","value":" If you return true the inhibitor will block the execution of the command.\nTo allow a command return a falsey value.","position":{"start":{"line":33,"column":19,"offset":1798},"end":{"line":34,"column":42,"offset":1914},"indent":[1]}}],"position":{"start":{"line":33,"column":3,"offset":1782},"end":{"line":34,"column":42,"offset":1914},"indent":[1]}}],"position":{"start":{"line":33,"column":1,"offset":1780},"end":{"line":34,"column":42,"offset":1914},"indent":[1]}},{"type":"listItem","spread":false,"checked":null,"children":[{"type":"paragraph","children":[{"type":"strong","children":[{"type":"text","value":"return false;","position":{"start":{"line":35,"column":5,"offset":1919},"end":{"line":35,"column":18,"offset":1932},"indent":[]}}],"position":{"start":{"line":35,"column":3,"offset":1917},"end":{"line":35,"column":20,"offset":1934},"indent":[]}},{"type":"text","value":" If you return false the inhibitor will not block the error.","position":{"start":{"line":35,"column":20,"offset":1934},"end":{"line":35,"column":80,"offset":1994},"indent":[]}}],"position":{"start":{"line":35,"column":3,"offset":1917},"end":{"line":35,"column":80,"offset":1994},"indent":[]}}],"position":{"start":{"line":35,"column":1,"offset":1915},"end":{"line":35,"column":80,"offset":1994},"indent":[]}}],"position":{"start":{"line":33,"column":1,"offset":1780},"end":{"line":35,"column":80,"offset":1994},"indent":[1,1]}},{"type":"code","lang":"ts","meta":null,"value":"// If the command is not VIP only we can allow this command to execute\nif (!command.vipOnly) return false;\n\n// The bot's support server\nconst guild = cache.guilds.get(configs.supportServerID);\n// If the command author is not in the server they won't have the vip role\nconst member = guild.members.get(message.author.id) || await getMember(guild.id, message.author.id);\n// Member doesn't exist so cancel the command\nif (!member) return true;\n\n// Check if the user has the vip role on the support server given by patreon\n// The user is VIP so we can allow this command to be used\nif (userIsVIP) return false;\n\n// The user is NOT VIP so we throw an error\nthrow `The ${command.name} is only allowed for VIP users.`","position":{"start":{"line":38,"column":1,"offset":1997},"end":{"line":55,"column":4,"offset":2717},"indent":[1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1]}},{"type":"export","value":"export const _frontmatter = {\"title\":\"Creating Inhibitors!\",\"metaTitle\":\"Creating An Inhibitor | Discordeno\",\"metaDescription\":\"Let's create our very own bot with Discordeno!\"}","position":{"start":{"line":58,"column":1,"offset":2720},"end":{"line":58,"column":177,"offset":2896},"indent":[]}}],"position":{"start":{"line":1,"column":1,"offset":0},"end":{"line":58,"column":177,"offset":2896}}},"scopeImports":["import * as React from 'react'"],"scopeIdentifiers":["React"],"body":"function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }\n\nfunction _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }\n\nfunction _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }\n\n/* @jsx mdx */\nvar _frontmatter = {\n \"title\": \"Creating Inhibitors!\",\n \"metaTitle\": \"Creating An Inhibitor | Discordeno\",\n \"metaDescription\": \"Let's create our very own bot with Discordeno!\"\n};\nvar layoutProps = {\n _frontmatter: _frontmatter\n};\nvar MDXLayout = \"wrapper\";\nreturn function MDXContent(_ref) {\n var components = _ref.components,\n props = _objectWithoutProperties(_ref, [\"components\"]);\n\n return mdx(MDXLayout, _extends({}, layoutProps, props, {\n components: components,\n mdxType: \"MDXLayout\"\n }), mdx(\"p\", null, \"Woah! You are almost half way done with understanding all of Discordeno. Amazing isn't it? Something you may have noticed in the last section was there were some options that prevented some commands from running like \", mdx(\"inlineCode\", {\n parentName: \"p\"\n }, \"dmOnly\"), \" or the permission options. we created a setting to prevent the monitor from running in certain channels. What if we wanted to do prevent commands from happening? How would we prevent commands from running?\"), mdx(\"h2\", null, \"What is an Inhibitor?\"), mdx(\"p\", null, \"An Inhibitor is very similar to how monitors work. A monitor runs on every message but an inhibitor runs on every command. Remember all those command options like cooldown, permissions, permissionLevel, nsfw, etc... Each and every one of these options has an inhibitor in that checks commands for these settings.\"), mdx(\"p\", null, \"Let's create our own inhibitor that would prevent commands from being used if the user is not a VIP user.\"), mdx(\"blockquote\", null, mdx(\"p\", {\n parentName: \"blockquote\"\n }, mdx(\"strong\", {\n parentName: \"p\"\n }, \"Note:\"), \" It is important to remember that everything below can be done with a simple permission level as well. We will create our own custom permission levels but for the purposes of this guide and to be able to learn about Inhibitors, we will be using an inhibitor.\")), mdx(\"h2\", null, \"Creating the File\"), mdx(\"p\", null, \"Let's start by creating a file inside the inhibitors folder called \", mdx(\"inlineCode\", {\n parentName: \"p\"\n }, \"boosted.ts\"), \" and paste the following snippet of code:\"), mdx(\"pre\", null, mdx(\"code\", _extends({\n parentName: \"pre\"\n }, {\n \"className\": \"language-ts\"\n }), \"import { botCache } from \\\"../../mod.ts\\\";\\n\\nbotCache.inhibitors.set(\\\"inhibitorname\\\", async function (message, command, guild) {\\n // Your code goes here\\n});\\n\")), mdx(\"p\", null, \"Inhibitors can take up to 3 arguments.\"), mdx(\"ul\", null, mdx(\"li\", {\n parentName: \"ul\"\n }, mdx(\"inlineCode\", {\n parentName: \"li\"\n }, \"message\"), \": The message object that triggered the command.\"), mdx(\"li\", {\n parentName: \"ul\"\n }, mdx(\"inlineCode\", {\n parentName: \"li\"\n }, \"command\"), \": The command object itself that was triggered.\"), mdx(\"li\", {\n parentName: \"ul\"\n }, mdx(\"inlineCode\", {\n parentName: \"li\"\n }, \"guild\"), \": The server guild object where this command was ran.\")), mdx(\"h2\", null, \"Understanding How Inhibitors Function\"), mdx(\"p\", null, \"To block a command you have to return a truthy value.\"), mdx(\"ul\", null, mdx(\"li\", {\n parentName: \"ul\"\n }, mdx(\"strong\", {\n parentName: \"li\"\n }, \"return true;\"), \" If you return true the inhibitor will block the execution of the command.\\nTo allow a command return a falsey value.\"), mdx(\"li\", {\n parentName: \"ul\"\n }, mdx(\"strong\", {\n parentName: \"li\"\n }, \"return false;\"), \" If you return false the inhibitor will not block the error.\")), mdx(\"pre\", null, mdx(\"code\", _extends({\n parentName: \"pre\"\n }, {\n \"className\": \"language-ts\"\n }), \"// If the command is not VIP only we can allow this command to execute\\nif (!command.vipOnly) return false;\\n\\n// The bot's support server\\nconst guild = cache.guilds.get(configs.supportServerID);\\n// If the command author is not in the server they won't have the vip role\\nconst member = guild.members.get(message.author.id) || await getMember(guild.id, message.author.id);\\n// Member doesn't exist so cancel the command\\nif (!member) return true;\\n\\n// Check if the user has the vip role on the support server given by patreon\\n// The user is VIP so we can allow this command to be used\\nif (userIsVIP) return false;\\n\\n// The user is NOT VIP so we throw an error\\nthrow `The ${command.name} is only allowed for VIP users.`\\n\")));\n}\n;\nMDXContent.isMDXComponent = true;","rawMDXOutput":"/* @jsx mdx */\nimport { mdx } from '@mdx-js/react';\n/* @jsx mdx */\n\nexport const _frontmatter = {\n \"title\": \"Creating Inhibitors!\",\n \"metaTitle\": \"Creating An Inhibitor | Discordeno\",\n \"metaDescription\": \"Let's create our very own bot with Discordeno!\"\n};\n\nconst layoutProps = {\n _frontmatter\n};\nconst MDXLayout = \"wrapper\"\nexport default function MDXContent({\n components,\n ...props\n}) {\n return \n

{`Woah! You are almost half way done with understanding all of Discordeno. Amazing isn't it? Something you may have noticed in the last section was there were some options that prevented some commands from running like `}{`dmOnly`}{` or the permission options. we created a setting to prevent the monitor from running in certain channels. What if we wanted to do prevent commands from happening? How would we prevent commands from running?`}

\n

{`What is an Inhibitor?`}

\n

{`An Inhibitor is very similar to how monitors work. A monitor runs on every message but an inhibitor runs on every command. Remember all those command options like cooldown, permissions, permissionLevel, nsfw, etc... Each and every one of these options has an inhibitor in that checks commands for these settings.`}

\n

{`Let's create our own inhibitor that would prevent commands from being used if the user is not a VIP user.`}

\n
\n

{`Note:`}{` It is important to remember that everything below can be done with a simple permission level as well. We will create our own custom permission levels but for the purposes of this guide and to be able to learn about Inhibitors, we will be using an inhibitor.`}

\n
\n

{`Creating the File`}

\n

{`Let's start by creating a file inside the inhibitors folder called `}{`boosted.ts`}{` and paste the following snippet of code:`}

\n
{`import { botCache } from \"../../mod.ts\";\n\nbotCache.inhibitors.set(\"inhibitorname\", async function (message, command, guild) {\n    // Your code goes here\n});\n`}
\n

{`Inhibitors can take up to 3 arguments.`}

\n
    \n
  • {`message`}{`: The message object that triggered the command.`}
  • \n
  • {`command`}{`: The command object itself that was triggered.`}
  • \n
  • {`guild`}{`: The server guild object where this command was ran.`}
  • \n
\n

{`Understanding How Inhibitors Function`}

\n

{`To block a command you have to return a truthy value.`}

\n
    \n
  • {`return true;`}{` If you return true the inhibitor will block the execution of the command.\nTo allow a command return a falsey value.`}
  • \n
  • {`return false;`}{` If you return false the inhibitor will not block the error.`}
  • \n
\n
{`// If the command is not VIP only we can allow this command to execute\nif (!command.vipOnly) return false;\n\n// The bot's support server\nconst guild = cache.guilds.get(configs.supportServerID);\n// If the command author is not in the server they won't have the vip role\nconst member = guild.members.get(message.author.id) || await getMember(guild.id, message.author.id);\n// Member doesn't exist so cancel the command\nif (!member) return true;\n\n// Check if the user has the vip role on the support server given by patreon\n// The user is VIP so we can allow this command to be used\nif (userIsVIP) return false;\n\n// The user is NOT VIP so we throw an error\nthrow \\`The \\${command.name} is only allowed for VIP users.\\`\n`}
\n\n
;\n}\n\n;\nMDXContent.isMDXComponent = true;"}} \ No newline at end of file diff --git a/docs/.cache/caches/gatsby-plugin-mdx/diskstore-e83281e8c42e1a99e1e05084c8e3ff68.json b/docs/.cache/caches/gatsby-plugin-mdx/diskstore-e83281e8c42e1a99e1e05084c8e3ff68.json new file mode 100644 index 000000000..0a8e8d752 --- /dev/null +++ b/docs/.cache/caches/gatsby-plugin-mdx/diskstore-e83281e8c42e1a99e1e05084c8e3ff68.json @@ -0,0 +1 @@ +{"expireTime":9007200851634822000,"key":"gatsby-plugin-mdx-entire-payload-0cac71b4736528a83eb3c130be1fedee-","val":{"mdast":{"type":"root","children":[{"type":"paragraph","children":[{"type":"text","value":"Woah! You are almost half way done with understanding all of Discordeno. Amazing isn't it? Something you may have noticed in the last section was there were some options that prevented some commands from running like ","position":{"start":{"line":2,"column":1,"offset":1},"end":{"line":2,"column":218,"offset":218},"indent":[]}},{"type":"inlineCode","value":"dmOnly","position":{"start":{"line":2,"column":218,"offset":218},"end":{"line":2,"column":226,"offset":226},"indent":[]}},{"type":"text","value":" or the permission options. we created a setting to prevent the monitor from running in certain channels. What if we wanted to do prevent commands from happening? How would we prevent commands from running?","position":{"start":{"line":2,"column":226,"offset":226},"end":{"line":2,"column":432,"offset":432},"indent":[]}}],"position":{"start":{"line":2,"column":1,"offset":1},"end":{"line":2,"column":432,"offset":432},"indent":[]}},{"type":"heading","depth":2,"children":[{"type":"text","value":"What is an Inhibitor?","position":{"start":{"line":4,"column":4,"offset":437},"end":{"line":4,"column":25,"offset":458},"indent":[]}}],"position":{"start":{"line":4,"column":1,"offset":434},"end":{"line":4,"column":25,"offset":458},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"An Inhibitor is very similar to how monitors work. A monitor runs on every message but an inhibitor runs on every command. Remember all those command options like cooldown, permissions, permissionLevel, nsfw, etc... Each and every one of these options has an inhibitor in that checks commands for these settings.","position":{"start":{"line":6,"column":1,"offset":460},"end":{"line":6,"column":313,"offset":772},"indent":[]}}],"position":{"start":{"line":6,"column":1,"offset":460},"end":{"line":6,"column":313,"offset":772},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"Let's create our own inhibitor that would prevent commands from being used if the user is not a VIP user.","position":{"start":{"line":8,"column":1,"offset":774},"end":{"line":8,"column":106,"offset":879},"indent":[]}}],"position":{"start":{"line":8,"column":1,"offset":774},"end":{"line":8,"column":106,"offset":879},"indent":[]}},{"type":"blockquote","children":[{"type":"paragraph","children":[{"type":"strong","children":[{"type":"text","value":"Note:","position":{"start":{"line":10,"column":5,"offset":885},"end":{"line":10,"column":10,"offset":890},"indent":[]}}],"position":{"start":{"line":10,"column":3,"offset":883},"end":{"line":10,"column":12,"offset":892},"indent":[]}},{"type":"text","value":" It is important to remember that everything below can be done with a simple permission level as well. We will create our own custom permission levels but for the purposes of this guide and to be able to learn about Inhibitors, we will be using an inhibitor.","position":{"start":{"line":10,"column":12,"offset":892},"end":{"line":10,"column":270,"offset":1150},"indent":[]}}],"position":{"start":{"line":10,"column":3,"offset":883},"end":{"line":10,"column":270,"offset":1150},"indent":[]}}],"position":{"start":{"line":10,"column":1,"offset":881},"end":{"line":10,"column":270,"offset":1150},"indent":[]}},{"type":"heading","depth":2,"children":[{"type":"text","value":"Creating the File","position":{"start":{"line":12,"column":4,"offset":1155},"end":{"line":12,"column":21,"offset":1172},"indent":[]}}],"position":{"start":{"line":12,"column":1,"offset":1152},"end":{"line":12,"column":21,"offset":1172},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"Let's start by creating a file inside the inhibitors folder called ","position":{"start":{"line":14,"column":1,"offset":1174},"end":{"line":14,"column":68,"offset":1241},"indent":[]}},{"type":"inlineCode","value":"boosted.ts","position":{"start":{"line":14,"column":68,"offset":1241},"end":{"line":14,"column":80,"offset":1253},"indent":[]}},{"type":"text","value":" and paste the following snippet of code:","position":{"start":{"line":14,"column":80,"offset":1253},"end":{"line":14,"column":121,"offset":1294},"indent":[]}}],"position":{"start":{"line":14,"column":1,"offset":1174},"end":{"line":14,"column":121,"offset":1294},"indent":[]}},{"type":"code","lang":"ts","meta":null,"value":"import { botCache } from \"../../mod.ts\";\n\nbotCache.inhibitors.set(\"inhibitorname\", async function (message, command, guild) {\n\t// Your code goes here\n});","position":{"start":{"line":16,"column":1,"offset":1296},"end":{"line":22,"column":4,"offset":1459},"indent":[1,1,1,1,1,1]}},{"type":"paragraph","children":[{"type":"text","value":"Inhibitors can take up to 3 arguments.","position":{"start":{"line":24,"column":1,"offset":1461},"end":{"line":24,"column":39,"offset":1499},"indent":[]}}],"position":{"start":{"line":24,"column":1,"offset":1461},"end":{"line":24,"column":39,"offset":1499},"indent":[]}},{"type":"list","ordered":false,"start":null,"spread":false,"children":[{"type":"listItem","spread":false,"checked":null,"children":[{"type":"paragraph","children":[{"type":"inlineCode","value":"message","position":{"start":{"line":26,"column":3,"offset":1503},"end":{"line":26,"column":12,"offset":1512},"indent":[]}},{"type":"text","value":": The message object that triggered the command.","position":{"start":{"line":26,"column":12,"offset":1512},"end":{"line":26,"column":60,"offset":1560},"indent":[]}}],"position":{"start":{"line":26,"column":3,"offset":1503},"end":{"line":26,"column":60,"offset":1560},"indent":[]}}],"position":{"start":{"line":26,"column":1,"offset":1501},"end":{"line":26,"column":60,"offset":1560},"indent":[]}},{"type":"listItem","spread":false,"checked":null,"children":[{"type":"paragraph","children":[{"type":"inlineCode","value":"command","position":{"start":{"line":27,"column":3,"offset":1563},"end":{"line":27,"column":12,"offset":1572},"indent":[]}},{"type":"text","value":": The command object itself that was triggered.","position":{"start":{"line":27,"column":12,"offset":1572},"end":{"line":27,"column":59,"offset":1619},"indent":[]}}],"position":{"start":{"line":27,"column":3,"offset":1563},"end":{"line":27,"column":59,"offset":1619},"indent":[]}}],"position":{"start":{"line":27,"column":1,"offset":1561},"end":{"line":27,"column":59,"offset":1619},"indent":[]}},{"type":"listItem","spread":false,"checked":null,"children":[{"type":"paragraph","children":[{"type":"inlineCode","value":"guild","position":{"start":{"line":28,"column":3,"offset":1622},"end":{"line":28,"column":10,"offset":1629},"indent":[]}},{"type":"text","value":": The server guild object where this command was ran.","position":{"start":{"line":28,"column":10,"offset":1629},"end":{"line":28,"column":63,"offset":1682},"indent":[]}}],"position":{"start":{"line":28,"column":3,"offset":1622},"end":{"line":28,"column":63,"offset":1682},"indent":[]}}],"position":{"start":{"line":28,"column":1,"offset":1620},"end":{"line":28,"column":63,"offset":1682},"indent":[]}}],"position":{"start":{"line":26,"column":1,"offset":1501},"end":{"line":28,"column":63,"offset":1682},"indent":[1,1]}},{"type":"heading","depth":2,"children":[{"type":"text","value":"Understanding How Inhibitors Function","position":{"start":{"line":30,"column":4,"offset":1687},"end":{"line":30,"column":41,"offset":1724},"indent":[]}}],"position":{"start":{"line":30,"column":1,"offset":1684},"end":{"line":30,"column":41,"offset":1724},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"To block a command you have to return a truthy value.","position":{"start":{"line":32,"column":1,"offset":1726},"end":{"line":32,"column":54,"offset":1779},"indent":[]}}],"position":{"start":{"line":32,"column":1,"offset":1726},"end":{"line":32,"column":54,"offset":1779},"indent":[]}},{"type":"list","ordered":false,"start":null,"spread":false,"children":[{"type":"listItem","spread":false,"checked":null,"children":[{"type":"paragraph","children":[{"type":"strong","children":[{"type":"text","value":"return true;","position":{"start":{"line":33,"column":5,"offset":1784},"end":{"line":33,"column":17,"offset":1796},"indent":[]}}],"position":{"start":{"line":33,"column":3,"offset":1782},"end":{"line":33,"column":19,"offset":1798},"indent":[]}},{"type":"text","value":" If you return true the inhibitor will block the execution of the command.\nTo allow a command return a falsey value.","position":{"start":{"line":33,"column":19,"offset":1798},"end":{"line":34,"column":42,"offset":1914},"indent":[1]}}],"position":{"start":{"line":33,"column":3,"offset":1782},"end":{"line":34,"column":42,"offset":1914},"indent":[1]}}],"position":{"start":{"line":33,"column":1,"offset":1780},"end":{"line":34,"column":42,"offset":1914},"indent":[1]}},{"type":"listItem","spread":false,"checked":null,"children":[{"type":"paragraph","children":[{"type":"strong","children":[{"type":"text","value":"return false;","position":{"start":{"line":35,"column":5,"offset":1919},"end":{"line":35,"column":18,"offset":1932},"indent":[]}}],"position":{"start":{"line":35,"column":3,"offset":1917},"end":{"line":35,"column":20,"offset":1934},"indent":[]}},{"type":"text","value":" If you return false the inhibitor will not block the error.","position":{"start":{"line":35,"column":20,"offset":1934},"end":{"line":35,"column":80,"offset":1994},"indent":[]}}],"position":{"start":{"line":35,"column":3,"offset":1917},"end":{"line":35,"column":80,"offset":1994},"indent":[]}}],"position":{"start":{"line":35,"column":1,"offset":1915},"end":{"line":35,"column":80,"offset":1994},"indent":[]}}],"position":{"start":{"line":33,"column":1,"offset":1780},"end":{"line":35,"column":80,"offset":1994},"indent":[1,1]}},{"type":"code","lang":"ts","meta":null,"value":"// If the command is not VIP only we can allow this command to execute\nif (!command.vipOnly) return false;\n\n// The bot's support server\nconst guild = cache.guilds.get(configs.supportServerID);\n// If the command author is not in the server they won't have the vip role\nconst member = guild.members.get(message.author.id) || await getMember(guild.id, message.author.id);\n// Member doesn't exist so cancel the command\nif (!member) {\n\tsendResponse(message, `sorry, but you can not use this command until you become VIP. **Close the IRIS!!!**`)\n\treturn true;\n}\n\n// If the user has the vip role on the support server given by patreon allow the command\nif (member.roles.includes(configs.roleIDs.patreonVIPRoleID)) return false;\n\n// Alert the user they don't have vip and can't use the command\nsendResponse(message, `sorry, but you can not use this command until you become a VIP. I'm sorry, Teal'c. We'll go to Disneyland next year. I promise.`)\n// Cancel the command since the user does not have vip\nreturn true;","position":{"start":{"line":38,"column":1,"offset":1997},"end":{"line":59,"column":4,"offset":3013},"indent":[1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1]}},{"type":"heading","depth":2,"children":[{"type":"text","value":"Challenges","position":{"start":{"line":61,"column":4,"offset":3018},"end":{"line":61,"column":14,"offset":3028},"indent":[]}}],"position":{"start":{"line":61,"column":1,"offset":3015},"end":{"line":61,"column":14,"offset":3028},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"Hell yes! We just got through the entire inhibitor section. You have now mastered everything related to inhibitors.","position":{"start":{"line":63,"column":1,"offset":3030},"end":{"line":63,"column":116,"offset":3145},"indent":[]}}],"position":{"start":{"line":63,"column":1,"offset":3030},"end":{"line":63,"column":116,"offset":3145},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"You can now try and get a little more practice with inhibitors by trying to challenge yourself and make your own inhibitors. Don't worry if you can't think of any good use cases for inhibitors.","position":{"start":{"line":65,"column":1,"offset":3147},"end":{"line":65,"column":194,"offset":3340},"indent":[]}}],"position":{"start":{"line":65,"column":1,"offset":3147},"end":{"line":65,"column":194,"offset":3340},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"Majority of Discordeno bots do not use many custom inhibitors because most of the necessary/important ones already come built for you.","position":{"start":{"line":67,"column":1,"offset":3342},"end":{"line":67,"column":135,"offset":3476},"indent":[]}}],"position":{"start":{"line":67,"column":1,"offset":3342},"end":{"line":67,"column":135,"offset":3476},"indent":[]}},{"type":"export","value":"export const _frontmatter = {\"title\":\"Creating Inhibitors!\",\"metaTitle\":\"Creating An Inhibitor | Discordeno\",\"metaDescription\":\"Let's create our very own bot with Discordeno!\"}","position":{"start":{"line":70,"column":1,"offset":3479},"end":{"line":70,"column":177,"offset":3655},"indent":[]}}],"position":{"start":{"line":1,"column":1,"offset":0},"end":{"line":70,"column":177,"offset":3655}}},"scopeImports":["import * as React from 'react'"],"scopeIdentifiers":["React"],"body":"function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }\n\nfunction _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }\n\nfunction _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }\n\n/* @jsx mdx */\nvar _frontmatter = {\n \"title\": \"Creating Inhibitors!\",\n \"metaTitle\": \"Creating An Inhibitor | Discordeno\",\n \"metaDescription\": \"Let's create our very own bot with Discordeno!\"\n};\nvar layoutProps = {\n _frontmatter: _frontmatter\n};\nvar MDXLayout = \"wrapper\";\nreturn function MDXContent(_ref) {\n var components = _ref.components,\n props = _objectWithoutProperties(_ref, [\"components\"]);\n\n return mdx(MDXLayout, _extends({}, layoutProps, props, {\n components: components,\n mdxType: \"MDXLayout\"\n }), mdx(\"p\", null, \"Woah! You are almost half way done with understanding all of Discordeno. Amazing isn't it? Something you may have noticed in the last section was there were some options that prevented some commands from running like \", mdx(\"inlineCode\", {\n parentName: \"p\"\n }, \"dmOnly\"), \" or the permission options. we created a setting to prevent the monitor from running in certain channels. What if we wanted to do prevent commands from happening? How would we prevent commands from running?\"), mdx(\"h2\", null, \"What is an Inhibitor?\"), mdx(\"p\", null, \"An Inhibitor is very similar to how monitors work. A monitor runs on every message but an inhibitor runs on every command. Remember all those command options like cooldown, permissions, permissionLevel, nsfw, etc... Each and every one of these options has an inhibitor in that checks commands for these settings.\"), mdx(\"p\", null, \"Let's create our own inhibitor that would prevent commands from being used if the user is not a VIP user.\"), mdx(\"blockquote\", null, mdx(\"p\", {\n parentName: \"blockquote\"\n }, mdx(\"strong\", {\n parentName: \"p\"\n }, \"Note:\"), \" It is important to remember that everything below can be done with a simple permission level as well. We will create our own custom permission levels but for the purposes of this guide and to be able to learn about Inhibitors, we will be using an inhibitor.\")), mdx(\"h2\", null, \"Creating the File\"), mdx(\"p\", null, \"Let's start by creating a file inside the inhibitors folder called \", mdx(\"inlineCode\", {\n parentName: \"p\"\n }, \"boosted.ts\"), \" and paste the following snippet of code:\"), mdx(\"pre\", null, mdx(\"code\", _extends({\n parentName: \"pre\"\n }, {\n \"className\": \"language-ts\"\n }), \"import { botCache } from \\\"../../mod.ts\\\";\\n\\nbotCache.inhibitors.set(\\\"inhibitorname\\\", async function (message, command, guild) {\\n // Your code goes here\\n});\\n\")), mdx(\"p\", null, \"Inhibitors can take up to 3 arguments.\"), mdx(\"ul\", null, mdx(\"li\", {\n parentName: \"ul\"\n }, mdx(\"inlineCode\", {\n parentName: \"li\"\n }, \"message\"), \": The message object that triggered the command.\"), mdx(\"li\", {\n parentName: \"ul\"\n }, mdx(\"inlineCode\", {\n parentName: \"li\"\n }, \"command\"), \": The command object itself that was triggered.\"), mdx(\"li\", {\n parentName: \"ul\"\n }, mdx(\"inlineCode\", {\n parentName: \"li\"\n }, \"guild\"), \": The server guild object where this command was ran.\")), mdx(\"h2\", null, \"Understanding How Inhibitors Function\"), mdx(\"p\", null, \"To block a command you have to return a truthy value.\"), mdx(\"ul\", null, mdx(\"li\", {\n parentName: \"ul\"\n }, mdx(\"strong\", {\n parentName: \"li\"\n }, \"return true;\"), \" If you return true the inhibitor will block the execution of the command.\\nTo allow a command return a falsey value.\"), mdx(\"li\", {\n parentName: \"ul\"\n }, mdx(\"strong\", {\n parentName: \"li\"\n }, \"return false;\"), \" If you return false the inhibitor will not block the error.\")), mdx(\"pre\", null, mdx(\"code\", _extends({\n parentName: \"pre\"\n }, {\n \"className\": \"language-ts\"\n }), \"// If the command is not VIP only we can allow this command to execute\\nif (!command.vipOnly) return false;\\n\\n// The bot's support server\\nconst guild = cache.guilds.get(configs.supportServerID);\\n// If the command author is not in the server they won't have the vip role\\nconst member = guild.members.get(message.author.id) || await getMember(guild.id, message.author.id);\\n// Member doesn't exist so cancel the command\\nif (!member) {\\n sendResponse(message, `sorry, but you can not use this command until you become VIP. **Close the IRIS!!!**`)\\n return true;\\n}\\n\\n// If the user has the vip role on the support server given by patreon allow the command\\nif (member.roles.includes(configs.roleIDs.patreonVIPRoleID)) return false;\\n\\n// Alert the user they don't have vip and can't use the command\\nsendResponse(message, `sorry, but you can not use this command until you become a VIP. I'm sorry, Teal'c. We'll go to Disneyland next year. I promise.`)\\n// Cancel the command since the user does not have vip\\nreturn true;\\n\")), mdx(\"h2\", null, \"Challenges\"), mdx(\"p\", null, \"Hell yes! We just got through the entire inhibitor section. You have now mastered everything related to inhibitors.\"), mdx(\"p\", null, \"You can now try and get a little more practice with inhibitors by trying to challenge yourself and make your own inhibitors. Don't worry if you can't think of any good use cases for inhibitors.\"), mdx(\"p\", null, \"Majority of Discordeno bots do not use many custom inhibitors because most of the necessary/important ones already come built for you.\"));\n}\n;\nMDXContent.isMDXComponent = true;","rawMDXOutput":"/* @jsx mdx */\nimport { mdx } from '@mdx-js/react';\n/* @jsx mdx */\n\nexport const _frontmatter = {\n \"title\": \"Creating Inhibitors!\",\n \"metaTitle\": \"Creating An Inhibitor | Discordeno\",\n \"metaDescription\": \"Let's create our very own bot with Discordeno!\"\n};\n\nconst layoutProps = {\n _frontmatter\n};\nconst MDXLayout = \"wrapper\"\nexport default function MDXContent({\n components,\n ...props\n}) {\n return \n

{`Woah! You are almost half way done with understanding all of Discordeno. Amazing isn't it? Something you may have noticed in the last section was there were some options that prevented some commands from running like `}{`dmOnly`}{` or the permission options. we created a setting to prevent the monitor from running in certain channels. What if we wanted to do prevent commands from happening? How would we prevent commands from running?`}

\n

{`What is an Inhibitor?`}

\n

{`An Inhibitor is very similar to how monitors work. A monitor runs on every message but an inhibitor runs on every command. Remember all those command options like cooldown, permissions, permissionLevel, nsfw, etc... Each and every one of these options has an inhibitor in that checks commands for these settings.`}

\n

{`Let's create our own inhibitor that would prevent commands from being used if the user is not a VIP user.`}

\n
\n

{`Note:`}{` It is important to remember that everything below can be done with a simple permission level as well. We will create our own custom permission levels but for the purposes of this guide and to be able to learn about Inhibitors, we will be using an inhibitor.`}

\n
\n

{`Creating the File`}

\n

{`Let's start by creating a file inside the inhibitors folder called `}{`boosted.ts`}{` and paste the following snippet of code:`}

\n
{`import { botCache } from \"../../mod.ts\";\n\nbotCache.inhibitors.set(\"inhibitorname\", async function (message, command, guild) {\n    // Your code goes here\n});\n`}
\n

{`Inhibitors can take up to 3 arguments.`}

\n
    \n
  • {`message`}{`: The message object that triggered the command.`}
  • \n
  • {`command`}{`: The command object itself that was triggered.`}
  • \n
  • {`guild`}{`: The server guild object where this command was ran.`}
  • \n
\n

{`Understanding How Inhibitors Function`}

\n

{`To block a command you have to return a truthy value.`}

\n
    \n
  • {`return true;`}{` If you return true the inhibitor will block the execution of the command.\nTo allow a command return a falsey value.`}
  • \n
  • {`return false;`}{` If you return false the inhibitor will not block the error.`}
  • \n
\n
{`// If the command is not VIP only we can allow this command to execute\nif (!command.vipOnly) return false;\n\n// The bot's support server\nconst guild = cache.guilds.get(configs.supportServerID);\n// If the command author is not in the server they won't have the vip role\nconst member = guild.members.get(message.author.id) || await getMember(guild.id, message.author.id);\n// Member doesn't exist so cancel the command\nif (!member) {\n    sendResponse(message, \\`sorry, but you can not use this command until you become VIP. **Close the IRIS!!!**\\`)\n    return true;\n}\n\n// If the user has the vip role on the support server given by patreon allow the command\nif (member.roles.includes(configs.roleIDs.patreonVIPRoleID)) return false;\n\n// Alert the user they don't have vip and can't use the command\nsendResponse(message, \\`sorry, but you can not use this command until you become a VIP. I'm sorry, Teal'c. We'll go to Disneyland next year. I promise.\\`)\n// Cancel the command since the user does not have vip\nreturn true;\n`}
\n

{`Challenges`}

\n

{`Hell yes! We just got through the entire inhibitor section. You have now mastered everything related to inhibitors.`}

\n

{`You can now try and get a little more practice with inhibitors by trying to challenge yourself and make your own inhibitors. Don't worry if you can't think of any good use cases for inhibitors.`}

\n

{`Majority of Discordeno bots do not use many custom inhibitors because most of the necessary/important ones already come built for you.`}

\n\n
;\n}\n\n;\nMDXContent.isMDXComponent = true;"}} \ No newline at end of file diff --git a/docs/.cache/caches/gatsby-plugin-mdx/diskstore-e8eb02eb31fcf60a834e7ed5accb056c.json b/docs/.cache/caches/gatsby-plugin-mdx/diskstore-e8eb02eb31fcf60a834e7ed5accb056c.json new file mode 100644 index 000000000..878706727 --- /dev/null +++ b/docs/.cache/caches/gatsby-plugin-mdx/diskstore-e8eb02eb31fcf60a834e7ed5accb056c.json @@ -0,0 +1 @@ +{"expireTime":9007200851635126000,"key":"gatsby-plugin-mdx-entire-payload-50515ba051769367302caac3ef02adc7-","val":{"mdast":{"type":"root","children":[{"type":"paragraph","children":[{"type":"text","value":"Woah! You are almost half way done with understanding all of Discordeno. Amazing isn't it? Something you may have noticed in the last section was when the bot started up you could see a bunch of messages like ","position":{"start":{"line":2,"column":1,"offset":1},"end":{"line":2,"column":210,"offset":210},"indent":[]}},{"type":"inlineCode","value":"Loaded X Commands","position":{"start":{"line":2,"column":210,"offset":210},"end":{"line":2,"column":229,"offset":229},"indent":[]}},{"type":"text","value":" and such. ","position":{"start":{"line":2,"column":229,"offset":229},"end":{"line":2,"column":240,"offset":240},"indent":[]}}],"position":{"start":{"line":2,"column":1,"offset":1},"end":{"line":2,"column":240,"offset":240},"indent":[]}},{"type":"heading","depth":2,"children":[{"type":"text","value":"What Is An Event?","position":{"start":{"line":4,"column":4,"offset":245},"end":{"line":4,"column":21,"offset":262},"indent":[]}}],"position":{"start":{"line":4,"column":1,"offset":242},"end":{"line":4,"column":21,"offset":262},"indent":[]}},{"type":"export","value":"export const _frontmatter = {\"title\":\"Creating Events!\",\"metaTitle\":\"Creating An Event | Discordeno\",\"metaDescription\":\"Let's create our very own bot with Discordeno!\"}","position":{"start":{"line":8,"column":1,"offset":266},"end":{"line":8,"column":169,"offset":434},"indent":[]}}],"position":{"start":{"line":1,"column":1,"offset":0},"end":{"line":8,"column":169,"offset":434}}},"scopeImports":["import * as React from 'react'"],"scopeIdentifiers":["React"],"body":"function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }\n\nfunction _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }\n\nfunction _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }\n\n/* @jsx mdx */\nvar _frontmatter = {\n \"title\": \"Creating Events!\",\n \"metaTitle\": \"Creating An Event | Discordeno\",\n \"metaDescription\": \"Let's create our very own bot with Discordeno!\"\n};\nvar layoutProps = {\n _frontmatter: _frontmatter\n};\nvar MDXLayout = \"wrapper\";\nreturn function MDXContent(_ref) {\n var components = _ref.components,\n props = _objectWithoutProperties(_ref, [\"components\"]);\n\n return mdx(MDXLayout, _extends({}, layoutProps, props, {\n components: components,\n mdxType: \"MDXLayout\"\n }), mdx(\"p\", null, \"Woah! You are almost half way done with understanding all of Discordeno. Amazing isn't it? Something you may have noticed in the last section was when the bot started up you could see a bunch of messages like \", mdx(\"inlineCode\", {\n parentName: \"p\"\n }, \"Loaded X Commands\"), \" and such. \"), mdx(\"h2\", null, \"What Is An Event?\"));\n}\n;\nMDXContent.isMDXComponent = true;","rawMDXOutput":"/* @jsx mdx */\nimport { mdx } from '@mdx-js/react';\n/* @jsx mdx */\n\nexport const _frontmatter = {\n \"title\": \"Creating Events!\",\n \"metaTitle\": \"Creating An Event | Discordeno\",\n \"metaDescription\": \"Let's create our very own bot with Discordeno!\"\n};\n\nconst layoutProps = {\n _frontmatter\n};\nconst MDXLayout = \"wrapper\"\nexport default function MDXContent({\n components,\n ...props\n}) {\n return \n

{`Woah! You are almost half way done with understanding all of Discordeno. Amazing isn't it? Something you may have noticed in the last section was when the bot started up you could see a bunch of messages like `}{`Loaded X Commands`}{` and such. `}

\n

{`What Is An Event?`}

\n\n
;\n}\n\n;\nMDXContent.isMDXComponent = true;"}} \ No newline at end of file diff --git a/docs/.cache/caches/gatsby-plugin-mdx/diskstore-e9705a7a27256a83004607546e6c6337.json b/docs/.cache/caches/gatsby-plugin-mdx/diskstore-e9705a7a27256a83004607546e6c6337.json new file mode 100644 index 000000000..0091a7327 --- /dev/null +++ b/docs/.cache/caches/gatsby-plugin-mdx/diskstore-e9705a7a27256a83004607546e6c6337.json @@ -0,0 +1 @@ +{"expireTime":9007200851644190000,"key":"gatsby-plugin-mdx-entire-payload-fd86e5d8634e0ba6b783bdfe75b97a16-","val":{"mdast":{"type":"root","children":[{"type":"paragraph","children":[{"type":"text","value":"Discordeno will help make Discord bot development much easier. Don't worry, as you go through this guide it will make a lot more sense.","position":{"start":{"line":2,"column":1,"offset":1},"end":{"line":2,"column":136,"offset":136},"indent":[]}}],"position":{"start":{"line":2,"column":1,"offset":1},"end":{"line":2,"column":136,"offset":136},"indent":[]}},{"type":"heading","depth":2,"children":[{"type":"text","value":"Creating The Bot!","position":{"start":{"line":4,"column":4,"offset":141},"end":{"line":4,"column":21,"offset":158},"indent":[]}}],"position":{"start":{"line":4,"column":1,"offset":138},"end":{"line":4,"column":21,"offset":158},"indent":[]}},{"type":"blockquote","children":[{"type":"paragraph","children":[{"type":"text","value":"This guide is going to assume you already have the basic requirements to make a bot ready. This includes github, git, a code editor like Visual Studio Code. If you don't have these yet please prepare them first before going forward.","position":{"start":{"line":6,"column":3,"offset":162},"end":{"line":6,"column":235,"offset":394},"indent":[]}}],"position":{"start":{"line":6,"column":3,"offset":162},"end":{"line":6,"column":235,"offset":394},"indent":[]}}],"position":{"start":{"line":6,"column":1,"offset":160},"end":{"line":6,"column":235,"offset":394},"indent":[]}},{"type":"list","ordered":false,"start":null,"spread":true,"children":[{"type":"listItem","spread":false,"checked":null,"children":[{"type":"paragraph","children":[{"type":"text","value":"First, create a Discordeno Bot using the ","position":{"start":{"line":8,"column":3,"offset":398},"end":{"line":8,"column":44,"offset":439},"indent":[]}},{"type":"link","title":null,"url":"https://github.com/Skillz4Killz/Discordeno-bot-template","children":[{"type":"text","value":"Generator Boilerplate","position":{"start":{"line":8,"column":45,"offset":440},"end":{"line":8,"column":66,"offset":461},"indent":[]}}],"position":{"start":{"line":8,"column":44,"offset":439},"end":{"line":8,"column":124,"offset":519},"indent":[]}},{"type":"text","value":". Give it any name you like. For the purpose of this guide we will call it, Stargate.","position":{"start":{"line":8,"column":124,"offset":519},"end":{"line":8,"column":209,"offset":604},"indent":[]}}],"position":{"start":{"line":8,"column":3,"offset":398},"end":{"line":8,"column":209,"offset":604},"indent":[]}}],"position":{"start":{"line":8,"column":1,"offset":396},"end":{"line":9,"column":1,"offset":605},"indent":[1]}},{"type":"listItem","spread":false,"checked":null,"children":[{"type":"paragraph","children":[{"type":"text","value":"Then ","position":{"start":{"line":10,"column":3,"offset":608},"end":{"line":10,"column":8,"offset":613},"indent":[]}},{"type":"inlineCode","value":"git clone https://github.com/Skillz4Killz/Stargate.git","position":{"start":{"line":10,"column":8,"offset":613},"end":{"line":10,"column":64,"offset":669},"indent":[]}}],"position":{"start":{"line":10,"column":3,"offset":608},"end":{"line":10,"column":64,"offset":669},"indent":[]}}],"position":{"start":{"line":10,"column":1,"offset":606},"end":{"line":11,"column":1,"offset":670},"indent":[1]}},{"type":"listItem","spread":false,"checked":null,"children":[{"type":"paragraph","children":[{"type":"text","value":"When that is done, go ahead and open up the folder with VSC.","position":{"start":{"line":12,"column":3,"offset":673},"end":{"line":12,"column":63,"offset":733},"indent":[]}}],"position":{"start":{"line":12,"column":3,"offset":673},"end":{"line":12,"column":63,"offset":733},"indent":[]}}],"position":{"start":{"line":12,"column":1,"offset":671},"end":{"line":12,"column":63,"offset":733},"indent":[]}},{"type":"listItem","spread":false,"checked":null,"children":[{"type":"paragraph","children":[{"type":"text","value":"Create a new file called ","position":{"start":{"line":13,"column":3,"offset":736},"end":{"line":13,"column":28,"offset":761},"indent":[]}},{"type":"inlineCode","value":"configs.ts","position":{"start":{"line":13,"column":28,"offset":761},"end":{"line":13,"column":40,"offset":773},"indent":[]}},{"type":"text","value":". Open the ","position":{"start":{"line":13,"column":40,"offset":773},"end":{"line":13,"column":51,"offset":784},"indent":[]}},{"type":"inlineCode","value":"configs.example.ts","position":{"start":{"line":13,"column":51,"offset":784},"end":{"line":13,"column":71,"offset":804},"indent":[]}},{"type":"text","value":" file and copy everything over.","position":{"start":{"line":13,"column":71,"offset":804},"end":{"line":13,"column":102,"offset":835},"indent":[]}}],"position":{"start":{"line":13,"column":3,"offset":736},"end":{"line":13,"column":102,"offset":835},"indent":[]}}],"position":{"start":{"line":13,"column":1,"offset":734},"end":{"line":13,"column":102,"offset":835},"indent":[]}}],"position":{"start":{"line":8,"column":1,"offset":396},"end":{"line":13,"column":102,"offset":835},"indent":[1,1,1,1,1]}},{"type":"paragraph","children":[{"type":"text","value":"Let's take a minute to review all the options we have available to us.","position":{"start":{"line":15,"column":1,"offset":837},"end":{"line":15,"column":71,"offset":907},"indent":[]}}],"position":{"start":{"line":15,"column":1,"offset":837},"end":{"line":15,"column":71,"offset":907},"indent":[]}},{"type":"heading","depth":3,"children":[{"type":"text","value":"Configs File","position":{"start":{"line":17,"column":5,"offset":913},"end":{"line":17,"column":17,"offset":925},"indent":[]}}],"position":{"start":{"line":17,"column":1,"offset":909},"end":{"line":17,"column":17,"offset":925},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"The ","position":{"start":{"line":19,"column":1,"offset":927},"end":{"line":19,"column":5,"offset":931},"indent":[]}},{"type":"inlineCode","value":"configs.ts","position":{"start":{"line":19,"column":5,"offset":931},"end":{"line":19,"column":17,"offset":943},"indent":[]}},{"type":"text","value":" file is where you will keep all your secret info you don't want to share with anyone else. As long as ","position":{"start":{"line":19,"column":17,"offset":943},"end":{"line":19,"column":120,"offset":1046},"indent":[]}},{"type":"inlineCode","value":".gitignore","position":{"start":{"line":19,"column":120,"offset":1046},"end":{"line":19,"column":132,"offset":1058},"indent":[]}},{"type":"text","value":" file is ignoring configs.ts your configurations will be kept private!","position":{"start":{"line":19,"column":132,"offset":1058},"end":{"line":19,"column":202,"offset":1128},"indent":[]}}],"position":{"start":{"line":19,"column":1,"offset":927},"end":{"line":19,"column":202,"offset":1128},"indent":[]}},{"type":"code","lang":"ts","meta":null,"value":"// Step 1: Remove the `.example` from this file name so it is called `configs.ts`\n// Step 2: Add all your bot's information below. The only required one is token and prefix. NOTE: As long as `.gitignore` file is ignoring configs.ts your configurations will be kept private!\n// Step 3: Remove these comments if you like.\n\nexport const configs = {\n // Your bot token goes here\n token: \"\",\n // The default prefix for your bot. Don't worry guilds can change this later.\n prefix: \"!\",\n // This isn't required but you can add bot list api keys here.\n botListTokens: {\n DISCORD_BOT_ORG: \"\",\n BOTS_ON_DISCORD: \"\",\n DISCORD_BOT_LIST: \"\",\n BOTS_FOR_DISCORD: \"\",\n DISCORD_BOATS: \"\",\n DISCORD_BOTS_GG: \"\",\n DISCORD_BOTS_GROUP: \"\",\n },\n // This is the server id for your bot's main server where users can get help/support\n supportServerID: \"\",\n // These are channel ids that will enable some functionality\n channelIDs: {\n // When a translation is missing this is the channel you will be alerted in.\n missingTranslation: \"\",\n // When an error occurs, we will try and log it to this channel\n errorChannelID: \"\"\n },\n // These are the role ids that will enable some functionality.\n roleIDs: {\n // If you have a patreon set up you can add the patreon vip role id here.\n patreonVIPRoleID: \"\",\n },\n // These are the user ids that will enable some functionality.\n userIDs: {\n // The user ids for the support team\n botSupporters: [],\n // The user ids for the other devs on your team\n botDevs: [],\n // The user ids who have complete 100% access to your bot\n botOwners: []\n }\n};\n","position":{"start":{"line":21,"column":1,"offset":1130},"end":{"line":66,"column":4,"offset":2770},"indent":[1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1]}},{"type":"heading","depth":4,"children":[{"type":"text","value":"Token","position":{"start":{"line":68,"column":6,"offset":2777},"end":{"line":68,"column":11,"offset":2782},"indent":[]}}],"position":{"start":{"line":68,"column":1,"offset":2772},"end":{"line":68,"column":11,"offset":2782},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"First, add your bot token. This is ","position":{"start":{"line":70,"column":1,"offset":2784},"end":{"line":70,"column":36,"offset":2819},"indent":[]}},{"type":"strong","children":[{"type":"text","value":"required","position":{"start":{"line":70,"column":38,"offset":2821},"end":{"line":70,"column":46,"offset":2829},"indent":[]}}],"position":{"start":{"line":70,"column":36,"offset":2819},"end":{"line":70,"column":48,"offset":2831},"indent":[]}},{"type":"text","value":" for the bot to start. Review the ","position":{"start":{"line":70,"column":48,"offset":2831},"end":{"line":70,"column":82,"offset":2865},"indent":[]}},{"type":"link","title":null,"url":"https://discordeno.netlify.app/gettingstarted#creatingyourfirstdiscordbotapplication","children":[{"type":"text","value":"instructions","position":{"start":{"line":70,"column":83,"offset":2866},"end":{"line":70,"column":95,"offset":2878},"indent":[]}}],"position":{"start":{"line":70,"column":82,"offset":2865},"end":{"line":70,"column":182,"offset":2965},"indent":[]}},{"type":"text","value":" if you have not made your token yet.","position":{"start":{"line":70,"column":182,"offset":2965},"end":{"line":70,"column":219,"offset":3002},"indent":[]}}],"position":{"start":{"line":70,"column":1,"offset":2784},"end":{"line":70,"column":219,"offset":3002},"indent":[]}},{"type":"heading","depth":4,"children":[{"type":"text","value":"Prefix","position":{"start":{"line":72,"column":6,"offset":3009},"end":{"line":72,"column":12,"offset":3015},"indent":[]}}],"position":{"start":{"line":72,"column":1,"offset":3004},"end":{"line":72,"column":12,"offset":3015},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"The prefix is where you will set the default prefix for your bot. Don't worry, every server will be able to choose their own prefix but we need a default prefix to start.","position":{"start":{"line":74,"column":1,"offset":3017},"end":{"line":74,"column":171,"offset":3187},"indent":[]}}],"position":{"start":{"line":74,"column":1,"offset":3017},"end":{"line":74,"column":171,"offset":3187},"indent":[]}},{"type":"heading","depth":4,"children":[{"type":"text","value":"Bot Lists Tokens","position":{"start":{"line":76,"column":6,"offset":3194},"end":{"line":76,"column":22,"offset":3210},"indent":[]}}],"position":{"start":{"line":76,"column":1,"offset":3189},"end":{"line":76,"column":22,"offset":3210},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"This section of the file is so you can easily have your bot's statistics updated on all the bot lists out there to help you grow your bot. The code is already written to handle this but you will need to do 3 things for each bot list.","position":{"start":{"line":78,"column":1,"offset":3212},"end":{"line":78,"column":234,"offset":3445},"indent":[]}}],"position":{"start":{"line":78,"column":1,"offset":3212},"end":{"line":78,"column":234,"offset":3445},"indent":[]}},{"type":"list","ordered":true,"start":1,"spread":false,"children":[{"type":"listItem","spread":false,"checked":null,"children":[{"type":"paragraph","children":[{"type":"text","value":"Go to the bot list and add your bot to their website. (Each site has it's own instructions)","position":{"start":{"line":80,"column":4,"offset":3450},"end":{"line":80,"column":95,"offset":3541},"indent":[]}}],"position":{"start":{"line":80,"column":4,"offset":3450},"end":{"line":80,"column":95,"offset":3541},"indent":[]}}],"position":{"start":{"line":80,"column":1,"offset":3447},"end":{"line":80,"column":95,"offset":3541},"indent":[]}},{"type":"listItem","spread":false,"checked":null,"children":[{"type":"paragraph","children":[{"type":"text","value":"Create a token for yourself on each website and paste it in your configs.","position":{"start":{"line":81,"column":4,"offset":3545},"end":{"line":81,"column":77,"offset":3618},"indent":[]}}],"position":{"start":{"line":81,"column":4,"offset":3545},"end":{"line":81,"column":77,"offset":3618},"indent":[]}}],"position":{"start":{"line":81,"column":1,"offset":3542},"end":{"line":81,"column":77,"offset":3618},"indent":[]}},{"type":"listItem","spread":false,"checked":null,"children":[{"type":"paragraph","children":[{"type":"text","value":"Enjoy!","position":{"start":{"line":82,"column":4,"offset":3622},"end":{"line":82,"column":10,"offset":3628},"indent":[]}}],"position":{"start":{"line":82,"column":4,"offset":3622},"end":{"line":82,"column":10,"offset":3628},"indent":[]}}],"position":{"start":{"line":82,"column":1,"offset":3619},"end":{"line":82,"column":10,"offset":3628},"indent":[]}}],"position":{"start":{"line":80,"column":1,"offset":3447},"end":{"line":82,"column":10,"offset":3628},"indent":[1,1]}},{"type":"paragraph","children":[{"type":"text","value":"If you wish to customize the code, you will find the bot list tasks in the tasks folder. Don't worry we will discuss this when we get to the tasks section of the guide.","position":{"start":{"line":84,"column":1,"offset":3630},"end":{"line":84,"column":169,"offset":3798},"indent":[]}}],"position":{"start":{"line":84,"column":1,"offset":3630},"end":{"line":84,"column":169,"offset":3798},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"For now just remember, that Discordeno provides you a built in way to update most discord bot lists.","position":{"start":{"line":86,"column":1,"offset":3800},"end":{"line":86,"column":101,"offset":3900},"indent":[]}}],"position":{"start":{"line":86,"column":1,"offset":3800},"end":{"line":86,"column":101,"offset":3900},"indent":[]}},{"type":"heading","depth":4,"children":[{"type":"text","value":"Channel IDs","position":{"start":{"line":88,"column":6,"offset":3907},"end":{"line":88,"column":17,"offset":3918},"indent":[]}}],"position":{"start":{"line":88,"column":1,"offset":3902},"end":{"line":88,"column":17,"offset":3918},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"The channelIDs section holds the useful for specific features to help give you alerts/notifications. For example, the ","position":{"start":{"line":90,"column":1,"offset":3920},"end":{"line":90,"column":119,"offset":4038},"indent":[]}},{"type":"inlineCode","value":"missingTranslation","position":{"start":{"line":90,"column":119,"offset":4038},"end":{"line":90,"column":139,"offset":4058},"indent":[]}},{"type":"text","value":" channel will be where messages are sent alerting you that somewhere in your code you are trying to use a translation key that you never created.","position":{"start":{"line":90,"column":139,"offset":4058},"end":{"line":90,"column":284,"offset":4203},"indent":[]}}],"position":{"start":{"line":90,"column":1,"offset":3920},"end":{"line":90,"column":284,"offset":4203},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"When you get to around 25,000 Discord servers on your bot, you may want to convert these channel IDs to webhooks.","position":{"start":{"line":92,"column":1,"offset":4205},"end":{"line":92,"column":114,"offset":4318},"indent":[]}}],"position":{"start":{"line":92,"column":1,"offset":4205},"end":{"line":92,"column":114,"offset":4318},"indent":[]}},{"type":"heading","depth":4,"children":[{"type":"text","value":"Role IDs","position":{"start":{"line":94,"column":6,"offset":4325},"end":{"line":94,"column":14,"offset":4333},"indent":[]}}],"position":{"start":{"line":94,"column":1,"offset":4320},"end":{"line":94,"column":14,"offset":4333},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"The channelIDs section holds the useful for specific features to help give you alerts/notifications. For example, the ","position":{"start":{"line":96,"column":1,"offset":4335},"end":{"line":96,"column":119,"offset":4453},"indent":[]}},{"type":"inlineCode","value":"missingTranslation","position":{"start":{"line":96,"column":119,"offset":4453},"end":{"line":96,"column":139,"offset":4473},"indent":[]}},{"type":"text","value":" channel will be where messages are sent alerting you that somewhere in your code you are trying to use a translation key that you never created.","position":{"start":{"line":96,"column":139,"offset":4473},"end":{"line":96,"column":284,"offset":4618},"indent":[]}}],"position":{"start":{"line":96,"column":1,"offset":4335},"end":{"line":96,"column":284,"offset":4618},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"When you get to around 25,000 Discord servers on your bot, you may want to convert these channel IDs to webhooks.","position":{"start":{"line":98,"column":1,"offset":4620},"end":{"line":98,"column":114,"offset":4733},"indent":[]}}],"position":{"start":{"line":98,"column":1,"offset":4620},"end":{"line":98,"column":114,"offset":4733},"indent":[]}},{"type":"heading","depth":2,"children":[{"type":"text","value":"It's Alive!","position":{"start":{"line":100,"column":4,"offset":4738},"end":{"line":100,"column":15,"offset":4749},"indent":[]}}],"position":{"start":{"line":100,"column":1,"offset":4735},"end":{"line":100,"column":15,"offset":4749},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"Oh my god! You now have a bot with a bunch of features already! You don't believe me? Well, seeing is believing, so start the bot.","position":{"start":{"line":102,"column":1,"offset":4751},"end":{"line":102,"column":131,"offset":4881},"indent":[]}}],"position":{"start":{"line":102,"column":1,"offset":4751},"end":{"line":102,"column":131,"offset":4881},"indent":[]}},{"type":"list","ordered":true,"start":1,"spread":false,"children":[{"type":"listItem","spread":false,"checked":null,"children":[{"type":"paragraph","children":[{"type":"text","value":"Invite your bot to a discord server.","position":{"start":{"line":104,"column":4,"offset":4886},"end":{"line":104,"column":40,"offset":4922},"indent":[]}}],"position":{"start":{"line":104,"column":4,"offset":4886},"end":{"line":104,"column":40,"offset":4922},"indent":[]}}],"position":{"start":{"line":104,"column":1,"offset":4883},"end":{"line":104,"column":40,"offset":4922},"indent":[]}},{"type":"listItem","spread":false,"checked":null,"children":[{"type":"paragraph","children":[{"type":"text","value":"Open up the integrated terminal in VSC using ","position":{"start":{"line":105,"column":4,"offset":4926},"end":{"line":105,"column":49,"offset":4971},"indent":[]}},{"type":"strong","children":[{"type":"text","value":"CTRL + `","position":{"start":{"line":105,"column":51,"offset":4973},"end":{"line":105,"column":59,"offset":4981},"indent":[]}}],"position":{"start":{"line":105,"column":49,"offset":4971},"end":{"line":105,"column":61,"offset":4983},"indent":[]}},{"type":"text","value":". If you use a Mac, replace CTRL with CMD.","position":{"start":{"line":105,"column":61,"offset":4983},"end":{"line":105,"column":103,"offset":5025},"indent":[]}}],"position":{"start":{"line":105,"column":4,"offset":4926},"end":{"line":105,"column":103,"offset":5025},"indent":[]}}],"position":{"start":{"line":105,"column":1,"offset":4923},"end":{"line":105,"column":103,"offset":5025},"indent":[]}},{"type":"listItem","spread":false,"checked":null,"children":[{"type":"paragraph","children":[{"type":"text","value":"Run the script below:","position":{"start":{"line":106,"column":4,"offset":5029},"end":{"line":106,"column":25,"offset":5050},"indent":[]}}],"position":{"start":{"line":106,"column":4,"offset":5029},"end":{"line":106,"column":25,"offset":5050},"indent":[]}}],"position":{"start":{"line":106,"column":1,"offset":5026},"end":{"line":106,"column":25,"offset":5050},"indent":[]}}],"position":{"start":{"line":104,"column":1,"offset":4883},"end":{"line":106,"column":25,"offset":5050},"indent":[1,1]}},{"type":"code","lang":"shell","meta":null,"value":"deno run --allow-net --allow-read mod.ts","position":{"start":{"line":108,"column":1,"offset":5052},"end":{"line":110,"column":4,"offset":5105},"indent":[1,1]}},{"type":"paragraph","children":[{"type":"text","value":"The first time you run it, you may see a lot of files being loaded. This is preparing all the magic behind the scene. Once it is ready, you will see something like this:","position":{"start":{"line":112,"column":1,"offset":5107},"end":{"line":112,"column":170,"offset":5276},"indent":[]}}],"position":{"start":{"line":112,"column":1,"offset":5107},"end":{"line":112,"column":170,"offset":5276},"indent":[]}},{"type":"paragraph","children":[{"type":"image","title":null,"url":"https://i.imgur.com/TOXjLgh.png","alt":"image","position":{"start":{"line":114,"column":1,"offset":5278},"end":{"line":114,"column":42,"offset":5319},"indent":[]}}],"position":{"start":{"line":114,"column":1,"offset":5278},"end":{"line":114,"column":42,"offset":5319},"indent":[]}},{"type":"heading","depth":2,"children":[{"type":"text","value":"Understanding What Discordeno Did","position":{"start":{"line":116,"column":4,"offset":5324},"end":{"line":116,"column":37,"offset":5357},"indent":[]}}],"position":{"start":{"line":116,"column":1,"offset":5321},"end":{"line":116,"column":37,"offset":5357},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"Discordeno includes these commands/folders as they are essential for any discord bot to have in order to meet the Discord Bot Best Practices. It also adds a few things that will help make some things easier to build a bot.","position":{"start":{"line":118,"column":1,"offset":5359},"end":{"line":118,"column":223,"offset":5581},"indent":[]}}],"position":{"start":{"line":118,"column":1,"offset":5359},"end":{"line":118,"column":223,"offset":5581},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"We will dive into these deeper in this guide. Let's take it step by step.","position":{"start":{"line":120,"column":1,"offset":5583},"end":{"line":120,"column":74,"offset":5656},"indent":[]}}],"position":{"start":{"line":120,"column":1,"offset":5583},"end":{"line":120,"column":74,"offset":5656},"indent":[]}},{"type":"export","value":"export const _frontmatter = {\"title\":\"Creating The Bot!\",\"metaTitle\":\"Creating A Bot | Discordeno\",\"metaDescription\":\"Let's create our very own bot with Discordeno!\"}","position":{"start":{"line":123,"column":1,"offset":5659},"end":{"line":123,"column":167,"offset":5825},"indent":[]}}],"position":{"start":{"line":1,"column":1,"offset":0},"end":{"line":123,"column":167,"offset":5825}}},"scopeImports":["import * as React from 'react'"],"scopeIdentifiers":["React"],"body":"function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }\n\nfunction _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }\n\nfunction _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }\n\n/* @jsx mdx */\nvar _frontmatter = {\n \"title\": \"Creating The Bot!\",\n \"metaTitle\": \"Creating A Bot | Discordeno\",\n \"metaDescription\": \"Let's create our very own bot with Discordeno!\"\n};\nvar layoutProps = {\n _frontmatter: _frontmatter\n};\nvar MDXLayout = \"wrapper\";\nreturn function MDXContent(_ref) {\n var components = _ref.components,\n props = _objectWithoutProperties(_ref, [\"components\"]);\n\n return mdx(MDXLayout, _extends({}, layoutProps, props, {\n components: components,\n mdxType: \"MDXLayout\"\n }), mdx(\"p\", null, \"Discordeno will help make Discord bot development much easier. Don't worry, as you go through this guide it will make a lot more sense.\"), mdx(\"h2\", null, \"Creating The Bot!\"), mdx(\"blockquote\", null, mdx(\"p\", {\n parentName: \"blockquote\"\n }, \"This guide is going to assume you already have the basic requirements to make a bot ready. This includes github, git, a code editor like Visual Studio Code. If you don't have these yet please prepare them first before going forward.\")), mdx(\"ul\", null, mdx(\"li\", {\n parentName: \"ul\"\n }, mdx(\"p\", {\n parentName: \"li\"\n }, \"First, create a Discordeno Bot using the \", mdx(\"a\", _extends({\n parentName: \"p\"\n }, {\n \"href\": \"https://github.com/Skillz4Killz/Discordeno-bot-template\"\n }), \"Generator Boilerplate\"), \". Give it any name you like. For the purpose of this guide we will call it, Stargate.\")), mdx(\"li\", {\n parentName: \"ul\"\n }, mdx(\"p\", {\n parentName: \"li\"\n }, \"Then \", mdx(\"inlineCode\", {\n parentName: \"p\"\n }, \"git clone https://github.com/Skillz4Killz/Stargate.git\"))), mdx(\"li\", {\n parentName: \"ul\"\n }, mdx(\"p\", {\n parentName: \"li\"\n }, \"When that is done, go ahead and open up the folder with VSC.\")), mdx(\"li\", {\n parentName: \"ul\"\n }, mdx(\"p\", {\n parentName: \"li\"\n }, \"Create a new file called \", mdx(\"inlineCode\", {\n parentName: \"p\"\n }, \"configs.ts\"), \". Open the \", mdx(\"inlineCode\", {\n parentName: \"p\"\n }, \"configs.example.ts\"), \" file and copy everything over.\"))), mdx(\"p\", null, \"Let's take a minute to review all the options we have available to us.\"), mdx(\"h3\", null, \"Configs File\"), mdx(\"p\", null, \"The \", mdx(\"inlineCode\", {\n parentName: \"p\"\n }, \"configs.ts\"), \" file is where you will keep all your secret info you don't want to share with anyone else. As long as \", mdx(\"inlineCode\", {\n parentName: \"p\"\n }, \".gitignore\"), \" file is ignoring configs.ts your configurations will be kept private!\"), mdx(\"pre\", null, mdx(\"code\", _extends({\n parentName: \"pre\"\n }, {\n \"className\": \"language-ts\"\n }), \"// Step 1: Remove the `.example` from this file name so it is called `configs.ts`\\n// Step 2: Add all your bot's information below. The only required one is token and prefix. NOTE: As long as `.gitignore` file is ignoring configs.ts your configurations will be kept private!\\n// Step 3: Remove these comments if you like.\\n\\nexport const configs = {\\n // Your bot token goes here\\n token: \\\"\\\",\\n // The default prefix for your bot. Don't worry guilds can change this later.\\n prefix: \\\"!\\\",\\n // This isn't required but you can add bot list api keys here.\\n botListTokens: {\\n DISCORD_BOT_ORG: \\\"\\\",\\n BOTS_ON_DISCORD: \\\"\\\",\\n DISCORD_BOT_LIST: \\\"\\\",\\n BOTS_FOR_DISCORD: \\\"\\\",\\n DISCORD_BOATS: \\\"\\\",\\n DISCORD_BOTS_GG: \\\"\\\",\\n DISCORD_BOTS_GROUP: \\\"\\\",\\n },\\n // This is the server id for your bot's main server where users can get help/support\\n supportServerID: \\\"\\\",\\n // These are channel ids that will enable some functionality\\n channelIDs: {\\n // When a translation is missing this is the channel you will be alerted in.\\n missingTranslation: \\\"\\\",\\n // When an error occurs, we will try and log it to this channel\\n errorChannelID: \\\"\\\"\\n },\\n // These are the role ids that will enable some functionality.\\n roleIDs: {\\n // If you have a patreon set up you can add the patreon vip role id here.\\n patreonVIPRoleID: \\\"\\\",\\n },\\n // These are the user ids that will enable some functionality.\\n userIDs: {\\n // The user ids for the support team\\n botSupporters: [],\\n // The user ids for the other devs on your team\\n botDevs: [],\\n // The user ids who have complete 100% access to your bot\\n botOwners: []\\n }\\n};\\n\\n\")), mdx(\"h4\", null, \"Token\"), mdx(\"p\", null, \"First, add your bot token. This is \", mdx(\"strong\", {\n parentName: \"p\"\n }, \"required\"), \" for the bot to start. Review the \", mdx(\"a\", _extends({\n parentName: \"p\"\n }, {\n \"href\": \"https://discordeno.netlify.app/gettingstarted#creatingyourfirstdiscordbotapplication\"\n }), \"instructions\"), \" if you have not made your token yet.\"), mdx(\"h4\", null, \"Prefix\"), mdx(\"p\", null, \"The prefix is where you will set the default prefix for your bot. Don't worry, every server will be able to choose their own prefix but we need a default prefix to start.\"), mdx(\"h4\", null, \"Bot Lists Tokens\"), mdx(\"p\", null, \"This section of the file is so you can easily have your bot's statistics updated on all the bot lists out there to help you grow your bot. The code is already written to handle this but you will need to do 3 things for each bot list.\"), mdx(\"ol\", null, mdx(\"li\", {\n parentName: \"ol\"\n }, \"Go to the bot list and add your bot to their website. (Each site has it's own instructions)\"), mdx(\"li\", {\n parentName: \"ol\"\n }, \"Create a token for yourself on each website and paste it in your configs.\"), mdx(\"li\", {\n parentName: \"ol\"\n }, \"Enjoy!\")), mdx(\"p\", null, \"If you wish to customize the code, you will find the bot list tasks in the tasks folder. Don't worry we will discuss this when we get to the tasks section of the guide.\"), mdx(\"p\", null, \"For now just remember, that Discordeno provides you a built in way to update most discord bot lists.\"), mdx(\"h4\", null, \"Channel IDs\"), mdx(\"p\", null, \"The channelIDs section holds the useful for specific features to help give you alerts/notifications. For example, the \", mdx(\"inlineCode\", {\n parentName: \"p\"\n }, \"missingTranslation\"), \" channel will be where messages are sent alerting you that somewhere in your code you are trying to use a translation key that you never created.\"), mdx(\"p\", null, \"When you get to around 25,000 Discord servers on your bot, you may want to convert these channel IDs to webhooks.\"), mdx(\"h4\", null, \"Role IDs\"), mdx(\"p\", null, \"The channelIDs section holds the useful for specific features to help give you alerts/notifications. For example, the \", mdx(\"inlineCode\", {\n parentName: \"p\"\n }, \"missingTranslation\"), \" channel will be where messages are sent alerting you that somewhere in your code you are trying to use a translation key that you never created.\"), mdx(\"p\", null, \"When you get to around 25,000 Discord servers on your bot, you may want to convert these channel IDs to webhooks.\"), mdx(\"h2\", null, \"It's Alive!\"), mdx(\"p\", null, \"Oh my god! You now have a bot with a bunch of features already! You don't believe me? Well, seeing is believing, so start the bot.\"), mdx(\"ol\", null, mdx(\"li\", {\n parentName: \"ol\"\n }, \"Invite your bot to a discord server.\"), mdx(\"li\", {\n parentName: \"ol\"\n }, \"Open up the integrated terminal in VSC using \", mdx(\"strong\", {\n parentName: \"li\"\n }, \"CTRL + `\"), \". If you use a Mac, replace CTRL with CMD.\"), mdx(\"li\", {\n parentName: \"ol\"\n }, \"Run the script below:\")), mdx(\"pre\", null, mdx(\"code\", _extends({\n parentName: \"pre\"\n }, {\n \"className\": \"language-shell\"\n }), \"deno run --allow-net --allow-read mod.ts\\n\")), mdx(\"p\", null, \"The first time you run it, you may see a lot of files being loaded. This is preparing all the magic behind the scene. Once it is ready, you will see something like this:\"), mdx(\"p\", null, mdx(\"img\", _extends({\n parentName: \"p\"\n }, {\n \"src\": \"https://i.imgur.com/TOXjLgh.png\",\n \"alt\": \"image\"\n }))), mdx(\"h2\", null, \"Understanding What Discordeno Did\"), mdx(\"p\", null, \"Discordeno includes these commands/folders as they are essential for any discord bot to have in order to meet the Discord Bot Best Practices. It also adds a few things that will help make some things easier to build a bot.\"), mdx(\"p\", null, \"We will dive into these deeper in this guide. Let's take it step by step.\"));\n}\n;\nMDXContent.isMDXComponent = true;","rawMDXOutput":"/* @jsx mdx */\nimport { mdx } from '@mdx-js/react';\n/* @jsx mdx */\n\nexport const _frontmatter = {\n \"title\": \"Creating The Bot!\",\n \"metaTitle\": \"Creating A Bot | Discordeno\",\n \"metaDescription\": \"Let's create our very own bot with Discordeno!\"\n};\n\nconst layoutProps = {\n _frontmatter\n};\nconst MDXLayout = \"wrapper\"\nexport default function MDXContent({\n components,\n ...props\n}) {\n return \n

{`Discordeno will help make Discord bot development much easier. Don't worry, as you go through this guide it will make a lot more sense.`}

\n

{`Creating The Bot!`}

\n
\n

{`This guide is going to assume you already have the basic requirements to make a bot ready. This includes github, git, a code editor like Visual Studio Code. If you don't have these yet please prepare them first before going forward.`}

\n
\n
    \n
  • \n

    {`First, create a Discordeno Bot using the `}{`Generator Boilerplate`}{`. Give it any name you like. For the purpose of this guide we will call it, Stargate.`}

    \n
  • \n
  • \n

    {`Then `}{`git clone https://github.com/Skillz4Killz/Stargate.git`}

    \n
  • \n
  • \n

    {`When that is done, go ahead and open up the folder with VSC.`}

    \n
  • \n
  • \n

    {`Create a new file called `}{`configs.ts`}{`. Open the `}{`configs.example.ts`}{` file and copy everything over.`}

    \n
  • \n
\n

{`Let's take a minute to review all the options we have available to us.`}

\n

{`Configs File`}

\n

{`The `}{`configs.ts`}{` file is where you will keep all your secret info you don't want to share with anyone else. As long as `}{`.gitignore`}{` file is ignoring configs.ts your configurations will be kept private!`}

\n
{`// Step 1: Remove the \\`.example\\` from this file name so it is called \\`configs.ts\\`\n// Step 2: Add all your bot's information below. The only required one is token and prefix. NOTE: As long as \\`.gitignore\\` file is ignoring configs.ts your configurations will be kept private!\n// Step 3: Remove these comments if you like.\n\nexport const configs = {\n  // Your bot token goes here\n  token: \"\",\n  // The default prefix for your bot. Don't worry guilds can change this later.\n  prefix: \"!\",\n  // This isn't required but you can add bot list api keys here.\n  botListTokens: {\n    DISCORD_BOT_ORG: \"\",\n    BOTS_ON_DISCORD: \"\",\n    DISCORD_BOT_LIST: \"\",\n    BOTS_FOR_DISCORD: \"\",\n    DISCORD_BOATS: \"\",\n    DISCORD_BOTS_GG: \"\",\n    DISCORD_BOTS_GROUP: \"\",\n  },\n  // This is the server id for your bot's main server where users can get help/support\n  supportServerID: \"\",\n  // These are channel ids that will enable some functionality\n  channelIDs: {\n    // When a translation is missing this is the channel you will be alerted in.\n    missingTranslation: \"\",\n    // When an error occurs, we will try and log it to this channel\n    errorChannelID: \"\"\n  },\n  // These are the role ids that will enable some functionality.\n  roleIDs: {\n    // If you have a patreon set up you can add the patreon vip role id here.\n    patreonVIPRoleID: \"\",\n  },\n  // These are the user ids that will enable some functionality.\n  userIDs: {\n    // The user ids for the support team\n    botSupporters: [],\n    // The user ids for the other devs on your team\n    botDevs: [],\n    // The user ids who have complete 100% access to your bot\n    botOwners: []\n  }\n};\n\n`}
\n

{`Token`}

\n

{`First, add your bot token. This is `}{`required`}{` for the bot to start. Review the `}{`instructions`}{` if you have not made your token yet.`}

\n

{`Prefix`}

\n

{`The prefix is where you will set the default prefix for your bot. Don't worry, every server will be able to choose their own prefix but we need a default prefix to start.`}

\n

{`Bot Lists Tokens`}

\n

{`This section of the file is so you can easily have your bot's statistics updated on all the bot lists out there to help you grow your bot. The code is already written to handle this but you will need to do 3 things for each bot list.`}

\n
    \n
  1. {`Go to the bot list and add your bot to their website. (Each site has it's own instructions)`}
  2. \n
  3. {`Create a token for yourself on each website and paste it in your configs.`}
  4. \n
  5. {`Enjoy!`}
  6. \n
\n

{`If you wish to customize the code, you will find the bot list tasks in the tasks folder. Don't worry we will discuss this when we get to the tasks section of the guide.`}

\n

{`For now just remember, that Discordeno provides you a built in way to update most discord bot lists.`}

\n

{`Channel IDs`}

\n

{`The channelIDs section holds the useful for specific features to help give you alerts/notifications. For example, the `}{`missingTranslation`}{` channel will be where messages are sent alerting you that somewhere in your code you are trying to use a translation key that you never created.`}

\n

{`When you get to around 25,000 Discord servers on your bot, you may want to convert these channel IDs to webhooks.`}

\n

{`Role IDs`}

\n

{`The channelIDs section holds the useful for specific features to help give you alerts/notifications. For example, the `}{`missingTranslation`}{` channel will be where messages are sent alerting you that somewhere in your code you are trying to use a translation key that you never created.`}

\n

{`When you get to around 25,000 Discord servers on your bot, you may want to convert these channel IDs to webhooks.`}

\n

{`It's Alive!`}

\n

{`Oh my god! You now have a bot with a bunch of features already! You don't believe me? Well, seeing is believing, so start the bot.`}

\n
    \n
  1. {`Invite your bot to a discord server.`}
  2. \n
  3. {`Open up the integrated terminal in VSC using `}{`CTRL + \\``}{`. If you use a Mac, replace CTRL with CMD.`}
  4. \n
  5. {`Run the script below:`}
  6. \n
\n
{`deno run --allow-net --allow-read mod.ts\n`}
\n

{`The first time you run it, you may see a lot of files being loaded. This is preparing all the magic behind the scene. Once it is ready, you will see something like this:`}

\n

\n

{`Understanding What Discordeno Did`}

\n

{`Discordeno includes these commands/folders as they are essential for any discord bot to have in order to meet the Discord Bot Best Practices. It also adds a few things that will help make some things easier to build a bot.`}

\n

{`We will dive into these deeper in this guide. Let's take it step by step.`}

\n\n
;\n}\n\n;\nMDXContent.isMDXComponent = true;"}} \ No newline at end of file diff --git a/docs/.cache/caches/gatsby-plugin-mdx/diskstore-ebdd53108c5131930180839be05a208e.json b/docs/.cache/caches/gatsby-plugin-mdx/diskstore-ebdd53108c5131930180839be05a208e.json new file mode 100644 index 000000000..2c945af1e --- /dev/null +++ b/docs/.cache/caches/gatsby-plugin-mdx/diskstore-ebdd53108c5131930180839be05a208e.json @@ -0,0 +1 @@ +{"expireTime":9007200851633755000,"key":"gatsby-plugin-mdx-entire-payload-657e560a843a1e43e2d0718779bd184d-","val":{"mdast":{"type":"root","children":[{"type":"paragraph","children":[{"type":"text","value":"Woah! You are almost half way done with understanding all of Discordeno. Amazing isn't it? Something you may have noticed in the last section was there were some options that prevented some commands from running like ","position":{"start":{"line":2,"column":1,"offset":1},"end":{"line":2,"column":218,"offset":218},"indent":[]}},{"type":"inlineCode","value":"dmOnly","position":{"start":{"line":2,"column":218,"offset":218},"end":{"line":2,"column":226,"offset":226},"indent":[]}},{"type":"text","value":" or the permission options. we created a setting to prevent the monitor from running in certain channels. What if we wanted to do prevent commands from happening? How would we prevent commands from running?","position":{"start":{"line":2,"column":226,"offset":226},"end":{"line":2,"column":432,"offset":432},"indent":[]}}],"position":{"start":{"line":2,"column":1,"offset":1},"end":{"line":2,"column":432,"offset":432},"indent":[]}},{"type":"heading","depth":2,"children":[{"type":"text","value":"What is an Inhibitor?","position":{"start":{"line":4,"column":4,"offset":437},"end":{"line":4,"column":25,"offset":458},"indent":[]}}],"position":{"start":{"line":4,"column":1,"offset":434},"end":{"line":4,"column":25,"offset":458},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"An Inhibitor is very similar to how monitors work. A monitor runs on every message but an inhibitor runs on every command. Remember all those command options like cooldown, permissions, permissionLevel, nsfw, etc... Each and every one of these options has an inhibitor in that checks commands for these settings.","position":{"start":{"line":6,"column":1,"offset":460},"end":{"line":6,"column":313,"offset":772},"indent":[]}}],"position":{"start":{"line":6,"column":1,"offset":460},"end":{"line":6,"column":313,"offset":772},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"Let's create our own inhibitor that would prevent commands from being used if the user is not a VIP user.","position":{"start":{"line":8,"column":1,"offset":774},"end":{"line":8,"column":106,"offset":879},"indent":[]}}],"position":{"start":{"line":8,"column":1,"offset":774},"end":{"line":8,"column":106,"offset":879},"indent":[]}},{"type":"blockquote","children":[{"type":"paragraph","children":[{"type":"strong","children":[{"type":"text","value":"Note:","position":{"start":{"line":10,"column":5,"offset":885},"end":{"line":10,"column":10,"offset":890},"indent":[]}}],"position":{"start":{"line":10,"column":3,"offset":883},"end":{"line":10,"column":12,"offset":892},"indent":[]}},{"type":"text","value":" It is important to remember that everything below can be done with a simple permission level as well. We will create our own custom permission levels but for the purposes of this guide and to be able to learn about Inhibitors, we will be using an inhibitor.","position":{"start":{"line":10,"column":12,"offset":892},"end":{"line":10,"column":270,"offset":1150},"indent":[]}}],"position":{"start":{"line":10,"column":3,"offset":883},"end":{"line":10,"column":270,"offset":1150},"indent":[]}}],"position":{"start":{"line":10,"column":1,"offset":881},"end":{"line":10,"column":270,"offset":1150},"indent":[]}},{"type":"heading","depth":2,"children":[{"type":"text","value":"Creating the File","position":{"start":{"line":12,"column":4,"offset":1155},"end":{"line":12,"column":21,"offset":1172},"indent":[]}}],"position":{"start":{"line":12,"column":1,"offset":1152},"end":{"line":12,"column":21,"offset":1172},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"Let's start by creating a file inside the inhibitors folder called ","position":{"start":{"line":14,"column":1,"offset":1174},"end":{"line":14,"column":68,"offset":1241},"indent":[]}},{"type":"inlineCode","value":"vipOnly.ts","position":{"start":{"line":14,"column":68,"offset":1241},"end":{"line":14,"column":80,"offset":1253},"indent":[]}},{"type":"text","value":" and paste the following snippet of code:","position":{"start":{"line":14,"column":80,"offset":1253},"end":{"line":14,"column":121,"offset":1294},"indent":[]}}],"position":{"start":{"line":14,"column":1,"offset":1174},"end":{"line":14,"column":121,"offset":1294},"indent":[]}},{"type":"code","lang":"ts","meta":null,"value":"import { botCache } from \"../../mod.ts\";\n\nbotCache.inhibitors.set(\"inhibitorname\", async function (message, command, guild) {\n\t// Your code goes here\n});","position":{"start":{"line":16,"column":1,"offset":1296},"end":{"line":22,"column":4,"offset":1459},"indent":[1,1,1,1,1,1]}},{"type":"paragraph","children":[{"type":"text","value":"Inhibitors can take up to 3 arguments.","position":{"start":{"line":24,"column":1,"offset":1461},"end":{"line":24,"column":39,"offset":1499},"indent":[]}}],"position":{"start":{"line":24,"column":1,"offset":1461},"end":{"line":24,"column":39,"offset":1499},"indent":[]}},{"type":"list","ordered":false,"start":null,"spread":false,"children":[{"type":"listItem","spread":false,"checked":null,"children":[{"type":"paragraph","children":[{"type":"inlineCode","value":"message","position":{"start":{"line":26,"column":3,"offset":1503},"end":{"line":26,"column":12,"offset":1512},"indent":[]}},{"type":"text","value":": The message object that triggered the command.","position":{"start":{"line":26,"column":12,"offset":1512},"end":{"line":26,"column":60,"offset":1560},"indent":[]}}],"position":{"start":{"line":26,"column":3,"offset":1503},"end":{"line":26,"column":60,"offset":1560},"indent":[]}}],"position":{"start":{"line":26,"column":1,"offset":1501},"end":{"line":26,"column":60,"offset":1560},"indent":[]}},{"type":"listItem","spread":false,"checked":null,"children":[{"type":"paragraph","children":[{"type":"inlineCode","value":"command","position":{"start":{"line":27,"column":3,"offset":1563},"end":{"line":27,"column":12,"offset":1572},"indent":[]}},{"type":"text","value":": The command object itself that was triggered.","position":{"start":{"line":27,"column":12,"offset":1572},"end":{"line":27,"column":59,"offset":1619},"indent":[]}}],"position":{"start":{"line":27,"column":3,"offset":1563},"end":{"line":27,"column":59,"offset":1619},"indent":[]}}],"position":{"start":{"line":27,"column":1,"offset":1561},"end":{"line":27,"column":59,"offset":1619},"indent":[]}},{"type":"listItem","spread":false,"checked":null,"children":[{"type":"paragraph","children":[{"type":"inlineCode","value":"guild","position":{"start":{"line":28,"column":3,"offset":1622},"end":{"line":28,"column":10,"offset":1629},"indent":[]}},{"type":"text","value":": The server guild object where this command was ran.","position":{"start":{"line":28,"column":10,"offset":1629},"end":{"line":28,"column":63,"offset":1682},"indent":[]}}],"position":{"start":{"line":28,"column":3,"offset":1622},"end":{"line":28,"column":63,"offset":1682},"indent":[]}}],"position":{"start":{"line":28,"column":1,"offset":1620},"end":{"line":28,"column":63,"offset":1682},"indent":[]}}],"position":{"start":{"line":26,"column":1,"offset":1501},"end":{"line":28,"column":63,"offset":1682},"indent":[1,1]}},{"type":"heading","depth":2,"children":[{"type":"text","value":"Understanding How Inhibitors Function","position":{"start":{"line":30,"column":4,"offset":1687},"end":{"line":30,"column":41,"offset":1724},"indent":[]}}],"position":{"start":{"line":30,"column":1,"offset":1684},"end":{"line":30,"column":41,"offset":1724},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"To block a command you have to return a truthy value.","position":{"start":{"line":32,"column":1,"offset":1726},"end":{"line":32,"column":54,"offset":1779},"indent":[]}}],"position":{"start":{"line":32,"column":1,"offset":1726},"end":{"line":32,"column":54,"offset":1779},"indent":[]}},{"type":"list","ordered":false,"start":null,"spread":false,"children":[{"type":"listItem","spread":false,"checked":null,"children":[{"type":"paragraph","children":[{"type":"strong","children":[{"type":"text","value":"return true;","position":{"start":{"line":33,"column":5,"offset":1784},"end":{"line":33,"column":17,"offset":1796},"indent":[]}}],"position":{"start":{"line":33,"column":3,"offset":1782},"end":{"line":33,"column":19,"offset":1798},"indent":[]}},{"type":"text","value":" If you return true the inhibitor will block the execution of the command.\nTo allow a command return a falsey value.","position":{"start":{"line":33,"column":19,"offset":1798},"end":{"line":34,"column":42,"offset":1914},"indent":[1]}}],"position":{"start":{"line":33,"column":3,"offset":1782},"end":{"line":34,"column":42,"offset":1914},"indent":[1]}}],"position":{"start":{"line":33,"column":1,"offset":1780},"end":{"line":34,"column":42,"offset":1914},"indent":[1]}},{"type":"listItem","spread":false,"checked":null,"children":[{"type":"paragraph","children":[{"type":"strong","children":[{"type":"text","value":"return false;","position":{"start":{"line":35,"column":5,"offset":1919},"end":{"line":35,"column":18,"offset":1932},"indent":[]}}],"position":{"start":{"line":35,"column":3,"offset":1917},"end":{"line":35,"column":20,"offset":1934},"indent":[]}},{"type":"text","value":" If you return false the inhibitor will not block the error.","position":{"start":{"line":35,"column":20,"offset":1934},"end":{"line":35,"column":80,"offset":1994},"indent":[]}}],"position":{"start":{"line":35,"column":3,"offset":1917},"end":{"line":35,"column":80,"offset":1994},"indent":[]}}],"position":{"start":{"line":35,"column":1,"offset":1915},"end":{"line":35,"column":80,"offset":1994},"indent":[]}}],"position":{"start":{"line":33,"column":1,"offset":1780},"end":{"line":35,"column":80,"offset":1994},"indent":[1,1]}},{"type":"code","lang":"ts","meta":null,"value":"// If the command is not VIP only we can allow this command to execute\nif (!command.vipOnly) return false;\n\n// Check if the user is VIP\nconst userIsVIP = await isUserVIP(mes)\n// The user is VIP so we can allow this command to be used\nif (userIsVIP) return false;\n\n// The user is NOT VIP so we throw an error\nthrow `The ${command.name} is only allowed for VIP users.`","position":{"start":{"line":38,"column":1,"offset":1997},"end":{"line":49,"column":4,"offset":2373},"indent":[1,1,1,1,1,1,1,1,1,1,1]}},{"type":"export","value":"export const _frontmatter = {\"title\":\"Creating Inhibitors!\",\"metaTitle\":\"Creating An Inhibitor | Discordeno\",\"metaDescription\":\"Let's create our very own bot with Discordeno!\"}","position":{"start":{"line":52,"column":1,"offset":2376},"end":{"line":52,"column":177,"offset":2552},"indent":[]}}],"position":{"start":{"line":1,"column":1,"offset":0},"end":{"line":52,"column":177,"offset":2552}}},"scopeImports":["import * as React from 'react'"],"scopeIdentifiers":["React"],"body":"function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }\n\nfunction _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }\n\nfunction _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }\n\n/* @jsx mdx */\nvar _frontmatter = {\n \"title\": \"Creating Inhibitors!\",\n \"metaTitle\": \"Creating An Inhibitor | Discordeno\",\n \"metaDescription\": \"Let's create our very own bot with Discordeno!\"\n};\nvar layoutProps = {\n _frontmatter: _frontmatter\n};\nvar MDXLayout = \"wrapper\";\nreturn function MDXContent(_ref) {\n var components = _ref.components,\n props = _objectWithoutProperties(_ref, [\"components\"]);\n\n return mdx(MDXLayout, _extends({}, layoutProps, props, {\n components: components,\n mdxType: \"MDXLayout\"\n }), mdx(\"p\", null, \"Woah! You are almost half way done with understanding all of Discordeno. Amazing isn't it? Something you may have noticed in the last section was there were some options that prevented some commands from running like \", mdx(\"inlineCode\", {\n parentName: \"p\"\n }, \"dmOnly\"), \" or the permission options. we created a setting to prevent the monitor from running in certain channels. What if we wanted to do prevent commands from happening? How would we prevent commands from running?\"), mdx(\"h2\", null, \"What is an Inhibitor?\"), mdx(\"p\", null, \"An Inhibitor is very similar to how monitors work. A monitor runs on every message but an inhibitor runs on every command. Remember all those command options like cooldown, permissions, permissionLevel, nsfw, etc... Each and every one of these options has an inhibitor in that checks commands for these settings.\"), mdx(\"p\", null, \"Let's create our own inhibitor that would prevent commands from being used if the user is not a VIP user.\"), mdx(\"blockquote\", null, mdx(\"p\", {\n parentName: \"blockquote\"\n }, mdx(\"strong\", {\n parentName: \"p\"\n }, \"Note:\"), \" It is important to remember that everything below can be done with a simple permission level as well. We will create our own custom permission levels but for the purposes of this guide and to be able to learn about Inhibitors, we will be using an inhibitor.\")), mdx(\"h2\", null, \"Creating the File\"), mdx(\"p\", null, \"Let's start by creating a file inside the inhibitors folder called \", mdx(\"inlineCode\", {\n parentName: \"p\"\n }, \"vipOnly.ts\"), \" and paste the following snippet of code:\"), mdx(\"pre\", null, mdx(\"code\", _extends({\n parentName: \"pre\"\n }, {\n \"className\": \"language-ts\"\n }), \"import { botCache } from \\\"../../mod.ts\\\";\\n\\nbotCache.inhibitors.set(\\\"inhibitorname\\\", async function (message, command, guild) {\\n // Your code goes here\\n});\\n\")), mdx(\"p\", null, \"Inhibitors can take up to 3 arguments.\"), mdx(\"ul\", null, mdx(\"li\", {\n parentName: \"ul\"\n }, mdx(\"inlineCode\", {\n parentName: \"li\"\n }, \"message\"), \": The message object that triggered the command.\"), mdx(\"li\", {\n parentName: \"ul\"\n }, mdx(\"inlineCode\", {\n parentName: \"li\"\n }, \"command\"), \": The command object itself that was triggered.\"), mdx(\"li\", {\n parentName: \"ul\"\n }, mdx(\"inlineCode\", {\n parentName: \"li\"\n }, \"guild\"), \": The server guild object where this command was ran.\")), mdx(\"h2\", null, \"Understanding How Inhibitors Function\"), mdx(\"p\", null, \"To block a command you have to return a truthy value.\"), mdx(\"ul\", null, mdx(\"li\", {\n parentName: \"ul\"\n }, mdx(\"strong\", {\n parentName: \"li\"\n }, \"return true;\"), \" If you return true the inhibitor will block the execution of the command.\\nTo allow a command return a falsey value.\"), mdx(\"li\", {\n parentName: \"ul\"\n }, mdx(\"strong\", {\n parentName: \"li\"\n }, \"return false;\"), \" If you return false the inhibitor will not block the error.\")), mdx(\"pre\", null, mdx(\"code\", _extends({\n parentName: \"pre\"\n }, {\n \"className\": \"language-ts\"\n }), \"// If the command is not VIP only we can allow this command to execute\\nif (!command.vipOnly) return false;\\n\\n// Check if the user is VIP\\nconst userIsVIP = await isUserVIP(mes)\\n// The user is VIP so we can allow this command to be used\\nif (userIsVIP) return false;\\n\\n// The user is NOT VIP so we throw an error\\nthrow `The ${command.name} is only allowed for VIP users.`\\n\")));\n}\n;\nMDXContent.isMDXComponent = true;","rawMDXOutput":"/* @jsx mdx */\nimport { mdx } from '@mdx-js/react';\n/* @jsx mdx */\n\nexport const _frontmatter = {\n \"title\": \"Creating Inhibitors!\",\n \"metaTitle\": \"Creating An Inhibitor | Discordeno\",\n \"metaDescription\": \"Let's create our very own bot with Discordeno!\"\n};\n\nconst layoutProps = {\n _frontmatter\n};\nconst MDXLayout = \"wrapper\"\nexport default function MDXContent({\n components,\n ...props\n}) {\n return \n

{`Woah! You are almost half way done with understanding all of Discordeno. Amazing isn't it? Something you may have noticed in the last section was there were some options that prevented some commands from running like `}{`dmOnly`}{` or the permission options. we created a setting to prevent the monitor from running in certain channels. What if we wanted to do prevent commands from happening? How would we prevent commands from running?`}

\n

{`What is an Inhibitor?`}

\n

{`An Inhibitor is very similar to how monitors work. A monitor runs on every message but an inhibitor runs on every command. Remember all those command options like cooldown, permissions, permissionLevel, nsfw, etc... Each and every one of these options has an inhibitor in that checks commands for these settings.`}

\n

{`Let's create our own inhibitor that would prevent commands from being used if the user is not a VIP user.`}

\n
\n

{`Note:`}{` It is important to remember that everything below can be done with a simple permission level as well. We will create our own custom permission levels but for the purposes of this guide and to be able to learn about Inhibitors, we will be using an inhibitor.`}

\n
\n

{`Creating the File`}

\n

{`Let's start by creating a file inside the inhibitors folder called `}{`vipOnly.ts`}{` and paste the following snippet of code:`}

\n
{`import { botCache } from \"../../mod.ts\";\n\nbotCache.inhibitors.set(\"inhibitorname\", async function (message, command, guild) {\n    // Your code goes here\n});\n`}
\n

{`Inhibitors can take up to 3 arguments.`}

\n
    \n
  • {`message`}{`: The message object that triggered the command.`}
  • \n
  • {`command`}{`: The command object itself that was triggered.`}
  • \n
  • {`guild`}{`: The server guild object where this command was ran.`}
  • \n
\n

{`Understanding How Inhibitors Function`}

\n

{`To block a command you have to return a truthy value.`}

\n
    \n
  • {`return true;`}{` If you return true the inhibitor will block the execution of the command.\nTo allow a command return a falsey value.`}
  • \n
  • {`return false;`}{` If you return false the inhibitor will not block the error.`}
  • \n
\n
{`// If the command is not VIP only we can allow this command to execute\nif (!command.vipOnly) return false;\n\n// Check if the user is VIP\nconst userIsVIP = await isUserVIP(mes)\n// The user is VIP so we can allow this command to be used\nif (userIsVIP) return false;\n\n// The user is NOT VIP so we throw an error\nthrow \\`The \\${command.name} is only allowed for VIP users.\\`\n`}
\n\n
;\n}\n\n;\nMDXContent.isMDXComponent = true;"}} \ No newline at end of file diff --git a/docs/.cache/caches/gatsby-plugin-mdx/diskstore-ec24df1a40ad5096bda4a0fcebe5d19e.json b/docs/.cache/caches/gatsby-plugin-mdx/diskstore-ec24df1a40ad5096bda4a0fcebe5d19e.json new file mode 100644 index 000000000..42ba70e3d --- /dev/null +++ b/docs/.cache/caches/gatsby-plugin-mdx/diskstore-ec24df1a40ad5096bda4a0fcebe5d19e.json @@ -0,0 +1 @@ +{"expireTime":9007200851634937000,"key":"gatsby-plugin-mdx-entire-payload-cb86c36288b306a727c2d51be91a0aa7-","val":{"mdast":{"type":"root","children":[{"type":"paragraph","children":[{"type":"text","value":"Woah! You are almost half way done with understanding all of Discordeno. Amazing isn't it? Something you may have noticed in the last section was there were some options that prevented some commands from running like ","position":{"start":{"line":2,"column":1,"offset":1},"end":{"line":2,"column":218,"offset":218},"indent":[]}},{"type":"inlineCode","value":"dmOnly","position":{"start":{"line":2,"column":218,"offset":218},"end":{"line":2,"column":226,"offset":226},"indent":[]}},{"type":"text","value":" or the permission options. we created a setting to prevent the monitor from running in certain channels. What if we wanted to do prevent commands from happening? How would we prevent commands from running?","position":{"start":{"line":2,"column":226,"offset":226},"end":{"line":2,"column":432,"offset":432},"indent":[]}}],"position":{"start":{"line":2,"column":1,"offset":1},"end":{"line":2,"column":432,"offset":432},"indent":[]}},{"type":"heading","depth":2,"children":[{"type":"text","value":"What is an Inhibitor?","position":{"start":{"line":4,"column":4,"offset":437},"end":{"line":4,"column":25,"offset":458},"indent":[]}}],"position":{"start":{"line":4,"column":1,"offset":434},"end":{"line":4,"column":25,"offset":458},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"An Inhibitor is very similar to how monitors work. A monitor runs on every message but an inhibitor runs on every command. Remember all those command options like cooldown, permissions, permissionLevel, nsfw, etc... Each and every one of these options has an inhibitor in that checks commands for these settings.","position":{"start":{"line":6,"column":1,"offset":460},"end":{"line":6,"column":313,"offset":772},"indent":[]}}],"position":{"start":{"line":6,"column":1,"offset":460},"end":{"line":6,"column":313,"offset":772},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"Let's create our own inhibitor that would prevent commands from being used if the user is not a VIP user.","position":{"start":{"line":8,"column":1,"offset":774},"end":{"line":8,"column":106,"offset":879},"indent":[]}}],"position":{"start":{"line":8,"column":1,"offset":774},"end":{"line":8,"column":106,"offset":879},"indent":[]}},{"type":"blockquote","children":[{"type":"paragraph","children":[{"type":"strong","children":[{"type":"text","value":"Note:","position":{"start":{"line":10,"column":5,"offset":885},"end":{"line":10,"column":10,"offset":890},"indent":[]}}],"position":{"start":{"line":10,"column":3,"offset":883},"end":{"line":10,"column":12,"offset":892},"indent":[]}},{"type":"text","value":" It is important to remember that everything below can be done with a simple permission level as well. We will create our own custom permission levels but for the purposes of this guide and to be able to learn about Inhibitors, we will be using an inhibitor.","position":{"start":{"line":10,"column":12,"offset":892},"end":{"line":10,"column":270,"offset":1150},"indent":[]}}],"position":{"start":{"line":10,"column":3,"offset":883},"end":{"line":10,"column":270,"offset":1150},"indent":[]}}],"position":{"start":{"line":10,"column":1,"offset":881},"end":{"line":10,"column":270,"offset":1150},"indent":[]}},{"type":"heading","depth":2,"children":[{"type":"text","value":"Creating the File","position":{"start":{"line":12,"column":4,"offset":1155},"end":{"line":12,"column":21,"offset":1172},"indent":[]}}],"position":{"start":{"line":12,"column":1,"offset":1152},"end":{"line":12,"column":21,"offset":1172},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"Let's start by creating a file inside the inhibitors folder called ","position":{"start":{"line":14,"column":1,"offset":1174},"end":{"line":14,"column":68,"offset":1241},"indent":[]}},{"type":"inlineCode","value":"boosted.ts","position":{"start":{"line":14,"column":68,"offset":1241},"end":{"line":14,"column":80,"offset":1253},"indent":[]}},{"type":"text","value":" and paste the following snippet of code:","position":{"start":{"line":14,"column":80,"offset":1253},"end":{"line":14,"column":121,"offset":1294},"indent":[]}}],"position":{"start":{"line":14,"column":1,"offset":1174},"end":{"line":14,"column":121,"offset":1294},"indent":[]}},{"type":"code","lang":"ts","meta":null,"value":"import { botCache } from \"../../mod.ts\";\n\nbotCache.inhibitors.set(\"inhibitorname\", async function (message, command, guild) {\n\t// Your code goes here\n});","position":{"start":{"line":16,"column":1,"offset":1296},"end":{"line":22,"column":4,"offset":1459},"indent":[1,1,1,1,1,1]}},{"type":"paragraph","children":[{"type":"text","value":"Inhibitors can take up to 3 arguments.","position":{"start":{"line":24,"column":1,"offset":1461},"end":{"line":24,"column":39,"offset":1499},"indent":[]}}],"position":{"start":{"line":24,"column":1,"offset":1461},"end":{"line":24,"column":39,"offset":1499},"indent":[]}},{"type":"list","ordered":false,"start":null,"spread":false,"children":[{"type":"listItem","spread":false,"checked":null,"children":[{"type":"paragraph","children":[{"type":"inlineCode","value":"message","position":{"start":{"line":26,"column":3,"offset":1503},"end":{"line":26,"column":12,"offset":1512},"indent":[]}},{"type":"text","value":": The message object that triggered the command.","position":{"start":{"line":26,"column":12,"offset":1512},"end":{"line":26,"column":60,"offset":1560},"indent":[]}}],"position":{"start":{"line":26,"column":3,"offset":1503},"end":{"line":26,"column":60,"offset":1560},"indent":[]}}],"position":{"start":{"line":26,"column":1,"offset":1501},"end":{"line":26,"column":60,"offset":1560},"indent":[]}},{"type":"listItem","spread":false,"checked":null,"children":[{"type":"paragraph","children":[{"type":"inlineCode","value":"command","position":{"start":{"line":27,"column":3,"offset":1563},"end":{"line":27,"column":12,"offset":1572},"indent":[]}},{"type":"text","value":": The command object itself that was triggered.","position":{"start":{"line":27,"column":12,"offset":1572},"end":{"line":27,"column":59,"offset":1619},"indent":[]}}],"position":{"start":{"line":27,"column":3,"offset":1563},"end":{"line":27,"column":59,"offset":1619},"indent":[]}}],"position":{"start":{"line":27,"column":1,"offset":1561},"end":{"line":27,"column":59,"offset":1619},"indent":[]}},{"type":"listItem","spread":false,"checked":null,"children":[{"type":"paragraph","children":[{"type":"inlineCode","value":"guild","position":{"start":{"line":28,"column":3,"offset":1622},"end":{"line":28,"column":10,"offset":1629},"indent":[]}},{"type":"text","value":": The server guild object where this command was ran.","position":{"start":{"line":28,"column":10,"offset":1629},"end":{"line":28,"column":63,"offset":1682},"indent":[]}}],"position":{"start":{"line":28,"column":3,"offset":1622},"end":{"line":28,"column":63,"offset":1682},"indent":[]}}],"position":{"start":{"line":28,"column":1,"offset":1620},"end":{"line":28,"column":63,"offset":1682},"indent":[]}}],"position":{"start":{"line":26,"column":1,"offset":1501},"end":{"line":28,"column":63,"offset":1682},"indent":[1,1]}},{"type":"heading","depth":2,"children":[{"type":"text","value":"Understanding How Inhibitors Function","position":{"start":{"line":30,"column":4,"offset":1687},"end":{"line":30,"column":41,"offset":1724},"indent":[]}}],"position":{"start":{"line":30,"column":1,"offset":1684},"end":{"line":30,"column":41,"offset":1724},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"To block a command you have to return a truthy value.","position":{"start":{"line":32,"column":1,"offset":1726},"end":{"line":32,"column":54,"offset":1779},"indent":[]}}],"position":{"start":{"line":32,"column":1,"offset":1726},"end":{"line":32,"column":54,"offset":1779},"indent":[]}},{"type":"list","ordered":false,"start":null,"spread":false,"children":[{"type":"listItem","spread":false,"checked":null,"children":[{"type":"paragraph","children":[{"type":"strong","children":[{"type":"text","value":"return true;","position":{"start":{"line":33,"column":5,"offset":1784},"end":{"line":33,"column":17,"offset":1796},"indent":[]}}],"position":{"start":{"line":33,"column":3,"offset":1782},"end":{"line":33,"column":19,"offset":1798},"indent":[]}},{"type":"text","value":" If you return true the inhibitor will block the execution of the command.\nTo allow a command return a falsey value.","position":{"start":{"line":33,"column":19,"offset":1798},"end":{"line":34,"column":42,"offset":1914},"indent":[1]}}],"position":{"start":{"line":33,"column":3,"offset":1782},"end":{"line":34,"column":42,"offset":1914},"indent":[1]}}],"position":{"start":{"line":33,"column":1,"offset":1780},"end":{"line":34,"column":42,"offset":1914},"indent":[1]}},{"type":"listItem","spread":false,"checked":null,"children":[{"type":"paragraph","children":[{"type":"strong","children":[{"type":"text","value":"return false;","position":{"start":{"line":35,"column":5,"offset":1919},"end":{"line":35,"column":18,"offset":1932},"indent":[]}}],"position":{"start":{"line":35,"column":3,"offset":1917},"end":{"line":35,"column":20,"offset":1934},"indent":[]}},{"type":"text","value":" If you return false the inhibitor will not block the error.","position":{"start":{"line":35,"column":20,"offset":1934},"end":{"line":35,"column":80,"offset":1994},"indent":[]}}],"position":{"start":{"line":35,"column":3,"offset":1917},"end":{"line":35,"column":80,"offset":1994},"indent":[]}}],"position":{"start":{"line":35,"column":1,"offset":1915},"end":{"line":35,"column":80,"offset":1994},"indent":[]}}],"position":{"start":{"line":33,"column":1,"offset":1780},"end":{"line":35,"column":80,"offset":1994},"indent":[1,1]}},{"type":"code","lang":"ts","meta":null,"value":"// If the command is not VIP only we can allow this command to execute\nif (!command.vipOnly) return false;\n\n// The bot's support server\nconst guild = cache.guilds.get(configs.supportServerID);\n// If the command author is not in the server they won't have the vip role\nconst member = guild.members.get(message.author.id) || await getMember(guild.id, message.author.id);\n// Member doesn't exist so cancel the command\nif (!member) {\n\tsendResponse(message, `sorry, but you can not use this command until you become VIP. **Close the IRIS!!!**`)\n\treturn true;\n}\n\n// If the user has the vip role on the support server given by patreon allow the command\nif (member.roles.includes(configs.roleIDs.patreonVIPRoleID)) return false;\n\n// Alert the user they don't have vip and can't use the command\nsendResponse(message, `sorry, but you can not use this command until you become a VIP. I'm sorry, Teal'c. We'll go to Disneyland next year. I promise.`)\n// Cancel the command since the user does not have vip\nreturn true;","position":{"start":{"line":38,"column":1,"offset":1997},"end":{"line":59,"column":4,"offset":3013},"indent":[1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1]}},{"type":"heading","depth":2,"children":[{"type":"text","value":"Updating Command Typings","position":{"start":{"line":61,"column":4,"offset":3018},"end":{"line":61,"column":28,"offset":3042},"indent":[]}}],"position":{"start":{"line":61,"column":1,"offset":3015},"end":{"line":61,"column":28,"offset":3042},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"Since we need a new option on our commands we need to add that. Open the ","position":{"start":{"line":63,"column":1,"offset":3044},"end":{"line":63,"column":74,"offset":3117},"indent":[]}},{"type":"inlineCode","value":"src/types/commands.ts","position":{"start":{"line":63,"column":74,"offset":3117},"end":{"line":63,"column":97,"offset":3140},"indent":[]}},{"type":"text","value":" file and add in the following","position":{"start":{"line":63,"column":97,"offset":3140},"end":{"line":63,"column":127,"offset":3170},"indent":[]}}],"position":{"start":{"line":63,"column":1,"offset":3044},"end":{"line":63,"column":127,"offset":3170},"indent":[]}},{"type":"code","lang":"ts","meta":null,"value":" vipOnly?: boolean;","position":{"start":{"line":65,"column":1,"offset":3172},"end":{"line":67,"column":4,"offset":3202},"indent":[1,1]}},{"type":"paragraph","children":[{"type":"text","value":"Once that is added, you can go into any command","position":{"start":{"line":69,"column":1,"offset":3204},"end":{"line":69,"column":48,"offset":3251},"indent":[]}}],"position":{"start":{"line":69,"column":1,"offset":3204},"end":{"line":69,"column":48,"offset":3251},"indent":[]}},{"type":"heading","depth":2,"children":[{"type":"text","value":"Challenges","position":{"start":{"line":71,"column":4,"offset":3256},"end":{"line":71,"column":14,"offset":3266},"indent":[]}}],"position":{"start":{"line":71,"column":1,"offset":3253},"end":{"line":71,"column":14,"offset":3266},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"Hell yes! We just got through the entire inhibitor section. You have now mastered everything related to inhibitors.","position":{"start":{"line":73,"column":1,"offset":3268},"end":{"line":73,"column":116,"offset":3383},"indent":[]}}],"position":{"start":{"line":73,"column":1,"offset":3268},"end":{"line":73,"column":116,"offset":3383},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"You can now try and get a little more practice with inhibitors by trying to challenge yourself and make your own inhibitors. Don't worry if you can't think of any good use cases for inhibitors.","position":{"start":{"line":75,"column":1,"offset":3385},"end":{"line":75,"column":194,"offset":3578},"indent":[]}}],"position":{"start":{"line":75,"column":1,"offset":3385},"end":{"line":75,"column":194,"offset":3578},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"Majority of Discordeno bots do not use many custom inhibitors because most of the necessary/important ones already come built for you in the inhibitors folder.","position":{"start":{"line":77,"column":1,"offset":3580},"end":{"line":77,"column":160,"offset":3739},"indent":[]}}],"position":{"start":{"line":77,"column":1,"offset":3580},"end":{"line":77,"column":160,"offset":3739},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"Next we will try our hands at creating a monitor.","position":{"start":{"line":79,"column":1,"offset":3741},"end":{"line":79,"column":50,"offset":3790},"indent":[]}}],"position":{"start":{"line":79,"column":1,"offset":3741},"end":{"line":79,"column":50,"offset":3790},"indent":[]}},{"type":"export","value":"export const _frontmatter = {\"title\":\"Creating Inhibitors!\",\"metaTitle\":\"Creating An Inhibitor | Discordeno\",\"metaDescription\":\"Let's create our very own bot with Discordeno!\"}","position":{"start":{"line":82,"column":1,"offset":3793},"end":{"line":82,"column":177,"offset":3969},"indent":[]}}],"position":{"start":{"line":1,"column":1,"offset":0},"end":{"line":82,"column":177,"offset":3969}}},"scopeImports":["import * as React from 'react'"],"scopeIdentifiers":["React"],"body":"function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }\n\nfunction _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }\n\nfunction _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }\n\n/* @jsx mdx */\nvar _frontmatter = {\n \"title\": \"Creating Inhibitors!\",\n \"metaTitle\": \"Creating An Inhibitor | Discordeno\",\n \"metaDescription\": \"Let's create our very own bot with Discordeno!\"\n};\nvar layoutProps = {\n _frontmatter: _frontmatter\n};\nvar MDXLayout = \"wrapper\";\nreturn function MDXContent(_ref) {\n var components = _ref.components,\n props = _objectWithoutProperties(_ref, [\"components\"]);\n\n return mdx(MDXLayout, _extends({}, layoutProps, props, {\n components: components,\n mdxType: \"MDXLayout\"\n }), mdx(\"p\", null, \"Woah! You are almost half way done with understanding all of Discordeno. Amazing isn't it? Something you may have noticed in the last section was there were some options that prevented some commands from running like \", mdx(\"inlineCode\", {\n parentName: \"p\"\n }, \"dmOnly\"), \" or the permission options. we created a setting to prevent the monitor from running in certain channels. What if we wanted to do prevent commands from happening? How would we prevent commands from running?\"), mdx(\"h2\", null, \"What is an Inhibitor?\"), mdx(\"p\", null, \"An Inhibitor is very similar to how monitors work. A monitor runs on every message but an inhibitor runs on every command. Remember all those command options like cooldown, permissions, permissionLevel, nsfw, etc... Each and every one of these options has an inhibitor in that checks commands for these settings.\"), mdx(\"p\", null, \"Let's create our own inhibitor that would prevent commands from being used if the user is not a VIP user.\"), mdx(\"blockquote\", null, mdx(\"p\", {\n parentName: \"blockquote\"\n }, mdx(\"strong\", {\n parentName: \"p\"\n }, \"Note:\"), \" It is important to remember that everything below can be done with a simple permission level as well. We will create our own custom permission levels but for the purposes of this guide and to be able to learn about Inhibitors, we will be using an inhibitor.\")), mdx(\"h2\", null, \"Creating the File\"), mdx(\"p\", null, \"Let's start by creating a file inside the inhibitors folder called \", mdx(\"inlineCode\", {\n parentName: \"p\"\n }, \"boosted.ts\"), \" and paste the following snippet of code:\"), mdx(\"pre\", null, mdx(\"code\", _extends({\n parentName: \"pre\"\n }, {\n \"className\": \"language-ts\"\n }), \"import { botCache } from \\\"../../mod.ts\\\";\\n\\nbotCache.inhibitors.set(\\\"inhibitorname\\\", async function (message, command, guild) {\\n // Your code goes here\\n});\\n\")), mdx(\"p\", null, \"Inhibitors can take up to 3 arguments.\"), mdx(\"ul\", null, mdx(\"li\", {\n parentName: \"ul\"\n }, mdx(\"inlineCode\", {\n parentName: \"li\"\n }, \"message\"), \": The message object that triggered the command.\"), mdx(\"li\", {\n parentName: \"ul\"\n }, mdx(\"inlineCode\", {\n parentName: \"li\"\n }, \"command\"), \": The command object itself that was triggered.\"), mdx(\"li\", {\n parentName: \"ul\"\n }, mdx(\"inlineCode\", {\n parentName: \"li\"\n }, \"guild\"), \": The server guild object where this command was ran.\")), mdx(\"h2\", null, \"Understanding How Inhibitors Function\"), mdx(\"p\", null, \"To block a command you have to return a truthy value.\"), mdx(\"ul\", null, mdx(\"li\", {\n parentName: \"ul\"\n }, mdx(\"strong\", {\n parentName: \"li\"\n }, \"return true;\"), \" If you return true the inhibitor will block the execution of the command.\\nTo allow a command return a falsey value.\"), mdx(\"li\", {\n parentName: \"ul\"\n }, mdx(\"strong\", {\n parentName: \"li\"\n }, \"return false;\"), \" If you return false the inhibitor will not block the error.\")), mdx(\"pre\", null, mdx(\"code\", _extends({\n parentName: \"pre\"\n }, {\n \"className\": \"language-ts\"\n }), \"// If the command is not VIP only we can allow this command to execute\\nif (!command.vipOnly) return false;\\n\\n// The bot's support server\\nconst guild = cache.guilds.get(configs.supportServerID);\\n// If the command author is not in the server they won't have the vip role\\nconst member = guild.members.get(message.author.id) || await getMember(guild.id, message.author.id);\\n// Member doesn't exist so cancel the command\\nif (!member) {\\n sendResponse(message, `sorry, but you can not use this command until you become VIP. **Close the IRIS!!!**`)\\n return true;\\n}\\n\\n// If the user has the vip role on the support server given by patreon allow the command\\nif (member.roles.includes(configs.roleIDs.patreonVIPRoleID)) return false;\\n\\n// Alert the user they don't have vip and can't use the command\\nsendResponse(message, `sorry, but you can not use this command until you become a VIP. I'm sorry, Teal'c. We'll go to Disneyland next year. I promise.`)\\n// Cancel the command since the user does not have vip\\nreturn true;\\n\")), mdx(\"h2\", null, \"Updating Command Typings\"), mdx(\"p\", null, \"Since we need a new option on our commands we need to add that. Open the \", mdx(\"inlineCode\", {\n parentName: \"p\"\n }, \"src/types/commands.ts\"), \" file and add in the following\"), mdx(\"pre\", null, mdx(\"code\", _extends({\n parentName: \"pre\"\n }, {\n \"className\": \"language-ts\"\n }), \" vipOnly?: boolean;\\n\")), mdx(\"p\", null, \"Once that is added, you can go into any command\"), mdx(\"h2\", null, \"Challenges\"), mdx(\"p\", null, \"Hell yes! We just got through the entire inhibitor section. You have now mastered everything related to inhibitors.\"), mdx(\"p\", null, \"You can now try and get a little more practice with inhibitors by trying to challenge yourself and make your own inhibitors. Don't worry if you can't think of any good use cases for inhibitors.\"), mdx(\"p\", null, \"Majority of Discordeno bots do not use many custom inhibitors because most of the necessary/important ones already come built for you in the inhibitors folder.\"), mdx(\"p\", null, \"Next we will try our hands at creating a monitor.\"));\n}\n;\nMDXContent.isMDXComponent = true;","rawMDXOutput":"/* @jsx mdx */\nimport { mdx } from '@mdx-js/react';\n/* @jsx mdx */\n\nexport const _frontmatter = {\n \"title\": \"Creating Inhibitors!\",\n \"metaTitle\": \"Creating An Inhibitor | Discordeno\",\n \"metaDescription\": \"Let's create our very own bot with Discordeno!\"\n};\n\nconst layoutProps = {\n _frontmatter\n};\nconst MDXLayout = \"wrapper\"\nexport default function MDXContent({\n components,\n ...props\n}) {\n return \n

{`Woah! You are almost half way done with understanding all of Discordeno. Amazing isn't it? Something you may have noticed in the last section was there were some options that prevented some commands from running like `}{`dmOnly`}{` or the permission options. we created a setting to prevent the monitor from running in certain channels. What if we wanted to do prevent commands from happening? How would we prevent commands from running?`}

\n

{`What is an Inhibitor?`}

\n

{`An Inhibitor is very similar to how monitors work. A monitor runs on every message but an inhibitor runs on every command. Remember all those command options like cooldown, permissions, permissionLevel, nsfw, etc... Each and every one of these options has an inhibitor in that checks commands for these settings.`}

\n

{`Let's create our own inhibitor that would prevent commands from being used if the user is not a VIP user.`}

\n
\n

{`Note:`}{` It is important to remember that everything below can be done with a simple permission level as well. We will create our own custom permission levels but for the purposes of this guide and to be able to learn about Inhibitors, we will be using an inhibitor.`}

\n
\n

{`Creating the File`}

\n

{`Let's start by creating a file inside the inhibitors folder called `}{`boosted.ts`}{` and paste the following snippet of code:`}

\n
{`import { botCache } from \"../../mod.ts\";\n\nbotCache.inhibitors.set(\"inhibitorname\", async function (message, command, guild) {\n    // Your code goes here\n});\n`}
\n

{`Inhibitors can take up to 3 arguments.`}

\n
    \n
  • {`message`}{`: The message object that triggered the command.`}
  • \n
  • {`command`}{`: The command object itself that was triggered.`}
  • \n
  • {`guild`}{`: The server guild object where this command was ran.`}
  • \n
\n

{`Understanding How Inhibitors Function`}

\n

{`To block a command you have to return a truthy value.`}

\n
    \n
  • {`return true;`}{` If you return true the inhibitor will block the execution of the command.\nTo allow a command return a falsey value.`}
  • \n
  • {`return false;`}{` If you return false the inhibitor will not block the error.`}
  • \n
\n
{`// If the command is not VIP only we can allow this command to execute\nif (!command.vipOnly) return false;\n\n// The bot's support server\nconst guild = cache.guilds.get(configs.supportServerID);\n// If the command author is not in the server they won't have the vip role\nconst member = guild.members.get(message.author.id) || await getMember(guild.id, message.author.id);\n// Member doesn't exist so cancel the command\nif (!member) {\n    sendResponse(message, \\`sorry, but you can not use this command until you become VIP. **Close the IRIS!!!**\\`)\n    return true;\n}\n\n// If the user has the vip role on the support server given by patreon allow the command\nif (member.roles.includes(configs.roleIDs.patreonVIPRoleID)) return false;\n\n// Alert the user they don't have vip and can't use the command\nsendResponse(message, \\`sorry, but you can not use this command until you become a VIP. I'm sorry, Teal'c. We'll go to Disneyland next year. I promise.\\`)\n// Cancel the command since the user does not have vip\nreturn true;\n`}
\n

{`Updating Command Typings`}

\n

{`Since we need a new option on our commands we need to add that. Open the `}{`src/types/commands.ts`}{` file and add in the following`}

\n
{`  vipOnly?: boolean;\n`}
\n

{`Once that is added, you can go into any command`}

\n

{`Challenges`}

\n

{`Hell yes! We just got through the entire inhibitor section. You have now mastered everything related to inhibitors.`}

\n

{`You can now try and get a little more practice with inhibitors by trying to challenge yourself and make your own inhibitors. Don't worry if you can't think of any good use cases for inhibitors.`}

\n

{`Majority of Discordeno bots do not use many custom inhibitors because most of the necessary/important ones already come built for you in the inhibitors folder.`}

\n

{`Next we will try our hands at creating a monitor.`}

\n\n
;\n}\n\n;\nMDXContent.isMDXComponent = true;"}} \ No newline at end of file diff --git a/docs/.cache/caches/gatsby-plugin-mdx/diskstore-ec40168b8fd40a8eb0f724b4c6cc08fa.json b/docs/.cache/caches/gatsby-plugin-mdx/diskstore-ec40168b8fd40a8eb0f724b4c6cc08fa.json new file mode 100644 index 000000000..58adff67d --- /dev/null +++ b/docs/.cache/caches/gatsby-plugin-mdx/diskstore-ec40168b8fd40a8eb0f724b4c6cc08fa.json @@ -0,0 +1 @@ +{"expireTime":9007200851632125000,"key":"gatsby-plugin-mdx-entire-payload-1b4d929b79efe91bcaa6c55d9be70894-","val":{"mdast":{"type":"root","children":[{"type":"paragraph","children":[{"type":"text","value":"Woah! You are almost half way done with understanding all of Discordeno. Amazing isn't it? Something you may have noticed in the last section was there were some options that prevented some commands from running like ","position":{"start":{"line":2,"column":1,"offset":1},"end":{"line":2,"column":218,"offset":218},"indent":[]}},{"type":"inlineCode","value":"dmOnly","position":{"start":{"line":2,"column":218,"offset":218},"end":{"line":2,"column":226,"offset":226},"indent":[]}},{"type":"text","value":" or the permission options. we created a setting to prevent the monitor from running in certain channels. What if we wanted to do prevent commands from happening? How would we prevent commands from running?","position":{"start":{"line":2,"column":226,"offset":226},"end":{"line":2,"column":432,"offset":432},"indent":[]}}],"position":{"start":{"line":2,"column":1,"offset":1},"end":{"line":2,"column":432,"offset":432},"indent":[]}},{"type":"heading","depth":2,"children":[{"type":"text","value":"What is an Inhibitor?","position":{"start":{"line":4,"column":4,"offset":437},"end":{"line":4,"column":25,"offset":458},"indent":[]}}],"position":{"start":{"line":4,"column":1,"offset":434},"end":{"line":4,"column":25,"offset":458},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"An Inhibitor is very similar to how monitors work. A monitor runs on every message but an inhibitor runs on every command. Remember all those command options like cooldown, permissions, permissionLevel, nsfw, etc... Each and every one of these options has an inhibitor in that checks commands for these settings.","position":{"start":{"line":6,"column":1,"offset":460},"end":{"line":6,"column":313,"offset":772},"indent":[]}}],"position":{"start":{"line":6,"column":1,"offset":460},"end":{"line":6,"column":313,"offset":772},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"Let's create our own inhibitor that would prevent commands from being used if the user is not a VIP user.","position":{"start":{"line":8,"column":1,"offset":774},"end":{"line":8,"column":106,"offset":879},"indent":[]}}],"position":{"start":{"line":8,"column":1,"offset":774},"end":{"line":8,"column":106,"offset":879},"indent":[]}},{"type":"blockquote","children":[{"type":"paragraph","children":[{"type":"strong","children":[{"type":"text","value":"Note:","position":{"start":{"line":10,"column":5,"offset":885},"end":{"line":10,"column":10,"offset":890},"indent":[]}}],"position":{"start":{"line":10,"column":3,"offset":883},"end":{"line":10,"column":12,"offset":892},"indent":[]}},{"type":"text","value":" It is important to remember that everything below can be done with a simple permission level as well. We will create our own custom permission levels but for the purposes of this guide and to be able to learn about Inhibitors, we will be using an inhibitor.","position":{"start":{"line":10,"column":12,"offset":892},"end":{"line":10,"column":270,"offset":1150},"indent":[]}}],"position":{"start":{"line":10,"column":3,"offset":883},"end":{"line":10,"column":270,"offset":1150},"indent":[]}}],"position":{"start":{"line":10,"column":1,"offset":881},"end":{"line":10,"column":270,"offset":1150},"indent":[]}},{"type":"export","value":"export const _frontmatter = {\"title\":\"Creating Inhibitors!\",\"metaTitle\":\"Creating An Inhibitor | Discordeno\",\"metaDescription\":\"Let's create our very own bot with Discordeno!\"}","position":{"start":{"line":13,"column":1,"offset":1153},"end":{"line":13,"column":177,"offset":1329},"indent":[]}}],"position":{"start":{"line":1,"column":1,"offset":0},"end":{"line":13,"column":177,"offset":1329}}},"scopeImports":["import * as React from 'react'"],"scopeIdentifiers":["React"],"body":"function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }\n\nfunction _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }\n\nfunction _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }\n\n/* @jsx mdx */\nvar _frontmatter = {\n \"title\": \"Creating Inhibitors!\",\n \"metaTitle\": \"Creating An Inhibitor | Discordeno\",\n \"metaDescription\": \"Let's create our very own bot with Discordeno!\"\n};\nvar layoutProps = {\n _frontmatter: _frontmatter\n};\nvar MDXLayout = \"wrapper\";\nreturn function MDXContent(_ref) {\n var components = _ref.components,\n props = _objectWithoutProperties(_ref, [\"components\"]);\n\n return mdx(MDXLayout, _extends({}, layoutProps, props, {\n components: components,\n mdxType: \"MDXLayout\"\n }), mdx(\"p\", null, \"Woah! You are almost half way done with understanding all of Discordeno. Amazing isn't it? Something you may have noticed in the last section was there were some options that prevented some commands from running like \", mdx(\"inlineCode\", {\n parentName: \"p\"\n }, \"dmOnly\"), \" or the permission options. we created a setting to prevent the monitor from running in certain channels. What if we wanted to do prevent commands from happening? How would we prevent commands from running?\"), mdx(\"h2\", null, \"What is an Inhibitor?\"), mdx(\"p\", null, \"An Inhibitor is very similar to how monitors work. A monitor runs on every message but an inhibitor runs on every command. Remember all those command options like cooldown, permissions, permissionLevel, nsfw, etc... Each and every one of these options has an inhibitor in that checks commands for these settings.\"), mdx(\"p\", null, \"Let's create our own inhibitor that would prevent commands from being used if the user is not a VIP user.\"), mdx(\"blockquote\", null, mdx(\"p\", {\n parentName: \"blockquote\"\n }, mdx(\"strong\", {\n parentName: \"p\"\n }, \"Note:\"), \" It is important to remember that everything below can be done with a simple permission level as well. We will create our own custom permission levels but for the purposes of this guide and to be able to learn about Inhibitors, we will be using an inhibitor.\")));\n}\n;\nMDXContent.isMDXComponent = true;","rawMDXOutput":"/* @jsx mdx */\nimport { mdx } from '@mdx-js/react';\n/* @jsx mdx */\n\nexport const _frontmatter = {\n \"title\": \"Creating Inhibitors!\",\n \"metaTitle\": \"Creating An Inhibitor | Discordeno\",\n \"metaDescription\": \"Let's create our very own bot with Discordeno!\"\n};\n\nconst layoutProps = {\n _frontmatter\n};\nconst MDXLayout = \"wrapper\"\nexport default function MDXContent({\n components,\n ...props\n}) {\n return \n

{`Woah! You are almost half way done with understanding all of Discordeno. Amazing isn't it? Something you may have noticed in the last section was there were some options that prevented some commands from running like `}{`dmOnly`}{` or the permission options. we created a setting to prevent the monitor from running in certain channels. What if we wanted to do prevent commands from happening? How would we prevent commands from running?`}

\n

{`What is an Inhibitor?`}

\n

{`An Inhibitor is very similar to how monitors work. A monitor runs on every message but an inhibitor runs on every command. Remember all those command options like cooldown, permissions, permissionLevel, nsfw, etc... Each and every one of these options has an inhibitor in that checks commands for these settings.`}

\n

{`Let's create our own inhibitor that would prevent commands from being used if the user is not a VIP user.`}

\n
\n

{`Note:`}{` It is important to remember that everything below can be done with a simple permission level as well. We will create our own custom permission levels but for the purposes of this guide and to be able to learn about Inhibitors, we will be using an inhibitor.`}

\n
\n\n
;\n}\n\n;\nMDXContent.isMDXComponent = true;"}} \ No newline at end of file diff --git a/docs/.cache/caches/gatsby-plugin-mdx/diskstore-ecc80478ddecaf48c545ae511c42e960.json b/docs/.cache/caches/gatsby-plugin-mdx/diskstore-ecc80478ddecaf48c545ae511c42e960.json new file mode 100644 index 000000000..ed4b6a48a --- /dev/null +++ b/docs/.cache/caches/gatsby-plugin-mdx/diskstore-ecc80478ddecaf48c545ae511c42e960.json @@ -0,0 +1 @@ +{"expireTime":9007200851644290000,"key":"gatsby-plugin-mdx-entire-payload-855df4e788fb5585820c105522185416-","val":{"mdast":{"type":"root","children":[{"type":"paragraph","children":[{"type":"text","value":"Discordeno will help make Discord bot development much easier. Don't worry, as you go through this guide it will make a lot more sense.","position":{"start":{"line":2,"column":1,"offset":1},"end":{"line":2,"column":136,"offset":136},"indent":[]}}],"position":{"start":{"line":2,"column":1,"offset":1},"end":{"line":2,"column":136,"offset":136},"indent":[]}},{"type":"heading","depth":2,"children":[{"type":"text","value":"Creating The Bot!","position":{"start":{"line":4,"column":4,"offset":141},"end":{"line":4,"column":21,"offset":158},"indent":[]}}],"position":{"start":{"line":4,"column":1,"offset":138},"end":{"line":4,"column":21,"offset":158},"indent":[]}},{"type":"blockquote","children":[{"type":"paragraph","children":[{"type":"text","value":"This guide is going to assume you already have the basic requirements to make a bot ready. This includes github, git, a code editor like Visual Studio Code. If you don't have these yet please prepare them first before going forward.","position":{"start":{"line":6,"column":3,"offset":162},"end":{"line":6,"column":235,"offset":394},"indent":[]}}],"position":{"start":{"line":6,"column":3,"offset":162},"end":{"line":6,"column":235,"offset":394},"indent":[]}}],"position":{"start":{"line":6,"column":1,"offset":160},"end":{"line":6,"column":235,"offset":394},"indent":[]}},{"type":"list","ordered":false,"start":null,"spread":true,"children":[{"type":"listItem","spread":false,"checked":null,"children":[{"type":"paragraph","children":[{"type":"text","value":"First, create a Discordeno Bot using the ","position":{"start":{"line":8,"column":3,"offset":398},"end":{"line":8,"column":44,"offset":439},"indent":[]}},{"type":"link","title":null,"url":"https://github.com/Skillz4Killz/Discordeno-bot-template","children":[{"type":"text","value":"Generator Boilerplate","position":{"start":{"line":8,"column":45,"offset":440},"end":{"line":8,"column":66,"offset":461},"indent":[]}}],"position":{"start":{"line":8,"column":44,"offset":439},"end":{"line":8,"column":124,"offset":519},"indent":[]}},{"type":"text","value":". Give it any name you like. For the purpose of this guide we will call it, Stargate.","position":{"start":{"line":8,"column":124,"offset":519},"end":{"line":8,"column":209,"offset":604},"indent":[]}}],"position":{"start":{"line":8,"column":3,"offset":398},"end":{"line":8,"column":209,"offset":604},"indent":[]}}],"position":{"start":{"line":8,"column":1,"offset":396},"end":{"line":9,"column":1,"offset":605},"indent":[1]}},{"type":"listItem","spread":false,"checked":null,"children":[{"type":"paragraph","children":[{"type":"text","value":"Then ","position":{"start":{"line":10,"column":3,"offset":608},"end":{"line":10,"column":8,"offset":613},"indent":[]}},{"type":"inlineCode","value":"git clone https://github.com/Skillz4Killz/Stargate.git","position":{"start":{"line":10,"column":8,"offset":613},"end":{"line":10,"column":64,"offset":669},"indent":[]}}],"position":{"start":{"line":10,"column":3,"offset":608},"end":{"line":10,"column":64,"offset":669},"indent":[]}}],"position":{"start":{"line":10,"column":1,"offset":606},"end":{"line":11,"column":1,"offset":670},"indent":[1]}},{"type":"listItem","spread":false,"checked":null,"children":[{"type":"paragraph","children":[{"type":"text","value":"When that is done, go ahead and open up the folder with VSC.","position":{"start":{"line":12,"column":3,"offset":673},"end":{"line":12,"column":63,"offset":733},"indent":[]}}],"position":{"start":{"line":12,"column":3,"offset":673},"end":{"line":12,"column":63,"offset":733},"indent":[]}}],"position":{"start":{"line":12,"column":1,"offset":671},"end":{"line":12,"column":63,"offset":733},"indent":[]}},{"type":"listItem","spread":false,"checked":null,"children":[{"type":"paragraph","children":[{"type":"text","value":"Create a new file called ","position":{"start":{"line":13,"column":3,"offset":736},"end":{"line":13,"column":28,"offset":761},"indent":[]}},{"type":"inlineCode","value":"configs.ts","position":{"start":{"line":13,"column":28,"offset":761},"end":{"line":13,"column":40,"offset":773},"indent":[]}},{"type":"text","value":". Open the ","position":{"start":{"line":13,"column":40,"offset":773},"end":{"line":13,"column":51,"offset":784},"indent":[]}},{"type":"inlineCode","value":"configs.example.ts","position":{"start":{"line":13,"column":51,"offset":784},"end":{"line":13,"column":71,"offset":804},"indent":[]}},{"type":"text","value":" file and copy everything over.","position":{"start":{"line":13,"column":71,"offset":804},"end":{"line":13,"column":102,"offset":835},"indent":[]}}],"position":{"start":{"line":13,"column":3,"offset":736},"end":{"line":13,"column":102,"offset":835},"indent":[]}}],"position":{"start":{"line":13,"column":1,"offset":734},"end":{"line":13,"column":102,"offset":835},"indent":[]}}],"position":{"start":{"line":8,"column":1,"offset":396},"end":{"line":13,"column":102,"offset":835},"indent":[1,1,1,1,1]}},{"type":"paragraph","children":[{"type":"text","value":"Let's take a minute to review all the options we have available to us.","position":{"start":{"line":15,"column":1,"offset":837},"end":{"line":15,"column":71,"offset":907},"indent":[]}}],"position":{"start":{"line":15,"column":1,"offset":837},"end":{"line":15,"column":71,"offset":907},"indent":[]}},{"type":"heading","depth":3,"children":[{"type":"text","value":"Configs File","position":{"start":{"line":17,"column":5,"offset":913},"end":{"line":17,"column":17,"offset":925},"indent":[]}}],"position":{"start":{"line":17,"column":1,"offset":909},"end":{"line":17,"column":17,"offset":925},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"The ","position":{"start":{"line":19,"column":1,"offset":927},"end":{"line":19,"column":5,"offset":931},"indent":[]}},{"type":"inlineCode","value":"configs.ts","position":{"start":{"line":19,"column":5,"offset":931},"end":{"line":19,"column":17,"offset":943},"indent":[]}},{"type":"text","value":" file is where you will keep all your secret info you don't want to share with anyone else. As long as ","position":{"start":{"line":19,"column":17,"offset":943},"end":{"line":19,"column":120,"offset":1046},"indent":[]}},{"type":"inlineCode","value":".gitignore","position":{"start":{"line":19,"column":120,"offset":1046},"end":{"line":19,"column":132,"offset":1058},"indent":[]}},{"type":"text","value":" file is ignoring configs.ts your configurations will be kept private!","position":{"start":{"line":19,"column":132,"offset":1058},"end":{"line":19,"column":202,"offset":1128},"indent":[]}}],"position":{"start":{"line":19,"column":1,"offset":927},"end":{"line":19,"column":202,"offset":1128},"indent":[]}},{"type":"code","lang":"ts","meta":null,"value":"// Step 1: Remove the `.example` from this file name so it is called `configs.ts`\n// Step 2: Add all your bot's information below. The only required one is token and prefix. NOTE: As long as `.gitignore` file is ignoring configs.ts your configurations will be kept private!\n// Step 3: Remove these comments if you like.\n\nexport const configs = {\n // Your bot token goes here\n token: \"\",\n // The default prefix for your bot. Don't worry guilds can change this later.\n prefix: \"!\",\n // This isn't required but you can add bot list api keys here.\n botListTokens: {\n DISCORD_BOT_ORG: \"\",\n BOTS_ON_DISCORD: \"\",\n DISCORD_BOT_LIST: \"\",\n BOTS_FOR_DISCORD: \"\",\n DISCORD_BOATS: \"\",\n DISCORD_BOTS_GG: \"\",\n DISCORD_BOTS_GROUP: \"\",\n },\n // This is the server id for your bot's main server where users can get help/support\n supportServerID: \"\",\n // These are channel ids that will enable some functionality\n channelIDs: {\n // When a translation is missing this is the channel you will be alerted in.\n missingTranslation: \"\",\n // When an error occurs, we will try and log it to this channel\n errorChannelID: \"\"\n },\n // These are the role ids that will enable some functionality.\n roleIDs: {\n // If you have a patreon set up you can add the patreon vip role id here.\n patreonVIPRoleID: \"\",\n },\n // These are the user ids that will enable some functionality.\n userIDs: {\n // The user ids for the support team\n botSupporters: [],\n // The user ids for the other devs on your team\n botDevs: [],\n // The user ids who have complete 100% access to your bot\n botOwners: []\n }\n};\n","position":{"start":{"line":21,"column":1,"offset":1130},"end":{"line":66,"column":4,"offset":2770},"indent":[1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1]}},{"type":"heading","depth":4,"children":[{"type":"text","value":"Token","position":{"start":{"line":68,"column":6,"offset":2777},"end":{"line":68,"column":11,"offset":2782},"indent":[]}}],"position":{"start":{"line":68,"column":1,"offset":2772},"end":{"line":68,"column":11,"offset":2782},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"First, add your bot token. This is ","position":{"start":{"line":70,"column":1,"offset":2784},"end":{"line":70,"column":36,"offset":2819},"indent":[]}},{"type":"strong","children":[{"type":"text","value":"required","position":{"start":{"line":70,"column":38,"offset":2821},"end":{"line":70,"column":46,"offset":2829},"indent":[]}}],"position":{"start":{"line":70,"column":36,"offset":2819},"end":{"line":70,"column":48,"offset":2831},"indent":[]}},{"type":"text","value":" for the bot to start. Review the ","position":{"start":{"line":70,"column":48,"offset":2831},"end":{"line":70,"column":82,"offset":2865},"indent":[]}},{"type":"link","title":null,"url":"https://discordeno.netlify.app/gettingstarted#creatingyourfirstdiscordbotapplication","children":[{"type":"text","value":"instructions","position":{"start":{"line":70,"column":83,"offset":2866},"end":{"line":70,"column":95,"offset":2878},"indent":[]}}],"position":{"start":{"line":70,"column":82,"offset":2865},"end":{"line":70,"column":182,"offset":2965},"indent":[]}},{"type":"text","value":" if you have not made your token yet.","position":{"start":{"line":70,"column":182,"offset":2965},"end":{"line":70,"column":219,"offset":3002},"indent":[]}}],"position":{"start":{"line":70,"column":1,"offset":2784},"end":{"line":70,"column":219,"offset":3002},"indent":[]}},{"type":"heading","depth":4,"children":[{"type":"text","value":"Prefix","position":{"start":{"line":72,"column":6,"offset":3009},"end":{"line":72,"column":12,"offset":3015},"indent":[]}}],"position":{"start":{"line":72,"column":1,"offset":3004},"end":{"line":72,"column":12,"offset":3015},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"The prefix is where you will set the default prefix for your bot. Don't worry, every server will be able to choose their own prefix but we need a default prefix to start.","position":{"start":{"line":74,"column":1,"offset":3017},"end":{"line":74,"column":171,"offset":3187},"indent":[]}}],"position":{"start":{"line":74,"column":1,"offset":3017},"end":{"line":74,"column":171,"offset":3187},"indent":[]}},{"type":"heading","depth":4,"children":[{"type":"text","value":"Bot Lists Tokens","position":{"start":{"line":76,"column":6,"offset":3194},"end":{"line":76,"column":22,"offset":3210},"indent":[]}}],"position":{"start":{"line":76,"column":1,"offset":3189},"end":{"line":76,"column":22,"offset":3210},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"This section of the file is so you can easily have your bot's statistics updated on all the bot lists out there to help you grow your bot. The code is already written to handle this but you will need to do 3 things for each bot list.","position":{"start":{"line":78,"column":1,"offset":3212},"end":{"line":78,"column":234,"offset":3445},"indent":[]}}],"position":{"start":{"line":78,"column":1,"offset":3212},"end":{"line":78,"column":234,"offset":3445},"indent":[]}},{"type":"list","ordered":true,"start":1,"spread":false,"children":[{"type":"listItem","spread":false,"checked":null,"children":[{"type":"paragraph","children":[{"type":"text","value":"Go to the bot list and add your bot to their website. (Each site has it's own instructions)","position":{"start":{"line":80,"column":4,"offset":3450},"end":{"line":80,"column":95,"offset":3541},"indent":[]}}],"position":{"start":{"line":80,"column":4,"offset":3450},"end":{"line":80,"column":95,"offset":3541},"indent":[]}}],"position":{"start":{"line":80,"column":1,"offset":3447},"end":{"line":80,"column":95,"offset":3541},"indent":[]}},{"type":"listItem","spread":false,"checked":null,"children":[{"type":"paragraph","children":[{"type":"text","value":"Create a token for yourself on each website and paste it in your configs.","position":{"start":{"line":81,"column":4,"offset":3545},"end":{"line":81,"column":77,"offset":3618},"indent":[]}}],"position":{"start":{"line":81,"column":4,"offset":3545},"end":{"line":81,"column":77,"offset":3618},"indent":[]}}],"position":{"start":{"line":81,"column":1,"offset":3542},"end":{"line":81,"column":77,"offset":3618},"indent":[]}},{"type":"listItem","spread":false,"checked":null,"children":[{"type":"paragraph","children":[{"type":"text","value":"Enjoy!","position":{"start":{"line":82,"column":4,"offset":3622},"end":{"line":82,"column":10,"offset":3628},"indent":[]}}],"position":{"start":{"line":82,"column":4,"offset":3622},"end":{"line":82,"column":10,"offset":3628},"indent":[]}}],"position":{"start":{"line":82,"column":1,"offset":3619},"end":{"line":82,"column":10,"offset":3628},"indent":[]}}],"position":{"start":{"line":80,"column":1,"offset":3447},"end":{"line":82,"column":10,"offset":3628},"indent":[1,1]}},{"type":"paragraph","children":[{"type":"text","value":"If you wish to customize the code, you will find the bot list tasks in the tasks folder. Don't worry we will discuss this when we get to the tasks section of the guide.","position":{"start":{"line":84,"column":1,"offset":3630},"end":{"line":84,"column":169,"offset":3798},"indent":[]}}],"position":{"start":{"line":84,"column":1,"offset":3630},"end":{"line":84,"column":169,"offset":3798},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"For now just remember, that Discordeno provides you a built in way to update most discord bot lists.","position":{"start":{"line":86,"column":1,"offset":3800},"end":{"line":86,"column":101,"offset":3900},"indent":[]}}],"position":{"start":{"line":86,"column":1,"offset":3800},"end":{"line":86,"column":101,"offset":3900},"indent":[]}},{"type":"heading","depth":4,"children":[{"type":"text","value":"Channel IDs","position":{"start":{"line":88,"column":6,"offset":3907},"end":{"line":88,"column":17,"offset":3918},"indent":[]}}],"position":{"start":{"line":88,"column":1,"offset":3902},"end":{"line":88,"column":17,"offset":3918},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"The channelIDs section holds the channel IDs that are useful for specific features to help give you alerts/notifications. For example, the ","position":{"start":{"line":90,"column":1,"offset":3920},"end":{"line":90,"column":140,"offset":4059},"indent":[]}},{"type":"inlineCode","value":"missingTranslation","position":{"start":{"line":90,"column":140,"offset":4059},"end":{"line":90,"column":160,"offset":4079},"indent":[]}},{"type":"text","value":" channel will be where messages are sent alerting you that somewhere in your code you are trying to use a translation key that you never created.","position":{"start":{"line":90,"column":160,"offset":4079},"end":{"line":90,"column":305,"offset":4224},"indent":[]}}],"position":{"start":{"line":90,"column":1,"offset":3920},"end":{"line":90,"column":305,"offset":4224},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"When you get to around 25,000 Discord servers on your bot, you may want to convert these channel IDs to webhooks.","position":{"start":{"line":92,"column":1,"offset":4226},"end":{"line":92,"column":114,"offset":4339},"indent":[]}}],"position":{"start":{"line":92,"column":1,"offset":4226},"end":{"line":92,"column":114,"offset":4339},"indent":[]}},{"type":"heading","depth":4,"children":[{"type":"text","value":"Role IDs","position":{"start":{"line":94,"column":6,"offset":4346},"end":{"line":94,"column":14,"offset":4354},"indent":[]}}],"position":{"start":{"line":94,"column":1,"offset":4341},"end":{"line":94,"column":14,"offset":4354},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"The roleIDs section holds the role IDs that are useful for specific features. For example, the ","position":{"start":{"line":96,"column":1,"offset":4356},"end":{"line":96,"column":96,"offset":4451},"indent":[]}},{"type":"inlineCode","value":"patreonVIPRoleID","position":{"start":{"line":96,"column":96,"offset":4451},"end":{"line":96,"column":114,"offset":4469},"indent":[]}},{"type":"text","value":" role can be used easily to enable vip features later in this guide.","position":{"start":{"line":96,"column":114,"offset":4469},"end":{"line":96,"column":182,"offset":4537},"indent":[]}}],"position":{"start":{"line":96,"column":1,"offset":4356},"end":{"line":96,"column":182,"offset":4537},"indent":[]}},{"type":"heading","depth":4,"children":[{"type":"text","value":"User IDs","position":{"start":{"line":98,"column":6,"offset":4544},"end":{"line":98,"column":14,"offset":4552},"indent":[]}}],"position":{"start":{"line":98,"column":1,"offset":4539},"end":{"line":98,"column":14,"offset":4552},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"The userIDs section holds the user IDs that are useful for specific features. For example, the ","position":{"start":{"line":100,"column":1,"offset":4554},"end":{"line":100,"column":96,"offset":4649},"indent":[]}},{"type":"inlineCode","value":"botDevs","position":{"start":{"line":100,"column":96,"offset":4649},"end":{"line":100,"column":105,"offset":4658},"indent":[]}},{"type":"text","value":" and such are useful for permission levels as you will see in the Permission Level part of the guide.","position":{"start":{"line":100,"column":105,"offset":4658},"end":{"line":100,"column":206,"offset":4759},"indent":[]}}],"position":{"start":{"line":100,"column":1,"offset":4554},"end":{"line":100,"column":206,"offset":4759},"indent":[]}},{"type":"heading","depth":2,"children":[{"type":"text","value":"It's Alive!","position":{"start":{"line":102,"column":4,"offset":4764},"end":{"line":102,"column":15,"offset":4775},"indent":[]}}],"position":{"start":{"line":102,"column":1,"offset":4761},"end":{"line":102,"column":15,"offset":4775},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"Oh my god! You now have a bot with a bunch of features already! You don't believe me? Well, seeing is believing, so start the bot.","position":{"start":{"line":104,"column":1,"offset":4777},"end":{"line":104,"column":131,"offset":4907},"indent":[]}}],"position":{"start":{"line":104,"column":1,"offset":4777},"end":{"line":104,"column":131,"offset":4907},"indent":[]}},{"type":"list","ordered":true,"start":1,"spread":false,"children":[{"type":"listItem","spread":false,"checked":null,"children":[{"type":"paragraph","children":[{"type":"text","value":"Invite your bot to a discord server.","position":{"start":{"line":106,"column":4,"offset":4912},"end":{"line":106,"column":40,"offset":4948},"indent":[]}}],"position":{"start":{"line":106,"column":4,"offset":4912},"end":{"line":106,"column":40,"offset":4948},"indent":[]}}],"position":{"start":{"line":106,"column":1,"offset":4909},"end":{"line":106,"column":40,"offset":4948},"indent":[]}},{"type":"listItem","spread":false,"checked":null,"children":[{"type":"paragraph","children":[{"type":"text","value":"Open up the integrated terminal in VSC using ","position":{"start":{"line":107,"column":4,"offset":4952},"end":{"line":107,"column":49,"offset":4997},"indent":[]}},{"type":"strong","children":[{"type":"text","value":"CTRL + `","position":{"start":{"line":107,"column":51,"offset":4999},"end":{"line":107,"column":59,"offset":5007},"indent":[]}}],"position":{"start":{"line":107,"column":49,"offset":4997},"end":{"line":107,"column":61,"offset":5009},"indent":[]}},{"type":"text","value":". If you use a Mac, replace CTRL with CMD.","position":{"start":{"line":107,"column":61,"offset":5009},"end":{"line":107,"column":103,"offset":5051},"indent":[]}}],"position":{"start":{"line":107,"column":4,"offset":4952},"end":{"line":107,"column":103,"offset":5051},"indent":[]}}],"position":{"start":{"line":107,"column":1,"offset":4949},"end":{"line":107,"column":103,"offset":5051},"indent":[]}},{"type":"listItem","spread":false,"checked":null,"children":[{"type":"paragraph","children":[{"type":"text","value":"Run the script below:","position":{"start":{"line":108,"column":4,"offset":5055},"end":{"line":108,"column":25,"offset":5076},"indent":[]}}],"position":{"start":{"line":108,"column":4,"offset":5055},"end":{"line":108,"column":25,"offset":5076},"indent":[]}}],"position":{"start":{"line":108,"column":1,"offset":5052},"end":{"line":108,"column":25,"offset":5076},"indent":[]}}],"position":{"start":{"line":106,"column":1,"offset":4909},"end":{"line":108,"column":25,"offset":5076},"indent":[1,1]}},{"type":"code","lang":"shell","meta":null,"value":"deno run --allow-net --allow-read mod.ts","position":{"start":{"line":110,"column":1,"offset":5078},"end":{"line":112,"column":4,"offset":5131},"indent":[1,1]}},{"type":"paragraph","children":[{"type":"text","value":"The first time you run it, you may see a lot of files being loaded. This is preparing all the magic behind the scene. Once it is ready, you will see something like this:","position":{"start":{"line":114,"column":1,"offset":5133},"end":{"line":114,"column":170,"offset":5302},"indent":[]}}],"position":{"start":{"line":114,"column":1,"offset":5133},"end":{"line":114,"column":170,"offset":5302},"indent":[]}},{"type":"paragraph","children":[{"type":"image","title":null,"url":"https://i.imgur.com/TOXjLgh.png","alt":"image","position":{"start":{"line":116,"column":1,"offset":5304},"end":{"line":116,"column":42,"offset":5345},"indent":[]}}],"position":{"start":{"line":116,"column":1,"offset":5304},"end":{"line":116,"column":42,"offset":5345},"indent":[]}},{"type":"heading","depth":2,"children":[{"type":"text","value":"Understanding What Discordeno Did","position":{"start":{"line":118,"column":4,"offset":5350},"end":{"line":118,"column":37,"offset":5383},"indent":[]}}],"position":{"start":{"line":118,"column":1,"offset":5347},"end":{"line":118,"column":37,"offset":5383},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"Discordeno includes these commands/folders as they are essential for any discord bot to have in order to meet the Discord Bot Best Practices. It also adds a few things that will help make some things easier to build a bot.","position":{"start":{"line":120,"column":1,"offset":5385},"end":{"line":120,"column":223,"offset":5607},"indent":[]}}],"position":{"start":{"line":120,"column":1,"offset":5385},"end":{"line":120,"column":223,"offset":5607},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"We will dive into these deeper in this guide. Let's take it step by step.","position":{"start":{"line":122,"column":1,"offset":5609},"end":{"line":122,"column":74,"offset":5682},"indent":[]}}],"position":{"start":{"line":122,"column":1,"offset":5609},"end":{"line":122,"column":74,"offset":5682},"indent":[]}},{"type":"export","value":"export const _frontmatter = {\"title\":\"Creating The Bot!\",\"metaTitle\":\"Creating A Bot | Discordeno\",\"metaDescription\":\"Let's create our very own bot with Discordeno!\"}","position":{"start":{"line":125,"column":1,"offset":5685},"end":{"line":125,"column":167,"offset":5851},"indent":[]}}],"position":{"start":{"line":1,"column":1,"offset":0},"end":{"line":125,"column":167,"offset":5851}}},"scopeImports":["import * as React from 'react'"],"scopeIdentifiers":["React"],"body":"function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }\n\nfunction _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }\n\nfunction _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }\n\n/* @jsx mdx */\nvar _frontmatter = {\n \"title\": \"Creating The Bot!\",\n \"metaTitle\": \"Creating A Bot | Discordeno\",\n \"metaDescription\": \"Let's create our very own bot with Discordeno!\"\n};\nvar layoutProps = {\n _frontmatter: _frontmatter\n};\nvar MDXLayout = \"wrapper\";\nreturn function MDXContent(_ref) {\n var components = _ref.components,\n props = _objectWithoutProperties(_ref, [\"components\"]);\n\n return mdx(MDXLayout, _extends({}, layoutProps, props, {\n components: components,\n mdxType: \"MDXLayout\"\n }), mdx(\"p\", null, \"Discordeno will help make Discord bot development much easier. Don't worry, as you go through this guide it will make a lot more sense.\"), mdx(\"h2\", null, \"Creating The Bot!\"), mdx(\"blockquote\", null, mdx(\"p\", {\n parentName: \"blockquote\"\n }, \"This guide is going to assume you already have the basic requirements to make a bot ready. This includes github, git, a code editor like Visual Studio Code. If you don't have these yet please prepare them first before going forward.\")), mdx(\"ul\", null, mdx(\"li\", {\n parentName: \"ul\"\n }, mdx(\"p\", {\n parentName: \"li\"\n }, \"First, create a Discordeno Bot using the \", mdx(\"a\", _extends({\n parentName: \"p\"\n }, {\n \"href\": \"https://github.com/Skillz4Killz/Discordeno-bot-template\"\n }), \"Generator Boilerplate\"), \". Give it any name you like. For the purpose of this guide we will call it, Stargate.\")), mdx(\"li\", {\n parentName: \"ul\"\n }, mdx(\"p\", {\n parentName: \"li\"\n }, \"Then \", mdx(\"inlineCode\", {\n parentName: \"p\"\n }, \"git clone https://github.com/Skillz4Killz/Stargate.git\"))), mdx(\"li\", {\n parentName: \"ul\"\n }, mdx(\"p\", {\n parentName: \"li\"\n }, \"When that is done, go ahead and open up the folder with VSC.\")), mdx(\"li\", {\n parentName: \"ul\"\n }, mdx(\"p\", {\n parentName: \"li\"\n }, \"Create a new file called \", mdx(\"inlineCode\", {\n parentName: \"p\"\n }, \"configs.ts\"), \". Open the \", mdx(\"inlineCode\", {\n parentName: \"p\"\n }, \"configs.example.ts\"), \" file and copy everything over.\"))), mdx(\"p\", null, \"Let's take a minute to review all the options we have available to us.\"), mdx(\"h3\", null, \"Configs File\"), mdx(\"p\", null, \"The \", mdx(\"inlineCode\", {\n parentName: \"p\"\n }, \"configs.ts\"), \" file is where you will keep all your secret info you don't want to share with anyone else. As long as \", mdx(\"inlineCode\", {\n parentName: \"p\"\n }, \".gitignore\"), \" file is ignoring configs.ts your configurations will be kept private!\"), mdx(\"pre\", null, mdx(\"code\", _extends({\n parentName: \"pre\"\n }, {\n \"className\": \"language-ts\"\n }), \"// Step 1: Remove the `.example` from this file name so it is called `configs.ts`\\n// Step 2: Add all your bot's information below. The only required one is token and prefix. NOTE: As long as `.gitignore` file is ignoring configs.ts your configurations will be kept private!\\n// Step 3: Remove these comments if you like.\\n\\nexport const configs = {\\n // Your bot token goes here\\n token: \\\"\\\",\\n // The default prefix for your bot. Don't worry guilds can change this later.\\n prefix: \\\"!\\\",\\n // This isn't required but you can add bot list api keys here.\\n botListTokens: {\\n DISCORD_BOT_ORG: \\\"\\\",\\n BOTS_ON_DISCORD: \\\"\\\",\\n DISCORD_BOT_LIST: \\\"\\\",\\n BOTS_FOR_DISCORD: \\\"\\\",\\n DISCORD_BOATS: \\\"\\\",\\n DISCORD_BOTS_GG: \\\"\\\",\\n DISCORD_BOTS_GROUP: \\\"\\\",\\n },\\n // This is the server id for your bot's main server where users can get help/support\\n supportServerID: \\\"\\\",\\n // These are channel ids that will enable some functionality\\n channelIDs: {\\n // When a translation is missing this is the channel you will be alerted in.\\n missingTranslation: \\\"\\\",\\n // When an error occurs, we will try and log it to this channel\\n errorChannelID: \\\"\\\"\\n },\\n // These are the role ids that will enable some functionality.\\n roleIDs: {\\n // If you have a patreon set up you can add the patreon vip role id here.\\n patreonVIPRoleID: \\\"\\\",\\n },\\n // These are the user ids that will enable some functionality.\\n userIDs: {\\n // The user ids for the support team\\n botSupporters: [],\\n // The user ids for the other devs on your team\\n botDevs: [],\\n // The user ids who have complete 100% access to your bot\\n botOwners: []\\n }\\n};\\n\\n\")), mdx(\"h4\", null, \"Token\"), mdx(\"p\", null, \"First, add your bot token. This is \", mdx(\"strong\", {\n parentName: \"p\"\n }, \"required\"), \" for the bot to start. Review the \", mdx(\"a\", _extends({\n parentName: \"p\"\n }, {\n \"href\": \"https://discordeno.netlify.app/gettingstarted#creatingyourfirstdiscordbotapplication\"\n }), \"instructions\"), \" if you have not made your token yet.\"), mdx(\"h4\", null, \"Prefix\"), mdx(\"p\", null, \"The prefix is where you will set the default prefix for your bot. Don't worry, every server will be able to choose their own prefix but we need a default prefix to start.\"), mdx(\"h4\", null, \"Bot Lists Tokens\"), mdx(\"p\", null, \"This section of the file is so you can easily have your bot's statistics updated on all the bot lists out there to help you grow your bot. The code is already written to handle this but you will need to do 3 things for each bot list.\"), mdx(\"ol\", null, mdx(\"li\", {\n parentName: \"ol\"\n }, \"Go to the bot list and add your bot to their website. (Each site has it's own instructions)\"), mdx(\"li\", {\n parentName: \"ol\"\n }, \"Create a token for yourself on each website and paste it in your configs.\"), mdx(\"li\", {\n parentName: \"ol\"\n }, \"Enjoy!\")), mdx(\"p\", null, \"If you wish to customize the code, you will find the bot list tasks in the tasks folder. Don't worry we will discuss this when we get to the tasks section of the guide.\"), mdx(\"p\", null, \"For now just remember, that Discordeno provides you a built in way to update most discord bot lists.\"), mdx(\"h4\", null, \"Channel IDs\"), mdx(\"p\", null, \"The channelIDs section holds the channel IDs that are useful for specific features to help give you alerts/notifications. For example, the \", mdx(\"inlineCode\", {\n parentName: \"p\"\n }, \"missingTranslation\"), \" channel will be where messages are sent alerting you that somewhere in your code you are trying to use a translation key that you never created.\"), mdx(\"p\", null, \"When you get to around 25,000 Discord servers on your bot, you may want to convert these channel IDs to webhooks.\"), mdx(\"h4\", null, \"Role IDs\"), mdx(\"p\", null, \"The roleIDs section holds the role IDs that are useful for specific features. For example, the \", mdx(\"inlineCode\", {\n parentName: \"p\"\n }, \"patreonVIPRoleID\"), \" role can be used easily to enable vip features later in this guide.\"), mdx(\"h4\", null, \"User IDs\"), mdx(\"p\", null, \"The userIDs section holds the user IDs that are useful for specific features. For example, the \", mdx(\"inlineCode\", {\n parentName: \"p\"\n }, \"botDevs\"), \" and such are useful for permission levels as you will see in the Permission Level part of the guide.\"), mdx(\"h2\", null, \"It's Alive!\"), mdx(\"p\", null, \"Oh my god! You now have a bot with a bunch of features already! You don't believe me? Well, seeing is believing, so start the bot.\"), mdx(\"ol\", null, mdx(\"li\", {\n parentName: \"ol\"\n }, \"Invite your bot to a discord server.\"), mdx(\"li\", {\n parentName: \"ol\"\n }, \"Open up the integrated terminal in VSC using \", mdx(\"strong\", {\n parentName: \"li\"\n }, \"CTRL + `\"), \". If you use a Mac, replace CTRL with CMD.\"), mdx(\"li\", {\n parentName: \"ol\"\n }, \"Run the script below:\")), mdx(\"pre\", null, mdx(\"code\", _extends({\n parentName: \"pre\"\n }, {\n \"className\": \"language-shell\"\n }), \"deno run --allow-net --allow-read mod.ts\\n\")), mdx(\"p\", null, \"The first time you run it, you may see a lot of files being loaded. This is preparing all the magic behind the scene. Once it is ready, you will see something like this:\"), mdx(\"p\", null, mdx(\"img\", _extends({\n parentName: \"p\"\n }, {\n \"src\": \"https://i.imgur.com/TOXjLgh.png\",\n \"alt\": \"image\"\n }))), mdx(\"h2\", null, \"Understanding What Discordeno Did\"), mdx(\"p\", null, \"Discordeno includes these commands/folders as they are essential for any discord bot to have in order to meet the Discord Bot Best Practices. It also adds a few things that will help make some things easier to build a bot.\"), mdx(\"p\", null, \"We will dive into these deeper in this guide. Let's take it step by step.\"));\n}\n;\nMDXContent.isMDXComponent = true;","rawMDXOutput":"/* @jsx mdx */\nimport { mdx } from '@mdx-js/react';\n/* @jsx mdx */\n\nexport const _frontmatter = {\n \"title\": \"Creating The Bot!\",\n \"metaTitle\": \"Creating A Bot | Discordeno\",\n \"metaDescription\": \"Let's create our very own bot with Discordeno!\"\n};\n\nconst layoutProps = {\n _frontmatter\n};\nconst MDXLayout = \"wrapper\"\nexport default function MDXContent({\n components,\n ...props\n}) {\n return \n

{`Discordeno will help make Discord bot development much easier. Don't worry, as you go through this guide it will make a lot more sense.`}

\n

{`Creating The Bot!`}

\n
\n

{`This guide is going to assume you already have the basic requirements to make a bot ready. This includes github, git, a code editor like Visual Studio Code. If you don't have these yet please prepare them first before going forward.`}

\n
\n
    \n
  • \n

    {`First, create a Discordeno Bot using the `}{`Generator Boilerplate`}{`. Give it any name you like. For the purpose of this guide we will call it, Stargate.`}

    \n
  • \n
  • \n

    {`Then `}{`git clone https://github.com/Skillz4Killz/Stargate.git`}

    \n
  • \n
  • \n

    {`When that is done, go ahead and open up the folder with VSC.`}

    \n
  • \n
  • \n

    {`Create a new file called `}{`configs.ts`}{`. Open the `}{`configs.example.ts`}{` file and copy everything over.`}

    \n
  • \n
\n

{`Let's take a minute to review all the options we have available to us.`}

\n

{`Configs File`}

\n

{`The `}{`configs.ts`}{` file is where you will keep all your secret info you don't want to share with anyone else. As long as `}{`.gitignore`}{` file is ignoring configs.ts your configurations will be kept private!`}

\n
{`// Step 1: Remove the \\`.example\\` from this file name so it is called \\`configs.ts\\`\n// Step 2: Add all your bot's information below. The only required one is token and prefix. NOTE: As long as \\`.gitignore\\` file is ignoring configs.ts your configurations will be kept private!\n// Step 3: Remove these comments if you like.\n\nexport const configs = {\n  // Your bot token goes here\n  token: \"\",\n  // The default prefix for your bot. Don't worry guilds can change this later.\n  prefix: \"!\",\n  // This isn't required but you can add bot list api keys here.\n  botListTokens: {\n    DISCORD_BOT_ORG: \"\",\n    BOTS_ON_DISCORD: \"\",\n    DISCORD_BOT_LIST: \"\",\n    BOTS_FOR_DISCORD: \"\",\n    DISCORD_BOATS: \"\",\n    DISCORD_BOTS_GG: \"\",\n    DISCORD_BOTS_GROUP: \"\",\n  },\n  // This is the server id for your bot's main server where users can get help/support\n  supportServerID: \"\",\n  // These are channel ids that will enable some functionality\n  channelIDs: {\n    // When a translation is missing this is the channel you will be alerted in.\n    missingTranslation: \"\",\n    // When an error occurs, we will try and log it to this channel\n    errorChannelID: \"\"\n  },\n  // These are the role ids that will enable some functionality.\n  roleIDs: {\n    // If you have a patreon set up you can add the patreon vip role id here.\n    patreonVIPRoleID: \"\",\n  },\n  // These are the user ids that will enable some functionality.\n  userIDs: {\n    // The user ids for the support team\n    botSupporters: [],\n    // The user ids for the other devs on your team\n    botDevs: [],\n    // The user ids who have complete 100% access to your bot\n    botOwners: []\n  }\n};\n\n`}
\n

{`Token`}

\n

{`First, add your bot token. This is `}{`required`}{` for the bot to start. Review the `}{`instructions`}{` if you have not made your token yet.`}

\n

{`Prefix`}

\n

{`The prefix is where you will set the default prefix for your bot. Don't worry, every server will be able to choose their own prefix but we need a default prefix to start.`}

\n

{`Bot Lists Tokens`}

\n

{`This section of the file is so you can easily have your bot's statistics updated on all the bot lists out there to help you grow your bot. The code is already written to handle this but you will need to do 3 things for each bot list.`}

\n
    \n
  1. {`Go to the bot list and add your bot to their website. (Each site has it's own instructions)`}
  2. \n
  3. {`Create a token for yourself on each website and paste it in your configs.`}
  4. \n
  5. {`Enjoy!`}
  6. \n
\n

{`If you wish to customize the code, you will find the bot list tasks in the tasks folder. Don't worry we will discuss this when we get to the tasks section of the guide.`}

\n

{`For now just remember, that Discordeno provides you a built in way to update most discord bot lists.`}

\n

{`Channel IDs`}

\n

{`The channelIDs section holds the channel IDs that are useful for specific features to help give you alerts/notifications. For example, the `}{`missingTranslation`}{` channel will be where messages are sent alerting you that somewhere in your code you are trying to use a translation key that you never created.`}

\n

{`When you get to around 25,000 Discord servers on your bot, you may want to convert these channel IDs to webhooks.`}

\n

{`Role IDs`}

\n

{`The roleIDs section holds the role IDs that are useful for specific features. For example, the `}{`patreonVIPRoleID`}{` role can be used easily to enable vip features later in this guide.`}

\n

{`User IDs`}

\n

{`The userIDs section holds the user IDs that are useful for specific features. For example, the `}{`botDevs`}{` and such are useful for permission levels as you will see in the Permission Level part of the guide.`}

\n

{`It's Alive!`}

\n

{`Oh my god! You now have a bot with a bunch of features already! You don't believe me? Well, seeing is believing, so start the bot.`}

\n
    \n
  1. {`Invite your bot to a discord server.`}
  2. \n
  3. {`Open up the integrated terminal in VSC using `}{`CTRL + \\``}{`. If you use a Mac, replace CTRL with CMD.`}
  4. \n
  5. {`Run the script below:`}
  6. \n
\n
{`deno run --allow-net --allow-read mod.ts\n`}
\n

{`The first time you run it, you may see a lot of files being loaded. This is preparing all the magic behind the scene. Once it is ready, you will see something like this:`}

\n

\n

{`Understanding What Discordeno Did`}

\n

{`Discordeno includes these commands/folders as they are essential for any discord bot to have in order to meet the Discord Bot Best Practices. It also adds a few things that will help make some things easier to build a bot.`}

\n

{`We will dive into these deeper in this guide. Let's take it step by step.`}

\n\n
;\n}\n\n;\nMDXContent.isMDXComponent = true;"}} \ No newline at end of file diff --git a/docs/.cache/caches/gatsby-plugin-mdx/diskstore-ece0ffec1c1dfb0744cec61b378aaa16.json b/docs/.cache/caches/gatsby-plugin-mdx/diskstore-ece0ffec1c1dfb0744cec61b378aaa16.json new file mode 100644 index 000000000..33ff34d18 --- /dev/null +++ b/docs/.cache/caches/gatsby-plugin-mdx/diskstore-ece0ffec1c1dfb0744cec61b378aaa16.json @@ -0,0 +1 @@ +{"expireTime":9007200851634932000,"key":"gatsby-plugin-mdx-entire-payload-f4bda4d1efd1c44b4cf24f3cc48dda08-","val":{"mdast":{"type":"root","children":[{"type":"paragraph","children":[{"type":"text","value":"Woah! You are almost half way done with understanding all of Discordeno. Amazing isn't it? Something you may have noticed in the last section was there were some options that prevented some commands from running like ","position":{"start":{"line":2,"column":1,"offset":1},"end":{"line":2,"column":218,"offset":218},"indent":[]}},{"type":"inlineCode","value":"dmOnly","position":{"start":{"line":2,"column":218,"offset":218},"end":{"line":2,"column":226,"offset":226},"indent":[]}},{"type":"text","value":" or the permission options. we created a setting to prevent the monitor from running in certain channels. What if we wanted to do prevent commands from happening? How would we prevent commands from running?","position":{"start":{"line":2,"column":226,"offset":226},"end":{"line":2,"column":432,"offset":432},"indent":[]}}],"position":{"start":{"line":2,"column":1,"offset":1},"end":{"line":2,"column":432,"offset":432},"indent":[]}},{"type":"heading","depth":2,"children":[{"type":"text","value":"What is an Inhibitor?","position":{"start":{"line":4,"column":4,"offset":437},"end":{"line":4,"column":25,"offset":458},"indent":[]}}],"position":{"start":{"line":4,"column":1,"offset":434},"end":{"line":4,"column":25,"offset":458},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"An Inhibitor is very similar to how monitors work. A monitor runs on every message but an inhibitor runs on every command. Remember all those command options like cooldown, permissions, permissionLevel, nsfw, etc... Each and every one of these options has an inhibitor in that checks commands for these settings.","position":{"start":{"line":6,"column":1,"offset":460},"end":{"line":6,"column":313,"offset":772},"indent":[]}}],"position":{"start":{"line":6,"column":1,"offset":460},"end":{"line":6,"column":313,"offset":772},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"Let's create our own inhibitor that would prevent commands from being used if the user is not a VIP user.","position":{"start":{"line":8,"column":1,"offset":774},"end":{"line":8,"column":106,"offset":879},"indent":[]}}],"position":{"start":{"line":8,"column":1,"offset":774},"end":{"line":8,"column":106,"offset":879},"indent":[]}},{"type":"blockquote","children":[{"type":"paragraph","children":[{"type":"strong","children":[{"type":"text","value":"Note:","position":{"start":{"line":10,"column":5,"offset":885},"end":{"line":10,"column":10,"offset":890},"indent":[]}}],"position":{"start":{"line":10,"column":3,"offset":883},"end":{"line":10,"column":12,"offset":892},"indent":[]}},{"type":"text","value":" It is important to remember that everything below can be done with a simple permission level as well. We will create our own custom permission levels but for the purposes of this guide and to be able to learn about Inhibitors, we will be using an inhibitor.","position":{"start":{"line":10,"column":12,"offset":892},"end":{"line":10,"column":270,"offset":1150},"indent":[]}}],"position":{"start":{"line":10,"column":3,"offset":883},"end":{"line":10,"column":270,"offset":1150},"indent":[]}}],"position":{"start":{"line":10,"column":1,"offset":881},"end":{"line":10,"column":270,"offset":1150},"indent":[]}},{"type":"heading","depth":2,"children":[{"type":"text","value":"Creating the File","position":{"start":{"line":12,"column":4,"offset":1155},"end":{"line":12,"column":21,"offset":1172},"indent":[]}}],"position":{"start":{"line":12,"column":1,"offset":1152},"end":{"line":12,"column":21,"offset":1172},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"Let's start by creating a file inside the inhibitors folder called ","position":{"start":{"line":14,"column":1,"offset":1174},"end":{"line":14,"column":68,"offset":1241},"indent":[]}},{"type":"inlineCode","value":"boosted.ts","position":{"start":{"line":14,"column":68,"offset":1241},"end":{"line":14,"column":80,"offset":1253},"indent":[]}},{"type":"text","value":" and paste the following snippet of code:","position":{"start":{"line":14,"column":80,"offset":1253},"end":{"line":14,"column":121,"offset":1294},"indent":[]}}],"position":{"start":{"line":14,"column":1,"offset":1174},"end":{"line":14,"column":121,"offset":1294},"indent":[]}},{"type":"code","lang":"ts","meta":null,"value":"import { botCache } from \"../../mod.ts\";\n\nbotCache.inhibitors.set(\"inhibitorname\", async function (message, command, guild) {\n\t// Your code goes here\n});","position":{"start":{"line":16,"column":1,"offset":1296},"end":{"line":22,"column":4,"offset":1459},"indent":[1,1,1,1,1,1]}},{"type":"paragraph","children":[{"type":"text","value":"Inhibitors can take up to 3 arguments.","position":{"start":{"line":24,"column":1,"offset":1461},"end":{"line":24,"column":39,"offset":1499},"indent":[]}}],"position":{"start":{"line":24,"column":1,"offset":1461},"end":{"line":24,"column":39,"offset":1499},"indent":[]}},{"type":"list","ordered":false,"start":null,"spread":false,"children":[{"type":"listItem","spread":false,"checked":null,"children":[{"type":"paragraph","children":[{"type":"inlineCode","value":"message","position":{"start":{"line":26,"column":3,"offset":1503},"end":{"line":26,"column":12,"offset":1512},"indent":[]}},{"type":"text","value":": The message object that triggered the command.","position":{"start":{"line":26,"column":12,"offset":1512},"end":{"line":26,"column":60,"offset":1560},"indent":[]}}],"position":{"start":{"line":26,"column":3,"offset":1503},"end":{"line":26,"column":60,"offset":1560},"indent":[]}}],"position":{"start":{"line":26,"column":1,"offset":1501},"end":{"line":26,"column":60,"offset":1560},"indent":[]}},{"type":"listItem","spread":false,"checked":null,"children":[{"type":"paragraph","children":[{"type":"inlineCode","value":"command","position":{"start":{"line":27,"column":3,"offset":1563},"end":{"line":27,"column":12,"offset":1572},"indent":[]}},{"type":"text","value":": The command object itself that was triggered.","position":{"start":{"line":27,"column":12,"offset":1572},"end":{"line":27,"column":59,"offset":1619},"indent":[]}}],"position":{"start":{"line":27,"column":3,"offset":1563},"end":{"line":27,"column":59,"offset":1619},"indent":[]}}],"position":{"start":{"line":27,"column":1,"offset":1561},"end":{"line":27,"column":59,"offset":1619},"indent":[]}},{"type":"listItem","spread":false,"checked":null,"children":[{"type":"paragraph","children":[{"type":"inlineCode","value":"guild","position":{"start":{"line":28,"column":3,"offset":1622},"end":{"line":28,"column":10,"offset":1629},"indent":[]}},{"type":"text","value":": The server guild object where this command was ran.","position":{"start":{"line":28,"column":10,"offset":1629},"end":{"line":28,"column":63,"offset":1682},"indent":[]}}],"position":{"start":{"line":28,"column":3,"offset":1622},"end":{"line":28,"column":63,"offset":1682},"indent":[]}}],"position":{"start":{"line":28,"column":1,"offset":1620},"end":{"line":28,"column":63,"offset":1682},"indent":[]}}],"position":{"start":{"line":26,"column":1,"offset":1501},"end":{"line":28,"column":63,"offset":1682},"indent":[1,1]}},{"type":"heading","depth":2,"children":[{"type":"text","value":"Understanding How Inhibitors Function","position":{"start":{"line":30,"column":4,"offset":1687},"end":{"line":30,"column":41,"offset":1724},"indent":[]}}],"position":{"start":{"line":30,"column":1,"offset":1684},"end":{"line":30,"column":41,"offset":1724},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"To block a command you have to return a truthy value.","position":{"start":{"line":32,"column":1,"offset":1726},"end":{"line":32,"column":54,"offset":1779},"indent":[]}}],"position":{"start":{"line":32,"column":1,"offset":1726},"end":{"line":32,"column":54,"offset":1779},"indent":[]}},{"type":"list","ordered":false,"start":null,"spread":false,"children":[{"type":"listItem","spread":false,"checked":null,"children":[{"type":"paragraph","children":[{"type":"strong","children":[{"type":"text","value":"return true;","position":{"start":{"line":33,"column":5,"offset":1784},"end":{"line":33,"column":17,"offset":1796},"indent":[]}}],"position":{"start":{"line":33,"column":3,"offset":1782},"end":{"line":33,"column":19,"offset":1798},"indent":[]}},{"type":"text","value":" If you return true the inhibitor will block the execution of the command.\nTo allow a command return a falsey value.","position":{"start":{"line":33,"column":19,"offset":1798},"end":{"line":34,"column":42,"offset":1914},"indent":[1]}}],"position":{"start":{"line":33,"column":3,"offset":1782},"end":{"line":34,"column":42,"offset":1914},"indent":[1]}}],"position":{"start":{"line":33,"column":1,"offset":1780},"end":{"line":34,"column":42,"offset":1914},"indent":[1]}},{"type":"listItem","spread":false,"checked":null,"children":[{"type":"paragraph","children":[{"type":"strong","children":[{"type":"text","value":"return false;","position":{"start":{"line":35,"column":5,"offset":1919},"end":{"line":35,"column":18,"offset":1932},"indent":[]}}],"position":{"start":{"line":35,"column":3,"offset":1917},"end":{"line":35,"column":20,"offset":1934},"indent":[]}},{"type":"text","value":" If you return false the inhibitor will not block the error.","position":{"start":{"line":35,"column":20,"offset":1934},"end":{"line":35,"column":80,"offset":1994},"indent":[]}}],"position":{"start":{"line":35,"column":3,"offset":1917},"end":{"line":35,"column":80,"offset":1994},"indent":[]}}],"position":{"start":{"line":35,"column":1,"offset":1915},"end":{"line":35,"column":80,"offset":1994},"indent":[]}}],"position":{"start":{"line":33,"column":1,"offset":1780},"end":{"line":35,"column":80,"offset":1994},"indent":[1,1]}},{"type":"code","lang":"ts","meta":null,"value":"// If the command is not VIP only we can allow this command to execute\nif (!command.vipOnly) return false;\n\n// The bot's support server\nconst guild = cache.guilds.get(configs.supportServerID);\n// If the command author is not in the server they won't have the vip role\nconst member = guild.members.get(message.author.id) || await getMember(guild.id, message.author.id);\n// Member doesn't exist so cancel the command\nif (!member) {\n\tsendResponse(message, `sorry, but you can not use this command until you become VIP. **Close the IRIS!!!**`)\n\treturn true;\n}\n\n// If the user has the vip role on the support server given by patreon allow the command\nif (member.roles.includes(configs.roleIDs.patreonVIPRoleID)) return false;\n\n// Alert the user they don't have vip and can't use the command\nsendResponse(message, `sorry, but you can not use this command until you become a VIP. I'm sorry, Teal'c. We'll go to Disneyland next year. I promise.`)\n// Cancel the command since the user does not have vip\nreturn true;","position":{"start":{"line":38,"column":1,"offset":1997},"end":{"line":59,"column":4,"offset":3013},"indent":[1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1]}},{"type":"heading","depth":2,"children":[{"type":"text","value":"Updating Command Typings","position":{"start":{"line":61,"column":4,"offset":3018},"end":{"line":61,"column":28,"offset":3042},"indent":[]}}],"position":{"start":{"line":61,"column":1,"offset":3015},"end":{"line":61,"column":28,"offset":3042},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"Since we need a new option on our commands we need to add that. Open the ","position":{"start":{"line":63,"column":1,"offset":3044},"end":{"line":63,"column":74,"offset":3117},"indent":[]}},{"type":"inlineCode","value":"src/types/commands.ts","position":{"start":{"line":63,"column":74,"offset":3117},"end":{"line":63,"column":97,"offset":3140},"indent":[]}},{"type":"text","value":" file and add in the following","position":{"start":{"line":63,"column":97,"offset":3140},"end":{"line":63,"column":127,"offset":3170},"indent":[]}}],"position":{"start":{"line":63,"column":1,"offset":3044},"end":{"line":63,"column":127,"offset":3170},"indent":[]}},{"type":"code","lang":"ts","meta":null,"value":" vipOnly?: boolean;","position":{"start":{"line":65,"column":1,"offset":3172},"end":{"line":67,"column":4,"offset":3202},"indent":[1,1]}},{"type":"paragraph","children":[{"type":"text","value":"Once that is added","position":{"start":{"line":69,"column":1,"offset":3204},"end":{"line":69,"column":19,"offset":3222},"indent":[]}}],"position":{"start":{"line":69,"column":1,"offset":3204},"end":{"line":69,"column":19,"offset":3222},"indent":[]}},{"type":"heading","depth":2,"children":[{"type":"text","value":"Challenges","position":{"start":{"line":71,"column":4,"offset":3227},"end":{"line":71,"column":14,"offset":3237},"indent":[]}}],"position":{"start":{"line":71,"column":1,"offset":3224},"end":{"line":71,"column":14,"offset":3237},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"Hell yes! We just got through the entire inhibitor section. You have now mastered everything related to inhibitors.","position":{"start":{"line":73,"column":1,"offset":3239},"end":{"line":73,"column":116,"offset":3354},"indent":[]}}],"position":{"start":{"line":73,"column":1,"offset":3239},"end":{"line":73,"column":116,"offset":3354},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"You can now try and get a little more practice with inhibitors by trying to challenge yourself and make your own inhibitors. Don't worry if you can't think of any good use cases for inhibitors.","position":{"start":{"line":75,"column":1,"offset":3356},"end":{"line":75,"column":194,"offset":3549},"indent":[]}}],"position":{"start":{"line":75,"column":1,"offset":3356},"end":{"line":75,"column":194,"offset":3549},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"Majority of Discordeno bots do not use many custom inhibitors because most of the necessary/important ones already come built for you in the inhibitors folder.","position":{"start":{"line":77,"column":1,"offset":3551},"end":{"line":77,"column":160,"offset":3710},"indent":[]}}],"position":{"start":{"line":77,"column":1,"offset":3551},"end":{"line":77,"column":160,"offset":3710},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"Next we will try our hands at creating a monitor.","position":{"start":{"line":79,"column":1,"offset":3712},"end":{"line":79,"column":50,"offset":3761},"indent":[]}}],"position":{"start":{"line":79,"column":1,"offset":3712},"end":{"line":79,"column":50,"offset":3761},"indent":[]}},{"type":"export","value":"export const _frontmatter = {\"title\":\"Creating Inhibitors!\",\"metaTitle\":\"Creating An Inhibitor | Discordeno\",\"metaDescription\":\"Let's create our very own bot with Discordeno!\"}","position":{"start":{"line":82,"column":1,"offset":3764},"end":{"line":82,"column":177,"offset":3940},"indent":[]}}],"position":{"start":{"line":1,"column":1,"offset":0},"end":{"line":82,"column":177,"offset":3940}}},"scopeImports":["import * as React from 'react'"],"scopeIdentifiers":["React"],"body":"function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }\n\nfunction _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }\n\nfunction _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }\n\n/* @jsx mdx */\nvar _frontmatter = {\n \"title\": \"Creating Inhibitors!\",\n \"metaTitle\": \"Creating An Inhibitor | Discordeno\",\n \"metaDescription\": \"Let's create our very own bot with Discordeno!\"\n};\nvar layoutProps = {\n _frontmatter: _frontmatter\n};\nvar MDXLayout = \"wrapper\";\nreturn function MDXContent(_ref) {\n var components = _ref.components,\n props = _objectWithoutProperties(_ref, [\"components\"]);\n\n return mdx(MDXLayout, _extends({}, layoutProps, props, {\n components: components,\n mdxType: \"MDXLayout\"\n }), mdx(\"p\", null, \"Woah! You are almost half way done with understanding all of Discordeno. Amazing isn't it? Something you may have noticed in the last section was there were some options that prevented some commands from running like \", mdx(\"inlineCode\", {\n parentName: \"p\"\n }, \"dmOnly\"), \" or the permission options. we created a setting to prevent the monitor from running in certain channels. What if we wanted to do prevent commands from happening? How would we prevent commands from running?\"), mdx(\"h2\", null, \"What is an Inhibitor?\"), mdx(\"p\", null, \"An Inhibitor is very similar to how monitors work. A monitor runs on every message but an inhibitor runs on every command. Remember all those command options like cooldown, permissions, permissionLevel, nsfw, etc... Each and every one of these options has an inhibitor in that checks commands for these settings.\"), mdx(\"p\", null, \"Let's create our own inhibitor that would prevent commands from being used if the user is not a VIP user.\"), mdx(\"blockquote\", null, mdx(\"p\", {\n parentName: \"blockquote\"\n }, mdx(\"strong\", {\n parentName: \"p\"\n }, \"Note:\"), \" It is important to remember that everything below can be done with a simple permission level as well. We will create our own custom permission levels but for the purposes of this guide and to be able to learn about Inhibitors, we will be using an inhibitor.\")), mdx(\"h2\", null, \"Creating the File\"), mdx(\"p\", null, \"Let's start by creating a file inside the inhibitors folder called \", mdx(\"inlineCode\", {\n parentName: \"p\"\n }, \"boosted.ts\"), \" and paste the following snippet of code:\"), mdx(\"pre\", null, mdx(\"code\", _extends({\n parentName: \"pre\"\n }, {\n \"className\": \"language-ts\"\n }), \"import { botCache } from \\\"../../mod.ts\\\";\\n\\nbotCache.inhibitors.set(\\\"inhibitorname\\\", async function (message, command, guild) {\\n // Your code goes here\\n});\\n\")), mdx(\"p\", null, \"Inhibitors can take up to 3 arguments.\"), mdx(\"ul\", null, mdx(\"li\", {\n parentName: \"ul\"\n }, mdx(\"inlineCode\", {\n parentName: \"li\"\n }, \"message\"), \": The message object that triggered the command.\"), mdx(\"li\", {\n parentName: \"ul\"\n }, mdx(\"inlineCode\", {\n parentName: \"li\"\n }, \"command\"), \": The command object itself that was triggered.\"), mdx(\"li\", {\n parentName: \"ul\"\n }, mdx(\"inlineCode\", {\n parentName: \"li\"\n }, \"guild\"), \": The server guild object where this command was ran.\")), mdx(\"h2\", null, \"Understanding How Inhibitors Function\"), mdx(\"p\", null, \"To block a command you have to return a truthy value.\"), mdx(\"ul\", null, mdx(\"li\", {\n parentName: \"ul\"\n }, mdx(\"strong\", {\n parentName: \"li\"\n }, \"return true;\"), \" If you return true the inhibitor will block the execution of the command.\\nTo allow a command return a falsey value.\"), mdx(\"li\", {\n parentName: \"ul\"\n }, mdx(\"strong\", {\n parentName: \"li\"\n }, \"return false;\"), \" If you return false the inhibitor will not block the error.\")), mdx(\"pre\", null, mdx(\"code\", _extends({\n parentName: \"pre\"\n }, {\n \"className\": \"language-ts\"\n }), \"// If the command is not VIP only we can allow this command to execute\\nif (!command.vipOnly) return false;\\n\\n// The bot's support server\\nconst guild = cache.guilds.get(configs.supportServerID);\\n// If the command author is not in the server they won't have the vip role\\nconst member = guild.members.get(message.author.id) || await getMember(guild.id, message.author.id);\\n// Member doesn't exist so cancel the command\\nif (!member) {\\n sendResponse(message, `sorry, but you can not use this command until you become VIP. **Close the IRIS!!!**`)\\n return true;\\n}\\n\\n// If the user has the vip role on the support server given by patreon allow the command\\nif (member.roles.includes(configs.roleIDs.patreonVIPRoleID)) return false;\\n\\n// Alert the user they don't have vip and can't use the command\\nsendResponse(message, `sorry, but you can not use this command until you become a VIP. I'm sorry, Teal'c. We'll go to Disneyland next year. I promise.`)\\n// Cancel the command since the user does not have vip\\nreturn true;\\n\")), mdx(\"h2\", null, \"Updating Command Typings\"), mdx(\"p\", null, \"Since we need a new option on our commands we need to add that. Open the \", mdx(\"inlineCode\", {\n parentName: \"p\"\n }, \"src/types/commands.ts\"), \" file and add in the following\"), mdx(\"pre\", null, mdx(\"code\", _extends({\n parentName: \"pre\"\n }, {\n \"className\": \"language-ts\"\n }), \" vipOnly?: boolean;\\n\")), mdx(\"p\", null, \"Once that is added\"), mdx(\"h2\", null, \"Challenges\"), mdx(\"p\", null, \"Hell yes! We just got through the entire inhibitor section. You have now mastered everything related to inhibitors.\"), mdx(\"p\", null, \"You can now try and get a little more practice with inhibitors by trying to challenge yourself and make your own inhibitors. Don't worry if you can't think of any good use cases for inhibitors.\"), mdx(\"p\", null, \"Majority of Discordeno bots do not use many custom inhibitors because most of the necessary/important ones already come built for you in the inhibitors folder.\"), mdx(\"p\", null, \"Next we will try our hands at creating a monitor.\"));\n}\n;\nMDXContent.isMDXComponent = true;","rawMDXOutput":"/* @jsx mdx */\nimport { mdx } from '@mdx-js/react';\n/* @jsx mdx */\n\nexport const _frontmatter = {\n \"title\": \"Creating Inhibitors!\",\n \"metaTitle\": \"Creating An Inhibitor | Discordeno\",\n \"metaDescription\": \"Let's create our very own bot with Discordeno!\"\n};\n\nconst layoutProps = {\n _frontmatter\n};\nconst MDXLayout = \"wrapper\"\nexport default function MDXContent({\n components,\n ...props\n}) {\n return \n

{`Woah! You are almost half way done with understanding all of Discordeno. Amazing isn't it? Something you may have noticed in the last section was there were some options that prevented some commands from running like `}{`dmOnly`}{` or the permission options. we created a setting to prevent the monitor from running in certain channels. What if we wanted to do prevent commands from happening? How would we prevent commands from running?`}

\n

{`What is an Inhibitor?`}

\n

{`An Inhibitor is very similar to how monitors work. A monitor runs on every message but an inhibitor runs on every command. Remember all those command options like cooldown, permissions, permissionLevel, nsfw, etc... Each and every one of these options has an inhibitor in that checks commands for these settings.`}

\n

{`Let's create our own inhibitor that would prevent commands from being used if the user is not a VIP user.`}

\n
\n

{`Note:`}{` It is important to remember that everything below can be done with a simple permission level as well. We will create our own custom permission levels but for the purposes of this guide and to be able to learn about Inhibitors, we will be using an inhibitor.`}

\n
\n

{`Creating the File`}

\n

{`Let's start by creating a file inside the inhibitors folder called `}{`boosted.ts`}{` and paste the following snippet of code:`}

\n
{`import { botCache } from \"../../mod.ts\";\n\nbotCache.inhibitors.set(\"inhibitorname\", async function (message, command, guild) {\n    // Your code goes here\n});\n`}
\n

{`Inhibitors can take up to 3 arguments.`}

\n
    \n
  • {`message`}{`: The message object that triggered the command.`}
  • \n
  • {`command`}{`: The command object itself that was triggered.`}
  • \n
  • {`guild`}{`: The server guild object where this command was ran.`}
  • \n
\n

{`Understanding How Inhibitors Function`}

\n

{`To block a command you have to return a truthy value.`}

\n
    \n
  • {`return true;`}{` If you return true the inhibitor will block the execution of the command.\nTo allow a command return a falsey value.`}
  • \n
  • {`return false;`}{` If you return false the inhibitor will not block the error.`}
  • \n
\n
{`// If the command is not VIP only we can allow this command to execute\nif (!command.vipOnly) return false;\n\n// The bot's support server\nconst guild = cache.guilds.get(configs.supportServerID);\n// If the command author is not in the server they won't have the vip role\nconst member = guild.members.get(message.author.id) || await getMember(guild.id, message.author.id);\n// Member doesn't exist so cancel the command\nif (!member) {\n    sendResponse(message, \\`sorry, but you can not use this command until you become VIP. **Close the IRIS!!!**\\`)\n    return true;\n}\n\n// If the user has the vip role on the support server given by patreon allow the command\nif (member.roles.includes(configs.roleIDs.patreonVIPRoleID)) return false;\n\n// Alert the user they don't have vip and can't use the command\nsendResponse(message, \\`sorry, but you can not use this command until you become a VIP. I'm sorry, Teal'c. We'll go to Disneyland next year. I promise.\\`)\n// Cancel the command since the user does not have vip\nreturn true;\n`}
\n

{`Updating Command Typings`}

\n

{`Since we need a new option on our commands we need to add that. Open the `}{`src/types/commands.ts`}{` file and add in the following`}

\n
{`  vipOnly?: boolean;\n`}
\n

{`Once that is added`}

\n

{`Challenges`}

\n

{`Hell yes! We just got through the entire inhibitor section. You have now mastered everything related to inhibitors.`}

\n

{`You can now try and get a little more practice with inhibitors by trying to challenge yourself and make your own inhibitors. Don't worry if you can't think of any good use cases for inhibitors.`}

\n

{`Majority of Discordeno bots do not use many custom inhibitors because most of the necessary/important ones already come built for you in the inhibitors folder.`}

\n

{`Next we will try our hands at creating a monitor.`}

\n\n
;\n}\n\n;\nMDXContent.isMDXComponent = true;"}} \ No newline at end of file diff --git a/docs/.cache/caches/gatsby-plugin-mdx/diskstore-ed442c06a5509cb228b891acd55be845.json b/docs/.cache/caches/gatsby-plugin-mdx/diskstore-ed442c06a5509cb228b891acd55be845.json new file mode 100644 index 000000000..caecbb672 --- /dev/null +++ b/docs/.cache/caches/gatsby-plugin-mdx/diskstore-ed442c06a5509cb228b891acd55be845.json @@ -0,0 +1 @@ +{"expireTime":9007200851634488000,"key":"gatsby-plugin-mdx-entire-payload-ba77483bed995aaca9da5c3b87b8cf22-","val":{"mdast":{"type":"root","children":[{"type":"paragraph","children":[{"type":"text","value":"Woah! You are almost half way done with understanding all of Discordeno. Amazing isn't it? Something you may have noticed in the last section was there were some options that prevented some commands from running like ","position":{"start":{"line":2,"column":1,"offset":1},"end":{"line":2,"column":218,"offset":218},"indent":[]}},{"type":"inlineCode","value":"dmOnly","position":{"start":{"line":2,"column":218,"offset":218},"end":{"line":2,"column":226,"offset":226},"indent":[]}},{"type":"text","value":" or the permission options. we created a setting to prevent the monitor from running in certain channels. What if we wanted to do prevent commands from happening? How would we prevent commands from running?","position":{"start":{"line":2,"column":226,"offset":226},"end":{"line":2,"column":432,"offset":432},"indent":[]}}],"position":{"start":{"line":2,"column":1,"offset":1},"end":{"line":2,"column":432,"offset":432},"indent":[]}},{"type":"heading","depth":2,"children":[{"type":"text","value":"What is an Inhibitor?","position":{"start":{"line":4,"column":4,"offset":437},"end":{"line":4,"column":25,"offset":458},"indent":[]}}],"position":{"start":{"line":4,"column":1,"offset":434},"end":{"line":4,"column":25,"offset":458},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"An Inhibitor is very similar to how monitors work. A monitor runs on every message but an inhibitor runs on every command. Remember all those command options like cooldown, permissions, permissionLevel, nsfw, etc... Each and every one of these options has an inhibitor in that checks commands for these settings.","position":{"start":{"line":6,"column":1,"offset":460},"end":{"line":6,"column":313,"offset":772},"indent":[]}}],"position":{"start":{"line":6,"column":1,"offset":460},"end":{"line":6,"column":313,"offset":772},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"Let's create our own inhibitor that would prevent commands from being used if the user is not a VIP user.","position":{"start":{"line":8,"column":1,"offset":774},"end":{"line":8,"column":106,"offset":879},"indent":[]}}],"position":{"start":{"line":8,"column":1,"offset":774},"end":{"line":8,"column":106,"offset":879},"indent":[]}},{"type":"blockquote","children":[{"type":"paragraph","children":[{"type":"strong","children":[{"type":"text","value":"Note:","position":{"start":{"line":10,"column":5,"offset":885},"end":{"line":10,"column":10,"offset":890},"indent":[]}}],"position":{"start":{"line":10,"column":3,"offset":883},"end":{"line":10,"column":12,"offset":892},"indent":[]}},{"type":"text","value":" It is important to remember that everything below can be done with a simple permission level as well. We will create our own custom permission levels but for the purposes of this guide and to be able to learn about Inhibitors, we will be using an inhibitor.","position":{"start":{"line":10,"column":12,"offset":892},"end":{"line":10,"column":270,"offset":1150},"indent":[]}}],"position":{"start":{"line":10,"column":3,"offset":883},"end":{"line":10,"column":270,"offset":1150},"indent":[]}}],"position":{"start":{"line":10,"column":1,"offset":881},"end":{"line":10,"column":270,"offset":1150},"indent":[]}},{"type":"heading","depth":2,"children":[{"type":"text","value":"Creating the File","position":{"start":{"line":12,"column":4,"offset":1155},"end":{"line":12,"column":21,"offset":1172},"indent":[]}}],"position":{"start":{"line":12,"column":1,"offset":1152},"end":{"line":12,"column":21,"offset":1172},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"Let's start by creating a file inside the inhibitors folder called ","position":{"start":{"line":14,"column":1,"offset":1174},"end":{"line":14,"column":68,"offset":1241},"indent":[]}},{"type":"inlineCode","value":"boosted.ts","position":{"start":{"line":14,"column":68,"offset":1241},"end":{"line":14,"column":80,"offset":1253},"indent":[]}},{"type":"text","value":" and paste the following snippet of code:","position":{"start":{"line":14,"column":80,"offset":1253},"end":{"line":14,"column":121,"offset":1294},"indent":[]}}],"position":{"start":{"line":14,"column":1,"offset":1174},"end":{"line":14,"column":121,"offset":1294},"indent":[]}},{"type":"code","lang":"ts","meta":null,"value":"import { botCache } from \"../../mod.ts\";\n\nbotCache.inhibitors.set(\"inhibitorname\", async function (message, command, guild) {\n\t// Your code goes here\n});","position":{"start":{"line":16,"column":1,"offset":1296},"end":{"line":22,"column":4,"offset":1459},"indent":[1,1,1,1,1,1]}},{"type":"paragraph","children":[{"type":"text","value":"Inhibitors can take up to 3 arguments.","position":{"start":{"line":24,"column":1,"offset":1461},"end":{"line":24,"column":39,"offset":1499},"indent":[]}}],"position":{"start":{"line":24,"column":1,"offset":1461},"end":{"line":24,"column":39,"offset":1499},"indent":[]}},{"type":"list","ordered":false,"start":null,"spread":false,"children":[{"type":"listItem","spread":false,"checked":null,"children":[{"type":"paragraph","children":[{"type":"inlineCode","value":"message","position":{"start":{"line":26,"column":3,"offset":1503},"end":{"line":26,"column":12,"offset":1512},"indent":[]}},{"type":"text","value":": The message object that triggered the command.","position":{"start":{"line":26,"column":12,"offset":1512},"end":{"line":26,"column":60,"offset":1560},"indent":[]}}],"position":{"start":{"line":26,"column":3,"offset":1503},"end":{"line":26,"column":60,"offset":1560},"indent":[]}}],"position":{"start":{"line":26,"column":1,"offset":1501},"end":{"line":26,"column":60,"offset":1560},"indent":[]}},{"type":"listItem","spread":false,"checked":null,"children":[{"type":"paragraph","children":[{"type":"inlineCode","value":"command","position":{"start":{"line":27,"column":3,"offset":1563},"end":{"line":27,"column":12,"offset":1572},"indent":[]}},{"type":"text","value":": The command object itself that was triggered.","position":{"start":{"line":27,"column":12,"offset":1572},"end":{"line":27,"column":59,"offset":1619},"indent":[]}}],"position":{"start":{"line":27,"column":3,"offset":1563},"end":{"line":27,"column":59,"offset":1619},"indent":[]}}],"position":{"start":{"line":27,"column":1,"offset":1561},"end":{"line":27,"column":59,"offset":1619},"indent":[]}},{"type":"listItem","spread":false,"checked":null,"children":[{"type":"paragraph","children":[{"type":"inlineCode","value":"guild","position":{"start":{"line":28,"column":3,"offset":1622},"end":{"line":28,"column":10,"offset":1629},"indent":[]}},{"type":"text","value":": The server guild object where this command was ran.","position":{"start":{"line":28,"column":10,"offset":1629},"end":{"line":28,"column":63,"offset":1682},"indent":[]}}],"position":{"start":{"line":28,"column":3,"offset":1622},"end":{"line":28,"column":63,"offset":1682},"indent":[]}}],"position":{"start":{"line":28,"column":1,"offset":1620},"end":{"line":28,"column":63,"offset":1682},"indent":[]}}],"position":{"start":{"line":26,"column":1,"offset":1501},"end":{"line":28,"column":63,"offset":1682},"indent":[1,1]}},{"type":"heading","depth":2,"children":[{"type":"text","value":"Understanding How Inhibitors Function","position":{"start":{"line":30,"column":4,"offset":1687},"end":{"line":30,"column":41,"offset":1724},"indent":[]}}],"position":{"start":{"line":30,"column":1,"offset":1684},"end":{"line":30,"column":41,"offset":1724},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"To block a command you have to return a truthy value.","position":{"start":{"line":32,"column":1,"offset":1726},"end":{"line":32,"column":54,"offset":1779},"indent":[]}}],"position":{"start":{"line":32,"column":1,"offset":1726},"end":{"line":32,"column":54,"offset":1779},"indent":[]}},{"type":"list","ordered":false,"start":null,"spread":false,"children":[{"type":"listItem","spread":false,"checked":null,"children":[{"type":"paragraph","children":[{"type":"strong","children":[{"type":"text","value":"return true;","position":{"start":{"line":33,"column":5,"offset":1784},"end":{"line":33,"column":17,"offset":1796},"indent":[]}}],"position":{"start":{"line":33,"column":3,"offset":1782},"end":{"line":33,"column":19,"offset":1798},"indent":[]}},{"type":"text","value":" If you return true the inhibitor will block the execution of the command.\nTo allow a command return a falsey value.","position":{"start":{"line":33,"column":19,"offset":1798},"end":{"line":34,"column":42,"offset":1914},"indent":[1]}}],"position":{"start":{"line":33,"column":3,"offset":1782},"end":{"line":34,"column":42,"offset":1914},"indent":[1]}}],"position":{"start":{"line":33,"column":1,"offset":1780},"end":{"line":34,"column":42,"offset":1914},"indent":[1]}},{"type":"listItem","spread":false,"checked":null,"children":[{"type":"paragraph","children":[{"type":"strong","children":[{"type":"text","value":"return false;","position":{"start":{"line":35,"column":5,"offset":1919},"end":{"line":35,"column":18,"offset":1932},"indent":[]}}],"position":{"start":{"line":35,"column":3,"offset":1917},"end":{"line":35,"column":20,"offset":1934},"indent":[]}},{"type":"text","value":" If you return false the inhibitor will not block the error.","position":{"start":{"line":35,"column":20,"offset":1934},"end":{"line":35,"column":80,"offset":1994},"indent":[]}}],"position":{"start":{"line":35,"column":3,"offset":1917},"end":{"line":35,"column":80,"offset":1994},"indent":[]}}],"position":{"start":{"line":35,"column":1,"offset":1915},"end":{"line":35,"column":80,"offset":1994},"indent":[]}}],"position":{"start":{"line":33,"column":1,"offset":1780},"end":{"line":35,"column":80,"offset":1994},"indent":[1,1]}},{"type":"code","lang":"ts","meta":null,"value":"// If the command is not VIP only we can allow this command to execute\nif (!command.vipOnly) return false;\n\n// The bot's support server\nconst guild = cache.guilds.get(configs.supportServerID);\n// If the command author is not in the server they won't have the vip role\nconst member = guild.members.get(message.author.id) || await getMember(guild.id, message.author.id);\n// Member doesn't exist so cancel the command\nif (!member) {\n\tsendResponse(message, `sorry, but you can not use this command until you become VIP. **Close the IRIS!!!`)\n\treturn true;\n}\n\n// If the user has the vip role on the support server given by patreon allow the command\nif (member.roles.includes(configs.patreonVIPRoleID)) return false;\n\n// Alert the user they don't have vip and can't use the command\nsendResponse(message, `sorry, but you can not use this command until you become a VIP. I'm sorry, Teal'c. We'll go to Disneyland next year. I promise.`)\n// Cancel the command since the user does not have vip\nreturn true;","position":{"start":{"line":38,"column":1,"offset":1997},"end":{"line":59,"column":4,"offset":3003},"indent":[1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1]}},{"type":"export","value":"export const _frontmatter = {\"title\":\"Creating Inhibitors!\",\"metaTitle\":\"Creating An Inhibitor | Discordeno\",\"metaDescription\":\"Let's create our very own bot with Discordeno!\"}","position":{"start":{"line":62,"column":1,"offset":3006},"end":{"line":62,"column":177,"offset":3182},"indent":[]}}],"position":{"start":{"line":1,"column":1,"offset":0},"end":{"line":62,"column":177,"offset":3182}}},"scopeImports":["import * as React from 'react'"],"scopeIdentifiers":["React"],"body":"function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }\n\nfunction _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }\n\nfunction _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }\n\n/* @jsx mdx */\nvar _frontmatter = {\n \"title\": \"Creating Inhibitors!\",\n \"metaTitle\": \"Creating An Inhibitor | Discordeno\",\n \"metaDescription\": \"Let's create our very own bot with Discordeno!\"\n};\nvar layoutProps = {\n _frontmatter: _frontmatter\n};\nvar MDXLayout = \"wrapper\";\nreturn function MDXContent(_ref) {\n var components = _ref.components,\n props = _objectWithoutProperties(_ref, [\"components\"]);\n\n return mdx(MDXLayout, _extends({}, layoutProps, props, {\n components: components,\n mdxType: \"MDXLayout\"\n }), mdx(\"p\", null, \"Woah! You are almost half way done with understanding all of Discordeno. Amazing isn't it? Something you may have noticed in the last section was there were some options that prevented some commands from running like \", mdx(\"inlineCode\", {\n parentName: \"p\"\n }, \"dmOnly\"), \" or the permission options. we created a setting to prevent the monitor from running in certain channels. What if we wanted to do prevent commands from happening? How would we prevent commands from running?\"), mdx(\"h2\", null, \"What is an Inhibitor?\"), mdx(\"p\", null, \"An Inhibitor is very similar to how monitors work. A monitor runs on every message but an inhibitor runs on every command. Remember all those command options like cooldown, permissions, permissionLevel, nsfw, etc... Each and every one of these options has an inhibitor in that checks commands for these settings.\"), mdx(\"p\", null, \"Let's create our own inhibitor that would prevent commands from being used if the user is not a VIP user.\"), mdx(\"blockquote\", null, mdx(\"p\", {\n parentName: \"blockquote\"\n }, mdx(\"strong\", {\n parentName: \"p\"\n }, \"Note:\"), \" It is important to remember that everything below can be done with a simple permission level as well. We will create our own custom permission levels but for the purposes of this guide and to be able to learn about Inhibitors, we will be using an inhibitor.\")), mdx(\"h2\", null, \"Creating the File\"), mdx(\"p\", null, \"Let's start by creating a file inside the inhibitors folder called \", mdx(\"inlineCode\", {\n parentName: \"p\"\n }, \"boosted.ts\"), \" and paste the following snippet of code:\"), mdx(\"pre\", null, mdx(\"code\", _extends({\n parentName: \"pre\"\n }, {\n \"className\": \"language-ts\"\n }), \"import { botCache } from \\\"../../mod.ts\\\";\\n\\nbotCache.inhibitors.set(\\\"inhibitorname\\\", async function (message, command, guild) {\\n // Your code goes here\\n});\\n\")), mdx(\"p\", null, \"Inhibitors can take up to 3 arguments.\"), mdx(\"ul\", null, mdx(\"li\", {\n parentName: \"ul\"\n }, mdx(\"inlineCode\", {\n parentName: \"li\"\n }, \"message\"), \": The message object that triggered the command.\"), mdx(\"li\", {\n parentName: \"ul\"\n }, mdx(\"inlineCode\", {\n parentName: \"li\"\n }, \"command\"), \": The command object itself that was triggered.\"), mdx(\"li\", {\n parentName: \"ul\"\n }, mdx(\"inlineCode\", {\n parentName: \"li\"\n }, \"guild\"), \": The server guild object where this command was ran.\")), mdx(\"h2\", null, \"Understanding How Inhibitors Function\"), mdx(\"p\", null, \"To block a command you have to return a truthy value.\"), mdx(\"ul\", null, mdx(\"li\", {\n parentName: \"ul\"\n }, mdx(\"strong\", {\n parentName: \"li\"\n }, \"return true;\"), \" If you return true the inhibitor will block the execution of the command.\\nTo allow a command return a falsey value.\"), mdx(\"li\", {\n parentName: \"ul\"\n }, mdx(\"strong\", {\n parentName: \"li\"\n }, \"return false;\"), \" If you return false the inhibitor will not block the error.\")), mdx(\"pre\", null, mdx(\"code\", _extends({\n parentName: \"pre\"\n }, {\n \"className\": \"language-ts\"\n }), \"// If the command is not VIP only we can allow this command to execute\\nif (!command.vipOnly) return false;\\n\\n// The bot's support server\\nconst guild = cache.guilds.get(configs.supportServerID);\\n// If the command author is not in the server they won't have the vip role\\nconst member = guild.members.get(message.author.id) || await getMember(guild.id, message.author.id);\\n// Member doesn't exist so cancel the command\\nif (!member) {\\n sendResponse(message, `sorry, but you can not use this command until you become VIP. **Close the IRIS!!!`)\\n return true;\\n}\\n\\n// If the user has the vip role on the support server given by patreon allow the command\\nif (member.roles.includes(configs.patreonVIPRoleID)) return false;\\n\\n// Alert the user they don't have vip and can't use the command\\nsendResponse(message, `sorry, but you can not use this command until you become a VIP. I'm sorry, Teal'c. We'll go to Disneyland next year. I promise.`)\\n// Cancel the command since the user does not have vip\\nreturn true;\\n\")));\n}\n;\nMDXContent.isMDXComponent = true;","rawMDXOutput":"/* @jsx mdx */\nimport { mdx } from '@mdx-js/react';\n/* @jsx mdx */\n\nexport const _frontmatter = {\n \"title\": \"Creating Inhibitors!\",\n \"metaTitle\": \"Creating An Inhibitor | Discordeno\",\n \"metaDescription\": \"Let's create our very own bot with Discordeno!\"\n};\n\nconst layoutProps = {\n _frontmatter\n};\nconst MDXLayout = \"wrapper\"\nexport default function MDXContent({\n components,\n ...props\n}) {\n return \n

{`Woah! You are almost half way done with understanding all of Discordeno. Amazing isn't it? Something you may have noticed in the last section was there were some options that prevented some commands from running like `}{`dmOnly`}{` or the permission options. we created a setting to prevent the monitor from running in certain channels. What if we wanted to do prevent commands from happening? How would we prevent commands from running?`}

\n

{`What is an Inhibitor?`}

\n

{`An Inhibitor is very similar to how monitors work. A monitor runs on every message but an inhibitor runs on every command. Remember all those command options like cooldown, permissions, permissionLevel, nsfw, etc... Each and every one of these options has an inhibitor in that checks commands for these settings.`}

\n

{`Let's create our own inhibitor that would prevent commands from being used if the user is not a VIP user.`}

\n
\n

{`Note:`}{` It is important to remember that everything below can be done with a simple permission level as well. We will create our own custom permission levels but for the purposes of this guide and to be able to learn about Inhibitors, we will be using an inhibitor.`}

\n
\n

{`Creating the File`}

\n

{`Let's start by creating a file inside the inhibitors folder called `}{`boosted.ts`}{` and paste the following snippet of code:`}

\n
{`import { botCache } from \"../../mod.ts\";\n\nbotCache.inhibitors.set(\"inhibitorname\", async function (message, command, guild) {\n    // Your code goes here\n});\n`}
\n

{`Inhibitors can take up to 3 arguments.`}

\n
    \n
  • {`message`}{`: The message object that triggered the command.`}
  • \n
  • {`command`}{`: The command object itself that was triggered.`}
  • \n
  • {`guild`}{`: The server guild object where this command was ran.`}
  • \n
\n

{`Understanding How Inhibitors Function`}

\n

{`To block a command you have to return a truthy value.`}

\n
    \n
  • {`return true;`}{` If you return true the inhibitor will block the execution of the command.\nTo allow a command return a falsey value.`}
  • \n
  • {`return false;`}{` If you return false the inhibitor will not block the error.`}
  • \n
\n
{`// If the command is not VIP only we can allow this command to execute\nif (!command.vipOnly) return false;\n\n// The bot's support server\nconst guild = cache.guilds.get(configs.supportServerID);\n// If the command author is not in the server they won't have the vip role\nconst member = guild.members.get(message.author.id) || await getMember(guild.id, message.author.id);\n// Member doesn't exist so cancel the command\nif (!member) {\n    sendResponse(message, \\`sorry, but you can not use this command until you become VIP. **Close the IRIS!!!\\`)\n    return true;\n}\n\n// If the user has the vip role on the support server given by patreon allow the command\nif (member.roles.includes(configs.patreonVIPRoleID)) return false;\n\n// Alert the user they don't have vip and can't use the command\nsendResponse(message, \\`sorry, but you can not use this command until you become a VIP. I'm sorry, Teal'c. We'll go to Disneyland next year. I promise.\\`)\n// Cancel the command since the user does not have vip\nreturn true;\n`}
\n\n
;\n}\n\n;\nMDXContent.isMDXComponent = true;"}} \ No newline at end of file diff --git a/docs/.cache/caches/gatsby-plugin-mdx/diskstore-eee18940f5863ac20b7a103ca35928ab.json b/docs/.cache/caches/gatsby-plugin-mdx/diskstore-eee18940f5863ac20b7a103ca35928ab.json new file mode 100644 index 000000000..c76e83eba --- /dev/null +++ b/docs/.cache/caches/gatsby-plugin-mdx/diskstore-eee18940f5863ac20b7a103ca35928ab.json @@ -0,0 +1 @@ +{"expireTime":9007200851596195000,"key":"gatsby-plugin-mdx-entire-payload-f8b24e2c70e724c117ea90639072ee4c-","val":{"mdast":{"type":"root","children":[{"type":"paragraph","children":[{"type":"text","value":"Discordeno will help make Discord bot development much easier. Don't worry, as you go through this guide it will make a lot more sense.","position":{"start":{"line":2,"column":1,"offset":1},"end":{"line":2,"column":136,"offset":136},"indent":[]}}],"position":{"start":{"line":2,"column":1,"offset":1},"end":{"line":2,"column":136,"offset":136},"indent":[]}},{"type":"heading","depth":2,"children":[{"type":"text","value":"Who Made Discordeno?","position":{"start":{"line":4,"column":4,"offset":141},"end":{"line":4,"column":24,"offset":161},"indent":[]}}],"position":{"start":{"line":4,"column":1,"offset":138},"end":{"line":4,"column":24,"offset":161},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"Skillz4Killz. However, there are a lot of other contributors to the project as well. Join the discord server to meet and learn more about the wonderful team!","position":{"start":{"line":6,"column":1,"offset":163},"end":{"line":6,"column":158,"offset":320},"indent":[]}}],"position":{"start":{"line":6,"column":1,"offset":163},"end":{"line":6,"column":158,"offset":320},"indent":[]}},{"type":"heading","depth":2,"children":[{"type":"text","value":"Why You Should Use Discordeno?","position":{"start":{"line":8,"column":4,"offset":325},"end":{"line":8,"column":34,"offset":355},"indent":[]}}],"position":{"start":{"line":8,"column":1,"offset":322},"end":{"line":8,"column":34,"offset":355},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"Discordeno provides you all the tools that you need to make bot development really easy. All the tools are already made for you to just simply copy and use for yourself. We will go through each and every tool in other sections of this guide.","position":{"start":{"line":10,"column":1,"offset":357},"end":{"line":10,"column":242,"offset":598},"indent":[]}}],"position":{"start":{"line":10,"column":1,"offset":357},"end":{"line":10,"column":242,"offset":598},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"As the old saying goes, the best way to learn to ride a bicycle is to actually try riding a bicycle. So let's try out Discordeno.","position":{"start":{"line":12,"column":1,"offset":600},"end":{"line":12,"column":130,"offset":729},"indent":[]}}],"position":{"start":{"line":12,"column":1,"offset":600},"end":{"line":12,"column":130,"offset":729},"indent":[]}},{"type":"heading","depth":2,"children":[{"type":"text","value":"Creating The Bot!","position":{"start":{"line":14,"column":4,"offset":734},"end":{"line":14,"column":21,"offset":751},"indent":[]}}],"position":{"start":{"line":14,"column":1,"offset":731},"end":{"line":14,"column":21,"offset":751},"indent":[]}},{"type":"blockquote","children":[{"type":"paragraph","children":[{"type":"text","value":"This guide is going to assume you already have the basic requirements to make a bot ready. This includes github, git, a code editor like Visual Studio Code. If you don't have these yet please prepare them first before going forward.","position":{"start":{"line":16,"column":3,"offset":755},"end":{"line":16,"column":235,"offset":987},"indent":[]}}],"position":{"start":{"line":16,"column":3,"offset":755},"end":{"line":16,"column":235,"offset":987},"indent":[]}}],"position":{"start":{"line":16,"column":1,"offset":753},"end":{"line":16,"column":235,"offset":987},"indent":[]}},{"type":"list","ordered":false,"start":null,"spread":true,"children":[{"type":"listItem","spread":false,"checked":null,"children":[{"type":"paragraph","children":[{"type":"text","value":"First, create a Discordeno Bot using the ","position":{"start":{"line":18,"column":3,"offset":991},"end":{"line":18,"column":44,"offset":1032},"indent":[]}},{"type":"link","title":null,"url":"https://github.com/Skillz4Killz/Discordeno-bot-template","children":[{"type":"text","value":"Generator Boilerplate","position":{"start":{"line":18,"column":45,"offset":1033},"end":{"line":18,"column":66,"offset":1054},"indent":[]}}],"position":{"start":{"line":18,"column":44,"offset":1032},"end":{"line":18,"column":124,"offset":1112},"indent":[]}},{"type":"text","value":". Give it any name you like. For the purpose of this guide we will call it, Stargate.","position":{"start":{"line":18,"column":124,"offset":1112},"end":{"line":18,"column":209,"offset":1197},"indent":[]}}],"position":{"start":{"line":18,"column":3,"offset":991},"end":{"line":18,"column":209,"offset":1197},"indent":[]}}],"position":{"start":{"line":18,"column":1,"offset":989},"end":{"line":19,"column":1,"offset":1198},"indent":[1]}},{"type":"listItem","spread":false,"checked":null,"children":[{"type":"paragraph","children":[{"type":"text","value":"Then ","position":{"start":{"line":20,"column":3,"offset":1201},"end":{"line":20,"column":8,"offset":1206},"indent":[]}},{"type":"inlineCode","value":"git clone https://github.com/Skillz4Killz/Stargate.git","position":{"start":{"line":20,"column":8,"offset":1206},"end":{"line":20,"column":64,"offset":1262},"indent":[]}}],"position":{"start":{"line":20,"column":3,"offset":1201},"end":{"line":20,"column":64,"offset":1262},"indent":[]}}],"position":{"start":{"line":20,"column":1,"offset":1199},"end":{"line":21,"column":1,"offset":1263},"indent":[1]}},{"type":"listItem","spread":false,"checked":null,"children":[{"type":"paragraph","children":[{"type":"text","value":"When that is done, go ahead and open up the folder with VSC.","position":{"start":{"line":22,"column":3,"offset":1266},"end":{"line":22,"column":63,"offset":1326},"indent":[]}}],"position":{"start":{"line":22,"column":3,"offset":1266},"end":{"line":22,"column":63,"offset":1326},"indent":[]}}],"position":{"start":{"line":22,"column":1,"offset":1264},"end":{"line":22,"column":63,"offset":1326},"indent":[]}},{"type":"listItem","spread":false,"checked":null,"children":[{"type":"paragraph","children":[{"type":"text","value":"Create a new file called ","position":{"start":{"line":23,"column":3,"offset":1329},"end":{"line":23,"column":28,"offset":1354},"indent":[]}},{"type":"inlineCode","value":"configs.ts","position":{"start":{"line":23,"column":28,"offset":1354},"end":{"line":23,"column":40,"offset":1366},"indent":[]}},{"type":"text","value":". Open the ","position":{"start":{"line":23,"column":40,"offset":1366},"end":{"line":23,"column":51,"offset":1377},"indent":[]}},{"type":"inlineCode","value":"configs.example.ts","position":{"start":{"line":23,"column":51,"offset":1377},"end":{"line":23,"column":71,"offset":1397},"indent":[]}},{"type":"text","value":" file and copy everything over.","position":{"start":{"line":23,"column":71,"offset":1397},"end":{"line":23,"column":102,"offset":1428},"indent":[]}}],"position":{"start":{"line":23,"column":3,"offset":1329},"end":{"line":23,"column":102,"offset":1428},"indent":[]}}],"position":{"start":{"line":23,"column":1,"offset":1327},"end":{"line":23,"column":102,"offset":1428},"indent":[]}}],"position":{"start":{"line":18,"column":1,"offset":989},"end":{"line":23,"column":102,"offset":1428},"indent":[1,1,1,1,1]}},{"type":"paragraph","children":[{"type":"text","value":"Let's take a minute to review all the options we have available to us.","position":{"start":{"line":25,"column":1,"offset":1430},"end":{"line":25,"column":71,"offset":1500},"indent":[]}}],"position":{"start":{"line":25,"column":1,"offset":1430},"end":{"line":25,"column":71,"offset":1500},"indent":[]}},{"type":"heading","depth":3,"children":[{"type":"text","value":"Configs File","position":{"start":{"line":27,"column":5,"offset":1506},"end":{"line":27,"column":17,"offset":1518},"indent":[]}}],"position":{"start":{"line":27,"column":1,"offset":1502},"end":{"line":27,"column":17,"offset":1518},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"The ","position":{"start":{"line":29,"column":1,"offset":1520},"end":{"line":29,"column":5,"offset":1524},"indent":[]}},{"type":"inlineCode","value":"configs.ts","position":{"start":{"line":29,"column":5,"offset":1524},"end":{"line":29,"column":17,"offset":1536},"indent":[]}},{"type":"text","value":" file is where you will keep all your secret info you don't want to share with anyone else. As long as ","position":{"start":{"line":29,"column":17,"offset":1536},"end":{"line":29,"column":120,"offset":1639},"indent":[]}},{"type":"inlineCode","value":".gitignore","position":{"start":{"line":29,"column":120,"offset":1639},"end":{"line":29,"column":132,"offset":1651},"indent":[]}},{"type":"text","value":" file is ignoring configs.ts your configurations will be kept private!","position":{"start":{"line":29,"column":132,"offset":1651},"end":{"line":29,"column":202,"offset":1721},"indent":[]}}],"position":{"start":{"line":29,"column":1,"offset":1520},"end":{"line":29,"column":202,"offset":1721},"indent":[]}},{"type":"code","lang":"ts","meta":null,"value":"export const configs = {\n token: \"\",\n prefix: \"!\",\n botListTokens: {\n DISCORD_BOT_ORG: \"\",\n BOTS_ON_DISCORD: \"\",\n DISCORD_BOT_LIST: \"\",\n BOTS_FOR_DISCORD: \"\",\n DISCORD_BOATS: \"\",\n DISCORD_BOTS_GG: \"\",\n DISCORD_BOTS_GROUP: \"\",\n },\n channelIDs: {\n missingTranslation: \"\",\n },\n};","position":{"start":{"line":31,"column":1,"offset":1723},"end":{"line":48,"column":4,"offset":2039},"indent":[1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1]}},{"type":"heading","depth":4,"children":[{"type":"text","value":"Token","position":{"start":{"line":50,"column":6,"offset":2046},"end":{"line":50,"column":11,"offset":2051},"indent":[]}}],"position":{"start":{"line":50,"column":1,"offset":2041},"end":{"line":50,"column":11,"offset":2051},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"First, add your bot token. This is ","position":{"start":{"line":52,"column":1,"offset":2053},"end":{"line":52,"column":36,"offset":2088},"indent":[]}},{"type":"strong","children":[{"type":"text","value":"required","position":{"start":{"line":52,"column":38,"offset":2090},"end":{"line":52,"column":46,"offset":2098},"indent":[]}}],"position":{"start":{"line":52,"column":36,"offset":2088},"end":{"line":52,"column":48,"offset":2100},"indent":[]}},{"type":"text","value":" for the bot to start. Review the ","position":{"start":{"line":52,"column":48,"offset":2100},"end":{"line":52,"column":82,"offset":2134},"indent":[]}},{"type":"link","title":null,"url":"https://discordeno.netlify.app/gettingstarted#creatingyourfirstdiscordbotapplication","children":[{"type":"text","value":"instructions","position":{"start":{"line":52,"column":83,"offset":2135},"end":{"line":52,"column":95,"offset":2147},"indent":[]}}],"position":{"start":{"line":52,"column":82,"offset":2134},"end":{"line":52,"column":182,"offset":2234},"indent":[]}},{"type":"text","value":" if you have not made your token yet.","position":{"start":{"line":52,"column":182,"offset":2234},"end":{"line":52,"column":219,"offset":2271},"indent":[]}}],"position":{"start":{"line":52,"column":1,"offset":2053},"end":{"line":52,"column":219,"offset":2271},"indent":[]}},{"type":"heading","depth":4,"children":[{"type":"text","value":"Prefix","position":{"start":{"line":54,"column":6,"offset":2278},"end":{"line":54,"column":12,"offset":2284},"indent":[]}}],"position":{"start":{"line":54,"column":1,"offset":2273},"end":{"line":54,"column":12,"offset":2284},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"The prefix is where you will set the default prefix for your bot. Don't worry, every server will be able to choose their own prefix but we need a default prefix to start.","position":{"start":{"line":56,"column":1,"offset":2286},"end":{"line":56,"column":171,"offset":2456},"indent":[]}}],"position":{"start":{"line":56,"column":1,"offset":2286},"end":{"line":56,"column":171,"offset":2456},"indent":[]}},{"type":"heading","depth":4,"children":[{"type":"text","value":"Bot Lists Tokens","position":{"start":{"line":58,"column":6,"offset":2463},"end":{"line":58,"column":22,"offset":2479},"indent":[]}}],"position":{"start":{"line":58,"column":1,"offset":2458},"end":{"line":58,"column":22,"offset":2479},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"This section of the file is so you can easily have your bot's statistics updated on all the bot lists out there to help you grow your bot. The code is already written to handle this but you will need to do 3 things for each bot list.","position":{"start":{"line":60,"column":1,"offset":2481},"end":{"line":60,"column":234,"offset":2714},"indent":[]}}],"position":{"start":{"line":60,"column":1,"offset":2481},"end":{"line":60,"column":234,"offset":2714},"indent":[]}},{"type":"list","ordered":true,"start":1,"spread":false,"children":[{"type":"listItem","spread":false,"checked":null,"children":[{"type":"paragraph","children":[{"type":"text","value":"Go to the bot list and add your bot to their website. (Each site has it's own instructions)","position":{"start":{"line":62,"column":4,"offset":2719},"end":{"line":62,"column":95,"offset":2810},"indent":[]}}],"position":{"start":{"line":62,"column":4,"offset":2719},"end":{"line":62,"column":95,"offset":2810},"indent":[]}}],"position":{"start":{"line":62,"column":1,"offset":2716},"end":{"line":62,"column":95,"offset":2810},"indent":[]}},{"type":"listItem","spread":false,"checked":null,"children":[{"type":"paragraph","children":[{"type":"text","value":"Create a token for yourself on each website and paste it in your configs.","position":{"start":{"line":63,"column":4,"offset":2814},"end":{"line":63,"column":77,"offset":2887},"indent":[]}}],"position":{"start":{"line":63,"column":4,"offset":2814},"end":{"line":63,"column":77,"offset":2887},"indent":[]}}],"position":{"start":{"line":63,"column":1,"offset":2811},"end":{"line":63,"column":77,"offset":2887},"indent":[]}},{"type":"listItem","spread":false,"checked":null,"children":[{"type":"paragraph","children":[{"type":"text","value":"Enjoy!","position":{"start":{"line":64,"column":4,"offset":2891},"end":{"line":64,"column":10,"offset":2897},"indent":[]}}],"position":{"start":{"line":64,"column":4,"offset":2891},"end":{"line":64,"column":10,"offset":2897},"indent":[]}}],"position":{"start":{"line":64,"column":1,"offset":2888},"end":{"line":64,"column":10,"offset":2897},"indent":[]}}],"position":{"start":{"line":62,"column":1,"offset":2716},"end":{"line":64,"column":10,"offset":2897},"indent":[1,1]}},{"type":"paragraph","children":[{"type":"text","value":"If you wish to customize the code, you will find the bot list tasks in the tasks folder. Don't worry we will discuss this when we get to the tasks section of the guide.","position":{"start":{"line":66,"column":1,"offset":2899},"end":{"line":66,"column":169,"offset":3067},"indent":[]}}],"position":{"start":{"line":66,"column":1,"offset":2899},"end":{"line":66,"column":169,"offset":3067},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"For now just remember, that Discordeno provides you a built in way to update most discord bot lists.","position":{"start":{"line":68,"column":1,"offset":3069},"end":{"line":68,"column":101,"offset":3169},"indent":[]}}],"position":{"start":{"line":68,"column":1,"offset":3069},"end":{"line":68,"column":101,"offset":3169},"indent":[]}},{"type":"heading","depth":4,"children":[{"type":"text","value":"Channel IDs","position":{"start":{"line":70,"column":6,"offset":3176},"end":{"line":70,"column":17,"offset":3187},"indent":[]}}],"position":{"start":{"line":70,"column":1,"offset":3171},"end":{"line":70,"column":17,"offset":3187},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"The channelIDs section holds the useful for specific features to help give you alerts/notifications. For example, the ","position":{"start":{"line":72,"column":1,"offset":3189},"end":{"line":72,"column":119,"offset":3307},"indent":[]}},{"type":"inlineCode","value":"missingTranslation","position":{"start":{"line":72,"column":119,"offset":3307},"end":{"line":72,"column":139,"offset":3327},"indent":[]}},{"type":"text","value":" channel will be where messages are sent alerting you that somewhere in your code you are trying to use a translation key that you never created.","position":{"start":{"line":72,"column":139,"offset":3327},"end":{"line":72,"column":284,"offset":3472},"indent":[]}}],"position":{"start":{"line":72,"column":1,"offset":3189},"end":{"line":72,"column":284,"offset":3472},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"When you get to around 25,000 Discord servers on your bot, you may want to convert these channel IDs to webhooks.","position":{"start":{"line":74,"column":1,"offset":3474},"end":{"line":74,"column":114,"offset":3587},"indent":[]}}],"position":{"start":{"line":74,"column":1,"offset":3474},"end":{"line":74,"column":114,"offset":3587},"indent":[]}},{"type":"heading","depth":2,"children":[{"type":"text","value":"It's Alive!","position":{"start":{"line":76,"column":4,"offset":3592},"end":{"line":76,"column":15,"offset":3603},"indent":[]}}],"position":{"start":{"line":76,"column":1,"offset":3589},"end":{"line":76,"column":15,"offset":3603},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"Oh my god! You now have a bot with a bunch of features already! You don't believe me? Well, seeing is believing, so start the bot.","position":{"start":{"line":78,"column":1,"offset":3605},"end":{"line":78,"column":131,"offset":3735},"indent":[]}}],"position":{"start":{"line":78,"column":1,"offset":3605},"end":{"line":78,"column":131,"offset":3735},"indent":[]}},{"type":"list","ordered":true,"start":1,"spread":false,"children":[{"type":"listItem","spread":false,"checked":null,"children":[{"type":"paragraph","children":[{"type":"text","value":"Invite your bot to a discord server.","position":{"start":{"line":80,"column":4,"offset":3740},"end":{"line":80,"column":40,"offset":3776},"indent":[]}}],"position":{"start":{"line":80,"column":4,"offset":3740},"end":{"line":80,"column":40,"offset":3776},"indent":[]}}],"position":{"start":{"line":80,"column":1,"offset":3737},"end":{"line":80,"column":40,"offset":3776},"indent":[]}},{"type":"listItem","spread":false,"checked":null,"children":[{"type":"paragraph","children":[{"type":"text","value":"Open up the integrated terminal in VSC using ","position":{"start":{"line":81,"column":4,"offset":3780},"end":{"line":81,"column":49,"offset":3825},"indent":[]}},{"type":"strong","children":[{"type":"text","value":"CTRL + `","position":{"start":{"line":81,"column":51,"offset":3827},"end":{"line":81,"column":59,"offset":3835},"indent":[]}}],"position":{"start":{"line":81,"column":49,"offset":3825},"end":{"line":81,"column":61,"offset":3837},"indent":[]}},{"type":"text","value":". If you use a Mac, replace CTRL with CMD.","position":{"start":{"line":81,"column":61,"offset":3837},"end":{"line":81,"column":103,"offset":3879},"indent":[]}}],"position":{"start":{"line":81,"column":4,"offset":3780},"end":{"line":81,"column":103,"offset":3879},"indent":[]}}],"position":{"start":{"line":81,"column":1,"offset":3777},"end":{"line":81,"column":103,"offset":3879},"indent":[]}},{"type":"listItem","spread":false,"checked":null,"children":[{"type":"paragraph","children":[{"type":"text","value":"Run the script below:","position":{"start":{"line":82,"column":4,"offset":3883},"end":{"line":82,"column":25,"offset":3904},"indent":[]}}],"position":{"start":{"line":82,"column":4,"offset":3883},"end":{"line":82,"column":25,"offset":3904},"indent":[]}}],"position":{"start":{"line":82,"column":1,"offset":3880},"end":{"line":82,"column":25,"offset":3904},"indent":[]}}],"position":{"start":{"line":80,"column":1,"offset":3737},"end":{"line":82,"column":25,"offset":3904},"indent":[1,1]}},{"type":"code","lang":"shell","meta":null,"value":"deno run --allow-net --allow-read mod.ts","position":{"start":{"line":84,"column":1,"offset":3906},"end":{"line":86,"column":4,"offset":3959},"indent":[1,1]}},{"type":"paragraph","children":[{"type":"text","value":"The first time you run it, you may see a lot of files being loaded. This is preparing all the magic behind the scene. Once it is ready, you will see something like this:","position":{"start":{"line":88,"column":1,"offset":3961},"end":{"line":88,"column":170,"offset":4130},"indent":[]}}],"position":{"start":{"line":88,"column":1,"offset":3961},"end":{"line":88,"column":170,"offset":4130},"indent":[]}},{"type":"paragraph","children":[{"type":"image","title":null,"url":"https://i.imgur.com/TOXjLgh.png","alt":"image","position":{"start":{"line":90,"column":1,"offset":4132},"end":{"line":90,"column":42,"offset":4173},"indent":[]}}],"position":{"start":{"line":90,"column":1,"offset":4132},"end":{"line":90,"column":42,"offset":4173},"indent":[]}},{"type":"heading","depth":2,"children":[{"type":"text","value":"Understanding What Discordeno Did","position":{"start":{"line":92,"column":4,"offset":4178},"end":{"line":92,"column":37,"offset":4211},"indent":[]}}],"position":{"start":{"line":92,"column":1,"offset":4175},"end":{"line":92,"column":37,"offset":4211},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"Discordeno includes these commands/folders as they are essential for any discord bot to have in order to meet the Discord Bot Best Practices. It also adds a few things that will help make some things easier to build a bot.","position":{"start":{"line":94,"column":1,"offset":4213},"end":{"line":94,"column":223,"offset":4435},"indent":[]}}],"position":{"start":{"line":94,"column":1,"offset":4213},"end":{"line":94,"column":223,"offset":4435},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"We will dive into these deeper in this guide. Let's take it step by step.","position":{"start":{"line":96,"column":1,"offset":4437},"end":{"line":96,"column":74,"offset":4510},"indent":[]}}],"position":{"start":{"line":96,"column":1,"offset":4437},"end":{"line":96,"column":74,"offset":4510},"indent":[]}},{"type":"export","value":"export const _frontmatter = {\"title\":\"Creating The Bot!\",\"metaTitle\":\"Creating A Bot | Discordeno\",\"metaDescription\":\"Let's create our very own bot with Discordeno!\"}","position":{"start":{"line":99,"column":1,"offset":4513},"end":{"line":99,"column":167,"offset":4679},"indent":[]}}],"position":{"start":{"line":1,"column":1,"offset":0},"end":{"line":99,"column":167,"offset":4679}}},"scopeImports":["import * as React from 'react'"],"scopeIdentifiers":["React"],"body":"function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }\n\nfunction _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }\n\nfunction _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }\n\n/* @jsx mdx */\nvar _frontmatter = {\n \"title\": \"Creating The Bot!\",\n \"metaTitle\": \"Creating A Bot | Discordeno\",\n \"metaDescription\": \"Let's create our very own bot with Discordeno!\"\n};\nvar layoutProps = {\n _frontmatter: _frontmatter\n};\nvar MDXLayout = \"wrapper\";\nreturn function MDXContent(_ref) {\n var components = _ref.components,\n props = _objectWithoutProperties(_ref, [\"components\"]);\n\n return mdx(MDXLayout, _extends({}, layoutProps, props, {\n components: components,\n mdxType: \"MDXLayout\"\n }), mdx(\"p\", null, \"Discordeno will help make Discord bot development much easier. Don't worry, as you go through this guide it will make a lot more sense.\"), mdx(\"h2\", null, \"Who Made Discordeno?\"), mdx(\"p\", null, \"Skillz4Killz. However, there are a lot of other contributors to the project as well. Join the discord server to meet and learn more about the wonderful team!\"), mdx(\"h2\", null, \"Why You Should Use Discordeno?\"), mdx(\"p\", null, \"Discordeno provides you all the tools that you need to make bot development really easy. All the tools are already made for you to just simply copy and use for yourself. We will go through each and every tool in other sections of this guide.\"), mdx(\"p\", null, \"As the old saying goes, the best way to learn to ride a bicycle is to actually try riding a bicycle. So let's try out Discordeno.\"), mdx(\"h2\", null, \"Creating The Bot!\"), mdx(\"blockquote\", null, mdx(\"p\", {\n parentName: \"blockquote\"\n }, \"This guide is going to assume you already have the basic requirements to make a bot ready. This includes github, git, a code editor like Visual Studio Code. If you don't have these yet please prepare them first before going forward.\")), mdx(\"ul\", null, mdx(\"li\", {\n parentName: \"ul\"\n }, mdx(\"p\", {\n parentName: \"li\"\n }, \"First, create a Discordeno Bot using the \", mdx(\"a\", _extends({\n parentName: \"p\"\n }, {\n \"href\": \"https://github.com/Skillz4Killz/Discordeno-bot-template\"\n }), \"Generator Boilerplate\"), \". Give it any name you like. For the purpose of this guide we will call it, Stargate.\")), mdx(\"li\", {\n parentName: \"ul\"\n }, mdx(\"p\", {\n parentName: \"li\"\n }, \"Then \", mdx(\"inlineCode\", {\n parentName: \"p\"\n }, \"git clone https://github.com/Skillz4Killz/Stargate.git\"))), mdx(\"li\", {\n parentName: \"ul\"\n }, mdx(\"p\", {\n parentName: \"li\"\n }, \"When that is done, go ahead and open up the folder with VSC.\")), mdx(\"li\", {\n parentName: \"ul\"\n }, mdx(\"p\", {\n parentName: \"li\"\n }, \"Create a new file called \", mdx(\"inlineCode\", {\n parentName: \"p\"\n }, \"configs.ts\"), \". Open the \", mdx(\"inlineCode\", {\n parentName: \"p\"\n }, \"configs.example.ts\"), \" file and copy everything over.\"))), mdx(\"p\", null, \"Let's take a minute to review all the options we have available to us.\"), mdx(\"h3\", null, \"Configs File\"), mdx(\"p\", null, \"The \", mdx(\"inlineCode\", {\n parentName: \"p\"\n }, \"configs.ts\"), \" file is where you will keep all your secret info you don't want to share with anyone else. As long as \", mdx(\"inlineCode\", {\n parentName: \"p\"\n }, \".gitignore\"), \" file is ignoring configs.ts your configurations will be kept private!\"), mdx(\"pre\", null, mdx(\"code\", _extends({\n parentName: \"pre\"\n }, {\n \"className\": \"language-ts\"\n }), \"export const configs = {\\n token: \\\"\\\",\\n prefix: \\\"!\\\",\\n botListTokens: {\\n DISCORD_BOT_ORG: \\\"\\\",\\n BOTS_ON_DISCORD: \\\"\\\",\\n DISCORD_BOT_LIST: \\\"\\\",\\n BOTS_FOR_DISCORD: \\\"\\\",\\n DISCORD_BOATS: \\\"\\\",\\n DISCORD_BOTS_GG: \\\"\\\",\\n DISCORD_BOTS_GROUP: \\\"\\\",\\n },\\n channelIDs: {\\n missingTranslation: \\\"\\\",\\n },\\n};\\n\")), mdx(\"h4\", null, \"Token\"), mdx(\"p\", null, \"First, add your bot token. This is \", mdx(\"strong\", {\n parentName: \"p\"\n }, \"required\"), \" for the bot to start. Review the \", mdx(\"a\", _extends({\n parentName: \"p\"\n }, {\n \"href\": \"https://discordeno.netlify.app/gettingstarted#creatingyourfirstdiscordbotapplication\"\n }), \"instructions\"), \" if you have not made your token yet.\"), mdx(\"h4\", null, \"Prefix\"), mdx(\"p\", null, \"The prefix is where you will set the default prefix for your bot. Don't worry, every server will be able to choose their own prefix but we need a default prefix to start.\"), mdx(\"h4\", null, \"Bot Lists Tokens\"), mdx(\"p\", null, \"This section of the file is so you can easily have your bot's statistics updated on all the bot lists out there to help you grow your bot. The code is already written to handle this but you will need to do 3 things for each bot list.\"), mdx(\"ol\", null, mdx(\"li\", {\n parentName: \"ol\"\n }, \"Go to the bot list and add your bot to their website. (Each site has it's own instructions)\"), mdx(\"li\", {\n parentName: \"ol\"\n }, \"Create a token for yourself on each website and paste it in your configs.\"), mdx(\"li\", {\n parentName: \"ol\"\n }, \"Enjoy!\")), mdx(\"p\", null, \"If you wish to customize the code, you will find the bot list tasks in the tasks folder. Don't worry we will discuss this when we get to the tasks section of the guide.\"), mdx(\"p\", null, \"For now just remember, that Discordeno provides you a built in way to update most discord bot lists.\"), mdx(\"h4\", null, \"Channel IDs\"), mdx(\"p\", null, \"The channelIDs section holds the useful for specific features to help give you alerts/notifications. For example, the \", mdx(\"inlineCode\", {\n parentName: \"p\"\n }, \"missingTranslation\"), \" channel will be where messages are sent alerting you that somewhere in your code you are trying to use a translation key that you never created.\"), mdx(\"p\", null, \"When you get to around 25,000 Discord servers on your bot, you may want to convert these channel IDs to webhooks.\"), mdx(\"h2\", null, \"It's Alive!\"), mdx(\"p\", null, \"Oh my god! You now have a bot with a bunch of features already! You don't believe me? Well, seeing is believing, so start the bot.\"), mdx(\"ol\", null, mdx(\"li\", {\n parentName: \"ol\"\n }, \"Invite your bot to a discord server.\"), mdx(\"li\", {\n parentName: \"ol\"\n }, \"Open up the integrated terminal in VSC using \", mdx(\"strong\", {\n parentName: \"li\"\n }, \"CTRL + `\"), \". If you use a Mac, replace CTRL with CMD.\"), mdx(\"li\", {\n parentName: \"ol\"\n }, \"Run the script below:\")), mdx(\"pre\", null, mdx(\"code\", _extends({\n parentName: \"pre\"\n }, {\n \"className\": \"language-shell\"\n }), \"deno run --allow-net --allow-read mod.ts\\n\")), mdx(\"p\", null, \"The first time you run it, you may see a lot of files being loaded. This is preparing all the magic behind the scene. Once it is ready, you will see something like this:\"), mdx(\"p\", null, mdx(\"img\", _extends({\n parentName: \"p\"\n }, {\n \"src\": \"https://i.imgur.com/TOXjLgh.png\",\n \"alt\": \"image\"\n }))), mdx(\"h2\", null, \"Understanding What Discordeno Did\"), mdx(\"p\", null, \"Discordeno includes these commands/folders as they are essential for any discord bot to have in order to meet the Discord Bot Best Practices. It also adds a few things that will help make some things easier to build a bot.\"), mdx(\"p\", null, \"We will dive into these deeper in this guide. Let's take it step by step.\"));\n}\n;\nMDXContent.isMDXComponent = true;","rawMDXOutput":"/* @jsx mdx */\nimport { mdx } from '@mdx-js/react';\n/* @jsx mdx */\n\nexport const _frontmatter = {\n \"title\": \"Creating The Bot!\",\n \"metaTitle\": \"Creating A Bot | Discordeno\",\n \"metaDescription\": \"Let's create our very own bot with Discordeno!\"\n};\n\nconst layoutProps = {\n _frontmatter\n};\nconst MDXLayout = \"wrapper\"\nexport default function MDXContent({\n components,\n ...props\n}) {\n return \n

{`Discordeno will help make Discord bot development much easier. Don't worry, as you go through this guide it will make a lot more sense.`}

\n

{`Who Made Discordeno?`}

\n

{`Skillz4Killz. However, there are a lot of other contributors to the project as well. Join the discord server to meet and learn more about the wonderful team!`}

\n

{`Why You Should Use Discordeno?`}

\n

{`Discordeno provides you all the tools that you need to make bot development really easy. All the tools are already made for you to just simply copy and use for yourself. We will go through each and every tool in other sections of this guide.`}

\n

{`As the old saying goes, the best way to learn to ride a bicycle is to actually try riding a bicycle. So let's try out Discordeno.`}

\n

{`Creating The Bot!`}

\n
\n

{`This guide is going to assume you already have the basic requirements to make a bot ready. This includes github, git, a code editor like Visual Studio Code. If you don't have these yet please prepare them first before going forward.`}

\n
\n
    \n
  • \n

    {`First, create a Discordeno Bot using the `}{`Generator Boilerplate`}{`. Give it any name you like. For the purpose of this guide we will call it, Stargate.`}

    \n
  • \n
  • \n

    {`Then `}{`git clone https://github.com/Skillz4Killz/Stargate.git`}

    \n
  • \n
  • \n

    {`When that is done, go ahead and open up the folder with VSC.`}

    \n
  • \n
  • \n

    {`Create a new file called `}{`configs.ts`}{`. Open the `}{`configs.example.ts`}{` file and copy everything over.`}

    \n
  • \n
\n

{`Let's take a minute to review all the options we have available to us.`}

\n

{`Configs File`}

\n

{`The `}{`configs.ts`}{` file is where you will keep all your secret info you don't want to share with anyone else. As long as `}{`.gitignore`}{` file is ignoring configs.ts your configurations will be kept private!`}

\n
{`export const configs = {\n  token: \"\",\n  prefix: \"!\",\n  botListTokens: {\n    DISCORD_BOT_ORG: \"\",\n    BOTS_ON_DISCORD: \"\",\n    DISCORD_BOT_LIST: \"\",\n    BOTS_FOR_DISCORD: \"\",\n    DISCORD_BOATS: \"\",\n    DISCORD_BOTS_GG: \"\",\n    DISCORD_BOTS_GROUP: \"\",\n  },\n  channelIDs: {\n    missingTranslation: \"\",\n  },\n};\n`}
\n

{`Token`}

\n

{`First, add your bot token. This is `}{`required`}{` for the bot to start. Review the `}{`instructions`}{` if you have not made your token yet.`}

\n

{`Prefix`}

\n

{`The prefix is where you will set the default prefix for your bot. Don't worry, every server will be able to choose their own prefix but we need a default prefix to start.`}

\n

{`Bot Lists Tokens`}

\n

{`This section of the file is so you can easily have your bot's statistics updated on all the bot lists out there to help you grow your bot. The code is already written to handle this but you will need to do 3 things for each bot list.`}

\n
    \n
  1. {`Go to the bot list and add your bot to their website. (Each site has it's own instructions)`}
  2. \n
  3. {`Create a token for yourself on each website and paste it in your configs.`}
  4. \n
  5. {`Enjoy!`}
  6. \n
\n

{`If you wish to customize the code, you will find the bot list tasks in the tasks folder. Don't worry we will discuss this when we get to the tasks section of the guide.`}

\n

{`For now just remember, that Discordeno provides you a built in way to update most discord bot lists.`}

\n

{`Channel IDs`}

\n

{`The channelIDs section holds the useful for specific features to help give you alerts/notifications. For example, the `}{`missingTranslation`}{` channel will be where messages are sent alerting you that somewhere in your code you are trying to use a translation key that you never created.`}

\n

{`When you get to around 25,000 Discord servers on your bot, you may want to convert these channel IDs to webhooks.`}

\n

{`It's Alive!`}

\n

{`Oh my god! You now have a bot with a bunch of features already! You don't believe me? Well, seeing is believing, so start the bot.`}

\n
    \n
  1. {`Invite your bot to a discord server.`}
  2. \n
  3. {`Open up the integrated terminal in VSC using `}{`CTRL + \\``}{`. If you use a Mac, replace CTRL with CMD.`}
  4. \n
  5. {`Run the script below:`}
  6. \n
\n
{`deno run --allow-net --allow-read mod.ts\n`}
\n

{`The first time you run it, you may see a lot of files being loaded. This is preparing all the magic behind the scene. Once it is ready, you will see something like this:`}

\n

\n

{`Understanding What Discordeno Did`}

\n

{`Discordeno includes these commands/folders as they are essential for any discord bot to have in order to meet the Discord Bot Best Practices. It also adds a few things that will help make some things easier to build a bot.`}

\n

{`We will dive into these deeper in this guide. Let's take it step by step.`}

\n\n
;\n}\n\n;\nMDXContent.isMDXComponent = true;"}} \ No newline at end of file diff --git a/docs/.cache/caches/gatsby-plugin-mdx/diskstore-ef7ccd85b3ec1f14596b805cbe5e96e8.json b/docs/.cache/caches/gatsby-plugin-mdx/diskstore-ef7ccd85b3ec1f14596b805cbe5e96e8.json new file mode 100644 index 000000000..b156d8c72 --- /dev/null +++ b/docs/.cache/caches/gatsby-plugin-mdx/diskstore-ef7ccd85b3ec1f14596b805cbe5e96e8.json @@ -0,0 +1 @@ +{"expireTime":9007200851632817000,"key":"gatsby-plugin-mdx-entire-payload-8fefe6a9d4bead3b371e08e9aff3ef56-","val":{"mdast":{"type":"root","children":[{"type":"paragraph","children":[{"type":"text","value":"Woah! You are almost half way done with understanding all of Discordeno. Amazing isn't it? Something you may have noticed in the last section was there were some options that prevented some commands from running like ","position":{"start":{"line":2,"column":1,"offset":1},"end":{"line":2,"column":218,"offset":218},"indent":[]}},{"type":"inlineCode","value":"dmOnly","position":{"start":{"line":2,"column":218,"offset":218},"end":{"line":2,"column":226,"offset":226},"indent":[]}},{"type":"text","value":" or the permission options. we created a setting to prevent the monitor from running in certain channels. What if we wanted to do prevent commands from happening? How would we prevent commands from running?","position":{"start":{"line":2,"column":226,"offset":226},"end":{"line":2,"column":432,"offset":432},"indent":[]}}],"position":{"start":{"line":2,"column":1,"offset":1},"end":{"line":2,"column":432,"offset":432},"indent":[]}},{"type":"heading","depth":2,"children":[{"type":"text","value":"What is an Inhibitor?","position":{"start":{"line":4,"column":4,"offset":437},"end":{"line":4,"column":25,"offset":458},"indent":[]}}],"position":{"start":{"line":4,"column":1,"offset":434},"end":{"line":4,"column":25,"offset":458},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"An Inhibitor is very similar to how monitors work. A monitor runs on every message but an inhibitor runs on every command. Remember all those command options like cooldown, permissions, permissionLevel, nsfw, etc... Each and every one of these options has an inhibitor in that checks commands for these settings.","position":{"start":{"line":6,"column":1,"offset":460},"end":{"line":6,"column":313,"offset":772},"indent":[]}}],"position":{"start":{"line":6,"column":1,"offset":460},"end":{"line":6,"column":313,"offset":772},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"Let's create our own inhibitor that would prevent commands from being used if the user is not a VIP user.","position":{"start":{"line":8,"column":1,"offset":774},"end":{"line":8,"column":106,"offset":879},"indent":[]}}],"position":{"start":{"line":8,"column":1,"offset":774},"end":{"line":8,"column":106,"offset":879},"indent":[]}},{"type":"blockquote","children":[{"type":"paragraph","children":[{"type":"strong","children":[{"type":"text","value":"Note:","position":{"start":{"line":10,"column":5,"offset":885},"end":{"line":10,"column":10,"offset":890},"indent":[]}}],"position":{"start":{"line":10,"column":3,"offset":883},"end":{"line":10,"column":12,"offset":892},"indent":[]}},{"type":"text","value":" It is important to remember that everything below can be done with a simple permission level as well. We will create our own custom permission levels but for the purposes of this guide and to be able to learn about Inhibitors, we will be using an inhibitor.","position":{"start":{"line":10,"column":12,"offset":892},"end":{"line":10,"column":270,"offset":1150},"indent":[]}}],"position":{"start":{"line":10,"column":3,"offset":883},"end":{"line":10,"column":270,"offset":1150},"indent":[]}}],"position":{"start":{"line":10,"column":1,"offset":881},"end":{"line":10,"column":270,"offset":1150},"indent":[]}},{"type":"heading","depth":2,"children":[{"type":"text","value":"Creating the File","position":{"start":{"line":12,"column":4,"offset":1155},"end":{"line":12,"column":21,"offset":1172},"indent":[]}}],"position":{"start":{"line":12,"column":1,"offset":1152},"end":{"line":12,"column":21,"offset":1172},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"Let's start by creating a file inside the inhibitors folder called ","position":{"start":{"line":14,"column":1,"offset":1174},"end":{"line":14,"column":68,"offset":1241},"indent":[]}},{"type":"inlineCode","value":"vipOnly.ts","position":{"start":{"line":14,"column":68,"offset":1241},"end":{"line":14,"column":80,"offset":1253},"indent":[]}},{"type":"text","value":" and paste the following snippet of code:","position":{"start":{"line":14,"column":80,"offset":1253},"end":{"line":14,"column":121,"offset":1294},"indent":[]}}],"position":{"start":{"line":14,"column":1,"offset":1174},"end":{"line":14,"column":121,"offset":1294},"indent":[]}},{"type":"code","lang":"ts","meta":null,"value":"import { botCache } from \"../../mod.ts\";\n\nbotCache.inhibitors.set(\"inhibitorname\", async function (message, command, guild) {\n\t// Your code goes here\n});","position":{"start":{"line":16,"column":1,"offset":1296},"end":{"line":22,"column":4,"offset":1459},"indent":[1,1,1,1,1,1]}},{"type":"paragraph","children":[{"type":"text","value":"Inhibitors can take up to 3 arguments.","position":{"start":{"line":24,"column":1,"offset":1461},"end":{"line":24,"column":39,"offset":1499},"indent":[]}}],"position":{"start":{"line":24,"column":1,"offset":1461},"end":{"line":24,"column":39,"offset":1499},"indent":[]}},{"type":"list","ordered":false,"start":null,"spread":false,"children":[{"type":"listItem","spread":false,"checked":null,"children":[{"type":"paragraph","children":[{"type":"inlineCode","value":"message","position":{"start":{"line":26,"column":3,"offset":1503},"end":{"line":26,"column":12,"offset":1512},"indent":[]}},{"type":"text","value":": The message object that triggered the command.","position":{"start":{"line":26,"column":12,"offset":1512},"end":{"line":26,"column":60,"offset":1560},"indent":[]}}],"position":{"start":{"line":26,"column":3,"offset":1503},"end":{"line":26,"column":60,"offset":1560},"indent":[]}}],"position":{"start":{"line":26,"column":1,"offset":1501},"end":{"line":26,"column":60,"offset":1560},"indent":[]}},{"type":"listItem","spread":false,"checked":null,"children":[{"type":"paragraph","children":[{"type":"inlineCode","value":"command","position":{"start":{"line":27,"column":3,"offset":1563},"end":{"line":27,"column":12,"offset":1572},"indent":[]}},{"type":"text","value":": The command object itself that was triggered.","position":{"start":{"line":27,"column":12,"offset":1572},"end":{"line":27,"column":59,"offset":1619},"indent":[]}}],"position":{"start":{"line":27,"column":3,"offset":1563},"end":{"line":27,"column":59,"offset":1619},"indent":[]}}],"position":{"start":{"line":27,"column":1,"offset":1561},"end":{"line":27,"column":59,"offset":1619},"indent":[]}},{"type":"listItem","spread":false,"checked":null,"children":[{"type":"paragraph","children":[{"type":"inlineCode","value":"guild","position":{"start":{"line":28,"column":3,"offset":1622},"end":{"line":28,"column":10,"offset":1629},"indent":[]}},{"type":"text","value":": The server guild object where this command was ran.","position":{"start":{"line":28,"column":10,"offset":1629},"end":{"line":28,"column":63,"offset":1682},"indent":[]}}],"position":{"start":{"line":28,"column":3,"offset":1622},"end":{"line":28,"column":63,"offset":1682},"indent":[]}}],"position":{"start":{"line":28,"column":1,"offset":1620},"end":{"line":28,"column":63,"offset":1682},"indent":[]}}],"position":{"start":{"line":26,"column":1,"offset":1501},"end":{"line":28,"column":63,"offset":1682},"indent":[1,1]}},{"type":"heading","depth":2,"children":[{"type":"text","value":"Understanding How Inhibitors Function","position":{"start":{"line":30,"column":4,"offset":1687},"end":{"line":30,"column":41,"offset":1724},"indent":[]}}],"position":{"start":{"line":30,"column":1,"offset":1684},"end":{"line":30,"column":41,"offset":1724},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"To block a command you have to return a truthy value.","position":{"start":{"line":32,"column":1,"offset":1726},"end":{"line":32,"column":54,"offset":1779},"indent":[]}}],"position":{"start":{"line":32,"column":1,"offset":1726},"end":{"line":32,"column":54,"offset":1779},"indent":[]}},{"type":"code","lang":null,"meta":null,"value":"- **return true;** If you return true the inhibitor will block the execution of the command.","position":{"start":{"line":33,"column":1,"offset":1780},"end":{"line":33,"column":94,"offset":1873},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"To allow a command return a falsey value.","position":{"start":{"line":34,"column":1,"offset":1874},"end":{"line":34,"column":42,"offset":1915},"indent":[]}}],"position":{"start":{"line":34,"column":1,"offset":1874},"end":{"line":34,"column":42,"offset":1915},"indent":[]}},{"type":"code","lang":null,"meta":null,"value":"- **return false;** If you return false the inhibitor will not block the error.","position":{"start":{"line":35,"column":1,"offset":1916},"end":{"line":35,"column":81,"offset":1996},"indent":[]}},{"type":"code","lang":"ts","meta":null,"value":"// If the command is not VIP only we can allow this command\n if (!command.vipOnly) return false\n // Check if the user is VIP\n const userIsVIP = message.author.settings.get(`isVIP`)\n // The user is VIP so we can allow this command to be used\n if (userIsVIP) return false\n // The user is NOT VIP so we throw an error\n throw `The ${command.name} is only allowed for VIP users.`","position":{"start":{"line":38,"column":1,"offset":1999},"end":{"line":47,"column":4,"offset":2432},"indent":[1,1,1,1,1,1,1,1,1]}},{"type":"export","value":"export const _frontmatter = {\"title\":\"Creating Inhibitors!\",\"metaTitle\":\"Creating An Inhibitor | Discordeno\",\"metaDescription\":\"Let's create our very own bot with Discordeno!\"}","position":{"start":{"line":50,"column":1,"offset":2435},"end":{"line":50,"column":177,"offset":2611},"indent":[]}}],"position":{"start":{"line":1,"column":1,"offset":0},"end":{"line":50,"column":177,"offset":2611}}},"scopeImports":["import * as React from 'react'"],"scopeIdentifiers":["React"],"body":"function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }\n\nfunction _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }\n\nfunction _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }\n\n/* @jsx mdx */\nvar _frontmatter = {\n \"title\": \"Creating Inhibitors!\",\n \"metaTitle\": \"Creating An Inhibitor | Discordeno\",\n \"metaDescription\": \"Let's create our very own bot with Discordeno!\"\n};\nvar layoutProps = {\n _frontmatter: _frontmatter\n};\nvar MDXLayout = \"wrapper\";\nreturn function MDXContent(_ref) {\n var components = _ref.components,\n props = _objectWithoutProperties(_ref, [\"components\"]);\n\n return mdx(MDXLayout, _extends({}, layoutProps, props, {\n components: components,\n mdxType: \"MDXLayout\"\n }), mdx(\"p\", null, \"Woah! You are almost half way done with understanding all of Discordeno. Amazing isn't it? Something you may have noticed in the last section was there were some options that prevented some commands from running like \", mdx(\"inlineCode\", {\n parentName: \"p\"\n }, \"dmOnly\"), \" or the permission options. we created a setting to prevent the monitor from running in certain channels. What if we wanted to do prevent commands from happening? How would we prevent commands from running?\"), mdx(\"h2\", null, \"What is an Inhibitor?\"), mdx(\"p\", null, \"An Inhibitor is very similar to how monitors work. A monitor runs on every message but an inhibitor runs on every command. Remember all those command options like cooldown, permissions, permissionLevel, nsfw, etc... Each and every one of these options has an inhibitor in that checks commands for these settings.\"), mdx(\"p\", null, \"Let's create our own inhibitor that would prevent commands from being used if the user is not a VIP user.\"), mdx(\"blockquote\", null, mdx(\"p\", {\n parentName: \"blockquote\"\n }, mdx(\"strong\", {\n parentName: \"p\"\n }, \"Note:\"), \" It is important to remember that everything below can be done with a simple permission level as well. We will create our own custom permission levels but for the purposes of this guide and to be able to learn about Inhibitors, we will be using an inhibitor.\")), mdx(\"h2\", null, \"Creating the File\"), mdx(\"p\", null, \"Let's start by creating a file inside the inhibitors folder called \", mdx(\"inlineCode\", {\n parentName: \"p\"\n }, \"vipOnly.ts\"), \" and paste the following snippet of code:\"), mdx(\"pre\", null, mdx(\"code\", _extends({\n parentName: \"pre\"\n }, {\n \"className\": \"language-ts\"\n }), \"import { botCache } from \\\"../../mod.ts\\\";\\n\\nbotCache.inhibitors.set(\\\"inhibitorname\\\", async function (message, command, guild) {\\n // Your code goes here\\n});\\n\")), mdx(\"p\", null, \"Inhibitors can take up to 3 arguments.\"), mdx(\"ul\", null, mdx(\"li\", {\n parentName: \"ul\"\n }, mdx(\"inlineCode\", {\n parentName: \"li\"\n }, \"message\"), \": The message object that triggered the command.\"), mdx(\"li\", {\n parentName: \"ul\"\n }, mdx(\"inlineCode\", {\n parentName: \"li\"\n }, \"command\"), \": The command object itself that was triggered.\"), mdx(\"li\", {\n parentName: \"ul\"\n }, mdx(\"inlineCode\", {\n parentName: \"li\"\n }, \"guild\"), \": The server guild object where this command was ran.\")), mdx(\"h2\", null, \"Understanding How Inhibitors Function\"), mdx(\"p\", null, \"To block a command you have to return a truthy value.\"), mdx(\"pre\", null, mdx(\"code\", _extends({\n parentName: \"pre\"\n }, {}), \"- **return true;** If you return true the inhibitor will block the execution of the command.\\n\")), mdx(\"p\", null, \"To allow a command return a falsey value.\"), mdx(\"pre\", null, mdx(\"code\", _extends({\n parentName: \"pre\"\n }, {}), \"- **return false;** If you return false the inhibitor will not block the error.\\n\")), mdx(\"pre\", null, mdx(\"code\", _extends({\n parentName: \"pre\"\n }, {\n \"className\": \"language-ts\"\n }), \"// If the command is not VIP only we can allow this command\\n if (!command.vipOnly) return false\\n // Check if the user is VIP\\n const userIsVIP = message.author.settings.get(`isVIP`)\\n // The user is VIP so we can allow this command to be used\\n if (userIsVIP) return false\\n // The user is NOT VIP so we throw an error\\n throw `The ${command.name} is only allowed for VIP users.`\\n\")));\n}\n;\nMDXContent.isMDXComponent = true;","rawMDXOutput":"/* @jsx mdx */\nimport { mdx } from '@mdx-js/react';\n/* @jsx mdx */\n\nexport const _frontmatter = {\n \"title\": \"Creating Inhibitors!\",\n \"metaTitle\": \"Creating An Inhibitor | Discordeno\",\n \"metaDescription\": \"Let's create our very own bot with Discordeno!\"\n};\n\nconst layoutProps = {\n _frontmatter\n};\nconst MDXLayout = \"wrapper\"\nexport default function MDXContent({\n components,\n ...props\n}) {\n return \n

{`Woah! You are almost half way done with understanding all of Discordeno. Amazing isn't it? Something you may have noticed in the last section was there were some options that prevented some commands from running like `}{`dmOnly`}{` or the permission options. we created a setting to prevent the monitor from running in certain channels. What if we wanted to do prevent commands from happening? How would we prevent commands from running?`}

\n

{`What is an Inhibitor?`}

\n

{`An Inhibitor is very similar to how monitors work. A monitor runs on every message but an inhibitor runs on every command. Remember all those command options like cooldown, permissions, permissionLevel, nsfw, etc... Each and every one of these options has an inhibitor in that checks commands for these settings.`}

\n

{`Let's create our own inhibitor that would prevent commands from being used if the user is not a VIP user.`}

\n
\n

{`Note:`}{` It is important to remember that everything below can be done with a simple permission level as well. We will create our own custom permission levels but for the purposes of this guide and to be able to learn about Inhibitors, we will be using an inhibitor.`}

\n
\n

{`Creating the File`}

\n

{`Let's start by creating a file inside the inhibitors folder called `}{`vipOnly.ts`}{` and paste the following snippet of code:`}

\n
{`import { botCache } from \"../../mod.ts\";\n\nbotCache.inhibitors.set(\"inhibitorname\", async function (message, command, guild) {\n    // Your code goes here\n});\n`}
\n

{`Inhibitors can take up to 3 arguments.`}

\n
    \n
  • {`message`}{`: The message object that triggered the command.`}
  • \n
  • {`command`}{`: The command object itself that was triggered.`}
  • \n
  • {`guild`}{`: The server guild object where this command was ran.`}
  • \n
\n

{`Understanding How Inhibitors Function`}

\n

{`To block a command you have to return a truthy value.`}

\n
{`- **return true;** If you return true the inhibitor will block the execution of the command.\n`}
\n

{`To allow a command return a falsey value.`}

\n
{`- **return false;** If you return false the inhibitor will not block the error.\n`}
\n
{`// If the command is not VIP only we can allow this command\n        if (!command.vipOnly) return false\n        // Check if the user is VIP\n        const userIsVIP = message.author.settings.get(\\`isVIP\\`)\n        // The user is VIP so we can allow this command to be used\n        if (userIsVIP) return false\n        // The user is NOT VIP so we throw an error\n        throw \\`The \\${command.name} is only allowed for VIP users.\\`\n`}
\n\n
;\n}\n\n;\nMDXContent.isMDXComponent = true;"}} \ No newline at end of file diff --git a/docs/.cache/caches/gatsby-plugin-mdx/diskstore-f1264c7d1daf7d4f2e5351beb90ee03a.json b/docs/.cache/caches/gatsby-plugin-mdx/diskstore-f1264c7d1daf7d4f2e5351beb90ee03a.json new file mode 100644 index 000000000..8cdc6c644 --- /dev/null +++ b/docs/.cache/caches/gatsby-plugin-mdx/diskstore-f1264c7d1daf7d4f2e5351beb90ee03a.json @@ -0,0 +1 @@ +{"expireTime":9007200851634098000,"key":"gatsby-plugin-mdx-entire-payload-38d3cb0b5caae6ef53d04266e48619e1-","val":{"mdast":{"type":"root","children":[{"type":"paragraph","children":[{"type":"text","value":"Woah! You are almost half way done with understanding all of Discordeno. Amazing isn't it? Something you may have noticed in the last section was there were some options that prevented some commands from running like ","position":{"start":{"line":2,"column":1,"offset":1},"end":{"line":2,"column":218,"offset":218},"indent":[]}},{"type":"inlineCode","value":"dmOnly","position":{"start":{"line":2,"column":218,"offset":218},"end":{"line":2,"column":226,"offset":226},"indent":[]}},{"type":"text","value":" or the permission options. we created a setting to prevent the monitor from running in certain channels. What if we wanted to do prevent commands from happening? How would we prevent commands from running?","position":{"start":{"line":2,"column":226,"offset":226},"end":{"line":2,"column":432,"offset":432},"indent":[]}}],"position":{"start":{"line":2,"column":1,"offset":1},"end":{"line":2,"column":432,"offset":432},"indent":[]}},{"type":"heading","depth":2,"children":[{"type":"text","value":"What is an Inhibitor?","position":{"start":{"line":4,"column":4,"offset":437},"end":{"line":4,"column":25,"offset":458},"indent":[]}}],"position":{"start":{"line":4,"column":1,"offset":434},"end":{"line":4,"column":25,"offset":458},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"An Inhibitor is very similar to how monitors work. A monitor runs on every message but an inhibitor runs on every command. Remember all those command options like cooldown, permissions, permissionLevel, nsfw, etc... Each and every one of these options has an inhibitor in that checks commands for these settings.","position":{"start":{"line":6,"column":1,"offset":460},"end":{"line":6,"column":313,"offset":772},"indent":[]}}],"position":{"start":{"line":6,"column":1,"offset":460},"end":{"line":6,"column":313,"offset":772},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"Let's create our own inhibitor that would prevent commands from being used if the user is not a VIP user.","position":{"start":{"line":8,"column":1,"offset":774},"end":{"line":8,"column":106,"offset":879},"indent":[]}}],"position":{"start":{"line":8,"column":1,"offset":774},"end":{"line":8,"column":106,"offset":879},"indent":[]}},{"type":"blockquote","children":[{"type":"paragraph","children":[{"type":"strong","children":[{"type":"text","value":"Note:","position":{"start":{"line":10,"column":5,"offset":885},"end":{"line":10,"column":10,"offset":890},"indent":[]}}],"position":{"start":{"line":10,"column":3,"offset":883},"end":{"line":10,"column":12,"offset":892},"indent":[]}},{"type":"text","value":" It is important to remember that everything below can be done with a simple permission level as well. We will create our own custom permission levels but for the purposes of this guide and to be able to learn about Inhibitors, we will be using an inhibitor.","position":{"start":{"line":10,"column":12,"offset":892},"end":{"line":10,"column":270,"offset":1150},"indent":[]}}],"position":{"start":{"line":10,"column":3,"offset":883},"end":{"line":10,"column":270,"offset":1150},"indent":[]}}],"position":{"start":{"line":10,"column":1,"offset":881},"end":{"line":10,"column":270,"offset":1150},"indent":[]}},{"type":"heading","depth":2,"children":[{"type":"text","value":"Creating the File","position":{"start":{"line":12,"column":4,"offset":1155},"end":{"line":12,"column":21,"offset":1172},"indent":[]}}],"position":{"start":{"line":12,"column":1,"offset":1152},"end":{"line":12,"column":21,"offset":1172},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"Let's start by creating a file inside the inhibitors folder called ","position":{"start":{"line":14,"column":1,"offset":1174},"end":{"line":14,"column":68,"offset":1241},"indent":[]}},{"type":"inlineCode","value":"boosted.ts","position":{"start":{"line":14,"column":68,"offset":1241},"end":{"line":14,"column":80,"offset":1253},"indent":[]}},{"type":"text","value":" and paste the following snippet of code:","position":{"start":{"line":14,"column":80,"offset":1253},"end":{"line":14,"column":121,"offset":1294},"indent":[]}}],"position":{"start":{"line":14,"column":1,"offset":1174},"end":{"line":14,"column":121,"offset":1294},"indent":[]}},{"type":"code","lang":"ts","meta":null,"value":"import { botCache } from \"../../mod.ts\";\n\nbotCache.inhibitors.set(\"inhibitorname\", async function (message, command, guild) {\n\t// Your code goes here\n});","position":{"start":{"line":16,"column":1,"offset":1296},"end":{"line":22,"column":4,"offset":1459},"indent":[1,1,1,1,1,1]}},{"type":"paragraph","children":[{"type":"text","value":"Inhibitors can take up to 3 arguments.","position":{"start":{"line":24,"column":1,"offset":1461},"end":{"line":24,"column":39,"offset":1499},"indent":[]}}],"position":{"start":{"line":24,"column":1,"offset":1461},"end":{"line":24,"column":39,"offset":1499},"indent":[]}},{"type":"list","ordered":false,"start":null,"spread":false,"children":[{"type":"listItem","spread":false,"checked":null,"children":[{"type":"paragraph","children":[{"type":"inlineCode","value":"message","position":{"start":{"line":26,"column":3,"offset":1503},"end":{"line":26,"column":12,"offset":1512},"indent":[]}},{"type":"text","value":": The message object that triggered the command.","position":{"start":{"line":26,"column":12,"offset":1512},"end":{"line":26,"column":60,"offset":1560},"indent":[]}}],"position":{"start":{"line":26,"column":3,"offset":1503},"end":{"line":26,"column":60,"offset":1560},"indent":[]}}],"position":{"start":{"line":26,"column":1,"offset":1501},"end":{"line":26,"column":60,"offset":1560},"indent":[]}},{"type":"listItem","spread":false,"checked":null,"children":[{"type":"paragraph","children":[{"type":"inlineCode","value":"command","position":{"start":{"line":27,"column":3,"offset":1563},"end":{"line":27,"column":12,"offset":1572},"indent":[]}},{"type":"text","value":": The command object itself that was triggered.","position":{"start":{"line":27,"column":12,"offset":1572},"end":{"line":27,"column":59,"offset":1619},"indent":[]}}],"position":{"start":{"line":27,"column":3,"offset":1563},"end":{"line":27,"column":59,"offset":1619},"indent":[]}}],"position":{"start":{"line":27,"column":1,"offset":1561},"end":{"line":27,"column":59,"offset":1619},"indent":[]}},{"type":"listItem","spread":false,"checked":null,"children":[{"type":"paragraph","children":[{"type":"inlineCode","value":"guild","position":{"start":{"line":28,"column":3,"offset":1622},"end":{"line":28,"column":10,"offset":1629},"indent":[]}},{"type":"text","value":": The server guild object where this command was ran.","position":{"start":{"line":28,"column":10,"offset":1629},"end":{"line":28,"column":63,"offset":1682},"indent":[]}}],"position":{"start":{"line":28,"column":3,"offset":1622},"end":{"line":28,"column":63,"offset":1682},"indent":[]}}],"position":{"start":{"line":28,"column":1,"offset":1620},"end":{"line":28,"column":63,"offset":1682},"indent":[]}}],"position":{"start":{"line":26,"column":1,"offset":1501},"end":{"line":28,"column":63,"offset":1682},"indent":[1,1]}},{"type":"heading","depth":2,"children":[{"type":"text","value":"Understanding How Inhibitors Function","position":{"start":{"line":30,"column":4,"offset":1687},"end":{"line":30,"column":41,"offset":1724},"indent":[]}}],"position":{"start":{"line":30,"column":1,"offset":1684},"end":{"line":30,"column":41,"offset":1724},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"To block a command you have to return a truthy value.","position":{"start":{"line":32,"column":1,"offset":1726},"end":{"line":32,"column":54,"offset":1779},"indent":[]}}],"position":{"start":{"line":32,"column":1,"offset":1726},"end":{"line":32,"column":54,"offset":1779},"indent":[]}},{"type":"list","ordered":false,"start":null,"spread":false,"children":[{"type":"listItem","spread":false,"checked":null,"children":[{"type":"paragraph","children":[{"type":"strong","children":[{"type":"text","value":"return true;","position":{"start":{"line":33,"column":5,"offset":1784},"end":{"line":33,"column":17,"offset":1796},"indent":[]}}],"position":{"start":{"line":33,"column":3,"offset":1782},"end":{"line":33,"column":19,"offset":1798},"indent":[]}},{"type":"text","value":" If you return true the inhibitor will block the execution of the command.\nTo allow a command return a falsey value.","position":{"start":{"line":33,"column":19,"offset":1798},"end":{"line":34,"column":42,"offset":1914},"indent":[1]}}],"position":{"start":{"line":33,"column":3,"offset":1782},"end":{"line":34,"column":42,"offset":1914},"indent":[1]}}],"position":{"start":{"line":33,"column":1,"offset":1780},"end":{"line":34,"column":42,"offset":1914},"indent":[1]}},{"type":"listItem","spread":false,"checked":null,"children":[{"type":"paragraph","children":[{"type":"strong","children":[{"type":"text","value":"return false;","position":{"start":{"line":35,"column":5,"offset":1919},"end":{"line":35,"column":18,"offset":1932},"indent":[]}}],"position":{"start":{"line":35,"column":3,"offset":1917},"end":{"line":35,"column":20,"offset":1934},"indent":[]}},{"type":"text","value":" If you return false the inhibitor will not block the error.","position":{"start":{"line":35,"column":20,"offset":1934},"end":{"line":35,"column":80,"offset":1994},"indent":[]}}],"position":{"start":{"line":35,"column":3,"offset":1917},"end":{"line":35,"column":80,"offset":1994},"indent":[]}}],"position":{"start":{"line":35,"column":1,"offset":1915},"end":{"line":35,"column":80,"offset":1994},"indent":[]}}],"position":{"start":{"line":33,"column":1,"offset":1780},"end":{"line":35,"column":80,"offset":1994},"indent":[1,1]}},{"type":"code","lang":"ts","meta":null,"value":"// If the command is not VIP only we can allow this command to execute\nif (!command.vipOnly) return false;\n\nconst guild =\n// Check if the user has the vip role on the support server given by patreon\nconst userIsVIP = await isUserVIP(message.author.id)\n// The user is VIP so we can allow this command to be used\nif (userIsVIP) return false;\n\n// The user is NOT VIP so we throw an error\nthrow `The ${command.name} is only allowed for VIP users.`","position":{"start":{"line":38,"column":1,"offset":1997},"end":{"line":50,"column":4,"offset":2450},"indent":[1,1,1,1,1,1,1,1,1,1,1,1]}},{"type":"export","value":"export const _frontmatter = {\"title\":\"Creating Inhibitors!\",\"metaTitle\":\"Creating An Inhibitor | Discordeno\",\"metaDescription\":\"Let's create our very own bot with Discordeno!\"}","position":{"start":{"line":53,"column":1,"offset":2453},"end":{"line":53,"column":177,"offset":2629},"indent":[]}}],"position":{"start":{"line":1,"column":1,"offset":0},"end":{"line":53,"column":177,"offset":2629}}},"scopeImports":["import * as React from 'react'"],"scopeIdentifiers":["React"],"body":"function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }\n\nfunction _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }\n\nfunction _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }\n\n/* @jsx mdx */\nvar _frontmatter = {\n \"title\": \"Creating Inhibitors!\",\n \"metaTitle\": \"Creating An Inhibitor | Discordeno\",\n \"metaDescription\": \"Let's create our very own bot with Discordeno!\"\n};\nvar layoutProps = {\n _frontmatter: _frontmatter\n};\nvar MDXLayout = \"wrapper\";\nreturn function MDXContent(_ref) {\n var components = _ref.components,\n props = _objectWithoutProperties(_ref, [\"components\"]);\n\n return mdx(MDXLayout, _extends({}, layoutProps, props, {\n components: components,\n mdxType: \"MDXLayout\"\n }), mdx(\"p\", null, \"Woah! You are almost half way done with understanding all of Discordeno. Amazing isn't it? Something you may have noticed in the last section was there were some options that prevented some commands from running like \", mdx(\"inlineCode\", {\n parentName: \"p\"\n }, \"dmOnly\"), \" or the permission options. we created a setting to prevent the monitor from running in certain channels. What if we wanted to do prevent commands from happening? How would we prevent commands from running?\"), mdx(\"h2\", null, \"What is an Inhibitor?\"), mdx(\"p\", null, \"An Inhibitor is very similar to how monitors work. A monitor runs on every message but an inhibitor runs on every command. Remember all those command options like cooldown, permissions, permissionLevel, nsfw, etc... Each and every one of these options has an inhibitor in that checks commands for these settings.\"), mdx(\"p\", null, \"Let's create our own inhibitor that would prevent commands from being used if the user is not a VIP user.\"), mdx(\"blockquote\", null, mdx(\"p\", {\n parentName: \"blockquote\"\n }, mdx(\"strong\", {\n parentName: \"p\"\n }, \"Note:\"), \" It is important to remember that everything below can be done with a simple permission level as well. We will create our own custom permission levels but for the purposes of this guide and to be able to learn about Inhibitors, we will be using an inhibitor.\")), mdx(\"h2\", null, \"Creating the File\"), mdx(\"p\", null, \"Let's start by creating a file inside the inhibitors folder called \", mdx(\"inlineCode\", {\n parentName: \"p\"\n }, \"boosted.ts\"), \" and paste the following snippet of code:\"), mdx(\"pre\", null, mdx(\"code\", _extends({\n parentName: \"pre\"\n }, {\n \"className\": \"language-ts\"\n }), \"import { botCache } from \\\"../../mod.ts\\\";\\n\\nbotCache.inhibitors.set(\\\"inhibitorname\\\", async function (message, command, guild) {\\n // Your code goes here\\n});\\n\")), mdx(\"p\", null, \"Inhibitors can take up to 3 arguments.\"), mdx(\"ul\", null, mdx(\"li\", {\n parentName: \"ul\"\n }, mdx(\"inlineCode\", {\n parentName: \"li\"\n }, \"message\"), \": The message object that triggered the command.\"), mdx(\"li\", {\n parentName: \"ul\"\n }, mdx(\"inlineCode\", {\n parentName: \"li\"\n }, \"command\"), \": The command object itself that was triggered.\"), mdx(\"li\", {\n parentName: \"ul\"\n }, mdx(\"inlineCode\", {\n parentName: \"li\"\n }, \"guild\"), \": The server guild object where this command was ran.\")), mdx(\"h2\", null, \"Understanding How Inhibitors Function\"), mdx(\"p\", null, \"To block a command you have to return a truthy value.\"), mdx(\"ul\", null, mdx(\"li\", {\n parentName: \"ul\"\n }, mdx(\"strong\", {\n parentName: \"li\"\n }, \"return true;\"), \" If you return true the inhibitor will block the execution of the command.\\nTo allow a command return a falsey value.\"), mdx(\"li\", {\n parentName: \"ul\"\n }, mdx(\"strong\", {\n parentName: \"li\"\n }, \"return false;\"), \" If you return false the inhibitor will not block the error.\")), mdx(\"pre\", null, mdx(\"code\", _extends({\n parentName: \"pre\"\n }, {\n \"className\": \"language-ts\"\n }), \"// If the command is not VIP only we can allow this command to execute\\nif (!command.vipOnly) return false;\\n\\nconst guild =\\n// Check if the user has the vip role on the support server given by patreon\\nconst userIsVIP = await isUserVIP(message.author.id)\\n// The user is VIP so we can allow this command to be used\\nif (userIsVIP) return false;\\n\\n// The user is NOT VIP so we throw an error\\nthrow `The ${command.name} is only allowed for VIP users.`\\n\")));\n}\n;\nMDXContent.isMDXComponent = true;","rawMDXOutput":"/* @jsx mdx */\nimport { mdx } from '@mdx-js/react';\n/* @jsx mdx */\n\nexport const _frontmatter = {\n \"title\": \"Creating Inhibitors!\",\n \"metaTitle\": \"Creating An Inhibitor | Discordeno\",\n \"metaDescription\": \"Let's create our very own bot with Discordeno!\"\n};\n\nconst layoutProps = {\n _frontmatter\n};\nconst MDXLayout = \"wrapper\"\nexport default function MDXContent({\n components,\n ...props\n}) {\n return \n

{`Woah! You are almost half way done with understanding all of Discordeno. Amazing isn't it? Something you may have noticed in the last section was there were some options that prevented some commands from running like `}{`dmOnly`}{` or the permission options. we created a setting to prevent the monitor from running in certain channels. What if we wanted to do prevent commands from happening? How would we prevent commands from running?`}

\n

{`What is an Inhibitor?`}

\n

{`An Inhibitor is very similar to how monitors work. A monitor runs on every message but an inhibitor runs on every command. Remember all those command options like cooldown, permissions, permissionLevel, nsfw, etc... Each and every one of these options has an inhibitor in that checks commands for these settings.`}

\n

{`Let's create our own inhibitor that would prevent commands from being used if the user is not a VIP user.`}

\n
\n

{`Note:`}{` It is important to remember that everything below can be done with a simple permission level as well. We will create our own custom permission levels but for the purposes of this guide and to be able to learn about Inhibitors, we will be using an inhibitor.`}

\n
\n

{`Creating the File`}

\n

{`Let's start by creating a file inside the inhibitors folder called `}{`boosted.ts`}{` and paste the following snippet of code:`}

\n
{`import { botCache } from \"../../mod.ts\";\n\nbotCache.inhibitors.set(\"inhibitorname\", async function (message, command, guild) {\n    // Your code goes here\n});\n`}
\n

{`Inhibitors can take up to 3 arguments.`}

\n
    \n
  • {`message`}{`: The message object that triggered the command.`}
  • \n
  • {`command`}{`: The command object itself that was triggered.`}
  • \n
  • {`guild`}{`: The server guild object where this command was ran.`}
  • \n
\n

{`Understanding How Inhibitors Function`}

\n

{`To block a command you have to return a truthy value.`}

\n
    \n
  • {`return true;`}{` If you return true the inhibitor will block the execution of the command.\nTo allow a command return a falsey value.`}
  • \n
  • {`return false;`}{` If you return false the inhibitor will not block the error.`}
  • \n
\n
{`// If the command is not VIP only we can allow this command to execute\nif (!command.vipOnly) return false;\n\nconst guild =\n// Check if the user has the vip role on the support server given by patreon\nconst userIsVIP = await isUserVIP(message.author.id)\n// The user is VIP so we can allow this command to be used\nif (userIsVIP) return false;\n\n// The user is NOT VIP so we throw an error\nthrow \\`The \\${command.name} is only allowed for VIP users.\\`\n`}
\n\n
;\n}\n\n;\nMDXContent.isMDXComponent = true;"}} \ No newline at end of file diff --git a/docs/.cache/caches/gatsby-plugin-mdx/diskstore-f2d24116339a81f3f59eba9270293ca5.json b/docs/.cache/caches/gatsby-plugin-mdx/diskstore-f2d24116339a81f3f59eba9270293ca5.json new file mode 100644 index 000000000..46731519e --- /dev/null +++ b/docs/.cache/caches/gatsby-plugin-mdx/diskstore-f2d24116339a81f3f59eba9270293ca5.json @@ -0,0 +1 @@ +{"expireTime":9007200851634243000,"key":"gatsby-plugin-mdx-entire-payload-ef63dc86087b843be5efce6a7331b920-","val":{"mdast":{"type":"root","children":[{"type":"paragraph","children":[{"type":"text","value":"Woah! You are almost half way done with understanding all of Discordeno. Amazing isn't it? Something you may have noticed in the last section was there were some options that prevented some commands from running like ","position":{"start":{"line":2,"column":1,"offset":1},"end":{"line":2,"column":218,"offset":218},"indent":[]}},{"type":"inlineCode","value":"dmOnly","position":{"start":{"line":2,"column":218,"offset":218},"end":{"line":2,"column":226,"offset":226},"indent":[]}},{"type":"text","value":" or the permission options. we created a setting to prevent the monitor from running in certain channels. What if we wanted to do prevent commands from happening? How would we prevent commands from running?","position":{"start":{"line":2,"column":226,"offset":226},"end":{"line":2,"column":432,"offset":432},"indent":[]}}],"position":{"start":{"line":2,"column":1,"offset":1},"end":{"line":2,"column":432,"offset":432},"indent":[]}},{"type":"heading","depth":2,"children":[{"type":"text","value":"What is an Inhibitor?","position":{"start":{"line":4,"column":4,"offset":437},"end":{"line":4,"column":25,"offset":458},"indent":[]}}],"position":{"start":{"line":4,"column":1,"offset":434},"end":{"line":4,"column":25,"offset":458},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"An Inhibitor is very similar to how monitors work. A monitor runs on every message but an inhibitor runs on every command. Remember all those command options like cooldown, permissions, permissionLevel, nsfw, etc... Each and every one of these options has an inhibitor in that checks commands for these settings.","position":{"start":{"line":6,"column":1,"offset":460},"end":{"line":6,"column":313,"offset":772},"indent":[]}}],"position":{"start":{"line":6,"column":1,"offset":460},"end":{"line":6,"column":313,"offset":772},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"Let's create our own inhibitor that would prevent commands from being used if the user is not a VIP user.","position":{"start":{"line":8,"column":1,"offset":774},"end":{"line":8,"column":106,"offset":879},"indent":[]}}],"position":{"start":{"line":8,"column":1,"offset":774},"end":{"line":8,"column":106,"offset":879},"indent":[]}},{"type":"blockquote","children":[{"type":"paragraph","children":[{"type":"strong","children":[{"type":"text","value":"Note:","position":{"start":{"line":10,"column":5,"offset":885},"end":{"line":10,"column":10,"offset":890},"indent":[]}}],"position":{"start":{"line":10,"column":3,"offset":883},"end":{"line":10,"column":12,"offset":892},"indent":[]}},{"type":"text","value":" It is important to remember that everything below can be done with a simple permission level as well. We will create our own custom permission levels but for the purposes of this guide and to be able to learn about Inhibitors, we will be using an inhibitor.","position":{"start":{"line":10,"column":12,"offset":892},"end":{"line":10,"column":270,"offset":1150},"indent":[]}}],"position":{"start":{"line":10,"column":3,"offset":883},"end":{"line":10,"column":270,"offset":1150},"indent":[]}}],"position":{"start":{"line":10,"column":1,"offset":881},"end":{"line":10,"column":270,"offset":1150},"indent":[]}},{"type":"heading","depth":2,"children":[{"type":"text","value":"Creating the File","position":{"start":{"line":12,"column":4,"offset":1155},"end":{"line":12,"column":21,"offset":1172},"indent":[]}}],"position":{"start":{"line":12,"column":1,"offset":1152},"end":{"line":12,"column":21,"offset":1172},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"Let's start by creating a file inside the inhibitors folder called ","position":{"start":{"line":14,"column":1,"offset":1174},"end":{"line":14,"column":68,"offset":1241},"indent":[]}},{"type":"inlineCode","value":"boosted.ts","position":{"start":{"line":14,"column":68,"offset":1241},"end":{"line":14,"column":80,"offset":1253},"indent":[]}},{"type":"text","value":" and paste the following snippet of code:","position":{"start":{"line":14,"column":80,"offset":1253},"end":{"line":14,"column":121,"offset":1294},"indent":[]}}],"position":{"start":{"line":14,"column":1,"offset":1174},"end":{"line":14,"column":121,"offset":1294},"indent":[]}},{"type":"code","lang":"ts","meta":null,"value":"import { botCache } from \"../../mod.ts\";\n\nbotCache.inhibitors.set(\"inhibitorname\", async function (message, command, guild) {\n\t// Your code goes here\n});","position":{"start":{"line":16,"column":1,"offset":1296},"end":{"line":22,"column":4,"offset":1459},"indent":[1,1,1,1,1,1]}},{"type":"paragraph","children":[{"type":"text","value":"Inhibitors can take up to 3 arguments.","position":{"start":{"line":24,"column":1,"offset":1461},"end":{"line":24,"column":39,"offset":1499},"indent":[]}}],"position":{"start":{"line":24,"column":1,"offset":1461},"end":{"line":24,"column":39,"offset":1499},"indent":[]}},{"type":"list","ordered":false,"start":null,"spread":false,"children":[{"type":"listItem","spread":false,"checked":null,"children":[{"type":"paragraph","children":[{"type":"inlineCode","value":"message","position":{"start":{"line":26,"column":3,"offset":1503},"end":{"line":26,"column":12,"offset":1512},"indent":[]}},{"type":"text","value":": The message object that triggered the command.","position":{"start":{"line":26,"column":12,"offset":1512},"end":{"line":26,"column":60,"offset":1560},"indent":[]}}],"position":{"start":{"line":26,"column":3,"offset":1503},"end":{"line":26,"column":60,"offset":1560},"indent":[]}}],"position":{"start":{"line":26,"column":1,"offset":1501},"end":{"line":26,"column":60,"offset":1560},"indent":[]}},{"type":"listItem","spread":false,"checked":null,"children":[{"type":"paragraph","children":[{"type":"inlineCode","value":"command","position":{"start":{"line":27,"column":3,"offset":1563},"end":{"line":27,"column":12,"offset":1572},"indent":[]}},{"type":"text","value":": The command object itself that was triggered.","position":{"start":{"line":27,"column":12,"offset":1572},"end":{"line":27,"column":59,"offset":1619},"indent":[]}}],"position":{"start":{"line":27,"column":3,"offset":1563},"end":{"line":27,"column":59,"offset":1619},"indent":[]}}],"position":{"start":{"line":27,"column":1,"offset":1561},"end":{"line":27,"column":59,"offset":1619},"indent":[]}},{"type":"listItem","spread":false,"checked":null,"children":[{"type":"paragraph","children":[{"type":"inlineCode","value":"guild","position":{"start":{"line":28,"column":3,"offset":1622},"end":{"line":28,"column":10,"offset":1629},"indent":[]}},{"type":"text","value":": The server guild object where this command was ran.","position":{"start":{"line":28,"column":10,"offset":1629},"end":{"line":28,"column":63,"offset":1682},"indent":[]}}],"position":{"start":{"line":28,"column":3,"offset":1622},"end":{"line":28,"column":63,"offset":1682},"indent":[]}}],"position":{"start":{"line":28,"column":1,"offset":1620},"end":{"line":28,"column":63,"offset":1682},"indent":[]}}],"position":{"start":{"line":26,"column":1,"offset":1501},"end":{"line":28,"column":63,"offset":1682},"indent":[1,1]}},{"type":"heading","depth":2,"children":[{"type":"text","value":"Understanding How Inhibitors Function","position":{"start":{"line":30,"column":4,"offset":1687},"end":{"line":30,"column":41,"offset":1724},"indent":[]}}],"position":{"start":{"line":30,"column":1,"offset":1684},"end":{"line":30,"column":41,"offset":1724},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"To block a command you have to return a truthy value.","position":{"start":{"line":32,"column":1,"offset":1726},"end":{"line":32,"column":54,"offset":1779},"indent":[]}}],"position":{"start":{"line":32,"column":1,"offset":1726},"end":{"line":32,"column":54,"offset":1779},"indent":[]}},{"type":"list","ordered":false,"start":null,"spread":false,"children":[{"type":"listItem","spread":false,"checked":null,"children":[{"type":"paragraph","children":[{"type":"strong","children":[{"type":"text","value":"return true;","position":{"start":{"line":33,"column":5,"offset":1784},"end":{"line":33,"column":17,"offset":1796},"indent":[]}}],"position":{"start":{"line":33,"column":3,"offset":1782},"end":{"line":33,"column":19,"offset":1798},"indent":[]}},{"type":"text","value":" If you return true the inhibitor will block the execution of the command.\nTo allow a command return a falsey value.","position":{"start":{"line":33,"column":19,"offset":1798},"end":{"line":34,"column":42,"offset":1914},"indent":[1]}}],"position":{"start":{"line":33,"column":3,"offset":1782},"end":{"line":34,"column":42,"offset":1914},"indent":[1]}}],"position":{"start":{"line":33,"column":1,"offset":1780},"end":{"line":34,"column":42,"offset":1914},"indent":[1]}},{"type":"listItem","spread":false,"checked":null,"children":[{"type":"paragraph","children":[{"type":"strong","children":[{"type":"text","value":"return false;","position":{"start":{"line":35,"column":5,"offset":1919},"end":{"line":35,"column":18,"offset":1932},"indent":[]}}],"position":{"start":{"line":35,"column":3,"offset":1917},"end":{"line":35,"column":20,"offset":1934},"indent":[]}},{"type":"text","value":" If you return false the inhibitor will not block the error.","position":{"start":{"line":35,"column":20,"offset":1934},"end":{"line":35,"column":80,"offset":1994},"indent":[]}}],"position":{"start":{"line":35,"column":3,"offset":1917},"end":{"line":35,"column":80,"offset":1994},"indent":[]}}],"position":{"start":{"line":35,"column":1,"offset":1915},"end":{"line":35,"column":80,"offset":1994},"indent":[]}}],"position":{"start":{"line":33,"column":1,"offset":1780},"end":{"line":35,"column":80,"offset":1994},"indent":[1,1]}},{"type":"code","lang":"ts","meta":null,"value":"// If the command is not VIP only we can allow this command to execute\nif (!command.vipOnly) return false;\n\n// The bot's support server\nconst guild = cache.guilds.get(configs.supportServerID);\n// If the command author is not in the server they won't have the vip role\nconst member = guild.members.get(message.author.id) || await getMember(guild.id, message.author.id);\n// Member doesn't exist so cancel the command\nif (!member) return true;\n\n// The user is VIP so we can allow this command to be used\nif (userIsVIP) return false;\n\n// The user is NOT VIP so we throw an error\nthrow `The ${command.name} is only allowed for VIP users.`","position":{"start":{"line":38,"column":1,"offset":1997},"end":{"line":54,"column":4,"offset":2640},"indent":[1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1]}},{"type":"export","value":"export const _frontmatter = {\"title\":\"Creating Inhibitors!\",\"metaTitle\":\"Creating An Inhibitor | Discordeno\",\"metaDescription\":\"Let's create our very own bot with Discordeno!\"}","position":{"start":{"line":57,"column":1,"offset":2643},"end":{"line":57,"column":177,"offset":2819},"indent":[]}}],"position":{"start":{"line":1,"column":1,"offset":0},"end":{"line":57,"column":177,"offset":2819}}},"scopeImports":["import * as React from 'react'"],"scopeIdentifiers":["React"],"body":"function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }\n\nfunction _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }\n\nfunction _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }\n\n/* @jsx mdx */\nvar _frontmatter = {\n \"title\": \"Creating Inhibitors!\",\n \"metaTitle\": \"Creating An Inhibitor | Discordeno\",\n \"metaDescription\": \"Let's create our very own bot with Discordeno!\"\n};\nvar layoutProps = {\n _frontmatter: _frontmatter\n};\nvar MDXLayout = \"wrapper\";\nreturn function MDXContent(_ref) {\n var components = _ref.components,\n props = _objectWithoutProperties(_ref, [\"components\"]);\n\n return mdx(MDXLayout, _extends({}, layoutProps, props, {\n components: components,\n mdxType: \"MDXLayout\"\n }), mdx(\"p\", null, \"Woah! You are almost half way done with understanding all of Discordeno. Amazing isn't it? Something you may have noticed in the last section was there were some options that prevented some commands from running like \", mdx(\"inlineCode\", {\n parentName: \"p\"\n }, \"dmOnly\"), \" or the permission options. we created a setting to prevent the monitor from running in certain channels. What if we wanted to do prevent commands from happening? How would we prevent commands from running?\"), mdx(\"h2\", null, \"What is an Inhibitor?\"), mdx(\"p\", null, \"An Inhibitor is very similar to how monitors work. A monitor runs on every message but an inhibitor runs on every command. Remember all those command options like cooldown, permissions, permissionLevel, nsfw, etc... Each and every one of these options has an inhibitor in that checks commands for these settings.\"), mdx(\"p\", null, \"Let's create our own inhibitor that would prevent commands from being used if the user is not a VIP user.\"), mdx(\"blockquote\", null, mdx(\"p\", {\n parentName: \"blockquote\"\n }, mdx(\"strong\", {\n parentName: \"p\"\n }, \"Note:\"), \" It is important to remember that everything below can be done with a simple permission level as well. We will create our own custom permission levels but for the purposes of this guide and to be able to learn about Inhibitors, we will be using an inhibitor.\")), mdx(\"h2\", null, \"Creating the File\"), mdx(\"p\", null, \"Let's start by creating a file inside the inhibitors folder called \", mdx(\"inlineCode\", {\n parentName: \"p\"\n }, \"boosted.ts\"), \" and paste the following snippet of code:\"), mdx(\"pre\", null, mdx(\"code\", _extends({\n parentName: \"pre\"\n }, {\n \"className\": \"language-ts\"\n }), \"import { botCache } from \\\"../../mod.ts\\\";\\n\\nbotCache.inhibitors.set(\\\"inhibitorname\\\", async function (message, command, guild) {\\n // Your code goes here\\n});\\n\")), mdx(\"p\", null, \"Inhibitors can take up to 3 arguments.\"), mdx(\"ul\", null, mdx(\"li\", {\n parentName: \"ul\"\n }, mdx(\"inlineCode\", {\n parentName: \"li\"\n }, \"message\"), \": The message object that triggered the command.\"), mdx(\"li\", {\n parentName: \"ul\"\n }, mdx(\"inlineCode\", {\n parentName: \"li\"\n }, \"command\"), \": The command object itself that was triggered.\"), mdx(\"li\", {\n parentName: \"ul\"\n }, mdx(\"inlineCode\", {\n parentName: \"li\"\n }, \"guild\"), \": The server guild object where this command was ran.\")), mdx(\"h2\", null, \"Understanding How Inhibitors Function\"), mdx(\"p\", null, \"To block a command you have to return a truthy value.\"), mdx(\"ul\", null, mdx(\"li\", {\n parentName: \"ul\"\n }, mdx(\"strong\", {\n parentName: \"li\"\n }, \"return true;\"), \" If you return true the inhibitor will block the execution of the command.\\nTo allow a command return a falsey value.\"), mdx(\"li\", {\n parentName: \"ul\"\n }, mdx(\"strong\", {\n parentName: \"li\"\n }, \"return false;\"), \" If you return false the inhibitor will not block the error.\")), mdx(\"pre\", null, mdx(\"code\", _extends({\n parentName: \"pre\"\n }, {\n \"className\": \"language-ts\"\n }), \"// If the command is not VIP only we can allow this command to execute\\nif (!command.vipOnly) return false;\\n\\n// The bot's support server\\nconst guild = cache.guilds.get(configs.supportServerID);\\n// If the command author is not in the server they won't have the vip role\\nconst member = guild.members.get(message.author.id) || await getMember(guild.id, message.author.id);\\n// Member doesn't exist so cancel the command\\nif (!member) return true;\\n\\n// The user is VIP so we can allow this command to be used\\nif (userIsVIP) return false;\\n\\n// The user is NOT VIP so we throw an error\\nthrow `The ${command.name} is only allowed for VIP users.`\\n\")));\n}\n;\nMDXContent.isMDXComponent = true;","rawMDXOutput":"/* @jsx mdx */\nimport { mdx } from '@mdx-js/react';\n/* @jsx mdx */\n\nexport const _frontmatter = {\n \"title\": \"Creating Inhibitors!\",\n \"metaTitle\": \"Creating An Inhibitor | Discordeno\",\n \"metaDescription\": \"Let's create our very own bot with Discordeno!\"\n};\n\nconst layoutProps = {\n _frontmatter\n};\nconst MDXLayout = \"wrapper\"\nexport default function MDXContent({\n components,\n ...props\n}) {\n return \n

{`Woah! You are almost half way done with understanding all of Discordeno. Amazing isn't it? Something you may have noticed in the last section was there were some options that prevented some commands from running like `}{`dmOnly`}{` or the permission options. we created a setting to prevent the monitor from running in certain channels. What if we wanted to do prevent commands from happening? How would we prevent commands from running?`}

\n

{`What is an Inhibitor?`}

\n

{`An Inhibitor is very similar to how monitors work. A monitor runs on every message but an inhibitor runs on every command. Remember all those command options like cooldown, permissions, permissionLevel, nsfw, etc... Each and every one of these options has an inhibitor in that checks commands for these settings.`}

\n

{`Let's create our own inhibitor that would prevent commands from being used if the user is not a VIP user.`}

\n
\n

{`Note:`}{` It is important to remember that everything below can be done with a simple permission level as well. We will create our own custom permission levels but for the purposes of this guide and to be able to learn about Inhibitors, we will be using an inhibitor.`}

\n
\n

{`Creating the File`}

\n

{`Let's start by creating a file inside the inhibitors folder called `}{`boosted.ts`}{` and paste the following snippet of code:`}

\n
{`import { botCache } from \"../../mod.ts\";\n\nbotCache.inhibitors.set(\"inhibitorname\", async function (message, command, guild) {\n    // Your code goes here\n});\n`}
\n

{`Inhibitors can take up to 3 arguments.`}

\n
    \n
  • {`message`}{`: The message object that triggered the command.`}
  • \n
  • {`command`}{`: The command object itself that was triggered.`}
  • \n
  • {`guild`}{`: The server guild object where this command was ran.`}
  • \n
\n

{`Understanding How Inhibitors Function`}

\n

{`To block a command you have to return a truthy value.`}

\n
    \n
  • {`return true;`}{` If you return true the inhibitor will block the execution of the command.\nTo allow a command return a falsey value.`}
  • \n
  • {`return false;`}{` If you return false the inhibitor will not block the error.`}
  • \n
\n
{`// If the command is not VIP only we can allow this command to execute\nif (!command.vipOnly) return false;\n\n// The bot's support server\nconst guild = cache.guilds.get(configs.supportServerID);\n// If the command author is not in the server they won't have the vip role\nconst member = guild.members.get(message.author.id) || await getMember(guild.id, message.author.id);\n// Member doesn't exist so cancel the command\nif (!member) return true;\n\n// The user is VIP so we can allow this command to be used\nif (userIsVIP) return false;\n\n// The user is NOT VIP so we throw an error\nthrow \\`The \\${command.name} is only allowed for VIP users.\\`\n`}
\n\n
;\n}\n\n;\nMDXContent.isMDXComponent = true;"}} \ No newline at end of file diff --git a/docs/.cache/caches/gatsby-plugin-mdx/diskstore-f2f2a41a6fd95fe72661e97b4dc2d38b.json b/docs/.cache/caches/gatsby-plugin-mdx/diskstore-f2f2a41a6fd95fe72661e97b4dc2d38b.json new file mode 100644 index 000000000..f1ba14bfe --- /dev/null +++ b/docs/.cache/caches/gatsby-plugin-mdx/diskstore-f2f2a41a6fd95fe72661e97b4dc2d38b.json @@ -0,0 +1 @@ +{"expireTime":9007200851634132000,"key":"gatsby-plugin-mdx-entire-payload-593ddc1cbaf45a87d71969b771637b0d-","val":{"mdast":{"type":"root","children":[{"type":"paragraph","children":[{"type":"text","value":"Woah! You are almost half way done with understanding all of Discordeno. Amazing isn't it? Something you may have noticed in the last section was there were some options that prevented some commands from running like ","position":{"start":{"line":2,"column":1,"offset":1},"end":{"line":2,"column":218,"offset":218},"indent":[]}},{"type":"inlineCode","value":"dmOnly","position":{"start":{"line":2,"column":218,"offset":218},"end":{"line":2,"column":226,"offset":226},"indent":[]}},{"type":"text","value":" or the permission options. we created a setting to prevent the monitor from running in certain channels. What if we wanted to do prevent commands from happening? How would we prevent commands from running?","position":{"start":{"line":2,"column":226,"offset":226},"end":{"line":2,"column":432,"offset":432},"indent":[]}}],"position":{"start":{"line":2,"column":1,"offset":1},"end":{"line":2,"column":432,"offset":432},"indent":[]}},{"type":"heading","depth":2,"children":[{"type":"text","value":"What is an Inhibitor?","position":{"start":{"line":4,"column":4,"offset":437},"end":{"line":4,"column":25,"offset":458},"indent":[]}}],"position":{"start":{"line":4,"column":1,"offset":434},"end":{"line":4,"column":25,"offset":458},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"An Inhibitor is very similar to how monitors work. A monitor runs on every message but an inhibitor runs on every command. Remember all those command options like cooldown, permissions, permissionLevel, nsfw, etc... Each and every one of these options has an inhibitor in that checks commands for these settings.","position":{"start":{"line":6,"column":1,"offset":460},"end":{"line":6,"column":313,"offset":772},"indent":[]}}],"position":{"start":{"line":6,"column":1,"offset":460},"end":{"line":6,"column":313,"offset":772},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"Let's create our own inhibitor that would prevent commands from being used if the user is not a VIP user.","position":{"start":{"line":8,"column":1,"offset":774},"end":{"line":8,"column":106,"offset":879},"indent":[]}}],"position":{"start":{"line":8,"column":1,"offset":774},"end":{"line":8,"column":106,"offset":879},"indent":[]}},{"type":"blockquote","children":[{"type":"paragraph","children":[{"type":"strong","children":[{"type":"text","value":"Note:","position":{"start":{"line":10,"column":5,"offset":885},"end":{"line":10,"column":10,"offset":890},"indent":[]}}],"position":{"start":{"line":10,"column":3,"offset":883},"end":{"line":10,"column":12,"offset":892},"indent":[]}},{"type":"text","value":" It is important to remember that everything below can be done with a simple permission level as well. We will create our own custom permission levels but for the purposes of this guide and to be able to learn about Inhibitors, we will be using an inhibitor.","position":{"start":{"line":10,"column":12,"offset":892},"end":{"line":10,"column":270,"offset":1150},"indent":[]}}],"position":{"start":{"line":10,"column":3,"offset":883},"end":{"line":10,"column":270,"offset":1150},"indent":[]}}],"position":{"start":{"line":10,"column":1,"offset":881},"end":{"line":10,"column":270,"offset":1150},"indent":[]}},{"type":"heading","depth":2,"children":[{"type":"text","value":"Creating the File","position":{"start":{"line":12,"column":4,"offset":1155},"end":{"line":12,"column":21,"offset":1172},"indent":[]}}],"position":{"start":{"line":12,"column":1,"offset":1152},"end":{"line":12,"column":21,"offset":1172},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"Let's start by creating a file inside the inhibitors folder called ","position":{"start":{"line":14,"column":1,"offset":1174},"end":{"line":14,"column":68,"offset":1241},"indent":[]}},{"type":"inlineCode","value":"boosted.ts","position":{"start":{"line":14,"column":68,"offset":1241},"end":{"line":14,"column":80,"offset":1253},"indent":[]}},{"type":"text","value":" and paste the following snippet of code:","position":{"start":{"line":14,"column":80,"offset":1253},"end":{"line":14,"column":121,"offset":1294},"indent":[]}}],"position":{"start":{"line":14,"column":1,"offset":1174},"end":{"line":14,"column":121,"offset":1294},"indent":[]}},{"type":"code","lang":"ts","meta":null,"value":"import { botCache } from \"../../mod.ts\";\n\nbotCache.inhibitors.set(\"inhibitorname\", async function (message, command, guild) {\n\t// Your code goes here\n});","position":{"start":{"line":16,"column":1,"offset":1296},"end":{"line":22,"column":4,"offset":1459},"indent":[1,1,1,1,1,1]}},{"type":"paragraph","children":[{"type":"text","value":"Inhibitors can take up to 3 arguments.","position":{"start":{"line":24,"column":1,"offset":1461},"end":{"line":24,"column":39,"offset":1499},"indent":[]}}],"position":{"start":{"line":24,"column":1,"offset":1461},"end":{"line":24,"column":39,"offset":1499},"indent":[]}},{"type":"list","ordered":false,"start":null,"spread":false,"children":[{"type":"listItem","spread":false,"checked":null,"children":[{"type":"paragraph","children":[{"type":"inlineCode","value":"message","position":{"start":{"line":26,"column":3,"offset":1503},"end":{"line":26,"column":12,"offset":1512},"indent":[]}},{"type":"text","value":": The message object that triggered the command.","position":{"start":{"line":26,"column":12,"offset":1512},"end":{"line":26,"column":60,"offset":1560},"indent":[]}}],"position":{"start":{"line":26,"column":3,"offset":1503},"end":{"line":26,"column":60,"offset":1560},"indent":[]}}],"position":{"start":{"line":26,"column":1,"offset":1501},"end":{"line":26,"column":60,"offset":1560},"indent":[]}},{"type":"listItem","spread":false,"checked":null,"children":[{"type":"paragraph","children":[{"type":"inlineCode","value":"command","position":{"start":{"line":27,"column":3,"offset":1563},"end":{"line":27,"column":12,"offset":1572},"indent":[]}},{"type":"text","value":": The command object itself that was triggered.","position":{"start":{"line":27,"column":12,"offset":1572},"end":{"line":27,"column":59,"offset":1619},"indent":[]}}],"position":{"start":{"line":27,"column":3,"offset":1563},"end":{"line":27,"column":59,"offset":1619},"indent":[]}}],"position":{"start":{"line":27,"column":1,"offset":1561},"end":{"line":27,"column":59,"offset":1619},"indent":[]}},{"type":"listItem","spread":false,"checked":null,"children":[{"type":"paragraph","children":[{"type":"inlineCode","value":"guild","position":{"start":{"line":28,"column":3,"offset":1622},"end":{"line":28,"column":10,"offset":1629},"indent":[]}},{"type":"text","value":": The server guild object where this command was ran.","position":{"start":{"line":28,"column":10,"offset":1629},"end":{"line":28,"column":63,"offset":1682},"indent":[]}}],"position":{"start":{"line":28,"column":3,"offset":1622},"end":{"line":28,"column":63,"offset":1682},"indent":[]}}],"position":{"start":{"line":28,"column":1,"offset":1620},"end":{"line":28,"column":63,"offset":1682},"indent":[]}}],"position":{"start":{"line":26,"column":1,"offset":1501},"end":{"line":28,"column":63,"offset":1682},"indent":[1,1]}},{"type":"heading","depth":2,"children":[{"type":"text","value":"Understanding How Inhibitors Function","position":{"start":{"line":30,"column":4,"offset":1687},"end":{"line":30,"column":41,"offset":1724},"indent":[]}}],"position":{"start":{"line":30,"column":1,"offset":1684},"end":{"line":30,"column":41,"offset":1724},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"To block a command you have to return a truthy value.","position":{"start":{"line":32,"column":1,"offset":1726},"end":{"line":32,"column":54,"offset":1779},"indent":[]}}],"position":{"start":{"line":32,"column":1,"offset":1726},"end":{"line":32,"column":54,"offset":1779},"indent":[]}},{"type":"list","ordered":false,"start":null,"spread":false,"children":[{"type":"listItem","spread":false,"checked":null,"children":[{"type":"paragraph","children":[{"type":"strong","children":[{"type":"text","value":"return true;","position":{"start":{"line":33,"column":5,"offset":1784},"end":{"line":33,"column":17,"offset":1796},"indent":[]}}],"position":{"start":{"line":33,"column":3,"offset":1782},"end":{"line":33,"column":19,"offset":1798},"indent":[]}},{"type":"text","value":" If you return true the inhibitor will block the execution of the command.\nTo allow a command return a falsey value.","position":{"start":{"line":33,"column":19,"offset":1798},"end":{"line":34,"column":42,"offset":1914},"indent":[1]}}],"position":{"start":{"line":33,"column":3,"offset":1782},"end":{"line":34,"column":42,"offset":1914},"indent":[1]}}],"position":{"start":{"line":33,"column":1,"offset":1780},"end":{"line":34,"column":42,"offset":1914},"indent":[1]}},{"type":"listItem","spread":false,"checked":null,"children":[{"type":"paragraph","children":[{"type":"strong","children":[{"type":"text","value":"return false;","position":{"start":{"line":35,"column":5,"offset":1919},"end":{"line":35,"column":18,"offset":1932},"indent":[]}}],"position":{"start":{"line":35,"column":3,"offset":1917},"end":{"line":35,"column":20,"offset":1934},"indent":[]}},{"type":"text","value":" If you return false the inhibitor will not block the error.","position":{"start":{"line":35,"column":20,"offset":1934},"end":{"line":35,"column":80,"offset":1994},"indent":[]}}],"position":{"start":{"line":35,"column":3,"offset":1917},"end":{"line":35,"column":80,"offset":1994},"indent":[]}}],"position":{"start":{"line":35,"column":1,"offset":1915},"end":{"line":35,"column":80,"offset":1994},"indent":[]}}],"position":{"start":{"line":33,"column":1,"offset":1780},"end":{"line":35,"column":80,"offset":1994},"indent":[1,1]}},{"type":"code","lang":"ts","meta":null,"value":"// If the command is not VIP only we can allow this command to execute\nif (!command.vipOnly) return false;\n\n// The bot's support server\nconst guild = cache.guilds.get(configs.supportServerID);\n\n// Check if the user has the vip role on the support server given by patreon\nconst userIsVIP = await isUserVIP(message.author.id)\n// The user is VIP so we can allow this command to be used\nif (userIsVIP) return false;\n\n// The user is NOT VIP so we throw an error\nthrow `The ${command.name} is only allowed for VIP users.`","position":{"start":{"line":38,"column":1,"offset":1997},"end":{"line":52,"column":4,"offset":2522},"indent":[1,1,1,1,1,1,1,1,1,1,1,1,1,1]}},{"type":"export","value":"export const _frontmatter = {\"title\":\"Creating Inhibitors!\",\"metaTitle\":\"Creating An Inhibitor | Discordeno\",\"metaDescription\":\"Let's create our very own bot with Discordeno!\"}","position":{"start":{"line":55,"column":1,"offset":2525},"end":{"line":55,"column":177,"offset":2701},"indent":[]}}],"position":{"start":{"line":1,"column":1,"offset":0},"end":{"line":55,"column":177,"offset":2701}}},"scopeImports":["import * as React from 'react'"],"scopeIdentifiers":["React"],"body":"function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }\n\nfunction _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }\n\nfunction _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }\n\n/* @jsx mdx */\nvar _frontmatter = {\n \"title\": \"Creating Inhibitors!\",\n \"metaTitle\": \"Creating An Inhibitor | Discordeno\",\n \"metaDescription\": \"Let's create our very own bot with Discordeno!\"\n};\nvar layoutProps = {\n _frontmatter: _frontmatter\n};\nvar MDXLayout = \"wrapper\";\nreturn function MDXContent(_ref) {\n var components = _ref.components,\n props = _objectWithoutProperties(_ref, [\"components\"]);\n\n return mdx(MDXLayout, _extends({}, layoutProps, props, {\n components: components,\n mdxType: \"MDXLayout\"\n }), mdx(\"p\", null, \"Woah! You are almost half way done with understanding all of Discordeno. Amazing isn't it? Something you may have noticed in the last section was there were some options that prevented some commands from running like \", mdx(\"inlineCode\", {\n parentName: \"p\"\n }, \"dmOnly\"), \" or the permission options. we created a setting to prevent the monitor from running in certain channels. What if we wanted to do prevent commands from happening? How would we prevent commands from running?\"), mdx(\"h2\", null, \"What is an Inhibitor?\"), mdx(\"p\", null, \"An Inhibitor is very similar to how monitors work. A monitor runs on every message but an inhibitor runs on every command. Remember all those command options like cooldown, permissions, permissionLevel, nsfw, etc... Each and every one of these options has an inhibitor in that checks commands for these settings.\"), mdx(\"p\", null, \"Let's create our own inhibitor that would prevent commands from being used if the user is not a VIP user.\"), mdx(\"blockquote\", null, mdx(\"p\", {\n parentName: \"blockquote\"\n }, mdx(\"strong\", {\n parentName: \"p\"\n }, \"Note:\"), \" It is important to remember that everything below can be done with a simple permission level as well. We will create our own custom permission levels but for the purposes of this guide and to be able to learn about Inhibitors, we will be using an inhibitor.\")), mdx(\"h2\", null, \"Creating the File\"), mdx(\"p\", null, \"Let's start by creating a file inside the inhibitors folder called \", mdx(\"inlineCode\", {\n parentName: \"p\"\n }, \"boosted.ts\"), \" and paste the following snippet of code:\"), mdx(\"pre\", null, mdx(\"code\", _extends({\n parentName: \"pre\"\n }, {\n \"className\": \"language-ts\"\n }), \"import { botCache } from \\\"../../mod.ts\\\";\\n\\nbotCache.inhibitors.set(\\\"inhibitorname\\\", async function (message, command, guild) {\\n // Your code goes here\\n});\\n\")), mdx(\"p\", null, \"Inhibitors can take up to 3 arguments.\"), mdx(\"ul\", null, mdx(\"li\", {\n parentName: \"ul\"\n }, mdx(\"inlineCode\", {\n parentName: \"li\"\n }, \"message\"), \": The message object that triggered the command.\"), mdx(\"li\", {\n parentName: \"ul\"\n }, mdx(\"inlineCode\", {\n parentName: \"li\"\n }, \"command\"), \": The command object itself that was triggered.\"), mdx(\"li\", {\n parentName: \"ul\"\n }, mdx(\"inlineCode\", {\n parentName: \"li\"\n }, \"guild\"), \": The server guild object where this command was ran.\")), mdx(\"h2\", null, \"Understanding How Inhibitors Function\"), mdx(\"p\", null, \"To block a command you have to return a truthy value.\"), mdx(\"ul\", null, mdx(\"li\", {\n parentName: \"ul\"\n }, mdx(\"strong\", {\n parentName: \"li\"\n }, \"return true;\"), \" If you return true the inhibitor will block the execution of the command.\\nTo allow a command return a falsey value.\"), mdx(\"li\", {\n parentName: \"ul\"\n }, mdx(\"strong\", {\n parentName: \"li\"\n }, \"return false;\"), \" If you return false the inhibitor will not block the error.\")), mdx(\"pre\", null, mdx(\"code\", _extends({\n parentName: \"pre\"\n }, {\n \"className\": \"language-ts\"\n }), \"// If the command is not VIP only we can allow this command to execute\\nif (!command.vipOnly) return false;\\n\\n// The bot's support server\\nconst guild = cache.guilds.get(configs.supportServerID);\\n\\n// Check if the user has the vip role on the support server given by patreon\\nconst userIsVIP = await isUserVIP(message.author.id)\\n// The user is VIP so we can allow this command to be used\\nif (userIsVIP) return false;\\n\\n// The user is NOT VIP so we throw an error\\nthrow `The ${command.name} is only allowed for VIP users.`\\n\")));\n}\n;\nMDXContent.isMDXComponent = true;","rawMDXOutput":"/* @jsx mdx */\nimport { mdx } from '@mdx-js/react';\n/* @jsx mdx */\n\nexport const _frontmatter = {\n \"title\": \"Creating Inhibitors!\",\n \"metaTitle\": \"Creating An Inhibitor | Discordeno\",\n \"metaDescription\": \"Let's create our very own bot with Discordeno!\"\n};\n\nconst layoutProps = {\n _frontmatter\n};\nconst MDXLayout = \"wrapper\"\nexport default function MDXContent({\n components,\n ...props\n}) {\n return \n

{`Woah! You are almost half way done with understanding all of Discordeno. Amazing isn't it? Something you may have noticed in the last section was there were some options that prevented some commands from running like `}{`dmOnly`}{` or the permission options. we created a setting to prevent the monitor from running in certain channels. What if we wanted to do prevent commands from happening? How would we prevent commands from running?`}

\n

{`What is an Inhibitor?`}

\n

{`An Inhibitor is very similar to how monitors work. A monitor runs on every message but an inhibitor runs on every command. Remember all those command options like cooldown, permissions, permissionLevel, nsfw, etc... Each and every one of these options has an inhibitor in that checks commands for these settings.`}

\n

{`Let's create our own inhibitor that would prevent commands from being used if the user is not a VIP user.`}

\n
\n

{`Note:`}{` It is important to remember that everything below can be done with a simple permission level as well. We will create our own custom permission levels but for the purposes of this guide and to be able to learn about Inhibitors, we will be using an inhibitor.`}

\n
\n

{`Creating the File`}

\n

{`Let's start by creating a file inside the inhibitors folder called `}{`boosted.ts`}{` and paste the following snippet of code:`}

\n
{`import { botCache } from \"../../mod.ts\";\n\nbotCache.inhibitors.set(\"inhibitorname\", async function (message, command, guild) {\n    // Your code goes here\n});\n`}
\n

{`Inhibitors can take up to 3 arguments.`}

\n
    \n
  • {`message`}{`: The message object that triggered the command.`}
  • \n
  • {`command`}{`: The command object itself that was triggered.`}
  • \n
  • {`guild`}{`: The server guild object where this command was ran.`}
  • \n
\n

{`Understanding How Inhibitors Function`}

\n

{`To block a command you have to return a truthy value.`}

\n
    \n
  • {`return true;`}{` If you return true the inhibitor will block the execution of the command.\nTo allow a command return a falsey value.`}
  • \n
  • {`return false;`}{` If you return false the inhibitor will not block the error.`}
  • \n
\n
{`// If the command is not VIP only we can allow this command to execute\nif (!command.vipOnly) return false;\n\n// The bot's support server\nconst guild = cache.guilds.get(configs.supportServerID);\n\n// Check if the user has the vip role on the support server given by patreon\nconst userIsVIP = await isUserVIP(message.author.id)\n// The user is VIP so we can allow this command to be used\nif (userIsVIP) return false;\n\n// The user is NOT VIP so we throw an error\nthrow \\`The \\${command.name} is only allowed for VIP users.\\`\n`}
\n\n
;\n}\n\n;\nMDXContent.isMDXComponent = true;"}} \ No newline at end of file diff --git a/docs/.cache/caches/gatsby-plugin-mdx/diskstore-f3276b7a1880bd6c95fbacf8dcddffc4.json b/docs/.cache/caches/gatsby-plugin-mdx/diskstore-f3276b7a1880bd6c95fbacf8dcddffc4.json new file mode 100644 index 000000000..cc7eb8c7c --- /dev/null +++ b/docs/.cache/caches/gatsby-plugin-mdx/diskstore-f3276b7a1880bd6c95fbacf8dcddffc4.json @@ -0,0 +1 @@ +{"expireTime":9007200851634798000,"key":"gatsby-plugin-mdx-entire-payload-24089d8bf8db8701e227ee69464abb8d-","val":{"mdast":{"type":"root","children":[{"type":"paragraph","children":[{"type":"text","value":"Woah! You are almost half way done with understanding all of Discordeno. Amazing isn't it? Something you may have noticed in the last section was there were some options that prevented some commands from running like ","position":{"start":{"line":2,"column":1,"offset":1},"end":{"line":2,"column":218,"offset":218},"indent":[]}},{"type":"inlineCode","value":"dmOnly","position":{"start":{"line":2,"column":218,"offset":218},"end":{"line":2,"column":226,"offset":226},"indent":[]}},{"type":"text","value":" or the permission options. we created a setting to prevent the monitor from running in certain channels. What if we wanted to do prevent commands from happening? How would we prevent commands from running?","position":{"start":{"line":2,"column":226,"offset":226},"end":{"line":2,"column":432,"offset":432},"indent":[]}}],"position":{"start":{"line":2,"column":1,"offset":1},"end":{"line":2,"column":432,"offset":432},"indent":[]}},{"type":"heading","depth":2,"children":[{"type":"text","value":"What is an Inhibitor?","position":{"start":{"line":4,"column":4,"offset":437},"end":{"line":4,"column":25,"offset":458},"indent":[]}}],"position":{"start":{"line":4,"column":1,"offset":434},"end":{"line":4,"column":25,"offset":458},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"An Inhibitor is very similar to how monitors work. A monitor runs on every message but an inhibitor runs on every command. Remember all those command options like cooldown, permissions, permissionLevel, nsfw, etc... Each and every one of these options has an inhibitor in that checks commands for these settings.","position":{"start":{"line":6,"column":1,"offset":460},"end":{"line":6,"column":313,"offset":772},"indent":[]}}],"position":{"start":{"line":6,"column":1,"offset":460},"end":{"line":6,"column":313,"offset":772},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"Let's create our own inhibitor that would prevent commands from being used if the user is not a VIP user.","position":{"start":{"line":8,"column":1,"offset":774},"end":{"line":8,"column":106,"offset":879},"indent":[]}}],"position":{"start":{"line":8,"column":1,"offset":774},"end":{"line":8,"column":106,"offset":879},"indent":[]}},{"type":"blockquote","children":[{"type":"paragraph","children":[{"type":"strong","children":[{"type":"text","value":"Note:","position":{"start":{"line":10,"column":5,"offset":885},"end":{"line":10,"column":10,"offset":890},"indent":[]}}],"position":{"start":{"line":10,"column":3,"offset":883},"end":{"line":10,"column":12,"offset":892},"indent":[]}},{"type":"text","value":" It is important to remember that everything below can be done with a simple permission level as well. We will create our own custom permission levels but for the purposes of this guide and to be able to learn about Inhibitors, we will be using an inhibitor.","position":{"start":{"line":10,"column":12,"offset":892},"end":{"line":10,"column":270,"offset":1150},"indent":[]}}],"position":{"start":{"line":10,"column":3,"offset":883},"end":{"line":10,"column":270,"offset":1150},"indent":[]}}],"position":{"start":{"line":10,"column":1,"offset":881},"end":{"line":10,"column":270,"offset":1150},"indent":[]}},{"type":"heading","depth":2,"children":[{"type":"text","value":"Creating the File","position":{"start":{"line":12,"column":4,"offset":1155},"end":{"line":12,"column":21,"offset":1172},"indent":[]}}],"position":{"start":{"line":12,"column":1,"offset":1152},"end":{"line":12,"column":21,"offset":1172},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"Let's start by creating a file inside the inhibitors folder called ","position":{"start":{"line":14,"column":1,"offset":1174},"end":{"line":14,"column":68,"offset":1241},"indent":[]}},{"type":"inlineCode","value":"boosted.ts","position":{"start":{"line":14,"column":68,"offset":1241},"end":{"line":14,"column":80,"offset":1253},"indent":[]}},{"type":"text","value":" and paste the following snippet of code:","position":{"start":{"line":14,"column":80,"offset":1253},"end":{"line":14,"column":121,"offset":1294},"indent":[]}}],"position":{"start":{"line":14,"column":1,"offset":1174},"end":{"line":14,"column":121,"offset":1294},"indent":[]}},{"type":"code","lang":"ts","meta":null,"value":"import { botCache } from \"../../mod.ts\";\n\nbotCache.inhibitors.set(\"inhibitorname\", async function (message, command, guild) {\n\t// Your code goes here\n});","position":{"start":{"line":16,"column":1,"offset":1296},"end":{"line":22,"column":4,"offset":1459},"indent":[1,1,1,1,1,1]}},{"type":"paragraph","children":[{"type":"text","value":"Inhibitors can take up to 3 arguments.","position":{"start":{"line":24,"column":1,"offset":1461},"end":{"line":24,"column":39,"offset":1499},"indent":[]}}],"position":{"start":{"line":24,"column":1,"offset":1461},"end":{"line":24,"column":39,"offset":1499},"indent":[]}},{"type":"list","ordered":false,"start":null,"spread":false,"children":[{"type":"listItem","spread":false,"checked":null,"children":[{"type":"paragraph","children":[{"type":"inlineCode","value":"message","position":{"start":{"line":26,"column":3,"offset":1503},"end":{"line":26,"column":12,"offset":1512},"indent":[]}},{"type":"text","value":": The message object that triggered the command.","position":{"start":{"line":26,"column":12,"offset":1512},"end":{"line":26,"column":60,"offset":1560},"indent":[]}}],"position":{"start":{"line":26,"column":3,"offset":1503},"end":{"line":26,"column":60,"offset":1560},"indent":[]}}],"position":{"start":{"line":26,"column":1,"offset":1501},"end":{"line":26,"column":60,"offset":1560},"indent":[]}},{"type":"listItem","spread":false,"checked":null,"children":[{"type":"paragraph","children":[{"type":"inlineCode","value":"command","position":{"start":{"line":27,"column":3,"offset":1563},"end":{"line":27,"column":12,"offset":1572},"indent":[]}},{"type":"text","value":": The command object itself that was triggered.","position":{"start":{"line":27,"column":12,"offset":1572},"end":{"line":27,"column":59,"offset":1619},"indent":[]}}],"position":{"start":{"line":27,"column":3,"offset":1563},"end":{"line":27,"column":59,"offset":1619},"indent":[]}}],"position":{"start":{"line":27,"column":1,"offset":1561},"end":{"line":27,"column":59,"offset":1619},"indent":[]}},{"type":"listItem","spread":false,"checked":null,"children":[{"type":"paragraph","children":[{"type":"inlineCode","value":"guild","position":{"start":{"line":28,"column":3,"offset":1622},"end":{"line":28,"column":10,"offset":1629},"indent":[]}},{"type":"text","value":": The server guild object where this command was ran.","position":{"start":{"line":28,"column":10,"offset":1629},"end":{"line":28,"column":63,"offset":1682},"indent":[]}}],"position":{"start":{"line":28,"column":3,"offset":1622},"end":{"line":28,"column":63,"offset":1682},"indent":[]}}],"position":{"start":{"line":28,"column":1,"offset":1620},"end":{"line":28,"column":63,"offset":1682},"indent":[]}}],"position":{"start":{"line":26,"column":1,"offset":1501},"end":{"line":28,"column":63,"offset":1682},"indent":[1,1]}},{"type":"heading","depth":2,"children":[{"type":"text","value":"Understanding How Inhibitors Function","position":{"start":{"line":30,"column":4,"offset":1687},"end":{"line":30,"column":41,"offset":1724},"indent":[]}}],"position":{"start":{"line":30,"column":1,"offset":1684},"end":{"line":30,"column":41,"offset":1724},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"To block a command you have to return a truthy value.","position":{"start":{"line":32,"column":1,"offset":1726},"end":{"line":32,"column":54,"offset":1779},"indent":[]}}],"position":{"start":{"line":32,"column":1,"offset":1726},"end":{"line":32,"column":54,"offset":1779},"indent":[]}},{"type":"list","ordered":false,"start":null,"spread":false,"children":[{"type":"listItem","spread":false,"checked":null,"children":[{"type":"paragraph","children":[{"type":"strong","children":[{"type":"text","value":"return true;","position":{"start":{"line":33,"column":5,"offset":1784},"end":{"line":33,"column":17,"offset":1796},"indent":[]}}],"position":{"start":{"line":33,"column":3,"offset":1782},"end":{"line":33,"column":19,"offset":1798},"indent":[]}},{"type":"text","value":" If you return true the inhibitor will block the execution of the command.\nTo allow a command return a falsey value.","position":{"start":{"line":33,"column":19,"offset":1798},"end":{"line":34,"column":42,"offset":1914},"indent":[1]}}],"position":{"start":{"line":33,"column":3,"offset":1782},"end":{"line":34,"column":42,"offset":1914},"indent":[1]}}],"position":{"start":{"line":33,"column":1,"offset":1780},"end":{"line":34,"column":42,"offset":1914},"indent":[1]}},{"type":"listItem","spread":false,"checked":null,"children":[{"type":"paragraph","children":[{"type":"strong","children":[{"type":"text","value":"return false;","position":{"start":{"line":35,"column":5,"offset":1919},"end":{"line":35,"column":18,"offset":1932},"indent":[]}}],"position":{"start":{"line":35,"column":3,"offset":1917},"end":{"line":35,"column":20,"offset":1934},"indent":[]}},{"type":"text","value":" If you return false the inhibitor will not block the error.","position":{"start":{"line":35,"column":20,"offset":1934},"end":{"line":35,"column":80,"offset":1994},"indent":[]}}],"position":{"start":{"line":35,"column":3,"offset":1917},"end":{"line":35,"column":80,"offset":1994},"indent":[]}}],"position":{"start":{"line":35,"column":1,"offset":1915},"end":{"line":35,"column":80,"offset":1994},"indent":[]}}],"position":{"start":{"line":33,"column":1,"offset":1780},"end":{"line":35,"column":80,"offset":1994},"indent":[1,1]}},{"type":"code","lang":"ts","meta":null,"value":"// If the command is not VIP only we can allow this command to execute\nif (!command.vipOnly) return false;\n\n// The bot's support server\nconst guild = cache.guilds.get(configs.supportServerID);\n// If the command author is not in the server they won't have the vip role\nconst member = guild.members.get(message.author.id) || await getMember(guild.id, message.author.id);\n// Member doesn't exist so cancel the command\nif (!member) {\n\tsendResponse(message, `sorry, but you can not use this command until you become VIP. **Close the IRIS!!!**`)\n\treturn true;\n}\n\n// If the user has the vip role on the support server given by patreon allow the command\nif (member.roles.includes(configs.roleIDs.patreonVIPRoleID)) return false;\n\n// Alert the user they don't have vip and can't use the command\nsendResponse(message, `sorry, but you can not use this command until you become a VIP. I'm sorry, Teal'c. We'll go to Disneyland next year. I promise.`)\n// Cancel the command since the user does not have vip\nreturn true;","position":{"start":{"line":38,"column":1,"offset":1997},"end":{"line":59,"column":4,"offset":3013},"indent":[1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1]}},{"type":"heading","depth":2,"children":[{"type":"text","value":"Challenges","position":{"start":{"line":61,"column":4,"offset":3018},"end":{"line":61,"column":14,"offset":3028},"indent":[]}}],"position":{"start":{"line":61,"column":1,"offset":3015},"end":{"line":61,"column":14,"offset":3028},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"Hell yes! We just got through the entire inhibitor section. You have now mastered everything related to inhibitors.","position":{"start":{"line":63,"column":1,"offset":3030},"end":{"line":63,"column":116,"offset":3145},"indent":[]}}],"position":{"start":{"line":63,"column":1,"offset":3030},"end":{"line":63,"column":116,"offset":3145},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"You can now try and get a little more practice with inhibitors by trying to challenge yourself and make your own inhibitors. Don't worry if you can't think of any good use cases for inhibitors.","position":{"start":{"line":65,"column":1,"offset":3147},"end":{"line":65,"column":194,"offset":3340},"indent":[]}}],"position":{"start":{"line":65,"column":1,"offset":3147},"end":{"line":65,"column":194,"offset":3340},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"Majority of Discordeno bots","position":{"start":{"line":67,"column":1,"offset":3342},"end":{"line":67,"column":28,"offset":3369},"indent":[]}}],"position":{"start":{"line":67,"column":1,"offset":3342},"end":{"line":67,"column":28,"offset":3369},"indent":[]}},{"type":"export","value":"export const _frontmatter = {\"title\":\"Creating Inhibitors!\",\"metaTitle\":\"Creating An Inhibitor | Discordeno\",\"metaDescription\":\"Let's create our very own bot with Discordeno!\"}","position":{"start":{"line":70,"column":1,"offset":3372},"end":{"line":70,"column":177,"offset":3548},"indent":[]}}],"position":{"start":{"line":1,"column":1,"offset":0},"end":{"line":70,"column":177,"offset":3548}}},"scopeImports":["import * as React from 'react'"],"scopeIdentifiers":["React"],"body":"function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }\n\nfunction _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }\n\nfunction _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }\n\n/* @jsx mdx */\nvar _frontmatter = {\n \"title\": \"Creating Inhibitors!\",\n \"metaTitle\": \"Creating An Inhibitor | Discordeno\",\n \"metaDescription\": \"Let's create our very own bot with Discordeno!\"\n};\nvar layoutProps = {\n _frontmatter: _frontmatter\n};\nvar MDXLayout = \"wrapper\";\nreturn function MDXContent(_ref) {\n var components = _ref.components,\n props = _objectWithoutProperties(_ref, [\"components\"]);\n\n return mdx(MDXLayout, _extends({}, layoutProps, props, {\n components: components,\n mdxType: \"MDXLayout\"\n }), mdx(\"p\", null, \"Woah! You are almost half way done with understanding all of Discordeno. Amazing isn't it? Something you may have noticed in the last section was there were some options that prevented some commands from running like \", mdx(\"inlineCode\", {\n parentName: \"p\"\n }, \"dmOnly\"), \" or the permission options. we created a setting to prevent the monitor from running in certain channels. What if we wanted to do prevent commands from happening? How would we prevent commands from running?\"), mdx(\"h2\", null, \"What is an Inhibitor?\"), mdx(\"p\", null, \"An Inhibitor is very similar to how monitors work. A monitor runs on every message but an inhibitor runs on every command. Remember all those command options like cooldown, permissions, permissionLevel, nsfw, etc... Each and every one of these options has an inhibitor in that checks commands for these settings.\"), mdx(\"p\", null, \"Let's create our own inhibitor that would prevent commands from being used if the user is not a VIP user.\"), mdx(\"blockquote\", null, mdx(\"p\", {\n parentName: \"blockquote\"\n }, mdx(\"strong\", {\n parentName: \"p\"\n }, \"Note:\"), \" It is important to remember that everything below can be done with a simple permission level as well. We will create our own custom permission levels but for the purposes of this guide and to be able to learn about Inhibitors, we will be using an inhibitor.\")), mdx(\"h2\", null, \"Creating the File\"), mdx(\"p\", null, \"Let's start by creating a file inside the inhibitors folder called \", mdx(\"inlineCode\", {\n parentName: \"p\"\n }, \"boosted.ts\"), \" and paste the following snippet of code:\"), mdx(\"pre\", null, mdx(\"code\", _extends({\n parentName: \"pre\"\n }, {\n \"className\": \"language-ts\"\n }), \"import { botCache } from \\\"../../mod.ts\\\";\\n\\nbotCache.inhibitors.set(\\\"inhibitorname\\\", async function (message, command, guild) {\\n // Your code goes here\\n});\\n\")), mdx(\"p\", null, \"Inhibitors can take up to 3 arguments.\"), mdx(\"ul\", null, mdx(\"li\", {\n parentName: \"ul\"\n }, mdx(\"inlineCode\", {\n parentName: \"li\"\n }, \"message\"), \": The message object that triggered the command.\"), mdx(\"li\", {\n parentName: \"ul\"\n }, mdx(\"inlineCode\", {\n parentName: \"li\"\n }, \"command\"), \": The command object itself that was triggered.\"), mdx(\"li\", {\n parentName: \"ul\"\n }, mdx(\"inlineCode\", {\n parentName: \"li\"\n }, \"guild\"), \": The server guild object where this command was ran.\")), mdx(\"h2\", null, \"Understanding How Inhibitors Function\"), mdx(\"p\", null, \"To block a command you have to return a truthy value.\"), mdx(\"ul\", null, mdx(\"li\", {\n parentName: \"ul\"\n }, mdx(\"strong\", {\n parentName: \"li\"\n }, \"return true;\"), \" If you return true the inhibitor will block the execution of the command.\\nTo allow a command return a falsey value.\"), mdx(\"li\", {\n parentName: \"ul\"\n }, mdx(\"strong\", {\n parentName: \"li\"\n }, \"return false;\"), \" If you return false the inhibitor will not block the error.\")), mdx(\"pre\", null, mdx(\"code\", _extends({\n parentName: \"pre\"\n }, {\n \"className\": \"language-ts\"\n }), \"// If the command is not VIP only we can allow this command to execute\\nif (!command.vipOnly) return false;\\n\\n// The bot's support server\\nconst guild = cache.guilds.get(configs.supportServerID);\\n// If the command author is not in the server they won't have the vip role\\nconst member = guild.members.get(message.author.id) || await getMember(guild.id, message.author.id);\\n// Member doesn't exist so cancel the command\\nif (!member) {\\n sendResponse(message, `sorry, but you can not use this command until you become VIP. **Close the IRIS!!!**`)\\n return true;\\n}\\n\\n// If the user has the vip role on the support server given by patreon allow the command\\nif (member.roles.includes(configs.roleIDs.patreonVIPRoleID)) return false;\\n\\n// Alert the user they don't have vip and can't use the command\\nsendResponse(message, `sorry, but you can not use this command until you become a VIP. I'm sorry, Teal'c. We'll go to Disneyland next year. I promise.`)\\n// Cancel the command since the user does not have vip\\nreturn true;\\n\")), mdx(\"h2\", null, \"Challenges\"), mdx(\"p\", null, \"Hell yes! We just got through the entire inhibitor section. You have now mastered everything related to inhibitors.\"), mdx(\"p\", null, \"You can now try and get a little more practice with inhibitors by trying to challenge yourself and make your own inhibitors. Don't worry if you can't think of any good use cases for inhibitors.\"), mdx(\"p\", null, \"Majority of Discordeno bots\"));\n}\n;\nMDXContent.isMDXComponent = true;","rawMDXOutput":"/* @jsx mdx */\nimport { mdx } from '@mdx-js/react';\n/* @jsx mdx */\n\nexport const _frontmatter = {\n \"title\": \"Creating Inhibitors!\",\n \"metaTitle\": \"Creating An Inhibitor | Discordeno\",\n \"metaDescription\": \"Let's create our very own bot with Discordeno!\"\n};\n\nconst layoutProps = {\n _frontmatter\n};\nconst MDXLayout = \"wrapper\"\nexport default function MDXContent({\n components,\n ...props\n}) {\n return \n

{`Woah! You are almost half way done with understanding all of Discordeno. Amazing isn't it? Something you may have noticed in the last section was there were some options that prevented some commands from running like `}{`dmOnly`}{` or the permission options. we created a setting to prevent the monitor from running in certain channels. What if we wanted to do prevent commands from happening? How would we prevent commands from running?`}

\n

{`What is an Inhibitor?`}

\n

{`An Inhibitor is very similar to how monitors work. A monitor runs on every message but an inhibitor runs on every command. Remember all those command options like cooldown, permissions, permissionLevel, nsfw, etc... Each and every one of these options has an inhibitor in that checks commands for these settings.`}

\n

{`Let's create our own inhibitor that would prevent commands from being used if the user is not a VIP user.`}

\n
\n

{`Note:`}{` It is important to remember that everything below can be done with a simple permission level as well. We will create our own custom permission levels but for the purposes of this guide and to be able to learn about Inhibitors, we will be using an inhibitor.`}

\n
\n

{`Creating the File`}

\n

{`Let's start by creating a file inside the inhibitors folder called `}{`boosted.ts`}{` and paste the following snippet of code:`}

\n
{`import { botCache } from \"../../mod.ts\";\n\nbotCache.inhibitors.set(\"inhibitorname\", async function (message, command, guild) {\n    // Your code goes here\n});\n`}
\n

{`Inhibitors can take up to 3 arguments.`}

\n
    \n
  • {`message`}{`: The message object that triggered the command.`}
  • \n
  • {`command`}{`: The command object itself that was triggered.`}
  • \n
  • {`guild`}{`: The server guild object where this command was ran.`}
  • \n
\n

{`Understanding How Inhibitors Function`}

\n

{`To block a command you have to return a truthy value.`}

\n
    \n
  • {`return true;`}{` If you return true the inhibitor will block the execution of the command.\nTo allow a command return a falsey value.`}
  • \n
  • {`return false;`}{` If you return false the inhibitor will not block the error.`}
  • \n
\n
{`// If the command is not VIP only we can allow this command to execute\nif (!command.vipOnly) return false;\n\n// The bot's support server\nconst guild = cache.guilds.get(configs.supportServerID);\n// If the command author is not in the server they won't have the vip role\nconst member = guild.members.get(message.author.id) || await getMember(guild.id, message.author.id);\n// Member doesn't exist so cancel the command\nif (!member) {\n    sendResponse(message, \\`sorry, but you can not use this command until you become VIP. **Close the IRIS!!!**\\`)\n    return true;\n}\n\n// If the user has the vip role on the support server given by patreon allow the command\nif (member.roles.includes(configs.roleIDs.patreonVIPRoleID)) return false;\n\n// Alert the user they don't have vip and can't use the command\nsendResponse(message, \\`sorry, but you can not use this command until you become a VIP. I'm sorry, Teal'c. We'll go to Disneyland next year. I promise.\\`)\n// Cancel the command since the user does not have vip\nreturn true;\n`}
\n

{`Challenges`}

\n

{`Hell yes! We just got through the entire inhibitor section. You have now mastered everything related to inhibitors.`}

\n

{`You can now try and get a little more practice with inhibitors by trying to challenge yourself and make your own inhibitors. Don't worry if you can't think of any good use cases for inhibitors.`}

\n

{`Majority of Discordeno bots`}

\n\n
;\n}\n\n;\nMDXContent.isMDXComponent = true;"}} \ No newline at end of file diff --git a/docs/.cache/caches/gatsby-plugin-mdx/diskstore-f49c90b62ca7a5bfa69c247e96c3c257.json b/docs/.cache/caches/gatsby-plugin-mdx/diskstore-f49c90b62ca7a5bfa69c247e96c3c257.json new file mode 100644 index 000000000..32bd3cf65 --- /dev/null +++ b/docs/.cache/caches/gatsby-plugin-mdx/diskstore-f49c90b62ca7a5bfa69c247e96c3c257.json @@ -0,0 +1 @@ +{"expireTime":9007200851634293000,"key":"gatsby-plugin-mdx-entire-payload-4a681a0f6e4700a30a942bdce2d59d1c-","val":{"mdast":{"type":"root","children":[{"type":"paragraph","children":[{"type":"text","value":"Woah! You are almost half way done with understanding all of Discordeno. Amazing isn't it? Something you may have noticed in the last section was there were some options that prevented some commands from running like ","position":{"start":{"line":2,"column":1,"offset":1},"end":{"line":2,"column":218,"offset":218},"indent":[]}},{"type":"inlineCode","value":"dmOnly","position":{"start":{"line":2,"column":218,"offset":218},"end":{"line":2,"column":226,"offset":226},"indent":[]}},{"type":"text","value":" or the permission options. we created a setting to prevent the monitor from running in certain channels. What if we wanted to do prevent commands from happening? How would we prevent commands from running?","position":{"start":{"line":2,"column":226,"offset":226},"end":{"line":2,"column":432,"offset":432},"indent":[]}}],"position":{"start":{"line":2,"column":1,"offset":1},"end":{"line":2,"column":432,"offset":432},"indent":[]}},{"type":"heading","depth":2,"children":[{"type":"text","value":"What is an Inhibitor?","position":{"start":{"line":4,"column":4,"offset":437},"end":{"line":4,"column":25,"offset":458},"indent":[]}}],"position":{"start":{"line":4,"column":1,"offset":434},"end":{"line":4,"column":25,"offset":458},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"An Inhibitor is very similar to how monitors work. A monitor runs on every message but an inhibitor runs on every command. Remember all those command options like cooldown, permissions, permissionLevel, nsfw, etc... Each and every one of these options has an inhibitor in that checks commands for these settings.","position":{"start":{"line":6,"column":1,"offset":460},"end":{"line":6,"column":313,"offset":772},"indent":[]}}],"position":{"start":{"line":6,"column":1,"offset":460},"end":{"line":6,"column":313,"offset":772},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"Let's create our own inhibitor that would prevent commands from being used if the user is not a VIP user.","position":{"start":{"line":8,"column":1,"offset":774},"end":{"line":8,"column":106,"offset":879},"indent":[]}}],"position":{"start":{"line":8,"column":1,"offset":774},"end":{"line":8,"column":106,"offset":879},"indent":[]}},{"type":"blockquote","children":[{"type":"paragraph","children":[{"type":"strong","children":[{"type":"text","value":"Note:","position":{"start":{"line":10,"column":5,"offset":885},"end":{"line":10,"column":10,"offset":890},"indent":[]}}],"position":{"start":{"line":10,"column":3,"offset":883},"end":{"line":10,"column":12,"offset":892},"indent":[]}},{"type":"text","value":" It is important to remember that everything below can be done with a simple permission level as well. We will create our own custom permission levels but for the purposes of this guide and to be able to learn about Inhibitors, we will be using an inhibitor.","position":{"start":{"line":10,"column":12,"offset":892},"end":{"line":10,"column":270,"offset":1150},"indent":[]}}],"position":{"start":{"line":10,"column":3,"offset":883},"end":{"line":10,"column":270,"offset":1150},"indent":[]}}],"position":{"start":{"line":10,"column":1,"offset":881},"end":{"line":10,"column":270,"offset":1150},"indent":[]}},{"type":"heading","depth":2,"children":[{"type":"text","value":"Creating the File","position":{"start":{"line":12,"column":4,"offset":1155},"end":{"line":12,"column":21,"offset":1172},"indent":[]}}],"position":{"start":{"line":12,"column":1,"offset":1152},"end":{"line":12,"column":21,"offset":1172},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"Let's start by creating a file inside the inhibitors folder called ","position":{"start":{"line":14,"column":1,"offset":1174},"end":{"line":14,"column":68,"offset":1241},"indent":[]}},{"type":"inlineCode","value":"boosted.ts","position":{"start":{"line":14,"column":68,"offset":1241},"end":{"line":14,"column":80,"offset":1253},"indent":[]}},{"type":"text","value":" and paste the following snippet of code:","position":{"start":{"line":14,"column":80,"offset":1253},"end":{"line":14,"column":121,"offset":1294},"indent":[]}}],"position":{"start":{"line":14,"column":1,"offset":1174},"end":{"line":14,"column":121,"offset":1294},"indent":[]}},{"type":"code","lang":"ts","meta":null,"value":"import { botCache } from \"../../mod.ts\";\n\nbotCache.inhibitors.set(\"inhibitorname\", async function (message, command, guild) {\n\t// Your code goes here\n});","position":{"start":{"line":16,"column":1,"offset":1296},"end":{"line":22,"column":4,"offset":1459},"indent":[1,1,1,1,1,1]}},{"type":"paragraph","children":[{"type":"text","value":"Inhibitors can take up to 3 arguments.","position":{"start":{"line":24,"column":1,"offset":1461},"end":{"line":24,"column":39,"offset":1499},"indent":[]}}],"position":{"start":{"line":24,"column":1,"offset":1461},"end":{"line":24,"column":39,"offset":1499},"indent":[]}},{"type":"list","ordered":false,"start":null,"spread":false,"children":[{"type":"listItem","spread":false,"checked":null,"children":[{"type":"paragraph","children":[{"type":"inlineCode","value":"message","position":{"start":{"line":26,"column":3,"offset":1503},"end":{"line":26,"column":12,"offset":1512},"indent":[]}},{"type":"text","value":": The message object that triggered the command.","position":{"start":{"line":26,"column":12,"offset":1512},"end":{"line":26,"column":60,"offset":1560},"indent":[]}}],"position":{"start":{"line":26,"column":3,"offset":1503},"end":{"line":26,"column":60,"offset":1560},"indent":[]}}],"position":{"start":{"line":26,"column":1,"offset":1501},"end":{"line":26,"column":60,"offset":1560},"indent":[]}},{"type":"listItem","spread":false,"checked":null,"children":[{"type":"paragraph","children":[{"type":"inlineCode","value":"command","position":{"start":{"line":27,"column":3,"offset":1563},"end":{"line":27,"column":12,"offset":1572},"indent":[]}},{"type":"text","value":": The command object itself that was triggered.","position":{"start":{"line":27,"column":12,"offset":1572},"end":{"line":27,"column":59,"offset":1619},"indent":[]}}],"position":{"start":{"line":27,"column":3,"offset":1563},"end":{"line":27,"column":59,"offset":1619},"indent":[]}}],"position":{"start":{"line":27,"column":1,"offset":1561},"end":{"line":27,"column":59,"offset":1619},"indent":[]}},{"type":"listItem","spread":false,"checked":null,"children":[{"type":"paragraph","children":[{"type":"inlineCode","value":"guild","position":{"start":{"line":28,"column":3,"offset":1622},"end":{"line":28,"column":10,"offset":1629},"indent":[]}},{"type":"text","value":": The server guild object where this command was ran.","position":{"start":{"line":28,"column":10,"offset":1629},"end":{"line":28,"column":63,"offset":1682},"indent":[]}}],"position":{"start":{"line":28,"column":3,"offset":1622},"end":{"line":28,"column":63,"offset":1682},"indent":[]}}],"position":{"start":{"line":28,"column":1,"offset":1620},"end":{"line":28,"column":63,"offset":1682},"indent":[]}}],"position":{"start":{"line":26,"column":1,"offset":1501},"end":{"line":28,"column":63,"offset":1682},"indent":[1,1]}},{"type":"heading","depth":2,"children":[{"type":"text","value":"Understanding How Inhibitors Function","position":{"start":{"line":30,"column":4,"offset":1687},"end":{"line":30,"column":41,"offset":1724},"indent":[]}}],"position":{"start":{"line":30,"column":1,"offset":1684},"end":{"line":30,"column":41,"offset":1724},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"To block a command you have to return a truthy value.","position":{"start":{"line":32,"column":1,"offset":1726},"end":{"line":32,"column":54,"offset":1779},"indent":[]}}],"position":{"start":{"line":32,"column":1,"offset":1726},"end":{"line":32,"column":54,"offset":1779},"indent":[]}},{"type":"list","ordered":false,"start":null,"spread":false,"children":[{"type":"listItem","spread":false,"checked":null,"children":[{"type":"paragraph","children":[{"type":"strong","children":[{"type":"text","value":"return true;","position":{"start":{"line":33,"column":5,"offset":1784},"end":{"line":33,"column":17,"offset":1796},"indent":[]}}],"position":{"start":{"line":33,"column":3,"offset":1782},"end":{"line":33,"column":19,"offset":1798},"indent":[]}},{"type":"text","value":" If you return true the inhibitor will block the execution of the command.\nTo allow a command return a falsey value.","position":{"start":{"line":33,"column":19,"offset":1798},"end":{"line":34,"column":42,"offset":1914},"indent":[1]}}],"position":{"start":{"line":33,"column":3,"offset":1782},"end":{"line":34,"column":42,"offset":1914},"indent":[1]}}],"position":{"start":{"line":33,"column":1,"offset":1780},"end":{"line":34,"column":42,"offset":1914},"indent":[1]}},{"type":"listItem","spread":false,"checked":null,"children":[{"type":"paragraph","children":[{"type":"strong","children":[{"type":"text","value":"return false;","position":{"start":{"line":35,"column":5,"offset":1919},"end":{"line":35,"column":18,"offset":1932},"indent":[]}}],"position":{"start":{"line":35,"column":3,"offset":1917},"end":{"line":35,"column":20,"offset":1934},"indent":[]}},{"type":"text","value":" If you return false the inhibitor will not block the error.","position":{"start":{"line":35,"column":20,"offset":1934},"end":{"line":35,"column":80,"offset":1994},"indent":[]}}],"position":{"start":{"line":35,"column":3,"offset":1917},"end":{"line":35,"column":80,"offset":1994},"indent":[]}}],"position":{"start":{"line":35,"column":1,"offset":1915},"end":{"line":35,"column":80,"offset":1994},"indent":[]}}],"position":{"start":{"line":33,"column":1,"offset":1780},"end":{"line":35,"column":80,"offset":1994},"indent":[1,1]}},{"type":"code","lang":"ts","meta":null,"value":"// If the command is not VIP only we can allow this command to execute\nif (!command.vipOnly) return false;\n\n// The bot's support server\nconst guild = cache.guilds.get(configs.supportServerID);\n// If the command author is not in the server they won't have the vip role\nconst member = guild.members.get(message.author.id) || await getMember(guild.id, message.author.id);\n// Member doesn't exist so cancel the command\nif (!member) return true;\n\n// If the user has the vip role on the support server given by patreon allow the command\nif (member.roles.includes(configs.patreonVIPRoleID)) return false;\n\n// Cancel the command since the user does not have vip\nreturn true;\n// The user is NOT VIP so we throw an error\nthrow `The ${command.name} is only allowed for VIP users.`","position":{"start":{"line":38,"column":1,"offset":1997},"end":{"line":56,"column":4,"offset":2776},"indent":[1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1]}},{"type":"export","value":"export const _frontmatter = {\"title\":\"Creating Inhibitors!\",\"metaTitle\":\"Creating An Inhibitor | Discordeno\",\"metaDescription\":\"Let's create our very own bot with Discordeno!\"}","position":{"start":{"line":59,"column":1,"offset":2779},"end":{"line":59,"column":177,"offset":2955},"indent":[]}}],"position":{"start":{"line":1,"column":1,"offset":0},"end":{"line":59,"column":177,"offset":2955}}},"scopeImports":["import * as React from 'react'"],"scopeIdentifiers":["React"],"body":"function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }\n\nfunction _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }\n\nfunction _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }\n\n/* @jsx mdx */\nvar _frontmatter = {\n \"title\": \"Creating Inhibitors!\",\n \"metaTitle\": \"Creating An Inhibitor | Discordeno\",\n \"metaDescription\": \"Let's create our very own bot with Discordeno!\"\n};\nvar layoutProps = {\n _frontmatter: _frontmatter\n};\nvar MDXLayout = \"wrapper\";\nreturn function MDXContent(_ref) {\n var components = _ref.components,\n props = _objectWithoutProperties(_ref, [\"components\"]);\n\n return mdx(MDXLayout, _extends({}, layoutProps, props, {\n components: components,\n mdxType: \"MDXLayout\"\n }), mdx(\"p\", null, \"Woah! You are almost half way done with understanding all of Discordeno. Amazing isn't it? Something you may have noticed in the last section was there were some options that prevented some commands from running like \", mdx(\"inlineCode\", {\n parentName: \"p\"\n }, \"dmOnly\"), \" or the permission options. we created a setting to prevent the monitor from running in certain channels. What if we wanted to do prevent commands from happening? How would we prevent commands from running?\"), mdx(\"h2\", null, \"What is an Inhibitor?\"), mdx(\"p\", null, \"An Inhibitor is very similar to how monitors work. A monitor runs on every message but an inhibitor runs on every command. Remember all those command options like cooldown, permissions, permissionLevel, nsfw, etc... Each and every one of these options has an inhibitor in that checks commands for these settings.\"), mdx(\"p\", null, \"Let's create our own inhibitor that would prevent commands from being used if the user is not a VIP user.\"), mdx(\"blockquote\", null, mdx(\"p\", {\n parentName: \"blockquote\"\n }, mdx(\"strong\", {\n parentName: \"p\"\n }, \"Note:\"), \" It is important to remember that everything below can be done with a simple permission level as well. We will create our own custom permission levels but for the purposes of this guide and to be able to learn about Inhibitors, we will be using an inhibitor.\")), mdx(\"h2\", null, \"Creating the File\"), mdx(\"p\", null, \"Let's start by creating a file inside the inhibitors folder called \", mdx(\"inlineCode\", {\n parentName: \"p\"\n }, \"boosted.ts\"), \" and paste the following snippet of code:\"), mdx(\"pre\", null, mdx(\"code\", _extends({\n parentName: \"pre\"\n }, {\n \"className\": \"language-ts\"\n }), \"import { botCache } from \\\"../../mod.ts\\\";\\n\\nbotCache.inhibitors.set(\\\"inhibitorname\\\", async function (message, command, guild) {\\n // Your code goes here\\n});\\n\")), mdx(\"p\", null, \"Inhibitors can take up to 3 arguments.\"), mdx(\"ul\", null, mdx(\"li\", {\n parentName: \"ul\"\n }, mdx(\"inlineCode\", {\n parentName: \"li\"\n }, \"message\"), \": The message object that triggered the command.\"), mdx(\"li\", {\n parentName: \"ul\"\n }, mdx(\"inlineCode\", {\n parentName: \"li\"\n }, \"command\"), \": The command object itself that was triggered.\"), mdx(\"li\", {\n parentName: \"ul\"\n }, mdx(\"inlineCode\", {\n parentName: \"li\"\n }, \"guild\"), \": The server guild object where this command was ran.\")), mdx(\"h2\", null, \"Understanding How Inhibitors Function\"), mdx(\"p\", null, \"To block a command you have to return a truthy value.\"), mdx(\"ul\", null, mdx(\"li\", {\n parentName: \"ul\"\n }, mdx(\"strong\", {\n parentName: \"li\"\n }, \"return true;\"), \" If you return true the inhibitor will block the execution of the command.\\nTo allow a command return a falsey value.\"), mdx(\"li\", {\n parentName: \"ul\"\n }, mdx(\"strong\", {\n parentName: \"li\"\n }, \"return false;\"), \" If you return false the inhibitor will not block the error.\")), mdx(\"pre\", null, mdx(\"code\", _extends({\n parentName: \"pre\"\n }, {\n \"className\": \"language-ts\"\n }), \"// If the command is not VIP only we can allow this command to execute\\nif (!command.vipOnly) return false;\\n\\n// The bot's support server\\nconst guild = cache.guilds.get(configs.supportServerID);\\n// If the command author is not in the server they won't have the vip role\\nconst member = guild.members.get(message.author.id) || await getMember(guild.id, message.author.id);\\n// Member doesn't exist so cancel the command\\nif (!member) return true;\\n\\n// If the user has the vip role on the support server given by patreon allow the command\\nif (member.roles.includes(configs.patreonVIPRoleID)) return false;\\n\\n// Cancel the command since the user does not have vip\\nreturn true;\\n// The user is NOT VIP so we throw an error\\nthrow `The ${command.name} is only allowed for VIP users.`\\n\")));\n}\n;\nMDXContent.isMDXComponent = true;","rawMDXOutput":"/* @jsx mdx */\nimport { mdx } from '@mdx-js/react';\n/* @jsx mdx */\n\nexport const _frontmatter = {\n \"title\": \"Creating Inhibitors!\",\n \"metaTitle\": \"Creating An Inhibitor | Discordeno\",\n \"metaDescription\": \"Let's create our very own bot with Discordeno!\"\n};\n\nconst layoutProps = {\n _frontmatter\n};\nconst MDXLayout = \"wrapper\"\nexport default function MDXContent({\n components,\n ...props\n}) {\n return \n

{`Woah! You are almost half way done with understanding all of Discordeno. Amazing isn't it? Something you may have noticed in the last section was there were some options that prevented some commands from running like `}{`dmOnly`}{` or the permission options. we created a setting to prevent the monitor from running in certain channels. What if we wanted to do prevent commands from happening? How would we prevent commands from running?`}

\n

{`What is an Inhibitor?`}

\n

{`An Inhibitor is very similar to how monitors work. A monitor runs on every message but an inhibitor runs on every command. Remember all those command options like cooldown, permissions, permissionLevel, nsfw, etc... Each and every one of these options has an inhibitor in that checks commands for these settings.`}

\n

{`Let's create our own inhibitor that would prevent commands from being used if the user is not a VIP user.`}

\n
\n

{`Note:`}{` It is important to remember that everything below can be done with a simple permission level as well. We will create our own custom permission levels but for the purposes of this guide and to be able to learn about Inhibitors, we will be using an inhibitor.`}

\n
\n

{`Creating the File`}

\n

{`Let's start by creating a file inside the inhibitors folder called `}{`boosted.ts`}{` and paste the following snippet of code:`}

\n
{`import { botCache } from \"../../mod.ts\";\n\nbotCache.inhibitors.set(\"inhibitorname\", async function (message, command, guild) {\n    // Your code goes here\n});\n`}
\n

{`Inhibitors can take up to 3 arguments.`}

\n
    \n
  • {`message`}{`: The message object that triggered the command.`}
  • \n
  • {`command`}{`: The command object itself that was triggered.`}
  • \n
  • {`guild`}{`: The server guild object where this command was ran.`}
  • \n
\n

{`Understanding How Inhibitors Function`}

\n

{`To block a command you have to return a truthy value.`}

\n
    \n
  • {`return true;`}{` If you return true the inhibitor will block the execution of the command.\nTo allow a command return a falsey value.`}
  • \n
  • {`return false;`}{` If you return false the inhibitor will not block the error.`}
  • \n
\n
{`// If the command is not VIP only we can allow this command to execute\nif (!command.vipOnly) return false;\n\n// The bot's support server\nconst guild = cache.guilds.get(configs.supportServerID);\n// If the command author is not in the server they won't have the vip role\nconst member = guild.members.get(message.author.id) || await getMember(guild.id, message.author.id);\n// Member doesn't exist so cancel the command\nif (!member) return true;\n\n// If the user has the vip role on the support server given by patreon allow the command\nif (member.roles.includes(configs.patreonVIPRoleID)) return false;\n\n// Cancel the command since the user does not have vip\nreturn true;\n// The user is NOT VIP so we throw an error\nthrow \\`The \\${command.name} is only allowed for VIP users.\\`\n`}
\n\n
;\n}\n\n;\nMDXContent.isMDXComponent = true;"}} \ No newline at end of file diff --git a/docs/.cache/caches/gatsby-plugin-mdx/diskstore-f4e0a51bcdcafcf7296a50dce16b3ffc.json b/docs/.cache/caches/gatsby-plugin-mdx/diskstore-f4e0a51bcdcafcf7296a50dce16b3ffc.json new file mode 100644 index 000000000..002e989d0 --- /dev/null +++ b/docs/.cache/caches/gatsby-plugin-mdx/diskstore-f4e0a51bcdcafcf7296a50dce16b3ffc.json @@ -0,0 +1 @@ +{"expireTime":9007200851644176000,"key":"gatsby-plugin-mdx-entire-payload-b6509c0446d4bd8e97cab6113c8e4f0c-","val":{"mdast":{"type":"root","children":[{"type":"paragraph","children":[{"type":"text","value":"Discordeno will help make Discord bot development much easier. Don't worry, as you go through this guide it will make a lot more sense.","position":{"start":{"line":2,"column":1,"offset":1},"end":{"line":2,"column":136,"offset":136},"indent":[]}}],"position":{"start":{"line":2,"column":1,"offset":1},"end":{"line":2,"column":136,"offset":136},"indent":[]}},{"type":"heading","depth":2,"children":[{"type":"text","value":"Creating The Bot!","position":{"start":{"line":4,"column":4,"offset":141},"end":{"line":4,"column":21,"offset":158},"indent":[]}}],"position":{"start":{"line":4,"column":1,"offset":138},"end":{"line":4,"column":21,"offset":158},"indent":[]}},{"type":"blockquote","children":[{"type":"paragraph","children":[{"type":"text","value":"This guide is going to assume you already have the basic requirements to make a bot ready. This includes github, git, a code editor like Visual Studio Code. If you don't have these yet please prepare them first before going forward.","position":{"start":{"line":6,"column":3,"offset":162},"end":{"line":6,"column":235,"offset":394},"indent":[]}}],"position":{"start":{"line":6,"column":3,"offset":162},"end":{"line":6,"column":235,"offset":394},"indent":[]}}],"position":{"start":{"line":6,"column":1,"offset":160},"end":{"line":6,"column":235,"offset":394},"indent":[]}},{"type":"list","ordered":false,"start":null,"spread":true,"children":[{"type":"listItem","spread":false,"checked":null,"children":[{"type":"paragraph","children":[{"type":"text","value":"First, create a Discordeno Bot using the ","position":{"start":{"line":8,"column":3,"offset":398},"end":{"line":8,"column":44,"offset":439},"indent":[]}},{"type":"link","title":null,"url":"https://github.com/Skillz4Killz/Discordeno-bot-template","children":[{"type":"text","value":"Generator Boilerplate","position":{"start":{"line":8,"column":45,"offset":440},"end":{"line":8,"column":66,"offset":461},"indent":[]}}],"position":{"start":{"line":8,"column":44,"offset":439},"end":{"line":8,"column":124,"offset":519},"indent":[]}},{"type":"text","value":". Give it any name you like. For the purpose of this guide we will call it, Stargate.","position":{"start":{"line":8,"column":124,"offset":519},"end":{"line":8,"column":209,"offset":604},"indent":[]}}],"position":{"start":{"line":8,"column":3,"offset":398},"end":{"line":8,"column":209,"offset":604},"indent":[]}}],"position":{"start":{"line":8,"column":1,"offset":396},"end":{"line":9,"column":1,"offset":605},"indent":[1]}},{"type":"listItem","spread":false,"checked":null,"children":[{"type":"paragraph","children":[{"type":"text","value":"Then ","position":{"start":{"line":10,"column":3,"offset":608},"end":{"line":10,"column":8,"offset":613},"indent":[]}},{"type":"inlineCode","value":"git clone https://github.com/Skillz4Killz/Stargate.git","position":{"start":{"line":10,"column":8,"offset":613},"end":{"line":10,"column":64,"offset":669},"indent":[]}}],"position":{"start":{"line":10,"column":3,"offset":608},"end":{"line":10,"column":64,"offset":669},"indent":[]}}],"position":{"start":{"line":10,"column":1,"offset":606},"end":{"line":11,"column":1,"offset":670},"indent":[1]}},{"type":"listItem","spread":false,"checked":null,"children":[{"type":"paragraph","children":[{"type":"text","value":"When that is done, go ahead and open up the folder with VSC.","position":{"start":{"line":12,"column":3,"offset":673},"end":{"line":12,"column":63,"offset":733},"indent":[]}}],"position":{"start":{"line":12,"column":3,"offset":673},"end":{"line":12,"column":63,"offset":733},"indent":[]}}],"position":{"start":{"line":12,"column":1,"offset":671},"end":{"line":12,"column":63,"offset":733},"indent":[]}},{"type":"listItem","spread":false,"checked":null,"children":[{"type":"paragraph","children":[{"type":"text","value":"Create a new file called ","position":{"start":{"line":13,"column":3,"offset":736},"end":{"line":13,"column":28,"offset":761},"indent":[]}},{"type":"inlineCode","value":"configs.ts","position":{"start":{"line":13,"column":28,"offset":761},"end":{"line":13,"column":40,"offset":773},"indent":[]}},{"type":"text","value":". Open the ","position":{"start":{"line":13,"column":40,"offset":773},"end":{"line":13,"column":51,"offset":784},"indent":[]}},{"type":"inlineCode","value":"configs.example.ts","position":{"start":{"line":13,"column":51,"offset":784},"end":{"line":13,"column":71,"offset":804},"indent":[]}},{"type":"text","value":" file and copy everything over.","position":{"start":{"line":13,"column":71,"offset":804},"end":{"line":13,"column":102,"offset":835},"indent":[]}}],"position":{"start":{"line":13,"column":3,"offset":736},"end":{"line":13,"column":102,"offset":835},"indent":[]}}],"position":{"start":{"line":13,"column":1,"offset":734},"end":{"line":13,"column":102,"offset":835},"indent":[]}}],"position":{"start":{"line":8,"column":1,"offset":396},"end":{"line":13,"column":102,"offset":835},"indent":[1,1,1,1,1]}},{"type":"paragraph","children":[{"type":"text","value":"Let's take a minute to review all the options we have available to us.","position":{"start":{"line":15,"column":1,"offset":837},"end":{"line":15,"column":71,"offset":907},"indent":[]}}],"position":{"start":{"line":15,"column":1,"offset":837},"end":{"line":15,"column":71,"offset":907},"indent":[]}},{"type":"heading","depth":3,"children":[{"type":"text","value":"Configs File","position":{"start":{"line":17,"column":5,"offset":913},"end":{"line":17,"column":17,"offset":925},"indent":[]}}],"position":{"start":{"line":17,"column":1,"offset":909},"end":{"line":17,"column":17,"offset":925},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"The ","position":{"start":{"line":19,"column":1,"offset":927},"end":{"line":19,"column":5,"offset":931},"indent":[]}},{"type":"inlineCode","value":"configs.ts","position":{"start":{"line":19,"column":5,"offset":931},"end":{"line":19,"column":17,"offset":943},"indent":[]}},{"type":"text","value":" file is where you will keep all your secret info you don't want to share with anyone else. As long as ","position":{"start":{"line":19,"column":17,"offset":943},"end":{"line":19,"column":120,"offset":1046},"indent":[]}},{"type":"inlineCode","value":".gitignore","position":{"start":{"line":19,"column":120,"offset":1046},"end":{"line":19,"column":132,"offset":1058},"indent":[]}},{"type":"text","value":" file is ignoring configs.ts your configurations will be kept private!","position":{"start":{"line":19,"column":132,"offset":1058},"end":{"line":19,"column":202,"offset":1128},"indent":[]}}],"position":{"start":{"line":19,"column":1,"offset":927},"end":{"line":19,"column":202,"offset":1128},"indent":[]}},{"type":"code","lang":"ts","meta":null,"value":"// Step 1: Remove the `.example` from this file name so it is called `configs.ts`\n// Step 2: Add all your bot's information below. The only required one is token and prefix. NOTE: As long as `.gitignore` file is ignoring configs.ts your configurations will be kept private!\n// Step 3: Remove these comments if you like.\n\nexport const configs = {\n // Your bot token goes here\n token: \"\",\n // The default prefix for your bot. Don't worry guilds can change this later.\n prefix: \"!\",\n // This isn't required but you can add bot list api keys here.\n botListTokens: {\n DISCORD_BOT_ORG: \"\",\n BOTS_ON_DISCORD: \"\",\n DISCORD_BOT_LIST: \"\",\n BOTS_FOR_DISCORD: \"\",\n DISCORD_BOATS: \"\",\n DISCORD_BOTS_GG: \"\",\n DISCORD_BOTS_GROUP: \"\",\n },\n // This is the server id for your bot's main server where users can get help/support\n supportServerID: \"\",\n // These are channel ids that will enable some functionality\n channelIDs: {\n // When a translation is missing this is the channel you will be alerted in.\n missingTranslation: \"\",\n // When an error occurs, we will try and log it to this channel\n errorChannelID: \"\"\n },\n // These are the role ids that will enable some functionality.\n roleIDs: {\n // If you have a patreon set up you can add the patreon vip role id here.\n patreonVIPRoleID: \"\",\n },\n // These are the user ids that will enable some functionality.\n userIDs: {\n // The user ids for the support team\n botSupporters: [],\n // The user ids for the other devs on your team\n botDevs: [],\n // The user ids who have complete 100% access to your bot\n botOwners: []\n }\n};\n","position":{"start":{"line":21,"column":1,"offset":1130},"end":{"line":66,"column":4,"offset":2770},"indent":[1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1]}},{"type":"heading","depth":4,"children":[{"type":"text","value":"Token","position":{"start":{"line":68,"column":6,"offset":2777},"end":{"line":68,"column":11,"offset":2782},"indent":[]}}],"position":{"start":{"line":68,"column":1,"offset":2772},"end":{"line":68,"column":11,"offset":2782},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"First, add your bot token. This is ","position":{"start":{"line":70,"column":1,"offset":2784},"end":{"line":70,"column":36,"offset":2819},"indent":[]}},{"type":"strong","children":[{"type":"text","value":"required","position":{"start":{"line":70,"column":38,"offset":2821},"end":{"line":70,"column":46,"offset":2829},"indent":[]}}],"position":{"start":{"line":70,"column":36,"offset":2819},"end":{"line":70,"column":48,"offset":2831},"indent":[]}},{"type":"text","value":" for the bot to start. Review the ","position":{"start":{"line":70,"column":48,"offset":2831},"end":{"line":70,"column":82,"offset":2865},"indent":[]}},{"type":"link","title":null,"url":"https://discordeno.netlify.app/gettingstarted#creatingyourfirstdiscordbotapplication","children":[{"type":"text","value":"instructions","position":{"start":{"line":70,"column":83,"offset":2866},"end":{"line":70,"column":95,"offset":2878},"indent":[]}}],"position":{"start":{"line":70,"column":82,"offset":2865},"end":{"line":70,"column":182,"offset":2965},"indent":[]}},{"type":"text","value":" if you have not made your token yet.","position":{"start":{"line":70,"column":182,"offset":2965},"end":{"line":70,"column":219,"offset":3002},"indent":[]}}],"position":{"start":{"line":70,"column":1,"offset":2784},"end":{"line":70,"column":219,"offset":3002},"indent":[]}},{"type":"heading","depth":4,"children":[{"type":"text","value":"Prefix","position":{"start":{"line":72,"column":6,"offset":3009},"end":{"line":72,"column":12,"offset":3015},"indent":[]}}],"position":{"start":{"line":72,"column":1,"offset":3004},"end":{"line":72,"column":12,"offset":3015},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"The prefix is where you will set the default prefix for your bot. Don't worry, every server will be able to choose their own prefix but we need a default prefix to start.","position":{"start":{"line":74,"column":1,"offset":3017},"end":{"line":74,"column":171,"offset":3187},"indent":[]}}],"position":{"start":{"line":74,"column":1,"offset":3017},"end":{"line":74,"column":171,"offset":3187},"indent":[]}},{"type":"heading","depth":4,"children":[{"type":"text","value":"Bot Lists Tokens","position":{"start":{"line":76,"column":6,"offset":3194},"end":{"line":76,"column":22,"offset":3210},"indent":[]}}],"position":{"start":{"line":76,"column":1,"offset":3189},"end":{"line":76,"column":22,"offset":3210},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"This section of the file is so you can easily have your bot's statistics updated on all the bot lists out there to help you grow your bot. The code is already written to handle this but you will need to do 3 things for each bot list.","position":{"start":{"line":78,"column":1,"offset":3212},"end":{"line":78,"column":234,"offset":3445},"indent":[]}}],"position":{"start":{"line":78,"column":1,"offset":3212},"end":{"line":78,"column":234,"offset":3445},"indent":[]}},{"type":"list","ordered":true,"start":1,"spread":false,"children":[{"type":"listItem","spread":false,"checked":null,"children":[{"type":"paragraph","children":[{"type":"text","value":"Go to the bot list and add your bot to their website. (Each site has it's own instructions)","position":{"start":{"line":80,"column":4,"offset":3450},"end":{"line":80,"column":95,"offset":3541},"indent":[]}}],"position":{"start":{"line":80,"column":4,"offset":3450},"end":{"line":80,"column":95,"offset":3541},"indent":[]}}],"position":{"start":{"line":80,"column":1,"offset":3447},"end":{"line":80,"column":95,"offset":3541},"indent":[]}},{"type":"listItem","spread":false,"checked":null,"children":[{"type":"paragraph","children":[{"type":"text","value":"Create a token for yourself on each website and paste it in your configs.","position":{"start":{"line":81,"column":4,"offset":3545},"end":{"line":81,"column":77,"offset":3618},"indent":[]}}],"position":{"start":{"line":81,"column":4,"offset":3545},"end":{"line":81,"column":77,"offset":3618},"indent":[]}}],"position":{"start":{"line":81,"column":1,"offset":3542},"end":{"line":81,"column":77,"offset":3618},"indent":[]}},{"type":"listItem","spread":false,"checked":null,"children":[{"type":"paragraph","children":[{"type":"text","value":"Enjoy!","position":{"start":{"line":82,"column":4,"offset":3622},"end":{"line":82,"column":10,"offset":3628},"indent":[]}}],"position":{"start":{"line":82,"column":4,"offset":3622},"end":{"line":82,"column":10,"offset":3628},"indent":[]}}],"position":{"start":{"line":82,"column":1,"offset":3619},"end":{"line":82,"column":10,"offset":3628},"indent":[]}}],"position":{"start":{"line":80,"column":1,"offset":3447},"end":{"line":82,"column":10,"offset":3628},"indent":[1,1]}},{"type":"paragraph","children":[{"type":"text","value":"If you wish to customize the code, you will find the bot list tasks in the tasks folder. Don't worry we will discuss this when we get to the tasks section of the guide.","position":{"start":{"line":84,"column":1,"offset":3630},"end":{"line":84,"column":169,"offset":3798},"indent":[]}}],"position":{"start":{"line":84,"column":1,"offset":3630},"end":{"line":84,"column":169,"offset":3798},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"For now just remember, that Discordeno provides you a built in way to update most discord bot lists.","position":{"start":{"line":86,"column":1,"offset":3800},"end":{"line":86,"column":101,"offset":3900},"indent":[]}}],"position":{"start":{"line":86,"column":1,"offset":3800},"end":{"line":86,"column":101,"offset":3900},"indent":[]}},{"type":"heading","depth":4,"children":[{"type":"text","value":"Channel IDs","position":{"start":{"line":88,"column":6,"offset":3907},"end":{"line":88,"column":17,"offset":3918},"indent":[]}}],"position":{"start":{"line":88,"column":1,"offset":3902},"end":{"line":88,"column":17,"offset":3918},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"The channelIDs section holds the useful for specific features to help give you alerts/notifications. For example, the ","position":{"start":{"line":90,"column":1,"offset":3920},"end":{"line":90,"column":119,"offset":4038},"indent":[]}},{"type":"inlineCode","value":"missingTranslation","position":{"start":{"line":90,"column":119,"offset":4038},"end":{"line":90,"column":139,"offset":4058},"indent":[]}},{"type":"text","value":" channel will be where messages are sent alerting you that somewhere in your code you are trying to use a translation key that you never created.","position":{"start":{"line":90,"column":139,"offset":4058},"end":{"line":90,"column":284,"offset":4203},"indent":[]}}],"position":{"start":{"line":90,"column":1,"offset":3920},"end":{"line":90,"column":284,"offset":4203},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"When you get to around 25,000 Discord servers on your bot, you may want to convert these channel IDs to webhooks.","position":{"start":{"line":92,"column":1,"offset":4205},"end":{"line":92,"column":114,"offset":4318},"indent":[]}}],"position":{"start":{"line":92,"column":1,"offset":4205},"end":{"line":92,"column":114,"offset":4318},"indent":[]}},{"type":"heading","depth":2,"children":[{"type":"text","value":"It's Alive!","position":{"start":{"line":94,"column":4,"offset":4323},"end":{"line":94,"column":15,"offset":4334},"indent":[]}}],"position":{"start":{"line":94,"column":1,"offset":4320},"end":{"line":94,"column":15,"offset":4334},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"Oh my god! You now have a bot with a bunch of features already! You don't believe me? Well, seeing is believing, so start the bot.","position":{"start":{"line":96,"column":1,"offset":4336},"end":{"line":96,"column":131,"offset":4466},"indent":[]}}],"position":{"start":{"line":96,"column":1,"offset":4336},"end":{"line":96,"column":131,"offset":4466},"indent":[]}},{"type":"list","ordered":true,"start":1,"spread":false,"children":[{"type":"listItem","spread":false,"checked":null,"children":[{"type":"paragraph","children":[{"type":"text","value":"Invite your bot to a discord server.","position":{"start":{"line":98,"column":4,"offset":4471},"end":{"line":98,"column":40,"offset":4507},"indent":[]}}],"position":{"start":{"line":98,"column":4,"offset":4471},"end":{"line":98,"column":40,"offset":4507},"indent":[]}}],"position":{"start":{"line":98,"column":1,"offset":4468},"end":{"line":98,"column":40,"offset":4507},"indent":[]}},{"type":"listItem","spread":false,"checked":null,"children":[{"type":"paragraph","children":[{"type":"text","value":"Open up the integrated terminal in VSC using ","position":{"start":{"line":99,"column":4,"offset":4511},"end":{"line":99,"column":49,"offset":4556},"indent":[]}},{"type":"strong","children":[{"type":"text","value":"CTRL + `","position":{"start":{"line":99,"column":51,"offset":4558},"end":{"line":99,"column":59,"offset":4566},"indent":[]}}],"position":{"start":{"line":99,"column":49,"offset":4556},"end":{"line":99,"column":61,"offset":4568},"indent":[]}},{"type":"text","value":". If you use a Mac, replace CTRL with CMD.","position":{"start":{"line":99,"column":61,"offset":4568},"end":{"line":99,"column":103,"offset":4610},"indent":[]}}],"position":{"start":{"line":99,"column":4,"offset":4511},"end":{"line":99,"column":103,"offset":4610},"indent":[]}}],"position":{"start":{"line":99,"column":1,"offset":4508},"end":{"line":99,"column":103,"offset":4610},"indent":[]}},{"type":"listItem","spread":false,"checked":null,"children":[{"type":"paragraph","children":[{"type":"text","value":"Run the script below:","position":{"start":{"line":100,"column":4,"offset":4614},"end":{"line":100,"column":25,"offset":4635},"indent":[]}}],"position":{"start":{"line":100,"column":4,"offset":4614},"end":{"line":100,"column":25,"offset":4635},"indent":[]}}],"position":{"start":{"line":100,"column":1,"offset":4611},"end":{"line":100,"column":25,"offset":4635},"indent":[]}}],"position":{"start":{"line":98,"column":1,"offset":4468},"end":{"line":100,"column":25,"offset":4635},"indent":[1,1]}},{"type":"code","lang":"shell","meta":null,"value":"deno run --allow-net --allow-read mod.ts","position":{"start":{"line":102,"column":1,"offset":4637},"end":{"line":104,"column":4,"offset":4690},"indent":[1,1]}},{"type":"paragraph","children":[{"type":"text","value":"The first time you run it, you may see a lot of files being loaded. This is preparing all the magic behind the scene. Once it is ready, you will see something like this:","position":{"start":{"line":106,"column":1,"offset":4692},"end":{"line":106,"column":170,"offset":4861},"indent":[]}}],"position":{"start":{"line":106,"column":1,"offset":4692},"end":{"line":106,"column":170,"offset":4861},"indent":[]}},{"type":"paragraph","children":[{"type":"image","title":null,"url":"https://i.imgur.com/TOXjLgh.png","alt":"image","position":{"start":{"line":108,"column":1,"offset":4863},"end":{"line":108,"column":42,"offset":4904},"indent":[]}}],"position":{"start":{"line":108,"column":1,"offset":4863},"end":{"line":108,"column":42,"offset":4904},"indent":[]}},{"type":"heading","depth":2,"children":[{"type":"text","value":"Understanding What Discordeno Did","position":{"start":{"line":110,"column":4,"offset":4909},"end":{"line":110,"column":37,"offset":4942},"indent":[]}}],"position":{"start":{"line":110,"column":1,"offset":4906},"end":{"line":110,"column":37,"offset":4942},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"Discordeno includes these commands/folders as they are essential for any discord bot to have in order to meet the Discord Bot Best Practices. It also adds a few things that will help make some things easier to build a bot.","position":{"start":{"line":112,"column":1,"offset":4944},"end":{"line":112,"column":223,"offset":5166},"indent":[]}}],"position":{"start":{"line":112,"column":1,"offset":4944},"end":{"line":112,"column":223,"offset":5166},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"We will dive into these deeper in this guide. Let's take it step by step.","position":{"start":{"line":114,"column":1,"offset":5168},"end":{"line":114,"column":74,"offset":5241},"indent":[]}}],"position":{"start":{"line":114,"column":1,"offset":5168},"end":{"line":114,"column":74,"offset":5241},"indent":[]}},{"type":"export","value":"export const _frontmatter = {\"title\":\"Creating The Bot!\",\"metaTitle\":\"Creating A Bot | Discordeno\",\"metaDescription\":\"Let's create our very own bot with Discordeno!\"}","position":{"start":{"line":117,"column":1,"offset":5244},"end":{"line":117,"column":167,"offset":5410},"indent":[]}}],"position":{"start":{"line":1,"column":1,"offset":0},"end":{"line":117,"column":167,"offset":5410}}},"scopeImports":["import * as React from 'react'"],"scopeIdentifiers":["React"],"body":"function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }\n\nfunction _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }\n\nfunction _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }\n\n/* @jsx mdx */\nvar _frontmatter = {\n \"title\": \"Creating The Bot!\",\n \"metaTitle\": \"Creating A Bot | Discordeno\",\n \"metaDescription\": \"Let's create our very own bot with Discordeno!\"\n};\nvar layoutProps = {\n _frontmatter: _frontmatter\n};\nvar MDXLayout = \"wrapper\";\nreturn function MDXContent(_ref) {\n var components = _ref.components,\n props = _objectWithoutProperties(_ref, [\"components\"]);\n\n return mdx(MDXLayout, _extends({}, layoutProps, props, {\n components: components,\n mdxType: \"MDXLayout\"\n }), mdx(\"p\", null, \"Discordeno will help make Discord bot development much easier. Don't worry, as you go through this guide it will make a lot more sense.\"), mdx(\"h2\", null, \"Creating The Bot!\"), mdx(\"blockquote\", null, mdx(\"p\", {\n parentName: \"blockquote\"\n }, \"This guide is going to assume you already have the basic requirements to make a bot ready. This includes github, git, a code editor like Visual Studio Code. If you don't have these yet please prepare them first before going forward.\")), mdx(\"ul\", null, mdx(\"li\", {\n parentName: \"ul\"\n }, mdx(\"p\", {\n parentName: \"li\"\n }, \"First, create a Discordeno Bot using the \", mdx(\"a\", _extends({\n parentName: \"p\"\n }, {\n \"href\": \"https://github.com/Skillz4Killz/Discordeno-bot-template\"\n }), \"Generator Boilerplate\"), \". Give it any name you like. For the purpose of this guide we will call it, Stargate.\")), mdx(\"li\", {\n parentName: \"ul\"\n }, mdx(\"p\", {\n parentName: \"li\"\n }, \"Then \", mdx(\"inlineCode\", {\n parentName: \"p\"\n }, \"git clone https://github.com/Skillz4Killz/Stargate.git\"))), mdx(\"li\", {\n parentName: \"ul\"\n }, mdx(\"p\", {\n parentName: \"li\"\n }, \"When that is done, go ahead and open up the folder with VSC.\")), mdx(\"li\", {\n parentName: \"ul\"\n }, mdx(\"p\", {\n parentName: \"li\"\n }, \"Create a new file called \", mdx(\"inlineCode\", {\n parentName: \"p\"\n }, \"configs.ts\"), \". Open the \", mdx(\"inlineCode\", {\n parentName: \"p\"\n }, \"configs.example.ts\"), \" file and copy everything over.\"))), mdx(\"p\", null, \"Let's take a minute to review all the options we have available to us.\"), mdx(\"h3\", null, \"Configs File\"), mdx(\"p\", null, \"The \", mdx(\"inlineCode\", {\n parentName: \"p\"\n }, \"configs.ts\"), \" file is where you will keep all your secret info you don't want to share with anyone else. As long as \", mdx(\"inlineCode\", {\n parentName: \"p\"\n }, \".gitignore\"), \" file is ignoring configs.ts your configurations will be kept private!\"), mdx(\"pre\", null, mdx(\"code\", _extends({\n parentName: \"pre\"\n }, {\n \"className\": \"language-ts\"\n }), \"// Step 1: Remove the `.example` from this file name so it is called `configs.ts`\\n// Step 2: Add all your bot's information below. The only required one is token and prefix. NOTE: As long as `.gitignore` file is ignoring configs.ts your configurations will be kept private!\\n// Step 3: Remove these comments if you like.\\n\\nexport const configs = {\\n // Your bot token goes here\\n token: \\\"\\\",\\n // The default prefix for your bot. Don't worry guilds can change this later.\\n prefix: \\\"!\\\",\\n // This isn't required but you can add bot list api keys here.\\n botListTokens: {\\n DISCORD_BOT_ORG: \\\"\\\",\\n BOTS_ON_DISCORD: \\\"\\\",\\n DISCORD_BOT_LIST: \\\"\\\",\\n BOTS_FOR_DISCORD: \\\"\\\",\\n DISCORD_BOATS: \\\"\\\",\\n DISCORD_BOTS_GG: \\\"\\\",\\n DISCORD_BOTS_GROUP: \\\"\\\",\\n },\\n // This is the server id for your bot's main server where users can get help/support\\n supportServerID: \\\"\\\",\\n // These are channel ids that will enable some functionality\\n channelIDs: {\\n // When a translation is missing this is the channel you will be alerted in.\\n missingTranslation: \\\"\\\",\\n // When an error occurs, we will try and log it to this channel\\n errorChannelID: \\\"\\\"\\n },\\n // These are the role ids that will enable some functionality.\\n roleIDs: {\\n // If you have a patreon set up you can add the patreon vip role id here.\\n patreonVIPRoleID: \\\"\\\",\\n },\\n // These are the user ids that will enable some functionality.\\n userIDs: {\\n // The user ids for the support team\\n botSupporters: [],\\n // The user ids for the other devs on your team\\n botDevs: [],\\n // The user ids who have complete 100% access to your bot\\n botOwners: []\\n }\\n};\\n\\n\")), mdx(\"h4\", null, \"Token\"), mdx(\"p\", null, \"First, add your bot token. This is \", mdx(\"strong\", {\n parentName: \"p\"\n }, \"required\"), \" for the bot to start. Review the \", mdx(\"a\", _extends({\n parentName: \"p\"\n }, {\n \"href\": \"https://discordeno.netlify.app/gettingstarted#creatingyourfirstdiscordbotapplication\"\n }), \"instructions\"), \" if you have not made your token yet.\"), mdx(\"h4\", null, \"Prefix\"), mdx(\"p\", null, \"The prefix is where you will set the default prefix for your bot. Don't worry, every server will be able to choose their own prefix but we need a default prefix to start.\"), mdx(\"h4\", null, \"Bot Lists Tokens\"), mdx(\"p\", null, \"This section of the file is so you can easily have your bot's statistics updated on all the bot lists out there to help you grow your bot. The code is already written to handle this but you will need to do 3 things for each bot list.\"), mdx(\"ol\", null, mdx(\"li\", {\n parentName: \"ol\"\n }, \"Go to the bot list and add your bot to their website. (Each site has it's own instructions)\"), mdx(\"li\", {\n parentName: \"ol\"\n }, \"Create a token for yourself on each website and paste it in your configs.\"), mdx(\"li\", {\n parentName: \"ol\"\n }, \"Enjoy!\")), mdx(\"p\", null, \"If you wish to customize the code, you will find the bot list tasks in the tasks folder. Don't worry we will discuss this when we get to the tasks section of the guide.\"), mdx(\"p\", null, \"For now just remember, that Discordeno provides you a built in way to update most discord bot lists.\"), mdx(\"h4\", null, \"Channel IDs\"), mdx(\"p\", null, \"The channelIDs section holds the useful for specific features to help give you alerts/notifications. For example, the \", mdx(\"inlineCode\", {\n parentName: \"p\"\n }, \"missingTranslation\"), \" channel will be where messages are sent alerting you that somewhere in your code you are trying to use a translation key that you never created.\"), mdx(\"p\", null, \"When you get to around 25,000 Discord servers on your bot, you may want to convert these channel IDs to webhooks.\"), mdx(\"h2\", null, \"It's Alive!\"), mdx(\"p\", null, \"Oh my god! You now have a bot with a bunch of features already! You don't believe me? Well, seeing is believing, so start the bot.\"), mdx(\"ol\", null, mdx(\"li\", {\n parentName: \"ol\"\n }, \"Invite your bot to a discord server.\"), mdx(\"li\", {\n parentName: \"ol\"\n }, \"Open up the integrated terminal in VSC using \", mdx(\"strong\", {\n parentName: \"li\"\n }, \"CTRL + `\"), \". If you use a Mac, replace CTRL with CMD.\"), mdx(\"li\", {\n parentName: \"ol\"\n }, \"Run the script below:\")), mdx(\"pre\", null, mdx(\"code\", _extends({\n parentName: \"pre\"\n }, {\n \"className\": \"language-shell\"\n }), \"deno run --allow-net --allow-read mod.ts\\n\")), mdx(\"p\", null, \"The first time you run it, you may see a lot of files being loaded. This is preparing all the magic behind the scene. Once it is ready, you will see something like this:\"), mdx(\"p\", null, mdx(\"img\", _extends({\n parentName: \"p\"\n }, {\n \"src\": \"https://i.imgur.com/TOXjLgh.png\",\n \"alt\": \"image\"\n }))), mdx(\"h2\", null, \"Understanding What Discordeno Did\"), mdx(\"p\", null, \"Discordeno includes these commands/folders as they are essential for any discord bot to have in order to meet the Discord Bot Best Practices. It also adds a few things that will help make some things easier to build a bot.\"), mdx(\"p\", null, \"We will dive into these deeper in this guide. Let's take it step by step.\"));\n}\n;\nMDXContent.isMDXComponent = true;","rawMDXOutput":"/* @jsx mdx */\nimport { mdx } from '@mdx-js/react';\n/* @jsx mdx */\n\nexport const _frontmatter = {\n \"title\": \"Creating The Bot!\",\n \"metaTitle\": \"Creating A Bot | Discordeno\",\n \"metaDescription\": \"Let's create our very own bot with Discordeno!\"\n};\n\nconst layoutProps = {\n _frontmatter\n};\nconst MDXLayout = \"wrapper\"\nexport default function MDXContent({\n components,\n ...props\n}) {\n return \n

{`Discordeno will help make Discord bot development much easier. Don't worry, as you go through this guide it will make a lot more sense.`}

\n

{`Creating The Bot!`}

\n
\n

{`This guide is going to assume you already have the basic requirements to make a bot ready. This includes github, git, a code editor like Visual Studio Code. If you don't have these yet please prepare them first before going forward.`}

\n
\n
    \n
  • \n

    {`First, create a Discordeno Bot using the `}{`Generator Boilerplate`}{`. Give it any name you like. For the purpose of this guide we will call it, Stargate.`}

    \n
  • \n
  • \n

    {`Then `}{`git clone https://github.com/Skillz4Killz/Stargate.git`}

    \n
  • \n
  • \n

    {`When that is done, go ahead and open up the folder with VSC.`}

    \n
  • \n
  • \n

    {`Create a new file called `}{`configs.ts`}{`. Open the `}{`configs.example.ts`}{` file and copy everything over.`}

    \n
  • \n
\n

{`Let's take a minute to review all the options we have available to us.`}

\n

{`Configs File`}

\n

{`The `}{`configs.ts`}{` file is where you will keep all your secret info you don't want to share with anyone else. As long as `}{`.gitignore`}{` file is ignoring configs.ts your configurations will be kept private!`}

\n
{`// Step 1: Remove the \\`.example\\` from this file name so it is called \\`configs.ts\\`\n// Step 2: Add all your bot's information below. The only required one is token and prefix. NOTE: As long as \\`.gitignore\\` file is ignoring configs.ts your configurations will be kept private!\n// Step 3: Remove these comments if you like.\n\nexport const configs = {\n  // Your bot token goes here\n  token: \"\",\n  // The default prefix for your bot. Don't worry guilds can change this later.\n  prefix: \"!\",\n  // This isn't required but you can add bot list api keys here.\n  botListTokens: {\n    DISCORD_BOT_ORG: \"\",\n    BOTS_ON_DISCORD: \"\",\n    DISCORD_BOT_LIST: \"\",\n    BOTS_FOR_DISCORD: \"\",\n    DISCORD_BOATS: \"\",\n    DISCORD_BOTS_GG: \"\",\n    DISCORD_BOTS_GROUP: \"\",\n  },\n  // This is the server id for your bot's main server where users can get help/support\n  supportServerID: \"\",\n  // These are channel ids that will enable some functionality\n  channelIDs: {\n    // When a translation is missing this is the channel you will be alerted in.\n    missingTranslation: \"\",\n    // When an error occurs, we will try and log it to this channel\n    errorChannelID: \"\"\n  },\n  // These are the role ids that will enable some functionality.\n  roleIDs: {\n    // If you have a patreon set up you can add the patreon vip role id here.\n    patreonVIPRoleID: \"\",\n  },\n  // These are the user ids that will enable some functionality.\n  userIDs: {\n    // The user ids for the support team\n    botSupporters: [],\n    // The user ids for the other devs on your team\n    botDevs: [],\n    // The user ids who have complete 100% access to your bot\n    botOwners: []\n  }\n};\n\n`}
\n

{`Token`}

\n

{`First, add your bot token. This is `}{`required`}{` for the bot to start. Review the `}{`instructions`}{` if you have not made your token yet.`}

\n

{`Prefix`}

\n

{`The prefix is where you will set the default prefix for your bot. Don't worry, every server will be able to choose their own prefix but we need a default prefix to start.`}

\n

{`Bot Lists Tokens`}

\n

{`This section of the file is so you can easily have your bot's statistics updated on all the bot lists out there to help you grow your bot. The code is already written to handle this but you will need to do 3 things for each bot list.`}

\n
    \n
  1. {`Go to the bot list and add your bot to their website. (Each site has it's own instructions)`}
  2. \n
  3. {`Create a token for yourself on each website and paste it in your configs.`}
  4. \n
  5. {`Enjoy!`}
  6. \n
\n

{`If you wish to customize the code, you will find the bot list tasks in the tasks folder. Don't worry we will discuss this when we get to the tasks section of the guide.`}

\n

{`For now just remember, that Discordeno provides you a built in way to update most discord bot lists.`}

\n

{`Channel IDs`}

\n

{`The channelIDs section holds the useful for specific features to help give you alerts/notifications. For example, the `}{`missingTranslation`}{` channel will be where messages are sent alerting you that somewhere in your code you are trying to use a translation key that you never created.`}

\n

{`When you get to around 25,000 Discord servers on your bot, you may want to convert these channel IDs to webhooks.`}

\n

{`It's Alive!`}

\n

{`Oh my god! You now have a bot with a bunch of features already! You don't believe me? Well, seeing is believing, so start the bot.`}

\n
    \n
  1. {`Invite your bot to a discord server.`}
  2. \n
  3. {`Open up the integrated terminal in VSC using `}{`CTRL + \\``}{`. If you use a Mac, replace CTRL with CMD.`}
  4. \n
  5. {`Run the script below:`}
  6. \n
\n
{`deno run --allow-net --allow-read mod.ts\n`}
\n

{`The first time you run it, you may see a lot of files being loaded. This is preparing all the magic behind the scene. Once it is ready, you will see something like this:`}

\n

\n

{`Understanding What Discordeno Did`}

\n

{`Discordeno includes these commands/folders as they are essential for any discord bot to have in order to meet the Discord Bot Best Practices. It also adds a few things that will help make some things easier to build a bot.`}

\n

{`We will dive into these deeper in this guide. Let's take it step by step.`}

\n\n
;\n}\n\n;\nMDXContent.isMDXComponent = true;"}} \ No newline at end of file diff --git a/docs/.cache/caches/gatsby-plugin-mdx/diskstore-f511d4e6b40f6576d3ec7af00a09f74c.json b/docs/.cache/caches/gatsby-plugin-mdx/diskstore-f511d4e6b40f6576d3ec7af00a09f74c.json new file mode 100644 index 000000000..cee353f5e --- /dev/null +++ b/docs/.cache/caches/gatsby-plugin-mdx/diskstore-f511d4e6b40f6576d3ec7af00a09f74c.json @@ -0,0 +1 @@ +{"expireTime":9007200851644251000,"key":"gatsby-plugin-mdx-entire-payload-205b4d91f58f747c4e1dc3b2ad40c752-","val":{"mdast":{"type":"root","children":[{"type":"paragraph","children":[{"type":"text","value":"Discordeno will help make Discord bot development much easier. Don't worry, as you go through this guide it will make a lot more sense.","position":{"start":{"line":2,"column":1,"offset":1},"end":{"line":2,"column":136,"offset":136},"indent":[]}}],"position":{"start":{"line":2,"column":1,"offset":1},"end":{"line":2,"column":136,"offset":136},"indent":[]}},{"type":"heading","depth":2,"children":[{"type":"text","value":"Creating The Bot!","position":{"start":{"line":4,"column":4,"offset":141},"end":{"line":4,"column":21,"offset":158},"indent":[]}}],"position":{"start":{"line":4,"column":1,"offset":138},"end":{"line":4,"column":21,"offset":158},"indent":[]}},{"type":"blockquote","children":[{"type":"paragraph","children":[{"type":"text","value":"This guide is going to assume you already have the basic requirements to make a bot ready. This includes github, git, a code editor like Visual Studio Code. If you don't have these yet please prepare them first before going forward.","position":{"start":{"line":6,"column":3,"offset":162},"end":{"line":6,"column":235,"offset":394},"indent":[]}}],"position":{"start":{"line":6,"column":3,"offset":162},"end":{"line":6,"column":235,"offset":394},"indent":[]}}],"position":{"start":{"line":6,"column":1,"offset":160},"end":{"line":6,"column":235,"offset":394},"indent":[]}},{"type":"list","ordered":false,"start":null,"spread":true,"children":[{"type":"listItem","spread":false,"checked":null,"children":[{"type":"paragraph","children":[{"type":"text","value":"First, create a Discordeno Bot using the ","position":{"start":{"line":8,"column":3,"offset":398},"end":{"line":8,"column":44,"offset":439},"indent":[]}},{"type":"link","title":null,"url":"https://github.com/Skillz4Killz/Discordeno-bot-template","children":[{"type":"text","value":"Generator Boilerplate","position":{"start":{"line":8,"column":45,"offset":440},"end":{"line":8,"column":66,"offset":461},"indent":[]}}],"position":{"start":{"line":8,"column":44,"offset":439},"end":{"line":8,"column":124,"offset":519},"indent":[]}},{"type":"text","value":". Give it any name you like. For the purpose of this guide we will call it, Stargate.","position":{"start":{"line":8,"column":124,"offset":519},"end":{"line":8,"column":209,"offset":604},"indent":[]}}],"position":{"start":{"line":8,"column":3,"offset":398},"end":{"line":8,"column":209,"offset":604},"indent":[]}}],"position":{"start":{"line":8,"column":1,"offset":396},"end":{"line":9,"column":1,"offset":605},"indent":[1]}},{"type":"listItem","spread":false,"checked":null,"children":[{"type":"paragraph","children":[{"type":"text","value":"Then ","position":{"start":{"line":10,"column":3,"offset":608},"end":{"line":10,"column":8,"offset":613},"indent":[]}},{"type":"inlineCode","value":"git clone https://github.com/Skillz4Killz/Stargate.git","position":{"start":{"line":10,"column":8,"offset":613},"end":{"line":10,"column":64,"offset":669},"indent":[]}}],"position":{"start":{"line":10,"column":3,"offset":608},"end":{"line":10,"column":64,"offset":669},"indent":[]}}],"position":{"start":{"line":10,"column":1,"offset":606},"end":{"line":11,"column":1,"offset":670},"indent":[1]}},{"type":"listItem","spread":false,"checked":null,"children":[{"type":"paragraph","children":[{"type":"text","value":"When that is done, go ahead and open up the folder with VSC.","position":{"start":{"line":12,"column":3,"offset":673},"end":{"line":12,"column":63,"offset":733},"indent":[]}}],"position":{"start":{"line":12,"column":3,"offset":673},"end":{"line":12,"column":63,"offset":733},"indent":[]}}],"position":{"start":{"line":12,"column":1,"offset":671},"end":{"line":12,"column":63,"offset":733},"indent":[]}},{"type":"listItem","spread":false,"checked":null,"children":[{"type":"paragraph","children":[{"type":"text","value":"Create a new file called ","position":{"start":{"line":13,"column":3,"offset":736},"end":{"line":13,"column":28,"offset":761},"indent":[]}},{"type":"inlineCode","value":"configs.ts","position":{"start":{"line":13,"column":28,"offset":761},"end":{"line":13,"column":40,"offset":773},"indent":[]}},{"type":"text","value":". Open the ","position":{"start":{"line":13,"column":40,"offset":773},"end":{"line":13,"column":51,"offset":784},"indent":[]}},{"type":"inlineCode","value":"configs.example.ts","position":{"start":{"line":13,"column":51,"offset":784},"end":{"line":13,"column":71,"offset":804},"indent":[]}},{"type":"text","value":" file and copy everything over.","position":{"start":{"line":13,"column":71,"offset":804},"end":{"line":13,"column":102,"offset":835},"indent":[]}}],"position":{"start":{"line":13,"column":3,"offset":736},"end":{"line":13,"column":102,"offset":835},"indent":[]}}],"position":{"start":{"line":13,"column":1,"offset":734},"end":{"line":13,"column":102,"offset":835},"indent":[]}}],"position":{"start":{"line":8,"column":1,"offset":396},"end":{"line":13,"column":102,"offset":835},"indent":[1,1,1,1,1]}},{"type":"paragraph","children":[{"type":"text","value":"Let's take a minute to review all the options we have available to us.","position":{"start":{"line":15,"column":1,"offset":837},"end":{"line":15,"column":71,"offset":907},"indent":[]}}],"position":{"start":{"line":15,"column":1,"offset":837},"end":{"line":15,"column":71,"offset":907},"indent":[]}},{"type":"heading","depth":3,"children":[{"type":"text","value":"Configs File","position":{"start":{"line":17,"column":5,"offset":913},"end":{"line":17,"column":17,"offset":925},"indent":[]}}],"position":{"start":{"line":17,"column":1,"offset":909},"end":{"line":17,"column":17,"offset":925},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"The ","position":{"start":{"line":19,"column":1,"offset":927},"end":{"line":19,"column":5,"offset":931},"indent":[]}},{"type":"inlineCode","value":"configs.ts","position":{"start":{"line":19,"column":5,"offset":931},"end":{"line":19,"column":17,"offset":943},"indent":[]}},{"type":"text","value":" file is where you will keep all your secret info you don't want to share with anyone else. As long as ","position":{"start":{"line":19,"column":17,"offset":943},"end":{"line":19,"column":120,"offset":1046},"indent":[]}},{"type":"inlineCode","value":".gitignore","position":{"start":{"line":19,"column":120,"offset":1046},"end":{"line":19,"column":132,"offset":1058},"indent":[]}},{"type":"text","value":" file is ignoring configs.ts your configurations will be kept private!","position":{"start":{"line":19,"column":132,"offset":1058},"end":{"line":19,"column":202,"offset":1128},"indent":[]}}],"position":{"start":{"line":19,"column":1,"offset":927},"end":{"line":19,"column":202,"offset":1128},"indent":[]}},{"type":"code","lang":"ts","meta":null,"value":"// Step 1: Remove the `.example` from this file name so it is called `configs.ts`\n// Step 2: Add all your bot's information below. The only required one is token and prefix. NOTE: As long as `.gitignore` file is ignoring configs.ts your configurations will be kept private!\n// Step 3: Remove these comments if you like.\n\nexport const configs = {\n // Your bot token goes here\n token: \"\",\n // The default prefix for your bot. Don't worry guilds can change this later.\n prefix: \"!\",\n // This isn't required but you can add bot list api keys here.\n botListTokens: {\n DISCORD_BOT_ORG: \"\",\n BOTS_ON_DISCORD: \"\",\n DISCORD_BOT_LIST: \"\",\n BOTS_FOR_DISCORD: \"\",\n DISCORD_BOATS: \"\",\n DISCORD_BOTS_GG: \"\",\n DISCORD_BOTS_GROUP: \"\",\n },\n // This is the server id for your bot's main server where users can get help/support\n supportServerID: \"\",\n // These are channel ids that will enable some functionality\n channelIDs: {\n // When a translation is missing this is the channel you will be alerted in.\n missingTranslation: \"\",\n // When an error occurs, we will try and log it to this channel\n errorChannelID: \"\"\n },\n // These are the role ids that will enable some functionality.\n roleIDs: {\n // If you have a patreon set up you can add the patreon vip role id here.\n patreonVIPRoleID: \"\",\n },\n // These are the user ids that will enable some functionality.\n userIDs: {\n // The user ids for the support team\n botSupporters: [],\n // The user ids for the other devs on your team\n botDevs: [],\n // The user ids who have complete 100% access to your bot\n botOwners: []\n }\n};\n","position":{"start":{"line":21,"column":1,"offset":1130},"end":{"line":66,"column":4,"offset":2770},"indent":[1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1]}},{"type":"heading","depth":4,"children":[{"type":"text","value":"Token","position":{"start":{"line":68,"column":6,"offset":2777},"end":{"line":68,"column":11,"offset":2782},"indent":[]}}],"position":{"start":{"line":68,"column":1,"offset":2772},"end":{"line":68,"column":11,"offset":2782},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"First, add your bot token. This is ","position":{"start":{"line":70,"column":1,"offset":2784},"end":{"line":70,"column":36,"offset":2819},"indent":[]}},{"type":"strong","children":[{"type":"text","value":"required","position":{"start":{"line":70,"column":38,"offset":2821},"end":{"line":70,"column":46,"offset":2829},"indent":[]}}],"position":{"start":{"line":70,"column":36,"offset":2819},"end":{"line":70,"column":48,"offset":2831},"indent":[]}},{"type":"text","value":" for the bot to start. Review the ","position":{"start":{"line":70,"column":48,"offset":2831},"end":{"line":70,"column":82,"offset":2865},"indent":[]}},{"type":"link","title":null,"url":"https://discordeno.netlify.app/gettingstarted#creatingyourfirstdiscordbotapplication","children":[{"type":"text","value":"instructions","position":{"start":{"line":70,"column":83,"offset":2866},"end":{"line":70,"column":95,"offset":2878},"indent":[]}}],"position":{"start":{"line":70,"column":82,"offset":2865},"end":{"line":70,"column":182,"offset":2965},"indent":[]}},{"type":"text","value":" if you have not made your token yet.","position":{"start":{"line":70,"column":182,"offset":2965},"end":{"line":70,"column":219,"offset":3002},"indent":[]}}],"position":{"start":{"line":70,"column":1,"offset":2784},"end":{"line":70,"column":219,"offset":3002},"indent":[]}},{"type":"heading","depth":4,"children":[{"type":"text","value":"Prefix","position":{"start":{"line":72,"column":6,"offset":3009},"end":{"line":72,"column":12,"offset":3015},"indent":[]}}],"position":{"start":{"line":72,"column":1,"offset":3004},"end":{"line":72,"column":12,"offset":3015},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"The prefix is where you will set the default prefix for your bot. Don't worry, every server will be able to choose their own prefix but we need a default prefix to start.","position":{"start":{"line":74,"column":1,"offset":3017},"end":{"line":74,"column":171,"offset":3187},"indent":[]}}],"position":{"start":{"line":74,"column":1,"offset":3017},"end":{"line":74,"column":171,"offset":3187},"indent":[]}},{"type":"heading","depth":4,"children":[{"type":"text","value":"Bot Lists Tokens","position":{"start":{"line":76,"column":6,"offset":3194},"end":{"line":76,"column":22,"offset":3210},"indent":[]}}],"position":{"start":{"line":76,"column":1,"offset":3189},"end":{"line":76,"column":22,"offset":3210},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"This section of the file is so you can easily have your bot's statistics updated on all the bot lists out there to help you grow your bot. The code is already written to handle this but you will need to do 3 things for each bot list.","position":{"start":{"line":78,"column":1,"offset":3212},"end":{"line":78,"column":234,"offset":3445},"indent":[]}}],"position":{"start":{"line":78,"column":1,"offset":3212},"end":{"line":78,"column":234,"offset":3445},"indent":[]}},{"type":"list","ordered":true,"start":1,"spread":false,"children":[{"type":"listItem","spread":false,"checked":null,"children":[{"type":"paragraph","children":[{"type":"text","value":"Go to the bot list and add your bot to their website. (Each site has it's own instructions)","position":{"start":{"line":80,"column":4,"offset":3450},"end":{"line":80,"column":95,"offset":3541},"indent":[]}}],"position":{"start":{"line":80,"column":4,"offset":3450},"end":{"line":80,"column":95,"offset":3541},"indent":[]}}],"position":{"start":{"line":80,"column":1,"offset":3447},"end":{"line":80,"column":95,"offset":3541},"indent":[]}},{"type":"listItem","spread":false,"checked":null,"children":[{"type":"paragraph","children":[{"type":"text","value":"Create a token for yourself on each website and paste it in your configs.","position":{"start":{"line":81,"column":4,"offset":3545},"end":{"line":81,"column":77,"offset":3618},"indent":[]}}],"position":{"start":{"line":81,"column":4,"offset":3545},"end":{"line":81,"column":77,"offset":3618},"indent":[]}}],"position":{"start":{"line":81,"column":1,"offset":3542},"end":{"line":81,"column":77,"offset":3618},"indent":[]}},{"type":"listItem","spread":false,"checked":null,"children":[{"type":"paragraph","children":[{"type":"text","value":"Enjoy!","position":{"start":{"line":82,"column":4,"offset":3622},"end":{"line":82,"column":10,"offset":3628},"indent":[]}}],"position":{"start":{"line":82,"column":4,"offset":3622},"end":{"line":82,"column":10,"offset":3628},"indent":[]}}],"position":{"start":{"line":82,"column":1,"offset":3619},"end":{"line":82,"column":10,"offset":3628},"indent":[]}}],"position":{"start":{"line":80,"column":1,"offset":3447},"end":{"line":82,"column":10,"offset":3628},"indent":[1,1]}},{"type":"paragraph","children":[{"type":"text","value":"If you wish to customize the code, you will find the bot list tasks in the tasks folder. Don't worry we will discuss this when we get to the tasks section of the guide.","position":{"start":{"line":84,"column":1,"offset":3630},"end":{"line":84,"column":169,"offset":3798},"indent":[]}}],"position":{"start":{"line":84,"column":1,"offset":3630},"end":{"line":84,"column":169,"offset":3798},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"For now just remember, that Discordeno provides you a built in way to update most discord bot lists.","position":{"start":{"line":86,"column":1,"offset":3800},"end":{"line":86,"column":101,"offset":3900},"indent":[]}}],"position":{"start":{"line":86,"column":1,"offset":3800},"end":{"line":86,"column":101,"offset":3900},"indent":[]}},{"type":"heading","depth":4,"children":[{"type":"text","value":"Channel IDs","position":{"start":{"line":88,"column":6,"offset":3907},"end":{"line":88,"column":17,"offset":3918},"indent":[]}}],"position":{"start":{"line":88,"column":1,"offset":3902},"end":{"line":88,"column":17,"offset":3918},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"The channelIDs section holds the channel IDs that are useful for specific features to help give you alerts/notifications. For example, the ","position":{"start":{"line":90,"column":1,"offset":3920},"end":{"line":90,"column":140,"offset":4059},"indent":[]}},{"type":"inlineCode","value":"missingTranslation","position":{"start":{"line":90,"column":140,"offset":4059},"end":{"line":90,"column":160,"offset":4079},"indent":[]}},{"type":"text","value":" channel will be where messages are sent alerting you that somewhere in your code you are trying to use a translation key that you never created.","position":{"start":{"line":90,"column":160,"offset":4079},"end":{"line":90,"column":305,"offset":4224},"indent":[]}}],"position":{"start":{"line":90,"column":1,"offset":3920},"end":{"line":90,"column":305,"offset":4224},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"When you get to around 25,000 Discord servers on your bot, you may want to convert these channel IDs to webhooks.","position":{"start":{"line":92,"column":1,"offset":4226},"end":{"line":92,"column":114,"offset":4339},"indent":[]}}],"position":{"start":{"line":92,"column":1,"offset":4226},"end":{"line":92,"column":114,"offset":4339},"indent":[]}},{"type":"heading","depth":4,"children":[{"type":"text","value":"Role IDs","position":{"start":{"line":94,"column":6,"offset":4346},"end":{"line":94,"column":14,"offset":4354},"indent":[]}}],"position":{"start":{"line":94,"column":1,"offset":4341},"end":{"line":94,"column":14,"offset":4354},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"The roleIDs section holds the role IDs that are useful for specific features. For example, the ","position":{"start":{"line":96,"column":1,"offset":4356},"end":{"line":96,"column":96,"offset":4451},"indent":[]}},{"type":"inlineCode","value":"patreonVIPRoleID","position":{"start":{"line":96,"column":96,"offset":4451},"end":{"line":96,"column":114,"offset":4469},"indent":[]}},{"type":"text","value":" role can be used easily to enable vip features later in this guide.","position":{"start":{"line":96,"column":114,"offset":4469},"end":{"line":96,"column":182,"offset":4537},"indent":[]}}],"position":{"start":{"line":96,"column":1,"offset":4356},"end":{"line":96,"column":182,"offset":4537},"indent":[]}},{"type":"heading","depth":4,"children":[{"type":"text","value":"User IDs","position":{"start":{"line":98,"column":6,"offset":4544},"end":{"line":98,"column":14,"offset":4552},"indent":[]}}],"position":{"start":{"line":98,"column":1,"offset":4539},"end":{"line":98,"column":14,"offset":4552},"indent":[]}},{"type":"heading","depth":2,"children":[{"type":"text","value":"It's Alive!","position":{"start":{"line":102,"column":4,"offset":4559},"end":{"line":102,"column":15,"offset":4570},"indent":[]}}],"position":{"start":{"line":102,"column":1,"offset":4556},"end":{"line":102,"column":15,"offset":4570},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"Oh my god! You now have a bot with a bunch of features already! You don't believe me? Well, seeing is believing, so start the bot.","position":{"start":{"line":104,"column":1,"offset":4572},"end":{"line":104,"column":131,"offset":4702},"indent":[]}}],"position":{"start":{"line":104,"column":1,"offset":4572},"end":{"line":104,"column":131,"offset":4702},"indent":[]}},{"type":"list","ordered":true,"start":1,"spread":false,"children":[{"type":"listItem","spread":false,"checked":null,"children":[{"type":"paragraph","children":[{"type":"text","value":"Invite your bot to a discord server.","position":{"start":{"line":106,"column":4,"offset":4707},"end":{"line":106,"column":40,"offset":4743},"indent":[]}}],"position":{"start":{"line":106,"column":4,"offset":4707},"end":{"line":106,"column":40,"offset":4743},"indent":[]}}],"position":{"start":{"line":106,"column":1,"offset":4704},"end":{"line":106,"column":40,"offset":4743},"indent":[]}},{"type":"listItem","spread":false,"checked":null,"children":[{"type":"paragraph","children":[{"type":"text","value":"Open up the integrated terminal in VSC using ","position":{"start":{"line":107,"column":4,"offset":4747},"end":{"line":107,"column":49,"offset":4792},"indent":[]}},{"type":"strong","children":[{"type":"text","value":"CTRL + `","position":{"start":{"line":107,"column":51,"offset":4794},"end":{"line":107,"column":59,"offset":4802},"indent":[]}}],"position":{"start":{"line":107,"column":49,"offset":4792},"end":{"line":107,"column":61,"offset":4804},"indent":[]}},{"type":"text","value":". If you use a Mac, replace CTRL with CMD.","position":{"start":{"line":107,"column":61,"offset":4804},"end":{"line":107,"column":103,"offset":4846},"indent":[]}}],"position":{"start":{"line":107,"column":4,"offset":4747},"end":{"line":107,"column":103,"offset":4846},"indent":[]}}],"position":{"start":{"line":107,"column":1,"offset":4744},"end":{"line":107,"column":103,"offset":4846},"indent":[]}},{"type":"listItem","spread":false,"checked":null,"children":[{"type":"paragraph","children":[{"type":"text","value":"Run the script below:","position":{"start":{"line":108,"column":4,"offset":4850},"end":{"line":108,"column":25,"offset":4871},"indent":[]}}],"position":{"start":{"line":108,"column":4,"offset":4850},"end":{"line":108,"column":25,"offset":4871},"indent":[]}}],"position":{"start":{"line":108,"column":1,"offset":4847},"end":{"line":108,"column":25,"offset":4871},"indent":[]}}],"position":{"start":{"line":106,"column":1,"offset":4704},"end":{"line":108,"column":25,"offset":4871},"indent":[1,1]}},{"type":"code","lang":"shell","meta":null,"value":"deno run --allow-net --allow-read mod.ts","position":{"start":{"line":110,"column":1,"offset":4873},"end":{"line":112,"column":4,"offset":4926},"indent":[1,1]}},{"type":"paragraph","children":[{"type":"text","value":"The first time you run it, you may see a lot of files being loaded. This is preparing all the magic behind the scene. Once it is ready, you will see something like this:","position":{"start":{"line":114,"column":1,"offset":4928},"end":{"line":114,"column":170,"offset":5097},"indent":[]}}],"position":{"start":{"line":114,"column":1,"offset":4928},"end":{"line":114,"column":170,"offset":5097},"indent":[]}},{"type":"paragraph","children":[{"type":"image","title":null,"url":"https://i.imgur.com/TOXjLgh.png","alt":"image","position":{"start":{"line":116,"column":1,"offset":5099},"end":{"line":116,"column":42,"offset":5140},"indent":[]}}],"position":{"start":{"line":116,"column":1,"offset":5099},"end":{"line":116,"column":42,"offset":5140},"indent":[]}},{"type":"heading","depth":2,"children":[{"type":"text","value":"Understanding What Discordeno Did","position":{"start":{"line":118,"column":4,"offset":5145},"end":{"line":118,"column":37,"offset":5178},"indent":[]}}],"position":{"start":{"line":118,"column":1,"offset":5142},"end":{"line":118,"column":37,"offset":5178},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"Discordeno includes these commands/folders as they are essential for any discord bot to have in order to meet the Discord Bot Best Practices. It also adds a few things that will help make some things easier to build a bot.","position":{"start":{"line":120,"column":1,"offset":5180},"end":{"line":120,"column":223,"offset":5402},"indent":[]}}],"position":{"start":{"line":120,"column":1,"offset":5180},"end":{"line":120,"column":223,"offset":5402},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"We will dive into these deeper in this guide. Let's take it step by step.","position":{"start":{"line":122,"column":1,"offset":5404},"end":{"line":122,"column":74,"offset":5477},"indent":[]}}],"position":{"start":{"line":122,"column":1,"offset":5404},"end":{"line":122,"column":74,"offset":5477},"indent":[]}},{"type":"export","value":"export const _frontmatter = {\"title\":\"Creating The Bot!\",\"metaTitle\":\"Creating A Bot | Discordeno\",\"metaDescription\":\"Let's create our very own bot with Discordeno!\"}","position":{"start":{"line":125,"column":1,"offset":5480},"end":{"line":125,"column":167,"offset":5646},"indent":[]}}],"position":{"start":{"line":1,"column":1,"offset":0},"end":{"line":125,"column":167,"offset":5646}}},"scopeImports":["import * as React from 'react'"],"scopeIdentifiers":["React"],"body":"function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }\n\nfunction _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }\n\nfunction _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }\n\n/* @jsx mdx */\nvar _frontmatter = {\n \"title\": \"Creating The Bot!\",\n \"metaTitle\": \"Creating A Bot | Discordeno\",\n \"metaDescription\": \"Let's create our very own bot with Discordeno!\"\n};\nvar layoutProps = {\n _frontmatter: _frontmatter\n};\nvar MDXLayout = \"wrapper\";\nreturn function MDXContent(_ref) {\n var components = _ref.components,\n props = _objectWithoutProperties(_ref, [\"components\"]);\n\n return mdx(MDXLayout, _extends({}, layoutProps, props, {\n components: components,\n mdxType: \"MDXLayout\"\n }), mdx(\"p\", null, \"Discordeno will help make Discord bot development much easier. Don't worry, as you go through this guide it will make a lot more sense.\"), mdx(\"h2\", null, \"Creating The Bot!\"), mdx(\"blockquote\", null, mdx(\"p\", {\n parentName: \"blockquote\"\n }, \"This guide is going to assume you already have the basic requirements to make a bot ready. This includes github, git, a code editor like Visual Studio Code. If you don't have these yet please prepare them first before going forward.\")), mdx(\"ul\", null, mdx(\"li\", {\n parentName: \"ul\"\n }, mdx(\"p\", {\n parentName: \"li\"\n }, \"First, create a Discordeno Bot using the \", mdx(\"a\", _extends({\n parentName: \"p\"\n }, {\n \"href\": \"https://github.com/Skillz4Killz/Discordeno-bot-template\"\n }), \"Generator Boilerplate\"), \". Give it any name you like. For the purpose of this guide we will call it, Stargate.\")), mdx(\"li\", {\n parentName: \"ul\"\n }, mdx(\"p\", {\n parentName: \"li\"\n }, \"Then \", mdx(\"inlineCode\", {\n parentName: \"p\"\n }, \"git clone https://github.com/Skillz4Killz/Stargate.git\"))), mdx(\"li\", {\n parentName: \"ul\"\n }, mdx(\"p\", {\n parentName: \"li\"\n }, \"When that is done, go ahead and open up the folder with VSC.\")), mdx(\"li\", {\n parentName: \"ul\"\n }, mdx(\"p\", {\n parentName: \"li\"\n }, \"Create a new file called \", mdx(\"inlineCode\", {\n parentName: \"p\"\n }, \"configs.ts\"), \". Open the \", mdx(\"inlineCode\", {\n parentName: \"p\"\n }, \"configs.example.ts\"), \" file and copy everything over.\"))), mdx(\"p\", null, \"Let's take a minute to review all the options we have available to us.\"), mdx(\"h3\", null, \"Configs File\"), mdx(\"p\", null, \"The \", mdx(\"inlineCode\", {\n parentName: \"p\"\n }, \"configs.ts\"), \" file is where you will keep all your secret info you don't want to share with anyone else. As long as \", mdx(\"inlineCode\", {\n parentName: \"p\"\n }, \".gitignore\"), \" file is ignoring configs.ts your configurations will be kept private!\"), mdx(\"pre\", null, mdx(\"code\", _extends({\n parentName: \"pre\"\n }, {\n \"className\": \"language-ts\"\n }), \"// Step 1: Remove the `.example` from this file name so it is called `configs.ts`\\n// Step 2: Add all your bot's information below. The only required one is token and prefix. NOTE: As long as `.gitignore` file is ignoring configs.ts your configurations will be kept private!\\n// Step 3: Remove these comments if you like.\\n\\nexport const configs = {\\n // Your bot token goes here\\n token: \\\"\\\",\\n // The default prefix for your bot. Don't worry guilds can change this later.\\n prefix: \\\"!\\\",\\n // This isn't required but you can add bot list api keys here.\\n botListTokens: {\\n DISCORD_BOT_ORG: \\\"\\\",\\n BOTS_ON_DISCORD: \\\"\\\",\\n DISCORD_BOT_LIST: \\\"\\\",\\n BOTS_FOR_DISCORD: \\\"\\\",\\n DISCORD_BOATS: \\\"\\\",\\n DISCORD_BOTS_GG: \\\"\\\",\\n DISCORD_BOTS_GROUP: \\\"\\\",\\n },\\n // This is the server id for your bot's main server where users can get help/support\\n supportServerID: \\\"\\\",\\n // These are channel ids that will enable some functionality\\n channelIDs: {\\n // When a translation is missing this is the channel you will be alerted in.\\n missingTranslation: \\\"\\\",\\n // When an error occurs, we will try and log it to this channel\\n errorChannelID: \\\"\\\"\\n },\\n // These are the role ids that will enable some functionality.\\n roleIDs: {\\n // If you have a patreon set up you can add the patreon vip role id here.\\n patreonVIPRoleID: \\\"\\\",\\n },\\n // These are the user ids that will enable some functionality.\\n userIDs: {\\n // The user ids for the support team\\n botSupporters: [],\\n // The user ids for the other devs on your team\\n botDevs: [],\\n // The user ids who have complete 100% access to your bot\\n botOwners: []\\n }\\n};\\n\\n\")), mdx(\"h4\", null, \"Token\"), mdx(\"p\", null, \"First, add your bot token. This is \", mdx(\"strong\", {\n parentName: \"p\"\n }, \"required\"), \" for the bot to start. Review the \", mdx(\"a\", _extends({\n parentName: \"p\"\n }, {\n \"href\": \"https://discordeno.netlify.app/gettingstarted#creatingyourfirstdiscordbotapplication\"\n }), \"instructions\"), \" if you have not made your token yet.\"), mdx(\"h4\", null, \"Prefix\"), mdx(\"p\", null, \"The prefix is where you will set the default prefix for your bot. Don't worry, every server will be able to choose their own prefix but we need a default prefix to start.\"), mdx(\"h4\", null, \"Bot Lists Tokens\"), mdx(\"p\", null, \"This section of the file is so you can easily have your bot's statistics updated on all the bot lists out there to help you grow your bot. The code is already written to handle this but you will need to do 3 things for each bot list.\"), mdx(\"ol\", null, mdx(\"li\", {\n parentName: \"ol\"\n }, \"Go to the bot list and add your bot to their website. (Each site has it's own instructions)\"), mdx(\"li\", {\n parentName: \"ol\"\n }, \"Create a token for yourself on each website and paste it in your configs.\"), mdx(\"li\", {\n parentName: \"ol\"\n }, \"Enjoy!\")), mdx(\"p\", null, \"If you wish to customize the code, you will find the bot list tasks in the tasks folder. Don't worry we will discuss this when we get to the tasks section of the guide.\"), mdx(\"p\", null, \"For now just remember, that Discordeno provides you a built in way to update most discord bot lists.\"), mdx(\"h4\", null, \"Channel IDs\"), mdx(\"p\", null, \"The channelIDs section holds the channel IDs that are useful for specific features to help give you alerts/notifications. For example, the \", mdx(\"inlineCode\", {\n parentName: \"p\"\n }, \"missingTranslation\"), \" channel will be where messages are sent alerting you that somewhere in your code you are trying to use a translation key that you never created.\"), mdx(\"p\", null, \"When you get to around 25,000 Discord servers on your bot, you may want to convert these channel IDs to webhooks.\"), mdx(\"h4\", null, \"Role IDs\"), mdx(\"p\", null, \"The roleIDs section holds the role IDs that are useful for specific features. For example, the \", mdx(\"inlineCode\", {\n parentName: \"p\"\n }, \"patreonVIPRoleID\"), \" role can be used easily to enable vip features later in this guide.\"), mdx(\"h4\", null, \"User IDs\"), mdx(\"h2\", null, \"It's Alive!\"), mdx(\"p\", null, \"Oh my god! You now have a bot with a bunch of features already! You don't believe me? Well, seeing is believing, so start the bot.\"), mdx(\"ol\", null, mdx(\"li\", {\n parentName: \"ol\"\n }, \"Invite your bot to a discord server.\"), mdx(\"li\", {\n parentName: \"ol\"\n }, \"Open up the integrated terminal in VSC using \", mdx(\"strong\", {\n parentName: \"li\"\n }, \"CTRL + `\"), \". If you use a Mac, replace CTRL with CMD.\"), mdx(\"li\", {\n parentName: \"ol\"\n }, \"Run the script below:\")), mdx(\"pre\", null, mdx(\"code\", _extends({\n parentName: \"pre\"\n }, {\n \"className\": \"language-shell\"\n }), \"deno run --allow-net --allow-read mod.ts\\n\")), mdx(\"p\", null, \"The first time you run it, you may see a lot of files being loaded. This is preparing all the magic behind the scene. Once it is ready, you will see something like this:\"), mdx(\"p\", null, mdx(\"img\", _extends({\n parentName: \"p\"\n }, {\n \"src\": \"https://i.imgur.com/TOXjLgh.png\",\n \"alt\": \"image\"\n }))), mdx(\"h2\", null, \"Understanding What Discordeno Did\"), mdx(\"p\", null, \"Discordeno includes these commands/folders as they are essential for any discord bot to have in order to meet the Discord Bot Best Practices. It also adds a few things that will help make some things easier to build a bot.\"), mdx(\"p\", null, \"We will dive into these deeper in this guide. Let's take it step by step.\"));\n}\n;\nMDXContent.isMDXComponent = true;","rawMDXOutput":"/* @jsx mdx */\nimport { mdx } from '@mdx-js/react';\n/* @jsx mdx */\n\nexport const _frontmatter = {\n \"title\": \"Creating The Bot!\",\n \"metaTitle\": \"Creating A Bot | Discordeno\",\n \"metaDescription\": \"Let's create our very own bot with Discordeno!\"\n};\n\nconst layoutProps = {\n _frontmatter\n};\nconst MDXLayout = \"wrapper\"\nexport default function MDXContent({\n components,\n ...props\n}) {\n return \n

{`Discordeno will help make Discord bot development much easier. Don't worry, as you go through this guide it will make a lot more sense.`}

\n

{`Creating The Bot!`}

\n
\n

{`This guide is going to assume you already have the basic requirements to make a bot ready. This includes github, git, a code editor like Visual Studio Code. If you don't have these yet please prepare them first before going forward.`}

\n
\n
    \n
  • \n

    {`First, create a Discordeno Bot using the `}{`Generator Boilerplate`}{`. Give it any name you like. For the purpose of this guide we will call it, Stargate.`}

    \n
  • \n
  • \n

    {`Then `}{`git clone https://github.com/Skillz4Killz/Stargate.git`}

    \n
  • \n
  • \n

    {`When that is done, go ahead and open up the folder with VSC.`}

    \n
  • \n
  • \n

    {`Create a new file called `}{`configs.ts`}{`. Open the `}{`configs.example.ts`}{` file and copy everything over.`}

    \n
  • \n
\n

{`Let's take a minute to review all the options we have available to us.`}

\n

{`Configs File`}

\n

{`The `}{`configs.ts`}{` file is where you will keep all your secret info you don't want to share with anyone else. As long as `}{`.gitignore`}{` file is ignoring configs.ts your configurations will be kept private!`}

\n
{`// Step 1: Remove the \\`.example\\` from this file name so it is called \\`configs.ts\\`\n// Step 2: Add all your bot's information below. The only required one is token and prefix. NOTE: As long as \\`.gitignore\\` file is ignoring configs.ts your configurations will be kept private!\n// Step 3: Remove these comments if you like.\n\nexport const configs = {\n  // Your bot token goes here\n  token: \"\",\n  // The default prefix for your bot. Don't worry guilds can change this later.\n  prefix: \"!\",\n  // This isn't required but you can add bot list api keys here.\n  botListTokens: {\n    DISCORD_BOT_ORG: \"\",\n    BOTS_ON_DISCORD: \"\",\n    DISCORD_BOT_LIST: \"\",\n    BOTS_FOR_DISCORD: \"\",\n    DISCORD_BOATS: \"\",\n    DISCORD_BOTS_GG: \"\",\n    DISCORD_BOTS_GROUP: \"\",\n  },\n  // This is the server id for your bot's main server where users can get help/support\n  supportServerID: \"\",\n  // These are channel ids that will enable some functionality\n  channelIDs: {\n    // When a translation is missing this is the channel you will be alerted in.\n    missingTranslation: \"\",\n    // When an error occurs, we will try and log it to this channel\n    errorChannelID: \"\"\n  },\n  // These are the role ids that will enable some functionality.\n  roleIDs: {\n    // If you have a patreon set up you can add the patreon vip role id here.\n    patreonVIPRoleID: \"\",\n  },\n  // These are the user ids that will enable some functionality.\n  userIDs: {\n    // The user ids for the support team\n    botSupporters: [],\n    // The user ids for the other devs on your team\n    botDevs: [],\n    // The user ids who have complete 100% access to your bot\n    botOwners: []\n  }\n};\n\n`}
\n

{`Token`}

\n

{`First, add your bot token. This is `}{`required`}{` for the bot to start. Review the `}{`instructions`}{` if you have not made your token yet.`}

\n

{`Prefix`}

\n

{`The prefix is where you will set the default prefix for your bot. Don't worry, every server will be able to choose their own prefix but we need a default prefix to start.`}

\n

{`Bot Lists Tokens`}

\n

{`This section of the file is so you can easily have your bot's statistics updated on all the bot lists out there to help you grow your bot. The code is already written to handle this but you will need to do 3 things for each bot list.`}

\n
    \n
  1. {`Go to the bot list and add your bot to their website. (Each site has it's own instructions)`}
  2. \n
  3. {`Create a token for yourself on each website and paste it in your configs.`}
  4. \n
  5. {`Enjoy!`}
  6. \n
\n

{`If you wish to customize the code, you will find the bot list tasks in the tasks folder. Don't worry we will discuss this when we get to the tasks section of the guide.`}

\n

{`For now just remember, that Discordeno provides you a built in way to update most discord bot lists.`}

\n

{`Channel IDs`}

\n

{`The channelIDs section holds the channel IDs that are useful for specific features to help give you alerts/notifications. For example, the `}{`missingTranslation`}{` channel will be where messages are sent alerting you that somewhere in your code you are trying to use a translation key that you never created.`}

\n

{`When you get to around 25,000 Discord servers on your bot, you may want to convert these channel IDs to webhooks.`}

\n

{`Role IDs`}

\n

{`The roleIDs section holds the role IDs that are useful for specific features. For example, the `}{`patreonVIPRoleID`}{` role can be used easily to enable vip features later in this guide.`}

\n

{`User IDs`}

\n

{`It's Alive!`}

\n

{`Oh my god! You now have a bot with a bunch of features already! You don't believe me? Well, seeing is believing, so start the bot.`}

\n
    \n
  1. {`Invite your bot to a discord server.`}
  2. \n
  3. {`Open up the integrated terminal in VSC using `}{`CTRL + \\``}{`. If you use a Mac, replace CTRL with CMD.`}
  4. \n
  5. {`Run the script below:`}
  6. \n
\n
{`deno run --allow-net --allow-read mod.ts\n`}
\n

{`The first time you run it, you may see a lot of files being loaded. This is preparing all the magic behind the scene. Once it is ready, you will see something like this:`}

\n

\n

{`Understanding What Discordeno Did`}

\n

{`Discordeno includes these commands/folders as they are essential for any discord bot to have in order to meet the Discord Bot Best Practices. It also adds a few things that will help make some things easier to build a bot.`}

\n

{`We will dive into these deeper in this guide. Let's take it step by step.`}

\n\n
;\n}\n\n;\nMDXContent.isMDXComponent = true;"}} \ No newline at end of file diff --git a/docs/.cache/caches/gatsby-plugin-mdx/diskstore-f56a9867ceea0134353f09a149a75268.json b/docs/.cache/caches/gatsby-plugin-mdx/diskstore-f56a9867ceea0134353f09a149a75268.json new file mode 100644 index 000000000..3b927f059 --- /dev/null +++ b/docs/.cache/caches/gatsby-plugin-mdx/diskstore-f56a9867ceea0134353f09a149a75268.json @@ -0,0 +1 @@ +{"expireTime":9007200851633127000,"key":"gatsby-plugin-mdx-entire-payload-d36eec0dfd96c7d3965bc91b6a957f03-","val":{"mdast":{"type":"root","children":[{"type":"paragraph","children":[{"type":"text","value":"Woah! You are almost half way done with understanding all of Discordeno. Amazing isn't it? Something you may have noticed in the last section was there were some options that prevented some commands from running like ","position":{"start":{"line":2,"column":1,"offset":1},"end":{"line":2,"column":218,"offset":218},"indent":[]}},{"type":"inlineCode","value":"dmOnly","position":{"start":{"line":2,"column":218,"offset":218},"end":{"line":2,"column":226,"offset":226},"indent":[]}},{"type":"text","value":" or the permission options. we created a setting to prevent the monitor from running in certain channels. What if we wanted to do prevent commands from happening? How would we prevent commands from running?","position":{"start":{"line":2,"column":226,"offset":226},"end":{"line":2,"column":432,"offset":432},"indent":[]}}],"position":{"start":{"line":2,"column":1,"offset":1},"end":{"line":2,"column":432,"offset":432},"indent":[]}},{"type":"heading","depth":2,"children":[{"type":"text","value":"What is an Inhibitor?","position":{"start":{"line":4,"column":4,"offset":437},"end":{"line":4,"column":25,"offset":458},"indent":[]}}],"position":{"start":{"line":4,"column":1,"offset":434},"end":{"line":4,"column":25,"offset":458},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"An Inhibitor is very similar to how monitors work. A monitor runs on every message but an inhibitor runs on every command. Remember all those command options like cooldown, permissions, permissionLevel, nsfw, etc... Each and every one of these options has an inhibitor in that checks commands for these settings.","position":{"start":{"line":6,"column":1,"offset":460},"end":{"line":6,"column":313,"offset":772},"indent":[]}}],"position":{"start":{"line":6,"column":1,"offset":460},"end":{"line":6,"column":313,"offset":772},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"Let's create our own inhibitor that would prevent commands from being used if the user is not a VIP user.","position":{"start":{"line":8,"column":1,"offset":774},"end":{"line":8,"column":106,"offset":879},"indent":[]}}],"position":{"start":{"line":8,"column":1,"offset":774},"end":{"line":8,"column":106,"offset":879},"indent":[]}},{"type":"blockquote","children":[{"type":"paragraph","children":[{"type":"strong","children":[{"type":"text","value":"Note:","position":{"start":{"line":10,"column":5,"offset":885},"end":{"line":10,"column":10,"offset":890},"indent":[]}}],"position":{"start":{"line":10,"column":3,"offset":883},"end":{"line":10,"column":12,"offset":892},"indent":[]}},{"type":"text","value":" It is important to remember that everything below can be done with a simple permission level as well. We will create our own custom permission levels but for the purposes of this guide and to be able to learn about Inhibitors, we will be using an inhibitor.","position":{"start":{"line":10,"column":12,"offset":892},"end":{"line":10,"column":270,"offset":1150},"indent":[]}}],"position":{"start":{"line":10,"column":3,"offset":883},"end":{"line":10,"column":270,"offset":1150},"indent":[]}}],"position":{"start":{"line":10,"column":1,"offset":881},"end":{"line":10,"column":270,"offset":1150},"indent":[]}},{"type":"heading","depth":2,"children":[{"type":"text","value":"Creating the File","position":{"start":{"line":12,"column":4,"offset":1155},"end":{"line":12,"column":21,"offset":1172},"indent":[]}}],"position":{"start":{"line":12,"column":1,"offset":1152},"end":{"line":12,"column":21,"offset":1172},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"Let's start by creating a file inside the inhibitors folder called ","position":{"start":{"line":14,"column":1,"offset":1174},"end":{"line":14,"column":68,"offset":1241},"indent":[]}},{"type":"inlineCode","value":"vipOnly.ts","position":{"start":{"line":14,"column":68,"offset":1241},"end":{"line":14,"column":80,"offset":1253},"indent":[]}},{"type":"text","value":" and paste the following snippet of code:","position":{"start":{"line":14,"column":80,"offset":1253},"end":{"line":14,"column":121,"offset":1294},"indent":[]}}],"position":{"start":{"line":14,"column":1,"offset":1174},"end":{"line":14,"column":121,"offset":1294},"indent":[]}},{"type":"code","lang":"ts","meta":null,"value":"import { botCache } from \"../../mod.ts\";\n\nbotCache.inhibitors.set(\"inhibitorname\", async function (message, command, guild) {\n\t// Your code goes here\n});","position":{"start":{"line":16,"column":1,"offset":1296},"end":{"line":22,"column":4,"offset":1459},"indent":[1,1,1,1,1,1]}},{"type":"paragraph","children":[{"type":"text","value":"Inhibitors can take up to 3 arguments.","position":{"start":{"line":24,"column":1,"offset":1461},"end":{"line":24,"column":39,"offset":1499},"indent":[]}}],"position":{"start":{"line":24,"column":1,"offset":1461},"end":{"line":24,"column":39,"offset":1499},"indent":[]}},{"type":"list","ordered":false,"start":null,"spread":false,"children":[{"type":"listItem","spread":false,"checked":null,"children":[{"type":"paragraph","children":[{"type":"inlineCode","value":"message","position":{"start":{"line":26,"column":3,"offset":1503},"end":{"line":26,"column":12,"offset":1512},"indent":[]}},{"type":"text","value":": The message object that triggered the command.","position":{"start":{"line":26,"column":12,"offset":1512},"end":{"line":26,"column":60,"offset":1560},"indent":[]}}],"position":{"start":{"line":26,"column":3,"offset":1503},"end":{"line":26,"column":60,"offset":1560},"indent":[]}}],"position":{"start":{"line":26,"column":1,"offset":1501},"end":{"line":26,"column":60,"offset":1560},"indent":[]}},{"type":"listItem","spread":false,"checked":null,"children":[{"type":"paragraph","children":[{"type":"inlineCode","value":"command","position":{"start":{"line":27,"column":3,"offset":1563},"end":{"line":27,"column":12,"offset":1572},"indent":[]}},{"type":"text","value":": The command object itself that was triggered.","position":{"start":{"line":27,"column":12,"offset":1572},"end":{"line":27,"column":59,"offset":1619},"indent":[]}}],"position":{"start":{"line":27,"column":3,"offset":1563},"end":{"line":27,"column":59,"offset":1619},"indent":[]}}],"position":{"start":{"line":27,"column":1,"offset":1561},"end":{"line":27,"column":59,"offset":1619},"indent":[]}},{"type":"listItem","spread":false,"checked":null,"children":[{"type":"paragraph","children":[{"type":"inlineCode","value":"guild","position":{"start":{"line":28,"column":3,"offset":1622},"end":{"line":28,"column":10,"offset":1629},"indent":[]}},{"type":"text","value":": The server guild object where this command was ran.","position":{"start":{"line":28,"column":10,"offset":1629},"end":{"line":28,"column":63,"offset":1682},"indent":[]}}],"position":{"start":{"line":28,"column":3,"offset":1622},"end":{"line":28,"column":63,"offset":1682},"indent":[]}}],"position":{"start":{"line":28,"column":1,"offset":1620},"end":{"line":28,"column":63,"offset":1682},"indent":[]}}],"position":{"start":{"line":26,"column":1,"offset":1501},"end":{"line":28,"column":63,"offset":1682},"indent":[1,1]}},{"type":"heading","depth":2,"children":[{"type":"text","value":"Understanding How Inhibitors Function","position":{"start":{"line":30,"column":4,"offset":1687},"end":{"line":30,"column":41,"offset":1724},"indent":[]}}],"position":{"start":{"line":30,"column":1,"offset":1684},"end":{"line":30,"column":41,"offset":1724},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"To block a command you have to return a truthy value.\n","position":{"start":{"line":32,"column":1,"offset":1726},"end":{"line":33,"column":1,"offset":1780},"indent":[1]}},{"type":"strong","children":[{"type":"text","value":"return true;","position":{"start":{"line":33,"column":3,"offset":1782},"end":{"line":33,"column":15,"offset":1794},"indent":[]}}],"position":{"start":{"line":33,"column":1,"offset":1780},"end":{"line":33,"column":17,"offset":1796},"indent":[]}},{"type":"text","value":" If you return true the inhibitor will block the execution of the command.\nTo allow a command return a falsey value.","position":{"start":{"line":33,"column":17,"offset":1796},"end":{"line":34,"column":42,"offset":1912},"indent":[1]}}],"position":{"start":{"line":32,"column":1,"offset":1726},"end":{"line":34,"column":42,"offset":1912},"indent":[1,1]}},{"type":"code","lang":null,"meta":null,"value":"- **return false;** If you return false the inhibitor will not block the error.","position":{"start":{"line":35,"column":1,"offset":1913},"end":{"line":35,"column":81,"offset":1993},"indent":[]}},{"type":"code","lang":"ts","meta":null,"value":"// If the command is not VIP only we can allow this command\nif (!command.vipOnly) return false;\n\n// Check if the user is VIP\nconst userIsVIP = message.author.settings.get(`isVIP`)\n// The user is VIP so we can allow this command to be used\nif (userIsVIP) return false\n// The user is NOT VIP so we throw an error\nthrow `The ${command.name} is only allowed for VIP users.`","position":{"start":{"line":38,"column":1,"offset":1996},"end":{"line":48,"column":4,"offset":2375},"indent":[1,1,1,1,1,1,1,1,1,1]}},{"type":"export","value":"export const _frontmatter = {\"title\":\"Creating Inhibitors!\",\"metaTitle\":\"Creating An Inhibitor | Discordeno\",\"metaDescription\":\"Let's create our very own bot with Discordeno!\"}","position":{"start":{"line":51,"column":1,"offset":2378},"end":{"line":51,"column":177,"offset":2554},"indent":[]}}],"position":{"start":{"line":1,"column":1,"offset":0},"end":{"line":51,"column":177,"offset":2554}}},"scopeImports":["import * as React from 'react'"],"scopeIdentifiers":["React"],"body":"function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }\n\nfunction _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }\n\nfunction _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }\n\n/* @jsx mdx */\nvar _frontmatter = {\n \"title\": \"Creating Inhibitors!\",\n \"metaTitle\": \"Creating An Inhibitor | Discordeno\",\n \"metaDescription\": \"Let's create our very own bot with Discordeno!\"\n};\nvar layoutProps = {\n _frontmatter: _frontmatter\n};\nvar MDXLayout = \"wrapper\";\nreturn function MDXContent(_ref) {\n var components = _ref.components,\n props = _objectWithoutProperties(_ref, [\"components\"]);\n\n return mdx(MDXLayout, _extends({}, layoutProps, props, {\n components: components,\n mdxType: \"MDXLayout\"\n }), mdx(\"p\", null, \"Woah! You are almost half way done with understanding all of Discordeno. Amazing isn't it? Something you may have noticed in the last section was there were some options that prevented some commands from running like \", mdx(\"inlineCode\", {\n parentName: \"p\"\n }, \"dmOnly\"), \" or the permission options. we created a setting to prevent the monitor from running in certain channels. What if we wanted to do prevent commands from happening? How would we prevent commands from running?\"), mdx(\"h2\", null, \"What is an Inhibitor?\"), mdx(\"p\", null, \"An Inhibitor is very similar to how monitors work. A monitor runs on every message but an inhibitor runs on every command. Remember all those command options like cooldown, permissions, permissionLevel, nsfw, etc... Each and every one of these options has an inhibitor in that checks commands for these settings.\"), mdx(\"p\", null, \"Let's create our own inhibitor that would prevent commands from being used if the user is not a VIP user.\"), mdx(\"blockquote\", null, mdx(\"p\", {\n parentName: \"blockquote\"\n }, mdx(\"strong\", {\n parentName: \"p\"\n }, \"Note:\"), \" It is important to remember that everything below can be done with a simple permission level as well. We will create our own custom permission levels but for the purposes of this guide and to be able to learn about Inhibitors, we will be using an inhibitor.\")), mdx(\"h2\", null, \"Creating the File\"), mdx(\"p\", null, \"Let's start by creating a file inside the inhibitors folder called \", mdx(\"inlineCode\", {\n parentName: \"p\"\n }, \"vipOnly.ts\"), \" and paste the following snippet of code:\"), mdx(\"pre\", null, mdx(\"code\", _extends({\n parentName: \"pre\"\n }, {\n \"className\": \"language-ts\"\n }), \"import { botCache } from \\\"../../mod.ts\\\";\\n\\nbotCache.inhibitors.set(\\\"inhibitorname\\\", async function (message, command, guild) {\\n // Your code goes here\\n});\\n\")), mdx(\"p\", null, \"Inhibitors can take up to 3 arguments.\"), mdx(\"ul\", null, mdx(\"li\", {\n parentName: \"ul\"\n }, mdx(\"inlineCode\", {\n parentName: \"li\"\n }, \"message\"), \": The message object that triggered the command.\"), mdx(\"li\", {\n parentName: \"ul\"\n }, mdx(\"inlineCode\", {\n parentName: \"li\"\n }, \"command\"), \": The command object itself that was triggered.\"), mdx(\"li\", {\n parentName: \"ul\"\n }, mdx(\"inlineCode\", {\n parentName: \"li\"\n }, \"guild\"), \": The server guild object where this command was ran.\")), mdx(\"h2\", null, \"Understanding How Inhibitors Function\"), mdx(\"p\", null, \"To block a command you have to return a truthy value.\\n\", mdx(\"strong\", {\n parentName: \"p\"\n }, \"return true;\"), \" If you return true the inhibitor will block the execution of the command.\\nTo allow a command return a falsey value.\"), mdx(\"pre\", null, mdx(\"code\", _extends({\n parentName: \"pre\"\n }, {}), \"- **return false;** If you return false the inhibitor will not block the error.\\n\")), mdx(\"pre\", null, mdx(\"code\", _extends({\n parentName: \"pre\"\n }, {\n \"className\": \"language-ts\"\n }), \"// If the command is not VIP only we can allow this command\\nif (!command.vipOnly) return false;\\n\\n// Check if the user is VIP\\nconst userIsVIP = message.author.settings.get(`isVIP`)\\n// The user is VIP so we can allow this command to be used\\nif (userIsVIP) return false\\n// The user is NOT VIP so we throw an error\\nthrow `The ${command.name} is only allowed for VIP users.`\\n\")));\n}\n;\nMDXContent.isMDXComponent = true;","rawMDXOutput":"/* @jsx mdx */\nimport { mdx } from '@mdx-js/react';\n/* @jsx mdx */\n\nexport const _frontmatter = {\n \"title\": \"Creating Inhibitors!\",\n \"metaTitle\": \"Creating An Inhibitor | Discordeno\",\n \"metaDescription\": \"Let's create our very own bot with Discordeno!\"\n};\n\nconst layoutProps = {\n _frontmatter\n};\nconst MDXLayout = \"wrapper\"\nexport default function MDXContent({\n components,\n ...props\n}) {\n return \n

{`Woah! You are almost half way done with understanding all of Discordeno. Amazing isn't it? Something you may have noticed in the last section was there were some options that prevented some commands from running like `}{`dmOnly`}{` or the permission options. we created a setting to prevent the monitor from running in certain channels. What if we wanted to do prevent commands from happening? How would we prevent commands from running?`}

\n

{`What is an Inhibitor?`}

\n

{`An Inhibitor is very similar to how monitors work. A monitor runs on every message but an inhibitor runs on every command. Remember all those command options like cooldown, permissions, permissionLevel, nsfw, etc... Each and every one of these options has an inhibitor in that checks commands for these settings.`}

\n

{`Let's create our own inhibitor that would prevent commands from being used if the user is not a VIP user.`}

\n
\n

{`Note:`}{` It is important to remember that everything below can be done with a simple permission level as well. We will create our own custom permission levels but for the purposes of this guide and to be able to learn about Inhibitors, we will be using an inhibitor.`}

\n
\n

{`Creating the File`}

\n

{`Let's start by creating a file inside the inhibitors folder called `}{`vipOnly.ts`}{` and paste the following snippet of code:`}

\n
{`import { botCache } from \"../../mod.ts\";\n\nbotCache.inhibitors.set(\"inhibitorname\", async function (message, command, guild) {\n    // Your code goes here\n});\n`}
\n

{`Inhibitors can take up to 3 arguments.`}

\n
    \n
  • {`message`}{`: The message object that triggered the command.`}
  • \n
  • {`command`}{`: The command object itself that was triggered.`}
  • \n
  • {`guild`}{`: The server guild object where this command was ran.`}
  • \n
\n

{`Understanding How Inhibitors Function`}

\n

{`To block a command you have to return a truthy value.\n`}{`return true;`}{` If you return true the inhibitor will block the execution of the command.\nTo allow a command return a falsey value.`}

\n
{`- **return false;** If you return false the inhibitor will not block the error.\n`}
\n
{`// If the command is not VIP only we can allow this command\nif (!command.vipOnly) return false;\n\n// Check if the user is VIP\nconst userIsVIP = message.author.settings.get(\\`isVIP\\`)\n// The user is VIP so we can allow this command to be used\nif (userIsVIP) return false\n// The user is NOT VIP so we throw an error\nthrow \\`The \\${command.name} is only allowed for VIP users.\\`\n`}
\n\n
;\n}\n\n;\nMDXContent.isMDXComponent = true;"}} \ No newline at end of file diff --git a/docs/.cache/caches/gatsby-plugin-mdx/diskstore-f79514e482d3378c47b031e0941fd1ef.json b/docs/.cache/caches/gatsby-plugin-mdx/diskstore-f79514e482d3378c47b031e0941fd1ef.json new file mode 100644 index 000000000..4adbae343 --- /dev/null +++ b/docs/.cache/caches/gatsby-plugin-mdx/diskstore-f79514e482d3378c47b031e0941fd1ef.json @@ -0,0 +1 @@ +{"expireTime":9007200851635031000,"key":"gatsby-plugin-mdx-entire-payload-1dba5bddab1d9bc919e54a94ea71b7c7-","val":{"mdast":{"type":"root","children":[{"type":"paragraph","children":[{"type":"text","value":"Woah! You are almost half way done with understanding all of Discordeno. Amazing isn't it? Something you may have noticed in the last section was there were some options that prevented some commands from running like ","position":{"start":{"line":2,"column":1,"offset":1},"end":{"line":2,"column":218,"offset":218},"indent":[]}},{"type":"inlineCode","value":"dmOnly","position":{"start":{"line":2,"column":218,"offset":218},"end":{"line":2,"column":226,"offset":226},"indent":[]}},{"type":"text","value":" or the permission options. we created a setting to prevent the monitor from running in certain channels. What if we wanted to do prevent commands from happening? How would we prevent commands from running?","position":{"start":{"line":2,"column":226,"offset":226},"end":{"line":2,"column":432,"offset":432},"indent":[]}}],"position":{"start":{"line":2,"column":1,"offset":1},"end":{"line":2,"column":432,"offset":432},"indent":[]}},{"type":"heading","depth":2,"children":[{"type":"text","value":"What is an Inhibitor?","position":{"start":{"line":4,"column":4,"offset":437},"end":{"line":4,"column":25,"offset":458},"indent":[]}}],"position":{"start":{"line":4,"column":1,"offset":434},"end":{"line":4,"column":25,"offset":458},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"An Inhibitor is very similar to how monitors work. A monitor runs on every message but an inhibitor runs on every command. Remember all those command options like cooldown, permissions, permissionLevel, nsfw, etc... Each and every one of these options has an inhibitor in that checks commands for these settings.","position":{"start":{"line":6,"column":1,"offset":460},"end":{"line":6,"column":313,"offset":772},"indent":[]}}],"position":{"start":{"line":6,"column":1,"offset":460},"end":{"line":6,"column":313,"offset":772},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"Let's create our own inhibitor that would prevent commands from being used if the user is not a VIP user.","position":{"start":{"line":8,"column":1,"offset":774},"end":{"line":8,"column":106,"offset":879},"indent":[]}}],"position":{"start":{"line":8,"column":1,"offset":774},"end":{"line":8,"column":106,"offset":879},"indent":[]}},{"type":"blockquote","children":[{"type":"paragraph","children":[{"type":"strong","children":[{"type":"text","value":"Note:","position":{"start":{"line":10,"column":5,"offset":885},"end":{"line":10,"column":10,"offset":890},"indent":[]}}],"position":{"start":{"line":10,"column":3,"offset":883},"end":{"line":10,"column":12,"offset":892},"indent":[]}},{"type":"text","value":" It is important to remember that everything below can be done with a simple permission level as well. We will create our own custom permission levels but for the purposes of this guide and to be able to learn about Inhibitors, we will be using an inhibitor.","position":{"start":{"line":10,"column":12,"offset":892},"end":{"line":10,"column":270,"offset":1150},"indent":[]}}],"position":{"start":{"line":10,"column":3,"offset":883},"end":{"line":10,"column":270,"offset":1150},"indent":[]}}],"position":{"start":{"line":10,"column":1,"offset":881},"end":{"line":10,"column":270,"offset":1150},"indent":[]}},{"type":"heading","depth":2,"children":[{"type":"text","value":"Creating the File","position":{"start":{"line":12,"column":4,"offset":1155},"end":{"line":12,"column":21,"offset":1172},"indent":[]}}],"position":{"start":{"line":12,"column":1,"offset":1152},"end":{"line":12,"column":21,"offset":1172},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"Let's start by creating a file inside the inhibitors folder called ","position":{"start":{"line":14,"column":1,"offset":1174},"end":{"line":14,"column":68,"offset":1241},"indent":[]}},{"type":"inlineCode","value":"boosted.ts","position":{"start":{"line":14,"column":68,"offset":1241},"end":{"line":14,"column":80,"offset":1253},"indent":[]}},{"type":"text","value":" and paste the following snippet of code:","position":{"start":{"line":14,"column":80,"offset":1253},"end":{"line":14,"column":121,"offset":1294},"indent":[]}}],"position":{"start":{"line":14,"column":1,"offset":1174},"end":{"line":14,"column":121,"offset":1294},"indent":[]}},{"type":"code","lang":"ts","meta":null,"value":"import { botCache } from \"../../mod.ts\";\n\nbotCache.inhibitors.set(\"inhibitorname\", async function (message, command, guild) {\n\t// Your code goes here\n});","position":{"start":{"line":16,"column":1,"offset":1296},"end":{"line":22,"column":4,"offset":1459},"indent":[1,1,1,1,1,1]}},{"type":"paragraph","children":[{"type":"text","value":"Inhibitors can take up to 3 arguments.","position":{"start":{"line":24,"column":1,"offset":1461},"end":{"line":24,"column":39,"offset":1499},"indent":[]}}],"position":{"start":{"line":24,"column":1,"offset":1461},"end":{"line":24,"column":39,"offset":1499},"indent":[]}},{"type":"list","ordered":false,"start":null,"spread":false,"children":[{"type":"listItem","spread":false,"checked":null,"children":[{"type":"paragraph","children":[{"type":"inlineCode","value":"message","position":{"start":{"line":26,"column":3,"offset":1503},"end":{"line":26,"column":12,"offset":1512},"indent":[]}},{"type":"text","value":": The message object that triggered the command.","position":{"start":{"line":26,"column":12,"offset":1512},"end":{"line":26,"column":60,"offset":1560},"indent":[]}}],"position":{"start":{"line":26,"column":3,"offset":1503},"end":{"line":26,"column":60,"offset":1560},"indent":[]}}],"position":{"start":{"line":26,"column":1,"offset":1501},"end":{"line":26,"column":60,"offset":1560},"indent":[]}},{"type":"listItem","spread":false,"checked":null,"children":[{"type":"paragraph","children":[{"type":"inlineCode","value":"command","position":{"start":{"line":27,"column":3,"offset":1563},"end":{"line":27,"column":12,"offset":1572},"indent":[]}},{"type":"text","value":": The command object itself that was triggered.","position":{"start":{"line":27,"column":12,"offset":1572},"end":{"line":27,"column":59,"offset":1619},"indent":[]}}],"position":{"start":{"line":27,"column":3,"offset":1563},"end":{"line":27,"column":59,"offset":1619},"indent":[]}}],"position":{"start":{"line":27,"column":1,"offset":1561},"end":{"line":27,"column":59,"offset":1619},"indent":[]}},{"type":"listItem","spread":false,"checked":null,"children":[{"type":"paragraph","children":[{"type":"inlineCode","value":"guild","position":{"start":{"line":28,"column":3,"offset":1622},"end":{"line":28,"column":10,"offset":1629},"indent":[]}},{"type":"text","value":": The server guild object where this command was ran.","position":{"start":{"line":28,"column":10,"offset":1629},"end":{"line":28,"column":63,"offset":1682},"indent":[]}}],"position":{"start":{"line":28,"column":3,"offset":1622},"end":{"line":28,"column":63,"offset":1682},"indent":[]}}],"position":{"start":{"line":28,"column":1,"offset":1620},"end":{"line":28,"column":63,"offset":1682},"indent":[]}}],"position":{"start":{"line":26,"column":1,"offset":1501},"end":{"line":28,"column":63,"offset":1682},"indent":[1,1]}},{"type":"heading","depth":2,"children":[{"type":"text","value":"Understanding How Inhibitors Function","position":{"start":{"line":30,"column":4,"offset":1687},"end":{"line":30,"column":41,"offset":1724},"indent":[]}}],"position":{"start":{"line":30,"column":1,"offset":1684},"end":{"line":30,"column":41,"offset":1724},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"To block a command you have to return a truthy value.","position":{"start":{"line":32,"column":1,"offset":1726},"end":{"line":32,"column":54,"offset":1779},"indent":[]}}],"position":{"start":{"line":32,"column":1,"offset":1726},"end":{"line":32,"column":54,"offset":1779},"indent":[]}},{"type":"list","ordered":false,"start":null,"spread":false,"children":[{"type":"listItem","spread":false,"checked":null,"children":[{"type":"paragraph","children":[{"type":"strong","children":[{"type":"text","value":"return true;","position":{"start":{"line":33,"column":5,"offset":1784},"end":{"line":33,"column":17,"offset":1796},"indent":[]}}],"position":{"start":{"line":33,"column":3,"offset":1782},"end":{"line":33,"column":19,"offset":1798},"indent":[]}},{"type":"text","value":" If you return true the inhibitor will block the execution of the command.\nTo allow a command return a falsey value.","position":{"start":{"line":33,"column":19,"offset":1798},"end":{"line":34,"column":42,"offset":1914},"indent":[1]}}],"position":{"start":{"line":33,"column":3,"offset":1782},"end":{"line":34,"column":42,"offset":1914},"indent":[1]}}],"position":{"start":{"line":33,"column":1,"offset":1780},"end":{"line":34,"column":42,"offset":1914},"indent":[1]}},{"type":"listItem","spread":false,"checked":null,"children":[{"type":"paragraph","children":[{"type":"strong","children":[{"type":"text","value":"return false;","position":{"start":{"line":35,"column":5,"offset":1919},"end":{"line":35,"column":18,"offset":1932},"indent":[]}}],"position":{"start":{"line":35,"column":3,"offset":1917},"end":{"line":35,"column":20,"offset":1934},"indent":[]}},{"type":"text","value":" If you return false the inhibitor will not block the error.","position":{"start":{"line":35,"column":20,"offset":1934},"end":{"line":35,"column":80,"offset":1994},"indent":[]}}],"position":{"start":{"line":35,"column":3,"offset":1917},"end":{"line":35,"column":80,"offset":1994},"indent":[]}}],"position":{"start":{"line":35,"column":1,"offset":1915},"end":{"line":35,"column":80,"offset":1994},"indent":[]}}],"position":{"start":{"line":33,"column":1,"offset":1780},"end":{"line":35,"column":80,"offset":1994},"indent":[1,1]}},{"type":"code","lang":"ts","meta":null,"value":"// If the command is not VIP only we can allow this command to execute\nif (!command.vipOnly) return false;\n\n// The bot's support server\nconst guild = cache.guilds.get(configs.supportServerID);\n// If the command author is not in the server they won't have the vip role\nconst member = guild.members.get(message.author.id) || await getMember(guild.id, message.author.id);\n// Member doesn't exist so cancel the command\nif (!member) {\n\tsendResponse(message, `sorry, but you can not use this command until you become VIP. **Close the IRIS!!!**`)\n\treturn true;\n}\n\n// If the user has the vip role on the support server given by patreon allow the command\nif (member.roles.includes(configs.roleIDs.patreonVIPRoleID)) return false;\n\n// Alert the user they don't have vip and can't use the command\nsendResponse(message, `sorry, but you can not use this command until you become a VIP. I'm sorry, Teal'c. We'll go to Disneyland next year. I promise.`)\n// Cancel the command since the user does not have vip\nreturn true;","position":{"start":{"line":38,"column":1,"offset":1997},"end":{"line":59,"column":4,"offset":3013},"indent":[1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1]}},{"type":"heading","depth":2,"children":[{"type":"text","value":"Updating Command Typings","position":{"start":{"line":61,"column":4,"offset":3018},"end":{"line":61,"column":28,"offset":3042},"indent":[]}}],"position":{"start":{"line":61,"column":1,"offset":3015},"end":{"line":61,"column":28,"offset":3042},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"Since we need a new option on our commands we need to add that. Open the ","position":{"start":{"line":63,"column":1,"offset":3044},"end":{"line":63,"column":74,"offset":3117},"indent":[]}},{"type":"inlineCode","value":"src/types/commands.ts","position":{"start":{"line":63,"column":74,"offset":3117},"end":{"line":63,"column":97,"offset":3140},"indent":[]}},{"type":"text","value":" file and add in the following","position":{"start":{"line":63,"column":97,"offset":3140},"end":{"line":63,"column":127,"offset":3170},"indent":[]}}],"position":{"start":{"line":63,"column":1,"offset":3044},"end":{"line":63,"column":127,"offset":3170},"indent":[]}},{"type":"code","lang":"ts","meta":null,"value":" vipOnly?: boolean;","position":{"start":{"line":65,"column":1,"offset":3172},"end":{"line":67,"column":4,"offset":3202},"indent":[1,1]}},{"type":"paragraph","children":[{"type":"text","value":"Once that is added, you can go into any command and mark them as vip only commands.","position":{"start":{"line":69,"column":1,"offset":3204},"end":{"line":69,"column":84,"offset":3287},"indent":[]}}],"position":{"start":{"line":69,"column":1,"offset":3204},"end":{"line":69,"column":84,"offset":3287},"indent":[]}},{"type":"heading","depth":2,"children":[{"type":"text","value":"Challenges","position":{"start":{"line":71,"column":4,"offset":3292},"end":{"line":71,"column":14,"offset":3302},"indent":[]}}],"position":{"start":{"line":71,"column":1,"offset":3289},"end":{"line":71,"column":14,"offset":3302},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"Hell yes! We just got through the entire inhibitor section. You have now mastered everything related to inhibitors.","position":{"start":{"line":73,"column":1,"offset":3304},"end":{"line":73,"column":116,"offset":3419},"indent":[]}}],"position":{"start":{"line":73,"column":1,"offset":3304},"end":{"line":73,"column":116,"offset":3419},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"You can now try and get a little more practice with inhibitors by trying to challenge yourself and make your own inhibitors. Don't worry if you can't think of any good use cases for inhibitors.","position":{"start":{"line":75,"column":1,"offset":3421},"end":{"line":75,"column":194,"offset":3614},"indent":[]}}],"position":{"start":{"line":75,"column":1,"offset":3421},"end":{"line":75,"column":194,"offset":3614},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"Majority of Discordeno bots do not use many custom inhibitors because most of the necessary/important ones already come built for you in the inhibitors folder.","position":{"start":{"line":77,"column":1,"offset":3616},"end":{"line":77,"column":160,"offset":3775},"indent":[]}}],"position":{"start":{"line":77,"column":1,"offset":3616},"end":{"line":77,"column":160,"offset":3775},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"Next we will try our hands at creating a monitor.","position":{"start":{"line":79,"column":1,"offset":3777},"end":{"line":79,"column":50,"offset":3826},"indent":[]}}],"position":{"start":{"line":79,"column":1,"offset":3777},"end":{"line":79,"column":50,"offset":3826},"indent":[]}},{"type":"export","value":"export const _frontmatter = {\"title\":\"Creating Inhibitors!\",\"metaTitle\":\"Creating An Inhibitor | Discordeno\",\"metaDescription\":\"Let's create our very own bot with Discordeno!\"}","position":{"start":{"line":82,"column":1,"offset":3829},"end":{"line":82,"column":177,"offset":4005},"indent":[]}}],"position":{"start":{"line":1,"column":1,"offset":0},"end":{"line":82,"column":177,"offset":4005}}},"scopeImports":["import * as React from 'react'"],"scopeIdentifiers":["React"],"body":"function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }\n\nfunction _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }\n\nfunction _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }\n\n/* @jsx mdx */\nvar _frontmatter = {\n \"title\": \"Creating Inhibitors!\",\n \"metaTitle\": \"Creating An Inhibitor | Discordeno\",\n \"metaDescription\": \"Let's create our very own bot with Discordeno!\"\n};\nvar layoutProps = {\n _frontmatter: _frontmatter\n};\nvar MDXLayout = \"wrapper\";\nreturn function MDXContent(_ref) {\n var components = _ref.components,\n props = _objectWithoutProperties(_ref, [\"components\"]);\n\n return mdx(MDXLayout, _extends({}, layoutProps, props, {\n components: components,\n mdxType: \"MDXLayout\"\n }), mdx(\"p\", null, \"Woah! You are almost half way done with understanding all of Discordeno. Amazing isn't it? Something you may have noticed in the last section was there were some options that prevented some commands from running like \", mdx(\"inlineCode\", {\n parentName: \"p\"\n }, \"dmOnly\"), \" or the permission options. we created a setting to prevent the monitor from running in certain channels. What if we wanted to do prevent commands from happening? How would we prevent commands from running?\"), mdx(\"h2\", null, \"What is an Inhibitor?\"), mdx(\"p\", null, \"An Inhibitor is very similar to how monitors work. A monitor runs on every message but an inhibitor runs on every command. Remember all those command options like cooldown, permissions, permissionLevel, nsfw, etc... Each and every one of these options has an inhibitor in that checks commands for these settings.\"), mdx(\"p\", null, \"Let's create our own inhibitor that would prevent commands from being used if the user is not a VIP user.\"), mdx(\"blockquote\", null, mdx(\"p\", {\n parentName: \"blockquote\"\n }, mdx(\"strong\", {\n parentName: \"p\"\n }, \"Note:\"), \" It is important to remember that everything below can be done with a simple permission level as well. We will create our own custom permission levels but for the purposes of this guide and to be able to learn about Inhibitors, we will be using an inhibitor.\")), mdx(\"h2\", null, \"Creating the File\"), mdx(\"p\", null, \"Let's start by creating a file inside the inhibitors folder called \", mdx(\"inlineCode\", {\n parentName: \"p\"\n }, \"boosted.ts\"), \" and paste the following snippet of code:\"), mdx(\"pre\", null, mdx(\"code\", _extends({\n parentName: \"pre\"\n }, {\n \"className\": \"language-ts\"\n }), \"import { botCache } from \\\"../../mod.ts\\\";\\n\\nbotCache.inhibitors.set(\\\"inhibitorname\\\", async function (message, command, guild) {\\n // Your code goes here\\n});\\n\")), mdx(\"p\", null, \"Inhibitors can take up to 3 arguments.\"), mdx(\"ul\", null, mdx(\"li\", {\n parentName: \"ul\"\n }, mdx(\"inlineCode\", {\n parentName: \"li\"\n }, \"message\"), \": The message object that triggered the command.\"), mdx(\"li\", {\n parentName: \"ul\"\n }, mdx(\"inlineCode\", {\n parentName: \"li\"\n }, \"command\"), \": The command object itself that was triggered.\"), mdx(\"li\", {\n parentName: \"ul\"\n }, mdx(\"inlineCode\", {\n parentName: \"li\"\n }, \"guild\"), \": The server guild object where this command was ran.\")), mdx(\"h2\", null, \"Understanding How Inhibitors Function\"), mdx(\"p\", null, \"To block a command you have to return a truthy value.\"), mdx(\"ul\", null, mdx(\"li\", {\n parentName: \"ul\"\n }, mdx(\"strong\", {\n parentName: \"li\"\n }, \"return true;\"), \" If you return true the inhibitor will block the execution of the command.\\nTo allow a command return a falsey value.\"), mdx(\"li\", {\n parentName: \"ul\"\n }, mdx(\"strong\", {\n parentName: \"li\"\n }, \"return false;\"), \" If you return false the inhibitor will not block the error.\")), mdx(\"pre\", null, mdx(\"code\", _extends({\n parentName: \"pre\"\n }, {\n \"className\": \"language-ts\"\n }), \"// If the command is not VIP only we can allow this command to execute\\nif (!command.vipOnly) return false;\\n\\n// The bot's support server\\nconst guild = cache.guilds.get(configs.supportServerID);\\n// If the command author is not in the server they won't have the vip role\\nconst member = guild.members.get(message.author.id) || await getMember(guild.id, message.author.id);\\n// Member doesn't exist so cancel the command\\nif (!member) {\\n sendResponse(message, `sorry, but you can not use this command until you become VIP. **Close the IRIS!!!**`)\\n return true;\\n}\\n\\n// If the user has the vip role on the support server given by patreon allow the command\\nif (member.roles.includes(configs.roleIDs.patreonVIPRoleID)) return false;\\n\\n// Alert the user they don't have vip and can't use the command\\nsendResponse(message, `sorry, but you can not use this command until you become a VIP. I'm sorry, Teal'c. We'll go to Disneyland next year. I promise.`)\\n// Cancel the command since the user does not have vip\\nreturn true;\\n\")), mdx(\"h2\", null, \"Updating Command Typings\"), mdx(\"p\", null, \"Since we need a new option on our commands we need to add that. Open the \", mdx(\"inlineCode\", {\n parentName: \"p\"\n }, \"src/types/commands.ts\"), \" file and add in the following\"), mdx(\"pre\", null, mdx(\"code\", _extends({\n parentName: \"pre\"\n }, {\n \"className\": \"language-ts\"\n }), \" vipOnly?: boolean;\\n\")), mdx(\"p\", null, \"Once that is added, you can go into any command and mark them as vip only commands.\"), mdx(\"h2\", null, \"Challenges\"), mdx(\"p\", null, \"Hell yes! We just got through the entire inhibitor section. You have now mastered everything related to inhibitors.\"), mdx(\"p\", null, \"You can now try and get a little more practice with inhibitors by trying to challenge yourself and make your own inhibitors. Don't worry if you can't think of any good use cases for inhibitors.\"), mdx(\"p\", null, \"Majority of Discordeno bots do not use many custom inhibitors because most of the necessary/important ones already come built for you in the inhibitors folder.\"), mdx(\"p\", null, \"Next we will try our hands at creating a monitor.\"));\n}\n;\nMDXContent.isMDXComponent = true;","rawMDXOutput":"/* @jsx mdx */\nimport { mdx } from '@mdx-js/react';\n/* @jsx mdx */\n\nexport const _frontmatter = {\n \"title\": \"Creating Inhibitors!\",\n \"metaTitle\": \"Creating An Inhibitor | Discordeno\",\n \"metaDescription\": \"Let's create our very own bot with Discordeno!\"\n};\n\nconst layoutProps = {\n _frontmatter\n};\nconst MDXLayout = \"wrapper\"\nexport default function MDXContent({\n components,\n ...props\n}) {\n return \n

{`Woah! You are almost half way done with understanding all of Discordeno. Amazing isn't it? Something you may have noticed in the last section was there were some options that prevented some commands from running like `}{`dmOnly`}{` or the permission options. we created a setting to prevent the monitor from running in certain channels. What if we wanted to do prevent commands from happening? How would we prevent commands from running?`}

\n

{`What is an Inhibitor?`}

\n

{`An Inhibitor is very similar to how monitors work. A monitor runs on every message but an inhibitor runs on every command. Remember all those command options like cooldown, permissions, permissionLevel, nsfw, etc... Each and every one of these options has an inhibitor in that checks commands for these settings.`}

\n

{`Let's create our own inhibitor that would prevent commands from being used if the user is not a VIP user.`}

\n
\n

{`Note:`}{` It is important to remember that everything below can be done with a simple permission level as well. We will create our own custom permission levels but for the purposes of this guide and to be able to learn about Inhibitors, we will be using an inhibitor.`}

\n
\n

{`Creating the File`}

\n

{`Let's start by creating a file inside the inhibitors folder called `}{`boosted.ts`}{` and paste the following snippet of code:`}

\n
{`import { botCache } from \"../../mod.ts\";\n\nbotCache.inhibitors.set(\"inhibitorname\", async function (message, command, guild) {\n    // Your code goes here\n});\n`}
\n

{`Inhibitors can take up to 3 arguments.`}

\n
    \n
  • {`message`}{`: The message object that triggered the command.`}
  • \n
  • {`command`}{`: The command object itself that was triggered.`}
  • \n
  • {`guild`}{`: The server guild object where this command was ran.`}
  • \n
\n

{`Understanding How Inhibitors Function`}

\n

{`To block a command you have to return a truthy value.`}

\n
    \n
  • {`return true;`}{` If you return true the inhibitor will block the execution of the command.\nTo allow a command return a falsey value.`}
  • \n
  • {`return false;`}{` If you return false the inhibitor will not block the error.`}
  • \n
\n
{`// If the command is not VIP only we can allow this command to execute\nif (!command.vipOnly) return false;\n\n// The bot's support server\nconst guild = cache.guilds.get(configs.supportServerID);\n// If the command author is not in the server they won't have the vip role\nconst member = guild.members.get(message.author.id) || await getMember(guild.id, message.author.id);\n// Member doesn't exist so cancel the command\nif (!member) {\n    sendResponse(message, \\`sorry, but you can not use this command until you become VIP. **Close the IRIS!!!**\\`)\n    return true;\n}\n\n// If the user has the vip role on the support server given by patreon allow the command\nif (member.roles.includes(configs.roleIDs.patreonVIPRoleID)) return false;\n\n// Alert the user they don't have vip and can't use the command\nsendResponse(message, \\`sorry, but you can not use this command until you become a VIP. I'm sorry, Teal'c. We'll go to Disneyland next year. I promise.\\`)\n// Cancel the command since the user does not have vip\nreturn true;\n`}
\n

{`Updating Command Typings`}

\n

{`Since we need a new option on our commands we need to add that. Open the `}{`src/types/commands.ts`}{` file and add in the following`}

\n
{`  vipOnly?: boolean;\n`}
\n

{`Once that is added, you can go into any command and mark them as vip only commands.`}

\n

{`Challenges`}

\n

{`Hell yes! We just got through the entire inhibitor section. You have now mastered everything related to inhibitors.`}

\n

{`You can now try and get a little more practice with inhibitors by trying to challenge yourself and make your own inhibitors. Don't worry if you can't think of any good use cases for inhibitors.`}

\n

{`Majority of Discordeno bots do not use many custom inhibitors because most of the necessary/important ones already come built for you in the inhibitors folder.`}

\n

{`Next we will try our hands at creating a monitor.`}

\n\n
;\n}\n\n;\nMDXContent.isMDXComponent = true;"}} \ No newline at end of file diff --git a/docs/.cache/caches/gatsby-plugin-mdx/diskstore-f96905d8fb403d6ef6bc75ddfe2a2530.json b/docs/.cache/caches/gatsby-plugin-mdx/diskstore-f96905d8fb403d6ef6bc75ddfe2a2530.json new file mode 100644 index 000000000..12b52f3e5 --- /dev/null +++ b/docs/.cache/caches/gatsby-plugin-mdx/diskstore-f96905d8fb403d6ef6bc75ddfe2a2530.json @@ -0,0 +1 @@ +{"expireTime":9007200851596814000,"key":"gatsby-plugin-mdx-entire-payload-84f0cbdba8af839efec48c42c28172fe-","val":{"mdast":{"type":"root","children":[{"type":"export","value":"export const _frontmatter = {\"title\":\"Creating Inhibitors!\",\"metaTitle\":\"Creating An Inhibitor | Discordeno\",\"metaDescription\":\"Let's create our very own bot with Discordeno!\"}","position":{"start":{"line":4,"column":1,"offset":3},"end":{"line":4,"column":177,"offset":179},"indent":[]}}],"position":{"start":{"line":1,"column":1,"offset":0},"end":{"line":4,"column":177,"offset":179}}},"scopeImports":["import * as React from 'react'"],"scopeIdentifiers":["React"],"body":"function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }\n\nfunction _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }\n\nfunction _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }\n\n/* @jsx mdx */\nvar _frontmatter = {\n \"title\": \"Creating Inhibitors!\",\n \"metaTitle\": \"Creating An Inhibitor | Discordeno\",\n \"metaDescription\": \"Let's create our very own bot with Discordeno!\"\n};\nvar layoutProps = {\n _frontmatter: _frontmatter\n};\nvar MDXLayout = \"wrapper\";\nreturn function MDXContent(_ref) {\n var components = _ref.components,\n props = _objectWithoutProperties(_ref, [\"components\"]);\n\n return mdx(MDXLayout, _extends({}, layoutProps, props, {\n components: components,\n mdxType: \"MDXLayout\"\n }));\n}\n;\nMDXContent.isMDXComponent = true;","rawMDXOutput":"/* @jsx mdx */\nimport { mdx } from '@mdx-js/react';\n/* @jsx mdx */\n\nexport const _frontmatter = {\n \"title\": \"Creating Inhibitors!\",\n \"metaTitle\": \"Creating An Inhibitor | Discordeno\",\n \"metaDescription\": \"Let's create our very own bot with Discordeno!\"\n};\n\nconst layoutProps = {\n _frontmatter\n};\nconst MDXLayout = \"wrapper\"\nexport default function MDXContent({\n components,\n ...props\n}) {\n return \n\n ;\n}\n\n;\nMDXContent.isMDXComponent = true;"}} \ No newline at end of file diff --git a/docs/.cache/caches/gatsby-plugin-mdx/diskstore-fab4139b88733bad72b839d16451f95d.json b/docs/.cache/caches/gatsby-plugin-mdx/diskstore-fab4139b88733bad72b839d16451f95d.json new file mode 100644 index 000000000..3a7d004a2 --- /dev/null +++ b/docs/.cache/caches/gatsby-plugin-mdx/diskstore-fab4139b88733bad72b839d16451f95d.json @@ -0,0 +1 @@ +{"expireTime":9007200851633257000,"key":"gatsby-plugin-mdx-entire-payload-0bf8d21896e1a785733569409d91b328-","val":{"mdast":{"type":"root","children":[{"type":"paragraph","children":[{"type":"text","value":"Woah! You are almost half way done with understanding all of Discordeno. Amazing isn't it? Something you may have noticed in the last section was there were some options that prevented some commands from running like ","position":{"start":{"line":2,"column":1,"offset":1},"end":{"line":2,"column":218,"offset":218},"indent":[]}},{"type":"inlineCode","value":"dmOnly","position":{"start":{"line":2,"column":218,"offset":218},"end":{"line":2,"column":226,"offset":226},"indent":[]}},{"type":"text","value":" or the permission options. we created a setting to prevent the monitor from running in certain channels. What if we wanted to do prevent commands from happening? How would we prevent commands from running?","position":{"start":{"line":2,"column":226,"offset":226},"end":{"line":2,"column":432,"offset":432},"indent":[]}}],"position":{"start":{"line":2,"column":1,"offset":1},"end":{"line":2,"column":432,"offset":432},"indent":[]}},{"type":"heading","depth":2,"children":[{"type":"text","value":"What is an Inhibitor?","position":{"start":{"line":4,"column":4,"offset":437},"end":{"line":4,"column":25,"offset":458},"indent":[]}}],"position":{"start":{"line":4,"column":1,"offset":434},"end":{"line":4,"column":25,"offset":458},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"An Inhibitor is very similar to how monitors work. A monitor runs on every message but an inhibitor runs on every command. Remember all those command options like cooldown, permissions, permissionLevel, nsfw, etc... Each and every one of these options has an inhibitor in that checks commands for these settings.","position":{"start":{"line":6,"column":1,"offset":460},"end":{"line":6,"column":313,"offset":772},"indent":[]}}],"position":{"start":{"line":6,"column":1,"offset":460},"end":{"line":6,"column":313,"offset":772},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"Let's create our own inhibitor that would prevent commands from being used if the user is not a VIP user.","position":{"start":{"line":8,"column":1,"offset":774},"end":{"line":8,"column":106,"offset":879},"indent":[]}}],"position":{"start":{"line":8,"column":1,"offset":774},"end":{"line":8,"column":106,"offset":879},"indent":[]}},{"type":"blockquote","children":[{"type":"paragraph","children":[{"type":"strong","children":[{"type":"text","value":"Note:","position":{"start":{"line":10,"column":5,"offset":885},"end":{"line":10,"column":10,"offset":890},"indent":[]}}],"position":{"start":{"line":10,"column":3,"offset":883},"end":{"line":10,"column":12,"offset":892},"indent":[]}},{"type":"text","value":" It is important to remember that everything below can be done with a simple permission level as well. We will create our own custom permission levels but for the purposes of this guide and to be able to learn about Inhibitors, we will be using an inhibitor.","position":{"start":{"line":10,"column":12,"offset":892},"end":{"line":10,"column":270,"offset":1150},"indent":[]}}],"position":{"start":{"line":10,"column":3,"offset":883},"end":{"line":10,"column":270,"offset":1150},"indent":[]}}],"position":{"start":{"line":10,"column":1,"offset":881},"end":{"line":10,"column":270,"offset":1150},"indent":[]}},{"type":"heading","depth":2,"children":[{"type":"text","value":"Creating the File","position":{"start":{"line":12,"column":4,"offset":1155},"end":{"line":12,"column":21,"offset":1172},"indent":[]}}],"position":{"start":{"line":12,"column":1,"offset":1152},"end":{"line":12,"column":21,"offset":1172},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"Let's start by creating a file inside the inhibitors folder called ","position":{"start":{"line":14,"column":1,"offset":1174},"end":{"line":14,"column":68,"offset":1241},"indent":[]}},{"type":"inlineCode","value":"vipOnly.ts","position":{"start":{"line":14,"column":68,"offset":1241},"end":{"line":14,"column":80,"offset":1253},"indent":[]}},{"type":"text","value":" and paste the following snippet of code:","position":{"start":{"line":14,"column":80,"offset":1253},"end":{"line":14,"column":121,"offset":1294},"indent":[]}}],"position":{"start":{"line":14,"column":1,"offset":1174},"end":{"line":14,"column":121,"offset":1294},"indent":[]}},{"type":"code","lang":"ts","meta":null,"value":"import { botCache } from \"../../mod.ts\";\n\nbotCache.inhibitors.set(\"inhibitorname\", async function (message, command, guild) {\n\t// Your code goes here\n});","position":{"start":{"line":16,"column":1,"offset":1296},"end":{"line":22,"column":4,"offset":1459},"indent":[1,1,1,1,1,1]}},{"type":"paragraph","children":[{"type":"text","value":"Inhibitors can take up to 3 arguments.","position":{"start":{"line":24,"column":1,"offset":1461},"end":{"line":24,"column":39,"offset":1499},"indent":[]}}],"position":{"start":{"line":24,"column":1,"offset":1461},"end":{"line":24,"column":39,"offset":1499},"indent":[]}},{"type":"list","ordered":false,"start":null,"spread":false,"children":[{"type":"listItem","spread":false,"checked":null,"children":[{"type":"paragraph","children":[{"type":"inlineCode","value":"message","position":{"start":{"line":26,"column":3,"offset":1503},"end":{"line":26,"column":12,"offset":1512},"indent":[]}},{"type":"text","value":": The message object that triggered the command.","position":{"start":{"line":26,"column":12,"offset":1512},"end":{"line":26,"column":60,"offset":1560},"indent":[]}}],"position":{"start":{"line":26,"column":3,"offset":1503},"end":{"line":26,"column":60,"offset":1560},"indent":[]}}],"position":{"start":{"line":26,"column":1,"offset":1501},"end":{"line":26,"column":60,"offset":1560},"indent":[]}},{"type":"listItem","spread":false,"checked":null,"children":[{"type":"paragraph","children":[{"type":"inlineCode","value":"command","position":{"start":{"line":27,"column":3,"offset":1563},"end":{"line":27,"column":12,"offset":1572},"indent":[]}},{"type":"text","value":": The command object itself that was triggered.","position":{"start":{"line":27,"column":12,"offset":1572},"end":{"line":27,"column":59,"offset":1619},"indent":[]}}],"position":{"start":{"line":27,"column":3,"offset":1563},"end":{"line":27,"column":59,"offset":1619},"indent":[]}}],"position":{"start":{"line":27,"column":1,"offset":1561},"end":{"line":27,"column":59,"offset":1619},"indent":[]}},{"type":"listItem","spread":false,"checked":null,"children":[{"type":"paragraph","children":[{"type":"inlineCode","value":"guild","position":{"start":{"line":28,"column":3,"offset":1622},"end":{"line":28,"column":10,"offset":1629},"indent":[]}},{"type":"text","value":": The server guild object where this command was ran.","position":{"start":{"line":28,"column":10,"offset":1629},"end":{"line":28,"column":63,"offset":1682},"indent":[]}}],"position":{"start":{"line":28,"column":3,"offset":1622},"end":{"line":28,"column":63,"offset":1682},"indent":[]}}],"position":{"start":{"line":28,"column":1,"offset":1620},"end":{"line":28,"column":63,"offset":1682},"indent":[]}}],"position":{"start":{"line":26,"column":1,"offset":1501},"end":{"line":28,"column":63,"offset":1682},"indent":[1,1]}},{"type":"heading","depth":2,"children":[{"type":"text","value":"Understanding How Inhibitors Function","position":{"start":{"line":30,"column":4,"offset":1687},"end":{"line":30,"column":41,"offset":1724},"indent":[]}}],"position":{"start":{"line":30,"column":1,"offset":1684},"end":{"line":30,"column":41,"offset":1724},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"To block a command you have to return a truthy value.","position":{"start":{"line":32,"column":1,"offset":1726},"end":{"line":32,"column":54,"offset":1779},"indent":[]}}],"position":{"start":{"line":32,"column":1,"offset":1726},"end":{"line":32,"column":54,"offset":1779},"indent":[]}},{"type":"list","ordered":false,"start":null,"spread":false,"children":[{"type":"listItem","spread":false,"checked":null,"children":[{"type":"paragraph","children":[{"type":"strong","children":[{"type":"text","value":"return true;","position":{"start":{"line":33,"column":5,"offset":1784},"end":{"line":33,"column":17,"offset":1796},"indent":[]}}],"position":{"start":{"line":33,"column":3,"offset":1782},"end":{"line":33,"column":19,"offset":1798},"indent":[]}},{"type":"text","value":" If you return true the inhibitor will block the execution of the command.\nTo allow a command return a falsey value.","position":{"start":{"line":33,"column":19,"offset":1798},"end":{"line":34,"column":42,"offset":1914},"indent":[1]}}],"position":{"start":{"line":33,"column":3,"offset":1782},"end":{"line":34,"column":42,"offset":1914},"indent":[1]}}],"position":{"start":{"line":33,"column":1,"offset":1780},"end":{"line":34,"column":42,"offset":1914},"indent":[1]}},{"type":"listItem","spread":false,"checked":null,"children":[{"type":"paragraph","children":[{"type":"strong","children":[{"type":"text","value":"return false;","position":{"start":{"line":35,"column":5,"offset":1919},"end":{"line":35,"column":18,"offset":1932},"indent":[]}}],"position":{"start":{"line":35,"column":3,"offset":1917},"end":{"line":35,"column":20,"offset":1934},"indent":[]}},{"type":"text","value":" If you return false the inhibitor will not block the error.","position":{"start":{"line":35,"column":20,"offset":1934},"end":{"line":35,"column":80,"offset":1994},"indent":[]}}],"position":{"start":{"line":35,"column":3,"offset":1917},"end":{"line":35,"column":80,"offset":1994},"indent":[]}}],"position":{"start":{"line":35,"column":1,"offset":1915},"end":{"line":35,"column":80,"offset":1994},"indent":[]}}],"position":{"start":{"line":33,"column":1,"offset":1780},"end":{"line":35,"column":80,"offset":1994},"indent":[1,1]}},{"type":"code","lang":"ts","meta":null,"value":"// If the command is not VIP only we can allow this command to execute\nif (!command.vipOnly) return false;\n\n// Check if the user is VIP\nconst userIsVIP = message.author.settings.get(`isVIP`)\n// The user is VIP so we can allow this command to be used\nif (userIsVIP) return false\n\n// The user is NOT VIP so we throw an error\nthrow `The ${command.name} is only allowed for VIP users.`","position":{"start":{"line":38,"column":1,"offset":1997},"end":{"line":49,"column":4,"offset":2388},"indent":[1,1,1,1,1,1,1,1,1,1,1]}},{"type":"export","value":"export const _frontmatter = {\"title\":\"Creating Inhibitors!\",\"metaTitle\":\"Creating An Inhibitor | Discordeno\",\"metaDescription\":\"Let's create our very own bot with Discordeno!\"}","position":{"start":{"line":52,"column":1,"offset":2391},"end":{"line":52,"column":177,"offset":2567},"indent":[]}}],"position":{"start":{"line":1,"column":1,"offset":0},"end":{"line":52,"column":177,"offset":2567}}},"scopeImports":["import * as React from 'react'"],"scopeIdentifiers":["React"],"body":"function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }\n\nfunction _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }\n\nfunction _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }\n\n/* @jsx mdx */\nvar _frontmatter = {\n \"title\": \"Creating Inhibitors!\",\n \"metaTitle\": \"Creating An Inhibitor | Discordeno\",\n \"metaDescription\": \"Let's create our very own bot with Discordeno!\"\n};\nvar layoutProps = {\n _frontmatter: _frontmatter\n};\nvar MDXLayout = \"wrapper\";\nreturn function MDXContent(_ref) {\n var components = _ref.components,\n props = _objectWithoutProperties(_ref, [\"components\"]);\n\n return mdx(MDXLayout, _extends({}, layoutProps, props, {\n components: components,\n mdxType: \"MDXLayout\"\n }), mdx(\"p\", null, \"Woah! You are almost half way done with understanding all of Discordeno. Amazing isn't it? Something you may have noticed in the last section was there were some options that prevented some commands from running like \", mdx(\"inlineCode\", {\n parentName: \"p\"\n }, \"dmOnly\"), \" or the permission options. we created a setting to prevent the monitor from running in certain channels. What if we wanted to do prevent commands from happening? How would we prevent commands from running?\"), mdx(\"h2\", null, \"What is an Inhibitor?\"), mdx(\"p\", null, \"An Inhibitor is very similar to how monitors work. A monitor runs on every message but an inhibitor runs on every command. Remember all those command options like cooldown, permissions, permissionLevel, nsfw, etc... Each and every one of these options has an inhibitor in that checks commands for these settings.\"), mdx(\"p\", null, \"Let's create our own inhibitor that would prevent commands from being used if the user is not a VIP user.\"), mdx(\"blockquote\", null, mdx(\"p\", {\n parentName: \"blockquote\"\n }, mdx(\"strong\", {\n parentName: \"p\"\n }, \"Note:\"), \" It is important to remember that everything below can be done with a simple permission level as well. We will create our own custom permission levels but for the purposes of this guide and to be able to learn about Inhibitors, we will be using an inhibitor.\")), mdx(\"h2\", null, \"Creating the File\"), mdx(\"p\", null, \"Let's start by creating a file inside the inhibitors folder called \", mdx(\"inlineCode\", {\n parentName: \"p\"\n }, \"vipOnly.ts\"), \" and paste the following snippet of code:\"), mdx(\"pre\", null, mdx(\"code\", _extends({\n parentName: \"pre\"\n }, {\n \"className\": \"language-ts\"\n }), \"import { botCache } from \\\"../../mod.ts\\\";\\n\\nbotCache.inhibitors.set(\\\"inhibitorname\\\", async function (message, command, guild) {\\n // Your code goes here\\n});\\n\")), mdx(\"p\", null, \"Inhibitors can take up to 3 arguments.\"), mdx(\"ul\", null, mdx(\"li\", {\n parentName: \"ul\"\n }, mdx(\"inlineCode\", {\n parentName: \"li\"\n }, \"message\"), \": The message object that triggered the command.\"), mdx(\"li\", {\n parentName: \"ul\"\n }, mdx(\"inlineCode\", {\n parentName: \"li\"\n }, \"command\"), \": The command object itself that was triggered.\"), mdx(\"li\", {\n parentName: \"ul\"\n }, mdx(\"inlineCode\", {\n parentName: \"li\"\n }, \"guild\"), \": The server guild object where this command was ran.\")), mdx(\"h2\", null, \"Understanding How Inhibitors Function\"), mdx(\"p\", null, \"To block a command you have to return a truthy value.\"), mdx(\"ul\", null, mdx(\"li\", {\n parentName: \"ul\"\n }, mdx(\"strong\", {\n parentName: \"li\"\n }, \"return true;\"), \" If you return true the inhibitor will block the execution of the command.\\nTo allow a command return a falsey value.\"), mdx(\"li\", {\n parentName: \"ul\"\n }, mdx(\"strong\", {\n parentName: \"li\"\n }, \"return false;\"), \" If you return false the inhibitor will not block the error.\")), mdx(\"pre\", null, mdx(\"code\", _extends({\n parentName: \"pre\"\n }, {\n \"className\": \"language-ts\"\n }), \"// If the command is not VIP only we can allow this command to execute\\nif (!command.vipOnly) return false;\\n\\n// Check if the user is VIP\\nconst userIsVIP = message.author.settings.get(`isVIP`)\\n// The user is VIP so we can allow this command to be used\\nif (userIsVIP) return false\\n\\n// The user is NOT VIP so we throw an error\\nthrow `The ${command.name} is only allowed for VIP users.`\\n\")));\n}\n;\nMDXContent.isMDXComponent = true;","rawMDXOutput":"/* @jsx mdx */\nimport { mdx } from '@mdx-js/react';\n/* @jsx mdx */\n\nexport const _frontmatter = {\n \"title\": \"Creating Inhibitors!\",\n \"metaTitle\": \"Creating An Inhibitor | Discordeno\",\n \"metaDescription\": \"Let's create our very own bot with Discordeno!\"\n};\n\nconst layoutProps = {\n _frontmatter\n};\nconst MDXLayout = \"wrapper\"\nexport default function MDXContent({\n components,\n ...props\n}) {\n return \n

{`Woah! You are almost half way done with understanding all of Discordeno. Amazing isn't it? Something you may have noticed in the last section was there were some options that prevented some commands from running like `}{`dmOnly`}{` or the permission options. we created a setting to prevent the monitor from running in certain channels. What if we wanted to do prevent commands from happening? How would we prevent commands from running?`}

\n

{`What is an Inhibitor?`}

\n

{`An Inhibitor is very similar to how monitors work. A monitor runs on every message but an inhibitor runs on every command. Remember all those command options like cooldown, permissions, permissionLevel, nsfw, etc... Each and every one of these options has an inhibitor in that checks commands for these settings.`}

\n

{`Let's create our own inhibitor that would prevent commands from being used if the user is not a VIP user.`}

\n
\n

{`Note:`}{` It is important to remember that everything below can be done with a simple permission level as well. We will create our own custom permission levels but for the purposes of this guide and to be able to learn about Inhibitors, we will be using an inhibitor.`}

\n
\n

{`Creating the File`}

\n

{`Let's start by creating a file inside the inhibitors folder called `}{`vipOnly.ts`}{` and paste the following snippet of code:`}

\n
{`import { botCache } from \"../../mod.ts\";\n\nbotCache.inhibitors.set(\"inhibitorname\", async function (message, command, guild) {\n    // Your code goes here\n});\n`}
\n

{`Inhibitors can take up to 3 arguments.`}

\n
    \n
  • {`message`}{`: The message object that triggered the command.`}
  • \n
  • {`command`}{`: The command object itself that was triggered.`}
  • \n
  • {`guild`}{`: The server guild object where this command was ran.`}
  • \n
\n

{`Understanding How Inhibitors Function`}

\n

{`To block a command you have to return a truthy value.`}

\n
    \n
  • {`return true;`}{` If you return true the inhibitor will block the execution of the command.\nTo allow a command return a falsey value.`}
  • \n
  • {`return false;`}{` If you return false the inhibitor will not block the error.`}
  • \n
\n
{`// If the command is not VIP only we can allow this command to execute\nif (!command.vipOnly) return false;\n\n// Check if the user is VIP\nconst userIsVIP = message.author.settings.get(\\`isVIP\\`)\n// The user is VIP so we can allow this command to be used\nif (userIsVIP) return false\n\n// The user is NOT VIP so we throw an error\nthrow \\`The \\${command.name} is only allowed for VIP users.\\`\n`}
\n\n
;\n}\n\n;\nMDXContent.isMDXComponent = true;"}} \ No newline at end of file diff --git a/docs/.cache/caches/gatsby-plugin-mdx/diskstore-fd2bca5948303a0e809d0df23a488374.json b/docs/.cache/caches/gatsby-plugin-mdx/diskstore-fd2bca5948303a0e809d0df23a488374.json new file mode 100644 index 000000000..adbd67934 --- /dev/null +++ b/docs/.cache/caches/gatsby-plugin-mdx/diskstore-fd2bca5948303a0e809d0df23a488374.json @@ -0,0 +1 @@ +{"expireTime":9007200851596121000,"key":"gatsby-plugin-mdx-entire-payload-923538a22d43c595db1c95ae8fd5a492-","val":{"mdast":{"type":"root","children":[{"type":"paragraph","children":[{"type":"text","value":"Discordeno is a Third Party Deno Library for interacting with the Discord API.","position":{"start":{"line":2,"column":1,"offset":1},"end":{"line":2,"column":79,"offset":79},"indent":[]}}],"position":{"start":{"line":2,"column":1,"offset":1},"end":{"line":2,"column":79,"offset":79},"indent":[]}},{"type":"paragraph","children":[{"type":"image","title":null,"url":"https://i.imgur.com/Cq7nNd0.png","alt":"Banner","position":{"start":{"line":4,"column":1,"offset":81},"end":{"line":4,"column":43,"offset":123},"indent":[]}}],"position":{"start":{"line":4,"column":1,"offset":81},"end":{"line":4,"column":43,"offset":123},"indent":[]}},{"type":"heading","depth":2,"children":[{"type":"text","value":"Why should you use Discordeno?","position":{"start":{"line":6,"column":4,"offset":128},"end":{"line":6,"column":34,"offset":158},"indent":[]}}],"position":{"start":{"line":6,"column":1,"offset":125},"end":{"line":6,"column":34,"offset":158},"indent":[]}},{"type":"list","ordered":false,"start":null,"spread":false,"children":[{"type":"listItem","spread":false,"checked":null,"children":[{"type":"paragraph","children":[{"type":"text","value":"Best TypeScript Support","position":{"start":{"line":7,"column":3,"offset":161},"end":{"line":7,"column":26,"offset":184},"indent":[]}}],"position":{"start":{"line":7,"column":3,"offset":161},"end":{"line":7,"column":26,"offset":184},"indent":[]}}],"position":{"start":{"line":7,"column":1,"offset":159},"end":{"line":7,"column":26,"offset":184},"indent":[]}},{"type":"listItem","spread":false,"checked":null,"children":[{"type":"paragraph","children":[{"type":"text","value":"Stable Library","position":{"start":{"line":8,"column":3,"offset":187},"end":{"line":8,"column":17,"offset":201},"indent":[]}}],"position":{"start":{"line":8,"column":3,"offset":187},"end":{"line":8,"column":17,"offset":201},"indent":[]}}],"position":{"start":{"line":8,"column":1,"offset":185},"end":{"line":8,"column":17,"offset":201},"indent":[]}},{"type":"listItem","spread":false,"checked":null,"children":[{"type":"paragraph","children":[{"type":"text","value":"Easy to use Boilerplates","position":{"start":{"line":9,"column":3,"offset":204},"end":{"line":9,"column":27,"offset":228},"indent":[]}}],"position":{"start":{"line":9,"column":3,"offset":204},"end":{"line":9,"column":27,"offset":228},"indent":[]}}],"position":{"start":{"line":9,"column":1,"offset":202},"end":{"line":9,"column":27,"offset":228},"indent":[]}},{"type":"listItem","spread":false,"checked":null,"children":[{"type":"paragraph","children":[{"type":"text","value":"Security","position":{"start":{"line":10,"column":3,"offset":231},"end":{"line":10,"column":11,"offset":239},"indent":[]}}],"position":{"start":{"line":10,"column":3,"offset":231},"end":{"line":10,"column":11,"offset":239},"indent":[]}}],"position":{"start":{"line":10,"column":1,"offset":229},"end":{"line":10,"column":11,"offset":239},"indent":[]}},{"type":"listItem","spread":false,"checked":null,"children":[{"type":"paragraph","children":[{"type":"text","value":"Built in Documentation","position":{"start":{"line":11,"column":3,"offset":242},"end":{"line":11,"column":25,"offset":264},"indent":[]}}],"position":{"start":{"line":11,"column":3,"offset":242},"end":{"line":11,"column":25,"offset":264},"indent":[]}}],"position":{"start":{"line":11,"column":1,"offset":240},"end":{"line":11,"column":25,"offset":264},"indent":[]}},{"type":"listItem","spread":false,"checked":null,"children":[{"type":"paragraph","children":[{"type":"text","value":"Minimalistic","position":{"start":{"line":12,"column":3,"offset":267},"end":{"line":12,"column":15,"offset":279},"indent":[]}}],"position":{"start":{"line":12,"column":3,"offset":267},"end":{"line":12,"column":15,"offset":279},"indent":[]}}],"position":{"start":{"line":12,"column":1,"offset":265},"end":{"line":12,"column":15,"offset":279},"indent":[]}},{"type":"listItem","spread":false,"checked":null,"children":[{"type":"paragraph","children":[{"type":"text","value":"Functional API","position":{"start":{"line":13,"column":3,"offset":282},"end":{"line":13,"column":17,"offset":296},"indent":[]}}],"position":{"start":{"line":13,"column":3,"offset":282},"end":{"line":13,"column":17,"offset":296},"indent":[]}}],"position":{"start":{"line":13,"column":1,"offset":280},"end":{"line":13,"column":17,"offset":296},"indent":[]}},{"type":"listItem","spread":false,"checked":null,"children":[{"type":"paragraph","children":[{"type":"text","value":"Latest and Greatest JavaScript","position":{"start":{"line":14,"column":3,"offset":299},"end":{"line":14,"column":33,"offset":329},"indent":[]}}],"position":{"start":{"line":14,"column":3,"offset":299},"end":{"line":14,"column":33,"offset":329},"indent":[]}}],"position":{"start":{"line":14,"column":1,"offset":297},"end":{"line":14,"column":33,"offset":329},"indent":[]}},{"type":"listItem","spread":false,"checked":null,"children":[{"type":"paragraph","children":[{"type":"text","value":"Actively Maintained!","position":{"start":{"line":15,"column":3,"offset":332},"end":{"line":15,"column":23,"offset":352},"indent":[]}}],"position":{"start":{"line":15,"column":3,"offset":332},"end":{"line":15,"column":23,"offset":352},"indent":[]}}],"position":{"start":{"line":15,"column":1,"offset":330},"end":{"line":15,"column":23,"offset":352},"indent":[]}}],"position":{"start":{"line":7,"column":1,"offset":159},"end":{"line":15,"column":23,"offset":352},"indent":[1,1,1,1,1,1,1,1]}},{"type":"heading","depth":2,"children":[{"type":"text","value":"Read me first...","position":{"start":{"line":17,"column":4,"offset":357},"end":{"line":17,"column":20,"offset":373},"indent":[]}}],"position":{"start":{"line":17,"column":1,"offset":354},"end":{"line":17,"column":20,"offset":373},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"Discordeno is cool right? You could make the next big bot! Who knows, but before we get right into developing our Bot. We want to get started with learning the basics...","position":{"start":{"line":18,"column":1,"offset":374},"end":{"line":18,"column":170,"offset":543},"indent":[]}}],"position":{"start":{"line":18,"column":1,"offset":374},"end":{"line":18,"column":170,"offset":543},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"You've seen how amazing Discord Bots are built and functioned! So beginning with Discordeno always starts with learning the TypeScript and/or JavaScript programming languages first. Making a Discord bot with very little knowledge is possible, it can be a challenge! You may end up dealing with Console errors or just syntax typographical errors...","position":{"start":{"line":20,"column":1,"offset":545},"end":{"line":20,"column":348,"offset":892},"indent":[]}}],"position":{"start":{"line":20,"column":1,"offset":545},"end":{"line":20,"column":348,"offset":892},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"If you are new to Discordeno, TypeScript or JavaScript, here are some great resources:","position":{"start":{"line":22,"column":1,"offset":894},"end":{"line":22,"column":87,"offset":980},"indent":[]}}],"position":{"start":{"line":22,"column":1,"offset":894},"end":{"line":22,"column":87,"offset":980},"indent":[]}},{"type":"list","ordered":false,"start":null,"spread":false,"children":[{"type":"listItem","spread":false,"checked":null,"children":[{"type":"paragraph","children":[{"type":"link","title":null,"url":"https://www.typescriptlang.org/docs/home.html","children":[{"type":"text","value":"Official TypeScript Documentation","position":{"start":{"line":24,"column":4,"offset":985},"end":{"line":24,"column":37,"offset":1018},"indent":[]}}],"position":{"start":{"line":24,"column":3,"offset":984},"end":{"line":24,"column":85,"offset":1066},"indent":[]}}],"position":{"start":{"line":24,"column":3,"offset":984},"end":{"line":24,"column":85,"offset":1066},"indent":[]}}],"position":{"start":{"line":24,"column":1,"offset":982},"end":{"line":24,"column":85,"offset":1066},"indent":[]}},{"type":"listItem","spread":false,"checked":null,"children":[{"type":"paragraph","children":[{"type":"link","title":null,"url":"https://devdocs.io/javascript/","children":[{"type":"text","value":"JavaScript Documentation from Devdocs","position":{"start":{"line":25,"column":4,"offset":1070},"end":{"line":25,"column":41,"offset":1107},"indent":[]}}],"position":{"start":{"line":25,"column":3,"offset":1069},"end":{"line":25,"column":74,"offset":1140},"indent":[]}}],"position":{"start":{"line":25,"column":3,"offset":1069},"end":{"line":25,"column":74,"offset":1140},"indent":[]}}],"position":{"start":{"line":25,"column":1,"offset":1067},"end":{"line":25,"column":74,"offset":1140},"indent":[]}},{"type":"listItem","spread":false,"checked":null,"children":[{"type":"paragraph","children":[{"type":"link","title":null,"url":"https://www.codecademy.com/","children":[{"type":"text","value":"Codecademy","position":{"start":{"line":26,"column":4,"offset":1144},"end":{"line":26,"column":14,"offset":1154},"indent":[]}}],"position":{"start":{"line":26,"column":3,"offset":1143},"end":{"line":26,"column":44,"offset":1184},"indent":[]}}],"position":{"start":{"line":26,"column":3,"offset":1143},"end":{"line":26,"column":44,"offset":1184},"indent":[]}}],"position":{"start":{"line":26,"column":1,"offset":1141},"end":{"line":26,"column":44,"offset":1184},"indent":[]}},{"type":"listItem","spread":false,"checked":null,"children":[{"type":"paragraph","children":[{"type":"link","title":null,"url":"https://basarat.gitbook.io/typescript/","children":[{"type":"text","value":"TypeScript Deep Dive","position":{"start":{"line":27,"column":4,"offset":1188},"end":{"line":27,"column":24,"offset":1208},"indent":[]}}],"position":{"start":{"line":27,"column":3,"offset":1187},"end":{"line":27,"column":65,"offset":1249},"indent":[]}}],"position":{"start":{"line":27,"column":3,"offset":1187},"end":{"line":27,"column":65,"offset":1249},"indent":[]}}],"position":{"start":{"line":27,"column":1,"offset":1185},"end":{"line":27,"column":65,"offset":1249},"indent":[]}},{"type":"listItem","spread":false,"checked":null,"children":[{"type":"paragraph","children":[{"type":"link","title":null,"url":"https://www.youtube.com/watch?v=NHHhiqwcfRM","children":[{"type":"text","value":"Deno Crash Course by Traversy Media","position":{"start":{"line":28,"column":4,"offset":1253},"end":{"line":28,"column":39,"offset":1288},"indent":[]}}],"position":{"start":{"line":28,"column":3,"offset":1252},"end":{"line":28,"column":85,"offset":1334},"indent":[]}}],"position":{"start":{"line":28,"column":3,"offset":1252},"end":{"line":28,"column":85,"offset":1334},"indent":[]}}],"position":{"start":{"line":28,"column":1,"offset":1250},"end":{"line":28,"column":85,"offset":1334},"indent":[]}},{"type":"listItem","spread":false,"checked":null,"children":[{"type":"paragraph","children":[{"type":"link","title":null,"url":"https://www.youtube.com/watch?v=rAy_3SIqT-E","children":[{"type":"text","value":"TypeScript Crash Course by Traversy Media","position":{"start":{"line":29,"column":4,"offset":1338},"end":{"line":29,"column":45,"offset":1379},"indent":[]}}],"position":{"start":{"line":29,"column":3,"offset":1337},"end":{"line":29,"column":91,"offset":1425},"indent":[]}}],"position":{"start":{"line":29,"column":3,"offset":1337},"end":{"line":29,"column":91,"offset":1425},"indent":[]}}],"position":{"start":{"line":29,"column":1,"offset":1335},"end":{"line":29,"column":91,"offset":1425},"indent":[]}}],"position":{"start":{"line":24,"column":1,"offset":982},"end":{"line":29,"column":91,"offset":1425},"indent":[1,1,1,1,1]}},{"type":"paragraph","children":[{"type":"text","value":"There is always more resources... Take your time and don't fret! Come back when you are ready, we can't wait to see what your Discordeno created bot does!","position":{"start":{"line":31,"column":1,"offset":1427},"end":{"line":31,"column":155,"offset":1581},"indent":[]}}],"position":{"start":{"line":31,"column":1,"offset":1427},"end":{"line":31,"column":155,"offset":1581},"indent":[]}},{"type":"export","value":"export const _frontmatter = {\"title\":\"Introduction\",\"metaTitle\":\"Introduction | Discordeno\",\"metaDescription\":\"Discordeno is a Third Party Deno Library for interacting with the Discord API.\"}","position":{"start":{"line":34,"column":1,"offset":1584},"end":{"line":34,"column":192,"offset":1775},"indent":[]}}],"position":{"start":{"line":1,"column":1,"offset":0},"end":{"line":34,"column":192,"offset":1775}}},"scopeImports":["import * as React from 'react'"],"scopeIdentifiers":["React"],"body":"function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }\n\nfunction _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }\n\nfunction _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }\n\n/* @jsx mdx */\nvar _frontmatter = {\n \"title\": \"Introduction\",\n \"metaTitle\": \"Introduction | Discordeno\",\n \"metaDescription\": \"Discordeno is a Third Party Deno Library for interacting with the Discord API.\"\n};\nvar layoutProps = {\n _frontmatter: _frontmatter\n};\nvar MDXLayout = \"wrapper\";\nreturn function MDXContent(_ref) {\n var components = _ref.components,\n props = _objectWithoutProperties(_ref, [\"components\"]);\n\n return mdx(MDXLayout, _extends({}, layoutProps, props, {\n components: components,\n mdxType: \"MDXLayout\"\n }), mdx(\"p\", null, \"Discordeno is a Third Party Deno Library for interacting with the Discord API.\"), mdx(\"p\", null, mdx(\"img\", _extends({\n parentName: \"p\"\n }, {\n \"src\": \"https://i.imgur.com/Cq7nNd0.png\",\n \"alt\": \"Banner\"\n }))), mdx(\"h2\", null, \"Why should you use Discordeno?\"), mdx(\"ul\", null, mdx(\"li\", {\n parentName: \"ul\"\n }, \"Best TypeScript Support\"), mdx(\"li\", {\n parentName: \"ul\"\n }, \"Stable Library\"), mdx(\"li\", {\n parentName: \"ul\"\n }, \"Easy to use Boilerplates\"), mdx(\"li\", {\n parentName: \"ul\"\n }, \"Security\"), mdx(\"li\", {\n parentName: \"ul\"\n }, \"Built in Documentation\"), mdx(\"li\", {\n parentName: \"ul\"\n }, \"Minimalistic\"), mdx(\"li\", {\n parentName: \"ul\"\n }, \"Functional API\"), mdx(\"li\", {\n parentName: \"ul\"\n }, \"Latest and Greatest JavaScript\"), mdx(\"li\", {\n parentName: \"ul\"\n }, \"Actively Maintained!\")), mdx(\"h2\", null, \"Read me first...\"), mdx(\"p\", null, \"Discordeno is cool right? You could make the next big bot! Who knows, but before we get right into developing our Bot. We want to get started with learning the basics...\"), mdx(\"p\", null, \"You've seen how amazing Discord Bots are built and functioned! So beginning with Discordeno always starts with learning the TypeScript and/or JavaScript programming languages first. Making a Discord bot with very little knowledge is possible, it can be a challenge! You may end up dealing with Console errors or just syntax typographical errors...\"), mdx(\"p\", null, \"If you are new to Discordeno, TypeScript or JavaScript, here are some great resources:\"), mdx(\"ul\", null, mdx(\"li\", {\n parentName: \"ul\"\n }, mdx(\"a\", _extends({\n parentName: \"li\"\n }, {\n \"href\": \"https://www.typescriptlang.org/docs/home.html\"\n }), \"Official TypeScript Documentation\")), mdx(\"li\", {\n parentName: \"ul\"\n }, mdx(\"a\", _extends({\n parentName: \"li\"\n }, {\n \"href\": \"https://devdocs.io/javascript/\"\n }), \"JavaScript Documentation from Devdocs\")), mdx(\"li\", {\n parentName: \"ul\"\n }, mdx(\"a\", _extends({\n parentName: \"li\"\n }, {\n \"href\": \"https://www.codecademy.com/\"\n }), \"Codecademy\")), mdx(\"li\", {\n parentName: \"ul\"\n }, mdx(\"a\", _extends({\n parentName: \"li\"\n }, {\n \"href\": \"https://basarat.gitbook.io/typescript/\"\n }), \"TypeScript Deep Dive\")), mdx(\"li\", {\n parentName: \"ul\"\n }, mdx(\"a\", _extends({\n parentName: \"li\"\n }, {\n \"href\": \"https://www.youtube.com/watch?v=NHHhiqwcfRM\"\n }), \"Deno Crash Course by Traversy Media\")), mdx(\"li\", {\n parentName: \"ul\"\n }, mdx(\"a\", _extends({\n parentName: \"li\"\n }, {\n \"href\": \"https://www.youtube.com/watch?v=rAy_3SIqT-E\"\n }), \"TypeScript Crash Course by Traversy Media\"))), mdx(\"p\", null, \"There is always more resources... Take your time and don't fret! Come back when you are ready, we can't wait to see what your Discordeno created bot does!\"));\n}\n;\nMDXContent.isMDXComponent = true;","rawMDXOutput":"/* @jsx mdx */\nimport { mdx } from '@mdx-js/react';\n/* @jsx mdx */\n\nexport const _frontmatter = {\n \"title\": \"Introduction\",\n \"metaTitle\": \"Introduction | Discordeno\",\n \"metaDescription\": \"Discordeno is a Third Party Deno Library for interacting with the Discord API.\"\n};\n\nconst layoutProps = {\n _frontmatter\n};\nconst MDXLayout = \"wrapper\"\nexport default function MDXContent({\n components,\n ...props\n}) {\n return \n

{`Discordeno is a Third Party Deno Library for interacting with the Discord API.`}

\n

\n

{`Why should you use Discordeno?`}

\n
    \n
  • {`Best TypeScript Support`}
  • \n
  • {`Stable Library`}
  • \n
  • {`Easy to use Boilerplates`}
  • \n
  • {`Security`}
  • \n
  • {`Built in Documentation`}
  • \n
  • {`Minimalistic`}
  • \n
  • {`Functional API`}
  • \n
  • {`Latest and Greatest JavaScript`}
  • \n
  • {`Actively Maintained!`}
  • \n
\n

{`Read me first...`}

\n

{`Discordeno is cool right? You could make the next big bot! Who knows, but before we get right into developing our Bot. We want to get started with learning the basics...`}

\n

{`You've seen how amazing Discord Bots are built and functioned! So beginning with Discordeno always starts with learning the TypeScript and/or JavaScript programming languages first. Making a Discord bot with very little knowledge is possible, it can be a challenge! You may end up dealing with Console errors or just syntax typographical errors...`}

\n

{`If you are new to Discordeno, TypeScript or JavaScript, here are some great resources:`}

\n \n

{`There is always more resources... Take your time and don't fret! Come back when you are ready, we can't wait to see what your Discordeno created bot does!`}

\n\n
;\n}\n\n;\nMDXContent.isMDXComponent = true;"}} \ No newline at end of file diff --git a/docs/.cache/caches/gatsby-plugin-mdx/diskstore-febbefc413098db85509b541775a63c8.json b/docs/.cache/caches/gatsby-plugin-mdx/diskstore-febbefc413098db85509b541775a63c8.json new file mode 100644 index 000000000..160dc4d49 --- /dev/null +++ b/docs/.cache/caches/gatsby-plugin-mdx/diskstore-febbefc413098db85509b541775a63c8.json @@ -0,0 +1 @@ +{"expireTime":9007200851635118000,"key":"gatsby-plugin-mdx-entire-payload-8a68d47addf27159ef4cfe396b5278f1-","val":{"mdast":{"type":"root","children":[{"type":"paragraph","children":[{"type":"text","value":"Woah! You are almost half way done with understanding all of Discordeno. Amazing isn't it? Something you may have noticed in the last section was when the bot started up you could see a bunch of messages like ","position":{"start":{"line":2,"column":1,"offset":1},"end":{"line":2,"column":210,"offset":210},"indent":[]}}],"position":{"start":{"line":2,"column":1,"offset":1},"end":{"line":2,"column":210,"offset":210},"indent":[]}},{"type":"heading","depth":2,"children":[{"type":"text","value":"What Is An Event?","position":{"start":{"line":4,"column":4,"offset":215},"end":{"line":4,"column":21,"offset":232},"indent":[]}}],"position":{"start":{"line":4,"column":1,"offset":212},"end":{"line":4,"column":21,"offset":232},"indent":[]}},{"type":"export","value":"export const _frontmatter = {\"title\":\"Creating Events!\",\"metaTitle\":\"Creating An Event | Discordeno\",\"metaDescription\":\"Let's create our very own bot with Discordeno!\"}","position":{"start":{"line":8,"column":1,"offset":236},"end":{"line":8,"column":169,"offset":404},"indent":[]}}],"position":{"start":{"line":1,"column":1,"offset":0},"end":{"line":8,"column":169,"offset":404}}},"scopeImports":["import * as React from 'react'"],"scopeIdentifiers":["React"],"body":"function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }\n\nfunction _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }\n\nfunction _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }\n\n/* @jsx mdx */\nvar _frontmatter = {\n \"title\": \"Creating Events!\",\n \"metaTitle\": \"Creating An Event | Discordeno\",\n \"metaDescription\": \"Let's create our very own bot with Discordeno!\"\n};\nvar layoutProps = {\n _frontmatter: _frontmatter\n};\nvar MDXLayout = \"wrapper\";\nreturn function MDXContent(_ref) {\n var components = _ref.components,\n props = _objectWithoutProperties(_ref, [\"components\"]);\n\n return mdx(MDXLayout, _extends({}, layoutProps, props, {\n components: components,\n mdxType: \"MDXLayout\"\n }), mdx(\"p\", null, \"Woah! You are almost half way done with understanding all of Discordeno. Amazing isn't it? Something you may have noticed in the last section was when the bot started up you could see a bunch of messages like \"), mdx(\"h2\", null, \"What Is An Event?\"));\n}\n;\nMDXContent.isMDXComponent = true;","rawMDXOutput":"/* @jsx mdx */\nimport { mdx } from '@mdx-js/react';\n/* @jsx mdx */\n\nexport const _frontmatter = {\n \"title\": \"Creating Events!\",\n \"metaTitle\": \"Creating An Event | Discordeno\",\n \"metaDescription\": \"Let's create our very own bot with Discordeno!\"\n};\n\nconst layoutProps = {\n _frontmatter\n};\nconst MDXLayout = \"wrapper\"\nexport default function MDXContent({\n components,\n ...props\n}) {\n return \n

{`Woah! You are almost half way done with understanding all of Discordeno. Amazing isn't it? Something you may have noticed in the last section was when the bot started up you could see a bunch of messages like `}

\n

{`What Is An Event?`}

\n\n
;\n}\n\n;\nMDXContent.isMDXComponent = true;"}} \ No newline at end of file diff --git a/docs/.cache/caches/gatsby-plugin-mdx/diskstore-fec66b01cb65f13e4b4c6eb2a4fc30fd.json b/docs/.cache/caches/gatsby-plugin-mdx/diskstore-fec66b01cb65f13e4b4c6eb2a4fc30fd.json new file mode 100644 index 000000000..42d00ea44 --- /dev/null +++ b/docs/.cache/caches/gatsby-plugin-mdx/diskstore-fec66b01cb65f13e4b4c6eb2a4fc30fd.json @@ -0,0 +1 @@ +{"expireTime":9007200851635206000,"key":"gatsby-plugin-mdx-entire-payload-3f7eb8eca364d8874896324854d55546-","val":{"mdast":{"type":"root","children":[{"type":"paragraph","children":[{"type":"text","value":"Woah! You are almost half way done with understanding all of Discordeno. Amazing isn't it? Something you may have noticed in the last section was when the bot started up you could see a bunch of messages like ","position":{"start":{"line":2,"column":1,"offset":1},"end":{"line":2,"column":210,"offset":210},"indent":[]}},{"type":"inlineCode","value":"Loaded X Commands","position":{"start":{"line":2,"column":210,"offset":210},"end":{"line":2,"column":229,"offset":229},"indent":[]}},{"type":"text","value":" and such. Let's jump into this part now and understand how event handling works in Discordeno.","position":{"start":{"line":2,"column":229,"offset":229},"end":{"line":2,"column":324,"offset":324},"indent":[]}}],"position":{"start":{"line":2,"column":1,"offset":1},"end":{"line":2,"column":324,"offset":324},"indent":[]}},{"type":"heading","depth":2,"children":[{"type":"text","value":"What Is An Event?","position":{"start":{"line":4,"column":4,"offset":329},"end":{"line":4,"column":21,"offset":346},"indent":[]}}],"position":{"start":{"line":4,"column":1,"offset":326},"end":{"line":4,"column":21,"offset":346},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"An event in Discordeno is a function that can be called when a specific event occurs. For the most part, events will usually be the ones that are available from the library","position":{"start":{"line":6,"column":1,"offset":348},"end":{"line":6,"column":173,"offset":520},"indent":[]}}],"position":{"start":{"line":6,"column":1,"offset":348},"end":{"line":6,"column":173,"offset":520},"indent":[]}},{"type":"export","value":"export const _frontmatter = {\"title\":\"Creating Events!\",\"metaTitle\":\"Creating An Event | Discordeno\",\"metaDescription\":\"Let's create our very own bot with Discordeno!\"}","position":{"start":{"line":9,"column":1,"offset":523},"end":{"line":9,"column":169,"offset":691},"indent":[]}}],"position":{"start":{"line":1,"column":1,"offset":0},"end":{"line":9,"column":169,"offset":691}}},"scopeImports":["import * as React from 'react'"],"scopeIdentifiers":["React"],"body":"function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }\n\nfunction _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }\n\nfunction _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }\n\n/* @jsx mdx */\nvar _frontmatter = {\n \"title\": \"Creating Events!\",\n \"metaTitle\": \"Creating An Event | Discordeno\",\n \"metaDescription\": \"Let's create our very own bot with Discordeno!\"\n};\nvar layoutProps = {\n _frontmatter: _frontmatter\n};\nvar MDXLayout = \"wrapper\";\nreturn function MDXContent(_ref) {\n var components = _ref.components,\n props = _objectWithoutProperties(_ref, [\"components\"]);\n\n return mdx(MDXLayout, _extends({}, layoutProps, props, {\n components: components,\n mdxType: \"MDXLayout\"\n }), mdx(\"p\", null, \"Woah! You are almost half way done with understanding all of Discordeno. Amazing isn't it? Something you may have noticed in the last section was when the bot started up you could see a bunch of messages like \", mdx(\"inlineCode\", {\n parentName: \"p\"\n }, \"Loaded X Commands\"), \" and such. Let's jump into this part now and understand how event handling works in Discordeno.\"), mdx(\"h2\", null, \"What Is An Event?\"), mdx(\"p\", null, \"An event in Discordeno is a function that can be called when a specific event occurs. For the most part, events will usually be the ones that are available from the library\"));\n}\n;\nMDXContent.isMDXComponent = true;","rawMDXOutput":"/* @jsx mdx */\nimport { mdx } from '@mdx-js/react';\n/* @jsx mdx */\n\nexport const _frontmatter = {\n \"title\": \"Creating Events!\",\n \"metaTitle\": \"Creating An Event | Discordeno\",\n \"metaDescription\": \"Let's create our very own bot with Discordeno!\"\n};\n\nconst layoutProps = {\n _frontmatter\n};\nconst MDXLayout = \"wrapper\"\nexport default function MDXContent({\n components,\n ...props\n}) {\n return \n

{`Woah! You are almost half way done with understanding all of Discordeno. Amazing isn't it? Something you may have noticed in the last section was when the bot started up you could see a bunch of messages like `}{`Loaded X Commands`}{` and such. Let's jump into this part now and understand how event handling works in Discordeno.`}

\n

{`What Is An Event?`}

\n

{`An event in Discordeno is a function that can be called when a specific event occurs. For the most part, events will usually be the ones that are available from the library`}

\n\n
;\n}\n\n;\nMDXContent.isMDXComponent = true;"}} \ No newline at end of file diff --git a/docs/.cache/caches/gatsby-plugin-mdx/diskstore-ff41dccc0b6b6515c7eaee05ba741dcc.json b/docs/.cache/caches/gatsby-plugin-mdx/diskstore-ff41dccc0b6b6515c7eaee05ba741dcc.json new file mode 100644 index 000000000..eeb523c84 --- /dev/null +++ b/docs/.cache/caches/gatsby-plugin-mdx/diskstore-ff41dccc0b6b6515c7eaee05ba741dcc.json @@ -0,0 +1 @@ +{"expireTime":9007200851632073000,"key":"gatsby-plugin-mdx-entire-payload-7ede1629887327a6edfe1366a71c7adf-","val":{"mdast":{"type":"root","children":[{"type":"paragraph","children":[{"type":"text","value":"Woah! You are almost half way done with understanding all of Discordeno. Amazing isn't it? Something you may have noticed in the last section was there were some options that prevented some commands from running like ","position":{"start":{"line":2,"column":1,"offset":1},"end":{"line":2,"column":218,"offset":218},"indent":[]}},{"type":"inlineCode","value":"dmOnly","position":{"start":{"line":2,"column":218,"offset":218},"end":{"line":2,"column":226,"offset":226},"indent":[]}},{"type":"text","value":" or the permission options. we created a setting to prevent the monitor from running in certain channels. What if we wanted to do prevent commands from happening? How would we prevent commands from running?","position":{"start":{"line":2,"column":226,"offset":226},"end":{"line":2,"column":432,"offset":432},"indent":[]}}],"position":{"start":{"line":2,"column":1,"offset":1},"end":{"line":2,"column":432,"offset":432},"indent":[]}},{"type":"heading","depth":2,"children":[{"type":"text","value":"What is an Inhibitor?","position":{"start":{"line":4,"column":4,"offset":437},"end":{"line":4,"column":25,"offset":458},"indent":[]}}],"position":{"start":{"line":4,"column":1,"offset":434},"end":{"line":4,"column":25,"offset":458},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"An Inhibitor is very similar to how monitors work. A monitor runs on every message but an inhibitor runs on every command. Remember all those command options like cooldown, enabled, requiredPermissions, permissionLevel, nsfw, requiredSettings, runIn. Each and every one of these options has an inhibitor in Klasa core that checks commands for these settings.\nLet's create our own inhibitor that would prevent commands from being used if the user is not a VIP user.","position":{"start":{"line":6,"column":1,"offset":460},"end":{"line":7,"column":106,"offset":924},"indent":[1]}}],"position":{"start":{"line":6,"column":1,"offset":460},"end":{"line":7,"column":106,"offset":924},"indent":[1]}},{"type":"export","value":"export const _frontmatter = {\"title\":\"Creating Inhibitors!\",\"metaTitle\":\"Creating An Inhibitor | Discordeno\",\"metaDescription\":\"Let's create our very own bot with Discordeno!\"}","position":{"start":{"line":10,"column":1,"offset":927},"end":{"line":10,"column":177,"offset":1103},"indent":[]}}],"position":{"start":{"line":1,"column":1,"offset":0},"end":{"line":10,"column":177,"offset":1103}}},"scopeImports":["import * as React from 'react'"],"scopeIdentifiers":["React"],"body":"function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }\n\nfunction _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }\n\nfunction _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }\n\n/* @jsx mdx */\nvar _frontmatter = {\n \"title\": \"Creating Inhibitors!\",\n \"metaTitle\": \"Creating An Inhibitor | Discordeno\",\n \"metaDescription\": \"Let's create our very own bot with Discordeno!\"\n};\nvar layoutProps = {\n _frontmatter: _frontmatter\n};\nvar MDXLayout = \"wrapper\";\nreturn function MDXContent(_ref) {\n var components = _ref.components,\n props = _objectWithoutProperties(_ref, [\"components\"]);\n\n return mdx(MDXLayout, _extends({}, layoutProps, props, {\n components: components,\n mdxType: \"MDXLayout\"\n }), mdx(\"p\", null, \"Woah! You are almost half way done with understanding all of Discordeno. Amazing isn't it? Something you may have noticed in the last section was there were some options that prevented some commands from running like \", mdx(\"inlineCode\", {\n parentName: \"p\"\n }, \"dmOnly\"), \" or the permission options. we created a setting to prevent the monitor from running in certain channels. What if we wanted to do prevent commands from happening? How would we prevent commands from running?\"), mdx(\"h2\", null, \"What is an Inhibitor?\"), mdx(\"p\", null, \"An Inhibitor is very similar to how monitors work. A monitor runs on every message but an inhibitor runs on every command. Remember all those command options like cooldown, enabled, requiredPermissions, permissionLevel, nsfw, requiredSettings, runIn. Each and every one of these options has an inhibitor in Klasa core that checks commands for these settings.\\nLet's create our own inhibitor that would prevent commands from being used if the user is not a VIP user.\"));\n}\n;\nMDXContent.isMDXComponent = true;","rawMDXOutput":"/* @jsx mdx */\nimport { mdx } from '@mdx-js/react';\n/* @jsx mdx */\n\nexport const _frontmatter = {\n \"title\": \"Creating Inhibitors!\",\n \"metaTitle\": \"Creating An Inhibitor | Discordeno\",\n \"metaDescription\": \"Let's create our very own bot with Discordeno!\"\n};\n\nconst layoutProps = {\n _frontmatter\n};\nconst MDXLayout = \"wrapper\"\nexport default function MDXContent({\n components,\n ...props\n}) {\n return \n

{`Woah! You are almost half way done with understanding all of Discordeno. Amazing isn't it? Something you may have noticed in the last section was there were some options that prevented some commands from running like `}{`dmOnly`}{` or the permission options. we created a setting to prevent the monitor from running in certain channels. What if we wanted to do prevent commands from happening? How would we prevent commands from running?`}

\n

{`What is an Inhibitor?`}

\n

{`An Inhibitor is very similar to how monitors work. A monitor runs on every message but an inhibitor runs on every command. Remember all those command options like cooldown, enabled, requiredPermissions, permissionLevel, nsfw, requiredSettings, runIn. Each and every one of these options has an inhibitor in Klasa core that checks commands for these settings.\nLet's create our own inhibitor that would prevent commands from being used if the user is not a VIP user.`}

\n\n
;\n}\n\n;\nMDXContent.isMDXComponent = true;"}} \ No newline at end of file diff --git a/docs/.cache/caches/gatsby-plugin-mdx/mdx-scopes-dir/e92f8988d65cf25c087d226e6c0ef06f.js b/docs/.cache/caches/gatsby-plugin-mdx/mdx-scopes-dir/e92f8988d65cf25c087d226e6c0ef06f.js new file mode 100644 index 000000000..4044aaa1b --- /dev/null +++ b/docs/.cache/caches/gatsby-plugin-mdx/mdx-scopes-dir/e92f8988d65cf25c087d226e6c0ef06f.js @@ -0,0 +1,4 @@ +import * as React from 'react'; +export default { + React +}; \ No newline at end of file diff --git a/docs/.cache/commonjs/api-runner-browser-plugins.js b/docs/.cache/commonjs/api-runner-browser-plugins.js new file mode 100644 index 000000000..d8ec9985b --- /dev/null +++ b/docs/.cache/commonjs/api-runner-browser-plugins.js @@ -0,0 +1,15 @@ +"use strict"; + +// During bootstrap, we write requires at top of this file which looks +// basically like: +// module.exports = [ +// { +// plugin: require("/path/to/plugin1/gatsby-browser.js"), +// options: { ... }, +// }, +// { +// plugin: require("/path/to/plugin2/gatsby-browser.js"), +// options: { ... }, +// }, +// ] +module.exports = []; diff --git a/docs/.cache/commonjs/api-runner-browser.js b/docs/.cache/commonjs/api-runner-browser.js new file mode 100644 index 000000000..861bf593d --- /dev/null +++ b/docs/.cache/commonjs/api-runner-browser.js @@ -0,0 +1,67 @@ +"use strict"; + +const plugins = require(`./api-runner-browser-plugins`); + +const { + getResourcesForPathname, + getResourcesForPathnameSync, + getResourceURLsForPathname, + loadPage, + loadPageSync, +} = require(`./loader`).publicLoader; + +exports.apiRunner = (api, args = {}, defaultReturn, argTransform) => { + // Hooks for gatsby-cypress's API handler + if (process.env.CYPRESS_SUPPORT) { + if (window.___apiHandler) { + window.___apiHandler(api); + } else if (window.___resolvedAPIs) { + window.___resolvedAPIs.push(api); + } else { + window.___resolvedAPIs = [api]; + } + } + + let results = plugins.map((plugin) => { + if (!plugin.plugin[api]) { + return undefined; + } // Deprecated April 2019. Use `loadPageSync` instead + + args.getResourcesForPathnameSync = getResourcesForPathnameSync; // Deprecated April 2019. Use `loadPage` instead + + args.getResourcesForPathname = getResourcesForPathname; + args.getResourceURLsForPathname = getResourceURLsForPathname; + args.loadPage = loadPage; + args.loadPageSync = loadPageSync; + const result = plugin.plugin[api](args, plugin.options); + + if (result && argTransform) { + args = argTransform({ + args, + result, + plugin, + }); + } + + return result; + }); // Filter out undefined results. + + results = results.filter((result) => typeof result !== `undefined`); + + if (results.length > 0) { + return results; + } else if (defaultReturn) { + return [defaultReturn]; + } else { + return []; + } +}; + +exports.apiRunnerAsync = (api, args, defaultReturn) => + plugins.reduce( + (previous, next) => + next.plugin[api] + ? previous.then(() => next.plugin[api](args, next.options)) + : previous, + Promise.resolve(), + ); diff --git a/docs/.cache/commonjs/api-runner-ssr.js b/docs/.cache/commonjs/api-runner-ssr.js new file mode 100644 index 000000000..db7d45ca2 --- /dev/null +++ b/docs/.cache/commonjs/api-runner-ssr.js @@ -0,0 +1,46 @@ +"use strict"; + +// During bootstrap, we write requires at top of this file which looks like: +// var plugins = [ +// { +// plugin: require("/path/to/plugin1/gatsby-ssr.js"), +// options: { ... }, +// }, +// { +// plugin: require("/path/to/plugin2/gatsby-ssr.js"), +// options: { ... }, +// }, +// ] +const apis = require(`./api-ssr-docs`); // Run the specified API in any plugins that have implemented it + +module.exports = (api, args, defaultReturn, argTransform) => { + if (!apis[api]) { + console.log(`This API doesn't exist`, api); + } // Run each plugin in series. + // eslint-disable-next-line no-undef + + let results = plugins.map((plugin) => { + if (!plugin.plugin[api]) { + return undefined; + } + + const result = plugin.plugin[api](args, plugin.options); + + if (result && argTransform) { + args = argTransform({ + args, + result, + }); + } + + return result; + }); // Filter out undefined results. + + results = results.filter((result) => typeof result !== `undefined`); + + if (results.length > 0) { + return results; + } else { + return [defaultReturn]; + } +}; diff --git a/docs/.cache/commonjs/api-ssr-docs.js b/docs/.cache/commonjs/api-ssr-docs.js new file mode 100644 index 000000000..72db66cc4 --- /dev/null +++ b/docs/.cache/commonjs/api-ssr-docs.js @@ -0,0 +1,200 @@ +"use strict"; + +/** + * Object containing options defined in `gatsby-config.js` + * @typedef {object} pluginOptions + */ + +/** + * Replace the default server renderer. This is useful for integration with + * Redux, css-in-js libraries, etc. that need custom setups for server + * rendering. + * @param {object} $0 + * @param {string} $0.pathname The pathname of the page currently being rendered. + * @param {function} $0.replaceBodyHTMLString Call this with the HTML string + * you render. **WARNING** if multiple plugins implement this API it's the + * last plugin that "wins". TODO implement an automated warning against this. + * @param {function} $0.setHeadComponents Takes an array of components as its + * first argument which are added to the `headComponents` array which is passed + * to the `html.js` component. + * @param {function} $0.setHtmlAttributes Takes an object of props which will + * spread into the `` component. + * @param {function} $0.setBodyAttributes Takes an object of props which will + * spread into the `` component. + * @param {function} $0.setPreBodyComponents Takes an array of components as its + * first argument which are added to the `preBodyComponents` array which is passed + * to the `html.js` component. + * @param {function} $0.setPostBodyComponents Takes an array of components as its + * first argument which are added to the `postBodyComponents` array which is passed + * to the `html.js` component. + * @param {function} $0.setBodyProps Takes an object of data which + * is merged with other body props and passed to `html.js` as `bodyProps`. + * @param {pluginOptions} pluginOptions + * @example + * // From gatsby-plugin-glamor + * const { renderToString } = require("react-dom/server") + * const inline = require("glamor-inline") + * + * exports.replaceRenderer = ({ bodyComponent, replaceBodyHTMLString }) => { + * const bodyHTML = renderToString(bodyComponent) + * const inlinedHTML = inline(bodyHTML) + * + * replaceBodyHTMLString(inlinedHTML) + * } + */ +exports.replaceRenderer = true; +/** + * Called after every page Gatsby server renders while building HTML so you can + * set head and body components to be rendered in your `html.js`. + * + * Gatsby does a two-pass render for HTML. It loops through your pages first + * rendering only the body and then takes the result body HTML string and + * passes it as the `body` prop to your `html.js` to complete the render. + * + * It's often handy to be able to send custom components to your `html.js`. + * For example, it's a very common pattern for React.js libraries that + * support server rendering to pull out data generated during the render to + * add to your HTML. + * + * Using this API over [`replaceRenderer`](#replaceRenderer) is preferable as + * multiple plugins can implement this API where only one plugin can take + * over server rendering. However, if your plugin requires taking over server + * rendering then that's the one to + * use + * @param {object} $0 + * @param {string} $0.pathname The pathname of the page currently being rendered. + * @param {function} $0.setHeadComponents Takes an array of components as its + * first argument which are added to the `headComponents` array which is passed + * to the `html.js` component. + * @param {function} $0.setHtmlAttributes Takes an object of props which will + * spread into the `` component. + * @param {function} $0.setBodyAttributes Takes an object of props which will + * spread into the `` component. + * @param {function} $0.setPreBodyComponents Takes an array of components as its + * first argument which are added to the `preBodyComponents` array which is passed + * to the `html.js` component. + * @param {function} $0.setPostBodyComponents Takes an array of components as its + * first argument which are added to the `postBodyComponents` array which is passed + * to the `html.js` component. + * @param {function} $0.setBodyProps Takes an object of data which + * is merged with other body props and passed to `html.js` as `bodyProps`. + * @param {pluginOptions} pluginOptions + * @example + * const { Helmet } = require("react-helmet") + * + * exports.onRenderBody = ( + * { setHeadComponents, setHtmlAttributes, setBodyAttributes }, + * pluginOptions + * ) => { + * const helmet = Helmet.renderStatic() + * setHtmlAttributes(helmet.htmlAttributes.toComponent()) + * setBodyAttributes(helmet.bodyAttributes.toComponent()) + * setHeadComponents([ + * helmet.title.toComponent(), + * helmet.link.toComponent(), + * helmet.meta.toComponent(), + * helmet.noscript.toComponent(), + * helmet.script.toComponent(), + * helmet.style.toComponent(), + * ]) + * } + */ + +exports.onRenderBody = true; +/** + * Called after every page Gatsby server renders while building HTML so you can + * replace head components to be rendered in your `html.js`. This is useful if + * you need to reorder scripts or styles added by other plugins. + * @param {object} $0 + * @param {string} $0.pathname The pathname of the page currently being rendered. + * @param {Array} $0.getHeadComponents Returns the current `headComponents` array. + * @param {function} $0.replaceHeadComponents Takes an array of components as its + * first argument which replace the `headComponents` array which is passed + * to the `html.js` component. **WARNING** if multiple plugins implement this + * API it's the last plugin that "wins". + * @param {Array} $0.getPreBodyComponents Returns the current `preBodyComponents` array. + * @param {function} $0.replacePreBodyComponents Takes an array of components as its + * first argument which replace the `preBodyComponents` array which is passed + * to the `html.js` component. **WARNING** if multiple plugins implement this + * API it's the last plugin that "wins". + * @param {Array} $0.getPostBodyComponents Returns the current `postBodyComponents` array. + * @param {function} $0.replacePostBodyComponents Takes an array of components as its + * first argument which replace the `postBodyComponents` array which is passed + * to the `html.js` component. **WARNING** if multiple plugins implement this + * API it's the last plugin that "wins". + * @param {pluginOptions} pluginOptions + * @example + * // Move Typography.js styles to the top of the head section so they're loaded first. + * exports.onPreRenderHTML = ({ getHeadComponents, replaceHeadComponents }) => { + * const headComponents = getHeadComponents() + * headComponents.sort((x, y) => { + * if (x.key === 'TypographyStyle') { + * return -1 + * } else if (y.key === 'TypographyStyle') { + * return 1 + * } + * return 0 + * }) + * replaceHeadComponents(headComponents) + * } + */ + +exports.onPreRenderHTML = true; +/** + * Allow a plugin to wrap the page element. + * + * This is useful for setting wrapper components around pages that won't get + * unmounted on page changes. For setting Provider components, use [wrapRootElement](#wrapRootElement). + * + * _Note:_ + * There is an equivalent hook in Gatsby's [Browser API](/docs/browser-apis/#wrapPageElement). + * It is recommended to use both APIs together. + * For example usage, check out [Using i18n](https://github.com/gatsbyjs/gatsby/tree/master/examples/using-i18n). + * @param {object} $0 + * @param {ReactNode} $0.element The "Page" React Element built by Gatsby. + * @param {object} $0.props Props object used by page. + * @param {pluginOptions} pluginOptions + * @returns {ReactNode} Wrapped element + * @example + * const React = require("react") + * const Layout = require("./src/components/layout").default + * + * exports.wrapPageElement = ({ element, props }) => { + * // props provide same data to Layout as Page element will get + * // including location, data, etc - you don't need to pass it + * return {element} + * } + */ + +exports.wrapPageElement = true; +/** + * Allow a plugin to wrap the root element. + * + * This is useful to set up any Provider components that will wrap your application. + * For setting persistent UI elements around pages use [wrapPageElement](#wrapPageElement). + * + * _Note:_ + * There is an equivalent hook in Gatsby's [Browser API](/docs/browser-apis/#wrapRootElement). + * It is recommended to use both APIs together. + * For example usage, check out [Using redux](https://github.com/gatsbyjs/gatsby/tree/master/examples/using-redux). + * @param {object} $0 + * @param {ReactNode} $0.element The "Root" React Element built by Gatsby. + * @param {pluginOptions} pluginOptions + * @returns {ReactNode} Wrapped element + * @example + * const React = require("react") + * const { Provider } = require("react-redux") + * + * const createStore = require("./src/state/createStore") + * const store = createStore() + * + * exports.wrapRootElement = ({ element }) => { + * return ( + * + * {element} + * + * ) + * } + */ + +exports.wrapRootElement = true; diff --git a/docs/.cache/commonjs/app.js b/docs/.cache/commonjs/app.js new file mode 100644 index 000000000..cec39e6de --- /dev/null +++ b/docs/.cache/commonjs/app.js @@ -0,0 +1,118 @@ +"use strict"; + +var _interopRequireDefault = require( + "@babel/runtime/helpers/interopRequireDefault", +); + +var _react = _interopRequireDefault(require("react")); + +var _reactDom = _interopRequireDefault(require("react-dom")); + +var _domready = _interopRequireDefault(require("@mikaelkristiansson/domready")); + +var _socket = _interopRequireDefault(require("socket.io-client")); + +var _socketIo = _interopRequireDefault(require("./socketIo")); + +var _emitter = _interopRequireDefault(require("./emitter")); + +var _apiRunnerBrowser = require("./api-runner-browser"); + +var _loader = require("./loader"); + +var _devLoader = _interopRequireDefault(require("./dev-loader")); + +var _syncRequires = _interopRequireDefault(require("$virtual/sync-requires")); + +var _matchPaths = _interopRequireDefault(require("$virtual/match-paths.json")); + +// Generated during bootstrap +window.___emitter = _emitter.default; +const loader = new _devLoader.default( + _syncRequires.default, + _matchPaths.default, +); +(0, _loader.setLoader)(loader); +loader.setApiRunner(_apiRunnerBrowser.apiRunner); +window.___loader = _loader.publicLoader; // Let the site/plugins run code very early. + +(0, _apiRunnerBrowser.apiRunnerAsync)(`onClientEntry`).then(() => { + // Hook up the client to socket.io on server + const socket = (0, _socketIo.default)(); + + if (socket) { + socket.on(`reload`, () => { + window.location.reload(); + }); + } + + fetch(`/___services`).then((res) => res.json()).then((services) => { + if (services.developstatusserver) { + const parentSocket = (0, _socket.default)( + `http://${window.location.hostname}:${services.developstatusserver.port}`, + ); + parentSocket.on(`develop:needs-restart`, (msg) => { + if ( + window.confirm( + `The develop process needs to be restarted for the changes to ${msg.dirtyFile} to be applied.\nDo you want to restart the develop process now?`, + ) + ) { + parentSocket.once(`develop:is-starting`, (msg) => { + window.location.reload(); + }); + parentSocket.once(`develop:started`, (msg) => { + window.location.reload(); + }); + parentSocket.emit(`develop:restart`); + } + }); + } + }); + /** + * Service Workers are persistent by nature. They stick around, + * serving a cached version of the site if they aren't removed. + * This is especially frustrating when you need to test the + * production build on your local machine. + * + * Let's warn if we find service workers in development. + */ + + if (`serviceWorker` in navigator) { + navigator.serviceWorker.getRegistrations().then((registrations) => { + if (registrations.length > 0) { + console.warn( + `Warning: found one or more service workers present.`, + `If your site isn't behaving as expected, you might want to remove these.`, + registrations, + ); + } + }); + } + + const rootElement = document.getElementById(`___gatsby`); + const renderer = (0, _apiRunnerBrowser.apiRunner)( + `replaceHydrateFunction`, + undefined, + _reactDom.default.render, + )[0]; + Promise.all( + [ + loader.loadPage(`/dev-404-page/`), + loader.loadPage(`/404.html`), + loader.loadPage(window.location.pathname), + ], + ).then(() => { + const preferDefault = (m) => m && m.default || m; + + let Root = preferDefault(require(`./root`)); + (0, _domready.default)(() => { + renderer( + /*#__PURE__*/ _react.default.createElement(Root, null), + rootElement, + () => { + (0, _apiRunnerBrowser.apiRunner)(`onInitialClientRender`); + }, + ); + }); + }); +}); diff --git a/docs/.cache/commonjs/create-react-context.js b/docs/.cache/commonjs/create-react-context.js new file mode 100644 index 000000000..999e86818 --- /dev/null +++ b/docs/.cache/commonjs/create-react-context.js @@ -0,0 +1,29 @@ +"use strict"; + +/* + Why commonjs and not ES imports/exports? + + This module is used to alias `create-react-context` package, but drop the the actual implementation part + because Gatsby requires version of react that has implementatoin baked in. + + Package source is using ES modules: + - https://github.com/jamiebuilds/create-react-context/blob/v0.3.0/src/index.js + + But to build this package `babel-plugin-add-module-exports` is used ( https://www.npmjs.com/package/babel-plugin-add-module-exports). + Which result in both `module.exports` and `exports.default` being set to same thing. + + We don't use that babel plugin so we only have `exports.default`. + + This cause problems in various 3rd party react components that rely on `module.exports` being set. + See https://github.com/gatsbyjs/gatsby/issues/23645 for example of it. + + Instead of adding same babel plugin we mimic output here. Adding babel plugin just for this would: + a) unnecesairly slow down compilation for all other files (if we just apply it everywhere) + b) or complicate babel-loader configuration with overwrite specifically for this file +*/ +const { + createContext, +} = require(`react`); + +module.exports = createContext; +module.exports.default = createContext; diff --git a/docs/.cache/commonjs/default-html.js b/docs/.cache/commonjs/default-html.js new file mode 100644 index 000000000..5ac69990c --- /dev/null +++ b/docs/.cache/commonjs/default-html.js @@ -0,0 +1,57 @@ +"use strict"; + +var _interopRequireDefault = require( + "@babel/runtime/helpers/interopRequireDefault", +); + +exports.__esModule = true; +exports.default = HTML; + +var _react = _interopRequireDefault(require("react")); + +var _propTypes = _interopRequireDefault(require("prop-types")); + +function HTML(props) { + return /*#__PURE__*/ _react.default.createElement( + "html", + props.htmlAttributes, /*#__PURE__*/ + _react.default.createElement( + "head", + null, /*#__PURE__*/ + _react.default.createElement("meta", { + charSet: "utf-8", + }), /*#__PURE__*/ + _react.default.createElement("meta", { + httpEquiv: "x-ua-compatible", + content: "ie=edge", + }), /*#__PURE__*/ + _react.default.createElement("meta", { + name: "viewport", + content: "width=device-width, initial-scale=1, shrink-to-fit=no", + }), + props.headComponents, + ), /*#__PURE__*/ + _react.default.createElement( + "body", + props.bodyAttributes, + props.preBodyComponents, /*#__PURE__*/ + _react.default.createElement("div", { + key: `body`, + id: "___gatsby", + dangerouslySetInnerHTML: { + __html: props.body, + }, + }), + props.postBodyComponents, + ), + ); +} + +HTML.propTypes = { + htmlAttributes: _propTypes.default.object, + headComponents: _propTypes.default.array, + bodyAttributes: _propTypes.default.object, + preBodyComponents: _propTypes.default.array, + body: _propTypes.default.string, + postBodyComponents: _propTypes.default.array, +}; diff --git a/docs/.cache/commonjs/dev-loader.js b/docs/.cache/commonjs/dev-loader.js new file mode 100644 index 000000000..9729946fe --- /dev/null +++ b/docs/.cache/commonjs/dev-loader.js @@ -0,0 +1,51 @@ +"use strict"; + +exports.__esModule = true; +exports.default = void 0; + +var _loader = require("./loader"); + +var _findPath = require("./find-path"); + +class DevLoader extends _loader.BaseLoader { + constructor(syncRequires, matchPaths) { + const loadComponent = (chunkName) => + Promise.resolve(syncRequires.components[chunkName]); + + super(loadComponent, matchPaths); + } + + loadPage(pagePath) { + const realPath = (0, _findPath.findPath)(pagePath); + return super.loadPage(realPath).then((result) => + require(`./socketIo`).getPageData(realPath).then(() => result) + ); + } + + loadPageDataJson(rawPath) { + return super.loadPageDataJson(rawPath).then((data) => { + // when we can't find a proper 404.html we fallback to dev-404-page + // we need to make sure to mark it as not found. + if ( + data.status === _loader.PageResourceStatus.Error && + rawPath !== `/dev-404-page/` + ) { + console.error( + `404 page could not be found. Checkout https://www.gatsbyjs.org/docs/add-404-page/`, + ); + return this.loadPageDataJson(`/dev-404-page/`).then((result) => + Object.assign({}, data, result) + ); + } + + return data; + }); + } + + doPrefetch(pagePath) { + return Promise.resolve(require(`./socketIo`).getPageData(pagePath)); + } +} + +var _default = DevLoader; +exports.default = _default; diff --git a/docs/.cache/commonjs/develop-static-entry.js b/docs/.cache/commonjs/develop-static-entry.js new file mode 100644 index 000000000..566194c0f --- /dev/null +++ b/docs/.cache/commonjs/develop-static-entry.js @@ -0,0 +1,152 @@ +"use strict"; + +var _interopRequireDefault = require( + "@babel/runtime/helpers/interopRequireDefault", +); + +exports.__esModule = true; +exports.default = void 0; + +var _react = _interopRequireDefault(require("react")); + +var _server = require("react-dom/server"); + +var _lodash = require("lodash"); + +var _apiRunnerSsr = _interopRequireDefault(require("./api-runner-ssr")); + +// import testRequireError from "./test-require-error" +// For some extremely mysterious reason, webpack adds the above module *after* +// this module so that when this code runs, testRequireError is undefined. +// So in the meantime, we'll just inline it. +const testRequireError = (moduleName, err) => { + const regex = new RegExp(`Error: Cannot find module\\s.${moduleName}`); + const firstLine = err.toString().split(`\n`)[0]; + return regex.test(firstLine); +}; + +let Html; + +try { + Html = require(`../src/html`); +} catch (err) { + if (testRequireError(`../src/html`, err)) { + Html = require(`./default-html`); + } else { + console.log(`There was an error requiring "src/html.js"\n\n`, err, `\n\n`); + process.exit(); + } +} + +Html = Html && Html.__esModule ? Html.default : Html; + +var _default = (pagePath, callback) => { + let headComponents = [/*#__PURE__*/ _react.default.createElement("meta", { + key: "environment", + name: "note", + content: "environment=development", + })]; + let htmlAttributes = {}; + let bodyAttributes = {}; + let preBodyComponents = []; + let postBodyComponents = []; + let bodyProps = {}; + let htmlStr; + + const setHeadComponents = (components) => { + headComponents = headComponents.concat(components); + }; + + const setHtmlAttributes = (attributes) => { + htmlAttributes = (0, _lodash.merge)(htmlAttributes, attributes); + }; + + const setBodyAttributes = (attributes) => { + bodyAttributes = (0, _lodash.merge)(bodyAttributes, attributes); + }; + + const setPreBodyComponents = (components) => { + preBodyComponents = preBodyComponents.concat(components); + }; + + const setPostBodyComponents = (components) => { + postBodyComponents = postBodyComponents.concat(components); + }; + + const setBodyProps = (props) => { + bodyProps = (0, _lodash.merge)({}, bodyProps, props); + }; + + const getHeadComponents = () => headComponents; + + const replaceHeadComponents = (components) => { + headComponents = components; + }; + + const getPreBodyComponents = () => preBodyComponents; + + const replacePreBodyComponents = (components) => { + preBodyComponents = components; + }; + + const getPostBodyComponents = () => postBodyComponents; + + const replacePostBodyComponents = (components) => { + postBodyComponents = components; + }; + + (0, _apiRunnerSsr.default)(`onRenderBody`, { + setHeadComponents, + setHtmlAttributes, + setBodyAttributes, + setPreBodyComponents, + setPostBodyComponents, + setBodyProps, + pathname: pagePath, + }); + (0, _apiRunnerSsr.default)(`onPreRenderHTML`, { + getHeadComponents, + replaceHeadComponents, + getPreBodyComponents, + replacePreBodyComponents, + getPostBodyComponents, + replacePostBodyComponents, + pathname: pagePath, + }); + + const htmlElement = /*#__PURE__*/ _react.default.createElement( + Html, + { + ...bodyProps, + body: ``, + headComponents: headComponents.concat( + [/*#__PURE__*/ _react.default.createElement("script", { + key: `io`, + src: "/socket.io/socket.io.js", + })], + ), + htmlAttributes, + bodyAttributes, + preBodyComponents, + postBodyComponents: postBodyComponents.concat( + [ + /*#__PURE__*/ _react.default.createElement("script", { + key: `polyfill`, + src: "/polyfill.js", + noModule: true, + }), /*#__PURE__*/ + _react.default.createElement("script", { + key: `commons`, + src: "/commons.js", + }), + ], + ), + }, + ); + + htmlStr = (0, _server.renderToStaticMarkup)(htmlElement); + htmlStr = `${htmlStr}`; + callback(null, htmlStr); +}; + +exports.default = _default; diff --git a/docs/.cache/commonjs/emitter.js b/docs/.cache/commonjs/emitter.js new file mode 100644 index 000000000..dbe00e73d --- /dev/null +++ b/docs/.cache/commonjs/emitter.js @@ -0,0 +1,14 @@ +"use strict"; + +var _interopRequireDefault = require( + "@babel/runtime/helpers/interopRequireDefault", +); + +exports.__esModule = true; +exports.default = void 0; + +var _mitt = _interopRequireDefault(require("mitt")); + +const emitter = (0, _mitt.default)(); +var _default = emitter; +exports.default = _default; diff --git a/docs/.cache/commonjs/ensure-resources.js b/docs/.cache/commonjs/ensure-resources.js new file mode 100644 index 000000000..cb55181b1 --- /dev/null +++ b/docs/.cache/commonjs/ensure-resources.js @@ -0,0 +1,116 @@ +"use strict"; + +var _interopRequireWildcard = require( + "@babel/runtime/helpers/interopRequireWildcard", +); + +var _interopRequireDefault = require( + "@babel/runtime/helpers/interopRequireDefault", +); + +exports.__esModule = true; +exports.default = void 0; + +var _react = _interopRequireDefault(require("react")); + +var _loader = _interopRequireWildcard(require("./loader")); + +var _shallowCompare = _interopRequireDefault(require("shallow-compare")); + +class EnsureResources extends _react.default.Component { + constructor(props) { + super(); + const { + location, + pageResources, + } = props; + this.state = { + location: { ...location }, + pageResources: pageResources || + _loader.default.loadPageSync(location.pathname), + }; + } + + static getDerivedStateFromProps({ + location, + }, prevState) { + if (prevState.location.href !== location.href) { + const pageResources = _loader.default.loadPageSync(location.pathname); + + return { + pageResources, + location: { ...location }, + }; + } + + return { + location: { ...location }, + }; + } + + loadResources(rawPath) { + _loader.default.loadPage(rawPath).then((pageResources) => { + if ( + pageResources && + pageResources.status !== _loader.PageResourceStatus.Error + ) { + this.setState({ + location: { ...window.location }, + pageResources, + }); + } else { + window.history.replaceState({}, ``, location.href); + window.location = rawPath; + } + }); + } + + shouldComponentUpdate(nextProps, nextState) { + // Always return false if we're missing resources. + if (!nextState.pageResources) { + this.loadResources(nextProps.location.pathname); + return false; + } // Check if the component or json have changed. + + if (this.state.pageResources !== nextState.pageResources) { + return true; + } + + if ( + this.state.pageResources.component !== nextState.pageResources.component + ) { + return true; + } + + if (this.state.pageResources.json !== nextState.pageResources.json) { + return true; + } // Check if location has changed on a page using internal routing + // via matchPath configuration. + + if ( + this.state.location.key !== nextState.location.key && + nextState.pageResources.page && + (nextState.pageResources.page.matchPath || + nextState.pageResources.page.path) + ) { + return true; + } + + return (0, _shallowCompare.default)(this, nextProps, nextState); + } + + render() { + if (process.env.NODE_ENV !== `production` && !this.state.pageResources) { + throw new Error( + `EnsureResources was not able to find resources for path: "${this.props.location.pathname}" +This typically means that an issue occurred building components for that path. +Run \`gatsby clean\` to remove any cached elements.`, + ); + } + + return this.props.children(this.state); + } +} + +var _default = EnsureResources; +exports.default = _default; diff --git a/docs/.cache/commonjs/error-overlay-handler.js b/docs/.cache/commonjs/error-overlay-handler.js new file mode 100644 index 000000000..e52846456 --- /dev/null +++ b/docs/.cache/commonjs/error-overlay-handler.js @@ -0,0 +1,91 @@ +"use strict"; + +var _interopRequireWildcard = require( + "@babel/runtime/helpers/interopRequireWildcard", +); + +exports.__esModule = true; +exports.errorMap = exports.reportError = exports.clearError = void 0; + +var ReactRefreshErrorOverlay = _interopRequireWildcard( + require("@pmmmwh/react-refresh-webpack-plugin/src/overlay"), +); + +var ReactErrorOverlay = _interopRequireWildcard(require("react-error-overlay")); + +const ErrorOverlay = { + showCompileError: process.env.GATSBY_HOT_LOADER !== `fast-refresh` + ? ReactErrorOverlay.reportBuildError + : ReactRefreshErrorOverlay.showCompileError, + clearCompileError: process.env.GATSBY_HOT_LOADER !== `fast-refresh` + ? ReactErrorOverlay.dismissBuildError + : ReactRefreshErrorOverlay.clearCompileError, +}; + +if (process.env.GATSBY_HOT_LOADER !== `fast-refresh`) { + // Report runtime errors + ReactErrorOverlay.startReportingRuntimeErrors({ + onError: () => {}, + filename: `/commons.js`, + }); + ReactErrorOverlay.setEditorHandler((errorLocation) => + window.fetch( + `/__open-stack-frame-in-editor?fileName=` + + window.encodeURIComponent(errorLocation.fileName) + `&lineNumber=` + + window.encodeURIComponent(errorLocation.lineNumber || 1), + ) + ); +} + +const errorMap = {}; +exports.errorMap = errorMap; + +function flat(arr) { + return Array.prototype.flat ? arr.flat() : [].concat(...arr); +} + +const handleErrorOverlay = () => { + const errors = Object.values(errorMap); + let errorStringsToDisplay = []; + + if (errors.length > 0) { + errorStringsToDisplay = flat(errors).map((error) => { + if (typeof error === `string`) { + return error; + } else if (typeof error === `object`) { + const errorStrBuilder = [error.text]; + + if (error.filePath) { + errorStrBuilder.push(`File: ${error.filePath}`); + } + + return errorStrBuilder.join(`\n\n`); + } + + return null; + }).filter(Boolean); + } + + if (errorStringsToDisplay.length > 0) { + ErrorOverlay.showCompileError(errorStringsToDisplay.join(`\n\n`)); + } else { + ErrorOverlay.clearCompileError(); + } +}; + +const clearError = (errorID) => { + delete errorMap[errorID]; + handleErrorOverlay(); +}; + +exports.clearError = clearError; + +const reportError = (errorID, error) => { + if (error) { + errorMap[errorID] = error; + } + + handleErrorOverlay(); +}; + +exports.reportError = reportError; diff --git a/docs/.cache/commonjs/find-path.js b/docs/.cache/commonjs/find-path.js new file mode 100644 index 000000000..8b16ddbff --- /dev/null +++ b/docs/.cache/commonjs/find-path.js @@ -0,0 +1,130 @@ +"use strict"; + +var _interopRequireDefault = require( + "@babel/runtime/helpers/interopRequireDefault", +); + +exports.__esModule = true; +exports.cleanPath = exports.findPath = exports.findMatchPath = exports + .setMatchPaths = void 0; + +var _utils = require("@reach/router/lib/utils"); + +var _stripPrefix = _interopRequireDefault(require("./strip-prefix")); + +var _normalizePagePath = _interopRequireDefault( + require("./normalize-page-path"), +); + +const pathCache = new Map(); +let matchPaths = []; + +const trimPathname = (rawPathname) => { + const pathname = decodeURIComponent(rawPathname); // Remove the pathPrefix from the pathname. + + const trimmedPathname = (0, _stripPrefix.default)(pathname, __BASE_PATH__) // Remove any hashfragment + .split(`#`)[0] // Remove search query + .split(`?`)[0]; + return trimmedPathname; +}; + +function absolutify(path) { + // If it's already absolute, return as-is + if ( + path.startsWith(`/`) || path.startsWith(`https://`) || + path.startsWith(`http://`) + ) { + return path; + } // Calculate path relative to current location, adding a trailing slash to + // match behavior of @reach/router + + return new URL( + path, + window.location.href + (window.location.href.endsWith(`/`) ? `` : `/`), + ).pathname; +} +/** + * Set list of matchPaths + * + * @param {Array<{path: string, matchPath: string}>} value collection of matchPaths + */ + +const setMatchPaths = (value) => { + matchPaths = value; +}; +/** + * Return a matchpath url + * if `match-paths.json` contains `{ "/foo*": "/page1", ...}`, then + * `/foo?bar=far` => `/page1` + * + * @param {string} rawPathname A raw pathname + * @return {string|null} + */ + +exports.setMatchPaths = setMatchPaths; + +const findMatchPath = (rawPathname) => { + const trimmedPathname = cleanPath(rawPathname); + + for ( + const { + matchPath, + path, + } of matchPaths + ) { + if ((0, _utils.match)(matchPath, trimmedPathname)) { + return (0, _normalizePagePath.default)(path); + } + } + + return null; +}; // Given a raw URL path, returns the cleaned version of it (trim off +// `#` and query params), or if it matches an entry in +// `match-paths.json`, its matched path is returned +// +// E.g. `/foo?bar=far` => `/foo` +// +// Or if `match-paths.json` contains `{ "/foo*": "/page1", ...}`, then +// `/foo?bar=far` => `/page1` + +exports.findMatchPath = findMatchPath; + +const findPath = (rawPathname) => { + const trimmedPathname = trimPathname(absolutify(rawPathname)); + + if (pathCache.has(trimmedPathname)) { + return pathCache.get(trimmedPathname); + } + + let foundPath = findMatchPath(trimmedPathname); + + if (!foundPath) { + foundPath = cleanPath(rawPathname); + } + + pathCache.set(trimmedPathname, foundPath); + return foundPath; +}; +/** + * Clean a url and converts /index.html => / + * E.g. `/foo?bar=far` => `/foo` + * + * @param {string} rawPathname A raw pathname + * @return {string} + */ + +exports.findPath = findPath; + +const cleanPath = (rawPathname) => { + const trimmedPathname = trimPathname(absolutify(rawPathname)); + let foundPath = trimmedPathname; + + if (foundPath === `/index.html`) { + foundPath = `/`; + } + + foundPath = (0, _normalizePagePath.default)(foundPath); + return foundPath; +}; + +exports.cleanPath = cleanPath; diff --git a/docs/.cache/commonjs/gatsby-browser-entry.js b/docs/.cache/commonjs/gatsby-browser-entry.js new file mode 100644 index 000000000..09a59bd55 --- /dev/null +++ b/docs/.cache/commonjs/gatsby-browser-entry.js @@ -0,0 +1,150 @@ +"use strict"; + +var _interopRequireWildcard = require( + "@babel/runtime/helpers/interopRequireWildcard", +); + +var _interopRequireDefault = require( + "@babel/runtime/helpers/interopRequireDefault", +); + +exports.__esModule = true; +exports.graphql = graphql; +exports.prefetchPathname = exports.useStaticQuery = exports.StaticQuery = + exports.StaticQueryContext = void 0; + +var _react = _interopRequireDefault(require("react")); + +var _propTypes = _interopRequireDefault(require("prop-types")); + +var _gatsbyLink = _interopRequireWildcard(require("gatsby-link")); + +exports.Link = _gatsbyLink.default; +exports.withPrefix = _gatsbyLink.withPrefix; +exports.withAssetPrefix = _gatsbyLink.withAssetPrefix; +exports.navigate = _gatsbyLink.navigate; +exports.push = _gatsbyLink.push; +exports.replace = _gatsbyLink.replace; +exports.navigateTo = _gatsbyLink.navigateTo; +exports.parsePath = _gatsbyLink.parsePath; + +var _gatsbyReactRouterScroll = require("gatsby-react-router-scroll"); + +exports.useScrollRestoration = _gatsbyReactRouterScroll.useScrollRestoration; + +var _publicPageRenderer = _interopRequireDefault( + require("./public-page-renderer"), +); + +exports.PageRenderer = _publicPageRenderer.default; + +var _loader = _interopRequireDefault(require("./loader")); + +const prefetchPathname = _loader.default.enqueue; +exports.prefetchPathname = prefetchPathname; + +const StaticQueryContext = _react.default.createContext({}); + +exports.StaticQueryContext = StaticQueryContext; + +function StaticQueryDataRenderer({ + staticQueryData, + data, + query, + render, +}) { + const finalData = data + ? data.data + : staticQueryData[query] && staticQueryData[query].data; + return /*#__PURE__*/ _react.default.createElement( + _react.default.Fragment, + null, + finalData && render(finalData), + !finalData && /*#__PURE__*/ + _react.default.createElement("div", null, "Loading (StaticQuery)"), + ); +} + +const StaticQuery = (props) => { + const { + data, + query, + render, + children, + } = props; + return /*#__PURE__*/ _react.default.createElement( + StaticQueryContext.Consumer, + null, + (staticQueryData) => + /*#__PURE__*/ _react.default.createElement(StaticQueryDataRenderer, { + data: data, + query: query, + render: render || children, + staticQueryData: staticQueryData, + }), + ); +}; + +exports.StaticQuery = StaticQuery; + +const useStaticQuery = (query) => { + var _context$query; + + if ( + typeof _react.default.useContext !== `function` && + process.env.NODE_ENV === `development` + ) { + throw new Error( + `You're likely using a version of React that doesn't support Hooks\n` + + `Please update React and ReactDOM to 16.8.0 or later to use the useStaticQuery hook.`, + ); + } + + const context = _react.default.useContext(StaticQueryContext); // query is a stringified number like `3303882` when wrapped with graphql, If a user forgets + // to wrap the query in a grqphql, then casting it to a Number results in `NaN` allowing us to + // catch the misuse of the API and give proper direction + + if (isNaN(Number(query))) { + throw new Error( + `useStaticQuery was called with a string but expects to be called using \`graphql\`. Try this: + +import { useStaticQuery, graphql } from 'gatsby'; + +useStaticQuery(graphql\`${query}\`); +`, + ); + } + + if ( + context === null || context === void 0 + ? void 0 + : (_context$query = context[query]) === null || _context$query === void 0 + ? void 0 + : _context$query.data + ) { + return context[query].data; + } else { + throw new Error( + `The result of this StaticQuery could not be fetched.\n\n` + + `This is likely a bug in Gatsby and if refreshing the page does not fix it, ` + + `please open an issue in https://github.com/gatsbyjs/gatsby/issues`, + ); + } +}; + +exports.useStaticQuery = useStaticQuery; +StaticQuery.propTypes = { + data: _propTypes.default.object, + query: _propTypes.default.string.isRequired, + render: _propTypes.default.func, + children: _propTypes.default.func, +}; + +function graphql() { + throw new Error( + `It appears like Gatsby is misconfigured. Gatsby related \`graphql\` calls ` + + `are supposed to only be evaluated at compile time, and then compiled away. ` + + `Unfortunately, something went wrong and the query was left in the compiled code.\n\n` + + `Unless your site has a complex or custom babel/Gatsby configuration this is likely a bug in Gatsby.`, + ); +} diff --git a/docs/.cache/commonjs/loader.js b/docs/.cache/commonjs/loader.js new file mode 100644 index 000000000..b5688e73d --- /dev/null +++ b/docs/.cache/commonjs/loader.js @@ -0,0 +1,562 @@ +"use strict"; + +var _interopRequireDefault = require( + "@babel/runtime/helpers/interopRequireDefault", +); + +exports.__esModule = true; +exports.getStaticQueryResults = getStaticQueryResults; +exports.default = exports.publicLoader = exports.setLoader = exports + .ProdLoader = exports.BaseLoader = exports.PageResourceStatus = void 0; + +var _prefetch = _interopRequireDefault(require("./prefetch")); + +var _emitter = _interopRequireDefault(require("./emitter")); + +var _findPath = require("./find-path"); + +/** + * Available resource loading statuses + */ +const PageResourceStatus = { + /** + * At least one of critical resources failed to load + */ + Error: `error`, + + /** + * Resources loaded successfully + */ + Success: `success`, +}; +exports.PageResourceStatus = PageResourceStatus; + +const preferDefault = (m) => m && m.default || m; + +const stripSurroundingSlashes = (s) => { + s = s[0] === `/` ? s.slice(1) : s; + s = s.endsWith(`/`) ? s.slice(0, -1) : s; + return s; +}; + +const createPageDataUrl = (path) => { + const fixedPath = path === `/` ? `index` : stripSurroundingSlashes(path); + return `${__PATH_PREFIX__}/page-data/${fixedPath}/page-data.json`; +}; + +function doFetch(url, method = `GET`) { + return new Promise((resolve, reject) => { + const req = new XMLHttpRequest(); + req.open(method, url, true); + + req.onreadystatechange = () => { + if (req.readyState == 4) { + resolve(req); + } + }; + + req.send(null); + }); +} + +const doesConnectionSupportPrefetch = () => { + if ( + `connection` in navigator && typeof navigator.connection !== `undefined` + ) { + if ((navigator.connection.effectiveType || ``).includes(`2g`)) { + return false; + } + + if (navigator.connection.saveData) { + return false; + } + } + + return true; +}; + +const toPageResources = (pageData, component = null) => { + const page = { + componentChunkName: pageData.componentChunkName, + path: pageData.path, + webpackCompilationHash: pageData.webpackCompilationHash, + matchPath: pageData.matchPath, + staticQueryHashes: pageData.staticQueryHashes, + }; + return { + component, + json: pageData.result, + page, + }; +}; + +class BaseLoader { + constructor(loadComponent, matchPaths) { + this.inFlightNetworkRequests = new Map(); + // Map of pagePath -> Page. Where Page is an object with: { + // status: PageResourceStatus.Success || PageResourceStatus.Error, + // payload: PageResources, // undefined if PageResourceStatus.Error + // } + // PageResources is { + // component, + // json: pageData.result, + // page: { + // componentChunkName, + // path, + // webpackCompilationHash, + // staticQueryHashes + // }, + // staticQueryResults + // } + this.pageDb = new Map(); + this.inFlightDb = new Map(); + this.staticQueryDb = {}; + this.pageDataDb = new Map(); + this.prefetchTriggered = new Set(); + this.prefetchCompleted = new Set(); + this.loadComponent = loadComponent; + (0, _findPath.setMatchPaths)(matchPaths); + } + + memoizedGet(url) { + let inFlightPromise = this.inFlightNetworkRequests.get(url); + + if (!inFlightPromise) { + inFlightPromise = doFetch(url, `GET`); + this.inFlightNetworkRequests.set(url, inFlightPromise); + } // Prefer duplication with then + catch over .finally to prevent problems in ie11 + firefox + + return inFlightPromise.then((response) => { + this.inFlightNetworkRequests.delete(url); + return response; + }).catch((err) => { + this.inFlightNetworkRequests.delete(url); + throw err; + }); + } + + setApiRunner(apiRunner) { + this.apiRunner = apiRunner; + this.prefetchDisabled = apiRunner(`disableCorePrefetching`).some((a) => a); + } + + fetchPageDataJson(loadObj) { + const { + pagePath, + retries = 0, + } = loadObj; + const url = createPageDataUrl(pagePath); + return this.memoizedGet(url).then((req) => { + const { + status, + responseText, + } = req; // Handle 200 + + if (status === 200) { + try { + const jsonPayload = JSON.parse(responseText); + + if (jsonPayload.path === undefined) { + throw new Error(`not a valid pageData response`); + } + + return Object.assign(loadObj, { + status: PageResourceStatus.Success, + payload: jsonPayload, + }); + } catch (err) { // continue regardless of error + } + } // Handle 404 + + if (status === 404 || status === 200) { + // If the request was for a 404 page and it doesn't exist, we're done + if (pagePath === `/404.html`) { + return Object.assign(loadObj, { + status: PageResourceStatus.Error, + }); + } // Need some code here to cache the 404 request. In case + // multiple loadPageDataJsons result in 404s + + return this.fetchPageDataJson(Object.assign(loadObj, { + pagePath: `/404.html`, + notFound: true, + })); + } // handle 500 response (Unrecoverable) + + if (status === 500) { + return Object.assign(loadObj, { + status: PageResourceStatus.Error, + }); + } // Handle everything else, including status === 0, and 503s. Should retry + + if (retries < 3) { + return this.fetchPageDataJson(Object.assign(loadObj, { + retries: retries + 1, + })); + } // Retried 3 times already, result is an error. + + return Object.assign(loadObj, { + status: PageResourceStatus.Error, + }); + }); + } + + loadPageDataJson(rawPath) { + const pagePath = (0, _findPath.findPath)(rawPath); + + if (this.pageDataDb.has(pagePath)) { + return Promise.resolve(this.pageDataDb.get(pagePath)); + } + + return this.fetchPageDataJson({ + pagePath, + }).then((pageData) => { + this.pageDataDb.set(pagePath, pageData); + return pageData; + }); + } + + findMatchPath(rawPath) { + return (0, _findPath.findMatchPath)(rawPath); + } // TODO check all uses of this and whether they use undefined for page resources not exist + + loadPage(rawPath) { + const pagePath = (0, _findPath.findPath)(rawPath); + + if (this.pageDb.has(pagePath)) { + const page = this.pageDb.get(pagePath); + return Promise.resolve(page.payload); + } + + if (this.inFlightDb.has(pagePath)) { + return this.inFlightDb.get(pagePath); + } + + const inFlightPromise = Promise.all( + [this.loadAppData(), this.loadPageDataJson(pagePath)], + ).then((allData) => { + const result = allData[1]; + + if (result.status === PageResourceStatus.Error) { + return { + status: PageResourceStatus.Error, + }; + } + + let pageData = result.payload; + const { + componentChunkName, + staticQueryHashes = [], + } = pageData; + const finalResult = {}; + const componentChunkPromise = this.loadComponent(componentChunkName).then( + (component) => { + finalResult.createdAt = new Date(); + let pageResources; + + if (!component) { + finalResult.status = PageResourceStatus.Error; + } else { + finalResult.status = PageResourceStatus.Success; + + if (result.notFound === true) { + finalResult.notFound = true; + } + + pageData = Object.assign(pageData, { + webpackCompilationHash: allData[0] + ? allData[0].webpackCompilationHash + : ``, + }); + pageResources = toPageResources(pageData, component); + } // undefined if final result is an error + + return pageResources; + }, + ); + const staticQueryBatchPromise = Promise.all( + staticQueryHashes.map((staticQueryHash) => { + // Check for cache in case this static query result has already been loaded + if (this.staticQueryDb[staticQueryHash]) { + const jsonPayload = this.staticQueryDb[staticQueryHash]; + return { + staticQueryHash, + jsonPayload, + }; + } + + return this.memoizedGet( + `${__PATH_PREFIX__}/static/d/${staticQueryHash}.json`, + ).then((req) => { + const jsonPayload = JSON.parse(req.responseText); + return { + staticQueryHash, + jsonPayload, + }; + }); + }), + ).then((staticQueryResults) => { + const staticQueryResultsMap = {}; + staticQueryResults.forEach(({ + staticQueryHash, + jsonPayload, + }) => { + staticQueryResultsMap[staticQueryHash] = jsonPayload; + this.staticQueryDb[staticQueryHash] = jsonPayload; + }); + return staticQueryResultsMap; + }); + return Promise.all([componentChunkPromise, staticQueryBatchPromise]).then( + ([pageResources, staticQueryResults]) => { + let payload; + + if (pageResources) { + payload = { ...pageResources, staticQueryResults }; + finalResult.payload = payload; + + _emitter.default.emit(`onPostLoadPageResources`, { + page: payload, + pageResources: payload, + }); + } + + this.pageDb.set(pagePath, finalResult); + return payload; + }, + ); + }); + inFlightPromise.then((response) => { + this.inFlightDb.delete(pagePath); + }).catch((error) => { + this.inFlightDb.delete(pagePath); + throw error; + }); + this.inFlightDb.set(pagePath, inFlightPromise); + return inFlightPromise; + } // returns undefined if loading page ran into errors + + loadPageSync(rawPath) { + const pagePath = (0, _findPath.findPath)(rawPath); + + if (this.pageDb.has(pagePath)) { + const pageData = this.pageDb.get(pagePath).payload; + return pageData; + } + + return undefined; + } + + shouldPrefetch(pagePath) { + // Skip prefetching if we know user is on slow or constrained connection + if (!doesConnectionSupportPrefetch()) { + return false; + } // Check if the page exists. + + if (this.pageDb.has(pagePath)) { + return false; + } + + return true; + } + + prefetch(pagePath) { + if (!this.shouldPrefetch(pagePath)) { + return false; + } // Tell plugins with custom prefetching logic that they should start + // prefetching this path. + + if (!this.prefetchTriggered.has(pagePath)) { + this.apiRunner(`onPrefetchPathname`, { + pathname: pagePath, + }); + this.prefetchTriggered.add(pagePath); + } // If a plugin has disabled core prefetching, stop now. + + if (this.prefetchDisabled) { + return false; + } + + const realPath = (0, _findPath.findPath)(pagePath); // Todo make doPrefetch logic cacheable + // eslint-disable-next-line consistent-return + + this.doPrefetch(realPath).then(() => { + if (!this.prefetchCompleted.has(pagePath)) { + this.apiRunner(`onPostPrefetchPathname`, { + pathname: pagePath, + }); + this.prefetchCompleted.add(pagePath); + } + }); + return true; + } + + doPrefetch(pagePath) { + throw new Error(`doPrefetch not implemented`); + } + + hovering(rawPath) { + this.loadPage(rawPath); + } + + getResourceURLsForPathname(rawPath) { + const pagePath = (0, _findPath.findPath)(rawPath); + const page = this.pageDataDb.get(pagePath); + + if (page) { + const pageResources = toPageResources(page.payload); + return [ + ...createComponentUrls(pageResources.page.componentChunkName), + createPageDataUrl(pagePath), + ]; + } else { + return null; + } + } + + isPageNotFound(rawPath) { + const pagePath = (0, _findPath.findPath)(rawPath); + const page = this.pageDb.get(pagePath); + return page && page.notFound === true; + } + + loadAppData(retries = 0) { + return this.memoizedGet(`${__PATH_PREFIX__}/page-data/app-data.json`).then( + (req) => { + const { + status, + responseText, + } = req; + let appData; + + if (status !== 200 && retries < 3) { + // Retry 3 times incase of non-200 responses + return this.loadAppData(retries + 1); + } // Handle 200 + + if (status === 200) { + try { + const jsonPayload = JSON.parse(responseText); + + if (jsonPayload.webpackCompilationHash === undefined) { + throw new Error(`not a valid app-data response`); + } + + appData = jsonPayload; + } catch (err) { // continue regardless of error + } + } + + return appData; + }, + ); + } +} + +exports.BaseLoader = BaseLoader; + +const createComponentUrls = (componentChunkName) => + (window.___chunkMapping[componentChunkName] || []).map((chunk) => + __PATH_PREFIX__ + chunk + ); + +class ProdLoader extends BaseLoader { + constructor(asyncRequires, matchPaths) { + const loadComponent = (chunkName) => + asyncRequires.components[chunkName] + ? asyncRequires.components[chunkName]().then(preferDefault) // loader will handle the case when component is null + .catch(() => null) + : Promise.resolve(); + + super(loadComponent, matchPaths); + } + + doPrefetch(pagePath) { + const pageDataUrl = createPageDataUrl(pagePath); + return (0, _prefetch.default)(pageDataUrl, { + crossOrigin: `anonymous`, + as: `fetch`, + }).then(() => + // This was just prefetched, so will return a response from + // the cache instead of making another request to the server + this.loadPageDataJson(pagePath) + ).then((result) => { + if (result.status !== PageResourceStatus.Success) { + return Promise.resolve(); + } + + const pageData = result.payload; + const chunkName = pageData.componentChunkName; + const componentUrls = createComponentUrls(chunkName); + return Promise.all(componentUrls.map(_prefetch.default)).then(() => + pageData + ); + }); + } + + loadPageDataJson(rawPath) { + return super.loadPageDataJson(rawPath).then((data) => { + if (data.notFound) { + // check if html file exist using HEAD request: + // if it does we should navigate to it instead of showing 404 + return doFetch(rawPath, `HEAD`).then((req) => { + if (req.status === 200) { + // page (.html file) actually exist (or we asked for 404 ) + // returning page resources status as errored to trigger + // regular browser navigation to given page + return { + status: PageResourceStatus.Error, + }; + } // if HEAD request wasn't 200, return notFound result + // and show 404 page + + return data; + }); + } + + return data; + }); + } +} + +exports.ProdLoader = ProdLoader; +let instance; + +const setLoader = (_loader) => { + instance = _loader; +}; + +exports.setLoader = setLoader; +const publicLoader = { + // Deprecated methods. As far as we're aware, these are only used by + // core gatsby and the offline plugin, however there's a very small + // chance they're called by others. + getResourcesForPathname: (rawPath) => { + console.warn( + `Warning: getResourcesForPathname is deprecated. Use loadPage instead`, + ); + return instance.i.loadPage(rawPath); + }, + getResourcesForPathnameSync: (rawPath) => { + console.warn( + `Warning: getResourcesForPathnameSync is deprecated. Use loadPageSync instead`, + ); + return instance.i.loadPageSync(rawPath); + }, + enqueue: (rawPath) => instance.prefetch(rawPath), + // Real methods + getResourceURLsForPathname: (rawPath) => + instance.getResourceURLsForPathname(rawPath), + loadPage: (rawPath) => instance.loadPage(rawPath), + loadPageSync: (rawPath) => instance.loadPageSync(rawPath), + prefetch: (rawPath) => instance.prefetch(rawPath), + isPageNotFound: (rawPath) => instance.isPageNotFound(rawPath), + hovering: (rawPath) => instance.hovering(rawPath), + loadAppData: () => instance.loadAppData(), +}; +exports.publicLoader = publicLoader; +var _default = publicLoader; +exports.default = _default; + +function getStaticQueryResults() { + return instance.staticQueryDb; +} diff --git a/docs/.cache/commonjs/navigation.js b/docs/.cache/commonjs/navigation.js new file mode 100644 index 000000000..3f06cf189 --- /dev/null +++ b/docs/.cache/commonjs/navigation.js @@ -0,0 +1,312 @@ +"use strict"; + +var _interopRequireWildcard = require( + "@babel/runtime/helpers/interopRequireWildcard", +); + +var _interopRequireDefault = require( + "@babel/runtime/helpers/interopRequireDefault", +); + +exports.__esModule = true; +exports.init = init; +exports.shouldUpdateScroll = shouldUpdateScroll; +exports.RouteUpdates = void 0; + +var _extends2 = _interopRequireDefault( + require("@babel/runtime/helpers/extends"), +); + +var _react = _interopRequireDefault(require("react")); + +var _propTypes = _interopRequireDefault(require("prop-types")); + +var _loader = _interopRequireWildcard(require("./loader")); + +var _redirects = _interopRequireDefault(require("./redirects.json")); + +var _apiRunnerBrowser = require("./api-runner-browser"); + +var _emitter = _interopRequireDefault(require("./emitter")); + +var _routeAnnouncerProps = require("./route-announcer-props"); + +var _router = require("@reach/router"); + +var _history = require("@reach/router/lib/history"); + +var _gatsbyLink = require("gatsby-link"); + +// Convert to a map for faster lookup in maybeRedirect() +const redirectMap = _redirects.default.reduce((map, redirect) => { + map[redirect.fromPath] = redirect; + return map; +}, {}); + +function maybeRedirect(pathname) { + const redirect = redirectMap[pathname]; + + if (redirect != null) { + if (process.env.NODE_ENV !== `production`) { + if (!_loader.default.isPageNotFound(pathname)) { + console.error( + `The route "${pathname}" matches both a page and a redirect; this is probably not intentional.`, + ); + } + } + + window.___replace(redirect.toPath); + + return true; + } else { + return false; + } +} + +const onPreRouteUpdate = (location, prevLocation) => { + if (!maybeRedirect(location.pathname)) { + (0, _apiRunnerBrowser.apiRunner)(`onPreRouteUpdate`, { + location, + prevLocation, + }); + } +}; + +const onRouteUpdate = (location, prevLocation) => { + if (!maybeRedirect(location.pathname)) { + (0, _apiRunnerBrowser.apiRunner)(`onRouteUpdate`, { + location, + prevLocation, + }); + } +}; + +const navigate = (to, options = {}) => { + // Support forward/backward navigation with numbers + // navigate(-2) (jumps back 2 history steps) + // navigate(2) (jumps forward 2 history steps) + if (typeof to === `number`) { + _history.globalHistory.navigate(to); + + return; + } + + let { + pathname, + } = (0, _gatsbyLink.parsePath)(to); + const redirect = redirectMap[pathname]; // If we're redirecting, just replace the passed in pathname + // to the one we want to redirect to. + + if (redirect) { + to = redirect.toPath; + pathname = (0, _gatsbyLink.parsePath)(to).pathname; + } // If we had a service worker update, no matter the path, reload window and + // reset the pathname whitelist + + if (window.___swUpdated) { + window.location = pathname; + return; + } // Start a timer to wait for a second before transitioning and showing a + // loader in case resources aren't around yet. + + const timeoutId = setTimeout(() => { + _emitter.default.emit(`onDelayedLoadPageResources`, { + pathname, + }); + + (0, _apiRunnerBrowser.apiRunner)(`onRouteUpdateDelayed`, { + location: window.location, + }); + }, 1000); + + _loader.default.loadPage(pathname).then((pageResources) => { + // If no page resources, then refresh the page + // Do this, rather than simply `window.location.reload()`, so that + // pressing the back/forward buttons work - otherwise when pressing + // back, the browser will just change the URL and expect JS to handle + // the change, which won't always work since it might not be a Gatsby + // page. + if ( + !pageResources || + pageResources.status === _loader.PageResourceStatus.Error + ) { + window.history.replaceState({}, ``, location.href); + window.location = pathname; + clearTimeout(timeoutId); + return; + } // If the loaded page has a different compilation hash to the + // window, then a rebuild has occurred on the server. Reload. + + if (process.env.NODE_ENV === `production` && pageResources) { + if ( + pageResources.page.webpackCompilationHash !== + window.___webpackCompilationHash + ) { + // Purge plugin-offline cache + if ( + `serviceWorker` in navigator && + navigator.serviceWorker.controller !== null && + navigator.serviceWorker.controller.state === `activated` + ) { + navigator.serviceWorker.controller.postMessage({ + gatsbyApi: `clearPathResources`, + }); + } + + console.log(`Site has changed on server. Reloading browser`); + window.location = pathname; + } + } + + (0, _router.navigate)(to, options); + clearTimeout(timeoutId); + }); +}; + +function shouldUpdateScroll(prevRouterProps, { + location, +}) { + const { + pathname, + hash, + } = location; + const results = (0, _apiRunnerBrowser.apiRunner)(`shouldUpdateScroll`, { + prevRouterProps, + // `pathname` for backwards compatibility + pathname, + routerProps: { + location, + }, + getSavedScrollPosition: (args) => this._stateStorage.read(args), + }); + + if (results.length > 0) { + // Use the latest registered shouldUpdateScroll result, this allows users to override plugin's configuration + // @see https://github.com/gatsbyjs/gatsby/issues/12038 + return results[results.length - 1]; + } + + if (prevRouterProps) { + const { + location: { + pathname: oldPathname, + }, + } = prevRouterProps; + + if (oldPathname === pathname) { + // Scroll to element if it exists, if it doesn't, or no hash is provided, + // scroll to top. + return hash ? decodeURI(hash.slice(1)) : [0, 0]; + } + } + + return true; +} + +function init() { + // The "scroll-behavior" package expects the "action" to be on the location + // object so let's copy it over. + _history.globalHistory.listen((args) => { + args.location.action = args.action; + }); + + window.___push = (to) => + navigate(to, { + replace: false, + }); + + window.___replace = (to) => + navigate(to, { + replace: true, + }); + + window.___navigate = (to, options) => navigate(to, options); // Check for initial page-load redirect + + maybeRedirect(window.location.pathname); +} + +class RouteAnnouncer extends _react.default.Component { + constructor(props) { + super(props); + this.announcementRef = /*#__PURE__*/ _react.default.createRef(); + } + + componentDidUpdate(prevProps, nextProps) { + requestAnimationFrame(() => { + let pageName = `new page at ${this.props.location.pathname}`; + + if (document.title) { + pageName = document.title; + } + + const pageHeadings = document.querySelectorAll( + `#gatsby-focus-wrapper h1`, + ); + + if (pageHeadings && pageHeadings.length) { + pageName = pageHeadings[0].textContent; + } + + const newAnnouncement = `Navigated to ${pageName}`; + + if (this.announcementRef.current) { + const oldAnnouncement = this.announcementRef.current.innerText; + + if (oldAnnouncement !== newAnnouncement) { + this.announcementRef.current.innerText = newAnnouncement; + } + } + }); + } + + render() { + return /*#__PURE__*/ _react.default.createElement( + "div", + (0, _extends2.default)({}, _routeAnnouncerProps.RouteAnnouncerProps, { + ref: this.announcementRef, + }), + ); + } +} // Fire on(Pre)RouteUpdate APIs + +class RouteUpdates extends _react.default.Component { + constructor(props) { + super(props); + onPreRouteUpdate(props.location, null); + } + + componentDidMount() { + onRouteUpdate(this.props.location, null); + } + + componentDidUpdate(prevProps, prevState, shouldFireRouteUpdate) { + if (shouldFireRouteUpdate) { + onRouteUpdate(this.props.location, prevProps.location); + } + } + + getSnapshotBeforeUpdate(prevProps) { + if (this.props.location.pathname !== prevProps.location.pathname) { + onPreRouteUpdate(this.props.location, prevProps.location); + return true; + } + + return false; + } + + render() { + return /*#__PURE__*/ _react.default.createElement( + _react.default.Fragment, + null, + this.props.children, /*#__PURE__*/ + _react.default.createElement(RouteAnnouncer, { + location: location, + }), + ); + } +} + +exports.RouteUpdates = RouteUpdates; +RouteUpdates.propTypes = { + location: _propTypes.default.object.isRequired, +}; diff --git a/docs/.cache/commonjs/normalize-page-path.js b/docs/.cache/commonjs/normalize-page-path.js new file mode 100644 index 000000000..e7e989033 --- /dev/null +++ b/docs/.cache/commonjs/normalize-page-path.js @@ -0,0 +1,22 @@ +"use strict"; + +exports.__esModule = true; +exports.default = void 0; + +var _default = (path) => { + if (path === undefined) { + return path; + } + + if (path === `/`) { + return `/`; + } + + if (path.charAt(path.length - 1) === `/`) { + return path.slice(0, -1); + } + + return path; +}; + +exports.default = _default; diff --git a/docs/.cache/commonjs/page-renderer.js b/docs/.cache/commonjs/page-renderer.js new file mode 100644 index 000000000..1ffa31557 --- /dev/null +++ b/docs/.cache/commonjs/page-renderer.js @@ -0,0 +1,68 @@ +"use strict"; + +var _interopRequireDefault = require( + "@babel/runtime/helpers/interopRequireDefault", +); + +var _interopRequireWildcard = require( + "@babel/runtime/helpers/interopRequireWildcard", +); + +exports.__esModule = true; +exports.default = void 0; + +var _react = _interopRequireWildcard(require("react")); + +var _propTypes = _interopRequireDefault(require("prop-types")); + +var _loader = require("./loader"); + +var _apiRunnerBrowser = require("./api-runner-browser"); + +// Renders page +class PageRenderer extends _react.default.Component { + render() { + const props = { ...this.props, pathContext: this.props.pageContext }; + const [replacementElement] = (0, _apiRunnerBrowser.apiRunner)( + `replaceComponentRenderer`, + { + props: this.props, + loader: _loader.publicLoader, + }, + ); + const pageElement = replacementElement || /*#__PURE__*/ + (0, _react.createElement)( + this.props.pageResources.component, + { + ...props, + key: this.props.path || this.props.pageResources.page.path, + }, + ); + const wrappedPage = (0, _apiRunnerBrowser.apiRunner)( + `wrapPageElement`, + { + element: pageElement, + props, + }, + pageElement, + ({ + result, + }) => { + return { + element: result, + props, + }; + }, + ).pop(); + return wrappedPage; + } +} + +PageRenderer.propTypes = { + location: _propTypes.default.object.isRequired, + pageResources: _propTypes.default.object.isRequired, + data: _propTypes.default.object, + pageContext: _propTypes.default.object.isRequired, +}; +var _default = PageRenderer; +exports.default = _default; diff --git a/docs/.cache/commonjs/polyfill-entry.js b/docs/.cache/commonjs/polyfill-entry.js new file mode 100644 index 000000000..f6f39bce3 --- /dev/null +++ b/docs/.cache/commonjs/polyfill-entry.js @@ -0,0 +1,7 @@ +"use strict"; + +require("gatsby-legacy-polyfills"); + +if (process.env.NODE_ENV === `development`) { + require(`event-source-polyfill`); +} diff --git a/docs/.cache/commonjs/polyfills/fetch.js b/docs/.cache/commonjs/polyfills/fetch.js new file mode 100644 index 000000000..df3000bde --- /dev/null +++ b/docs/.cache/commonjs/polyfills/fetch.js @@ -0,0 +1,3 @@ +"use strict"; + +module.exports = global.fetch; diff --git a/docs/.cache/commonjs/polyfills/no-op.js b/docs/.cache/commonjs/polyfills/no-op.js new file mode 100644 index 000000000..4b34a7603 --- /dev/null +++ b/docs/.cache/commonjs/polyfills/no-op.js @@ -0,0 +1,2 @@ +// empty file +"use strict"; diff --git a/docs/.cache/commonjs/polyfills/object-assign.js b/docs/.cache/commonjs/polyfills/object-assign.js new file mode 100644 index 000000000..f273acb6e --- /dev/null +++ b/docs/.cache/commonjs/polyfills/object-assign.js @@ -0,0 +1,3 @@ +"use strict"; + +module.exports = Object.assign; diff --git a/docs/.cache/commonjs/polyfills/whatwg-fetch.js b/docs/.cache/commonjs/polyfills/whatwg-fetch.js new file mode 100644 index 000000000..89d48c701 --- /dev/null +++ b/docs/.cache/commonjs/polyfills/whatwg-fetch.js @@ -0,0 +1,5 @@ +"use strict"; + +module.exports = { + fetch: global.fetch, +}; diff --git a/docs/.cache/commonjs/prefetch.js b/docs/.cache/commonjs/prefetch.js new file mode 100644 index 000000000..7a643c8a9 --- /dev/null +++ b/docs/.cache/commonjs/prefetch.js @@ -0,0 +1,82 @@ +"use strict"; + +exports.__esModule = true; +exports.default = void 0; + +const support = function (feature) { + if (typeof document === `undefined`) { + return false; + } + + const fakeLink = document.createElement(`link`); + + try { + if (fakeLink.relList && typeof fakeLink.relList.supports === `function`) { + return fakeLink.relList.supports(feature); + } + } catch (err) { + return false; + } + + return false; +}; + +const linkPrefetchStrategy = function (url, options) { + return new Promise((resolve, reject) => { + if (typeof document === `undefined`) { + reject(); + return; + } + + const link = document.createElement(`link`); + link.setAttribute(`rel`, `prefetch`); + link.setAttribute(`href`, url); + Object.keys(options).forEach((key) => { + link.setAttribute(key, options[key]); + }); + link.onload = resolve; + link.onerror = reject; + const parentElement = document.getElementsByTagName(`head`)[0] || + document.getElementsByName(`script`)[0].parentNode; + parentElement.appendChild(link); + }); +}; + +const xhrPrefetchStrategy = function (url) { + return new Promise((resolve, reject) => { + const req = new XMLHttpRequest(); + req.open(`GET`, url, true); + + req.onload = () => { + if (req.status === 200) { + resolve(); + } else { + reject(); + } + }; + + req.send(null); + }); +}; + +const supportedPrefetchStrategy = support(`prefetch`) + ? linkPrefetchStrategy + : xhrPrefetchStrategy; +const preFetched = {}; + +const prefetch = function (url, options) { + return new Promise((resolve) => { + if (preFetched[url]) { + resolve(); + return; + } + + supportedPrefetchStrategy(url, options).then(() => { + resolve(); + preFetched[url] = true; + }).catch(() => {}); // 404s are logged to the console anyway + }); +}; + +var _default = prefetch; +exports.default = _default; diff --git a/docs/.cache/commonjs/production-app.js b/docs/.cache/commonjs/production-app.js new file mode 100644 index 000000000..087dd93dd --- /dev/null +++ b/docs/.cache/commonjs/production-app.js @@ -0,0 +1,243 @@ +"use strict"; + +var _interopRequireDefault = require( + "@babel/runtime/helpers/interopRequireDefault", +); + +var _extends2 = _interopRequireDefault( + require("@babel/runtime/helpers/extends"), +); + +var _apiRunnerBrowser = require("./api-runner-browser"); + +var _react = _interopRequireDefault(require("react")); + +var _reactDom = _interopRequireDefault(require("react-dom")); + +var _router = require("@reach/router"); + +var _gatsbyReactRouterScroll = require("gatsby-react-router-scroll"); + +var _domready = _interopRequireDefault(require("@mikaelkristiansson/domready")); + +var _gatsby = require("gatsby"); + +var _navigation = require("./navigation"); + +var _emitter = _interopRequireDefault(require("./emitter")); + +var _pageRenderer = _interopRequireDefault(require("./page-renderer")); + +var _asyncRequires = _interopRequireDefault(require("$virtual/async-requires")); + +var _loader = require("./loader"); + +var _ensureResources = _interopRequireDefault(require("./ensure-resources")); + +var _stripPrefix = _interopRequireDefault(require("./strip-prefix")); + +var _matchPaths = _interopRequireDefault(require("$virtual/match-paths.json")); + +// Generated during bootstrap +const loader = new _loader.ProdLoader( + _asyncRequires.default, + _matchPaths.default, +); +(0, _loader.setLoader)(loader); +loader.setApiRunner(_apiRunnerBrowser.apiRunner); +window.asyncRequires = _asyncRequires.default; +window.___emitter = _emitter.default; +window.___loader = _loader.publicLoader; +(0, _navigation.init)(); +(0, _apiRunnerBrowser.apiRunnerAsync)(`onClientEntry`).then(() => { + // Let plugins register a service worker. The plugin just needs + // to return true. + if ((0, _apiRunnerBrowser.apiRunner)(`registerServiceWorker`).length > 0) { + require(`./register-service-worker`); + } // In gatsby v2 if Router is used in page using matchPaths + // paths need to contain full path. + // For example: + // - page have `/app/*` matchPath + // - inside template user needs to use `/app/xyz` as path + // Resetting `basepath`/`baseuri` keeps current behaviour + // to not introduce breaking change. + // Remove this in v3 + + const RouteHandler = (props) => + /*#__PURE__*/ _react.default.createElement( + _router.BaseContext.Provider, + { + value: { + baseuri: `/`, + basepath: `/`, + }, + }, /*#__PURE__*/ + _react.default.createElement(_pageRenderer.default, props), + ); + + const DataContext = _react.default.createContext({}); + + class GatsbyRoot extends _react.default.Component { + render() { + const { + children, + } = this.props; + return /*#__PURE__*/ _react.default.createElement( + _router.Location, + null, + ({ + location, + }) => + /*#__PURE__*/ _react.default.createElement(_ensureResources.default, { + location: location, + }, ({ + pageResources, + location, + }) => { + const staticQueryResults = (0, _loader.getStaticQueryResults)(); + return /*#__PURE__*/ _react.default.createElement( + _gatsby.StaticQueryContext.Provider, + { + value: staticQueryResults, + }, /*#__PURE__*/ + _react.default.createElement(DataContext.Provider, { + value: { + pageResources, + location, + }, + }, children), + ); + }), + ); + } + } + + class LocationHandler extends _react.default.Component { + render() { + return /*#__PURE__*/ _react.default.createElement( + DataContext.Consumer, + null, + ({ + pageResources, + location, + }) => + /*#__PURE__*/ _react.default.createElement( + _navigation.RouteUpdates, + { + location: location, + }, /*#__PURE__*/ + _react.default.createElement( + _gatsbyReactRouterScroll.ScrollContext, + { + location: location, + shouldUpdateScroll: _navigation.shouldUpdateScroll, + }, /*#__PURE__*/ + _react.default.createElement( + _router.Router, + { + basepath: __BASE_PATH__, + location: location, + id: "gatsby-focus-wrapper", + }, /*#__PURE__*/ + _react.default.createElement( + RouteHandler, + (0, _extends2.default)( + { + path: pageResources.page.path === `/404.html` + ? (0, _stripPrefix.default)( + location.pathname, + __BASE_PATH__, + ) + : encodeURI( + pageResources.page.matchPath || + pageResources.page.path, + ), + }, + this.props, + { + location: location, + pageResources: pageResources, + }, + pageResources.json, + ), + ), + ), + ), + ), + ); + } + } + + const { + pagePath, + location: browserLoc, + } = window; // Explicitly call navigate if the canonical path (window.pagePath) + // is different to the browser path (window.location.pathname). But + // only if NONE of the following conditions hold: + // + // - The url matches a client side route (page.matchPath) + // - it's a 404 page + // - it's the offline plugin shell (/offline-plugin-app-shell-fallback/) + + if ( + pagePath && __BASE_PATH__ + pagePath !== browserLoc.pathname && + !(loader.findMatchPath( + (0, _stripPrefix.default)(browserLoc.pathname, __BASE_PATH__), + ) || pagePath === `/404.html` || pagePath.match(/^\/404\/?$/) || + pagePath.match(/^\/offline-plugin-app-shell-fallback\/?$/)) + ) { + (0, _router.navigate)( + __BASE_PATH__ + pagePath + browserLoc.search + browserLoc.hash, + { + replace: true, + }, + ); + } + + _loader.publicLoader.loadPage(browserLoc.pathname).then((page) => { + if (!page || page.status === _loader.PageResourceStatus.Error) { + throw new Error( + `page resources for ${browserLoc.pathname} not found. Not rendering React`, + ); + } + + window.___webpackCompilationHash = page.page.webpackCompilationHash; + const SiteRoot = (0, _apiRunnerBrowser.apiRunner)( + `wrapRootElement`, + { + element: /*#__PURE__*/ _react.default.createElement( + LocationHandler, + null, + ), + }, /*#__PURE__*/ + _react.default.createElement(LocationHandler, null), + ({ + result, + }) => { + return { + element: result, + }; + }, + ).pop(); + + const App = () => + /*#__PURE__*/ _react.default.createElement(GatsbyRoot, null, SiteRoot); + + const renderer = (0, _apiRunnerBrowser.apiRunner)( + `replaceHydrateFunction`, + undefined, + _reactDom.default.hydrate, + )[0]; + (0, _domready.default)(() => { + renderer( + /*#__PURE__*/ _react.default.createElement(App, null), + typeof window !== `undefined` + ? document.getElementById(`___gatsby`) + : void 0, + () => { + (0, _apiRunnerBrowser.apiRunner)(`onInitialClientRender`); + }, + ); + }); + }); +}); diff --git a/docs/.cache/commonjs/public-page-renderer-dev.js b/docs/.cache/commonjs/public-page-renderer-dev.js new file mode 100644 index 000000000..edf363346 --- /dev/null +++ b/docs/.cache/commonjs/public-page-renderer-dev.js @@ -0,0 +1,38 @@ +"use strict"; + +var _interopRequireDefault = require( + "@babel/runtime/helpers/interopRequireDefault", +); + +exports.__esModule = true; +exports.default = void 0; + +var _react = _interopRequireDefault(require("react")); + +var _propTypes = _interopRequireDefault(require("prop-types")); + +var _loader = _interopRequireDefault(require("./loader")); + +var _queryResultStore = require("./query-result-store"); + +const DevPageRenderer = ({ + location, +}) => { + const pageResources = _loader.default.loadPageSync(location.pathname); + + return /*#__PURE__*/ _react.default.createElement( + _queryResultStore.PageQueryStore, + { + location, + pageResources, + }, + ); +}; + +DevPageRenderer.propTypes = { + location: _propTypes.default.shape({ + pathname: _propTypes.default.string.isRequired, + }).isRequired, +}; +var _default = DevPageRenderer; +exports.default = _default; diff --git a/docs/.cache/commonjs/public-page-renderer-prod.js b/docs/.cache/commonjs/public-page-renderer-prod.js new file mode 100644 index 000000000..b8fb15c58 --- /dev/null +++ b/docs/.cache/commonjs/public-page-renderer-prod.js @@ -0,0 +1,40 @@ +"use strict"; + +var _interopRequireDefault = require( + "@babel/runtime/helpers/interopRequireDefault", +); + +exports.__esModule = true; +exports.default = void 0; + +var _react = _interopRequireDefault(require("react")); + +var _propTypes = _interopRequireDefault(require("prop-types")); + +var _loader = _interopRequireDefault(require("./loader")); + +var _pageRenderer = _interopRequireDefault(require("./page-renderer")); + +const ProdPageRenderer = ({ + location, +}) => { + const pageResources = _loader.default.loadPageSync(location.pathname); + + if (!pageResources) { + return null; + } + + return /*#__PURE__*/ _react.default.createElement(_pageRenderer.default, { + location, + pageResources, + ...pageResources.json, + }); +}; + +ProdPageRenderer.propTypes = { + location: _propTypes.default.shape({ + pathname: _propTypes.default.string.isRequired, + }).isRequired, +}; +var _default = ProdPageRenderer; +exports.default = _default; diff --git a/docs/.cache/commonjs/public-page-renderer.js b/docs/.cache/commonjs/public-page-renderer.js new file mode 100644 index 000000000..98d85533c --- /dev/null +++ b/docs/.cache/commonjs/public-page-renderer.js @@ -0,0 +1,11 @@ +"use strict"; + +const preferDefault = (m) => m && m.default || m; + +if (process.env.BUILD_STAGE === `develop`) { + module.exports = preferDefault(require(`./public-page-renderer-dev`)); +} else if (process.env.BUILD_STAGE === `build-javascript`) { + module.exports = preferDefault(require(`./public-page-renderer-prod`)); +} else { + module.exports = () => null; +} diff --git a/docs/.cache/commonjs/query-result-store.js b/docs/.cache/commonjs/query-result-store.js new file mode 100644 index 000000000..e11ec7bdc --- /dev/null +++ b/docs/.cache/commonjs/query-result-store.js @@ -0,0 +1,152 @@ +"use strict"; + +var _interopRequireDefault = require( + "@babel/runtime/helpers/interopRequireDefault", +); + +exports.__esModule = true; +exports.StaticQueryStore = exports.PageQueryStore = void 0; + +var _extends2 = _interopRequireDefault( + require("@babel/runtime/helpers/extends"), +); + +var _react = _interopRequireDefault(require("react")); + +var _gatsby = require("gatsby"); + +var _socketIo = require("./socketIo"); + +var _pageRenderer = _interopRequireDefault(require("./page-renderer")); + +var _normalizePagePath = _interopRequireDefault( + require("./normalize-page-path"), +); + +if (process.env.NODE_ENV === `production`) { + throw new Error( + `It appears like Gatsby is misconfigured. JSONStore is Gatsby internal ` + + `development-only component and should never be used in production.\n\n` + + `Unless your site has a complex or custom webpack/Gatsby ` + + `configuration this is likely a bug in Gatsby. ` + + `Please report this at https://github.com/gatsbyjs/gatsby/issues ` + + `with steps to reproduce this error.`, + ); +} + +const getPathFromProps = (props) => + props.pageResources && props.pageResources.page + ? (0, _normalizePagePath.default)(props.pageResources.page.path) + : undefined; + +class PageQueryStore extends _react.default.Component { + constructor(props) { + super(props); + + this.handleMittEvent = () => { + this.setState({ + pageQueryData: (0, _socketIo.getPageQueryData)(), + }); + }; + + this.state = { + pageQueryData: (0, _socketIo.getPageQueryData)(), + path: null, + }; + } + + componentDidMount() { + (0, _socketIo.registerPath)(getPathFromProps(this.props)); + + ___emitter.on(`*`, this.handleMittEvent); + } + + componentWillUnmount() { + (0, _socketIo.unregisterPath)(this.state.path); + + ___emitter.off(`*`, this.handleMittEvent); + } + + static getDerivedStateFromProps(props, state) { + const newPath = getPathFromProps(props); + + if (newPath !== state.path) { + (0, _socketIo.unregisterPath)(state.path); + (0, _socketIo.registerPath)(newPath); + return { + path: newPath, + }; + } + + return null; + } + + shouldComponentUpdate(nextProps, nextState) { + // We want to update this component when: + // - location changed + // - page data for path changed + return this.props.location !== nextProps.location || + this.state.path !== nextState.path || + this.state + .pageQueryData[(0, _normalizePagePath.default)(nextState.path)] !== + nextState + .pageQueryData[(0, _normalizePagePath.default)(nextState.path)]; + } + + render() { + const data = this.state.pageQueryData[getPathFromProps(this.props)]; // eslint-disable-next-line + + if (!data) { + return /*#__PURE__*/ _react.default.createElement("div", null); + } + + return /*#__PURE__*/ _react.default.createElement( + _pageRenderer.default, + (0, _extends2.default)({}, this.props, data.result), + ); + } +} + +exports.PageQueryStore = PageQueryStore; + +class StaticQueryStore extends _react.default.Component { + constructor(props) { + super(props); + + this.handleMittEvent = () => { + this.setState({ + staticQueryData: (0, _socketIo.getStaticQueryData)(), + }); + }; + + this.state = { + staticQueryData: (0, _socketIo.getStaticQueryData)(), + }; + } + + componentDidMount() { + ___emitter.on(`*`, this.handleMittEvent); + } + + componentWillUnmount() { + ___emitter.off(`*`, this.handleMittEvent); + } + + shouldComponentUpdate(nextProps, nextState) { + // We want to update this component when: + // - static query results changed + return this.state.staticQueryData !== nextState.staticQueryData; + } + + render() { + return /*#__PURE__*/ _react.default.createElement( + _gatsby.StaticQueryContext.Provider, + { + value: this.state.staticQueryData, + }, + this.props.children, + ); + } +} + +exports.StaticQueryStore = StaticQueryStore; diff --git a/docs/.cache/commonjs/react-lifecycles-compat.js b/docs/.cache/commonjs/react-lifecycles-compat.js new file mode 100644 index 000000000..469fb1d47 --- /dev/null +++ b/docs/.cache/commonjs/react-lifecycles-compat.js @@ -0,0 +1,3 @@ +"use strict"; + +exports.polyfill = (Component) => Component; diff --git a/docs/.cache/commonjs/register-service-worker.js b/docs/.cache/commonjs/register-service-worker.js new file mode 100644 index 000000000..3d701b9bc --- /dev/null +++ b/docs/.cache/commonjs/register-service-worker.js @@ -0,0 +1,73 @@ +"use strict"; + +var _apiRunnerBrowser = require("./api-runner-browser"); + +if ( + window.location.protocol !== `https:` && + window.location.hostname !== `localhost` +) { + console.error( + `Service workers can only be used over HTTPS, or on localhost for development`, + ); +} else if (`serviceWorker` in navigator) { + navigator.serviceWorker.register(`${__BASE_PATH__}/sw.js`).then( + function (reg) { + reg.addEventListener(`updatefound`, () => { + (0, _apiRunnerBrowser.apiRunner)(`onServiceWorkerUpdateFound`, { + serviceWorker: reg, + }); // The updatefound event implies that reg.installing is set; see + // https://w3c.github.io/ServiceWorker/#service-worker-registration-updatefound-event + + const installingWorker = reg.installing; + console.log(`installingWorker`, installingWorker); + installingWorker.addEventListener(`statechange`, () => { + switch (installingWorker.state) { + case `installed`: + if (navigator.serviceWorker.controller) { + // At this point, the old content will have been purged and the fresh content will + // have been added to the cache. + // We set a flag so Gatsby Link knows to refresh the page on next navigation attempt + window.___swUpdated = true; // We call the onServiceWorkerUpdateReady API so users can show update prompts. + + (0, _apiRunnerBrowser.apiRunner)(`onServiceWorkerUpdateReady`, { + serviceWorker: reg, + }); // If resources failed for the current page, reload. + + if (window.___failedResources) { + console.log(`resources failed, SW updated - reloading`); + window.location.reload(); + } + } else { + // At this point, everything has been precached. + // It's the perfect time to display a "Content is cached for offline use." message. + console.log(`Content is now available offline!`); // Post to service worker that install is complete. + // Delay to allow time for the event listener to be added -- + // otherwise fetch is called too soon and resources aren't cached. + + (0, _apiRunnerBrowser.apiRunner)(`onServiceWorkerInstalled`, { + serviceWorker: reg, + }); + } + + break; + + case `redundant`: + console.error(`The installing service worker became redundant.`); + (0, _apiRunnerBrowser.apiRunner)(`onServiceWorkerRedundant`, { + serviceWorker: reg, + }); + break; + + case `activated`: + (0, _apiRunnerBrowser.apiRunner)(`onServiceWorkerActive`, { + serviceWorker: reg, + }); + break; + } + }); + }); + }, + ).catch(function (e) { + console.error(`Error during service worker registration:`, e); + }); +} diff --git a/docs/.cache/commonjs/root.js b/docs/.cache/commonjs/root.js new file mode 100644 index 000000000..f1db78508 --- /dev/null +++ b/docs/.cache/commonjs/root.js @@ -0,0 +1,199 @@ +"use strict"; + +var _interopRequireDefault = require( + "@babel/runtime/helpers/interopRequireDefault", +); + +exports.__esModule = true; +exports.default = void 0; + +var _extends2 = _interopRequireDefault( + require("@babel/runtime/helpers/extends"), +); + +var _react = _interopRequireDefault(require("react")); + +var _router = require("@reach/router"); + +var _gatsbyReactRouterScroll = require("gatsby-react-router-scroll"); + +var _navigation = require("./navigation"); + +var _apiRunnerBrowser = require("./api-runner-browser"); + +var _loader = _interopRequireDefault(require("./loader")); + +var _queryResultStore = require("./query-result-store"); + +var _ensureResources = _interopRequireDefault(require("./ensure-resources")); + +var _errorOverlayHandler = require("./error-overlay-handler"); + +// TODO: Remove entire block when we make fast-refresh the default +// In fast-refresh, this logic is all moved into the `error-overlay-handler` +if ( + window.__webpack_hot_middleware_reporter__ !== undefined && + process.env.GATSBY_HOT_LOADER !== `fast-refresh` +) { + const overlayErrorID = `webpack`; // Report build errors + + window.__webpack_hot_middleware_reporter__.useCustomOverlay({ + showProblems(type, obj) { + if (type !== `errors`) { + (0, _errorOverlayHandler.clearError)(overlayErrorID); + return; + } + + (0, _errorOverlayHandler.reportError)(overlayErrorID, obj[0]); + }, + + clear() { + (0, _errorOverlayHandler.clearError)(overlayErrorID); + }, + }); +} + +(0, _navigation.init)(); // In gatsby v2 if Router is used in page using matchPaths +// paths need to contain full path. +// For example: +// - page have `/app/*` matchPath +// - inside template user needs to use `/app/xyz` as path +// Resetting `basepath`/`baseuri` keeps current behaviour +// to not introduce breaking change. +// Remove this in v3 + +const RouteHandler = (props) => + /*#__PURE__*/ _react.default.createElement( + _router.BaseContext.Provider, + { + value: { + baseuri: `/`, + basepath: `/`, + }, + }, /*#__PURE__*/ + _react.default.createElement(_queryResultStore.PageQueryStore, props), + ); + +class LocationHandler extends _react.default.Component { + render() { + const { + location, + } = this.props; + + if (!_loader.default.isPageNotFound(location.pathname)) { + return /*#__PURE__*/ _react.default.createElement( + _ensureResources.default, + { + location: location, + }, + (locationAndPageResources) => + /*#__PURE__*/ _react.default.createElement( + _navigation.RouteUpdates, + { + location: location, + }, /*#__PURE__*/ + _react.default.createElement( + _gatsbyReactRouterScroll.ScrollContext, + { + location: location, + shouldUpdateScroll: _navigation.shouldUpdateScroll, + }, /*#__PURE__*/ + _react.default.createElement( + _router.Router, + { + basepath: __BASE_PATH__, + location: location, + id: "gatsby-focus-wrapper", + }, /*#__PURE__*/ + _react.default.createElement( + RouteHandler, + (0, _extends2.default)( + { + path: encodeURI( + locationAndPageResources.pageResources.page.matchPath || + locationAndPageResources.pageResources.page.path, + ), + }, + this.props, + locationAndPageResources, + ), + ), + ), + ), + ), + ); + } + + const dev404PageResources = _loader.default.loadPageSync(`/dev-404-page`); + + const real404PageResources = _loader.default.loadPageSync(`/404.html`); + + let custom404; + + if (real404PageResources) { + custom404 = /*#__PURE__*/ _react.default.createElement( + _queryResultStore.PageQueryStore, + (0, _extends2.default)({}, this.props, { + pageResources: real404PageResources, + }), + ); + } + + return /*#__PURE__*/ _react.default.createElement( + _navigation.RouteUpdates, + { + location: location, + }, /*#__PURE__*/ + _react.default.createElement( + _router.Router, + { + basepath: __BASE_PATH__, + location: location, + id: "gatsby-focus-wrapper", + }, /*#__PURE__*/ + _react.default.createElement(RouteHandler, { + path: location.pathname, + location: location, + pageResources: dev404PageResources, + custom404: custom404, + }), + ), + ); + } +} + +const Root = () => + /*#__PURE__*/ _react.default.createElement( + _router.Location, + null, + (locationContext) => + /*#__PURE__*/ _react.default.createElement( + LocationHandler, + locationContext, + ), + ); // Let site, plugins wrap the site e.g. for Redux. + +const WrappedRoot = (0, _apiRunnerBrowser.apiRunner)( + `wrapRootElement`, + { + element: /*#__PURE__*/ _react.default.createElement(Root, null), + }, /*#__PURE__*/ + _react.default.createElement(Root, null), + ({ + result, + plugin, + }) => { + return { + element: result, + }; + }, +).pop(); + +var _default = () => + /*#__PURE__*/ _react.default.createElement( + _queryResultStore.StaticQueryStore, + null, + WrappedRoot, + ); + +exports.default = _default; diff --git a/docs/.cache/commonjs/route-announcer-props.js b/docs/.cache/commonjs/route-announcer-props.js new file mode 100644 index 000000000..a28b1cd2c --- /dev/null +++ b/docs/.cache/commonjs/route-announcer-props.js @@ -0,0 +1,23 @@ +"use strict"; + +exports.__esModule = true; +exports.RouteAnnouncerProps = void 0; +// This is extracted to separate module because it's shared +// between browser and SSR code +const RouteAnnouncerProps = { + id: `gatsby-announcer`, + style: { + position: `absolute`, + top: 0, + width: 1, + height: 1, + padding: 0, + overflow: `hidden`, + clip: `rect(0, 0, 0, 0)`, + whiteSpace: `nowrap`, + border: 0, + }, + "aria-live": `assertive`, + "aria-atomic": `true`, +}; +exports.RouteAnnouncerProps = RouteAnnouncerProps; diff --git a/docs/.cache/commonjs/socketIo.js b/docs/.cache/commonjs/socketIo.js new file mode 100644 index 000000000..0ddd7aab5 --- /dev/null +++ b/docs/.cache/commonjs/socketIo.js @@ -0,0 +1,138 @@ +"use strict"; + +var _interopRequireDefault = require( + "@babel/runtime/helpers/interopRequireDefault", +); + +exports.__esModule = true; +exports.default = socketIo; +exports.getPageData = getPageData; +exports.registerPath = registerPath; +exports.unregisterPath = unregisterPath; +exports.getIsInitialized = exports.getPageQueryData = exports + .getStaticQueryData = void 0; + +var _errorOverlayHandler = require("./error-overlay-handler"); + +var _normalizePagePath = _interopRequireDefault( + require("./normalize-page-path"), +); + +let socket = null; +let staticQueryData = {}; +let pageQueryData = {}; +let isInitialized = false; + +const getStaticQueryData = () => staticQueryData; + +exports.getStaticQueryData = getStaticQueryData; + +const getPageQueryData = () => pageQueryData; + +exports.getPageQueryData = getPageQueryData; + +const getIsInitialized = () => isInitialized; + +exports.getIsInitialized = getIsInitialized; + +function socketIo() { + if (process.env.NODE_ENV !== `production`) { + if (!socket) { + // Try to initialize web socket if we didn't do it already + try { + // eslint-disable-next-line no-undef + socket = io(); + + const didDataChange = (msg, queryData) => { + const id = msg.type === `staticQueryResult` + ? msg.payload.id + : (0, _normalizePagePath.default)(msg.payload.id); + return !(id in queryData) || + JSON.stringify(msg.payload.result) !== + JSON.stringify(queryData[id]); + }; + + socket.on(`message`, (msg) => { + if (msg.type === `staticQueryResult`) { + if (didDataChange(msg, staticQueryData)) { + staticQueryData = { + ...staticQueryData, + [msg.payload.id]: msg.payload.result, + }; + } + } else if (msg.type === `pageQueryResult`) { + if (didDataChange(msg, pageQueryData)) { + pageQueryData = { + ...pageQueryData, + [(0, _normalizePagePath.default)(msg.payload.id)]: + msg.payload.result, + }; + } + } else if (msg.type === `overlayError`) { + if (msg.payload.message) { + (0, _errorOverlayHandler.reportError)( + msg.payload.id, + msg.payload.message, + ); + } else { + (0, _errorOverlayHandler.clearError)(msg.payload.id); + } + } + + if (msg.type && msg.payload) { + ___emitter.emit(msg.type, msg.payload); + } + }); + } catch (err) { + console.error(`Could not connect to socket.io on dev server.`); + } + } + + return socket; + } else { + return null; + } +} + +const inFlightGetPageDataPromiseCache = {}; + +function getPageData(pathname) { + pathname = (0, _normalizePagePath.default)(pathname); + + if (inFlightGetPageDataPromiseCache[pathname]) { + return inFlightGetPageDataPromiseCache[pathname]; + } else { + inFlightGetPageDataPromiseCache[pathname] = new Promise((resolve) => { + if (pageQueryData[pathname]) { + delete inFlightGetPageDataPromiseCache[pathname]; + resolve(pageQueryData[pathname]); + } else { + const onPageDataCallback = (msg) => { + if ( + msg.type === `pageQueryResult` && + (0, _normalizePagePath.default)(msg.payload.id) === pathname + ) { + socket.off(`message`, onPageDataCallback); + delete inFlightGetPageDataPromiseCache[pathname]; + resolve(pageQueryData[pathname]); + } + }; + + socket.on(`message`, onPageDataCallback); + socket.emit(`getDataForPath`, pathname); + } + }); + } + + return inFlightGetPageDataPromiseCache[pathname]; +} // Tell websocket-manager.js the new path we're on. +// This will help the backend prioritize queries for this +// path. + +function registerPath(path) { + socket.emit(`registerPath`, path); +} // Unregister the former path + +function unregisterPath(path) { + socket.emit(`unregisterPath`, path); +} diff --git a/docs/.cache/commonjs/static-entry.js b/docs/.cache/commonjs/static-entry.js new file mode 100644 index 000000000..4ff650ff6 --- /dev/null +++ b/docs/.cache/commonjs/static-entry.js @@ -0,0 +1,535 @@ +"use strict"; + +var _interopRequireDefault = require( + "@babel/runtime/helpers/interopRequireDefault", +); + +exports.__esModule = true; +exports.default = exports.sanitizeComponents = void 0; + +var _extends2 = _interopRequireDefault( + require("@babel/runtime/helpers/extends"), +); + +const React = require(`react`); + +const fs = require(`fs`); + +const { + join, +} = require(`path`); + +const { + renderToString, + renderToStaticMarkup, +} = require(`react-dom/server`); + +const { + ServerLocation, + Router, + isRedirect, +} = require(`@reach/router`); + +const { + get, + merge, + isObject, + flatten, + uniqBy, + flattenDeep, + replace, + concat, + memoize, +} = require(`lodash`); + +const { + RouteAnnouncerProps, +} = require(`./route-announcer-props`); + +const apiRunner = require(`./api-runner-ssr`); + +const syncRequires = require(`$virtual/sync-requires`); + +const { + version: gatsbyVersion, +} = require(`gatsby/package.json`); + +const stats = JSON.parse( + fs.readFileSync(`${process.cwd()}/public/webpack.stats.json`, `utf-8`), +); +const chunkMapping = JSON.parse( + fs.readFileSync(`${process.cwd()}/public/chunk-map.json`, `utf-8`), +); // const testRequireError = require("./test-require-error") +// For some extremely mysterious reason, webpack adds the above module *after* +// this module so that when this code runs, testRequireError is undefined. +// So in the meantime, we'll just inline it. + +const testRequireError = (moduleName, err) => { + const regex = new RegExp(`Error: Cannot find module\\s.${moduleName}`); + const firstLine = err.toString().split(`\n`)[0]; + return regex.test(firstLine); +}; + +let Html; + +try { + Html = require(`../src/html`); +} catch (err) { + if (testRequireError(`../src/html`, err)) { + Html = require(`./default-html`); + } else { + throw err; + } +} + +Html = Html && Html.__esModule ? Html.default : Html; + +const getPageDataPath = (path) => { + const fixedPagePath = path === `/` ? `index` : path; + return join(`page-data`, fixedPagePath, `page-data.json`); +}; + +const getPageDataUrl = (pagePath) => { + const pageDataPath = getPageDataPath(pagePath); + return `${__PATH_PREFIX__}/${pageDataPath}`; +}; + +const getStaticQueryUrl = (hash) => `${__PATH_PREFIX__}/static/d/${hash}.json`; + +const getPageData = (pagePath) => { + const pageDataPath = getPageDataPath(pagePath); + const absolutePageDataPath = join(process.cwd(), `public`, pageDataPath); + const pageDataRaw = fs.readFileSync(absolutePageDataPath); + + try { + return JSON.parse(pageDataRaw.toString()); + } catch (err) { + return null; + } +}; + +const appDataPath = join(`page-data`, `app-data.json`); +const getAppDataUrl = memoize(() => { + let appData; + + try { + const absoluteAppDataPath = join(process.cwd(), `public`, appDataPath); + const appDataRaw = fs.readFileSync(absoluteAppDataPath); + appData = JSON.parse(appDataRaw.toString()); + + if (!appData) { + return null; + } + } catch (err) { + return null; + } + + return `${__PATH_PREFIX__}/${appDataPath}`; +}); + +const loadPageDataSync = (pagePath) => { + const pageDataPath = getPageDataPath(pagePath); + const pageDataFile = join(process.cwd(), `public`, pageDataPath); + + try { + const pageDataJson = fs.readFileSync(pageDataFile); + return JSON.parse(pageDataJson); + } catch (error) { + // not an error if file is not found. There's just no page data + return null; + } +}; + +const createElement = React.createElement; + +const sanitizeComponents = (components) => { + const componentsArray = ensureArray(components); + return componentsArray.map((component) => { + // Ensure manifest is always loaded from content server + // And not asset server when an assetPrefix is used + if (__ASSET_PREFIX__ && component.props.rel === `manifest`) { + return React.cloneElement(component, { + href: replace(component.props.href, __ASSET_PREFIX__, ``), + }); + } + + return component; + }); +}; + +exports.sanitizeComponents = sanitizeComponents; + +const ensureArray = (components) => { + if (Array.isArray(components)) { + // remove falsy items and flatten + return flattenDeep( + components.filter((val) => Array.isArray(val) ? val.length > 0 : val), + ); + } else { + // we also accept single components, so we need to handle this case as well + return components ? [components] : []; + } +}; + +var _default = (pagePath, callback) => { + let bodyHtml = ``; + let headComponents = [/*#__PURE__*/ React.createElement("meta", { + name: "generator", + content: `Gatsby ${gatsbyVersion}`, + key: `generator-${gatsbyVersion}`, + })]; + let htmlAttributes = {}; + let bodyAttributes = {}; + let preBodyComponents = []; + let postBodyComponents = []; + let bodyProps = {}; + + const replaceBodyHTMLString = (body) => { + bodyHtml = body; + }; + + const setHeadComponents = (components) => { + headComponents = headComponents.concat(sanitizeComponents(components)); + }; + + const setHtmlAttributes = (attributes) => { + htmlAttributes = merge(htmlAttributes, attributes); + }; + + const setBodyAttributes = (attributes) => { + bodyAttributes = merge(bodyAttributes, attributes); + }; + + const setPreBodyComponents = (components) => { + preBodyComponents = preBodyComponents.concat( + sanitizeComponents(components), + ); + }; + + const setPostBodyComponents = (components) => { + postBodyComponents = postBodyComponents.concat( + sanitizeComponents(components), + ); + }; + + const setBodyProps = (props) => { + bodyProps = merge({}, bodyProps, props); + }; + + const getHeadComponents = () => headComponents; + + const replaceHeadComponents = (components) => { + headComponents = sanitizeComponents(components); + }; + + const getPreBodyComponents = () => preBodyComponents; + + const replacePreBodyComponents = (components) => { + preBodyComponents = sanitizeComponents(components); + }; + + const getPostBodyComponents = () => postBodyComponents; + + const replacePostBodyComponents = (components) => { + postBodyComponents = sanitizeComponents(components); + }; + + const pageData = getPageData(pagePath); + const pageDataUrl = getPageDataUrl(pagePath); + const appDataUrl = getAppDataUrl(); + const { + componentChunkName, + staticQueryHashes = [], + } = pageData; + const staticQueryUrls = staticQueryHashes.map(getStaticQueryUrl); + + class RouteHandler extends React.Component { + render() { + const props = { + ...this.props, + ...pageData.result, + // pathContext was deprecated in v2. Renamed to pageContext + pathContext: pageData.result ? pageData.result.pageContext : undefined, + }; + const pageElement = createElement( + syncRequires.components[componentChunkName], + props, + ); + const wrappedPage = apiRunner( + `wrapPageElement`, + { + element: pageElement, + props, + }, + pageElement, + ({ + result, + }) => { + return { + element: result, + props, + }; + }, + ).pop(); + return wrappedPage; + } + } + + const routerElement = /*#__PURE__*/ React.createElement( + ServerLocation, + { + url: `${__BASE_PATH__}${pagePath}`, + }, /*#__PURE__*/ + React.createElement( + Router, + { + id: "gatsby-focus-wrapper", + baseuri: __BASE_PATH__, + }, /*#__PURE__*/ + React.createElement(RouteHandler, { + path: "/*", + }), + ), /*#__PURE__*/ + React.createElement("div", RouteAnnouncerProps), + ); + const bodyComponent = apiRunner( + `wrapRootElement`, + { + element: routerElement, + pathname: pagePath, + }, + routerElement, + ({ + result, + }) => { + return { + element: result, + pathname: pagePath, + }; + }, + ).pop(); // Let the site or plugin render the page component. + + apiRunner(`replaceRenderer`, { + bodyComponent, + replaceBodyHTMLString, + setHeadComponents, + setHtmlAttributes, + setBodyAttributes, + setPreBodyComponents, + setPostBodyComponents, + setBodyProps, + pathname: pagePath, + pathPrefix: __PATH_PREFIX__, + }); // If no one stepped up, we'll handle it. + + if (!bodyHtml) { + try { + bodyHtml = renderToString(bodyComponent); + } catch (e) { + // ignore @reach/router redirect errors + if (!isRedirect(e)) throw e; + } + } // Create paths to scripts + + let scriptsAndStyles = flatten([`app`, componentChunkName].map((s) => { + const fetchKey = `assetsByChunkName[${s}]`; + let chunks = get(stats, fetchKey); + const namedChunkGroups = get(stats, `namedChunkGroups`); + + if (!chunks) { + return null; + } + + chunks = chunks.map((chunk) => { + if (chunk === `/`) { + return null; + } + + return { + rel: `preload`, + name: chunk, + }; + }); + namedChunkGroups[s].assets.forEach((asset) => + chunks.push({ + rel: `preload`, + name: asset, + }) + ); + const childAssets = namedChunkGroups[s].childAssets; + + for (const rel in childAssets) { + chunks = concat( + chunks, + childAssets[rel].map((chunk) => { + return { + rel, + name: chunk, + }; + }), + ); + } + + return chunks; + })).filter((s) => isObject(s)).sort((s1, s2) => s1.rel == `preload` ? -1 : 1); // given priority to preload + + scriptsAndStyles = uniqBy(scriptsAndStyles, (item) => item.name); + const scripts = scriptsAndStyles.filter((script) => + script.name && script.name.endsWith(`.js`) + ); + const styles = scriptsAndStyles.filter((style) => + style.name && style.name.endsWith(`.css`) + ); + apiRunner(`onRenderBody`, { + setHeadComponents, + setHtmlAttributes, + setBodyAttributes, + setPreBodyComponents, + setPostBodyComponents, + setBodyProps, + pathname: pagePath, + loadPageDataSync, + bodyHtml, + scripts, + styles, + pathPrefix: __PATH_PREFIX__, + }); + scripts.slice(0).reverse().forEach((script) => { + // Add preload/prefetch s for scripts. + headComponents.push(/*#__PURE__*/ React.createElement("link", { + as: "script", + rel: script.rel, + key: script.name, + href: `${__PATH_PREFIX__}/${script.name}`, + })); + }); + + if (pageData) { + headComponents.push(/*#__PURE__*/ React.createElement("link", { + as: "fetch", + rel: "preload", + key: pageDataUrl, + href: pageDataUrl, + crossOrigin: "anonymous", + })); + } + + staticQueryUrls.forEach((staticQueryUrl) => + headComponents.push(/*#__PURE__*/ React.createElement("link", { + as: "fetch", + rel: "preload", + key: staticQueryUrl, + href: staticQueryUrl, + crossOrigin: "anonymous", + })) + ); + + if (appDataUrl) { + headComponents.push(/*#__PURE__*/ React.createElement("link", { + as: "fetch", + rel: "preload", + key: appDataUrl, + href: appDataUrl, + crossOrigin: "anonymous", + })); + } + + styles.slice(0).reverse().forEach((style) => { + // Add s for styles that should be prefetched + // otherwise, inline as a