Last active
May 28, 2021 03:50
-
-
Save relyky/b616032c84f45c99d7cad22806504e55 to your computer and use it in GitHub Desktop.
line.cli 指令範例
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
§§ 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 | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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