How to make Slash Commands for your Discord Bot (Discord.js)

Поділитися
Вставка
  • Опубліковано 13 гру 2024

КОМЕНТАРІ • 155

  • @makxoito01
    @makxoito01 9 місяців тому +8

    here u go sir.

    • @RohanPlayZ_YT
      @RohanPlayZ_YT 9 місяців тому +1

      I feel bad for you..

    • @taimialia
      @taimialia 9 місяців тому

      fr feel bad that the creator didn't reply or pinged ur message

    • @ImagineGamingPlay
      @ImagineGamingPlay  8 місяців тому +1

      My bad

  • @RecRoomGuyHere
    @RecRoomGuyHere 10 місяців тому +11

    happy 18th bday dude! (i was watching the embed tutorial when you said your bday and i realised im watching on your 18th haha)

  • @thamtom3856
    @thamtom3856 Рік тому +4

    Big W! Looking forward for the part 2 and upcoming future videos. Keep it up mate

  • @HaneeshPediredla
    @HaneeshPediredla 3 місяці тому

    Out of 100 tutorials I watched this is the only one that explains clearly!! You earned yourself a sub man!!

  • @makxoito01
    @makxoito01 9 місяців тому +3

    ooooraaa

  • @oyepriyansh
    @oyepriyansh Рік тому +18

    Bros Comback 👀

  • @Glitchwar7
    @Glitchwar7 10 місяців тому +1

    Thank you for making this video! This was super helpful!

  • @LandfishProd.
    @LandfishProd. Рік тому +1

    Haven't seen this name in a while... Welcome back IGP.

  • @Bruinebies
    @Bruinebies Рік тому +4

    Yo, you are back on youtube :D

  • @tas_nimmy
    @tas_nimmy Рік тому +1

    The legend finally came back, a big W fr

  • @masakre2lalune634
    @masakre2lalune634 Рік тому +1

    “Hey, I hope you are doing well. I just wanted to say that over the past few months, our conversations have really meant a lot to me and I’ve developed feelings for you. I enjoy spending time with you and I love how you make me feel when I’m around you. I’m telling you all this because I care about you and I think you deserve to know the truth. So I just want you to know that my feelings for you are real and I want you to think about it as well.”

  • @TheRealKyuOFC
    @TheRealKyuOFC Рік тому +1

    Waiting for next part🎉

  • @AlluXD
    @AlluXD Рік тому +1

    Holy shit bro came back

  • @KikoMT
    @KikoMT 7 місяців тому +2

    For some reason when I execute the code in the shell, some error pops up mentioning "Cannot read properties of undefined (reading 'setToken')" how can I fix this issue

    • @Plixy1
      @Plixy1 6 місяців тому

      fixed it or still?

  • @simplepreciseyt
    @simplepreciseyt Рік тому

    This is a well paced, all rounded video, however I would like to mention that the lack of 4k really ruining the experience for me, nevertheless, I will hesitate from calling this video bad because of the pros I mentioned above. Looking forward to see more videos, but the next time with 4k.
    Thank you for your understanding.

  • @GamingCoderzX
    @GamingCoderzX 11 місяців тому

    My mans backkkkkkk! Les goooo

  • @DemonX82
    @DemonX82 6 місяців тому

    Thanks, you made it looks easy

  • @Discord_users
    @Discord_users 4 місяці тому

    I made my own bot! Thank you!

  • @MuddyIsCool
    @MuddyIsCool 5 місяців тому +2

    Not sure if anyone will see this, but for some reason it keeps saying something alone the lines of REST isn't valid or smthin, I genuinely can't do anything because rest wont work. Any advice?

    • @ImagineGamingPlay
      @ImagineGamingPlay  4 місяці тому

      You need to be a little more specific about the error

    • @lily_chann
      @lily_chann 3 місяці тому

      ​@@ImagineGamingPlay REST is not a constructor is what shows up

  • @celxsth
    @celxsth Рік тому +1

    Yooo bro came back

  • @TheAntinity
    @TheAntinity Рік тому +1

    bro came alive

  • @matute_penzotti
    @matute_penzotti 9 місяців тому

    omgg bro tyy i need this a lot

  • @zolite7213
    @zolite7213 8 місяців тому +4

    i keep getting to @4:30 where i run the "node name-of-file.js" and it tells me "TypeError: REST is not a constructor" yet this is what my code looks like
    const { REST, Routes } = require("discord.js");
    //Info needed for slash commands
    const botID = "here i have my bot ID, ignore this part";
    const serverID = "here i have my server ID, ignore this part";
    const botToken = process.env.token;
    const rest = new REST().setToken(botToken);
    const slashRegister = async () => {
    try {
    await rest.put(Routes.applicationGuildCommands(botID, serverID), {
    body: [
    {
    name: "ping",
    description: "just ping command, lol."
    }
    ]
    });
    } catch (error) {
    console.log(error);
    }
    };
    slashRegister();
    thoughts?

    • @ImagineGamingPlay
      @ImagineGamingPlay  6 місяців тому +1

      Sorry for ignoring, are you using the latest discord.js version? If you don't know how to check, do let me know.

    • @MrGamerBoyYTOrg
      @MrGamerBoyYTOrg 6 місяців тому

      @@ImagineGamingPlay ~/AttachedSwelteringLearning$ node slash-deploy.js
      node:internal/modules/cjs/loader:1146
      throw err;
      ^
      Error: Cannot find module 'discord.js'
      Require stack:
      - /home/runner/AttachedSwelteringLearning/slash-deploy.js
      at Module._resolveFilename (node:internal/modules/cjs/loader:1143:15)
      at Module._load (node:internal/modules/cjs/loader:984:27)
      at Module.require (node:internal/modules/cjs/loader:1231:19)
      at require (node:internal/modules/helpers:179:18)
      at Object. (/home/runner/AttachedSwelteringLearning/slash-deploy.js:1:26)
      at Module._compile (node:internal/modules/cjs/loader:1369:14)
      at Module._extensions..js (node:internal/modules/cjs/loader:1427:10)
      at Module.load (node:internal/modules/cjs/loader:1206:32)
      at Module._load (node:internal/modules/cjs/loader:1022:12)
      at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:135:12) {
      code: 'MODULE_NOT_FOUND',
      requireStack: [ '/home/runner/AttachedSwelteringLearning/slash-deploy.js' ]
      }(
      this is the error i get on the same step

    • @artman3
      @artman3 6 місяців тому +1

      im also getting the same problem, have you found a fix?
      edit:
      i think i fixed it, take off the "()" in
      const rest = new REST().setToken(botToken);
      so it should be
      const rest = new REST.setToken(botToken);
      but for some reason it doesnt show it on discord, i even made prefix command and nothing would print

    • @zolite7213
      @zolite7213 6 місяців тому

      @@artman3 im actually just now seeing his reply.. fuck me. i havent found a fix btw, but as he said to me check to see if you're using the latest discord.js version since that might be the root of our issues

    • @zolite7213
      @zolite7213 6 місяців тому

      @@ImagineGamingPlay just now seeing your reply 😭 im not 100% sure if i am or not, ill get back to you on whether or not it fixes the issue.

  • @im_andrei1010
    @im_andrei1010 Рік тому +2

    GUYS HES BACK

  • @NotSar
    @NotSar 4 місяці тому +1

    when are you coming back

  • @DiscordTricks
    @DiscordTricks Рік тому +1

    He is back

  • @CharlesShorts
    @CharlesShorts 9 місяців тому

    Amazing tutorial

  • @nafiskamalniloy4402
    @nafiskamalniloy4402 9 місяців тому

    can u make a video with a slash command with embed having options?

  • @Evil_voidr
    @Evil_voidr 2 місяці тому

    It doesn’t show the command 4:34

  • @_purple_44_
    @_purple_44_ Рік тому +1

    Bro remembered his youtube password

  • @CodeCrazyX
    @CodeCrazyX 8 місяців тому

    Thank you a good video keep up

  • @ExpertiiS
    @ExpertiiS 7 місяців тому +1

    shell says that "TypeError: REST is not a constructor", what do i do to fix?

    • @ImagineGamingPlay
      @ImagineGamingPlay  6 місяців тому

      Sorry for ignoring, are you using the latest discord.js version? If you don't know how to check, do let me know.

    • @Zachary_24
      @Zachary_24 6 місяців тому

      @@ImagineGamingPlay how do you?

    • @ImagineGamingPlay
      @ImagineGamingPlay  6 місяців тому

      @Zachary_24 Go to package.json, and there you'll see a line which goes something like "discord.js": version, from there you can see the version. (like 14.x.y is v14)

    • @MrGamerBoyYTOrg
      @MrGamerBoyYTOrg 6 місяців тому

      @@ImagineGamingPlay mine is 1.0.0

    • @ImagineGamingPlay
      @ImagineGamingPlay  6 місяців тому

      @@MrGamerBoyYTOrg you're seeing the wrong line

  • @clansofchess
    @clansofchess 10 місяців тому +1

    It says my token is not present when I tried to run the command in shell. How do I fix this?
    Edit: now it says discordapi error 401 unauthorized
    Edit 2: ok it says my token is invalid/unexpected when I type node slash-deploy.js

    • @ImagineGamingPlay
      @ImagineGamingPlay  8 місяців тому

      have you fixed it yet

    • @terracottasucks
      @terracottasucks 8 місяців тому

      I'm having the same issue, any help would be appreciated

    • @ImagineGamingPlay
      @ImagineGamingPlay  8 місяців тому

      @terracottasucks it means your token is invalid in the security tab

  • @angelzinhah4519
    @angelzinhah4519 Рік тому

    BRO WHERE WERE YOU

  • @ISamAtlas
    @ISamAtlas Місяць тому

    ALMOST NINETEENTH BDAY!!!

  • @faaxultimate7695
    @faaxultimate7695 5 місяців тому

    not sure if anyone will see this, but for some reason my slash command simply just doesn't appear. my bot is online, and it is in my server. but the slash command doesnt show

  • @angelzinhah4519
    @angelzinhah4519 9 місяців тому

    Eii, so I was wondering. Coul you please remake the first videos? The codes aren't working anymore

  • @3NeighborhoodChildren
    @3NeighborhoodChildren 6 місяців тому

    Hey I don't know what is happening but for require("discord.js") it says "File is a CommonJS module; it may be converted to an ES module." I am really confused

    • @3NeighborhoodChildren
      @3NeighborhoodChildren 6 місяців тому

      It also says cannot find module

    • @ImagineGamingPlay
      @ImagineGamingPlay  6 місяців тому

      Your initial comment is just a warning. For your second issue, you don't have discord.js installed most likely

    • @3NeighborhoodChildren
      @3NeighborhoodChildren 6 місяців тому

      @@ImagineGamingPlay thanks but I have it installed

    • @MuddyIsCool
      @MuddyIsCool 5 місяців тому

      Keeps happening to me aswell, anyone know what to do?

    • @3NeighborhoodChildren
      @3NeighborhoodChildren 5 місяців тому

      @@MuddyIsCool i some how fixed it

  • @Liyahrts
    @Liyahrts 8 місяців тому

    could u make a video next on how to make reaction roles?

    • @Liyahrts
      @Liyahrts 8 місяців тому

      using ur bot ofc

  • @SkyfireGamez
    @SkyfireGamez Рік тому +1

    i didnt hear you get rebooted man

  • @misbah.m
    @misbah.m Рік тому +2

    slayyyy skay 💅

  • @za234v8
    @za234v8 9 місяців тому

    I keep getting an error called "REST is not a constructor at Object" does anyone know how to fix it?

  • @fish_fnf
    @fish_fnf Рік тому +1

    Did someone press your start button?

  • @Discord_users
    @Discord_users 4 місяці тому

    Can you make a tutorial of how to make your bot be seen on the bot directory?

    • @Discord_users
      @Discord_users 3 місяці тому

      Hey can I code a bot with you?

  • @curlzncrush
    @curlzncrush Рік тому

    The king is back!

  • @ImanoobXDe
    @ImanoobXDe 8 місяців тому

    what is the software you use to code?

  • @nathanbenofficial522
    @nathanbenofficial522 Місяць тому

    Hi! I really loved your tutorial but im getting an error on this line
    const rest = new REST().setToken(BotToken)
    When im trying to run it from the shell, its throwing this error, pls tell me how to resolve this
    const rest = new REST().setToken(BotToken)
    ^
    TypeError: REST is not a constructor

    • @ImagineGamingPlay
      @ImagineGamingPlay  28 днів тому

      Are you using an older version of discord.js?

    • @nathanbenofficial522
      @nathanbenofficial522 28 днів тому

      @ImagineGamingPlay idk how to update it then

    • @ImagineGamingPlay
      @ImagineGamingPlay  28 днів тому

      @@nathanbenofficial522 Hop on to my Discord server. It's better there for helping

    • @nathanbenofficial522
      @nathanbenofficial522 27 днів тому

      @@ImagineGamingPlay Thx ill join, but im using the latest version which is 14.63.3

  • @kodzukennnnn
    @kodzukennnnn 6 місяців тому

    so for me it says "REST is not a constructor" so maybe i need to update my discord.js version. how do i do that without fucking up the codes?

    • @kodzukennnnn
      @kodzukennnnn 6 місяців тому

      nvm i've done it but idk if my codes still work like before. It's saying "ReadableStream is not defined"

    • @ImagineGamingPlay
      @ImagineGamingPlay  5 місяців тому

      @@kodzukennnnn Your node.js is outdated. are you using an old repl project perhaps?

    • @kodzukennnnn
      @kodzukennnnn 5 місяців тому

      @@ImagineGamingPlay nope it’s new and i stopped using replit cause they told me that it’s not that safe so don’t worry! thanks for answering
      if you want more info about replit i could dm you on discord

  • @ChicagoRoleplayCommunity
    @ChicagoRoleplayCommunity Рік тому

    Which discord.js should we use?

  • @Noodles6000
    @Noodles6000 Рік тому +1

    Igp revived discord bot help

  • @clonetrooper23
    @clonetrooper23 10 місяців тому

    7:40

  • @chemreal
    @chemreal Рік тому +1

    bro who got his reboot card 💀

  • @makxoito01
    @makxoito01 9 місяців тому

    imagineeee

  • @spaceuniversity7448
    @spaceuniversity7448 Рік тому +1

    Post more i need you

  • @goldtequila_.
    @goldtequila_. 10 місяців тому

    how to download discord.js v14 on replit. It only shows v14.14.1

  • @Watchoutav
    @Watchoutav Місяць тому

    How do I get to the coding part?

  • @MashrafiYT
    @MashrafiYT Рік тому +2

    W

  • @YellowARMY_gtag
    @YellowARMY_gtag 6 місяців тому

    IT SAYS INSTALL REPLITS NODE TOOLS

  • @ZENUX_EDITS
    @ZENUX_EDITS Рік тому +4

    Who tf revived you

    • @ImagineGamingPlay
      @ImagineGamingPlay  Рік тому

      Found my reboot card

    • @ZENUX_EDITS
      @ZENUX_EDITS Рік тому

      @@ImagineGamingPlay nahhhh bro you're literally our careless father in bot development you thaught as the most basic things and went for milk and we learnt everything advanced ourselves. Joining your servers feels like nostalgia. Sending code with token and using that one dog bot (chiku was the name ig) tag system to get code like "start" tag and other tags for commands' code.
      Started from copying others code from your server to teaching others bot development. I've come a long way (now it's boring but I wanna restart).
      Love from India buddy ❤️

  • @Antlercrow
    @Antlercrow 7 місяців тому

    it says Rest is not a Constructor how the hell do we fix that??

    • @ImagineGamingPlay
      @ImagineGamingPlay  7 місяців тому

      I'd need to see your code for that

    • @Antlercrow
      @Antlercrow 7 місяців тому

      @@ImagineGamingPlay So it no longer does that but it wont do a command still after running into no errors.

  • @kaydencaisley2394
    @kaydencaisley2394 8 місяців тому +1

    BRO 3:38 TELL ME WHAT TO DO LIKE UR JUST GOIN BAM BAM QUICK apart from that good work sorry

  • @Kaiser_Playz
    @Kaiser_Playz 5 місяців тому

    I cant use spaces or Capitals in my Command name anyone help me?

    • @stilryttv
      @stilryttv 5 місяців тому +1

      You cant use them, for example you cant do “/Ping Me” but you can do “/ping-me”

    • @Kaiser_Playz
      @Kaiser_Playz 4 місяці тому +1

      @@stilryttv I have seen multiple commands use spaces though

    • @stilryttv
      @stilryttv 4 місяці тому

      @@Kaiser_Playz might be like special coding or something

    • @ImagineGamingPlay
      @ImagineGamingPlay  4 місяці тому

      @@Kaiser_Playz Those are called sub commands

  • @mayatheshark
    @mayatheshark 7 місяців тому

    not working

  • @0Saraj
    @0Saraj 11 місяців тому

    Yo why taking so long for a video create more videos
    Can you explain how to code our bots like without checking tutorials os it possible ?

  • @00_Hacker
    @00_Hacker 9 місяців тому

    How to make, that the bot loggs into an Fortnite account?

  • @dragon-slayer27
    @dragon-slayer27 Рік тому

    Bro took a whole lifetime to post

  • @Universe_Error
    @Universe_Error 10 місяців тому

    idk why but this is bugging my code

  • @shivangimishra9142
    @shivangimishra9142 11 місяців тому

    ❤❤

  • @shivangimishra9142
    @shivangimishra9142 6 місяців тому

    Hi

  • @goodboyneon
    @goodboyneon Рік тому

    YOU ALIVENED FROM THE DEAD WTF

  • @YellowARMY_gtag
    @YellowARMY_gtag 6 місяців тому

    PASTE BIN>>>

  • @Discord_users
    @Discord_users 4 місяці тому

    But

  • @NotSoZub2010
    @NotSoZub2010 Рік тому

    Nvm

  • @NotSoZub2010
    @NotSoZub2010 Рік тому

    I am fast as fk boiis

  • @AljoBerg
    @AljoBerg Рік тому +2

    Yowtf

  • @NotSoZub2010
    @NotSoZub2010 Рік тому

    Igp, can i please get unbanned on your server? I had been banned a long time ago just because of joking.

  • @augustfeeling
    @augustfeeling Рік тому

    speed

  • @nasab8781
    @nasab8781 Рік тому +1

    👋👋❤❤

  • @Lofihofi00
    @Lofihofi00 Рік тому +1

    First comment. Likeeee

  • @SAVENGE_XT
    @SAVENGE_XT Рік тому +1

    firstt

  • @pranav5878
    @pranav5878 Рік тому

    goofy ah voice

  • @mychannel583
    @mychannel583 4 місяці тому

    how to fix
    error message
    ReferenceError: ReadableStream is not defined
    at Object. (/home/runner/bot/node_modules/undici/lib/web/fetch/response.js:530:3)
    at Module._compile (node:internal/modules/cjs/loader:1198:14)
    at Object.Module._extensions..js (node:internal/modules/cjs/loader:1252:10)
    at Module.load (node:internal/modules/cjs/loader:1076:32)
    at Function.Module._load (node:internal/modules/cjs/loader:911:12)
    at Module.require (node:internal/modules/cjs/loader:1100:19)
    at require (node:internal/modules/cjs/helpers:119:18)
    at Object. (/home/runner/bot/node_modules/undici/lib/web/fetch/index.js:11:5)
    at Module._compile (node:internal/modules/cjs/loader:1198:14)
    at Object.Module._extensions..js (node:internal/modules/cjs/loader:1252:10)
    my code
    const { REST, Routes } = require("discord.js")
    //info
    const botID = "1270926735382413343"
    const serverID = "1270933837068898305"
    const botToken = process.env.token
    const rest = new REST().setToken(botToken)
    const slashRegister = async () => {
    try {
    await rest.put(Routes.applicationGuildCommands(botID, serverID), {
    body: [
    {
    name: "ping",
    description: "Replies with pong!"
    }
    ]
    })
    } catch (error) {
    console.log(error)
    }
    }
    slashRegister();

  • @mohammedhamdan5926
    @mohammedhamdan5926 Рік тому

    z

  • @CaptainCatalyst719
    @CaptainCatalyst719 7 місяців тому

    I dont use these AI voices I don't trust them look up No Text to Speach and he will help you his a real person and isn't a AI voice that says get me to this like and I'll do a voice reveal

  • @kacpergamez
    @kacpergamez 7 місяців тому

    Can you explain how to fix this?
    ExpectedConstraintError > s.string.regex
    Invalid string format
    Expected: expected /^[\p{Ll}\p{Lm}\p{Lo}\p{N}\p{sc=Devanagari}\p{sc=Thai}_-]+$/u.test(expected) to be true
    Received:
    | 'ping'

  • @celxsth
    @celxsth Рік тому +1

    Yooo bro came back