Skip to content

Commit

Permalink
Switch database to MongoDB (#97)
Browse files Browse the repository at this point in the history
* change: switch to MongoDB

* Clean up a todo

Signed-off-by: NoComment1105 <[email protected]>

* Fix stars

Signed-off-by: NoComment1105 <[email protected]>

* Fix stars

Signed-off-by: NoComment1105 <[email protected]>

* new: add javadocs for DatabaseHelper.kt

* make some small changes to the database startup

Signed-off-by: NoComment1105 <[email protected]>

* Clean up warnings in ThreadInviter.kt

Signed-off-by: NoComment1105 <[email protected]>

* fix RoleMenu.kt with Mongo

* Completely convert everything to MongoDB

Signed-off-by: NoComment1105 <[email protected]>

* Clean up warnings and add KDoc

Signed-off-by: NoComment1105 <[email protected]>

* typoooooo

Signed-off-by: NoComment1105 <[email protected]>

* Add logo to repository

Signed-off-by: NoComment1105 <[email protected]>

* misc. fixes and tweaks

* update docs

* update required constants

* fix Config.kt, ThreadInviter.kt

* fix ThreadInviter.kt

* fix warn

* lock presence to testing guild, misc changes

* changes from review by NoComment1105

* handle news channels properly

* switch support inviting from if statements to checks

* broken snowflakes in data classes

* Switch extension names to the `lower-kebab-case` convention

* final tweaks

* Fix clear this time for real i promise (likely not though uwu)

Signed-off-by: NoComment1105 <[email protected]>

* wrap lines, update links to guides

* add 3.0.0 changelog, fix line wrapping in old changelogs

* Update to gradle 7.4.1

Signed-off-by: NoComment1105 <[email protected]>

* Fix a spelling

Signed-off-by: NoComment1105 <[email protected]>

* De-duplicate some of the database checking code (#98)

* [WIP] Work on removing some code duplication

Signed-off-by: NoComment1105 <[email protected]>

* More deduplication, javadoc.

Signed-off-by: NoComment1105 <[email protected]>

* Fix a formatting

Signed-off-by: NoComment1105 <[email protected]>

* Do more deduplication

Signed-off-by: NoComment1105 <[email protected]>

* I forgor javadoc 💀

Signed-off-by: NoComment1105 <[email protected]>

* I really should polish things into one commit shouldn't I?

Signed-off-by: NoComment1105 <[email protected]>

* Apply changes

Signed-off-by: NoComment1105 <[email protected]>

* Fix thread control

Signed-off-by: NoComment1105 <[email protected]>

Co-authored-by: NoComment1105 <[email protected]>
Co-authored-by: NoComment <[email protected]>
  • Loading branch information
3 people authored Mar 19, 2022
1 parent 25b14b9 commit fd888d0
Show file tree
Hide file tree
Showing 34 changed files with 1,157 additions and 1,036 deletions.
2 changes: 2 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ root = true
charset = utf-8
end_of_line = lf
tab_width = 4
max_line_length = 120
insert_final_newline = true

[*.gradle]
indent_style = tab
Expand Down
25 changes: 15 additions & 10 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,38 +6,43 @@ When opening issues, please make sure that you include as much information as ap
[stacktrace](https://stackoverflow.com/questions/3988788/what-is-a-stack-trace-and-how-can-i-use-it-to-debug-my-application-errors)
of what went wrong. This can be attached as a file, or uploaded to a [GitHub Gist](https://gist.github.com/).
* If your issue is a bug or otherwise unexpected behavior, explain what happened and what you expected to happen.
* If you're having trouble setting the bot up, we recommend joining the [Iris Discord server](https://discord.gg/jQJnav2jPu) as we will be able to provide more dynamic support there.
* If you're having trouble setting the bot up, we recommend joining [our discord](https://discord.gg/hy2329fcTZ)
as we will be able to provide more dynamic support there.

## Pull Requests

We love to see when people contribute to the project! Our [Issues Page](https://github.com/IrisShaders/LilyBot/issues) often has a list of features that need to be implemented. However, you'll need to read the following guidelines:
We love to see when people contribute to the project! Our [Issues Page](https://github.com/IrisShaders/LilyBot/issues)
often has a list of features that need to be implemented. However, you'll need to read the following guidelines:

### Contributor License Agreement (CLA)

By submitting changes to the repository, you are hereby agreeing that:

* Your contributions will be licensed irrevocably under the [GNU General Public License v3.0](https://choosealicense.com/licenses/gpl-3.0/).
* Your contributions are of your own work and free of legal restrictions (such as patents and copyrights) or other issues
which would pose issues for inclusion or distribution under the above license.
* Your contributions will be licensed irrevocably under the
[GNU General Public License v3.0](https://choosealicense.com/licenses/gpl-3.0/).
* Your contributions are of your own work and free of legal restrictions (such as patents and copyrights)
or other issues which would pose issues for inclusion or distribution under the above license.

If you do not agree with these terms, please do not submit contributions to this repository. If you have any questions
about these terms, feel free to join the [Iris Discord server](https://discord.gg/jQJnav2jPu) and ask any questions that
you may have in the the `lilybot-development` channel.
about these terms, feel free to join [our discord](https://discord.gg/hy2329fcTZ)
and ask any questions that you may have.

### Code Style

When contributing source code changes to the project, ensure that you make consistent use of the code style guidelines
used throughout the codebase (which closely follow the standard Java code style guidelines).
Notably, please wrap all ines at 120 characters.
These are not explicitly enforced, but are generally welcome.

We have no plans to use automatic word detection, since it can easily have false positives and is generally more annoying
and intrusive than helpful. Any Pull Requests that attempt to do this will be closed.
We have no plans to use automatic word detection, since it can easily have false positives and is generally
more annoying and intrusive than helpful. Any Pull Requests that attempt to do this will be closed.

### Making a Pull Request

Your Pull Request should include a brief description of the changes it makes and link to any open issues which it
resolves. You should also ensure that your code follows the outlined guidance above.

When adding new commands to the project, thoroughly explain why you would like said command to be added to the bot. It's recommended to first draft any such command in [our Discord server](https://discord.gg/jQJnav2jPu).
When adding new commands to the project, thoroughly explain why you would like said command to be added to the bot.
It's recommended to first draft any such command in [our Discord server](https://discord.gg/jQJnav2jPu).

**All new pull requests should target the [develop branch](https://github.com/IrisShaders/LilyBot/tree/develop).**
68 changes: 46 additions & 22 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,45 +1,69 @@
# LilyBot
![GitHub Workflow Status](https://img.shields.io/github/workflow/status/IrisShaders/LilyBot/Build%20Only?label=Build%20Only) ![GitHub Workflow Status](https://img.shields.io/github/workflow/status/IrisShaders/LilyBot/Build%20&%20Deploy?label=Build%20and%20Deploy)
![GitHub Workflow Status](https://img.shields.io/github/workflow/status/IrisShaders/LilyBot/Build%20Only?label=Build%20Only)
![GitHub Workflow Status](https://img.shields.io/github/workflow/status/IrisShaders/LilyBot/Build%20&%20Deploy?label=Build%20and%20Deploy)

![GitHub issues](https://img.shields.io/github/issues/IrisShaders/LilyBot?label=Issues)
![GitHub pull requests](https://img.shields.io/github/issues-pr/IrisShaders/LilyBot?label=Pull%20Requests)

![GitHub](https://img.shields.io/github/license/IrisShaders/LilyBot?label=License) ![GitHub repo size](https://img.shields.io/github/repo-size/IrisShaders/LilyBot?label=Repository%20Size)
![GitHub](https://img.shields.io/github/license/IrisShaders/LilyBot?label=License)
![GitHub repo size](https://img.shields.io/github/repo-size/IrisShaders/LilyBot?label=Repository%20Size)

![GitHub commits since latest release](https://img.shields.io/github/commits-since/IrisShaders/LilyBot/latest/main?include_prereleases)
![GitHub commit activity](https://img.shields.io/github/commit-activity/w/IrisShaders/LilyBot?label=Commit%20Activity)

<img src="docs/lily-logo-transparent.png" alt="The LilyBot Logo" style="width: 128px"/>

![GitHub commits since latest release](https://img.shields.io/github/commits-since/IrisShaders/LilyBot/latest/main?include_prereleases) ![GitHub commit activity](https://img.shields.io/github/commit-activity/w/IrisShaders/LilyBot?label=Commit%20Activity)
## Links
* **Visit [our website](https://irisshaders.net) for downloads and pretty screenshots!**
* Visit [our Discord server](https://discord.gg/jQJnav2jPu) to chat about Iris projects (such as LilyBot) and get support!
* Visit [Coderbot's Patreon page](https://www.patreon.com/coderbot) to support the continued development of Iris projects!
* Visit [Iris's Discord](https://discord.gg/hy2329fcTZ) to chat about Iris projects and join our amazing community.
* Visit [our discord](https://discord.gg/hy2329fcTZ) to watch the development of LilyBot and get support.
* Visit [Coderbot's Patreon page](https://www.patreon.com/coderbot)
to support the continued development of Iris projects!

### Why?
* Iris had a need for a utility and moderation bot in our Discord. Available bots were largely closed source, and having an in-house bot was preferable anyway. Hence, LilyBot!
* Iris had a need for a utility and moderation bot in our Discord.
Available bots were largely closed source, and having an in-house bot was preferable anyway. Hence, LilyBot!

### History
* Late in August 2021, Discord.py, the library that our previous bot utilized, was discontinued. So [NoComment](https://github.com/NoComment1105), [Miss Corruption](https://github.com/Miss-Corruption), [Maxigator](https://github.com/Maxigator) and [chalkyjeans](https://github.com/chalkyjeans) took on the task of rewriting the bot in JDA.
* Then with need for features that JDA did not provide, another rewrite occurred! This time [NoComment](https://github.com/NoComment1105), [Miss Corruption](https://github.com/Miss-Corruption), [Maximum](https://github.com/maximumpower55) and [IMS](https://github.com/IMS212), began rewriting in Kotlin, using the [Kord API](https://github.com/kordlib/kord) and [KordEx Extension Library](https://github.com/Kord-Extensions/kord-extensions)
* Late in August 2021, Discord.py, the library that our previous bot utilized, was discontinued.
So [NoComment](https://github.com/NoComment1105), [Miss Corruption](https://github.com/Miss-Corruption),
[Maxigator](https://github.com/Maxigator) and [chalkyjeans](https://github.com/chalkyjeans)
took on the task of rewriting the bot in JDA.
* Then with need for features that JDA did not provide, another rewrite occurred!
This time [NoComment](https://github.com/NoComment1105), [Miss Corruption](https://github.com/Miss-Corruption),
[Maximum](https://github.com/maximumpower55) and [IMS](https://github.com/IMS212), began rewriting in Kotlin,
using the [Kord API](https://github.com/kordlib/kord) and
[KordEx Extension Library](https://github.com/Kord-Extensions/kord-extensions)
* In early 2022, we decided to expand the scope of LilyBot to be usable in other servers.

### How can I use LilyBot myself!?
Follow our in-depth [installation guide](https://github.com/IrisShaders/LilyBot/blob/main/docs/installation-guide.md).
* If you're looking to add Lily to your server, try our
[usage guide](https://github.com/IrisShaders/LilyBot/blob/main/docs/usage-guide.md).
* If you're looking to host Lily for yourself, try our
[hosting guide](https://github.com/IrisShaders/LilyBot/blob/main/docs/hosting-guide.md).
* If you're looking to set up a development environment for Lily, try our
[development guide](https://github.com/IrisShaders/LilyBot/blob/main/docs/development-guide.md).

### What was used to write this bot and what does each thing do?
* [Kord](https://github.com/kordlib/kord), the Kotlin API for Discord.
* [KordEx](https://github.com/Kord-Extensions/kord-extensions), an integrated commands and extensions framework for Kord.
* KordEx's [Minecraft Mappings](https://github.com/Kord-Extensions/ext-mappings) and [Phishing](https://github.com/Kord-Extensions/kord-extensions/tree/develop/extra-modules/extra-phishing) extensions.
* [JetBrains Exposed](https://github.com/JetBrains/Exposed), [SQLite](https://github.com/xerial/sqlite-jdbc), and [HikariCP](https://github.com/brettwooldridge/HikariCP) to manage the database used for warnings, server configurations, and other small things.
* [KordEx](https://github.com/Kord-Extensions/kord-extensions),
an integrated commands and extensions framework for Kord.
* KordEx's [Minecraft Mappings](https://github.com/Kord-Extensions/ext-mappings) and
[Phishing](https://github.com/Kord-Extensions/kord-extensions/tree/develop/extra-modules/extra-phishing) extensions.
* [MongoDB](https://www.mongodb.com/) and [KMongo](https://litote.org/kmongo/)
to manage the database used for warnings, server configurations, and other small things.
* [Groovy](https://www.groovy-lang.org/), allows us to use groovy files for logback,
* [Logback](https://github.com/qos-ch/logback), a library that makes logging prettier.
* [Kotlin Logging](https://github.com/MicroUtils/kotlin-logging), a lightweight logging that wraps slf4j with kotlin extensions
* [Github-API](https://github.com/hub4j/github-api), the API utilized by the GitHub commands.
* [TOML](https://github.com/Jezza/toml) library for custom commands
* [Shadow Gradle Plugin](https://github.com/johnrengelman/shadow), allows us to make a big fatjar containing all dependencies
* [Logback](https://github.com/qos-ch/logback), a library that makes logging prettier
* [Kotlin Logging](https://github.com/MicroUtils/kotlin-logging),
a lightweight logging that wraps slf4j with kotlin extensions
* [Github-API](https://github.com/hub4j/github-api), the API utilized by the GitHub commands
* [TOML](https://github.com/Jezza/toml), a library for custom commands
* [Shadow Gradle Plugin](https://github.com/johnrengelman/shadow),
a tool which allows us to make a big fatjar containing all dependencies

#### This repo is open to contributions by the community. Please check our [Contributor Guidelines](https://github.com/IrisShaders/LilyBot/blob/main/CONTRIBUTING.md) before doing so.
**This repo is open to contributions by the community. If you plan on contributing, please check our
[Contributor Guidelines](https://github.com/IrisShaders/LilyBot/blob/main/CONTRIBUTING.md).**

### Contributors
![GitHub contributors](https://img.shields.io/github/contributors/IrisShaders/LilyBot?label=Total%20Contributors)

<a href="https://github.com/IrisShaders/LilyBot/graphs/contributors">
<img src="https://contrib.rocks/image?repo=IrisShaders/LilyBot" />
</a>
![contributors](https://contrib.rocks/image?repo=IrisShaders/LilyBot)
13 changes: 3 additions & 10 deletions build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ plugins {
application

kotlin("jvm")
kotlin("plugin.serialization") version "1.6.10"

id("com.github.johnrengelman.shadow")
}
Expand Down Expand Up @@ -59,16 +60,8 @@ dependencies {
// Github API
implementation(libs.github.api)

// Exposed
implementation(libs.exposed.core)
implementation(libs.exposed.dao)
implementation(libs.exposed.jdbc)

// Hikari
implementation(libs.hikari)

// SQLite
implementation(libs.sqlite.jdbc)
// KMongo
implementation(libs.kmongo)
}

application {
Expand Down
5 changes: 3 additions & 2 deletions docs/changelogs/2.0.0.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,9 @@ This update fully rewrites Lily in Kotlin, resulting in a much cleaner codebase.
* Add manual message reporting for those who can't utilize the context menu.
* Add message deletion logging.
* Add integration for Discord timeouts, remove old mute system.
* Add support threading system. Whenever someone sends a message in the specified channel, a thread will be created for them.
* Add support threading system. Whenever someone sends a message in the specified channel,
a thread will be created for them.
* Add soft bans.
* Switch to TOML for custom commands allowing for much easier editing.

As this is the first officially published release, there is no proper list of commits.
As this is the first officially published release, there is no proper list of commits.
7 changes: 5 additions & 2 deletions docs/changelogs/2.0.1.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,9 @@ This update includes a variety of small bugfixes. The full list of changes is be
* Remove unused dependencies.
* Update to Gradle 7.3.3.
* Make responses to GitHub commands work properly.
* Add sentry integration, see the [installation guide](https://github.com/IrisShaders/LilyBot/blob/main/docs/installation-guide.md) for more how to set up! Or don't if you don't want to.
* Add sentry integration, see the
[installation guide](https://github.com/IrisShaders/LilyBot/blob/main/docs/installation-guide.md)
for more how to set up! Or don't if you don't want to.
* Updates to the custom commands list.
* Some internal refactors around extension locations.
* Re-added NotEnoughCrashes detection and confirmation to log uploading.
Expand All @@ -19,4 +21,5 @@ This update includes a variety of small bugfixes. The full list of changes is be
* Nuke star imports.
* Fix banning via id, this was previously prevented by our moderator and bot checks.

You can find a list of all the commits in this update [here](https://github.com/IrisShaders/LilyBot/compare/v2.0...v2.0.1).
You can find a list of all the commits in this update
[here](https://github.com/IrisShaders/LilyBot/compare/v2.0...v2.0.1).
9 changes: 6 additions & 3 deletions docs/changelogs/2.1.0.md
Original file line number Diff line number Diff line change
@@ -1,18 +1,21 @@
# LilyBot 2.1.0 Changelog

This update is medium-sized, but has lots of important changes for the future of Lily. The full list of changes can be found below.
This update is medium-sized, but has lots of important changes for the future of Lily.
The full list of changes can be found below.

* Add Dockerfile for deployment.
* Add KordEx's built-in Minecraft mappings extension
* Add commands to archive and rename threads
* Add a command to create a menu for role selection.
* Switched config for roles and channels from `.ENV` to a database, add commands to set and clear said config.
* A [full list](https://github.com/IrisShaders/LilyBot/blob/main/docs/commands.md) of all commands, their syntax, and what they do.
* A [full list](https://github.com/IrisShaders/LilyBot/blob/main/docs/commands.md) of all commands, their syntax,
and what they do.
* Log attachment URLS along with messages.
* An updated `README.md`, and `CONTRIBUTING.md`.
* New issue and PR templates
* Various internal package refactors and movement of code.
* Tweaks to the custom commands list
* Various other fixes and tidying for message logging, `.gitignore`, banning users out of guild, and GitHub commands.

You can find a list of all the commits in this update [here](https://github.com/IrisShaders/LilyBot/compare/v2.0.1...v2.1.0).
You can find a list of all the commits in this update
[here](https://github.com/IrisShaders/LilyBot/compare/v2.0.1...v2.1.0).
17 changes: 17 additions & 0 deletions docs/changelogs/3.0.0.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# LilyBot 3.0.0 Changelog

This is a major update that fully overhaul's Lily's database system. The full list of changes can be found below.

* Switch Lily's database to [MongoDB](https://www.mongodb.com/) utilizing [KMongo](https://litote.org/kmongo/).
* Minor fixes for the say command.
* Hopefully a full fix for the clear command.
* Add Lily's logo to the repository. This logo can be found
[here](https://github.com/IrisShaders/LilyBot/blob/main/docs/lily-logo-transparent.png).
* Split the old installation guide in three. We now have a
[usage guide](https://github.com/IrisShaders/LilyBot/blob/main/docs/usage-guide.md),
a [hosting guide](https://github.com/IrisShaders/LilyBot/blob/main/docs/hosting-guide.md),
and a [development guide](https://github.com/IrisShaders/LilyBot/blob/main/docs/development-guide.md).
* Remove some star imports, fix lots of warnings, and generally clean up code.

You can find a list of all the commits in this update
[here](https://github.com/IrisShaders/LilyBot/compare/v2.1.0...v3.0.0).
1 change: 1 addition & 0 deletions docs/commands.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ Arguments:
* `presence` - Value for Lily's status - String

Result: Lily's "Now Playing:" status is set to `presence`.
This command can only be executed in the test guild specified in your `.env` file.

## Moderation Commands
These commands are for use by moderators.
Expand Down
Loading

0 comments on commit fd888d0

Please sign in to comment.