Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function onTextMessageEvent(serverConnectionHandlerID, targetMode, toID, fromID, fromName, fromUniqueIdentifier, message, ffIgnored)
- -- Get own client ID
- local myClientID, error = ts3.getClientID(serverConnectionHandlerID)
- if error ~= ts3errors.ERROR_ok then
- print("Error getting own client ID: " .. error)
- return
- end
- --JSON = (loadfile "JSON.lua")()
- 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
- function string.starts(String,Start)
- return string.sub(String,1,string.len(Start))==Start
- end
- -- Reply to person messaging ANYTHING to you when you are in channel
- function onTextMessageEvent(serverConnectionHandlerID, targetMode, toID, fromID, fromName, fromUniqueIdentifier, message, ffIgnored)
- myID = ts3.getClientID(serverConnectionHandlerID)
- if fromID ~= myID then
- if string.starts(message, "!yt play") then
- new = string.sub(message, 15, -7)
- --new = "https://www.youtube.com/watch?v=y6120QOlsfU"
- -- [=[Playing: [URL]]=] .. new .. [=[[/URL]]=]
- ts3.requestSendPrivateTextMsg(serverConnectionHandlerID,[[""C:\Program Files (x86)\VideoLAN\VLC\vlc.exe" --http-port=8080 "]] .. new .. [[""]], fromID)
- os.execute([[""C:\Program Files (x86)\VideoLAN\VLC\vlc.exe" --http-port=8080 "]] .. new .. [[""]])
- end
- end
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment