Esempio n. 1
0
 private static void discordRPC(string details, string state)
 {
     handlers = default(DiscordRpc.EventHandlers);
     DiscordRpc.Initialize("815646242041757706", ref handlers, true, null);
     handlers = default(DiscordRpc.EventHandlers);
     DiscordRpc.Initialize("815646242041757706", ref handlers, true, null);
     presence.details        = details;
     presence.state          = state;
     presence.largeImageKey  = "logo";
     presence.smallImageKey  = "";
     presence.largeImageText = title_nanime;
     //presence.startTimestamp = timestamp; # OPTIONAL
     DiscordRpc.UpdatePresence(ref presence);
 }
    void OnEnable()
    {
        Debug.Log("Discord: init");
        callbackCalls = 0;

        handlers = new DiscordRpc.EventHandlers();
        handlers.readyCallback         = ReadyCallback;
        handlers.disconnectedCallback += DisconnectedCallback;
        handlers.errorCallback        += ErrorCallback;
        handlers.joinCallback         += JoinCallback;
        handlers.spectateCallback     += SpectateCallback;
        handlers.requestCallback      += RequestCallback;
        DiscordRpc.Initialize(applicationId, ref handlers, true, optionalSteamId);
    }
        public void Initialize()
        {
            DiscordRpc.EventHandlers handlers = new DiscordRpc.EventHandlers();
            handlers.readyCallback         = ReadyCallback;
            handlers.disconnectedCallback += DisconnectedCallback;
            handlers.errorCallback        += ErrorCallback;
            handlers.joinCallback         += JoinCallback;
            handlers.spectateCallback     += SpectateCallback;
            handlers.requestCallback      += RequestCallback;

            DiscordRpc.Initialize(applicationId, ref handlers, true, null);

            Debug.Log("DiscordRP: Discord Initialize");
        }
Esempio n. 4
0
        private static void CheckRpc()
        {
            if (global.presence != null)
            {
                // Initialized
                return;
            }

            global.presence = new DiscordRpc.RichPresence();
            //global.events = new DiscordRpc.EventHandlers();

            // Discord Api initializing...
            DiscordRpc.Initialize(info.ApplicationId, ref global.events, false, null);
        }
        internal static void InternalDiscordInitialize()
        {
            if (IsConnected)
            {
                return;
            }

            _handlers = new DiscordRpc.EventHandlers();

            Debug.Log("Discord: init");
            DiscordRpc.Initialize(ApplicationId, ref _handlers, true, OptionalSteamId);
            IsConnected = true;

            JEMDiscordUnityPresence.RefreshPresence();
        }
Esempio n. 6
0
    void OnEnable()
    {
        Debug.Log("Discord: init");
        handlers = new DiscordRpc.EventHandlers();
        handlers.readyCallback        += ReadyCallback;
        handlers.disconnectedCallback += DisconnectedCallback;
        handlers.errorCallback        += ErrorCallback;
        handlers.joinCallback         += JoinCallback;
        handlers.spectateCallback     += SpectateCallback;
        handlers.requestCallback      += RequestCallback;
        DiscordRpc.Initialize(applicationId, ref handlers, true, optionalSteamId);

        presence = GetDefaultRPC();
        DiscordRpc.UpdatePresence(presence);
    }
Esempio n. 7
0
        static TBA_DiscordRPC()
        {
            if (!EditorPrefs.HasKey("TBA_discordRPC"))
            {
                EditorPrefs.SetBool("TBA_discordRPC", true);
            }

            if (EditorPrefs.GetBool("TBA_discordRPC"))
            {
                BRSLog("Starting discord rpc");
                DiscordRpc.EventHandlers eventHandlers = default(DiscordRpc.EventHandlers);
                DiscordRpc.Initialize("741036203880742992", ref eventHandlers, false, string.Empty);
                updateDRPC();
            }
        }
