From 328992357190dd14a41b1f2502554550c54d62ed Mon Sep 17 00:00:00 2001 From: Navy Date: Fri, 17 Apr 2020 23:18:52 +0300 Subject: [PATCH] Observer templates --- .../components/observers/ActivityTracker.js | 5 ++- .../client/components/observers/Automute.js | 29 +++++++++++++++ .../client/components/observers/Autorole.js | 29 +++++++++++++++ .../client/components/observers/BanLogger.js | 36 +++++++++++++++++++ .../components/observers/Invitefilter.js | 36 +++++++++++++++++++ .../client/components/observers/Linkfilter.js | 36 +++++++++++++++++++ .../components/observers/MemberLogger.js | 36 +++++++++++++++++++ .../components/observers/MemberUpdates.js | 36 +++++++++++++++++++ .../client/components/observers/Wordfilter.js | 36 +++++++++++++++++++ 9 files changed, 276 insertions(+), 3 deletions(-) create mode 100644 structure/client/components/observers/Automute.js create mode 100644 structure/client/components/observers/Autorole.js create mode 100644 structure/client/components/observers/BanLogger.js create mode 100644 structure/client/components/observers/Invitefilter.js create mode 100644 structure/client/components/observers/Linkfilter.js create mode 100644 structure/client/components/observers/MemberLogger.js create mode 100644 structure/client/components/observers/MemberUpdates.js create mode 100644 structure/client/components/observers/Wordfilter.js diff --git a/structure/client/components/observers/ActivityTracker.js b/structure/client/components/observers/ActivityTracker.js index b7fef53..fee37e5 100644 --- a/structure/client/components/observers/ActivityTracker.js +++ b/structure/client/components/observers/ActivityTracker.js @@ -1,5 +1,4 @@ const { Observer } = require('../../../interfaces/'); -const Collection = require('../../../../util/Collection.js'); class ActivityTracker extends Observer { @@ -7,12 +6,12 @@ class ActivityTracker extends Observer { super(client, { name: 'activityTracker', - priority: 3, + priority: 4, guarded: true }); this.client = client; - this.cache = new Collection(); + this.cache = { }; this.hooks = [ ['message', this.onMessage.bind(this)], diff --git a/structure/client/components/observers/Automute.js b/structure/client/components/observers/Automute.js new file mode 100644 index 0000000..e26f602 --- /dev/null +++ b/structure/client/components/observers/Automute.js @@ -0,0 +1,29 @@ +const { Observer } = require('../../../interfaces/'); + +class Automute extends Observer { + + constructor(client) { + + super(client, { + name: 'automute', + priority: 1, + guarded: true + }); + + this.client = client; + + this.hooks = [ + ['guildMemberAdd', this.onJoin.bind(this)] + ]; + + } + + async onJoin(member) { + + + + } + +} + +module.exports = Automute; \ No newline at end of file diff --git a/structure/client/components/observers/Autorole.js b/structure/client/components/observers/Autorole.js new file mode 100644 index 0000000..937eb39 --- /dev/null +++ b/structure/client/components/observers/Autorole.js @@ -0,0 +1,29 @@ +const { Observer } = require('../../../interfaces/'); + +class Autorole extends Observer { + + constructor(client) { + + super(client, { + name: 'autorole', + priority: 3, + guarded: true + }); + + this.client = client; + + this.hooks = [ + ['guildMemberAdd', this.onJoin.bind(this)] + ]; + + } + + async onJoin(member) { + + + + } + +} + +module.exports = Autorole; \ No newline at end of file diff --git a/structure/client/components/observers/BanLogger.js b/structure/client/components/observers/BanLogger.js new file mode 100644 index 0000000..e862375 --- /dev/null +++ b/structure/client/components/observers/BanLogger.js @@ -0,0 +1,36 @@ +const { Observer } = require('../../../interfaces/'); + +class BanLogger extends Observer { + + constructor(client) { + + super(client, { + name: 'autorole', + priority: 3, + guarded: true + }); + + this.client = client; + + this.hooks = [ + ['guildBanAdd', this.onBan.bind(this)], + ['guildBanRemove', this.onUnban.bind(this)] + ]; + + } + + async onBan(guild, member) { + + + + } + + async onUnban(guild, member) { + + + + } + +} + +module.exports = BanLogger; \ No newline at end of file diff --git a/structure/client/components/observers/Invitefilter.js b/structure/client/components/observers/Invitefilter.js new file mode 100644 index 0000000..2b13563 --- /dev/null +++ b/structure/client/components/observers/Invitefilter.js @@ -0,0 +1,36 @@ +const { Observer } = require('../../../interfaces/'); + +class Invitefilter extends Observer { + + constructor(client) { + + super(client, { + name: 'invitefilter', + priority: 1, + guarded: true + }); + + this.client = client; + + this.hooks = [ + ['messageUpdate', this.onEdit.bind(this)], + ['message', this.onMessage.bind(this)] + ]; + + } + + async onEdit(oldMsg, newMsg) { + + + + } + + async onMessage(message) { + + + + } + +} + +module.exports = Invitefilter; \ No newline at end of file diff --git a/structure/client/components/observers/Linkfilter.js b/structure/client/components/observers/Linkfilter.js new file mode 100644 index 0000000..31ff4f1 --- /dev/null +++ b/structure/client/components/observers/Linkfilter.js @@ -0,0 +1,36 @@ +const { Observer } = require('../../../interfaces/'); + +class Linkfilter extends Observer { + + constructor(client) { + + super(client, { + name: 'linkfilter', + priority: 1, + guarded: true + }); + + this.client = client; + + this.hooks = [ + ['messageUpdate', this.onEdit.bind(this)], + ['message', this.onMessage.bind(this)] + ]; + + } + + async onEdit(oldMsg, newMsg) { + + + + } + + async onMessage(message) { + + + + } + +} + +module.exports = Linkfilter; \ No newline at end of file diff --git a/structure/client/components/observers/MemberLogger.js b/structure/client/components/observers/MemberLogger.js new file mode 100644 index 0000000..4a0a94a --- /dev/null +++ b/structure/client/components/observers/MemberLogger.js @@ -0,0 +1,36 @@ +const { Observer } = require('../../../interfaces/'); + +class MemberLogger extends Observer { + + constructor(client) { + + super(client, { + name: 'memberLogger', + priority: 3, + guarded: true + }); + + this.client = client; + + this.hooks = [ + ['guildMemberAdd', this.onJoin.bind(this)], + ['guildMemberRemove', this.onLeave.bind(this)] + ]; + + } + + async onJoin(member) { + + + + } + + async onLeave(member) { + + + + } + +} + +module.exports = MemberLogger; \ No newline at end of file diff --git a/structure/client/components/observers/MemberUpdates.js b/structure/client/components/observers/MemberUpdates.js new file mode 100644 index 0000000..f8bb4cb --- /dev/null +++ b/structure/client/components/observers/MemberUpdates.js @@ -0,0 +1,36 @@ +const { Observer } = require('../../../interfaces/'); + +class MemberUpdates extends Observer { + + constructor(client) { + + super(client, { + name: 'memberUpdates', + priority: 3, + guarded: true + }); + + this.client = client; + + this.hooks = [ + ['voiceStateUpdate', this.onVoice.bind(this)], + ['guildMemberUpdate', this.onMember.bind(this)] + ]; + + } + + async onVoice(oldState, newState) { + + + + } + + async onMember(oldMember, newMember) { + + + + } + +} + +module.exports = MemberUpdates; \ No newline at end of file diff --git a/structure/client/components/observers/Wordfilter.js b/structure/client/components/observers/Wordfilter.js new file mode 100644 index 0000000..e0bb2a1 --- /dev/null +++ b/structure/client/components/observers/Wordfilter.js @@ -0,0 +1,36 @@ +const { Observer } = require('../../../interfaces/'); + +class Wordfilter extends Observer { + + constructor(client) { + + super(client, { + name: 'wordfilter', + priority: 1, + guarded: true + }); + + this.client = client; + + this.hooks = [ + ['messageUpdate', this.onEdit.bind(this)], + ['message', this.onMessage.bind(this)] + ]; + + } + + async onEdit(oldMsg, newMsg) { + + + + } + + async onMessage(message) { + + + + } + +} + +module.exports = Wordfilter; \ No newline at end of file