Compare commits

..

10 commits

Author SHA1 Message Date
bf3097216e Update dependency np to v10.0.5
All checks were successful
continuous-integration/drone/push Build is passing
continuous-integration/drone/pr Build is passing
2024-04-21 23:02:23 +00:00
c6cb35a12c Merge branch 'main' into develop
All checks were successful
continuous-integration/drone/push Build is passing
2024-04-19 18:24:57 +01:00
3b0586ddad v3.2.2
All checks were successful
continuous-integration/drone/push Build is passing
continuous-integration/drone/tag Build is passing
2024-04-19 18:24:04 +01:00
1c430222aa Revert release bump 2024-04-19 18:24:00 +01:00
c9789a3c77 Update drone deployment
All checks were successful
continuous-integration/drone/push Build is passing
2024-04-19 18:20:01 +01:00
5678097aac v3.2.2
Some checks failed
continuous-integration/drone/push Build is passing
continuous-integration/drone/tag Build is failing
2024-04-19 18:18:04 +01:00
d6330ae501 3.2.2
All checks were successful
continuous-integration/drone/push Build is passing
2024-04-19 18:16:45 +01:00
f3d67bb33a Update bunny command to defer reply until it finds an image 2024-04-19 18:16:25 +01:00
790afcca4a Update random-bunny to v2.1.6 2024-04-19 18:15:59 +01:00
2b04952d85 Update cache helper using the wrong symbol to measure interval
All checks were successful
continuous-integration/drone/push Build is passing
2024-03-30 16:15:53 +00:00
9 changed files with 87 additions and 26 deletions

View file

@ -7,7 +7,7 @@
# any secret values. # any secret values.
BOT_TOKEN= BOT_TOKEN=
BOT_VER=3.2.1 BOT_VER=3.2.2
BOT_AUTHOR=Vylpes BOT_AUTHOR=Vylpes
BOT_OWNERID=147392775707426816 BOT_OWNERID=147392775707426816
BOT_CLIENTID=682942374040961060 BOT_CLIENTID=682942374040961060

View file

@ -7,7 +7,7 @@ steps:
- name: deploy - name: deploy
image: appleboy/drone-ssh image: appleboy/drone-ssh
settings: settings:
host: 192.168.68.120 host: 192.168.1.115
username: vylpes username: vylpes
password: password:
from_secret: ssh_password from_secret: ssh_password
@ -28,7 +28,7 @@ steps:
- name: stage - name: stage
image: appleboy/drone-ssh image: appleboy/drone-ssh
settings: settings:
host: 192.168.68.120 host: 192.168.1.115
username: vylpes username: vylpes
password: password:
from_secret: ssh_password from_secret: ssh_password

View file

@ -7,7 +7,7 @@
# any secret values. # any secret values.
BOT_TOKEN= BOT_TOKEN=
BOT_VER=3.2.1 BOT_VER=3.2.2
BOT_AUTHOR=Vylpes BOT_AUTHOR=Vylpes
BOT_OWNERID=147392775707426816 BOT_OWNERID=147392775707426816
BOT_CLIENTID=680083120896081954 BOT_CLIENTID=680083120896081954

View file

@ -7,7 +7,7 @@
# any secret values. # any secret values.
BOT_TOKEN= BOT_TOKEN=
BOT_VER=3.2.1 BOT_VER=3.2.2
BOT_AUTHOR=Vylpes BOT_AUTHOR=Vylpes
BOT_OWNERID=147392775707426816 BOT_OWNERID=147392775707426816
BOT_CLIENTID=1016767908740857949 BOT_CLIENTID=1016767908740857949

View file

@ -1,6 +1,6 @@
{ {
"name": "vylbot-app", "name": "vylbot-app",
"version": "3.2.1", "version": "3.2.2",
"description": "A discord bot made for Vylpes' Den", "description": "A discord bot made for Vylpes' Den",
"main": "./dist/vylbot", "main": "./dist/vylbot",
"typings": "./dist", "typings": "./dist",
@ -37,7 +37,7 @@
"jest-mock-extended": "^3.0.0", "jest-mock-extended": "^3.0.0",
"minimatch": "9.0.3", "minimatch": "9.0.3",
"mysql": "^2.18.1", "mysql": "^2.18.1",
"random-bunny": "^2.0.5", "random-bunny": "^2.1.6",
"ts-jest": "^29.0.0", "ts-jest": "^29.0.0",
"typeorm": "0.3.20" "typeorm": "0.3.20"
}, },

