Skip to content

Commit

Permalink
1.5.2: properly error when no token is provided
Browse files Browse the repository at this point in the history
  • Loading branch information
pixelcmtd committed Feb 14, 2024
1 parent c391269 commit 0738364
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 3 deletions.
1 change: 1 addition & 0 deletions .pubignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Dockerfile
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -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
Expand Down
9 changes: 7 additions & 2 deletions bin/jana.dart
Original file line number Diff line number Diff line change
Expand Up @@ -43,9 +43,14 @@ extension SendJson on TextChannel {
}

void main(List<String> 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;
Expand Down
2 changes: 1 addition & 1 deletion pubspec.yaml
Original file line number Diff line number Diff line change
@@ -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:
Expand Down

0 comments on commit 0738364

Please sign in to comment.