Compare commits

...

18 commits

Author SHA1 Message Date
866beb0e04 Add untracked counter
All checks were successful
Test / build (push) Successful in 6s
2024-10-29 10:49:09 +00:00
8b0e93d324 Remove moonset command 2024-10-29 10:30:05 +00:00
2695219b20 Create moonset command 2024-10-29 10:29:31 +00:00
56a04c2703 Merge branch 'develop' into feature/300-moon-set 2024-10-29 09:59:27 +00:00
5f49117196 Upgrade to node v20
All checks were successful
Deploy To Stage / build (push) Successful in 7s
Deploy To Stage / deploy (push) Successful in 15s
2024-10-28 11:39:14 +00:00
5beebba29a Upgrade packages
Some checks failed
Deploy To Stage / build (push) Failing after 2s
Deploy To Stage / deploy (push) Has been skipped
2024-10-28 11:37:44 +00:00
fdf52c2285 Remove unused resolved packages 2024-10-28 11:34:45 +00:00
e3a583aa99 Upgrade packages 2024-10-28 11:34:11 +00:00
3a4665f907 Update dependency @types/jest to v29.5.14 (#488)
All checks were successful
Deploy To Stage / build (push) Successful in 6s
Deploy To Stage / deploy (push) Successful in 17s
This PR contains the following updates:

| Package | Type | Update | Change |
|---|---|---|---|
| [@types/jest](https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/jest) ([source](https://github.com/DefinitelyTyped/DefinitelyTyped/tree/HEAD/types/jest)) | devDependencies | patch | [`29.5.13` -> `29.5.14`](https://renovatebot.com/diffs/npm/@types%2fjest/29.5.13/29.5.14) |

---

### Configuration

📅 **Schedule**: Branch creation - At any time (no schedule defined), Automerge - At any time (no schedule defined).

🚦 **Automerge**: Disabled by config. Please merge this manually once you are satisfied.

♻ **Rebasing**: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox.

🔕 **Ignore**: Close this PR and you won't be reminded about this update again.

---

 - [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check this box

---

This PR has been generated by [Renovate Bot](https://github.com/renovatebot/renovate).
<!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiIzOC44MC4wIiwidXBkYXRlZEluVmVyIjoiMzguODAuMCIsInRhcmdldEJyYW5jaCI6ImRldmVsb3AiLCJsYWJlbHMiOltdfQ==-->

Reviewed-on: #488
Reviewed-by: Vylpes <ethan@vylpes.com>
Co-authored-by: Renovate Bot <renovate@vylpes.com>
Co-committed-by: Renovate Bot <renovate@vylpes.com>
2024-10-28 11:28:46 +00:00
60e736774d Update appleboy/ssh-action action to v1.1.0 (#482)
All checks were successful
Deploy To Stage / build (push) Successful in 8s
Deploy To Stage / deploy (push) Successful in 17s
This PR contains the following updates:

| Package | Type | Update | Change |
|---|---|---|---|
| [appleboy/ssh-action](https://github.com/appleboy/ssh-action) | action | minor | `v1.0.3` -> `v1.1.0` |

---

### Release Notes

<details>
<summary>appleboy/ssh-action (appleboy/ssh-action)</summary>

### [`v1.1.0`](https://github.com/appleboy/ssh-action/releases/tag/v1.1.0)

[Compare Source](https://github.com/appleboy/ssh-action/compare/v1.0.3...v1.1.0)

##### Changelog

##### Bug fixes

-   [`0c7561b`](0c7561b1a3): fix: switch to SSH key authentication for security ([@&#8203;appleboy](https://github.com/appleboy))

##### Enhancements

-   [`9b978f0`](9b978f09f2): chore: update SSH action version in README files ([@&#8203;appleboy](https://github.com/appleboy))
-   [`1991c55`](1991c553ec): chore(file): update target file ([@&#8203;appleboy](https://github.com/appleboy))
-   [`aa293c2`](aa293c24bb): chore: optimize system configuration and API integration ([@&#8203;appleboy](https://github.com/appleboy))
-   [`036cad7`](036cad7df7): chore: update drone-ssh to version 1.7.7 ([@&#8203;appleboy](https://github.com/appleboy))
-   [`8b60782`](8b6078208d): chore(cli): enhance version handling and testing mechanisms ([@&#8203;appleboy](https://github.com/appleboy))
-   [`5ade826`](5ade826485): chore: improve CLI reliability and version visibility ([@&#8203;appleboy](https://github.com/appleboy))
-   [`eaeb069`](eaeb06998d): chore(cli): enhance curl command with silent mode and redirects ([@&#8203;appleboy](https://github.com/appleboy))
-   [`58164d0`](58164d0dc2): chore: remove Dockerfile and related configurations ([@&#8203;appleboy](https://github.com/appleboy))

##### Refactor

-   [`da612c8`](da612c8015): refactor: optimize CI pipeline for faster execution ([@&#8203;appleboy](https://github.com/appleboy))

##### Build process updates

-   [`c781418`](c78141851a): ci: enhance GitHub Actions for IPv6 and flexibility ([#&#8203;303](https://github.com/appleboy/ssh-action/issues/303)) ([@&#8203;appleboy](https://github.com/appleboy))
-   [`d2d6858`](d2d6858859): ci: enhance GitHub workflow for SSH actions and deployments ([@&#8203;appleboy](https://github.com/appleboy))
-   [`551964e`](551964ebda): ci: optimize GitHub Actions workflow configuration ([@&#8203;appleboy](https://github.com/appleboy))
-   [`f916346`](f916346256): ci: refactor CI workflow and improve robustness ([#&#8203;320](https://github.com/appleboy/ssh-action/issues/320)) ([@&#8203;appleboy](https://github.com/appleboy))
-   [`aabaf12`](aabaf1254d): ci: add bug report template ([@&#8203;appleboy](https://github.com/appleboy))
-   [`c8594ae`](c8594ae37d): ci: implement GitHub Actions for remote SSH execution ([@&#8203;appleboy](https://github.com/appleboy))
-   [`40aad53`](40aad53c5a): ci: add SSH authentication setup for GitHub Actions ([@&#8203;appleboy](https://github.com/appleboy))
-   [`0b0e770`](0b0e77098a): ci: optimize and enhance SSH server workflow ([@&#8203;appleboy](https://github.com/appleboy))
-   [`977b74a`](977b74a12d): ci: enhance CI workflow with SSH job and optimizations ([@&#8203;appleboy](https://github.com/appleboy))
-   [`2eeab5b`](2eeab5bdba): ci: refactor GitHub Actions key management ([@&#8203;appleboy](https://github.com/appleboy))
-   [`acd41e5`](acd41e5091): ci: enhance SSH job testing with varied key/password scenarios ([@&#8203;appleboy](https://github.com/appleboy))
-   [`f05aefe`](f05aefe351): ci: enhance SSH action configuration and error handling ([@&#8203;appleboy](https://github.com/appleboy))
-   [`e40b597`](e40b597081): ci: add GitHub Actions job for SSH key passphrase support ([@&#8203;appleboy](https://github.com/appleboy))
-   [`15b64dc`](15b64dc891): ci: enhance CI pipeline with SSH key handling improvements ([@&#8203;appleboy](https://github.com/appleboy))
-   [`a39b3cc`](a39b3cce7d): ci: enhance CI/CD pipeline with SSH command execution ([@&#8203;appleboy](https://github.com/appleboy))
-   [`815c574`](815c5743ac): ci: enhance deployment with multi-host SSH action ([@&#8203;appleboy](https://github.com/appleboy))
-   [`378323e`](378323e4c8): ci: add multi-server support to CI workflow ([@&#8203;appleboy](https://github.com/appleboy))
-   [`fc1c1fc`](fc1c1fce51): ci: add GitHub Actions job for [`ed25519`](https://github.com/appleboy/ssh-action/commit/ed25519) key support ([@&#8203;appleboy](https://github.com/appleboy))
-   [`f0e5a23`](f0e5a23d53): ci: add environment variable handling in GitHub Actions ([@&#8203;appleboy](https://github.com/appleboy))
-   [`9c32aa6`](9c32aa61f8): ci: refactor workflows and API integrations ([@&#8203;appleboy](https://github.com/appleboy))
-   [`97f8d75`](97f8d752b5): ci: enable root access in CI pipeline ([@&#8203;appleboy](https://github.com/appleboy))
-   [`5a8776f`](5a8776fd15): ci: switch to password authentication in GitHub workflow ([@&#8203;appleboy](https://github.com/appleboy))
-   [`b6941ae`](b6941ae5d5): ci: refactor codebase and optimize performance ([@&#8203;appleboy](https://github.com/appleboy))
-   [`43895f2`](43895f2cd5): ci: refactor SSH testing workflows and job configurations ([@&#8203;appleboy](https://github.com/appleboy))
-   [`06fa62e`](06fa62e61c): ci: rename the workflow files. ([@&#8203;appleboy](https://github.com/appleboy))
-   [`b4a07ca`](b4a07ca594): ci: enhance GitHub Actions with secret variable support ([#&#8203;330](https://github.com/appleboy/ssh-action/issues/330)) ([@&#8203;appleboy](https://github.com/appleboy))
-   [`25ce8cb`](25ce8cbbcb): ci: implement automated release workflow with GoReleaser ([@&#8203;appleboy](https://github.com/appleboy))

##### Documentation updates

-   [`8a779a5`](8a779a5b1a): docs: describe true usage of allenvs parameter ([#&#8203;301](https://github.com/appleboy/ssh-action/issues/301)) ([@&#8203;hussu010](https://github.com/hussu010))
-   [`fe44be0`](fe44be0b96): docs: improve documentation and CI robustness ([@&#8203;appleboy](https://github.com/appleboy))
-   [`dd0f09c`](dd0f09ca07): docs: improve README clarity and completeness ([@&#8203;appleboy](https://github.com/appleboy))
-   [`71d43ea`](71d43ea0f7): docs: improve documentation and testing configurations ([@&#8203;appleboy](https://github.com/appleboy))
-   [`28428a1`](28428a13f5): docs: improve cross-platform clipboard support for key copying ([@&#8203;appleboy](https://github.com/appleboy))
-   [`d732991`](d732991ab0): docs(lang): README.zh-cn Document ([#&#8203;332](https://github.com/appleboy/ssh-action/issues/332)) ([@&#8203;astralwaveio](https://github.com/astralwaveio))

</details>

---

### Configuration

📅 **Schedule**: Branch creation - At any time (no schedule defined), Automerge - At any time (no schedule defined).

🚦 **Automerge**: Disabled by config. Please merge this manually once you are satisfied.

♻ **Rebasing**: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox.

🔕 **Ignore**: Close this PR and you won't be reminded about this update again.

---

 - [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check this box

---

This PR has been generated by [Renovate Bot](https://github.com/renovatebot/renovate).
<!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiIzOC44MC4wIiwidXBkYXRlZEluVmVyIjoiMzguODAuMCIsInRhcmdldEJyYW5jaCI6ImRldmVsb3AiLCJsYWJlbHMiOltdfQ==-->

Reviewed-on: #482
Reviewed-by: Vylpes <ethan@vylpes.com>
Co-authored-by: Renovate Bot <renovate@vylpes.com>
Co-committed-by: Renovate Bot <renovate@vylpes.com>
2024-10-28 11:27:39 +00:00
1aca8c7b60 Update dependency @types/node to v22.8.1 (#480)
All checks were successful
Deploy To Stage / build (push) Successful in 8s
Deploy To Stage / deploy (push) Successful in 15s
This PR contains the following updates:

| Package | Type | Update | Change |
|---|---|---|---|
| [@types/node](https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/node) ([source](https://github.com/DefinitelyTyped/DefinitelyTyped/tree/HEAD/types/node)) | devDependencies | minor | [`22.5.5` -> `22.8.1`](https://renovatebot.com/diffs/npm/@types%2fnode/22.5.5/22.8.1) |

---

### Configuration

📅 **Schedule**: Branch creation - At any time (no schedule defined), Automerge - At any time (no schedule defined).

🚦 **Automerge**: Disabled by config. Please merge this manually once you are satisfied.

♻ **Rebasing**: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox.

🔕 **Ignore**: Close this PR and you won't be reminded about this update again.

---

 - [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check this box

---

This PR has been generated by [Renovate Bot](https://github.com/renovatebot/renovate).
<!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiIzOC44MC4wIiwidXBkYXRlZEluVmVyIjoiMzguODAuMCIsInRhcmdldEJyYW5jaCI6ImRldmVsb3AiLCJsYWJlbHMiOltdfQ==-->

Reviewed-on: #480
Reviewed-by: Vylpes <ethan@vylpes.com>
Co-authored-by: Renovate Bot <renovate@vylpes.com>
Co-committed-by: Renovate Bot <renovate@vylpes.com>
2024-10-28 11:26:25 +00:00
b81f607702 Merge branch 'main' into develop
All checks were successful
Deploy To Stage / build (push) Successful in 10s
Deploy To Stage / deploy (push) Successful in 15s
2024-10-18 18:12:07 +01:00
6acc5a9a02 v3.2.3
All checks were successful
Deploy To Production / build (push) Successful in 7s
Deploy To Production / deploy (push) Successful in 15s
2024-10-18 18:09:26 +01:00
d75f7e650c 3.2.3 2024-10-18 18:09:19 +01:00
923348d809 Migrate to yarn
All checks were successful
Test / build (push) Successful in 9s
2024-10-18 18:07:42 +01:00
6f91134756 Add to registry
Some checks failed
Test / build (push) Failing after 3s
2024-10-18 18:04:49 +01:00
1acedfbd3d WIP: Start of implementing a link-only mode
Some checks failed
Test / build (push) Failing after 4s
2024-10-12 13:45:41 +01:00
4ed5beb42a Move to yarn 2024-10-12 13:04:44 +01:00
18 changed files with 530 additions and 536 deletions

View file

@ -16,7 +16,7 @@ jobs:
- name: Use Node.js - name: Use Node.js
uses: actions/setup-node@v4 uses: actions/setup-node@v4
with: with:
node-version: 18.x node-version: 20.x
- run: yarn install --frozen-lockfile - run: yarn install --frozen-lockfile
- run: yarn build - run: yarn build
- run: yarn test - run: yarn test
@ -29,7 +29,7 @@ jobs:
needs: build needs: build
runs-on: node runs-on: node
steps: steps:
- uses: https://github.com/appleboy/ssh-action@v1.0.3 - uses: https://github.com/appleboy/ssh-action@v1.1.0
env: env:
DB_NAME: ${{ secrets.PROD_DB_NAME }} DB_NAME: ${{ secrets.PROD_DB_NAME }}
DB_AUTH_USER: ${{ secrets.PROD_DB_AUTH_USER }} DB_AUTH_USER: ${{ secrets.PROD_DB_AUTH_USER }}

View file

@ -16,7 +16,7 @@ jobs:
- name: Use Node.js - name: Use Node.js
uses: actions/setup-node@v4 uses: actions/setup-node@v4
with: with:
node-version: 18.x node-version: 20.x
- run: yarn install --frozen-lockfile - run: yarn install --frozen-lockfile
- run: yarn build - run: yarn build
- run: yarn test - run: yarn test
@ -29,7 +29,7 @@ jobs:
needs: build needs: build
runs-on: node runs-on: node
steps: steps:
- uses: https://github.com/appleboy/ssh-action@v1.0.3 - uses: https://github.com/appleboy/ssh-action@v1.1.0
env: env:
DB_NAME: ${{ secrets.STAGE_DB_NAME }} DB_NAME: ${{ secrets.STAGE_DB_NAME }}
DB_AUTH_USER: ${{ secrets.STAGE_DB_AUTH_USER }} DB_AUTH_USER: ${{ secrets.STAGE_DB_AUTH_USER }}

View file

@ -18,7 +18,7 @@ jobs:
- name: Use Node.js - name: Use Node.js
uses: actions/setup-node@v4 uses: actions/setup-node@v4
with: with:
node-version: 18.x node-version: 20.x
- run: yarn install --frozen-lockfile - run: yarn install --frozen-lockfile
- run: yarn build - run: yarn build
- run: yarn test - run: yarn test

View file

@ -1,6 +1,6 @@
{ {
"name": "vylbot-app", "name": "vylbot-app",
"version": "3.2.2", "version": "3.2.3",
"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",
@ -32,14 +32,12 @@
"discord.js": "^14.3.0", "discord.js": "^14.3.0",
"dotenv": "^16.0.0", "dotenv": "^16.0.0",
"emoji-regex": "^10.0.0", "emoji-regex": "^10.0.0",
"minimatch": "9.0.5", "minimatch": "10.0.1",
"mysql": "^2.18.1", "mysql": "^2.18.1",
"random-bunny": "^2.1.6", "random-bunny": "^2.1.6",
"typeorm": "0.3.20" "typeorm": "^0.3.20"
}, },
"resolutions": { "resolutions": {
"**/semver": "^7.5.2",
"**/undici": "^6.0.0"
}, },
"devDependencies": { "devDependencies": {
"@types/jest": "^29.5.12", "@types/jest": "^29.5.12",

View file

@ -29,7 +29,18 @@ export default async function List(interaction: ButtonInteraction) {
const totalPages = Math.ceil(moons[1] / pageLength); const totalPages = Math.ceil(moons[1] / pageLength);
const description = moons[0].flatMap(x => `**${x.MoonNumber} -** ${x.Description.slice(0, 15)}`); let description = ["*none*"];
if (moons[0].length > 0) {
description = moons[0].flatMap(x => `**${x.MoonNumber} -** ${x.Description.slice(0, 15)}`);
}
const moonDifference = totalMoons - moons[1];
const isLastPage = pageNumber + 1 == totalPages || moons[0].length == 0;
if (isLastPage && moonDifference > 0) {
description.push(`...plus ${moonDifference} more untracked`);
}
const embed = new EmbedBuilder() const embed = new EmbedBuilder()
.setTitle(`${member?.user.username}'s Moons`) .setTitle(`${member?.user.username}'s Moons`)
@ -48,7 +59,7 @@ export default async function List(interaction: ButtonInteraction) {
.setCustomId(`moons list ${userId} ${pageNumber + 1}`) .setCustomId(`moons list ${userId} ${pageNumber + 1}`)
.setLabel("Next") .setLabel("Next")
.setStyle(ButtonStyle.Primary) .setStyle(ButtonStyle.Primary)
.setDisabled(pageNumber + 1 == totalPages)); .setDisabled(isLastPage));
await interaction.update({ await interaction.update({
embeds: [ embed ], embeds: [ embed ],

View file

@ -11,17 +11,23 @@ export default async function ListMoons(interaction: CommandInteraction) {
const moons = await Moon.FetchPaginatedMoonsByUserId(user.id, pageLength, page); const moons = await Moon.FetchPaginatedMoonsByUserId(user.id, pageLength, page);
if (!moons || moons[0].length == 0) {
await interaction.reply(`${user.username} does not have any moons or page is invalid.`);
return;
}
const moonSetting = await UserSetting.FetchOneByKey(interaction.user.id, "moons"); const moonSetting = await UserSetting.FetchOneByKey(interaction.user.id, "moons");
const totalMoons = moonSetting && Number(moonSetting.Value) ? Number(moonSetting.Value) : 0; const totalMoons = moonSetting && Number(moonSetting.Value) ? Number(moonSetting.Value) : 0;
const totalPages = Math.ceil(moons[1] / pageLength); const totalPages = Math.ceil(moons[1] / pageLength);
const description = moons[0].flatMap(x => `**${x.MoonNumber} -** ${x.Description.slice(0, 15)}`); let description = ["*none*"];
if (moons[0].length > 0) {
description = moons[0].flatMap(x => `**${x.MoonNumber} -** ${x.Description.slice(0, 15)}`);
}
const moonDifference = totalMoons - moons[1];
const isLastPage = page + 1 == totalPages || moons[0].length == 0;
if (isLastPage && moonDifference > 0) {
description.push(`...plus ${moonDifference} more untracked`);
}
const embed = new EmbedBuilder() const embed = new EmbedBuilder()
.setTitle(`${user.username}'s Moons`) .setTitle(`${user.username}'s Moons`)
@ -40,7 +46,7 @@ export default async function ListMoons(interaction: CommandInteraction) {
.setCustomId(`moons list ${user.id} ${page + 1}`) .setCustomId(`moons list ${user.id} ${page + 1}`)
.setLabel("Next") .setLabel("Next")
.setStyle(ButtonStyle.Primary) .setStyle(ButtonStyle.Primary)
.setDisabled(page + 1 == totalPages)); .setDisabled(isLastPage));
await interaction.reply({ await interaction.reply({
embeds: [ embed ], embeds: [ embed ],

View file

@ -1,28 +0,0 @@
import { CommandInteraction, PermissionFlagsBits, SlashCommandBuilder } from "discord.js";
import { Command } from "../../type/command";
import UserSetting from "../../database/entities/UserSetting";
export default class MoonSet extends Command {
constructor() {
super();
this.CommandBuilder = new SlashCommandBuilder()
.setName("moonset")
.setDescription("Manually set a user's moons")
.setDefaultMemberPermissions(PermissionFlagsBits.Administrator)
.addUserOption(x => x
.setName("user")
.setDescription("The user to set")
.setRequired(true))
.addNumberOption(x => x
.setName("count")
.setDescription("The amount the user will have")
.setRequired(true)
.setMinValue(0));
}
public override async execute(interaction: CommandInteraction) {
const user = interaction.options.get("user", true).user!;
const count = interaction.options.get("count", true).value! as number;
}
}

View file

@ -1,4 +1,4 @@
import { CommandInteraction, EmbedBuilder, PermissionsBitField, SlashCommandBuilder } from "discord.js"; import { CommandInteraction, EmbedBuilder, PermissionsBitField, SlashCommandBuilder, TextChannel } from "discord.js";
import EmbedColours from "../../constants/EmbedColours"; import EmbedColours from "../../constants/EmbedColours";
import SettingsHelper from "../../helpers/SettingsHelper"; import SettingsHelper from "../../helpers/SettingsHelper";
import { Command } from "../../type/command"; import { Command } from "../../type/command";
@ -24,6 +24,8 @@ export default class Entry extends Command {
.setTitle("Welcome") .setTitle("Welcome")
.setDescription(`Welcome to the server! Please make sure to read the rules in the <#${rulesChannelId}> channel and type the code found there in here to proceed to the main part of the server.`); .setDescription(`Welcome to the server! Please make sure to read the rules in the <#${rulesChannelId}> channel and type the code found there in here to proceed to the main part of the server.`);
await interaction.channel.send({ embeds: [ embed ]}); const channel = interaction.channel as TextChannel;
await channel.send({ embeds: [ embed ]});
} }
} }

View file

@ -1,4 +1,4 @@
import { CommandInteraction, EmbedBuilder, PermissionsBitField, SlashCommandBuilder } from "discord.js"; import { CommandInteraction, EmbedBuilder, PermissionsBitField, SlashCommandBuilder, TextChannel } from "discord.js";
import SettingsHelper from "../helpers/SettingsHelper"; import SettingsHelper from "../helpers/SettingsHelper";
import StringTools from "../helpers/StringTools"; import StringTools from "../helpers/StringTools";
import { Command } from "../type/command"; import { Command } from "../type/command";
@ -59,6 +59,8 @@ export default class Code extends Command {
.setTitle("Entry Code") .setTitle("Entry Code")
.setDescription(code); .setDescription(code);
await interaction.channel.send({ embeds: [ embed ]}); const channel = interaction.channel as TextChannel;
await channel.send({ embeds: [ embed ]});
} }
} }

30
src/commands/linkonly.ts Normal file
View file

@ -0,0 +1,30 @@
import { CommandInteraction, PermissionFlagsBits, SlashCommandBuilder } from "discord.js";
import { Command } from "../type/command";
import SettingsHelper from "../helpers/SettingsHelper";
export default class Linkonly extends Command {
constructor() {
super();
this.CommandBuilder = new SlashCommandBuilder()
.setName("linkonly")
.setDescription("Set the link only channel, leave blank to disable")
.setDefaultMemberPermissions(PermissionFlagsBits.ManageMessages)
.addChannelOption(x => x
.setName("channel")
.setDescription("The channel"));
}
public override async execute(interaction: CommandInteraction) {
if (!interaction.guild) return;
const channel = interaction.options.get("channel")?.channel;
const channelid = channel?.id ?? "";
const channelName = channel?.name ?? "<NONE>";
await SettingsHelper.SetSetting("channel.linkonly", interaction.guild.id, channelid);
await interaction.reply(`Set the link only channel to \`${channelName}\``);
}
}

View file

@ -1,4 +1,4 @@
import { ActionRowBuilder, ButtonBuilder, ButtonStyle, CommandInteraction, EmbedBuilder, PermissionsBitField, SlashCommandBuilder } from "discord.js"; import { ActionRowBuilder, ButtonBuilder, ButtonStyle, CommandInteraction, EmbedBuilder, PermissionsBitField, SlashCommandBuilder, TextChannel } from "discord.js";
import { existsSync, readFileSync } from "fs"; import { existsSync, readFileSync } from "fs";
import EmbedColours from "../constants/EmbedColours"; import EmbedColours from "../constants/EmbedColours";
import { Command } from "../type/command"; import { Command } from "../type/command";
@ -79,7 +79,7 @@ export default class Rules extends Command {
embeds.push(embed); embeds.push(embed);
}); });
const channel = interaction.channel; const channel = interaction.channel as TextChannel;
if (!channel) { if (!channel) {
await interaction.reply({ content: "Channel not found.", ephemeral: true }); await interaction.reply({ content: "Channel not found.", ephemeral: true });
@ -109,7 +109,9 @@ export default class Rules extends Command {
.setLabel(buttonLabel || "Verify") .setLabel(buttonLabel || "Verify")
]); ]);
await interaction.channel?.send({ const channel = interaction.channel as TextChannel;
await channel.send({
components: [ row ] components: [ row ]
}); });

View file

@ -44,6 +44,9 @@ export default class DefaultValues {
this.values.push({ Key: "verification.role", Value: "Entry" }); this.values.push({ Key: "verification.role", Value: "Entry" });
this.values.push({ Key: "verification.code", Value: "" }); this.values.push({ Key: "verification.code", Value: "" });
// Gif Only Mode
this.values.push({ Key: "channel.linkonly", Value: "" })
// Event // Event
this.values.push({ Key: "event.message.delete.enabled", Value: "false" }); this.values.push({ Key: "event.message.delete.enabled", Value: "false" });
this.values.push({ Key: "event.message.delete.channel", Value: "message-logs" }); this.values.push({ Key: "event.message.delete.channel", Value: "message-logs" });

View file

@ -14,7 +14,7 @@ export default class Moon extends BaseEntity {
@Column() @Column()
MoonNumber: number; MoonNumber: number;
@Column() @Column()
Description: string; Description: string;

View file

@ -2,6 +2,7 @@ import { Message } from "discord.js";
import SettingsHelper from "../../helpers/SettingsHelper"; import SettingsHelper from "../../helpers/SettingsHelper";
import VerificationCheck from "./MessageCreate/VerificationCheck"; import VerificationCheck from "./MessageCreate/VerificationCheck";
import CacheHelper from "../../helpers/CacheHelper"; import CacheHelper from "../../helpers/CacheHelper";
import LinkOnlyMode from "./MessageCreate/LinkOnlyMode";
export default async function MessageCreate(message: Message) { export default async function MessageCreate(message: Message) {
if (!message.guild) return; if (!message.guild) return;
@ -9,6 +10,8 @@ export default async function MessageCreate(message: Message) {
await CacheHelper.UpdateServerCache(message.guild); await CacheHelper.UpdateServerCache(message.guild);
await LinkOnlyMode(message);
const isVerificationEnabled = await SettingsHelper.GetSetting("verification.enabled", message.guild.id); const isVerificationEnabled = await SettingsHelper.GetSetting("verification.enabled", message.guild.id);
if (isVerificationEnabled && isVerificationEnabled.toLocaleLowerCase() == "true") { if (isVerificationEnabled && isVerificationEnabled.toLocaleLowerCase() == "true") {

View file

@ -0,0 +1,20 @@
import { Message } from "discord.js";
import SettingsHelper from "../../../helpers/SettingsHelper";
export default async function LinkOnlyMode(message: Message) {
if (!message.guild) return;
const gifOnlyMode = await SettingsHelper.GetSetting("channel.linkonly", message.guild.id);
if (!gifOnlyMode) return;
const channel = message.guild.channels.cache.find(x => x.id == gifOnlyMode) || message.guild.channels.fetch(gifOnlyMode);
if (!channel) return;
if (message.content.startsWith("https://") || message.content.startsWith("http://")) return;
if (!message.deletable) return;
await message.delete();
}

View file

@ -1,5 +0,0 @@
import DefaultValues from "../constants/DefaultValues";
import UserSetting from "../database/entities/UserSetting";
export default class UserSettingsHelper {
}

View file

@ -12,6 +12,7 @@ import Config from "./commands/config";
import Disable from "./commands/disable"; import Disable from "./commands/disable";
import Ignore from "./commands/ignore"; import Ignore from "./commands/ignore";
import Kick from "./commands/kick"; import Kick from "./commands/kick";
import Linkonly from "./commands/linkonly";
import Poll from "./commands/poll"; import Poll from "./commands/poll";
import Role from "./commands/Role/role"; import Role from "./commands/Role/role";
import ConfigRole from "./commands/Role/config"; import ConfigRole from "./commands/Role/config";
@ -55,6 +56,7 @@ export default class Registry {
CoreClient.RegisterCommand("disable", new Disable()); CoreClient.RegisterCommand("disable", new Disable());
CoreClient.RegisterCommand("ignore", new Ignore()); CoreClient.RegisterCommand("ignore", new Ignore());
CoreClient.RegisterCommand("kick", new Kick()); CoreClient.RegisterCommand("kick", new Kick());
CoreClient.RegisterCommand("linkonly", new Linkonly());
CoreClient.RegisterCommand("poll", new Poll()); CoreClient.RegisterCommand("poll", new Poll());
CoreClient.RegisterCommand("rules", new Rules()); CoreClient.RegisterCommand("rules", new Rules());
CoreClient.RegisterCommand("say", new Say()); CoreClient.RegisterCommand("say", new Say());

900
yarn.lock

File diff suppressed because it is too large Load diff