Skip to content

Commit

Permalink
chore: update discord.js from 14.16.1 to 14.16.3
Browse files Browse the repository at this point in the history
  • Loading branch information
GamesTwoLife committed Oct 8, 2024
1 parent e686d75 commit bab4e37
Show file tree
Hide file tree
Showing 3 changed files with 45 additions and 42 deletions.
19 changes: 11 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,12 +1,15 @@
<h1 align="center">Ласкаво просимо до шаблону дискорд бота</h1>
<p>
<img alt="Version" src="https://img.shields.io/badge/версія-v1.3.0-blue.svg" />
<a href="https://github.com/GamesTwoLife/DiscordBot-Template#readme" target="_blank">
<img alt="Документація" src="https://img.shields.io/badge/Документація-yes-brightgreen.svg" />
</a>
<a href="https://github.com/GamesTwoLife/DiscordBot-Template/graphs/commit-activity" target="_blank">
<img alt="Підтримується" src="https://img.shields.io/badge/Підтримується%3F-yes-green.svg" />
</a>
<img alt="Version" src="https://img.shields.io/badge/версія-v1.3.0-blue.svg" />
<a href="https://www.npmjs.com/package/discord.js">
<img src="https://img.shields.io/npm/v/discord.js.svg" alt="npm version" />
</a>
<a href="https://github.com/GamesTwoLife/DiscordBot-Template#readme" target="_blank">
<img alt="Документація" src="https://img.shields.io/badge/Документація-yes-brightgreen.svg" />
</a>
<a href="https://github.com/GamesTwoLife/DiscordBot-Template/graphs/commit-activity" target="_blank">
<img alt="Підтримується" src="https://img.shields.io/badge/Підтримується%3F-yes-green.svg" />
</a>
</p>

