mineral-dart / core

🧡 The neuralgic heart of the application, this module gathers all the functionalities of the framework.
https://mineral-foundation.org
MIT License
27 stars 8 forks source link
api-rest bot dart dart3 dartlang dartmineral discord discord-api discord-bot discord-bots discord-server discordapi discordapiwrapper discordapp discordbot flutter mineral mineraldart null-safety websocket

Mineral - Discord Bot Framework for Dart

banner

Mineral meets a need for scalability over time but also within a team of developers thanks to a modular and flexible software architecture. modular and flexible software architecture.

Don't reinvent the wheel, the framework facilitates the sharing and accessibility of your data across your entire of your application. Design modules that can be reused in several of your projects.

We want to make your life easier, Mineral provides you with dedicated classes for each of the following features of Discord: events, commands, context menus, etc...

In order to improve your development experience, we wanted to integrate some features that do not exist in Discord but are very interesting but very interesting features such as intra-application data sharing through the Stores, a bunch of additional events around your discord servers or access in only one and 2 lines of code to an API through official Dart packages delivering recurring features such as tickets recurring features such as tickets, invitations or voice chancels on demand.

With Mineral, you can unleash the full potential of your bot and bring your Discord server to life.

Key Features

Command Handling

Commands in Mineral serve the purpose of defining specific actions that your bot can perform in response to a given command. They allow users to communicate with your bot and interact with it in a structured way.

class HelloWorldCommand extends MineralCommand<GuildCommandInteraction> {
  HelloWorldCommand(): super(
    label: Display('hello'),
    description: Display('Add new member to the ticket !'),
    options: [
      CommandOption.user(Display('member'), Display('The member to add to the ticket !'))
    ]
  );

  Future<void> handle (interaction) async {
    final targetMember = interaction.getMember('member');

    await interaction.reply(
      content: 'Hello $targetMember',
      private: true
    );
  }
}

Event Listeners

Commands in Mineral serve the purpose of defining specific actions that your bot can perform in response to a given command. They allow users to communicate with your bot and interact with it in a structured way.

By utilizing events, you can create dynamic and interactive experiences within your Discord bot. Events allow you to capture and respond to various actions and changes happening in real-time, enabling your bot to adapt and provide relevant functionality based on the events occurring in the Discord environment.

class Ready extends MineralEvent<ReadyEvent> with Console {
  Future<void> handle (event) async {
    console.info('${event.client.user.username} is ready to use !');
  }
}

Interactive Components

By utilizing events, you can create dynamic and interactive experiences within your Discord bot. Events allow you to capture and respond to various actions and changes happening in real-time, enabling your bot to adapt and provide relevant functionality based on the events occurring in the Discord environment.

By incorporating interactive components into your Discord bot, you can enhance user engagement and provide a more interactive and dynamic experience. They allow users to interact with your bot directly within messages, enabling them to perform actions, make choices, and receive real-time feedback. Interactive components add an extra layer of interactivity to your bot's functionality and can greatly enhance the user experience.

Interactive components enhance the way buttons are used in Discord bots by introducing interactivity and real-time feedback.

A single file allows you to design your composanbt and attach a dedicated handler when the user interacts with it.

class MyButton extends InteractiveButton {
  MyButton(): super('my-id');

  @override
  Future<void> handle (ButtonCreateEvent event) async {
    await event.interaction.reply(
      content: 'Hello Mineral !', 
      private: true
    );
  }

  @override
  ButtonBuilder build () => ButtonBuilder.button(customId)
    ..setLabel('Mineral')
    ..setStyle(ButtonStyle.primary);
}

State Management

Share and manage data across your bot using shared states.

class MyState extends MineralState<int> {
  MyState() : super(0);

  void increment() => state++;

  void decrement() => state--;
}

Community and Support

Join our vibrant community of Discord bot developers on Discord to get support, share your projects, and collaborate with other developers.

We also encourage you to contribute to the Mineral project by reporting issues, suggesting new features, or submitting pull requests on GitHub.

Start your journey with Mineral today and create extraordinary Discord bots that will elevate your server to new heights!

Discord Discord [Tiktok]()