diff options
| author | ilotterytea <iltsu@alright.party> | 2025-12-05 00:49:42 +0500 |
|---|---|---|
| committer | ilotterytea <iltsu@alright.party> | 2025-12-05 00:49:42 +0500 |
| commit | ae485b94ea7b9d34efd4526ddf43ec51678e1be7 (patch) | |
| tree | fec4789c53b89a3a1a93e78d1ca0c5ebcf53c292 | |
| parent | a2052f0362d66493d05aec9cbdd151bfc1011a5f (diff) | |
feat: !say command
| -rw-r--r-- | luamods/say.lua | 41 |
1 files changed, 41 insertions, 0 deletions
diff --git a/luamods/say.lua b/luamods/say.lua new file mode 100644 index 0000000..8fa48be --- /dev/null +++ b/luamods/say.lua @@ -0,0 +1,41 @@ +local lines = { + english = { + ["no_message"] = "{sender.alias_name}: Message must be provided.", + }, + russian = { + ["no_message"] = "{sender.alias_name}: Сообщение должно быть указано.", + }, +} + +return { + name = "say", + description = "Make the bot say something. Available only to superusers.", + delay_sec = 5, + options = {}, + subcommands = {}, + aliases = {}, + minimal_rights = "superuser", + handle = function(request) + if request.message == nil then + return l10n_custom_formatted_line_request(request, lines, "no_message", {}) + end + + local msg = request.message + + local parts = str_split(msg, " ") + if #parts == 0 then + return l10n_custom_formatted_line_request(request, lines, "no_message", {}) + end + + local channel_name = request.channel.alias_name + if string.sub(parts[1], 1, 1) == "#" then + channel_name = string.sub(parts[1], 2, #parts[1]) + table.remove(parts, 1) + msg = table.concat(parts, " ") + end + + irc_send_message(channel_name, msg) + + return nil + end, +} |
