aboutsummaryrefslogtreecommitdiff
path: root/notify.py
diff options
context:
space:
mode:
authorLoic Guegan <manzerbredes@mailbox.org>2020-04-24 17:20:43 +0200
committerLoic Guegan <manzerbredes@mailbox.org>2020-04-24 17:20:43 +0200
commitbf9c2444942e861c1b5cae24573acb71ac7a4cae (patch)
treefb15559106d2e09704a9a31d83da18f136d0a7ee /notify.py
Init repo
Diffstat (limited to 'notify.py')
-rwxr-xr-xnotify.py24
1 files changed, 24 insertions, 0 deletions
diff --git a/notify.py b/notify.py
new file mode 100755
index 0000000..8a57df5
--- /dev/null
+++ b/notify.py
@@ -0,0 +1,24 @@
+#!/usr/bin/env python
+
+import berserk, subprocess
+
+# Change ACCESS TOKEN according to your need
+ACCESS_TOKEN="EiZbLRtZzWnTL4xh"
+
+
+# Notify using notify-send
+def notify_send(summary, message):
+ subprocess.Popen(['notify-send', '-u', 'critical','-t', '99999999', summary, message])
+ return
+
+
+# Fetch data and notify
+session = berserk.TokenSession(ACCESS_TOKEN)
+client = berserk.Client(session=session)
+data=client.games.get_ongoing()
+for game in data:
+ opponent=game["opponent"]["username"]
+ lastMove=game["lastMove"]
+ if not(game["isMyTurn"]):
+ notify_send("Lichess ("+opponent+")","It is your turn !\n Your oppenent played "+lastMove)
+