> Шаблон бота з **відкритим вихідним кодом** `discord.js`, який базується на офіційному [посібнику з discord.js](https://discordjs.guide/), щоб розпочати створення свого особистого бота для Discord!
Expand All @@ -30,7 +33,7 @@ Discord Bot Template — це шаблон бота з відкритим вих
#### **Динамічний обробник команд (як слеш так і контекстного меню):**

- Мій шаблон постачається з динамічним обробником команд, який дуже легко налаштовувати та створювати команди.
- Команди в папці commands отримують об’єкт [`ChatInputCommandInteraction`](https://discord.js.org/docs/packages/discord.js/14.16.1/ChatInputCommandInteraction:Class) або [`ContextMenuCommandInteraction`](https://discord.js.org/docs/packages/discord.js/14.16.1/ContextMenuCommandInteraction:Class) в залежності від типу команди (слеш або контекстна).
- Команди в папці commands отримують об’єкт [`ChatInputCommandInteraction`](https://discord.js.org/docs/packages/discord.js/14.16.3/ChatInputCommandInteraction:Class) або [`ContextMenuCommandInteraction`](https://discord.js.org/docs/packages/discord.js/14.16.3/ContextMenuCommandInteraction:Class) в залежності від типу команди (слеш або контекстна).
- **ВАЖЛИВО:** У шаблоні ми надсилаємо команди в Discord для реєстрації лише в 1 гільдії. Це тому, що є 2 типи команд, гільдійські та глобальні. Команди гільдії обмежені 1 гільдією, але щоразу, коли ви їх оновлюєте, вони набувають чинності негайно, тоді як для глобальних команд потрібно до 1 години. Тому використовуйте команди гільди у розробці та глобальні команди для виробництва. (змінити це можна використавши параметр в кожному файлі команди `devGuildOnly`: `true` - команда в 1 гільдії, `false` - глобальна команда)

#### **Динамічний обробник взаємодії кнопок:**
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
},
"homepage": "https://github.com/GamesTwoLife/DiscordBot-Template#readme",
"dependencies": {
"discord.js": "^14.16.1",
"discord.js": "^14.16.3",
"fs": "^0.0.1-security",
"i18next": "^23.10.0",
"mongoose": "^7.0.2",
Expand Down
66 changes: 33 additions & 33 deletions typings.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,104 +9,104 @@ export type ComponentType = "button" | "selectmenu" | "autocomplete" | "modalSub
* @description Modified built-in client with support for command/event handlers.
*/
export interface MainClient extends Discord.Client {
commands: Discord.Collection<string, Command>;
cooldowns: Discord.Collection<string, Discord.Collection<string, number>>;
components: Discord.Collection<string, [Component]>;
dbguild: GuildDB;
dbuser: UserDB;
i18n: i18next;
commands: Discord.Collection<string, Command>;
cooldowns: Discord.Collection<string, Discord.Collection<string, number>>;
components: Discord.Collection<string, [Component]>;
dbguild: GuildDB;
dbuser: UserDB;
i18n: i18next;
};

/**
* @description Represents the program command.
*/
export interface Command {
data: Discord.SlashCommandBuilder | Discord.ContextMenuCommandBuilder;
options: {
cooldown?: number,
ownerOnly?: boolean,
devGuildOnly?: boolean,
bot_permissions?: Discord.PermissionResolvable
};
data: Discord.SlashCommandBuilder | Discord.ContextMenuCommandBuilder;
options: {
cooldown?: number,
ownerOnly?: boolean,
devGuildOnly?: boolean,
bot_permissions?: Discord.PermissionResolvable
};

execute(interaction: (Discord.ChatInputCommandInteraction | Discord.ContextMenuCommandInteraction) & { client: MainClient }): void | Promise<void>;
execute(interaction: (Discord.ChatInputCommandInteraction | Discord.ContextMenuCommandInteraction) & { client: MainClient }): void | Promise<void>;
};

/**
* @description Represents a component of the program.
*/
export interface Component {
name: string;
type: ComponentType;
options: {
cooldown?: number;
ownerOnly?: boolean;
devGuildOnly?: boolean;
bot_permissions?: [Discord.PermissionResolvable] | [];
};
name: string;
type: ComponentType;
options: {
cooldown?: number;
ownerOnly?: boolean;
devGuildOnly?: boolean;
bot_permissions?: [Discord.PermissionResolvable] | [];
};

execute(interaction: Discord.ButtonInteraction | Discord.AnySelectMenuInteraction | Discord.ModalSubmitInteraction | Discord.AutocompleteInteraction): Promise<void>;
execute(interaction: Discord.ButtonInteraction | Discord.AnySelectMenuInteraction | Discord.ModalSubmitInteraction | Discord.AutocompleteInteraction): Promise<void>;
}

/**
* @description Represents a button component of the program.
*/
export interface Button extends Component {
execute(interaction: Discord.ButtonInteraction): Promise<void>;
execute(interaction: Discord.ButtonInteraction): Promise<void>;
}

/**
* @description Represents a any select menu component of the program.
*/
export interface SelectMenu extends Component {
execute(interaction: Discord.StringSelectMenuInteraction | Discord.UserSelectMenuInteraction | Discord.MentionableSelectMenuInteraction | Discord.ChannelSelectMenuInteraction | Discord.RoleSelectMenuInteraction): Promise<void>;
execute(interaction: Discord.StringSelectMenuInteraction | Discord.UserSelectMenuInteraction | Discord.MentionableSelectMenuInteraction | Discord.ChannelSelectMenuInteraction | Discord.RoleSelectMenuInteraction): Promise<void>;
}

/**
* @description Represents a string select menu component of the program.
*/
export interface StringSelectMenu extends SelectMenu {
execute(interaction: Discord.StringSelectMenuInteraction): Promise<void>;
execute(interaction: Discord.StringSelectMenuInteraction): Promise<void>;
}

/**
* @description Represents a user select menu component of the program.
*/
export interface UserSelectMenu extends SelectMenu {
execute(interaction: Discord.UserSelectMenuInteraction): Promise<void>;
execute(interaction: Discord.UserSelectMenuInteraction): Promise<void>;
}

/**
* @description Represents a mentionable select menu component of the program.
*/
export interface MentionableSelectMenu extends SelectMenu {
execute(interaction: Discord.MentionableSelectMenuInteraction): Promise<void>;
execute(interaction: Discord.MentionableSelectMenuInteraction): Promise<void>;
}

/**
* @description Represents a channel select menu component of the program.
*/
export interface ChannelSelectMenu extends SelectMenu {
execute(interaction: Discord.ChannelSelectMenuInteraction): Promise<void>;
execute(interaction: Discord.ChannelSelectMenuInteraction): Promise<void>;
}

/**
* @description Represents a role select menu component of the program.
*/
export interface RoleSelectMenu extends SelectMenu {
execute(interaction: Discord.RoleSelectMenuInteraction): Promise<void>;
execute(interaction: Discord.RoleSelectMenuInteraction): Promise<void>;
}

/**
* @description Represents a modal submit component of the program.
*/
export interface Modal extends Component {
execute(interaction: Discord.ModalSubmitInteraction): Promise<void>;
execute(interaction: Discord.ModalSubmitInteraction): Promise<void>;
}

/**
* @description Represents a autocomplete component of the program.
*/
export interface Autocomplete extends Component {
execute(interaction: Discord.AutocompleteInteraction): Promise<void>;
}
execute(interaction: Discord.AutocompleteInteraction): Promise<void>;
}

0 comments on commit bab4e37

Please sign in to comment.