Plexcord LogoPlexcord
Examples

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

Advanced Examples

How to Use These Examples

  1. Create a new folder in src/userplugins/pluginName/
  2. Copy the code into index.ts
  3. Run pnpm build
  4. 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

On this page