GithubHelp home page GithubHelp logo

kord-extensions / template Goto Github PK

View Code? Open in Web Editor NEW
5.0 3.0 3.0 123 KB

Template repository for quickly getting started with a KordEx bot

Home Page: https://kordex.kotlindiscord.com

License: The Unlicense

Kotlin 14.61% Groovy 85.39%
kotlin discord discord-bot bot kord

template's Introduction

KordEx Bot Template

This repository contains a basic KordEx example bot for you to use as a template for your own KordEx bots. This includes the following:

  • A basic extension that allows you to slap other people, using both message commands and slash commands.
  • A basic bot configuration that enables slash commands and shows you how to conditionally provide a different message command prefix for different guilds.
  • A Gradle Kotlin build script that uses the Kotlin Discord public maven repo, Detekt for linting (with a fairly strict configuration) and a Git commit hook plugin that runs Detekt when you make a commit - this uses Gradle 7's new version catalog feature, for easy configuration of dependencies.
  • GitHub CI scripts that build the bot and publish its artefacts.
  • A reasonable .gitignore file, including one in the .idea folder that ignores files that you shouldn't commit - if you're using IDEA yourself, you should install the Ignore plugin to handle changes to this for you.
  • A Groovy-based Logback config, so you've reasonable logging out of the box.

Note: This template includes a .editorconfig file that defaults to using tabs for indentation in almost all file types. This is because tabs are more accessible for the blind, or those with impaired vision. We won't accept feedback or PRs targeting this approach.

Potential Changes

  • The .yml files in .github/ are used to configure GitHub apps. If you're not using them, you can remove them.
  • The provided LICENSE file contains The Unlicense, which makes this repository public domain. You will probably want to change this - we suggest looking at Choose a License if you're not sure where to start.
  • In the build.gradle.kts:
    • Set the group and version properties as appropriate.
    • If you're not using this to test KordEx builds, you can remove the mavenLocal() from the repositories block.
    • In the application and tasks.jar blocks, update the main class path/name as appropriate.
    • To target a newer/older Java version, change the options in the KotlinCompile configuration and java blocks
  • In the settings.gradle.kts, update the name of the root project as appropriate.
  • The bundled Detekt config is pretty strict - you can check over detekt.yml if you want to change it, but you need to follow the TODOs in that file regardless.
  • The Logback configuration is in src/main/resources/logback.groovy. If the logging setup doesn't suit, you can change it there.

Bundled Bot

  • App.kt includes a basic bot, which uses environment variables (or variables in a .env file) for the testing guild ID (TEST_SERVER) and the bot's token (TOKEN). You can specify these either directly as environment variables, or as KEY=value pairs in a file named .env. Some example code is also included that shows one potential way of providing different command prefixes for different servers.
  • TestExtension.kt includes an example extension that creates a slap command - this command works as both a message command and slash command, and allows you to slap other users with whatever you wish, defaulting to a large, smelly trout.

To test the bot, we recommend using a .env file that looks like the following:

TOKEN=abc...
TEST_SERVER=123...

Create this file, fill it out, and run the run gradle task for testing in development.

template's People

Contributors

ashhhleyyy avatar dawsson avatar gdude2002 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

template's Issues

Template does not run

Download the template, replace the TEST_SERVER_ID, build, run the built. You will then receive java.lang.NoClassDefFoundError: kotlin/coroutines/Continuation.

I attempted to at kotlinx.coroutines to the dependencies, but that did not solve the issue.

Is this for real?

Note: This template includes a .editorconfig file that defaults to using tabs for indentation in almost all file types. This is because tabs are more accessible for the blind, or those with impaired vision. We won't accept feedback or PRs targeting this approach.

I am just curious, don't blind people (or people with any sort of physical disability) have assistive software installed on their computers/phones?

Isn't that assistive software ignoring whitespace?
If it is not ignoring whitespace, shouldn't that be your focus instead?

I fail to see how a tab is more accessible.


PS: If we are talking about a programmer and not just a code-reviewer, they can use Ctrl+ArrowRight or Ctrl+ArrowLeft to jump over the group of spaces.

', 'FIXME:', 'STOPSHIP:']

template/detekt.yml

Lines 528 to 535 in 9e59497

values: ['TODO:', 'FIXME:', 'STOPSHIP:']
allowedPatterns: ''
ForbiddenImport:
active: false
imports: []
forbiddenPatterns: ''
ForbiddenMethodCall:
active: false


This issue was generated by todo based on a TODO comment in 9e59497. It's been assigned to @gdude2002 because they committed the code.

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.