How could I program a Vencord plugin that converts my messages into catgirl speech…
- User
How could I program a Vencord plugin that converts my messages into catgirl speech before sending them?
- Assistant
How could I program a Vencord plugin that converts my messages into catgirl speech before sending them?
Creating a Vencord plugin that transforms your messages into "catgirl speech" before sending them is an interesting project! Below is a step-by-step guide to help you develop such a plugin. This guide assumes you have some familiarity with JavaScript and the basics of plugin development for Vencord.
Disclaimer: Modifying the Discord client with third-party plugins may violate Discord's Terms of Service. Proceed at your own risk.
Before you begin, ensure you have the following:
Vencord plugins are typically written in JavaScript. Here's how to set up the basic structure of your plugin.
File Structure:
MyCatgirlPlugin/
├── index.js
index.js Content:
// Import necessary Vencord utilities
import { registerPlugin } from "@vendetta/plugins";
import { before } from "@vendetta/patcher";
// Plugin metadata
const plugin = {
name: "Catgirl Speech",
author: "Your Name",
description: "Converts your messages into catgirl speech before sending them.",
version: "1.0.0",
};
export default plugin;
You need to intercept the function that handles message dispatching and modify the content before it's sent.
Implementation:
// Import necessary modules
import { findByProps } from "@vendetta/metro";
import { after } from "@vendetta/patcher";
const MessageActions = findByProps("sendMessage", "editMessage");
let unpatch;
plugin.onLoad = () => {
unpatch = before("sendMessage", MessageActions, (args) => {
const [channelId, message] = args;
if (message && message.content) {
// Transform the message content
message.content = transformToCatgirlSpeech(message.content);
}
});
};
plugin.onUnload = () => {
if (unpatch) unpatch();
};
Define a function that converts regular text into catgirl speech. Here's a simple example:
Transformation Function:
function transformToCatgirlSpeech(text) {
let transformedText = text;
// Replace "l" and "r" with "w"
transformedText = transformedText.replace(/(r|l)/g, "w");
transformedText = transformedText.replace(/(R|L)/g, "W");
// Add "nya~" at the end of sentences
transformedText = transformedText.replace(/([.!?])\s*$/g, "$1 nya~");
// Occasional "meow" interjections
transformedText = transformedText.replace(/\b(and|or|but)\b/gi, (match) => {
return `${match} meow`;
});
// Elongate some vowels randomly
transformedText = transformedText.replace(/[aeiouAEIOU]/g, (vowel) => {
return Math.random() > 0.7 ? vowel + vowel : vowel;
});
return transformedText;
}
Explanation:
After implementing the plugin, you need to test it to ensure it works correctly.
Steps:
Load the Plugin:
MyCatgirlPlugin) into Vencord's plugins directory.Send Test Messages:
Debugging:
Settings Panel:
Regex Improvements:
Edge Case Handling:
Example of Adding a Settings Toggle:
import { storage } from "@vendetta/plugin";
plugin.settings = {
enabled: true,
};
plugin.onLoad = () => {
// ... existing code ...
unpatch = before("sendMessage", MessageActions, (args) => {
if (!plugin.settings.enabled) return;
// ... transformation code ...
});
};
Putting it all together, your index.js would look like this:
import { registerPlugin } from "@vendetta/plugins";
import { findByProps } from "@vendetta/metro";
import { before } from "@vendetta/patcher";
const MessageActions = findByProps("sendMessage", "editMessage");
let unpatch;
const plugin = {
name: "Catgirl Speech",
author: "Your Name",
description: "Converts your messages into catgirl speech before sending them.",
version: "1.0.0",
onLoad() {
unpatch = before("sendMessage", MessageActions, (args) => {
const [channelId, message] = args;
if (message && message.content) {
// Ignore commands or empty messages
if (message.content.startsWith("/")) return;
// Transform the message content
message.content = transformToCatgirlSpeech(message.content);
}
});
},
onUnload() {
if (unpatch) unpatch();
},
};
function transformToCatgirlSpeech(text) {
let transformedText = text;
// Replace "l" and "r" with "w"
transformedText = transformedText.replace(/(r|l)/g, "w");
transformedText = transformedText.replace(/(R|L)/g, "W");
// Add "nya~" at the end of sentences
transformedText = transformedText.replace(/([.!?])\s*$/g, "$1 nya~");
// Interject "meow" after certain words
transformedText = transformedText.replace(/\b(and|or|but)\b/gi, (match) => {
return `${match} meow`;
});
// Elongate some vowels randomly
transformedText = transformedText.replace(/[aeiouAEIOU]/g, (vowel) => {
return Math.random() > 0.7 ? vowel + vowel : vowel;
});
return transformedText;
}
export default plugin;
By following the steps above, you should have a functioning Vencord plugin that converts your messages into catgirl speech before sending them. Feel free to customize the transformation logic to better suit your desired speech pattern.
Happy coding, nya~!