Ejemplo n.º 1
0
        public static void SendPushbulletMessage(string title, string message)
        {
            try
            {
                PushbulletClient client;

                User currentUserInformation;

                client = new PushbulletClient("o.7DsY57f3IS7FXOejdR8ncoIXvU3n2yF0");

                currentUserInformation = client.CurrentUsersInformation();

                if (currentUserInformation != null)
                {
                    PushNoteRequest request = new PushNoteRequest()
                    {
                        Email = currentUserInformation.Email,
                        Title = title,
                        Body  = message
                    };

                    PushResponse response = client.PushNote(request);
                }
            }
            catch (Exception)
            {
                // we ignore any pushbullet problems
            }
        }
Ejemplo n.º 2
0
        public void SendNotification(Sites sites)
        {
            PushbulletClient client = new PushbulletClient("o.gPbFYLv0VHGepKmD77nJElg9FWSbGQca");

            //If you don't know your device_iden, you can always query your devices
            var devices = client.CurrentUsersDevices();

            var device = devices.Devices.Where(o => o.Iden == "ujuXuA1sqOqsjAnjr1gpPw");

            String message = "";

            for (int x = 0; x < sites.siteCount(); x++)
            {
                message = message + "Site " + sites.getSite(x).id + " has a value of: " + sites.getSite(x).price + "\n";
            }

            if (device != null)
            {
                PushNoteRequest request = new PushNoteRequest()
                {
                    DeviceIden = "ujuXuA1sqOqsjAnjr1gpPw",
                    Title      = "Value has changed",
                    Body       = message
                };
                PushResponse response = client.PushNote(request);
            }
        }
        public void Send(string title, string message)
        {
            Console.WriteLine();
            Console.WriteLine("--- " + title);
            Console.WriteLine("> " + message);
            Console.WriteLine("---");

            if (!string.IsNullOrWhiteSpace(_apiKey))
            {
                var client = new PushbulletClient(_apiKey);
                var currentUserInformation = client.CurrentUsersInformation();

                if (currentUserInformation != null)
                {
                    PushNoteRequest reqeust = new PushNoteRequest()
                    {
                        Email = currentUserInformation.Email,
                        Title = title,
                        Body  = message
                    };

                    client.PushNote(reqeust);
                }
            }
        }
        public PushbulletMethods()
        {
            Configs configs     = ConfigsTools.GetConfigs <Configs>();
            string  accessToken = configs.PushbulletAccessToken;

            Client = new PushbulletClient(accessToken);
        }
Ejemplo n.º 5
0
        protected override void OnSendNotification(string title, string message, string testing)
        {
            if (!MainControl.PushBulletCheckbox.Checked)
            {
                Logger.Write("UI: Pushbullet notifications are disabled", LogLevel.Debug);
                return;
            }

            if (string.IsNullOrWhiteSpace(MainControl.PushBulletTokenTextBox.Text))
            {
                Logger.Write("UI: Pushbullet Token is missing", LogLevel.Error);
                return;
            }

            try
            {
                var client  = new PushbulletClient(MainControl.PushBulletTokenTextBox.Text);
                var request = new PushNoteRequest {
                    Body = message, Title = title
                };
                if (!string.IsNullOrWhiteSpace(MainControl.PushBulletDeviceIdTextBox.Text))
                {
                    request.DeviceIden = MainControl.PushBulletDeviceIdTextBox.Text;
                }

                var response = client.PushNote(request);

                Logger.Write($"UI: Message pushed to Pushbullet with Id {response.ReceiverIden}", LogLevel.Info);
            }
            catch (Exception ex)
            {
                Logger.Write(ex, "UI: Unable to push Pushbullet notification", LogLevel.Error);
            }
        }
Ejemplo n.º 6
0
        public static async Task <HttpResponseMessage> Run([HttpTrigger(AuthorizationLevel.Anonymous, "get", "post", Route = null)] HttpRequestMessage req, TraceWriter log)
        {
            try
            {
                NotifyRequest notifyRequest = await req.Content.ReadAsAsync <NotifyRequest>();

                string[] pushbulletAccessTokens = Environment.GetEnvironmentVariable("PushbulletAccessTokens").Split(';');

                Parallel.ForEach(pushbulletAccessTokens, pushbulletAccessToken =>
                {
                    var pushbulletClient = new PushbulletClient(pushbulletAccessToken);
                    var result           = pushbulletClient.PushNote(new PushNoteRequest()
                    {
                        Body  = notifyRequest.message,
                        Title = notifyRequest.subject
                    });
                });

                return(req.CreateResponse(HttpStatusCode.OK));
            }
            catch (Exception e)
            {
                return(req.CreateResponse(HttpStatusCode.InternalServerError, e.Message));
            }
        }
