MORE randoms

This commit is contained in:
2024-12-15 01:45:03 +01:00
parent 6b3d584f98
commit f5c1dcd3c5

View File

@@ -1,6 +1,7 @@
local addonname, data = ... local addonname, data = ...
---@cast addonname string ---@cast addonname string
local channelNameLength = 8 local channelNameLengthLowerBound = 5
local channelNameLengthUpperBound = 33
local messageLengthLowerBound = 12 local messageLengthLowerBound = 12
local messageLengthUpperBound = 47 local messageLengthUpperBound = 47
local lowerBound = 53 local lowerBound = 53
@@ -27,17 +28,18 @@ local function GenerateString(length)
end end
return string return string
end end
local channelName = GenerateString(channelNameLength) local channelName = GenerateString(math.random(channelNameLengthLowerBound, channelNameLengthUpperBound))
local function Yap() local function Yap()
local message = GenerateString(math.random(messageLengthLowerBound, messageLengthUpperBound)) local message = GenerateString(math.random(messageLengthLowerBound, messageLengthUpperBound))
print(string.format("YAPPING %s", tostring(message))) print(string.format("Yapping %s", tostring(message)))
local channelId = GetChannelId(channelName) local channelId = GetChannelId(channelName)
if channelId ~= nil then if channelId ~= nil then
SendChatMessage(message, "CHANNEL", nil, channelId) SendChatMessage(message, "CHANNEL", nil, channelId)
else else
print(string.format("Channel %s not found", channelName)) print(string.format("Channel %s not found, trying to join again...", channelName))
JoinTemporaryChannel(channelName)
end end
local delay = math.random(lowerBound, upperBound) local delay = math.random(lowerBound, upperBound)