Compare commits
10 commits
5f4fd725f9
...
bf3097216e
Author | SHA1 | Date | |
---|---|---|---|
bf3097216e | |||
c6cb35a12c | |||
3b0586ddad | |||
1c430222aa | |||
c9789a3c77 | |||
5678097aac | |||
d6330ae501 | |||
f3d67bb33a | |||
790afcca4a | |||
2b04952d85 |
9 changed files with 87 additions and 26 deletions
2
.dev.env
2
.dev.env
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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"
|
||||
},
|
||||
|
|
|
@ -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.");
|
||||
}
|
||||
}
|
||||
}
|
|
@ -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);
|
||||
|
|
|
@ -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) {
|
||||
|
|
75
yarn.lock
75
yarn.lock
|
@ -391,6 +391,11 @@
|
|||
resolved "https://registry.yarnpkg.com/@fastify/busboy/-/busboy-2.1.0.tgz#0709e9f4cb252351c609c6e6d8d6779a8d25edff"
|
||||
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":
|
||||
version "8.0.2"
|
||||
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"
|
||||
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"
|
||||
|
@ -1744,6 +1779,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"
|
||||
|
@ -1903,7 +1943,7 @@ figures@^2.0.0:
|
|||
dependencies:
|
||||
escape-string-regexp "^1.0.5"
|
||||
|
||||
figures@^3.0.0, figures@^3.2.0:
|
||||
figures@^3.0.0:
|
||||
version "3.2.0"
|
||||
resolved "https://registry.yarnpkg.com/figures/-/figures-3.2.0.tgz#625c18bd293c604dc4a8ddb2febf0c88341746af"
|
||||
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"
|
||||
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"
|
||||
|
@ -2352,17 +2402,17 @@ inquirer@^7.0.0:
|
|||
through "^2.3.6"
|
||||
|
||||
inquirer@^9.2.15:
|
||||
version "9.2.17"
|
||||
resolved "https://registry.yarnpkg.com/inquirer/-/inquirer-9.2.17.tgz#87783875f2983cf8f64c30acb9c59cf044c71bc6"
|
||||
integrity sha512-Vr3Ia2ud5sGnioURkE69endl4SkeJcMzTF6SosKcX5GALJfId7C+JvO5ZZb6y1LOXnEofCPbwzoQ1q0e8Gaduw==
|
||||
version "9.2.19"
|
||||
resolved "https://registry.yarnpkg.com/inquirer/-/inquirer-9.2.19.tgz#e142ebc111b6328a21eb84d8e7dd226ff824239e"
|
||||
integrity sha512-WpxOT71HGsFya6/mj5PUue0sWwbpbiPfAR+332zLj/siB0QA1PZM8v3GepegFV1Op189UxHUCF6y8AySdtOMVA==
|
||||
dependencies:
|
||||
"@inquirer/figures" "^1.0.1"
|
||||
"@ljharb/through" "^2.3.13"
|
||||
ansi-escapes "^4.3.2"
|
||||
chalk "^5.3.0"
|
||||
cli-cursor "^3.1.0"
|
||||
cli-width "^4.1.0"
|
||||
external-editor "^3.1.0"
|
||||
figures "^3.2.0"
|
||||
lodash "^4.17.21"
|
||||
mute-stream "1.0.0"
|
||||
ora "^5.4.1"
|
||||
|
@ -3420,9 +3470,9 @@ normalize-url@^8.0.0:
|
|||
integrity sha512-IO9QvjUMWxPQQhs60oOu10CRkWCiZzSUkzbXGGV9pviYl1fXYcvkzQ5jV9z8Y6un8ARoVRl4EtC6v6jNqbaJ/w==
|
||||
|
||||
np@^10.0.0:
|
||||
version "10.0.3"
|
||||
resolved "https://registry.yarnpkg.com/np/-/np-10.0.3.tgz#777e0e52fcc874949d28fff3cbdb54b9fffd4066"
|
||||
integrity sha512-JioZkOd7DtT1nkGnVOUrPfD7P3SlNbjsT2dHxMDsxpZcpd44iP4J4Nn9OTjCAhf9LK4EezTcIfU7QadyupEvxg==
|
||||
version "10.0.5"
|
||||
resolved "https://registry.yarnpkg.com/np/-/np-10.0.5.tgz#575c056b54534534ccbc978e6699d8bfcd4740c4"
|
||||
integrity sha512-Tu270vVvsh92uh6XDXrGS6D94PhzxQYqM8uUxftYVp0B8qXl78dJRYwQ9wfYMOBB9ynlF79eWlUtPUxPzKGddQ==
|
||||
dependencies:
|
||||
chalk "^5.3.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"
|
||||
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:
|
||||
|
|
Loading…
Reference in a new issue