Ejemplo n.º 7
0
        // PushBullet 이미지 첨부 메세지용
        public void ImageMsgPush(string Token, string Msg, string ImagePath)
        {
            try
            {
                PushbulletClient Client = new PushbulletClient(Token);
                var current             = Client.CurrentUsersInformation();

                using (var fileStream = new FileStream(ImagePath, FileMode.Open, FileAccess.Read, FileShare.Read))
                {
                    PushbulletSharp.Models.Requests.PushFileRequest reqeust = new PushbulletSharp.Models.Requests.PushFileRequest
                    {
                        Email      = current.Email,
                        FileName   = Path.GetFileName(ImagePath),
                        FileType   = "image/png",
                        FileStream = fileStream,
                        Body       = Msg
                    };
                    var response = Client.PushFile(reqeust);
                }
            }
            catch (Exception)
            {
                MessageBox.Show("ImageMsgPush 함수 오류. 내용을 작성 하세요.");
                timer1.Stop();
            }

            timer1.Stop();
        }
Ejemplo n.º 8
0
        // PushBullet 메세지용
        public void MsgPush(string Token, string title, string Msg)
        {
            PushbulletClient Client = new PushbulletClient(Token);

            try
            {
                var current = Client.CurrentUsersInformation();

                PushbulletSharp.Models.Requests.PushNoteRequest reqeust = new PushbulletSharp.Models.Requests.PushNoteRequest()
                {
                    Email = current.Email,
                    Title = title,
                    Body  = Msg
                };

                var response = Client.PushNote(reqeust);
            }
            catch (Exception)
            {
                MessageBox.Show("MsgPush 함수 오류, 제목과 내용을 작성 하세요.");
                timer1.Stop();
            }

            timer1.Stop();
        }
        public void DetectType_RegularText_ReturnsNoteType()
        {
            const string body = "just a note";

            var detectedType = PushbulletClient.DetectType(body);

            Assert.AreEqual(PushbulletPushType.Note, detectedType);
        }
Ejemplo n.º 10
0
        public void DetectType_BodyWithFilePath_ReturnsFileType()
        {
            const string body = @"c:\temp\test.jpg";

            var detectedType = PushbulletClient.DetectType(body);

            Assert.AreEqual(PushbulletPushType.File, detectedType);
        }
Ejemplo n.º 11
0
        private void PushbulletSetup()
        {
            var apiKey = GetPBApiKey();

            _pbClient        = new PushbulletClient(accessToken: apiKey, TimeZoneInfo.Local);
            PBTargetDeviceId = GetTargetDeviceId();
            PBServerDeviceSetup();
        }
Ejemplo n.º 12
0
        public void DetectType_NullBody_ReturnsNoteType()
        {
            const string body = null;

            var detectedType = PushbulletClient.DetectType(body);

            Assert.AreEqual(PushbulletPushType.Note, detectedType);
        }
Ejemplo n.º 13
0
        public void DetectType_BodyWithList_ReturnsListType()
        {
            const string body = "item 1;item 2;item 3";

            var detectedType = PushbulletClient.DetectType(body);

            Assert.AreEqual(PushbulletPushType.List, detectedType);
        }
Ejemplo n.º 14
0
        public void DetectType_BodyWithWww_ReturnsLinkType()
        {
            const string body = "www.fakedomain.au/subpage";

            var detectedType = PushbulletClient.DetectType(body);

            Assert.AreEqual(PushbulletPushType.Link, detectedType);
        }
Ejemplo n.º 15
0
        public void DetectType_BodyWithFileScheme_ReturnsFileType()
        {
            const string body = "file:///c:/temp/test.jpg";

            var detectedType = PushbulletClient.DetectType(body);

            Assert.AreEqual(PushbulletPushType.File, detectedType);
        }
Ejemplo n.º 16
0
        public override void OnExecute()
        {
            PushBullet = Context.CredentialProvider.Get <PushBulletCredential, PushbulletClient>();

            var response = PushBullet.PushNote(new PushbulletSharp.Models.Requests.PushNoteRequest()
            {
                Title = Title,
                Body  = Body
            });
        }
