-
-
Notifications
You must be signed in to change notification settings - Fork 101
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
Showing
7 changed files
with
72 additions
and
21 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
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,52 @@ | ||
const { PermissionsBitField, ApplicationCommandOptionType } = require("discord.js"); | ||
const { Database } = require("st.db"); | ||
|
||
const GSetup = new Database("./settings/models/setup.json", { databaseInObject: true }); | ||
|
||
module.exports = { | ||
name: ["playfile"], | ||
description: "Play file with mp3/wav/ogg", | ||
category: "Music", | ||
options: [ | ||
{ | ||
name: "file", | ||
type: ApplicationCommandOptionType.Attachment, | ||
description: "file with mp3/wav/ogg.", | ||
required: true, | ||
} | ||
], | ||
run: async (client, interaction) => { | ||
try { | ||
if (interaction.options.getAttachment("file")) { | ||
const db = await GSetup.get(interaction.guild.id); | ||
if (db.setup_enable === true) return interaction.reply("Command is disable already have song request channel!"); | ||
|
||
await interaction.reply(`🔍 **Loading...** \`${interaction.options.getAttachment("file").name}\``); | ||
|
||
const message = await interaction.fetchReply(); | ||
await client.createPlay(interaction, message.id); | ||
|
||
const { channel } = interaction.member.voice; | ||
if (!channel) return interaction.editReply("You need to be in voice channel.") | ||
if (!channel.permissionsFor(interaction.guild.members.me).has(PermissionsBitField.Flags.Connect)) return interaction.editReply(`I don't have perm \`CONNECT\` in ${channel.name} to join voice!`); | ||
if (!channel.permissionsFor(interaction.guild.members.me).has(PermissionsBitField.Flags.Speak)) return interaction.editReply(`I don't have perm \`SPEAK\` in ${channel.name} to join voice!`); | ||
|
||
try { | ||
const string = interaction.options.getAttachment("file").url; | ||
|
||
const options = { | ||
member: interaction.member, | ||
textChannel: interaction.channel, | ||
interaction, | ||
} | ||
|
||
await client.distube.play(interaction.member.voice.channel, string, options); | ||
} catch (e) { | ||
// | ||
} | ||
} | ||
} catch (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
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
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