mirror of
https://github.com/Hessenuk/DiscordTickets.git
synced 2024-12-23 08:13:09 +02:00
Finish "new" command, and other stuff
This commit is contained in:
parent
01519df0cf
commit
4b3ba238bd
@ -42,7 +42,6 @@
|
|||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"eslint": "^7.21.0",
|
"eslint": "^7.21.0",
|
||||||
"jsdoc": "^3.6.6",
|
|
||||||
"mariadb": "^2.5.2",
|
"mariadb": "^2.5.2",
|
||||||
"mysql2": "^2.2.5",
|
"mysql2": "^2.2.5",
|
||||||
"nodemon": "^2.0.7",
|
"nodemon": "^2.0.7",
|
||||||
|
130
pnpm-lock.yaml
130
pnpm-lock.yaml
@ -12,7 +12,6 @@ dependencies:
|
|||||||
terminal-link: 2.1.1
|
terminal-link: 2.1.1
|
||||||
devDependencies:
|
devDependencies:
|
||||||
eslint: 7.21.0
|
eslint: 7.21.0
|
||||||
jsdoc: 3.6.6
|
|
||||||
mariadb: 2.5.2
|
mariadb: 2.5.2
|
||||||
mysql2: 2.2.5
|
mysql2: 2.2.5
|
||||||
nodemon: 2.0.7
|
nodemon: 2.0.7
|
||||||
@ -86,13 +85,6 @@ packages:
|
|||||||
dev: true
|
dev: true
|
||||||
resolution:
|
resolution:
|
||||||
integrity: sha512-4vrIhfJyfNf+lCtXC2ck1rKSzDwciqF7IWFhXXrSOUC2O5DrVp+w4c6ed4AllTxhTkUP5x2tYj41VaxdVMMRDw==
|
integrity: sha512-4vrIhfJyfNf+lCtXC2ck1rKSzDwciqF7IWFhXXrSOUC2O5DrVp+w4c6ed4AllTxhTkUP5x2tYj41VaxdVMMRDw==
|
||||||
/@babel/parser/7.13.4:
|
|
||||||
dev: true
|
|
||||||
engines:
|
|
||||||
node: '>=6.0.0'
|
|
||||||
hasBin: true
|
|
||||||
resolution:
|
|
||||||
integrity: sha512-uvoOulWHhI+0+1f9L4BoozY7U5cIkZ9PgJqvb041d6vypgUmtVPG4vmGm4pSggjl8BELzvHyUeJSUyEMY6b+qA==
|
|
||||||
/@discordjs/collection/0.1.6:
|
/@discordjs/collection/0.1.6:
|
||||||
dev: false
|
dev: false
|
||||||
resolution:
|
resolution:
|
||||||
@ -416,10 +408,6 @@ packages:
|
|||||||
optional: true
|
optional: true
|
||||||
resolution:
|
resolution:
|
||||||
integrity: sha1-E+v+d4oDIFz+A3UUgeu0szAMEmo=
|
integrity: sha1-E+v+d4oDIFz+A3UUgeu0szAMEmo=
|
||||||
/bluebird/3.7.2:
|
|
||||||
dev: true
|
|
||||||
resolution:
|
|
||||||
integrity: sha512-XpNj6GDQzdfW+r2Wnn7xiSAd7TM3jzkxGXBGTtWKuSXv1xUV+azxAm8jdWZN06QTQk+2N2XB9jRDkvbmQmcRtg==
|
|
||||||
/boxen/4.2.0:
|
/boxen/4.2.0:
|
||||||
dependencies:
|
dependencies:
|
||||||
ansi-align: 3.0.0
|
ansi-align: 3.0.0
|
||||||
@ -516,14 +504,6 @@ packages:
|
|||||||
/caseless/0.12.0:
|
/caseless/0.12.0:
|
||||||
resolution:
|
resolution:
|
||||||
integrity: sha1-G2gcIf+EAzyCZUMJBolCDRhxUdw=
|
integrity: sha1-G2gcIf+EAzyCZUMJBolCDRhxUdw=
|
||||||
/catharsis/0.8.11:
|
|
||||||
dependencies:
|
|
||||||
lodash: 4.17.21
|
|
||||||
dev: true
|
|
||||||
engines:
|
|
||||||
node: '>= 8'
|
|
||||||
resolution:
|
|
||||||
integrity: sha512-a+xUyMV7hD1BrDQA/3iPV7oc+6W26BgVJO05PGEoatMyIuPScQKsde6i3YorWX1qs+AZjnJ18NqdKoCtKiNh1g==
|
|
||||||
/chalk/2.4.2:
|
/chalk/2.4.2:
|
||||||
dependencies:
|
dependencies:
|
||||||
ansi-styles: 3.2.1
|
ansi-styles: 3.2.1
|
||||||
@ -829,10 +809,6 @@ packages:
|
|||||||
node: '>=8.6'
|
node: '>=8.6'
|
||||||
resolution:
|
resolution:
|
||||||
integrity: sha512-yjNnPr315/FjS4zIsUxYguYUPP2e1NK4d7E7ZOLiyYCcbFBiTMyID+2wvm2w6+pZ/odMA7cRkjhsPbltwBOrLg==
|
integrity: sha512-yjNnPr315/FjS4zIsUxYguYUPP2e1NK4d7E7ZOLiyYCcbFBiTMyID+2wvm2w6+pZ/odMA7cRkjhsPbltwBOrLg==
|
||||||
/entities/2.0.3:
|
|
||||||
dev: true
|
|
||||||
resolution:
|
|
||||||
integrity: sha512-MyoZ0jgnLvB2X3Lg5HqpFmn1kybDiIfEQmKzTb5apr51Rb+T3KdmMiqa70T+bhGnyv7bQ6WMj2QMHpGMmlrUYQ==
|
|
||||||
/escape-goat/2.1.1:
|
/escape-goat/2.1.1:
|
||||||
dev: true
|
dev: true
|
||||||
engines:
|
engines:
|
||||||
@ -845,12 +821,6 @@ packages:
|
|||||||
node: '>=0.8.0'
|
node: '>=0.8.0'
|
||||||
resolution:
|
resolution:
|
||||||
integrity: sha1-G2HAViGQqN/2rjuyzwIAyhMLhtQ=
|
integrity: sha1-G2HAViGQqN/2rjuyzwIAyhMLhtQ=
|
||||||
/escape-string-regexp/2.0.0:
|
|
||||||
dev: true
|
|
||||||
engines:
|
|
||||||
node: '>=8'
|
|
||||||
resolution:
|
|
||||||
integrity: sha512-UpzcLCXolUWcNu5HtVMHYdXJjArjsF9C0aNnquZYY4uW/Vu0miy5YoWvbV345HauVvcAUnpRuhMMcqTcGOY2+w==
|
|
||||||
/eslint-scope/5.1.1:
|
/eslint-scope/5.1.1:
|
||||||
dependencies:
|
dependencies:
|
||||||
esrecurse: 4.3.0
|
esrecurse: 4.3.0
|
||||||
@ -1469,12 +1439,6 @@ packages:
|
|||||||
hasBin: true
|
hasBin: true
|
||||||
resolution:
|
resolution:
|
||||||
integrity: sha512-okMH7OXXJ7YrN9Ok3/SXrnu4iX9yOk+25nqX4imS2npuvTYDmo/QEZoqwZkYaIDk3jVvBOTOIEgEhaLOynBS9g==
|
integrity: sha512-okMH7OXXJ7YrN9Ok3/SXrnu4iX9yOk+25nqX4imS2npuvTYDmo/QEZoqwZkYaIDk3jVvBOTOIEgEhaLOynBS9g==
|
||||||
/js2xmlparser/4.0.1:
|
|
||||||
dependencies:
|
|
||||||
xmlcreate: 2.0.3
|
|
||||||
dev: true
|
|
||||||
resolution:
|
|
||||||
integrity: sha512-KrPTolcw6RocpYjdC7pL7v62e55q7qOMHvLX1UCLc5AAS8qeJ6nukarEJAF2KL2PZxlbGueEbINqZR2bDe/gUw==
|
|
||||||
/jsbi/3.1.4:
|
/jsbi/3.1.4:
|
||||||
dev: true
|
dev: true
|
||||||
resolution:
|
resolution:
|
||||||
@ -1482,28 +1446,6 @@ packages:
|
|||||||
/jsbn/0.1.1:
|
/jsbn/0.1.1:
|
||||||
resolution:
|
resolution:
|
||||||
integrity: sha1-peZUwuWi3rXyAdls77yoDA7y9RM=
|
integrity: sha1-peZUwuWi3rXyAdls77yoDA7y9RM=
|
||||||
/jsdoc/3.6.6:
|
|
||||||
dependencies:
|
|
||||||
'@babel/parser': 7.13.4
|
|
||||||
bluebird: 3.7.2
|
|
||||||
catharsis: 0.8.11
|
|
||||||
escape-string-regexp: 2.0.0
|
|
||||||
js2xmlparser: 4.0.1
|
|
||||||
klaw: 3.0.0
|
|
||||||
markdown-it: 10.0.0
|
|
||||||
markdown-it-anchor: 5.3.0_markdown-it@10.0.0
|
|
||||||
marked: 0.8.2
|
|
||||||
mkdirp: 1.0.4
|
|
||||||
requizzle: 0.2.3
|
|
||||||
strip-json-comments: 3.1.1
|
|
||||||
taffydb: 2.6.2
|
|
||||||
underscore: 1.10.2
|
|
||||||
dev: true
|
|
||||||
engines:
|
|
||||||
node: '>=8.15.0'
|
|
||||||
hasBin: true
|
|
||||||
resolution:
|
|
||||||
integrity: sha512-znR99e1BHeyEkSvgDDpX0sTiTu+8aQyDl9DawrkOGZTTW8hv0deIFXx87114zJ7gRaDZKVQD/4tr1ifmJp9xhQ==
|
|
||||||
/json-buffer/3.0.0:
|
/json-buffer/3.0.0:
|
||||||
dev: true
|
dev: true
|
||||||
resolution:
|
resolution:
|
||||||
@ -1564,12 +1506,6 @@ packages:
|
|||||||
dev: true
|
dev: true
|
||||||
resolution:
|
resolution:
|
||||||
integrity: sha512-9ykJ/46SN/9KPM/sichzQ7OvXyGDYKGTaDlKMGCAlg2UK8KRy4jb0d8sFc+0Tt0YYnThq8X2RZgCg74RPxgcVA==
|
integrity: sha512-9ykJ/46SN/9KPM/sichzQ7OvXyGDYKGTaDlKMGCAlg2UK8KRy4jb0d8sFc+0Tt0YYnThq8X2RZgCg74RPxgcVA==
|
||||||
/klaw/3.0.0:
|
|
||||||
dependencies:
|
|
||||||
graceful-fs: 4.2.6
|
|
||||||
dev: true
|
|
||||||
resolution:
|
|
||||||
integrity: sha512-0Fo5oir+O9jnXu5EefYbVK+mHMBeEVEy2cmctR1O1NECcCkPRreJKrS6Qt/j3KC2C148Dfo9i3pCmCMsdqGr0g==
|
|
||||||
/latest-version/5.1.0:
|
/latest-version/5.1.0:
|
||||||
dependencies:
|
dependencies:
|
||||||
package-json: 6.5.0
|
package-json: 6.5.0
|
||||||
@ -1611,12 +1547,6 @@ packages:
|
|||||||
node: '>= 0.8.0'
|
node: '>= 0.8.0'
|
||||||
resolution:
|
resolution:
|
||||||
integrity: sha512-+bT2uH4E5LGE7h/n3evcS/sQlJXCpIp6ym8OWJ5eV6+67Dsql/LaaT7qJBAt2rzfoa/5QBGBhxDix1dMt2kQKQ==
|
integrity: sha512-+bT2uH4E5LGE7h/n3evcS/sQlJXCpIp6ym8OWJ5eV6+67Dsql/LaaT7qJBAt2rzfoa/5QBGBhxDix1dMt2kQKQ==
|
||||||
/linkify-it/2.2.0:
|
|
||||||
dependencies:
|
|
||||||
uc.micro: 1.0.6
|
|
||||||
dev: true
|
|
||||||
resolution:
|
|
||||||
integrity: sha512-GnAl/knGn+i1U/wjBz3akz2stz+HrHLsxMwHQGofCDfPvlf+gDKN58UtfmUquTY4/MXeE2x7k19KQmeoZi94Iw==
|
|
||||||
/lodash/4.17.20:
|
/lodash/4.17.20:
|
||||||
resolution:
|
resolution:
|
||||||
integrity: sha512-PlhdFcillOINfeV7Ni6oF1TAEayyZBoZ8bcshTHqOYJYlrqzRK5hagpagky5o4HfCzzd1TRkXPMFq6cKk9rGmA==
|
integrity: sha512-PlhdFcillOINfeV7Ni6oF1TAEayyZBoZ8bcshTHqOYJYlrqzRK5hagpagky5o4HfCzzd1TRkXPMFq6cKk9rGmA==
|
||||||
@ -1676,36 +1606,6 @@ packages:
|
|||||||
node: '>= 10.13'
|
node: '>= 10.13'
|
||||||
resolution:
|
resolution:
|
||||||
integrity: sha512-SfaBl5/LiX2qJNNr7wCQvizVjtWxVm1CUWYKe+y4OMeyYMM6g0GhwX7/BbGtv/O3WthnGrM+Kj1imFnlescO0w==
|
integrity: sha512-SfaBl5/LiX2qJNNr7wCQvizVjtWxVm1CUWYKe+y4OMeyYMM6g0GhwX7/BbGtv/O3WthnGrM+Kj1imFnlescO0w==
|
||||||
/markdown-it-anchor/5.3.0_markdown-it@10.0.0:
|
|
||||||
dependencies:
|
|
||||||
markdown-it: 10.0.0
|
|
||||||
dev: true
|
|
||||||
peerDependencies:
|
|
||||||
markdown-it: '*'
|
|
||||||
resolution:
|
|
||||||
integrity: sha512-/V1MnLL/rgJ3jkMWo84UR+K+jF1cxNG1a+KwqeXqTIJ+jtA8aWSHuigx8lTzauiIjBDbwF3NcWQMotd0Dm39jA==
|
|
||||||
/markdown-it/10.0.0:
|
|
||||||
dependencies:
|
|
||||||
argparse: 1.0.10
|
|
||||||
entities: 2.0.3
|
|
||||||
linkify-it: 2.2.0
|
|
||||||
mdurl: 1.0.1
|
|
||||||
uc.micro: 1.0.6
|
|
||||||
dev: true
|
|
||||||
hasBin: true
|
|
||||||
resolution:
|
|
||||||
integrity: sha512-YWOP1j7UbDNz+TumYP1kpwnP0aEa711cJjrAQrzd0UXlbJfc5aAq0F/PZHjiioqDC1NKgvIMX+o+9Bk7yuM2dg==
|
|
||||||
/marked/0.8.2:
|
|
||||||
dev: true
|
|
||||||
engines:
|
|
||||||
node: '>= 8.16.2'
|
|
||||||
hasBin: true
|
|
||||||
resolution:
|
|
||||||
integrity: sha512-EGwzEeCcLniFX51DhTpmTom+dSA/MG/OBUDjnWtHbEnjAH180VzUeAw+oE4+Zv+CoYBWyRlYOTR0N8SO9R1PVw==
|
|
||||||
/mdurl/1.0.1:
|
|
||||||
dev: true
|
|
||||||
resolution:
|
|
||||||
integrity: sha1-/oWy7HWlkDfyrf7BAP1sYBdhFS4=
|
|
||||||
/mime-db/1.45.0:
|
/mime-db/1.45.0:
|
||||||
engines:
|
engines:
|
||||||
node: '>= 0.6'
|
node: '>= 0.6'
|
||||||
@ -1755,13 +1655,6 @@ packages:
|
|||||||
optional: true
|
optional: true
|
||||||
resolution:
|
resolution:
|
||||||
integrity: sha512-NKmAlESf6jMGym1++R0Ra7wvhV+wFW63FaSOFPwRahvea0gMUcGUhVeAg/0BC0wiv9ih5NYPB1Wn1UEI1/L+xQ==
|
integrity: sha512-NKmAlESf6jMGym1++R0Ra7wvhV+wFW63FaSOFPwRahvea0gMUcGUhVeAg/0BC0wiv9ih5NYPB1Wn1UEI1/L+xQ==
|
||||||
/mkdirp/1.0.4:
|
|
||||||
dev: true
|
|
||||||
engines:
|
|
||||||
node: '>=10'
|
|
||||||
hasBin: true
|
|
||||||
resolution:
|
|
||||||
integrity: sha512-vVqVZQyf3WLx2Shd0qJ9xuvqgAyKPLAiqITEtqW0oIUjzo3PePDd6fW9iFz30ef7Ysp/oiWqbhszeGWW2T6Gzw==
|
|
||||||
/moment-timezone/0.5.33:
|
/moment-timezone/0.5.33:
|
||||||
dependencies:
|
dependencies:
|
||||||
moment: 2.29.1
|
moment: 2.29.1
|
||||||
@ -2347,12 +2240,6 @@ packages:
|
|||||||
node: '>=0.10.0'
|
node: '>=0.10.0'
|
||||||
resolution:
|
resolution:
|
||||||
integrity: sha512-Xf0nWe6RseziFMu+Ap9biiUbmplq6S9/p+7w7YXP/JBHhrUDDUhwa+vANyubuqfZWTveU//DYVGsDG7RKL/vEw==
|
integrity: sha512-Xf0nWe6RseziFMu+Ap9biiUbmplq6S9/p+7w7YXP/JBHhrUDDUhwa+vANyubuqfZWTveU//DYVGsDG7RKL/vEw==
|
||||||
/requizzle/0.2.3:
|
|
||||||
dependencies:
|
|
||||||
lodash: 4.17.21
|
|
||||||
dev: true
|
|
||||||
resolution:
|
|
||||||
integrity: sha512-YanoyJjykPxGHii0fZP0uUPEXpvqfBDxWV7s6GKAiiOsiqhX6vHNyW3Qzdmqp/iq/ExbhaGbVrjB4ruEVSM4GQ==
|
|
||||||
/resolve-from/4.0.0:
|
/resolve-from/4.0.0:
|
||||||
dev: true
|
dev: true
|
||||||
engines:
|
engines:
|
||||||
@ -2698,10 +2585,6 @@ packages:
|
|||||||
node: '>=10.0.0'
|
node: '>=10.0.0'
|
||||||
resolution:
|
resolution:
|
||||||
integrity: sha512-rxZevLGTUzWna/qBLObOe16kB2RTnnbhciwgPbMMlazz1yZGVEgnZK762xyVdVznhqxrfCeBMmMkgOOaPwjH7g==
|
integrity: sha512-rxZevLGTUzWna/qBLObOe16kB2RTnnbhciwgPbMMlazz1yZGVEgnZK762xyVdVznhqxrfCeBMmMkgOOaPwjH7g==
|
||||||
/taffydb/2.6.2:
|
|
||||||
dev: true
|
|
||||||
resolution:
|
|
||||||
integrity: sha1-fLy2S1oUG2ou/CxdLGe04VCyomg=
|
|
||||||
/tar/2.2.2:
|
/tar/2.2.2:
|
||||||
dependencies:
|
dependencies:
|
||||||
block-stream: 0.0.9
|
block-stream: 0.0.9
|
||||||
@ -2865,20 +2748,12 @@ packages:
|
|||||||
dev: true
|
dev: true
|
||||||
resolution:
|
resolution:
|
||||||
integrity: sha512-zdu8XMNEDepKKR+XYOXAVPtWui0ly0NtohUscw+UmaHiAWT8hrV1rr//H6V+0DvJ3OQ19S979M0laLfX8rm82Q==
|
integrity: sha512-zdu8XMNEDepKKR+XYOXAVPtWui0ly0NtohUscw+UmaHiAWT8hrV1rr//H6V+0DvJ3OQ19S979M0laLfX8rm82Q==
|
||||||
/uc.micro/1.0.6:
|
|
||||||
dev: true
|
|
||||||
resolution:
|
|
||||||
integrity: sha512-8Y75pvTYkLJW2hWQHXxoqRgV7qb9B+9vFEtidML+7koHUFapnVJAZ6cKs+Qjz5Aw3aZWHMC6u0wJE3At+nSGwA==
|
|
||||||
/undefsafe/2.0.3:
|
/undefsafe/2.0.3:
|
||||||
dependencies:
|
dependencies:
|
||||||
debug: 2.6.9
|
debug: 2.6.9
|
||||||
dev: true
|
dev: true
|
||||||
resolution:
|
resolution:
|
||||||
integrity: sha512-nrXZwwXrD/T/JXeygJqdCO6NZZ1L66HrxM/Z7mIq2oPanoN0F1nLx3lwJMu6AwJY69hdixaFQOuoYsMjE5/C2A==
|
integrity: sha512-nrXZwwXrD/T/JXeygJqdCO6NZZ1L66HrxM/Z7mIq2oPanoN0F1nLx3lwJMu6AwJY69hdixaFQOuoYsMjE5/C2A==
|
||||||
/underscore/1.10.2:
|
|
||||||
dev: true
|
|
||||||
resolution:
|
|
||||||
integrity: sha512-N4P+Q/BuyuEKFJ43B9gYuOj4TQUHXX+j2FqguVOpjkssLUUrnJofCcBccJSCoeturDoZU6GorDTHSvUDlSQbTg==
|
|
||||||
/underscore/1.12.0:
|
/underscore/1.12.0:
|
||||||
dev: true
|
dev: true
|
||||||
resolution:
|
resolution:
|
||||||
@ -3061,10 +2936,6 @@ packages:
|
|||||||
node: '>=4.0'
|
node: '>=4.0'
|
||||||
resolution:
|
resolution:
|
||||||
integrity: sha512-fDlsI/kFEx7gLvbecc0/ohLG50fugQp8ryHzMTuW9vSa1GJ0XYWKnhsUx7oie3G98+r56aTQIUB4kht42R3JvA==
|
integrity: sha512-fDlsI/kFEx7gLvbecc0/ohLG50fugQp8ryHzMTuW9vSa1GJ0XYWKnhsUx7oie3G98+r56aTQIUB4kht42R3JvA==
|
||||||
/xmlcreate/2.0.3:
|
|
||||||
dev: true
|
|
||||||
resolution:
|
|
||||||
integrity: sha512-HgS+X6zAztGa9zIK3Y3LXuJes33Lz9x+YyTxgrkIdabu2vqcGOWwdfCpf1hWLRrd553wd4QCDf6BBO6FfdsRiQ==
|
|
||||||
/xmldom/0.4.0:
|
/xmldom/0.4.0:
|
||||||
dev: true
|
dev: true
|
||||||
engines:
|
engines:
|
||||||
@ -3102,7 +2973,6 @@ specifiers:
|
|||||||
dotenv: ^8.2.0
|
dotenv: ^8.2.0
|
||||||
eslint: ^7.21.0
|
eslint: ^7.21.0
|
||||||
fs-extra: ^9.1.0
|
fs-extra: ^9.1.0
|
||||||
jsdoc: ^3.6.6
|
|
||||||
leeks.js: ^0.0.9
|
leeks.js: ^0.0.9
|
||||||
leekslazylogger-fastify: ^0.1.0
|
leekslazylogger-fastify: ^0.1.0
|
||||||
mariadb: ^2.5.2
|
mariadb: ^2.5.2
|
||||||
|
33
src/commands/close.js
Normal file
33
src/commands/close.js
Normal file
@ -0,0 +1,33 @@
|
|||||||
|
const { MessageEmbed } = require('discord.js');
|
||||||
|
const Command = require('../modules/commands/command');
|
||||||
|
const { footer } = require('../utils/discord');
|
||||||
|
|
||||||
|
module.exports = class CloseCommand extends Command {
|
||||||
|
constructor(client) {
|
||||||
|
const i18n = client.i18n.get(client.config.locale);
|
||||||
|
super(client, {
|
||||||
|
internal: true,
|
||||||
|
name: i18n('commands.close.name'),
|
||||||
|
description: i18n('commands.close.description'),
|
||||||
|
aliases: [
|
||||||
|
i18n('commands.close.aliases.delete'),
|
||||||
|
],
|
||||||
|
process_args: false,
|
||||||
|
args: [
|
||||||
|
{
|
||||||
|
name: i18n('commands.close.args.ticket.name'),
|
||||||
|
description: i18n('commands.close.args.ticket.description'),
|
||||||
|
example: i18n('commands.close.args.ticket.example'),
|
||||||
|
required: false,
|
||||||
|
}
|
||||||
|
]
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
async execute(message, args) {
|
||||||
|
|
||||||
|
let settings = await message.guild.settings;
|
||||||
|
const i18n = this.client.i18n.get(settings.locale);
|
||||||
|
|
||||||
|
}
|
||||||
|
};
|
@ -1,5 +1,7 @@
|
|||||||
const { MessageEmbed } = require('discord.js');
|
const { MessageEmbed } = require('discord.js');
|
||||||
const Command = require('../modules/commands/command');
|
const Command = require('../modules/commands/command');
|
||||||
|
const { footer } = require('../utils/discord');
|
||||||
|
const { letters } = require('../utils/emoji');
|
||||||
|
|
||||||
module.exports = class NewCommand extends Command {
|
module.exports = class NewCommand extends Command {
|
||||||
constructor(client) {
|
constructor(client) {
|
||||||
@ -29,27 +31,131 @@ module.exports = class NewCommand extends Command {
|
|||||||
let settings = await message.guild.settings;
|
let settings = await message.guild.settings;
|
||||||
const i18n = this.client.i18n.get(settings.locale);
|
const i18n = this.client.i18n.get(settings.locale);
|
||||||
|
|
||||||
let { count: cat_count, rows: categories } = await this.client.db.models.Category.findAndCountAll({
|
const editOrSend = async (msg, content) => {
|
||||||
|
if (msg) return await msg.edit(content);
|
||||||
|
else return await message.channel.send(content);
|
||||||
|
};
|
||||||
|
|
||||||
|
const create = async (cat_row, response) => {
|
||||||
|
let tickets = await this.client.db.models.Ticket.findAndCountAll({
|
||||||
|
where: {
|
||||||
|
category: cat_row.id,
|
||||||
|
creator: message.author.id,
|
||||||
|
open: true
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
if (tickets.count >= cat_row.max_per_member) {
|
||||||
|
if (cat_row.max_per_member === 1) {
|
||||||
|
response = await editOrSend(response,
|
||||||
|
new MessageEmbed()
|
||||||
|
.setColor(settings.error_colour)
|
||||||
|
.setAuthor(message.author.username, message.author.displayAvatarURL())
|
||||||
|
.setTitle(i18n('commands.new.response.has_a_ticket.title'))
|
||||||
|
.setDescription(i18n('commands.new.response.has_a_ticket.description', tickets.rows[0].id))
|
||||||
|
.setFooter(footer(settings.footer, i18n('message_will_be_deleted_in', 15)), message.guild.iconURL())
|
||||||
|
);
|
||||||
|
} else {
|
||||||
|
let list = tickets.rows.map(row => {
|
||||||
|
if (row.topic) {
|
||||||
|
let description = row.topic.substring(0, 30);
|
||||||
|
let ellipses = description.length > 30 ? '...' : '';
|
||||||
|
return `<#${row.id}>: \`${description}${ellipses}\``;
|
||||||
|
} else {
|
||||||
|
return `<#${row.id}>`;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
response = await editOrSend(response,
|
||||||
|
new MessageEmbed()
|
||||||
|
.setColor(settings.error_colour)
|
||||||
|
.setAuthor(message.author.username, message.author.displayAvatarURL())
|
||||||
|
.setTitle(i18n('commands.new.response.max_tickets.title', tickets.count))
|
||||||
|
.setDescription(i18n('commands.new.response.max_tickets.description', settings.command_prefix, list.join('\n')))
|
||||||
|
.setFooter(footer(settings.footer, i18n('message_will_be_deleted_in', 15)), message.guild.iconURL())
|
||||||
|
);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
let t_row = await this.client.tickets.create(message.guild.id, message.author.id, cat_row.id, args);
|
||||||
|
response = await editOrSend(response,
|
||||||
|
new MessageEmbed()
|
||||||
|
.setColor(settings.success_colour)
|
||||||
|
.setAuthor(message.author.username, message.author.displayAvatarURL())
|
||||||
|
.setTitle(i18n('commands.new.response.created.title'))
|
||||||
|
.setDescription(i18n('commands.new.response.created.description', `<#${t_row.id}>`))
|
||||||
|
.setFooter(footer(settings.footer, i18n('message_will_be_deleted_in', 15)), message.guild.iconURL())
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
setTimeout(async () => {
|
||||||
|
await response.delete();
|
||||||
|
await message.delete();
|
||||||
|
}, 15000);
|
||||||
|
};
|
||||||
|
|
||||||
|
let categories = await this.client.db.models.Category.findAndCountAll({
|
||||||
where: {
|
where: {
|
||||||
guild: message.guild.id
|
guild: message.guild.id
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
switch (cat_count) {
|
if (categories.count === 0) {
|
||||||
case 0:
|
|
||||||
return await message.channel.send(
|
return await message.channel.send(
|
||||||
new MessageEmbed()
|
new MessageEmbed()
|
||||||
.setColor(settings.error_colour)
|
.setColor(settings.error_colour)
|
||||||
|
.setAuthor(message.author.username, message.author.displayAvatarURL())
|
||||||
.setTitle(i18n('commands.new.response.no_categories.title'))
|
.setTitle(i18n('commands.new.response.no_categories.title'))
|
||||||
.setDescription(i18n('commands.new.response.no_categories.description'))
|
.setDescription(i18n('commands.new.response.no_categories.description'))
|
||||||
|
.setFooter(settings.footer, message.guild.iconURL())
|
||||||
);
|
);
|
||||||
case 1:
|
} else if (categories.count === 1) {
|
||||||
break;
|
create(categories.rows[0]);
|
||||||
default:
|
} else {
|
||||||
|
let letters_array = Object.values(letters);
|
||||||
|
let category_list = categories.rows.map((category, i) => `${letters_array[i]} » ${category.name}`);
|
||||||
|
let collector_message = await message.channel.send(
|
||||||
|
new MessageEmbed()
|
||||||
|
.setColor(settings.colour)
|
||||||
|
.setAuthor(message.author.username, message.author.displayAvatarURL())
|
||||||
|
.setTitle(i18n('commands.new.response.select_category.title'))
|
||||||
|
.setDescription(i18n('commands.new.response.select_category.description', category_list.join('\n')))
|
||||||
|
.setFooter(footer(settings.footer, i18n('collector_expires_in', 30)), message.guild.iconURL())
|
||||||
|
);
|
||||||
|
|
||||||
|
for (let i in categories.rows) {
|
||||||
|
await collector_message.react(letters_array[i]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const collector_filter = (reaction, user) => {
|
||||||
|
let allowed = letters_array.slice(0, categories.count);
|
||||||
|
return user.id === message.author.id && allowed.includes(reaction.emoji.name);
|
||||||
|
};
|
||||||
|
|
||||||
|
let collector = collector_message.createReactionCollector(collector_filter, {
|
||||||
|
time: 30000
|
||||||
|
});
|
||||||
|
|
||||||
|
collector.on('collect', async (reaction) => {
|
||||||
|
let index = letters_array.findIndex(value => value === reaction.emoji.name);
|
||||||
|
if (index === -1) return await collector_message.delete({ timeout: 15000 });
|
||||||
|
await collector_message.reactions.removeAll();
|
||||||
|
create(categories.rows[index], collector_message);
|
||||||
|
});
|
||||||
|
|
||||||
|
collector.on('end', async (collected) => {
|
||||||
|
if (collected.size === 0) {
|
||||||
|
await collector_message.reactions.removeAll();
|
||||||
|
await collector_message.edit(
|
||||||
|
new MessageEmbed()
|
||||||
|
.setColor(settings.error_colour)
|
||||||
|
.setAuthor(message.author.username, message.author.displayAvatarURL())
|
||||||
|
.setTitle(i18n('commands.new.response.select_category_timeout.title'))
|
||||||
|
.setDescription(i18n('commands.new.response.select_category_timeout.description', category_list.join('\n')))
|
||||||
|
.setFooter(footer(settings.footer, i18n('message_will_be_deleted_in', 15)), message.guild.iconURL())
|
||||||
|
);
|
||||||
|
collector_message.delete({ timeout: 15000 });
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
// this.client.tickets.create(message.guild.id, message.member.id, '825861413687787560', args.topic);
|
|
||||||
}
|
}
|
||||||
};
|
};
|
@ -31,6 +31,7 @@ module.exports = class SettingsCommand extends Command {
|
|||||||
settings.colour = data.colour;
|
settings.colour = data.colour;
|
||||||
settings.command_prefix = data.command_prefix;
|
settings.command_prefix = data.command_prefix;
|
||||||
settings.error_colour = data.error_colour;
|
settings.error_colour = data.error_colour;
|
||||||
|
settings.footer = data.footer;
|
||||||
settings.locale = data.locale;
|
settings.locale = data.locale;
|
||||||
settings.log_messages = data.log_messages;
|
settings.log_messages = data.log_messages;
|
||||||
settings.success_colour = data.success_colour;
|
settings.success_colour = data.success_colour;
|
||||||
@ -114,6 +115,7 @@ module.exports = class SettingsCommand extends Command {
|
|||||||
colour: settings.colour,
|
colour: settings.colour,
|
||||||
command_prefix: settings.command_prefix,
|
command_prefix: settings.command_prefix,
|
||||||
error_colour: settings.error_colour,
|
error_colour: settings.error_colour,
|
||||||
|
footer: settings.footer,
|
||||||
locale: settings.locale,
|
locale: settings.locale,
|
||||||
log_messages: settings.log_messages,
|
log_messages: settings.log_messages,
|
||||||
success_colour: settings.success_colour,
|
success_colour: settings.success_colour,
|
||||||
|
@ -6,7 +6,7 @@ const { path } = require('../utils/fs');
|
|||||||
const config = require('../../user/config');
|
const config = require('../../user/config');
|
||||||
const types = require('./dialects');
|
const types = require('./dialects');
|
||||||
|
|
||||||
module.exports = async (log) => {
|
module.exports = async (client) => {
|
||||||
|
|
||||||
const {
|
const {
|
||||||
DB_TYPE,
|
DB_TYPE,
|
||||||
@ -22,7 +22,7 @@ module.exports = async (log) => {
|
|||||||
|
|
||||||
const supported = Object.keys(types);
|
const supported = Object.keys(types);
|
||||||
if (!supported.includes(type)) {
|
if (!supported.includes(type)) {
|
||||||
log.error(new Error(`DB_TYPE (${type}) is not a valid type`));
|
client.log.error(new Error(`DB_TYPE (${type}) is not a valid type`));
|
||||||
return process.exit();
|
return process.exit();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -30,35 +30,35 @@ module.exports = async (log) => {
|
|||||||
types[type].packages.forEach(pkg => require(pkg));
|
types[type].packages.forEach(pkg => require(pkg));
|
||||||
} catch {
|
} catch {
|
||||||
let required = types[type].packages.map(i => `"${i}"`).join(' and ');
|
let required = types[type].packages.map(i => `"${i}"`).join(' and ');
|
||||||
log.error(new Error(`Please install the package(s) for your selected database type: ${required}`));
|
client.log.error(new Error(`Please install the package(s) for your selected database type: ${required}`));
|
||||||
return process.exit();
|
return process.exit();
|
||||||
}
|
}
|
||||||
|
|
||||||
let sequelize;
|
let sequelize;
|
||||||
|
|
||||||
if (type === 'sqlite') {
|
if (type === 'sqlite') {
|
||||||
log.info('Using SQLite storage');
|
client.log.info('Using SQLite storage');
|
||||||
sequelize = new Sequelize({
|
sequelize = new Sequelize({
|
||||||
dialect: types[type].dialect,
|
dialect: types[type].dialect,
|
||||||
storage: path('./user/database.sqlite'),
|
storage: path('./user/database.sqlite'),
|
||||||
logging: text => log.debug(text)
|
logging: text => client.log.debug(text)
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
log.info(`Connecting to ${types[type].name} database...`);
|
client.log.info(`Connecting to ${types[type].name} database...`);
|
||||||
sequelize = new Sequelize(DB_NAME, DB_USER, DB_PASS, {
|
sequelize = new Sequelize(DB_NAME, DB_USER, DB_PASS, {
|
||||||
dialect: types[type].dialect,
|
dialect: types[type].dialect,
|
||||||
host: DB_HOST,
|
host: DB_HOST,
|
||||||
port: DB_PORT,
|
port: DB_PORT,
|
||||||
logging: text => log.debug(text)
|
logging: text => client.log.debug(text)
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
await sequelize.authenticate();
|
await sequelize.authenticate();
|
||||||
log.success('Connected to database successfully');
|
client.log.success('Connected to database successfully');
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
log.warn('Failed to connect to database');
|
client.log.warn('Failed to connect to database');
|
||||||
log.error(error);
|
client.log.error(error);
|
||||||
return process.exit();
|
return process.exit();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -92,6 +92,10 @@ module.exports = async (log) => {
|
|||||||
type: DataTypes.BOOLEAN,
|
type: DataTypes.BOOLEAN,
|
||||||
defaultValue: config.defaults.log_messages
|
defaultValue: config.defaults.log_messages
|
||||||
},
|
},
|
||||||
|
footer: {
|
||||||
|
type: DataTypes.STRING,
|
||||||
|
defaultValue: 'Discord Tickets by eartharoid'
|
||||||
|
},
|
||||||
}, {
|
}, {
|
||||||
tableName: DB_TABLE_PREFIX + 'guilds'
|
tableName: DB_TABLE_PREFIX + 'guilds'
|
||||||
});
|
});
|
||||||
@ -160,6 +164,10 @@ module.exports = async (log) => {
|
|||||||
key: 'id'
|
key: 'id'
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
topic: {
|
||||||
|
type: DataTypes.STRING,
|
||||||
|
allowNull: true,
|
||||||
|
},
|
||||||
creator: {
|
creator: {
|
||||||
type: DataTypes.CHAR(18),
|
type: DataTypes.CHAR(18),
|
||||||
allowNull: false,
|
allowNull: false,
|
||||||
|
@ -97,15 +97,15 @@ class Bot extends Client {
|
|||||||
/** The global bot configuration */
|
/** The global bot configuration */
|
||||||
this.config = config;
|
this.config = config;
|
||||||
|
|
||||||
/** A sequelize instance */
|
|
||||||
this.db = await require('./database')(log), // this.db.models.Ticket...
|
|
||||||
|
|
||||||
/** A leekslazylogger instance */
|
/** A leekslazylogger instance */
|
||||||
this.log = log;
|
this.log = log;
|
||||||
|
|
||||||
/** An @eartharoid/i18n instance */
|
/** An @eartharoid/i18n instance */
|
||||||
this.i18n = new I18n(path('./src/locales'), 'en-GB');
|
this.i18n = new I18n(path('./src/locales'), 'en-GB');
|
||||||
|
|
||||||
|
/** A sequelize instance */
|
||||||
|
this.db = await require('./database')(this), // this.db.models.Ticket...
|
||||||
|
|
||||||
this.setMaxListeners(this.config.max_listeners); // set the max listeners for each event
|
this.setMaxListeners(this.config.max_listeners); // set the max listeners for each event
|
||||||
|
|
||||||
require('./updater')(this); // check for updates
|
require('./updater')(this); // check for updates
|
||||||
|
@ -4,18 +4,26 @@
|
|||||||
},
|
},
|
||||||
"cmd_usage": {
|
"cmd_usage": {
|
||||||
"args": {
|
"args": {
|
||||||
"description": "**Description:**",
|
"description": "**Description:** %s",
|
||||||
"example": "**Example:**"
|
"example": "**Example:** `%s`"
|
||||||
},
|
},
|
||||||
"description": "**Usage:**\n`%s`\n\n**Example:**\n`%s`\n\nRequired arguments are prefixed with `❗`.",
|
"description": "**Usage:**\n`%s`\n\n**Example:**\n`%s`\n\nRequired arguments are prefixed with `❗`.",
|
||||||
"named_args": "This command uses named arguments.\n\n",
|
"named_args": "This command uses named arguments.\n\n",
|
||||||
"title": "`%s` command usage"
|
"title": "`%s` command usage"
|
||||||
},
|
},
|
||||||
|
"collector_expires_in": "Expires in %d seconds",
|
||||||
"commands": {
|
"commands": {
|
||||||
"close": {
|
"close": {
|
||||||
"aliases": {
|
"aliases": {
|
||||||
"delete": "delete"
|
"delete": "delete"
|
||||||
},
|
},
|
||||||
|
"args": {
|
||||||
|
"ticket": {
|
||||||
|
"name": "ticket",
|
||||||
|
"description": "The number or a channel mention of the ticket to close",
|
||||||
|
"example": "217"
|
||||||
|
}
|
||||||
|
},
|
||||||
"description": "Close a ticket channel",
|
"description": "Close a ticket channel",
|
||||||
"name": "close",
|
"name": "close",
|
||||||
"response": {
|
"response": {
|
||||||
@ -31,10 +39,6 @@
|
|||||||
"open": "open"
|
"open": "open"
|
||||||
},
|
},
|
||||||
"args": {
|
"args": {
|
||||||
"category": {
|
|
||||||
"name": "category",
|
|
||||||
"description": "The category you would like to create a new ticket for"
|
|
||||||
},
|
|
||||||
"topic": {
|
"topic": {
|
||||||
"name": "topic",
|
"name": "topic",
|
||||||
"description": "The topic of the ticket",
|
"description": "The topic of the ticket",
|
||||||
@ -46,11 +50,27 @@
|
|||||||
"response": {
|
"response": {
|
||||||
"created": {
|
"created": {
|
||||||
"title": "✅ Ticket created",
|
"title": "✅ Ticket created",
|
||||||
"description": ""
|
"description": "Your ticket has been created: %s."
|
||||||
|
},
|
||||||
|
"has_a_ticket": {
|
||||||
|
"title": "❌ You already have an open ticket",
|
||||||
|
"description": "Please use your existing ticket (<#%s>) or close it before creating another."
|
||||||
|
},
|
||||||
|
"max_tickets": {
|
||||||
|
"title": "❌ You already have %d open tickets",
|
||||||
|
"description": "Please use `%sclose` to close any unneeded tickets.\n\n%s"
|
||||||
},
|
},
|
||||||
"no_categories": {
|
"no_categories": {
|
||||||
"title": "❌ Can't create ticket",
|
"title": "❌ Can't create ticket",
|
||||||
"description": "A server administrator must create at least one ticket category before a new ticket can be opened."
|
"description": "A server administrator must create at least one ticket category before a new ticket can be opened."
|
||||||
|
},
|
||||||
|
"select_category": {
|
||||||
|
"title": "Please select the ticket category",
|
||||||
|
"description": "Select the category most relevant to your ticket's topic:\n\n%s"
|
||||||
|
},
|
||||||
|
"select_category_timeout": {
|
||||||
|
"title": "❌ Reaction time expired",
|
||||||
|
"description": "You took too long to select the ticket category."
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
@ -67,8 +87,9 @@
|
|||||||
},
|
},
|
||||||
"command_execution_error": {
|
"command_execution_error": {
|
||||||
"title": "⚠️",
|
"title": "⚠️",
|
||||||
"description": "An unexpected error occurred during command execution.\nPlease ask a server administrator to check the console output / logs for details."
|
"description": "An unexpected error occurred during command execution.\nPlease ask an administrator to check the console output / logs for details."
|
||||||
},
|
},
|
||||||
|
"message_will_be_deleted_in": "This message will be deleted in %d seconds",
|
||||||
"missing_perms": {
|
"missing_perms": {
|
||||||
"title": "❌",
|
"title": "❌",
|
||||||
"description": "You do not have the permissions required to use this command:\n%s"
|
"description": "You do not have the permissions required to use this command:\n%s"
|
||||||
|
@ -1,3 +1,5 @@
|
|||||||
|
const { MessageEmbed } = require('discord.js');
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A command
|
* A command
|
||||||
*/
|
*/
|
||||||
@ -115,4 +117,47 @@ module.exports = class Command {
|
|||||||
*/
|
*/
|
||||||
async execute(message, args) { } // eslint-disable-line no-unused-vars
|
async execute(message, args) { } // eslint-disable-line no-unused-vars
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Send a message with the command usage
|
||||||
|
* @param {TextChannel} channel - The channel to send the message to
|
||||||
|
* @param {string} [cmd_name] - The command alias
|
||||||
|
* @returns {Message}
|
||||||
|
*/
|
||||||
|
async sendUsage(channel, cmd_name) {
|
||||||
|
let settings = await channel.guild.settings;
|
||||||
|
if (!cmd_name) cmd_name = this.name;
|
||||||
|
|
||||||
|
const prefix = settings.command_prefix;
|
||||||
|
const i18n = this.client.i18n.get(settings.locale);
|
||||||
|
|
||||||
|
const addArgs = (embed, arg) => {
|
||||||
|
let required = arg.required ? '`❗` ' : '';
|
||||||
|
embed.addField(required + arg.name, `» ${i18n('cmd_usage.args.description', arg.description)}}\n» ${i18n('cmd_usage.args.example', arg.example)}`);
|
||||||
|
};
|
||||||
|
|
||||||
|
let usage,
|
||||||
|
example,
|
||||||
|
embed;
|
||||||
|
|
||||||
|
if (this.process_args) {
|
||||||
|
usage = `${prefix + cmd_name} ${this.args.map(arg => arg.required ? `<${arg.name};>` : `[${arg.name};]`).join(' ')}`;
|
||||||
|
example = `${prefix + cmd_name} ${this.args.map(arg => `${arg.name}: ${arg.example};`).join(' ')}`;
|
||||||
|
embed = new MessageEmbed()
|
||||||
|
.setColor(settings.error_colour)
|
||||||
|
.setTitle(i18n('cmd_usage.title', cmd_name))
|
||||||
|
.setDescription(i18n('cmd_usage.named_args') + i18n('cmd_usage.description', usage, example));
|
||||||
|
} else {
|
||||||
|
usage = `${prefix + cmd_name} ${this.args.map(arg => arg.required ? `<${arg.name}>` : `[${arg.name}]`).join(' ')}`;
|
||||||
|
example = `${prefix + cmd_name} ${this.args.map(arg => `${arg.example}`).join(' ')}`;
|
||||||
|
embed = new MessageEmbed()
|
||||||
|
.setColor(settings.error_colour)
|
||||||
|
.setTitle(i18n('cmd_usage.title', cmd_name))
|
||||||
|
.setDescription(i18n('cmd_usage.description', usage, example));
|
||||||
|
}
|
||||||
|
|
||||||
|
this.args.forEach(arg => addArgs(embed, arg));
|
||||||
|
return await channel.send(embed);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
};
|
};
|
@ -83,39 +83,20 @@ module.exports = class CommandManager {
|
|||||||
|
|
||||||
let args = raw_args;
|
let args = raw_args;
|
||||||
|
|
||||||
const addArgs = (embed, arg) => {
|
|
||||||
let required = arg.required ? '`❗` ' : '';
|
|
||||||
embed.addField(required + arg.name, `» ${i18n('cmd_usage.args.description')} ${arg.description}\n» ${i18n('cmd_usage.args.example')} \`${arg.example}\``);
|
|
||||||
};
|
|
||||||
|
|
||||||
if (cmd.process_args) {
|
if (cmd.process_args) {
|
||||||
args = {};
|
args = {};
|
||||||
let data = [...raw_args.matchAll(/(?<key>\w+)\??\s?:\s?(?<value>([^;]|;{2})*);/gmi)];
|
let data = [...raw_args.matchAll(/(?<key>\w+)\??\s?:\s?(?<value>([^;]|;{2})*);/gmi)];
|
||||||
data.forEach(arg => args[arg.groups.key] = arg.groups.value.replace(/;{2}/gm, ';'));
|
data.forEach(arg => args[arg.groups.key] = arg.groups.value.replace(/;{2}/gm, ';'));
|
||||||
for (let arg of cmd.args) {
|
for (let arg of cmd.args) {
|
||||||
if (arg.required && !args[arg]) {
|
if (arg.required && !args[arg]) {
|
||||||
let usage = `${prefix + cmd_name} ${cmd.args.map(arg => arg.required ? `<${arg.name};>` : `[${arg.name};]`).join(' ')}`;
|
return await cmd.sendUsage(message.channel, cmd_name);
|
||||||
let example = `${prefix + cmd_name} ${cmd.args.map(arg => `${arg.name}: ${arg.example};`).join(' ')}`;
|
|
||||||
let embed = new MessageEmbed()
|
|
||||||
.setColor(settings.error_colour)
|
|
||||||
.setTitle(i18n('cmd_usage.title', cmd_name))
|
|
||||||
.setDescription(i18n('cmd_usage.named_args') + i18n('cmd_usage.description', usage, example));
|
|
||||||
cmd.args.forEach(a => addArgs(embed, a));
|
|
||||||
return message.channel.send(embed);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
const args_num = raw_args.split(' ').filter(arg => arg.length !== 0).length;
|
const args_num = raw_args.split(' ').filter(arg => arg.length !== 0).length;
|
||||||
const required_args = cmd.args.reduce((acc, arg) => arg.required ? acc + 1 : acc, 0);
|
const required_args = cmd.args.reduce((acc, arg) => arg.required ? acc + 1 : acc, 0);
|
||||||
if (args_num < required_args) {
|
if (args_num < required_args) {
|
||||||
let usage = `${prefix + cmd_name} ${cmd.args.map(arg => arg.required ? `<${arg.name}>` : `[${arg.name}]`).join(' ')}`;
|
return await cmd.sendUsage(message.channel, cmd_name);
|
||||||
let example = `${prefix + cmd_name} ${cmd.args.map(arg => `${arg.example}`).join(' ')}`;
|
|
||||||
let embed = new MessageEmbed()
|
|
||||||
.setColor(settings.error_colour)
|
|
||||||
.setTitle(i18n('cmd_usage.title', cmd_name))
|
|
||||||
.setDescription(i18n('cmd_usage.description', usage, example));
|
|
||||||
cmd.args.forEach(a => addArgs(embed, a));
|
|
||||||
return message.channel.send(embed);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -158,7 +139,6 @@ module.exports = class CommandManager {
|
|||||||
} catch (e) {
|
} catch (e) {
|
||||||
this.client.log.warn(`An error occurred whilst executing the ${cmd.name} command`);
|
this.client.log.warn(`An error occurred whilst executing the ${cmd.name} command`);
|
||||||
this.client.log.error(e);
|
this.client.log.error(e);
|
||||||
// await message.channel.send(i18n('command_execution_error'));
|
|
||||||
await message.channel.send(
|
await message.channel.send(
|
||||||
new MessageEmbed()
|
new MessageEmbed()
|
||||||
.setColor('ORANGE')
|
.setColor('ORANGE')
|
||||||
|
@ -21,9 +21,6 @@ module.exports = class TicketArchives {
|
|||||||
});
|
});
|
||||||
|
|
||||||
if (t_row) {
|
if (t_row) {
|
||||||
let embeds = [];
|
|
||||||
for (let embed in message.embeds) embeds.push({ ...message.embeds[embed] });
|
|
||||||
|
|
||||||
await this.client.db.models.Message.create({
|
await this.client.db.models.Message.create({
|
||||||
id: message.id,
|
id: message.id,
|
||||||
ticket: t_row.id,
|
ticket: t_row.id,
|
||||||
@ -31,7 +28,9 @@ module.exports = class TicketArchives {
|
|||||||
data: {
|
data: {
|
||||||
content: message.content,
|
content: message.content,
|
||||||
// time: message.createdTimestamp,
|
// time: message.createdTimestamp,
|
||||||
embeds,
|
embeds: message.embeds.map(embed => {
|
||||||
|
return { embed };
|
||||||
|
}),
|
||||||
attachments: [...message.attachments.values()]
|
attachments: [...message.attachments.values()]
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
@ -48,14 +47,11 @@ module.exports = class TicketArchives {
|
|||||||
});
|
});
|
||||||
|
|
||||||
if (m_row) {
|
if (m_row) {
|
||||||
let embeds = [];
|
|
||||||
for (let embed in message.embeds) embeds.push({ ...message.embeds[embed] });
|
|
||||||
|
|
||||||
m_row.data = {
|
m_row.data = {
|
||||||
content: message.content,
|
content: message.content,
|
||||||
// time: message.editedTimestamp,
|
// time: message.editedTimestamp,
|
||||||
embeds: message.embeds.map(embed => {
|
embeds: message.embeds.map(embed => {
|
||||||
return { ...message.embeds[embed] };
|
return { embed };
|
||||||
}),
|
}),
|
||||||
attachments: [...message.attachments.values()]
|
attachments: [...message.attachments.values()]
|
||||||
};
|
};
|
||||||
@ -90,7 +86,8 @@ module.exports = class TicketArchives {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
if (m_row) {
|
if (!m_row) return;
|
||||||
|
|
||||||
// message author
|
// message author
|
||||||
let u_model_data = {
|
let u_model_data = {
|
||||||
user: message.author.id,
|
user: message.author.id,
|
||||||
@ -160,7 +157,6 @@ module.exports = class TicketArchives {
|
|||||||
colour: role.color === 0 ? '7289DA' : int2hex(role.color) // 7289DA = 7506394
|
colour: role.color === 0 ? '7289DA' : int2hex(role.color) // 7289DA = 7506394
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -75,6 +75,7 @@ module.exports = class TicketManager extends EventEmitter {
|
|||||||
});
|
});
|
||||||
|
|
||||||
this.emit('create', t_row.id, creator_id);
|
this.emit('create', t_row.id, creator_id);
|
||||||
|
return t_row;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -144,6 +145,7 @@ module.exports = class TicketManager extends EventEmitter {
|
|||||||
}
|
}
|
||||||
|
|
||||||
this.emit('close', ticket_id);
|
this.emit('close', ticket_id);
|
||||||
|
return t_row;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -3,9 +3,19 @@ const config = require('../../user/config');
|
|||||||
let current_presence = -1;
|
let current_presence = -1;
|
||||||
|
|
||||||
module.exports = {
|
module.exports = {
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @param {string} text
|
||||||
|
* @param {string} [additional]
|
||||||
|
* @returns {string}
|
||||||
|
*/
|
||||||
|
footer: (text, additional) => {
|
||||||
|
if (text && additional) return `${text} | ${additional}`;
|
||||||
|
else return text || additional || '';
|
||||||
|
},
|
||||||
/**
|
/**
|
||||||
* Select a presence from the config
|
* Select a presence from the config
|
||||||
* @returns {Discord.PresenceData}
|
* @returns {PresenceData}
|
||||||
*/
|
*/
|
||||||
selectPresence: () => {
|
selectPresence: () => {
|
||||||
let length = config.presence.presences.length;
|
let length = config.presence.presences.length;
|
||||||
|
43
src/utils/emoji.js
Normal file
43
src/utils/emoji.js
Normal file
@ -0,0 +1,43 @@
|
|||||||
|
module.exports = {
|
||||||
|
letters: {
|
||||||
|
A: '🇦',
|
||||||
|
B: '🇧',
|
||||||
|
C: '🇨',
|
||||||
|
D: '🇩',
|
||||||
|
E: '🇪',
|
||||||
|
F: '🇫',
|
||||||
|
G: '🇬',
|
||||||
|
H: '🇭',
|
||||||
|
I: '🇮',
|
||||||
|
J: '🇯',
|
||||||
|
K: '🇰',
|
||||||
|
L: '🇱',
|
||||||
|
M: '🇲',
|
||||||
|
N: '🇳',
|
||||||
|
O: '🇴',
|
||||||
|
P: '🇵',
|
||||||
|
Q: '🇶',
|
||||||
|
R: '🇷',
|
||||||
|
S: '🇸',
|
||||||
|
T: '🇹',
|
||||||
|
U: '🇺',
|
||||||
|
V: '🇻',
|
||||||
|
W: '🇼',
|
||||||
|
X: '🇽',
|
||||||
|
Y: '🇾',
|
||||||
|
Z: '🇿',
|
||||||
|
},
|
||||||
|
numbers: {
|
||||||
|
0: '0️⃣',
|
||||||
|
1: '1️⃣',
|
||||||
|
2: '2️⃣',
|
||||||
|
3: '3️⃣',
|
||||||
|
4: '4️⃣',
|
||||||
|
5: '5️⃣',
|
||||||
|
6: '6️⃣',
|
||||||
|
7: '7️⃣',
|
||||||
|
8: '8️⃣',
|
||||||
|
9: '9️⃣',
|
||||||
|
10: '🔟',
|
||||||
|
}
|
||||||
|
};
|
@ -25,7 +25,6 @@ module.exports = {
|
|||||||
command_prefix: prefix,
|
command_prefix: prefix,
|
||||||
log_messages: true, // transcripts/archives will be empty if false
|
log_messages: true, // transcripts/archives will be empty if false
|
||||||
name_format: 'ticket-{number}',
|
name_format: 'ticket-{number}',
|
||||||
ticket_welcome: 'Hello {name}, thank you for creating a ticket. A member of staff will soon be available to assist you.\n\n__All messages in this channel are stored for future reference.__',
|
|
||||||
},
|
},
|
||||||
locale: 'en-GB', // used for globals (such as commands) and the default guild locale
|
locale: 'en-GB', // used for globals (such as commands) and the default guild locale
|
||||||
logs: {
|
logs: {
|
||||||
|
Loading…
Reference in New Issue
Block a user