Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# Not a Bot

Source code of the bot of the french programming discord server NaN (Not a Name). https://discord.gg/zcWp9sC

[Documentation (WIP)](doc/index.md)
3 changes: 2 additions & 1 deletion bot_commands.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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

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

if (not success) then
message:reply("An error occurred")
return
end
Expand Down
39 changes: 39 additions & 0 deletions doc/index.md
Original file line number Diff line number Diff line change
@@ -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


Not a Bot is a french moderation bot designed for the [Not a Name](https://discord.gg/zcWp9sC).

It is based on multiple configurable modules where each ones have their own task.

The bot is made in Lua, with a custom wrapper around the Discordia library.

## Summary

### Modules

- [Ban]() : Ban management module
- [Channel]() : Channel management module
- [Game]() : Global mudule handling bot status
- [Kick]() : Kick management
- [Mention]() : Mention reaction module
- [Message]() : Message handler module (includes custom commands)
- [Modmail]() : Modmail and tickets module
- [Modo]() : Alert and flags module
- [Mute]() : Mute management module
- [Pin]() : Message pinning module
- [Poll]() : Polling module
- [Purge]() : Purge management module
- [Quote]() : Message quoting module
- [Raid]() : Anti-raid module
- [RoleInfo]() : Infos about roles
- [Stats]() : Guild stat module
- [Twitch]() : Twitch notification module
- [Warn](modules/warn_module.md) : Warning module
- [Welcome]() : Welcome message module

### API



### External Resources

- [Discordia Library](https://github.com/SinisterRectus/Discordia)
64 changes: 64 additions & 0 deletions doc/modules/warn_module.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
# Warn Module

Back to the *[Summary](../index.md)*.

*[Sources of the module](../../module_warn.lua)*

The warn module is used to give members warnings about their behaviour in the guild.

After a given amount of warns, the member gets muted __if the mute module is enabled__

## Config


- Sanctions (Boolean) (default = true)
- Enables sanctions (mute and ban alert) when a member receives a warning.

- MinimalWarnRole (Role) (default = nothing)
- Minimal role to be able to warn members and see their histories
- Unlocks `warn` and `warnlist`

- MinimalUnwarnRole (Role) (default = nothing)
- Minimal role to be able to unwarn a member.
- Unlocks `popwarn` and `clearwarn`

- WarnAmountToMute (Integer) (default = 3)
- Number of warns needed to mute a member.

- WarnAmountToBan (Integer) (default = 9)
- Numbed of warns needed to send the ban alert to the moderators.

- DefaultMuteDuration (Duration) (default = 1 hour)
- Default mute duration when a member gets enough warnings.
- The duration increases as the warning amount increases: `duration = default_duration * (warnings / WarnAmountToMute)`

- BanInformationChannel (Channel) (default = nothing)
- Channel where all the ban notifications are sent when a player has enough warnings
- This setting is required to enable the module
- You still have to manually ban the member, the last choice remains to the moderation team.

- WarnLogChannel (Channel) (default = nothing)
- Channel where all the notifications about warns and unwarns are logged.

- SendPrivateMessage (Boolean) (default = true)
- Enable private messages to inform the member of his warning.

## Commands

Assuming the bot prefix is `!`

- `!warn <target> [reason]`
- This command gives a warning to the target with the given reason. It also checks if the member should receive a mute or more (only if the option is enabled).
- If enabled, the member will receive a private message resuming the warning and where it comes from.
- Example : `!warn @SomePlayer You are a terrible liar`

- `!warnlist <target>`
- Shows all the warnings that the given user received.
- Example : `!warnlist @SomePlayer`

- `!clearwarns <target>`
- Clears all the history of the given member.
- Example : `!clearwarns @SomePlayer`

- `!popwarns <target>`
- Removes the last warn of the targeted member
Loading