question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Have Context.Guild.GetBanAsync not throw an Discord.Net.HttpException when user is not banned

See original GitHub issue

What I must do right now

Discord.Rest.RestBan guildUsers = null;
try {
    guildUsers = await Context.Guild.GetBanAsync(banMember);
} catch { }

if(guildUsers != null) // Do some code shenangans

What I think should be done

Discord.Rest.RestBan guildUsers = await Context.Guild.GetBanAsync(banMember);

if(guildUsers != null) // Do some code shenangans

Is there a reason why this hasn’t been done?

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:6

github_iconTop GitHub Comments

2reactions
jakedacatmancommented, Aug 28, 2020

Well the issue hasn’t been fixed yet, so I would leave it open for posterity.

0reactions
OoLunarcommented, Aug 28, 2020

I had no idea the when keyword was a thing, interesting! I already have a fix made, but I’m glad you offered one to everyone else who might’ve been having the same issue. Should I keep this issue open to raise awareness, or should I close it?

Read more comments on GitHub >

github_iconTop Results From Across the Web

discord.net ban having a value of null
1 Answer 1 ... Guild.GetBansAsync() returns a list of user who are banned on this server, not the list of users that the...
Read more >
Changelog
#2711 Fixed modifying guild resets preferred locale (12c50f2) · #2713 Fixed some ReplyAsync methods missing MessageFlags parameter. · #2714 Fixed disconnecting ...
Read more >
Class SocketGuild
This property retrieves all users found within this guild. warning. This property may not always return all the members for large guilds (i.e....
Read more >
Discord.Net.HttpException: - Developer Community
i did code a bot for discord and i get error 401 idk what to do i watched giude how to fix this...
Read more >
Opcodes and Status Codes - Developer Portal
This table explains what the application defined close codes for the gateway are, and which close codes you should not attempt to reconnect....
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found