Compare commits

..

9 commits

Author SHA1 Message Date
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 74 additions and 18 deletions

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

@ -1681,6 +1681,36 @@ discord.js@^14.3.0:
undici "5.27.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:
version "6.0.1"
resolved "https://registry.yarnpkg.com/dot-prop/-/dot-prop-6.0.1.tgz#fc26b3cf142b9e59b74dbd39ed66ce620c681083"
@ -1735,6 +1765,11 @@ end-of-stream@^1.1.0:
dependencies:
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:
version "1.3.2"
resolved "https://registry.yarnpkg.com/error-ex/-/error-ex-1.3.2.tgz#b4ac40648107fdcdcfae242f428bea8a14d4f1bf"
@ -2194,6 +2229,16 @@ html-escaper@^2.0.0:
resolved "https://registry.yarnpkg.com/html-escaper/-/html-escaper-2.0.2.tgz#dfd60027da36a36dfcbe236262c00a5822681453"
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:
version "4.1.1"
resolved "https://registry.yarnpkg.com/http-cache-semantics/-/http-cache-semantics-4.1.1.tgz#abe02fcb2985460bf0323be664436ec3476a6d5a"
@ -3836,13 +3881,14 @@ quick-lru@^5.1.1:
resolved "https://registry.yarnpkg.com/quick-lru/-/quick-lru-5.1.1.tgz#366493e6b3e42a3a6885e2e99d18f80fb7a8c932"
integrity sha512-WuyALRjWPDGtt/wzJiadO5AXY+8hZ80hVpe6MyivgraREW751X3SbhRvG3eLKOYN+8VEvqLcf3wdnt44Z4S4SA==
random-bunny@^2.0.5:
version "2.1.5"
resolved "https://registry.yarnpkg.com/random-bunny/-/random-bunny-2.1.5.tgz#f944cb1e525b1deba462186831d8482d49bc6521"
integrity sha512-CjxDxn+JlVZvu3LUUuwi5OOGB1J4/E4ff9EHdlkGEgdCYHszW7m8JLX9Sqgaxs7w4U6Kkq7eX59OAx+oIPwCrA==
random-bunny@^2.1.6:
version "2.1.6"
resolved "https://registry.yarnpkg.com/random-bunny/-/random-bunny-2.1.6.tgz#80a22fa0fafdffa02c2ec01a02078387607ac87e"
integrity sha512-jsPvEoM6Ux3VbZFspiZiOhuQ+SaBVGFPq1R4EwWFRstSJrJJBKQyjtTUOvis5ejxyMKAOIsXvn3owNnzo5eWow==
dependencies:
glob-parent "^6.0.0"
got-cjs "^12.5.4"
htmlparser2 "^9.1.0"
linqts "^1.14.4"
rc@1.2.8: