Skip to content

Commit 37fdcb4

Browse files
authoredFeb 18, 2023
fix: typescript fix for discord-api-types 0.37.35 (#608)
1 parent 530475c commit 37fdcb4

File tree

5 files changed

+388
-512
lines changed

5 files changed

+388
-512
lines changed
 

‎.github/renovate.json

+10-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,13 @@
11
{
22
"$schema": "https://docs.renovatebot.com/renovate-schema.json",
3-
"extends": ["github>sapphiredev/readme:sapphire-renovate"]
3+
"extends": ["github>sapphiredev/readme:sapphire-renovate"],
4+
"labels": ["Meta: Dependencies"],
5+
"npm": {
6+
"packageRules": [
7+
{
8+
"matchPackagePatterns": ["tsup"],
9+
"enabled": false
10+
}
11+
]
12+
}
413
}

‎package.json

+11-11
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@
3030
"dependencies": {
3131
"@discordjs/builders": "^1.4.0",
3232
"@sapphire/discord-utilities": "^3.0.0",
33-
"@sapphire/discord.js-utilities": "6.0.1",
33+
"@sapphire/discord.js-utilities": "6.0.2",
3434
"@sapphire/lexure": "^1.1.2",
3535
"@sapphire/pieces": "^3.6.0",
3636
"@sapphire/ratelimits": "^2.4.5",
@@ -39,19 +39,19 @@
3939
"@sapphire/utilities": "^3.11.0"
4040
},
4141
"devDependencies": {
42-
"@commitlint/cli": "^17.4.2",
43-
"@commitlint/config-conventional": "^17.4.2",
42+
"@commitlint/cli": "^17.4.4",
43+
"@commitlint/config-conventional": "^17.4.4",
4444
"@favware/cliff-jumper": "^1.10.0",
4545
"@favware/npm-deprecate": "^1.0.7",
4646
"@favware/rollup-type-bundler": "^2.0.0",
4747
"@sapphire/eslint-config": "^4.3.8",
4848
"@sapphire/prettier-config": "^1.4.5",
4949
"@sapphire/ts-config": "^3.3.4",
50-
"@types/node": "^18.13.0",
50+
"@types/node": "^18.14.0",
5151
"@types/ws": "^8.5.4",
52-
"@typescript-eslint/eslint-plugin": "^5.51.0",
53-
"@typescript-eslint/parser": "^5.51.0",
54-
"@vitest/coverage-c8": "^0.28.4",
52+
"@typescript-eslint/eslint-plugin": "^5.52.0",
53+
"@typescript-eslint/parser": "^5.52.0",
54+
"@vitest/coverage-c8": "^0.28.5",
5555
"cz-conventional-changelog": "^3.3.0",
5656
"discord.js": "^14.7.1",
5757
"esbuild-plugin-file-path-extensions": "^1.0.0",
@@ -62,16 +62,16 @@
6262
"eslint-plugin-prettier": "^4.2.1",
6363
"gen-esm-wrapper": "^1.1.3",
6464
"husky": "^8.0.3",
65-
"lint-staged": "^13.1.1",
65+
"lint-staged": "^13.1.2",
6666
"pinst": "^3.0.0",
6767
"prettier": "^2.8.4",
6868
"pretty-quick": "^3.1.3",
69-
"tsup": "^6.6.0",
69+
"tsup": "6.6.2",
7070
"typedoc": "^0.23.25",
7171
"typedoc-json-parser": "^7.1.0",
7272
"typescript": "^4.9.5",
73-
"vite": "^4.1.1",
74-
"vitest": "^0.28.4"
73+
"vite": "^4.1.2",
74+
"vitest": "^0.28.5"
7575
},
7676
"repository": {
7777
"type": "git",

‎src/lib/resolvers/message.ts

+6-3
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import {
44
isAnyInteraction,
55
isGuildBasedChannel,
66
isNewsChannel,
7+
isStageChannel,
78
isTextBasedChannel,
89
isTextChannel,
910
type GuildBasedChannelTypes,
@@ -50,17 +51,19 @@ export async function resolveMessage(parameter: string, options: MessageResolver
5051
}
5152

5253
function resolveById(parameter: string, options: MessageResolverOptions): Awaitable<Message | null> {
53-
if (!SnowflakeRegex.test(parameter)) {
54+
if (!SnowflakeRegex.test(parameter) || isStageChannel(options.messageOrInteraction.channel)) {
5455
return null;
5556
}
5657

57-
if (options.channel) {
58+
if (options.channel && !isStageChannel(options.channel)) {
5859
return options.channel.messages.fetch(parameter as Snowflake);
5960
}
6061

6162
if (options.scan && isGuildBasedChannel(options.messageOrInteraction.channel)) {
6263
for (const channel of options.messageOrInteraction.channel.guild.channels.cache.values()) {
63-
if (!isTextBasedChannel(channel)) continue;
64+
if (!isTextBasedChannel(channel) || isStageChannel(channel)) {
65+
continue;
66+
}
6467

6568
const message = channel.messages.cache.get(parameter);
6669
if (message) {

‎src/optional-listeners/message-command-listeners/CoreMessageCommandTyping.ts

+4-1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import { isStageChannel } from '@sapphire/discord.js-utilities';
12
import type { Message } from 'discord.js';
23
import type { MessageCommand } from '../../lib/structures/Command';
34
import { Listener } from '../../lib/structures/Listener';
@@ -10,7 +11,9 @@ export class CoreListener extends Listener<typeof Events.MessageCommandRun> {
1011
}
1112

1213
public async run(message: Message, command: MessageCommand, payload: MessageCommandRunPayload) {
13-
if (!command.typing) return;
14+
if (!command.typing || isStageChannel(message.channel)) {
15+
return;
16+
}
1417

1518
try {
1619
await message.channel.sendTyping();

‎yarn.lock

+357-496
Large diffs are not rendered by default.

0 commit comments

Comments
 (0)
Please sign in to comment.