discord_verifier

module
v0.0.0-...-de8f1eb Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 10, 2023 License: GPL-3.0

README

image

POST Request json example:

{
  "signature": "9ce8d820f543c5a68f214da51cdad84b",
  "username": "testuser",
  "role": "release"
}

Signature being generated by hashing in md5:

function GenerateSignature(username, role, secretKey)
    return md5(string.format("role%susername%s%s",
        role,
        username,
        secretKey
    ))    
end

Answer will be send also in JSON

{
  "success": true,
  "code": "40918d702d719255338e2c84b4cdde5f"
}

Admin Requests

List All Roles
curl --location 'http://localhost:40000/admin/listRoles' \
--header 'admin_key: 123456'
Create OR Edit roles
curl --location 'http://localhost:40000/admin/editRole' \
--header 'admin_key: 123456' \
--header 'Content-Type: application/json' \
--data '{
    "name": "role_name",
    "role":"1234567890"
}'
Delete Role
curl --location 'http://localhost:40000/admin/deleteRole' \
--header 'admin_key: 123456' \
--header 'Content-Type: application/json' \
--data '{
    "name": "role_name"
}'

Environment variables

  • SECRET
    • The secret key with which the signature will be generated can be any string
  • DISCORD_TOKEN
    • Discord bot token
  • DISCORD_GUILD
    • Discord server id
  • ADMIN_PASSWORD
    • Used as password to admin requests

Installation steps

  1. Install Docker

  2. Run docker run. Do not forget to change tokens and passwords.

docker run -p 40000:80 --name=Verifier --env=SECRET=random_secret_password --env=ADMIN_PASSWORD=123456 --env=DISCORD_GUILD=server_id --env=DISCORD_TOKEN=discord_token --mount source=Verifier,target=/app/data --restart=always -d elleqt/verifier:latest

REST is now started on port 40000 (if you not changed it) with /verify endpoint

curl --location 'http://localhost:40000/verify' \
--header 'Content-Type: application/json' \
--data '{
    "signature": "9ce8d820f543c5a68f214da51cdad84b",
    "username": "testuser",
    "role":"release"
}'

Get Role

Just use interaction /verify in any discord channel on ur server

image

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL