A discord bot for the yellow corps
- Message Auditing (via Trusty-cogs/extendedmodlog)
- Message Relaying (via coffee-cogs/msgmover)
- Message Purging
- Shopify Orders
- SOS Tickets
- Unique Invite Creation
- Handle Change Requests
- 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.
git clone https://github.com/yellow-corps/ibis
cd ibis
git submodule update --initCopy the .env.example file to .env and fill out the variables within.
(cd shopify && npm install && npm run deploy)This will configure your app on Shopify correctly with the correct Webhooks.
docker compose up -dThis 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
discordcontainer that primary runs the bot. - If Shopify is configured,
shopifyandngrokcontainers will also be created.shopifyis responsible for relaying the Shopify HTTP Webhooks to Discord via JSON RPC calls.ngrokis responsible for providing ingress from the outside world to theshopifycontainer for the Shopify HTTP Webhooks, without needing to punch holes in firewalls.
- If the exporter for SOS Tickets is configured, an
exportercontainer will also be created.exporterprovides a small wrapper around the Tyrrrz/DiscordChatExporter project, for the bot to use with SOS Tickets.
Note
Replace any instance of [@] below with a mention of the bot.
For example, if the bot is named Ibis, replace [@] with @Ibis.
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"
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.
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
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
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
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.
[@] shopify channel #<Shop Channel>
Example
[@] shopify channel #shop
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!
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
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
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.
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.
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