add info command

This commit is contained in:
Wieland Schöbl
2020-08-14 01:58:20 +02:00
parent d6a3691756
commit a8babb52ba
5 changed files with 24 additions and 18 deletions

16
.idea/workspace.xml generated
View File

@@ -3,18 +3,10 @@
<component name="ChangeListManager"> <component name="ChangeListManager">
<list default="true" id="1aabf22b-2f57-46ac-9973-367d8668ffd3" name="Default Changelist" comment=""> <list default="true" id="1aabf22b-2f57-46ac-9973-367d8668ffd3" name="Default Changelist" comment="">
<change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" /> <change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" />
<change beforePath="$PROJECT_DIR$/build.gradle" beforeDir="false" afterPath="$PROJECT_DIR$/build.gradle" afterDir="false" /> <change beforePath="$PROJECT_DIR$/README.md" beforeDir="false" afterPath="$PROJECT_DIR$/README.md" afterDir="false" />
<change beforePath="$PROJECT_DIR$/gradle.properties" beforeDir="false" afterPath="$PROJECT_DIR$/gradle.properties" afterDir="false" /> <change beforePath="$PROJECT_DIR$/src/main/kotlin/de/wulkanat/Admin.kt" beforeDir="false" afterPath="$PROJECT_DIR$/src/main/kotlin/de/wulkanat/Admin.kt" afterDir="false" />
<change beforePath="$PROJECT_DIR$/src/main/kotlin/Admin.kt" beforeDir="false" afterPath="$PROJECT_DIR$/src/main/kotlin/de/wulkanat/Admin.kt" afterDir="false" /> <change beforePath="$PROJECT_DIR$/src/main/kotlin/de/wulkanat/Cli.kt" beforeDir="false" afterPath="$PROJECT_DIR$/src/main/kotlin/de/wulkanat/Cli.kt" afterDir="false" />
<change beforePath="$PROJECT_DIR$/src/main/kotlin/Bot.kt" beforeDir="false" afterPath="$PROJECT_DIR$/src/main/kotlin/de/wulkanat/Bot.kt" afterDir="false" /> <change beforePath="$PROJECT_DIR$/src/main/kotlin/de/wulkanat/Main.kt" beforeDir="false" afterPath="$PROJECT_DIR$/src/main/kotlin/de/wulkanat/Main.kt" afterDir="false" />
<change beforePath="$PROJECT_DIR$/src/main/kotlin/Channels.kt" beforeDir="false" afterPath="$PROJECT_DIR$/src/main/kotlin/de/wulkanat/Channels.kt" afterDir="false" />
<change beforePath="$PROJECT_DIR$/src/main/kotlin/Cli.kt" beforeDir="false" afterPath="$PROJECT_DIR$/src/main/kotlin/de/wulkanat/Cli.kt" afterDir="false" />
<change beforePath="$PROJECT_DIR$/src/main/kotlin/DataIO.kt" beforeDir="false" afterPath="$PROJECT_DIR$/src/main/kotlin/de/wulkanat/DataIO.kt" afterDir="false" />
<change beforePath="$PROJECT_DIR$/src/main/kotlin/Main.kt" beforeDir="false" afterPath="$PROJECT_DIR$/src/main/kotlin/de/wulkanat/Main.kt" afterDir="false" />
<change beforePath="$PROJECT_DIR$/src/main/kotlin/extensions/Color.kt" beforeDir="false" afterPath="$PROJECT_DIR$/src/main/kotlin/de/wulkanat/extensions/Color.kt" afterDir="false" />
<change beforePath="$PROJECT_DIR$/src/main/kotlin/model/BlogPostPreview.kt" beforeDir="false" afterPath="$PROJECT_DIR$/src/main/kotlin/de/wulkanat/model/BlogPostPreview.kt" afterDir="false" />
<change beforePath="$PROJECT_DIR$/src/main/kotlin/web/BlogPostParser.kt" beforeDir="false" afterPath="$PROJECT_DIR$/src/main/kotlin/de/wulkanat/web/BlogPostParser.kt" afterDir="false" />
<change beforePath="$PROJECT_DIR$/src/main/kotlin/web/SiteWatcher.kt" beforeDir="false" afterPath="$PROJECT_DIR$/src/main/kotlin/de/wulkanat/web/SiteWatcher.kt" afterDir="false" />
</list> </list>
<option name="SHOW_DIALOG" value="false" /> <option name="SHOW_DIALOG" value="false" />
<option name="HIGHLIGHT_CONFLICTS" value="true" /> <option name="HIGHLIGHT_CONFLICTS" value="true" />

