Skip to content

Commit

Permalink
Merge branch 'develop' into main
Browse files Browse the repository at this point in the history
  • Loading branch information
oliverbooth committed Jul 31, 2022
2 parents 7c24d7a + 8919303 commit 2a7cc3e
Show file tree
Hide file tree
Showing 4 changed files with 430 additions and 7 deletions.
8 changes: 8 additions & 0 deletions Hammer.sln
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,14 @@
Microsoft Visual Studio Solution File, Format Version 12.00
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Hammer", "Hammer\Hammer.csproj", "{E7AA6942-4B97-4AEE-884D-12BF1FA06BA7}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{AE4B08D1-7556-49F8-8D77-BE25A8663BB1}"
ProjectSection(SolutionItems) = preProject
CONTRIBUTING.md = CONTRIBUTING.md
LICENSE.md = LICENSE.md
README.md = README.md
USAGE.md = USAGE.md
EndProjectSection
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Expand Down
5 changes: 5 additions & 0 deletions Hammer/Services/DiscordLogService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,12 @@ public async Task LogAsync(DiscordGuild guild, DiscordEmbed embed,
ArgumentNullException.ThrowIfNull(embed);

if (_logChannels.TryGetValue(guild, out DiscordChannel? logChannel))
{
if (embed.Timestamp is null)
embed = new DiscordEmbedBuilder(embed).WithTimestamp(DateTimeOffset.UtcNow);

await logChannel.SendMessageAsync(BuildMentionString(guild, notificationOptions), embed: embed).ConfigureAwait(false);
}
}

/// <summary>
Expand Down
70 changes: 63 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,15 +10,71 @@
## About
Hammer is a Discord bot which provides features to issue infractions to misbehaving users.

## Features
### Notes
Leave staff-only notes on users so that staff can keep shared notes on users without informing the user of the action.
## Installing and configuring Hammer
Hammer runs in a Docker container, and there is a [docker-compose.yaml](docker-compose.yaml) file which simplifies this process.

### Warnings
Issue an infraction against a user by providing them with a warning about their behaviour.
### Clone the repository
To start off, clone the repository into your desired directory:
```bash
git clone https://github.com/BrackeysBot/Hammer.git
```

### Tracking
Is a certain user spamming or being offensive, but deleting the evidence? Start tracking them. For a specified amount of time (or indefinitely), their actions will be logged (including message edits, message deletions, nickname changes).
### Setting up for Docker compose
Two directories are required to exist for Docker compose to mount as container volumes.
```bash
mkdir data
mkdir logs
```
Copy the example `config.example.json` to `data/config.json`, and assign the necessary config keys. Below is breakdown of the config.json layout:
```json
{
"GUILD_ID": {
"logChannel": /* The ID of the log channel */,
"primaryColor": /* The primary branding colour, as a 24-bit RGB integer. Defaults to #7837FF */,
"secondaryColor": /* The secondary branding colour, as a 24-bit RGB integer. Defaults to #E33C6C */,
"tertiaryColor": /* The tertiary branding colour, as a 24-bit RGB integer. Defaults to #FFE056 */,
"urgentReportThreshold": /* How many message reports until the bot uses @ everyone instead of @ here. Defaults to 5 */,
"mute": {
"gagDuration": /* The duration of a gag, in milliseconds. Defaults to 5 minutes */,
"maxModeratorMuteDuration": /* The maximum duration that a Moderator is allowed to mute, in milliseconds. Defaults to 14 days */
},
"reactions": {
"deleteMessageReaction": /* The fallback reaction to delete messages, in Discord format. Defautls to 🗑️ (:wastebasket:) */,
"gagReaction": /* The fallback reaction to gag users, in Discord format. Defautls to 🔇 (:mute:) */,
"historyReaction": /* The fallback reaction to view infraction history, in Discord format. Defautls to 🕓 (:clock4:) */,
"reportReaction": /* The fallback reaction to report messages, in Discord format. Defautls to 🚩 (:triangular_flag_on_post:) */
},
"roles": {
"administratorRoleId": /* The ID of the Admin role */,
"guruRoleId": /* The ID of the Guru role */,
"moderatorRoleId": /* The ID of the Mod role */,
"mutedRoleId": /* The ID of the muted role */
}
}
}
```
The `logs` directory is used to store logs in a format similar to that of a Minecraft server. `latest.log` will contain the log for the current day and current execution. All past logs are archived.

The `data` directory is used to store persistent state of the bot, such as config values and the infraction database.

### Launch Hammer
To launch Hammer, simply run the following commands:
```bash
sudo docker-compose build
sudo docker-compose up --detach
```

## Updating Hammer
To update Hammer, simply pull the latest changes from the repo and restart the container:
```bash
git pull
sudo docker-compose stop
sudo docker-compose build
sudo docker-compose up --detach
```

## Using Hammer
For further usage breakdown and explanation of commands, see [USAGE.md](USAGE.md).

## License
This bot is under the [MIT License](LICENSE.md).
Expand Down
Loading

0 comments on commit 2a7cc3e

Please sign in to comment.