mirror of
https://github.com/ninjamuffin99/Funkin.git
synced 2024-11-01 04:14:47 +00:00
fdecd95cca
I'm an idiot and had no idea what I was doing with haxe.Timer.delay() so I'm using Sys.sleep() and it seems to work fine.
70 lines
1.3 KiB
Haxe
70 lines
1.3 KiB
Haxe
package;
|
|
|
|
import Sys.sleep;
|
|
import discord_rpc.DiscordRpc;
|
|
|
|
using StringTools;
|
|
|
|
class DiscordClient
|
|
{
|
|
public function new()
|
|
{
|
|
trace("Discord Client starting...");
|
|
DiscordRpc.start({
|
|
clientID: "814588678700924999",
|
|
onReady: onReady,
|
|
onError: onError,
|
|
onDisconnected: onDisconnected
|
|
});
|
|
trace("Discord Client started.");
|
|
|
|
while (true)
|
|
{
|
|
DiscordRpc.process();
|
|
sleep(2);
|
|
trace("Discord Client Update");
|
|
}
|
|
|
|
DiscordRpc.shutdown();
|
|
}
|
|
|
|
static function onReady()
|
|
{
|
|
DiscordRpc.presence({
|
|
details: "In the Menus",
|
|
state: null,
|
|
largeImageKey: 'icon',
|
|
largeImageText: "Friday Night Funkin'"
|
|
});
|
|
}
|
|
|
|
static function onError(_code:Int, _message:String)
|
|
{
|
|
trace('Error! $_code : $_message');
|
|
}
|
|
|
|
static function onDisconnected(_code:Int, _message:String)
|
|
{
|
|
trace('Disconnected! $_code : $_message');
|
|
}
|
|
|
|
public static function initialize()
|
|
{
|
|
var DiscordDaemon = sys.thread.Thread.create(() ->
|
|
{
|
|
new DiscordClient();
|
|
});
|
|
trace("Discord Client initialized");
|
|
}
|
|
|
|
public static function changePresence(details:String, state:Null<String>)
|
|
{
|
|
DiscordRpc.presence({
|
|
details: details,
|
|
state: state,
|
|
largeImageKey: 'icon',
|
|
largeImageText: "Friday Night Funkin'"
|
|
});
|
|
}
|
|
}
|