Merge branch 'main' into develop
All checks were successful
continuous-integration/drone/push Build is passing
All checks were successful
continuous-integration/drone/push Build is passing
This commit is contained in:
commit
c6cb35a12c
9 changed files with 74 additions and 18 deletions
2
.dev.env
2
.dev.env
|
@ -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
|
||||||
|
|
|
@ -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
|
||||||
|
|
|
@ -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
|
||||||
|
|
|
@ -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
|
||||||
|
|
|
@ -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"
|
||||||
},
|
},
|
||||||
|
|
|
@ -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.");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -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);
|
||||||
|
|
|
@ -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) {
|
||||||
|
|
54
yarn.lock
54
yarn.lock
|
@ -1681,6 +1681,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"
|
||||||
|
@ -1735,6 +1765,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"
|
||||||
|
@ -2194,6 +2229,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"
|
||||||
|
@ -3836,13 +3881,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:
|
||||||
|
|
Loading…
Reference in a new issue