Skip to content

Handschrift/Papilertus

Repository files navigation

About this project

Papilertus is a (high configurable) general purpose bot providing different abilities for basic server management, moderation and entertainment. It also provides a plugin interface giving the ability to extend the bot with custom features.
Currently the bot is in a very early state so feel free to open any issues if there are some.

Requirements

  • Java 17

Installation

Gradle

Clone from GitHub:

git clone https://github.com/Handschrift/Papilertus.git

Build the jar with all dependencies:

./gradlew shadowJar

This should create an executable Papilertus-1.0-all.jar

Run the .jar with:

java -jar Papilertus-1.0-all.jar

After the first start it should create a configuration file where you can enter your bot token. If you don't have a token, create a bot at the Discord developer portal.

Configuration

Key Default value Description
token empty The bot token if you plan to host the bot yourself
plugindir "plugins/" Path to your Plugins folder
databaseUrl "mongodb://localhost/" URL to your mongodb
databaseUsername "admin" username of your mongodb
databasePassword "admin" password of your mongodb
cacheFlags list (see above) list of disabled caches
feedbackRecipientId empty user id of the user who should receive the feedback
databaseName "Papilertus" mongodb database name
possibleNotificationMessages list (see above) list of possible notifications
probabilityForNotifications 1 (equals 1%) probability for a notification to be sent

Core Commands

These are commands build into Papilertus

Command Description
feedback Sends feedback to the user specified in the config

Plugins

How to install plugins

On the first start, the bot should have created a folder called "plugins". To install Plugins just download the plugin or build it yourself and put the .jar into the "plugins" folder.

You have to restart the bot after you have installed a plugin!

A collection of plugins can be found at gitlab: https://gitlab.com/papilertus/

Attention!

Even with the ability to write custom plugins, we are not responsible for any damage done with plugins of third parties. Plugins are arbitrary chunks of code which are able to execute any kind instruction including reading or deleting files or extracting your bot's token!

Creating Plugins

Clone from GitHub:

git clone https://github.com/Handschrift/Papilertus.git

Build the library version of Papilertus:

./gradlew shadowJar

A jar should be generated in build/libs which you can use as a dependency in a gradle project.

plugin.json

Every plugin needs a plugin.json which you can create in the resources directory of your project

The file should contain the following:

{
  "name": "NAME_OF_THE_PLUGIN",
  "author": "NAME_OF_THE_AUTHOR",
  "mainClass": "MAIN_CLASS_PATH"
}

Basic setup

Create a Class which implements the Plugin interface and the overrides the corresponding methods:

class MyPlugin : Plugin {
    override fun getCommands(): List<Command> {

    }

    override fun getContextMenuEntries(): List<ContextMenuEntry> {

    }

    override fun getListeners(): List<EventListener> {

    }

    override fun onLoad(data: PluginData) {
        println("Hello World")
    }

    override fun onUnload() {

    }
}

Creating commands

First create a class extending the Command class provided by Papilertus:

class MyCommand : Command("name", "description") {
    override fun execute(event: SlashCommandInteractionEvent) {
        event.reply("Test!").queue()
    }
}

Then in your main class you have to add the command to the command list:

override fun getCommands(): List<Command> {
    return listOf(
        MyCommand()
    )
}

Supporting this project

You can support this project with:

  • contributing to the code
  • adding the bot to your server / host your own instance
  • testing