Fixing Discord shortcomings (for our internal server) with Chuckle

Overview

chuckle logo


Discord Server Test status Command deployment status Database migrations status

About

Chuckle is our in-house Discord bot for our internal company server. We weren't a huge fan of Slack and, most of our target demographic uses Discord.

A few of our favorite (and only :p) features include:

  • Circle Back, create reminders to revisit a specific message
  • PR Comments, stream PR reviews and updates to a configured thread
  • /hexil, allow each member to set a custom role/name color

Development

Requirements

These are some broad, general requirements for running Chuckle.

Setup

Before you can actually setup... we have some setup to do!

  1. Install cargo-make (cargo install --force cargo-make)

Cargo doesn't have a native "scripts" feature like Yarn or NPM. Thus, we use cargo-make and Makefile.toml.

2. Install pre-commit (pip install pre-commit)

We use this for running git hooks. This is handled by the next step.

  1. Run cargo make setup

This installs necessary components for other scripts and development fun.

Environment

If it weren't for sqlx and it's inability to play nice with direnv, we wouldn't also need an .env file containing just the DATABASE_URL.

  1. Install direnv.

It automatically loads our .direnv file.

  1. Copy .envrc.example to .envrc and fill with your environment variables.

  2. Ensure .env houses your DATABASE_URL address.

Database

We utilize sqlx's compile-time checked queries, which requires a database connection during development. Additionally, we use sqlx's migrations tool, which is just a treat!

  1. Start the database with docker compose up -d.

  2. Run sqlx migrate run

This applies our database migrations.

Running

Now, running the bot should be as easy as:

  1. cargo make dev

Contributing

When making changes to Chuckle, there are a few things you must take into consideration.

If you make any query changes, you must run cargo sqlx prepare to create an entry in .sqlx to support SQLX_OFFLINE. If you make any command/interaction data changes, you must run cargo make commands-lockfile to remake the commands.lock.json file.

Regardless, of what scope, you must always ensure Clippy, Rustfmt and cargo-check are satisified, as done with pre-commit hooks.

Production

We currently host Chuckle on our Google Kubernetes Engine cluster.

