Verification System #32

Open
opened 2024-10-31 16:01:34 -04:00 by cswimr · 3 comments
Owner

What cog is your feature request for?

Pterodactyl

Currently, Minecraft server plugins like DiscordSRV allow for server administrators to require players to verify with their Discord accounts inside of a Discord server. My Pterodactyl cog doesn't currently have a system like this, and it seems pretty trivial to add.

Describe the solution you'd like

Here's a mermaid diagram explaining my plans for this system.

flowchart TD
    A[Pterodactyl cog detects player joining the game server] --> B{Is the cog configured to require verification to join the game server?}

    B -- No --> H
    B -- Yes --> C{Player linked to Discord account?}
    
    C -- No --> D[Kick player from game server<br>Send Discord invite, expiring verification code, and instructions on how to verify]
    C -- Yes --> E{Is the cog configured to require players to be in a specific Discord server?}

    E -- No --> H
    E -- Yes --> F{Is player still in the required Discord server?}
    
    F -- No --> G[Kick player from game server<br>Send Discord invite]
    F -- Yes --> H[Allow player to join game server]

And for the actual verification system itself:

flowchart TD
    A["Player runs the '[p]pterodactyl verify' command."] --> B{Is verification enabled?}

    B -- No --> C[Show an error message]
    B -- Yes --> D{Is the Player already verified to another account?}

    D -- Yes --> C
    D -- No --> E{Is the verification code provided by the Player valid and unexpired?}

    E -- No --> C
    E -- Yes --> F[Save the UUID of the Player and their Discord ID in Config]

Describe alternatives you've considered

No response

Screenshots

No response

Additional context

No response

### What cog is your feature request for? Pterodactyl ### Is your feature request related to a problem? Please describe. Currently, Minecraft server plugins like DiscordSRV allow for server administrators to require players to verify with their Discord accounts inside of a Discord server. My Pterodactyl cog doesn't currently have a system like this, and it seems pretty trivial to add. ### Describe the solution you'd like Here's a mermaid diagram explaining my plans for this system. ```mermaid flowchart TD A[Pterodactyl cog detects player joining the game server] --> B{Is the cog configured to require verification to join the game server?} B -- No --> H B -- Yes --> C{Player linked to Discord account?} C -- No --> D[Kick player from game server<br>Send Discord invite, expiring verification code, and instructions on how to verify] C -- Yes --> E{Is the cog configured to require players to be in a specific Discord server?} E -- No --> H E -- Yes --> F{Is player still in the required Discord server?} F -- No --> G[Kick player from game server<br>Send Discord invite] F -- Yes --> H[Allow player to join game server] ``` And for the actual verification system itself: ```mermaid flowchart TD A["Player runs the '[p]pterodactyl verify' command."] --> B{Is verification enabled?} B -- No --> C[Show an error message] B -- Yes --> D{Is the Player already verified to another account?} D -- Yes --> C D -- No --> E{Is the verification code provided by the Player valid and unexpired?} E -- No --> C E -- Yes --> F[Save the UUID of the Player and their Discord ID in Config] ``` ### Describe alternatives you've considered _No response_ ### Screenshots _No response_ ### Additional context _No response_
cswimr added the
enhancement
label 2024-10-31 16:01:34 -04:00
cswimr self-assigned this 2024-10-31 16:01:34 -04:00

So just my notes from the conversation we had from discord:

to make running commands on users in game (ie for automation purposes) storing all the info in a database on the bot seems like the best way to go, and then if possible having them be able to be used as a variable.

Example: User buys an apple from reds bot shop, which runs the command pterodactyl command give $USER apple 1 so we don't have to have staff get involved on every transaction a user goes through.

I'm unsure how to implement this so that it works with other cogs though.

So just my notes from the conversation we had from discord: to make running commands on users in game (ie for automation purposes) storing all the info in a database on the bot seems like the best way to go, and then if possible having them be able to be used as a variable. Example: User buys an apple from reds bot shop, which runs the command `pterodactyl command give $USER apple 1` so we don't have to have staff get involved on every transaction a user goes through. I'm unsure how to implement this so that it works with other cogs though.
Author
Owner

(Assume unless explicitly stated otherwise that any mentions of "Pterodactyl" are referring to my Pterodactyl cog, and not the Pterodactyl Panel.)

to make running commands on users in game (ie for automation purposes) storing all the info in a database on the bot seems like the best way to go

Okay so, I would already be using Red's config to store all of this data. Basically a json database included with Red that any other cog can access. I could use a Sqlite3 database for it, like my Aurora cog does, but I don't think it's necessary tbh. Fault tolerance and stuff is nice yeah but it's just storing verification status, so not really a big deal imo.

and then if possible having them be able to be used as a variable.

Yeah, this is easy. Pterodactyl already has a basic placeholder system that it uses for chat commands and topics, and I can reuse that for this. If .$U is present in the command, it can substitute that placeholder for a user id provided by an optional argument before the actual command. I don't think that'd be too hard to implement.

I'm unsure how to implement this so that it works with other cogs though.

If the shop/economy cog you're using supports running arbitrary commands on purchase, this solution will work fine. Otherwise, you should contact the maintainer of the cog you're using and ask for that feature.

***(Assume unless explicitly stated otherwise that any mentions of "Pterodactyl" are referring to my Pterodactyl cog, and not the Pterodactyl Panel.)*** > to make running commands on users in game (ie for automation purposes) storing all the info in a database on the bot seems like the best way to go Okay so, I would already be using Red's config to store all of this data. Basically a json database included with Red that any other cog can access. I *could* use a Sqlite3 database for it, like my Aurora cog does, but I don't think it's necessary tbh. Fault tolerance and stuff is nice yeah but it's just storing verification status, so not really a big deal imo. > and then if possible having them be able to be used as a variable. Yeah, this is easy. Pterodactyl already has a basic placeholder system that it uses for chat commands and topics, and I can reuse that for this. If `.$U` is present in the command, it can substitute that placeholder for a user id provided by an optional argument before the actual command. I don't think that'd be too hard to implement. > I'm unsure how to implement this so that it works with other cogs though. If the shop/economy cog you're using supports running arbitrary commands on purchase, this solution will work fine. Otherwise, you should contact the maintainer of the cog you're using and ask for that feature.
Author
Owner

Additionally, I think dynamic commands like you're talking about are a bit out of scope of this issue, so I'll be creating a new issue to handle those, as well as one for handling role syncing which you also brought up in our Discord conversation.

Edit: Created, see #34

Additionally, I think dynamic commands like you're talking about are a bit out of scope of this issue, so I'll be creating a new issue to handle those, as well as one for handling role syncing which you also brought up in our Discord conversation. Edit: Created, see #34
cswimr added this to the Pterodactyl V3 milestone 2024-10-31 19:22:54 -04:00
cswimr changed title from [Pterodactyl] Verification System to Verification System 2024-10-31 22:02:41 -04:00
cswimr added the
cog
Pterodactyl
label 2024-10-31 22:02:45 -04:00
cswimr changed reference from master to pterodactyl-v3 2024-10-31 22:15:53 -04:00
cswimr added a new dependency 2024-11-01 11:26:01 -04:00
cswimr added a new dependency 2024-11-01 12:38:12 -04:00
Sign in to join this conversation.
No description provided.