๐ŸŽต Discore

A Modern, Lightning-Fast Discord API Wrapper for Dart

Dart Discord API License Stars

Discore Mascot
    โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
    โ”‚  ๐ŸŽต  DISCORE - Discord Made Simple  ๐ŸŽต  โ”‚
    โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜

Your gateway to building powerful Discord bots with Dart โšก

Getting Started โ€ข Documentation โ€ข Examples โ€ข Discord Server


โœจ Why Choose Discore?

๐Ÿš€ Lightning Fast

Built from the ground up with performance in mind. Zero unnecessary dependencies means blazing-fast startup times and minimal overhead.

๐ŸŽฏ Type-Safe

Full Dart null safety and strong typing throughout. Catch errors at compile-time, not runtime.

๐ŸŽต Music Bot Ready

First-class voice support with seamless Lavalink integration. Build professional music bots in minutes.

๐Ÿ”ง Easy to Use

Intuitive API design that feels natural to Dart developers. Get started with just a few lines of code.

๐Ÿ›ก๏ธ Production Ready

Battle-tested error handling, automatic reconnection, and comprehensive event coverage.

๐Ÿ“š Well Documented

Extensive documentation with real-world examples and best practices.

๐ŸŒŸ Core Features

โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
โ”‚  โœ…  Discord API v10          โ”‚  โœ…  Gateway WebSocket             โ”‚
โ”‚  โœ…  Voice State Management   โ”‚  โœ…  Complete REST API             โ”‚
โ”‚  โœ…  Type-Safe Snowflakes     โ”‚  โœ…  Strongly-Typed Events         โ”‚
โ”‚  โœ…  Gateway Intents          โ”‚  โœ…  Automatic Reconnection        โ”‚
โ”‚  โœ…  Music Bot Support        โ”‚  โœ…  Zero External Dependencies    โ”‚
โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜

๐Ÿ“ฆ Installation

๐Ÿ“ Local Development
dependencies:
  discore:
    path: ../discore  # Path to discore directory

Perfect for testing and development without publishing!

๐ŸŒ From Git Repository (Coming Soon)
dependencies:
  discore:
    git:
      url: https://github.com/your-org/discore.git
      ref: main

Stay on the cutting edge with the latest features!

๐Ÿ“ฆ From pub.dev (Coming Soon)
dependencies:
  discore: ^1.0.0

Stable releases for production use!


๐Ÿš€ Quick Start

Get your bot running in 60 seconds!

๐Ÿค– Your First Bot

import 'package:discore/discore.dart';

void main() async {
  // Create Discord client
  final client = DiscoreClient(
    token: 'YOUR_BOT_TOKEN',
    intents: GatewayIntents.guilds |
             GatewayIntents.guildMessages |
             GatewayIntents.messageContent,
  );
  
  // Listen for ready event
  client.on<ReadyEvent>((event) {
    print('Bot is ready: ${event.user?.username}');
  });
  
  // Listen for messages
  client.on<MessageCreateEvent>((event) {
    final message = event.message;
    
    if (message.content == '!ping') {
      client.rest.sendMessage(
        message.channelId,
        content: 'Pong!',
      );
    }
  });
  
  // Connect to Discord
  await client.connect();
}

๐ŸŽต Voice Support

Build professional music bots with ease

    โ™ช โ™ซ โ™ช โ™ซ โ™ช โ™ซ โ™ช โ™ซ โ™ช โ™ซ โ™ช โ™ซ
    ๐ŸŽค  Voice-Ready   ๐ŸŽง  Lavalink   ๐ŸŽต  Music Bots
    โ™ช โ™ซ โ™ช โ™ซ โ™ช โ™ซ โ™ช โ™ซ โ™ช โ™ซ โ™ช โ™ซ

Discore includes comprehensive voice support for building music bots:

import 'package:discore/discore.dart';

void main() async {
  final client = DiscoreClient(
    token: 'YOUR_BOT_TOKEN',
    intents: GatewayIntents.guilds |
             GatewayIntents.guildVoiceStates |  // Required for voice!
             GatewayIntents.guildMessages |
             GatewayIntents.messageContent,
  );
  
  // Listen for voice state updates
  client.on<VoiceStateUpdateEvent>((event) {
    print('Voice state changed: ${event.voiceState.sessionId}');
  });
  
  // Listen for voice server updates
  client.on<VoiceServerUpdateEvent>((event) {
    print('Voice server: ${event.endpoint}');
  });
  
  // Join voice channel
  client.gateway.updateVoiceState(
    guildId: guildId,
    channelId: voiceChannelId,
    selfMute: false,
    selfDeaf: false,
  );
  
  await client.connect();
}

