The following script demonstrates how to register a basic Discord command using the provided ExampleCommand
configuration:
local ExampleCommand = {
name = "test",
description = "This is the Test Description",
access_roles = { "1111111111111111111", "2222222222222222222" }, -- DISCORD ROLE ID
options = {
{
name = "id",
description = "Provide an ID",
optiontype = "number",
required = true,
},
{
name = "user",
description = "Provide a User",
optiontype = "user",
required = true,
},
{
name = "choice",
description = "Select an Option",
optiontype = "string",
required = true,
choices = {
{ name = "Option 1", value = "option1" },
{ name = "Option 2", value = "option2" },
},
}
},
onUse = function(args)
args.reply({
author = "Discord Bot",
description = "First Argument: " .. args.id .. "\nInvoker: " .. args.user.username .. "\nSelected Option: " .. args.choice,
color = "Green"
})
args.sendTo("user", { -- Argument Name (in this case 2nd option)
author = "Discord Bot",
description = "Hello!",
color = "Green"
})
end,
}
TriggerEvent("upikk_discordbot:RegisterCommand", ExampleCommand)