Skip to content

Conversation

@GiregL
Copy link
Contributor

@GiregL GiregL commented Jan 23, 2021

Warn module:

  • added !popwarn command
  • added warn and unwarn roles (for permission checking)
  • added log channel in configuration
  • added logs for each action (excluding warnlist)

Documentation:

  • created summary
  • created Warn Module doc
  • API documentation will come later

Bot modification:

  • Added new field to modules: GuildAwarePrivilegeCheck
  • Made PrivilegeCheck and GuildAwarePrivilegeCheck complementary, both of them should pass to check privileges
  • GuildAwarePrivilegeCheck takes the guild and the member as parameters, enabling configuration dependent privilege checking

doc/index.md Outdated

- [Ban]() : Ban management module
- [Channel]() : Channel management module
- [Game]() :
Copy link
Contributor

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

Copy link
Contributor Author

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)

Default = true
},
{
Name = "MinimalWarnRole",
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why "minimal"?

Copy link
Contributor Author

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)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

#member.Warns

Copy link
Contributor Author

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)
Copy link
Member

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

Copy link
Contributor Author

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)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LogError

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

if (commandTable.PrivilegeCheck) then
local success, ret = Bot:ProtectedCall("Command " .. commandName .. " privilege check", commandTable.PrivilegeCheck, message.member)
if (not success) then

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

?

Copy link
Contributor Author

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
Copy link
Member

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants