-
-
Notifications
You must be signed in to change notification settings - Fork 61
/
Copy pathindex.js
803 lines (784 loc) · 21.5 KB
/
index.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
const {
app,
BrowserWindow,
systemPreferences,
shell,
session,
Tray,
Menu,
screen,
ipcMain,
Notification,
} = require('electron');
const { scope, errorHandler, eventLogger, hooks, transports } = require('electron-log');
const path = require('path');
const { fetch } = require('undici');
const os = require('os');
const contextMenu = require('electron-context-menu');
const Constants = require('./Constants.js');
// Setup logger
const log = scope(Constants.APP_NAME);
Object.assign(console, scope('ConsoleProxy'));
errorHandler.startCatching({
onError({ createIssue, error, processType, versions }) {
// Handle internet connection error
if (error.message.includes('ENOTFOUND')) {
log.error('DNS lookup failed. Check the domain name or network connection.', error);
return false;
}
if (error.message.includes('EAI_AGAIN')) {
log.error('Temporary DNS resolution failure. Please try again later.', error);
return false;
}
if (error.message.includes('ECONNREFUSED')) {
log.error('Connection refused. The server may be down or the port is not open.', error);
return false;
}
if (error.message.includes('ETIMEDOUT')) {
log.error('Connection timed out. The server is not responding.', error);
return false;
}
if (error.message.includes('ECONNRESET')) {
log.error('Connection reset by the server. The server may have closed the connection abruptly.', error);
return false;
}
if (error.message.includes('EHOSTUNREACH')) {
log.error('Host unreachable. The server may be offline or the network is down.', error);
return false;
}
if (error.message.includes('ENETUNREACH')) {
log.error('Network unreachable. Check your internet connection.', error);
return false;
}
if (error.message.includes('UNABLE_TO_VERIFY_LEAF_SIGNATURE')) {
log.error('SSL certificate verification failed. The certificate may be invalid or self-signed.', error);
return false;
}
if (error.message.includes('CERT_HAS_EXPIRED')) {
log.error('SSL certificate has expired. The server certificate is no longer valid.', error);
return false;
}
if (error.message.includes('EPROTO')) {
log.error('SSL/TLS protocol error. There may be a mismatch in the protocol version.', error);
return false;
}
if (error.message.includes('EADDRINUSE')) {
log.error('Address already in use. The port is occupied by another process.', error);
return false;
}
if (error.message.includes('EACCES')) {
log.error('Permission denied. You may need elevated privileges to access the resource.', error);
return false;
}
if (error.message.includes('HPE_INVALID_STATUS')) {
log.error('Invalid HTTP status code received from the server.', error);
return false;
}
if (error.message.includes('HPE_HEADER_OVERFLOW')) {
log.error('HTTP header overflow. The server sent headers that are too large.', error);
return false;
}
if (error.message.includes('ESOCKETTIMEDOUT')) {
log.error('Socket timed out. The connection took too long to respond.', error);
return false;
}
return;
}
});
eventLogger.startLogging();
// https://github.com/chalk/ansi-regex/blob/main/index.js
/*
export default function ansiRegex({onlyFirst = false} = {}) {
// Valid string terminator sequences are BEL, ESC\, and 0x9c
const ST = '(?:\\u0007|\\u001B\\u005C|\\u009C)';
const pattern = [
`[\\u001B\\u009B][[\\]()#;?]*(?:(?:(?:(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]+)*|[a-zA-Z\\d]+(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]*)*)?${ST})`,
'(?:(?:\\d{1,4}(?:;\\d{0,4})*)?[\\dA-PR-TZcf-nq-uy=><~]))',
].join('|');
return new RegExp(pattern, onlyFirst ? undefined : 'g');
}
*/
const RegexANSIEscape =
/[\u001B\u009B][[\]()#;?]*(?:(?:(?:(?:;[-a-zA-Z\d\/#&.:=?%@~_]+)*|[a-zA-Z\d]+(?:;[-a-zA-Z\d\/#&.:=?%@~_]*)*)?(?:\u0007|\u001B\u005C|\u009C))|(?:(?:\d{1,4}(?:;\d{0,4})*)?[\dA-PR-TZcf-nq-uy=><~]))/g;
hooks.push((message, transport) => {
if (transport !== transports.file) {
return message;
}
message.data = message.data.map((l) => l?.toString()?.replace(RegexANSIEscape, ''));
return message;
});
const {
version: VencordVersion,
} = require('../VencordExtension/manifest.json');
const server = require('./APIServer.js');
const ApplicationFlags = require('../AppAssets/ApplicationFlags.js');
const {
DirectMessagesDB,
PreloadedUserSettingsDB,
FrecencyUserSettingsDB,
} = require('./database/index.js');
const { PreloadedUserSettings } = require('../DiscordProtos');
const Experiments = require('../AppAssets/Experiments.js');
const Intents = require('../AppAssets/Intents.js');
const IPCEvent = require('./IPCEvent.js');
BigInt.prototype.toJSON = function () {
return this.toString();
};
class DiscordBotClient {
logger = log;
#shouldQuitApp = false;
/**
* @type {BrowserWindow}
*/
win;
/**
* @type {Tray}
*/
tray;
/**
* @type {number}
*/
port;
constructor() {
this.logger.log('App starting...');
this.initApp();
}
/**
* Load the tray
* @param {Electron.Menu} menu
*/
initTray(menu) {
if (!this.tray) {
this.tray = new Tray(Constants.icon16);
}
this.tray.setToolTip(`${Constants.APP_NAME} v${app.getVersion()}`);
this.tray.on('click', () => {
this.win.show();
});
this.tray.setContextMenu(menu);
}
setupTray() {
const menu = Menu.buildFromTemplate([
{
label: `${Constants.APP_NAME} v${app.getVersion()}`,
icon: Constants.icon16,
enabled: false,
},
{
type: 'separator',
},
{
label: 'Check for Updates...',
type: 'normal',
click: () => {
this.checkingForUpdates(true);
},
},
{
label: 'Github Repository',
type: 'normal',
click: () =>
shell.openExternal(
'https://github.com/aiko-chan-ai/DiscordBotClient',
),
},
{
type: 'separator',
},
{
label: 'Reload',
click: () => {
this.win.reload();
},
},
{
label: 'Relaunch',
click: () => {
app.relaunch();
this.#shouldQuitApp = true;
app.quit();
},
},
{
label: 'Clear web storage and relaunch',
click: () => {
this.win.webContents.session
.clearCache()
.then(() =>
this.win.webContents.session.clearStorageData(),
)
.then(() => {
app.relaunch();
this.#shouldQuitApp = true;
app.quit();
});
},
},
{
label: 'Clear local database',
submenu: [
{
label: 'Clear PreloadedUserSettings',
click: () => {
PreloadedUserSettingsDB.deleteAll().then(() => {
this.showNotification({
title: 'PreloadedUserSettings has been cleared',
body: 'This will reset all user settings.',
silent: false,
});
});
},
},
{
label: 'Clear FrecencyUserSettings',
click: () => {
FrecencyUserSettingsDB.deleteAll().then(() => {
this.showNotification({
title: 'FrecencyUserSettings has been cleared',
body: 'This will reset all user settings.',
silent: false,
});
});
},
},
{
label: 'Clear opened Private Channels',
click: () => {
DirectMessagesDB.deleteAll().then(
() => {
this.showNotification({
title: 'Opened Private Channels has been cleared',
body: 'This will reset all opened Private Channels.',
silent: false,
});
},
);
},
},
],
},
{
label: 'Toggle DevTools',
click: () => {
this.win.webContents.toggleDevTools();
},
},
{
type: 'separator',
},
{
label: 'Quit',
click: () => {
this.#shouldQuitApp = true;
app.quit();
},
},
]);
this.initTray(menu);
}
initApp() {
app.setAppUserModelId(Constants.APP_NAME);
// Allow Localhost SSL
app.commandLine.appendSwitch('allow-insecure-localhost', 'true');
app.commandLine.appendSwitch('ignore-certificate-errors');
app.commandLine.appendSwitch('disable-features', 'OutOfBlinkCors');
// App Event
app.on('window-all-closed', () => {
if (process.platform !== 'darwin') {
this.#shouldQuitApp = true;
app.quit();
}
});
app.on('before-quit', (event) => {
this.logger.info('App closing...');
this.logger.info('='.repeat(50));
});
app.on(
'second-instance',
(event, commandLine, workingDirectory, additionalData) => {
const myWindow = BrowserWindow.getAllWindows()?.[0];
if (myWindow) {
myWindow.show();
}
},
);
// Handle second instance
const gotTheLock = app.requestSingleInstanceLock();
if (!gotTheLock) {
this.logger.debug('Second Instance detected. Quit app...');
this.#shouldQuitApp = true;
app.quit();
} else {
app.whenReady().then(async () => {
this.logger.info('Checking Database...');
await Promise.all([
DirectMessagesDB.promiseReady,
PreloadedUserSettingsDB.promiseReady,
FrecencyUserSettingsDB.promiseReady,
]);
this.checkingForUpdates(false);
this.createWindow();
});
}
// Create context menu
contextMenu({
showLearnSpelling: false,
showSearchWithGoogle: false,
showCopyImageAddress: true,
showInspectElement: true,
showSaveImage: true,
showSaveImageAs: true,
showSaveVideo: true,
showSaveVideoAs: true,
});
this.setupIpcEvents();
}
async sessionPatch() {
// Disable stripe.com
session.defaultSession.webRequest.onBeforeRequest(
{
urls: ['https://*.stripe.com/*'],
},
(details, callback) => {
// Cancel all requests to stripe.com
callback({
cancel: true,
});
},
);
// Patch headers
session.defaultSession.webRequest.onBeforeSendHeaders(
{
urls: ['https://*.discord.com/*'],
},
(details, callback) => {
callback({
requestHeaders: {
Origin: 'https://discord.com',
'User-Agent': details.requestHeaders['User-Agent'],
Accept: '*/*',
Referer: 'https://discord.com',
'Accept-Encoding': 'gzip, deflate, br, zstd',
'Accept-Language': 'en-US'
}
});
}
);
// Intercept responses for specific URLs
session.defaultSession.webRequest.onHeadersReceived(
{ urls: ['<all_urls>'] },
(details, callback) => {
// Patch custom css
if (details.url.startsWith('https://raw.githubusercontent.com/')) {
if (
details.responseHeaders['content-type'].find((_) =>
_.includes('text/'),
)
) {
details.responseHeaders['content-type'] = ['text/css'];
}
}
if (details.responseHeaders && details.responseHeaders['access-control-allow-origin']) {
// Remove the CORS header
delete details.responseHeaders['access-control-allow-origin'];
// Alternatively, set it to '*' to allow all origins
// details.responseHeaders['access-control-allow-origin'] = ['*'];
}
callback({ responseHeaders: details.responseHeaders });
}
);
// Load Vencord-Web Extension
await session.defaultSession.loadExtension(
Constants.VencordExtensionPath,
);
this.logger.info(
'Vencord-Web Extension loaded, version: ' + VencordVersion,
);
}
async createWindow() {
this.port = await server(Constants.PortDefault);
this.setupTray();
const primaryDisplay = screen.getPrimaryDisplay();
const { width, height } = primaryDisplay.workAreaSize;
// Create the browser window.
this.win = new BrowserWindow({
width: Math.floor(width * 0.9),
height: Math.floor(height * 0.9),
minWidth: 940,
minHeight: 500,
icon: Constants.icon128,
webPreferences: {
webSecurity: false,
nodeIntegration: false,
enableRemoteModule: false,
preload: path.join(__dirname, 'ElectronPreload.js'),
contextIsolation: true,
sandbox: false,
},
backgroundColor: '#36393f',
titleBarStyle: 'hidden',
frame: false,
show: true,
title: Constants.APP_NAME,
...(process.platform === 'darwin' && {
titleBarStyle: 'hidden',
trafficLightPosition: { x: 10, y: 10 },
}),
});
// Check port
if (this.port !== Constants.PortDefault) {
this.showNotification({
title: 'Port In Use',
body: 'The default port is already in use by another application, so you will be logged out temporarily.',
silent: false,
});
}
// BrowserWindow Event
this.win
.on('close', (event) => {
if (!this.#shouldQuitApp) {
event.preventDefault();
this.win.hide();
}
})
.on('hide', function (e) {
e.preventDefault();
});
await this.sessionPatch();
// Patch UserAgent (Switch Plan B SDP > Unified Plan)
this.win.webContents.setUserAgent(Constants.UserAgentChrome);
this.logger.info(`Electron UserData: ${app.getPath('userData')}`);
// Microphone
if (process.platform === 'darwin') {
session.defaultSession.setPermissionRequestHandler(
async (_webContents, permission, callback, details) => {
let granted = true;
if ('mediaTypes' in details) {
if (details.mediaTypes?.includes('audio')) {
granted &&=
await systemPreferences.askForMediaAccess(
'microphone',
);
}
if (details.mediaTypes?.includes('video')) {
granted = false;
}
}
callback(granted);
},
);
}
// webContents
if (!app.isPackaged) this.win.webContents.openDevTools();
// Discord popout
this.win.webContents.setWindowOpenHandler(({ url }) => {
this.logger.log('WindowOpenHandler', url);
if (
Constants.AllowPopups.map(u => u.replace('{port}', this.port)).find(
u => url.startsWith(u),
)
) {
return {
action: 'allow',
overrideBrowserWindowOptions: {
icon: Constants.icon128,
frame: true,
autoHideMenuBar: true,
width: 1080,
height: 720,
minWidth: 940,
minHeight: 500,
webPreferences: {
webSecurity: false,
nodeIntegration: false,
enableRemoteModule: false,
preload: path.join(__dirname, 'ElectronPreload.js'),
contextIsolation: true,
sandbox: false,
},
backgroundColor: '#36393f',
show: true,
...(process.platform === 'darwin' && {
titleBarStyle: 'hidden',
trafficLightPosition: { x: 10, y: 10 },
}),
},
};
}
if (!Constants.DeclinePopups.map(u => u.replace('{port}', this.port)).find(
u => url.startsWith(u),
)) {
shell.openExternal(url);
}
return { action: 'deny' };
});
// WebContents Event
this.win.webContents
.on('did-start-loading', () => {
this.win.setProgressBar(2, { mode: 'indeterminate' });
})
.on('did-stop-loading', () => {
this.win.setTitle(Constants.APP_NAME);
this.win.setProgressBar(-1);
});
// Load the index.html of the app.
this.win.loadURL(
Constants.TestVencordMode
? 'https://canary.discord.com/channels/@me'
: `https://localhost:${this.port}`,
);
}
setupIpcEvents() {
ipcMain
.on(IPCEvent.Minimize, (event) => {
this.win.minimize();
event.returnValue = true;
})
.on(IPCEvent.Maximize, (event) => {
if (this.win.isMaximized()) {
this.win.restore();
} else {
this.win.maximize();
}
})
.on(IPCEvent.Close, (event) => {
this.win.hide();
})
.on(IPCEvent.GetBotInfo, async (event, token) => {
token = token.replace(/Bot/g, '').trim();
fetch(
`https://discord.com/api/v9/applications/@me?with_counts=true`,
{
headers: {
Authorization: `Bot ${token}`,
'User-Agent': Constants.UserAgentDiscordBot,
},
},
)
.then((res) => {
if (!res.ok) throw new Error(res.statusText);
return res.json();
})
.then((data) => {
const flags = new ApplicationFlags(
data.flags,
).toArray();
const skip = new Set([
'GUILD_PRESENCES',
'GUILD_MEMBERS',
'MESSAGE_CONTENT',
]);
for (let i = 0; i < flags.length; i++) {
const f = flags[i];
if (f.includes('GATEWAY_PRESENCE')) {
skip.delete('GUILD_PRESENCES');
}
if (f.includes('GATEWAY_GUILD_MEMBERS')) {
skip.delete('GUILD_MEMBERS');
}
if (f.includes('GATEWAY_MESSAGE_CONTENT')) {
skip.delete('MESSAGE_CONTENT');
}
}
if (skip.has('MESSAGE_CONTENT')) {
throw new Error('MESSAGE_CONTENT is required');
}
event.sender.send(IPCEvent.GetBotInfoResponse, {
success: true,
data,
intents: Intents.getIntents(...Array.from(skip)),
allShards:
Math.ceil(
parseInt(data.approximate_guild_count) /
Constants.MaxGuildsPerShard,
) || 1,
});
})
.catch((e) => {
event.sender.send(IPCEvent.GetBotInfoResponse, {
success: false,
message: e.message,
});
});
})
.on(IPCEvent.GetDBCVersions, (event) => {
return (event.returnValue = app.getVersion());
})
.on(IPCEvent.GetPreloadedUserSettings, async (event, uid) => {
const userData = await PreloadedUserSettingsDB.get(uid);
event.returnValue = PreloadedUserSettings.toBase64(
PreloadedUserSettings.create(userData),
);
})
.on(IPCEvent.GetExperiment, (event, type, allData, botId) => {
if (type == 'user') {
event.returnValue = Experiments.User(allData, botId);
} else if (type == 'guild') {
event.returnValue = Experiments.Guild();
}
})
.on(
IPCEvent.HandlePrivateChannel,
async (event, type, botId, channelId, userId) => {
this.logger.log(
'handlePrivateChannel',
type,
botId,
channelId,
userId,
);
const userData = await DirectMessagesDB.get(botId);
if (typeof userId == 'object' && userId?.id) {
this.logger.warn('UserId does not match the required format (string)', userId);
userId = userId.id[0]; // ??? Discord feature ???
}
if (type == 'add') {
userData[channelId] = {
type: 1,
recipients: [
{
id: userId,
},
],
last_message_id: null,
is_spam: false,
id: channelId,
flags: 0,
};
await DirectMessagesDB.set(botId, userData);
} else if (type == 'remove') {
delete userData[channelId];
await DirectMessagesDB.set(botId, userData);
} else if (type == 'clear') {
userData = {};
await DirectMessagesDB.set(botId, userData);
}
event.returnValue = true;
},
)
.on(IPCEvent.GetPrivateChannel, async (event, uid) => {
const userData = await DirectMessagesDB.get(uid);
event.returnValue = userData;
})
.on(IPCEvent.GetDefaultUserPatch, (event) => {
event.returnValue = Constants.UserDefaultPatch;
})
.on(IPCEvent.GetLocationDiscordAPIHandle, (event) => {
event.returnValue = 'localhost:' + this.port;
});
}
/**
* Show a notification
* @param {import('electron').NotificationConstructorOptions} options Options for the notification
* @param {Function} callback Callback function
* @returns {void}
*/
showNotification(options, callback) {
const notif = new Notification(options);
notif.once('click', () => {
notif.close();
if (callback && typeof callback === 'function') callback();
});
notif.show();
}
/**
* Compares two version strings and determines if `versionB` is newer than `versionA`.
* Supports version strings in the format `major.minor.patch` with an optional prefix 'v'.
*
* @param versionA - The current version (e.g., "v1.2.3" or "1.2.3").
* @param versionB - The new version to check (e.g., "v1.3.0" or "1.3.0").
* @returns `true` if `versionB` is newer than `versionA`, otherwise `false`.
*/
#isNewerVersion(versionA, versionB) {
// Remove 'v' prefix if present
const normalizeVersion = (version) => version.replace(/^v/, '');
const parseVersion = (version) => {
const parts = version.split('.').map(Number);
if (parts.length !== 3 || parts.some(isNaN)) {
throw new Error(`Invalid version format: ${version}`);
}
return parts;
};
const [vA, vB] = [
normalizeVersion(versionA),
normalizeVersion(versionB),
].map(parseVersion);
// Compare versions
for (let i = 0; i < 3; i++) {
if (vB[i] > vA[i]) return true;
if (vB[i] < vA[i]) return false;
}
return false; // Versions are equal
}
checkingForUpdates(forceEmitted = false) {
this.logger.info('Checking for updates...');
return new Promise((resolve) => {
fetch(
'https://api.github.com/repos/aiko-chan-ai/DiscordBotClient/releases/latest',
)
.then((res) => res.json())
.then((res) => {
if (!app.isPackaged) {
this.showNotification(
{
title: `Test mode`,
body: `Electron v${app.getVersion()} - ${os.platform()}`,
silent: true,
},
() => {
shell.openExternal(
'https://github.com/aiko-chan-ai/DiscordBotClient/releases',
);
},
);
} else if (
this.#isNewerVersion(app.getVersion(), res.tag_name)
) {
this.showNotification(
{
title: `New version available: ${res.name}`,
body: `Click here to open the update page`,
silent: false,
},
() => {
shell.openExternal(
'https://github.com/aiko-chan-ai/DiscordBotClient/releases',
);
},
);
} else {
if (forceEmitted)
this.showNotification(
{
title: 'Update Manager',
body: `You are using the latest version (v${app.getVersion()})`,
silent: true,
},
() => {
shell.openExternal(
'https://github.com/aiko-chan-ai/DiscordBotClient/releases',
);
},
);
}
})
.catch((e) => {
this.logger.error(e);
this.showNotification(
{
title: 'Update Manager',
body: `Unable to check for updates (v${app.getVersion()})`,
silent: false,
},
() => {
shell.openExternal(
'https://github.com/aiko-chan-ai/DiscordBotClient/releases',
);
},
);
})
.finally(() => resolve(true));
});
}
}
new DiscordBotClient();