Esempio n. 8
0
        public Form7()
        {
            InitializeComponent();

            this.handlers = default(DiscordRpc.EventHandlers);
            DiscordRpc.Initialize("795348433711005787", ref this.handlers, true, null);
            this.handlers = default(DiscordRpc.EventHandlers);
            DiscordRpc.Initialize("795348433711005787", ref this.handlers, true, null);
            this.presence.details        = "XFORCE Beta";
            this.presence.state          = "https://discord.gg/Fkz4tK8XFn";
            this.presence.largeImageKey  = "monobrasil";
            this.presence.smallImageKey  = "";
            this.presence.startTimestamp = (long)(DateTime.UtcNow - new DateTime(1970, 1, 1, 0, 0, 0)).TotalSeconds;
            DiscordRpc.UpdatePresence(ref this.presence);
        }
Esempio n. 9
0
 private void Form1_Load(object sender, EventArgs e)
 {
    this.handlers = default(DiscordRpc.EventHandlers);
     DiscordRpc.Initialize(textBox1.Text, ref this.handlers, true, null);
     this.handlers = default(DiscordRpc.EventHandlers);
     DiscordRpc.Initialize(textBox1.Text, ref this.handlers, true, null);
     this.presence.details = textBox2.Text;
     this.presence.state = textBox3.Text;
     this.presence.largeImageKey = textBox4.Text;
     this.presence.smallImageKey = textBox5.Text;
     this.presence.largeImageText = textBox6.Text;
     this.presence.smallImageText = textBox7.Text;
     this.presence.startTimestamp = (long)(DateTime.UtcNow - new DateTime(1970, 1, 1, 0, 0, 0)).TotalSeconds;
     DiscordRpc.UpdatePresence(ref this.presence);
     }
Esempio n. 10
0
        public override void OnApplicationStart() // Runs after Game Initialization.
        {
            var handlers = new DiscordRpc.EventHandlers();

            DiscordRpc.Initialize(DiscordAppID, ref handlers, false, string.Empty);
            Presence.state          = "Starting game...";
            Presence.details        = "Playing PhasMODphobia";
            Presence.startTimestamp = default(long);
            Presence.largeImageKey  = "phasmod";
            Presence.largeImageText = "Phasmodphobia";
            Presence.smallImageKey  = "phasmod";
            Presence.smallImageText = "phasmomod";
            DiscordRpc.UpdatePresence(Presence);

            MelonLogger.Log("[log] Phasmophobia Mod Handler has started");
        }
Esempio n. 11
0
        public static void Init()
        {
            eventHandlers = new DiscordRpc.EventHandlers();
            eventHandlers.errorCallback = (code, message) => VRCModLogger.LogError("[VRCTools] [Discord] (E" + code + ") " + message);

            presence.state          = "Not in a world";
            presence.details        = "Not logged in" + " (" + (VRCTrackingManager.IsInVRMode() ? "VR" : "PC") + ")";
            presence.largeImageKey  = "logo";
            presence.partySize      = 0;
            presence.partyMax       = 0;
            presence.startTimestamp = (long)DateTime.UtcNow.Subtract(new DateTime(1970, 1, 1)).TotalSeconds;
            presence.partyId        = "";
            presence.largeImageText = "VRChat";
            DeviceChanged();
            try
            {
                string steamId = null;
                switch (VRCApplicationSetup._instance.ServerEnvironment)
                {
                case ApiServerEnvironment.Release:
                    steamId = "438100"; presence.largeImageText += " Release";
                    break;

                case ApiServerEnvironment.Beta:
                    steamId = "744530"; presence.largeImageText += " Beta";
                    break;

                case ApiServerEnvironment.Dev:
                    steamId = "326100"; presence.largeImageText += " Dev";
                    break;

                default:
                    break;
                }

                DiscordRpc.Initialize("404400696171954177", ref eventHandlers, true, steamId);
                DiscordRpc.UpdatePresence(ref presence);

                running = true;
                VRCModLogger.Log("[DiscordManager] RichPresence Initialised");
            }
            catch (Exception e)
            {
                VRCModLogger.Log("[DiscordManager] Unable to init discord RichPresence:");
                VRCModLogger.Log("[DiscordManager] " + e);
            }
        }
