AsukaBot - A simple Kotlin Discord Bot

Related tags

App AsukaBot
Overview

AsukaBot - A simple Kotlin Discord Bot

The Discord bot of the serber, a private Discord server. Asuka is a Discord But running on the JDA API but made in kotlin. Asuka support ini configuration file, local modules and slash commands.

Configuration


As you see, Asuka use a INI configuration file with the api Init4j, and you configuration file should be like this :

[configuration]
token = Insert your token here
owner_ids = Owner ids are here separated by a simple space (like this " ")
motd = A useless status for the bot

If you don't know how to read the code, just launch it with gradle (type ./gradlew run in terminal) and the config file shloud be created on the first boot.

Also, there is some arguments used by Asuka to run with different configurations :

Arguments Definition
--sigma Launch the bot in sigma mode (aka debug mode). This mode disable non debug events, such as modules and some commands. Also activate debug console and authorize use of debug commands.
--no-events Disable all non system events, such as almost all ListenerAdapter() events.
--invisible Launch the bot in invisible mode. Can be used with --sigma for incognito debugging.

The Module Manager


The module manager is a simple module class with a module handler and interface. the module manager can manage simple module class at bot startup, for cache, logging, commands, or anything else. To create a command, you need to implement your newly created class to IModule and import all needed methods and variables. Once your module created, you just simply need to initialize it on the main class on Asuka.kt in the loadModules()

A correct module with no extra functions should look like this :

package modules

import managers.IModule

class TestModule : IModule {
    
    override var name: String
        get() = TODO("Not yet implemented")
        set(value) {}

    override fun execution() {
        TODO("Not yet implemented")
    }
}
Member Description
name The name of the module, initialized in the get() assignation
execution The method used as main module method. You are free to create more method in order to evolve your module.

The Command Module


The command module is the main command class handler and interface. It also support the use for slash commands, but only for one guild (You can change this guild ID, just by replacing the hardcoded one in the modules.CommandModule.tk class).

In order to make a command, just like Modules, you have to create a class implemented by the ICommand interface.

A correct command class should look like this :

{ TODO("Not yet implemented") } } ">
package commands

import modules.CommandOption
import modules.CommandType
import modules.ICommand
import net.dv8tion.jda.api.events.interaction.SlashCommandEvent

class TestCmd : ICommand {
    override var name: String
        get() = TODO("Not yet implemented")
        set(value) {}

    override var description: String
        get() = TODO("Not yet implemented")
        set(value) {}

    override var type: CommandType
        get() = TODO("Not yet implemented")
        set(value) {}

    override fun execution(event: SlashCommandEvent) {
        TODO("Not yet implemented")
    }

    override fun options(): HashMap<CommandOption, Boolean> {
        TODO("Not yet implemented")
    }
}

Let me explain you what you have to do if you are lost :

Member Definition
name As you see, it's the name of the command. write it without upper case, because it's case sensitive.
description The description of the command, who will be displayed on discord when you type the command.
type The type of the command. The type will be one of the CommandType types.
execution There is where your command code will be. There is a event variable containing the SlashCommand event. You are free to create and use other methods or variables in order to evolve your command.
options The option method is kinda special. You have to return a HashMap with a CommandOption in key and a Boolean in value. The CommandOption is the class created to handle Slash commands options. You have to create a new variable of its type, and initialize the type (with OptionType enum), the name and the desctiption. Once you do that, you have to put your CommandOption in the returned Hashmap. The Boolean value is the setRequired method needed by JDA. set true if the option is required.

Installation


Everything is in the gradle configuration files. All you need to do is know how to use gradle !

Contribution


If you want to contribute to the project, you can give it a star or discuss on it with suggestions, or reports !

Thank you all ! <3

You might also like...
Simple Telegram bot that responds with list of results obtained from Google.
Simple Telegram bot that responds with list of results obtained from Google.

Simple project focused on learning a little more about how Telegram bots work and are created. The bot has a very basic functionality: the user types

GoogleSearchBot - Google Search Bot With Kotlin

GoogleSearchBot Simple telegram bot on kotlin with spring framework With command

🐦 Loritta's Social media relayer via Discord Webhooks micro-service

