mirror of
https://github.com/ZeppelinBot/Zeppelin.git
synced 2025-05-10 12:25:02 +00:00
Add !slowmode command
This commit is contained in:
parent
2d8decdb4f
commit
5215dd0738
10 changed files with 122 additions and 2 deletions
|
@ -0,0 +1,44 @@
|
|||
import { Message, GuildTextableChannel, EmbedOptions } from "eris";
|
||||
import { PluginData } from "knub";
|
||||
import { UtilityPluginType } from "../types";
|
||||
import { UnknownUser, trimLines, embedPadding, resolveMember, resolveUser, preEmbedPadding } from "src/utils";
|
||||
import moment from "moment-timezone";
|
||||
import { CaseTypes } from "src/data/CaseTypes";
|
||||
import humanizeDuration from "humanize-duration";
|
||||
import { snowflakeToTimestamp } from "../../../utils/snowflakeToTimestamp";
|
||||
|
||||
const SNOWFLAKE_ICON = "https://cdn.discordapp.com/attachments/740650744830623756/742020790471491668/snowflake.png";
|
||||
|
||||
export function getSnowflakeInfoEmbed(
|
||||
pluginData: PluginData<UtilityPluginType>,
|
||||
snowflake: string,
|
||||
showUnknownWarning = false,
|
||||
): EmbedOptions {
|
||||
const embed: EmbedOptions = {
|
||||
fields: [],
|
||||
};
|
||||
|
||||
embed.author = {
|
||||
name: `Snowflake: ${snowflake}`,
|
||||
icon_url: SNOWFLAKE_ICON,
|
||||
};
|
||||
|
||||
if (showUnknownWarning) {
|
||||
embed.description =
|
||||
"This is a valid [snowflake ID](https://discord.com/developers/docs/reference#snowflakes), but I don't know what it's for.";
|
||||
}
|
||||
|
||||
const createdAtMS = snowflakeToTimestamp(snowflake);
|
||||
const createdAt = moment(createdAtMS, "x");
|
||||
const snowflakeAge = humanizeDuration(Date.now() - createdAtMS, {
|
||||
largest: 2,
|
||||
round: true,
|
||||
});
|
||||
|
||||
embed.fields.push({
|
||||
name: preEmbedPadding + "Basic information",
|
||||
value: `Created: **${snowflakeAge} ago** (\`${createdAt.format("MMM D, YYYY [at] H:mm [UTC]")}\`)`,
|
||||
});
|
||||
|
||||
return embed;
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue