Skip to content

Kyuuto v1 #26

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 29 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
29 commits
Select commit Hold shift + click to select a range
0eac81f
Create basic bot
duncte123 Apr 22, 2020
dd02cec
Fix lint command
duncte123 Apr 22, 2020
dfa5c80
Update from master
duncte123 Apr 22, 2020
0870f55
Add note about intents
duncte123 Apr 22, 2020
4580340
Use hasmaps for storing commands
duncte123 Apr 22, 2020
78ce510
Create solid base to work with (#1)
duncte123 Apr 24, 2020
08a3a2e
Allow for the application to be booted (#2)
duncte123 May 5, 2020
995b79d
Add Law command (#7)
zsotroav May 15, 2020
a88a99b
Add per server channel locking (#6)
duncte123 May 19, 2020
4774d4b
Add ship command (#9)
duncte123 May 21, 2020
dba8684
Add enlarege command (#5)
MorphTuple May 25, 2020
b5d3006
Add cvt command (#4)
duncte123 May 27, 2020
7d516a1
Add Avatar command (#19)
MorphTuple Jun 2, 2020
3a35f0e
Add route command (#18)
MorphTuple Jun 2, 2020
493148b
Add better style rules to enforce a more consistent code style (#21)
duncte123 Jun 24, 2020
a9ba05a
Add dialog command (#3)
MorphTuple Jun 30, 2020
ae117af
Add Owoify command (#20)
MorphTuple Jul 7, 2020
b3f2a79
Add Help command (#8)
Leguu Jul 12, 2020
247a08e
Add minigame command (#23)
Leguu Jul 13, 2020
4b1cc4f
Add list subcommand to dialog (#24)
duncte123 Jul 14, 2020
62f27fb
Set JDA to use ETF encoding
duncte123 Jul 15, 2020
ca5f343
Fix channel locking (#25)
duncte123 Jul 18, 2020
f580205
Add info command (#22)
zsotroav Jul 21, 2020
00ff975
Upgrade libs and runtime
duncte123 Nov 20, 2020
5049a5f
Fix image in ship command
duncte123 Nov 20, 2020
4ebfa6a
lint and fix workflow files
duncte123 Nov 20, 2020
dc040eb
Add reloading for dialog command (#27)
duncte123 Nov 25, 2020
dd62583
Upgrade libraries
duncte123 Apr 5, 2021
f128396
No :)
duncte123 Apr 5, 2021
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
root = true

[*]
charset = utf-8
end_of_line = lf
insert_final_newline = true
indent_style = space
indent_size = 4
22 changes: 22 additions & 0 deletions .github/workflows/lint-code.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
name: Lint
on: [push, pull_request]
jobs:
lint:
name: ktlint
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/[email protected]

- name: Install java
uses: actions/[email protected]
with:
java-version: '13.0.2' # The JDK version to make available on the path.
java-package: jdk # (jre, jdk, or jdk+fx) - defaults to jdk
architecture: x64 # (x64 or x86) - defaults to x64

- name: Install dependencies
run: ./gradlew dependencies

- name: run linter
run: ./gradlew lintKotlin
36 changes: 13 additions & 23 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,23 +1,13 @@
# Compiled class file
*.class

# Log file
*.log

# BlueJ files
*.ctxt

# Mobile Tools for Java (J2ME)
.mtj.tmp/

# Package Files #
*.jar
*.war
*.nar
*.ear
*.zip
*.tar.gz
*.rar

# virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml
hs_err_pid*
.idea/
!\.idea/copyright/*
!\.idea/copyright/yuuto.xml
!\.idea/copyright/profiles_settings.xml
.gradle/
out/
build/
.env
*.iml
*.ipr
*.iws
rigged_ships.json5
owoify.bundle.js
7 changes: 7 additions & 0 deletions .idea/copyright/profiles_settings.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 6 additions & 0 deletions .idea/copyright/yuuto.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

28 changes: 28 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ The first command clones over HTTPS, the second one over SSH, thus requiring you
- [Project Setup](#project-setup)
- [Bot application](#bot-application)
- [Development](#development)
- [Intents](#intents)
- [Development Server](#development-server)
- [Bots](#bots)
- [Channels](#channels)
Expand All @@ -44,6 +45,23 @@ The first command clones over HTTPS, the second one over SSH, thus requiring you

Kyuuto bot is written in Kotlin and the repository hosted on GitHub, as it's the most popular platform to host Open Source project repositories. The decision for Kotlin came from the initial JS dev team's wish for a more robust platform than Node.js.

To get started setting up the project you will need the following things:
1. Intellij IDEA (The free version supports everything we need)
2. Java 13, added to path and JAVA_HOME env var set, adopt openjdk hotspot recommended
3. A bit of knowledge about gradle
4. Knowledge about kotlin

There are a couple of important gradle commands that you need to know as well, these commands are:
- `./gradlew run` - Runs the project
- `./gradlew lintKotlin` - Runs the linter
- `./gradlew formatKotlin` - Fixes code styling (can be done with ctrl-alt-l in intellij as well)
- `./gradlew build` - Builds the project into a jar

If you are setting up the project for the first time you will need to run `./gradlew idea`.
This command will make sure you have all the proper files for intellij to function correctly. Alternatively you can also run `./gradlew openIdea` to open your intellij installation from the command line directly.

Note: If you are a Windows user you will need to use `gradlew.bat` instead of `./gradlew`

### Bot application

The bot is developed using Kotlin, for JDK 13.
Expand All @@ -53,6 +71,16 @@ Once you have cloned the repository on your local machine, make sure to set up y

Yuuto bot has its own development server, you can join it by clicking [here](https://discord.gg/fPFbV8G). The server is the official means of discussion and collaboration on the bot, together with GitHub's collaboration tools.

### Intents

Because Yuuto is using the `GUILD_MEMBERS` gateway intent from discord you must enable this in your developer portal.

To enable this you have to follow the following steps:
1. Go to https://discordapp.com/developers/applications and select the application that you want to run the code on.
2. Click on the application and select "Bot" on the left side.
3. When you are on the bot page scroll down to "Privileged Gateway Intents" and enable "SERVER MEMBERS INTENT".
4. Press the save button and you are good to go to run Yuuto.

## Development Server

The development server is the place where the campers can interact and test the bot, as for many it might be easier than to work with GitHub's integrated tools and branches. The server also makes use of webhooks to make integration with GitHub even simpler.
Expand Down
100 changes: 100 additions & 0 deletions build.gradle.kts
Original file line number Diff line number Diff line change
@@ -0,0 +1,100 @@
/*
* Open source bot built by and for the Camp Buddy Discord Fan Server.
* Copyright (C) 2020 Kyuuto-devs
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/

import org.gradle.api.tasks.wrapper.Wrapper.DistributionType

plugins {
idea
application
kotlin("jvm") version "1.4.32"
id("org.jmailen.kotlinter") version "3.4.0"
id("com.github.johnrengelman.shadow") version "6.0.0"
}

project.group = "io.github.yuutoproject"
project.version = "4.0-alpha"

repositories {
mavenCentral()
maven("https://m2.dv8tion.net/releases")
jcenter() // JDA utils is still on here :/
}

// JDA and logback-classic are written in java
// But kotlin has terrific java interop
dependencies {
// Kotlin STD and other kotlin stuff
implementation(kotlin("stdlib-jdk8"))
implementation(group = "org.jetbrains.kotlinx", name = "kotlinx-coroutines-core", version = "1.4.3")
// The discord lib
implementation(group = "net.dv8tion", name = "JDA", version = "4.2.1_253") {
exclude(module = "opus-java")
}
// Utils (aka finder util)
implementation(group = "com.jagrosh", name = "jda-utilities", version = "3.0.4")
// dotenv support
implementation(group = "io.github.cdimascio", name = "java-dotenv", version = "5.1.3")
// For logging
implementation(group = "ch.qos.logback", name = "logback-classic", version = "1.2.3")
// For loading the commands (super small lib)
implementation(group = "org.reflections", name = "reflections", version = "0.9.12")
// Http client
implementation(group = "com.squareup.okhttp3", name = "okhttp", version = "4.9.0")
// Json library, ships with JDA but is not in our classpath until we list it here
implementation(group = "com.fasterxml.jackson.core", name = "jackson-databind", version = "2.10.1")
// For all conversions
implementation(group = "org.jscience", name = "jscience", version = "4.3.1")
}

tasks {
compileKotlin {
kotlinOptions.jvmTarget = "11"
}
compileTestKotlin {
kotlinOptions.jvmTarget = "11"
}
wrapper {
gradleVersion = "6.5"
distributionType = DistributionType.ALL
}
shadowJar {
archiveClassifier.set("shadow")

manifest {
attributes["Description"] = "Kyuuto is cute tho"
}
}
}

// Force a minimum of java 11
java {
sourceCompatibility = JavaVersion.VERSION_11
targetCompatibility = JavaVersion.VERSION_11
}

application {
mainClassName = "${project.group}.yuutobot.YuutoKt"
}

kotlinter {
ignoreFailures = false
indentSize = 4
reporters = arrayOf("checkstyle", "plain")
experimentalRules = true
disabledRules = arrayOf("no-wildcard-imports", "experimental:indent", "experimental:argument-list-wrapping")
}
19 changes: 19 additions & 0 deletions gradle.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
#
# Open source bot built by and for the Camp Buddy Discord Fan Server.
# Copyright (C) 2020 Kyuuto-devs
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <https://www.gnu.org/licenses/>.
#

kotlin.code.style=official
Binary file added gradle/wrapper/gradle-wrapper.jar
Binary file not shown.
5 changes: 5 additions & 0 deletions gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-6.5-all.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
Loading