diff --git a/DisCatSharp.Docs/articles/modules/audio/lavalink_v4/commands.md b/DisCatSharp.Docs/articles/modules/audio/lavalink_v4/commands.md index 81af08f67c..d513a04277 100644 --- a/DisCatSharp.Docs/articles/modules/audio/lavalink_v4/commands.md +++ b/DisCatSharp.Docs/articles/modules/audio/lavalink_v4/commands.md @@ -352,6 +352,7 @@ Now we can use these commands to listen to music! + + !generic + + + Only usable during the year 2030! + + diff --git a/DisCatSharp.Docs/articles/modules/commandsnext/customization/argument_converters.md b/DisCatSharp.Docs/articles/modules/commandsnext/customization/argument_converters.md index 82cd365f0c..5b9db4c458 100644 --- a/DisCatSharp.Docs/articles/modules/commandsnext/customization/argument_converters.md +++ b/DisCatSharp.Docs/articles/modules/commandsnext/customization/argument_converters.md @@ -57,9 +57,16 @@ Once the argument converter is written and registered, we'll be able to use it: [Command("boolean")] public async Task BooleanCommand(CommandContext ctx, bool boolean) { - await ctx.RespondAsync($"Converted to {boolean}"); + await ctx.RespondAsync($"Converted to {boolean} :3"); } ``` -![true](/images/commands_argument_converters_01.png) + + + !boolean yes + + + Converted to True :3 + + diff --git a/DisCatSharp.Docs/articles/modules/commandsnext/customization/help_formatter.md b/DisCatSharp.Docs/articles/modules/commandsnext/customization/help_formatter.md index 83c5d7b5a8..09cc849ca2 100644 --- a/DisCatSharp.Docs/articles/modules/commandsnext/customization/help_formatter.md +++ b/DisCatSharp.Docs/articles/modules/commandsnext/customization/help_formatter.md @@ -16,44 +16,44 @@ Simply inherit from `BaseHelpFormatter` and provide an implementation for each o ```cs public class CustomHelpFormatter : BaseHelpFormatter { - // protected DiscordEmbedBuilder _embed; - // protected StringBuilder _strBuilder; + // protected DiscordEmbedBuilder _embed; + // protected StringBuilder _strBuilder; - public CustomHelpFormatter(CommandContext ctx) : base(ctx) - { - // _embed = new DiscordEmbedBuilder(); - // _strBuilder = new StringBuilder(); + public CustomHelpFormatter(CommandContext ctx) : base(ctx) + { + // _embed = new DiscordEmbedBuilder(); + // _strBuilder = new StringBuilder(); // Help formatters do support dependency injection. // Any required services can be specified by declaring constructor parameters. - // Other required initialization here ... - } - - public override BaseHelpFormatter WithCommand(Command command) - { - // _embed.AddField(command.Name, command.Description); - // _strBuilder.AppendLine($"{command.Name} - {command.Description}"); - - return this; - } - - public override BaseHelpFormatter WithSubcommands(IEnumerable cmds) - { - foreach (var cmd in cmds) - { - // _embed.AddField(cmd.Name, cmd.Description); - // _strBuilder.AppendLine($"{cmd.Name} - {cmd.Description}"); - } - - return this; - } - - public override CommandHelpMessage Build() - { - // return new CommandHelpMessage(embed: _embed); - // return new CommandHelpMessage(content: _strBuilder.ToString()); - } + // Other required initialization here ... + } + + public override BaseHelpFormatter WithCommand(Command command) + { + // _embed.AddField(command.Name, command.Description); + // _strBuilder.AppendLine($"{command.Name} - {command.Description}"); + + return this; + } + + public override BaseHelpFormatter WithSubcommands(IEnumerable cmds) + { + foreach (var cmd in cmds) + { + // _embed.AddField(cmd.Name, cmd.Description); + // _strBuilder.AppendLine($"{cmd.Name} - {cmd.Description}"); + } + + return this; + } + + public override CommandHelpMessage Build() + { + // return new CommandHelpMessage(embed: _embed); + // return new CommandHelpMessage(content: _strBuilder.ToString()); + } } ``` @@ -62,13 +62,13 @@ Alternatively, if you're only wanting to make a few small tweaks to the default ```cs public class CustomHelpFormatter : DefaultHelpFormatter { - public CustomHelpFormatter(CommandContext ctx) : base(ctx) { } + public CustomHelpFormatter(CommandContext ctx) : base(ctx) { } - public override CommandHelpMessage Build() - { - EmbedBuilder.Color = DiscordColor.SpringGreen; - return base.Build(); - } + public override CommandHelpMessage Build() + { + EmbedBuilder.Color = DiscordColor.SpringGreen; + return base.Build(); + } } ``` @@ -83,4 +83,15 @@ commands.SetHelpFormatter(); That's all there is to it. -![Fresh New Look](/images/commands_help_formatter_01.png) + + + + All available commands will be listed below. + + Sends you a list of all available commands, their usage and their description. + Displays information the bot knows about you or the mentioned user. + Displays your or the mentioned user's avatar as an embedded image. + + + + diff --git a/DisCatSharp.Docs/articles/modules/commandsnext/dependency_injection.md b/DisCatSharp.Docs/articles/modules/commandsnext/dependency_injection.md index 9e0c066bc8..9b34a09f97 100644 --- a/DisCatSharp.Docs/articles/modules/commandsnext/dependency_injection.md +++ b/DisCatSharp.Docs/articles/modules/commandsnext/dependency_injection.md @@ -65,7 +65,14 @@ public async Task RandomCommand(CommandContext ctx, int min, int max) Then we can give it a try! -![Command Execution](/images/commands_intro_05.png) + + + !random 1 500 + + + Your number is: 420 + +
CommandsNext has automatically injected our singleton `Random` instance into the `Rng` property when our command module was instantiated. diff --git a/DisCatSharp.Docs/articles/modules/commandsnext/intro.md b/DisCatSharp.Docs/articles/modules/commandsnext/intro.md index 6a74feb592..80f778338f 100644 --- a/DisCatSharp.Docs/articles/modules/commandsnext/intro.md +++ b/DisCatSharp.Docs/articles/modules/commandsnext/intro.md @@ -47,7 +47,7 @@ public async Task GreetCommand(CommandContext ctx) { } In the body of our new method, we'll use `CommandContext#RespondAsync` to send a simple message. ```cs -await ctx.RespondAsync("Greetings! Thank you for executing me!"); +await ctx.RespondAsync("Greetings! UwU"); ``` Finally, mark your command method with the `Command` attribute so CommandsNext will know to treat our method as a command method. @@ -59,7 +59,7 @@ We'll name our command *greet* to match the name of the method. [Command("greet")] public async Task GreetCommand(CommandContext ctx) { - await ctx.RespondAsync("Greetings! Thank you for executing me!"); + await ctx.RespondAsync("Greetings! UwU"); } ``` @@ -75,7 +75,7 @@ public class MyFirstModule : BaseCommandModule [Command("greet")] public async Task GreetCommand(CommandContext ctx) { - await ctx.RespondAsync("Greetings! Thank you for executing me!"); + await ctx.RespondAsync("Greetings! UwU"); } } ``` @@ -156,9 +156,14 @@ internal static async Task MainAsync() It's now the moment of truth; all your blood, sweat, and tears have lead to this moment. Hit `F5` on your keyboard to compile and run your bot, then execute your command in any channel that your bot account has access to. -![Congratulations, You've Won!](/images/commands_intro_03.png) - -[That was easy](https://www.youtube.com/watch?v=GsQXadrmhws). + + + !greet + + + Greetings! UwU + + ## Taking User Input @@ -186,13 +191,20 @@ which uses our new parameter. ```cs public async Task GreetCommand(CommandContext ctx, string name) { - await ctx.RespondAsync($"Greetings, {name}! You're pretty neat!"); + await ctx.RespondAsync($"Greetings, {name}! You're cute OwO!"); } ``` That's all there is to it. Smack `F5` and test it out in a channel your bot account has access to. -![Greet Part 2: Electric Boogaloo](/images/commands_intro_04.png) + + + !greet Drac + + + Greetings, Drac! You're cute OwO! + + Now, you may have noticed that providing more than one word simply does not work. For example, `!greet Luke Smith` will result in no response from your bot. @@ -207,7 +219,7 @@ The simplest way to get around this would be to wrap your input with double quot CommandsNext will parse this as one argument, allowing your command to be executed. ``` -!greet "Luke Smith" +!greet "Lala Sabathil" ``` If you would prefer not to use quotes, you can use the `RemainingText` attribute on your parameter. @@ -275,7 +287,14 @@ await ctx.RespondAsync($"Your number is: {random.Next(min, max)}"); Run your bot once more with `F5` and give this a try in a text channel. -![Discord Channel](/images/commands_intro_05.png) + + + !random 1 100 + + + Your number is: 69 + + CommandsNext converted the two arguments from `string` into `int` and passed them to the parameters of our command, removing the need to manually parse and convert the arguments yourself. @@ -292,17 +311,38 @@ Then modify the response to mention the provided member with the `Mention` prope ```cs public async Task GreetCommand(CommandContext ctx, DiscordMember member) { - await ctx.RespondAsync($"Greetings, {member.Mention}! Enjoy the mention!"); + await ctx.RespondAsync($"Heywo, {member.Mention}! Enjoy the mention!"); } ``` Go ahead and give that a test run. -![According to all known laws of aviation,](/images/commands_intro_06.png) - -![there is no way a bee should be able to fly.](/images/commands_intro_07.png) - -![Its wings are too small to get its fat little body off the ground.](/images/commands_intro_08.png) + + + !greet Discord User + + + Heywo, Discord User! Enjoy the mention! + + + + + + !greet Discord User + + + Heywo, Discord User! Enjoy the mention! + + + + + + !greet 666339628613107725 + + + Heywo, Discord User! Enjoy the mention! + + The argument converter for `DiscordMember` is able to parse mentions, usernames, nicknames, and user IDs then look for a matching member within the guild the command was executed from. Ain't that neat? diff --git a/DisCatSharp.Docs/articles/modules/interactivity.md b/DisCatSharp.Docs/articles/modules/interactivity.md index 3a8d0d536a..b655657f8b 100644 --- a/DisCatSharp.Docs/articles/modules/interactivity.md +++ b/DisCatSharp.Docs/articles/modules/interactivity.md @@ -5,6 +5,7 @@ hasDiscordComponents: true --- # Introduction to Interactivity + Interactivity will enable you to write commands which the user can interact with through reactions and messages. The goal of this article is to introduce you to the general flow of this extension. @@ -13,6 +14,7 @@ Make sure to install the `DisCatSharp.Interactivity` package from NuGet before c ![Interactivity NuGet](/images/interactivity_01.png) ## Enabling Interactivity + Interactivity can be registered using the `DiscordClient#UseInteractivity()` extension method.
Optionally, you can also provide an instance of `InteractivityConfiguration` to modify default behaviors. @@ -35,17 +37,18 @@ There are two ways available to use interactivity: We'll have a quick look at a few common interactivity methods along with an example of use for each. -
The first (and arguably most useful) extension method is `SendPaginatedMessageAsync` for `DiscordChannel`. This method displays a collection of *'pages'* which are selected one-at-a-time by the user through reaction buttons. Each button click will move the page view in one direction or the other until the timeout is reached. You'll need to create a collection of pages before you can invoke this method. -This can be done easily using the `GeneratePagesInEmbed` and `GeneratePagesInContent` instance methods from `InteractivityExtension`.
+This can be done easily using the `GeneratePagesInEmbed` and `GeneratePagesInContent` instance methods from `InteractivityExtension`. + Alternatively, for pre-generated content, you can create and add individual instances of `Page` to a collection. This example will use the `GeneratePagesInEmbed` method to generate the pages. + ```cs public async Task PaginationCommand(CommandContext ctx) { @@ -75,11 +78,11 @@ public async Task PaginationCommand(CommandContext ctx) -
-Next we'll look at the `WaitForReactionAsync` extension method for `DiscordMessage`.
+Next we'll look at the `WaitForReactionAsync` extension method for `DiscordMessage`. This method waits for a reaction from a specific user and returns the emoji that was used. An overload of this method also enables you to wait for a *specific* reaction, as shown in the example below. + ```cs public async Task ReactionCommand(CommandContext ctx, DiscordMember member) { @@ -104,8 +107,7 @@ public async Task ReactionCommand(CommandContext ctx, DiscordMember member) -
-Another reaction extension method for `DiscordMessage` is `CollectReactionsAsync`.
+Another reaction extension method for `DiscordMessage` is `CollectReactionsAsync`. As the name implies, this method collects all reactions on a message until the timeout is reached. ```cs @@ -136,11 +138,11 @@ public async Task CollectionCommand(CommandContext ctx) -
-The final one we'll take a look at is the `GetNextMessageAsync` extension method for `DiscordMessage`.
+The final one we'll take a look at is the `GetNextMessageAsync` extension method for `DiscordMessage`. -This method will return the next message sent from the author of the original message.
+This method will return the next message sent from the author of the original message. Our example here will use its alternate overload which accepts an additional predicate. + ```cs public async Task ActionCommand(CommandContext ctx) { diff --git a/DisCatSharp.Docs/articles/toc.yml b/DisCatSharp.Docs/articles/toc.yml index b9f5536296..a638cf8b3f 100644 --- a/DisCatSharp.Docs/articles/toc.yml +++ b/DisCatSharp.Docs/articles/toc.yml @@ -89,7 +89,7 @@ items: uid: modules_audio_lavalink_v4_setup - name: Configuration uid: modules_audio_lavalink_v4_configuration - - name: Music Commands + - name: Commands uid: modules_audio_lavalink_v4_commands - name: Advanced uid: modules_audio_lavalink_v4_advanced diff --git a/DisCatSharp.Docs/articles/topics/messagebuilder.md b/DisCatSharp.Docs/articles/topics/messagebuilder.md index b42424af39..b2717eb3cc 100644 --- a/DisCatSharp.Docs/articles/topics/messagebuilder.md +++ b/DisCatSharp.Docs/articles/topics/messagebuilder.md @@ -21,23 +21,24 @@ but here we'll go over some of the concepts of using the message builder: For sending files, you'll have to use the MessageBuilder to construct your message, see example below: ```cs - using (var fs = new FileStream("snippet.cs", FileMode.Open, FileAccess.Read)) + using (var fs = new FileStream("global_name.cs", FileMode.Open, FileAccess.Read)) { var msg = await new DiscordMessageBuilder() .WithContent("Here's a code snippet for you!") - .WithFiles(new Dictionary() { { "snippet.cs", fs } }) + .WithFiles(new Dictionary() { { "global_name.cs", fs } }) .SendAsync(ctx.Channel); } ``` - + ### Adding Mentions For sending mentions, you'll have to use the MessageBuilder to construct your message, see example below: diff --git a/DisCatSharp.Docs/dcs/layout/_master.tmpl b/DisCatSharp.Docs/dcs/layout/_master.tmpl index fd12c31f9e..a3b847c0e0 100644 --- a/DisCatSharp.Docs/dcs/layout/_master.tmpl +++ b/DisCatSharp.Docs/dcs/layout/_master.tmpl @@ -147,11 +147,11 @@ } }, defaultMode: "cozy", - defaultTheme: "dark", + defaultTheme: "dark", // replace with amoled soon defaultBackground: "discord" }; - + {{/hasDiscordComponents}} @@ -173,7 +173,7 @@ - {{/redirect_url}} diff --git a/DisCatSharp.Docs/dcs/public/main.css b/DisCatSharp.Docs/dcs/public/main.css index fb2c850f19..471b1910ae 100644 --- a/DisCatSharp.Docs/dcs/public/main.css +++ b/DisCatSharp.Docs/dcs/public/main.css @@ -319,3 +319,22 @@ a.discord-button[href] { a.discord-button[href]::after { content: '' !important; } + +*, ::before, ::after { + box-sizing: content-box !important; +} + +.discord-invite .discord-invite-badge { + width: 16px !important; + height: 23px !important; +} + +.discord-header-text { + flex-grow: 1; + left: 8px !important; + position: relative !important; +} + +.discord-header { + display: contents !important; +} diff --git a/DisCatSharp.Docs/docfx.json b/DisCatSharp.Docs/docfx.json index fc82b5ffff..7b44730014 100644 --- a/DisCatSharp.Docs/docfx.json +++ b/DisCatSharp.Docs/docfx.json @@ -264,7 +264,8 @@ "images/**", "natives/**.zip", "natives/**.jar", - "./.htaccess" + "./.htaccess", + "snippets/**" ], "exclude": [ "**/bin/**", diff --git a/DisCatSharp.Docs/images/commands_help_formatter_01.png b/DisCatSharp.Docs/images/commands_help_formatter_01.png deleted file mode 100644 index 73a4b99f19..0000000000 Binary files a/DisCatSharp.Docs/images/commands_help_formatter_01.png and /dev/null differ diff --git a/DisCatSharp.Docs/index.md b/DisCatSharp.Docs/index.md index 3d5319c790..3d530cc246 100644 --- a/DisCatSharp.Docs/index.md +++ b/DisCatSharp.Docs/index.md @@ -16,15 +16,16 @@ hasDiscordComponents: true What is that, do you have an invite? Sure!

https://discord.gg/discatsharp - +

+ This is the main channel of DisCatSharp Welcome, Discord User. We hope you brought pizza. - + Hey guys, I'm new here!