aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--.gitignore1
-rw-r--r--AudioBackend.js3
-rw-r--r--README.md9
-rw-r--r--commands/join.js7
-rw-r--r--commands/leave.js6
-rw-r--r--commands/pause.js7
-rw-r--r--commands/play.js7
-rw-r--r--commands/skip.js6
-rw-r--r--commands/status.js4
-rw-r--r--commands/stop.js7
10 files changed, 31 insertions, 26 deletions
diff --git a/.gitignore b/.gitignore
index 1015bf3..3b49509 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,5 +1,4 @@
config.json
-config.json.bday
node_modules
yarn.lock
music
diff --git a/AudioBackend.js b/AudioBackend.js
index 15fa45e..9873d9a 100644
--- a/AudioBackend.js
+++ b/AudioBackend.js
@@ -26,7 +26,7 @@ import {
joinVoiceChannel,
VoiceConnectionStatus
} from '@discordjs/voice'
-import { MessageActionRow, MessageButton, MessageEmbed } from 'discord.js'
+import { MessageEmbed } from 'discord.js'
import config from './config.json' assert {type: 'json'}
import { readdirSync, writeFile } from 'node:fs'
@@ -35,7 +35,6 @@ export let audio;
export let files = readdirSync('music');
let fileData;
-let runOnce = false
export let playerState;
export let isAudioStatePaused;
diff --git a/README.md b/README.md
index fa06e9d..3078d46 100644
--- a/README.md
+++ b/README.md
@@ -11,7 +11,6 @@ Make a new file called `config.json`.
```
{
"token": "token_here",
- "botOwner": "your_user_id_here",
"txtFile": true/false
"statusChannel": "channel_id",
"voiceChannel": "voice_channel_id"
@@ -32,19 +31,19 @@ Launch the bot using `node bot.js` in terminal.
```
Public Only
-----------
-help - Displays commands.
ping - Pong!
-git - Links to the source repo.
+status - Checks what audio file is playing currently.
about - Information about the bot.
Bot Owner Only
--------------
join - Joins voice chat.
-resume - Resumes music.
+play - Resumes music.
+play (int) - Input a number for the selection for the audio file.
pause - Pauses music.
skip - Skips the audio track.
leave - Leaves voice chat.
-stop - Stops bot.
+stop - Powers off the bot.
```
# Forking
diff --git a/commands/join.js b/commands/join.js
index 8ede21a..42f3e1c 100644
--- a/commands/join.js
+++ b/commands/join.js
@@ -20,13 +20,14 @@
***************************************************************************/
import { SlashCommandBuilder } from '@discordjs/builders'
-import { voiceInit } from '../AudioBackend.js';
-import config from '../config.json' assert {type: 'json'}
+import { voiceInit } from '../AudioBackend.js'
+import { PermissionFlagsBits } from 'discord-api-types/v10'
export default {
data: new SlashCommandBuilder()
.setName('join')
- .setDescription('Joins voice chat.'),
+ .setDescription('Joins voice chat')
+ .setDefaultMemberPermissions(PermissionFlagsBits.Administrator),
async execute(interaction, bot) {
await interaction.reply({ content: 'Joining voice channel', ephemeral: true })
return await voiceInit(bot);
diff --git a/commands/leave.js b/commands/leave.js
index 5024488..63b4245 100644
--- a/commands/leave.js
+++ b/commands/leave.js
@@ -20,12 +20,14 @@
***************************************************************************/
import { SlashCommandBuilder } from '@discordjs/builders'
-import { destroyAudio } from "../AudioBackend.js";
+import { destroyAudio } from "../AudioBackend.js"
+import { PermissionFlagsBits } from "discord-api-types/v10"
export default {
data: new SlashCommandBuilder()
.setName('leave')
- .setDescription('Leaves the voice chat'),
+ .setDescription('Leaves the voice chat')
+ .setDefaultMemberPermissions(PermissionFlagsBits.Administrator),
async execute(interaction) {
console.log('Leaving voice channel...');
await destroyAudio(interaction);
diff --git a/commands/pause.js b/commands/pause.js
index 7615573..5306f63 100644
--- a/commands/pause.js
+++ b/commands/pause.js
@@ -20,13 +20,14 @@
***************************************************************************/
import { SlashCommandBuilder } from '@discordjs/builders'
-import config from '../config.json' assert {type: 'json'}
-import {audioState, isAudioStatePaused, player} from "../AudioBackend.js";
+import { audioState, isAudioStatePaused, player } from "../AudioBackend.js"
+import { PermissionFlagsBits } from "discord-api-types/v10"
export default {
data: new SlashCommandBuilder()
.setName('pause')
- .setDescription('Pauses the player'),
+ .setDescription('Pauses music')
+ .setDefaultMemberPermissions(PermissionFlagsBits.Administrator),
async execute(interaction) {
if (isAudioStatePaused === false) {
audioState();
diff --git a/commands/play.js b/commands/play.js
index 2a5a385..2785288 100644
--- a/commands/play.js
+++ b/commands/play.js
@@ -21,18 +21,19 @@
import { SlashCommandBuilder } from '@discordjs/builders'
import { isAudioStatePaused, inputAudio, audio, audioState, player } from '../AudioBackend.js'
-import config from '../config.json' assert {type: 'json'}
+import { PermissionFlagsBits } from "discord-api-types/v10"
export let integer;
export default {
data: new SlashCommandBuilder()
.setName('play')
- .setDescription('Plays the player')
+ .setDescription('Resumes music')
.addIntegerOption(option =>
option.setName('int')
.setDescription('Input a number for the selection for the audio file.'),
- ),
+ )
+ .setDefaultMemberPermissions(PermissionFlagsBits.Administrator),
async execute(interaction, bot) {
integer = interaction.options.getInteger('int');
diff --git a/commands/skip.js b/commands/skip.js
index a49b904..3e1a836 100644
--- a/commands/skip.js
+++ b/commands/skip.js
@@ -20,12 +20,14 @@
***************************************************************************/
import { SlashCommandBuilder } from '@discordjs/builders'
-import { audio, player, searchAudio } from "../AudioBackend.js";
+import { audio, player, searchAudio } from "../AudioBackend.js"
+import { PermissionFlagsBits } from "discord-api-types/v10"
export default {
data: new SlashCommandBuilder()
.setName('skip')
- .setDescription('Skips the track'),
+ .setDescription('Skips the audio track')
+ .setDefaultMemberPermissions(PermissionFlagsBits.Administrator),
async execute(interaction, bot) {
await interaction.reply({content:`Skipping ${audio}`, ephemeral:true});
player.stop();
diff --git a/commands/status.js b/commands/status.js
index 804b046..d7012ce 100644
--- a/commands/status.js
+++ b/commands/status.js
@@ -20,8 +20,8 @@
***************************************************************************/
import { SlashCommandBuilder } from '@discordjs/builders'
-import { MessageEmbed } from "discord.js";
-import { audio, playerState } from "../AudioBackend.js";
+import { MessageEmbed } from "discord.js"
+import { audio, playerState } from "../AudioBackend.js"
export default {
data: new SlashCommandBuilder()
diff --git a/commands/stop.js b/commands/stop.js
index b3997e2..c57301e 100644
--- a/commands/stop.js
+++ b/commands/stop.js
@@ -20,13 +20,14 @@
***************************************************************************/
import { SlashCommandBuilder } from '@discordjs/builders'
-import config from '../config.json' assert {type: 'json'}
-import { stopBot } from "../AudioBackend.js";
+import { stopBot } from "../AudioBackend.js"
+import { PermissionFlagsBits } from "discord-api-types/v10"
export default {
data: new SlashCommandBuilder()
.setName('stop')
- .setDescription('Powers off the bot'),
+ .setDescription('Powers off the bot')
+ .setDefaultMemberPermissions(PermissionFlagsBits.Administrator),
async execute(interaction, bot) {
await interaction.reply({ content: 'Powering off...', ephemeral: true})
return await stopBot(bot, interaction);