🐦 SocialRelayer 🐦 SocialRelayer is a social media relayer to Discord via webhooks, pulling Loritta's guild configurations to automatically register

An open-source reimplementation of the Discord Android app

OpenCord An open source reimplementation of the Discord Android app. Why does this exist? Current discord app sucks as it looks ugly and doesn't suppo

Experimental Discord Mobile Rich Presence (Android)

MRPC Experimental Discord Mobile Rich Presence (Android) How does it work? It's pretty simple. Connect to the Discord Gateway as a normal Discord Clie

A Discord audio player that streams audio from the desktop.

Synced A Discord audio player that streams audio from the desktop. Synced runs as a bot that plays audio to your selected Discord server. You can cont

Mindusty -- Discord

Minducord Mindustry -- Discord Setup Go to Releases and download minducord.jar. After download, paste it to mods folder and run server. If you can s

Photon Framework provides cool way to Discord Slash Commands πŸ‘©β€πŸ’» 🚧

Photon Framework provides cool way to Discord Slash Commands πŸ‘©β€πŸ’» 🚧

🎧 Hacky last.fm Discord rich presence
🎧 Hacky last.fm Discord rich presence

LastFmRichPresence 🎧 Hacky last.fm Discord rich presence How to use?

Owner
Yann ItzPeaxel
He / Him. Trying to be a fullstack dev. 20 Yo & Computer Science sutdent
Yann ItzPeaxel
A simple Discord bot that aims to provide a snapshot of the join logs given a range of time for servers.

?? What is Humpy Dumpy? Humpy Dumpy is a simple Discord bot that aims to provide a snapshot of the join logs given a range of time for servers. It was

Miu 2 Aug 29, 2022
A lightweight, feature-rich wrapper for the Telegram Bot API, providing a handy Kotlin DSL to quickly build your bot.

Kotlin Telegram Bot Kotlin based wrapper over Telegram API. Current version of the Telegram Api: 6.0 Principles Annotations Magic. The basic interacti

Jey 61 Dec 27, 2022
Urban Dictionary discord bot.

Urban Dictionary Installation & Setup 1. Clone the repository git clone https://github.com/thexxiv/urbandictionary-discord-bot.git 2. Navigate to the

XXIV 0 Jan 17, 2022
DiscordBot - Small Discord bot using JDA

Discord bot written in kotlin and using JDA Use it yourself ./gradlew build crea

chell 2 Feb 2, 2022
TimmyBot is a discord bot based on Discord4J and LavaPlayer

TimmyBot TimmyBot is a discord bot based on Discord4J and LavaPlayer Invite Click here to invite Timmy to your server Commands ?play - Plays a song, e

Ian de Villiers 0 Apr 21, 2022
A Discord bot heavily inspired by Ultimate Bravery to spice up your Pokemon Unite experience.

UniteBraveryBot ?? A Discord bot heavily inpired by Ultimate Bravery to spice up your Pokemon Unite experience. Required Permissions ?? View Channels

Alexander Deledda 2 Sep 8, 2022
All things generative! Discord Bot

Thingy Discord bot to generate images based on a text prompt - way more than just that! Through a wide variety of tools, you can alter your generated

Peter Willemsen 17 Dec 15, 2022
Simple metrics exporter HTTP server for Prometheus meant to be used for private Discord servers.

Discord Prometheus Exporter Simple metrics exporter HTTP server for Prometheus meant to be used for private Discord servers. Thanks to the creator of

Subham 2 Nov 29, 2022
Based on mirai, a fast simple bot for maimai DX

maimai-bot δΈ€δΈͺ基于 mirai ε’Œ 舞萌 DX ζŸ₯εˆ†ε™¨ ηΌ–ε†™ηš„ maimai DX QQ ζœΊε™¨δΊΊζ’δ»Άγ€‚

εΏƒζ°΄ζΉ›ζΈ… 20 Dec 16, 2022
Simple configurable Twitch Chat Bot for Emote Repetition 😎

DopaminChatter Dopamin is the happiness hormone. What's better than a Twitch Chat with great Emote Usage and Emote Chains (same Emotes after another).

Jakob 2 Dec 9, 2022