Esempio n. 12
0
 public static void Main(string[] args)
 {
     Console.WriteLine("Discord: init");
     handlers = new DiscordRpc.EventHandlers {
         readyCallback        = ReadyCallback,
         disconnectedCallback = DisconnectedCallback,
         errorCallback        = ErrorCallback,
         joinCallback         = JoinCallback,
         spectateCallback     = SpectateCallback,
         requestCallback      = RequestCallback
     };
     DiscordRpc.Initialize(applicationId, ref handlers, false, null);
     while (true)
     {
         DiscordRpc.RunCallbacks();
     }
 }
        public override void OnApplicationStart()
        {
            var i = HarmonyInstance.Create("audica-rpc");

            Hooks.ApplyHooks(i);
            var handlers = new DiscordRpc.EventHandlers();

            DiscordRpc.Initialize(DiscordAppID, ref handlers, false, string.Empty);
            Presence.state          = string.Empty;
            Presence.details        = "In Menu";
            Presence.startTimestamp = default(long);
            Presence.largeImageKey  = "audica_main";
            Presence.largeImageText = "AUDICA";
            Presence.smallImageKey  = "expert";
            Presence.smallImageText = "Expert difficulty";
            DiscordRpc.UpdatePresence(Presence);
        }
Esempio n. 14
0
        private void updateButton_Click(object sender, EventArgs e)
        {
            if (CurrentApplication == null)
            {
                return;
            }

            DiscordRpc.Shutdown();
            DiscordRpc.Initialize(CurrentApplication.appId, ref handlers, false, string.Empty);

            DiscordRpc.RichPresence richPresence = new DiscordRpc.RichPresence();
            richPresence.details = detailsTextBox.Text;
            richPresence.state   = stateTextBox.Text;

            if (largeIconBox.SelectedIndex > 0)
            {
                richPresence.largeImageKey  = (string)largeIconBox.SelectedItem;
                richPresence.largeImageText = CurrentApplication.GetLargeIconText(largeIconBox.SelectedIndex);
            }
            if (smallIconBox.SelectedIndex > 0)
            {
                richPresence.smallImageKey  = (string)smallIconBox.SelectedItem;
                richPresence.smallImageText = CurrentApplication.GetSmallIconText(smallIconBox.SelectedIndex);
            }

            if (partyCheckBox.Checked)
            {
                richPresence.partySize = (int)partySizeNumeric.Value;
                richPresence.partyMax  = (int)partyMaxNumeric.Value;
            }

            if (timeCheckBox.Checked)
            {
                if (startTimeRadioButton.Checked)
                {
                    richPresence.startTimestamp = (long)dateTimePicker.Value.ToUniversalTime().Subtract(unixDateTimeStart).TotalSeconds;
                }
                else if (endTimeRadioButton.Checked)
                {
                    richPresence.endTimestamp = (long)dateTimePicker.Value.ToUniversalTime().Subtract(unixDateTimeStart).TotalSeconds;
                }
            }

            DiscordRpc.UpdatePresence(richPresence);
        }
        public YoutubePresence()
        {
            InitializeComponent();

            this.handlers = default(DiscordRpc.EventHandlers);
            DiscordRpc.Initialize("705480188624109660", ref this.handlers, true, null);
            this.handlers = default(DiscordRpc.EventHandlers);
            DiscordRpc.Initialize("705480188624109660", ref this.handlers, true, null);
            this.presence.details       = "No Video Found";
            this.presence.state         = "Youtube Presence By LeonimusT";
            this.presence.largeImageKey = "large";
            //this.presence.smallImageKey = "small";
            //this.presence.largeImageText = "Image 1 Text";
            //this.presence.smallImageText = "Image 2 Text";
            DiscordRpc.UpdatePresence(ref this.presence);

            Chrome();
        }
 public void Init()
 {
     try
     {
         DiscordRpc.Initialize(discordAppID, ref handlers, true, steamAppID);
         isInitialized = true;
         var presence = new DiscordUpdatePresence();
         presence.details       = "The best RTS";
         presence.state         = "Waiting for GoogleFrog to send details";
         presence.largeImageKey = "zk";
         presence.smallImageKey = "star";
         DiscordRpc.UpdatePresence(ref presence);
     }
     catch (Exception ex)
     {
         Trace.TraceError("Error initializing discord-RPC: {0}", ex);
     }
 }
