Git Product home page Git Product logo

discore's Introduction

discore

GitHub last commit GitHub tag (latest by date) GitHub Lines of code Discord Badge

A Discord bot core built upon JDA, written in Kotlin.

Current features

Embed Constructor

A simpler, cleaner way to create a MessageEmbed. The embed constructor has two forms: the inline form, and the structured form. The embed constructor consists of multiple components, all of which are optional. They are as follows:

Name Type Example
author EmbedAuthor See below
color String "#2f3136"
description String "Total stats"
footer EmbedFooter See below
image String "https://img.com/img.png"
thumbnail String "https://img.com/img2.jpg"
timestamp TemporalAccessor Instant.now()
title EmbedTitle See below
fields List<EmbedField> See below

The complex components consist of the following attributes:

EmbedAuthor

Name Type Example Default
name String "zp4rker" null
url String "https://google.com" null
iconUrl String "https://img.com/avtr.png" null

EmbedFooter

Name Type Example Default
text String "Created by zp4rker#3333" null
iconUrl String "https://img.com/avtr.png" null

EmbedTitle

Name Type Example Default
text String "Cool embed title" "Title"
url String "https://google.com" null

EmbedField

Name Type Example Default
title String "Current level" EmbedBuilder.ZERO_WIDTH_SPACE
text String "Lvl. 47" EmbedBuilder.ZERO_WIDTH_SPACE
inline Boolean false true

Inline Constructor

// Example 1
embed(author = author(name = "zp4rker", iconUrl = "https://img.avatar.com/zp4rker.png"), color = "#568abe", description = "This the embed content.")

// Example 2
embed(footer = footer(text = "Made by zp4rker#3333"), fields = listOf(field(title = "embed #1", text = "here is some text"), field(title = "empty text field"), field(title = "non-inline embed", text = "some text", inline = false)))

Structured Constructor

// Example 1
embed {
    author {
        name = "zp4rker"
        iconUrl = "https://img.avatar.com/zp4rker.png"
    }
    
    color = "#568abe"
    
    description = "This is the embed content."
}

// Example 2
embed {
    footer {
        text = "Made by zp4rker#3333"
    }
    
    field {
        title = "embed #1"
        text = "here is some text"
    }
    
    field {
        title = "empty text field"
    }
    
    field {
        title = "non-inline embed"
        text = "some text"
        inline = false
    }
}

Bot constructor

A simple, structured and clean way to build the JDA instance. Below are the current options available within the constructor:

Name Type Default Description
name String "Discore" The name of the bot, used for the default logger.
version String "1.0.0" The bot's version, used in log outputs.
token String "empty" The Discord bot token, used to authenticate the bot. Required
prefix String "/" The prefix for the command handler.
helpCommandEnabled Boolean true Whether or not the default help command should be registered.
commands List<Command> listOf() The list of commands to register on startup.
activity Activity null The activity/status of the bot.
intents Int GatewayIntent.DEFAULT The gateway intents the bot should start with.
cache List<CacheFlag> listOf() Whether or not cache should be enabled.
quit () -> Unit {} The function to run when the bot is quitting.
// Example
bot {
    name = "MySuperCoolBot"
    version = "1.3.7"
    token = "secure.code"
    
    prefix = "!"
    commands = arrayOf(PingCommand, FunCommand, PurgeCommand)
    
    activity = Activity.playing("something awesome")
    
    quit = {
        logger.info("Now quitting...")
        // run some cleanup code
    }
}

Invoking the bot constructor returns an instance of the Bot class, which has two methods to register commands or event listeners: addCommands(vararg commands: Command) & addEventListeners(vararg listeners: EventListener). When using the bot constructor, the IEventManager is set to InterfacedEventManager(). Using the bot constructor also initialises the following constants:

Name Class
API JDA
BOT Bot
LOGGER Logger
DISCORE_VERSION String

discore's People

Contributors

zp4rker avatar

Stargazers

avi s chetlin avatar Arijan Nikoci avatar

Watchers

James Cloos avatar  avatar  avatar

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.