DotNetLineBotSDK 0.0.2-alpha

This is a prerelease version of DotNetLineBotSDK.
There is a newer version of this package available.
See the version list below for details.
dotnet add package DotNetLineBotSDK --version 0.0.2-alpha                
NuGet\Install-Package DotNetLineBotSDK -Version 0.0.2-alpha                
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="DotNetLineBotSDK" Version="0.0.2-alpha" />                
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add DotNetLineBotSDK --version 0.0.2-alpha                
#r "nuget: DotNetLineBotSDK, 0.0.2-alpha"                
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
// Install DotNetLineBotSDK as a Cake Addin
#addin nuget:?package=DotNetLineBotSDK&version=0.0.2-alpha&prerelease

// Install DotNetLineBotSDK as a Cake Tool
#tool nuget:?package=DotNetLineBotSDK&version=0.0.2-alpha&prerelease                

取得User Message

var req = this.HttpContext.Request;
using (var bodyReader = new StreamReader(stream: req.Body,
    encoding: Encoding.UTF8,
    detectEncodingFromByteOrderMarks: false,
    bufferSize: 1024, leaveOpen: true))

{
    var body = await bodyReader.ReadToEndAsync();
    var lineReceMsg = ReceivedMessageConvert.ReceivedMessage(body);
    if (lineReceMsg != null && lineReceMsg.Events[0].Type == WebhookEventType.message.ToString())
    {
        if (lineReceMsg.Events[0].Message.Type == MessageType.text.ToString())
        {
            // user message text
            lineReceMsg.Events[0].Message.Text;
        }
    }
}

回應文字訊息

var replyEvent = new ReplyEvent(channel_Access_Token);
var txtMessage1 = new TextMessage("reply message");
await replyEvent.ReplyAsync(lineReceMsg.Events[0].ReplyToken,
                           new List<IMessage>() {
                                txtMessage1
                           });

回應文字+表情訊息

var replyEvent = new ReplyEvent(channel_Access_Token);
var txtMessage1 = new TextMessage("$ LINE emoji $")
{
    Emojis = new List<TextMessageEmoji>()
    {
        new TextMessageEmoji(){Index=0,ProductId="5ac1bfd5040ab15980c9b435",EmojiId="002"},
        new TextMessageEmoji(){Index=13,ProductId="5ac1bfd5040ab15980c9b435",EmojiId="008"}
    }
};
var txtMessage2 = new TextMessage("\U0001F449 Unicode emoji \U0001F617");               
await replyEvent.ReplyAsync(lineReceMsg.Events[0].ReplyToken,
                           new List<IMessage>() {
                                txtMessage1, txtMessage2
                           });
Product Compatible and additional computed target framework versions.
.NET net6.0 is compatible.  net6.0-android was computed.  net6.0-ios was computed.  net6.0-maccatalyst was computed.  net6.0-macos was computed.  net6.0-tvos was computed.  net6.0-windows was computed.  net7.0 was computed.  net7.0-android was computed.  net7.0-ios was computed.  net7.0-maccatalyst was computed.  net7.0-macos was computed.  net7.0-tvos was computed.  net7.0-windows was computed.  net8.0 was computed.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last updated
8.0.0 70 11/25/2024
1.0.0 223 7/18/2023
0.0.5-alpha 190 1/28/2023
0.0.4-alpha 174 12/25/2022
0.0.3-alpha 177 11/30/2022
0.0.2-alpha 183 11/29/2022
0.0.1-alpha 171 11/22/2022