Slightly extended broadcast.

stable
By mimaflexi in Miscellaneous Published May 2024 👁 629 views 💬 0 comments

Description

Slightly extended version for broadcast. I use when using multiple bots (for consistent looking bot label messages)
HaasScript
--- Author: MiMaFlexi

--[[

   Slightly extended version for broadcast. 
   I use when using multiple bots (for consistent looking bot label messages) 

]]

-- Inputs --
DefineCommand('broadcast', 'broadcastV1')
 
local cfText = DefineParameter(StringType,"Message","message to send",true,"")
local cfBotName = DefineParameter(StringType,"Bot Name","name of bot, false for no name",false,false)
local cfBroadcastTo = DefineParameter(StringType, "Broadcast to","all/discord/telegram",false,"all","all;discord;telegram")

-- function --
local msg = ""
if cfBotName != false then
    msg = cfBotName..": "
    end

msg = msg..cfText

local discord = false 
local telegram = false
if cfBroadcastTo == "all" then
    discord = true 
    telegram = true 
elseif cfBroadcastTo == "discord" then 
    discord = true 
elseif cfBroadcastTo == "telegram" then 
    telegram = true 
end

if discord == true then 
    BroadcastToDiscord(msg)
    Log("Broadcasting to Discord: "..msg, Gold)
end
if telegram == true then 
    BroadcastToTelegram(msg)
    Log("Broadcasting to Telegram: "..msg, Gold)
end


DefineOutput(VoidType)

0 Comments

Sign in to leave a comment.

No comments yet. Be the first!