Skip to content

yellow-corps/ibis

Repository files navigation

ibis

A discord bot for the yellow corps

Features

Requirments

  • Git
  • Docker
  • A Discord App/Bot Token
    • Adding a Bot to a Discord server is not covered in these instructions.
    • See Red-DiscordBot Documentation.
  • (Optional) A Shopify App Client ID and Client Secret
    • Best practice is to create an app specifically for the Shopify shop being connected.
    • See Shopify Custom Apps Documentation.
    • For the scopes, select read_orders.
  • (Required for Shopify) Node.js
  • (Required for Shopify) An Ngrok Authtoken and Domain
    • You must use a static domain with Ngrok for this to all work.
    • As of 04/08/2024, Ngrok allows you to allocate one random static domain to your account.

Installation

1. Clone the Repo

git clone https://github.com/yellow-corps/ibis
cd ibis
git submodule update --init

2. Setup Environment

Copy the .env.example file to .env and fill out the variables within.

2a. (Optional) Deploy Shopify

(cd shopify && npm install && npm run deploy)

This will configure your app on Shopify correctly with the correct Webhooks.

3. Run Containers

docker compose up -d

This will do the following:

  • Create a volume ibis_discord-data.
    • This is where any settings on the bot will be stored. If you want to migrate the bot and keep any settings, one way would be to migrate this volume in particular to the new location.
  • Create a discord container that primary runs the bot.
  • If Shopify is configured, shopify and ngrok containers will also be created.
    • shopify is responsible for relaying the Shopify HTTP Webhooks to Discord via JSON RPC calls.
    • ngrok is responsible for providing ingress from the outside world to the shopify container for the Shopify HTTP Webhooks, without needing to punch holes in firewalls.
  • If the exporter for SOS Tickets is configured, an exporter container will also be created.

Configuration

Note

Replace any instance of [@] below with a mention of the bot.

For example, if the bot is named Ibis, replace [@] with @Ibis.

1. Limit Who Can Use The Bot

1a. localallowlist

Add one or more people to the local allowlist for the bot, including yourself.

This should prevent users not on the list from interacting with the bot at all.

[@] localallowlist add [@<User>/"User"/"Role"]
[@] localallowlist remove [@<User>/"User"/"Role"]
[@] localallowlist list
[@] localallowlist clear

Example

[@] localallowlist add @SpiltCoffee "Knocked Over Mocha" "Bot Commander Role"

1b. set roles addadminrole

This allows some commands marked as @commands.admin() to be used by users in the server.

[@] set roles addadminrole [@<User>/User/Role]
[@] set roles removeadminrole [@<User>/User/Role]

Example

[@] set roles addadminrole @SpiltCoffee
[@] set roles addadminrole Knocked Over Mocha
[@] set roles addadminrole Bot Commander Role

Note

Unlike with localallowlist, you can only provide one user or role at a time to addadminrole, and you do not quote anything.

2. Configure the Audit Channel

Tell the bot which channel to post audit messages to, and log all events.

[@] modlogset modlog #<Channel>
[@] modlog all true

Example

[@] modlogset modlog #audit
[@] modlog all true

3. Configure Message Relays

Tell the bot which channels to relay to other channels.

[@] msgrelay add #<Source Channel> #<Target Channel>

Important

Make sure to answer the two followup questions it asks. Responding "Yes" to both is fine, if you're not otherwise sure.

Note

If the bot does not have write permissions in the #<Source Channel>, it will warn that "some permissions may be missing" after running the relay command.

This is because the bot attempts, one time only, to send a test message to the source channel. It is safe to ignore the warning in this scenario.

Example

[@] msgrelay add #source #target

3a. Turn Off Relay Timer

Turn off the relay timer by seting it to 0.

Doing this prevents the message relay from deleting messages in the relay channel when the source message is deleted.

[@] msgrelay settimer 0

4. Purge messages when necessary

Use one of the following methods to cleanup messages using the bot.

[@] cleanup messages #<Number of messages>

An alias exists to cleanup 1000 messages at a time.

[@] purge

Note

Just keep in mind you will also need to say "Yes" when cleaning up/purging more than 99 messages at a time.

5. Configure Shopify

5a. Set Shop channel

[@] shopify channel #<Shop Channel>

Example

[@] shopify channel #shop

5b. Set Shop Messages

You can customise the messages that are shown for each status change of an order.

The statuses are created, updated, fulfilled, and cancelled

The Order Name (e.g. "Order #1234") is represented in the message as {}.

[@] shopify message <status> <message>

Example

[@] shopify message created Your {} has been created!

This would appear as...

Your Order #1234 has been created!

5c. Set Staff Users

Staff Users will always be added to threads created by the bot.

[@] shopify staff add @<Staff>
[@] shopify staff remove @<Staff>

Example

[@] shopify staff add @Frontdesk

6. Configure SOS Tickets

Allows users to create emergency tickets using text channels.

It's rather involved, so you may want to explore how to best configure it for your needs. At a high level, you'll likely want to run these commands:

[@] sostickets channel "<name>"
[@] sostickets category active "<active category>"
[@] sostickets category archive "<archive category>"
[@] sostickets export set #<export channel>
[@] sostickets export auto_prune True
[@] sostickets responders add @<Responders>
[@] sostickets enable

7. Create Unique Invites

You can create unique, single use, non-expiring invites using the bot.

[@] uniqueinvites create <channel> <amount>

Example

[@] uniqueinvites create #announcements 500

Important

Discord allows for a maximum of 999 unique invites per server at a time.

See Discord Account Caps, Server Caps, and More

Note

Due to rate limits, the bot will take it's time to create the invites. Each invite takes about 2s to create.

Once the bot is finished making invites, or if it experiences an error along the way, it will output the created invites in response to your command, as to notify you that it is finished.

If you want to cancel an ongoing invite creation process, see [@] uniqueinvites stop.

8. Persist messages for auditing

The configuration of modlog above will log any messages deleted or edited, but only if the bot still has the message cached in memory. The memory cache is limited to a number of messages, and will be cleared if when the bot is restarted.

We can persist messages to disk so that they can be looked up at any time, including after restarts.

[@] persistmessages set true

Cog Instructions

About

A discord bot for the yellow corps

Resources

License

Code of conduct

Stars

Watchers

Forks

Packages

 
 
 

Contributors