Ejemplo n.º 17
0
        public void TestInit()
        {
            ApiKey = "--YOURKEYGOESHERE--";
            Client = new PushbulletClient(ApiKey, "--YOUR-ENCRYPTION-PASSWORD--", TimeZoneInfo.Local);

            //Optional pass in your timezone
            //Client = new PushbulletClient(ApiKey, TimeZoneInfo.Local);

            //Or pass in a specific timezone
            //Client = new PushbulletClient(ApiKey, "password", TimeZoneInfo.FindSystemTimeZoneById("Eastern Standard Time"));
        }
Ejemplo n.º 18
0
        static void Main(string[] args)
        {
            string key = "--YOURKEYGOESHERE--";
            JavaScriptSerializer js     = new JavaScriptSerializer();
            PushbulletClient     Client = new PushbulletClient(key, TimeZoneInfo.Local);

            DateTime lastChecked = DateTime.Now;

            using (var ws = new WebSocket(string.Concat("wss://stream.pushbullet.com/websocket/", key)))
            {
                ws.OnMessage += (sender, e) =>
                {
                    WebSocketResponse response = js.Deserialize <WebSocketResponse>(e.Data);

                    switch (response.Type)
                    {
                    case "nop":
                        Console.WriteLine(string.Format("Updated {0}", DateTime.Now));
                        break;

                    case "tickle":
                        Console.WriteLine(string.Format("Tickle recieved on {0}. Go check it out.", DateTime.Now));
                        PushResponseFilter filter = new PushResponseFilter()
                        {
                            Active       = true,
                            ModifiedDate = lastChecked
                        };

                        var pushes = Client.GetPushes(filter);
                        foreach (var push in pushes.Pushes)
                        {
                            Console.WriteLine(push.Title);
                        }

                        lastChecked = DateTime.Now;
                        break;

                    case "push":
                        Console.WriteLine(string.Format("New push recieved on {0}.", DateTime.Now));
                        Console.WriteLine("Push Type: {0}", response.Push.Type);
                        Console.WriteLine("Response SubType: {0}", response.Subtype);
                        break;

                    default:
                        Console.WriteLine("new type that is not supported");
                        break;
                    }
                };
                ws.Connect();
                Console.ReadKey(true);
            }
        }
 public static bool CheckToken(string token)
 {
     try
     {
         PushbulletClient client = new PushbulletClient(token);
         var devices             = client.CurrentUsersDevices();
         return(true);
     }
     catch (Exception ex)
     {
         return(false);
     }
 }
Ejemplo n.º 20
0
        private void bStartPushbullet_Click(object sender, EventArgs e)
        {
            string key = this.tbPushBullet.Text.Trim();

            if (key.Length > 0)
            {
                this.CloseConnections();
                this.Client   = new PushbulletClient(key, TimeZoneInfo.Local);
                ws            = new WebSocket(string.Concat("wss://stream.pushbullet.com/websocket/", key));
                ws.OnMessage += Ws_OnMessage;
                ws.Connect();
            }
        }
Ejemplo n.º 21
0
        public Core StartPushBulletService()
        {
            if (!string.IsNullOrEmpty(Config.PushBulletApiKey))
            {
                Helpers.InBackground(() => {
                    if (PushbulletClient.InitPushbulletClient(Config.PushBulletApiKey) != null)
                    {
                        Logger.Log("Push bullet service started.", LogLevels.Trace);
                    }
                });
            }

            return(this);
        }