Esempio n. 17
0
 void UpdatePresence()
 {
     if (DiscordRPC_Active.Checked)
     {
         DiscordRpc.EventHandlers handlers = new DiscordRpc.EventHandlers();
         DiscordRpc.RichPresence  presence = new DiscordRpc.RichPresence();
         DiscordRpc.Initialize("738137354589437972", ref handlers, true, null);
         presence.details        = DiscordRPC_Description.Text;
         presence.largeImageKey  = Properties.Settings.Default.DiscordRPC_Image;
         presence.largeImageText = "Seafight";
         presence.startTimestamp = DateTimeOffset.UtcNow.ToUnixTimeSeconds();
         DiscordRpc.UpdatePresence(ref presence);
     }
     else
     {
         DiscordRpc.Shutdown();
     }
 }
Esempio n. 18
0
        private void Initialize()
        {
            _spotify = new SpotifyLocalAPI();

            var handlers = new DiscordRpc.EventHandlers {
                readyCallback        = HandleReady,
                errorCallback        = HandleError,
                disconnectedCallback = HandleDisconnected
            };

            DiscordRpc.Initialize("383020355553460224", ref handlers, true, null);

            DiscordRpc.RunCallbacks();

            SetStatus("Initializing");

            _tickTimer = new Timer(TimerTick, null, 1000, 1000);
        }
Esempio n. 19
0
        public override void OnApplicationStart()
        {
            Instance instance = Manager.CreateInstance("AudicaRPC");

            AudicaRPC.SongSelectItem_OnSelect = instance.Patch(SDK.GetClass("SongSelectItem").GetMethod("OnSelect"), typeof(AudicaRPC).GetMethod("OnSelect"));
            AudicaRPC.SongSelect_OnEnable     = instance.Patch(SDK.GetClass("SongSelect").GetMethod("OnEnablle"), typeof(AudicaRPC).GetMethod("SongSelectOnEnable"));
            var handlers = new DiscordRpc.EventHandlers();

            DiscordRpc.Initialize(DiscordAppID, ref handlers, false, string.Empty);
            Presence.state          = string.Empty;
            Presence.details        = "In Menu";
            Presence.startTimestamp = default(long);
            Presence.largeImageKey  = "audica_main";
            Presence.largeImageText = "AUDICA";
            Presence.smallImageKey  = "expert";
            Presence.smallImageText = "Expert difficulty";
            DiscordRpc.UpdatePresence(Presence);
        }
Esempio n. 20
0
        private void DiscordInit()
        {
            _discordStatus = "Discord - Connecting";
            stDiscord.Text = _discordStatus;

            dchn = new DiscordRpc.EventHandlers();

            dchn.readyCallback        = ReadyCallback;
            dchn.errorCallback        = ErrorCallback;
            dchn.disconnectedCallback = DisconnectedCallback;

            DiscordRpc.Initialize(cliid, ref dchn, true, null);
            _discordStatus = "Discord - Connected?";
            stDiscord.Text = _discordStatus;

            DiscordRpc.RunCallbacks();

            DiscordRpc.UpdatePresence(ref dcrp);
        }
Esempio n. 21
0
    private static void Init()
    {
        try
        {
            EditorSceneManager.sceneOpened += SceneOpened;

            callbackCalls = 0;
            handlers      = new DiscordRpc.EventHandlers();
            handlers.disconnectedCallback += DisconnectedCallback;
            handlers.errorCallback        += ErrorCallback;
            handlers.requestCallback      += RequestCallback;
            DiscordRpc.Initialize(applicationId, ref handlers, true, "1234");
        }
        catch (Exception e)
        {
            AssetDatabase.Refresh();
        }
        UpdatePresence();
    }
Esempio n. 22
0
 public void InitializeModule(Vegas vegas)
 {
     resetPresence(ref presence, vegas);
     DiscordRpc.Initialize("434711433112977427", ref callbacks, true, string.Empty);
     presence.details              = "Idling";
     vegas.TrackCountChanged      += (a, b) => UpdateTrackNumber(vegas);
     vegas.TrackEventCountChanged += (a, b) => UpdateTrackNumber(vegas);
     vegas.PlaybackStarted        += (a, b) => { isActive = true; GenericNonIdleAction(vegas); };
     vegas.PlaybackStopped        += (a, b) => { isActive = false; GenericNonIdleAction(vegas); };
     vegas.ProjectSaving          += (a, b) => GenericNonIdleAction(vegas);
     vegas.RenderStarted          += (a, b) => RenderStarted(vegas);
     vegas.RenderFinished         += (a, b) => RenderEvtFinish(b, vegas);
     vegas.AppInitialized         += (a, b) => loadDummyDocker((Vegas)a);
     DiscordRpc.RunCallbacks();
     DiscordRpc.UpdatePresence(ref presence);
     idleTimer.Interval = 10000;
     idleTimer.Tick    += (a, b) => IntervalTick();
     idleTimer.Start();
 }
