k9 auto-deletes / recreates Chat channels when rebooting, people in voice chats gain XP, chat channels also gain XP for messages at a rate of 50%

master
Nicole Collings 2019-12-23 17:24:05 -08:00
parent a6d0a2bf98
commit 686d6ec1bb
8 changed files with 346 additions and 365 deletions

437
package-lock.json generated
View File

@ -4,31 +4,22 @@
"lockfileVersion": 1,
"requires": true,
"dependencies": {
"@babel/polyfill": {
"version": "7.4.4",
"resolved": "https://registry.npmjs.org/@babel/polyfill/-/polyfill-7.4.4.tgz",
"integrity": "sha512-WlthFLfhQQhh+A2Gn5NSFl0Huxz36x86Jn+E9OW7ibK8edKPq+KLy4apM1yDpQ8kJOVi1OVjpP4vSDLdrI04dg==",
"requires": {
"core-js": "^2.6.5",
"regenerator-runtime": "^0.13.2"
}
},
"@jimp/bmp": {
"version": "0.6.4",
"resolved": "https://registry.npmjs.org/@jimp/bmp/-/bmp-0.6.4.tgz",
"integrity": "sha512-dhKM7Cjw4XoOefx3/we2+vWyTP6hQPpM7mEsziGjtsrK2f/e3/+hhHbEsQNgO9BOA1FPJRXAOiYHts9IlMH1mg==",
"version": "0.6.8",
"resolved": "https://registry.npmjs.org/@jimp/bmp/-/bmp-0.6.8.tgz",
"integrity": "sha512-uxVgSkI62uAzk5ZazYHEHBehow590WAkLKmDXLzkr/XP/Hv2Fx1T4DKwJ/15IY5ktq5VAhAUWGXTyd8KWFsx7w==",
"requires": {
"@jimp/utils": "^0.6.4",
"@jimp/utils": "^0.6.8",
"bmp-js": "^0.1.0",
"core-js": "^2.5.7"
}
},
"@jimp/core": {
"version": "0.6.4",
"resolved": "https://registry.npmjs.org/@jimp/core/-/core-0.6.4.tgz",
"integrity": "sha512-nyiAXI8/uU54fGO53KrRB8pdn1s+IODZ+rj0jG2owsNJlTlagFrsZAy8IVTUCOiiXjh9TbwFo7D5XMrmi4KUww==",
"version": "0.6.8",
"resolved": "https://registry.npmjs.org/@jimp/core/-/core-0.6.8.tgz",
"integrity": "sha512-JOFqBBcSNiDiMZJFr6OJqC6viXj5NVBQISua0eacoYvo4YJtTajOIxC4MqWyUmGrDpRMZBR8QhSsIOwsFrdROA==",
"requires": {
"@jimp/utils": "^0.6.4",
"@jimp/utils": "^0.6.8",
"any-base": "^1.1.0",
"buffer": "^5.2.0",
"core-js": "^2.5.7",
@ -42,264 +33,261 @@
}
},
"@jimp/custom": {
"version": "0.6.4",
"resolved": "https://registry.npmjs.org/@jimp/custom/-/custom-0.6.4.tgz",
"integrity": "sha512-sdBHrBoVr1+PFx4dlUAgXvvu4dG0esQobhg7qhpSLRje1ScavIgE2iXdJKpycgzrqwAOL8vW4/E5w2/rONlaoQ==",
"version": "0.6.8",
"resolved": "https://registry.npmjs.org/@jimp/custom/-/custom-0.6.8.tgz",
"integrity": "sha512-FrYlzZRVXP2vuVwd7Nc2dlK+iZk4g6IaT1Ib8Z6vU5Kkwlt83FJIPJ2UUFABf3bF5big0wkk8ZUihWxE4Nzdng==",
"requires": {
"@jimp/core": "^0.6.4",
"@jimp/core": "^0.6.8",
"core-js": "^2.5.7"
}
},
"@jimp/gif": {
"version": "0.6.4",
"resolved": "https://registry.npmjs.org/@jimp/gif/-/gif-0.6.4.tgz",
"integrity": "sha512-14mLoyG0UrYJsGNRoXBFvSJdFtBD0BSBwQ1zCNeW+HpQqdl+Kh5E1Pz4nqT2KNylJe1jypyR51Q2yndgcfGVyg==",
"version": "0.6.8",
"resolved": "https://registry.npmjs.org/@jimp/gif/-/gif-0.6.8.tgz",
"integrity": "sha512-yyOlujjQcgz9zkjM5ihZDEppn9d1brJ7jQHP5rAKmqep0G7FU1D0AKcV+Ql18RhuI/CgWs10wAVcrQpmLnu4Yw==",
"requires": {
"@jimp/utils": "^0.6.4",
"@jimp/utils": "^0.6.8",
"core-js": "^2.5.7",
"omggif": "^1.0.9"
}
},
"@jimp/jpeg": {
"version": "0.6.4",
"resolved": "https://registry.npmjs.org/@jimp/jpeg/-/jpeg-0.6.4.tgz",
"integrity": "sha512-NrFla9fZC/Bhw1Aa9vJ6cBOqpB5ylEPb9jD+yZ0fzcAw5HwILguS//oXv9EWLApIY1XsOMFFe0XWpY653rv8hw==",
"version": "0.6.8",
"resolved": "https://registry.npmjs.org/@jimp/jpeg/-/jpeg-0.6.8.tgz",
"integrity": "sha512-rGtXbYpFXAn471qLpTGvhbBMNHJo5KiufN+vC5AWyufntmkt5f0Ox2Cx4ijuBMDtirZchxbMLtrfGjznS4L/ew==",
"requires": {
"@jimp/utils": "^0.6.4",
"@jimp/utils": "^0.6.8",
"core-js": "^2.5.7",
"jpeg-js": "^0.3.4"
}
},
"@jimp/plugin-blit": {
"version": "0.6.4",
"resolved": "https://registry.npmjs.org/@jimp/plugin-blit/-/plugin-blit-0.6.4.tgz",
"integrity": "sha512-suVznd4XozkQIuECX0u8kMl+cAQpZN3WcbWXUcJaVxRi+VBvHIetG1Qs5qGLzuEg9627+kE7ppv0UgZ5mkE6lg==",
"version": "0.6.8",
"resolved": "https://registry.npmjs.org/@jimp/plugin-blit/-/plugin-blit-0.6.8.tgz",
"integrity": "sha512-7Tl6YpKTSpvwQbnGNhsfX2zyl3jRVVopd276Y2hF2zpDz9Bycow7NdfNU/4Nx1jaf96X6uWOtSVINcQ7rGd47w==",
"requires": {
"@jimp/utils": "^0.6.4",
"@jimp/utils": "^0.6.8",
"core-js": "^2.5.7"
}
},
"@jimp/plugin-blur": {
"version": "0.6.4",
"resolved": "https://registry.npmjs.org/@jimp/plugin-blur/-/plugin-blur-0.6.4.tgz",
"integrity": "sha512-M2fDMYUUtEKVNnCJZk5J0KSMzzISobmWfnG88RdHXJCkOn98kdawQFwTsYOfJJfCM8jWfhIxwZLFhC/2lkTN2w==",
"version": "0.6.8",
"resolved": "https://registry.npmjs.org/@jimp/plugin-blur/-/plugin-blur-0.6.8.tgz",
"integrity": "sha512-NpZCMKxXHLDQsX9zPlWtpMA660DQStY6/z8ZetyxCDbqrLe9YCXpeR4MNhdJdABIiwTm1W5FyFF4kp81PHJx3Q==",
"requires": {
"@jimp/utils": "^0.6.4",
"@jimp/utils": "^0.6.8",
"core-js": "^2.5.7"
}
},
"@jimp/plugin-color": {
"version": "0.6.4",
"resolved": "https://registry.npmjs.org/@jimp/plugin-color/-/plugin-color-0.6.4.tgz",
"integrity": "sha512-6Nfr2l9KSb6zH2fij8G6fQOw85TTkyRaBlqMvDmsQp/I1IlaDbXzA2C2Eh9jkQYZQDPu61B1MkmlEhJp/TUx6Q==",
"version": "0.6.8",
"resolved": "https://registry.npmjs.org/@jimp/plugin-color/-/plugin-color-0.6.8.tgz",
"integrity": "sha512-jjFyU0zNmGOH2rjzHuOMU4kaia0oo82s/7UYfn5h7OUkmUZTd6Do3ZSK1PiXA7KR+s4B76/Omm6Doh/0SGb7BQ==",
"requires": {
"@jimp/utils": "^0.6.4",
"@jimp/utils": "^0.6.8",
"core-js": "^2.5.7",
"tinycolor2": "^1.4.1"
}
},
"@jimp/plugin-contain": {
"version": "0.6.4",
"resolved": "https://registry.npmjs.org/@jimp/plugin-contain/-/plugin-contain-0.6.4.tgz",
"integrity": "sha512-qI1MxU1noS6NbEPu/bDDeP405aMviuIsfpOz8J3En8IwIwrJV22qt6QIHmF+eyng8CYgivwIPjEPzFzLR566Nw==",
"version": "0.6.8",
"resolved": "https://registry.npmjs.org/@jimp/plugin-contain/-/plugin-contain-0.6.8.tgz",
"integrity": "sha512-p/P2wCXhAzbmEgXvGsvmxLmbz45feF6VpR4m9suPSOr8PC/i/XvTklTqYEUidYYAft4vHgsYJdS74HKSMnH8lw==",
"requires": {
"@jimp/utils": "^0.6.4",
"@jimp/utils": "^0.6.8",
"core-js": "^2.5.7"
}
},
"@jimp/plugin-cover": {
"version": "0.6.4",
"resolved": "https://registry.npmjs.org/@jimp/plugin-cover/-/plugin-cover-0.6.4.tgz",
"integrity": "sha512-z6eafPonj3LJY8cTEfRkXmOfCDi1+f0tbYaNvmiu+OrWJ3Ojw2hMt+BVVvJ8pKe1dWIFkCjxOjyjZWj1gEkaLw==",
"version": "0.6.8",
"resolved": "https://registry.npmjs.org/@jimp/plugin-cover/-/plugin-cover-0.6.8.tgz",
"integrity": "sha512-2PvWgk+PJfRsfWDI1G8Fpjrsu0ZlpNyZxO2+fqWlVo6y/y2gP4v08FqvbkcqSjNlOu2IDWIFXpgyU0sTINWZLg==",
"requires": {
"@jimp/utils": "^0.6.4",
"@jimp/utils": "^0.6.8",
"core-js": "^2.5.7"
}
},
"@jimp/plugin-crop": {
"version": "0.6.4",
"resolved": "https://registry.npmjs.org/@jimp/plugin-crop/-/plugin-crop-0.6.4.tgz",
"integrity": "sha512-w9TR+pn+GeWbznscGe2HRkPxInge0whAF3TLPWhPwBVjZChTT8dSDXsUpUlxQqvI4SfzuKp8z3/0SBqYDCzxxA==",
"version": "0.6.8",
"resolved": "https://registry.npmjs.org/@jimp/plugin-crop/-/plugin-crop-0.6.8.tgz",
"integrity": "sha512-CbrcpWE2xxPK1n/JoTXzhRUhP4mO07mTWaSavenCg664oQl/9XCtL+A0FekuNHzIvn4myEqvkiTwN7FsbunS/Q==",
"requires": {
"@jimp/utils": "^0.6.4",
"@jimp/utils": "^0.6.8",
"core-js": "^2.5.7"
}
},
"@jimp/plugin-displace": {
"version": "0.6.4",
"resolved": "https://registry.npmjs.org/@jimp/plugin-displace/-/plugin-displace-0.6.4.tgz",
"integrity": "sha512-MEvtBXOAio/3iGJkKBrTtFs3Q38ez2Wy/wTD0Ruas+L8fjJR7l4mDgV+zjRr57CqB5mpY+L48VEoa2/gNXh9cg==",
"version": "0.6.8",
"resolved": "https://registry.npmjs.org/@jimp/plugin-displace/-/plugin-displace-0.6.8.tgz",
"integrity": "sha512-RmV2bPxoPE6mrPxtYSPtHxm2cGwBQr5a2p+9gH6SPy+eUMrbGjbvjwKNfXWUYD0leML+Pt5XOmAS9pIROmuruQ==",
"requires": {
"@jimp/utils": "^0.6.4",
"@jimp/utils": "^0.6.8",
"core-js": "^2.5.7"
}
},
"@jimp/plugin-dither": {
"version": "0.6.4",
"resolved": "https://registry.npmjs.org/@jimp/plugin-dither/-/plugin-dither-0.6.4.tgz",
"integrity": "sha512-w+AGLcIMUeJZ4CI0FvFomahgKLcW+ICsLidUNOqyLzceluPAfug4X7vDhQ41pNkzKg0M1+Q1j0aWV8bdyF+LhA==",
"version": "0.6.8",
"resolved": "https://registry.npmjs.org/@jimp/plugin-dither/-/plugin-dither-0.6.8.tgz",
"integrity": "sha512-x6V/qjxe+xypjpQm7GbiMNqci1EW5UizrcebOhHr8AHijOEqHd2hjXh5f6QIGfrkTFelc4/jzq1UyCsYntqz9Q==",
"requires": {
"@jimp/utils": "^0.6.4",
"@jimp/utils": "^0.6.8",
"core-js": "^2.5.7"
}
},
"@jimp/plugin-flip": {
"version": "0.6.4",
"resolved": "https://registry.npmjs.org/@jimp/plugin-flip/-/plugin-flip-0.6.4.tgz",
"integrity": "sha512-ukINMegMUM9KYjyDCiyYKYdSsbhNRLHDwOJN0xVRalmOKqNaZmjNbiMbaVxKlYt6sHW76RhSMOekw9f6GQB9tQ==",
"version": "0.6.8",
"resolved": "https://registry.npmjs.org/@jimp/plugin-flip/-/plugin-flip-0.6.8.tgz",
"integrity": "sha512-4il6Da6G39s9MyWBEee4jztEOUGJ40E6OlPjkMrdpDNvge6hYEAB31BczTYBP/CEY74j4LDSoY5LbcU4kv06yA==",
"requires": {
"@jimp/utils": "^0.6.4",
"@jimp/utils": "^0.6.8",
"core-js": "^2.5.7"
}
},
"@jimp/plugin-gaussian": {
"version": "0.6.4",
"resolved": "https://registry.npmjs.org/@jimp/plugin-gaussian/-/plugin-gaussian-0.6.4.tgz",
"integrity": "sha512-C1P6ohzIddpNb7CX5X+ygbp+ow8Fpt64ZLoIgdjYPs/42HxKluvY62fVfMhY6m5zUGKIMbg0uYeAtz/9LRJPyw==",
"version": "0.6.8",
"resolved": "https://registry.npmjs.org/@jimp/plugin-gaussian/-/plugin-gaussian-0.6.8.tgz",
"integrity": "sha512-pVOblmjv7stZjsqloi4YzHVwAPXKGdNaHPhp4KP4vj41qtc6Hxd9z/+VWGYRTunMFac84gUToe0UKIXd6GhoKw==",
"requires": {
"@jimp/utils": "^0.6.4",
"@jimp/utils": "^0.6.8",
"core-js": "^2.5.7"
}
},
"@jimp/plugin-invert": {
"version": "0.6.4",
"resolved": "https://registry.npmjs.org/@jimp/plugin-invert/-/plugin-invert-0.6.4.tgz",
"integrity": "sha512-sleGz1jXaNEsP/5Ayqw8oez/6KesWcyCqovIuK4Z4kDmMc2ncuhsXIJQXDWtIF4tTQVzNEgrxUDNA4bi9xpCUA==",
"version": "0.6.8",
"resolved": "https://registry.npmjs.org/@jimp/plugin-invert/-/plugin-invert-0.6.8.tgz",
"integrity": "sha512-11zuLiXDHr6tFv4U8aieXqNXQEKbDbSBG/h+X62gGTNFpyn8EVPpncHhOqrAFtZUaPibBqMFlNJ15SzwC7ExsQ==",
"requires": {
"@jimp/utils": "^0.6.4",
"@jimp/utils": "^0.6.8",
"core-js": "^2.5.7"
}
},
"@jimp/plugin-mask": {
"version": "0.6.4",
"resolved": "https://registry.npmjs.org/@jimp/plugin-mask/-/plugin-mask-0.6.4.tgz",
"integrity": "sha512-3D4FbRxnpO9nzwa6cF8AImgO1aVReYbfRRO4I4bku4/iZ+kuU3fBLV+SRhB4c7di3ejG5u+rGsIfaNc94iYYvw==",
"version": "0.6.8",
"resolved": "https://registry.npmjs.org/@jimp/plugin-mask/-/plugin-mask-0.6.8.tgz",
"integrity": "sha512-hZJ0OiKGJyv7hDSATwJDkunB1Ie80xJnONMgpUuUseteK45YeYNBOiZVUe8vum8QI1UwavgBzcvQ9u4fcgXc9g==",
"requires": {
"@jimp/utils": "^0.6.4",
"@jimp/utils": "^0.6.8",
"core-js": "^2.5.7"
}
},
"@jimp/plugin-normalize": {
"version": "0.6.4",
"resolved": "https://registry.npmjs.org/@jimp/plugin-normalize/-/plugin-normalize-0.6.4.tgz",
"integrity": "sha512-nOFMwOaVkOKArHkD/T6/1HKAPj3jlW6l0JduVDn1A5eIPCtlnyhlE9zdjgi5Q9IBR/gRjwW6tTzBKuJenS51kg==",
"version": "0.6.8",
"resolved": "https://registry.npmjs.org/@jimp/plugin-normalize/-/plugin-normalize-0.6.8.tgz",
"integrity": "sha512-Q4oYhU+sSyTJI7pMZlg9/mYh68ujLfOxXzQGEXuw0sHGoGQs3B0Jw7jmzGa6pIS06Hup5hD2Zuh1ppvMdjJBfQ==",
"requires": {
"@jimp/utils": "^0.6.4",
"@jimp/utils": "^0.6.8",
"core-js": "^2.5.7"
}
},
"@jimp/plugin-print": {
"version": "0.6.4",
"resolved": "https://registry.npmjs.org/@jimp/plugin-print/-/plugin-print-0.6.4.tgz",
"integrity": "sha512-3z5DLVCKg0NfZhHATEaYH/4XanIboPP1pOUoxIUeF++qOnGiGgH2giFJlRprHmx2l3E3DukR1v8pt54PGvfrFw==",
"version": "0.6.8",
"resolved": "https://registry.npmjs.org/@jimp/plugin-print/-/plugin-print-0.6.8.tgz",
"integrity": "sha512-2aokejGn4Drv1FesnZGqh5KEq0FQtR0drlmtyZrBH+r9cx7hh0Qgf4D1BOTDEgXkfSSngjGRjKKRW/fwOrVXYw==",
"requires": {
"@jimp/utils": "^0.6.4",
"@jimp/utils": "^0.6.8",
"core-js": "^2.5.7",
"load-bmfont": "^1.4.0"
}
},
"@jimp/plugin-resize": {
"version": "0.6.4",
"resolved": "https://registry.npmjs.org/@jimp/plugin-resize/-/plugin-resize-0.6.4.tgz",
"integrity": "sha512-fk2+KheUNClrOWj6aDNWj1r4byVQb6Qxy4aT1UHX5GXPHDA+nhlej7ghaYdzeWZYodeM3lpasYtByu1XE2qScQ==",
"version": "0.6.8",
"resolved": "https://registry.npmjs.org/@jimp/plugin-resize/-/plugin-resize-0.6.8.tgz",
"integrity": "sha512-27nPh8L1YWsxtfmV/+Ub5dOTpXyC0HMF2cu52RQSCYxr+Lm1+23dJF70AF1poUbUe+FWXphwuUxQzjBJza9UoA==",
"requires": {
"@jimp/utils": "^0.6.4",
"@jimp/utils": "^0.6.8",
"core-js": "^2.5.7"
}
},
"@jimp/plugin-rotate": {
"version": "0.6.4",
"resolved": "https://registry.npmjs.org/@jimp/plugin-rotate/-/plugin-rotate-0.6.4.tgz",
"integrity": "sha512-44VgV5D4xQIYInJAVevdW9J3SOhGKyz0OEr2ciA8Q3ktonKx0O5Q1g2kbruiqxFSkK/u2CKPLeKXZzYCFrmJGQ==",
"version": "0.6.8",
"resolved": "https://registry.npmjs.org/@jimp/plugin-rotate/-/plugin-rotate-0.6.8.tgz",
"integrity": "sha512-GbjETvL05BDoLdszNUV4Y0yLkHf177MnqGqilA113LIvx9aD0FtUopGXYfRGVvmtTOTouoaGJUc+K6qngvKxww==",
"requires": {
"@jimp/utils": "^0.6.4",
"@jimp/utils": "^0.6.8",
"core-js": "^2.5.7"
}
},
"@jimp/plugin-scale": {
"version": "0.6.4",
"resolved": "https://registry.npmjs.org/@jimp/plugin-scale/-/plugin-scale-0.6.4.tgz",
"integrity": "sha512-RAQRaDiCHmEz+A8QS5d/Z38EnlNsQizz3Mu3NsjA8uFtJsv1yMKWXZSQuzniofZw8tlMV6oI3VdM0eQVE07/5w==",
"version": "0.6.8",
"resolved": "https://registry.npmjs.org/@jimp/plugin-scale/-/plugin-scale-0.6.8.tgz",
"integrity": "sha512-GzIYWR/oCUK2jAwku23zt19V1ssaEU4pL0x2XsLNKuuJEU6DvEytJyTMXCE7OLG/MpDBQcQclJKHgiyQm5gIOQ==",
"requires": {
"@jimp/utils": "^0.6.4",
"@jimp/utils": "^0.6.8",
"core-js": "^2.5.7"
}
},
"@jimp/plugins": {
"version": "0.6.4",
"resolved": "https://registry.npmjs.org/@jimp/plugins/-/plugins-0.6.4.tgz",
"integrity": "sha512-NpO/87CKnF4Q9r8gMl6w+jPKOM/C089qExkViD9cPvcFZEnyVOu7ucGzcMmTcabWOU62iQTOkRViPYr6XaK0LQ==",
"version": "0.6.8",
"resolved": "https://registry.npmjs.org/@jimp/plugins/-/plugins-0.6.8.tgz",
"integrity": "sha512-fMcTI72Vn/Lz6JftezTURmyP5ml/xGMe0Ljx2KRJ85IWyP33vDmGIUuutFiBEbh2+y7lRT+aTSmjs0QGa/xTmQ==",
"requires": {
"@jimp/plugin-blit": "^0.6.4",
"@jimp/plugin-blur": "^0.6.4",
"@jimp/plugin-color": "^0.6.4",
"@jimp/plugin-contain": "^0.6.4",
"@jimp/plugin-cover": "^0.6.4",
"@jimp/plugin-crop": "^0.6.4",
"@jimp/plugin-displace": "^0.6.4",
"@jimp/plugin-dither": "^0.6.4",
"@jimp/plugin-flip": "^0.6.4",
"@jimp/plugin-gaussian": "^0.6.4",
"@jimp/plugin-invert": "^0.6.4",
"@jimp/plugin-mask": "^0.6.4",
"@jimp/plugin-normalize": "^0.6.4",
"@jimp/plugin-print": "^0.6.4",
"@jimp/plugin-resize": "^0.6.4",
"@jimp/plugin-rotate": "^0.6.4",
"@jimp/plugin-scale": "^0.6.4",
"@jimp/plugin-blit": "^0.6.8",
"@jimp/plugin-blur": "^0.6.8",
"@jimp/plugin-color": "^0.6.8",
"@jimp/plugin-contain": "^0.6.8",
"@jimp/plugin-cover": "^0.6.8",
"@jimp/plugin-crop": "^0.6.8",
"@jimp/plugin-displace": "^0.6.8",
"@jimp/plugin-dither": "^0.6.8",
"@jimp/plugin-flip": "^0.6.8",
"@jimp/plugin-gaussian": "^0.6.8",
"@jimp/plugin-invert": "^0.6.8",
"@jimp/plugin-mask": "^0.6.8",
"@jimp/plugin-normalize": "^0.6.8",
"@jimp/plugin-print": "^0.6.8",
"@jimp/plugin-resize": "^0.6.8",
"@jimp/plugin-rotate": "^0.6.8",
"@jimp/plugin-scale": "^0.6.8",
"core-js": "^2.5.7",
"timm": "^1.6.1"
}
},
"@jimp/png": {
"version": "0.6.4",
"resolved": "https://registry.npmjs.org/@jimp/png/-/png-0.6.4.tgz",
"integrity": "sha512-qv3oo6ll3XWVIToBwVC1wQX0MFKwpxbe2o+1ld9B4ZDavqvAHzalzcmTd/iyooI85CVDAcC3RRDo66oiizGZCQ==",
"version": "0.6.8",
"resolved": "https://registry.npmjs.org/@jimp/png/-/png-0.6.8.tgz",
"integrity": "sha512-JHHg/BZ7KDtHQrcG+a7fztw45rdf7okL/YwkN4qU5FH7Fcrp41nX5QnRviDtD9hN+GaNC7kvjvcqRAxW25qjew==",
"requires": {
"@jimp/utils": "^0.6.4",
"@jimp/utils": "^0.6.8",
"core-js": "^2.5.7",
"pngjs": "^3.3.3"
}
},
"@jimp/tiff": {
"version": "0.6.4",
"resolved": "https://registry.npmjs.org/@jimp/tiff/-/tiff-0.6.4.tgz",
"integrity": "sha512-8/vD4qleexmhPdppiu6fSstj/n/kGNTn8iIlf1emiqOuMN2PL9q5GOPDWU0xWdGNyJMMIDXJPgUFUkKfqXdg7w==",
"version": "0.6.8",
"resolved": "https://registry.npmjs.org/@jimp/tiff/-/tiff-0.6.8.tgz",
"integrity": "sha512-iWHbxd+0IKWdJyJ0HhoJCGYmtjPBOusz1z1HT/DnpePs/Lo3TO4d9ALXqYfUkyG74ZK5jULZ69KLtwuhuJz1bg==",
"requires": {
"core-js": "^2.5.7",
"utif": "^2.0.1"
}
},
"@jimp/types": {
"version": "0.6.4",
"resolved": "https://registry.npmjs.org/@jimp/types/-/types-0.6.4.tgz",
"integrity": "sha512-/EMbipQDg5U6DnBAgcSiydlMBRYoKhnaK7MJRImeTzhDJ6xfgNOF7lYq66o0kmaezKdG/cIwZ1CLecn2y3D8SQ==",
"version": "0.6.8",
"resolved": "https://registry.npmjs.org/@jimp/types/-/types-0.6.8.tgz",
"integrity": "sha512-vCZ/Cp2osy69VP21XOBACfHI5HeR60Rfd4Jidj4W73UL+HrFWOtyQiJ7hlToyu1vI5mR/NsUQpzyQvz56ADm5A==",
"requires": {
"@jimp/bmp": "^0.6.4",
"@jimp/gif": "^0.6.4",
"@jimp/jpeg": "^0.6.4",
"@jimp/png": "^0.6.4",
"@jimp/tiff": "^0.6.4",
"@jimp/bmp": "^0.6.8",
"@jimp/gif": "^0.6.8",
"@jimp/jpeg": "^0.6.8",
"@jimp/png": "^0.6.8",
"@jimp/tiff": "^0.6.8",
"core-js": "^2.5.7",
"timm": "^1.6.1"
}
},
"@jimp/utils": {
"version": "0.6.4",
"resolved": "https://registry.npmjs.org/@jimp/utils/-/utils-0.6.4.tgz",
"integrity": "sha512-EFQurCyEnZLSM2Q1BYDTUmsOJPSOYEQd18Fvq8bGo8hnBHoGLWLWWyNi2l4cYhtpKmIXyhvQqa6/WaEpKPzvqA==",
"version": "0.6.8",
"resolved": "https://registry.npmjs.org/@jimp/utils/-/utils-0.6.8.tgz",
"integrity": "sha512-7RDfxQ2C/rarNG9iso5vmnKQbcvlQjBIlF/p7/uYj72WeZgVCB+5t1fFBKJSU4WhniHX4jUMijK+wYGE3Y3bGw==",
"requires": {
"core-js": "^2.5.7"
}
},
<<<<<<< HEAD
"@types/node": {
"version": "12.7.3",
"resolved": "https://registry.npmjs.org/@types/node/-/node-12.7.3.tgz",
"integrity": "sha512-3SiLAIBkDWDg6vFo0+5YJyHPWU9uwu40Qe+v+0MH8wRKYBimHvvAOyk3EzMrD/TrIlLYfXrqDqrg913PynrMJQ=="
"version": "12.12.22",
"resolved": "https://registry.npmjs.org/@types/node/-/node-12.12.22.tgz",
"integrity": "sha512-r5i93jqbPWGXYXxianGATOxTelkp6ih/U0WVnvaqAvTqM+0U6J3kw6Xk6uq/dWNRkEVw/0SLcO5ORXbVNz4FMQ=="
},
=======
>>>>>>> b3a6b17effd58de3374675cbcf658cf6b1c4ce37
"File": {
"version": "0.10.2",
"resolved": "https://registry.npmjs.org/File/-/File-0.10.2.tgz",
@ -324,14 +312,11 @@
"uri-js": "^4.2.2"
}
},
<<<<<<< HEAD
"ansi-colors": {
"version": "4.1.1",
"resolved": "https://registry.npmjs.org/ansi-colors/-/ansi-colors-4.1.1.tgz",
"integrity": "sha512-JoX0apGbHaUJBNl6yF+p6JAFYZ666/hhCGKN5t9QFjbJQKUU/g8MNbFDbvfrgKXvI1QpZplPOnwIo99lX/AAmA=="
},
=======
>>>>>>> b3a6b17effd58de3374675cbcf658cf6b1c4ce37
"any-base": {
"version": "1.1.0",
"resolved": "https://registry.npmjs.org/any-base/-/any-base-1.1.0.tgz",
@ -396,9 +381,9 @@
"integrity": "sha1-4Fpj95amwf8l9Hcex62twUjAcjM="
},
"buffer": {
"version": "5.4.0",
"resolved": "https://registry.npmjs.org/buffer/-/buffer-5.4.0.tgz",
"integrity": "sha512-Xpgy0IwHK2N01ncykXTy6FpCWuM+CJSHoPVBLyNqyrWxsedpLvwsYUhf0ME3WRFNUhos0dMamz9cOS/xRDtU5g==",
"version": "5.4.3",
"resolved": "https://registry.npmjs.org/buffer/-/buffer-5.4.3.tgz",
"integrity": "sha512-zvj65TkFeIt3i6aj5bIvJDzjjQQGs4o/sNoezg1F1kYap9Nu2jcUdpwzRSJTHMMzG0H7bZkn4rNQpImhuxWX2A==",
"requires": {
"base64-js": "^1.0.2",
"ieee754": "^1.1.4"
@ -436,9 +421,9 @@
}
},
"core-js": {
"version": "2.6.9",
"resolved": "https://registry.npmjs.org/core-js/-/core-js-2.6.9.tgz",
"integrity": "sha512-HOpZf6eXmnl7la+cUdMnLvUxKNqLUzJvgIziQ0DiF3JwSImNphIqdGqzj6hIKyX04MmV0poclQ7+wjWvxQyR2A=="
"version": "2.6.11",
"resolved": "https://registry.npmjs.org/core-js/-/core-js-2.6.11.tgz",
"integrity": "sha512-5wjnpaT/3dV+XB4borEsnAYQchn00XSgTAWKDkEqv+K8KevjbzmofK6hfJ9TZIlpj2N0xQpazy7PiRQiWHqzWg=="
},
"core-util-is": {
"version": "1.0.2",
@ -453,14 +438,6 @@
"assert-plus": "^1.0.0"
}
},
"define-properties": {
"version": "1.1.3",
"resolved": "https://registry.npmjs.org/define-properties/-/define-properties-1.1.3.tgz",
"integrity": "sha512-3MqfYKj2lLzdMSf8ZIZE/V+Zuy+BgD6f164e8K2w7dgnpKArBDerGYpM46IYYcjnkdPNMjPk9A6VFB8+3SKlXQ==",
"requires": {
"object-keys": "^1.0.12"
}
},
"delayed-stream": {
"version": "1.0.0",
"resolved": "https://registry.npmjs.org/delayed-stream/-/delayed-stream-1.0.0.tgz",
@ -500,29 +477,6 @@
"iconv-lite": "~0.4.13"
}
},
"es-abstract": {
"version": "1.13.0",
"resolved": "https://registry.npmjs.org/es-abstract/-/es-abstract-1.13.0.tgz",
"integrity": "sha512-vDZfg/ykNxQVwup/8E1BZhVzFfBxs9NqMzGcvIJrqg5k2/5Za2bWo40dK2J1pgLngZ7c+Shh8lwYtLGyrwPutg==",
"requires": {
"es-to-primitive": "^1.2.0",
"function-bind": "^1.1.1",
"has": "^1.0.3",
"is-callable": "^1.1.4",
"is-regex": "^1.0.4",
"object-keys": "^1.0.12"
}
},
"es-to-primitive": {
"version": "1.2.0",
"resolved": "https://registry.npmjs.org/es-to-primitive/-/es-to-primitive-1.2.0.tgz",
"integrity": "sha512-qZryBOJjV//LaxLTV6UC//WewneB3LcXOL9NP++ozKVXsIIIpm/2c13UDiD9Jp2eThsecw9m3jPqDwTyobcdbg==",
"requires": {
"is-callable": "^1.1.4",
"is-date-object": "^1.0.1",
"is-symbol": "^1.0.2"
}
},
"exif-parser": {
"version": "0.1.12",
"resolved": "https://registry.npmjs.org/exif-parser/-/exif-parser-0.1.12.tgz",
@ -578,14 +532,6 @@
"resolved": "https://registry.npmjs.org/filereader/-/filereader-0.10.3.tgz",
"integrity": "sha1-x0fUos2PYeVBinwH/hJXpD8KzbE="
},
"for-each": {
"version": "0.3.3",
"resolved": "https://registry.npmjs.org/for-each/-/for-each-0.3.3.tgz",
"integrity": "sha512-jqYfLp7mo9vIyQf8ykW2v7A+2N4QjeCeI5+Dz9XraiO1ign81wjiH7Fb9vSOWvQfNtmSa4H2RoQTrrXivdUZmw==",
"requires": {
"is-callable": "^1.1.3"
}
},
"foreachasync": {
"version": "3.0.0",
"resolved": "https://registry.npmjs.org/foreachasync/-/foreachasync-3.0.0.tgz",
@ -597,9 +543,9 @@
"integrity": "sha1-+8cfDEGt6zf5bFd60e1C2P2sypE="
},
"form-data": {
"version": "2.5.0",
"resolved": "https://registry.npmjs.org/form-data/-/form-data-2.5.0.tgz",
"integrity": "sha512-WXieX3G/8side6VIqx44ablyULoGruSde5PNTxoUyo5CeyAMX6nVWUd0rgist/EuX655cjhUhTo1Fo3tRYqbcA==",
"version": "2.5.1",
"resolved": "https://registry.npmjs.org/form-data/-/form-data-2.5.1.tgz",
"integrity": "sha512-m21N3WOmEEURgk6B9GLOE4RuWOFf28Lhh9qGYeNlGq4VDXUlJy2th2slBNU8Gp8EzloYZOibZJ7t5ecIrFSjVA==",
"requires": {
"asynckit": "^0.4.0",
"combined-stream": "^1.0.6",
@ -626,11 +572,6 @@
}
}
},
"function-bind": {
"version": "1.1.1",
"resolved": "https://registry.npmjs.org/function-bind/-/function-bind-1.1.1.tgz",
"integrity": "sha512-yIovAzMX49sF8Yl58fSCWJ5svSLuaibPxXQJFLmBObTuCr0Mf1KiPopGM9NiFjiYBCbfaa2Fh6breQ6ANVTI0A=="
},
"getpass": {
"version": "0.1.7",
"resolved": "https://registry.npmjs.org/getpass/-/getpass-0.1.7.tgz",
@ -667,19 +608,6 @@
"har-schema": "^2.0.0"
}
},
"has": {
"version": "1.0.3",
"resolved": "https://registry.npmjs.org/has/-/has-1.0.3.tgz",
"integrity": "sha512-f2dvO0VU6Oej7RkWJGrehjbzMAjFp5/VKPp5tTpWIV4JHHZK1/BxbFRtf/siA2SWTe09caDmVtYYzWEIbBS4zw==",
"requires": {
"function-bind": "^1.1.1"
}
},
"has-symbols": {
"version": "1.0.0",
"resolved": "https://registry.npmjs.org/has-symbols/-/has-symbols-1.0.0.tgz",
"integrity": "sha1-uhqPGvKg/DllD1yFA2dwQSIGO0Q="
},
"http-signature": {
"version": "1.2.0",
"resolved": "https://registry.npmjs.org/http-signature/-/http-signature-1.2.0.tgz",
@ -711,16 +639,6 @@
"node-fetch": "^1.7.3"
}
},
"is-callable": {
"version": "1.1.4",
"resolved": "https://registry.npmjs.org/is-callable/-/is-callable-1.1.4.tgz",
"integrity": "sha512-r5p9sxJjYnArLjObpjA4xu5EKI3CuKHkJXMhT7kwbpUyIFD1n5PMAsoPvWnvtZiNz7LjkYDRZhd7FlI0eMijEA=="
},
"is-date-object": {
"version": "1.0.1",
"resolved": "https://registry.npmjs.org/is-date-object/-/is-date-object-1.0.1.tgz",
"integrity": "sha1-mqIOtq7rv/d/vTPnTKAbM1gdOhY="
},
"is-function": {
"version": "1.0.1",
"resolved": "https://registry.npmjs.org/is-function/-/is-function-1.0.1.tgz",
@ -731,27 +649,11 @@
"resolved": "https://registry.npmjs.org/is-promise/-/is-promise-2.1.0.tgz",
"integrity": "sha1-eaKp7OfwlugPNtKy87wWwf9L8/o="
},
"is-regex": {
"version": "1.0.4",
"resolved": "https://registry.npmjs.org/is-regex/-/is-regex-1.0.4.tgz",
"integrity": "sha1-VRdIm1RwkbCTDglWVM7SXul+lJE=",
"requires": {
"has": "^1.0.1"
}
},
"is-stream": {
"version": "1.1.0",
"resolved": "https://registry.npmjs.org/is-stream/-/is-stream-1.1.0.tgz",
"integrity": "sha1-EtSj3U5o4Lec6428hBc66A2RykQ="
},
"is-symbol": {
"version": "1.0.2",
"resolved": "https://registry.npmjs.org/is-symbol/-/is-symbol-1.0.2.tgz",
"integrity": "sha512-HS8bZ9ox60yCJLH9snBpIwv9pYUAkcuLhSA1oero1UB5y9aiQpRA8y2ex945AOtCZL1lJDeIk3G5LthswI46Lw==",
"requires": {
"has-symbols": "^1.0.0"
}
},
"is-typedarray": {
"version": "1.0.0",
"resolved": "https://registry.npmjs.org/is-typedarray/-/is-typedarray-1.0.0.tgz",
@ -763,15 +665,15 @@
"integrity": "sha1-R+Y/evVa+m+S4VAOaQ64uFKcCZo="
},
"jimp": {
"version": "0.6.4",
"resolved": "https://registry.npmjs.org/jimp/-/jimp-0.6.4.tgz",
"integrity": "sha512-WQVMoNhkcq/fgthZOWeMdIguCVPg+t4PDFfSxvbNcrECwl8eq3/Ou2whcFWWjyW45m43yAJEY2UT7acDKl6uSQ==",
"version": "0.6.8",
"resolved": "https://registry.npmjs.org/jimp/-/jimp-0.6.8.tgz",
"integrity": "sha512-F7emeG7Hp61IM8VFbNvWENLTuHe0ghizWPuP4JS9ujx2r5mCVYEd/zdaz6M2M42ZdN41blxPajLWl9FXo7Mr2Q==",
"requires": {
"@babel/polyfill": "^7.0.0",
"@jimp/custom": "^0.6.4",
"@jimp/plugins": "^0.6.4",
"@jimp/types": "^0.6.4",
"core-js": "^2.5.7"
"@jimp/custom": "^0.6.8",
"@jimp/plugins": "^0.6.8",
"@jimp/types": "^0.6.8",
"core-js": "^2.5.7",
"regenerator-runtime": "^0.13.3"
}
},
"jpeg-js": {
@ -905,11 +807,6 @@
"resolved": "https://registry.npmjs.org/oauth-sign/-/oauth-sign-0.9.0.tgz",
"integrity": "sha512-fexhUFFPTGV8ybAtSIGbV6gOkSv8UtRbDBnAyLQw4QPKkgNlsH2ByPGtMUqdWkos6YCRmAqViwgZrJc/mRDzZQ=="
},
"object-keys": {
"version": "1.1.1",
"resolved": "https://registry.npmjs.org/object-keys/-/object-keys-1.1.1.tgz",
"integrity": "sha512-NuAESUOUMrlIXOfHKzD6bpPu3tYt3xvjNdRIQ+FeT0lNb4K8WR70CaDxhuNguS2XG+GjkyMwOzsN5ZktImfhLA=="
},
"omggif": {
"version": "1.0.10",
"resolved": "https://registry.npmjs.org/omggif/-/omggif-1.0.10.tgz",
@ -940,13 +837,9 @@
}
},
"parse-headers": {
"version": "2.0.2",
"resolved": "https://registry.npmjs.org/parse-headers/-/parse-headers-2.0.2.tgz",
"integrity": "sha512-/LypJhzFmyBIDYP9aDVgeyEb5sQfbfY5mnDq4hVhlQ69js87wXfmEI5V3xI6vvXasqebp0oCytYFLxsBVfCzSg==",
"requires": {
"for-each": "^0.3.3",
"string.prototype.trim": "^1.1.2"
}
"version": "2.0.3",
"resolved": "https://registry.npmjs.org/parse-headers/-/parse-headers-2.0.3.tgz",
"integrity": "sha512-QhhZ+DCCit2Coi2vmAKbq5RGTRcQUOE2+REgv8vdyu7MnYx2eZztegqtTx99TZ86GTIwqiy3+4nQTWZ2tgmdCA=="
},
"performance-now": {
"version": "2.1.0",
@ -1101,16 +994,6 @@
"graceful-fs": "^4.1.3"
}
},
"string.prototype.trim": {
"version": "1.2.0",
"resolved": "https://registry.npmjs.org/string.prototype.trim/-/string.prototype.trim-1.2.0.tgz",
"integrity": "sha512-9EIjYD/WdlvLpn987+ctkLf0FfvBefOCuiEr2henD8X+7jfwPnyvTdmW8OJhj5p+M0/96mBdynLWkxUr+rHlpg==",
"requires": {
"define-properties": "^1.1.3",
"es-abstract": "^1.13.0",
"function-bind": "^1.1.1"
}
},
"timm": {
"version": "1.6.2",
"resolved": "https://registry.npmjs.org/timm/-/timm-1.6.2.tgz",
@ -1137,14 +1020,6 @@
}
}
},
<<<<<<< HEAD
"tsc": {
"version": "1.20150623.0",
"resolved": "https://registry.npmjs.org/tsc/-/tsc-1.20150623.0.tgz",
"integrity": "sha1-Trw8d04WkUjLx2inNCUz8ILHpuU="
},
=======
>>>>>>> b3a6b17effd58de3374675cbcf658cf6b1c4ce37
"tunnel-agent": {
"version": "0.6.0",
"resolved": "https://registry.npmjs.org/tunnel-agent/-/tunnel-agent-0.6.0.tgz",
@ -1214,18 +1089,18 @@
"integrity": "sha1-qQKekp09vN7RafPG4oI42VpdWig="
},
"xml2js": {
"version": "0.4.19",
"resolved": "https://registry.npmjs.org/xml2js/-/xml2js-0.4.19.tgz",
"integrity": "sha512-esZnJZJOiJR9wWKMyuvSE1y6Dq5LCuJanqhxslH2bxM6duahNZ+HMpCLhBQGZkbX6xRf8x1Y2eJlgt2q3qo49Q==",
"version": "0.4.23",
"resolved": "https://registry.npmjs.org/xml2js/-/xml2js-0.4.23.tgz",
"integrity": "sha512-ySPiMjM0+pLDftHgXY4By0uswI3SPKLDw/i3UXbnO8M/p28zqexCUoPmQFrYD+/1BzhGJSs2i1ERWKJAtiLrug==",
"requires": {
"sax": ">=0.6.0",
"xmlbuilder": "~9.0.1"
"xmlbuilder": "~11.0.0"
}
},
"xmlbuilder": {
"version": "9.0.7",
"resolved": "https://registry.npmjs.org/xmlbuilder/-/xmlbuilder-9.0.7.tgz",
"integrity": "sha1-Ey7mPS7FVlxVfiD0wi35rKaGsQ0="
"version": "11.0.1",
"resolved": "https://registry.npmjs.org/xmlbuilder/-/xmlbuilder-11.0.1.tgz",
"integrity": "sha512-fDlsI/kFEx7gLvbecc0/ohLG50fugQp8ryHzMTuW9vSa1GJ0XYWKnhsUx7oie3G98+r56aTQIUB4kht42R3JvA=="
},
"xmlhttprequest": {
"version": "1.8.0",

View File

@ -10,15 +10,15 @@
"author": "Nicole Collings (Aurailus)",
"license": "UNLICENSED",
"dependencies": {
"@types/node": "^12.7.3",
"@types/node": "^12.12.22",
"ansi-colors": "^4.1.1",
"bufferutil": "^4.0.1",
"discord.js": "^11.5.1",
"file-api": "^0.10.4",
"filereader": "^0.10.3",
"form-data": "^2.5.0",
"form-data": "^2.5.1",
"image-to-base64": "^2.0.1",
"jimp": "^0.6.4",
"jimp": "^0.6.8",
"lowdb": "^1.0.0",
"request": "^2.88.0",
"tsc": "^1.20150623.0",

View File

@ -10,7 +10,7 @@ import {BotStorage} from "./BotStorage";
import {Database} from "./Database";
import {Command} from "./Commands/Command";
import {VoiceTextChannels} from "./Modules/VoiceTextChannels";
import {ChatChannels} from "./Modules/ChatChannels";
import {Leveller} from "./Modules/Leveller";
import {Help} from "./Commands/Help";
@ -23,7 +23,7 @@ export class Bot {
client: Discord.Client;
storage: BotStorage;
voiceTextChannels: VoiceTextChannels;
chatChannels: ChatChannels;
leveller: Leveller;
commands: Command[] = [];
@ -66,7 +66,7 @@ export class Bot {
bindFunctions(): Promise<Bot> {
return new Promise((resolve, reject) => {
try {
this.voiceTextChannels = new VoiceTextChannels(this.client, this.storage);
this.chatChannels = new ChatChannels(this.client, this.storage);
this.leveller = new Leveller(this.client, this.storage);
this.commands.push(new Help(this.client, this.storage));
@ -80,17 +80,15 @@ export class Bot {
});
}
shutDown(): number {
async shutDown() {
try {
this.voiceTextChannels.cleanup();
this.leveller.cleanup();
await this.chatChannels.cleanup();
await this.leveller.cleanup();
console.log(`Shut down gracefully.`);
return 0;
}
catch (e) {
getFatalCallback("Shutdown")(e);
return 1;
}
}
}

View File

@ -2,7 +2,7 @@ import * as Discord from 'discord.js';
export class GuildData {
guild: Discord.Guild;
voiceTextChannels: {[key: string]: Discord.TextChannel} = {};
chatChannels: {[key: string]: Discord.Snowflake} = {};
constructor(guild: Discord.Guild) {
this.guild = guild;

View File

@ -28,8 +28,8 @@ function start() {
}).then((bot: Bot) => {
return bot.bindFunctions();
}).then((bot: Bot) => {
process.on('SIGINT', () => {
bot.shutDown();
process.on('SIGINT', async () => {
await bot.shutDown();
process.exit();
});
}).catch(getFatalCallback("Main.ts"));

View File

@ -0,0 +1,88 @@
import * as Discord from 'discord.js';
import {BotStorage} from "../BotStorage";
import {GuildData} from "../GuildData";
export class ChatChannels {
client: Discord.Client;
storage: BotStorage;
PREFIX = "**Temporary discussion for ";
SUFFIX = ".** Screen share link: "
constructor(client: Discord.Client, storage: BotStorage) {
this.client = client;
this.storage = storage;
client.on("voiceStateUpdate", (om, nm) => this.voiceStateUpdate(om, nm));
this.client.guilds.forEach((guild, guildKey) => {
let guildData = this.storage.getGuild(guild);
guild.channels.forEach((channel, channelKey) => {
if (channel.type == "voice") {
if ((channel as Discord.VoiceChannel).members.size >= 1) {
this.createChatChannel(channel as Discord.VoiceChannel, guildData);
}
}
});
})
}
voiceStateUpdate(oldMember: Discord.GuildMember, member: Discord.GuildMember): void {
let guild: GuildData = this.storage.getGuild(member.guild);
if (member.voiceChannel == oldMember.voiceChannel) return;
if (member.voiceChannel && member.voiceChannel.parent) {
if (member.voiceChannel.members.size == 1) {
this.createChatChannel(member.voiceChannel, guild);
}
}
if (oldMember.voiceChannel && oldMember.voiceChannel.parent) {
if (oldMember.voiceChannel.members.size == 0) {
let channelId = guild.chatChannels[oldMember.voiceChannelID];
if (oldMember.client.channels.get(channelId)) oldMember.client.channels.get(channelId).delete()
.catch((e) => {/*Channel was already deleted*/})
.finally(() => {
delete guild.chatChannels[oldMember.voiceChannelID];
});
}
}
}
createChatChannel(voiceChannel: Discord.VoiceChannel, guild: GuildData) {
let link = `https://discordapp.com/channels/${voiceChannel.guild.id}/${voiceChannel.id}`
let channelName = voiceChannel.name.replace(/[\W_]+/g,"-") + "-chat";
voiceChannel.guild.createChannel(channelName, {
type: `text`,
topic: `${this.PREFIX}<#${voiceChannel.id}>${this.SUFFIX}**${link}**`,
parent: voiceChannel.parent
}).then((channel: Discord.TextChannel) => {
guild.chatChannels[voiceChannel.id] = channel.id;
const embed = new Discord.RichEmbed()
.setAuthor(channelName, "https://i.imgur.com/vitVUtr.png")
.setColor("#EE86ED")
.setDescription(
`This is a temporary discussion channel for ${channelName}!\n` +
`This channel will be automatically deleted when everybody leaves the voice channel.\n` +
`[Group-chat-style screen share link.](${link})`)
.setTimestamp()
channel.send({embed}).catch((e) => {/*Missing send message permissions for the channel*/});
}).catch((e) => {/*Channel was deleted before the promise callback*/});
}
async cleanup() {
for (let key in this.storage.guildData) {
let guild: GuildData = this.storage.guildData[key];
for (let key in guild.chatChannels) {
let chat = guild.chatChannels[key];
await guild.guild.channels.get(chat).delete().catch(e => {/*Channel was already deleted*/});
}
}
}
}

View File

@ -11,6 +11,7 @@ export class Leveller {
client: Discord.Client;
storage: BotStorage;
imgBuilder: LevelImageBuilder;
checkVAInterval: any;
constructor(client: Discord.Client, storage: BotStorage) {
this.client = client;
@ -18,6 +19,71 @@ export class Leveller {
this.imgBuilder = new LevelImageBuilder();
client.on("message", (msg) => this.onMessage(msg));
this.checkVAInterval = setInterval(this.checkVoiceActivity.bind(this), 5*1000*60);
}
checkVoiceActivity(): void {
for (let guildKey in this.storage.guildData) {
let guild = this.storage.guildData[guildKey];
for (let activeVoiceChannel in guild.chatChannels) {
let channel = guild.guild.channels.get(activeVoiceChannel) as Discord.VoiceChannel;
let undeafenedUsers: number = 0;
channel.members.forEach((member, key) => {
if (!member.selfDeaf) undeafenedUsers++;
});
if (undeafenedUsers >= 2) {
channel.members.forEach((member, key) => {
if (!member.selfDeaf && !member.selfMute) {
let chatChannel = (guild.guild.channels.get(guild.chatChannels[activeVoiceChannel]) as Discord.TextChannel);
let server: DBServer = this.storage.db.getServer(guild.guild);
let user: DBUser = server.getUser(member);
let xp = Math.round(Math.random() * 3 + 3);
user.levelXP += xp;
user.totalXP += xp;
const cost = (this.storage.conf.xp_properties.level_base_cost + Math.pow(user.level, this.storage.conf.xp_properties.level_multiplier));
if (user.levelXP >= cost) {
user.level++;
user.levelXP -= cost;
if (chatChannel) {
this.imgBuilder.generate(member.displayName, user.level, member.id).then(image => {
chatChannel.send("", {file: image as any}).then(() => {
fs.unlinkSync(image);
});
});
}
let currentRole = -1;
let previousRole = -1;
const roles: BotLevelRoles = server.getLevelRolesTable();
for (let role in roles) {
let num = parseInt(role);
if (num <= user.level && num > currentRole) currentRole = num;
if (num <= user.level - 1 && num > previousRole) previousRole = num;
}
if (currentRole != previousRole) {
if (previousRole != -1) member.removeRole(member.guild.roles.find(r => r.id == roles[previousRole]));
if (currentRole != -1) member.addRole(member.guild.roles.find(r => r.id == roles[currentRole]), 'Update user level role.');
}
}
server.pushUser(user);
}
});
}
}
}
}
onMessage(msg: Discord.Message): void {
@ -37,12 +103,6 @@ export class Leveller {
const guild = this.storage.getGuild(msg.guild);
for (let voice in guild.voiceTextChannels) {
if (guild.voiceTextChannels[voice].id == msg.channel.id) {
return;
}
}
let server: DBServer = this.storage.db.getServer(msg.guild);
let user: DBUser = server.getUser(msg.member);
@ -69,6 +129,28 @@ export class Leveller {
});
}
if (/good.(bo[i|y]|g[u|i]rl)/gi.test(msg.content.toLowerCase())) {
// Make dog sad
msg.channel.fetchMessages({ limit: 2 }).then(messages => {
let lastMsg = messages.last();
if (lastMsg.author.id == this.client.user.id && lastMsg.attachments.first()) {
let filename = lastMsg.attachments.first().filename;
let user = filename.substr(0, filename.length - 4);
if (user == msg.member.id) {
msg.reply("I'm enby tho :(");
return;
}
}
});
}
for (let voice in guild.chatChannels) {
if (guild.chatChannels[voice] == msg.channel.id) {
xp /= 2;
}
}
// Ignore the first message in a while to prevent single spam messages gaining XP
if (!thankedTheDog && (!user.lastInstigated || time - user.lastInstigated >= 300 * 1000)) {
user.lastInstigated = time;
@ -120,7 +202,7 @@ export class Leveller {
server.pushUser(user);
}
cleanup(): void {
async cleanup() {
clearInterval(this.checkVAInterval);
}
}

View File

@ -1,62 +0,0 @@
import * as Discord from 'discord.js';
import {BotStorage} from "../BotStorage";
import {GuildData} from "../GuildData"
export class VoiceTextChannels {
client: Discord.Client;
storage: BotStorage;
PREFIX = "**Temporary discussion for ";
SUFFIX = ".** Screen share link: "
constructor(client: Discord.Client, storage: BotStorage) {
this.client = client;
this.storage = storage;
client.on("voiceStateUpdate", (om, nm) => this.voiceStateUpdate(om, nm));
}
voiceStateUpdate(oldMember: Discord.GuildMember, member: Discord.GuildMember): void {
let guild: GuildData = this.storage.getGuild(member.guild);
if (member.voiceChannel == oldMember.voiceChannel) return;
if (member.voiceChannel && member.voiceChannel.parent) {
if (member.voiceChannel.members.size == 1) {
let link = `**https://discordapp.com/channels/${member.guild.id}/${member.voiceChannelID}**`
member.guild.createChannel(member.voiceChannel.name.replace(/[\W_]+/g,"-") + "-chat", {
type: `text`,
topic: `${this.PREFIX}<#${member.voiceChannelID}>${this.SUFFIX}${link}`,
parent: member.voiceChannel.parent
}).then((channel: Discord.TextChannel) => {
guild.voiceTextChannels[member.voiceChannelID] = channel;
channel.send("https://cdn.discordapp.com/attachments/618247443158532098/618254905966329885/suru2tgf87k31.png");
}).catch((e) => {/*Channel was deleted before the promise callback*/});
}
}
if (oldMember.voiceChannel && oldMember.voiceChannel.parent) {
if (oldMember.voiceChannel.members.size == 0) {
let channel = guild.voiceTextChannels[oldMember.voiceChannelID];
if (channel) channel.delete()
.catch((e) => {/*Channel was deleted already*/})
.finally(() => {
delete guild.voiceTextChannels[oldMember.voiceChannelID];
});
}
}
}
cleanup(): void {
//TODO: Clean up open text channels
// for (let key in this.storage.guildData) {
// let guild: GuildData = this.storage.guildData[key];
// for (let key in guild.voiceTextChannels) {
// let channel: Discord.TextChannel = guild.voiceTextChannels[key];
// channel.delete();
// }
// }
}
}