Created
February 15, 2023 13:04
-
-
Save veeponym/c4798e0ce8a07b4a233806c88d648624 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
-- Define an echo object | |
local echo = {} | |
-- Define a function to register the commands | |
function echo:registerCommands(client, slash) | |
-- Define a slash command for echo | |
slash:registerCommand('echo', 'Repeat a message', function(interaction) | |
-- Get the message from the interaction | |
local message = interaction.data.options[1].value | |
-- Reply with the message | |
interaction:reply(message) | |
end, { | |
-- Define an option for the message | |
{ | |
name = 'message', | |
description = 'The message to repeat', | |
type = slash.enums.optionType.string, | |
required = true | |
} | |
}) | |
end | |
-- Define a function to unregister the commands | |
function echo:unregisterCommands(client, slash) | |
-- Unregister the slash command for echo | |
slash:unregisterCommand('echo') | |
end | |
-- Return the echo object | |
return echo |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment