Skip to content

acmcsufoss/shorter

Folders and files

NameName
Last commit message
Last commit date

Latest commit

e4fb9b0 Β· Nov 1, 2024

History

44 Commits
Aug 9, 2023
Sep 30, 2023
Apr 13, 2024
Apr 16, 2024
Aug 9, 2023
Aug 9, 2023
Aug 9, 2023
Apr 16, 2024
Apr 16, 2024
Apr 16, 2024
Apr 16, 2024
Jun 22, 2024
Nov 1, 2024

Repository files navigation

shorter

πŸ”— Discord slash command URL shortener.

Development

Run the server

NOTE

Be sure to set the environment variables before running the server.

Be sure to install Deno before running the server.

You will need to use two terminal windows; one for the HTTP server and one for Ngrok.

Terminal 1

To run the server, run the following command:

deno task start

Terminal 2

NOTE You will need to have Ngrok installed and in your path.

deno task ngrok

In Terminal 2, copy the URL that is generated under Forwarding.

  • The URL should look similar to this: https://ab01-23-456-78-910.ngrok-free.app

Set this new URL as the Interactions Endpoint URL in the General tab of your Discord application. Find your application here.

Deploy

This server is deployed on Deno Deploy. To deploy, set the entrypoint file to main.ts and set the environment variables in the Deno Deploy dashboard.

Slash command usage

To understand the usage of the slash command, refer to the source code in bot/app/app.ts.

Discord Application Command setup

  1. Create a Discord application.
  2. Create a bot for the application.
  3. Copy the bot token and set it as the DISCORD_TOKEN environment variable.
  4. Copy the public key and set it as the DISCORD_PUBLIC_KEY environment variable.
  5. Copy the client ID and set it as the DISCORD_CLIENT_ID environment variable.
  6. Spin up the server. Set the Discord interactions endpoint URL to the URL of the server (Ngrok or Deno Deploy).

Environment variables

Refer to .env.example for a list of environment variables that need to be set.

DISCORD_PUBLIC_KEY

The public key of the Discord application. This is used to verify that the request is coming from Discord.

DISCORD_CLIENT_ID

The client ID of the Discord application. This is used to generate the OAuth2 URL.

DISCORD_TOKEN

The bot token of the Discord application.

DISCORD_ROLE_ID

The ID of the role that is allowed to use the slash command. Board members are intended to use this command.

GITHUB_TOKEN

The GitHub personal access token. This is used to access the GitHub API via Codemod.

PORT

Not required. The port that the server will listen on.


Programmed with ❀️ by @acmcsufoss.