feat: /tictactoe

This commit is contained in:
2022-09-10 23:25:54 +02:00
parent 2fb60152d2
commit c6add72cdc
6 changed files with 203 additions and 85 deletions

24
commands/fun/tictactoe.ts Normal file
View File

@@ -0,0 +1,24 @@
const TicTacToe = require("discord-tictactoe")
const { commandModule, CommandType } = require('@sern/handler');
import { publish } from "../../src/plugins/publish";
import { ownerOnly } from "../../src/plugins/ownerOnly"
import { ApplicationCommandOptionType } from "discord.js";
const game = new TicTacToe({language: 'en'})
export default commandModule({
name: 'tictactoe',
type: CommandType.Slash,
plugins: [publish({ guildIds: ['1000400148289036298', '928018226330337280'] })],
description: 'tres en raya',
//alias : [],
options: [
{
name: "opponent",
description: "opponent",
type: ApplicationCommandOptionType.User
}
],
execute: async (ctx, options) => {
await game.handleInteraction(ctx.interaction)
},
});

View File

@@ -1,6 +1,5 @@
const { EventType, eventModule } = require('@sern/handler');
export default eventModule({
type: EventType.Sern,
name : 'error',

199
package-lock.json generated
View File

@@ -15,6 +15,7 @@
"@xmldom/xmldom": "^0.8.2",
"axios": "^0.27.2",
"discord-bot-youtube-notifications": "^1.1.4",
"discord-tictactoe": "^4.0.0",
"discord.js": "^14.2.0",
"dotenv": "^16.0.1",
"express": "^4.18.1",
@@ -58,12 +59,12 @@
}
},
"node_modules/@discordjs/builders": {
"version": "1.1.0",
"resolved": "https://registry.npmjs.org/@discordjs/builders/-/builders-1.1.0.tgz",
"integrity": "sha512-EO8TSltiIc9Z1wE854wAFvv5AccqEtvjFmao9PPoxQhRaJ0hEb7FwWRTCA1jGg4ZWI3hcp4m+RET5ufZQz3rOg==",
"version": "1.2.0",
"resolved": "https://registry.npmjs.org/@discordjs/builders/-/builders-1.2.0.tgz",
"integrity": "sha512-ARy4BUTMU+S0ZI6605NDqfWO+qZqV2d/xfY32z3hVSsd9IaAKJBZ1ILTZLy87oIjW8+gUpQmk9Kt0ZP9bmmd8Q==",
"dependencies": {
"@sapphire/shapeshift": "^3.5.1",
"discord-api-types": "^0.36.3",
"discord-api-types": "^0.37.3",
"fast-deep-equal": "^3.1.3",
"ts-mixer": "^6.0.1",
"tslib": "^2.4.0"
@@ -72,10 +73,15 @@
"node": ">=16.9.0"
}
},
"node_modules/@discordjs/builders/node_modules/discord-api-types": {
"version": "0.37.8",
"resolved": "https://registry.npmjs.org/discord-api-types/-/discord-api-types-0.37.8.tgz",
"integrity": "sha512-uhol9KQ2moExZItMpuDMkf0R7sqqNHqcJBFN7S5iSdXBVCMRO7sC0GoyuRrv6ZDBYxoFU6nDy4dv0nld/aysqA=="
},
"node_modules/@discordjs/collection": {
"version": "1.0.1",
"resolved": "https://registry.npmjs.org/@discordjs/collection/-/collection-1.0.1.tgz",
"integrity": "sha512-5V/wswzR3r2RVYXLxxg4TvrAnBhVCNgHTXhC+OUtLoriJ072rPMHo+Iw1SS1vrCckp8Es40XM411+WkNRPaXFw==",
"version": "1.1.0",
"resolved": "https://registry.npmjs.org/@discordjs/collection/-/collection-1.1.0.tgz",
"integrity": "sha512-PQ2Bv6pnT7aGPCKWbvvNRww5tYCGpggIQVgpuF9TdDPeR6n6vQYxezXiLVOS9z2B62Dp4c+qepQ15SgJbLYtCQ==",
"engines": {
"node": ">=16.9.0"
}
@@ -113,22 +119,27 @@
}
},
"node_modules/@discordjs/rest": {
"version": "1.0.1",
"resolved": "https://registry.npmjs.org/@discordjs/rest/-/rest-1.0.1.tgz",
"integrity": "sha512-w08CTKVzzYYvKxEjXKOs9AdS7KQ1J502TrPfF8eCZ2lF6AfKuMP/32YgDakiwIyYTDjEQS/v0nKLSFcncHRMtg==",
"version": "1.1.0",
"resolved": "https://registry.npmjs.org/@discordjs/rest/-/rest-1.1.0.tgz",
"integrity": "sha512-yCrthRTQeUyNThQEpCk7bvQJlwQmz6kU0tf3dcWBv2WX3Bncl41x7Wc+v5b5OsIxfNYq38PvVtWircu9jtYZug==",
"dependencies": {
"@discordjs/collection": "^1.0.1",
"@sapphire/async-queue": "^1.3.2",
"@sapphire/async-queue": "^1.5.0",
"@sapphire/snowflake": "^3.2.2",
"discord-api-types": "^0.36.3",
"file-type": "^17.1.4",
"discord-api-types": "^0.37.3",
"file-type": "^17.1.6",
"tslib": "^2.4.0",
"undici": "^5.8.0"
"undici": "^5.9.1"
},
"engines": {
"node": ">=16.9.0"
}
},
"node_modules/@discordjs/rest/node_modules/discord-api-types": {
"version": "0.37.8",
"resolved": "https://registry.npmjs.org/discord-api-types/-/discord-api-types-0.37.8.tgz",
"integrity": "sha512-uhol9KQ2moExZItMpuDMkf0R7sqqNHqcJBFN7S5iSdXBVCMRO7sC0GoyuRrv6ZDBYxoFU6nDy4dv0nld/aysqA=="
},
"node_modules/@discordjs/voice": {
"version": "0.11.0",
"resolved": "https://registry.npmjs.org/@discordjs/voice/-/voice-0.11.0.tgz",
@@ -170,9 +181,9 @@
}
},
"node_modules/@sapphire/async-queue": {
"version": "1.3.2",
"resolved": "https://registry.npmjs.org/@sapphire/async-queue/-/async-queue-1.3.2.tgz",
"integrity": "sha512-rUpMLATsoAMnlN3gecAcr9Ecnw1vG7zi5Xr+IX22YzRzi1k9PF9vKzoT8RuEJbiIszjcimu3rveqUnvwDopz8g==",
"version": "1.5.0",
"resolved": "https://registry.npmjs.org/@sapphire/async-queue/-/async-queue-1.5.0.tgz",
"integrity": "sha512-JkLdIsP8fPAdh9ZZjrbHWR/+mZj0wvKS5ICibcLrRI1j84UmLMshx5n9QmL8b95d4onJ2xxiyugTgSAX7AalmA==",
"engines": {
"node": ">=v14.0.0",
"npm": ">=7.0.0"
@@ -950,27 +961,46 @@
"node": ">=10"
}
},
"node_modules/discord.js": {
"version": "14.2.0",
"resolved": "https://registry.npmjs.org/discord.js/-/discord.js-14.2.0.tgz",
"integrity": "sha512-kIGhEeOB1d9k7whL9HCCuRuzK2GL7i/hTesYINOZ2szWm4TOsBVwRU+i9O/zDb2M+Gvff4SJ4EpAtCVV0okgVw==",
"node_modules/discord-tictactoe": {
"version": "4.0.0",
"resolved": "https://registry.npmjs.org/discord-tictactoe/-/discord-tictactoe-4.0.0.tgz",
"integrity": "sha512-13BaBq/rIj71bb2du/IwGdlJwYlk8jAPpJHaOWQB4SqpFMJPeCFbjfdFo8f9rZfKrihTSraqmV2ZFecc2pHHQQ==",
"dependencies": {
"@discordjs/builders": "^1.1.0",
"@discordjs/collection": "^1.0.1",
"@discordjs/rest": "^1.0.1",
"discord.js": "^14.3.0"
},
"bin": {
"tictactoe": "dist/bin/tictactoe.js"
},
"engines": {
"node": ">= 16.9.0"
}
},
"node_modules/discord.js": {
"version": "14.3.0",
"resolved": "https://registry.npmjs.org/discord.js/-/discord.js-14.3.0.tgz",
"integrity": "sha512-CpIwoAAuELiHSgVKRMzsCADS6ZlJwAZ9RlvcJYdEgS00aW36dSvXyBgE+S3pigkc7G+jU6BEalMUWIJFveqrBQ==",
"dependencies": {
"@discordjs/builders": "^1.2.0",
"@discordjs/collection": "^1.1.0",
"@discordjs/rest": "^1.1.0",
"@sapphire/snowflake": "^3.2.2",
"@types/ws": "^8.5.3",
"discord-api-types": "^0.36.3",
"discord-api-types": "^0.37.3",
"fast-deep-equal": "^3.1.3",
"lodash.snakecase": "^4.1.1",
"tslib": "^2.4.0",
"undici": "^5.8.2",
"undici": "^5.9.1",
"ws": "^8.8.1"
},
"engines": {
"node": ">=16.9.0"
}
},
"node_modules/discord.js/node_modules/discord-api-types": {
"version": "0.37.8",
"resolved": "https://registry.npmjs.org/discord-api-types/-/discord-api-types-0.37.8.tgz",
"integrity": "sha512-uhol9KQ2moExZItMpuDMkf0R7sqqNHqcJBFN7S5iSdXBVCMRO7sC0GoyuRrv6ZDBYxoFU6nDy4dv0nld/aysqA=="
},
"node_modules/dotenv": {
"version": "16.0.1",
"resolved": "https://registry.npmjs.org/dotenv/-/dotenv-16.0.1.tgz",
@@ -1117,9 +1147,9 @@
}
},
"node_modules/file-type": {
"version": "17.1.5",
"resolved": "https://registry.npmjs.org/file-type/-/file-type-17.1.5.tgz",
"integrity": "sha512-GMZRKCpcCQgqV0L/8ZqlMZ5lLzH2GLYnAwnqen6fr8b0CHzQPP+R/vXHBOsa0m/R74gCZP3sQDpu6fUeIvyFEQ==",
"version": "17.1.6",
"resolved": "https://registry.npmjs.org/file-type/-/file-type-17.1.6.tgz",
"integrity": "sha512-hlDw5Ev+9e883s0pwUsuuYNu4tD7GgpUnOvykjv1Gya0ZIjuKumthDRua90VUn6/nlRKAjcxLUnHNTIUWwWIiw==",
"dependencies": {
"readable-web-to-node-stream": "^3.0.2",
"strtok3": "^7.0.0-alpha.9",
@@ -2574,9 +2604,9 @@
}
},
"node_modules/token-types": {
"version": "5.0.0",
"resolved": "https://registry.npmjs.org/token-types/-/token-types-5.0.0.tgz",
"integrity": "sha512-cza79xW1bo4pa6/AAZoOaZTlgNCgG3oCG7LQiGrfRFVl+XZvqiyc0+ncvlz+3XDIDNf9WcaT3Hcy6n/e1Tuc9A==",
"version": "5.0.1",
"resolved": "https://registry.npmjs.org/token-types/-/token-types-5.0.1.tgz",
"integrity": "sha512-Y2fmSnZjQdDb9W4w4r1tswlMHylzWIeOKpx0aZH9BgGtACHhrk3OkT52AzwcuqTRBZtvvnTjDBh8eynMulu8Vg==",
"dependencies": {
"@tokenizer/token": "^0.3.0",
"ieee754": "^1.2.1"
@@ -2705,9 +2735,9 @@
}
},
"node_modules/undici": {
"version": "5.8.2",
"resolved": "https://registry.npmjs.org/undici/-/undici-5.8.2.tgz",
"integrity": "sha512-3KLq3pXMS0Y4IELV045fTxqz04Nk9Ms7yfBBHum3yxsTR4XNn+ZCaUbf/mWitgYDAhsplQ0B1G4S5D345lMO3A==",
"version": "5.10.0",
"resolved": "https://registry.npmjs.org/undici/-/undici-5.10.0.tgz",
"integrity": "sha512-c8HsD3IbwmjjbLvoZuRI26TZic+TSEe8FPMLLOkN1AfYRhdjnKBU6yL+IwcSCbdZiX4e5t0lfMDLDCqj4Sq70g==",
"engines": {
"node": ">=12.18"
}
@@ -2857,21 +2887,28 @@
}
},
"@discordjs/builders": {
"version": "1.1.0",
"resolved": "https://registry.npmjs.org/@discordjs/builders/-/builders-1.1.0.tgz",
"integrity": "sha512-EO8TSltiIc9Z1wE854wAFvv5AccqEtvjFmao9PPoxQhRaJ0hEb7FwWRTCA1jGg4ZWI3hcp4m+RET5ufZQz3rOg==",
"version": "1.2.0",
"resolved": "https://registry.npmjs.org/@discordjs/builders/-/builders-1.2.0.tgz",
"integrity": "sha512-ARy4BUTMU+S0ZI6605NDqfWO+qZqV2d/xfY32z3hVSsd9IaAKJBZ1ILTZLy87oIjW8+gUpQmk9Kt0ZP9bmmd8Q==",
"requires": {
"@sapphire/shapeshift": "^3.5.1",
"discord-api-types": "^0.36.3",
"discord-api-types": "^0.37.3",
"fast-deep-equal": "^3.1.3",
"ts-mixer": "^6.0.1",
"tslib": "^2.4.0"
},
"dependencies": {
"discord-api-types": {
"version": "0.37.8",
"resolved": "https://registry.npmjs.org/discord-api-types/-/discord-api-types-0.37.8.tgz",
"integrity": "sha512-uhol9KQ2moExZItMpuDMkf0R7sqqNHqcJBFN7S5iSdXBVCMRO7sC0GoyuRrv6ZDBYxoFU6nDy4dv0nld/aysqA=="
}
}
},
"@discordjs/collection": {
"version": "1.0.1",
"resolved": "https://registry.npmjs.org/@discordjs/collection/-/collection-1.0.1.tgz",
"integrity": "sha512-5V/wswzR3r2RVYXLxxg4TvrAnBhVCNgHTXhC+OUtLoriJ072rPMHo+Iw1SS1vrCckp8Es40XM411+WkNRPaXFw=="
"version": "1.1.0",
"resolved": "https://registry.npmjs.org/@discordjs/collection/-/collection-1.1.0.tgz",
"integrity": "sha512-PQ2Bv6pnT7aGPCKWbvvNRww5tYCGpggIQVgpuF9TdDPeR6n6vQYxezXiLVOS9z2B62Dp4c+qepQ15SgJbLYtCQ=="
},
"@discordjs/node-pre-gyp": {
"version": "0.4.4",
@@ -2899,17 +2936,24 @@
}
},
"@discordjs/rest": {
"version": "1.0.1",
"resolved": "https://registry.npmjs.org/@discordjs/rest/-/rest-1.0.1.tgz",
"integrity": "sha512-w08CTKVzzYYvKxEjXKOs9AdS7KQ1J502TrPfF8eCZ2lF6AfKuMP/32YgDakiwIyYTDjEQS/v0nKLSFcncHRMtg==",
"version": "1.1.0",
"resolved": "https://registry.npmjs.org/@discordjs/rest/-/rest-1.1.0.tgz",
"integrity": "sha512-yCrthRTQeUyNThQEpCk7bvQJlwQmz6kU0tf3dcWBv2WX3Bncl41x7Wc+v5b5OsIxfNYq38PvVtWircu9jtYZug==",
"requires": {
"@discordjs/collection": "^1.0.1",
"@sapphire/async-queue": "^1.3.2",
"@sapphire/async-queue": "^1.5.0",
"@sapphire/snowflake": "^3.2.2",
"discord-api-types": "^0.36.3",
"file-type": "^17.1.4",
"discord-api-types": "^0.37.3",
"file-type": "^17.1.6",
"tslib": "^2.4.0",
"undici": "^5.8.0"
"undici": "^5.9.1"
},
"dependencies": {
"discord-api-types": {
"version": "0.37.8",
"resolved": "https://registry.npmjs.org/discord-api-types/-/discord-api-types-0.37.8.tgz",
"integrity": "sha512-uhol9KQ2moExZItMpuDMkf0R7sqqNHqcJBFN7S5iSdXBVCMRO7sC0GoyuRrv6ZDBYxoFU6nDy4dv0nld/aysqA=="
}
}
},
"@discordjs/voice": {
@@ -2947,9 +2991,9 @@
}
},
"@sapphire/async-queue": {
"version": "1.3.2",
"resolved": "https://registry.npmjs.org/@sapphire/async-queue/-/async-queue-1.3.2.tgz",
"integrity": "sha512-rUpMLATsoAMnlN3gecAcr9Ecnw1vG7zi5Xr+IX22YzRzi1k9PF9vKzoT8RuEJbiIszjcimu3rveqUnvwDopz8g=="
"version": "1.5.0",
"resolved": "https://registry.npmjs.org/@sapphire/async-queue/-/async-queue-1.5.0.tgz",
"integrity": "sha512-JkLdIsP8fPAdh9ZZjrbHWR/+mZj0wvKS5ICibcLrRI1j84UmLMshx5n9QmL8b95d4onJ2xxiyugTgSAX7AalmA=="
},
"@sapphire/shapeshift": {
"version": "3.5.1",
@@ -3559,22 +3603,37 @@
}
}
},
"discord.js": {
"version": "14.2.0",
"resolved": "https://registry.npmjs.org/discord.js/-/discord.js-14.2.0.tgz",
"integrity": "sha512-kIGhEeOB1d9k7whL9HCCuRuzK2GL7i/hTesYINOZ2szWm4TOsBVwRU+i9O/zDb2M+Gvff4SJ4EpAtCVV0okgVw==",
"discord-tictactoe": {
"version": "4.0.0",
"resolved": "https://registry.npmjs.org/discord-tictactoe/-/discord-tictactoe-4.0.0.tgz",
"integrity": "sha512-13BaBq/rIj71bb2du/IwGdlJwYlk8jAPpJHaOWQB4SqpFMJPeCFbjfdFo8f9rZfKrihTSraqmV2ZFecc2pHHQQ==",
"requires": {
"@discordjs/builders": "^1.1.0",
"@discordjs/collection": "^1.0.1",
"@discordjs/rest": "^1.0.1",
"discord.js": "^14.3.0"
}
},
"discord.js": {
"version": "14.3.0",
"resolved": "https://registry.npmjs.org/discord.js/-/discord.js-14.3.0.tgz",
"integrity": "sha512-CpIwoAAuELiHSgVKRMzsCADS6ZlJwAZ9RlvcJYdEgS00aW36dSvXyBgE+S3pigkc7G+jU6BEalMUWIJFveqrBQ==",
"requires": {
"@discordjs/builders": "^1.2.0",
"@discordjs/collection": "^1.1.0",
"@discordjs/rest": "^1.1.0",
"@sapphire/snowflake": "^3.2.2",
"@types/ws": "^8.5.3",
"discord-api-types": "^0.36.3",
"discord-api-types": "^0.37.3",
"fast-deep-equal": "^3.1.3",
"lodash.snakecase": "^4.1.1",
"tslib": "^2.4.0",
"undici": "^5.8.2",
"undici": "^5.9.1",
"ws": "^8.8.1"
},
"dependencies": {
"discord-api-types": {
"version": "0.37.8",
"resolved": "https://registry.npmjs.org/discord-api-types/-/discord-api-types-0.37.8.tgz",
"integrity": "sha512-uhol9KQ2moExZItMpuDMkf0R7sqqNHqcJBFN7S5iSdXBVCMRO7sC0GoyuRrv6ZDBYxoFU6nDy4dv0nld/aysqA=="
}
}
},
"dotenv": {
@@ -3700,9 +3759,9 @@
}
},
"file-type": {
"version": "17.1.5",
"resolved": "https://registry.npmjs.org/file-type/-/file-type-17.1.5.tgz",
"integrity": "sha512-GMZRKCpcCQgqV0L/8ZqlMZ5lLzH2GLYnAwnqen6fr8b0CHzQPP+R/vXHBOsa0m/R74gCZP3sQDpu6fUeIvyFEQ==",
"version": "17.1.6",
"resolved": "https://registry.npmjs.org/file-type/-/file-type-17.1.6.tgz",
"integrity": "sha512-hlDw5Ev+9e883s0pwUsuuYNu4tD7GgpUnOvykjv1Gya0ZIjuKumthDRua90VUn6/nlRKAjcxLUnHNTIUWwWIiw==",
"requires": {
"readable-web-to-node-stream": "^3.0.2",
"strtok3": "^7.0.0-alpha.9",
@@ -4745,9 +4804,9 @@
"integrity": "sha512-o5sSPKEkg/DIQNmH43V0/uerLrpzVedkUh8tGNvaeXpfpuwjKenlSox/2O/BTlZUtEe+JG7s5YhEz608PlAHRA=="
},
"token-types": {
"version": "5.0.0",
"resolved": "https://registry.npmjs.org/token-types/-/token-types-5.0.0.tgz",
"integrity": "sha512-cza79xW1bo4pa6/AAZoOaZTlgNCgG3oCG7LQiGrfRFVl+XZvqiyc0+ncvlz+3XDIDNf9WcaT3Hcy6n/e1Tuc9A==",
"version": "5.0.1",
"resolved": "https://registry.npmjs.org/token-types/-/token-types-5.0.1.tgz",
"integrity": "sha512-Y2fmSnZjQdDb9W4w4r1tswlMHylzWIeOKpx0aZH9BgGtACHhrk3OkT52AzwcuqTRBZtvvnTjDBh8eynMulu8Vg==",
"requires": {
"@tokenizer/token": "^0.3.0",
"ieee754": "^1.2.1"
@@ -4831,9 +4890,9 @@
"dev": true
},
"undici": {
"version": "5.8.2",
"resolved": "https://registry.npmjs.org/undici/-/undici-5.8.2.tgz",
"integrity": "sha512-3KLq3pXMS0Y4IELV045fTxqz04Nk9Ms7yfBBHum3yxsTR4XNn+ZCaUbf/mWitgYDAhsplQ0B1G4S5D345lMO3A=="
"version": "5.10.0",
"resolved": "https://registry.npmjs.org/undici/-/undici-5.10.0.tgz",
"integrity": "sha512-c8HsD3IbwmjjbLvoZuRI26TZic+TSEe8FPMLLOkN1AfYRhdjnKBU6yL+IwcSCbdZiX4e5t0lfMDLDCqj4Sq70g=="
},
"unpipe": {
"version": "1.0.0",

View File

@@ -31,6 +31,7 @@
"@xmldom/xmldom": "^0.8.2",
"axios": "^0.27.2",
"discord-bot-youtube-notifications": "^1.1.4",
"discord-tictactoe": "^4.0.0",
"discord.js": "^14.2.0",
"dotenv": "^16.0.1",
"express": "^4.18.1",

9
schemas/counting.js Normal file
View File

@@ -0,0 +1,9 @@
const mongoose = require('mongoose');
const schema = new mongoose.Schema({
number: {type: Number, required: true}
})
const db = new mongoose.Model('counting', schema)
module.exports = db;

View File

@@ -1,3 +1,22 @@
// @ts-nocheck
/**
* This is publish plugin, it allows you to publish your slash commands with ease.
*
* @author @EvolutionX-10 [<@697795666373640213>]
* @version 1.2.3
* @example
* ```ts
* import { publish } from "../plugins/publish";
* import { commandModule } from "@sern/handler";
* export default commandModule({
* plugins: [ publish() ], // put an object containing permissions, ids for guild commands, boolean for dmPermission
* // plugins: [ publish({ guildIds: ['guildId'], defaultMemberPermissions: 'Administrator'})]
* execute: (ctx) => {
* //your code here
* }
* })
* ```
*/
import {
CommandPlugin,
CommandType,
@@ -20,7 +39,6 @@ export function publish(
async execute({ client }, { mod: module }, controller) {
const defaultOptions = {
guildIds: [],
dmPermission: undefined,
defaultMemberPermissions: null,
};
@@ -35,22 +53,24 @@ export function publish(
console.error(e);
}
try {
const commandData: ApplicationCommandData = {
const commandData = {
type: CommandTypeRaw[module.type],
name: module.name!,
description: module.description,
options: optionsTransformer(module.options ?? []),
defaultMemberPermissions,
dmPermission,
};
} as ApplicationCommandData;
if (!guildIds.length) {
const cmd = (await client.application!.commands.fetch()).find(
(c) => c.name === module.name
);
const cmd = (
await client.application!.commands.fetch()
).find((c) => c.name === module.name);
if (cmd) {
if (!cmd.equals(commandData, true)) {
console.log(`Found differences in global command ${module.name}`);
console.log(
`Found differences in global command ${module.name}`
);
cmd.edit(commandData).then(() => {
console.log(
`${module.name} updated with new data successfully!`
@@ -76,7 +96,9 @@ export function publish(
);
if (guildcmd) {
if (!guildcmd.equals(commandData, true)) {
console.log(`Found differences in command ${module.name}`);
console.log(
`Found differences in command ${module.name}`
);
guildcmd
.edit(commandData)
.then(() =>
@@ -92,7 +114,11 @@ export function publish(
guild.commands
.create(commandData)
.then(() =>
console.log("Guild Command created", module.name!, guild.name)
console.log(
"Guild Command created",
module.name!,
guild.name
)
)
.catch(c);
}
@@ -119,9 +145,9 @@ export const CommandTypeRaw = {
[CommandType.Slash]: ApplicationCommandType.ChatInput,
} as const;
type NonEmptyArray<T extends string = string> = [T, ...T[]];
export type NonEmptyArray<T extends `${number}` = `${number}`> = [T, ...T[]];
interface ValidPublishOptions {
export interface ValidPublishOptions {
guildIds: string[];
dmPermission: boolean;
defaultMemberPermissions: PermissionResolvable;
@@ -133,17 +159,17 @@ interface GuildPublishOptions {
}
interface GlobalPublishOptions {
defaultMemberPermissions?: PermissionResolvable;
dmPermission?: boolean;
dmPermission?: false;
guildIds?: never;
}
type BasePublishOptions = GuildPublishOptions | GlobalPublishOptions;
type PublishOptions = BasePublishOptions &
export type PublishOptions = BasePublishOptions &
(
| Required<Pick<BasePublishOptions, "defaultMemberPermissions">>
| (
| Required<Pick<BasePublishOptions, "dmPermission">>
| Required<Pick<BasePublishOptions, "guildIds">>
)
);
);