This repository has been archived by the owner on Jun 18, 2022. It is now read-only.
generated from NamVr/DiscordBot-Template
-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
5181383
commit 918c29b
Showing
19 changed files
with
4,987 additions
and
332 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,114 +1,3 @@ | ||
<h1 align="center">Welcome to NamVr Discord Bot Template 👋</h1> | ||
<p> | ||
<img alt="Version" src="https://img.shields.io/badge/version-v3.0-blue.svg?cacheSeconds=2592000" /> | ||
<a href="https://github.com/NamVr/DiscordBot-Template#readme" target="_blank"> | ||
<img alt="Documentation" src="https://img.shields.io/badge/documentation-yes-brightgreen.svg" /> | ||
</a> | ||
<a href="https://github.com/NamVr/DiscordBot-Template/graphs/commit-activity" target="_blank"> | ||
<img alt="Maintenance" src="https://img.shields.io/badge/Maintained%3F-yes-green.svg" /> | ||
</a> | ||
<a href="https://twitter.com/namanvrati" target="_blank"> | ||
<img alt="Twitter: namanvrati" src="https://img.shields.io/twitter/follow/namanvrati.svg?style=social" /> | ||
</a> | ||
</p> | ||
|
||
> An **open source** `discord.js` bot template which is based on official [discord.js guide](https://discordjs.guide/) to get started on making your very personal discord bot! | ||
### 🏠 [Homepage](https://github.com/NamVr/DiscordBot-Template#readme) | ||
|
||
## Introduction | ||
|
||
`NamVr` Discord Bot Template is an open source discord.js based bot template to get started on a new bot project. It is classic javascript template, not requiring any external dependencies unlike other famous frameworks. (This is not a framework!) | ||
You can scale any kind of bot project using this template. (single server based or multiple server based) It all depends on your creativity! | ||
|
||
### Features: | ||
|
||
This template comes in with many in-built useful and flexible features, such as | ||
|
||
#### • **Dynamic Command Handler:** | ||
|
||
- My template comes in with a dynamic command handler! Using the command handler, you don't need to indulge in main bot files to create your very own command! | ||
- You can simply make command groups (categorized as folders) in the [commands](https://github.com/NamVr/DiscordBot-Template/tree/master/commands/) folder. | ||
- Your JavaScript commands goes inside respective category folders. A sample command is provided as [ping](https://github.com/NamVr/DiscordBot-Template/blob/master/commands/misc/ping.js) command. You can use the same skeleton for all commands you want! | ||
|
||
#### • **Dynamic Event Handler:** | ||
|
||
- All events goes inside the [events](https://github.com/NamVr/DiscordBot-Template/blob/master/events/) folder. You don't need to use `client.on()` in the main `bot.js` file to handle events. | ||
- Using simple skeleton code for events, you can make any amount of events in the events folder using the event handler. | ||
|
||
#### • **Dynamic Trigger Handler:** | ||
|
||
- Triggers occur when a specific "phrase" is said in a message content. For example, if you want your bot to react with :heart: when someone say `welcome` in their message, you can do that with this trigger handler! | ||
- Trigger Handler also has the same skeleton structure as of command handler. The trigger handler is associated with the [triggers](https://github.com/NamVr/DiscordBot-Template/tree/master/triggers/) folder. There are trigger categories, like [reactions](https://github.com/NamVr/DiscordBot-Template/tree/master/triggers/reactions) folder, in the trigger folder. | ||
- A sample trigger command is given in the [`hello.js`](https://github.com/NamVr/DiscordBot-Template/tree/master/triggers/reactions/hello.js) trigger file. | ||
|
||
#### • **[NEW] Dynamic Slash Command Handler:** | ||
|
||
- My template comes with a dynamic slash command handler with very easy to customize and make slash commands. | ||
- The commands, in the slashCommands folder, receive an [`CommandInteraction`](https://discord.js.org/#/docs/main/stable/class/CommandInteraction) object. You can see the [documentation of discord.js](https://discord.js.org/#/docs/main/stable/class/CommandInteraction) for all the properties and methods available. | ||
- **IMPORTANT:** In the template, we are sending the slash commands to discord to be registered only to 1 guild. That is because their are 2 types of slash commands, guild and global. Guild commands are restricted to 1 guild but whenever you update them, they take effect immediately, whereas global commands take upto 1 hour to take effect. So use guild commands in development and global commands for production. | ||
|
||
#### • **[NEW] Dynamic Buttons Interaction Handler:** | ||
|
||
- This template comes with a dynamic button interaction handler to receive and process button interactions. | ||
- Buttons can be classified in two category folders. | ||
|
||
#### • **[NEW] Dynamic Context Menu Handler:** | ||
|
||
- All new addition to discord API is context menus! You can right click a user or message -> Apps to find these options! | ||
- This template will register all your context menu options and dynamically interact with them! Worth a try. | ||
|
||
#### • **Highly Customizable:** | ||
|
||
Using the template is so easy and fun, you would know. As the template does not rely on any external dependencies and written in javascript, it is highly customizable to any extend. There's no end to your creativity! | ||
|
||
#### • **Open source and self-hosted:** | ||
|
||
> It's yours, you have full control. | ||
## Install | ||
|
||
```sh | ||
npm install | ||
``` | ||
|
||
## Run tests | ||
|
||
```sh | ||
npm run test | ||
``` | ||
|
||
## Support & Documentation | ||
|
||
I'm working to make it more professional and easy to use for everyone. There will be a documentation out very soon. | ||
|
||
## Authors | ||
|
||
👤 **Naman Vrati** | ||
|
||
- Website: https://namanvrati.cf/ | ||
- Twitter: [@namanvrati](https://twitter.com/namanvrati) | ||
- Github: [@NamVr](https://github.com/NamVr) | ||
- LinkedIn: [@namanvrati](https://linkedin.com/in/namanvrati) | ||
|
||
👤 **Krish Garg** | ||
|
||
- Website: https://krishgarg.ga/ | ||
- Twitter: [@KrishGa95586696](https://twitter.com/KrishGa95586696) | ||
- Github: [@KrishGarg](https://github.com/KrishGarg) | ||
|
||
## 🤝 Contributing | ||
|
||
Contributions, issues and feature requests are welcome!<br />Feel free to check [issues page](https://github.com/NamVr/DiscordBot-Template/issues). You can also take a look at the [contributing guide](https://github.com/NamVr/DiscordBot-Template/blob/master/CONTRIBUTING.md). | ||
|
||
## Show your support | ||
|
||
Give a ⭐️ if this project helped you! Star-ring the project gives me encouragement to continue it. | ||
You can also [sponsor](https://ko-fi.com/namanvrati) the project and get listed as a contributer! Thanks a lot. | ||
|
||
## 📝 License | ||
|
||
Copyright © 2021 [Naman Vrati](https://github.com/NamVr).<br /> | ||
This project is [ISC](https://github.com/NamVr/DiscordBot-Template/blob/master/LICENSE) licensed. | ||
|
||
--- | ||
<h1> IvyMusic </h1> | ||
<h2> The Project </h1> | ||
<p> I will do this later I promise </p> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
module.exports = { | ||
name: "autoplay", | ||
description: "Turn on/off Autoplay", | ||
usage: "autoplay", | ||
guildOnly: true, | ||
/** | ||
* @description Executes when the command is called by command handler. | ||
* @author Vachan MN | ||
* @param {Object} message The Message Object of the command. | ||
* @param {String[]} args The Message Content of the received message seperated by spaces (' ') in an array, this excludes prefix and command/alias itself. | ||
*/ | ||
|
||
execute(message, args) { | ||
const client = message.client; | ||
const queue = client.distube.getQueue(message) | ||
if (!queue) return message.channel.send(`There is nothing in the queue right now!`) | ||
try { | ||
const autoplay = queue.toggleAutoplay() | ||
message.channel.send(`AutoPlay: \`${autoplay ? "On" : "Off"}\``) | ||
} catch (e) { | ||
message.channel.send(`${e}`) | ||
} | ||
}, | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
module.exports = { | ||
name: "filters", | ||
description: "Add filters to the playing song", | ||
usage: "filters <filter>", | ||
guildOnly: true, | ||
/** | ||
* @description Executes when the command is called by command handler. | ||
* @author Vachan MN | ||
* @param {Object} message The Message Object of the command. | ||
* @param {String[]} args The Message Content of the received message seperated by spaces (' ') in an array, this excludes prefix and command/alias itself. | ||
*/ | ||
|
||
execute(message, args) { | ||
const queue = message.client.distube.getQueue(message) | ||
if (!queue) return message.channel.send(`There is nothing in the queue right now!`) | ||
if (args[0] === "off" && queue.filters?.length) queue.setFilter(false) | ||
else if (Object.keys(message.client.distube.filters).includes(args[0])) queue.setFilter(args[0]) | ||
else if (args[0]) return message.channel.send(`Not a valid filter`) | ||
message.channel.send(`Current Queue Filter: \`${queue.filters.join(", ") || "Off"}\``) | ||
}, | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
module.exports = { | ||
name: "pause", | ||
description: "pause the playing song", | ||
usage: "pause", | ||
guildOnly: true, | ||
/** | ||
* @description Executes when the command is called by command handler. | ||
* @author Vachan MN | ||
* @param {Object} message The Message Object of the command. | ||
* @param {String[]} args The Message Content of the received message seperated by spaces (' ') in an array, this excludes prefix and command/alias itself. | ||
*/ | ||
|
||
execute(message, args) { | ||
const client = message.client; | ||
const queue = client.distube.getQueue(message) | ||
if (!queue) return message.channel.send(`There is nothing in the queue right now!`) | ||
if (queue.pause) { | ||
queue.resume() | ||
return message.channel.send("Resumed the song for you :)") | ||
} | ||
queue.pause() | ||
message.channel.send("Paused the song for you :)") | ||
}, | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
const DisTube = require('distube') | ||
|
||
module.exports = { | ||
name: "play", | ||
description: "Play a song", | ||
usage: "play <song name>", | ||
guildOnly: true, | ||
|
||
/** | ||
* @description Executes when the command is called by command handler. | ||
* @author Vachan MN | ||
* @param {Object} message The Message Object of the command. | ||
* @param {String[]} args The Message Content of the received message seperated by spaces (' ') in an array, this excludes prefix and command/alias itself. | ||
*/ | ||
|
||
execute(message, args) { | ||
const distube = message.client.distube | ||
searchString = args.join(' '); | ||
if (!message.member.voice.channel) return message.reply('YOU ARENT IN A VC!') | ||
if (!searchString) return message.reply('Please enter the search string or url') | ||
try { | ||
distube.play(message, args.join(' ')) | ||
} catch (e) { | ||
return message.reply(e) | ||
} | ||
}, | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
module.exports = { | ||
name: "previous", | ||
description: "Plays the previous song", | ||
usage: "previous", | ||
guildOnly: true, | ||
/** | ||
* @description Executes when the command is called by command handler. | ||
* @author Vachan MN | ||
* @param {Object} message The Message Object of the command. | ||
* @param {String[]} args The Message Content of the received message seperated by spaces (' ') in an array, this excludes prefix and command/alias itself. | ||
*/ | ||
|
||
execute(message, args) { | ||
const client = message.client; | ||
const queue = client.distube.getQueue(message) | ||
if (!queue) return message.channel.send(`There is nothing in the queue right now!`) | ||
try { | ||
const song = queue.previous() | ||
message.channel.send(`Now playing:\n${song.name}`) | ||
} catch (e) { | ||
message.channel.send(`${e}`) | ||
} | ||
}, | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
module.exports = { | ||
name: "queue", | ||
description: "show the queue", | ||
usage: "queue", | ||
guildOnly: true, | ||
/** | ||
* @description Executes when the command is called by command handler. | ||
* @author Vachan MN | ||
* @param {Object} message The Message Object of the command. | ||
* @param {String[]} args The Message Content of the received message seperated by spaces (' ') in an array, this excludes prefix and command/alias itself. | ||
*/ | ||
|
||
execute(message, args) { | ||
const queue = message.client.distube.getQueue(message) | ||
if (!queue) return message.channel.send(`There is nothing playing!`) | ||
const q = queue.songs.map((song, i) => `${i === 0 ? "Playing:" : `${i}.`} ${song.name} - \`${song.formattedDuration}\``).join("\n") | ||
message.channel.send(`**Server Queue**\n${q}`) | ||
}, | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
module.exports = { | ||
name: "repeat", | ||
description: "Select the repeat pattern", | ||
usage: "repeat <off/song/queue>", | ||
guildOnly: true, | ||
aliases: ["loop"], | ||
/** | ||
* @description Executes when the command is called by command handler. | ||
* @author Vachan MN | ||
* @param {Object} message The Message Object of the command. | ||
* @param {String[]} args The Message Content of the received message seperated by spaces (' ') in an array, this excludes prefix and command/alias itself. | ||
*/ | ||
|
||
execute(message, args) { | ||
const client = message.client; | ||
const queue = client.distube.getQueue(message) | ||
if (!queue) return message.channel.send(`There is nothing playing!`) | ||
let mode = null | ||
switch (args[0]) { | ||
case "off": | ||
mode = 0 | ||
break | ||
case "song": | ||
mode = 1 | ||
break | ||
case "queue": | ||
mode = 2 | ||
break | ||
} | ||
mode = queue.setRepeatMode(mode) | ||
mode = mode ? mode === 2 ? "Repeat queue" : "Repeat song" : "Off" | ||
message.channel.send(`Set repeat mode to \`${mode}\``) | ||
}, | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
module.exports = { | ||
name: "resume", | ||
description: "Resume the paused song", | ||
usage: "resume", | ||
guildOnly: true, | ||
/** | ||
* @description Executes when the command is called by command handler. | ||
* @author Vachan MN | ||
* @param {Object} message The Message Object of the command. | ||
* @param {String[]} args The Message Content of the received message seperated by spaces (' ') in an array, this excludes prefix and command/alias itself. | ||
*/ | ||
|
||
execute(message, args) { | ||
const client = message.client; | ||
const queue = client.distube.getQueue(message) | ||
if (!queue) return message.channel.send(`There is nothing in the queue right now!`) | ||
queue.resume() | ||
message.channel.send("Resumed the song for you :)") | ||
}, | ||
}; |
Oops, something went wrong.