GithubHelp home page GithubHelp logo

larabot's Introduction

๐Ÿค– larabot

This repository is a non-published Rust crate that has the common code used by my Discord bots.

Although the code itself is very opinionated, feel free to fork the project and adjust it however you wish.

โœจ Features

๐Ÿ”ƒ Interaction Handling Flow

๐Ÿซก Command Creation

Has a method to create a commands for the given guild or globally based on the build configuration.

๐Ÿƒ Interaction Handling

Provides a trait to handle the interaction, which is meant to be implemented on each interaction's struct.

The trait's provided handle method sets up automatic deferring, runs the interaction, and handles the error by reporting it to the user.

๐ŸŒ Localization

Has a struct to hold text in a localized manner, with methods to get the text in the desired language or return Discord-compatible arrays of localized texts.

All user-facing texts used in this crate are also localized.

๐Ÿ“จ User Feedback

Includes a command that users can use to provide feedback, which uses Sentry to report the feedback.

Users can also provide feedback with the button attached to the interaction error message.

๐Ÿ“ Tracing

Has a function to set up tracing with a formatter, environment filtering, Sentry support, and log crate compatibility.

๐Ÿ™ˆ Generic Option to Result Conversion

Provides a trait to convert an Option to a Result concisely. This is here because the Discord API returns many optional values.

๐Ÿ“ก Event Handling

Provides methods to handle the ready event, as well as errors that occur while handling or receiving an event.

๐ŸŽจ Colors

Allows you to use Discord-defined colors with an enum the crate provides.

larabot's People

Contributors

laralove143 avatar

Watchers

 avatar

larabot's Issues

metrics support

support sentry's metrics feature, through abstraction functions and also collect metrics within the crate

centralize localization further

currently, RequiredData associated type in traits is used to pass locale around, which is more code than necessary since basically every action involving ui requires locale context, so locale should be attached directly to traits in interaction module

they can be set to "" if they're not used anyway

centralize help commands

some parts of help commands are the same, such as the embed thumbnail (bot's avatar) and the components (feedback button, server invite)

write a function that gives the starting point for the response, the rest can be customized specifically for the bot

celebrate important dates in embed footers

probably as part of the function in #1

if the current date is an important date, this overrides the random footer message

the date is prioritized by reverse length, so a special day is prioritized over a special month

example messages:

  • Happy pride!
  • Happy mother's day!

random footer message

add a function that picks a random string to be used as the embed footer

useful for petty messages like:

  • Consider donating...
  • Want to edit others' messages? Check out Message Bender!

publish metrics

there will probably be a background task that stores guild count and other metrics to a public database like r2

unless sentry has a way of doing that

show updates in footers

probably part of #1 and #2, overrides both when there's an update

on an update, footer should be set to a short description of the update once, once the footer has been displayed, its discarded and #2 or #1 take effect as usual

if there are multiple updates not shown in a guild yet, they are shown in order until they deplete

example messages:

  • You can now see what's new in the bot with these footers.
  • Use the new /ban command to ban your friends without having the necessary permissions!

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.