mirror of
https://github.com/Duke-Syndicate/duke-bot.git
synced 2025-09-10 04:38:13 +00:00
Update to use environment variables
This commit is contained in:
parent
81acf75760
commit
efdd502b52
2
.gitignore
vendored
2
.gitignore
vendored
@ -1,4 +1,4 @@
|
|||||||
token.txt
|
.env
|
||||||
app.jar
|
app.jar
|
||||||
|
|
||||||
duke-bot*
|
duke-bot*
|
||||||
|
11
README.md
Normal file
11
README.md
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
# Duke Bot
|
||||||
|
The bot for the Duke Syndicate discord.
|
||||||
|
|
||||||
|
## Example docker compose
|
||||||
|
```yaml
|
||||||
|
services:
|
||||||
|
bot:
|
||||||
|
build: .
|
||||||
|
environment:
|
||||||
|
- BOT_TOKEN=token_goes_here
|
||||||
|
```
|
@ -4,12 +4,9 @@ import net.dv8tion.jda.api.JDABuilder;
|
|||||||
import net.dv8tion.jda.api.entities.Activity;
|
import net.dv8tion.jda.api.entities.Activity;
|
||||||
import net.dv8tion.jda.api.requests.GatewayIntent;
|
import net.dv8tion.jda.api.requests.GatewayIntent;
|
||||||
|
|
||||||
import java.io.IOException;
|
|
||||||
import java.nio.charset.StandardCharsets;
|
|
||||||
|
|
||||||
public class Main {
|
public class Main {
|
||||||
public static void main(String[] args) throws IOException, InterruptedException {
|
public static void main(String[] args) {
|
||||||
String token = new String(Main.class.getResourceAsStream("/token.txt").readAllBytes(), StandardCharsets.UTF_8);
|
String token = System.getenv("BOT_TOKEN");
|
||||||
|
|
||||||
JDABuilder builder = JDABuilder.createDefault(token)
|
JDABuilder builder = JDABuilder.createDefault(token)
|
||||||
.addEventListeners(new ReadyListener(), new MessageListener());
|
.addEventListeners(new ReadyListener(), new MessageListener());
|
||||||
|
@ -3,12 +3,13 @@ package hard.rock;
|
|||||||
import net.dv8tion.jda.api.events.GenericEvent;
|
import net.dv8tion.jda.api.events.GenericEvent;
|
||||||
import net.dv8tion.jda.api.events.session.ReadyEvent;
|
import net.dv8tion.jda.api.events.session.ReadyEvent;
|
||||||
import net.dv8tion.jda.api.hooks.EventListener;
|
import net.dv8tion.jda.api.hooks.EventListener;
|
||||||
|
import org.jetbrains.annotations.NotNull;
|
||||||
|
|
||||||
public class ReadyListener implements EventListener {
|
public class ReadyListener implements EventListener {
|
||||||
@Override
|
@Override
|
||||||
public void onEvent(GenericEvent event) {
|
public void onEvent(@NotNull GenericEvent event) {
|
||||||
if (event instanceof ReadyEvent) {
|
if (event instanceof ReadyEvent) {
|
||||||
System.out.println("Duke is rizzing");
|
System.out.println("Duke is omniscient");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user