Skip to content

Commit

Permalink
feat: upgrade to [email protected] (#330)
Browse files Browse the repository at this point in the history
  • Loading branch information
book000 authored Aug 12, 2023
1 parent 783e006 commit c304170
Show file tree
Hide file tree
Showing 5 changed files with 117 additions and 177 deletions.
6 changes: 3 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,18 +22,18 @@
},
"devDependencies": {
"@types/config": "3.3.0",
"@types/node": "18.17.5",
"@types/node": "20.4.10",
"@typescript-eslint/eslint-plugin": "6.3.0",
"@typescript-eslint/parser": "6.3.0",
"config": "3.3.9",
"discord.js": "14.11.0",
"discord.js": "14.12.1",
"eslint": "8.47.0",
"eslint-config-prettier": "9.0.0",
"eslint-config-standard": "17.1.0",
"eslint-plugin-import": "2.28.0",
"eslint-plugin-n": "16.0.1",
"eslint-plugin-promise": "6.1.1",
"prettier": "2.8.8",
"prettier": "3.0.1",
"ts-node": "10.9.1",
"ts-node-dev": "2.0.0",
"typescript": "5.1.6",
Expand Down
6 changes: 3 additions & 3 deletions src/lib.ts
Original file line number Diff line number Diff line change
Expand Up @@ -70,15 +70,15 @@ export async function loadChannelPositions(client: Client) {
channel.parentId +
' -> ' +
p.parent +
')'
')',
)
await report(
client,
channel,
p.parent,
p.position,
channel.parentId,
channel.position
channel.position,
)
await channel.setParent(p.parent, {
lockPermissions: false,
Expand All @@ -97,7 +97,7 @@ async function report(
oldParentId: string | null,
oldPosition: number,
newParentId: string | null,
newPosition: number
newPosition: number,
) {
const reportChannelId = config.get<string>('reportChannelId')
const reportChannel = await client.channels.fetch(reportChannelId)
Expand Down
19 changes: 11 additions & 8 deletions src/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -70,12 +70,15 @@ client.on('interactionCreate', async (interaction) => {
await saveChannelPositions(client)
locked = false
await interaction.editReply(
'チャンネルの位置を移動できるようにしました。5分後に再度ロックされます。'
'チャンネルの位置を移動できるようにしました。5分後に再度ロックされます。',
)
setTimeout(
() => {
locked = true
interaction.editReply('5分経過したため、再ロックしました。')
},
5 * 60 * 1000,
)
setTimeout(() => {
locked = true
interaction.editReply('5分経過したため、再ロックしました。')
}, 5 * 60 * 1000)
}
if (command.name === 'position-save') {
await saveChannelPositions(client)
Expand Down Expand Up @@ -109,7 +112,7 @@ client.on(
'channelUpdate',
async (
oldTempChannel: DMChannel | NonThreadGuildBasedChannel,
newTempChannel: DMChannel | NonThreadGuildBasedChannel
newTempChannel: DMChannel | NonThreadGuildBasedChannel,
) => {
if (
oldTempChannel instanceof DMChannel &&
Expand All @@ -133,15 +136,15 @@ client.on(
oldChannel.name,
oldChannel.rawPosition,
newChannel.rawPosition,
oldChannel.rawPosition === newChannel.rawPosition
oldChannel.rawPosition === newChannel.rawPosition,
)

if (oldChannel.rawPosition === newChannel.rawPosition) return

loading = true
await loadChannelPositions(client)
loading = false
}
},
)

client
Expand Down
7 changes: 3 additions & 4 deletions tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
{
"ts-node": { "files": true },
"compilerOptions": {
"target": "es6",
"target": "es2020",
"module": "commonjs",
"moduleResolution": "Node",
"lib": ["ESNext", "ESNext.AsyncIterable", "DOM"],
"lib": ["es2020", "ESNext.AsyncIterable"],
"outDir": "./dist",
"removeComments": true,
"esModuleInterop": true,
Expand All @@ -25,6 +25,5 @@
"baseUrl": ".",
"newLine": "LF"
},
"include": ["src/**/*"],
"types": ["src/types/*.d.ts"]
"include": ["src/**/*"]
}
Loading

0 comments on commit c304170

Please sign in to comment.