Function create_embed_followed_summoner

Source
pub fn create_embed_followed_summoner(data: Value) -> CreateReply
Expand description

⚙️ Function: Creates an embed displaying the list of followed summoners.

This function constructs a Discord embed message that lists all summoners being followed in a guild. It includes the remaining time for each summoner’s follow or a message if no summoners are currently being tracked. The embed has a default purple color and includes a footer stating that the message will be deleted after 60 seconds.

§Parameters:

  • data: A serde_json::Value object containing the list of tracked summoners. The data is expected to have a tracked_summoners field, which is an array of objects with each summoner’s name and follow duration.

§Returns:

  • CreateReply: A Discord reply object containing the constructed embed. This can be sent to a Discord channel. The embed includes fields with each summoner’s name and the remaining follow time, or a message stating that no summoners are currently being followed.

§⚠️ Notes:

  • If no summoners are found in the tracked_summoners array, the embed will display “No summoners are currently being followed”.
  • The embed’s color is set to purple (0xA020F0), and a footer is included indicating that the message will be deleted after 60 seconds.
  • Each summoner’s follow information is displayed in the format: Follow ends in: X time.

§Example:

let data = json!({
    "tracked_summoners": [
        {
            "name": "Summoner1",
            "time_remaining": "2 hours 15 minutes"
        },
        {
            "name": "Summoner2",
            "time_remaining": "Follow ended"
        }
    ]
});
let embed_reply = create_embed_followed_summoner(data);
ctx.send(embed_reply).await?;

This example would produce an embed listing two summoners, with their remaining follow durations.