Skip to content
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

Embed and role management #4

Merged
merged 12 commits into from
Dec 27, 2024
13 changes: 13 additions & 0 deletions Writerside/dhub.tree
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,23 @@
<toc-element topic="Commands.md">
<toc-element topic="calc-price.topic"/>
<toc-element topic="config.topic"/>
<toc-element topic="embed.topic">
<toc-element topic="embed-add.topic"/>
<toc-element topic="embed-edit.topic"/>
<toc-element topic="embed-get.topic"/>
<toc-element topic="embed-send.topic"/>
</toc-element>
<toc-element topic="leaderboard.topic"/>
<toc-element topic="manage-score.topic">
<toc-element topic="manage-score-add.topic"/>
<toc-element topic="manage-score-remove.topic"/>
<toc-element topic="manage-score-reset.topic"/>
</toc-element>
<toc-element topic="role.topic">
<toc-element topic="role-requirements.topic">
<toc-element topic="role-requirements-add.topic"/>
</toc-element>
</toc-element>
<toc-element topic="warn.topic">
<toc-element topic="warn-add.topic"/>
<toc-element topic="warn-add-evidence.topic"/>
Expand All @@ -38,7 +49,9 @@
<toc-element topic="Carry-Type.md"/>
<toc-element topic="Carry-Tier.md"/>
<toc-element topic="Carry-Difficulty.md"/>
<toc-element topic="Role-Action.md"/>
<toc-element topic="Role-Group.md"/>
<toc-element topic="Role-Requirement-Type.md"/>
<toc-element topic="Score-Type.md"/>
<toc-element topic="Warning-Action.md"/>
<toc-element topic="Warning-Punishment.md"/>
Expand Down
Binary file added Writerside/images/role-groups-dh-carriers.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added Writerside/images/role-groups-dh-staff.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added Writerside/images/role-groups.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
115 changes: 114 additions & 1 deletion Writerside/topics/Embed-Management.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,116 @@
# Embed Management ✏️

`Coming soon`
The Dungeon Hub Bot contains an advanced feature to read message data from embeds, send new embeds and also edit them
afterward.
This feature fully supports adding multiple embeds onto one message, which is supported by discord.
This feature is mainly enabled through the command [](embed.topic).

## Embed Format

Most sub-commands of [](embed.topic) expect the embed-data to be passed as a json-string.
This can either contain one object, or a json array of multiple objects.
You can get an example of the format that is used by running the command [](embed-get.topic) and supplying the message
link of a message with an embed. \
The format that is expected in those arguments looks like this:

```json
{
"title": "title",
"description": "description",
"url": "url for title",
"timestamp": "timestamp in epoch milliseconds",
"color": "color in hex format, with leading #",
"image": "example image url",
"footer": {
"text": "footer text",
"icon": "icon url"
},
"thumbnail": {
"url": "thumbnail url"
},
"author": {
"name": "author name",
"url": "author url",
"icon": "author icon url"
},
"fields": [
{
"name": "field name",
"value": "field value",
"inline": "boolean, if the field should be inline"
}
]
}
```
{collapsible="true" default-state="expanded" collapsed-title="Format"}

```json
{
"title": "Example Embed",
"description": "Example embed, just to try it out",
"url": "https://example.com/",
"timestamp": 1732920448245,
"color": "#A51770",
"image": "https://static.dungeon-hub.net/blaze.png",
"footer": {
"text": "footer text",
"icon": "https://static.dungeon-hub.net/favicon.gif"
},
"thumbnail": {
"url": "https://static.dungeon-hub.net/enderman.png"
},
"author": {
"name": "author name",
"url": "https://example.com/",
"icon": "https://static.dungeon-hub.net/livid.png"
},
"fields": [
{
"name": "field name",
"value": "field value",
"inline": true
},
{
"name": "field name 2",
"value": "field value 2",
"inline": false
}
]
}
```
{collapsible="true" default-state="collapsed" collapsed-title="Example Embed"}

### URL format

Some fields in the embed can contain a URL. This URL is often a link to an image that should be used, but it can reference any possible url.
These fields are checked before the embed is sent, and if any of the URLs are not valid, an error will be shown.
The URL must contain a valid protocol, meaning it must start with e.g. `http://` or `https://`.

### Message Link

