MasterFloat

Untitled

Feb 28th, 2015
221
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.48 KB | None | 0 0
  1. eating: 'away',
  2. gaming: 'away',
  3. sleep: 'away',
  4. work: 'away',
  5. working: 'away',
  6. sleeping: 'away',
  7. busy: 'away',
  8. afk: 'away',
  9. away: function(target, room, user, connection, cmd) {
  10. // unicode away message idea by Siiilver
  11. var t = 'Ⓐⓦⓐⓨ';
  12. var t2 = 'Away';
  13. switch (cmd) {
  14. case 'busy':
  15. t = 'Ⓑⓤⓢⓨ';
  16. t2 = 'Busy';
  17. break;
  18. case 'sleeping':
  19. t = 'Ⓢⓛⓔⓔⓟⓘⓝⓖ';
  20. t2 = 'Sleeping';
  21. break;
  22. case 'sleep':
  23. t = 'Ⓢⓛⓔⓔⓟⓘⓝⓖ';
  24. t2 = 'Sleeping';
  25. break;
  26. case 'gaming':
  27. t = 'Ⓖⓐⓜⓘⓝⓖ';
  28. t2 = 'Gaming';
  29. break;
  30. case 'working':
  31. t = 'Ⓦⓞⓡⓚⓘⓝⓖ';
  32. t2 = 'Working';
  33. break;
  34. case 'work':
  35. t = 'Ⓦⓞⓡⓚⓘⓝⓖ';
  36. t2 = 'Working';
  37. break;
  38. case 'eating':
  39. t = 'Ⓔⓐⓣⓘⓝⓖ';
  40. t2 = 'Eating';
  41. break;
  42. default:
  43. t = 'Ⓐⓦⓐⓨ'
  44. t2 = 'Away';
  45. break;
  46. }
  47.  
  48. if (user.name.length > 18) return this.sendReply('Your username exceeds the length limit.');
  49.  
  50. if (!user.isAway) {
  51. user.originalName = user.name;
  52. var awayName = user.name + ' - '+t;
  53. //delete the user object with the new name in case it exists - if it does it can cause issues with forceRename
  54. delete Users.get(awayName);
  55. user.forceRename(awayName, undefined, true);
  56.  
  57. if (user.isStaff) this.add('|raw|-- <b><font color="#088cc7">' + user.originalName +'</font color></b> is now '+t2.toLowerCase()+'. '+ (target ? " (" + escapeHTML(target) + ")" : ""));
  58.  
  59. user.isAway = true;
  60. }
  61. else {
  62. return this.sendReply('You are already set as a form of away, type /back if you are now back.');
  63. }
  64.  
  65. user.updateIdentity();
  66. },
  67.  
  68. back: function(target, room, user, connection) {
  69.  
  70. if (user.isAway) {
  71. if (user.name === user.originalName) {
  72. user.isAway = false;
  73. return this.sendReply('Your name has been left unaltered and no longer marked as away.');
  74. }
  75.  
  76. var newName = user.originalName;
  77.  
  78. //delete the user object with the new name in case it exists - if it does it can cause issues with forceRename
  79. delete Users.get(newName);
  80.  
  81. user.forceRename(newName, undefined, true);
  82.  
  83. //user will be authenticated
  84. user.authenticated = true;
  85.  
  86. if (user.isStaff) this.add('|raw|-- <b><font color="#088cc7">' + newName + '</font color></b> is no longer away.');
  87.  
  88. user.originalName = '';
  89. user.isAway = false;
  90. }
  91. else {
  92. return this.sendReply('You are not set as away.');
  93. }
  94.  
  95. user.updateIdentity();
  96. },
Advertisement
Add Comment
Please, Sign In to add comment