use User#displayAvatarURL and dont encode reason
This commit is contained in:
parent
b4ba1daa76
commit
f9e1343003
9 changed files with 9 additions and 12 deletions
|
@ -57,7 +57,7 @@ export const CasesModCmd = modActionsCmd({
|
|||
const embed: MessageEmbedOptions = {
|
||||
author: {
|
||||
name: title,
|
||||
iconURL: mod instanceof User ? mod.avatarURL() || mod.defaultAvatarURL : undefined,
|
||||
iconURL: mod instanceof User ? mod.displayAvatarURL() : undefined,
|
||||
},
|
||||
fields: [
|
||||
...getChunkedEmbedFields(emptyEmbedValue, lines.join("\n")),
|
||||
|
|
|
@ -119,7 +119,7 @@ export const CasesUserCmd = modActionsCmd({
|
|||
lineChunks.length === 1
|
||||
? `Cases for ${userName} (${lines.length} total)`
|
||||
: `Cases ${chunkStart}–${chunkEnd} of ${lines.length} for ${userName}`,
|
||||
icon_url: user instanceof User ? user.avatarURL() || user.defaultAvatarURL : undefined,
|
||||
icon_url: user instanceof User ? user.displayAvatarURL() : undefined,
|
||||
},
|
||||
fields: [
|
||||
...getChunkedEmbedFields(emptyEmbedValue, linesInChunk.join("\n")),
|
||||
|
|
|
@ -70,7 +70,7 @@ export const ForcebanCmd = modActionsCmd({
|
|||
// FIXME: Use banUserId()?
|
||||
await pluginData.guild.bans.create(user.id as Snowflake, {
|
||||
days: 1,
|
||||
reason: reason != null ? encodeURIComponent(reason) : undefined,
|
||||
reason: reason ?? undefined,
|
||||
});
|
||||
} catch {
|
||||
sendErrorMessage(pluginData, msg.channel, "Failed to forceban member");
|
||||
|
|
|
@ -51,7 +51,7 @@ export const UnbanCmd = modActionsCmd({
|
|||
|
||||
try {
|
||||
ignoreEvent(pluginData, IgnoredEventType.Unban, user.id);
|
||||
await pluginData.guild.bans.remove(user.id as Snowflake, reason != null ? encodeURIComponent(reason) : undefined);
|
||||
await pluginData.guild.bans.remove(user.id as Snowflake, reason ?? undefined);
|
||||
} catch {
|
||||
sendErrorMessage(pluginData, msg.channel, "Failed to unban member; are you sure they're banned?");
|
||||
return;
|
||||
|
|
|
@ -80,7 +80,7 @@ export async function banUserId(
|
|||
const deleteMessageDays = Math.min(30, Math.max(0, banOptions.deleteMessageDays ?? 1));
|
||||
await pluginData.guild.bans.create(userId as Snowflake, {
|
||||
days: deleteMessageDays,
|
||||
reason: reason != null ? encodeURIComponent(reason) : undefined,
|
||||
reason: reason ?? undefined,
|
||||
});
|
||||
} catch (e) {
|
||||
let errorMessage;
|
||||
|
|
|
@ -49,7 +49,7 @@ export async function kickMember(
|
|||
pluginData.state.serverLogs.ignoreLog(LogType.MEMBER_KICK, member.id);
|
||||
ignoreEvent(pluginData, IgnoredEventType.Kick, member.id);
|
||||
try {
|
||||
await member.kick(reason != null ? encodeURIComponent(reason) : undefined);
|
||||
await member.kick(reason ?? undefined);
|
||||
} catch (e) {
|
||||
return {
|
||||
status: "failed",
|
||||
|
|
|
@ -32,10 +32,7 @@ export async function outdatedTempbansLoop(pluginData: GuildPluginData<ModAction
|
|||
);
|
||||
try {
|
||||
ignoreEvent(pluginData, IgnoredEventType.Unban, tempban.user_id);
|
||||
await pluginData.guild.bans.remove(
|
||||
tempban.user_id as Snowflake,
|
||||
reason != null ? encodeURIComponent(reason) : undefined,
|
||||
);
|
||||
await pluginData.guild.bans.remove(tempban.user_id as Snowflake, reason ?? undefined);
|
||||
} catch (e) {
|
||||
pluginData.state.serverLogs.log(LogType.BOT_ALERT, {
|
||||
body: `Encountered an error trying to automatically unban ${tempban.user_id} after tempban timeout`,
|
||||
|
|
|
@ -16,7 +16,7 @@ export const AvatarCmd = utilityCmd({
|
|||
async run({ message: msg, args, pluginData }) {
|
||||
const user = args.user || msg.author;
|
||||
if (!(user instanceof UnknownUser)) {
|
||||
const avatar = user.avatarURL() || user.defaultAvatarURL;
|
||||
const avatar = user.displayAvatarURL();
|
||||
let extension = avatar.slice(avatar.lastIndexOf("."), avatar.lastIndexOf("?"));
|
||||
// Some pngs can have the .jpg extention for some reason, so we always use .png for static images
|
||||
extension = extension === ".gif" ? extension : ".png";
|
||||
|
|
|
@ -39,7 +39,7 @@ export async function getUserInfoEmbed(
|
|||
name: `User: ${user.username}#${user.discriminator}`,
|
||||
};
|
||||
|
||||
const avatarURL = user.avatarURL() || user.defaultAvatarURL;
|
||||
const avatarURL = user.displayAvatarURL();
|
||||
embed.author.icon_url = avatarURL;
|
||||
|
||||
const createdAt = moment.utc(user.createdAt, "x");
|
||||
|
|
Loading…
Add table
Reference in a new issue