From e8e6cd15d496fb5455a0a688b9d6287c7f7670ec Mon Sep 17 00:00:00 2001 From: Purplebored Date: Mon, 25 Sep 2023 12:41:49 +0200 Subject: [PATCH] Small changes Added stuff nodded by VS --- Chrobry.sln | 25 +++++++++++++++++++++++++ Program.cs | 33 ++++++++++++++++++++++++++++++--- 2 files changed, 55 insertions(+), 3 deletions(-) create mode 100644 Chrobry.sln diff --git a/Chrobry.sln b/Chrobry.sln new file mode 100644 index 0000000..35efdb8 --- /dev/null +++ b/Chrobry.sln @@ -0,0 +1,25 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio Version 17 +VisualStudioVersion = 17.7.34031.279 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Chrobry", "Chrobry.csproj", "{5F72A41D-651C-45E0-A377-5F04BC7F0E4D}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {5F72A41D-651C-45E0-A377-5F04BC7F0E4D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {5F72A41D-651C-45E0-A377-5F04BC7F0E4D}.Debug|Any CPU.Build.0 = Debug|Any CPU + {5F72A41D-651C-45E0-A377-5F04BC7F0E4D}.Release|Any CPU.ActiveCfg = Release|Any CPU + {5F72A41D-651C-45E0-A377-5F04BC7F0E4D}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + SolutionGuid = {570C625E-26DC-4793-998A-10733E2600CD} + EndGlobalSection +EndGlobal diff --git a/Program.cs b/Program.cs index 22b80c0..45d0a67 100644 --- a/Program.cs +++ b/Program.cs @@ -35,7 +35,7 @@ class Program // Modify user status await Client.CurrentUser.ModifySelfAsync( - statusText: new Option("God please someone kill me."), + statusText: new Option("?help."), statusType: new Option(UserStatusType.Focus) ); @@ -110,7 +110,6 @@ public class Commands : ModuleBase "#### List of available commands:\n\n" + "#### Practical Commands: \n" + "`?help` - Displays this command.\n" + - "`?source` - Links to the bots source code. \n" + "`?credits` - Displays bot's credit.\n" + "`?test` - Simple test command you say test bot will response.\n" + "`?invite` - Send a link to invite this bot to your server! \n" + @@ -126,7 +125,7 @@ public class Commands : ModuleBase "`?dogfact` - Gives a random dogfact using the Dogfact API!. \n" + "`?catfact` - Gives a random Catfact using cat fact API (Currently somewhat bugged with the []). \n" + "`?joke` - Very simple command just gives a joke using the Joke API. \n " + - "`?flipcoin` - a Command so easy a child could do it. \n " + + "`?coinflip` - a Command so easy a child could do it. \n " + "`?fact` - Gives a random useless fact. \n " + "`?urban + {word}` - uses the urban dictionary to search for the word. \n" + "`?shitpost` - Sends a random shitpost. (The shitpost API is broken.) \n " + @@ -382,6 +381,34 @@ public class Commands : ModuleBase } // End of the Dice command + // Pick Command + [Command("roll")] + public async Task Roll([Remainder] string randnum = null) + { + if (randnum == null) + { + await ReplyAsync("Please specify a number to roll"); + } + else if (int.TryParse(randnum, out int maxNumber) && maxNumber > 0) + { + try + { + var random = new Random(); + var result = random.Next(1, maxNumber + 1); + await ReplyAsync($"You rolled a {result}!"); + } + catch (Exception ex) + { + await ReplyAsync("An error occurred while rolling the dice."); + } + } + else + { + await ReplyAsync("Please pick a valid number."); + } + } + // End of the pick command + // Very simple say command. private List blacklist = new List {