Merge branch 'dev' into 'main'
Added sorting to ranks based on position See merge request illegitimate/illegitimate-bot!123
This commit is contained in:
@@ -11,7 +11,7 @@ module.exports = {
|
|||||||
|
|
||||||
data: new SlashCommandBuilder()
|
data: new SlashCommandBuilder()
|
||||||
.setName("ban")
|
.setName("ban")
|
||||||
.setDescription("Ban a user")
|
.setDescription("Bans a user")
|
||||||
.addUserOption(option =>
|
.addUserOption(option =>
|
||||||
option
|
option
|
||||||
.setName("user")
|
.setName("user")
|
||||||
|
|||||||
@@ -9,6 +9,16 @@ module.exports = {
|
|||||||
type: "slash",
|
type: "slash",
|
||||||
dev: false,
|
dev: false,
|
||||||
public: true,
|
public: true,
|
||||||
|
subcommands: [
|
||||||
|
{
|
||||||
|
name: "member",
|
||||||
|
description: "Get info about a guild memeber",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: "info",
|
||||||
|
description: "Get info about a guild.",
|
||||||
|
}
|
||||||
|
],
|
||||||
|
|
||||||
data: new SlashCommandBuilder()
|
data: new SlashCommandBuilder()
|
||||||
.setName("guild")
|
.setName("guild")
|
||||||
@@ -31,7 +41,7 @@ module.exports = {
|
|||||||
.addStringOption(option =>
|
.addStringOption(option =>
|
||||||
option
|
option
|
||||||
.setName("query")
|
.setName("query")
|
||||||
.setDescription("The IGN of a member.")
|
.setDescription("The query to search for. [Default: player]")
|
||||||
.setRequired(true)
|
.setRequired(true)
|
||||||
).
|
).
|
||||||
addStringOption(option =>
|
addStringOption(option =>
|
||||||
|
|||||||
@@ -127,7 +127,8 @@ async function guildInfo(interaction) {
|
|||||||
|
|
||||||
const guildOwner = guildMembers.find((m) => m.rank === "Guild Master").uuid
|
const guildOwner = guildMembers.find((m) => m.rank === "Guild Master").uuid
|
||||||
const guildOwnerName = await getIGN(guildOwner)
|
const guildOwnerName = await getIGN(guildOwner)
|
||||||
const guildRanks = guild.ranks.map((r) => "**➺ " + r.name + "** `[" + r.tag + "]`").join("\n")
|
const guildRanksUnsorted = guild.ranks.sort((a, b) => b.priority - a.priority)
|
||||||
|
const guildRanks = guildRanksUnsorted.map((r) => "**➺ " + r.name + "** `[" + r.tag + "]`").join("\n")
|
||||||
|
|
||||||
const guildMembersDailyXP = Object.values(guildMembers).map((m) => m.expHistory[Object.keys(m.expHistory)[0]])
|
const guildMembersDailyXP = Object.values(guildMembers).map((m) => m.expHistory[Object.keys(m.expHistory)[0]])
|
||||||
const totalGuildMembersDailyXPUnformatted = guildMembersDailyXP.reduce((a, b) => a + b, 0)
|
const totalGuildMembersDailyXPUnformatted = guildMembersDailyXP.reduce((a, b) => a + b, 0)
|
||||||
|
|||||||
@@ -11,7 +11,7 @@ module.exports = {
|
|||||||
|
|
||||||
data: new SlashCommandBuilder()
|
data: new SlashCommandBuilder()
|
||||||
.setName("help")
|
.setName("help")
|
||||||
.setDescription("Help command")
|
.setDescription("List's all commands usable by a member")
|
||||||
.setDMPermission(true),
|
.setDMPermission(true),
|
||||||
|
|
||||||
/** @param { import('discord.js').ChatInputCommandInteraction } interaction */
|
/** @param { import('discord.js').ChatInputCommandInteraction } interaction */
|
||||||
@@ -24,10 +24,26 @@ module.exports = {
|
|||||||
const commandFiles = fs.readdirSync(__dirname).filter(file => file.endsWith(".js"))
|
const commandFiles = fs.readdirSync(__dirname).filter(file => file.endsWith(".js"))
|
||||||
for (const file of commandFiles) {
|
for (const file of commandFiles) {
|
||||||
const command = require(`./${file}`)
|
const command = require(`./${file}`)
|
||||||
if (command.public) {
|
if (command.public && !command.subcommands) {
|
||||||
commands.push(command)
|
commands.push(command)
|
||||||
|
} else if (command.public && command.subcommands) {
|
||||||
|
const commandName = command.name
|
||||||
|
|
||||||
|
const subcommands = command.subcommands.map((subcommand) => {
|
||||||
|
return {
|
||||||
|
name: commandName + " " + subcommand.name,
|
||||||
|
description: subcommand.description
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
|
console.log(subcommands)
|
||||||
|
|
||||||
|
for (const subcommand of subcommands) {
|
||||||
|
commands.push(subcommand)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const commandList = commands.map((command) => {
|
const commandList = commands.map((command) => {
|
||||||
return {
|
return {
|
||||||
name: "**/" + command.name + "**",
|
name: "**/" + command.name + "**",
|
||||||
|
|||||||
@@ -10,7 +10,7 @@ module.exports = {
|
|||||||
|
|
||||||
data: new SlashCommandBuilder()
|
data: new SlashCommandBuilder()
|
||||||
.setName("ping")
|
.setName("ping")
|
||||||
.setDescription("Get the bot's ping."),
|
.setDescription("Get's the bot's ping."),
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param { import("discord.js").ChatInputCommandInteraction } interaction
|
* @param { import("discord.js").ChatInputCommandInteraction } interaction
|
||||||
|
|||||||
@@ -14,7 +14,7 @@ module.exports = {
|
|||||||
|
|
||||||
data: new SlashCommandBuilder()
|
data: new SlashCommandBuilder()
|
||||||
.setName("update")
|
.setName("update")
|
||||||
.setDescription("Update your guild rank.")
|
.setDescription("Update your discord roles.")
|
||||||
.setDMPermission(false),
|
.setDMPermission(false),
|
||||||
|
|
||||||
/** @param { import('discord.js').ChatInputCommandInteraction } interaction */
|
/** @param { import('discord.js').ChatInputCommandInteraction } interaction */
|
||||||
|
|||||||
@@ -8,10 +8,16 @@ module.exports = {
|
|||||||
|
|
||||||
execute(interaction) {
|
execute(interaction) {
|
||||||
if (interaction.isCommand()) {
|
if (interaction.isCommand()) {
|
||||||
console.log(interaction.user.username + "#" +
|
try {
|
||||||
interaction.user.discriminator + " ran " +
|
console.log(interaction.user.username + " ran " +
|
||||||
interaction.commandName
|
interaction.commandName + " " +
|
||||||
)
|
interaction.options.getSubcommand()
|
||||||
|
)
|
||||||
|
} catch {
|
||||||
|
console.log(interaction.user.username + " ran " +
|
||||||
|
interaction.commandName
|
||||||
|
)
|
||||||
|
}
|
||||||
} else if (interaction.isButton()) {
|
} else if (interaction.isButton()) {
|
||||||
console.log(interaction.user.username + "#" +
|
console.log(interaction.user.username + "#" +
|
||||||
interaction.user.discriminator + " clicked " +
|
interaction.user.discriminator + " clicked " +
|
||||||
|
|||||||
Reference in New Issue
Block a user