Compare commits

..

No commits in common. "c699c0471720a2f1cea641cae85623fa69dc0b9f" and "939effc40a3889e9cc7f607816ad45d361ed9f96" have entirely different histories.

3 changed files with 121 additions and 134 deletions

File diff suppressed because one or more lines are too long

View file

@ -254,14 +254,11 @@ const vote = new Command("vote");
vote.category = CATEGORY;
vote.helpText = "Start a yes/no vote";
vote.usage = "[topic]";
vote.callback = async function (msg, line, topic, {maybe}) {
vote.callback = async function (msg, line, [topic], {maybe}) {
if (!topic) return "No topic given.";
topic = topic.join(" ");
return {
content: `**${msg.author.username}#${
msg.author.discriminator
}** has started a vote:\n**__${topic}__**\n<:ms_tick:503341995348066313>: Yes\n<:ms_cross:503341994974773250>: No${
content: `**${msg.author.username}#${msg.author.discriminator}** has started a vote:\n**__${topic}__**\n<:ms_tick:503341995348066313>: Yes\n<:ms_cross:503341994974773250>: No${
maybe ? "\n<:ms_tilda:581268710925271095>: Maybe/Uncertain" : ""
}`,
addReactions: [
@ -575,18 +572,10 @@ search.callback = async function (msg, line, args, {results = 2}) {
let out = `__**Results for \`${safeString(query)}\`**__\n`;
for (const result of searchResults) {
if (result.special_response) {
out +=
"> " +
safeString(
parseHtmlEntities(
result.special_response.response.split("\n").join("\n> ")
)
);
out += "> " + safeString(parseHtmlEntities(result.special_response.response.split("\n").join("\n> ")));
out += `\n<${encodeURI(result.special_response.source)}>`;
} else {
out += `**${safeString(parseHtmlEntities(result.title))}** - <${encodeURI(
result.url
)}>`;
out += `**${safeString(parseHtmlEntities(result.title))}** - <${encodeURI(result.url)}>`;
out += `\n> ${safeString(parseHtmlEntities(result.description))}`;
}
out += "\n\n";

View file

@ -1,38 +1,12 @@
const Command = require("../lib/command.js");
const CATEGORY = "utility";
// imports
const sharp = require("sharp");
const {
hastebin,
lookupUser,
formatTime,
safeString,
} = require("../lib/utils.js");
const {getNamesFromString} = require("../lib/unicode.js");
const GameData = require("../../data/games.json");
const EmojiData = require("../../data/emoji.json");
const EMOJI_NAMES = [];
for (const emoji of EmojiData) {
EMOJI_NAMES[emoji.char] = emoji.name.replace(/ /g, "_");
}
// constants
const ICON_BASE = "https://cdn.discordapp.com/icons/";
const AVATAR_BASE = "https://cdn.discordapp.com/avatars/";
const SPLASH_BASE = "https://cdn.discordapp.com/splashes/";
const BANNER_BASE = "https://cdn.discordapp.com/banners/";
const EMOTE_BASE = "https://cdn.discordapp.com/emojis/";
const CUSTOM_EMOTE_REGEX = /<(?:\u200b|&)?(a)?:(\w+):(\d+)>/;
const NOWPLAYING_BAR_LENGTH = 30;
const STATUS_ICONS = {
online: "<:online:493173082421461002>",
idle: "<:idle:493173082006093836>",
@ -40,93 +14,6 @@ const STATUS_ICONS = {
offline: "<:offline:493173082253426688>",
};
const PRESENCE_ICONS = {
desktop: {
online: "<:desktop_online:1028887024670871552>",
idle: "<:desktop_idle:1028887022938624033>",
dnd: "<:desktop_dnd:1028887021848121364>",
},
mobile: {
online: "<:mobile_online:1028887017637036043>",
idle: "<:mobile_idle:1028887019226669116>",
dnd: "<:mobile_dnd:1028887020560449637>",
},
web: {
online: "<:web_online:1028887016353574962>",
idle: "<:web_idle:1028887014579392592>",
dnd: "<:web_dnd:1028887012855525486>",
},
embedded: {
online: "<:embedded_online:1028887010636726313>",
idle: "<:embedded_idle:1028887009147760681>",
dnd: "<:embedded_dnd:1028887008149516299>",
},
};
const PRESENCE_TYPES = [
"Playing",
"Streaming",
"Listening to",
"Watching",
"",
"Competing in",
];
const USER_FLAGS = [
"STAFF",
"PARTNER",
"HYPESQUAD",
"BUG_HUNTER_LEVEL_1",
"MFA_SMS",
"PREMIUM_PROMO_DISMISSED",
"HYPESQUAD_ONLINE_HOUSE_1",
"HYPESQUAD_ONLINE_HOUSE_2",
"HYPESQUAD_ONLINE_HOUSE_3",
"PREMIUM_EARLY_SUPPORTER",
"TEAM_PSEUDO_USER",
"<Internal Application (Partner, etc) Flag>", // leaked
"SYSTEM",
"HAS_UNREAD_URGENT_MESSAGES",
"BUG_HUNTER_LEVEL_2",
"UNDERAGE_DELETED",
"VERIFIED_BOT",
"VERIFIED_DEVELOPER",
"CERTIFIED_MODERATOR",
"BOT_HTTP_INTERACTIONS",
"SPAMMER",
"DISABLE_PREMIUM",
"ACTIVE_DEVELOPER",
undefined,
undefined,
undefined,
undefined,
undefined,
undefined,
undefined,
undefined,
undefined,
undefined,
"HIGH_GLOBAL_RATE_LIMIT", // start admin panel leak aug 2022
"DELETED",
"DISABLED_SUSPICIOUS_ACTIVITY",
"SELF_DELETED",
"PREMIUM_DISCRIMINATOR",
"USED_DESKTOP_CLIENT",
"USED_WEB_CLIENT",
"USED_MOBILE_CLIENT",
"DISABLED",
undefined,
"VERIFIED_EMAIL", // end admin panel leak aug 2022
"QUARANTINED",
undefined,
undefined,
undefined,
undefined,
undefined,
"COLLABORATOR",
"RESTRICTED_COLLABORATOR",
];
const EMOJI_SETS = {
blobs: {
prefix:
@ -168,7 +55,19 @@ EMOJI_SETS.ms = EMOJI_SETS.mustd;
EMOJI_SETS.twitter = EMOJI_SETS.twemoji;
EMOJI_SETS.fb = EMOJI_SETS.facebook;
// commands
const CUSTOM_EMOTE_REGEX = /<(?:\u200b|&)?(a)?:(\w+):(\d+)>/;
const sharp = require("sharp");
const {
hastebin,
lookupUser,
formatTime,
safeString,
} = require("../lib/utils.js");
const {getNamesFromString} = require("../lib/unicode.js");
const GameData = require("../../data/games.json");
const avatar = new Command("avatar");
avatar.category = CATEGORY;
@ -567,6 +466,61 @@ snowflake.callback = function (msg, line, [snowflake], {twitter}) {
};
hf.registerCommand(snowflake);
const USER_FLAGS = [
"STAFF",
"PARTNER",
"HYPESQUAD",
"BUG_HUNTER_LEVEL_1",
"MFA_SMS",
"PREMIUM_PROMO_DISMISSED",
"HYPESQUAD_ONLINE_HOUSE_1",
"HYPESQUAD_ONLINE_HOUSE_2",
"HYPESQUAD_ONLINE_HOUSE_3",
"PREMIUM_EARLY_SUPPORTER",
"TEAM_PSEUDO_USER",
"<Internal Application (Partner, etc) Flag>", // leaked
"SYSTEM",
"HAS_UNREAD_URGENT_MESSAGES",
"BUG_HUNTER_LEVEL_2",
"UNDERAGE_DELETED",
"VERIFIED_BOT",
"VERIFIED_DEVELOPER",
"CERTIFIED_MODERATOR",
"BOT_HTTP_INTERACTIONS",
"SPAMMER",
"DISABLE_PREMIUM",
"ACTIVE_DEVELOPER",
undefined,
undefined,
undefined,
undefined,
undefined,
undefined,
undefined,
undefined,
undefined,
undefined,
"HIGH_GLOBAL_RATE_LIMIT", // start admin panel leak aug 2022
"DELETED",
"DISABLED_SUSPICIOUS_ACTIVITY",
"SELF_DELETED",
"PREMIUM_DISCRIMINATOR",
"USED_DESKTOP_CLIENT",
"USED_WEB_CLIENT",
"USED_MOBILE_CLIENT",
"DISABLED",
undefined,
"VERIFIED_EMAIL", // end admin panel leak aug 2022
"QUARANTINED",
undefined,
undefined,
undefined,
undefined,
undefined,
"COLLABORATOR",
"RESTRICTED_COLLABORATOR",
];
function flagFromInt(int) {
const bits = int.toString(2);
const splitBits = bits.split("").reverse();
@ -626,6 +580,15 @@ flagdump.callback = async function (msg, line, [numOrMention], {id}) {
};
hf.registerCommand(flagdump);
const emojiNames = [];
fetch("https://unpkg.com/emoji.json/emoji.json")
.then((res) => res.json())
.then((body) =>
body.map(
(emoji) => (emojiNames[emoji.char] = emoji.name.replace(/ /g, "_"))
)
);
const jumbo = new Command("jumbo");
jumbo.category = CATEGORY;
jumbo.helpText = "Gets the raw image of an emoji.";
@ -665,15 +628,17 @@ jumbo.callback = async function (msg, line) {
.join(set.sep);
const url = set.prefix + emoji + set.suffix;
const name = EMOJI_NAMES[line]
? `\\:${EMOJI_NAMES[line]}\\:`
const name = emojiNames[line]
? `\\:${emojiNames[line]}\\:`
: await getNamesFromString(line).then((name) =>
name.map((x) => x[1]).join(", ")
);
const emojiFound = await fetch(url, {method: "HEAD"}).then((res) => res.ok);
const statusCode = await fetch(url, {method: "HEAD"}).then(
(res) => res.status
);
if (emojiFound) {
if (statusCode !== 200) {
return "Emoji not found. The emoji set chosen might not have this emote as an image.";
}
@ -740,6 +705,40 @@ charinfo.callback = async function (msg, line) {
};
hf.registerCommand(charinfo);
const PRESENCE_ICONS = {
desktop: {
online: "<:desktop_online:1028887024670871552>",
idle: "<:desktop_idle:1028887022938624033>",
dnd: "<:desktop_dnd:1028887021848121364>",
},
mobile: {
online: "<:mobile_online:1028887017637036043>",
idle: "<:mobile_idle:1028887019226669116>",
dnd: "<:mobile_dnd:1028887020560449637>",
},
web: {
online: "<:web_online:1028887016353574962>",
idle: "<:web_idle:1028887014579392592>",
dnd: "<:web_dnd:1028887012855525486>",
},
embedded: {
online: "<:embedded_online:1028887010636726313>",
idle: "<:embedded_idle:1028887009147760681>",
dnd: "<:embedded_dnd:1028887008149516299>",
},
};
const PRESENCE_TYPES = [
"Playing",
"Streaming",
"Listening to",
"Watching",
"",
"Competing in",
];
const NOWPLAYING_BAR_LENGTH = 30;
const presence = new Command("presence");
presence.category = CATEGORY;
presence.helpText = "Get presences of a user.";