A Discord bot for lichess and Rosen related things

Related tags

Miscellaneous liro
Overview

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 this bot is trying to solve is automating the role assignment for denizens of the IM Rosen Discord server.

This project also aims to increase rating support to not only lichess accounts, but also chesscom.

Invite

Please note: Liro is still being developped heavily. We do not provide uptime guarantees, and things related to role management might break in the near future. In addition, you might have to re-invite the bot in the future to add/remove permissions due to the changes that Discord is making to permissions.

You can now invite Liro to join your discord!

Setup

You will need to create roles that Liro can use to hand out to people. Colours and ordering are up to you, however the roles need to be under the liro role in your server. Here is an example of how roles could be setup:

Screenshot of sample Discord rating role setup

Todo

  • Handle sharding
  • Handle permission errors when roles are misconfigured
  • Implement per-TC roles
  • Add automated role creation
  • Implement application commands
Comments
  • Add

    Add "Add to Server" button in bot description

    To change it, go to https://discord.com/developers/applications/<client_id>/oauth2/general and update CUSTOM URL under Default Authorization Link with the appropriate link, as shown below.

    Screen Shot 2021-11-18 at 3 46 58 AM
    opened by maxrosenb 1
  • RUSTSEC-2020-0071: Potential segfault in the time crate

    RUSTSEC-2020-0071: Potential segfault in the time crate

    Potential segfault in the time crate

    | Details | | | ------------------- | ---------------------------------------------- | | Package | time | | Version | 0.1.43 | | URL | https://github.com/time-rs/time/issues/293 | | Date | 2020-11-18 | | Patched versions | >=0.2.23 | | Unaffected versions | =0.2.0,=0.2.1,=0.2.2,=0.2.3,=0.2.4,=0.2.5,=0.2.6 |

    Impact

    Unix-like operating systems may segfault due to dereferencing a dangling pointer in specific circumstances. This requires an environment variable to be set in a different thread than the affected functions. This may occur without the user's knowledge, notably in a third-party library.

    The affected functions from time 0.2.7 through 0.2.22 are:

    • time::UtcOffset::local_offset_at
    • time::UtcOffset::try_local_offset_at
    • time::UtcOffset::current_local_offset
    • time::UtcOffset::try_current_local_offset
    • time::OffsetDateTime::now_local
    • time::OffsetDateTime::try_now_local

    The affected functions in time 0.1 (all versions) are:

    • at
    • at_utc

    Non-Unix targets (including Windows and wasm) are unaffected.

    Patches

    Pending a proper fix, the internal method that determines the local offset has been modified to always return None on the affected operating systems. This has the effect of returning an Err on the try_* methods and UTC on the non-try_* methods.

    Users and library authors with time in their dependency tree should perform cargo update, which will pull in the updated, unaffected code.

    Users of time 0.1 do not have a patch and should upgrade to an unaffected version: time 0.2.23 or greater or the 0.3. series.

    Workarounds

    No workarounds are known.

    References

    time-rs/time#293

    See advisory page for additional details.

    opened by github-actions[bot] 0
  • Implement auth token for lichess API to get better rate limits

    Implement auth token for lichess API to get better rate limits

    At the moment we're using a mostly unauthenticated API client when talking to lichess. One minor optimisation we could do is use an authenticated client, which would give us better API rates.

    We're not anywhere near the limit of API limits with our current usage, but that kind of thing has a nasty habit of sneaking up on you.

    enhancement good first issue 
    opened by teotwaki 0
  • Implement application commands

    Implement application commands

    It doesn't look like Discord is changing its mind when it comes to application commands, so they probably need to be implemented at some point. This is the task I'm currently working on.

    I've tried playing around with Poise, but I wasn't a fan of how opinionated it is. That's not meant as a diss or anything, it's just that I'm opinionated as well, and our opinions don't really match. I'm sure that if I had started off building liro using Poise, I would be very happy with it.

    I'm taking the overly verbose and declarative route that is currently available in Serenity. I'll see if I get around to publishing a branch with my current WIP, although it may not be super interesting. The main part that I'm trying to figure out is restructuring the existing commands and making that mesh with the application commands, so that I don't need to have two parallel implementations of each command.

    enhancement 
    opened by teotwaki 0
  • Bump regex from 1.5.4 to 1.5.5

    Bump regex from 1.5.4 to 1.5.5

    Bumps regex from 1.5.4 to 1.5.5.

    Changelog

    Sourced from regex's changelog.

    1.5.5 (2022-03-08)

    This releases fixes a security bug in the regex compiler. This bug permits a vector for a denial-of-service attack in cases where the regex being compiled is untrusted. There are no known problems where the regex is itself trusted, including in cases of untrusted haystacks.

    Commits

    Dependabot compatibility score

    Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting @dependabot rebase.


    Dependabot commands and options

    You can trigger Dependabot actions by commenting on this PR:

    • @dependabot rebase will rebase this PR
    • @dependabot recreate will recreate this PR, overwriting any edits that have been made to it
    • @dependabot merge will merge this PR after your CI passes on it
    • @dependabot squash and merge will squash and merge this PR after your CI passes on it
    • @dependabot cancel merge will cancel a previously requested merge and block automerging
    • @dependabot reopen will reopen this PR if it is closed
    • @dependabot close will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually
    • @dependabot ignore this major version will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself)
    • @dependabot ignore this minor version will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself)
    • @dependabot ignore this dependency will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)
    • @dependabot use these labels will set the current labels as the default for future PRs for this repo and language
    • @dependabot use these reviewers will set the current reviewers as the default for future PRs for this repo and language
    • @dependabot use these assignees will set the current assignees as the default for future PRs for this repo and language
    • @dependabot use this milestone will set the current milestone as the default for future PRs for this repo and language

    You can disable automated security fix PRs for this repo from the Security Alerts page.

    dependencies 
    opened by dependabot[bot] 0
  • Add documentation

    Add documentation

    I saw that my liro fork had gotten deleted and remembered this old stale pr I'd made. I've finished most of it, just have the role format part left.

    If anybody knows how to make it look a bit better please lmk here.

    opened by ReubenMenezes 1
  • RUSTSEC-2020-0159: Potential segfault in `localtime_r` invocations

    RUSTSEC-2020-0159: Potential segfault in `localtime_r` invocations

    Potential segfault in localtime_r invocations

    | Details | | | ------------------- | ---------------------------------------------- | | Package | chrono | | Version | 0.4.19 | | URL | https://github.com/chronotope/chrono/issues/499 | | Date | 2020-11-10 |

    Impact

    Unix-like operating systems may segfault due to dereferencing a dangling pointer in specific circumstances. This requires an environment variable to be set in a different thread than the affected functions. This may occur without the user's knowledge, notably in a third-party library.

    Workarounds

    No workarounds are known.

    References

    See advisory page for additional details.

    opened by github-actions[bot] 0
  • Manage YT/TTV roles

    Manage YT/TTV roles

    In addition to managing a user's rating range roles, Liro should also hand out "Team YouTube" and "Team Twitch" roles on Discord. This gives users access to private channel based on which team they are part of.

    Barebones proposal

    The most basic system could just be to read from Lichess which team the user is part of, and give him a role based on that.

    This has a few limitations:

    • The user needs to manually join the team on lichess.
    • There is no limitation in lichess about how many teams you can join at any point.
      • This being said, lichess will force users to "choose" a team when the tournament starts, so sandbagging isn't very likely (and we have a good community)
      • This means a single user could have both roles, and end up with access to both channels.

    While this isn't the cleanest implementation, it's simple and easy to do, and neither myself nor @CBrocks294 see any major issue with this simple solution.

    Bells and whistles

    This would require quite a bit more setup and work, however this would give us more control.

    • When people link their lichess account with Liro, increase the permissions we request to also allow us to manage their teams
      • Extra OAuth scope required: team:write.
      • Store the credentials with the user so we can make requests on their behalf.
    • Implement a command to join either team YT or team TTV.
      • When a team is picked:
        • Give them a role
        • Send a join request on their behalf to the correct team
        • Approve the join request through the Lichess API (this requires #9 to be implemented, and for Liro to be an admin for the teams)
    enhancement 
    opened by teotwaki 0
  • Implement chesscom support

    Implement chesscom support

    It would be great to be able to support chesscom in addition to lichess.

    From an API perspective, chesscom is a bit more limited, however it's not unmanageable:

    • There's no OAuth support, however one common technique is that as a challenge/response system, we give the user a token they should put in the Location field of their profile. Once they validate, we fetch the profile and verify the token is there. It requires a bit more manual work on the user's part, however it does prove account ownership.
    • chesscom has an API that we can access to fetch ratings and such. It's by far not the sexiest of APIs to work with, but it will get the job done.

    Questions:

    • how do we handle people with both a lichess and a chesscom account? Do we average the ratings? Do we show the highest? Should we handle both accounts at all?
    • How do we show the difference in ratings? Do we need to show the difference at all? We could have one role that says "Liro Lichess" or "Liro ChessCom", so that we don't need to duplicate all the roles again (this only works with the single-account-linked approach).
    enhancement 
    opened by teotwaki 2
  • Add automated role creation

    Add automated role creation

    It would be great for Liro to be able to create the roles in an automated fashion. One proposal is to have a command like:

    /setup 800 2400 100 rapid classical
    

    Breakdown:

    • 800: minimum rating, so this would be turned into U800
    • 2400: maximum rating, this would become 2400+
    • 100: increment between two ratings. This would mean that we would end up with 800-899, 900-999, 1000-1099, etc.
    • rapid classical the formats for which the roles should be created.

    This to take into account:

    • existing roles that match the format should be removed prior to creating the new ones.
    • I'm not sure messing with colour schemes is a good idea. Every Discord has their own colour scheme, and us coming in and forcing our own could mess things up. Maybe it would be better to have an option that when a role has its colour changed, we pick up on that modification and update the ratings in the other formats to match the colour?
    enhancement 
    opened by teotwaki 0
Owner
Sebastian Lauwers
I'm a freelance consultant focused on helping companies get an amazing tech stack.
Sebastian Lauwers
A rust(serenity) based discord bot for the hacksquad discord server

A Discord Bot for Hacksquad How to Deploy? Requirements Docker Docker Compose Steps To Run Copy the docker-compose.yml and .env.example files to your

HackSquad 5 Jan 4, 2023
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
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
🦜 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
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 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
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
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 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 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
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