Skip to content

Commit

Permalink
remove unnecessary formatting of usernames
Browse files Browse the repository at this point in the history
  • Loading branch information
iamasink committed Jun 7, 2024
1 parent af4c108 commit 8c1a110
Show file tree
Hide file tree
Showing 7 changed files with 14 additions and 9 deletions.
2 changes: 1 addition & 1 deletion src/commands/info.ts
Original file line number Diff line number Diff line change
Expand Up @@ -224,7 +224,7 @@ export default new ApplicationCommand({
if (invite) {
const invitedById = invite.inviterId
const invitedBy = await client.users.fetch(invitedById) || null
const invited = format.oldUsername(invitedBy) ? `\`${format.oldUsername(invitedBy)}\` <@${invitedById}>` : `*Unknown*`
const invited = invitedBy ? `\`${invitedBy}\` <@${invitedById}>` : `*Unknown*`
guildtext += `\n**Invited by:** ${invited} ${invite.code.slice(0, 4)}`
}

Expand Down
2 changes: 1 addition & 1 deletion src/commands/invite.ts
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ export default new ApplicationCommand({
if (hasExpired && uses === 0 && !showall) continue


tempoutput += `${name}\`${code}\`, by \`${format.oldUsername(inviter)}\` (<@${inviter.id}>),`
tempoutput += `${name}\`${code}\`, by \`${inviter.username}\` (<@${inviter.id}>),`

let guildinvite: Invite

Expand Down
2 changes: 1 addition & 1 deletion src/commands/issue.ts
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ export default new ApplicationCommand({
const userissuetitle = i.fields.getTextInputValue('errorReportModalTitleField')
const userissuedesc = i.fields.getTextInputValue('errorReportModalDescriptionField')
const content = stripIndents`
Reported by: \`${format.oldUsername(interaction.user)} (${interaction.user.id})\`
Reported by: \`${interaction.user} (${interaction.user.id})\`
User's Message: \`\`\`${userissuedesc}\`\`\`
`

Expand Down
2 changes: 1 addition & 1 deletion src/events/guildMemberAdd.ts
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ export default new Event({
}


log.log(guild, `${member.id}, \`${format.oldUsername(member.user)}\` has joined guild ${guild}. ${note}`)
log.log(guild, `${member.id}, \`${member.user}\` has joined guild ${guild}. ${note}`)
.then(async msg => {
if (!msg) return
let interaction = await commands.run(msg, "slash", "info", null, "user", [
Expand Down
2 changes: 1 addition & 1 deletion src/events/interactionCreate.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ export default new Event({
let location: string
if (interaction.channel) location = interaction.channel.name
else location = "dms"
console.log(`${format.oldUsername(interaction.user)} in #${location} triggered an interaction.`)
console.log(`${interaction.user} in #${location} triggered an interaction.`)

//const guildID = interaction.guild.id

Expand Down
6 changes: 3 additions & 3 deletions src/events/messageDelete.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ export default new Event({
// Perform a coherence check to make sure that there's *something*
if (!deletionLog) {
// Discord does not emit an audit log if the person who deleted the message is a bot deleting a single message or is the author of the message itself.
const msg = `A message by ${format.oldUsername(message.author)} <@${message.author.id}> was deleted in <#${message.channel.id}>`
const msg = `A message by ${message.author.username} <@${message.author.id}> was deleted in <#${message.channel.id}>`
console.log(msg)
log.log(message.guild, msg)

Expand All @@ -46,8 +46,8 @@ export default new Event({
// Update the output with a bit more information
// Also run a check to make sure that the log returned was for the same author's message
if (target.id === message.author.id) {
console.log(`A message by ${format.oldUsername(message.author)} <@${message.author.id}> was deleted in <#${message.channel.id}> by ${format.oldUsername(executor)}.`)
log.log(message.guild, `A message by ${format.oldUsername(message.author)} <@${message.author.id}> was deleted in <#${message.channel.id}> by ${format.oldUsername(executor)}.`)
console.log(`A message by ${message.author.username} <@${message.author.id}> was deleted in <#${message.channel.id}> by ${executor.username}.`)
log.log(message.guild, `A message by ${message.author} <@${message.author.id}> was deleted in <#${message.channel.id}> by ${executor}.`)
}
}

Expand Down
7 changes: 6 additions & 1 deletion src/utils/commands.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ import config from "../config.json"
import { setTimeout } from "node:timers"
import { Octokit } from "@octokit/rest"
import format from "./format"
import { stripIndents } from "common-tags"

function merge(a: any, b: any, prop: any) {
const reduced = a.filter(
Expand Down Expand Up @@ -431,7 +432,11 @@ export default {
.then(async i => {
interaction.deleteReply()
const usermessage = i.fields.getTextInputValue('errorReportModalField')
const content = `error: \`\`\`${error.toString()}\`\`\`\nOn command: \`${interaction.commandName}\`\nOptions: \`\`\`${JSON.stringify(interaction.options)}\`\`\`\nReported by: \`${format.oldUsername(interaction.user)} (${interaction.user.id})\`\nUser's Message: \`\`\`${usermessage}\`\`\``
const content = stripIndents`error: \`\`\`${error.toString()}\`\`\`
On command: \`${interaction.commandName}\`
Options: \`\`\`${JSON.stringify(interaction.options)}\`\`\`
Reported by: \`${format.oldUsername(interaction.user)} (${interaction.user.id})\`
User's Message: \`\`\`${usermessage}\`\`\``

client.channels.fetch("767026023387758612").then((channel: GuildTextBasedChannel) => {
console.log(channel.name)
Expand Down

0 comments on commit 8c1a110

Please sign in to comment.