-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathCommandcuts.lua
36 lines (32 loc) · 1011 Bytes
/
Commandcuts.lua
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
_addon.version = '1.0'
_addon.name = 'CommandCuts'
_addon.author = 'Selindrile'
require 'strings'
config = require 'config'
default_settings = {
commands = S{'lua','gs','load','unload','cancel','exec'},
block_non_commands = false,
}
settings = config.load('data\\settings.xml',default_settings)
config.save(settings)
setmetatable(settings,nil)
commands = settings.commands
windower.register_event('outgoing text',function(original,modified)
local converted = windower.convert_auto_trans(original)
if converted:startswith('/') then
local potentialcommand = string.match(converted, "/(%S+)")
if commands[potentialcommand] then
windower.send_command(original:sub(2))
return true
end
else
local potentialcommand = string.match(converted, "(%S+)")
if commands[potentialcommand] then
windower.send_command(original)
return true
elseif settings.block_non_commands then
windower.add_to_chat(123, "Commandcuts: Message didn't start with a /, blocking.")
return true
end
end
end)