-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDiscord.cs
More file actions
63 lines (57 loc) · 1.65 KB
/
Discord.cs
File metadata and controls
63 lines (57 loc) · 1.65 KB
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
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using DiscordRPC;
namespace Breaworlds_PrivateServerManager
{
internal class Discord
{
public static DiscordRpcClient client = new DiscordRpcClient("1318743749068587128");
public static void InitRPC()
{
Debug.WriteLine("Start RPC");
client.Initialize();
client.SetPresence(new RichPresence()
{
Details = "Selecting A Server",
State = "Idle",
Assets = new Assets()
{
LargeImageKey = "logo",
LargeImageText = "Breaworlds Private Server Manager"
}
});
var timer = new System.Timers.Timer(150);
timer.Elapsed += (sender, args) => { client.Invoke(); };
timer.Start();
}
public static void UpdateRPC(string detail, string status, bool timer)
{
Debug.WriteLine("Update RPC");
if (timer)
{
client.SetPresence(new RichPresence()
{
Details = detail,
State = status,
Timestamps = Timestamps.Now
});
}
else
{
client.SetPresence(new RichPresence()
{
Details = detail,
State = status,
});
}
}
public static void KillRPC()
{
client.Dispose();
}
}
}