Visual Studio Code Discord



  1. Search results for 'discord', Visual Studio Code on marketplace.visualstudio.com.
  2. Open up your preferred code editor (whether it be Visual Studio Code (opens new window), Atom (opens new window), Sublime Text (opens new window), or any other editor of your choice) and create a new file. If you're brand new and aren't sure what to use, go with Visual Studio Code.
  3. I am coding it using Visual Studio Code. I don't really understand what else to do. I've tried looking for help in YouTube, but every time I try it seems to not work anymore.

Discord Tools is a Visual Studio Code extension to code Discord bots more easily.

  • GITHUB :https://github.com/Darkempire78/Discord-Tools
  • DOWNLOAD :https://marketplace.visualstudio.com/items?itemName=Darkempire78.discord-tools

Supported Languages

  • [x] Javascript (Discord.js, Eris)
  • [x] Typescript (Harmony)
  • [x] Python (Discord.py)
  • [x] Java (JDA)
  • [ ] Soon..

Index

  • Javascript snippets
  • Typescript snippets
  • Python snippets
  • Java snippets

Features

Generate a template Discord bot :

  • Open the command palette (Ctrl+Shift+P) and choose : Generate a <language> template bot (Discord.<language>) (not available for JDA, Harmony and Eris)

Open the Discord bot Documentation with/without a research :

  • Open the command palette (Ctrl+Shift+P) and choose : Open the Discord bot Documention
  • Shortcut : Ctrl+Alt+D
  • Works with Discord.py, Discord.js and JDA (JDA, Harmony and Eris documentions do not allow to make a research)

Generate code easily :

Available Snippets

Javascript (Discord.js) :

  • djs.index : Create a basic Discord bot index.js file.
  • djs.cmd : Create a basic Discord command.
  • djs.cmd+ : Create a complex Discord command.
  • djs.embed : Create a basic Discord embed.
  • djs.embed+ : Create a complex Discord embed.
  • djs.message : Create a default Discord bot message event.
  • djs.guildmemberadd : Create a default Discord bot guildMemberAdd event.
  • djs.guildmemberremove : Create a default Discord bot guildMemberRemove event.
  • djs.guildcreate : Create a default Discord bot guildCreate event.
  • djs.guilddelete : Create a default Discord bot guildDelete event.
  • and 47 other events..

Javascript (Eris) :

  • eris.index : Create a basic Discord bot index.js file.
  • eris.cmd : Create a basic Discord command.
  • eris.cmd+ : Create a complex Discord command.
  • eris.embed : Create a basic Discord embed.
  • eris.embed+ : Create a complex Discord embed.
  • eris.message : Create a default Discord bot message event.

Javascript Preview :

Typescript (Harmony) :

  • hy.index : Create a basic Discord bot index.ts file.
  • hy.cmd : Create a basic Discord command.
  • hy.cmd+ : Create a complex Discord command.
  • hy.embed : Create a basic Discord embed.
  • hy.embed+ : Create a complex Discord embed.
  • hy.message : Create a default Discord bot message event.

Python (Discord.py) :

  • dpy.main : Create a basic Discord bot main.py file.
  • dpy.cog : Create a basic Discord cog.
  • dpy.cmd : Create a basic Discord command.
  • dpy.cmd+ : Create a complex Discord command.
  • dpy.embed : Create a basic Discord embed.
  • dpy.embed+ : Create a complex Discord embed.
  • dpy.onmessage : CCreate a default Discord bot on_message event.
  • dpy.onmemberjoin : Create a default Discord bot on_member_join event.
  • dpy.onmemberremove : Create a default Discord bot on_member_remove event.
  • dpy.onguildjoin : Create a default Discord bot on_guild_join event.
  • dpy.onguildremove : Create a default Discord bot on_guild_remove event.
  • and 59 other events..

Python Preview :

Java (JDA) :

  • jda.main : Create a basic Discord bot main function.
  • jda.cmd : Create a basic Discord command.
  • jda.embed : Create a basic Discord embed.
  • jda.embed+ : Create a complex Discord embed.
  • jda.onmessagereceived : Create a default Discord bot on.

Java Preview :

Functionality table

TemplateDocDoc searcherSnippets
Discord.js
Eris
Harmony
Discord.py
JDA

Contributing

Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.

