-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDiscordPresence.cs
More file actions
40 lines (35 loc) · 941 Bytes
/
DiscordPresence.cs
File metadata and controls
40 lines (35 loc) · 941 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
using DiscordRPC;
using DiscordRPC.Logging;
using System;
class DiscordPresence
{
private static DiscordRpcClient client;
public static void Init(string clientId)
{
client = new DiscordRpcClient(clientId);
client.Logger = new ConsoleLogger() { Level = LogLevel.Warning };
client.Initialize();
}
public static void SetPresence(string image, string texte, string sousTexte)
{
if (client == null)
{
Console.WriteLine("Erreur : Discord RPC non initialisé. Appelle Init(clientId) avant.");
return;
}
client.SetPresence(new RichPresence()
{
Details = texte,
State = sousTexte,
Assets = new Assets()
{
LargeImageKey = image,
LargeImageText = texte
}
});
}
public static void Close()
{
client.Dispose();
}
}