Examples
Copy-paste working Plexcord plugin examples. Beginner to advanced complexity with inline explanations.
Examples
Real, working Plexcord plugin examples you can copy, learn from, and build upon. Each example is complete and runnable.
Beginner Examples
Intermediate Examples
Keyword Alert
~60 lines: Watch for keywords in messages and alert you with a notification. Uses Flux events and settings.
Message Formatter
~80 lines: Add a chat bar button that formats your typed message. Uses ChatButtons API and commands.
Advanced Examples
How to Use These Examples
- Create a new folder in
src/userplugins/pluginName/ - Copy the code into
index.ts - Run
pnpm build - Enable the plugin in Discord Settings → Plexcord → Plugins
Code Quality
All examples follow these standards:
- Full TypeScript types
- Proper cleanup in
stop() - Logger usage instead of
console.log - Error handling where appropriate
- Comments explaining non-obvious code
Examples
Practical examples to help you understand how to use Plexcord effectively.
Basic Examples
Hello World
// Simple Plexcord initialization
import plexcord from 'plexcord';
plexcord.on('ready', () => {
console.log('Plexcord is ready!');
});Custom Theme
// Apply a custom theme
plexcord.themes.apply({
name: 'My Theme',
colors: {
primary: '#5865F2',
background: '#23272A',
text: '#FFFFFF'
}
});Plugin Creation
// Create a simple plugin
export default {
name: 'hello-world',
version: '1.0.0',
onLoad() {
console.log('Hello from plugin!');
},
onUnload() {
console.log('Goodbye!');
}
};Advanced Examples
Event Handling
// Listen to Discord events
plexcord.events.on('message', (message) => {
if (message.content.startsWith('!plexcord')) {
message.reply('Hello from Plexcord!');
}
});Dynamic Configuration
// Update configuration dynamically
plexcord.config.update({
features: {
customEmojis: true,
enhancedNotifications: true
}
});Use Cases
Internationalization (i18n)
Make your plugin speak every language. Full reference for Plexcord's dual i18n system, covering the renderer API and main process.
Simple Notification Plugin
A beginner-level Plexcord plugin that shows a welcome notification when installed. Learn the bare minimum of a working plugin.