Added Leaderboard to Quotes
This commit is contained in:
@@ -0,0 +1,106 @@
|
||||
const { SlashCommandBuilder, Events } = require('discord.js')
|
||||
const { mClient } = require('../..')
|
||||
require('dotenv').config()
|
||||
|
||||
async function channelSet(interaction) {
|
||||
const channel = interaction.options.getChannel('channel')
|
||||
const purpose = interaction.options.getString('purpose')
|
||||
const db = mClient.db(process.env.DB)
|
||||
const channelColl = db.collection('channels')
|
||||
|
||||
await channelColl.findOneAndUpdate({
|
||||
$and: [{ guildID: channel.guild.id }, { purpose: purpose }]
|
||||
}, {
|
||||
$set: {
|
||||
guildID: channel.guild.id,
|
||||
purpose: purpose,
|
||||
channelID: channel.id
|
||||
}
|
||||
}, {
|
||||
upsert: true
|
||||
})
|
||||
|
||||
return await interaction.editReply({
|
||||
content: `Set <#${channel.id}> as ${purpose} channel!`, ephemeral: true
|
||||
})
|
||||
}
|
||||
async function channelSimulate(interaction) {
|
||||
const purpose = interaction.options.getString('purpose')
|
||||
switch (purpose) {
|
||||
case 'birthday':
|
||||
await interaction.client.emit('Birthday', interaction.member)
|
||||
break;
|
||||
case 'wge':
|
||||
// For Future WGE Use
|
||||
break;
|
||||
case 'welcome':
|
||||
await interaction.client.emit(Events.GuildMemberAdd, interaction.member)
|
||||
break;
|
||||
case 'logs':
|
||||
// For Future Log Use
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
return interaction.reply({ content: 'Done.', ephemeral: true })
|
||||
}
|
||||
module.exports = {
|
||||
data: new SlashCommandBuilder()
|
||||
.setName('channels')
|
||||
.setDescription('rund um den honor')
|
||||
.addSubcommand(s =>
|
||||
s
|
||||
.setName('set')
|
||||
.setDescription('set a channel for a specific purpose')
|
||||
.addStringOption(o =>
|
||||
o.setName('purpose').setDescription('set the purpose').setRequired(true).addChoices({
|
||||
name: 'birthday',
|
||||
value: 'birthday'
|
||||
}, {
|
||||
name: 'welcome',
|
||||
value: 'welcome'
|
||||
}, {
|
||||
name: 'logs',
|
||||
value: 'logs'
|
||||
}, {
|
||||
name: 'wge',
|
||||
value: 'wge'
|
||||
}))
|
||||
.addChannelOption(c =>
|
||||
c.setName('channel').setDescription('choose a channel').setRequired(true)
|
||||
)
|
||||
)
|
||||
.addSubcommand(s =>
|
||||
s
|
||||
.setName('simulate')
|
||||
.setDescription('simulate a specific channel event')
|
||||
.addStringOption(o =>
|
||||
o.setName('purpose').setDescription('set the purpose').setRequired(true).addChoices({
|
||||
name: 'birthday',
|
||||
value: 'birthday'
|
||||
}, {
|
||||
name: 'welcome',
|
||||
value: 'welcome'
|
||||
}, {
|
||||
name: 'logs',
|
||||
value: 'logs'
|
||||
}, {
|
||||
name: 'wge',
|
||||
value: 'wge'
|
||||
}))
|
||||
)
|
||||
,
|
||||
async execute(interaction) {
|
||||
switch (interaction.options._subcommand) {
|
||||
case 'set':
|
||||
await interaction.deferReply()
|
||||
channelSet(interaction)
|
||||
break;
|
||||
case 'simulate':
|
||||
channelSimulate(interaction)
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -104,7 +104,9 @@ async function honorLeaderboard(interaction) {
|
||||
const embed = new EmbedBuilder()
|
||||
.setTitle('- Honors Leaderboard -')
|
||||
.setThumbnail('https://cdn.discordapp.com/attachments/1152723542836772914/1152940755539722240/pngwing.com.png')
|
||||
.setDescription(fields.toString());
|
||||
.setDescription(fields.toString())
|
||||
.setColor('#5865F2') // Discord's blurple color
|
||||
.setFooter({ text: 'Use ◄ ► to navigate' });
|
||||
await interaction.editReply({
|
||||
embeds: [embed],
|
||||
components: [row]
|
||||
|
||||
+14
-5
@@ -129,7 +129,9 @@ async function nutsLeaderboard(interaction) {
|
||||
const embed = new EmbedBuilder()
|
||||
.setTitle('Nuts Leaderboard')
|
||||
.setThumbnail('https://cdn.discordapp.com/attachments/1152723542836772914/1152940755539722240/pngwing.com.png')
|
||||
.setDescription(fields.toString());
|
||||
.setDescription(fields.toString())
|
||||
.setColor('#5865F2') // Discord's blurple color
|
||||
.setFooter({ text: 'Use ◄ ► to navigate' });
|
||||
await interaction.editReply({
|
||||
embeds: [embed],
|
||||
components: [row]
|
||||
@@ -192,7 +194,9 @@ async function nutsCooldown(interaction) {
|
||||
let content = `Du kannst wieder nussen! :)`
|
||||
let thumbnail = 'https://cdn-icons-png.flaticon.com/512/7451/7451659.png'
|
||||
let title = 'Go Nuts!'
|
||||
if (cooldown) {
|
||||
|
||||
let date = (Date.now() / 1000)
|
||||
if (cooldown.cooldown > date) {
|
||||
content = `<t:${cooldown.cooldown}:R> kannst du wieder nussen! ;)`
|
||||
thumbnail = 'https://cdn.discordapp.com/attachments/1152723542836772914/1152987472788193361/No-nuts-PhotoRoom.png-PhotoRoom.png'
|
||||
title = 'To Nut or Not to Nut...'
|
||||
@@ -213,6 +217,8 @@ async function nutsNut(interaction) {
|
||||
const cdColl = db.collection('cooldown')
|
||||
|
||||
const cdData = await cdColl.findOne({ userID: interaction.user.id })
|
||||
const embed = new EmbedBuilder()
|
||||
.setThumbnail('https://cdn.discordapp.com/attachments/1152723542836772914/1152991361113538621/png-transparent-subscription-box-label-bag-mysterious-miscellaneous-purple-blue-thumbnail-PhotoRoom.png-PhotoRoom.png')
|
||||
|
||||
let content
|
||||
const images = {
|
||||
@@ -259,11 +265,14 @@ async function nutsNut(interaction) {
|
||||
} else {
|
||||
content = `Du kannst erst <t:${Math.floor(cdData?.cooldown)}:R> wieder nussen :(`
|
||||
image = images["onCD"]
|
||||
await delay(1000)
|
||||
embed.setDescription(content)
|
||||
embed.setThumbnail(image)
|
||||
return await interaction.editReply({
|
||||
embeds: [embed]
|
||||
})
|
||||
}
|
||||
|
||||
const embed = new EmbedBuilder()
|
||||
.setThumbnail('https://cdn.discordapp.com/attachments/1152723542836772914/1152991361113538621/png-transparent-subscription-box-label-bag-mysterious-miscellaneous-purple-blue-thumbnail-PhotoRoom.png-PhotoRoom.png')
|
||||
|
||||
await interaction.editReply({
|
||||
embeds: [embed]
|
||||
})
|
||||
|
||||
+83
-26
@@ -1,17 +1,11 @@
|
||||
/*
|
||||
Add
|
||||
Delete
|
||||
Random
|
||||
Random By Person
|
||||
Direct Search by ID
|
||||
|
||||
Random By Year?
|
||||
List?
|
||||
Counter (Leaderboard?)
|
||||
Counter (Leaderboard)
|
||||
*/
|
||||
const { SlashCommandBuilder, EmbedBuilder, ActionRowBuilder, ButtonBuilder, ButtonStyle, UserSelectMenuBuilder } = require('discord.js')
|
||||
const { mClient } = require('../..')
|
||||
require('dotenv').config()
|
||||
function delay(ms) { return new Promise(resolve => setTimeout(resolve, ms)); }
|
||||
|
||||
async function quotesAdd(interaction) {
|
||||
const messageLink = await interaction.options.getString('link')
|
||||
@@ -108,7 +102,7 @@ async function quotesSearch(interaction) {
|
||||
const found = await quotesColl.findOne({ messageID: id })
|
||||
if (!found) { return await interaction.reply({ content: 'ID not found!', ephemeral: true }) }
|
||||
|
||||
|
||||
|
||||
const guild = await interaction.client.guilds.fetch(found.guildID)
|
||||
const channel = await guild.channels.fetch(found.channelID)
|
||||
const message = await channel.messages.fetch(found.messageID)
|
||||
@@ -122,9 +116,9 @@ async function quotesSearch(interaction) {
|
||||
|
||||
quotesColl.findOneAndUpdate({
|
||||
messageID: found.messageID
|
||||
},{
|
||||
$inc: { count: 1}
|
||||
},{
|
||||
}, {
|
||||
$inc: { count: 1 }
|
||||
}, {
|
||||
upsert: true
|
||||
})
|
||||
|
||||
@@ -166,18 +160,18 @@ async function quotesRandom(interaction) {
|
||||
const db = mClient.db(process.env.M_DB)
|
||||
const quotesColl = db.collection('quotes')
|
||||
var rdm
|
||||
if(user){
|
||||
if (user) {
|
||||
rdm = await quotesColl.aggregate([
|
||||
{
|
||||
$match: { by: user.id},
|
||||
},{
|
||||
$sample: { size: 1 }
|
||||
{
|
||||
$match: { by: user.id },
|
||||
}, {
|
||||
$sample: { size: 1 }
|
||||
}
|
||||
]).toArray()
|
||||
} else {
|
||||
rdm = await quotesColl.aggregate([
|
||||
{
|
||||
$sample: { size: 1 }
|
||||
{
|
||||
$sample: { size: 1 }
|
||||
}
|
||||
]).toArray()
|
||||
}
|
||||
@@ -196,9 +190,9 @@ async function quotesRandom(interaction) {
|
||||
|
||||
quotesColl.findOneAndUpdate({
|
||||
messageID: found.messageID
|
||||
},{
|
||||
$inc: { count: 1}
|
||||
},{
|
||||
}, {
|
||||
$inc: { count: 1 }
|
||||
}, {
|
||||
upsert: true
|
||||
})
|
||||
|
||||
@@ -258,7 +252,7 @@ async function quotesList(interaction) {
|
||||
.setCustomId('quotes_list_right')
|
||||
.setStyle(ButtonStyle.Primary)
|
||||
)
|
||||
|
||||
|
||||
const select = new ActionRowBuilder()
|
||||
.addComponents(
|
||||
new UserSelectMenuBuilder()
|
||||
@@ -272,12 +266,74 @@ async function quotesList(interaction) {
|
||||
ephemeral: true
|
||||
})
|
||||
|
||||
|
||||
|
||||
}
|
||||
async function quotesLeaderboard(interaction) {
|
||||
// need to add count to quotes
|
||||
const db = mClient.db(process.env.M_DB)
|
||||
const quotesColl = db.collection('quotes')
|
||||
let skip = 0
|
||||
const minValue = 0
|
||||
const maxValue = await quotesColl.countDocuments({ $and: [{ guildID: interaction.guild.id }, { count: { $gt: 0 } }] })
|
||||
|
||||
const quotesData = await quotesColl.find({}).sort({ count: -1, messageID: -1 }).skip(skip).limit(5).toArray()
|
||||
const fields = []
|
||||
|
||||
const guild = await interaction.client.guilds.fetch(interaction.guild.id)
|
||||
quotesData.forEach(async (data, index) => {
|
||||
|
||||
let channel = await guild.channels.fetch(data.channelID)
|
||||
let message = await channel.messages.fetch(data.messageID)
|
||||
|
||||
await delay(500)
|
||||
let timestamp = new Date(message.createdTimestamp)
|
||||
fields.push({
|
||||
name: `${index + 1}.`,//`\u200b` ,
|
||||
value: `[#${data.messageID}](https://discord.com/channels/${data.guildID}/${data.channelID}/${data.messageID})\r\n**by** <@${data.by}> • ⭐ ${data.count}\r\n_Posted on **${timestamp}**_\r\n${message.content}`
|
||||
})
|
||||
|
||||
})
|
||||
|
||||
|
||||
await delay(5000)
|
||||
console.log(fields)
|
||||
quotesData.sort((a,b) => {
|
||||
const numA = parseInt(a.name);
|
||||
const numB = parseInt(b.name);
|
||||
return numA - numB;
|
||||
})
|
||||
console.log(fields)
|
||||
|
||||
const embed = new EmbedBuilder()
|
||||
.setTitle('- Quotes Leaderboard -')
|
||||
.setThumbnail('https://cdn.discordapp.com/attachments/1152723542836772914/1152940755539722240/pngwing.com.png')
|
||||
.setFields(fields)
|
||||
.setColor('#5865F2') // Discord's blurple color
|
||||
.setFooter({ text: `Use ◄ ► to navigate\r\n${skip}` });
|
||||
|
||||
const row = new ActionRowBuilder()
|
||||
.addComponents(
|
||||
new ButtonBuilder()
|
||||
.setLabel('◄')
|
||||
.setStyle(ButtonStyle.Primary)
|
||||
.setCustomId('quotes_leaderboard_left')
|
||||
)
|
||||
.addComponents(
|
||||
new ButtonBuilder()
|
||||
.setLabel('X')
|
||||
.setStyle(ButtonStyle.Danger)
|
||||
.setCustomId('abort')
|
||||
)
|
||||
.addComponents(
|
||||
new ButtonBuilder()
|
||||
.setLabel('►')
|
||||
.setStyle(ButtonStyle.Primary)
|
||||
.setCustomId('quotes_leaderboard_right')
|
||||
)
|
||||
await interaction.editReply({
|
||||
embeds: [embed],
|
||||
components: [row]
|
||||
})
|
||||
}
|
||||
|
||||
module.exports = {
|
||||
data: new SlashCommandBuilder()
|
||||
.setName('quotes')
|
||||
@@ -326,6 +382,7 @@ module.exports = {
|
||||
quotesRandom(interaction)
|
||||
break;
|
||||
case 'leaderboard':
|
||||
await interaction.deferReply()
|
||||
quotesLeaderboard(interaction)
|
||||
break;
|
||||
case 'list':
|
||||
|
||||
@@ -0,0 +1,259 @@
|
||||
const { SlashCommandBuilder, EmbedBuilder } = require('discord.js')
|
||||
const { mClient } = require('../..')
|
||||
const { configDotenv } = require('dotenv')
|
||||
configDotenv()
|
||||
|
||||
function isValidDate(day, month) {
|
||||
// Define the number of days in each month
|
||||
const daysInMonth = {
|
||||
1: 31, // January
|
||||
2: 28, // February (ignore leap years)
|
||||
3: 31, // March
|
||||
4: 30, // April
|
||||
5: 31, // May
|
||||
6: 30, // June
|
||||
7: 31, // July
|
||||
8: 31, // August
|
||||
9: 30, // September
|
||||
10: 31, // October
|
||||
11: 30, // November
|
||||
12: 31 // December
|
||||
};
|
||||
|
||||
// Check if month is valid
|
||||
if (month < 1 || month > 12) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// Check if day is valid for the given month
|
||||
if (day < 1 || day > daysInMonth[month]) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
async function birthdayAdd(interaction) {
|
||||
let target = await interaction.options.getUser('user')
|
||||
let day = await interaction.options.getNumber('day')
|
||||
let month = await interaction.options.getNumber('month')
|
||||
|
||||
|
||||
if (!isValidDate(day, month)) {
|
||||
return interaction.reply({ content: "Invalid Date", ephemeral: true })
|
||||
}
|
||||
|
||||
const db = mClient.db(process.env.M_DB)
|
||||
const bdayColl = db.collection('birthdays')
|
||||
|
||||
const found = await bdayColl.findOne({ userID: target.id })
|
||||
if (found) {
|
||||
return interaction.reply({ content: "Already in Database", ephemeral: true })
|
||||
}
|
||||
|
||||
const data = {
|
||||
guildID: interaction.guild.id,
|
||||
userID: target.id,
|
||||
day: day,
|
||||
month: month
|
||||
}
|
||||
|
||||
const res = await bdayColl.insertOne(data)
|
||||
if (res.acknowledged) {
|
||||
return interaction.reply({ content: "Birthday added successfully!" })
|
||||
} else {
|
||||
return interaction.reply({ content: "There was an issue!" })
|
||||
}
|
||||
}
|
||||
async function birthdayDelete(interaction) {
|
||||
var target = await interaction.options.getUser('user')
|
||||
const guild = await interaction.client.guilds.cache.get(interaction.guild.id)
|
||||
if (!target) {
|
||||
target = await guild.members.cache.get(await interaction.options.getString('id'))
|
||||
}
|
||||
|
||||
if (!target) {
|
||||
return interaction.reply({ content: "Invalid or No User specified!" })
|
||||
}
|
||||
|
||||
const db = mClient.db(process.env.M_DB)
|
||||
const bdayColl = db.collection('birthdays')
|
||||
|
||||
const found = await bdayColl.findOne({ userID: target.id })
|
||||
if (!found) {
|
||||
return interaction.reply({ content: "Not yet in Database", ephemeral: true })
|
||||
}
|
||||
|
||||
const res = await bdayColl.deleteOne({ userID: target.id })
|
||||
if (res.acknowledged) {
|
||||
return interaction.reply({ content: "Birthday removed successfully!" })
|
||||
} else {
|
||||
return interaction.reply({ content: "There was an issue!" })
|
||||
}
|
||||
}
|
||||
async function birthdayEdit(interaction) {
|
||||
let target = await interaction.options.getUser('user')
|
||||
let day = await interaction.options.getNumber('day')
|
||||
let month = await interaction.options.getNumber('month')
|
||||
|
||||
|
||||
if (!isValidDate(day, month)) {
|
||||
return interaction.reply({ content: "Invalid Date", ephemeral: true })
|
||||
}
|
||||
|
||||
const db = mClient.db(process.env.M_DB)
|
||||
const bdayColl = db.collection('birthdays')
|
||||
|
||||
const found = await bdayColl.findOne({ userID: target.id })
|
||||
if (!found) {
|
||||
return interaction.reply({ content: "Not yet in Database", ephemeral: true })
|
||||
}
|
||||
|
||||
const data = {
|
||||
guildID: interaction.guild.id,
|
||||
userID: target.id,
|
||||
day: day,
|
||||
month: month
|
||||
}
|
||||
|
||||
const res = await bdayColl.findOneAndUpdate({ userID: target.id }, { $set: data }, { upsert: true })
|
||||
return interaction.reply({ content: "Birthday edited successfully!" })
|
||||
}
|
||||
async function isDateInPast(day, month) {
|
||||
const currentYear = new Date().getFullYear();
|
||||
const inputDate = new Date(currentYear, month - 1, day);
|
||||
const now = new Date();
|
||||
return inputDate < now;
|
||||
}
|
||||
async function makeTimestamp(day, month, year) {
|
||||
const date = new Date(year, month - 1, day);
|
||||
const unixTimestamp = Math.floor(date.getTime() / 1000);
|
||||
return unixTimestamp
|
||||
}
|
||||
function isToday(day, month) {
|
||||
const currentYear = new Date().getFullYear();
|
||||
const inputDate = new Date(currentYear, month - 1, day);
|
||||
const today = new Date();
|
||||
return (
|
||||
inputDate.getDate() === today.getDate() &&
|
||||
inputDate.getMonth() === today.getMonth() &&
|
||||
inputDate.getFullYear() === today.getFullYear()
|
||||
);
|
||||
}
|
||||
async function birthdayGet(interaction) {
|
||||
let target = await interaction.options.getUser('user')
|
||||
const db = mClient.db(process.env.M_DB)
|
||||
const bdayColl = db.collection('birthdays')
|
||||
|
||||
const found = await bdayColl.findOne({ userID: target.id })
|
||||
if (!found) {
|
||||
return interaction.reply({ content: "Not in Database!", ephemeral: true })
|
||||
}
|
||||
let unix
|
||||
if(isDateInPast(found.day,found.month)){
|
||||
let nextYear = new Date().getFullYear() + 1
|
||||
unix = await makeTimestamp(found.day,found.month, nextYear)
|
||||
} else {
|
||||
let thisYear = new Date().getFullYear()
|
||||
unix = await makeTimestamp(found.day,found.month, thisYear)
|
||||
}
|
||||
let description = `is on the <t:${unix}:d>\r\n<t:${unix}:R>`
|
||||
if(isToday(found.day, found.month)){
|
||||
description = `IS TODAY!🥳🎉`
|
||||
}
|
||||
const embed = new EmbedBuilder()
|
||||
.setThumbnail(target.displayAvatarURL())
|
||||
.setTitle(`${target.globalName ? target.globalName: target.username}'s Birthday!`)
|
||||
.setDescription(description)
|
||||
await interaction.reply({ embeds: [embed] })
|
||||
}
|
||||
|
||||
module.exports = {
|
||||
data: new SlashCommandBuilder()
|
||||
.setName('birthday')
|
||||
.setDescription('manage birthdays')
|
||||
.addSubcommand(s =>
|
||||
s
|
||||
.setName('add')
|
||||
.setDescription('adds a birthday')
|
||||
.addUserOption((option) =>
|
||||
option
|
||||
.setName('user')
|
||||
.setDescription('user')
|
||||
.setRequired(true))
|
||||
.addNumberOption((option) =>
|
||||
option
|
||||
.setName('day')
|
||||
.setDescription('day')
|
||||
.setMinValue(1)
|
||||
.setMaxValue(31)
|
||||
.setRequired(true))
|
||||
.addNumberOption((option) =>
|
||||
option
|
||||
.setName('month')
|
||||
.setDescription('month')
|
||||
.setMinValue(1)
|
||||
.setMaxValue(12)
|
||||
.setRequired(true))
|
||||
)
|
||||
.addSubcommand(s =>
|
||||
s
|
||||
.setName('delete')
|
||||
.setDescription('deletes a birthday')
|
||||
.addUserOption((option) =>
|
||||
option.setName('user').setDescription('user'))
|
||||
.addStringOption((option) =>
|
||||
option.setName('id').setDescription('ID')))
|
||||
.addSubcommand(s =>
|
||||
s
|
||||
.setName('edit')
|
||||
.setDescription('edits a birthday')
|
||||
.addUserOption((option) =>
|
||||
option.setName('user').setDescription('user').setRequired(true))
|
||||
.addNumberOption((option) =>
|
||||
option.setName('day').setDescription('day').setRequired(true))
|
||||
.addNumberOption((option) =>
|
||||
option.setName('month').setDescription('month').setRequired(true)))
|
||||
.addSubcommand(s =>
|
||||
s
|
||||
.setName('get')
|
||||
.setDescription('gets a birthday')
|
||||
.addUserOption((option) =>
|
||||
option.setName('user').setDescription('user').setRequired(true))),
|
||||
async execute(interaction) {
|
||||
switch (interaction.options._subcommand) {
|
||||
case 'add':
|
||||
if (!interaction.member.permissions.has("ADMINISTRATOR")) {
|
||||
return await interaction.reply({
|
||||
content: "Unprivileged Access!",
|
||||
ephemeral: true
|
||||
})
|
||||
}
|
||||
birthdayAdd(interaction)
|
||||
break;
|
||||
case 'delete':
|
||||
if (!interaction.member.permissions.has("ADMINISTRATOR")) {
|
||||
return await interaction.reply({
|
||||
content: "Unprivileged Access!",
|
||||
ephemeral: true
|
||||
})
|
||||
}
|
||||
birthdayDelete(interaction)
|
||||
break;
|
||||
case 'edit':
|
||||
if (!interaction.member.permissions.has("ADMINISTRATOR")) {
|
||||
return await interaction.reply({
|
||||
content: "Unprivileged Access!",
|
||||
ephemeral: true
|
||||
})
|
||||
}
|
||||
birthdayEdit(interaction)
|
||||
break;
|
||||
case 'get':
|
||||
birthdayGet(interaction)
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,39 +0,0 @@
|
||||
const { SlashCommandBuilder, Events } = require('discord.js')
|
||||
module.exports = {
|
||||
data: new SlashCommandBuilder()
|
||||
.setName('simjoin')
|
||||
.setDescription('simulates a join event')
|
||||
.addMentionableOption((option) =>
|
||||
option.setName('target').setDescription('user')),
|
||||
async execute(interaction) {
|
||||
|
||||
if(!interaction.member.permissions.has("ADMINISTRATOR")){
|
||||
return await interaction.reply({
|
||||
content: "Unprivileged Access!",
|
||||
ephemeral: true
|
||||
})
|
||||
}
|
||||
|
||||
let target = interaction.options.getMentionable('target')
|
||||
if(!target){
|
||||
target = interaction.member
|
||||
}
|
||||
try {
|
||||
if(target.user.username){
|
||||
interaction.client.emit(Events.GuildMemberAdd, target)
|
||||
await interaction.reply({
|
||||
content: "Done!",
|
||||
ephemeral: true
|
||||
})
|
||||
}
|
||||
} catch (error) {
|
||||
await interaction.reply({
|
||||
content: "Invalid Mentionable!",
|
||||
ephemeral: true
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user