This repository has been archived by the owner on Oct 12, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #30 from RealEthanPlayzDev/rewrite
v3
- Loading branch information
Showing
91 changed files
with
3,244 additions
and
6,571 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
[*] | ||
charset = utf-8 | ||
insert_final_newline = true | ||
end_of_line = lf | ||
indent_style = space | ||
indent_size = 4 | ||
max_line_length = 150 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
METEORIUM_POSTGRES_URL= | ||
METEORIUM_BOT_TOKEN= | ||
METEORIUM_APPLICATION_ID= | ||
METEORIUM_HOLODEX_APIKEY= | ||
METEORIUM_GENIUS_APIKEY= | ||
METEORIUM_APPDEPLOY_GUILDIDS= | ||
METEORIUM_RUNTIMELOG_CHANNELIDS= | ||
METEORIUM_NOREG_TESTINTERACTIONS= |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,6 @@ | ||
config.json | ||
# Compile deps and results | ||
node_modules | ||
.ENV | ||
dist | ||
dist | ||
|
||
# Configuration files | ||
.env |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
{ | ||
"recommendations": ["EditorConfig.EditorConfig", "esbenp.prettier-vscode", "mikestead.dotenv", "prisma.prisma"] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
{ | ||
"version": "2.0.0", | ||
"tasks": [ | ||
{ | ||
"label": "Build", | ||
"type": "shell", | ||
"command": "yarn compile", | ||
"group": { | ||
"kind": "build", | ||
"isDefault": true | ||
} | ||
} | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,47 +1,43 @@ | ||
{ | ||
"name": "meteorium", | ||
"version": "2.0.0", | ||
"description": "A Discord bot created by RadiatedExodus as a hobby project.", | ||
"version": "3.0.0", | ||
"description": "RadiatedExodus's hobby Discord bot project, built with TypeScript, Prisma, and DiscordJS.", | ||
"main": "dist/index.js", | ||
"type": "module", | ||
"scripts": { | ||
"compile": "tsc", | ||
"start": "node --enable-source-maps --es-module-specifier-resolution=node ." | ||
"start": "node dist", | ||
"installUtils:fillMissingGuildData": "node ./dist/installUtils/fillMissingGuildData.js", | ||
"installUtils:enableGuildFeature": "node ./dist/installUtils/enableGuildFeature.js" | ||
}, | ||
"repository": { | ||
"type": "git", | ||
"url": "git+https://github.com/RealEthanPlayzDev/Meteorium.git" | ||
}, | ||
"author": "RadiatedExodus", | ||
"license": "GPL-3.0", | ||
"license": "MIT", | ||
"bugs": { | ||
"url": "https://github.com/RealEthanPlayzDev/Meteorium/issues" | ||
}, | ||
"homepage": "https://github.com/RealEthanPlayzDev/Meteorium#readme", | ||
"homepage": "https://github.com/RealEthanPlayzDev/Meteorium", | ||
"devDependencies": { | ||
"prettier": "3.0.3", | ||
"prisma": "^5.2.0", | ||
"typescript": "^5.1.6" | ||
"@types/node": "^20.11.17", | ||
"prettier": "^3.2.5", | ||
"prisma": "^5.9.1", | ||
"typescript": "^5.3.3" | ||
}, | ||
"dependencies": { | ||
"@discord-player/extractor": "^4.4.6", | ||
"@discordjs/opus": "^0.9.0", | ||
"@discordjs/voice": "^0.16.1", | ||
"@prisma/client": "^5.9.1", | ||
"@types/ms": "^0.7.32", | ||
"axios": "^1.6.3", | ||
"chalk": "4.0.0", | ||
"discord-player": "^6.6.7", | ||
"bufferutil": "^4.0.8", | ||
"chalk": "^5.3.0", | ||
"discord.js": "^14.14.1", | ||
"dotenv": "^16.0.3", | ||
"dotenv": "^16.4.2", | ||
"holodex.js": "^2.0.5", | ||
"libsodium-wrappers": "^0.7.10", | ||
"moment": "^2.29.4", | ||
"ms": "^2.1.3", | ||
"moment": "^2.30.1", | ||
"noblox.js": "^4.15.1", | ||
"play-dl": "^1.9.7", | ||
"soundcloud-scraper": "^5.0.3", | ||
"spotify-url-info": "^3.2.13", | ||
"youtube-sr": "^4.3.10", | ||
"ytdl-core": "^4.11.5" | ||
"utf-8-validate": "^6.0.3", | ||
"zlib-sync": "^0.1.9" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
import { Client, ClientOptions } from "discord.js"; | ||
import { config } from "dotenv"; | ||
import { PrismaClient } from "@prisma/client"; | ||
import { HolodexApiClient } from "holodex.js"; | ||
|
||
import Logging from "./logging.js"; | ||
import MeteoriumInteractionManager from "../interactions/index.js"; | ||
import MeteoriumEventManager from "../events/index.js"; | ||
import MeteoriumDatabaseUtilities from "./dbUtils.js"; | ||
import MeteoriumGuildFeatureManager from "./guildFeatureManager.js"; | ||
|
||
function parseDotEnvConfig() { | ||
if (!process.env.METEORIUM_BOT_TOKEN) config(); | ||
return { | ||
BotToken: String(process.env.METEORIUM_BOT_TOKEN), | ||
ApplicationId: String(process.env.METEORIUM_APPLICATION_ID), | ||
HolodexApiKey: String(process.env.METEORIUM_HOLODEX_APIKEY), | ||
GeniusApiKey: String(process.env.METEORIUM_GENIUS_APIKEY), | ||
ApplicationDeployGuildIds: String(process.env.METEORIUM_APPDEPLOY_GUILDIDS).split(","), | ||
RuntimeLogChannelIds: String(process.env.METEORIUM_RUNTIMELOG_CHANNELIDS).split(","), | ||
DontRegisterTestInteractions: Boolean(process.env.METEORIUM_NOREG_TESTINTERACTIONS), | ||
}; | ||
} | ||
|
||
export default class MeteoriumClient extends Client<true> { | ||
public logging = new Logging("Meteorium"); | ||
public config = parseDotEnvConfig(); | ||
public db = new PrismaClient(); | ||
public dbUtils = new MeteoriumDatabaseUtilities(this); | ||
public guildFeatures = new MeteoriumGuildFeatureManager(this); | ||
public interactions = new MeteoriumInteractionManager(this); | ||
public events = new MeteoriumEventManager(this); | ||
public holodex = new HolodexApiClient({ apiKey: this.config.HolodexApiKey }); | ||
|
||
public constructor(options: ClientOptions) { | ||
super(options); | ||
|
||
// Register all events and hook them | ||
this.events.register(); | ||
|
||
// Register all interactions | ||
this.interactions.registerAllInteractions(); | ||
|
||
return this; | ||
} | ||
|
||
public async login() { | ||
const loginNS = this.logging.getNamespace("Login"); | ||
|
||
// Hook events | ||
this.events.hook(); | ||
|
||
// Login | ||
loginNS.info("Logging in to Discord"); | ||
return super.login(this.config.BotToken); | ||
} | ||
|
||
public async destroy() { | ||
await super.destroy(); | ||
await this.db.$disconnect(); | ||
return; | ||
} | ||
} |
Oops, something went wrong.