Skip to content

Commit

Permalink
feat(deps): support for djs v14
Browse files Browse the repository at this point in the history
  • Loading branch information
favna committed Dec 30, 2022
1 parent 2993951 commit fc7bac3
Show file tree
Hide file tree
Showing 8 changed files with 400 additions and 564 deletions.
14 changes: 7 additions & 7 deletions package.json
Expand Up @@ -22,21 +22,21 @@
"@favware/cliff-jumper": "^1.9.0",
"@favware/npm-deprecate": "^1.0.7",
"@sapphire/eslint-config": "^4.3.8",
"@sapphire/framework": "^3.1.4",
"@sapphire/framework": "pr-512",
"@sapphire/pieces": "^3.6.0",
"@sapphire/prettier-config": "^1.4.4",
"@sapphire/stopwatch": "^1.5.0",
"@sapphire/ts-config": "^3.3.4",
"@sapphire/utilities": "^3.11.0",
"@types/node": "^18.11.17",
"@types/node": "^18.11.18",
"@types/node-fetch": "^2.6.2",
"@types/ws": "^8.5.3",
"@typescript-eslint/eslint-plugin": "^5.47.0",
"@typescript-eslint/parser": "^5.47.0",
"@types/ws": "^8.5.4",
"@typescript-eslint/eslint-plugin": "^5.47.1",
"@typescript-eslint/parser": "^5.47.1",
"@vitest/coverage-c8": "^0.26.2",
"cz-conventional-changelog": "^3.3.0",
"discord-api-types": "^0.33.5",
"discord.js": "^13.12.0",
"discord-api-types": "^0.37.25",
"discord.js": "^14.7.1",
"eslint": "^8.30.0",
"eslint-config-prettier": "^8.5.0",
"eslint-plugin-prettier": "^4.2.1",
Expand Down
2 changes: 1 addition & 1 deletion packages/api/package.json
Expand Up @@ -39,7 +39,7 @@
"dependencies": {
"@types/node-fetch": "2.6.2",
"@types/psl": "^1.1.0",
"@types/ws": "^8.5.3",
"@types/ws": "^8.5.4",
"node-fetch": "2.6.7",
"psl": "^1.9.0",
"tslib": "^2.4.1"
Expand Down
2 changes: 1 addition & 1 deletion packages/editable-commands/package.json
Expand Up @@ -36,7 +36,7 @@
"check-update": "cliff-jumper --dry-run"
},
"dependencies": {
"@skyra/editable-commands": "^2.1.4",
"@skyra/editable-commands": "^3.0.0",
"tslib": "^2.4.1"
},
"repository": {
Expand Down
8 changes: 4 additions & 4 deletions packages/i18next/src/lib/functions.ts
@@ -1,7 +1,7 @@
import { container } from '@sapphire/pieces';
import { lazy, type NonNullObject } from '@sapphire/utilities';
import { APIApplicationCommandOptionChoice, Locale, type LocaleString } from 'discord-api-types/v10';
import { BaseCommandInteraction, Guild, Message, MessageComponentInteraction } from 'discord.js';
import { APIApplicationCommandOptionChoice, ChannelType, Locale, type LocaleString } from 'discord-api-types/v10';
import { CommandInteraction, Guild, Message, MessageComponentInteraction } from 'discord.js';
import type { TFuncKey, TOptions } from 'i18next';
import type {
BuilderWithDescription,
Expand Down Expand Up @@ -29,7 +29,7 @@ import type {
*/
export function fetchLanguage(target: Target): Promise<string> {
// Handle Interactions:
if (target instanceof BaseCommandInteraction || target instanceof MessageComponentInteraction) {
if (target instanceof CommandInteraction || target instanceof MessageComponentInteraction) {
return resolveLanguage({
user: target.user,
channel: target.channel,
Expand All @@ -50,7 +50,7 @@ export function fetchLanguage(target: Target): Promise<string> {
}

// Handle DMChannel:
if (target.type === 'DM') {
if (target.type === ChannelType.DM) {
return resolveLanguage({ user: null, channel: target, guild: null });
}

Expand Down
16 changes: 3 additions & 13 deletions packages/i18next/src/lib/types.ts
Expand Up @@ -2,17 +2,7 @@ import type { Awaitable } from '@sapphire/utilities';
import type { Backend } from '@skyra/i18next-backend';
import type { WatchOptions } from 'chokidar';
import type { LocalizationMap } from 'discord-api-types/v10';
import type {
BaseCommandInteraction,
Guild,
Interaction,
Message,
MessageComponentInteraction,
StageChannel,
StoreChannel,
User,
VoiceChannel
} from 'discord.js';
import type { CommandInteraction, Guild, Interaction, Message, MessageComponentInteraction, StageChannel, User, VoiceChannel } from 'discord.js';
import type { DefaultTFuncReturnWithObject, InitOptions, Namespace, TFuncKey, TFuncReturn, TypeOptions } from 'i18next';

export interface StringMap {
Expand Down Expand Up @@ -137,7 +127,7 @@ export interface InternationalizationOptions {
}

export type TextBasedDiscordChannel = Message['channel'];
export type DiscordChannel = TextBasedDiscordChannel | StoreChannel | StageChannel | VoiceChannel;
export type DiscordChannel = TextBasedDiscordChannel | StageChannel | VoiceChannel;

/**
* Context for {@link InternationalizationHandler.fetchLanguage} functions.
Expand Down Expand Up @@ -180,4 +170,4 @@ export interface BuilderWithDescription {

export type BuilderWithNameAndDescription = BuilderWithName & BuilderWithDescription;
export type ChannelTarget = Message | DiscordChannel;
export type Target = BaseCommandInteraction | ChannelTarget | Guild | MessageComponentInteraction;
export type Target = CommandInteraction | ChannelTarget | Guild | MessageComponentInteraction;
6 changes: 3 additions & 3 deletions packages/pattern-commands/src/listeners/PluginMessageParse.ts
@@ -1,13 +1,13 @@
import { GuildBasedChannelTypes, isDMChannel } from '@sapphire/discord.js-utilities';
import { Events, Listener } from '@sapphire/framework';
import type { PieceContext } from '@sapphire/pieces';
import { Message, Permissions } from 'discord.js';
import { Message, PermissionFlagsBits, PermissionsBitField } from 'discord.js';
import type { PatternCommandStore } from '../lib/structures/PaternCommandStore';
import { PatternCommandEvents } from '../lib/utils/PaternCommandEvents';
import type { PossiblePatternCommand } from '../lib/utils/PatternCommandInterfaces';

export class MessageParseListener extends Listener<typeof Events.PreMessageParsed> {
private readonly requiredPermissions = new Permissions(['VIEW_CHANNEL', 'SEND_MESSAGES']).freeze();
private readonly requiredPermissions = new PermissionsBitField([PermissionFlagsBits.ViewChannel, PermissionFlagsBits.SendMessages]).freeze();
public constructor(context: PieceContext) {
super(context, { event: Events.PreMessageParsed });
}
Expand Down Expand Up @@ -89,7 +89,7 @@ export class MessageParseListener extends Listener<typeof Events.PreMessageParse
private async canRunInChannel(message: Message): Promise<boolean> {
if (isDMChannel(message.channel)) return true;

const me = message.guild!.me ?? (message.client.id ? await message.guild!.members.fetch(message.client.id) : null);
const me = await message.guild?.members.fetchMe();
if (!me) return false;

const channel = message.channel as GuildBasedChannelTypes;
Expand Down
4 changes: 2 additions & 2 deletions packages/subcommands/src/lib/Subcommand.ts
Expand Up @@ -384,8 +384,8 @@ export namespace Subcommand {
export type JSON = Command.JSON;
export type Context = Command.Context;
export type RunInTypes = Command.RunInTypes;
export type ChatInputInteraction<Cached extends CacheType = CacheType> = Command.ChatInputInteraction<Cached>;
export type ContextMenuInteraction<Cached extends CacheType = CacheType> = Command.ContextMenuInteraction<Cached>;
export type ChatInputInteraction<Cached extends CacheType = CacheType> = Command.ChatInputCommandInteraction<Cached>;
export type ContextMenuInteraction<Cached extends CacheType = CacheType> = Command.ContextMenuCommandInteraction<Cached>;
export type AutocompleteInteraction<Cached extends CacheType = CacheType> = Command.AutocompleteInteraction<Cached>;
export type Registry = Command.Registry;
}

0 comments on commit fc7bac3

Please sign in to comment.