Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(deps): update all non-major dependencies #2668

Merged
merged 2 commits into from
Nov 2, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .github/workflows/continuous-delivery.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,15 +19,15 @@ jobs:
- name: Checkout Project
uses: actions/checkout@v4
- name: Setup Docker Buildx
uses: docker/setup-buildx-action@v3.6.1
uses: docker/setup-buildx-action@v3.7.1
- name: Login to GitHub Container Registry
uses: docker/login-action@v3.3.0
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Build and push Skyra Docker image
uses: docker/build-push-action@v6.7.0
uses: docker/build-push-action@v6.9.0
with:
push: true
context: .
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/publish-stable.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,15 +18,15 @@ jobs:
with:
ref: ${{ github.event.inputs.commit }}
- name: Setup Docker Buildx
uses: docker/setup-buildx-action@v3.6.1
uses: docker/setup-buildx-action@v3.7.1
- name: Login to GitHub Container Registry
uses: docker/login-action@v3.3.0
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Build and push Skyra Docker image
uses: docker/build-push-action@v6.7.0
uses: docker/build-push-action@v6.9.0
with:
push: true
context: .
Expand Down
6 changes: 3 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -51,8 +51,8 @@
"update": "yarn upgrade-interactive"
},
"dependencies": {
"@discordjs/builders": "^1.8.2",
"@discordjs/collection": "^2.1.0",
"@discordjs/builders": "^1.9.0",
"@discordjs/collection": "^2.1.1",
"@discordjs/core": "^1.2.0",
"@influxdata/influxdb-client": "^1.35.0",
"@influxdata/influxdb-client-apis": "^1.35.0",
Expand Down Expand Up @@ -85,7 +85,7 @@
"confusables": "^1.1.1",
"diff": "^5.2.0",
"discord-api-types": "0.37.98",
"discord.js": "~14.15.3",
"discord.js": "~14.16.3",
"he": "^1.2.0",
"zlib-sync": "^0.1.9"
},
Expand Down
8 changes: 6 additions & 2 deletions src/arguments/commandName.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { LanguageKeys } from '#lib/i18n/languageKeys';
import type { SkyraCommand } from '#lib/structures';
import { PermissionLevels } from '#lib/types';
import { PermissionLevels, type NonGroupMessage } from '#lib/types';
import { OWNERS } from '#root/config';
import { FuzzySearch } from '#utils/Parsers/FuzzySearch';
import { Argument, Command } from '@sapphire/framework';
Expand All @@ -13,7 +13,11 @@ export class UserArgument extends Argument<Command> {
return this.isAllowed(found, context) ? this.ok(found) : this.error({ parameter, identifier: LanguageKeys.Arguments.Command, context });
}

const command = await new FuzzySearch(commands, (command) => command.name, context.filter).run(context.message, parameter, context.minimum);
const command = await new FuzzySearch(commands, (command) => command.name, context.filter).run(
context.message as NonGroupMessage,
parameter,
context.minimum
);
if (command) return this.ok(command[1]);

return this.error({ parameter, identifier: LanguageKeys.Arguments.Command, context });
Expand Down
2 changes: 1 addition & 1 deletion src/lib/moderation/structures/SetUpModerationCommand.ts
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ export abstract class SetUpModerationCommand<Type extends RoleTypeVariation, Val
if (role) return undefined;