Auric

Discore is designed to work seamlessly with Auric, a powerful Lavalink v4 client:

import 'package:discore/discore.dart' hide VoiceState;
import 'package:auric/auric.dart' hide ReadyEvent;

void main() async {
  final discord = DiscoreClient(token: token, intents: ...);
  final lavalink = LavalinkClient(host: 'localhost', port: 2333, ...);
  
  // Create integration - handles voice automatically!
  final integration = AuricDiscordIntegration(
    discord: discord,
    lavalink: lavalink,
  );
  
  // Join and play music with 2 lines!
  await integration.joinVoiceChannel(guildId: guildId, channelId: channelId);
  final player = integration.getPlayer(guildId.toString());
  await player.playTrack(track);
}

See Auric Integration Guide for more details.


๐Ÿ“š Core Concepts

Master Discore in 5 minutes

1. Client Initialization

final client = DiscoreClient(
  token: 'YOUR_BOT_TOKEN',
  intents: GatewayIntents.guilds | GatewayIntents.guildMessages,
);

2. Gateway Intents

Required for receiving specific events:

// Common intents
GatewayIntents.guilds              // Guild events
GatewayIntents.guildMembers        // Member events (privileged)
GatewayIntents.guildVoiceStates    // Voice events (for music bots)
GatewayIntents.guildMessages       // Message events
GatewayIntents.messageContent      // Message content (privileged)

// Combine with bitwise OR
final intents = GatewayIntents.guilds |
                GatewayIntents.guildMessages |
                GatewayIntents.messageContent;

Note: Some intents are privileged and must be enabled in the Discord Developer Portal.

3. Event System

// Type-safe event listeners
client.on<ReadyEvent>((event) {
  print('Ready: ${event.user?.username}');
});

client.on<MessageCreateEvent>((event) {
  print('Message: ${event.message.content}');
});

client.on<GuildCreateEvent>((event) {
  print('Guild: ${event.guild.name}');
});

4. REST API

// Send message
await client.rest.sendMessage(
  channelId,
  content: 'Hello, Discord!',
);

// Get channel
final channel = await client.rest.getChannel(channelId);

// Create guild
final guild = await client.rest.createGuild(name: 'My Server');

// Get user
final user = await client.rest.getUser(userId);

5. Snowflake IDs

Discord uses Snowflake IDs - type-safe wrappers around strings:

final userId = Snowflake('123456789012345678');
final guildId = Snowflake('987654321098765432');

// Convert to string
print(userId.toString());  // '123456789012345678'

// Use in comparisons
if (message.author.id == userId) {
  print('Message from specific user');
}

๐ŸŽฏ Available Events

Listen to everything happening in your Discord server

๐Ÿ”Œ Connection

  • ReadyEvent
  • ResumedEvent

๐Ÿฐ Guilds

  • GuildCreateEvent
  • GuildUpdateEvent
  • GuildDeleteEvent

๐Ÿ’ฌ Messages

  • MessageCreateEvent
  • MessageUpdateEvent
  • MessageDeleteEvent

๐Ÿ“ข Channels

  • ChannelCreateEvent
  • ChannelUpdateEvent
  • ChannelDeleteEvent

๐Ÿ‘ฅ Members

  • GuildMemberAddEvent
  • GuildMemberUpdateEvent
  • GuildMemberRemoveEvent

๐ŸŽญ Roles

  • GuildRoleCreateEvent
  • GuildRoleUpdateEvent
  • GuildRoleDeleteEvent

๐ŸŽค Voice

  • VoiceStateUpdateEvent
  • VoiceServerUpdateEvent

โšก And More!

  • Reactions
  • Webhooks
  • Invites
  • Bans
  • Emojis
  • Presence

See the events directory for the complete list!


๐Ÿ”ง API Reference

Complete API documentation at your fingertips

DiscoreClient

Constructor

DiscoreClient({
  required String token,
  required int intents,
})

Methods

connect()
Future<void> connect()

Connects to Discord gateway.

disconnect()
Future<void> disconnect()

