Skip to content

Commit

Permalink
fix: typescript fix for discord-api-types 0.37.35 (#608)
Browse files Browse the repository at this point in the history
  • Loading branch information
favna authored Feb 18, 2023
1 parent 530475c commit 37fdcb4
Show file tree
Hide file tree
Showing 5 changed files with 388 additions and 512 deletions.
11 changes: 10 additions & 1 deletion .github/renovate.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,13 @@
{
"$schema": "https://docs.renovatebot.com/renovate-schema.json",
"extends": ["github>sapphiredev/readme:sapphire-renovate"]
"extends": ["github>sapphiredev/readme:sapphire-renovate"],
"labels": ["Meta: Dependencies"],
"npm": {
"packageRules": [
{
"matchPackagePatterns": ["tsup"],
"enabled": false
}
]
}
}
22 changes: 11 additions & 11 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
"dependencies": {
"@discordjs/builders": "^1.4.0",
"@sapphire/discord-utilities": "^3.0.0",
"@sapphire/discord.js-utilities": "6.0.1",
"@sapphire/discord.js-utilities": "6.0.2",
"@sapphire/lexure": "^1.1.2",
"@sapphire/pieces": "^3.6.0",
"@sapphire/ratelimits": "^2.4.5",
Expand All @@ -39,19 +39,19 @@
"@sapphire/utilities": "^3.11.0"
},
"devDependencies": {
"@commitlint/cli": "^17.4.2",
"@commitlint/config-conventional": "^17.4.2",
"@commitlint/cli": "^17.4.4",
"@commitlint/config-conventional": "^17.4.4",
"@favware/cliff-jumper": "^1.10.0",
"@favware/npm-deprecate": "^1.0.7",
"@favware/rollup-type-bundler": "^2.0.0",
"@sapphire/eslint-config": "^4.3.8",
"@sapphire/prettier-config": "^1.4.5",
"@sapphire/ts-config": "^3.3.4",
"@types/node": "^18.13.0",
"@types/node": "^18.14.0",
"@types/ws": "^8.5.4",
"@typescript-eslint/eslint-plugin": "^5.51.0",
"@typescript-eslint/parser": "^5.51.0",
"@vitest/coverage-c8": "^0.28.4",
"@typescript-eslint/eslint-plugin": "^5.52.0",
"@typescript-eslint/parser": "^5.52.0",
"@vitest/coverage-c8": "^0.28.5",
"cz-conventional-changelog": "^3.3.0",
"discord.js": "^14.7.1",
"esbuild-plugin-file-path-extensions": "^1.0.0",
Expand All @@ -62,16 +62,16 @@
"eslint-plugin-prettier": "^4.2.1",
"gen-esm-wrapper": "^1.1.3",
"husky": "^8.0.3",
"lint-staged": "^13.1.1",
"lint-staged": "^13.1.2",
"pinst": "^3.0.0",
"prettier": "^2.8.4",
"pretty-quick": "^3.1.3",
"tsup": "^6.6.0",
"tsup": "6.6.2",
"typedoc": "^0.23.25",
"typedoc-json-parser": "^7.1.0",
"typescript": "^4.9.5",
"vite": "^4.1.1",
"vitest": "^0.28.4"
"vite": "^4.1.2",
"vitest": "^0.28.5"
},
"repository": {
"type": "git",
Expand Down
9 changes: 6 additions & 3 deletions src/lib/resolvers/message.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import {
isAnyInteraction,
isGuildBasedChannel,
isNewsChannel,
isStageChannel,
isTextBasedChannel,
isTextChannel,
type GuildBasedChannelTypes,
Expand Down Expand Up @@ -50,17 +51,19 @@ export async function resolveMessage(parameter: string, options: MessageResolver
}

function resolveById(parameter: string, options: MessageResolverOptions): Awaitable<Message | null> {
if (!SnowflakeRegex.test(parameter)) {
if (!SnowflakeRegex.test(parameter) || isStageChannel(options.messageOrInteraction.channel)) {
return null;
}

if (options.channel) {
if (options.channel && !isStageChannel(options.channel)) {
return options.channel.messages.fetch(parameter as Snowflake);
}

if (options.scan && isGuildBasedChannel(options.messageOrInteraction.channel)) {
for (const channel of options.messageOrInteraction.channel.guild.channels.cache.values()) {
if (!isTextBasedChannel(channel)) continue;
if (!isTextBasedChannel(channel) || isStageChannel(channel)) {
continue;
}

const message = channel.messages.cache.get(parameter);
if (message) {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { isStageChannel } from '@sapphire/discord.js-utilities';
import type { Message } from 'discord.js';
import type { MessageCommand } from '../../lib/structures/Command';
import { Listener } from '../../lib/structures/Listener';
Expand All @@ -10,7 +11,9 @@ export class CoreListener extends Listener<typeof Events.MessageCommandRun> {
}

public async run(message: Message, command: MessageCommand, payload: MessageCommandRunPayload) {
if (!command.typing) return;
if (!command.typing || isStageChannel(message.channel)) {
return;
}

try {
await message.channel.sendTyping();
Expand Down
Loading

0 comments on commit 37fdcb4

Please sign in to comment.