Crates.io | drftr |
lib.rs | drftr |
version | 0.1.1 |
source | src |
created_at | 2023-09-20 14:32:24.847464 |
updated_at | 2023-09-20 15:43:14.897891 |
description | A utility library for building Discord bots to draft whatever you like. |
homepage | |
repository | https://github.com/Sam-Dunlap/drftr |
max_upload_size | |
id | 978199 |
size | 40,044 |
This is a utility library designed to integrate into Discord bots built with Poise and Serenity. You can use the structs and methods found within to build a draft league manager bot.
I built this library primarily for personal use, but I believe it can be helpful for others. See the full documentation for more detailed information.
After adding this library to your Rust Discord bot, make sure to create a struct which implements the DraftItem trait. This struct must have a method which returns a unique name, but otherwise can contain as little or as much data as you choose. You may want each DraftItem to contain a URL to an image of the item, for example, or a set of relevant statistics (points, KDA, position, etc).
Your bot should also contain a static collection that represents the pool of possible draft items. This collection needs not contain actual DraftItems, but you should have a constructor to create DraftItems from entries within it.
When passing these DraftItems into DRFTR methods, you must also put them into a Box, and they will be Boxed when a method returns a DraftItem.
The general workflow of the structures in this library is intended as such:
Players should also have a command to remove picks from their queues, which should call League::delete_from_player_queue, and a command to clear their queues, which should call League::clear_player_queue.
DraftGuilds can contain any number of Leagues, whether active or inactive, but each Discord server should be associated with only one DraftGuild. You are responsible for maintaining the collection of DraftGuilds in your bot.