Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add an AFK timer #5002

Merged
merged 49 commits into from
Jun 30, 2019
Merged
Changes from 1 commit
Commits
Show all changes
49 commits
Select commit Hold shift + click to select a range
b5d97f5
Add an AFK timer
Asheviere Nov 29, 2018
88823c3
Increase afk timer for staff to 1 hour
Asheviere Nov 29, 2018
1b02622
Make times look a little better
Asheviere Nov 29, 2018
868c5ab
Don't AFK timer logout bots
Asheviere Nov 29, 2018
be8392e
Different approach!
Asheviere Apr 11, 2019
53a3bbe
Ok do things better
Asheviere Apr 11, 2019
f61337c
Update server/users.js
scheibo Apr 11, 2019
049e039
Update server/users.js
scheibo Apr 11, 2019
c81980f
fixes
Asheviere Apr 11, 2019
af8fca0
oops
Asheviere Apr 11, 2019
fe3e0b7
totally didn't mess this tiny thing up
Asheviere Apr 11, 2019
9c81fd0
Update PROTOCOL.md
scheibo Apr 11, 2019
0677e37
avoid duplicate messages
Asheviere Apr 11, 2019
89a6578
Move logic for setting users as back to User.chat
Asheviere Apr 11, 2019
3ae22ae
typo
Asheviere Apr 11, 2019
327f40c
more verbose
Asheviere Apr 11, 2019
cd0eaec
more documentation once again
Asheviere Apr 11, 2019
f9d98a1
some more improvements
Asheviere Apr 12, 2019
e45a9d0
Implement different away messages for different ways of setting away …
Asheviere Apr 12, 2019
2265ea8
(Attempt to) implement pre's suggested changes to how this all works
Asheviere Apr 15, 2019
79d3d3f
and his other comments
Asheviere Apr 15, 2019
d9d1026
more shit
Asheviere Apr 15, 2019
33a0caf
Update server/chat-commands.js
scheibo Apr 16, 2019
c9970b6
Mark back in some more places
Asheviere May 3, 2019
eb98dc1
set back in User.merge
Asheviere May 5, 2019
dac6446
Set back when broadcasting commands
Asheviere May 10, 2019
e08e600
Improve display of AFK statuses
Asheviere May 10, 2019
7ca9a4a
toId -> toID
Asheviere May 17, 2019
c4a0d45
Refactor /away
Asheviere May 19, 2019
212df5b
change getStatus
Asheviere May 22, 2019
84ba7c6
more updates
Asheviere May 27, 2019
cf10832
Update protocol documentation
Asheviere May 29, 2019
ad7629c
reset status when resetting name
Asheviere May 29, 2019
05c6824
Don't allow locked users to use /away
Asheviere May 29, 2019
c5353ce
reset status when namelocked
Asheviere May 29, 2019
c846678
Add /status to let users set a status without /away
Asheviere May 30, 2019
1a2b147
blah
Asheviere May 30, 2019
8964c81
Pre likes this word better
Asheviere May 30, 2019
903d8ca
fix
Asheviere May 31, 2019
2e75412
Pre liked smaller numbers
Asheviere May 31, 2019
e46b3dd
Add busy status
Asheviere Jun 7, 2019
87c4d65
ffff
Asheviere Jun 7, 2019
7249c40
Improve bot immunity
Asheviere Jun 11, 2019
ee1d8f5
refactor some stuff
Asheviere Jun 13, 2019
597d4ee
fix typo
Asheviere Jun 14, 2019
51bc726
whoooops
Asheviere Jun 14, 2019
85420aa
forgot to save a file
Asheviere Jun 14, 2019
f31e5f0
Admins use the staff timer as well
scheibo Jun 26, 2019
12bee58
Merge branch 'master' into afktimer
Jun 28, 2019
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
Prev Previous commit
Next Next commit
more updates
  • Loading branch information
Asheviere committed Jun 25, 2019
commit 84ba7c6cf83669dfac9d43a939bdc68a8a1acbbe
14 changes: 6 additions & 8 deletions server/users.js
Original file line number Diff line number Diff line change
Expand Up @@ -536,8 +536,6 @@ class User extends Chat.MessageContext {
// Used in punishments
/** @type {string} */
this.trackRename = '';
/** @type {boolean} */
this.isAway = false;
/** @type {string} */
this.status = '';
// initialize
Expand Down Expand Up @@ -604,7 +602,7 @@ class User extends Chat.MessageContext {
getIdentityWithStatus(roomid = '') {
const identity = this.getIdentity(roomid);
if (!this.status) return identity;
return `${identity}@${this.isAway ? '!' : ''}${this.status}`;
return `${identity}@${this.status}`;
}
/**
* @param {string} minAuth
Expand Down Expand Up @@ -1017,15 +1015,14 @@ class User extends Chat.MessageContext {
* @param {string[]} updated the settings which have been updated or none for all settings.
*/
getUpdateuserText(...updated) {
const status = this.status ? `@${this.status}` : '';
const named = this.named ? 1 : 0;
const diff = {};
const settings = updated.length ? updated : SETTINGS;
for (const setting of settings) {
// @ts-ignore - dynamic lookup
diff[setting] = this[setting];
}
return `|updateuser|${this.name}${status}|${named}|${this.avatar}|${JSON.stringify(diff)}`;
return `|updateuser|${this.getIdentityWithStatus()}|${named}|${this.avatar}|${JSON.stringify(diff)}`;
}
/**
* @param {string[]} updated the settings which have been updated or none for all settings.
Expand Down Expand Up @@ -1562,17 +1559,18 @@ class User extends Chat.MessageContext {
this.chatQueue = null;
}
}
isAway() {
return this.status && this.status.charAt(0) === '!';
}
/**
* @param {string} message
*/
setAway(message) {
this.isAway = true;
this.status = message;
this.status = `!${message}`;
this.updateIdentity();
}
setBack() {
if (!this.isAway) return;
this.isAway = false;
this.status = '';
this.updateIdentity();
}
Expand Down