Merge branch 'main' into development
diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml
index 325f0d8..7c5ccbb 100644
--- a/.github/workflows/lint.yml
+++ b/.github/workflows/lint.yml
@@ -18,13 +18,13 @@
steps:
- uses: actions/checkout@v3
- - uses: actions/setup-node@v3.6.0
+ - uses: cachix/install-nix-action@v19
with:
- node-version: 19.x
- - run: yarn install --immutable
+ github_access_token: ${{ secrets.GITHUB_TOKEN }}
+ - run: nix develop --command yarn install --immutable --immutable-cache --check-cache
- name: Show versions
- run: yarn run versions
+ run: nix develop --command yarn run versions
- name: Compile
- run: yarn build
+ run: nix develop --command yarn build
- name: Run prettier and eslint
- run: yarn lint-ci
+ run: nix develop --command yarn lint-ci
diff --git a/src/events/messageCreate.ts b/src/events/messageCreate.ts
index 6c26d2a..cc69bf0 100644
--- a/src/events/messageCreate.ts
+++ b/src/events/messageCreate.ts
@@ -268,7 +268,7 @@
const check = TestString(
content,
config.filters.wordFilter.words.loose,
- config.filters.wordFilter.words.strict,
+ config.filters.wordFilter.words.strict
);
if (check !== null) {
messageException(message.guild.id, message.channel.id, message.id);
diff --git a/src/utils/database.ts b/src/utils/database.ts
index 7353ff7..67ff5ac 100644
--- a/src/utils/database.ts
+++ b/src/utils/database.ts
@@ -618,37 +618,37 @@
}
async write(hash: string, type: "nsfw" | "malware" | "bad_link", data: boolean, tags?: string[]) {
- await this.scanCache.insertOne(
- { hash: hash, [type]: data, tags: tags ?? [], addedAt: new Date() },
- collectionOptions
- );
- // await this.scanCache.updateOne(
- // { hash: hash },
- // {
- // $set: (() => {
- // switch (type) {
- // case "nsfw": {
- // return { nsfw: data, addedAt: new Date() };
- // }
- // case "malware": {
- // return { malware: data, addedAt: new Date() };
- // }
- // case "bad_link": {
- // return { bad_link: data, tags: tags ?? [], addedAt: new Date() };
- // }
- // default: {
- // throw new Error("Invalid type");
- // }
- // }
- // })()
- // // No you can't just do { [type]: data }, yes it's a typescript error, no I don't know how to fix it
- // // cleanly, yes it would be marginally more elegant, no it's not essential, yes I'd be happy to review
- // // PRs that did improve this snippet
- // // Made an attempt... Gave up... Just Leave It
- // // Counter: 2
- // },
- // Object.assign({ upsert: true }, collectionOptions)
+ // await this.scanCache.insertOne(
+ // { hash: hash, [type]: data, tags: tags ?? [], addedAt: new Date() },
+ // collectionOptions
// );
+ await this.scanCache.updateOne(
+ { hash: hash },
+ {
+ $set: (() => {
+ switch (type) {
+ case "nsfw": {
+ return { nsfw: data, addedAt: new Date() };
+ }
+ case "malware": {
+ return { malware: data, addedAt: new Date() };
+ }
+ case "bad_link": {
+ return { bad_link: data, tags: tags ?? [], addedAt: new Date() };
+ }
+ default: {
+ throw new Error("Invalid type");
+ }
+ }
+ })()
+ // No you can't just do { [type]: data }, yes it's a typescript error, no I don't know how to fix it
+ // cleanly, yes it would be marginally more elegant, no it's not essential, yes I'd be happy to review
+ // PRs that did improve this snippet
+ // Made an attempt... Gave up... Just Leave It
+ // Counter: 2
+ },
+ Object.assign({ upsert: true }, collectionOptions)
+ );
}
async cleanup() {