Skip to content
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
18 changes: 4 additions & 14 deletions src/events/message_create/auto-thread-channels.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
// loosely based on https://github.com/hackclub/scrappy
import { setTimeout } from "node:timers/promises";
import type { Message } from "discord.js";
import { WACKY_ROLE_ID } from "../../utils/consts";

const SHIP_CHANNEL_ID = "904896819165814794";
const CHECKPOINTS_CHANNEL_ID = "1052236377338683514";
Expand All @@ -17,6 +18,7 @@ const CHECKPOINT_RESPONSE_MESSAGES = [
"Awesome update! :D",
"Yay thanks for sharing! :D",
"Yippie!! Keep it up! :D",
"Who up checking they point?",
];

const SHIP_RESPONSE_MESSAGES = [
Expand All @@ -32,15 +34,6 @@ const SHIP_RESPONSE_MESSAGES = [
"Boom, nice ship! :D",
];

const CHECKPOINTS_MESSAGE_OPT_IN_USERS = [
"753840846549418024", // kian
];

const SHIP_MESSAGE_OPT_IN_USERS = [
"753840846549418024", // kian
"636701123620634653", // ray
];

export default async function handler(message: Message) {
if (message.author.bot) return;
if (message.channel.isDMBased()) return;
Expand Down Expand Up @@ -98,9 +91,7 @@ Cheers! ^•^`;
});

if (message.channelId === CHECKPOINTS_CHANNEL_ID) {
// NOTE: a couple people didn't like this, so it's opt-in.
// can add it back if people come around to it :3
if (CHECKPOINTS_MESSAGE_OPT_IN_USERS.includes(message.author.id)) {
if (message.member?.roles.cache.has(WACKY_ROLE_ID)) {
await Promise.all([
message.react("🎉"),
message.react("✨"),
Expand All @@ -117,8 +108,7 @@ Cheers! ^•^`;
}

if (message.channelId === SHIP_CHANNEL_ID) {
// Keep sending messages for some, we still love you Wack Hacker </3
if (SHIP_MESSAGE_OPT_IN_USERS.includes(message.author.id)) {
if (message.member?.roles.cache.has(WACKY_ROLE_ID)) {
await Promise.all([
message.react("🎉"),
message.react("✨"),
Expand Down
2 changes: 2 additions & 0 deletions src/events/message_create/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import grok from "./grok";
import hackNightImages from "./hack-night-images";
import voiceMessageTranscription from "./voice-transcription";
import welcomer from "./welcomer";
import praise from "./praise";

export const eventType = Events.MessageCreate;
export {
Expand All @@ -17,4 +18,5 @@ export {
welcomer,
grok,
hackNightImages,
praise,
};
29 changes: 29 additions & 0 deletions src/events/message_create/praise.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
import { type Message, TextChannel, ChannelType } from "discord.js";
import { WACKY_ROLE_ID } from "../../utils/consts";

const ENABLE_PATTERN = /wackity\s+hackity\s+praise\s+me/;
const DISABLE_PATTERN = /wackity\s+hackity\s+go\s+away/;

export default async function handler(message: Message) {
if (message.author.bot) return;
if (
!(
message.channel.type == ChannelType.GuildText ||
message.channel.type == ChannelType.PublicThread
)
)
return;
if (message.member === null) return;

try {
if (message.content.match(ENABLE_PATTERN)) {
await message.member!.roles.add(WACKY_ROLE_ID);
await message.react("🥳");
} else if (message.content.match(DISABLE_PATTERN)) {
await message.member!.roles.remove(WACKY_ROLE_ID);
await message.react("🤐");
}
} catch (e) {
console.error(e);
}
}
1 change: 1 addition & 0 deletions src/utils/consts.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,3 +11,4 @@ export const INTERNAL_CATEGORIES = [
"1082077318329143336",
"938975633885782037",
];
export const WACKY_ROLE_ID = "1419119560627458129";