Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit dd09ffa

Browse filesBrowse files
committed
Add uptime command
1 parent 58abc93 commit dd09ffa
Copy full SHA for dd09ffa

File tree

Expand file treeCollapse file tree

2 files changed

+14
-2
lines changed
Filter options
Expand file treeCollapse file tree

2 files changed

+14
-2
lines changed

‎paperbot/package.json

Copy file name to clipboardExpand all lines: paperbot/package.json
+3-2Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "isocpp-mattermost-paperbot",
3-
"version": "2.0.0-rc.8",
3+
"version": "2.0.0-rc.9",
44
"description": "",
55
"main": "src/index.js",
66
"scripts": {
@@ -14,6 +14,7 @@
1414
"mattermost-redux": "^5.33.1",
1515
"tslib": "^2.5.0",
1616
"express": "^4.18.2",
17-
"dotenv": "^16.0.3"
17+
"dotenv": "^16.0.3",
18+
"moment": "2.29.4"
1819
}
1920
}

‎paperbot/src/index.js

Copy file name to clipboardExpand all lines: paperbot/src/index.js
+11Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
require('babel-polyfill');
22
require('isomorphic-fetch');
3+
const moment = require('moment')
34
if (!global.WebSocket) {
45
global.WebSocket = require('ws');
56
}
@@ -245,6 +246,7 @@ class PaperBot {
245246
this.registerCommand('help', this.handleHelpCommand);
246247
this.registerCommand('search', this.handleSearchCommand);
247248
this.registerCommand('version', this.handleVersionCommand);
249+
this.registerCommand('uptime', this.handleUptimeCommand);
248250
}
249251

250252
registerCommand(token, handler) {
@@ -278,6 +280,7 @@ class PaperBot {
278280
help: 0,
279281
search: 0,
280282
version: 0,
283+
uptime: 0,
281284
},
282285
index: {
283286
update_checks_performed: 0,
@@ -424,6 +427,14 @@ class PaperBot {
424427
this.respondTo(post, 'Running PaperBot in Version {0}'.format(pjson.version));
425428
}
426429

430+
handleUptimeCommand(post, message, tokenized) {
431+
this.stats.commands.uptime += 1;
432+
433+
this.respondTo(post, 'PaperBot was started {0} ({1})'.format(
434+
moment(this.launch_timestamp).fromNow(),
435+
moment(this.launch_timestamp).format('YYYY-MM-DD HH:m:s')));
436+
}
437+
427438
handleSearchCommand(post, message, tokenized) {
428439
this.stats.commands.search += 1;
429440

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.