Skip to content

Instantly share code, notes, and snippets.

@veeponym
Created February 15, 2023 13:04
Show Gist options
  • Save veeponym/c4798e0ce8a07b4a233806c88d648624 to your computer and use it in GitHub Desktop.
Save veeponym/c4798e0ce8a07b4a233806c88d648624 to your computer and use it in GitHub Desktop.
-- 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