DiscordClient.GetChannelAsync

Hello, I put on my discord the channel id but its not working here is my code
var a = Client.GetChannelAsync(ChannelID).GetAwaiter().GetResult();
var myMsg = a.GetMessagesAsync(1).GetAwaiter().GetResult();
var a = Client.GetChannelAsync(ChannelID).GetAwaiter().GetResult();
var myMsg = a.GetMessagesAsync(1).GetAwaiter().GetResult();
15 Replies
Starlk
Starlk3y ago
please do not cross-post. why are you not just awaiting the method?
invisibility
invisibilityOP3y ago
invisibility
invisibilityOP3y ago
Starlk
Starlk3y ago
is there a reason why you are calling .GetAwaiter().GetResult(); instead of making your method async so that you can use await
invisibility
invisibilityOP3y ago
Nop
invisibility
invisibilityOP3y ago
Starlk
Starlk3y ago
then prefix your methods with await and remove the get awaiter calls
invisibility
invisibilityOP3y ago
But those I don’t understand before it worked and when I want changed the GetChannelAsync ID works more
Starlk
Starlk3y ago
I'm not sure if I understand what you've said
invisibility
invisibilityOP3y ago
Basically I had it on another discord all worked I made a transition to another discord its no longer works
Starlk
Starlk3y ago
you are not answering my question... however, I think the error message is quite self explanatory, it seems the bot does not have access to the channel ID check permissions
invisibility
invisibilityOP3y ago
and my bot doesn’t connect either
Starlk
Starlk3y ago
this is not helpful are there any error messages?
invisibility
invisibilityOP3y ago
Unknown User
Unknown User3y ago
Message Not Public
Sign In & Join Server To View
Want results from more Discord servers?
Add your server