From c07b79d5a3c3e34fa80113cc9d62a5a103f6cf8b Mon Sep 17 00:00:00 2001 From: Ryse93 <69793084+Ryse93@users.noreply.github.com> Date: Sat, 27 May 2023 00:09:24 +0200 Subject: [PATCH] :sparkles: Add discord RPC --- MyCards.py | 23 ++++++++++++++++++++--- README.md | 6 ++++++ 2 files changed, 26 insertions(+), 3 deletions(-) diff --git a/MyCards.py b/MyCards.py index 1eec5f2..8f66daa 100644 --- a/MyCards.py +++ b/MyCards.py @@ -6,9 +6,26 @@ import random # Librairie #6 import webbrowser # Librairie #7 import tkinter.font as font # Librairie #8 -from tkinter import * # Librairie #9 -from settings import * # .py #10 -from language_modules import * # .py #11 +import time # Librairie #9 +from tkinter import * # Librairie #10 +from settings import * # .py #11 +from language_modules import * # .py #12 + +# Start- Discord RPC +try: + from pypresence import Presence + cliend_id = "1111771604746244117" + RPC = Presence(cliend_id) + RPC.connect() + RPC.update( + state = "Learn vocabulary", + start = time.time(), + large_image = "logo", + buttons = [{"label": "GitHub", "url": "https://github.com/Hidden-Warden/MyCards"}] + ) +except: + print("module pypresence not found so the Discord RPC is not working") +# End- Discord RPC ## ///DEF\\\## def language(input_language): diff --git a/README.md b/README.md index 3922b4d..9cc3813 100644 --- a/README.md +++ b/README.md @@ -20,6 +20,12 @@ |--|--| |![LightMode](https://user-images.githubusercontent.com/70717127/166895375-186bdaa9-780f-4a6f-92f6-8ac3e7dbd331.png)|![DarkMode](https://user-images.githubusercontent.com/70717127/166895388-a46eaa57-f200-4a52-8fed-d1217b223841.png)| +## Prerequisite +You need to install pypresence with the following commands if you want to use the Discord Rich Presence: +```sh +pip install pypresence +``` + ## You are free to personalise it! In the `settings.py` file, you can: * Change the language. (s_language=)