Guest User

Untitled

a guest
Jan 6th, 2017
89
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.16 KB | None | 0 0
  1. registerPlugin({
  2. name: 'Welcome and Move',
  3. vars: [
  4. {
  5. name: 'group',
  6. title: 'Gruppe',
  7. type: 'string'
  8. },
  9. {
  10. name: 'channel',
  11. title: 'Channel',
  12. type: 'channel'
  13. },
  14. {
  15. name: 'text',
  16. title: 'Text',
  17. type: 'multiline'
  18. },
  19. {
  20. name: 'modgroups',
  21. title: 'Moderatoren-Gruppen',
  22. type: 'strings'
  23. },
  24. {
  25. name: 'modnotification',
  26. title: 'Moderatoren-Benachrichtigung',
  27. type: 'string'
  28. }
  29. ]
  30. }, function(sinusbot, config) {
  31. config.group = config.group || '';
  32. config.channel = config.channel || '';
  33. config.text = config.text || '';
  34. sinusbot.on('clientMove', function(e) {
  35. if (e.oldChannel == 0) {
  36. if (e.client.groups) {
  37. e.client.groups.forEach(function(g) {
  38. if (g.i+'' == config.group+'') { // Make sure we're using strings for both
  39. sinusbot.chatPrivate(e.client.id, config.text);
  40. sinusbot.move(e.client.id, config.channel);
  41.  
  42. // Find mods...
  43. var notify = (config.modnotification || '').replace('%n', e.client.nick);
  44. var chans = sinusbot.getChannels() || [];
  45. chans.forEach(function(chan) {
  46. if (!chan.clients) return;
  47. chan.clients.forEach(function(client) {
  48. if (client.g) {
  49. client.g.forEach(function(group) {
  50. if (config.modgroups.indexOf(group.i+'') >= 0) {
  51. sinusbot.chatPrivate(client.id, notify);
  52. }
  53. });
  54. }
  55. });
  56. });
  57. return;
  58. }
  59. });
  60. }
  61. }
  62. });
  63. });
Add Comment
Please, Sign In to add comment