diff options
Diffstat (limited to 'src/lib')
-rw-r--r-- | src/lib/common/Sentry.ts | 12 | ||||
-rw-r--r-- | src/lib/extensions/discord-akairo/BushClient.ts | 12 | ||||
-rw-r--r-- | src/lib/extensions/global.d.ts | 1 | ||||
-rw-r--r-- | src/lib/utils/BushConstants.ts | 142 | ||||
-rw-r--r-- | src/lib/utils/Config.ts | 1 |
5 files changed, 96 insertions, 72 deletions
diff --git a/src/lib/common/Sentry.ts b/src/lib/common/Sentry.ts new file mode 100644 index 0000000..2040536 --- /dev/null +++ b/src/lib/common/Sentry.ts @@ -0,0 +1,12 @@ +import * as SentryNode from '@sentry/node'; +import config from './../../config/options'; + +export class Sentry { + public constructor() { + SentryNode.init({ + dsn: config.credentials.sentryDsn, + environment: config.environment, + tracesSampleRate: 1.0 + }); + } +} diff --git a/src/lib/extensions/discord-akairo/BushClient.ts b/src/lib/extensions/discord-akairo/BushClient.ts index 32f43be..4954d8e 100644 --- a/src/lib/extensions/discord-akairo/BushClient.ts +++ b/src/lib/extensions/discord-akairo/BushClient.ts @@ -1,4 +1,5 @@ -import { AkairoClient, ContextMenuCommandHandler } from 'discord-akairo'; +import * as Sentry from '@sentry/node'; +import { AkairoClient, ContextMenuCommandHandler, version as akairoVersion } from 'discord-akairo'; import { Awaitable, Collection, @@ -13,6 +14,7 @@ import { ReplyMessageOptions, Snowflake, Structures, + version as discordJsVersion, WebhookEditMessageOptions } from 'discord.js'; //@ts-ignore: no typings @@ -152,6 +154,7 @@ export class BushClient<Ready extends boolean = boolean> extends AkairoClient<Re public logger = BushLogger; public constants = BushConstants; public cache = BushCache; + public sentry!: typeof Sentry; public override on<K extends keyof BushClientEvents>( event: K, @@ -322,6 +325,13 @@ export class BushClient<Ready extends boolean = boolean> extends AkairoClient<Re durationSeconds: durationSecondsTypeCaster, globalUser: globalUserTypeCaster }); + + this.sentry = Sentry; + this.sentry.setTag('process', process.pid.toString()); + this.sentry.setTag('discord.js', discordJsVersion); + this.sentry.setTag('discord-akairo', akairoVersion); + void this.logger.success('startup', `Successfully connected to <<Sentry>>.`, false); + // loads all the handlers const loaders = { commands: this.commandHandler, diff --git a/src/lib/extensions/global.d.ts b/src/lib/extensions/global.d.ts index e10db0a..5274fd2 100644 --- a/src/lib/extensions/global.d.ts +++ b/src/lib/extensions/global.d.ts @@ -4,4 +4,5 @@ import { BushClientUtil } from './discord-akairo/BushClientUtil'; declare global { var client: BushClient; var util: BushClientUtil; + var __rootdir__: string; } diff --git a/src/lib/utils/BushConstants.ts b/src/lib/utils/BushConstants.ts index 64208a1..a4b3108 100644 --- a/src/lib/utils/BushConstants.ts +++ b/src/lib/utils/BushConstants.ts @@ -1,76 +1,5 @@ import { Constants, ConstantsColors } from 'discord.js'; -interface bushColors { - default: '#1FD8F1'; - error: '#EF4947'; - warn: '#FEBA12'; - success: '#3BB681'; - info: '#3B78FF'; - red: '#ff0000'; - blue: '#0055ff'; - aqua: '#00bbff'; - purple: '#8400ff'; - blurple: '#5440cd'; - newBlurple: '#5865f2'; - pink: '#ff00e6'; - green: '#00ff1e'; - darkGreen: '#008f11'; - gold: '#b59400'; - yellow: '#ffff00'; - white: '#ffffff'; - gray: '#a6a6a6'; - lightGray: '#cfcfcf'; - darkGray: '#7a7a7a'; - black: '#000000'; - orange: '#E86100'; - discord: ConstantsColors; -} - -export type PronounCode = - | 'unspecified' - | 'hh' - | 'hi' - | 'hs' - | 'ht' - | 'ih' - | 'ii' - | 'is' - | 'it' - | 'shh' - | 'sh' - | 'si' - | 'st' - | 'th' - | 'ti' - | 'ts' - | 'tt' - | 'any' - | 'other' - | 'ask' - | 'avoid'; -export type Pronoun = - | 'Unspecified' - | 'He/Him' - | 'He/It' - | 'He/She' - | 'He/They' - | 'It/Him' - | 'It/Its' - | 'It/She' - | 'It/They' - | 'She/He' - | 'She/Her' - | 'She/It' - | 'She/They' - | 'They/He' - | 'They/It' - | 'They/She' - | 'They/Them' - | 'Any pronouns' - | 'Other pronouns' - | 'Ask me my pronouns' - | 'Avoid pronouns, use my name'; - const rawCapeUrl = 'https://raw.githubusercontent.com/NotEnoughUpdates/capes/master/'; export class BushConstants { public static emojis = { @@ -564,3 +493,74 @@ export class BushConstants { { name: 'No Support', id: '790247359824396319' } ]; } + +interface bushColors { + default: '#1FD8F1'; + error: '#EF4947'; + warn: '#FEBA12'; + success: '#3BB681'; + info: '#3B78FF'; + red: '#ff0000'; + blue: '#0055ff'; + aqua: '#00bbff'; + purple: '#8400ff'; + blurple: '#5440cd'; + newBlurple: '#5865f2'; + pink: '#ff00e6'; + green: '#00ff1e'; + darkGreen: '#008f11'; + gold: '#b59400'; + yellow: '#ffff00'; + white: '#ffffff'; + gray: '#a6a6a6'; + lightGray: '#cfcfcf'; + darkGray: '#7a7a7a'; + black: '#000000'; + orange: '#E86100'; + discord: ConstantsColors; +} + +export type PronounCode = + | 'unspecified' + | 'hh' + | 'hi' + | 'hs' + | 'ht' + | 'ih' + | 'ii' + | 'is' + | 'it' + | 'shh' + | 'sh' + | 'si' + | 'st' + | 'th' + | 'ti' + | 'ts' + | 'tt' + | 'any' + | 'other' + | 'ask' + | 'avoid'; +export type Pronoun = + | 'Unspecified' + | 'He/Him' + | 'He/It' + | 'He/She' + | 'He/They' + | 'It/Him' + | 'It/Its' + | 'It/She' + | 'It/They' + | 'She/He' + | 'She/Her' + | 'She/It' + | 'She/They' + | 'They/He' + | 'They/It' + | 'They/She' + | 'They/Them' + | 'Any pronouns' + | 'Other pronouns' + | 'Ask me my pronouns' + | 'Avoid pronouns, use my name'; diff --git a/src/lib/utils/Config.ts b/src/lib/utils/Config.ts index 393dd44..81e3a85 100644 --- a/src/lib/utils/Config.ts +++ b/src/lib/utils/Config.ts @@ -61,6 +61,7 @@ interface Credentials { wolframAlphaAppId: string; imgurClientId: string; imgurClientSecret: string; + sentryDsn: string; } type Environment = 'production' | 'beta' | 'development'; |