mirror of
https://github.com/EnderIce2/SDR-RPC.git
synced 2025-07-12 08:09:13 +00:00
First commit
This commit is contained in:
34
DiscordAPI/RPC/Commands/CloseCommand.cs
Normal file
34
DiscordAPI/RPC/Commands/CloseCommand.cs
Normal file
@ -0,0 +1,34 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using DiscordRPC.RPC.Payload;
|
||||
using Newtonsoft.Json;
|
||||
|
||||
namespace DiscordRPC.RPC.Commands
|
||||
{
|
||||
internal class CloseCommand : ICommand
|
||||
{
|
||||
/// <summary>
|
||||
/// The process ID
|
||||
/// </summary>
|
||||
[JsonProperty("pid")]
|
||||
public int PID { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// The rich presence to be set. Can be null.
|
||||
/// </summary>
|
||||
[JsonProperty("close_reason")]
|
||||
public string value = "Unity 5.5 doesn't handle thread aborts. Can you please close me discord?";
|
||||
|
||||
public IPayload PreparePayload(long nonce)
|
||||
{
|
||||
return new ArgumentPayload()
|
||||
{
|
||||
Command = Command.Dispatch,
|
||||
Nonce = null,
|
||||
Arguments = null
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
13
DiscordAPI/RPC/Commands/ICommand.cs
Normal file
13
DiscordAPI/RPC/Commands/ICommand.cs
Normal file
@ -0,0 +1,13 @@
|
||||
using DiscordRPC.RPC.Payload;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
|
||||
namespace DiscordRPC.RPC.Commands
|
||||
{
|
||||
internal interface ICommand
|
||||
{
|
||||
IPayload PreparePayload(long nonce);
|
||||
}
|
||||
}
|
32
DiscordAPI/RPC/Commands/PresenceCommand.cs
Normal file
32
DiscordAPI/RPC/Commands/PresenceCommand.cs
Normal file
@ -0,0 +1,32 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using DiscordRPC.RPC.Payload;
|
||||
using Newtonsoft.Json;
|
||||
|
||||
namespace DiscordRPC.RPC.Commands
|
||||
{
|
||||
internal class PresenceCommand : ICommand
|
||||
{
|
||||
/// <summary>
|
||||
/// The process ID
|
||||
/// </summary>
|
||||
[JsonProperty("pid")]
|
||||
public int PID { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// The rich presence to be set. Can be null.
|
||||
/// </summary>
|
||||
[JsonProperty("activity")]
|
||||
public RichPresence Presence { get; set; }
|
||||
|
||||
public IPayload PreparePayload(long nonce)
|
||||
{
|
||||
return new ArgumentPayload(this, nonce)
|
||||
{
|
||||
Command = Command.SetActivity
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
32
DiscordAPI/RPC/Commands/RespondCommand.cs
Normal file
32
DiscordAPI/RPC/Commands/RespondCommand.cs
Normal file
@ -0,0 +1,32 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using DiscordRPC.RPC.Payload;
|
||||
using Newtonsoft.Json;
|
||||
|
||||
namespace DiscordRPC.RPC.Commands
|
||||
{
|
||||
internal class RespondCommand : ICommand
|
||||
{
|
||||
/// <summary>
|
||||
/// The user ID that we are accepting / rejecting
|
||||
/// </summary>
|
||||
[JsonProperty("user_id")]
|
||||
public string UserID { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// If true, the user will be allowed to connect.
|
||||
/// </summary>
|
||||
[JsonIgnore]
|
||||
public bool Accept { get; set; }
|
||||
|
||||
public IPayload PreparePayload(long nonce)
|
||||
{
|
||||
return new ArgumentPayload(this, nonce)
|
||||
{
|
||||
Command = Accept ? Command.SendActivityJoinInvite : Command.CloseActivityJoinRequest
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
23
DiscordAPI/RPC/Commands/SubscribeCommand.cs
Normal file
23
DiscordAPI/RPC/Commands/SubscribeCommand.cs
Normal file
@ -0,0 +1,23 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using DiscordRPC.RPC.Payload;
|
||||
|
||||
namespace DiscordRPC.RPC.Commands
|
||||
{
|
||||
internal class SubscribeCommand : ICommand
|
||||
{
|
||||
public ServerEvent Event { get; set; }
|
||||
public bool IsUnsubscribe { get; set; }
|
||||
|
||||
public IPayload PreparePayload(long nonce)
|
||||
{
|
||||
return new EventPayload(nonce)
|
||||
{
|
||||
Command = IsUnsubscribe ? Command.Unsubscribe : Command.Subscribe,
|
||||
Event = Event
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user