Giter Club home page Giter Club logo

k-bot's Introduction

kbot

Kbot, a Quantum Discord bot in SpringBoot.

kbot sonar kot CI


📣Introduction

A DIY bot that you can be the designer of your own K-bot ​!:fire:

K-bot is a Quantum Discord bot, which means she can do everything, if she has enough plugins. 🚀

It is NOT the specific bot which is just for importing to your Discord server( absolutely, she can do that ! 😉 ).

K-bot is developed in SpringBoot and makes all the plugins as plugins/configurations. hence you can chose what skills you want for K-bot via setting the configuration files to summon the abilities, and you can add and register your own plugins in K-bot easily. 🤠


📖Usage

IF YOU WANNA USE IT.

Set those configurations to application.yml(more details in application-example.yml).

Get your bot

k-bot:
  # your bot token
  token: "your bot token"
  # the command you wanna call your bot
  cmd: "!koy"

Summon Plugin

the plugins you want add to your bot and then , it will only create those plugin instances.

  # register plugins
  plugins:
  - player
  - time
  - joker

IF YOU WANNA CREATE IT !

Create Plugin

  • Implementation interface.

the parser will give the arguments to your plugin if it matched.

public interface IPlugin {
    
    void handle(String[] args);
    
    @Deprecated
    String command();
}
  • Define command

We use the annotation @Plugin to define the plugin meta data.

@Target(ElementType.TYPE)
@Retention(RetentionPolicy.RUNTIME)
@Inherited
public @interface Plugin {

    // the plugin name
    String name() default "";

    // how to call the plugin normally
    String call();

    // fast commands
    String[] fastCommand() default {};
}
  • Configure the condition

We won't create the plugin instance when it does not be called, so we should set the conditional configuration.

@Bean
@ConditionalOnSummoned(name = "k-bot.plugins", havingValue = "player")
public AudioPlayer audioPlayer(){
    return new AudioPlayer();
}

Example

the example of how to create the plugin joker.

  • create joker
@Plugin(name = "joker", call = "joker", fastCommand = {"j", "jk"})
public class Joker implements IPlugin {
    ...
}
  • set bean condition
@Bean
@ConditionalOnSummoned(name = "k-bot.plugins", havingValue = "joker")
public Joker joker() {
    return new Joker();
}

it is so easy to add an new plugin to K-bot, isn't it ! 🎉


🔧Plugins

NOTE: Command doesn't contain the command/name calling the bot. 📝

Plugin Description Command Example
Player A audio player based on lavaplayer. play [- u ] play hello
Joke Send a joke randomly. joke joke
time Report the current time of the city. time [cityname] time Tokyo
weather Report the current weather details of the city. weather [cityname] weather Beijing
... waiting for your ideas !:rocket:

Help

help is an embed command that it can help a lot about the commands, such as recommending the similar commands when you called a non exist command.


🚀Contributing

Folk it !

  • fix bugs: send a PR here !
  • feature:it is better to have an feature request issue first and then, working on it !

📃 Statement

The API of bot are all getting from the open resources, if there has any problem, leaving an issues please.

MIT @Koy

k-bot's People

Contributors

dependabot[bot] avatar koooooo-7 avatar sivyer9303 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

k-bot's Issues

[Player] Player need refactor.

Feature Request

Motivation

Making Player more talented.

Implementation

Not yet, for more investigation.

Assignment

Me.

add bot self introduction

add a plugin to show bot's introduction,i.e.
!kono hi
will get a message like 'hi,i'm kbot, i can talk with u by ur type command....'.
is it necessary?

optimize introduction plugin , change to use annotations to get plugin description.

Feature Request

optimize introduction plugin , change to use annotations to get plugin description.

Motivation

To make introduction plugin more flexible by use annotation to collection plugin description.

Implementation

Add a annotation that use in plugins.
Define a bean processor to collection annotation field then fill them into collections.
Rewrite getting plugin description logic in introduction plugin.

Assignment

i'll make this myself.

[Unit Test] Building Unit Test.

Feature Request

Motivation

Making bot more reliable and can be tested.

Implementation

Junit + Mock tool or something better.

Assignment

Myself.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.