// If there
if (!(await isAdmin(message.member!))) {
if (!(await isAdmin(message.member))) {
this.error(LanguageKeys.Commands.Moderation.RestrictLowlevel);
}

Expand Down
3 changes: 2 additions & 1 deletion src/lib/types/Discord.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import type { GuildMember, Message } from 'discord.js';
import type { GuildMember, Message, OmitPartialGroupDMChannel } from 'discord.js';

export type GuildMessage = Message<true> & { member: GuildMember };
export type DMMessage = Message<false>;
export type NonGroupMessage = OmitPartialGroupDMChannel<Message<boolean>>;
6 changes: 3 additions & 3 deletions src/lib/util/Parsers/FuzzySearch.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import { LanguageKeys } from '#lib/i18n/languageKeys';
import type { NonGroupMessage } from '#lib/types';
import { promptForMessage } from '#utils/functions';
import { UserError } from '@sapphire/framework';
import { fetchT } from '@sapphire/plugin-i18next';
import { codeBlock } from '@sapphire/utilities';
import { decodeUtf8, jaroWinkler } from '@skyra/jaro-winkler';
import type { Message } from 'discord.js';

type FuzzySearchAccess<V> = (value: V) => string;
type FuzzySearchFilter<V> = (value: V) => boolean;
Expand All @@ -20,7 +20,7 @@ export class FuzzySearch<K extends string, V> {
this.kFilter = filter;
}

public run(message: Message, query: string, threshold?: number) {
public run(message: NonGroupMessage, query: string, threshold?: number) {
const lowerCaseQuery = query.toLowerCase();
const decodedLowerCaseQuery = decodeUtf8(lowerCaseQuery);
const results: [K, V, number][] = [];
Expand Down Expand Up @@ -75,7 +75,7 @@ export class FuzzySearch<K extends string, V> {
return this.select(message, sorted);
}

private async select(message: Message, results: [K, V, number][]) {
private async select(message: NonGroupMessage, results: [K, V, number][]) {
if (results.length === 1) return results[0];
if (results.length > 10) results.length = 10;

Expand Down
20 changes: 12 additions & 8 deletions src/lib/util/functions/messages.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import type { SkyraCommand } from '#lib/structures';
import type { TypedFT, TypedT } from '#lib/types';
import type { NonGroupMessage, TypedFT, TypedT } from '#lib/types';
import { floatPromise, minutes, resolveOnErrorCodes } from '#utils/common';
import { canReact, canRemoveAllReactions } from '@sapphire/discord.js-utilities';
import { container } from '@sapphire/framework';
Expand Down Expand Up @@ -149,11 +149,11 @@ const enum PromptConfirmationReactions {
No = '🇳'
}

async function promptConfirmationReaction(message: Message, response: Message, options: PromptConfirmationMessageOptions) {
async function promptConfirmationReaction(message: NonGroupMessage, response: NonGroupMessage, options: PromptConfirmationMessageOptions) {
await response.react(PromptConfirmationReactions.Yes);
await response.react(PromptConfirmationReactions.No);

const target = container.client.users.resolveId(options.target ?? message.author)!;
const target = container.client.users.resolveId(options.target ?? message.author);
const reactions = await response.awaitReactions({ filter: (__, user) => user.id === target, time: minutes(1), max: 1 });

// Remove all reactions if the user has permissions to do so
Expand All @@ -165,8 +165,8 @@ async function promptConfirmationReaction(message: Message, response: Message, o
}

const promptConfirmationMessageRegExp = /^y|yes?|yeah?$/i;
async function promptConfirmationMessage(message: Message, response: Message, options: PromptConfirmationMessageOptions) {
const target = container.client.users.resolveId(options.target ?? message.author)!;
async function promptConfirmationMessage(message: NonGroupMessage, response: NonGroupMessage, options: PromptConfirmationMessageOptions) {
const target = container.client.users.resolveId(options.target ?? message.author);
const messages = await response.channel.awaitMessages({ filter: (message) => message.author.id === target, time: minutes(1), max: 1 });

return messages.size === 0 ? null : promptConfirmationMessageRegExp.test(messages.first()!.content);
Expand All @@ -178,17 +178,21 @@ async function promptConfirmationMessage(message: Message, response: Message, op
* @param options The options for the message to be sent, alongside the prompt options.
* @returns `null` if no response was given within the requested time, `boolean` otherwise.
*/
export async function promptConfirmation(message: Message, options: string | PromptConfirmationMessageOptions) {
export async function promptConfirmation(message: NonGroupMessage, options: string | PromptConfirmationMessageOptions) {
if (typeof options === 'string') options = { content: options };

// TODO: v13 | Switch to buttons only when available.
const response = await send(message, options);
const response = (await send(message, options)) as NonGroupMessage;
return canReact(response.channel)
? promptConfirmationReaction(message, response, options)
: promptConfirmationMessage(message, response, options);
}

export async function promptForMessage(message: Message, sendOptions: string | MessageCreateOptions, time = minutes(1)): Promise<string | null> {
export async function promptForMessage(
message: NonGroupMessage,
sendOptions: string | MessageCreateOptions,
time = minutes(1)
): Promise<string | null> {
const response = await message.channel.send(sendOptions);
const responses = await message.channel.awaitMessages({ filter: (msg) => msg.author === message.author, time, max: 1 });
floatPromise(deleteMessage(response));
Expand Down
4 changes: 2 additions & 2 deletions src/listeners/messages/messageDeleteBulkRemoveResponses.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@ import { ApplyOptions } from '@sapphire/decorators';
import { Listener } from '@sapphire/framework';
import { get } from '@sapphire/plugin-editable-commands';
import { hasAtLeastOneKeyInMap } from '@sapphire/utilities';
import { Collection, type Message, type Snowflake } from 'discord.js';
import type { Message, OmitPartialGroupDMChannel, ReadonlyCollection } from 'discord.js';

type MessageCollection = Collection<Snowflake, Message>;
type MessageCollection = ReadonlyCollection<string, OmitPartialGroupDMChannel<Message<boolean>>>;

@ApplyOptions<Listener.Options>({ event: Events.MessageDeleteBulk })
export class UserListener extends Listener<Events.MessageDeleteBulk> {
Expand Down
4 changes: 2 additions & 2 deletions src/listeners/twitch/twitchStreamOffline.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import { streamNotificationDrip } from '#utils/twitch';
import { extractDetailedMentions } from '#utils/util';
import { TimestampStyles, time } from '@discordjs/builders';
import { ApplyOptions } from '@sapphire/decorators';
import { canSendMessages, type TextBasedChannelTypes } from '@sapphire/discord.js-utilities';
import { canSendMessages, type GuildTextBasedChannelTypes } from '@sapphire/discord.js-utilities';
import { Listener } from '@sapphire/framework';
import type { TFunction } from '@sapphire/plugin-i18next';
import { fetchT } from '@sapphire/plugin-i18next';
Expand Down Expand Up @@ -42,7 +42,7 @@ export class UserListener extends Listener<Events.TwitchStreamOffline> {
const t = await fetchT(guild);

// Retrieve the channel to send the message to
const channel = guild.channels.cache.get(guildSubscription.channelId) as TextBasedChannelTypes;
const channel = guild.channels.cache.get(guildSubscription.channelId) as GuildTextBasedChannelTypes;
if (isNullish(channel) || !canSendMessages(channel)) {
continue;
}
Expand Down
6 changes: 3 additions & 3 deletions src/listeners/twitch/twitchStreamOnline.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,15 @@ import { streamNotificationDrip } from '#utils/twitch';
import { extractDetailedMentions } from '#utils/util';
import { EmbedBuilder } from '@discordjs/builders';
import { ApplyOptions } from '@sapphire/decorators';
import { canSendMessages, type TextBasedChannelTypes } from '@sapphire/discord.js-utilities';
import { canSendMessages, type GuildTextBasedChannelTypes } from '@sapphire/discord.js-utilities';
import { Listener } from '@sapphire/framework';
import type { TFunction } from '@sapphire/plugin-i18next';
import { fetchT } from '@sapphire/plugin-i18next';
import { isNullish } from '@sapphire/utilities';
import {
fetchStream,
TwitchBrandingColor,
TwitchEventSubTypes,
fetchStream,
type TwitchEventSubOnlineEvent,
type TwitchHelixStreamsResult,
type TwitchOnlineEmbedData
Expand Down Expand Up @@ -56,7 +56,7 @@ export class UserListener extends Listener<Events.TwitchStreamOnline> {
const t = await fetchT(guild);

// Retrieve the channel to send the message to
const channel = guild.channels.cache.get(guildSubscription.channelId) as TextBasedChannelTypes;
const channel = guild.channels.cache.get(guildSubscription.channelId) as GuildTextBasedChannelTypes;
if (isNullish(channel) || !canSendMessages(channel)) {
continue;
}
Expand Down
Loading