Skip to content

Commit 71cf295

Browse files
committedJul 21, 2023
fix(preconditions): resolve deprecated discordjs code
1 parent c711e8c commit 71cf295

5 files changed

+11
-11
lines changed
 

‎src/preconditions/GuildNewsOnly.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import { Identifiers } from '../lib/errors/Identifiers';
33
import { AllFlowsPrecondition } from '../lib/structures/Precondition';
44

55
export class CorePrecondition extends AllFlowsPrecondition {
6-
private readonly allowedTypes: TextBasedChannelTypes[] = [ChannelType.GuildNews, ChannelType.GuildNewsThread];
6+
private readonly allowedTypes: TextBasedChannelTypes[] = [ChannelType.GuildAnnouncement, ChannelType.AnnouncementThread];
77

88
public messageRun(message: Message): AllFlowsPrecondition.Result {
99
return this.allowedTypes.includes(message.channel.type)

‎src/preconditions/GuildNewsThreadOnly.ts

+3-3
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import { AllFlowsPrecondition } from '../lib/structures/Precondition';
44

55
export class CorePrecondition extends AllFlowsPrecondition {
66
public messageRun(message: Message): AllFlowsPrecondition.Result {
7-
return message.thread?.type === ChannelType.GuildNewsThread
7+
return message.thread?.type === ChannelType.AnnouncementThread
88
? this.ok()
99
: this.error({
1010
identifier: Identifiers.PreconditionGuildNewsThreadOnly,
@@ -15,7 +15,7 @@ export class CorePrecondition extends AllFlowsPrecondition {
1515
public async chatInputRun(interaction: ChatInputCommandInteraction): AllFlowsPrecondition.AsyncResult {
1616
const channel = await this.fetchChannelFromInteraction(interaction);
1717

18-
return channel.type === ChannelType.GuildNewsThread
18+
return channel.type === ChannelType.AnnouncementThread
1919
? this.ok()
2020
: this.error({
2121
identifier: Identifiers.PreconditionGuildNewsThreadOnly,
@@ -26,7 +26,7 @@ export class CorePrecondition extends AllFlowsPrecondition {
2626
public async contextMenuRun(interaction: ContextMenuCommandInteraction): AllFlowsPrecondition.AsyncResult {
2727
const channel = await this.fetchChannelFromInteraction(interaction);
2828

29-
return channel.type === ChannelType.GuildNewsThread
29+
return channel.type === ChannelType.AnnouncementThread
3030
? this.ok()
3131
: this.error({
3232
identifier: Identifiers.PreconditionGuildNewsThreadOnly,

‎src/preconditions/GuildPrivateThreadOnly.ts

+3-3
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import { AllFlowsPrecondition } from '../lib/structures/Precondition';
44

55
export class CorePrecondition extends AllFlowsPrecondition {
66
public messageRun(message: Message): AllFlowsPrecondition.Result {
7-
return message.thread?.type === ChannelType.GuildPrivateThread
7+
return message.thread?.type === ChannelType.PrivateThread
88
? this.ok()
99
: this.error({
1010
identifier: Identifiers.PreconditionGuildPrivateThreadOnly,
@@ -15,7 +15,7 @@ export class CorePrecondition extends AllFlowsPrecondition {
1515
public async chatInputRun(interaction: ChatInputCommandInteraction): AllFlowsPrecondition.AsyncResult {
1616
const channel = await this.fetchChannelFromInteraction(interaction);
1717

18-
return channel.type === ChannelType.GuildPrivateThread
18+
return channel.type === ChannelType.PrivateThread
1919
? this.ok()
2020
: this.error({
2121
identifier: Identifiers.PreconditionGuildPrivateThreadOnly,
@@ -26,7 +26,7 @@ export class CorePrecondition extends AllFlowsPrecondition {
2626
public async contextMenuRun(interaction: ContextMenuCommandInteraction): AllFlowsPrecondition.AsyncResult {
2727
const channel = await this.fetchChannelFromInteraction(interaction);
2828

29-
return channel.type === ChannelType.GuildPrivateThread
29+
return channel.type === ChannelType.PrivateThread
3030
? this.ok()
3131
: this.error({
3232
identifier: Identifiers.PreconditionGuildPrivateThreadOnly,

‎src/preconditions/GuildPublicThreadOnly.ts

+3-3
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import { AllFlowsPrecondition } from '../lib/structures/Precondition';
44

55
export class CorePrecondition extends AllFlowsPrecondition {
66
public messageRun(message: Message): AllFlowsPrecondition.Result {
7-
return message.thread?.type === ChannelType.GuildPublicThread
7+
return message.thread?.type === ChannelType.PublicThread
88
? this.ok()
99
: this.error({
1010
identifier: Identifiers.PreconditionGuildPublicThreadOnly,
@@ -15,7 +15,7 @@ export class CorePrecondition extends AllFlowsPrecondition {
1515
public async chatInputRun(interaction: ChatInputCommandInteraction): AllFlowsPrecondition.AsyncResult {
1616
const channel = await this.fetchChannelFromInteraction(interaction);
1717

18-
return channel.type === ChannelType.GuildPublicThread
18+
return channel.type === ChannelType.PublicThread
1919
? this.ok()
2020
: this.error({
2121
identifier: Identifiers.PreconditionGuildPublicThreadOnly,
@@ -26,7 +26,7 @@ export class CorePrecondition extends AllFlowsPrecondition {
2626
public async contextMenuRun(interaction: ContextMenuCommandInteraction): AllFlowsPrecondition.AsyncResult {
2727
const channel = await this.fetchChannelFromInteraction(interaction);
2828

29-
return channel.type === ChannelType.GuildPublicThread
29+
return channel.type === ChannelType.PublicThread
3030
? this.ok()
3131
: this.error({
3232
identifier: Identifiers.PreconditionGuildPublicThreadOnly,

‎src/preconditions/GuildTextOnly.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import { Identifiers } from '../lib/errors/Identifiers';
33
import { AllFlowsPrecondition } from '../lib/structures/Precondition';
44

55
export class CorePrecondition extends AllFlowsPrecondition {
6-
private readonly allowedTypes: TextBasedChannelTypes[] = [ChannelType.GuildText, ChannelType.GuildPublicThread, ChannelType.GuildPrivateThread];
6+
private readonly allowedTypes: TextBasedChannelTypes[] = [ChannelType.GuildText, ChannelType.PublicThread, ChannelType.PrivateThread];
77

88
public messageRun(message: Message): AllFlowsPrecondition.Result {
99
return this.allowedTypes.includes(message.channel.type)

0 commit comments

Comments
 (0)
Please sign in to comment.