tags: add support for embeds

This commit is contained in:
Dragory 2020-05-22 23:21:43 +03:00
parent 7f02aec20c
commit 1cff4fb801
No known key found for this signature in database
GPG key ID: 5F387BA66DF8AAC1
2 changed files with 66 additions and 12 deletions

View file

@ -195,6 +195,15 @@ export const tEmbed = t.type({
),
});
export type StrictMessageContent = { content?: string; tts?: boolean; disableEveryone?: boolean; embed?: EmbedOptions };
export const tStrictMessageContent = t.type({
content: tNullable(t.string),
tts: tNullable(t.boolean),
disableEveryone: tNullable(t.boolean),
embed: tNullable(tEmbed),
});
export function dropPropertiesByName(obj, propName) {
if (obj.hasOwnProperty(propName)) delete obj[propName];
for (const value of Object.values(obj)) {
@ -1017,8 +1026,6 @@ export async function resolveRoleId(bot: Client, guildId: string, value: string)
return null;
}
export type StrictMessageContent = { content?: string; tts?: boolean; disableEveryone?: boolean; embed?: EmbedOptions };
export async function confirm(bot: Client, channel: TextableChannel, userId: string, content: MessageContent) {
const msg = await channel.createMessage(content);
const reply = await waitForReaction(bot, msg, ["✅", "❌"], userId);