Esempio n. 23
0
        public static void RvExtension(StringBuilder output, int outputSize, [MarshalAs(UnmanagedType.LPStr)] string function)
        {
            outputSize--;
            switch (function)
            {
            case "setup":
                //Initialize RPC
                Data data = Data.GetData();
                data.handlers = new DiscordRpc.EventHandlers();

                output.Append("Setup Done");

                DiscordRpc.Initialize("411594868293500938", ref data.handlers, true, null);
                break;

            case "screenshot":
                Keyboard k = new Keyboard();
                k.Send(Keyboard.ScanCodeShort.F12);
                break;
            }
        }
Esempio n. 24
0
 public void TogglePresence(Vegas vegas)
 {
     if (PresenceEnabled)
     {
         RichPresenceToggle rpct = new RichPresenceToggle(false);
         rpct.ShowDialog(vegas.MainWindow);
         idleTimer.Stop();
         PresenceEnabled = false;
         DiscordRpc.Shutdown();
     }
     else
     {
         RichPresenceToggle rpct = new RichPresenceToggle(true);
         rpct.ShowDialog(vegas.MainWindow);
         idleTimer.Start();
         PresenceEnabled = true;
         resetPresence(ref presence, vegas);
         DiscordRpc.Initialize("434711433112977427", ref callbacks, true, string.Empty);
         UpdateTrackNumber(vegas);
     }
 }
Esempio n. 25
0
 private void button1_Click(object sender, EventArgs e)
 {
     if (textBox1.Text.Length == 0 || textBox2.Text.Length == 0 || textBox3.Text.Length == 0 || textBox4.Text.Length == 0 || textBox5.Text.Length == 0 || textBox6.Text.Length == 0)
     {
         MessageBox.Show("Put a valid information!", "ERROR");
         richTextBox1.Text = "[ERROR] ClientID is not provided";
     }
     else
     {
         richTextBox1.Text = "[LOGS] RichPresence has been launched on : " + DateTime.Now;
         this.handlers     = default(DiscordRpc.EventHandlers);
         DiscordRpc.Initialize(textBox1.Text, ref this.handlers, true, null);
         this.handlers = default(DiscordRpc.EventHandlers);
         DiscordRpc.Initialize(textBox1.Text, ref this.handlers, true, null);
         this.presence.details        = textBox3.Text;
         this.presence.state          = textBox2.Text;
         this.presence.largeImageKey  = textBox4.Text;
         this.presence.smallImageKey  = textBox5.Text;
         this.presence.largeImageText = textBox6.Text;
         DiscordRpc.UpdatePresence(ref this.presence);
     }
 }
Esempio n. 26
0
        public static void Init()
        {
            eventHandlers = new DiscordRpc.EventHandlers();
            eventHandlers.errorCallback = (code, message) => VRCModLogger.LogError("[VRCTools] [Discord] (E" + code + ") " + message);

            presence.state         = "Not in a world";
            presence.details       = "Not logged in" + " (" + (VRCTrackingManager.IsInVRMode() ? "VR" : "Desktop") + ")";
            presence.largeImageKey = "logo";
            presence.partySize     = 0;
            presence.partyMax      = 0;
            presence.partyId       = "";
            try
            {
                string steamId = null;
                if (VRCApplicationSetup._instance.ServerEnvironment == ApiServerEnvironment.Release)
                {
                    steamId = "438100";
                }
                if (VRCApplicationSetup._instance.ServerEnvironment == ApiServerEnvironment.Beta)
                {
                    steamId = "744530";
                }
                if (VRCApplicationSetup._instance.ServerEnvironment == ApiServerEnvironment.Dev)
                {
                    steamId = "326100";
                }

                DiscordRpc.Initialize("404400696171954177", ref eventHandlers, true, steamId);
                DiscordRpc.UpdatePresence(ref presence);

                running = true;
                VRCModLogger.Log("[DiscordManager] RichPresence Initialised");
            }
            catch (Exception e)
            {
                VRCModLogger.Log("[DiscordManager] Unable to init discord RichPresence:");
                VRCModLogger.Log("[DiscordManager] " + e);
            }
        }
