-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #53 from Sobhan-SRZA/v0.0.0
0.0.0
- Loading branch information
Showing
14 changed files
with
313 additions
and
162 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,95 @@ | ||
|
||
const | ||
{ | ||
ApplicationCommandType, | ||
PermissionFlagsBits, | ||
ApplicationCommandOptionType, | ||
PermissionsBitField | ||
} = require("discord.js"), | ||
radio = require("../../functions/player"), | ||
response = require("../../functions/response"), | ||
selectLanguage = require("../../functions/selectLanguage"), | ||
config = require("../../../config"), | ||
ephemeral = selectLanguage(config.source.default_language).replies.ephemeral, | ||
defaultLanguage = selectLanguage(config.source.default_language).commands.resume, | ||
database = require("../../functions/database"), | ||
checkPlayerPerms = require("../../functions/checkPlayerPerms"); | ||
|
||
module.exports = { | ||
data: { | ||
name: "resume", | ||
description: defaultLanguage.description, | ||
type: ApplicationCommandType.ChatInput, | ||
default_member_permissions: new PermissionsBitField([PermissionFlagsBits.SendMessages]), | ||
default_bot_permissions: new PermissionsBitField([ | ||
PermissionFlagsBits.SendMessages, | ||
PermissionFlagsBits.EmbedLinks, | ||
PermissionFlagsBits.Connect, | ||
PermissionFlagsBits.Speak | ||
]), | ||
dm_permission: false, | ||
nsfw: false, | ||
options: [ | ||
{ | ||
name: "ephemeral", | ||
description: ephemeral.description, | ||
type: ApplicationCommandOptionType.String, | ||
choices: [ | ||
{ | ||
name: ephemeral.choices.yes, | ||
value: "true" | ||
}, | ||
{ | ||
name: ephemeral.choices.no, | ||
value: "false" | ||
} | ||
], | ||
required: false | ||
} | ||
] | ||
}, | ||
category: "music", | ||
cooldown: 5, | ||
aliases: ["re"], | ||
only_owner: false, | ||
only_slash: true, | ||
only_message: true, | ||
|
||
/** | ||
* | ||
* @param {import("discord.js").Client} client | ||
* @param {import("discord.js").CommandInteraction} interaction | ||
* @param {Array<string>} args | ||
* @returns {void} | ||
*/ | ||
run: async (client, interaction, args) => { | ||
const | ||
db = new database(client.db), | ||
databaseNames = { | ||
language: `language.${interaction.guild.id}` | ||
}, | ||
lang = await db.has(databaseNames.language) ? await db.get(databaseNames.language) : config.source.default_language, | ||
language = selectLanguage(lang).commands.resume; | ||
|
||
// Check perms | ||
if (await checkPlayerPerms(interaction)) | ||
return; | ||
|
||
// resume Player | ||
const queue = new radio(interaction); | ||
queue.resume(); | ||
|
||
return await response(interaction, { | ||
content: language.replies.resumed | ||
}); | ||
}, | ||
}; | ||
/** | ||
* @copyright | ||
* Coded by Sobhan-SRZA (mr.sinre) | https://github.com/Sobhan-SRZA | ||
* @copyright | ||
* Work for Persian Caesar | https://dsc.gg/persian-caesar | ||
* @copyright | ||
* Please Mention Us "Persian Caesar", When Have Problem With Using This Code! | ||
* @copyright | ||
*/ |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
const | ||
{ | ||
ButtonBuilder, | ||
ActionRowBuilder | ||
} = require("discord.js"), | ||
error = require("./error"); | ||
|
||
/** | ||
* | ||
* @param {import("discord.js").ButtonInteraction} interaction | ||
* @param {string} id | ||
* @param {string} emote | ||
* @returns {Array<import("discord.js").ActionRow<import("discord.js").ButtonBuilder>>} | ||
*/ | ||
module.exports = async function (interaction, id, emote) { | ||
try { | ||
const components = interaction.message.components.map(oldActionRow => { | ||
const updatedActionRow = new ActionRowBuilder() | ||
.addComponents( | ||
oldActionRow.components.map(buttonComponent => { | ||
const newButton = ButtonBuilder.from(buttonComponent) | ||
if (interaction.component.customId == buttonComponent.customId) | ||
newButton.setCustomId(id).setEmoji(emote); | ||
|
||
return newButton; | ||
}) | ||
) | ||
return updatedActionRow; | ||
}); | ||
return components; | ||
} catch (e) { | ||
error(e); | ||
} | ||
} | ||
/** | ||
* @copyright | ||
* Coded by Sobhan-SRZA (mr.sinre) | https://github.com/Sobhan-SRZA | ||
* @copyright | ||
* Work for Persian Caesar | https://dsc.gg/persian-caesar | ||
* @copyright | ||
* Please Mention Us "Persian Caesar", When Have Problem With Using This Code! | ||
* @copyright | ||
*/ |
Oops, something went wrong.