Last active
August 4, 2021 04:00
-
-
Save NotSoSuper/fced730f9d0bd4cafdb6c131d9ba2f8e to your computer and use it in GitHub Desktop.
This file contains 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
local function getMyself(serverConnectionHandlerID) | |
-- Get Self ID | |
local myClientID, error = ts3.getClientID(serverConnectionHandlerID) | |
if error ~= ts3errors.ERROR_ok then | |
print("Error getting own client ID: " .. error) | |
return | |
end | |
if myClientID == 0 then | |
ts3.printMessageToCurrentTab("Not connected") | |
return | |
end | |
-- Get which channel we are in | |
local myChannelID, error = ts3.getChannelOfClient(serverConnectionHandlerID, myClientID) | |
if error ~= ts3errors.ERROR_ok then | |
print("Error getting own channel: " .. error) | |
return | |
end | |
local clients, error = ts3.getClientList(serverConnectionHandlerID) | |
if error == ts3errors.ERROR_not_connected then | |
ts3.printMessageToCurrentTab("Not connected") | |
return | |
elseif error ~= ts3errors.ERROR_ok then | |
print("Error getting client list: " .. error) | |
return | |
end | |
return myClientID, myChannelID, clients | |
end | |
function PokeMods(serverConnectionHandlerID, ...) | |
local myClientID, myChannelID, clients = getMyself(serverConnectionHandlerID) | |
local clients, error = ts3.getClientList(serverConnectionHandlerID) | |
for i=1, #clients do | |
local c = clients[i] | |
if c ~= myClientID then | |
local groups, error = ts3.getClientVariableAsString(serverConnectionHandlerID, c, 34) | |
if error ~= ts3errors.ERROR_ok then | |
ts3.printMessageToCurrentTab("Error getting client groups: " .. error) | |
return | |
end | |
local ranks = {["23"] = true, ["22"] = true, ["34"] = true} | |
for group in string.gmatch(groups, '([^,]+)') do | |
if ranks[group] then | |
ts3.requestClientPoke(serverConnectionHandlerID, c, table.concat({...}, " ")) | |
end | |
end | |
end | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
ts3.requestClientPoke(serverConnectionHandlerID, c, table.concat({...}, " "))
When i use this function at TS3, the lenght of poke is limited and small. how can i make it bigger?