Disconnects from Discord gateway.

on<T>(Function(T) handler)
void on<T extends DiscoreEvent>(Function(T) handler)

Register an event handler for event type T.

Properties

gateway
GatewayClient gateway

Access to gateway operations (voice state updates, etc).

rest
RestClient rest

Access to REST API operations.

user
User? user

The bot's user object (available after ReadyEvent).


๐ŸŽฎ Examples

Real-world code snippets you can use right away

๐Ÿ“ Ping Command

client.on<MessageCreateEvent>((event) {
  if (event.message.content == '!ping') {
    client.rest.sendMessage(
      event.message.channelId,
      content: 'Pong! ๐Ÿ“',
    );
  }
});

๐Ÿ‘‹ Welcome New Members

client.on<GuildMemberAddEvent>((event) {
  final welcomeChannelId = Snowflake('YOUR_CHANNEL_ID');
  
  client.rest.sendMessage(
    welcomeChannelId,
    content: 'Welcome ${event.member.user?.username}! ๐Ÿ‘‹',
  );
});

๐ŸŽค Log Voice Activity

client.on<VoiceStateUpdateEvent>((event) {
  final user = event.voiceState.userId;
  final channel = event.voiceState.channelId;
  
  if (channel != null) {
    print('$user joined voice channel $channel');
  } else {
    print('$user left voice channel');
  }
});

๐Ÿ‘ React to Messages

client.on<MessageCreateEvent>((event) {
  if (event.message.content.contains('awesome')) {
    client.rest.addReaction(
      event.message.channelId,
      event.message.id,
      '๐Ÿ‘',
    );
  }
});

๐ŸŽต Building Music Bots

Create the next big music bot with Discore + Auric

    โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
    โ”‚     ๐ŸŽธ  MUSIC BOT READY  ๐ŸŽน         โ”‚
    โ”‚                                      โ”‚
    โ”‚   Discore + Auric + Lavalink = ๐Ÿ”ฅ   โ”‚
    โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜

Discore is perfect for building music bots when combined with Auric, a powerful Lavalink v4 client.

๐ŸŽถ Why Discore + Auric?


Discore
Discord Gateway & Voice

Auric
Lavalink & Audio Streaming

Integration
Automatic Bridge

๐ŸŽผ Complete Music Bot Example

import 'package:discore/discore.dart' hide VoiceState;
import 'package:auric/auric.dart' hide ReadyEvent;

void main() async {
  // Setup Discord
  final discord = DiscoreClient(
    token: token,
    intents: GatewayIntents.guilds |
             GatewayIntents.guildVoiceStates |
             GatewayIntents.guildMessages |
             GatewayIntents.messageContent,
  );
  
  // Setup Lavalink
  final lavalink = LavalinkClient(
    host: 'localhost',
    port: 2333,
    password: 'youshallnotpass',
    userId: '',
  );
  
  // Create integration
  AuricDiscordIntegration? integration;
  
  discord.on<ReadyEvent>((event) async {
    await lavalink.connect();
    integration = AuricDiscordIntegration(
      discord: discord,
      lavalink: lavalink,
    );
    print('Music bot ready!');
  });
  
  // Handle play command
  discord.on<MessageCreateEvent>((event) async {
    if (event.message.content.startsWith('!play ')) {
      final query = event.message.content.substring(6);
      
      // Join voice
      await integration!.joinVoiceChannel(
        guildId: event.message.guildId!,
        channelId: voiceChannelId,
      );
      
      // Search and play
      final result = await lavalink.rest.loadTracks('ytsearch:$query');
      final player = integration!.getPlayer(event.message.guildId!.toString());
      await player.playTrack(result.tracks!.first);
      
      await discord.rest.sendMessage(
        event.message.channelId,
        content: 'โ–ถ๏ธ Playing: ${result.tracks!.first.info.title}',
      );
    }
  });
  
  await discord.connect();
}

โš™๏ธ Configuration

Get everything set up correctly

Required Discord Intents

Enable in Discord Developer Portal:

  1. Go to https://discord.com/developers/applications
  2. Select your application
  3. Go to "Bot" tab
  4. Enable required privileged intents:
    • SERVER MEMBERS INTENT (for member events)
    • MESSAGE CONTENT INTENT (for reading message content)

Bot Permissions

