storing embeds/fields into dictionaries

iterating through dictionary to add fields
pull/8/head
sgoudham 4 years ago
parent 9b95961b24
commit 2511675fad

@ -1,4 +1,5 @@
import datetime import datetime
from typing import List, Tuple, Any
from discord import Embed from discord import Embed
from discord.ext import commands, menus from discord.ext import commands, menus
@ -7,6 +8,11 @@ from discord.ext.commands import command
from settings import enso_embedmod_colours from settings import enso_embedmod_colours
async def make_embed(embed, seq: List[Tuple[Any, Any, bool]]) -> Embed:
embed.add_field(seq)
return embed
# Pages of the help embed # Pages of the help embed
def help_menu(self, guild_icon): def help_menu(self, guild_icon):
# Setting up the embed for the Fun Commands # Setting up the embed for the Fun Commands
@ -165,51 +171,24 @@ def help_menu(self, guild_icon):
(f"**{self.ctx.prefix}mmsetup delete modmail**", (f"**{self.ctx.prefix}mmsetup delete modmail**",
"Existing modmail system will be deleted", False)] "Existing modmail system will be deleted", False)]
""" fields = [fun_fields, interactive_fields, interactive_fields_2, # Defining dictionary of embeds as keys, list of fields as values
relationship_fields, enso_fields, waifu_and_husbando_fields, help_dict = {
important_fields, modmail_fields] fun: fun_fields,
embeds = [fun, interactive, interactive_2, interactive: interactive_fields,
relationship, enso, waifu_and_husbando, interactive_2: interactive_fields_2,
important, modmail] relationship: relationship_fields,
enso: enso_fields,
for embed in embeds: waifu_and_husbando: waifu_and_husbando_fields,
for field in fields: important: important_fields,
# Add fields to the embed modmail: modmail_fields
for name, value, inline in field: }
embed.add_field(name=name, value=value, inline=inline)"""
# Iterating through the dictionary and adding fields to the embeds
# Add fields to the embed for embed, field in help_dict.items():
for name, value, inline in fun_fields: for name, value, inline in field:
fun.add_field(name=name, value=value, inline=inline) embed.add_field(name=name, value=value, inline=inline)
# Add fields to the embed # Return all the embeds
for name, value, inline in interactive_fields:
interactive.add_field(name=name, value=value, inline=inline)
# Add fields to the embed
for name, value, inline in interactive_fields_2:
interactive_2.add_field(name=name, value=value, inline=inline)
# Add fields to the embed
for name, value, inline in relationship_fields:
relationship.add_field(name=name, value=value, inline=inline)
# Add fields to the embed
for name, value, inline in enso_fields:
enso.add_field(name=name, value=value, inline=inline)
# Add fields to the embed
for name, value, inline in waifu_and_husbando_fields:
waifu_and_husbando.add_field(name=name, value=value, inline=inline)
# Add fields to the embed
for name, value, inline in important_fields:
important.add_field(name=name, value=value, inline=inline)
# Add fields to the embed
for name, value, inline in modmail_fields:
modmail.add_field(name=name, value=value, inline=inline)
return fun, interactive, interactive_2, relationship, \ return fun, interactive, interactive_2, relationship, \
enso, waifu_and_husbando, important, modmail enso, waifu_and_husbando, important, modmail

Loading…
Cancel
Save