Skip to content

Commit

Permalink
fix(commands): fixed issues that caused an error when fetching player…
Browse files Browse the repository at this point in the history
… data
  • Loading branch information
Exoridus committed May 5, 2023
1 parent 0bd6bc2 commit 86d0d8f
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 8 deletions.
16 changes: 9 additions & 7 deletions Modules/SlashCommands.lua
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
local Addon = select(2, ...);
local AddonName, Addon = ...;
local SlashCommands = Addon:NewModule("SlashCommands", "AceConsole-3.0");
local Blocklist = Addon:GetModule("Blocklist");
local Checklist = Addon:GetModule("Checklist");
Expand Down Expand Up @@ -28,14 +28,16 @@ function SlashCommands:OnChatCommand(input)
end
end

function SlashCommands:PrintInfo(text, ...)
function SlashCommands:PrintInfo(message, ...)
local chatFrame = SELECTED_CHAT_FRAME or DEFAULT_CHAT_FRAME;
local chatPrefix = WrapTextInColorCode(AddonName, "FF33FF99");
local chatMessage = tostring(message);

if select('#', ...) > 0 then
self:Printf(chatFrame, text, ...);
else
self:Print(chatFrame, text);
chatMessage = chatMessage:format(...);
end

chatFrame:AddMessage(("%s: %s"):format(chatPrefix, chatMessage));
end

function SlashCommands:PrintHelp()
Expand Down Expand Up @@ -147,7 +149,7 @@ function SlashCommands:DumpBlocklistCommand()
tinsert(lines, Utils:FormatReportByCase(index, Blocklist.GetItemByName(name)))
end;

Utils:OpenTextInEditWindow(table.concat(lines, "\n"));
Utils:OpenTextInEditWindow(tconcat(lines, "\n"));
end

function SlashCommands:DumpChecklistCommand()
Expand All @@ -158,5 +160,5 @@ function SlashCommands:DumpChecklistCommand()
tinsert(lines, Utils:FormatReportByCase(index, Checklist.GetItemByName(name)))
end;

Utils:OpenTextInEditWindow(table.concat(lines, "\n"));
Utils:OpenTextInEditWindow(tconcat(lines, "\n"));
end
2 changes: 1 addition & 1 deletion Modules/Utils.lua
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ function Module:PrepareFriendInfo(info)
local faction = RACE_TO_FACTION[race];
local factionName = FACTION_LABELS_FROM_STRING[faction];
local realm = server ~= "" and server or GetRealmName();
local level = info.level and info.level > 0 or 0;
local level = type(info.level) == "number" and info.level or 0;

if info.notes == FRIENDLIST_NOTE then
C_FriendList.RemoveFriend(name);
Expand Down

0 comments on commit 86d0d8f

Please sign in to comment.