chatr/ChatrNotificationBotTest/Program.cs

33 lines
1.0 KiB
C#

using Chatr;
ChatrClient clt=new ChatrClient();
var bot=clt.AuthenticateBot("http://127.0.0.1:4031/","YOUR_API_KEY");
bot.OnMessage += (sender,e)=>{
Console.WriteLine($"New Messsage: {e.Data.Content}");
};
await bot.StartCommunication();
bot.SendMessage("me","Demi Lovato Is Cool");
bot.SendNotification("mnolan1202","SOME_NOTIFICATION223","Hot Chicks?","Do You Want Demi Lovato?",
NotificationEvent.CreateBotCallback(),
NotificationButton.CreateButton("Download",NotificationEvent.CreateDownload("http://192.168.0.142:3252/api/Storage/Video/PzUKeGZiEl0")),
NotificationButton.CreateButton("Fire Bot",NotificationEvent.CreateBotCallback())
);
bot.OnNotificationEventFire += (sender,e)=>{
if(string.IsNullOrWhiteSpace(e.Data.Button))
{
Console.WriteLine($"Notification: \"{e.Data.BotNotificationId}\" Clicked");
}else{
Console.WriteLine($"Notification: \"{e.Data.BotNotificationId}\" Action \"{e.Data.Button}\" Clicked");
}
};
while(true)
{
}