Ejemplo n.º 22
0
        private void Envianotificação(string texto)
        {
            PushbulletClient client = new PushbulletClient("o.ijhfmbKRI8JAAAjaorTvs3n1I1oHo4qH");
            //var devices = client.CurrentUsersDevices();
            //var device = devices.Devices.Where(o => o.Manufacturer == "Apple").FirstOrDefault();
            PushNoteRequest request1 = new PushNoteRequest
            {
                DeviceIden = "ujy7mvFtukmsjE5NB4jvkO",
                Title      = texto,
                Body       = texto
            };

            PushResponse response1 = client.PushNote(request1);
        }
        public IEnumerable <IDevice> GetDeviceList()
        {
            if (!IsPusbulletApiKeyValid())
            {
                return(null);
            }

            PushbulletClient client = new PushbulletClient(ApiKey);
            var response            = client.CurrentUsersDevices();
            var devices             = response.Devices;

            return(devices.Where(_ => _.Pushable).Select(_ => new GenericDevice {
                Id = _.Iden, Nickname = _.Nickname
            }));
        }
        public void Notify(Notification notification, IEnumerable <string> deviceIds)
        {
            if (deviceIds == null)
            {
                return;
            }
            if (!deviceIds.Any())
            {
                return;
            }
            if (!IsPusbulletApiKeyValid())
            {
                return;
            }

            PushbulletClient client = new PushbulletClient(ApiKey);
            var response            = client.CurrentUsersDevices();

            List <Device> devices = new List <Device>();

            foreach (var device in response.Devices)
            {
                if (deviceIds.Any(_ => _ == device.Iden))
                {
                    devices.Add(device);
                }
            }

            foreach (var device in devices)
            {
                PushNoteRequest reqeust = new PushNoteRequest()
                {
                    DeviceIden = device.Iden,
                    Title      = notification.Title,
                    Body       = notification.Body
                };

                try {
                    client.PushNote(reqeust);
                }
                catch (Exception e) {
                    if (Debugger.IsAttached)
                    {
                        throw e;
                    }
                }
            }
        }
        private bool IsPusbulletApiKeyValid()
        {
            if (string.IsNullOrWhiteSpace(ApiKey))
            {
                return(false);
            }
            PushbulletClient client = new PushbulletClient(ApiKey);

            try {
                client.CurrentUsersInformation();
                return(true);
            }
            catch {
                return(false);
            }
        }
Ejemplo n.º 26
0
        private static void DoPush(CLArguments parsedArgs)
        {
            using (var client = new PushbulletClient(parsedArgs.ApiKey))
            {
                PushbulletDevices devices        = client.GetDevices();
                string            targetDeviceId = (
                    devices.Devices.SingleOrDefault(device => String.Compare(device.Name, parsedArgs.Device, StringComparison.OrdinalIgnoreCase) == 0)
                    ??
                    new PushbulletDevice()
                    ).Id;

                if (string.IsNullOrEmpty(targetDeviceId))
                {
                    ConsoleHelpers.WriteErrorAndExit("No device found with the given name.");
                }

                // validate or autodetect push type
                PushbulletPushType pushType;
                if (String.IsNullOrEmpty(parsedArgs.Type))
                {
                    pushType = PushbulletClient.DetectType(parsedArgs.Body);
                }
                else
                {
                    if (!Enum.TryParse(parsedArgs.Type, true, out pushType))
                    {
                        ConsoleHelpers.WriteErrorAndExit("Incorrect push type specified.");
                    }
                }
                dynamic response = null;
                try
                {
                    System.Console.Write("Pushing {0} {1}... ", pushType != PushbulletPushType.Address ? "a" : "an", pushType.ToString().ToLowerInvariant());
                    response = client.Push(targetDeviceId, pushType, parsedArgs.Title, parsedArgs.Body);
                    System.Console.WriteLine("SUCCESS");
                }
                catch (Exception ex)
                {
                    ConsoleHelpers.WriteErrorAndExit("Exception during pushing: " + ex.Message);
                }
                if (parsedArgs.ShowResponse)
                {
                    System.Console.WriteLine("Response:\r\n{0}", new[] { response.ToString() });
                }
            }
        }
Ejemplo n.º 27
0
        public static void Notify(string messageFormat, params object[] args)
        {
            #if DEBUG
            return;
            #endif
            PushbulletClient client = new PushbulletClient(Settings.PushbulletApiKey);

            //If you don't know your device_iden, you can always query your devices
            var userDevices = client.CurrentUsersDevices();

            //search for specified device, otherwise send to all devices
            var recipientDevices = new List<PushbulletSharp.Models.Responses.Device>();

            bool isUserSpecifiedDeviceFound = false;
            if (!string.IsNullOrWhiteSpace(Settings.PushbulletDeviceName))
            {
                foreach (var device in userDevices.Devices)
                {
                    if (device.Nickname.ToLowerInvariant().Contains(Settings.PushbulletDeviceName.ToLower()))
                    {
                        recipientDevices.Add(device);
                        isUserSpecifiedDeviceFound = true;
                        break;
                    }
                }
            }

            if (!isUserSpecifiedDeviceFound)
            {
                recipientDevices.AddRange(userDevices.Devices);
            }

            foreach (var device in recipientDevices)
            {
                if (device != null)
                {
                    var request = new PushNoteRequest()
                    {
                        DeviceIden = device.Iden,
                        Title = "Notification from dlm",
                        Body = string.Format(messageFormat, args)
                    };
                    var response = client.PushNote(request);
                }
            }
        }
