Skip to content

Instantly share code, notes, and snippets.

@relyky
Last active May 28, 2021 03:50
Show Gist options
  • Save relyky/b616032c84f45c99d7cad22806504e55 to your computer and use it in GitHub Desktop.
Save relyky/b616032c84f45c99d7cad22806504e55 to your computer and use it in GitHub Desktop.
line.cli 指令範例
§§ line.cli
https://www.nuget.org/packages/line.cli/
## 指令參考
line config -t [channel access token --- 很長的一串代碼]
# 送出文字訊息
line push -u [userId] -m [message]
line push -u SomeOneLineId0123456789abcdef0123 -m "有效耶!!"
# 送出貼圖訊息(sticker)
line push -u [userId] -s [stickerId]
line push -u SomeOneLineId0123456789abcdef0123 -s 1,3
# 送出圖片訊息(image)
line push -u SomeOneLineId0123456789abcdef0123 -i https://i.imgur.com/0DNElwF.png
# 當然也可送出複合訊息
line push -u SomeOneLineId0123456789abcdef0123 -m "測試複合訊息" -s 1,3 -i https://i.imgur.com/0DNElwF.png
using System;
namespace LineBotConsole
{
class Program
{
static void Main(string[] args)
{
String channelAccessToken = "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx....";
String userId = "SomeOneLineId0123456789abcdef0123";
var bot = new isRock.LineBot.Bot(channelAccessToken);
bot.PushMessage(userId, "測試送訊息 LINE bot。"); // text message
bot.PushMessage(userId, 1, 4); // sticker message
bot.PushMessage(userId, new Uri("https://i.imgur.com/0DNElwF.png")); // image message
Console.WriteLine("LINE bot 應用:已透過LINE Message API 送出訊息。");
Console.ReadKey();
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment