diff --git a/.pubignore b/.pubignore new file mode 100644 index 0000000..9414382 --- /dev/null +++ b/.pubignore @@ -0,0 +1 @@ +Dockerfile diff --git a/CHANGELOG.md b/CHANGELOG.md index a3ff727..d92203e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,7 @@ +## 1.5.2 + +- Print an error and `exit(1)` instead of crashing when no token is provided + ## 1.5.1 - Ping the admin (pixel) by id, not name diff --git a/bin/jana.dart b/bin/jana.dart index 298c342..d1e819d 100644 --- a/bin/jana.dart +++ b/bin/jana.dart @@ -43,9 +43,14 @@ extension SendJson on TextChannel { } void main(List argv) async { + final token = Platform.environment['JANA_DISCORD_TOKEN'] ?? argv.firstOrNull; + if (token == null || token.isEmpty) { + stderr.writeln('No token provided (env JANA_DISCORD_TOKEN or pass as arg)'); + exit(1); + } + final bot = await Nyxx.connectGateway( - Platform.environment['JANA_DISCORD_TOKEN'] ?? argv.first, - GatewayIntents.allUnprivileged | GatewayIntents.messageContent, + token, GatewayIntents.allUnprivileged | GatewayIntents.messageContent, options: GatewayClientOptions(plugins: [Logging(), CliIntegration()])); internal = await bot.channels.get(internalId) as TextChannel; diff --git a/pubspec.yaml b/pubspec.yaml index a9030f0..3ad6e50 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -1,6 +1,6 @@ name: jana description: A Discord bot -version: 1.5.1 +version: 1.5.2 homepage: https://github.com/chrissxMedia/jana environment: