-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #116 from InFTord/master
refactoring :3
- Loading branch information
Showing
32 changed files
with
777 additions
and
748 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Threading; | ||
using System.Threading.Tasks; | ||
using DSharpPlus; | ||
using DSharpPlus.Entities; | ||
|
||
/// <summary> | ||
/// Choosing Custom Status for bot! ("Playing CS:GO!") | ||
/// author: J0nathan550 | ||
/// </summary> | ||
|
||
namespace UPBot.DiscordRPC { | ||
public class DiscordStatus { | ||
struct ActivityStatus { | ||
public string status; | ||
public ActivityType type; | ||
} | ||
|
||
static async void DiscordUpdateStatusFunction(DiscordClient client, CancellationToken token) { | ||
List<ActivityStatus> activityStatusString = new() { | ||
new ActivityStatus { type = ActivityType.Playing, status = "Visual Studio to code algorithms!" }, | ||
new ActivityStatus { type = ActivityType.Playing, status = "a random game" }, | ||
new ActivityStatus { type = ActivityType.Playing, status = "happily with my toys" }, | ||
new ActivityStatus { type = ActivityType.Streaming, status = "the whole life" }, | ||
new ActivityStatus { type = ActivityType.Streaming, status = "a bunch of solution" }, | ||
new ActivityStatus { type = ActivityType.Streaming, status = "programming tutorials" }, | ||
new ActivityStatus { type = ActivityType.Streaming, status = "some lights in the channels" }, | ||
new ActivityStatus { type = ActivityType.ListeningTo, status = "Ode to Joy" }, | ||
new ActivityStatus { type = ActivityType.ListeningTo, status = "your complaints" }, | ||
new ActivityStatus { type = ActivityType.ListeningTo, status = "sounds in my head" }, | ||
new ActivityStatus { type = ActivityType.ListeningTo, status = "the falling rain" }, | ||
new ActivityStatus { type = ActivityType.Watching, status = "you!" }, | ||
new ActivityStatus { type = ActivityType.Watching, status = "all users" }, | ||
new ActivityStatus { type = ActivityType.Watching, status = "for nitro fakes" }, | ||
new ActivityStatus { type = ActivityType.Watching, status = "to reformat code" }, | ||
new ActivityStatus { type = ActivityType.Watching, status = "water boil" }, | ||
new ActivityStatus { type = ActivityType.Watching, status = "grass grow" }, | ||
new ActivityStatus { type = ActivityType.Competing, status = "with other bots" }, | ||
new ActivityStatus { type = ActivityType.Competing, status = "performance review" }, | ||
new ActivityStatus { type = ActivityType.Competing, status = "performance optimization" } | ||
}; | ||
|
||
Random random = new(); | ||
while (!token.IsCancellationRequested) { | ||
int activity = random.Next(0, activityStatusString.Count); | ||
ActivityStatus activityStatus = activityStatusString[activity]; | ||
|
||
await client.UpdateStatusAsync(new DiscordActivity(activityStatus.status, activityStatus.type)); | ||
|
||
await Task.Delay(TimeSpan.FromSeconds(60 + random.Next(0, 180)), token); | ||
} | ||
} | ||
|
||
internal static void Start(DiscordClient client) { | ||
Task statusUpdateTask = new(() => DiscordUpdateStatusFunction(client, new CancellationToken())); | ||
statusUpdateTask.Start(); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.