Compare commits
3 commits
2b35629506
...
7b620dfd90
Author | SHA1 | Date | |
---|---|---|---|
7b620dfd90 | |||
50c237f6fa | |||
832f88fd85 |
7 changed files with 89 additions and 3 deletions
|
@ -7,7 +7,7 @@
|
||||||
# any secret values.
|
# any secret values.
|
||||||
|
|
||||||
BOT_TOKEN=
|
BOT_TOKEN=
|
||||||
BOT_VER=3.2.1
|
BOT_VER=3.3.0
|
||||||
BOT_AUTHOR=Vylpes
|
BOT_AUTHOR=Vylpes
|
||||||
BOT_OWNERID=147392775707426816
|
BOT_OWNERID=147392775707426816
|
||||||
BOT_CLIENTID=682942374040961060
|
BOT_CLIENTID=682942374040961060
|
||||||
|
@ -24,3 +24,5 @@ DB_AUTH_USER=dev
|
||||||
DB_AUTH_PASS=dev
|
DB_AUTH_PASS=dev
|
||||||
DB_SYNC=true
|
DB_SYNC=true
|
||||||
DB_LOGGING=true
|
DB_LOGGING=true
|
||||||
|
DB_ROOT_HOST=0.0.0.0
|
||||||
|
DB_DATA_LOCATION=./.temp/database
|
||||||
|
|
1
.gitignore
vendored
1
.gitignore
vendored
|
@ -106,3 +106,4 @@ dist
|
||||||
config.json
|
config.json
|
||||||
.DS_Store
|
.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,
|
||||||
|
`ServerId` varchar(255) NOT NULL,
|
||||||
|
`UserId` varchar(255) NOT NULL,
|
||||||
|
`Description` varchar(255) NOT NULL
|
||||||
|
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci;
|
||||||
|
|
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;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
5
src/commands/304276391837302787/moons/list.ts
Normal file
5
src/commands/304276391837302787/moons/list.ts
Normal file
|
@ -0,0 +1,5 @@
|
||||||
|
import {CommandInteraction} from "discord.js";
|
||||||
|
|
||||||
|
export default async function ListMoons(interaction: CommandInteraction) {
|
||||||
|
|
||||||
|
}
|
27
src/database/entities/Moon.ts
Normal file
27
src/database/entities/Moon.ts
Normal file
|
@ -0,0 +1,27 @@
|
||||||
|
import { Column, Entity } from "typeorm";
|
||||||
|
import BaseEntity from "../../contracts/BaseEntity";
|
||||||
|
import AppDataSource from "../dataSources/appDataSource";
|
||||||
|
|
||||||
|
@Entity()
|
||||||
|
export default class Moon extends BaseEntity {
|
||||||
|
constructor(description: string, userId: string) {
|
||||||
|
super();
|
||||||
|
|
||||||
|
this.Description = description;
|
||||||
|
this.UserId = userId;
|
||||||
|
}
|
||||||
|
|
||||||
|
@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> {
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
Loading…
Reference in a new issue