Skip to content
This repository has been archived by the owner on Jul 23, 2024. It is now read-only.

Commit

Permalink
Merge pull request #72 from greencoast-studios/develop
Browse files Browse the repository at this point in the history
Version 3.0.1
  • Loading branch information
moonstar-x authored Jul 23, 2023
2 parents a2269f9 + 747cb62 commit b8959f3
Show file tree
Hide file tree
Showing 23 changed files with 111 additions and 75 deletions.
8 changes: 4 additions & 4 deletions __mocks__/local/dataProvider.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { DataProvider } from '../../src';
import { DataProvider, ClearableDataProvider } from '../../src';

export class ConcreteDataProvider extends DataProvider {
export class ConcreteDataProvider extends DataProvider implements ClearableDataProvider {
public override init(): Promise<this> {
return Promise.resolve(this);
}
Expand All @@ -25,10 +25,10 @@ export class ConcreteDataProvider extends DataProvider {
public override deleteGlobal(): Promise<any> {
return Promise.resolve();
}
public override clear(): Promise<void> {
public clear(): Promise<void> {
return Promise.resolve();
}
public override clearGlobal(): Promise<void> {
public clearGlobal(): Promise<void> {
return Promise.resolve();
}
}
2 changes: 1 addition & 1 deletion package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@greencoast/discord.js-extended",
"version": "3.0.0",
"version": "3.0.1",
"description": "An utility to facilitate the repetitive tasks when creating discord bots. Used by Greencoast Studios.",
"main": "./dist/index.js",
"types": "./dist/index.d.ts",
Expand Down
2 changes: 1 addition & 1 deletion src/classes/ExtendedClient.ts
Original file line number Diff line number Diff line change
Expand Up @@ -207,7 +207,7 @@ export class ExtendedClient extends Client {

/**
* Test whether the specified user is the client's owner.
* @param user The [user](https://discord.js.org/#/docs/discord.js/stable/class/User) to test.
* @param user The [user](https://old.discordjs.dev/#/docs/discord.js/main/class/User) to test.
* @returns Whether the tested user is the client's owner.
* @throws Throws if the user cannot be resolved.
*/
Expand Down
10 changes: 5 additions & 5 deletions src/classes/command/Command.ts
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ export abstract class Command<T extends CommandTrigger> {
public readonly ownerOnly: boolean;

/**
* The [permissions resolvable](https://discord.js.org/#/docs/main/stable/typedef/PermissionResolvable) that
* The [permissions resolvable](https://old.discordjs.dev/#/docs/discord.js/main/typedef/PermissionResolvablee) that
* defines the permissions that a user requires to execute this command.
* @type {(PermissionResolvable | null)}
* @memberof Command
Expand Down Expand Up @@ -124,17 +124,17 @@ export abstract class Command<T extends CommandTrigger> {

/**
* Check whether the message author can execute this command.
* @param trigger The [message](https://discord.js.org/#/docs/discord.js/stable/class/Message) or
* [interaction](https://discord.js.org/#/docs/discord.js/stable/class/Interaction) that triggered this command.
* @param trigger The [message](https://old.discordjs.dev/#/docs/discord.js/main/class/Message) or
* [interaction](https://old.discordjs.dev/#/docs/discord.js/main/class/ChatInputCommandInteraction) that triggered this command.
* @returns `true` if the user has enough permissions, or a string with the reason why they cannot execute this command.
*/
public abstract hasPermission(trigger: T): boolean | string;

/**
* Handle command error.
* @param error The error that was thrown inside the command's run method.
* @param trigger The [message](https://discord.js.org/#/docs/discord.js/stable/class/Message) or
* [interaction](https://discord.js.org/#/docs/discord.js/stable/class/Interaction) that triggered this command.
* @param trigger The [message](https://old.discordjs.dev/#/docs/discord.js/main/class/Message) or
* [interaction](https://old.discordjs.dev/#/docs/discord.js/main/class/ChatInputCommandInteraction) that triggered this command.
* @returns A promise that resolves the message that was replied to the original message author (if available).
* @emits `client#commandError`
*/
Expand Down
4 changes: 2 additions & 2 deletions src/classes/command/CommandDispatcher.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ export class CommandDispatcher {

/**
* Handles command fetching and execution for message based commands (RegularCommand).
* @param message The [message](https://discord.js.org/#/docs/discord.js/stable/class/Message) that triggered this handler.
* @param message The [message](https://old.discordjs.dev/#/docs/discord.js/main/class/Message) that triggered this handler.
* @emits `client#commandExecute`
*/
public async handleMessage(message: Message): Promise<void> {
Expand Down Expand Up @@ -72,7 +72,7 @@ export class CommandDispatcher {

/**
* Handles command fetching and execution for slash commands.
* @param interaction The [interaction](https://discord.js.org/#/docs/discord.js/stable/class/Interaction) that triggered this handler.
* @param interaction The [interaction](https://old.discordjs.dev/#/docs/discord.js/main/class/ChatInputCommandInteraction) that triggered this handler.
* @emits `client#commandExecute`
*/
public async handleInteraction(interaction: Interaction): Promise<void> {
Expand Down
2 changes: 1 addition & 1 deletion src/classes/command/CommandGroup.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ export class CommandGroup {
public readonly name: string;

/**
* A [collection](https://discord.js.org/#/docs/collection/master/class/Collection) of the commands
* A [collection](https://discord.js.org/docs/packages/collection/main/Collection:Class) of the commands
* registered to this group, mapped by the command's name and the command.
* @type {Collection<string, Command>}
* @memberof CommandGroup
Expand Down
4 changes: 2 additions & 2 deletions src/classes/command/CommandRegistry.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,15 +19,15 @@ export class CommandRegistry {
public readonly client: ExtendedClient;

/**
* A [collection](https://discord.js.org/#/docs/collection/master/class/Collection) of the commands registered
* A [collection](https://discord.js.org/docs/packages/collection/main/Collection:Class) of the commands registered
* to this registry, mapped by the command's name and the command.
* @type {Collection<string, Command>}
* @memberof CommandRegistry
*/
public readonly commands: Collection<string, Command<CommandTrigger>>;

/**
* A [collection](https://discord.js.org/#/docs/collection/master/class/Collection) of the groups registered
* A [collection](https://discord.js.org/docs/packages/collection/main/Collection:Class) of the groups registered
* to this registry, mapped by the group's ID and the group.
* @type {Collection<string, CommandGroup>}
* @memberof CommandRegistry
Expand Down
6 changes: 3 additions & 3 deletions src/classes/command/RegularCommand.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,14 @@ import { Command } from './Command';
export abstract class RegularCommand extends Command<Message> {
/**
* Abstract method. You need to implement this method in order for the command to work. This defines the execution behavior of the command.
* @param message The [message](https://discord.js.org/#/docs/discord.js/stable/class/Message) that triggered this command.
* @param message The [message](https://old.discordjs.dev/#/docs/discord.js/main/class/Message) that triggered this command.
* @param args The arguments passed to this command.
*/
public abstract run(message: Message, args: string[]): Promise<void>;

/**
* Check whether the message author can execute this command.
* @param message The [message](https://discord.js.org/#/docs/discord.js/stable/class/Message) that triggered this command.
* @param message The [message](https://old.discordjs.dev/#/docs/discord.js/main/class/Message) that triggered this command.
* @returns `true` if the user has enough permissions, or a string with the reason why they cannot execute this command.
*/
public override hasPermission(message: Message): boolean | string {
Expand Down Expand Up @@ -57,7 +57,7 @@ export abstract class RegularCommand extends Command<Message> {
/**
* Handle command error.
* @param error The error that was thrown inside the command's run method.
* @param message The [message](https://discord.js.org/#/docs/discord.js/stable/class/Message) that triggered this command.
* @param message The [message](https://old.discordjs.dev/#/docs/discord.js/main/class/Message) that triggered this command.
* @emits `client#commandError`
*/
public override async onError(error: unknown, message: Message): Promise<void> {
Expand Down
6 changes: 3 additions & 3 deletions src/classes/command/SlashCommand.ts
Original file line number Diff line number Diff line change
Expand Up @@ -66,13 +66,13 @@ export abstract class SlashCommand extends Command<ChatInputCommandInteraction>

/**
* Abstract method. You need to implement this method in order for the command to work. This defines the execution behavior of the command.
* @param interaction The [interaction](https://discord.js.org/#/docs/discord.js/stable/class/ChatInputCommandInteraction) that triggered this command.
* @param interaction The [interaction](https://old.discordjs.dev/#/docs/discord.js/main/class/ChatInputCommandInteraction) that triggered this command.
*/
public abstract run(interaction: ChatInputCommandInteraction): Promise<void>;

/**
* Check whether the interaction author can execute this command.
* @param interaction The [interaction](https://discord.js.org/#/docs/discord.js/stable/class/ChatInputCommandInteraction) that triggered this command.
* @param interaction The [interaction](https://old.discordjs.dev/#/docs/discord.js/main/class/ChatInputCommandInteraction) that triggered this command.
* @returns `true` if the user has enough permissions, or a string with the reason why they cannot execute this command.
*/
public override hasPermission(interaction: ChatInputCommandInteraction): boolean | string {
Expand Down Expand Up @@ -112,7 +112,7 @@ export abstract class SlashCommand extends Command<ChatInputCommandInteraction>
/**
* Handle command error.
* @param error The error that was thrown inside the command's run method.
* @param interaction The [interaction](https://discord.js.org/#/docs/discord.js/stable/class/ChatInputCommandInteraction) that triggered this command.
* @param interaction The [interaction](https://old.discordjs.dev/#/docs/discord.js/main/class/ChatInputCommandInteraction) that triggered this command.
* @emits `client#commandError`
*/
public override async onError(error: unknown, interaction: ChatInputCommandInteraction): Promise<void> {
Expand Down
4 changes: 2 additions & 2 deletions src/classes/command/SlashCommandDeployer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ export class SlashCommandDeployer {

/**
* Deploy the commands registered to this deployer's client registry to a given guild.
* @param guildID The ID of the [guild](https://discord.js.org/#/docs/discord.js/stable/class/Guild) to deploy the commands to.
* @param guildID The ID of the [guild](https://old.discordjs.dev/#/docs/discord.js/main/class/Guild) to deploy the commands to.
* @returns A promise that resolves once all the commands have been deployed.
* @emits `client#commandDeployed`
* @emits `client#error`
Expand All @@ -77,7 +77,7 @@ export class SlashCommandDeployer {

/**
* Deploy the commands registered to this deployer's client registry to multiple guilds.
* @param guildIDs An array with the IDs of the [guilds](https://discord.js.org/#/docs/discord.js/stable/class/Guild) to deploy the commands to.
* @param guildIDs An array with the IDs of the [guilds](https://old.discordjs.dev/#/docs/discord.js/main/class/Guild) to deploy the commands to.
* @returns A promise that resolves once all the commands have been deployed.
* @emits `client#commandDeployed`
* @emits `client#error`
Expand Down
4 changes: 2 additions & 2 deletions src/classes/command/default/regular/HelpRegularCommand.ts
Original file line number Diff line number Diff line change
Expand Up @@ -60,8 +60,8 @@ export class HelpRegularCommand extends RegularCommand {
* ```text
* $help
* ```
* @param message The [message](https://discord.js.org/#/docs/discord.js/stable/class/Message) that triggered this command.
* @returns The [message](https://discord.js.org/#/docs/discord.js/stable/class/Message) where the help message embed was sent.
* @param message The [message](https://old.discordjs.dev/#/docs/discord.js/main/class/Message) that triggered this command.
* @returns The [message](https://old.discordjs.dev/#/docs/discord.js/main/class/Message) where the help message embed was sent.
*/
public async run(message: Message): Promise<void> {
const embed = new EmbedBuilder();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ export class SetLocaleRegularCommand extends RegularCommand {
* ```text
* /set_locale <locale>
* ```
* @param message The [message](https://discord.js.org/#/docs/discord.js/stable/class/Message) that triggered this command.
* @param message The [message](https://old.discordjs.dev/#/docs/discord.js/main/class/Message) that triggered this command.
* @param args The arguments passed to this command.
*/
public async run(message: Message, args: string[]): Promise<void> {
Expand Down
2 changes: 1 addition & 1 deletion src/classes/command/default/slash/HelpSlashCommand.ts
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ export class HelpSlashCommand extends SlashCommand {
* ```text
* $help
* ```
* @param interaction The [interaction](https://discord.js.org/#/docs/discord.js/stable/class/CommandInteraction) that triggered this command.
* @param interaction The [interaction](https://old.discordjs.dev/#/docs/discord.js/main/class/ChatInputCommandInteraction) that triggered this command.
*/
public async run(interaction: ChatInputCommandInteraction): Promise<void> {
const embed = new EmbedBuilder();
Expand Down
2 changes: 1 addition & 1 deletion src/classes/command/default/slash/SetLocaleSlashCommand.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ export class SetLocaleSlashCommand extends SlashCommand {
* ```text
* /set_locale <locale>
* ```
* @param interaction The [interaction](https://discord.js.org/#/docs/discord.js/stable/class/CommandInteraction) that triggered this command.
* @param interaction The [interaction](https://old.discordjs.dev/#/docs/discord.js/main/class/ChatInputCommandInteraction) that triggered this command.
*/
public async run(interaction: ChatInputCommandInteraction): Promise<void> {
const localizer = this.client.localizer!.getLocalizer(interaction.guild!)!; // We know it comes from a guild because of guildOnly.
Expand Down
Loading

0 comments on commit b8959f3

Please sign in to comment.