View file

@ -7,7 +7,7 @@ export default class Bunny extends Command {
constructor() { constructor() {
super(); super();
super.CommandBuilder = new SlashCommandBuilder() this.CommandBuilder = new SlashCommandBuilder()
.setName("bunny") .setName("bunny")
.setDescription("Get a random picture of a rabbit."); .setDescription("Get a random picture of a rabbit.");
} }
@ -15,6 +15,8 @@ export default class Bunny extends Command {
public override async execute(interaction: CommandInteraction) { public override async execute(interaction: CommandInteraction) {
if (!interaction.isChatInputCommand()) return; if (!interaction.isChatInputCommand()) return;
await interaction.deferReply();
const subreddits = [ const subreddits = [
'rabbits', 'rabbits',
'bunnieswithhats', 'bunnieswithhats',
@ -37,9 +39,9 @@ export default class Bunny extends Command {
.setURL(`https://reddit.com${result.Result!.Permalink}`) .setURL(`https://reddit.com${result.Result!.Permalink}`)
.setFooter({ text: `r/${selectedSubreddit} · ${result.Result!.Ups} upvotes`}); .setFooter({ text: `r/${selectedSubreddit} · ${result.Result!.Ups} upvotes`});
await interaction.reply({ embeds: [ embed ]}); await interaction.editReply({ embeds: [ embed ]});
} else { } else {
await interaction.reply("There was an error running this command."); await interaction.editReply("There was an error running this command.");
} }
} }
} }

View file

@ -3,7 +3,9 @@ import NicknameChanged from "./GuildMemberUpdate/NicknameChanged";
import CacheHelper from "../../helpers/CacheHelper"; import CacheHelper from "../../helpers/CacheHelper";
export default async function GuildMemberUpdate(oldMember: GuildMember, newMember: GuildMember) { export default async function GuildMemberUpdate(oldMember: GuildMember, newMember: GuildMember) {
await CacheHelper.UpdateServerCache(newMember.guild); const updatedFromCache = await CacheHelper.UpdateServerCache(newMember.guild);
if (updatedFromCache) return;
if (oldMember.nickname !== newMember.nickname) { // Nickname change if (oldMember.nickname !== newMember.nickname) { // Nickname change
await NicknameChanged(oldMember, newMember); await NicknameChanged(oldMember, newMember);

View file

@ -2,10 +2,10 @@ import { Guild } from "discord.js";
import Server from "../database/entities/Server"; import Server from "../database/entities/Server";
export default class CacheHelper { export default class CacheHelper {
public static async UpdateServerCache(guild: Guild) { public static async UpdateServerCache(guild: Guild): Promise<boolean> {
const cacheInterval = process.env.CACHE_INTERVAL; const cacheInterval = process.env.CACHE_INTERVAL;
if (!cacheInterval) return; if (!cacheInterval) return false;
let server = await Server.FetchOneById(Server, guild.id); let server = await Server.FetchOneById(Server, guild.id);
@ -14,9 +14,15 @@ export default class CacheHelper {
await server.Save(Server, server); await server.Save(Server, server);
await CacheHelper.UpdateCache(guild); await CacheHelper.UpdateCache(guild);
} else if (server.LastCached.getTime() + Number(cacheInterval) < Date.now()) {
return true;
} else if (server.LastCached.getTime() + Number(cacheInterval) > Date.now()) {
await CacheHelper.UpdateCache(guild); await CacheHelper.UpdateCache(guild);
return true;
} }
return false;
} }
private static async UpdateCache(guild: Guild) { private static async UpdateCache(guild: Guild) {

View file

@ -391,6 +391,11 @@
resolved "https://registry.yarnpkg.com/@fastify/busboy/-/busboy-2.1.0.tgz#0709e9f4cb252351c609c6e6d8d6779a8d25edff" resolved "https://registry.yarnpkg.com/@fastify/busboy/-/busboy-2.1.0.tgz#0709e9f4cb252351c609c6e6d8d6779a8d25edff"
integrity sha512-+KpH+QxZU7O4675t3mnkQKcZZg56u+K/Ct2K+N2AZYNVK8kyeo/bI18tI8aPm3tvNNRyTWfj6s5tnGNlcbQRsA== integrity sha512-+KpH+QxZU7O4675t3mnkQKcZZg56u+K/Ct2K+N2AZYNVK8kyeo/bI18tI8aPm3tvNNRyTWfj6s5tnGNlcbQRsA==
"@inquirer/figures@^1.0.1":
version "1.0.1"
resolved "https://registry.yarnpkg.com/@inquirer/figures/-/figures-1.0.1.tgz#d65f0bd0e9511a90b4d3543ee6a3ce7211f29417"
integrity sha512-mtup3wVKia3ZwULPHcbs4Mor8Voi+iIXEWD7wCNbIO6lYR62oPCTQyrddi5OMYVXHzeCSoneZwJuS8sBvlEwDw==
"@isaacs/cliui@^8.0.2": "@isaacs/cliui@^8.0.2":
version "8.0.2" version "8.0.2"
resolved "https://registry.yarnpkg.com/@isaacs/cliui/-/cliui-8.0.2.tgz#b37667b7bc181c168782259bab42474fbf52b550" resolved "https://registry.yarnpkg.com/@isaacs/cliui/-/cliui-8.0.2.tgz#b37667b7bc181c168782259bab42474fbf52b550"
@ -1690,6 +1695,36 @@ discord.js@^14.3.0:
undici "5.27.2" undici "5.27.2"
ws "8.14.2" ws "8.14.2"
dom-serializer@^2.0.0:
version "2.0.0"
resolved "https://registry.yarnpkg.com/dom-serializer/-/dom-serializer-2.0.0.tgz#e41b802e1eedf9f6cae183ce5e622d789d7d8e53"
integrity sha512-wIkAryiqt/nV5EQKqQpo3SToSOV9J0DnbJqwK7Wv/Trc92zIAYZ4FlMu+JPFW1DfGFt81ZTCGgDEabffXeLyJg==
dependencies:
domelementtype "^2.3.0"
domhandler "^5.0.2"
entities "^4.2.0"
domelementtype@^2.3.0:
version "2.3.0"
resolved "https://registry.yarnpkg.com/domelementtype/-/domelementtype-2.3.0.tgz#5c45e8e869952626331d7aab326d01daf65d589d"
integrity sha512-OLETBj6w0OsagBwdXnPdN0cnMfF9opN69co+7ZrbfPGrdpPVNBUj02spi6B1N7wChLQiPn4CSH/zJvXw56gmHw==
domhandler@^5.0.2, domhandler@^5.0.3:
version "5.0.3"
resolved "https://registry.yarnpkg.com/domhandler/-/domhandler-5.0.3.tgz#cc385f7f751f1d1fc650c21374804254538c7d31"
integrity sha512-cgwlv/1iFQiFnU96XXgROh8xTeetsnJiDsTc7TYCLFd9+/WNkIqPTxiM/8pSd8VIrhXGTf1Ny1q1hquVqDJB5w==
dependencies:
domelementtype "^2.3.0"
domutils@^3.1.0:
version "3.1.0"
resolved "https://registry.yarnpkg.com/domutils/-/domutils-3.1.0.tgz#c47f551278d3dc4b0b1ab8cbb42d751a6f0d824e"
integrity sha512-H78uMmQtI2AhgDJjWeQmHwJJ2bLPD3GMmO7Zja/ZZh84wkm+4ut+IUnUdRa8uCGX88DiVx1j6FRe1XfxEgjEZA==
dependencies:
dom-serializer "^2.0.0"
domelementtype "^2.3.0"
domhandler "^5.0.3"
dot-prop@^6.0.1: dot-prop@^6.0.1:
version "6.0.1" version "6.0.1"
resolved "https://registry.yarnpkg.com/dot-prop/-/dot-prop-6.0.1.tgz#fc26b3cf142b9e59b74dbd39ed66ce620c681083" resolved "https://registry.yarnpkg.com/dot-prop/-/dot-prop-6.0.1.tgz#fc26b3cf142b9e59b74dbd39ed66ce620c681083"
@ -1744,6 +1779,11 @@ end-of-stream@^1.1.0:
dependencies: dependencies:
once "^1.4.0" once "^1.4.0"
entities@^4.2.0, entities@^4.5.0:
version "4.5.0"
resolved "https://registry.yarnpkg.com/entities/-/entities-4.5.0.tgz#5d268ea5e7113ec74c4d033b79ea5a35a488fb48"
integrity sha512-V0hjH4dGPh9Ao5p0MoRY6BVqtwCjhz6vI5LT8AJ55H+4g9/4vbHx1I54fS0XuclLhDHArPQCiMjDxjaL8fPxhw==
error-ex@^1.3.1: error-ex@^1.3.1:
version "1.3.2" version "1.3.2"
resolved "https://registry.yarnpkg.com/error-ex/-/error-ex-1.3.2.tgz#b4ac40648107fdcdcfae242f428bea8a14d4f1bf" resolved "https://registry.yarnpkg.com/error-ex/-/error-ex-1.3.2.tgz#b4ac40648107fdcdcfae242f428bea8a14d4f1bf"
@ -1903,7 +1943,7 @@ figures@^2.0.0:
dependencies: dependencies:
escape-string-regexp "^1.0.5" escape-string-regexp "^1.0.5"
figures@^3.0.0, figures@^3.2.0: figures@^3.0.0:
version "3.2.0" version "3.2.0"
resolved "https://registry.yarnpkg.com/figures/-/figures-3.2.0.tgz#625c18bd293c604dc4a8ddb2febf0c88341746af" resolved "https://registry.yarnpkg.com/figures/-/figures-3.2.0.tgz#625c18bd293c604dc4a8ddb2febf0c88341746af"
integrity sha512-yaduQFRKLXYOGgEn6AZau90j3ggSOyiqXU0F9JZfeXYhNa+Jk4X+s45A2zg5jns87GAFa34BBm2kXw4XpNcbdg== integrity sha512-yaduQFRKLXYOGgEn6AZau90j3ggSOyiqXU0F9JZfeXYhNa+Jk4X+s45A2zg5jns87GAFa34BBm2kXw4XpNcbdg==
@ -2188,6 +2228,16 @@ html-escaper@^2.0.0:
resolved "https://registry.yarnpkg.com/html-escaper/-/html-escaper-2.0.2.tgz#dfd60027da36a36dfcbe236262c00a5822681453" resolved "https://registry.yarnpkg.com/html-escaper/-/html-escaper-2.0.2.tgz#dfd60027da36a36dfcbe236262c00a5822681453"
integrity sha512-H2iMtd0I4Mt5eYiapRdIDjp+XzelXQ0tFE4JS7YFwFevXXMmOp9myNrUvCg0D6ws8iqkRPBfKHgbwig1SmlLfg== integrity sha512-H2iMtd0I4Mt5eYiapRdIDjp+XzelXQ0tFE4JS7YFwFevXXMmOp9myNrUvCg0D6ws8iqkRPBfKHgbwig1SmlLfg==
htmlparser2@^9.1.0:
version "9.1.0"
resolved "https://registry.yarnpkg.com/htmlparser2/-/htmlparser2-9.1.0.tgz#cdb498d8a75a51f739b61d3f718136c369bc8c23"
integrity sha512-5zfg6mHUoaer/97TxnGpxmbR7zJtPwIYFMZ/H5ucTlPZhKvtum05yiPK3Mgai3a0DyVxv7qYqoweaEd2nrYQzQ==
dependencies:
domelementtype "^2.3.0"
domhandler "^5.0.3"
domutils "^3.1.0"
entities "^4.5.0"
http-cache-semantics@^4.0.0, http-cache-semantics@^4.1.1: http-cache-semantics@^4.0.0, http-cache-semantics@^4.1.1:
version "4.1.1" version "4.1.1"
resolved "https://registry.yarnpkg.com/http-cache-semantics/-/http-cache-semantics-4.1.1.tgz#abe02fcb2985460bf0323be664436ec3476a6d5a" resolved "https://registry.yarnpkg.com/http-cache-semantics/-/http-cache-semantics-4.1.1.tgz#abe02fcb2985460bf0323be664436ec3476a6d5a"
@ -2352,17 +2402,17 @@ inquirer@^7.0.0:
through "^2.3.6" through "^2.3.6"
inquirer@^9.2.15: inquirer@^9.2.15:
version "9.2.17" version "9.2.19"
resolved "https://registry.yarnpkg.com/inquirer/-/inquirer-9.2.17.tgz#87783875f2983cf8f64c30acb9c59cf044c71bc6" resolved "https://registry.yarnpkg.com/inquirer/-/inquirer-9.2.19.tgz#e142ebc111b6328a21eb84d8e7dd226ff824239e"
integrity sha512-Vr3Ia2ud5sGnioURkE69endl4SkeJcMzTF6SosKcX5GALJfId7C+JvO5ZZb6y1LOXnEofCPbwzoQ1q0e8Gaduw== integrity sha512-WpxOT71HGsFya6/mj5PUue0sWwbpbiPfAR+332zLj/siB0QA1PZM8v3GepegFV1Op189UxHUCF6y8AySdtOMVA==
dependencies: dependencies:
"@inquirer/figures" "^1.0.1"
"@ljharb/through" "^2.3.13" "@ljharb/through" "^2.3.13"
ansi-escapes "^4.3.2" ansi-escapes "^4.3.2"
chalk "^5.3.0" chalk "^5.3.0"
cli-cursor "^3.1.0" cli-cursor "^3.1.0"
cli-width "^4.1.0" cli-width "^4.1.0"
external-editor "^3.1.0" external-editor "^3.1.0"
figures "^3.2.0"
lodash "^4.17.21" lodash "^4.17.21"
mute-stream "1.0.0" mute-stream "1.0.0"
ora "^5.4.1" ora "^5.4.1"
@ -3420,9 +3470,9 @@ normalize-url@^8.0.0:
integrity sha512-IO9QvjUMWxPQQhs60oOu10CRkWCiZzSUkzbXGGV9pviYl1fXYcvkzQ5jV9z8Y6un8ARoVRl4EtC6v6jNqbaJ/w== integrity sha512-IO9QvjUMWxPQQhs60oOu10CRkWCiZzSUkzbXGGV9pviYl1fXYcvkzQ5jV9z8Y6un8ARoVRl4EtC6v6jNqbaJ/w==
np@^10.0.0: np@^10.0.0:
version "10.0.3" version "10.0.5"
resolved "https://registry.yarnpkg.com/np/-/np-10.0.3.tgz#777e0e52fcc874949d28fff3cbdb54b9fffd4066" resolved "https://registry.yarnpkg.com/np/-/np-10.0.5.tgz#575c056b54534534ccbc978e6699d8bfcd4740c4"
integrity sha512-JioZkOd7DtT1nkGnVOUrPfD7P3SlNbjsT2dHxMDsxpZcpd44iP4J4Nn9OTjCAhf9LK4EezTcIfU7QadyupEvxg== integrity sha512-Tu270vVvsh92uh6XDXrGS6D94PhzxQYqM8uUxftYVp0B8qXl78dJRYwQ9wfYMOBB9ynlF79eWlUtPUxPzKGddQ==
dependencies: dependencies:
chalk "^5.3.0" chalk "^5.3.0"
chalk-template "^1.1.0" chalk-template "^1.1.0"
@ -3818,13 +3868,14 @@ quick-lru@^5.1.1:
resolved "https://registry.yarnpkg.com/quick-lru/-/quick-lru-5.1.1.tgz#366493e6b3e42a3a6885e2e99d18f80fb7a8c932" resolved "https://registry.yarnpkg.com/quick-lru/-/quick-lru-5.1.1.tgz#366493e6b3e42a3a6885e2e99d18f80fb7a8c932"
integrity sha512-WuyALRjWPDGtt/wzJiadO5AXY+8hZ80hVpe6MyivgraREW751X3SbhRvG3eLKOYN+8VEvqLcf3wdnt44Z4S4SA== integrity sha512-WuyALRjWPDGtt/wzJiadO5AXY+8hZ80hVpe6MyivgraREW751X3SbhRvG3eLKOYN+8VEvqLcf3wdnt44Z4S4SA==
random-bunny@^2.0.5: random-bunny@^2.1.6:
version "2.1.5" version "2.1.6"
resolved "https://registry.yarnpkg.com/random-bunny/-/random-bunny-2.1.5.tgz#f944cb1e525b1deba462186831d8482d49bc6521" resolved "https://registry.yarnpkg.com/random-bunny/-/random-bunny-2.1.6.tgz#80a22fa0fafdffa02c2ec01a02078387607ac87e"
integrity sha512-CjxDxn+JlVZvu3LUUuwi5OOGB1J4/E4ff9EHdlkGEgdCYHszW7m8JLX9Sqgaxs7w4U6Kkq7eX59OAx+oIPwCrA== integrity sha512-jsPvEoM6Ux3VbZFspiZiOhuQ+SaBVGFPq1R4EwWFRstSJrJJBKQyjtTUOvis5ejxyMKAOIsXvn3owNnzo5eWow==
dependencies: dependencies:
glob-parent "^6.0.0" glob-parent "^6.0.0"
got-cjs "^12.5.4" got-cjs "^12.5.4"
htmlparser2 "^9.1.0"
linqts "^1.14.4" linqts "^1.14.4"
rc@1.2.8: rc@1.2.8: