Skip to content

Commit

Permalink
Fix deprecations
Browse files Browse the repository at this point in the history
  • Loading branch information
mmerfort committed Jul 14, 2024
1 parent caabaa1 commit 7bb59d5
Show file tree
Hide file tree
Showing 8 changed files with 45 additions and 41 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'

Check failure on line 1226 in src/commands/NFD.ts

View workflow job for this annotation

GitHub Actions / ESLint

src/commands/NFD.ts#L1226

Replace `(owner.nickname·??·owner.user.username)` with `owner.nickname·??·owner.user.username` (prettier/prettier)
const avatar = owner ? (owner.user.avatarURL() ?? undefined) : undefined

Check failure on line 1227 in src/commands/NFD.ts

View workflow job for this annotation

GitHub Actions / ESLint

src/commands/NFD.ts#L1227

Replace `(owner.user.avatarURL()·??·undefined)` with `owner.user.avatarURL()·??·undefined` (prettier/prettier)

// 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(

Check failure on line 26 in src/commands/RPG/Character.ts

View workflow job for this annotation

GitHub Actions / ESLint

src/commands/RPG/Character.ts#L26

Replace `⏎····public·user:·User,⏎····public·nickname:·string,⏎····private·seedPhrase?:·string⏎··` with `public·user:·User,·public·nickname:·string,·private·seedPhrase?:·string` (prettier/prettier)
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
2 changes: 1 addition & 1 deletion 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
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

Check failure on line 47 in src/guards/RoleChecks.ts

View workflow job for this annotation

GitHub Actions / ESLint

src/guards/RoleChecks.ts#L47

Delete `··` (prettier/prettier)
: argObj instanceof VoiceState

Check failure on line 48 in src/guards/RoleChecks.ts

View workflow job for this annotation

GitHub Actions / ESLint

src/guards/RoleChecks.ts#L48

Delete `··` (prettier/prettier)
? argObj.member?.user

Check failure on line 49 in src/guards/RoleChecks.ts

View workflow job for this annotation

GitHub Actions / ESLint

src/guards/RoleChecks.ts#L49

Replace `··········` with `······` (prettier/prettier)
: argObj instanceof Message

Check failure on line 50 in src/guards/RoleChecks.ts

View workflow job for this annotation

GitHub Actions / ESLint

src/guards/RoleChecks.ts#L50

Delete `····` (prettier/prettier)
? argObj.author

Check failure on line 51 in src/guards/RoleChecks.ts

View workflow job for this annotation

GitHub Actions / ESLint

src/guards/RoleChecks.ts#L51

Delete `······` (prettier/prettier)
: argObj instanceof SimpleCommandMessage

Check failure on line 52 in src/guards/RoleChecks.ts

View workflow job for this annotation

GitHub Actions / ESLint

src/guards/RoleChecks.ts#L52

Replace `············` with `······` (prettier/prettier)
? argObj.message.author

Check failure on line 53 in src/guards/RoleChecks.ts

View workflow job for this annotation

GitHub Actions / ESLint

src/guards/RoleChecks.ts#L53

Delete `········` (prettier/prettier)
: argObj instanceof CommandInteraction ||

Check failure on line 54 in src/guards/RoleChecks.ts

View workflow job for this annotation

GitHub Actions / ESLint

src/guards/RoleChecks.ts#L54

Delete `········` (prettier/prettier)
argObj instanceof ContextMenuCommandInteraction ||

Check failure on line 55 in src/guards/RoleChecks.ts

View workflow job for this annotation

GitHub Actions / ESLint

src/guards/RoleChecks.ts#L55

Replace `··················` with `········` (prettier/prettier)
argObj instanceof StringSelectMenuInteraction ||

Check failure on line 56 in src/guards/RoleChecks.ts

View workflow job for this annotation

GitHub Actions / ESLint

src/guards/RoleChecks.ts#L56

Replace `··················` with `········` (prettier/prettier)
argObj instanceof ButtonInteraction

