diff --git a/bin/jana.dart b/bin/jana.dart index d07edf4..2f257e8 100644 --- a/bin/jana.dart +++ b/bin/jana.dart @@ -52,17 +52,20 @@ extension SendJson on TextChannel { } void main(List argv) async { - final token = Platform.environment['JANA_DISCORD_TOKEN'] ?? argv.firstOrNull; + final env = Platform.environment; + final token = env['JANA_DISCORD_TOKEN']?.isNotEmpty ?? false + ? env['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 lavalink = Platform.environment.containsKey('JANA_LAVALINK_BASE') && - Platform.environment.containsKey('JANA_LAVALINK_PASSWORD') + final lavalink = (env['JANA_LAVALINK_BASE']?.isNotEmpty ?? false) && + (env['JANA_LAVALINK_PASSWORD']?.isNotEmpty ?? false) ? LavalinkPlugin( - base: Uri.parse(Platform.environment['JANA_LAVALINK_BASE']!), - password: Platform.environment['JANA_LAVALINK_PASSWORD']!, + base: Uri.parse(env['JANA_LAVALINK_BASE']!), + password: env['JANA_LAVALINK_PASSWORD']!, ) : null; diff --git a/pubspec.yaml b/pubspec.yaml index 0993031..8f8ee32 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -1,6 +1,6 @@ name: jana description: A Discord bot -version: 2.0.0-beta.1 +version: 2.0.0-beta.2 homepage: https://github.com/chrissxMedia/jana environment: