def delete_permitted_term(self, streamer: Streamer, info, mod_action: ModAction, embed: disnake.Embed) -> disnake.Embed: embed = self.set_terms_attrs(mod_action, embed) embed.add_field(name="Removed by", value=f"{info['requester_login']}") if "`" in info["text"]: embed.add_field(name="Value", value=f"```{info['text']}```") else: embed.add_field(name="Value", value=f"`{info['text']}`") embed.remove_field(1) return embed
def add_permitted_term(self, streamer: Streamer, info, mod_action: ModAction, embed: disnake.Embed) -> disnake.Embed: embed = self.set_terms_attrs(mod_action, embed) embed.colour = self.colour.green embed.add_field(name="Added by", value=f"{info['requester_login']}") if "`" in info["text"]: embed.add_field(name="Term", value=f"```{info['text']}```", inline=False) else: embed.add_field(name="Term", value=f"`{info['text']}`", inline=False) embed.add_field(name="From Automod", value=f"`{info['from_automod']}`") if info["expires_at"] != "": d = datetime.strptime(info["expires_at"][:-4] + "Z", "%Y-%m-%dT%H:%M:%S.%fZ") epoch = d.timestamp() + 1 - datetime.utcnow().timestamp() days = int(str(epoch // 86400).split('.')[0]) hours = int(str(epoch // 3600 % 24).split('.')[0]) minutes = int(str(epoch // 60 % 60).split('.')[0]) seconds = int(str(epoch % 60).split('.')[0]) full = [] if days != 0: full.append(f"{days}d") if hours != 0: full.append(f"{hours}h") if minutes != 0: full.append(f"{minutes}m") if seconds != 0: full.append(f"{seconds}s") expiry = ''.join(full) embed.add_field( name="Expires in", value= f"{expiry} (<t:{int(epoch+datetime.now().timestamp())}:R>)") else: embed.add_field(name="Expires in", value="Permanent") embed.remove_field(1) return embed