Check failure on line 57 in src/guards/RoleChecks.ts

View workflow job for this annotation

GitHub Actions / ESLint

src/guards/RoleChecks.ts#L57

Delete `··········` (prettier/prettier)
? argObj.member?.user

Check failure on line 58 in src/guards/RoleChecks.ts

View workflow job for this annotation

GitHub Actions / ESLint

src/guards/RoleChecks.ts#L58

Delete `··········` (prettier/prettier)
: argObj?.message?.author

Check failure on line 59 in src/guards/RoleChecks.ts

View workflow job for this annotation

GitHub Actions / ESLint

src/guards/RoleChecks.ts#L59

Delete `··········` (prettier/prettier)
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

Check failure on line 78 in src/guards/RoleChecks.ts

View workflow job for this annotation

GitHub Actions / ESLint

src/guards/RoleChecks.ts#L78

Delete `··` (prettier/prettier)
: argObj instanceof VoiceState

Check failure on line 79 in src/guards/RoleChecks.ts

View workflow job for this annotation

GitHub Actions / ESLint

src/guards/RoleChecks.ts#L79

Delete `··` (prettier/prettier)
? argObj.member

Check failure on line 80 in src/guards/RoleChecks.ts

View workflow job for this annotation

GitHub Actions / ESLint

src/guards/RoleChecks.ts#L80

Replace `··········` with `······` (prettier/prettier)
: argObj instanceof Message

Check failure on line 81 in src/guards/RoleChecks.ts

View workflow job for this annotation

GitHub Actions / ESLint

src/guards/RoleChecks.ts#L81

Delete `····` (prettier/prettier)
? argObj.member

Check failure on line 82 in src/guards/RoleChecks.ts

View workflow job for this annotation

GitHub Actions / ESLint

src/guards/RoleChecks.ts#L82

Delete `······` (prettier/prettier)
: argObj instanceof SimpleCommandMessage

Check failure on line 83 in src/guards/RoleChecks.ts

View workflow job for this annotation

GitHub Actions / ESLint

src/guards/RoleChecks.ts#L83

Replace `············` with `······` (prettier/prettier)
? argObj.message.member

Check failure on line 84 in src/guards/RoleChecks.ts

View workflow job for this annotation

GitHub Actions / ESLint

src/guards/RoleChecks.ts#L84

Delete `········` (prettier/prettier)
: argObj instanceof CommandInteraction ||

Check failure on line 85 in src/guards/RoleChecks.ts

View workflow job for this annotation

GitHub Actions / ESLint

src/guards/RoleChecks.ts#L85

Delete `········` (prettier/prettier)
argObj instanceof ContextMenuCommandInteraction ||

Check failure on line 86 in src/guards/RoleChecks.ts

View workflow job for this annotation

GitHub Actions / ESLint

src/guards/RoleChecks.ts#L86

Replace `··················` with `········` (prettier/prettier)
argObj instanceof StringSelectMenuInteraction ||

Check failure on line 87 in src/guards/RoleChecks.ts

View workflow job for this annotation

GitHub Actions / ESLint

src/guards/RoleChecks.ts#L87

Replace `··················` with `········` (prettier/prettier)
argObj instanceof ButtonInteraction

Check failure on line 88 in src/guards/RoleChecks.ts

View workflow job for this annotation

GitHub Actions / ESLint

src/guards/RoleChecks.ts#L88

Delete `··········` (prettier/prettier)
? argObj.member

Check failure on line 89 in src/guards/RoleChecks.ts

View workflow job for this annotation

GitHub Actions / ESLint

src/guards/RoleChecks.ts#L89

Delete `··········` (prettier/prettier)
: argObj?.message?.member

Check failure on line 90 in src/guards/RoleChecks.ts

View workflow job for this annotation

GitHub Actions / ESLint

src/guards/RoleChecks.ts#L90

Delete `··········` (prettier/prettier)
if (memberIsSU(member)) {
await next()
}
Expand Down

0 comments on commit 7bb59d5

Please sign in to comment.