View File

@@ -3,7 +3,7 @@ A bot that automatically polls the newest blogpost from [Hytale News Tab](https:
## Setup ## Setup
Okay, this isn't really meant for you to setup, if you want it though it first is easier to just dm me on Twitter [@tale_talk](https://twitter.com/tale_talk) so I can add you to the server list. Okay, this isn't really meant for you to setup, if you want it though it first is easier to just dm me on Twitter [@tale_talk](https://twitter.com/tale_talk) so I can add you to the server list.
If you *really* want to set it up yourself, fine. If you *really* want to set it up yourself, fine.
1. first clone the repo, build it, etc. 1. first go to the release tab, download the jar, and put it in a folder
2. Add two files in the root of the repo, an `admin.json` and a `servers.json`. 2. Add two files in the root of the repo, an `admin.json` and a `servers.json`.
Add your Discord ID (not name), Bot token, and update frequency to the `admin.json`: Add your Discord ID (not name), Bot token, and update frequency to the `admin.json`:
```json ```json
@@ -13,10 +13,14 @@ Add your Discord ID (not name), Bot token, and update frequency to the `admin.js
```json ```json
[] []
``` ```
Not sure, but it might be that multiline JSON doesn't work. Not sure, but it might be that multiline JSON doesn't work.
Start the server. If you put in everything correctly, the bot should message you on Discord. ## Compiling yourself
I developed it under Windows, and had some trouble compiling it on Linux. You mileage may vary.
## Admin commands
Start the server with `java -jar [server-file-name]` If you put in everything correctly, the bot should message you on Discord.
### Adding Servers ### Adding Servers
``` ```
%!addChannel [channelID] [roleID/everyone] %!addChannel [channelID] [roleID/everyone]
@@ -30,7 +34,14 @@ Second argument is optional.
``` ```
%!stop %!stop
``` ```
### Show servers, channels and roles
```
%!info
```
These commands will work in every channel, but will be ignored if they don't come from you, however the bot will always respond in a private message. These commands will work in every channel, but will be ignored if they don't come from you, however the bot will always respond in a private message.
It will also print errors directly in a Discord private message. It will also print errors directly in a Discord private message.
## TODO
Mainly reaction roles for convenience, self setup on invite to server, Twitter integration.

View File

@@ -85,7 +85,7 @@ object Admin {
) )
} }
fun ready() { fun info() {
sendDevMessage( sendDevMessage(
EmbedBuilder() EmbedBuilder()
.setTitle("Now watching for new Hytale Blogposts every ${updateMs / 1000}s") .setTitle("Now watching for new Hytale Blogposts every ${updateMs / 1000}s")

View File

@@ -51,6 +51,9 @@ class Cli : ListenerAdapter() {
Admin.warning("Unknown Channel ID") Admin.warning("Unknown Channel ID")
} }
} }
"info" -> {
Admin.info()
}
} }
} catch (e: ArrayIndexOutOfBoundsException) { } catch (e: ArrayIndexOutOfBoundsException) {
// noop // noop

View File

@@ -20,7 +20,7 @@ fun main() {
Channels.jda = builder Channels.jda = builder
Admin.jda = builder Admin.jda = builder
Admin.ready() Admin.info()
Runtime.getRuntime().addShutdownHook(object : Thread() { Runtime.getRuntime().addShutdownHook(object : Thread() {
override fun run() { override fun run() {