C
C#3mo ago
Nothavid

Discord.NET cannot view invite uses

I've been trying out Discord.NET and also tried to implement an invite tracking feature. While implementing this, I attempted to access the uses of an invite link, however, it always just returned 0 while the value should have been 3 in reality. I simplified the code as much as possible and the issue persisted.
DiscordSocketClient client;

DiscordSocketConfig config = new DiscordSocketConfig
{
GatewayIntents = GatewayIntents.All
};

client = new(config);

await client.LoginAsync(TokenType.Bot, TOKEN);

await client.StartAsync();

IInviteMetadata invite = await client.GetInviteAsync("nrqJHqKPM2"); // Invite now deleted

Console.WriteLine($"Uses: {invite.Uses}"); // Uses: 0
DiscordSocketClient client;

DiscordSocketConfig config = new DiscordSocketConfig
{
GatewayIntents = GatewayIntents.All
};

client = new(config);

await client.LoginAsync(TokenType.Bot, TOKEN);

await client.StartAsync();

IInviteMetadata invite = await client.GetInviteAsync("nrqJHqKPM2"); // Invite now deleted

Console.WriteLine($"Uses: {invite.Uses}"); // Uses: 0
The bot has Administrator permissions and all privileged intents enabled on the discord developer platform. I haven't heard anything about needing another scope, but I have the bot and the unrelated applications.commands scopes enabled. Yes, i have also opened the generated link after changing the permissions and authorized the change. I also had the same issue with reading the contents of messages, though I have not tested this feature again. Thanks for any help in advance!
No description
3 Replies
Nothavid
Nothavid3mo ago
I won't be staying up now so I hope I provided all necessary information.
The Fog from Human Resources
Sounds like a default value to me, try to wrap this into a try catch blog and print out possible exceptions
Nothavid
Nothavid3mo ago
Yes, it's the default value. The code runs fine and doesn't throw any Exceptions.
Want results from more Discord servers?
Add your server