nyxx-discord/nyxx

Cannot get guild information using OAuth2

Closed this issue · 0 comments

Describe the bug

<title>

Note: partial guilds in nyxx do have only id

To Reproduce

import 'dart:io';

import 'package:nyxx/nyxx.dart';

void main() async {
  final accessToken = 'blah blah';
  final client = await Nyxx.connectOAuth2(Credentials(accessToken, scopes: ['guilds']));
  PartialGuild guild = await client.users.listCurrentUserGuilds().then((guilds) => guilds[0]);
  print(guild); // OK
  print(await guild.get()); // Fail
}

Expected behavior
To get guild information using Bearer token, such as name, permissions, whether user is owner, features, etc

Screenshots
image
(notice the 401: unauthorized in end (GET /guilds/{guild.id}))

Desktop (please complete the following information):

  • OS: unrelated
  • Dart version: unrelated
  • Nyxx version: v6.1.0

Additional context
API provides guild information in /users/@me/guilds: https://discord.com/developers/docs/resources/user#get-current-user-guilds