flowchart TD
    commands["
        Update Discord
        Commands
    "]
    test["
        Lint, Format
        and Build
    "]
    commit[Push to main] --> test
    commit ---> deploy[Deploy to GCR]
    commit -- "
        commands.lock.json
        updated?
    " ---> commands
    commit -- "
        migrations
        updated?
    " --> cloudsql[Connect to Cloud SQL]
    --> migrations[Apply Migrations]

Building Chuckle

todo, see our .github/workflows

Comments
  • fix(deps): update rust crate thiserror to 1.0.47

    fix(deps): update rust crate thiserror to 1.0.47

    Mend Renovate

    This PR contains the following updates:

    | Package | Type | Update | Change | |---|---|---|---| | thiserror | dependencies | patch | 1.0.46 -> 1.0.47 |


    Release Notes

    dtolnay/thiserror (thiserror)

    v1.0.47

    Compare Source


    Configuration

    ūüďÖ Schedule: Branch creation - "after 6pm" (UTC), Automerge - At any time (no schedule defined).

    ūüö¶ Automerge: Enabled.

    ‚ôĽ Rebasing: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox.

    ūüĒē Ignore: Close this PR and you won't be reminded about this update again.


    • [ ] If you want to rebase/retry this PR, check this box

    This PR has been generated by Mend Renovate. View repository job log here.

    dependencies 
    opened by renovate[bot] 0
  • fix(deps): update rust crate thiserror to 1.0.46

    fix(deps): update rust crate thiserror to 1.0.46

    Mend Renovate

    This PR contains the following updates:

    | Package | Type | Update | Change | |---|---|---|---| | thiserror | dependencies | patch | 1.0.44 -> 1.0.46 |


    Release Notes

    dtolnay/thiserror (thiserror)

    v1.0.46

    Compare Source

    v1.0.45

    Compare Source


    Configuration

    ūüďÖ Schedule: Branch creation - "after 6pm" (UTC), Automerge - At any time (no schedule defined).

    ūüö¶ Automerge: Enabled.

    ‚ôĽ Rebasing: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox.

    ūüĒē Ignore: Close this PR and you won't be reminded about this update again.


    • [ ] If you want to rebase/retry this PR, check this box

    This PR has been generated by Mend Renovate. View repository job log here.

    dependencies 
    opened by renovate[bot] 0
  • feat: breakout rooms

    feat: breakout rooms

    Please describe the changes this PR makes and why it should be merged: This PR:

    • introduces a new breakout rooms feature for our random 1 on 1 days

    Status and versioning classification:

    • Code changes have been tested, or there are no code changes
    • This PR updates Discord interaction metadata, and I updated the commands lockfile
    opened by carterhimmel 0
  • chore(deps): update rust crate redis to 0.23.2

    chore(deps): update rust crate redis to 0.23.2

    Mend Renovate

    This PR contains the following updates:

    | Package | Type | Update | Change | |---|---|---|---| | redis | workspace.dependencies | patch | 0.23.1 -> 0.23.2 |


    Release Notes

    redis-rs/redis-rs (redis)

    v0.23.2: v0.23.2

    Compare Source

    0.23.2 (2023-08-10)

    Fixes

    Configuration

    ūüďÖ Schedule: Branch creation - "after 6pm" (UTC), Automerge - At any time (no schedule defined).

    ūüö¶ Automerge: Enabled.

    ‚ôĽ Rebasing: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox.

    ūüĒē Ignore: Close this PR and you won't be reminded about this update again.


    • [ ] If you want to rebase/retry this PR, check this box

    This PR has been generated by Mend Renovate. View repository job log here.

    dependencies 
    opened by renovate[bot] 0
  • chore(deps): update rust crate redis to 0.23.1

    chore(deps): update rust crate redis to 0.23.1

    Mend Renovate

    This PR contains the following updates:

    | Package | Type | Update | Change | |---|---|---|---| | redis | workspace.dependencies | patch | 0.23.0 -> 0.23.1 |


    Release Notes

    redis-rs/redis-rs (redis)

    v0.23.1: v0.23.1

    Compare Source

    0.23.1 (2023-07-28)
    Features
    Changes

    Configuration

    ūüďÖ Schedule: Branch creation - "after 6pm" (UTC), Automerge - At any time (no schedule defined).

    ūüö¶ Automerge: Enabled.

    ‚ôĽ Rebasing: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox.

    ūüĒē Ignore: Close this PR and you won't be reminded about this update again.


    • [ ] If you want to rebase/retry this PR, check this box

    This PR has been generated by Mend Renovate. View repository job log here.

    dependencies 
    opened by renovate[bot] 0
  • fix(deps): update rust crate thiserror to 1.0.44

    fix(deps): update rust crate thiserror to 1.0.44

    Mend Renovate

    This PR contains the following updates:

    | Package | Type | Update | Change | |---|---|---|---| | thiserror | dependencies | patch | 1.0.43 -> 1.0.44 |


    Release Notes

    dtolnay/thiserror (thiserror)

    v1.0.44

    Compare Source

    • Documentation improvements

    Configuration

    ūüďÖ Schedule: Branch creation - "after 6pm" (UTC), Automerge - At any time (no schedule defined).

    ūüö¶ Automerge: Enabled.

    ‚ôĽ Rebasing: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox.

    ūüĒē Ignore: Close this PR and you won't be reminded about this update again.


    • [ ] If you want to rebase/retry this PR, check this box

    This PR has been generated by Mend Renovate. View repository job log here.

    dependencies 
    opened by renovate[bot] 0
  • chore(deps): update rust crate sqlx to 0.7.1

    chore(deps): update rust crate sqlx to 0.7.1

    Mend Renovate

    This PR contains the following updates:

    | Package | Type | Update | Change | |---|---|---|---| | sqlx | workspace.dependencies | patch | 0.7.0 -> 0.7.1 |


    Release Notes

    launchbadge/sqlx (sqlx)

    v0.7.1

    Compare Source

    This release mainly addresses issues reported with the 0.7.0 release.

    16 pull requests were merged this release cycle.

    Added
    Changed
    Fixed

    Configuration

    ūüďÖ Schedule: Branch creation - "after 6pm" (UTC), Automerge - At any time (no schedule defined).

    ūüö¶ Automerge: Enabled.

    ‚ôĽ Rebasing: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox.

    ūüĒē Ignore: Close this PR and you won't be reminded about this update again.


    • [ ] If you want to rebase/retry this PR, check this box

    This PR has been generated by Mend Renovate. View repository job log here.

    dependencies 
    opened by renovate[bot] 0
  • Dependency Dashboard

    Dependency Dashboard

    This issue lists Renovate updates and detected dependencies. Read the Dependency Dashboard docs to learn more.

    This repository currently has no open or pending branches.

    Detected dependencies

    cargo
    Cargo.toml
    • anyhow 1
    • async-trait 0.1
    • axum 0.6
    • chrono 0.4
    • hex 0.4
    • once_cell 1
    • redis 0.23.2
    • reqwest 0.11
    • serde 1
    • serde_json 1
    • tokio 1
    • sqlx 0.7.1
    • time 0.3
    • tracing 0.1
    • twilight-cache-inmemory 0.15
    • twilight-gateway 0.15
    • twilight-http 0.15
    • twilight-model 0.15
    • twilight-util 0.15
    • uuid 1
    chuckle-gateway/Cargo.toml
    chuckle-github/Cargo.toml
    chuckle-http/Cargo.toml
    • ring 0.16
    • thiserror 1.0.47
    • tower 0.4
    • tower-http 0.4
    chuckle-interactions/Cargo.toml
    • ms 0.1.1
    chuckle-jobs/Cargo.toml
    • clokwerk 0.4
    chuckle-util/Cargo.toml
    • envy 0.4.2
    chuckle/Cargo.toml
    • tracing-subscriber 0.3
    docker-compose
    docker-compose.yml
    dockerfile
    chuckle/Dockerfile
    github-actions
    .github/workflows/cd.yml
    • actions/checkout v3
    • docker/setup-buildx-action v2
    • actions/cache v3
    • docker/login-action v2
    • docker/metadata-action v4
    • docker/build-push-action v4
    .github/workflows/commands.yml
    • actions/checkout v3
    .github/workflows/migrations.yml
    • actions/checkout v3
    • actions/cache v3
    • r7kamura/rust-problem-matchers v1
    • ahmadnassri/action-google-cloud-sql-proxy v1
    .github/workflows/test.yml
    • actions/checkout v3
    • actions/cache v3
    • r7kamura/rust-problem-matchers v1
    • docker/setup-buildx-action v2
    • actions/cache v3
    • docker/build-push-action v4

    • [ ] Check this box to trigger a request for Renovate to run again on this repository
    opened by renovate[bot] 0
Owner
Truffle
Building cool shit for creators.
Truffle
A Discord bot focused on addressing the inherent problems with Discord, to allow a more socialist/anarchist organization of servers.

ACABot A Discord bot focused on addressing the inherent problems with Discord, to allow a more socialist/anarchist organization of servers (or "guilds

null 4 May 3, 2022
This is a public snapshot of Fly's init code. It powers every Firecracker microvm we run for our users.

Fly Init This is a public snapshot of Fly's init code. It powers every Firecracker microvm we run for our users. It is Rust-based and we thought makin

fly.io 186 Dec 30, 2022
A realtime flight tracking program for our Software Engineering 300 class at ERAU

Flight Tracking ERAU SE300 Description Software that allows for weather and plane tracking to facilitate the user in looking at plane paths. Many peop

null 18 Sep 29, 2022
Source code and documentation for our 'full stack on rust' meetup on 29-9-2022

Full stack on Rust This is the code and documentation repository for our 'Full stack on Rust' meetup on 29-9-2022. It includes step-by-step documentat

Baseflow 7 Oct 23, 2022
A small in-house bot of the TTC Discord Server

Welcome to The Terminal cafe Support Bot Repository Hello, hope you are having a nice day. This is the official repository for The Terminal Cafe Suppo

null 5 Jul 4, 2022
A simple bot for discord.

Rusky Um simples bot para o discord! ?? Executando ‚ö†ÔłŹ Antes de tudo voc√™ precisa do Rust Instalado voc√™ pode instalar clicando aqui Preparando Primeir

Rusky 3 Aug 12, 2022
A lightweight Discord wrapper made in Tauri

Discord-Tauri is a work in progress lightweight wrapper for Discord.

null 104 Dec 20, 2022
A Discord bot for lichess and Rosen related things

liro Liro is a Discord bot that follows in the footsteps of Lichess-discord-bot, without necessarily aiming to replace it. The main pain point that th

Sebastian Lauwers 5 Feb 16, 2022
Hi I'm Sophy, a discord bot in devlopment, soon I'll be available to help everyone (‚ĚĀ¬ī‚ó°`‚ĚĀ)

Sophy Bot Hi I'm Sophy, a discord bot in devlopment, soon I'll be available to help everyone (‚ĚĀ¬ī‚ó°`‚ĚĀ) Contribution Do you like me and want to help me?

Far Dragi 0 May 30, 2022
A webhook-based Discord slash command library

Slashook A webhook-based Discord slash command library. This is a WIP project. Please note breaking changes can occur within minor releases until vers

Tonkku 11 Oct 18, 2022
Push BYCEPS ticket sale stats to Discord (as channel name)

Push BYCEPS Ticket Sale Stats to Discord A tool to fetch ticket sale stats for a specific LAN party from a BYCEPS installation and show that as the na

BYCEPS 1 Dec 28, 2021
A Discord bot for sending GeoGuessr challenge links that uses the GeoGuessr API written in rust.

GeoGuessr-bot-rs This is a simple implementation of a discord bot that send GeoGuessr-challenge links on demand. Features: Slash-commands Lightning-fa

Luukas Pörtfors 6 Nov 18, 2022
ūü¶īūü§Ė // A Discord bot about collecting all the Borpa

?? ?? Borpa Bot Borpa Bot is a Discord bot about collecting all the Borpa possible. If you dont know what a Borpa is you can find it here Crate Descri

mellowmarshe 1 Dec 19, 2021
twilight-interactions is a set of macros and utilities to work with Discord Interactions using twilight.

Twilight interactions twilight-interactions is a set of macros and utilities to work with Discord Interactions using twilight. Note: This crate is not

null 24 Dec 26, 2022
A scriptable discord bot (WIP)

Status This project is currently a VERY EARLY WORK IN PROGRESS. Contact me on discord for more details: Jonas747#0001 (105487308693757952) BotLoader (

null 26 Dec 21, 2022
ūü¶ú A hassle-free, highly performant, host it yourself Discord music bot built with Serenity in Rust. Powered by youtube-dl and Genius.

?? A hassle-free, highly performant and fast evolving Discord music bot built with Serenity in Rust. Deployment Usage Just create a bot account, copy

Miguel Mano 82 Dec 14, 2022
The best discord bot to annoy @a3mat

A3mat v pomoyke The best discord bot to annoy @a3mat Usage: This command moves pinged users n times: move <number> [users...] This command moves ping

null 1 Dec 31, 2021
A Discord bot to send updates on queries in tori.fi

torimies-rs How the bot works? The bot works by making requests to the undocumented (and very bad) tori.fi api endpoint. The users can add and remove

Luukas Pörtfors 19 Dec 29, 2022
A Discord bot for control and decentralization of threads management

Threadripper-bot A Discord bot for control and decentralization of threads management About Threadripper aims to serve some extra utilities to take be

S0ra 15 Dec 27, 2022