Ejemplo n.º 28
0
Archivo: Form1.cs Proyecto: iPanja/ALC
        public void pushNotification(string message, string pbKey)
        {
            if (pbClient == null)
            {
                pbClient = new PushbulletClient(pbKey);
            }
            if (pbClient.CurrentUsersInformation() == null)
            {
                showBalloon("Your Pushbullet key is invalid", SystemIcons.Error);
                return;
            }
            PushNoteRequest note = new PushNoteRequest {
                Title = "ALC",
                Body  = message,
            };

            pbClient.PushNote(note);
        }
Ejemplo n.º 29
0
        private void Envianotificação(string texto)
        {
            PushbulletClient client   = new PushbulletClient("o.ijhfmbKRI8JAAAjaorTvs3n1I1oHo4qH");
            PushNoteRequest  request1 = new PushNoteRequest
            {
                DeviceIden = "ujy7mvFtukmsjE5NB4jvkO",
                Title      = texto,
                Body       = texto
            };

            PushResponse    response1 = client.PushNote(request1);
            PushNoteRequest request2  = new PushNoteRequest
            {
                DeviceIden = "ujy7mvFtukmsjBmQj6ywIS",
                Title      = texto,
                Body       = texto
            };

            PushResponse response2 = client.PushNote(request2);
        }
Ejemplo n.º 30
0
        private void bStartPushbullet_Click(object sender, EventArgs e)
        {
            string key = this.tbPushBullet.Text.Trim();

            if (key.Length > 0)
            {
                this.Client   = new PushbulletClient(key, TimeZoneInfo.Local);
                ws            = new WebSocket(string.Concat("wss://stream.pushbullet.com/websocket/", key));
                ws.OnMessage += Ws_OnMessage;
                ws.Connect();
                this.bStartPushbullet.Enabled = false;

                // When We Connect, Hide (helpful on startup)
                Action act = () => { this.Hide(); };
                System.Threading.Timer timer = null;
                timer = new System.Threading.Timer((obj) =>
                {
                    this.BeginInvoke(act);
                    timer.Dispose();
                }, null, 250, System.Threading.Timeout.Infinite);
            }
        }
