Skip to content

Commit

Permalink
feat: enabled editor.inlayHints, added tabulation, updated intents, a…
Browse files Browse the repository at this point in the history
…dded makeCache and sweepers

- Enabled "editor.inlayHints.enabled": "on"
- Added tabulation
- Added client to the Event handler
- Updated intents in new Client, added makeCache and sweepers
- Reduced large_threshold from 250 to 100
  • Loading branch information
GamesTwoLife committed Oct 8, 2024
1 parent 98f726c commit 1cce93a
Show file tree
Hide file tree
Showing 39 changed files with 826 additions and 853 deletions.
7 changes: 1 addition & 6 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -1,10 +1,5 @@
{
"eslint.validate": ["javascript", "javascriptreact", "typescript", "typescriptreact"],
"eslint.experimental.useFlatConfig": true,
"eslint.workingDirectories": [
{ "directory": "${workspaceFolder}" },
{ "pattern": "./src/*/" }
],
"editor.inlayHints.enabled": "on",
"editor.fontLigatures": true,
"editor.formatOnSave": true,
"editor.codeActionsOnSave": {
Expand Down
44 changes: 22 additions & 22 deletions commands/info/ping.js
Original file line number Diff line number Diff line change
@@ -1,32 +1,32 @@
const { SlashCommandBuilder, InteractionContextType } = require("discord.js");
const { SlashCommandBuilder, InteractionContextType, ApplicationIntegrationType } = require("discord.js");
const { t } = require("i18next");

/**
* @type {import('../../typings').Command}
*/
module.exports = {
data: new SlashCommandBuilder()
.setName("ping")
.setDescription(t('commands:info.ping.description', { lng: "en" }))
.setDescriptionLocalizations({
uk: t('commands:info.ping.description', { lng: "uk" }),
ru: t('commands:info.ping.description', { lng: "ru" })
})
.setContexts([InteractionContextType.Guild]),
options: {
cooldown: 30,
ownerOnly: false,
devGuildOnly: true,
bot_permissions: [],
},
data: new SlashCommandBuilder()
.setName("ping")
.setDescription(t('commands:info.ping.description', { lng: "en" }))
.setDescriptionLocalizations({
uk: t('commands:info.ping.description', { lng: "uk" })
})
.setContexts(InteractionContextType.Guild)
.setIntegrationTypes(ApplicationIntegrationType.GuildInstall),
options: {
cooldown: 30,
ownerOnly: false,
devGuildOnly: true,
bot_permissions: [],
},

async execute(interaction) {
const { client } = interaction;
async execute(interaction) {
const { client } = interaction;

await interaction.deferReply()
await interaction.deferReply()

const reply = await interaction.fetchReply()
await interaction.editReply({ content: t('commands:info.ping.content', { lng: interaction.locale, ping: Math.round(client.ws.ping), latency: Math.round(reply.createdTimestamp - interaction.createdTimestamp) }) });
},
const reply = await interaction.fetchReply()
await interaction.editReply({ content: t('commands:info.ping.content', { lng: interaction.locale, ping: Math.round(client.ws.ping), latency: Math.round(reply.createdTimestamp - interaction.createdTimestamp) }) });
},
};
45 changes: 21 additions & 24 deletions commands/sample/message sample.js
Original file line number Diff line number Diff line change
@@ -1,33 +1,30 @@
const { ContextMenuCommandBuilder, ApplicationCommandType, InteractionContextType } = require("discord.js");
const { ContextMenuCommandBuilder, ApplicationCommandType, InteractionContextType, ApplicationIntegrationType } = require("discord.js");
const { t } = require("i18next");

/**
* @type {import("../../typings").Command}
*/
module.exports = {
data: new ContextMenuCommandBuilder()
.setName(t('commands:sample.message_sample.description', { lng: "en" }).slice(0, 32))
.setNameLocalizations({
uk: t('commands:sample.message_sample.description', { lng: "uk" }).slice(0, 32),
ru: t('commands:sample.message_sample.description', { lng: "ru" }).slice(0, 32)
})
.setType(ApplicationCommandType.Message)
.setContexts([InteractionContextType.Guild]),
options: {
cooldown: 10,
ownerOnly: false,
devGuildOnly: true,
bot_permissions: [],
},
data: new ContextMenuCommandBuilder()
.setName("Message Sample")
.setType(ApplicationCommandType.Message)
.setContexts(InteractionContextType.Guild)
.setIntegrationTypes(ApplicationIntegrationType.GuildInstall),
options: {
cooldown: 10,
ownerOnly: false,
devGuildOnly: true,
bot_permissions: [],
},

async execute(interaction) {
if (!interaction.isMessageContextMenuCommand()) return;
async execute(interaction) {
if (!interaction.isMessageContextMenuCommand()) return;

const { targetId, targetMessage } = interaction;
await interaction.reply({
content: t('commands:sample.message_sample.content', { lng: interaction.locale, id: targetId, message: targetMessage.content }),
ephemeral: true
});
},
const { targetId, targetMessage } = interaction;
await interaction.reply({
content: t('commands:sample.message_sample.content', { lng: interaction.locale, id: targetId, message: targetMessage.content }),
ephemeral: true
});
},
};
32 changes: 12 additions & 20 deletions commands/sample/sample.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
const { SlashCommandBuilder, ActionRowBuilder, ButtonBuilder, ButtonStyle, StringSelectMenuBuilder, ModalBuilder, TextInputBuilder, TextInputStyle, EmbedBuilder, UserSelectMenuBuilder, ChannelSelectMenuBuilder, MentionableSelectMenuBuilder, RoleSelectMenuBuilder, PollLayoutType, InteractionContextType } = require("discord.js");
const { SlashCommandBuilder, ActionRowBuilder, ButtonBuilder, ButtonStyle, StringSelectMenuBuilder, ModalBuilder, TextInputBuilder, TextInputStyle, EmbedBuilder, UserSelectMenuBuilder, ChannelSelectMenuBuilder, MentionableSelectMenuBuilder, RoleSelectMenuBuilder, PollLayoutType, InteractionContextType, ApplicationIntegrationType } = require("discord.js");
const { t } = require("i18next");
const buttonPagination = require("../../utils/buttonPagination");
const buttonWrapper = require("../../utils/buttonWrapper");
Expand All @@ -11,24 +11,21 @@ module.exports = {
.setName("sample")
.setDescription(t('commands:sample.sample.description', { lng: "en" }))
.setDescriptionLocalizations({
uk: t('commands:sample.sample.description', { lng: "uk" }),
ru: t('commands:sample.sample.description', { lng: "ru" })
uk: t('commands:sample.sample.description', { lng: "uk" })
})
.addSubcommand(subcommand =>
subcommand
.setName("autocomplete")
.setDescription(t('commands:sample.sample.autocomplete.description', { lng: "en" }))
.setDescriptionLocalizations({
uk: t('commands:sample.sample.autocomplete.description', { lng: "uk" }),
ru: t('commands:sample.sample.autocomplete.description', { lng: "ru" })
uk: t('commands:sample.sample.autocomplete.description', { lng: "uk" })
})
.addStringOption(option =>
option
.setName("input")
.setDescription(t('commands:sample.sample.autocomplete.options.input', { lng: "en" }))
.setDescriptionLocalizations({
uk: t('commands:sample.sample.autocomplete.options.input', { lng: "uk" }),
ru: t('commands:sample.sample.autocomplete.options.input', { lng: "ru" })
uk: t('commands:sample.sample.autocomplete.options.input', { lng: "uk" })
})
.setAutocomplete(true)
.setRequired(true)
Expand All @@ -39,8 +36,7 @@ module.exports = {
.setName("button")
.setDescription(t('commands:sample.sample.button.description', { lng: "en" }))
.setDescriptionLocalizations({
uk: t('commands:sample.sample.button.description', { lng: "uk" }),
ru: t('commands:sample.sample.button.description', { lng: "ru" })
uk: t('commands:sample.sample.button.description', { lng: "uk" })
})
)
.addSubcommand(subcommand =>
Expand All @@ -49,47 +45,43 @@ module.exports = {
.setDescription("Sample Menu")
.setDescription(t('commands:sample.sample.menu.description', { lng: "en" }))
.setDescriptionLocalizations({
uk: t('commands:sample.sample.menu.description', { lng: "uk" }),
ru: t('commands:sample.sample.menu.description', { lng: "ru" })
uk: t('commands:sample.sample.menu.description', { lng: "uk" })
})
)
.addSubcommand(subcommand =>
subcommand
.setName("modal")
.setDescription(t('commands:sample.sample.modal.description', { lng: "en" }))
.setDescriptionLocalizations({
uk: t('commands:sample.sample.modal.description', { lng: "uk" }),
ru: t('commands:sample.sample.modal.description', { lng: "ru" })
uk: t('commands:sample.sample.modal.description', { lng: "uk" })
})
)
.addSubcommand(subcommand =>
subcommand
.setName("pagination")
.setDescription(t('commands:sample.sample.pagination.description', { lng: "en" }))
.setDescriptionLocalizations({
uk: t('commands:sample.sample.pagination.description', { lng: "uk" }),
ru: t('commands:sample.sample.pagination.description', { lng: "ru" })
uk: t('commands:sample.sample.pagination.description', { lng: "uk" })
})
)
.addSubcommand(subcommand =>
subcommand
.setName("buttonwrapper")
.setDescription(t('commands:sample.sample.buttonwrapper.description', { lng: "en" }))
.setDescriptionLocalizations({
uk: t('commands:sample.sample.buttonwrapper.description', { lng: "uk" }),
ru: t('commands:sample.sample.buttonwrapper.description', { lng: "ru" })
uk: t('commands:sample.sample.buttonwrapper.description', { lng: "uk" })
})
)
.addSubcommand(subcommand =>
subcommand
.setName("create-poll")
.setDescription(t('commands:sample.sample.create-poll.description', { lng: "en" }))
.setDescriptionLocalizations({
uk: t('commands:sample.sample.create-poll.description', { lng: "uk" }),
ru: t('commands:sample.sample.create-poll.description', { lng: "ru" })
uk: t('commands:sample.sample.create-poll.description', { lng: "uk" })
})
)
.setContexts([InteractionContextType.Guild]),
.setContexts(InteractionContextType.Guild)
.setIntegrationTypes(ApplicationIntegrationType.GuildInstall),
options: {
cooldown: 10,
ownerOnly: false,
Expand Down
47 changes: 22 additions & 25 deletions commands/sample/user sample.js
Original file line number Diff line number Diff line change
@@ -1,33 +1,30 @@
const { ContextMenuCommandBuilder, ApplicationCommandType, InteractionContextType } = require("discord.js");
const { ContextMenuCommandBuilder, ApplicationCommandType, InteractionContextType, ApplicationIntegrationType } = require("discord.js");
const { t } = require("i18next");

/**
* @type {import("../../typings").Command}
*/
module.exports = {
data: new ContextMenuCommandBuilder()
.setName(t('commands:sample.user_sample.description', { lng: "en" }).slice(0, 32))
.setNameLocalizations({
uk: t('commands:sample.user_sample.description', { lng: "uk" }).slice(0, 32),
ru: t('commands:sample.user_sample.description', { lng: "ru" }).slice(0, 32)
})
.setType(ApplicationCommandType.User)
.setContexts([InteractionContextType.Guild]),
options: {
cooldown: 10,
ownerOnly: false,
devGuildOnly: true,
bot_permissions: [],
},

async execute(interaction) {
if (!interaction.isUserContextMenuCommand()) return;
data: new ContextMenuCommandBuilder()
.setName("User Sample")
.setType(ApplicationCommandType.User)
.setContexts(InteractionContextType.Guild)
.setIntegrationTypes(ApplicationIntegrationType.GuildInstall),
options: {
cooldown: 10,
ownerOnly: false,
devGuildOnly: true,
bot_permissions: [],
},

async execute(interaction) {
if (!interaction.isUserContextMenuCommand()) return;

const { targetId, targetMember, targetUser} = interaction;
await interaction.reply({
content: t('commands:sample.user_sample.content', { lng: interaction.locale, id: targetId, member: targetMember.toString(), user: targetUser.toString() }),
ephemeral: true
});
},
const { targetId, targetMember, targetUser} = interaction;
await interaction.reply({
content: t('commands:sample.user_sample.content', { lng: interaction.locale, id: targetId, member: targetMember.toString(), user: targetUser.toString() }),
ephemeral: true
});
},
};
10 changes: 5 additions & 5 deletions components/autocomplete/sample/sample.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,13 @@
* @type {import("../../../typings").Autocomplete}
*/
module.exports = {
name: "sample",
name: "sample",
type: "autocomplete",

async execute(interaction) {
async execute(interaction) {
if (!interaction.isAutocomplete()) return;

const { options } = interaction;
const { options } = interaction;

const choices = ['Popular Topics: Threads', 'Sharding: Getting started', 'Library: Voice Connections', 'Interactions: Replying to slash commands', 'Popular Topics: Embed preview'];

Expand All @@ -24,5 +24,5 @@ module.exports = {
return interaction.respond(
filtered.map(choice => ({ name: choice, value: choice })),
);
},
};
},
};
12 changes: 6 additions & 6 deletions components/buttons/sample/sample.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,12 @@
* @type {import("../../../typings").Button}
*/
module.exports = {
name: "sample",
type: "button",
name: "sample",
type: "button",

async execute(interaction) {
if (!interaction.isButton()) return;
async execute(interaction) {
if (!interaction.isButton()) return;

return interaction.reply({ content: `${interaction.customId}`, ephemeral: true });
},
return interaction.reply({ content: `${interaction.customId}`, ephemeral: true });
},
};
12 changes: 6 additions & 6 deletions components/buttons/sample/say_hello.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,12 @@
* @type {import("../../../typings").Button}
*/
module.exports = {
name: "say_hello",
type: "button",
name: "say_hello",
type: "button",

async execute(interaction) {
if (!interaction.isButton()) return;
async execute(interaction) {
if (!interaction.isButton()) return;

return interaction.reply({ content: `Hello, ${interaction.user}!`, ephemeral: true });
},
return interaction.reply({ content: `Hello, ${interaction.user}!`, ephemeral: true });
},
};
16 changes: 8 additions & 8 deletions components/modals/sample/sample.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,16 @@
* @type {import("../../../typings").Modal}
*/
module.exports = {
name: "sample",
type: "modalSubmit",
name: "sample",
type: "modalSubmit",

async execute(interaction) {
if (!interaction.isModalSubmit()) return;
async execute(interaction) {
if (!interaction.isModalSubmit()) return;

const { fields } = interaction;
const { fields } = interaction;

const input = fields.getTextInputValue('input');
const input = fields.getTextInputValue('input');

return interaction.reply({ content: `${input}`, ephemeral: true });
},
return interaction.reply({ content: `${input}`, ephemeral: true });
},
};
4 changes: 2 additions & 2 deletions components/selectmenu/sample/channel_sample.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ module.exports = {
type: "selectmenu",

async execute(interaction) {
if (!interaction.isChannelSelectMenu()) return;
if (!interaction.isChannelSelectMenu()) return;

return interaction.reply({ content: `<#${interaction.values[0]}> ${interaction.values[0]}`, ephemeral: true });
},
};
};
4 changes: 2 additions & 2 deletions components/selectmenu/sample/mentionable_sample.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ module.exports = {
type: "selectmenu",

async execute(interaction) {
if (!interaction.isMentionableSelectMenu()) return;
if (!interaction.isMentionableSelectMenu()) return;

return interaction.reply({ content: `${interaction.values[0]}`, ephemeral: true });
},
};
};
Loading

0 comments on commit 1cce93a

Please sign in to comment.