Greasy Fork is available in English.

Pendoria - FixHazzy

Overwrites what Hazzy says in realtime with some nice sentences.

  1. // ==UserScript==
  2. // @name Pendoria - FixHazzy
  3. // @description Overwrites what Hazzy says in realtime with some nice sentences.
  4. // @namespace http://pendoria.net/
  5. // @version 0.0.2
  6. // @author Xortrox
  7. // @contributor Tester: Hazzy
  8. // @match http://pendoria.net/game
  9. // @match https://pendoria.net/game
  10. // @match http://www.pendoria.net/game
  11. // @match https://www.pendoria.net/game
  12. // @grant none
  13. // ==/UserScript==
  14.  
  15. inspirationalQuotes = [
  16. 'Xortrox made me the way I am! That\'s why I am soooo happy :D',
  17. 'Maria is love Maria is life',
  18. 'Puls3 is a generous guy!',
  19. 'It\'sa me Hazzio!',
  20. 'Me Hazzy! Me Happy!',
  21. 'Flowers are pretty tbh, and you look like one my peoples :3!',
  22. 'Hello sunshine! how is your day?',
  23. 'My name is Hazzy, and I and very happy today :3'
  24. ];
  25. function getChatMessageTimestamp(msg){
  26. return msg.substr(0, msg.indexOf(' '))
  27. }
  28. function fixhazzy(message, channel, username, id) {
  29. if (channel === '/main' || channel === 'hazzyfix') {
  30. // Hazy ID
  31. if (id === 1774) {
  32. console.log("IT WAS HAZZY!");
  33. }
  34. setTimeout(() => {
  35. let timestamp = getChatMessageTimestamp(message);
  36. let chatLine = $('li:contains("' + timestamp + '")');
  37. if(!chatLine) {
  38. return console.log('No chat line found.');
  39. }
  40. console.log('chatLine:', chatLine);
  41. let msgText = chatLine[0].innerHTML.substr(chatLine[0].innerHTML.indexOf('</a>: ') + 6)
  42. //console.log('text:', msgText);
  43. //console.log('New innerHTML with replaced text:', chatLine[0].innerHTML.replace(msgText, 'Flowers are pretty tbh, and you look like one my peoples :3!'));
  44. if (id === 1774) {
  45. let newInner = chatLine[0].innerHTML.replace(msgText, inspirationalQuotes[Math.floor(Math.random() * inspirationalQuotes.length)])
  46. chatLine[0].innerHTML = newInner;
  47. console.log('chat now:', chatLine[0].innerHTML);
  48. }
  49. }, 200);
  50. console.log('Received main message:', message, '\nusername:', username);
  51. }
  52. }
  53. socket.on('message', fixhazzy);
  54. socket.io.on('message', fixhazzy);