Bootstrap Framework 3.3.6

Over a dozen reusable components built to provide iconography, dropdowns, input groups, navigation, alerts, and much more...

Publish your tools and modifications here.
By Bisb
#721
Hello everyone,

there is a little lua script I made for teamspeak so you can use hotkeys to manage the volume of the bot (you can use them wihtout having the focus on Teamspeak).

Installation
You'll need two files for this plugin to work, the first one is init.lua
Code: Select all
require("ts3init")                    -- Required for ts3RegisterModule
require("msgbot/msgbot")     -- Function file

-- Register the callback function
local MODULE_NAME = "msgbot"

ts3RegisterModule(MODULE_NAME, registeredEvents)
the second one is msgbot.lua
Code: Select all
require("ts3defs")
require("ts3errors")

local function sendToMusicBot(message)
		local botId = NULL
		local clients, error = ts3.getClientList(1)
		for i=1, #clients do
			local clientName, error = ts3.getClientVariableAsString(1, clients[i], ts3defs.ClientProperties.CLIENT_NICKNAME)
			if clientName == "TS3MusicBot" then
				botId = clients[i]
			end
		end
		if botId ~= NULL then
			ts3.requestSendPrivateTextMsg(1, message, botId)
		else
			ts3.printMessageToCurrentTab("Can't reach TS3MusicBot")
		end
end

local function voldefault()
		cmd = "!volume 5"
		sendToMusicBot(cmd)
end

local function volup()
		cmd = "!volume +"
		sendToMusicBot(cmd)
end

local function voldown()
		cmd = "!volume -"
		sendToMusicBot(cmd)
end

msgbot = {
	voldefault = voldefault,
	volup = volup,
	voldown = voldown
}
Now go to your lua plugins directory in your Teamspeak installation folder (C:\Program Files\TeamSpeak 3 Client\plugins\lua_plugin, it might change if you installed Teamspeak in a different place) and create a folder named msgbot. Now place both init.lua and msgbot.lua in the freshly created folder.

You'll have to enable the Lua Plugin in Teamspeak, to do so follow these steps :
Settings->Plugins (or CTRL+SHIFT+P) and be sure that Lua Plugin is checked, you can now close the window.

You should now be able to use the following commands on the Teamspeak chat :
Code: Select all
/lua run msgbot.volup
/lua run msgbot.voldown
/lua run msgbot.voldefault
If you encounter errors try the following commands :
Code: Select all
/lua load msgbot/init.lua
and
Code: Select all
/lua load msgbot/msgbot.lua
To use the commands as hotkeys on Teamspeak.
To do so enter the options menu (Settings->Options or ALT+P) and find the Hotkeys sub-menu.
  • Add a new hotkey
  • Assign keys
  • Click on "Show Advanced Actions"
  • Find "Plugins" and "Run Plugin Command"
  • Enter one of the following commands :
    • /lua run msgbot.volup (same command as !volume +)
    • /lua run msgbot.voldown (same command as !volume -)
    • /lua run msgbot.voldefault (same command as !volume 5, you can change the default value in the script)
You're done, everything should work from now on!


How it works :
Everytime you'll press a hotkey it will check if the TS3MusicBot client is on your server (you wont see it but he's here if your Music Bot is connected) and will send him the command, allowing you to manage the volume of your bot while doing something else. You won't have to use the commands or the web interface anymore!

You can customize the script as you want. For example you can add commands to run a given playlist with a simple hotkey etc.

Hope you'll enjoy the script, if you have any question you can ask me.

Hf

Alles klar, werde ich, wenn ich dafür Zeit ha[…]

1. Shell Script (ts3musicbot_service.sh) Create […]

Unable to set Avatar error

Really? We have not made a change regarding the av[…]

youtube

Schauen wir uns an.

Swap-in out addons, use only what you really need!