Please make sure to update tests as appropriate.

Release Notes

1.3.1 (Latest update)

  • Update the Discord.js template
  • Update the Discord.py template

1.3.0

  • Add the Harmony support

1.2.2

  • Fix the python template

1.2.1

  • Fix workspace error
  • Small corrections

1.2.0

  • Add the Eris support
  • Add the definition of python parameters
  • Fix small python snippets

1.1.6

  • Several python snippet corrections
  • Correction of the python template

1.1.5

  • New snippet aliases
  • New snippet choices
  • Several corrections

1.1.4

  • New command : open the Discord bot Documentation with/without a research (works with Discord.py, Discord.js, JDA)

1.1.3

  • New Discord.js bot template
  • New bot template generator system
  • New auto package downloader
  • Few small updates

1.1.2

  • 48 new Discord.js events added
  • Addition of capital letters to Discord.py events
  • Few small updates

1.1.1

  • Change of snippet prefixes to dpy (Discord.py), djs (Discord.js) and jda (JDA)
  • 59 new Discord.py events added

1.1.0

  • New language supported : Java (JDA)

1.0.1

  • Several corrections

1.0.0

  • Initial release

License

This project is under GPLv3. Michael buble call me irresponsible full album.

Discord rich presence vs code

We're finally getting to the exciting parts! Since your bot is in your server now, the next step is to start coding and get it online!

Visual-studio-code discord discord.js. Improve this question. Follow edited Apr 30 '20 at 16:48. Asked Apr 30 '20 at 16:08. 1 2 2 bronze badges. You just leaked your bot token, I suggest you reset it quickly – Syntle Apr 30 '20 at 16:11.

# Creating the bot file

Open up your preferred code editor (whether it be Visual Studio Code(opens new window), Atom(opens new window), Sublime Text(opens new window), or any other editor of your choice) and create a new file. If you're brand new and aren't sure what to use, go with Visual Studio Code.

We suggest that you save the file as index.js, but you may name it whatever you wish, as long as it ends with .js.

TIP

You can quickly create a new file using the Ctrl + N shortcut on your keyboard and then using Ctrl + S to save the file.

# Logging in to Discord

Once you've created a new file, do a quick check to see if you have everything setup correctly. Copy & paste the following code into your file and save it. Don't worry if you don't understand it right away—we explain more in-depth after this.

Visual Studio Code Discord

Head back to your console window, type in node your-file-name.js, and press enter. If you see the Ready! message after a few seconds, you're good to go! If not, try going back a few steps and make sure you followed everything correctly.

1984 malayalam calendar with stars. TIP

Visual

Don't feel like typing the file name each time? Open up your package.json file, look for something like 'main': 'index.js', and change 'index.js' to whatever your file name is. After saving, you can run the node . shortcut in your console to start the process!

# Start-up code explained

Here's the same code with comments, so it's easier to understand what's going on.

Visual Studio Code Discord

Although it's not a lot, it's good to know what each bit of your code does. But, as it currently is, this won't do anything. You probably want to add some commands that run whenever someone sends a specific message, right? Let's get started on that, then!

# Listening for messages

First, make sure to close the process in your console. You can do so by pressing Ctrl + C inside the console. Go back to your code editor and add the following piece of code above the client.login() line.

Notice how the code uses .on rather than .once like in the ready event. This means that it can trigger multiple times. Save the file, go back to your console, and start the process up again. Whenever a message is sent inside a channel your bot can access, the console will log the message's content. Go ahead and test it out!

TIP

Inside your console, you can press the up arrow on your keyboard to bring up the latest commands you've run. Pressing Up and then Enter after closing the process is a convenient, quick way to start it up again (instead of typing out the name each time).

# Replying to messages

Logging to the console is great and all, but it doesn't provide any feedback for the end-user. Let's create a basic ping/pong command before you move on to making real commands. Remove the console.log(message.content) line from your code and replace it with the following:

Restart your bot and then send !ping to a channel your bot has access to. If all goes well, you should see something like this:

!ping
Pong.

You've successfully created your first Discord bot command! Exciting stuff, isn't it? This is only the beginning, so let's move on to making some more commands.

# Resulting code

Visual Studio Code Discord Integration

If you want to compare your code to the code we've constructed so far, you can review it over on the GitHub repository here (opens new window).