Updated command files
This commit is contained in:
parent
6752829876
commit
bc818511d5
10 changed files with 411 additions and 570 deletions
120
commands/drop.js
120
commands/drop.js
|
@ -1,68 +1,66 @@
|
|||
const Discord = require("discord.js");
|
||||
const messages = require("../utils/messages");
|
||||
|
||||
module.exports = {
|
||||
description: "Create a drop giveaway",
|
||||
|
||||
options: [
|
||||
{
|
||||
name: "winners",
|
||||
description: "How many winners the giveaway should have",
|
||||
type: Discord.ApplicationCommandOptionType.Integer,
|
||||
required: true,
|
||||
},
|
||||
{
|
||||
name: "prize",
|
||||
description: "What the prize of the giveaway should be",
|
||||
type: Discord.ApplicationCommandOptionType.String,
|
||||
required: true,
|
||||
},
|
||||
{
|
||||
name: "channel",
|
||||
description: "The channel to start the giveaway in",
|
||||
type: Discord.ApplicationCommandOptionType.Channel,
|
||||
required: true,
|
||||
},
|
||||
],
|
||||
description: 'Create a drop giveaway',
|
||||
|
||||
options: [
|
||||
{
|
||||
name: 'winners',
|
||||
description: 'How many winners the giveaway should have',
|
||||
type: 'INTEGER',
|
||||
required: true
|
||||
},
|
||||
{
|
||||
name: 'prize',
|
||||
description: 'What the prize of the giveaway should be',
|
||||
type: 'STRING',
|
||||
required: true
|
||||
},
|
||||
{
|
||||
name: 'channel',
|
||||
description: 'The channel to start the giveaway in',
|
||||
type: 'CHANNEL',
|
||||
required: true
|
||||
}
|
||||
],
|
||||
|
||||
run: async (client, interaction) => {
|
||||
|
||||
// If the member doesn't have enough permissions
|
||||
if(!interaction.member.permissions.has('MANAGE_MESSAGES') && !interaction.member.roles.cache.some((r) => r.name === "Giveaways")){
|
||||
return interaction.reply({
|
||||
content: ':x: You need to have the manage messages permissions to start giveaways.',
|
||||
ephemeral: true
|
||||
});
|
||||
}
|
||||
|
||||
const giveawayChannel = interaction.options.getChannel('channel');
|
||||
const giveawayWinnerCount = interaction.options.getInteger('winners');
|
||||
const giveawayPrize = interaction.options.getString('prize');
|
||||
|
||||
if(!giveawayChannel.isText()) {
|
||||
return interaction.reply({
|
||||
content: ':x: Selected channel is not text-based.',
|
||||
ephemeral: true
|
||||
});
|
||||
}
|
||||
|
||||
// Start the giveaway
|
||||
client.giveawaysManager.start(giveawayChannel, {
|
||||
// The number of winners for this drop
|
||||
winnerCount: giveawayWinnerCount,
|
||||
// The prize of the giveaway
|
||||
prize: giveawayPrize,
|
||||
// Who hosts this giveaway
|
||||
hostedBy: client.config.hostedBy ? interaction.user : null,
|
||||
// specify drop
|
||||
isDrop: true,
|
||||
// Messages
|
||||
messages
|
||||
});
|
||||
|
||||
interaction.reply(`Giveaway started in ${giveawayChannel}!`);
|
||||
|
||||
run: async (client, interaction) => {
|
||||
// If the member doesn't have enough permissions
|
||||
if (
|
||||
!interaction.member.permissions.has("MANAGE_MESSAGES") &&
|
||||
!interaction.member.roles.cache.some((r) => r.name === "Giveaways")
|
||||
) {
|
||||
return interaction.reply({
|
||||
content:
|
||||
":x: You need to have the manage messages permissions to start giveaways.",
|
||||
ephemeral: true,
|
||||
});
|
||||
}
|
||||
|
||||
const giveawayChannel = interaction.options.getChannel("channel");
|
||||
const giveawayWinnerCount = interaction.options.getInteger("winners");
|
||||
const giveawayPrize = interaction.options.getString("prize");
|
||||
|
||||
if (!giveawayChannel.isTextBased()) {
|
||||
return interaction.reply({
|
||||
content: ":x: Selected channel is not text-based.",
|
||||
ephemeral: true,
|
||||
});
|
||||
}
|
||||
|
||||
// Start the giveaway
|
||||
client.giveawaysManager.start(giveawayChannel, {
|
||||
// The number of winners for this drop
|
||||
winnerCount: giveawayWinnerCount,
|
||||
// The prize of the giveaway
|
||||
prize: giveawayPrize,
|
||||
// Who hosts this giveaway
|
||||
hostedBy: client.config.hostedBy ? interaction.user : null,
|
||||
// specify drop
|
||||
isDrop: true,
|
||||
// Messages
|
||||
messages,
|
||||
});
|
||||
|
||||
interaction.reply(`Giveaway started in ${giveawayChannel}!`);
|
||||
},
|
||||
};
|
112
commands/end.js
112
commands/end.js
|
@ -1,71 +1,65 @@
|
|||
const Discord = require("discord.js");
|
||||
const ms = require('ms');
|
||||
|
||||
module.exports = {
|
||||
description: "End a giveaway",
|
||||
|
||||
options: [
|
||||
{
|
||||
name: "giveaway",
|
||||
description: "The giveaway to end (message ID or giveaway prize)",
|
||||
type: Discord.ApplicationCommandOptionType.String,
|
||||
required: true,
|
||||
},
|
||||
],
|
||||
description: 'End a giveaway',
|
||||
|
||||
run: async (client, interaction) => {
|
||||
// If the member doesn't have enough permissions
|
||||
if (
|
||||
!interaction.member.permissions.has("MANAGE_MESSAGES") &&
|
||||
!interaction.member.roles.cache.some((r) => r.name === "Giveaways")
|
||||
) {
|
||||
return interaction.reply({
|
||||
content:
|
||||
":x: You need to have the manage messages permissions to end giveaways.",
|
||||
ephemeral: true,
|
||||
});
|
||||
}
|
||||
options: [
|
||||
{
|
||||
name: 'giveaway',
|
||||
description: 'The giveaway to end (message ID or giveaway prize)',
|
||||
type: 'STRING',
|
||||
required: true
|
||||
}
|
||||
],
|
||||
|
||||
const query = interaction.options.getString("giveaway");
|
||||
run: async (client, interaction) => {
|
||||
|
||||
// try to found the giveaway with prize then with ID
|
||||
const giveaway =
|
||||
// Search with giveaway prize
|
||||
client.giveawaysManager.giveaways.find(
|
||||
(g) => g.prize === query && g.guildId === interaction.guild.id
|
||||
) ||
|
||||
// Search with giveaway ID
|
||||
client.giveawaysManager.giveaways.find(
|
||||
(g) => g.messageId === query && g.guildId === interaction.guild.id
|
||||
);
|
||||
// If the member doesn't have enough permissions
|
||||
if(!interaction.member.permissions.has('MANAGE_MESSAGES') && !interaction.member.roles.cache.some((r) => r.name === "Giveaways")){
|
||||
return interaction.reply({
|
||||
content: ':x: You need to have the manage messages permissions to end giveaways.',
|
||||
ephemeral: true
|
||||
});
|
||||
}
|
||||
|
||||
// If no giveaway was found
|
||||
if (!giveaway) {
|
||||
return interaction.reply({
|
||||
content: "Unable to find a giveaway for `" + query + "`.",
|
||||
ephemeral: true,
|
||||
});
|
||||
}
|
||||
const query = interaction.options.getString('giveaway');
|
||||
|
||||
if (giveaway.ended) {
|
||||
return interaction.reply({
|
||||
content: "This giveaway is already ended.",
|
||||
ephemeral: true,
|
||||
});
|
||||
}
|
||||
// try to found the giveaway with prize then with ID
|
||||
const giveaway =
|
||||
// Search with giveaway prize
|
||||
client.giveawaysManager.giveaways.find((g) => g.prize === query && g.guildId === interaction.guild.id) ||
|
||||
// Search with giveaway ID
|
||||
client.giveawaysManager.giveaways.find((g) => g.messageId === query && g.guildId === interaction.guild.id);
|
||||
|
||||
// Edit the giveaway
|
||||
client.giveawaysManager
|
||||
.end(giveaway.messageId)
|
||||
// Success message
|
||||
.then(() => {
|
||||
// If no giveaway was found
|
||||
if (!giveaway) {
|
||||
return interaction.reply({
|
||||
content: 'Unable to find a giveaway for `'+ query + '`.',
|
||||
ephemeral: true
|
||||
});
|
||||
}
|
||||
|
||||
if (giveaway.ended) {
|
||||
return interaction.reply({
|
||||
content: 'This giveaway is already ended.',
|
||||
ephemeral: true
|
||||
});
|
||||
}
|
||||
|
||||
// Edit the giveaway
|
||||
client.giveawaysManager.end(giveaway.messageId)
|
||||
// Success message
|
||||
interaction.reply("Giveaway ended!");
|
||||
})
|
||||
.catch((e) => {
|
||||
interaction.reply({
|
||||
content: e,
|
||||
ephemeral: true,
|
||||
.then(() => {
|
||||
// Success message
|
||||
interaction.reply('Giveaway ended!');
|
||||
})
|
||||
.catch((e) => {
|
||||
interaction.reply({
|
||||
content: e,
|
||||
ephemeral: true
|
||||
});
|
||||
});
|
||||
});
|
||||
},
|
||||
|
||||
}
|
||||
};
|
|
@ -1,37 +1,41 @@
|
|||
const messages = require("../utils/messages");
|
||||
const { EmbedBuilder, MessageActionRow, MessageButton } = require("discord.js");
|
||||
const message = require('../utils/messages');
|
||||
const {
|
||||
MessageEmbed,
|
||||
MessageActionRow,
|
||||
MessageButton
|
||||
} = require('discord.js');
|
||||
|
||||
module.exports = {
|
||||
name: "help",
|
||||
description: "Get all Bot Commands",
|
||||
run: async (client, interaction) => {
|
||||
let helpembed = new EmbedBuilder();
|
||||
helpembed.setColor("RANDOM");
|
||||
helpembed.setAuthor({ name: `Commands of ${client.user.username}` });
|
||||
helpembed.setColor("#2f3136");
|
||||
helpembed.setThumbnail(
|
||||
"https://cdn.discordapp.com/avatars/608119997713350679/d71c7cbb2ba132867367ed47261aea6d.png"
|
||||
);
|
||||
client.commands.map((cmd) => {
|
||||
helpembed.addField(`\`${cmd.name}\``, `${cmd.description}`, true);
|
||||
});
|
||||
helpembed.setTimestamp();
|
||||
helpembed.setFooter({ text: `© EmotionChild | Have a nice day!` });
|
||||
|
||||
const row = new MessageActionRow().addComponents(
|
||||
new MessageButton()
|
||||
.setEmoji("865572290065072128")
|
||||
.setLabel(`Invite ${client.user.username}`)
|
||||
.setURL(
|
||||
`https://discord.com/api/oauth2/authorize?client_id=726333575091454002&permissions=8&scope=bot%20applications.commands`
|
||||
)
|
||||
.setStyle("LINK")
|
||||
);
|
||||
|
||||
await interaction.reply({
|
||||
embeds: [helpembed],
|
||||
components: [row],
|
||||
ephemeral: true,
|
||||
});
|
||||
},
|
||||
name: "help",
|
||||
description: "Get all Bot Commands",
|
||||
run: async (client, interaction) => {
|
||||
|
||||
let helpembed = new MessageEmbed()
|
||||
helpembed.setColor("RANDOM")
|
||||
helpembed.setAuthor(
|
||||
`Commands of ${client.user.username}`
|
||||
)
|
||||
helpembed.setColor("#2f3136")
|
||||
helpembed.setThumbnail("https://cdn.discordapp.com/avatars/608119997713350679/d71c7cbb2ba132867367ed47261aea6d.png")
|
||||
client.commands.map((cmd) => {
|
||||
helpembed.addField(
|
||||
`\`${cmd.name}\``,
|
||||
`${cmd.description}`,
|
||||
true
|
||||
);
|
||||
})
|
||||
helpembed.setTimestamp()
|
||||
helpembed.setFooter(`© EmotionChild | Have a nice day!`);
|
||||
|
||||
const row = new MessageActionRow()
|
||||
.addComponents(
|
||||
new MessageButton()
|
||||
.setEmoji('865572290065072128')
|
||||
.setLabel(`Invite ${client.user.username}`)
|
||||
.setURL(`https://discord.com/api/oauth2/authorize?client_id=726333575091454002&permissions=8&scope=bot%20applications.commands`)
|
||||
.setStyle('LINK'),
|
||||
);
|
||||
|
||||
await interaction.reply({ embeds: [helpembed],components: [row], ephemeral: true });
|
||||
},
|
||||
};
|
|
@ -1,30 +1,29 @@
|
|||
const messages = require("../utils/messages");
|
||||
const { EmbedBuilder, MessageActionRow, MessageButton } = require("discord.js");
|
||||
const messages = require('../utils/messages');
|
||||
const {
|
||||
MessageEmbed,
|
||||
MessageActionRow,
|
||||
MessageButton
|
||||
} = require('discord.js');
|
||||
|
||||
module.exports = {
|
||||
name: "invite",
|
||||
description: "Get Invite Link for Giveaway Child",
|
||||
run: async (client, interaction) => {
|
||||
let invite = new EmbedBuilder()
|
||||
.setTitle(`${interaction.user.tag}`)
|
||||
.setDescription("You can invite the bot by clicking on the below button.")
|
||||
.setColor("#2f3136")
|
||||
.setFooter({ text: `© EmotionChild | Have a nice day!` });
|
||||
|
||||
const row = new MessageActionRow().addComponents(
|
||||
new MessageButton()
|
||||
.setEmoji("865572290065072128")
|
||||
.setLabel(`Invite ${client.user.username}`)
|
||||
.setURL(
|
||||
`https://discord.com/api/oauth2/authorize?client_id=910559370843131944&permissions=8&scope=bot%20applications.commands`
|
||||
)
|
||||
.setStyle("LINK")
|
||||
);
|
||||
|
||||
await interaction.reply({
|
||||
embeds: [invite],
|
||||
components: [row],
|
||||
ephemeral: true,
|
||||
});
|
||||
},
|
||||
name: "invite",
|
||||
description: "Get Invite Link for Holana",
|
||||
run: async (client, interaction) => {
|
||||
|
||||
let invite = new MessageEmbed()
|
||||
.setAuthor(`Invite of ${client.user.username}`, `${client.user.displayAvatarURL({ format: 'png' })}`)
|
||||
.setColor("#2f3136")
|
||||
.setFooter(`© EmotionChild | Have a nice day!`);
|
||||
|
||||
const row = new MessageActionRow()
|
||||
.addComponents(
|
||||
new MessageButton()
|
||||
.setEmoji('865572290065072128')
|
||||
.setLabel(`Invite ${client.user.username}`)
|
||||
.setURL(`https://discord.com/api/oauth2/authorize?client_id=726333575091454002&permissions=8&scope=bot%20applications.commands`)
|
||||
.setStyle('LINK'),
|
||||
);
|
||||
|
||||
await interaction.reply({ embeds: [invite],components: [row], ephemeral: true });
|
||||
},
|
||||
};
|
|
@ -1,71 +0,0 @@
|
|||
const Discord = require("discord.js");
|
||||
|
||||
module.exports = {
|
||||
description: "Pause a giveaway",
|
||||
|
||||
options: [
|
||||
{
|
||||
name: "giveaway",
|
||||
description: "The giveaway to pause (message ID or giveaway prize)",
|
||||
type: Discord.ApplicationCommandOptionType.String,
|
||||
required: true,
|
||||
},
|
||||
],
|
||||
|
||||
run: async (client, interaction) => {
|
||||
// If the member doesn't have enough permissions
|
||||
if (
|
||||
!interaction.member.permissions.has("MANAGE_MESSAGES") &&
|
||||
!interaction.member.roles.cache.some((r) => r.name === "Giveaways")
|
||||
) {
|
||||
return interaction.reply({
|
||||
content:
|
||||
":x: You need to have the manage messages permissions to pause giveaways.",
|
||||
ephemeral: true,
|
||||
});
|
||||
}
|
||||
|
||||
const query = interaction.options.getString("giveaway");
|
||||
|
||||
// try to found the giveaway with prize then with ID
|
||||
const giveaway =
|
||||
// Search with giveaway prize
|
||||
client.giveawaysManager.giveaways.find(
|
||||
(g) => g.prize === query && g.guildId === interaction.guild.id
|
||||
) ||
|
||||
// Search with giveaway ID
|
||||
client.giveawaysManager.giveaways.find(
|
||||
(g) => g.messageId === query && g.guildId === interaction.guild.id
|
||||
);
|
||||
|
||||
// If no giveaway was found
|
||||
if (!giveaway) {
|
||||
return interaction.reply({
|
||||
content: "Unable to find a giveaway for `" + query + "`.",
|
||||
ephemeral: true,
|
||||
});
|
||||
}
|
||||
|
||||
if (giveaway.pauseOptions.isPaused) {
|
||||
return interaction.reply({
|
||||
content: "This giveaway is already paused.",
|
||||
ephemeral: true,
|
||||
});
|
||||
}
|
||||
|
||||
// Edit the giveaway
|
||||
client.giveawaysManager
|
||||
.pause(giveaway.messageId)
|
||||
// Success message
|
||||
.then(() => {
|
||||
// Success message
|
||||
interaction.reply("Giveaway paused!");
|
||||
})
|
||||
.catch((e) => {
|
||||
interaction.reply({
|
||||
content: e,
|
||||
ephemeral: true,
|
||||
});
|
||||
});
|
||||
},
|
||||
};
|
|
@ -1,39 +1,39 @@
|
|||
const messages = require("../utils/messages");
|
||||
const { EmbedBuilder } = require("discord.js");
|
||||
const messages = require('../utils/messages');
|
||||
const { MessageEmbed } = require("discord.js");
|
||||
|
||||
module.exports = {
|
||||
name: "ping",
|
||||
description: "Tells a bot latency,",
|
||||
run: async (client, interaction) => {
|
||||
// If the member doesn't have enough permissions
|
||||
if (!interaction.member.permissions.has("SEND_MESSAGES")) {
|
||||
return interaction.reply({
|
||||
content:
|
||||
":x: You need to have the right permissions to use this command.",
|
||||
ephemeral: true,
|
||||
});
|
||||
}
|
||||
name: "ping",
|
||||
description: "Tells the bot's latency,",
|
||||
run: async (client, interaction) => {
|
||||
// If the member doesn't have enough permissions
|
||||
if (!interaction.member.permissions.has("SEND_MESSAGES")) {
|
||||
return interaction.reply({
|
||||
content:
|
||||
":x: You need to have the manage messages permissions to start giveaways.",
|
||||
ephemeral: true,
|
||||
});
|
||||
}
|
||||
|
||||
let circles = {
|
||||
green: "<:online:903711513183940669>",
|
||||
yellow: "<:idle:903711513490112512> ",
|
||||
red: "<:dnd:903711513066487851>",
|
||||
};
|
||||
let circles = {
|
||||
green: "<:online:885049752297824276>",
|
||||
yellow: "<:idle:885049726460899339>",
|
||||
red: "<:offline:885049312877346817>",
|
||||
};
|
||||
|
||||
let botping = new EmbedBuilder()
|
||||
.setTitle(`${client.user.username} Ping`)
|
||||
.setColor("2f3136")
|
||||
.addFields({
|
||||
name: "<:connection2:896715171454677013> Bot Ping:",
|
||||
value: `${
|
||||
client.ws?.ping <= 200
|
||||
? circles.green
|
||||
: client.ws?.ping <= 400
|
||||
? circles.yellow
|
||||
: circles.red
|
||||
} ${client.ws?.ping}ms`,
|
||||
})
|
||||
.setTimestamp();
|
||||
await interaction.reply({ embeds: [botping] });
|
||||
},
|
||||
let botping = new MessageEmbed()
|
||||
.setTitle(`${client.user.name} Ping`)
|
||||
.setColor("2f3136")
|
||||
.addFields({
|
||||
name: "<:link:911514727375577088> Bot Ping:",
|
||||
value: `${
|
||||
client.ws?.ping <= 200
|
||||
? circles.green
|
||||
: client.ws?.ping <= 400
|
||||
? circles.yellow
|
||||
: circles.red
|
||||
} ${client.ws?.ping}ms`,
|
||||
})
|
||||
.setTimestamp();
|
||||
await interaction.reply({ embeds: [botping] });
|
||||
},
|
||||
};
|
|
@ -1,70 +1,62 @@
|
|||
const Discord = require("discord.js");
|
||||
|
||||
module.exports = {
|
||||
description: "Reroll a giveaway",
|
||||
|
||||
options: [
|
||||
{
|
||||
name: "giveaway",
|
||||
description: "The giveaway to reroll (message ID or prize)",
|
||||
type: Discord.ApplicationCommandOptionType.String,
|
||||
required: true,
|
||||
},
|
||||
],
|
||||
description: 'Reroll a giveaway',
|
||||
|
||||
run: async (client, interaction) => {
|
||||
// If the member doesn't have enough permissions
|
||||
if (
|
||||
!interaction.member.permissions.has("MANAGE_MESSAGES") &&
|
||||
!interaction.member.roles.cache.some((r) => r.name === "Giveaways")
|
||||
) {
|
||||
return interaction.reply({
|
||||
content:
|
||||
":x: You need to have the manage messages permissions to reroll giveaways.",
|
||||
ephemeral: true,
|
||||
});
|
||||
}
|
||||
options: [
|
||||
{
|
||||
name: 'giveaway',
|
||||
description: 'The giveaway to reroll (message ID or prize)',
|
||||
type: 'STRING',
|
||||
required: true
|
||||
}
|
||||
],
|
||||
|
||||
run: async (client, interaction) => {
|
||||
|
||||
const query = interaction.options.getString("giveaway");
|
||||
// If the member doesn't have enough permissions
|
||||
if(!interaction.member.permissions.has('MANAGE_MESSAGES') && !interaction.member.roles.cache.some((r) => r.name === "Giveaways")){
|
||||
return interaction.reply({
|
||||
content: ':x: You need to have the manage messages permissions to reroll giveaways.',
|
||||
ephemeral: true
|
||||
});
|
||||
}
|
||||
|
||||
// try to found the giveaway with prize then with ID
|
||||
const giveaway =
|
||||
// Search with giveaway prize
|
||||
client.giveawaysManager.giveaways.find(
|
||||
(g) => g.prize === query && g.guildId === interaction.guild.id
|
||||
) ||
|
||||
// Search with giveaway ID
|
||||
client.giveawaysManager.giveaways.find(
|
||||
(g) => g.messageId === query && g.guildId === interaction.guild.id
|
||||
);
|
||||
const query = interaction.options.getString('giveaway');
|
||||
|
||||
// If no giveaway was found
|
||||
if (!giveaway) {
|
||||
return interaction.reply({
|
||||
content: "Unable to find a giveaway for `" + query + "`.",
|
||||
ephemeral: true,
|
||||
});
|
||||
}
|
||||
// try to found the giveaway with prize then with ID
|
||||
const giveaway =
|
||||
// Search with giveaway prize
|
||||
client.giveawaysManager.giveaways.find((g) => g.prize === query && g.guildId === interaction.guild.id) ||
|
||||
// Search with giveaway ID
|
||||
client.giveawaysManager.giveaways.find((g) => g.messageId === query && g.guildId === interaction.guild.id);
|
||||
|
||||
if (!giveaway.ended) {
|
||||
return interaction.reply({
|
||||
content: "The giveaway is not ended yet.",
|
||||
ephemeral: true,
|
||||
});
|
||||
}
|
||||
// If no giveaway was found
|
||||
if (!giveaway) {
|
||||
return interaction.reply({
|
||||
content: 'Unable to find a giveaway for `'+ query +'`.',
|
||||
ephemeral: true
|
||||
});
|
||||
}
|
||||
|
||||
// Reroll the giveaway
|
||||
client.giveawaysManager
|
||||
.reroll(giveaway.messageId)
|
||||
.then(() => {
|
||||
// Success message
|
||||
interaction.reply("Giveaway rerolled!");
|
||||
})
|
||||
.catch((e) => {
|
||||
interaction.reply({
|
||||
content: e,
|
||||
ephemeral: true,
|
||||
if (!giveaway.ended) {
|
||||
return interaction.reply({
|
||||
content: 'The giveaway is not ended yet.',
|
||||
ephemeral: true
|
||||
});
|
||||
}
|
||||
|
||||
// Reroll the giveaway
|
||||
client.giveawaysManager.reroll(giveaway.messageId)
|
||||
.then(() => {
|
||||
// Success message
|
||||
interaction.reply('Giveaway rerolled!');
|
||||
})
|
||||
.catch((e) => {
|
||||
interaction.reply({
|
||||
content: e,
|
||||
ephemeral: true
|
||||
});
|
||||
});
|
||||
});
|
||||
},
|
||||
|
||||
}
|
||||
};
|
|
@ -1,77 +1,75 @@
|
|||
const Discord = require("discord.js");
|
||||
const ms = require("ms");
|
||||
const ms = require('ms');
|
||||
const messages = require("../utils/messages");
|
||||
|
||||
module.exports = {
|
||||
description: "Start a giveaway",
|
||||
|
||||
options: [
|
||||
{
|
||||
name: "duration",
|
||||
description:
|
||||
"How long the giveaway should last for. Example values: 1m, 1h, 1d",
|
||||
type: Discord.ApplicationCommandOptionType.String,
|
||||
required: true,
|
||||
},
|
||||
{
|
||||
name: "winners",
|
||||
description: "How many winners the giveaway should have",
|
||||
type: Discord.ApplicationCommandOptionType.Integer,
|
||||
required: true,
|
||||
},
|
||||
{
|
||||
name: "prize",
|
||||
description: "What the prize of the giveaway should be",
|
||||
type: Discord.ApplicationCommandOptionType.String,
|
||||
required: true,
|
||||
},
|
||||
{
|
||||
name: "channel",
|
||||
description: "The channel to start the giveaway in",
|
||||
type: Discord.ApplicationCommandOptionType.Channel,
|
||||
required: true,
|
||||
},
|
||||
],
|
||||
description: 'Start a giveaway',
|
||||
|
||||
run: async (client, interaction) => {
|
||||
// If the member doesn't have enough permissions
|
||||
if (
|
||||
!interaction.member.permissions.has("MANAGE_MESSAGES") &&
|
||||
!interaction.member.roles.cache.some((r) => r.name === "Giveaways")
|
||||
) {
|
||||
return interaction.reply({
|
||||
content:
|
||||
":x: You need to have the manage messages permissions to start giveaways.",
|
||||
ephemeral: true,
|
||||
});
|
||||
}
|
||||
options: [
|
||||
{
|
||||
name: 'duration',
|
||||
description: 'How long the giveaway should last for. Example values: 1m, 1h, 1d',
|
||||
type: 'STRING',
|
||||
required: true
|
||||
},
|
||||
{
|
||||
name: 'winners',
|
||||
description: 'How many winners the giveaway should have',
|
||||
type: 'INTEGER',
|
||||
required: true
|
||||
},
|
||||
{
|
||||
name: 'prize',
|
||||
description: 'What the prize of the giveaway should be',
|
||||
type: 'STRING',
|
||||
required: true
|
||||
},
|
||||
{
|
||||
name: 'channel',
|
||||
description: 'The channel to start the giveaway in',
|
||||
type: 'CHANNEL',
|
||||
required: true
|
||||
}
|
||||
],
|
||||
|
||||
const giveawayChannel = interaction.options.getChannel("channel");
|
||||
const giveawayDuration = interaction.options.getString("duration");
|
||||
const giveawayWinnerCount = interaction.options.getInteger("winners");
|
||||
const giveawayPrize = interaction.options.getString("prize");
|
||||
run: async (client, interaction) => {
|
||||
|
||||
if (!giveawayChannel.isTextBased()) {
|
||||
return interaction.reply({
|
||||
content: ":x: Selected channel is not text-based.",
|
||||
ephemeral: true,
|
||||
});
|
||||
}
|
||||
// If the member doesn't have enough permissions
|
||||
if(!interaction.member.permissions.has('MANAGE_MESSAGES') && !interaction.member.roles.cache.some((r) => r.name === "Giveaways")){
|
||||
return interaction.reply({
|
||||
content: ':x: You need to have the manage messages permissions to start giveaways.',
|
||||
ephemeral: true
|
||||
});
|
||||
}
|
||||
|
||||
const giveawayChannel = interaction.options.getChannel('channel');
|
||||
const giveawayDuration = interaction.options.getString('duration');
|
||||
const giveawayWinnerCount = interaction.options.getInteger('winners');
|
||||
const giveawayPrize = interaction.options.getString('prize');
|
||||
|
||||
if(!giveawayChannel.isText()) {
|
||||
return interaction.reply({
|
||||
content: ':x: Selected channel is not text-based.',
|
||||
ephemeral: true
|
||||
});
|
||||
}
|
||||
|
||||
// Start the giveaway
|
||||
client.giveawaysManager.start(giveawayChannel, {
|
||||
// The giveaway duration
|
||||
duration: ms(giveawayDuration),
|
||||
// The giveaway prize
|
||||
prize: giveawayPrize,
|
||||
// The giveaway winner count
|
||||
winnerCount: giveawayWinnerCount,
|
||||
// Who hosts this giveaway
|
||||
hostedBy: client.config.hostedBy ? interaction.user : null,
|
||||
// Messages
|
||||
messages
|
||||
});
|
||||
|
||||
interaction.reply(`Giveaway started in ${giveawayChannel}!`);
|
||||
|
||||
}
|
||||
|
||||
// Start the giveaway
|
||||
client.giveawaysManager.start(giveawayChannel, {
|
||||
// The giveaway duration
|
||||
duration: ms(giveawayDuration),
|
||||
// The giveaway prize
|
||||
prize: giveawayPrize,
|
||||
// The giveaway winner count
|
||||
winnerCount: giveawayWinnerCount,
|
||||
// Who hosts this giveaway
|
||||
hostedBy: client.config.hostedBy ? interaction.user : null,
|
||||
// Messages
|
||||
messages,
|
||||
});
|
||||
|
||||
interaction.reply(`Giveaway started in ${giveawayChannel}!`);
|
||||
},
|
||||
};
|
|
@ -1,87 +1,85 @@
|
|||
const os = require("os");
|
||||
const { EmbedBuilder } = require("discord.js");
|
||||
const feroms = require("fero-ms");
|
||||
const os = require('os');
|
||||
const { MessageEmbed } = require('discord.js');
|
||||
const feroms = require('fero-ms');
|
||||
|
||||
module.exports = {
|
||||
name: "stats",
|
||||
description: "Sends bot physical statistics",
|
||||
run: async (client, interaction) => {
|
||||
let uptime = client.uptime;
|
||||
let shortUptime = feroms.ms(uptime);
|
||||
let model = os.cpus()[0].model;
|
||||
let cores = os.cpus().length;
|
||||
let platform = os.platform();
|
||||
let nodejs = process.version;
|
||||
let djs = require("discord.js").version;
|
||||
let botversion = require("../package.json").version;
|
||||
let server = client.guilds.cache.size;
|
||||
let user = client.users.cache.size;
|
||||
let channel = client.channels.cache.size;
|
||||
|
||||
let statsembed = new EmbedBuilder()
|
||||
.addFields(
|
||||
{
|
||||
name: "<:live2:896715171882500106> I have been online for?",
|
||||
value: `\`\`\`${shortUptime}\`\`\``,
|
||||
},
|
||||
{
|
||||
name: "<:globe:896718155416760340> Guilds",
|
||||
value: `\`${server}\``,
|
||||
inline: true,
|
||||
},
|
||||
{
|
||||
name: "<:mention:896718358672707584> Users",
|
||||
value: `\`${user}\``,
|
||||
inline: true,
|
||||
},
|
||||
{
|
||||
name: "<:channel:896717996326809641> Channels",
|
||||
value: `\`${channel}\``,
|
||||
inline: true,
|
||||
},
|
||||
{
|
||||
name: "Bot Version",
|
||||
value: `\`v${botversion}\``,
|
||||
inline: true,
|
||||
},
|
||||
{
|
||||
name: "<:prime:896718399776886816> Arch",
|
||||
value: `\`${os.arch()}\``,
|
||||
inline: true,
|
||||
},
|
||||
{
|
||||
name: "<:info:896718244461826140> Platform",
|
||||
value: `\`${platform}\``,
|
||||
inline: true,
|
||||
},
|
||||
{
|
||||
name: "<:desktop:896718080821047346> Cores",
|
||||
value: `\`${cores}\``,
|
||||
inline: true,
|
||||
},
|
||||
{
|
||||
name: "<a:Discord:896723328277024819> Discord.js Version",
|
||||
value: `\`v${djs}\``,
|
||||
inline: true,
|
||||
},
|
||||
{
|
||||
name: "<:jss:896718571491704852> Node.js Version",
|
||||
value: `\`${nodejs}\``,
|
||||
inline: true,
|
||||
},
|
||||
{
|
||||
name: "<:ram:896715172029276180> Ram Usage",
|
||||
value: `\`${(process.memoryUsage().heapUsed / 1024 / 1024).toFixed(
|
||||
2
|
||||
)}MB/ ${(os.totalmem() / 1024 / 1024).toFixed(2)}MB\``,
|
||||
inline: true,
|
||||
},
|
||||
{
|
||||
name: "<:desktop:896718080821047346> CPU Model",
|
||||
value: `\`\`\`${model}\`\`\``,
|
||||
}
|
||||
)
|
||||
.setTimestamp();
|
||||
await interaction.reply({ embeds: [statsembed] });
|
||||
},
|
||||
};
|
||||
name: 'stats',
|
||||
description: 'Sends bot physical statistics',
|
||||
run: async(client, interaction) => {
|
||||
let uptime = client.uptime;
|
||||
let shortUptime = feroms.ms(uptime);
|
||||
let model = os.cpus()[0].model;
|
||||
let cores = os.cpus().length;
|
||||
let platform = os.platform();
|
||||
let nodejs = process.version;
|
||||
let djs = require('discord.js').version;
|
||||
let botversion = require('../package.json').version;
|
||||
let server = client.guilds.cache.size;
|
||||
let user = client.users.cache.size;
|
||||
let channel = client.channels.cache.size;
|
||||
|
||||
let statsembed = new MessageEmbed()
|
||||
.addFields(
|
||||
{
|
||||
name: '<:live2:896715171882500106> I have been online for?',
|
||||
value: `\`\`\`${shortUptime}\`\`\``
|
||||
},
|
||||
{
|
||||
name: '<:globe:896718155416760340> Guilds',
|
||||
value: `\`${server}\``,
|
||||
inline: true
|
||||
},
|
||||
{
|
||||
name: '<:mention:896718358672707584> Users',
|
||||
value: `\`${user}\``,
|
||||
inline: true
|
||||
},
|
||||
{
|
||||
name: '<:channel:896717996326809641> Channels',
|
||||
value: `\`${channel}\``,
|
||||
inline: true
|
||||
},
|
||||
{
|
||||
name: 'Bot Version',
|
||||
value: `\`v${botversion}\``,
|
||||
inline: true
|
||||
},
|
||||
{
|
||||
name: '<:prime:896718399776886816> Arch',
|
||||
value: `\`${os.arch()}\``,
|
||||
inline: true
|
||||
},
|
||||
{
|
||||
name: '<:info:896718244461826140> Platform',
|
||||
value: `\`${platform}\``,
|
||||
inline: true
|
||||
},
|
||||
{
|
||||
name: '<:desktop:896718080821047346> Cores',
|
||||
value: `\`${cores}\``,
|
||||
inline: true
|
||||
},
|
||||
{
|
||||
name: '<a:Discord:896723328277024819> Discord.js Version',
|
||||
value: `\`v${djs}\``,
|
||||
inline: true
|
||||
},
|
||||
{
|
||||
name: '<:jss:896718571491704852> Node.js Version',
|
||||
value: `\`${nodejs}\``,
|
||||
inline: true
|
||||
},
|
||||
{
|
||||
name: '<:ram:896715172029276180> Ram Usage',
|
||||
value: `\`${(process.memoryUsage().heapUsed / 1024 / 1024).toFixed(2)}MB/ ${(os.totalmem() / 1024 / 1024).toFixed(2)}MB\``,
|
||||
inline: true
|
||||
},
|
||||
{
|
||||
name: '<:desktop:896718080821047346> CPU Model',
|
||||
value: `\`\`\`${model}\`\`\``
|
||||
}
|
||||
)
|
||||
.setTimestamp()
|
||||
await interaction.reply({ embeds: [statsembed] });
|
||||
}
|
||||
}
|
|
@ -1,71 +0,0 @@
|
|||
const Discord = require("discord.js");
|
||||
|
||||
module.exports = {
|
||||
description: "Unpause a giveaway",
|
||||
|
||||
options: [
|
||||
{
|
||||
name: "giveaway",
|
||||
description: "The giveaway to unpause (message ID or giveaway prize)",
|
||||
type: Discord.ApplicationCommandOptionType.String,
|
||||
required: true,
|
||||
},
|
||||
],
|
||||
|
||||
run: async (client, interaction) => {
|
||||
// If the member doesn't have enough permissions
|
||||
if (
|
||||
!interaction.member.permissions.has("MANAGE_MESSAGES") &&
|
||||
!interaction.member.roles.cache.some((r) => r.name === "Giveaways")
|
||||
) {
|
||||
return interaction.reply({
|
||||
content:
|
||||
":x: You need to have the manage messages permissions to unpause giveaways.",
|
||||
ephemeral: true,
|
||||
});
|
||||
}
|
||||
|
||||
const query = interaction.options.getString("giveaway");
|
||||
|
||||
// try to found the giveaway with prize then with ID
|
||||
const giveaway =
|
||||
// Search with giveaway prize
|
||||
client.giveawaysManager.giveaways.find(
|
||||
(g) => g.prize === query && g.guildId === interaction.guild.id
|
||||
) ||
|
||||
// Search with giveaway ID
|
||||
client.giveawaysManager.giveaways.find(
|
||||
(g) => g.messageId === query && g.guildId === interaction.guild.id
|
||||
);
|
||||
|
||||
// If no giveaway was found
|
||||
if (!giveaway) {
|
||||
return interaction.reply({
|
||||
content: "Unable to find a giveaway for `" + query + "`.",
|
||||
ephemeral: true,
|
||||
});
|
||||
}
|
||||
|
||||
if (!giveaway.pauseOptions.isPaused) {
|
||||
return interaction.reply({
|
||||
content: "This giveaway is not paused.",
|
||||
ephemeral: true,
|
||||
});
|
||||
}
|
||||
|
||||
// Edit the giveaway
|
||||
client.giveawaysManager
|
||||
.unpause(giveaway.messageId)
|
||||
// Success message
|
||||
.then(() => {
|
||||
// Success message
|
||||
interaction.reply("Giveaway unpaused!");
|
||||
})
|
||||
.catch((e) => {
|
||||
interaction.reply({
|
||||
content: e,
|
||||
ephemeral: true,
|
||||
});
|
||||
});
|
||||
},
|
||||
};
|
Loading…
Reference in a new issue