Hi, i know this method to send announces:
await TheTwitchAPI.Helix.Chat.SendChatAnnouncementAsync(broadcasterId:, moderatorId: , message: “”, color: , accessToken: );
But i have a problem. Im connecting 2 accounts, Owner and Bot to an Owner’s Channel, and the accessToken have Owner’s channel ID instead of Bot ID so when i use Bot ID on “moderatorId:” parameter it throw an exception.
The other way i know is using “/announce” but if i use this at start of a message the message is not sended. (If i write “/me” at start of message the message is sended and coloured perfectly)
Im using this to connect Owners account:
WebServer.RequestReceived += async (s, e) =>
using (var writer = new StreamWriter(e.Response.OutputStream))
var code = e.Request.QueryString[“code”];
var ownerOfChannelAccessAndRefresh = await getAccessAndRefreshTokens(code);
CachedOwnerOfChannelAccessToken = ownerOfChannelAccessAndRefresh.Item1;
And this to send the announce:
await TheTwitchAPI.Helix.Chat.SendChatAnnouncementAsync(broadcasterId: TwitchChannelId, moderatorId: BotChannelId, message: “El Anuncio esta funcionando”, color: announceColor, accessToken: <oauthClave/CachedOwnerOfChannelAccessToken both throw exception>);
It throw this:
TwitchLib.Api.Core.Exceptions.BadScopeException: ‘Your request was blocked due to bad credentials (Do you have the right scope for your access token?).’
The way i connect the bot is using this: < Twitch Chat Password Generator >
and then <var credentials = new ConnectionCredentials(nombreBot, oauthClave);
With that i can use <BotClient.OnChatCommandReceived> and then <BotClient.SendMessage()>
But cant use <await TheTwitchAPI.Helix.Chat.SendChatAnnouncementAsync(broadcasterId: TwitchChannelId, moderatorId: BotChannelId, message: “”, color: announceColor, accessToken: CachedOwnerOfChannelAccessToken);> because the token i generate is using Owner Channel Account instead of Bot Account.
I dont know how to generate accessToken with that scope to SendChatAnnouncement WITHOUT login in predetermined browser my Bot Account.
Just an other question because as you can see im noob, Why dont you implement <Client.SendChatAnnouncement()> or maybe is there a way to do it and i dont know it.