Logo

index : nswa

WoW addon which removes annoyances and adds QoL (for me)

  • summary
  • about
  • tree
  • log
  • branches
<< path: root/public/nswa.git/html/nswa_hello.lua blob: a12678e1d5413b9052628f34a8095548fdae39c2 [raw] [clear marker]

        
0
1
2local DELAY_MIN = 2
3local DELAY_MAX = 5
4
5local messages = {
6 "hi",
7 "o/",
8 "o7",
9 "yo",
10 "hello",
11}
12
13local is_in_group = false
14local has_greeted = false
15
16
17local frame = CreateFrame("Frame")
18frame:RegisterEvent("GROUP_ROSTER_UPDATE")
19
20
21local function send_message(msg)
22 if IsInGroup(LE_PARTY_CATEGORY_INSTANCE) then
23 SendChatMessage(msg, "INSTANCE_CHAT")
24 elseif IsInGroup() then
25 SendChatMessage(msg, "PARTY")
26 end
27end
28
29local function greet_group()
30 local delay = math.random(DELAY_MIN, DELAY_MAX)
31 C_Timer.After(delay, function()
32 local msg = messages[ math.random(#messages) ]
33 send_message(msg)
34 end)
35end
36
37frame:SetScript("OnEvent", function()
38 if IsInGroup() and not IsInRaid() then
39 if not is_in_group then
40 if not has_greeted then
41 greet_group()
42 has_greeted = true
43 end
44 is_in_group = true
45 end
46 else
47 is_in_group = false
48 has_greeted = false
49 end
50end)
51
52
53
Copyright 2026  E766CB298A6D1E64 | Git-Thing heavily inspired by cgit