Esempio n. 27
0
    void Start()
    {
        if (initialized)
        {
            return;
        }
#if UNITY_EDITOR
        if (disableInEditor)
        {
            gameObject.SetActive(false);
            return;
        }
#endif
        if (Application.platform != RuntimePlatform.WindowsPlayer)
        {
            gameObject.SetActive(false);
            return;
        }

        Debug.Log("Discord: init");
        callbackCalls = 0;

        handlers = new DiscordRpc.EventHandlers();
        handlers.readyCallback         = ReadyCallback;
        handlers.disconnectedCallback += DisconnectedCallback;
        handlers.errorCallback        += ErrorCallback;

        try
        {
            DiscordRpc.Initialize(applicationId, ref handlers, true, optionalSteamId);
            initialized = true;
        }
        catch (DllNotFoundException e)
        {
            Debug.Log("Discord controller not found! Probably just a non-Windows build idk");
            enabled = false;
        }
    }
Esempio n. 28
0
        private void load()
        {
            DiscordRpc.Initialize("384734966690611202", ref discordHandlers, true, "");

            dependencies.Cache(this);
            dependencies.Cache(new LovewingColours());
            dependencies.Cache(new UserData());

            Fonts.AddStore(new GlyphStore(Resources, @"Fonts/FontAwesome"));
            Fonts.AddStore(new GlyphStore(Resources, @"Fonts/Muli_Light"));
            Fonts.AddStore(new GlyphStore(Resources, @"Fonts/Noto_Sans_CJK_JP_Regular")); // - it cant find the font for some reason

            var t = Audio.Track.Get(@"mainmenu_aqours");

            if (t == null)
            {
                return;
            }

            t.Looping = true;
            t.Volume.Set(0.5);
            t.Start();
        }
    static void Resume()
    {
        applicationId = editorAppId;
        callbackCalls = 0;

        handlers = new DiscordRpc.EventHandlers();
        handlers.readyCallback         = ReadyCallback;
        handlers.disconnectedCallback += DisconnectedCallback;
        handlers.errorCallback        += ErrorCallback;
        handlers.joinCallback         += JoinCallback;
        handlers.spectateCallback     += SpectateCallback;
        handlers.requestCallback      += RequestCallback;
        DiscordRpc.Initialize(applicationId, ref handlers, true, optionalSteamId);
        string[] s           = Application.dataPath.Split('/');
        string   projectName = s[s.Length - 2];

        Debug.Log("project = " + projectName);
        presence.details        = string.Format("Working on {0}, in scene {1}", projectName, SceneManager.GetActiveScene().name);
        presence.largeImageKey  = string.Format("unityicon");
        presence.startTimestamp = EditorPrefs.GetInt("discordEpoch");
        DiscordRpc.UpdatePresence(presence);
        DiscordRpc.RunCallbacks();
    }
Esempio n. 30
0
        static void Main(string[] args)
        {
            // Register callbacks
            var Callbacks = new DiscordRpc.EventHandlers();

            Callbacks.readyCallback         = ReadyCallback;
            Callbacks.disconnectedCallback += DisconnectedCallback;
            Callbacks.errorCallback        += ErrorCallback;

            Task.Run((Action) delegate
            {
                // Connect (Using the 'send-presence.c' id for demo MAKE_YOUR_OWN)
                DiscordRpc.Initialize("345229890980937739", ref Callbacks, true, null);

                // Register status
                var Status     = new DiscordRpc.RichPresence();
                Status.details = "Doing a thing!";

                // Update status
                DiscordRpc.UpdatePresence(ref Status);

                while (Continue)
                {
                    // Callbacks
                    DiscordRpc.RunCallbacks();
                    System.Threading.Thread.Sleep(100);
                }
            });

            while (Continue)
            {
                System.Threading.Thread.Sleep(100);
            }

            // Clean up
            DiscordRpc.Shutdown();
        }