Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add statcord #146

Merged
merged 1 commit into from
May 16, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@
"dependencies": {
"@discordjs/builders": "^0.13.0",
"@discordjs/opus": "^0.7.0",
"@kaname-png/plugin-statcord": "^1.3.4",
"@prisma/client": "^3.14.0",
"@sapphire/decorators": "^4.3.4",
"@sapphire/framework": "^3.0.0-next.fd7be0b.0",
Expand Down
2 changes: 2 additions & 0 deletions src/augment.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,10 @@ declare global {
interface ProcessEnv {
GUILD: string;
OWNER: string;
CLIENT_ID: string;
CONSOLE_URL: string;
GUILDS_URL: string;
STATCORD_API_KEY: string;
}
}
}
7 changes: 7 additions & 0 deletions src/bot.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import {Logger} from "./logger";
import {container, LogLevel, SapphireClient} from "@sapphire/framework";
import "@sapphire/plugin-logger/register";
import "@sapphire/plugin-i18next/register";
import "@kaname-png/plugin-statcord/register";
import {PrismaClient} from "@prisma/client";
config();

Expand All @@ -20,6 +21,12 @@ const client = new SapphireClient({
"en-US"
);
}
},
statcord: {
client_id: process.env.CLIENT_ID,
key: process.env.STATCORD_API_KEY,
autopost: true,
debug: true
}
});
container.player = new Player(client);
Expand Down
14 changes: 14 additions & 0 deletions src/listeners/client/interactionCreate.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
import {ApplyOptions} from "@sapphire/decorators";
import {Events, Listener, ListenerOptions} from "@sapphire/framework";
import type {Interaction, CacheType} from "discord.js";

@ApplyOptions<ListenerOptions>({
event: Events.InteractionCreate
})
export class InteractionCreateListener extends Listener<typeof Events.InteractionCreate> {
public run(interaction: Interaction<CacheType>): unknown {
if (!interaction.isCommand()) return;

return this.container.statcord.postCommand(interaction.commandName, interaction.user.id);
}
}
33 changes: 32 additions & 1 deletion yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -143,6 +143,17 @@ __metadata:
languageName: node
linkType: hard

"@kaname-png/plugin-statcord@npm:^1.3.4":
version: 1.3.4
resolution: "@kaname-png/plugin-statcord@npm:1.3.4"
dependencies:
"@sapphire/fetch": ^2.3.1
systeminformation: ^5.11.14
tslib: ^2.4.0
checksum: 2870011a4d0c55eea916b734536fe7bd4ab1a8eb196ac7f13e757280bf93cc8a9fd994ecb007a51edac6d65e8be516d0de17be2734d31d8a4c5c662d888a8188
languageName: node
linkType: hard

"@nodelib/fs.scandir@npm:2.1.5":
version: 2.1.5
resolution: "@nodelib/fs.scandir@npm:2.1.5"
Expand Down Expand Up @@ -270,6 +281,15 @@ __metadata:
languageName: node
linkType: hard

"@sapphire/fetch@npm:^2.3.1":
version: 2.3.1
resolution: "@sapphire/fetch@npm:2.3.1"
dependencies:
cross-fetch: ^3.1.5
checksum: 3cb6d2a74fd107901d6902b8949ae7b3780da7efb519fc411fee1496d4d0d72cec1a68e19fc6ac47984f37f509567dbbc4ce82bea5c1ff437f119fc0afa8359d
languageName: node
linkType: hard

"@sapphire/framework@npm:^3.0.0-next.fd7be0b.0":
version: 3.0.0-next.fd7be0b.0
resolution: "@sapphire/framework@npm:3.0.0-next.fd7be0b.0"
Expand Down Expand Up @@ -1075,7 +1095,7 @@ __metadata:
languageName: node
linkType: hard

"cross-fetch@npm:~3.1.4":
"cross-fetch@npm:^3.1.5, cross-fetch@npm:~3.1.4":
version: 3.1.5
resolution: "cross-fetch@npm:3.1.5"
dependencies:
Expand Down Expand Up @@ -3016,6 +3036,7 @@ __metadata:
"@commitlint/config-angular": 17.0.0
"@discordjs/builders": ^0.13.0
"@discordjs/opus": ^0.7.0
"@kaname-png/plugin-statcord": ^1.3.4
"@prisma/client": ^3.14.0
"@sapphire/decorators": ^4.3.4
"@sapphire/eslint-config": 4.3.5
Expand Down Expand Up @@ -3697,6 +3718,16 @@ __metadata:
languageName: node
linkType: hard

"systeminformation@npm:^5.11.14":
version: 5.11.15
resolution: "systeminformation@npm:5.11.15"
bin:
systeminformation: lib/cli.js
checksum: 29bfd93cd6b733a2730a40daba415ecccb030b1dd965f872d0d0b272a935d31ab35c092ad273ce174f10f123899de03d95295336e5f9c68df0eb4a93b8eaed21
conditions: (os=darwin | os=linux | os=win32 | os=freebsd | os=openbsd | os=netbsd | os=sunos | os=android)
languageName: node
linkType: hard

"tar@npm:^2.0.0":
version: 2.2.2
resolution: "tar@npm:2.2.2"
Expand Down