Remove unnecessary code

This commit is contained in:
Diamond Creeper 2024-11-30 22:07:43 +13:00
parent 3a164c5599
commit 0775ab2a43
6 changed files with 2 additions and 66 deletions

View file

@ -32,58 +32,10 @@ class Program
// Poll Jellyfin API for currently playing media
var updateTask = UpdateRichPresence(); // Start the rich presence update task
// Command loop for toggling screen sharing
while (true)
{
var command = Console.ReadLine()?.ToLower();
if (command == "toggle")
{
ToggleScreenSharing();
}
else if (command == "exit")
{
break; // Exit the loop and end the program
}
else
{
Console.WriteLine("Invalid command. Type 'toggle' to toggle screen sharing or 'exit' to quit.");
}
}
await updateTask; // Wait for the rich presence update task to finish
}
private static void ToggleScreenSharing()
{
isScreenSharing = !isScreenSharing; // Toggle the screen sharing state
Console.WriteLine(isScreenSharing ? "Screen sharing enabled." : "Screen sharing disabled.");
UpdateDiscordPresence(); // Manually update Discord presence when toggling screen sharing
}
private static void UpdateDiscordPresence()
{
// Log the current status of screen sharing
Console.WriteLine($"Updating Discord Presence. Screen Sharing: {isScreenSharing}");
// Ensure we immediately update the Discord presence when toggling screen sharing
_discordClient.SetPresence(new RichPresence
{
Details = isScreenSharing ? "Sharing screen" : "Watching media",
State = isScreenSharing ? "Screen sharing is active" : "Not sharing screen",
Timestamps = new Timestamps
{
Start = DateTime.UtcNow
},
Assets = new Assets
{
LargeImageKey = isScreenSharing ? "screen_sharing" : "media_playing",
LargeImageText = isScreenSharing ? "Screen sharing on Discord" : "Watching media on Jellyfin"
}
});
Console.WriteLine("Presence updated successfully.");
}
private static async Task UpdateRichPresence()
{
while (true)