-
Notifications
You must be signed in to change notification settings - Fork 10
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Warn Module update + started documentation + added guild aware permission checking #29
base: master
Are you sure you want to change the base?
Conversation
doc/index.md
Outdated
|
||
- [Ban]() : Ban management module | ||
- [Channel]() : Channel management module | ||
- [Game]() : |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Game is the global module handling bot status
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I will recreate this PR, I made some mistakes.
(I will also update the Game description in the doc)
@@ -82,6 +142,18 @@ function Module:GetConfigTable() | |||
Type = bot.ConfigType.Boolean, | |||
Default = true | |||
}, | |||
{ | |||
Name = "MinimalWarnRole", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why "minimal"?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Higher roles have the permission to warn, same for unwarn and MinimalUnwarnRole
module_warn.lua
Outdated
|
||
function Module:GetWarnAmount(history, memberId) | ||
local member = FindMember(history, memberId) | ||
return table.length(member.Warns) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
#member.Warns
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
module_warn.lua
Outdated
if not memberHistory then | ||
commandMessage:reply(string.format("The member **%s** (%d) already have zero warns.", targetMember.tag, targetMember.id)) | ||
else | ||
local lastWarn = table.remove(memberHistory.Warns, #memberHistory.Warns) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No need for the second table.remove parameter
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
module_warn.lua
Outdated
timestamp | ||
)) | ||
if not success then | ||
self:LogInfo(errMessage) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LogError
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
@@ -124,7 +124,8 @@ client:on('messageCreate', function(message) | |||
|
|||
if (commandTable.PrivilegeCheck) then | |||
local success, ret = Bot:ProtectedCall("Command " .. commandName .. " privilege check", commandTable.PrivilegeCheck, message.member) | |||
if (not success) then | |||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I removed GuildAwarePrivilegeCheck
@@ -0,0 +1,39 @@ | |||
# Not a Bot - Discord Bot |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This shouldn't be part of this PR
Warn module:
Documentation:
Bot modification: