Skip to content

Magi3r/pin-bot

Repository files navigation

Pin-Bot

GitHub

A simple discord bot for allowing anyone to pin and unpin messages.

Discord only allows pinning and unpinning messages for roles having the Manage Messages permission, which also allows deleting any message.

This bot is probably more useful for private servers where you have a group of people, e.g. for studying together.

Features

  • Pin messages by messageID
  • Pin messages by message link
  • Unpin messages by messageID
  • Unpin messages by message link

Thats all this bot was invented for.

Installation

There are a couple of ways on how to run pin-bot:

  • Using one of the precompiled binaries from the releases page.
  • Using node with the precompiled .js files in js-src.zip from the releases page.
  npm install
  node .
  • Downloading the .ts-source (aka. cloning this repo) and compile them yourself.
    git clone https://github.com/Magi3r/pin-bot
    cd pin-bot
    npm install
    npx tsc
    cd ./dist/src
    node bot.js
  • You can also use ts-node to skip the compile step.
    git clone https://github.com/Magi3r/pin-bot
    cd pin-bot
    npm install
    npx ts-node

If you want to use the docker image, simply run:

docker run -d --name pin-bot --restart unless-stopped -e TOKEN=<your-token> magi3r/pin-bot:latest

If you prefer alpine because of the slightly smaller image size, run:

docker run -d --name pin-bot --restart unless-stopped -e TOKEN=<your-token> magi3r/pin-bot:alpine

Usage

You need to provide a discord bot token. You can get one from the developer portal by creating a new application. You can either provide it as:

  • an environmental variable
TOKEN=<your-token> node bot.js
  • saving it in a .env file. It will automatically be loaded
TOKEN=<your-token>
  • providing it as a command line argument. A token provided this way will be used instead of a token provided as environment variable.
node bot.js --token <your-token>

You also need to deploy the commands (although only once). This is done by running

node bot.js -u

You still need to provide a token for this and the bot will start automatically after this.