Skip to content

Commit

Permalink
Fix deprecations
Browse files Browse the repository at this point in the history
  • Loading branch information
mmerfort committed Aug 2, 2024
1 parent f4d4395 commit d86ed0d
Show file tree
Hide file tree
Showing 8 changed files with 46 additions and 42 deletions.
4 changes: 2 additions & 2 deletions src/commands/NFD.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1223,8 +1223,8 @@ class NFD {
) {
const nfdName = nfd.name

const author = owner ? owner.nickname ?? owner.user.username : 'UNKNOWN'
const avatar = owner ? owner.user.avatarURL() ?? undefined : undefined
const author = owner ? (owner.nickname ?? owner.user.username) : 'UNKNOWN'
const avatar = owner ? (owner.user.avatarURL() ?? undefined) : undefined

// Check for the existence of the image in the cache, if it doesn't exist, make it.

Expand Down
6 changes: 5 additions & 1 deletion src/commands/RPG/Character.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,11 @@ export class Character {

rng: () => number

public constructor(public user: User, public nickname: string, private seedPhrase?: string) {
public constructor(
public user: User,
public nickname: string,
private seedPhrase?: string
) {
// Maybe the screen name is better until folks can build their own character
if (this.seedPhrase) {
this.seed = cyrb53(this.seedPhrase)
Expand Down
4 changes: 2 additions & 2 deletions src/commands/duel.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,10 @@ import {
ButtonStyle,
CommandInteraction,
EmbedBuilder,
Formatters,
GuildMember,
Message,
MessageActionRowComponentBuilder,
inlineCode,
} from 'discord.js'
import { Discord, Slash, SlashGroup } from 'discordx'
import { injectable } from 'tsyringe'
Expand Down Expand Up @@ -143,7 +143,7 @@ export class Duel {

// Check if there is no current duel
await collectionInteraction.followUp({
content: `Someone beat you to the challenge! (or the duel expired... who knows!). You may issue a new challenge with ${Formatters.inlineCode(
content: `Someone beat you to the challenge! (or the duel expired... who knows!). You may issue a new challenge with ${inlineCode(
'/duel'
)}.`,
ephemeral: true,
Expand Down
6 changes: 3 additions & 3 deletions src/commands/minesweeper.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { ApplicationCommandOptionType, CommandInteraction, Formatters } from 'discord.js'
import { ApplicationCommandOptionType, CommandInteraction, spoiler } from 'discord.js'
import {
Discord,
SimpleCommand,
Expand Down Expand Up @@ -116,13 +116,13 @@ class Board {

const tile = this.neighbors[i]
if (tile === -1) {
board += Formatters.spoiler(`:${this.randomBomb()}:`)
board += spoiler(`:${this.randomBomb()}:`)
} else {
if (tile === 0 && !startRevealed) {
board += `:${Board.neighborCounts[tile]}:`
startRevealed = true
} else {
board += Formatters.spoiler(`:${Board.neighborCounts[tile]}:`)
board += spoiler(`:${Board.neighborCounts[tile]}:`)
}
}
}
Expand Down
4 changes: 2 additions & 2 deletions src/commands/roleCommands/changecolor.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import {
import {
ApplicationCommandOptionType,
CommandInteraction,
Formatters,
italic,
Guild,
GuildMember,
HexColorString,
Expand Down Expand Up @@ -293,7 +293,7 @@ export class ColorRoles {
const hexColor: HexColorString = color[0] !== '#' ? `#${color}` : (color as HexColorString)
let favoriteString = ' '
if (isFavorite || hexColor === userOptions.favColor?.toUpperCase()) {
favoriteString += Formatters.italic('favorite') + ' '
favoriteString += italic('favorite') + ' '
}

await ColorRoles.setColor(hexColor, member, guild)
Expand Down
2 changes: 1 addition & 1 deletion src/commands/roleCommands/embedpls.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { Discord, SimpleCommand, SimpleCommandMessage, Slash, SlashOption } from 'discordx'
import { ApplicationCommandOptionType, CommandInteraction, GuildMember, GuildMemberRoleManager, User } from 'discord.js'
import { ApplicationCommandOptionType, CommandInteraction, GuildMember, GuildMemberRoleManager } from 'discord.js'
import { memberIsSU } from '../../guards/RoleChecks.js'

// Intentionally leaving out the slash command for this as it doesn't really make sense to
Expand Down
4 changes: 2 additions & 2 deletions src/commands/timeout.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import {
ButtonBuilder,
ButtonStyle,
CommandInteraction,
Formatters,
quote,
Guild,
GuildMember,
GuildMemberRoleManager,
Expand Down Expand Up @@ -67,7 +67,7 @@ abstract class Timeout {
async sudoku(member: GuildMember | null, message?: string): Promise<string> {
const time = this.sudokuDuration()
await member?.timeout(time * 1000, "Sudoku'd").catch(console.error)
const msg = message && message.length < 150 ? `\n${Formatters.quote(message)}` : ''
const msg = message && message.length < 150 ? `\n${quote(message)}` : ''

// If the Sudoku-ee is a Super User send them a DM with a button to remove the timeout
if (memberIsSU(member)) {
Expand Down
58 changes: 29 additions & 29 deletions src/guards/RoleChecks.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import {
GuildMember,
Message,
MessageReaction,
SelectMenuInteraction,
StringSelectMenuInteraction,
VoiceState,
} from 'discord.js'

Expand All @@ -35,7 +35,7 @@ export const NotBot: GuardFunction<
| ArgsOf<'messageCreate' | 'messageReactionAdd' | 'voiceStateUpdate'>
| CommandInteraction
| ContextMenuCommandInteraction
| SelectMenuInteraction
| StringSelectMenuInteraction
| ButtonInteraction
| SimpleCommandMessage
> = async (arg, _, next) => {
Expand All @@ -44,19 +44,19 @@ export const NotBot: GuardFunction<
argObj instanceof CommandInteraction
? argObj.user
: argObj instanceof MessageReaction
? argObj.message.author
: argObj instanceof VoiceState
? argObj.member?.user
: argObj instanceof Message
? argObj.author
: argObj instanceof SimpleCommandMessage
? argObj.message.author
: argObj instanceof CommandInteraction ||
argObj instanceof ContextMenuCommandInteraction ||
argObj instanceof SelectMenuInteraction ||
argObj instanceof ButtonInteraction
? argObj.member?.user
: argObj?.message?.author
? argObj.message.author
: argObj instanceof VoiceState
? argObj.member?.user
: argObj instanceof Message
? argObj.author
: argObj instanceof SimpleCommandMessage
? argObj.message.author
: argObj instanceof CommandInteraction ||
argObj instanceof ContextMenuCommandInteraction ||
argObj instanceof StringSelectMenuInteraction ||
argObj instanceof ButtonInteraction
? argObj.member?.user
: argObj?.message?.author
if (!user?.bot) {
await next()
}
Expand All @@ -66,7 +66,7 @@ export const IsSuperUser: GuardFunction<
| ArgsOf<'messageCreate' | 'messageReactionAdd' | 'voiceStateUpdate'>
| CommandInteraction
| ContextMenuCommandInteraction
| SelectMenuInteraction
| StringSelectMenuInteraction
| ButtonInteraction
| SimpleCommandMessage
> = async (arg, _, next) => {
Expand All @@ -75,19 +75,19 @@ export const IsSuperUser: GuardFunction<
argObj instanceof CommandInteraction
? argObj.member
: argObj instanceof MessageReaction
? argObj.message.member
: argObj instanceof VoiceState
? argObj.member
: argObj instanceof Message
? argObj.member
: argObj instanceof SimpleCommandMessage
? argObj.message.member
: argObj instanceof CommandInteraction ||
argObj instanceof ContextMenuCommandInteraction ||
argObj instanceof SelectMenuInteraction ||
argObj instanceof ButtonInteraction
? argObj.member
: argObj?.message?.member
? argObj.message.member
: argObj instanceof VoiceState
? argObj.member
: argObj instanceof Message
? argObj.member
: argObj instanceof SimpleCommandMessage
? argObj.message.member
: argObj instanceof CommandInteraction ||
argObj instanceof ContextMenuCommandInteraction ||
argObj instanceof StringSelectMenuInteraction ||
argObj instanceof ButtonInteraction
? argObj.member
: argObj?.message?.member
if (memberIsSU(member)) {
await next()
}
Expand Down

0 comments on commit d86ed0d

Please sign in to comment.