Ejemplo n.º 31
0
Archivo: Form1.cs Proyecto: j0sh77/PFPB
        private void sendAlert(String title, String text)
        {
            PushbulletClient client = new PushbulletClient(txt_APIKey.Text);

            var currentUserInformation = client.CurrentUsersInformation();

            if (currentUserInformation != null)
            {
                PushNoteRequest reqeust = new PushNoteRequest()
                {
                    Email = currentUserInformation.Email,
                    Title = title,
                    Body  = text
                };

                txt_Log.AppendText(DateTime.Now.ToString("HH:mm:ss") + " - " + text + "\r\n");
                if (!DEBUG)
                {
                    PushResponse response = client.PushNote(reqeust);
                }
            }
        }
        private bool Respond(SteamID toID, SteamID userID, string message, bool room)
        {
            bool messageSent = false;
            CheckIfDBExists(userID);
            Dictionary<ulong, DB> db = Options.NotificationOptions.DB;

            db[userID].userID = userID.ConvertToUInt64();
            db[userID].seen = DateTime.Now;
            db[userID].name = Bot.steamFriends.GetFriendPersonaName(userID);

            string[] query = StripCommand(message, Options.NotificationOptions.SeenCommand);
            if (query != null && query.Length == 2)
            {
                if (!db.ContainsKey(Convert.ToUInt64(query[1])) || db[Convert.ToUInt64(query[1])] == null)
                {
                    SendMessageAfterDelay(toID, "The user " + query[1] + " was not found.", room);
                    messageSent = true;
                }
                else
                {
                    SendMessageAfterDelay(toID, string.Format("I last saw {0} on {1} at {2}", db[Convert.ToUInt64(query[1])].name, db[Convert.ToUInt64(query[1])].seen.ToShortDateString(), db[Convert.ToUInt64(query[1])].seen.ToShortTimeString()), room);
                    messageSent = true;
                }
            }

            query = StripCommand(message, Options.NotificationOptions.APICommand);
            if(query != null && userID != toID)
            {
                SendMessageAfterDelay(toID, "This command will only work in private to protect privacy.", room);
                messageSent = true;
            }
            else if(query != null && query.Length == 2 && userID == toID)
            {
                CheckIfDBExists(userID);
                string api = query[1];
                db[userID.ConvertToUInt64()].pb.apikey = api;
                PushbulletClient client = new PushbulletClient(api);
                PushNoteRequest note = new PushNoteRequest()
                {
                    Title = "Test note",
                    Body = "This is a test. If you receive this then you have successfully registered an API key with the bot."
                };

                PushResponse response = client.PushNote(note);
                if(response == null)
                {
                    SendMessageAfterDelay(toID, "Your push failed. Most likely your API key is incorrect.", room);
                    messageSent = true;
                }
                else
                {
                    SendMessageAfterDelay(toID, "Your push was a success.", room);
                    messageSent = true;
                }
            }

            query = StripCommand(message, Options.NotificationOptions.FilterCommand);
            if(query != null && query.Length == 1)
            {
                SendMessageAfterDelay(toID, "Available sub commands: add, list, clear, delete", room);
                messageSent = true;
            }
            else if(query != null && query.Length >= 2)
            {
                if(query[1] == "add" && query.Length >= 3)
                {

                    List<string> words = new List<string>();
                    words = db[userID].pb.filter;
                    // !filter add banshee test 1 2 3
                    for (int i = 2; i < query.Length; i++)
                    {
                        words.Add(query[i]);
                    }

                    db[userID].pb.filter = words;
                    SendMessageAfterDelay(toID, "Your filter has been successfully modified.", room);
                    messageSent = true;
                }
                else if(query[1] == "list" && query.Length == 2)
                {
                    if (db[userID].pb.filter.Count > 0)
                    {
                        string words = string.Join(", ", db[userID].pb.filter);
                        SendMessageAfterDelay(userID, "Your filter: " + words, false);
                        messageSent = true;
                    }
                    else
                    {
                        SendMessageAfterDelay(userID, "Your filter is empty. Use \"!filter add <words>\" to add to your filter", false);
                        messageSent = true;
                    }
                }
                else if(query[1] == "clear" && query.Length == 2)
                {
                    db[userID].pb.filter.Clear();
                    SendMessageAfterDelay(toID, "Your filter has been cleared", room);
                    messageSent = true;
                }
                else if(query[1] == "delete" && query.Length == 3)
                {
                    db[userID].pb.filter.Remove(query[2]);
                    SendMessageAfterDelay(toID, "The filter \"" + query[2] + "\" has been removed", room);
                    messageSent = true;
                }
            }

            query = StripCommand(message, Options.NotificationOptions.ClearCommand);
            if(query != null)
            {
                db[userID] = null;
                SendMessageAfterDelay(toID, "Your database file has been cleared.", room);
                messageSent = true;
            }

            foreach (DB d in db.Values)
            {
                if (d == null || d.pb == null || d.pb.filter == null || d.pb.filter.Count == 0)
                {
                    return false;
                }
                foreach (string word in d.pb.filter)
                {
                    if (message.ToLower().Contains(word.ToLower()) && userID.ConvertToUInt64() != d.userID)
                    {
                        if (d.pb.apikey != null && d.pb.apikey != "")
                        {
                            PushbulletClient client = new PushbulletClient(d.pb.apikey);
                            PushNoteRequest note = new PushNoteRequest();
                            note.Title = string.Format("Steam message from {0}/{1} in {2}", db[userID.ConvertToUInt64()].name, userID.ConvertToUInt64(), toID.ConvertToUInt64());
                            note.Body = message;
                            client.PushNote(note);
                            Log.Instance.Verbose("{0}/{1}: Sending pushbullet for {2}/{3}", Bot.username, Name, db[d.userID].name, db[d.userID].userID);
                            return true;
                        }
                    }
                }
            }

            return messageSent;
        }
Ejemplo n.º 33
0
Archivo: Setup.cs Proyecto: Ricium/Wetu
        private void SendPushBullet(string Message, string _Title, string API, int UserNotifyId)
        {
            ///TODO: Add Client API Keys in DB
            ///TODO: Retreive Client API Key

            // v1Tftuzx00PyhMzoOdJMMbvnrDwUCvz2ZQujvKinowKOW
            PushbulletClient client = new PushbulletClient(API);

            var currentUserInformation = client.CurrentUsersInformation();

            if (currentUserInformation != null)
            {
                PushNoteRequest reqeust = new PushNoteRequest()
                {
                    Email = currentUserInformation.Email,
                    Title = _Title,
                    Body = Message
                };

                PushResponse response = client.PushNote(reqeust);

                LogNotification(UserNotifyId, Message);
            }
        }