Skip to content

Koooooo-7/K-Bot

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

94 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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