The message link is a link to a message in discord, which can be obtained by right-clicking on a message and selecting `Copy Message Link`.
This link is used to identify the message that should be edited or read from.
```regex
(?x) # enable comment mode
(?i) # ignore case
(?:https?+://)?+ # 'https://' or 'http://' or ''
(?:(?:canary|ptb)\\.)?+ # 'canary.' or 'ptb.'
discord(?:app)?+\\.com/channels/ # 'discord(app).com/channels/'
(?:(?<server>[0-9]++)|@me) # '@me' or the server id as named group
/ # '/'
(?<channel>[0-9]++) # the textchannel id as named group
/ # '/'
(?<message>[0-9]++) # the message id as named group
```
{collapsible="true" default-state="collapsed" collapsed-title="Message Link Regex"}

### Timestamp

The `timestamp` field is a unix timestamp in milliseconds. This is used to display a timestamp in the embed. \
You can convert a date to a timestamp and vice versa by using websites like [this](https://www.epochconverter.com/). \
Please make sure that the timestamp is in milliseconds, as the bot will not convert it for you, resulting in incorrect dates being shown.

### Color

The `color` field is a hex color code, with a leading `#`. This color is used to color the left bar of the embed. \
You can use websites like [this](https://www.w3schools.com/colors/colors_picker.asp) or [this](https://www.color-hex.com/) to find a color you like.
17 changes: 17 additions & 0 deletions Writerside/topics/Role-Action.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# Role Action ✏️

Role actions describe which action should be taken for a given role, depending on if the server member is linked or not.
This is checked every time the users roles are synced.

## Possible values

- None
- Apply And Remove When Verified
- This applies the role when a user is verified and removes it when the user is unverified
- Apply And Remove When Unverified
- This applies the role when a user is unverified and removes it when the user is verified
- Apply When Verified
- Apply When Unverified
- Remove When Verified
- Remove When Unverified
- Apply Always
42 changes: 41 additions & 1 deletion Writerside/topics/Role-Management.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,43 @@
# Role Management ✏️

`Coming soon`
The Dungeon Hub Bot has multiple systems in place to aid with the assignment and management of roles. This guide will
cover the various commands and features available to you as a server administrator.

## Role Actions

It is possible to set roles to automatically be applied to users based on a certain criteria.
A list of all possible actions can be found [here](Role-Action.md#possible-values). \
The role actions for all roles are checked once a user's roles are synced.

## Role Requirements

Role requirements are used to define which requirements have to be met to receive a given role. \
These consist of a [requirement type](Role-Requirement-Type.md), a comparison, a count (that has to be met) and optionally some extra data.
A list of all possible requirement types can be found [here](Role-Requirement-Type.md#possible-values). \
A role requirement can be added for a role by using [](role-requirements-add.topic).
Multiple role requirements can be defined for a single role, in that case all requirements have to be met to receive the role. \
Role requirements are checked after the role actions have been processed, meaning that the role requirements can override the role actions.

## Role Groups

Role groups are a way to group roles together and apply them all at once. If the user has a specific role that has role
groups, those are given to the user as well. \
Role groups are applied after the role actions and role requirements have been processed. \
You can think of role groups similar to a tree structure:

### Structure

![](role-groups.png) { border-effect="rounded" }

You can also take a look at these two example use-cases:

### Examples { collapsible="true" }

![](role-groups-dh-carriers.png) { border-effect="rounded" }

This example ensures that all service team members have the general role `Service Team` and the carry-type specific roles, such as `Dungeon Carrier`. \
This ensures that permissions can be set up for all service team members, while also allowing for specific permissions for each carry type. It also allows to easily ping all service team members at once, as well as it gives an easier overview over
all service team members.

![](role-groups-dh-staff.png) { border-effect="rounded" }

33 changes: 33 additions & 0 deletions Writerside/topics/Role-Requirement-Type.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
# Role Requirement Type ✏️

Role requirements describe which requirement has to be met to receive a given role, depending on the server member's data and their linked accounts.
This is checked every time the users roles are synced.

## Possible values

- Skyblock Level
- Catacombs Level
- Farming Level
- Mining Level
- Combat Level
- Fishing Level
- Skill Average
- Highest Skill
- Current Score
- WIP, extra data is not implemented yet
- Alltime Score
- WIP, extra data is not implemented yet
- Total Carries
- WIP, not implemented yet
- Total Carries In Time Frame
- WIP, not implemented yet
- Money Spent
- Money Spent In Time Frame
- Extra data is [parsed](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin.time/-duration/-companion/parse.html)
as a [duration](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin.time/-duration/to-string.html)
- Hypixel Rank
- WIP, not implemented yet
- Guild Membership
- WIP, not implemented yet
- Guild Rank
- WIP, not implemented yet
22 changes: 13 additions & 9 deletions Writerside/topics/Server-Property.md
Original file line number Diff line number Diff line change
@@ -1,12 +1,16 @@
# Server Property ✏️
# Server Property

The server property is a way to store and manage server-specific settings that are used across multiple commands.
This includes settings like the moderation log channel, the strike log channel, the score management role, and more.

The settings can be changes using the sub-commands of [](config.topic). \
A list of all available server properties can be found below.
## Possible values

## String / Text
There are currently a set amount of possible server properties that can be set.
They can be managed using the sub-commands of [](config.topic), respective to the type of config property.

The following values can be set for the server property:

### String / Text {id="string"}

- `BAN_MESSAGE`: The message that is sent to a user when they are banned from the server. It can contain some
placeholders:
Expand All @@ -15,17 +19,17 @@ A list of all available server properties can be found below.
- `UNBAN_FORM`: The link to the unban form that is sent to a user when they are banned from the server. If it is
present, it will be attached to the message as a link button, so please make sure that it is in a proper link format.

## Number
### Number

`currently none`

## Boolean (true/false)
### Boolean (true/false) {id="boolean"}

- `PROFILE_MODERATION_BAN`: If set to `true`, the bot will automatically ban users that have a flagged profile, meaning
a suspicious username that might impersonate legitimate bots or users. Otherwise, only a log message is sent into the
`MODERATION_LOGS_CHANNEL`.

## Channel
### Channel

- `MODERATION_LOGS_CHANNEL`: The channel where moderation logs are sent to. This includes all messages about warnings
and messages when a user is flagged.
Expand All @@ -43,11 +47,11 @@ A list of all available server properties can be found below.
- `CNT_MESSAGES_CHANNEL`: `Coming soon`
- `CNT_INFORMATION_CHANNEL`: `Coming soon`

## Category
### Category

`currently none`

## Role
### Role

- `SCORE_MANAGEMENT_ROLE`: The score management role affect which users are allowed to manage the score of other users
using the [](manage-score.topic) command. If a user does not have this role, they are not allowed to manage the score
Expand Down
11 changes: 10 additions & 1 deletion Writerside/topics/Warnings.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ applied to the user.
> contact [the development team](mailto:[email protected])
> {style="warning"}

[Punishments](Warning-Punishment.md) aren't updated/lifted when a warning is [deactivated](warn-deactivate.topic) or
[Punishments](Warning-Punishment.md) aren't updated/lifted when a warning is [deactivated](#deactivation) or
updated by an [evidence being added](warn-add-evidence.topic).

When warnings are edited, either by them being created, when an evidence is added or when they are deactivated, the
Expand All @@ -36,3 +36,12 @@ The log channel depends on the [](Warning-Type.md):
If the [warning type](Warning-Type.md) is either `Serious`, `Major` or `Minor`, the message is sent into the channel of
the [server property `MODERATION_LOGS_CHANNEL`](Server-Property.md), otherwise it's sent into the
[`STRIKES_LOGS_CHANNEL`](Server-Property.md).

## Deactivation

Warnings can be deactivated by using the command [](warn-deactivate.topic).
This will mean that the warning will no longer be shown in [](warns.topic) and will no longer have an
effect when [punishments](Warning-Punishment.md) are calculated.

> Currently, deactivated warnings can't be reactivated.
> {style="note"}
9 changes: 9 additions & 0 deletions Writerside/topics/embed-add.topic
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE topic
SYSTEM "https://resources.jetbrains.com/writerside/1.0/xhtml-entities.dtd">
<topic xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="https://resources.jetbrains.com/writerside/1.0/topic.v2.xsd"
title="/embed add ✏️" id="embed-add">

<code>Coming soon</code>
</topic>
9 changes: 9 additions & 0 deletions Writerside/topics/embed-edit.topic
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE topic
SYSTEM "https://resources.jetbrains.com/writerside/1.0/xhtml-entities.dtd">
<topic xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="https://resources.jetbrains.com/writerside/1.0/topic.v2.xsd"
title="/embed edit ✏️" id="embed-edit">

<code>Coming soon</code>
</topic>
9 changes: 9 additions & 0 deletions Writerside/topics/embed-get.topic
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE topic
SYSTEM "https://resources.jetbrains.com/writerside/1.0/xhtml-entities.dtd">
<topic xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="https://resources.jetbrains.com/writerside/1.0/topic.v2.xsd"
title="/embed get ✏️" id="embed-get">

<code>Coming soon</code>
</topic>
9 changes: 9 additions & 0 deletions Writerside/topics/embed-send.topic
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE topic
SYSTEM "https://resources.jetbrains.com/writerside/1.0/xhtml-entities.dtd">
<topic xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="https://resources.jetbrains.com/writerside/1.0/topic.v2.xsd"
title="/embed send ✏️" id="embed-send">

<code>Coming soon</code>
</topic>
Loading
Loading