Skip to content
Open
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
2 changes: 1 addition & 1 deletion .eslintrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,5 @@
"root": true,
"parser": "@typescript-eslint/parser",
"plugins": ["@typescript-eslint"],
"extends": ["prettier", "plugin:prettier/recommended"]
"extends": ["prettier"]
}
3 changes: 2 additions & 1 deletion .prettierrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,5 +15,6 @@
"trailingComma": "es5",
"useTabs": false,
"vueIndentScriptAndStyle": false,
"printWidth": 120
"printWidth": 120,
"endOfLine": "auto"
}
39 changes: 39 additions & 0 deletions package-lock.json

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

1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
"dependencies": {
"discord.js": "^12.5.1",
"dotenv": "^8.2.0",
"hot-shots": "^8.3.2",
"typescript": "^4.2.3"
},
"devDependencies": {
Expand Down
10 changes: 9 additions & 1 deletion src/DiscordClient.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { Client, TextChannel } from "discord.js";
import dogstats from "./util/dogstats";

export enum MESSAGES {
UPDATE = "Ya boy is back and better than ever\nFor change notes, ask <@677740656747216916>",
Expand All @@ -24,7 +25,14 @@ class DiscordClient extends Client {
if (hasValidChannels) {
if (channelNameMatches) {
const channel = await this.channels.fetch(channelName);
(channel as TextChannel)?.send(message);
(channel as TextChannel)
?.send(message)
.then(() => {
dogstats.increment("discordbot.discord.message.sent");
})
.catch(() => {
dogstats.increment("discordbot.discord.message.failed");
});
}
}
};
Expand Down
1 change: 0 additions & 1 deletion src/NYTCrosswordPuzzleBot.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ const discordClient = new DiscordClient();
discordClient.login(process.env.TOKEN || "");

discordClient.on("ready", async () => {
console.log("eggy kibun");
await discordClient.sendMessage(MESSAGES.UPDATE, DiscordClient.CHANNELS.CHANGELOG);

//NYT Crossword updates at 10PM EST on weekdays and 6PM EST on weekends
Expand Down
5 changes: 5 additions & 0 deletions src/util/dogstats.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
import StatsD from "hot-shots";

const dogstats = new StatsD();

export default dogstats;