For voice bots, your bot needs these permissions:

  • View Channels (1024)
  • Connect (1048576)
  • Speak (2097152)
  • Use Voice Activity (33554432)

Permission value: 36700160

Use this when generating your bot invite URL:

https://discord.com/api/oauth2/authorize?client_id=YOUR_CLIENT_ID&permissions=36700160&scope=bot

๐Ÿ› Troubleshooting

Common issues and their solutions

Bot doesn't receive messages

Solution: Enable the MESSAGE CONTENT INTENT in the Discord Developer Portal and use the messageContent intent flag.

Voice events not received

Solution: Enable the GUILD_VOICE_STATES intent in your code and ensure your bot has voice permissions in the server.

Gateway connection fails

Solution: Check your bot token is correct and your bot isn't rate limited.

"Privileged intent provided" error

Solution: Enable the required privileged intents in the Discord Developer Portal.


๐Ÿ“– API Documentation

Everything you need to know

Models

All Discord API models are available in lib/src/models/:

  • User - Discord user
  • Guild - Discord guild (server)
  • Channel - Discord channel
  • Message - Discord message
  • Member - Guild member
  • Role - Guild role
  • VoiceState - User voice state
  • And more...

REST API

All REST endpoints are available via client.rest:

  • Guild operations
  • Channel operations
  • Message operations
  • User operations
  • Role operations
  • Webhook operations
  • And more...

Gateway

Gateway operations via client.gateway:

  • updateVoiceState() - Join/leave voice channels
  • updatePresence() - Update bot status (coming soon)
  • requestGuildMembers() - Request guild members (coming soon)

๐Ÿค Integration with Auric

The perfect duo for music bots

Auric

Discore is designed to work seamlessly with Auric for building music bots. The integration is automatic and requires minimal setup.

Benefits of Discore + Auric

  • โœ… Automatic voice event handling
  • โœ… Type-safe integration
  • โœ… Simple 2-line API to join voice and play music
  • โœ… Local dependency testing without publishing
  • โœ… Production-ready error handling

See the Auric Integration Guide for complete details.



๐Ÿค– Basic Bot
Simple ping-pong bot


โšก Command Handler
Advanced command system


๐ŸŽต Music Bot
Full-featured with Auric


๐Ÿ‘‚ Event Listeners
Handle all events


๐Ÿ”Š Voice Activity
Monitor voice channels


๐ŸŽญ Role Manager
Manage server roles


๐Ÿ› ๏ธ Development

Contributing to Discore

๐Ÿงช Testing

dart test

Run the full test suite

๐Ÿ” Analysis

dart analyze

Check code quality

โœจ Formatting

dart format .

Format all code


๐Ÿ—บ๏ธ Roadmap

What's coming next?

โœ… Completed

  • โœ… Discord API v10 support
  • โœ… Gateway WebSocket connection
  • โœ… Voice state management
  • โœ… Complete REST API
  • โœ… Event system
  • โœ… Snowflake IDs
  • โœ… All gateway intents
  • โœ… Auric integration

๐Ÿšง Coming Soon

  • โณ Slash commands support
  • โณ Message components (buttons, menus)
  • โณ Embeds builder
  • โณ Presence updates
  • โณ Advanced caching layer
  • โณ Rate limit improvements
  • โณ Webhook support
  • โณ Stage channel support

๐Ÿ“„ License

MIT License - see LICENSE file for details


๐Ÿ™ Acknowledgments


Discord
Excellent API docs

Dart Team
Amazing language

Contributors
Community support

๐Ÿ“ž Support & Community

GitHub Issues Discord Server Discussions


Discord API Dart Docs Auric Lavalink


Made with โค๏ธ and โ˜• by developers, for developers

    โ•”โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•—
    โ•‘                                       โ•‘
    โ•‘    ๐Ÿ’ป  Code  โ€ข  Learn  โ€ข  Build  ๐Ÿš€  โ•‘
    โ•‘                                       โ•‘
    โ•‘      Thank you for using Discore!     โ•‘
    โ•‘                                       โ•‘
    โ•šโ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•

Star โญ this repo if you find it useful!


๐ŸŽ‰ Happy Coding! ๐ŸŽ‰

Build something amazing with Discore today!

GitHub Stars GitHub Forks GitHub Watchers


ยฉ 2024 Discore. All rights reserved.

Libraries

discore
Discore - The Ultimate Discord API Wrapper for Dart