diff --git a/package-lock.json b/package-lock.json
index ebe6601..530feca 100644
--- a/package-lock.json
+++ b/package-lock.json
@@ -13,6 +13,7 @@
"@sapphire/ts-config": "^3.3.4",
"@types/node": "^18.0.3",
"discord.js": "^13.8.1",
+ "dotenv": "^16.0.1",
"typescript": "^4.7.4"
},
"devDependencies": {
@@ -858,6 +859,14 @@
"node": ">=6.0.0"
}
},
+ "node_modules/dotenv": {
+ "version": "16.0.1",
+ "resolved": "https://registry.npmjs.org/dotenv/-/dotenv-16.0.1.tgz",
+ "integrity": "sha512-1K6hR6wtk2FviQ4kEiSjFiH5rpzEVi8WW0x96aztHVMhEspNpc4DVOUTEHtEva5VThQ8IaBX1Pe4gSzpVVUsKQ==",
+ "engines": {
+ "node": ">=12"
+ }
+ },
"node_modules/es-abstract": {
"version": "1.20.1",
"resolved": "https://registry.npmjs.org/es-abstract/-/es-abstract-1.20.1.tgz",
@@ -3271,6 +3280,11 @@
"esutils": "^2.0.2"
}
},
+ "dotenv": {
+ "version": "16.0.1",
+ "resolved": "https://registry.npmjs.org/dotenv/-/dotenv-16.0.1.tgz",
+ "integrity": "sha512-1K6hR6wtk2FviQ4kEiSjFiH5rpzEVi8WW0x96aztHVMhEspNpc4DVOUTEHtEva5VThQ8IaBX1Pe4gSzpVVUsKQ=="
+ },
"es-abstract": {
"version": "1.20.1",
"resolved": "https://registry.npmjs.org/es-abstract/-/es-abstract-1.20.1.tgz",
diff --git a/package.json b/package.json
index dcfd127..b1a7ff1 100644
--- a/package.json
+++ b/package.json
@@ -28,6 +28,7 @@
"@sapphire/ts-config": "^3.3.4",
"@types/node": "^18.0.3",
"discord.js": "^13.8.1",
+ "dotenv": "^16.0.1",
"typescript": "^4.7.4"
},
"devDependencies": {
diff --git a/src/commands/ping.ts b/src/commands/ping.ts
new file mode 100644
index 0000000..29002b5
--- /dev/null
+++ b/src/commands/ping.ts
@@ -0,0 +1,39 @@
+// SPDX-License-Identifier: GPL-3.0-or-later
+/*
+ Animal Rights Advocates Discord Bot
+ Copyright (C) 2022 Anthony Berg
+
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see .
+ */
+
+import { Command } from '@sapphire/framework';
+import type { Message } from 'discord.js';
+
+export class PingCommand extends Command {
+ public constructor(context: Command.Context) {
+ super(context, {
+ name: 'ping',
+ aliases: ['pong'],
+ description: 'ping pong',
+ });
+ }
+
+ public async messageRun(message: Message) {
+ const msg = await message.channel.send('Ping?');
+
+ const content = `Pong from JavaScript! Bot Latency ${Math.round(this.container.client.ws.ping)}ms. API Latency ${msg.createdTimestamp - message.createdTimestamp}ms.`;
+
+ return msg.edit(content);
+ }
+}
diff --git a/src/index.ts b/src/index.ts
new file mode 100644
index 0000000..90ed77d
--- /dev/null
+++ b/src/index.ts
@@ -0,0 +1,52 @@
+// SPDX-License-Identifier: GPL-3.0-or-later
+/*
+ Animal Rights Advocates Discord Bot
+ Copyright (C) 2022 Anthony Berg
+
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see .
+
+ I used the Sapphire documentation and parts of the code from the Sapphire CLI to
+ create this file.
+*/
+
+import { LogLevel, SapphireClient } from '@sapphire/framework';
+
+require('dotenv').config();
+
+// Setting up the Sapphire client
+const client = new SapphireClient({
+ defaultPrefix: process.env.DEFAULT_PREFIX,
+ logger: {
+ level: LogLevel.Debug,
+ },
+ intents:
+ ['GUILDS',
+ 'GUILD_MESSAGES'],
+});
+
+// Main function to log in
+const main = async () => {
+ try {
+ const token = process.env.DISCORD_TOKEN;
+ client.logger.info('Logging in');
+ await client.login(token);
+ client.logger.info('Logged in');
+ } catch (error) {
+ client.logger.fatal(error);
+ client.destroy();
+ process.exit(1);
+ }
+};
+
+main();