Skip to content

Commit

Permalink
Merge pull request #194 from zhiyan114/master
Browse files Browse the repository at this point in the history
Unnecessary deployment lol
  • Loading branch information
zhiyan114 authored Oct 12, 2024
2 parents a1d41d6 + ca7643f commit 30cb288
Show file tree
Hide file tree
Showing 8 changed files with 121 additions and 107 deletions.
130 changes: 65 additions & 65 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 4 additions & 0 deletions src/commands/discord/tbypass.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,10 @@ export class TwitchChatRelay extends baseCommand {
const uniqueID = randomUUID();

const tUser = await this.client.prisma.twitch.findUnique({
select: {
verified: true,
username: true,
},
where: {
memberid: interaction.user.id
}
Expand Down
5 changes: 5 additions & 0 deletions src/commands/discord/tverify.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,11 @@ export class TwitchVerify extends baseCommand {

// Check for the request and status
const userReq = await this.client.prisma.twitch.findUnique({
select: {
id: true,
username: true,
verified: true,
},
where: {
memberid: interaction.user.id,
username: twitchUsername,
Expand Down
3 changes: 3 additions & 0 deletions src/commands/twitch/link.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,9 @@ export class LinkCommand extends baseTCommand {

// Check if user has already joined in the discord server
const dAccCount = await data.client.discord.prisma.members.findUnique({
select: {
rulesconfirmedon: true,
},
where: {
id: discordID,
}
Expand Down
41 changes: 23 additions & 18 deletions src/core/DiscordClient.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { ActivityType, Client, GatewayIntentBits, Partials, DefaultWebSocketManagerOptions } from "discord.js";
import config from '../config.json';
import { PrismaClient } from "@prisma/client";
import { suppressTracing } from "@sentry/core";
import Redis from "ioredis";
import { eventLogger } from "./helper/eventLogger";
import { DiscordEvents, RedisEvents } from "../events";
Expand Down Expand Up @@ -97,27 +98,31 @@ export class DiscordClient extends Client implements baseClient {
}

public async start(token: string) {
// Connect all services
await this.prisma.$connect();
if(this.redis.status === "close")
await this.redis.connect();
await this.login(token);

// Start all services
await new DiscordCommandHandler(this).commandRegister();
await this.loadServices();
this.updateStatus();

// Start helper clients
await this.twitch.start();
await this.youtube.start();
return await suppressTracing(async()=>{
// Connect all services
await this.prisma.$connect();
if(this.redis.status === "close")
await this.redis.connect();
await this.login(token);

// Start all services
await new DiscordCommandHandler(this).commandRegister();
await this.loadServices();
this.updateStatus();

// Start helper clients
await this.twitch.start();
await this.youtube.start();
});
}

public async dispose() {
// Close all connections
await this.prisma.$disconnect();
await this.redis.quit();
await this.destroy();
return await suppressTracing(async() => {
// Close all connections
await this.prisma.$disconnect();
await this.redis.quit();
await this.destroy();
});
}

public updateStatus() {
Expand Down
Loading

0 comments on commit 30cb288

Please sign in to comment.