Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Twitch added (New) "SendChatMessage" API endpoint - Currently not in Helix API #406

Open
WrithemTwine opened this issue Nov 5, 2024 · 5 comments

Comments

@WrithemTwine
Copy link

https://dev.twitch.tv/docs/api/reference/#send-chat-message
Send Chat Message
NEW Sends a message to the broadcaster’s chat room.

Reviewing:
https://github.com/TwitchLib/TwitchLib.Api/tree/dev/TwitchLib.Api.Helix.Models/Chat

Not seeing new Twitch Api endpoint in TwitchLib.API

@WrithemTwine WrithemTwine changed the title Twitch API added (New) "SendChatMessage" - Currently not in Helix API Twitch added (New) "SendChatMessage" API endpoint - Currently not in Helix API Nov 5, 2024
@Hampo
Copy link
Contributor

Hampo commented Nov 5, 2024

Already available in dev:

/// <summary>
/// Sends a message to a chat
/// </summary>
/// <param name="broadcasterId">The ID of the broadcaster whose chat room the message will be sent to.</param>
/// <param name="senderId"> The ID of the user sending the message. This ID must match the user ID in the user access token.</param>
/// <param name="message"> The message to send. The message is limited to a maximum of 500 characters. Chat messages can also include emoticons. To include emoticons, use the name of the emote. The names are case sensitive. Don’t include colons around the name (e.g., :bleedPurple:). If Twitch recognizes the name, Twitch converts the name to the emote before writing the chat message to the chat room</param>
/// <param name="replyParentMessageId">The ID of the chat message being replied to. If omitted, the message is not a reply</param>
/// <param name="accessToken"></param>
/// <returns></returns>
/// <exception cref="BadParameterException"></exception>
public Task<SendChatMessageResponse> SendChatMessage(string broadcasterId, string senderId, string message, string replyParentMessageId = null, string accessToken = null)
{
if (string.IsNullOrEmpty(broadcasterId))
throw new BadParameterException("broadcasterId must be set");
if (string.IsNullOrEmpty(senderId))
throw new BadParameterException("senderId must be set");
if (string.IsNullOrEmpty(message))
throw new BadParameterException("message must be set");
var json = new JObject
{
["broadcaster_id"] = broadcasterId,
["sender_id"] = senderId,
["message"] = message
};
if (replyParentMessageId != null)
{
json.Add("reply_parent_message_id", replyParentMessageId);
}
return TwitchPostGenericAsync<SendChatMessageResponse>("/chat/messages", ApiVersion.Helix, json.ToString(), null, accessToken);
}

@WrithemTwine
Copy link
Author

Didn't add detail... not finding in latest NuGet

image
image
image
image

@Hampo
Copy link
Contributor

Hampo commented Nov 6, 2024

Ah, that's an annoying issue - the NuGet releases aren't in order. If you check the page you can see the release date.

I think you want 3.10.0-preview-b3dba8d .

https://www.nuget.org/packages/TwitchLib.Api#versions-body-tab

@WrithemTwine
Copy link
Author

WrithemTwine commented Nov 6, 2024

Is it possible to add subversion numbers?
although this time, probably want a clean 3.10.0, so might be too late

ok to close

3.10.0-preview-92a4359 is later
image
image

@Mahsaap
Copy link
Member

Mahsaap commented Nov 6, 2024

correct [92a4359](https://github.com/TwitchLib/TwitchLib.Api/commit/92a4359ed145876af4e8e108e267004dcb0babab) is the latest

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants