Skip to content

Commit

Permalink
Merge branch 'evaera:master' into runif-conditions
Browse files Browse the repository at this point in the history
  • Loading branch information
wilyt1 authored Jun 29, 2024
2 parents 0566caa + 232064c commit 4f32ffe
Showing 1 changed file with 11 additions and 2 deletions.
13 changes: 11 additions & 2 deletions Cmdr/BuiltInCommands/Utility/bind.lua
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
local UserInputService = game:GetService("UserInputService")
local TextChatService = game:GetService("TextChatService")

return {
Name = "bind",
Expand Down Expand Up @@ -52,7 +53,7 @@ return {
elseif bindType == "bindableResource" then
return "Unimplemented..."
elseif bindType == "player" then
binds[bind] = bind.Chatted:Connect(function(message)
local function RunCommand(message)
local args = { message }
local chatCommand = context.Cmdr.Util.RunEmbeddedCommands(
context.Dispatcher,
Expand All @@ -62,7 +63,15 @@ return {
("%s $ %s : %s"):format(bind.Name, chatCommand, context.Dispatcher:EvaluateAndRun(chatCommand)),
Color3.fromRGB(244, 92, 66)
)
end)
end

if TextChatService.ChatVersion == Enum.ChatVersion.LegacyChatService then
binds[bind] = bind.Chatted:Connect(RunCommand)
else
binds[bind] = TextChatService.SendingMessage:Connect(function(message)
RunCommand(message.Text)
end)
end
end

return "Bound command to input."
Expand Down

0 comments on commit 4f32ffe

Please sign in to comment.