Skip to content

Commit d82caba

Browse files
committed
Officially deprecate CGB Chat
Signed-off-by: cobalt <61329810+cobaltt7@users.noreply.github.com>
1 parent 0e96678 commit d82caba

5 files changed

Lines changed: 30 additions & 25 deletions

File tree

modules/chat/chat.ts

Lines changed: 13 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,22 @@
1-
import type {
2-
InteractionResponse,
3-
Message,
4-
MessageContextMenuCommandInteraction,
5-
Snowflake,
6-
} from "discord.js";
1+
import type { InteractionResponse, Message, MessageContextMenuCommandInteraction, Snowflake } from "discord.js";
2+
3+
74

85
import assert from "node:assert";
96

7+
8+
109
import didYouMean, { ReturnTypeEnums, ThresholdTypeEnums } from "didyoumean2";
11-
import {
12-
ChannelType,
13-
ComponentType,
14-
MessageFlags,
15-
MessageType,
16-
PermissionFlagsBits,
17-
TextInputStyle,
18-
} from "discord.js";
10+
import { ChannelType, ComponentType, MessageFlags, MessageType, PermissionFlagsBits, TextInputStyle } from "discord.js";
1911
import { client, getBaseChannel } from "strife.js";
2012

13+
14+
2115
import constants from "../../common/constants.ts";
22-
import { Chat, ChatConfig, ChatConsent } from "./misc.ts";
16+
import { Chat, ChatConfig, ChatConsent, deprecationMessage } from "./misc.ts";
2317
import { postProcessResponse, preProcessResponse, processPrompt } from "./process.ts";
2418

19+
2520
export default async function sendChat(message: Message<true>): Promise<string | undefined> {
2621
if (
2722
!message.member
@@ -136,8 +131,9 @@ export async function removeResponse(
136131
response,
137132
}).exec();
138133
await modalInteraction.editReply(
139-
deletedCount ?
134+
(deletedCount ?
140135
`${constants.emojis.statuses.yes} Deleted ${deletedCount.toLocaleString()} prompts with that response.`
141-
: `${constants.emojis.statuses.no} Could not find that as a response to any prompt.`,
136+
: `${constants.emojis.statuses.no} Could not find that as a response to any prompt.`)
137+
+ deprecationMessage,
142138
);
143139
}

modules/chat/config.ts

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import assert from "node:assert";
55
import { channelMention } from "discord.js";
66

77
import constants from "../../common/constants.ts";
8-
import { ChatConfig } from "./misc.ts";
8+
import { ChatConfig, deprecationMessage } from "./misc.ts";
99

1010
export default async function configChat(
1111
interaction: ChatInputCommandInteraction<"cached" | "raw">,
@@ -21,10 +21,11 @@ export default async function configChat(
2121

2222
await interaction.reply({
2323
content:
24-
config.enabled ?
24+
(config.enabled ?
2525
config.channel ?
2626
`${constants.emojis.statuses.yes} CGB Chat is currently enabled, tracking all public channels, and responding in ${channelMention(config.channel)}.`
2727
: `${constants.emojis.statuses.no} CGB Chat is currently enabled and tracking all public channels, but no chat channel is configured.`
28-
: `${constants.emojis.statuses.no} CGB Chat is currently disabled in this server.`,
28+
: `${constants.emojis.statuses.no} CGB Chat is currently disabled in this server.`)
29+
+ deprecationMessage,
2930
});
3031
}

modules/chat/consent.ts

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ import {
1717
import { client } from "strife.js";
1818

1919
import constants from "../../common/constants.ts";
20-
import { ChatConsent } from "./misc.ts";
20+
import { ChatConsent, deprecationMessage } from "./misc.ts";
2121

2222
async function getSettings(user: User): Promise<string> {
2323
const consent = await ChatConsent.findOne({ user: user.id }).exec();
@@ -78,8 +78,10 @@ export async function showConsent(interaction: ChatInputCommandInteraction): Pro
7878
{
7979
type: ComponentType.TextDisplay,
8080
content:
81-
"CGB Chat learns by tracking messages across all channels. Any stored messages may be regurgitated, but only in the server you sent it in. Messages will never be sent cross-server.\n"
82-
+ "Your messages will only be stored if you give explicit permission using the button below. You will be able to change your preference at any time, however any past messages can’t be deleted, as message authors are not stored. By default, your messages are not saved.",
81+
`CGB Chat learns by tracking messages across all channels. Any stored messages may be regurgitated, but only in the server you sent it in. Messages will never be sent cross-server.\n`
82+
+ `Your messages will only be stored if you give explicit permission using the button below. You will be able to change your preference at any time, however any past messages can’t be deleted, as message authors are not stored. By default, your messages are not saved.${
83+
deprecationMessage
84+
}`,
8385
},
8486
{
8587
type: ComponentType.Separator,
@@ -120,7 +122,7 @@ export async function chatConsent(interaction: ButtonInteraction, type: string):
120122
components: [
121123
{
122124
type: ComponentType.TextDisplay,
123-
content: `${constants.emojis.statuses.yes} Updated settings!`,
125+
content: `${constants.emojis.statuses.yes} Updated settings!${deprecationMessage}`,
124126
},
125127
{ type: ComponentType.TextDisplay, content: "## Current Settings" },
126128
{ type: ComponentType.TextDisplay, content: await getSettings(interaction.user) },

modules/chat/misc.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,3 +25,8 @@ export const ChatConsent = model(
2525
guilds: { type: Map, of: Boolean, default: {} },
2626
}),
2727
);
28+
29+
export const deprecationMessage =
30+
"\n\n**CGB Chat will be removed soon.**"
31+
+ " Due to low usage, high memory use, and privacy and performance concerns, CGB Chat will be removed in the coming months."
32+
+ " If you still actively use CGB Chat, please reach out in the support server (linked in my bio).";

modules/chat/process.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ import {
3232

3333
import { GlobalBotInvitesPattern, messageToText } from "../../util/discord.ts";
3434
import { normalize } from "../../util/text.ts";
35+
import { deprecationMessage } from "./misc.ts";
3536

3637
const defaultUser = userMention("0");
3738
const defaultChannel = channelMention("0");
@@ -117,7 +118,7 @@ export async function postProcessResponse(response: string, author: GuildMember)
117118
const noChannels = await replaceChannels(noUsers, author.guild);
118119
const noRoles = await replaceRoles(noChannels, author.guild);
119120
const noEmojis = await replaceEmojis(noRoles, author.guild);
120-
return noEmojis;
121+
return noEmojis + deprecationMessage;
121122
}
122123

123124
async function replaceChannels(response: string, guild: Guild): Promise<string> {

0 commit comments

Comments
 (0)