<Group("math")>
Public Class cmd_math
Inherits ModuleBase
#Region "Add"
<Command("add")>
Public Async Function cmdAdd(ByVal num1 As Integer, <Remainder> ByVal num2 As Integer) As Task
Dim sum = num1 + num2
Dim user = Context.User
Dim channel = Context.Channel
Await channel.SendMessageAsync($"{user.Mention} the sum of the two specified numbers are {sum}")
End Function
#End Region
#Region "Subtract"
<Command("sub")>
Public Async Function cmdSub(ByVal num1 As Integer, <Remainder> ByVal num2 As Integer) As Task
Dim sum = num1 - num2
Dim user = Context.User
Dim channel = Context.Channel
Await channel.SendMessageAsync($"{user.Mention} the sum of the two specified numbers are {sum}")
End Function
#End Region
#Region "Multiply"
<Command("multi")>
Public Async Function cmdMulti(ByVal num1 As Integer, <Remainder> ByVal num2 As Integer) As Task
Dim sum = num1 * num2
Dim user = Context.User
Dim channel = Context.Channel
Await channel.SendMessageAsync($"{user.Mention} the sum of the two specified numbers are {sum}")
End Function
#End Region
#Region "Divide"
<Command("divide")>
Public Async Function cmdDivide(ByVal num1 As Integer, <Remainder> ByVal num2 As Integer) As Task
Dim sum = num1 / num2
Dim user = Context.User
Dim channel = Context.Channel
Await channel.SendMessageAsync($"{user.Mention} the sum of the two specified numbers are {sum}")
End Function
#End Region
End Class
How would I go about creating a command lets say called 'list' which would then send an embed with the list of commands automatically without having to write the embed and fill it in automatically? If it can't be done within an embed using a regular image is fine. I'm pretty sure it's going to use a for loop for that but after that, I don't know how to take it on.
Somewhere in your program you would probably have something like
or however you add your client to your
IserviceProvider
You
ServiceProvider
is what is used for dependency injection. To inject the command service you would need to add it to theServiceCollection
To inject it into your command module, simply add an argument to your constructor
Then you can create your help command within that class, which now has access to the
CommandService
You can look at the different things you have access to via ModuleInfo and CommandInfo