A small in-house bot of the TTC Discord Server

Overview

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 Support bot. It was created the to manage the support questions in an automated and organized way.

Technologies used

While creating this bot we tried to use efficient and modern technologies . We based the main logic on Rust and the main database is handled by PostgreSQL.

The rust libraries in use are listed here:

  • serenity-rs: The main discord bot library.
  • sqlx: A library for accessing the sql database.
  • tokio: A fast asynchronous runtime.
  • serde: Data serialization and deserialization for the config file.
  • serde_yaml: Serde implementation for YAML.
  • clap: Launch argument parsing.
  • regex: Regex for input sanitazion.
  • chrono: Timestamps for the database.
  • dotenv: .env file reading for easier environment variables during compile time.

Running

The bot requires a postgresql database with a table based on the schema in sql/ttc-bot.sql to function, as well as a YAML config file with the following format:

---
  token: <The bot token you wish to use>
  sqlx_config: <A string for sqlx to connect to the database, postgres://username:password@host:port/database_name>
  support_channel: <Discord channel id for the support channel>
  owners: <Array of owner user ids, [<user_id>, <user_id>...]>

You need to set the DATABASE_URL variable in .env to the same value as sqlx_config in the config file to allow for compile time checking of database calls. Running is done with cargo run -- -c <path/to/config/file>.

Dependencies

If you want to install TTC support bot in your own system these following dependencies are required

  • Latest rust toolchain is preferable
  • PostgreSQL database

Contribute

If you want to contribute to our project feel free to do it 😃 . To start you can make a fork of our project, if you fork our project we request you to change the name of your forked one to minimize confusion. If you want to join our team and contribute to the main project feel free to join our Discord server The Terminal Cafe, we would love to see you there.

Naming conversion

If you work on the project please follow the naming conversion to minimize confusion. Use self explanatory class and function names, also try to comment out your code.

Example:

// This line prints the inc_id read from the DB
println!("{}", inc_id);

Please don't add anything offensive or political into the code base don't make it uncomfortable for others.

Credits

If you like our project and want to make a fork of it please add credits to the main repository.

Data collection

This bot only stores the following data when you create a support ticket.

userID - to manage the incident creator
timestamp - to find out when the incident is created 
threadID - to store the conversertation thread for future referances 
questions - to store the question for better searching ability

Contributors

Thanks to these people we are able to develop this project 😉 😉

Kiro Lead Rust dev
Ereshkigal SQL and logic

Thanks for using out software. See you in the discord server.

Made with 💛 and code

Discord TheTerminalCafe

