Skip to content

Commit

Permalink
Add /owo guild option
Browse files Browse the repository at this point in the history
Test bc classic packaging
  • Loading branch information
Ketho committed Apr 18, 2021
1 parent 70d2f5b commit 7196a2a
Show file tree
Hide file tree
Showing 3 changed files with 39 additions and 18 deletions.
6 changes: 5 additions & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,11 @@ jobs:

- uses: BigWigsMods/packager@master
with:
args: release.sh -g 1.13.4
args: release.sh -g classic

- uses: BigWigsMods/packager@master
with:
args: release.sh -g bc

- uses: BigWigsMods/packager@master
with:
Expand Down
41 changes: 30 additions & 11 deletions OwoSpeak.lua
Original file line number Diff line number Diff line change
Expand Up @@ -9,19 +9,23 @@ local owos = {
}

local defaults = {
db_version = 1,
db_version = 2,
enabled = true,
guild = true,
}

local db
local hyperlinks = {}

local function OnEvent(self, event, addon)
if addon == "OwoSpeak" then
if not OwoSpeakDB or OwoSpeakDB.db_version < defaults.db_version then
OwoSpeakDB = CopyTable(defaults)
end
OwoSpeakDB = OwoSpeakDB or CopyTable(defaults)
db = OwoSpeakDB
for k, v in pairs(defaults) do
if db[k] == nil then
db[k] = v
end
end
self:UnregisterEvent("ADDON_LOADED")
end
end
Expand All @@ -40,10 +44,20 @@ local function RestoreLink(s)
return hyperlinks[n]
end

local function ShouldOwo(chatType)
if db.enabled then
if chatType == "GUILD" then
return db.guild
else
return true
end
end
end

local makeowo = SendChatMessage

function SendChatMessage(msg, ...)
if db.enabled then
function SendChatMessage(msg, chatType, ...)
if ShouldOwo(chatType) then
wipe(hyperlinks)
local owo = owos[random(#owos)]
local whatsthis = random(10)
Expand Down Expand Up @@ -71,9 +85,9 @@ function SendChatMessage(msg, ...)
s = whatsthis == 1 and s.." "..owo or s:gsub("!$", " "..owo)
-- pwease owo wesponsibwy
s = #s <= 255 and s:gsub("owo%d", RestoreLink) or msg
makeowo(s, ...)
makeowo(s, chatType, ...)
else
makeowo(msg, ...)
makeowo(msg, chatType, ...)
end
end

Expand All @@ -85,7 +99,12 @@ local EnabledMsg = {
SLASH_OWOSPEAK1 = "/owo"
SLASH_OWOSPEAK2 = "/owospeak"

SlashCmdList.OWOSPEAK = function()
db.enabled = not db.enabled
print("OwoSpeak: "..EnabledMsg[db.enabled])
SlashCmdList.OWOSPEAK = function(msg)
if msg == "guild" then
db.guild = not db.guild
print("OwoSpeak: Guild - "..EnabledMsg[db.guild])
else
db.enabled = not db.enabled
print("OwoSpeak: "..EnabledMsg[db.enabled])
end
end
10 changes: 4 additions & 6 deletions OwoSpeak.toc
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
#@retail@
## Interface: 80300
#@end-retail@
#@non-retail@
# ## Interface: 11304
#@end-non-retail@
## Interface: 90005
## Interface-Retail: 90005
## Interface-Classic: 11306
## Interface-BC: 20501
## Version: @project-version@
## Title: OwoSpeak
## Notes: Pwease owo wesponsibwy
Expand Down

0 comments on commit 7196a2a

Please sign in to comment.