fix .tag refs, fix purge not working
This commit is contained in:
parent
c9faaab317
commit
abfeba89b3
6 changed files with 26 additions and 25 deletions
|
@ -70,7 +70,10 @@ bot.on("messageUpdate", (msg, oldMsg) => {
|
||||||
|
|
||||||
bot.once("ready", async () => {
|
bot.once("ready", async () => {
|
||||||
logger.info("hf:main", "Connected to Discord.");
|
logger.info("hf:main", "Connected to Discord.");
|
||||||
logger.info("hf:main", `Logged in as: ${bot.user.tag} (${bot.user.id})`);
|
logger.info(
|
||||||
|
"hf:main",
|
||||||
|
`Logged in as: ${bot.user.username}#${bot.user.discriminator} (${bot.user.id})`
|
||||||
|
);
|
||||||
|
|
||||||
const channel = await bot.getDMChannel(config.owner_id);
|
const channel = await bot.getDMChannel(config.owner_id);
|
||||||
if (channel) {
|
if (channel) {
|
||||||
|
|
|
@ -310,7 +310,7 @@ async function lookupUser(msg, str, filter) {
|
||||||
selection.push({
|
selection.push({
|
||||||
value: user,
|
value: user,
|
||||||
key: user.id,
|
key: user.id,
|
||||||
display: `${user.tag}${user.nick ? ` (${user.nick})` : ""}`,
|
display: `${user.username}#${user.discriminator}${user.nick ? ` (${user.nick})` : ""}`,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -233,7 +233,7 @@ poll.callback = async function (msg, line, [topic, ...options]) {
|
||||||
if (arrOptions.length < 2) return "A minimum of two options are required.";
|
if (arrOptions.length < 2) return "A minimum of two options are required.";
|
||||||
|
|
||||||
const reactions = [];
|
const reactions = [];
|
||||||
let displayString = `**${msg.author.tag}** has started a poll:\n**__${topic}__**\n`;
|
let displayString = `**${msg.author.username}#${msg.author.discriminator}** has started a poll:\n**__${topic}__**\n`;
|
||||||
for (let i = 0; i < arrOptions.length; i++) {
|
for (let i = 0; i < arrOptions.length; i++) {
|
||||||
displayString +=
|
displayString +=
|
||||||
(i === 9 ? "\ud83d\udd1f" : `${i + 1}\u20e3`) +
|
(i === 9 ? "\ud83d\udd1f" : `${i + 1}\u20e3`) +
|
||||||
|
@ -258,9 +258,7 @@ vote.callback = async function (msg, line, [topic], {maybe}) {
|
||||||
if (!topic) return "No topic given.";
|
if (!topic) return "No topic given.";
|
||||||
|
|
||||||
return {
|
return {
|
||||||
content: `**${
|
content: `**${msg.author.username}#${msg.author.discriminator}** has started a vote:\n**__${topic}__**\n<:ms_tick:503341995348066313>: Yes\n<:ms_cross:503341994974773250>: No${
|
||||||
msg.author.tag
|
|
||||||
}** has started a vote:\n**__${topic}__**\n<:ms_tick:503341995348066313>: Yes\n<:ms_cross:503341994974773250>: No${
|
|
||||||
maybe ? "\n<:ms_tilda:581268710925271095>: Maybe/Uncertain" : ""
|
maybe ? "\n<:ms_tilda:581268710925271095>: Maybe/Uncertain" : ""
|
||||||
}`,
|
}`,
|
||||||
addReactions: [
|
addReactions: [
|
||||||
|
|
|
@ -20,15 +20,15 @@ tidy.callback = async function (msg, line, [subcommand, count, extra]) {
|
||||||
switch (subcommand) {
|
switch (subcommand) {
|
||||||
case "all": {
|
case "all": {
|
||||||
const messages = await msg.channel.getMessages({
|
const messages = await msg.channel.getMessages({
|
||||||
after: msg.id,
|
before: msg.id,
|
||||||
limit: count && parseInt(count) > 0 ? parseInt(count) : 10,
|
limit: count && parseInt(count) > 0 ? parseInt(count) : 10,
|
||||||
});
|
});
|
||||||
await msg.channel.deleteMessages(
|
await msg.channel.deleteMessages(
|
||||||
messages.map((m) => m.id),
|
messages.map((m) => m.id),
|
||||||
`Message purge by ${msg.author.tag}`
|
`Message purge by ${msg.author.username}#${msg.author.discriminator}`
|
||||||
);
|
);
|
||||||
|
|
||||||
return `Deleted ${messages.length} messages.`;
|
return `Deleted ${messages.length} message(s).`;
|
||||||
}
|
}
|
||||||
case "user": {
|
case "user": {
|
||||||
const user = await lookupUser(count);
|
const user = await lookupUser(count);
|
||||||
|
@ -36,43 +36,43 @@ tidy.callback = async function (msg, line, [subcommand, count, extra]) {
|
||||||
return user;
|
return user;
|
||||||
} else {
|
} else {
|
||||||
const messages = await msg.channel.getMessages({
|
const messages = await msg.channel.getMessages({
|
||||||
after: msg.id,
|
before: msg.id,
|
||||||
limit: extra && parseInt(extra) > 0 ? parseInt(extra) : 10,
|
limit: extra && parseInt(extra) > 0 ? parseInt(extra) : 10,
|
||||||
});
|
});
|
||||||
await msg.channel.deleteMessages(
|
await msg.channel.deleteMessages(
|
||||||
messages.filter((m) => m.author.id == user.id).map((m) => m.id),
|
messages.filter((m) => m.author.id == user.id).map((m) => m.id),
|
||||||
`Message purge by ${msg.author.tag} targeting ${user.tag}`
|
`Message purge by ${msg.author.username}#${msg.author.discriminator} targeting ${user.username}#${user.discriminator}`
|
||||||
);
|
);
|
||||||
|
|
||||||
return `Deleted ${messages.length} messages.`;
|
return `Deleted ${messages.length} message(s).`;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
case "bots": {
|
case "bots": {
|
||||||
const messages = await msg.channel.getMessages({
|
const messages = await msg.channel.getMessages({
|
||||||
after: msg.id,
|
before: msg.id,
|
||||||
limit: count && parseInt(count) > 0 ? parseInt(count) : 50,
|
limit: count && parseInt(count) > 0 ? parseInt(count) : 50,
|
||||||
});
|
});
|
||||||
await msg.channel.deleteMessages(
|
await msg.channel.deleteMessages(
|
||||||
messages.filter((m) => msg.author.bot).map((m) => m.id),
|
messages.filter((m) => msg.author.bot).map((m) => m.id),
|
||||||
`Message purge by ${msg.author.tag} targeting bots`
|
`Message purge by ${msg.author.username}#${msg.author.discriminator} targeting bots`
|
||||||
);
|
);
|
||||||
|
|
||||||
return `Deleted ${messages.length} messages.`;
|
return `Deleted ${messages.length} message(s).`;
|
||||||
}
|
}
|
||||||
case "filter": {
|
case "filter": {
|
||||||
if (count.length === 0)
|
if (count.length === 0)
|
||||||
return "Filter must be at least 1 character long.";
|
return "Filter must be at least 1 character long.";
|
||||||
|
|
||||||
const messages = await msg.channel.getMessages({
|
const messages = await msg.channel.getMessages({
|
||||||
after: msg.id,
|
before: msg.id,
|
||||||
limit: extra && parseInt(extra) > 0 ? parseInt(extra) : 10,
|
limit: extra && parseInt(extra) > 0 ? parseInt(extra) : 10,
|
||||||
});
|
});
|
||||||
await msg.channel.deleteMessages(
|
await msg.channel.deleteMessages(
|
||||||
messages.filter((m) => m.content.indexOf(count) > -1).map((m) => m.id),
|
messages.filter((m) => m.content.indexOf(count) > -1).map((m) => m.id),
|
||||||
`Message purge by ${msg.author.tag} targeting "${count}"`
|
`Message purge by ${msg.author.username}#${msg.author.discriminator} targeting "${count}"`
|
||||||
);
|
);
|
||||||
|
|
||||||
return `Deleted ${messages.length} messages.`;
|
return `Deleted ${messages.length} message(s).`;
|
||||||
}
|
}
|
||||||
default:
|
default:
|
||||||
return `__Usage__
|
return `__Usage__
|
||||||
|
|
|
@ -727,7 +727,7 @@ command.callback = async function (
|
||||||
return {
|
return {
|
||||||
key: item.id,
|
key: item.id,
|
||||||
display: (item.title ?? item.url).substr(0, 100),
|
display: (item.title ?? item.url).substr(0, 100),
|
||||||
description: hasManageMessages ? `Added by: ${user.tag}` : "",
|
description: hasManageMessages ? `Added by: ${user.username}#${user.discriminator}` : "",
|
||||||
};
|
};
|
||||||
}),
|
}),
|
||||||
30000,
|
30000,
|
||||||
|
|
|
@ -110,7 +110,7 @@ avatar.callback = async function (msg, line, [user], {server, guild}) {
|
||||||
}
|
}
|
||||||
|
|
||||||
const baseEmbed = {
|
const baseEmbed = {
|
||||||
title: `Avatar for \`${member.tag}\``,
|
title: `Avatar for \`${member.username}#${member.discriminator}\``,
|
||||||
};
|
};
|
||||||
|
|
||||||
const normalAvatar = member.user.avatar;
|
const normalAvatar = member.user.avatar;
|
||||||
|
@ -155,7 +155,7 @@ avatar.callback = async function (msg, line, [user], {server, guild}) {
|
||||||
const guild = msg.channel.guild || hf.bot.guilds.get(msg.guildID);
|
const guild = msg.channel.guild || hf.bot.guilds.get(msg.guildID);
|
||||||
|
|
||||||
const baseEmbed = {
|
const baseEmbed = {
|
||||||
title: `Avatar for \`${msg.author.tag}\``,
|
title: `Avatar for \`${msg.author.username}#${msg.author.discriminator}\``,
|
||||||
};
|
};
|
||||||
|
|
||||||
const normalAvatar = msg.author.avatar;
|
const normalAvatar = msg.author.avatar;
|
||||||
|
@ -501,14 +501,14 @@ flagdump.callback = async function (msg, line, [numOrMention], {id}) {
|
||||||
if (!user) {
|
if (!user) {
|
||||||
return "User not cached.";
|
return "User not cached.";
|
||||||
} else {
|
} else {
|
||||||
return `\`${user.tag}\`'s public flags:\n\`\`\`${flagFromInt(
|
return `\`${user.username}#${user.discriminator}\`'s public flags:\n\`\`\`${flagFromInt(
|
||||||
user.publicFlags
|
user.publicFlags
|
||||||
)}\`\`\``;
|
)}\`\`\``;
|
||||||
}
|
}
|
||||||
} else if (!isNaN(num)) {
|
} else if (!isNaN(num)) {
|
||||||
return `\`\`\`\n${flagFromInt(num)}\`\`\``;
|
return `\`\`\`\n${flagFromInt(num)}\`\`\``;
|
||||||
} else {
|
} else {
|
||||||
return `\`${msg.author.tag}\`'s public flags:\n\`\`\`${flagFromInt(
|
return `\`${msg.author.username}#${msg.author.discriminator}\`'s public flags:\n\`\`\`${flagFromInt(
|
||||||
msg.author.publicFlags
|
msg.author.publicFlags
|
||||||
)}\`\`\``;
|
)}\`\`\``;
|
||||||
}
|
}
|
||||||
|
@ -710,7 +710,7 @@ presence.callback = async function (msg, line) {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (target) {
|
if (target) {
|
||||||
if (!target.presence) return `**${target.tag}** is offline.`;
|
if (!target.presence) return `**${target.username}#${target.discriminator}** is offline.`;
|
||||||
|
|
||||||
let icons = "";
|
let icons = "";
|
||||||
for (const platform in target.presence.client_status) {
|
for (const platform in target.presence.client_status) {
|
||||||
|
@ -902,7 +902,7 @@ presence.callback = async function (msg, line) {
|
||||||
}
|
}
|
||||||
|
|
||||||
return {
|
return {
|
||||||
content: `Presence for **${target.tag}**: ${icons}`,
|
content: `Presence for **${target.username}#${target.discriminator}**: ${icons}`,
|
||||||
embeds,
|
embeds,
|
||||||
files,
|
files,
|
||||||
};
|
};
|
||||||
|
|
Loading…
Reference in a new issue