Comments
  • Create a ttc!ttc command (easter egg)

    Create a ttc!ttc command (easter egg)

    TTC stands also for something else. Something to do with subways and buses. It won't be shown in the help menu. But I thought adding this hidden command to the bot would be something interesting!

    opened by Glitched519 2
  • Dynamic settings

    Dynamic settings

    Rather than settings options being set in a config.yaml file, we should implement a setting system where settings are stored in a DB. This allows us to dynamically change specific options (channel blacklists, welcome messages, etc) from within discord, rather than needing to log into the server and edit the config file.

    enhancement 
    opened by Stargirl-chan 2
  • Add translation via contextmenu and check for bee

    Add translation via contextmenu and check for bee

    This PR (finally) adds the contextmenu option to translate and also adds the same check for beeified users that the normal translation command has too

    opened by UltimateNyn 1
  • Got rid of xtask, added idban, removed/updated vulnerable dependencies, general cleanup

    Got rid of xtask, added idban, removed/updated vulnerable dependencies, general cleanup

    Xtask was no longer needed, as the cross freebsd images have been updated to be suitable for cross compiling this project. With this I cleaned up the folder structure to get rid of the annoying workspace thing with the two projects. The command idban allows for banning of a member that is no longer a member of the server.

    opened by Kirottu 1
  • Fixed a couple of bugs

    Fixed a couple of bugs

    Fixed the bug of ttc-bot never giving up on a support thread even though it should after 3 retries. Also made user getting in the logging a warning instead of an error due to error flooding caused by webhooks and stuff.

    opened by Kirottu 1
  • Dynamic Settings & Much More

    Dynamic Settings & Much More

    This PR includes new dynamic settings, which can be initially set from the config.yaml file with the -w command line argument. A ban command is also implemented now. This also fixes the regression that caused the bot to still think you are making a support ticket.

    opened by Kirottu 1
  • added release profile

    added release profile

    lto will enable link time optimization across all crates

    codegen-units enables the compiler to optimize better across chunks (this sets it so that 1 crate = 1 chunk), by default it tries to split crates into as many chunks as possible to compile them in parallel, while it might speed up compile time, it sure limits the possible optimizations taking place.

    opened by Stargirl-chan 1
  • Translation improvements

    Translation improvements

    This includes 3 changes:

    1. When translating the Embed will now use the full language name instead of the language code (changing de -> English to German -> English)
    2. The translate_text just returns a tuple with 2 Strings and takes lang as String. Now it's more documented and it's clear that it takes the target language as argument
    3. When translating into Beemovie the source language is now Human
    opened by UltimateNyn 0
  • Add Emojis as Option in userinfo

    Add Emojis as Option in userinfo

    This adds the Option to also show Emoji stats in the userinfo commands. Before it gets merged the following things should be improved:

    • [x] sort the Emojis by count
    • [x] format the Emojis in a better way
    opened by UltimateNyn 0
  • New Database + Macro

    New Database + Macro

    This code uses the new Database + adds functions to get the config from the DB instead of using a raw struct. Also the repetitive

    match foo {
        Ok(val) => val,
        Err(why) => {
            log::error!("error [...]: {}", why);
            return;
        },
    }
    

    was replaced with a macro (ttc_unwrap). Please note that this should be tested a bit more before getting merged.

    Other changes:

    • removed create_webhooks
    • remove -w argument for now

    For a detailed list look in the commit history

    opened by UltimateNyn 0
  • Emoji caching

    Emoji caching

    We now store for every user on the server for every emoji the count and the general message count of that user. Users and Emojis that aren't on the Server anymore will be purged from the DB during the next run. To simplify future usage of the Cache there is the according struct EmojiCache from which you can get CacheData as result. To get the data in a special form use/add a method from/to the impl CacheData.

    Closes #29

    opened by UltimateNyn 0
Owner
null
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
Rewrite of the Discord Bot used for Managing the Infinity Bot List Servers.

Arcadia Rewrite of the Discord Bot used for Managing the Infinity Bot List Servers. Contributing Always run fmt.sh before making a Pull Request! MacOS

InfinityBotList 3 Dec 15, 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 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 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
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
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

Testausserveri ry 19 Dec 29, 2022
A discord bot that safely executes whatever rust you throw at it. Remote code execution as a service

RustBot Bot is still under development and not ready for production use RustBot is a discord bot that executes whatever rust code you throw at it. In

Conner Bradley 7 Jan 3, 2022
An experimental Discord bot using Serenity.

VoidBot An experimental Discord bot using Serenity. Environment Variables Can be set with a .env file. DISCORD_TOKEN: The token for your bot. (require

null 1 May 21, 2022
Yet another multi-purpose discord bot

virus yet another multi-purpose discord bot

miten 2 Jan 11, 2022
sentry - yet another multi-purpose discord bot

sentry - yet another multi-purpose discord bot

miten 1 Feb 17, 2022
This is a Discord bot written in Rust to translate to and from the Bottom Encoding Standard using bottom-rs and Serenity.

bottom-bot This is a Discord bot written in Rust to translate to and from the Bottom Encoding Standard using bottom-rs and Serenity. Ever had this pro

Bottom Software Foundation 11 Dec 10, 2022
Discord bot for the Tegaki Tuesday handwriting challenge 🚧 WIP NOT PRODUCTION 🚧

字(じ)ちゃん 字(じ)ちゃん is the Discord bot for the Tegaki Tuesday handwriting challenge. For more information on the challenge, please visit the website. She

Elnu 0 Dec 19, 2022