diff options
4 files changed, 155 insertions, 87 deletions
diff --git a/packages/gateway/src/listeners/messageCreate/constants.ts b/packages/gateway/src/listeners/messageCreate/constants.ts new file mode 100644 index 0000000..a39e218 --- /dev/null +++ b/packages/gateway/src/listeners/messageCreate/constants.ts @@ -0,0 +1,75 @@ +export const PERSONA_GREETINGS = [ + "Hi, everyone!", + "Hey there!", + "Hello everyone!", + "Hi all!", + "Hey!", + "Hello!", + "Hi everyone!", + "Hey there!", + "Hello all!", + "Hi!", + "Hey everyone!", + "Hello there!", +]; + +export const PERSONA_INTRODUCTIONS = [ + "{username} here!", + "It's {username}!", + "{username} speaking!", + "{username} here with an important reminder!", + "{username} checking in!", + "It's {username}!", + "{username} here!", + "{username} speaking!", + "{username} here!", + "{username} checking in!", + "{username} here!", + "It's {username}!", + "{username} here!", + "{username} here!", +]; + +export const PERSONA_MIDDLES = [ + "I want to make sure everyone knows that this channel is for NSFW content **only**! I really don't want to have to get rid of this channel for good", + "Just a friendly reminder: this channel is strictly for NSFW content. Please keep it that way, or I might have to remove this channel permanently", + "This channel is meant for NSFW content exclusively. I'd hate to see this channel disappear because of rule violations", + "This channel is for NSFW content **only**! Let's keep it that way, or I'll have no choice but to remove this channel", + "Just wanted to remind everyone that this channel is strictly for NSFW content. I really don't want to have to delete this channel", + "Please remember that this channel is for NSFW content only. I'd prefer not to have to permanently get rid of this channel", + "This channel is exclusively for NSFW content. Keep it clean, or I might have to remove this channel for good", + "Just a quick reminder that this channel is for NSFW content **only**! I don't want to have to delete this channel", + "This channel is strictly for NSFW content only. Please respect that, or I'll have no choice but to remove this channel", + "Remember, this channel is for NSFW content exclusively. I really don't want to have to get rid of this channel permanently", +]; + +export const CONVERSATION_MIDDLES = [ + "What's everyone up to today? Any exciting plans?", + "How's everyone feeling today? Ready for some fun conversations?", + "What's the most interesting thing that happened to you recently?", + "Anyone have any cool stories to share? I'm all ears!", + "What's your favorite way to spend a relaxing day?", + "Anyone want to chat about something fun? I'm in the mood for good conversation!", + "What's something that always makes you smile?", + "Anyone have any interesting hobbies or projects they're working on?", + "What's the best thing that happened to you this week?", + "Anyone want to share something they're excited about?", + "What's your go-to way to cheer yourself up when you're feeling down?", + "Anyone have any fun weekend plans or recent adventures to talk about?", + "What's something new you've learned or discovered recently?", + "Anyone want to chat about their favorite movies, shows, or games?", + "What's the most random or interesting conversation you've had lately?", +]; + +export const PERSONA_ENDINGS = [ + "I know you're all doing your best! 💕", + "You've got this! ✨", + "Keep being amazing! 🌟", + "I believe in you! 💪", + "You're all wonderful! 🌸", + "Stay awesome! 💖", + "You're doing great! 🎀", + "Keep shining! ⭐", + "You're all stars! 🌠", + "Keep being fantastic! 🎉", +]; diff --git a/packages/gateway/src/listeners/messageCreate/dailyConversationStarter.ts b/packages/gateway/src/listeners/messageCreate/dailyConversationStarter.ts index 268c19d..5ee0405 100644 --- a/packages/gateway/src/listeners/messageCreate/dailyConversationStarter.ts +++ b/packages/gateway/src/listeners/messageCreate/dailyConversationStarter.ts @@ -1,27 +1,12 @@ import { Message, WebhookClient, Client } from "discord.js"; import { UMA_PERSONAS } from "../../constants"; import { sendPersonaLog } from "../../commands/utilities"; +import { CONVERSATION_MIDDLES } from "./constants"; +import { generatePersonaMessage } from "./utilities"; const ENABLED_PRIMER_MESSAGE = false; const TARGET_CHANNEL_ID = "1406422619087044675"; const MIN_HOURS_BETWEEN_MESSAGES = 8; -const CONVERSATION_STARTERS = [ - "Hey everyone! {username} here! What's everyone up to today? Any exciting plans?", - "Hi there! It's {username}! How's everyone feeling today? Ready for some fun conversations?", - "Hello! {username} checking in! What's the most interesting thing that happened to you recently?", - "Hey! {username} speaking! Anyone have any cool stories to share? I'm all ears!", - "Hi everyone! {username} here! What's your favorite way to spend a relaxing day?", - "Hello there! It's {username}! Anyone want to chat about something fun? I'm in the mood for good conversation!", - "Hey! {username} checking in! What's something that always makes you smile?", - "Hi! {username} here! Anyone have any interesting hobbies or projects they're working on?", - "Hello everyone! {username} speaking! What's the best thing that happened to you this week?", - "Hey there! It's {username}! Anyone want to share something they're excited about?", - "Hi! {username} checking in! What's your go-to way to cheer yourself up when you're feeling down?", - "Hello! {username} here! Anyone have any fun weekend plans or recent adventures to talk about?", - "Hey everyone! {username} speaking! What's something new you've learned or discovered recently?", - "Hi there! It's {username}! Anyone want to chat about their favorite movies, shows, or games?", - "Hello! {username} checking in! What's the most random or interesting conversation you've had lately?", -]; interface DailyMessageTracker { lastMessageTime: number; @@ -73,13 +58,10 @@ class DailyConversationStarterSystem { try { const randomPersona = UMA_PERSONAS[Math.floor(Math.random() * UMA_PERSONAS.length)]; - const randomMessage = - CONVERSATION_STARTERS[ - Math.floor(Math.random() * CONVERSATION_STARTERS.length) - ]; - const formattedMessage = randomMessage.replace( - "{username}", + const formattedMessage = generatePersonaMessage( randomPersona.name, + CONVERSATION_MIDDLES, + false, ); await this.initializeWebhook(randomPersona.name, randomPersona.avatar); @@ -93,7 +75,13 @@ class DailyConversationStarterSystem { } await this.webhookClient.send(formattedMessage); - await sendPersonaLog(this.client!, "conversation", randomPersona.name, undefined, true); + await sendPersonaLog( + this.client!, + "conversation", + randomPersona.name, + undefined, + true, + ); this.tracker.lastMessageTime = Date.now(); @@ -125,18 +113,15 @@ class DailyConversationStarterSystem { } private async sendRandomConversationStarter( - triggerMessage: Message /* eslint-disable-line @typescript-eslint/no-unused-vars, no-unused-vars */, + triggerMessage: Message, ): Promise<void> { try { const randomPersona = UMA_PERSONAS[Math.floor(Math.random() * UMA_PERSONAS.length)]; - const randomMessage = - CONVERSATION_STARTERS[ - Math.floor(Math.random() * CONVERSATION_STARTERS.length) - ]; - const formattedMessage = randomMessage.replace( - "{username}", + const formattedMessage = generatePersonaMessage( randomPersona.name, + CONVERSATION_MIDDLES, + false, ); await this.initializeWebhook(randomPersona.name, randomPersona.avatar); @@ -153,7 +138,13 @@ class DailyConversationStarterSystem { const messageLink = `https://discord.com/channels/${triggerMessage.guildId}/${triggerMessage.channelId}/${triggerMessage.id}`; - await sendPersonaLog(this.client!, "conversation", randomPersona.name, messageLink, false); + await sendPersonaLog( + this.client!, + "conversation", + randomPersona.name, + messageLink, + false, + ); this.tracker.lastMessageTime = Date.now(); diff --git a/packages/gateway/src/listeners/messageCreate/personaRandomMessage.ts b/packages/gateway/src/listeners/messageCreate/personaRandomMessage.ts index a17c647..827925d 100644 --- a/packages/gateway/src/listeners/messageCreate/personaRandomMessage.ts +++ b/packages/gateway/src/listeners/messageCreate/personaRandomMessage.ts @@ -1,46 +1,12 @@ import { Message, WebhookClient, Client } from "discord.js"; import { UMA_PERSONAS } from "../../constants"; import { sendPersonaLog } from "../../commands/utilities"; +import { PERSONA_MIDDLES } from "./constants"; +import { generatePersonaMessage } from "./utilities"; const ENABLED_PRIMER_MESSAGE = false; const TARGET_CHANNEL_ID = "1410333697701314791"; const MESSAGE_THRESHOLD = 250; -const PERSONA_OPENINGS = [ - "Hi, everyone! {username} here!", - "Hey there! It's {username}!", - "Hello everyone! {username} speaking!", - "Hi all! {username} here with an important reminder!", - "Hey! {username} checking in!", - "Hello! It's {username}!", - "Hi everyone! {username} here!", - "Hey there! {username} speaking!", - "Hello all! {username} here!", - "Hi! {username} checking in!", -]; -const PERSONA_MIDDLES = [ - "I want to make sure everyone knows that this channel is for NSFW content **only**! I really don't want to have to get rid of this channel for good", - "Just a friendly reminder: this channel is strictly for NSFW content. Please keep it that way, or I might have to remove this channel permanently", - "This channel is meant for NSFW content exclusively. I'd hate to see this channel disappear because of rule violations", - "This channel is for NSFW content **only**! Let's keep it that way, or I'll have no choice but to remove this channel", - "Just wanted to remind everyone that this channel is strictly for NSFW content. I really don't want to have to delete this channel", - "Please remember that this channel is for NSFW content only. I'd prefer not to have to permanently get rid of this channel", - "This channel is exclusively for NSFW content. Keep it clean, or I might have to remove this channel for good", - "Just a quick reminder that this channel is for NSFW content **only**! I don't want to have to delete this channel", - "This channel is strictly for NSFW content only. Please respect that, or I'll have no choice but to remove this channel", - "Remember, this channel is for NSFW content exclusively. I really don't want to have to get rid of this channel permanently", -]; -const PERSONA_ENDINGS = [ - "I know you're all doing your best! 💕", - "You've got this! ✨", - "Keep being amazing! 🌟", - "I believe in you! 💪", - "You're all wonderful! 🌸", - "Stay awesome! 💖", - "You're doing great! 🎀", - "Keep shining! ⭐", - "You're all stars! 🌠", - "Keep being fantastic! 🎉", -]; interface PersonaMessageTracker { messageCount: number; @@ -94,15 +60,10 @@ class PersonaRandomMessageSystem { try { const randomPersona = UMA_PERSONAS[Math.floor(Math.random() * UMA_PERSONAS.length)]; - const randomOpening = - PERSONA_OPENINGS[Math.floor(Math.random() * PERSONA_OPENINGS.length)]; - const randomMiddle = - PERSONA_MIDDLES[Math.floor(Math.random() * PERSONA_MIDDLES.length)]; - const randomEnding = - PERSONA_ENDINGS[Math.floor(Math.random() * PERSONA_ENDINGS.length)]; - const formattedMessage = `${randomOpening} ${randomMiddle} .... ${randomEnding}`.replace( - "{username}", + const formattedMessage = generatePersonaMessage( randomPersona.name, + PERSONA_MIDDLES, + true, ); await this.initializeWebhook(randomPersona.name, randomPersona.avatar); @@ -114,7 +75,13 @@ class PersonaRandomMessageSystem { } await this.webhookClient.send(formattedMessage); - await sendPersonaLog(this.client!, "persona", randomPersona.name, undefined, true); + await sendPersonaLog( + this.client!, + "persona", + randomPersona.name, + undefined, + true, + ); await this.cleanupWebhook(); } catch (error) { console.error("Failed to send primer persona message:", error); @@ -140,20 +107,15 @@ class PersonaRandomMessageSystem { } private async sendRandomPersonaMessage( - triggerMessage: Message /* eslint-disable-line @typescript-eslint/no-unused-vars, no-unused-vars */, + triggerMessage: Message, ): Promise<void> { try { const randomPersona = UMA_PERSONAS[Math.floor(Math.random() * UMA_PERSONAS.length)]; - const randomOpening = - PERSONA_OPENINGS[Math.floor(Math.random() * PERSONA_OPENINGS.length)]; - const randomMiddle = - PERSONA_MIDDLES[Math.floor(Math.random() * PERSONA_MIDDLES.length)]; - const randomEnding = - PERSONA_ENDINGS[Math.floor(Math.random() * PERSONA_ENDINGS.length)]; - const formattedMessage = `${randomOpening} ${randomMiddle} .... ${randomEnding}`.replace( - "{username}", + const formattedMessage = generatePersonaMessage( randomPersona.name, + PERSONA_MIDDLES, + true, ); await this.initializeWebhook(randomPersona.name, randomPersona.avatar); @@ -168,7 +130,13 @@ class PersonaRandomMessageSystem { const messageLink = `https://discord.com/channels/${triggerMessage.guildId}/${triggerMessage.channelId}/${triggerMessage.id}`; - await sendPersonaLog(this.client!, "persona", randomPersona.name, messageLink, false); + await sendPersonaLog( + this.client!, + "persona", + randomPersona.name, + messageLink, + false, + ); this.tracker.messageCount = 0; this.tracker.lastRandomMessageTime = Date.now(); diff --git a/packages/gateway/src/listeners/messageCreate/utilities.ts b/packages/gateway/src/listeners/messageCreate/utilities.ts new file mode 100644 index 0000000..0badeef --- /dev/null +++ b/packages/gateway/src/listeners/messageCreate/utilities.ts @@ -0,0 +1,34 @@ +import { + PERSONA_GREETINGS, + PERSONA_INTRODUCTIONS, + PERSONA_ENDINGS, +} from "./constants"; + +export const generateRandomOpening = (username: string): string => { + const randomGreeting = + PERSONA_GREETINGS[Math.floor(Math.random() * PERSONA_GREETINGS.length)]; + const randomIntroduction = + PERSONA_INTRODUCTIONS[ + Math.floor(Math.random() * PERSONA_INTRODUCTIONS.length) + ]; + + return `${randomGreeting} ${randomIntroduction}`.replace( + "{username}", + username, + ); +}; + +export const generatePersonaMessage = ( + username: string, + middleMessages: readonly string[], + useEllipsis: boolean = false, +): string => { + const randomOpening = generateRandomOpening(username); + const randomMiddle = + middleMessages[Math.floor(Math.random() * middleMessages.length)]; + const randomEnding = + PERSONA_ENDINGS[Math.floor(Math.random() * PERSONA_ENDINGS.length)]; + + const separator = useEllipsis ? " .... " : " "; + return `${randomOpening}${separator}${randomMiddle}${separator}${randomEnding}`; +}; |