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
|
||||
|
||||
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.requests.GatewayIntent;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
|
||||
public class Main {
|
||||
public static void main(String[] args) throws IOException, InterruptedException {
|
||||
String token = new String(Main.class.getResourceAsStream("/token.txt").readAllBytes(), StandardCharsets.UTF_8);
|
||||
public static void main(String[] args) {
|
||||
String token = System.getenv("BOT_TOKEN");
|
||||
|
||||
JDABuilder builder = JDABuilder.createDefault(token)
|
||||
.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.session.ReadyEvent;
|
||||
import net.dv8tion.jda.api.hooks.EventListener;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
public class ReadyListener implements EventListener {
|
||||
@Override
|
||||
public void onEvent(GenericEvent event) {
|
||||
public void onEvent(@NotNull GenericEvent event) {
|
||||
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