Compare commits
17 commits
main
...
feature/19
Author | SHA1 | Date | |
---|---|---|---|
|
690b63470a | ||
|
7b620dfd90 | ||
|
50c237f6fa | ||
|
832f88fd85 | ||
|
2b35629506 | ||
|
0ce9ff5453 | ||
|
b1afc79dda | ||
|
7ccfa34562 | ||
|
f1c7cdc6d6 | ||
|
1371a30eee | ||
|
34398e5657 | ||
|
cd0737cf3b | ||
|
5f22a31398 | ||
|
932d3ac3d5 | ||
|
6412ad0ad4 | ||
|
f1c513bd16 | ||
|
942fea12bf |
|
@ -7,7 +7,7 @@
|
|||
# any secret values.
|
||||
|
||||
BOT_TOKEN=
|
||||
BOT_VER=3.2.1
|
||||
BOT_VER=3.3.0
|
||||
BOT_AUTHOR=Vylpes
|
||||
BOT_OWNERID=147392775707426816
|
||||
BOT_CLIENTID=682942374040961060
|
||||
|
@ -23,4 +23,6 @@ DB_NAME=vylbot
|
|||
DB_AUTH_USER=dev
|
||||
DB_AUTH_PASS=dev
|
||||
DB_SYNC=true
|
||||
DB_LOGGING=true
|
||||
DB_LOGGING=true
|
||||
DB_ROOT_HOST=0.0.0.0
|
||||
DB_DATA_LOCATION=./.temp/database
|
||||
|
|
|
@ -12,14 +12,14 @@ jobs:
|
|||
runs-on: node
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- uses: actions/checkout@v4
|
||||
- name: Use Node.js
|
||||
uses: actions/setup-node@v1
|
||||
uses: actions/setup-node@v4
|
||||
with:
|
||||
node-version: 18.x
|
||||
- run: npm ci
|
||||
- run: npm run build
|
||||
- run: npm test
|
||||
- run: yarn install --frozen-lockfile
|
||||
- run: yarn build
|
||||
- run: yarn test
|
||||
|
||||
- name: "Copy files over to location"
|
||||
run: cp -r . ${{ secrets.PROD_REPO_PATH }}
|
||||
|
@ -63,5 +63,5 @@ jobs:
|
|||
&& (pm2 delete vylbot_prod || true) \
|
||||
&& docker compose up -d \
|
||||
&& sleep 10 \
|
||||
&& npm run db:up \
|
||||
&& pm2 start --name vylbot_prod dist/vylbot.js
|
||||
&& yarn db:up \
|
||||
&& pm2 start --name vylbot_prod dist/vylbot.js
|
||||
|
|
|
@ -12,14 +12,14 @@ jobs:
|
|||
runs-on: node
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- uses: actions/checkout@v4
|
||||
- name: Use Node.js
|
||||
uses: actions/setup-node@v1
|
||||
uses: actions/setup-node@v4
|
||||
with:
|
||||
node-version: 18.x
|
||||
- run: npm ci
|
||||
- run: npm run build
|
||||
- run: npm test
|
||||
- run: yarn install --frozen-lockfile
|
||||
- run: yarn build
|
||||
- run: yarn test
|
||||
|
||||
- name: "Copy files over to location"
|
||||
run: cp -r . ${{ secrets.STAGE_REPO_PATH }}
|
||||
|
@ -63,5 +63,5 @@ jobs:
|
|||
&& (pm2 delete vylbot_stage || true) \
|
||||
&& docker compose up -d \
|
||||
&& sleep 10 \
|
||||
&& npm run db:up \
|
||||
&& pm2 start --name vylbot_stage dist/vylbot.js
|
||||
&& yarn db:up \
|
||||
&& pm2 start --name vylbot_stage dist/vylbot.js
|
||||
|
|
|
@ -14,11 +14,11 @@ jobs:
|
|||
runs-on: node
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- uses: actions/checkout@v4
|
||||
- name: Use Node.js
|
||||
uses: actions/setup-node@v1
|
||||
uses: actions/setup-node@v4
|
||||
with:
|
||||
node-version: 18.x
|
||||
- run: npm ci
|
||||
- run: npm run build
|
||||
- run: npm test
|
||||
- run: yarn install --frozen-lockfile
|
||||
- run: yarn build
|
||||
- run: yarn test
|
||||
|
|
3
.gitignore
vendored
3
.gitignore
vendored
|
@ -105,4 +105,5 @@ dist
|
|||
|
||||
config.json
|
||||
.DS_Store
|
||||
ormconfig.json
|
||||
ormconfig.json
|
||||
.temp/
|
||||
|
|
9
database/3.3.0/1719856023429-CreateMoon/Up/01-Moon.sql
Normal file
9
database/3.3.0/1719856023429-CreateMoon/Up/01-Moon.sql
Normal file
|
@ -0,0 +1,9 @@
|
|||
CREATE TABLE `moon` (
|
||||
`Id` varchar(255) NOT NULL,
|
||||
`WhenCreated` datetime NOT NULL,
|
||||
`WhenUpdated` datetime NOT NULL,
|
||||
`MoonNumber` int NOT NULL,
|
||||
`UserId` varchar(255) NOT NULL,
|
||||
`Description` varchar(255) NOT NULL
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci;
|
||||
|
8815
package-lock.json
generated
8815
package-lock.json
generated
File diff suppressed because it is too large
Load diff
|
@ -29,13 +29,13 @@
|
|||
"dependencies": {
|
||||
"@discordjs/rest": "^2.0.0",
|
||||
"@types/jest": "^29.0.0",
|
||||
"@types/uuid": "^9.0.0",
|
||||
"@types/uuid": "^10.0.0",
|
||||
"discord.js": "^14.3.0",
|
||||
"dotenv": "^16.0.0",
|
||||
"emoji-regex": "^10.0.0",
|
||||
"jest": "^29.0.0",
|
||||
"jest-mock-extended": "^3.0.0",
|
||||
"minimatch": "9.0.3",
|
||||
"minimatch": "9.0.5",
|
||||
"mysql": "^2.18.1",
|
||||
"random-bunny": "^2.1.6",
|
||||
"ts-jest": "^29.0.0",
|
||||
|
|
27
src/commands/304276391837302787/moons.ts
Normal file
27
src/commands/304276391837302787/moons.ts
Normal file
|
@ -0,0 +1,27 @@
|
|||
import { Command } from "../../type/command";
|
||||
import { CommandInteraction, SlashCommandBuilder } from "discord.js";
|
||||
import ListMoons from "./moons/list";
|
||||
|
||||
export default class Moons extends Command {
|
||||
constructor() {
|
||||
super();
|
||||
|
||||
this.CommandBuilder = new SlashCommandBuilder()
|
||||
.setName("moons")
|
||||
.setDescription("View and create moons")
|
||||
.addSubcommand(subcommand =>
|
||||
subcommand
|
||||
.setName('list')
|
||||
.setDescription('List moons you have obtained'));
|
||||
}
|
||||
|
||||
public override async execute(interaction: CommandInteraction) {
|
||||
if (!interaction.isChatInputCommand()) return;
|
||||
|
||||
switch (interaction.options.getSubcommand()) {
|
||||
case "list":
|
||||
await ListMoons(interaction);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
22
src/commands/304276391837302787/moons/list.ts
Normal file
22
src/commands/304276391837302787/moons/list.ts
Normal file
|
@ -0,0 +1,22 @@
|
|||
import {CommandInteraction, EmbedBuilder} from "discord.js";
|
||||
import Moon from "../../../database/entities/Moon";
|
||||
import EmbedColours from "../../../constants/EmbedColours";
|
||||
|
||||
export default async function ListMoons(interaction: CommandInteraction) {
|
||||
const moons = await Moon.FetchMoonsByUserId(interaction.user.id);
|
||||
|
||||
if (!moons || moons.length == 0) {
|
||||
await interaction.reply("You do not have any moons.");
|
||||
return;
|
||||
}
|
||||
|
||||
const description = moons.flatMap(x => `${x.MoonNumber}. ${x.Description.slice(0, 15)}`);
|
||||
|
||||
const embed = new EmbedBuilder()
|
||||
.setTitle(`${interaction.user.username}'s Moons`)
|
||||
.setColor(EmbedColours.Ok)
|
||||
.setDescription(description.join("\n"))
|
||||
.setFooter({ text: `${moons.length} moons` });
|
||||
|
||||
await interaction.reply({ embeds: [ embed ] });
|
||||
}
|
|
@ -93,7 +93,7 @@ export default class Audits extends Command {
|
|||
private async SendAuditForUser(interaction: CommandInteraction) {
|
||||
if (!interaction.guildId) return;
|
||||
|
||||
const user = interaction.options.getUser('target');
|
||||
const user = interaction.options.get('target', true).user!;
|
||||
|
||||
if (!user) {
|
||||
await interaction.reply("User not found.");
|
||||
|
@ -191,7 +191,7 @@ export default class Audits extends Command {
|
|||
private async AddAudit(interaction: CommandInteraction) {
|
||||
if (!interaction.guildId) return;
|
||||
|
||||
const user = interaction.options.getUser('target');
|
||||
const user = interaction.options.get('target', true).user!;
|
||||
const auditType = interaction.options.get('type');
|
||||
const reasonInput = interaction.options.get('reason');
|
||||
|
||||
|
@ -209,4 +209,4 @@ export default class Audits extends Command {
|
|||
|
||||
await interaction.reply(`Created new audit with ID \`${audit.AuditId}\``);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
24
src/commands/say.ts
Normal file
24
src/commands/say.ts
Normal file
|
@ -0,0 +1,24 @@
|
|||
import { ActionRowBuilder, ButtonBuilder, ButtonStyle, CommandInteraction, EmbedBuilder, SlashCommandBuilder } from "discord.js";
|
||||
import EmbedColours from "../constants/EmbedColours";
|
||||
import { Command } from "../type/command";
|
||||
|
||||
export default class Say extends Command {
|
||||
constructor() {
|
||||
super();
|
||||
|
||||
this.CommandBuilder = new SlashCommandBuilder()
|
||||
.setName('say')
|
||||
.setDescription('Have the bot reply with your message')
|
||||
.addStringOption(x =>
|
||||
x
|
||||
.setName("message")
|
||||
.setDescription("The message to repeat")
|
||||
.setRequired(true));
|
||||
}
|
||||
|
||||
public override async execute(interaction: CommandInteraction) {
|
||||
const message = interaction.options.get("message", true);
|
||||
|
||||
await interaction.reply(message.value as string);
|
||||
}
|
||||
}
|
31
src/database/entities/Moon.ts
Normal file
31
src/database/entities/Moon.ts
Normal file
|
@ -0,0 +1,31 @@
|
|||
import { Column, Entity } from "typeorm";
|
||||
import BaseEntity from "../../contracts/BaseEntity";
|
||||
import AppDataSource from "../dataSources/appDataSource";
|
||||
|
||||
@Entity()
|
||||
export default class Moon extends BaseEntity {
|
||||
constructor(moonNumber: number, description: string, userId: string) {
|
||||
super();
|
||||
|
||||
this.MoonNumber = moonNumber;
|
||||
this.Description = description;
|
||||
this.UserId = userId;
|
||||
}
|
||||
|
||||
@Column()
|
||||
MoonNumber: number;
|
||||
|
||||
@Column()
|
||||
Description: string;
|
||||
|
||||
@Column()
|
||||
UserId: string;
|
||||
|
||||
public static async FetchMoonsByUserId(userId: string): Promise<Moon[] | null> {
|
||||
const repository = AppDataSource.getRepository(Moon);
|
||||
|
||||
const all = await repository.find({ where: { UserId: userId } });
|
||||
|
||||
return all;
|
||||
}
|
||||
}
|
15
src/database/migrations/3.3/1719856023429-CreateMoon.ts
Normal file
15
src/database/migrations/3.3/1719856023429-CreateMoon.ts
Normal file
|
@ -0,0 +1,15 @@
|
|||
import { MigrationInterface, QueryRunner } from "typeorm"
|
||||
import MigrationHelper from "../../../helpers/MigrationHelper"
|
||||
|
||||
export class CreateMoon1719856023429 implements MigrationInterface {
|
||||
|
||||
public async up(queryRunner: QueryRunner): Promise<void> {
|
||||
MigrationHelper.Up('1719856023429-CreateMoon', '3.3.0', [
|
||||
"01-Moon",
|
||||
], queryRunner);
|
||||
}
|
||||
|
||||
public async down(queryRunner: QueryRunner): Promise<void> {
|
||||
}
|
||||
|
||||
}
|
|
@ -17,6 +17,7 @@ import Poll from "./commands/poll";
|
|||
import Role from "./commands/Role/role";
|
||||
import ConfigRole from "./commands/Role/config";
|
||||
import Rules from "./commands/rules";
|
||||
import Say from "./commands/say";
|
||||
import Setup from "./commands/setup";
|
||||
import Timeout from "./commands/timeout";
|
||||
import Unmute from "./commands/unmute";
|
||||
|
@ -29,6 +30,9 @@ import AddLobby from "./commands/501231711271780357/Lobby/add";
|
|||
import RemoveLobby from "./commands/501231711271780357/Lobby/remove";
|
||||
import ListLobby from "./commands/501231711271780357/Lobby/list";
|
||||
|
||||
// Command Imports: Potato Talk
|
||||
import Moons from "./commands/304276391837302787/moons";
|
||||
|
||||
// Event Imports
|
||||
import GuildMemberAdd from "./events/MemberEvents/GuildMemberAdd";
|
||||
import GuildMemberRemove from "./events/MemberEvents/GuildMemberRemove";
|
||||
|
@ -55,6 +59,7 @@ export default class Registry {
|
|||
CoreClient.RegisterCommand("mute", new Mute());
|
||||
CoreClient.RegisterCommand("poll", new Poll());
|
||||
CoreClient.RegisterCommand("rules", new Rules());
|
||||
CoreClient.RegisterCommand("say", new Say());
|
||||
CoreClient.RegisterCommand("setup", new Setup());
|
||||
CoreClient.RegisterCommand("timeout", new Timeout());
|
||||
CoreClient.RegisterCommand("unmute", new Unmute());
|
||||
|
@ -70,12 +75,16 @@ export default class Registry {
|
|||
CoreClient.RegisterCommand("listlobby", new ListLobby(), "501231711271780357");
|
||||
CoreClient.RegisterCommand("entry", new Entry(), "501231711271780357");
|
||||
|
||||
// Exclusive Commands: Potato Talk
|
||||
CoreClient.RegisterCommand("moons", new Moons(), "304276391837302787");
|
||||
|
||||
// Add Exclusive Commands to Test Server
|
||||
CoreClient.RegisterCommand("lobby", new Lobby(), "442730357897429002");
|
||||
CoreClient.RegisterCommand("addlobby", new AddLobby(), "442730357897429002");
|
||||
CoreClient.RegisterCommand("removelobby", new RemoveLobby(), "442730357897429002");
|
||||
CoreClient.RegisterCommand("listlobby", new ListLobby(), "442730357897429002");
|
||||
CoreClient.RegisterCommand("entry", new Entry(), "442730357897429002");
|
||||
CoreClient.RegisterCommand("moons", new Moons(), "442730357897429002");
|
||||
}
|
||||
|
||||
public static RegisterEvents() {
|
||||
|
@ -91,4 +100,4 @@ export default class Registry {
|
|||
public static RegisterButtonEvents() {
|
||||
CoreClient.RegisterButtonEvent("verify", new Verify());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue