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
Starlk2y ago
please do not cross-post. why are you not just awaiting the method?
invisibility
invisibility2y ago
invisibility
invisibility2y ago
Starlk
Starlk2y ago
is there a reason why you are calling .GetAwaiter().GetResult(); instead of making your method async so that you can use await
invisibility
invisibility2y ago
Nop
invisibility
invisibility2y ago
Starlk
Starlk2y ago
then prefix your methods with await and remove the get awaiter calls
invisibility
invisibility2y ago
But those I don’t understand before it worked and when I want changed the GetChannelAsync ID works more
Starlk
Starlk2y ago
I'm not sure if I understand what you've said
invisibility
invisibility2y ago
Basically I had it on another discord all worked I made a transition to another discord its no longer works
Starlk
Starlk2y 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
invisibility2y ago
and my bot doesn’t connect either
Starlk
Starlk2y ago
this is not helpful are there any error messages?
invisibility
invisibility2y ago
Unknown User
Unknown User2y ago
Message Not Public
Sign In & Join Server To View