Skip to content

Commit

Permalink
refactor: change all Discord tags to username
Browse files Browse the repository at this point in the history
  • Loading branch information
guidojw committed Sep 3, 2023
1 parent ff39182 commit 2036a8f
Show file tree
Hide file tree
Showing 9 changed files with 12 additions and 12 deletions.
2 changes: 1 addition & 1 deletion src/client/events/guild-member-add.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ export default class GuildMemberAddEventHandler implements BaseHandler {
if (welcomeChannelsGroup !== null && welcomeChannelsGroup.isChannelGroup() &&
welcomeChannelsGroup.channels.cache.size > 0) {
const embed = new EmbedBuilder()
.setTitle(`Hey ${member.user.tag},`)
.setTitle(`Hey ${member.user.username},`)
.setDescription(`You're the **${getOrdinalNum(guild.memberCount)}** member on **${guild.name}**!`)
.setThumbnail(member.user.displayAvatarURL())
.setColor(context.primaryColor ?? applicationConfig.defaultColor)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ export default class PersistentRolesCommand extends SubCommandCommand<Persistent
}

const embed = new EmbedBuilder()
.setTitle(`${member.user.tag}'s Persistent Roles`)
.setTitle(`${member.user.username}'s Persistent Roles`)
.setDescription(persistentRoles.map(role => role.toString()).toString())
.setColor(context.primaryColor ?? applicationConfig.defaultColor)
await interaction.reply({ embeds: [embed] })
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ export default class BoostInfoCommand extends Command {
await member.user.fetch()
}
const embed = new EmbedBuilder()
.setTitle(`${member.user.tag} ${emoji?.toString() ?? ''}`)
.setTitle(`${member.user.username} ${emoji?.toString() ?? ''}`)
.setThumbnail(member.user.displayAvatarURL())
.setDescription(`Has been boosting this server for **${pluralize('month', months, true)}** and **${pluralize('day', days, true)}**!`)
.setFooter({ text: '* Discord Nitro months are 30 days long.' })
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ export default class PollCommand extends Command {
}
const embed = new EmbedBuilder()
.setDescription(poll)
.setAuthor({ name: interaction.user.tag, iconURL: interaction.user.displayAvatarURL() })
.setAuthor({ name: interaction.user.username, iconURL: interaction.user.displayAvatarURL() })
.setColor(context?.primaryColor ?? applicationConfig.defaultColor)

const newMessage = await interaction.reply({ embeds: [embed], fetchReply: true })
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ export default class SuggestCommand extends Command {
const authorUrl = `https://discord.com/users/${interaction.user.id}`
const embed = new EmbedBuilder()
.setDescription(suggestion)
.setAuthor({ name: interaction.user.tag, iconURL: interaction.user.displayAvatarURL(), url: authorUrl })
.setAuthor({ name: interaction.user.username, iconURL: interaction.user.displayAvatarURL(), url: authorUrl })
.setColor(0x000af43)
if (attachment !== null) {
if (attachment.height !== null) {
Expand Down
2 changes: 1 addition & 1 deletion src/jobs/premium-members-report.ts
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ export default class PremiumMembersReportJob implements BaseJob {
for (const { member, months } of monthlyPremiumMembers) {
embed.addFields([
{
name: `${member.user.tag} ${emoji?.toString() ?? ''}`,
name: `${member.user.username} ${emoji?.toString() ?? ''}`,
value: `Has been boosting this server for **${pluralize('month', months, true)}**!`
}
])
Expand Down
2 changes: 1 addition & 1 deletion src/managers/guild-ticket.ts
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ export default class GuildTicketManager extends DataManager<number, Ticket, Tick
throw new Error('Invalid ticket type.')
}

const channelName = `${ticketType.name}-${author.user.tag}`
const channelName = `${ticketType.name}-${author.user.username}`
const permissionOverwrites = this.context.ticketsCategory?.permissionOverwrites.cache.toJSON() ?? []
let channel
try {
Expand Down
2 changes: 1 addition & 1 deletion src/structures/guild-context.ts
Original file line number Diff line number Diff line change
Expand Up @@ -242,7 +242,7 @@ export default class GuildContext extends BaseStructure<GuildEntity> {
}

const embed = new EmbedBuilder()
.setAuthor({ name: author.tag, iconURL: author.displayAvatarURL() })
.setAuthor({ name: author.username, iconURL: author.displayAvatarURL() })
.setColor(this.primaryColor ?? applicationConfig.defaultColor)
.setDescription(content)
if (typeof options.color !== 'undefined') {
Expand Down
8 changes: 4 additions & 4 deletions src/structures/ticket.ts
Original file line number Diff line number Diff line change
Expand Up @@ -196,7 +196,7 @@ export default class Ticket extends BaseStructure<TicketEntity> {
...this.moderators.cache.map(moderator => moderator.partial && moderator.fetch())
])
let moderatorsString = makeCommaSeparatedString(this.moderators.cache.map((moderator: GuildMember) => {
return `**${moderator.user.tag ?? moderator.id}**`
return `**${moderator.user.username ?? moderator.id}**`
}))
if (moderatorsString === '') {
moderatorsString = 'none'
Expand All @@ -205,7 +205,7 @@ export default class Ticket extends BaseStructure<TicketEntity> {
const embed = new EmbedBuilder()
.setColor(this.context.primaryColor ?? applicationConfig.defaultColor)
.setAuthor({
name: this.author?.user?.tag ?? this.authorId ?? 'unknown',
name: this.author?.user?.username ?? this.authorId ?? 'unknown',
iconURL: this.author?.user?.displayAvatarURL()
})
.setTitle('Ticket Rating')
Expand All @@ -230,7 +230,7 @@ export default class Ticket extends BaseStructure<TicketEntity> {
}
const { robloxId, robloxUsername } = await this.fetchAuthorData()
output += 'AUTHOR INFORMATION\n'
output += `Discord tag: ${this.author?.user?.tag ?? 'unknown'}\nDiscord ID: ${this.authorId ?? 'unknown'}\n`
output += `Discord username: ${this.author?.user?.username ?? 'unknown'}\nDiscord ID: ${this.authorId ?? 'unknown'}\n`
output += `Roblox username: ${robloxUsername ?? 'unknown'}\nRoblox ID: ${robloxId ?? 'unknown'}\n\n`

output += `Created at: ${this.channel.createdAt.toString()}\nClosed at: ${new Date().toString()}\n\n`
Expand All @@ -248,7 +248,7 @@ export default class Ticket extends BaseStructure<TicketEntity> {
}
for (const message of messages.values()) {
if (message.content !== '' || message.attachments.size > 0) {
output += `Sent by: ${message.author.tag} (${message.author.id})\n\n`
output += `Sent by: ${message.author.username} (${message.author.id})\n\n`

if (message.content !== '') {
output += ` ${message.cleanContent}\n\n`
Expand Down

0 comments on commit 2036a8f

Please sign in to comment.