+}
+
+export interface OnStatusChangeEventArgs {
+ user: User,
+ presence: Presence
+}
diff --git a/src/util/plugin/event_types/TypingEventArgs.ts b/src/util/plugin/event_types/TypingEventArgs.ts
new file mode 100644
index 000000000..3ac59b416
--- /dev/null
+++ b/src/util/plugin/event_types/TypingEventArgs.ts
@@ -0,0 +1,17 @@
+import { Channel, Guild, User } from "util/entities";
+import { EventResult } from ".";
+
+export interface PreTypingEventArgs {
+ channel: Channel,
+ guild: Guild,
+ user: User
+}
+export interface PreTypingEventResult extends EventResult {
+
+}
+
+export interface OnTypingEventArgs {
+ channel: Channel,
+ guild: Guild,
+ user: User
+}
diff --git a/src/util/plugin/event_types/_gen.sh b/src/util/plugin/event_types/_gen.sh
new file mode 100755
index 000000000..9f761d1e8
--- /dev/null
+++ b/src/util/plugin/event_types/_gen.sh
@@ -0,0 +1,74 @@
+#!/bin/sh
+rm -f ../plugin.eventfuncs.generated
+rm -f ../plugin.imports.generated
+while read event
+do
+ echo Making event $event...
+ (
+ echo 'import { EventResult } from ".";'
+ echo ''
+ echo "export interface Pre${event}EventArgs {"
+ echo ' '
+ echo '}'
+ echo "export interface Pre${event}EventResult extends EventResult {"
+ echo ' '
+ echo '}'
+ echo ''
+ echo "export interface On${event}EventArgs {"
+ echo ' '
+ echo '}'
+ ) > ${event}EventArgs.ts.generated
+ (
+ echo " public static async pre${event}Event(args: Pre${event}EventArgs): Promise {"
+ echo " return (await Promise.all(PluginStore.plugins.filter(x=>x.onPre${event}).map(x=>x.onPre${event} && x.onPre${event}(args)))).filter(x=>x) as Pre${event}EventResult[];"
+ echo ' }'
+ echo ' '
+ echo " public static async on${event}Event(args: On${event}EventArgs): Promise {"
+ echo " await Promise.all(PluginStore.plugins.filter(x=>x.on${event}).map(x=>x.on${event} && x.on${event}(args)));"
+ echo ' }'
+ echo ' '
+ ) >> ../PluginEventHandler.ts.3
+ (
+ echo " /**"
+ echo " * ${event}Event: document me"
+ echo " *"
+ echo " * @param {On${event}EventArgs} args Info about what's going on"
+ echo " * @memberof Plugin"
+ echo " */"
+ echo " async on${event}?(args: On${event}EventArgs): Promise;"
+ echo ' '
+ echo " /**"
+ echo " * ${event}Event: Executed before changes are announced"
+ echo " * document me."
+ echo " *"
+ echo " * @param {Pre${event}EventArgs} args Info about what's going on"
+ echo " * @return {Pre${event}EventResult} How event should be handled"
+ echo " * @memberof Plugin"
+ echo " */"
+ echo " async onPre${event}?(args: Pre${event}EventArgs): Promise;"
+ ) >> ../plugin.eventfuncs.generated
+
+ echo "import { Pre${event}EventArgs, On${event}EventArgs, Pre${event}EventResult } from './event_types';" >> ../PluginEventHandler.ts.1
+ echo "import { Pre${event}EventArgs, Pre${event}EventResult, On${event}EventArgs } from '.';" >> ../plugin.imports.generated
+ cmp --silent "${event}EventArgs.ts" "${event}EventArgs.ts.generated" && rm -f "${event}EventArgs.ts.generated"
+done < _pdo
+
+echo 'Building PluginEventHandler...'
+
+rm -f ../PluginEventHandler.ts.generated
+(
+ echo 'import { PluginStore } from ".";'
+ echo ''
+ echo 'export class PluginEventHandler {'
+) > ../PluginEventHandler.ts.2
+echo '}' > ../PluginEventHandler.ts.4
+for i in {1..4}
+do
+ cat "../PluginEventHandler.ts.$i" >> ../PluginEventHandler.ts.generated
+ rm -f ../PluginEventHandler.ts.$i
+done
+cmp --silent ../PluginEventHandler.ts ../PluginEventHandler.ts.generated && rm -f ../PluginEventHandler.ts.generated
+
+echo 'Rebuilding indexes...'
+node ../../../../scripts/gen_index.js .. --recursive
+echo 'Done!'
\ No newline at end of file
diff --git a/src/util/plugin/plugin_data_objects/_pdo b/src/util/plugin/event_types/_pdo
similarity index 65%
rename from src/util/plugin/plugin_data_objects/_pdo
rename to src/util/plugin/event_types/_pdo
index fa207f773..f6127174c 100644
--- a/src/util/plugin/plugin_data_objects/_pdo
+++ b/src/util/plugin/event_types/_pdo
@@ -4,4 +4,5 @@ Login
GuildCreate
ChannelCreate
Typing
-StatusChange
\ No newline at end of file
+StatusChange
+UserProfileUpdate
\ No newline at end of file
diff --git a/src/util/plugin/plugin_data_objects/_todo.txt b/src/util/plugin/event_types/_todo.txt
similarity index 100%
rename from src/util/plugin/plugin_data_objects/_todo.txt
rename to src/util/plugin/event_types/_todo.txt
diff --git a/src/util/plugin/event_types/base/EventResult.ts b/src/util/plugin/event_types/base/EventResult.ts
new file mode 100644
index 000000000..f18837cdc
--- /dev/null
+++ b/src/util/plugin/event_types/base/EventResult.ts
@@ -0,0 +1,4 @@
+export interface EventResult {
+ cancel?: boolean;
+ blockReason?: string;
+}
\ No newline at end of file
diff --git a/src/util/plugin/event_types/base/index.ts b/src/util/plugin/event_types/base/index.ts
new file mode 100644
index 000000000..fd0dbd037
--- /dev/null
+++ b/src/util/plugin/event_types/base/index.ts
@@ -0,0 +1 @@
+export * from "./EventResult";
diff --git a/src/util/plugin/plugin_data_objects/index.ts b/src/util/plugin/event_types/index.ts
similarity index 78%
rename from src/util/plugin/plugin_data_objects/index.ts
rename to src/util/plugin/event_types/index.ts
index c75d43f91..4a585dc02 100644
--- a/src/util/plugin/plugin_data_objects/index.ts
+++ b/src/util/plugin/event_types/index.ts
@@ -4,4 +4,6 @@ export * from "./LoginEventArgs";
export * from "./MessageEventArgs";
export * from "./PluginLoadedEventArgs";
export * from "./RegisterEventArgs";
+export * from "./StatusChangeEventArgs";
export * from "./TypingEventArgs";
+export * from "./base/index";
diff --git a/src/util/plugin/index.ts b/src/util/plugin/index.ts
index 5974a065c..7a2979814 100644
--- a/src/util/plugin/index.ts
+++ b/src/util/plugin/index.ts
@@ -1,4 +1,7 @@
export * from "./Plugin";
+export * from "./PluginConfig";
+export * from "./PluginEventHandler";
export * from "./PluginLoader";
export * from "./PluginManifest";
-export * from "./plugin_data_objects/index";
+export * from "./PluginStore";
+export * from "./event_types/index";
diff --git a/src/util/plugin/plugin_data_objects/ChannelCreateEventArgs.ts b/src/util/plugin/plugin_data_objects/ChannelCreateEventArgs.ts
deleted file mode 100644
index ce7dec872..000000000
--- a/src/util/plugin/plugin_data_objects/ChannelCreateEventArgs.ts
+++ /dev/null
@@ -1,7 +0,0 @@
-export interface PreChannelCreateEventArgs {
-
-}
-
-export interface OnChannelCreateEventArgs {
-
-}
diff --git a/src/util/plugin/plugin_data_objects/GuildCreateEventArgs.ts b/src/util/plugin/plugin_data_objects/GuildCreateEventArgs.ts
deleted file mode 100644
index e10e675af..000000000
--- a/src/util/plugin/plugin_data_objects/GuildCreateEventArgs.ts
+++ /dev/null
@@ -1,7 +0,0 @@
-export interface PreGuildCreateEventArgs {
-
-}
-
-export interface OnGuildCreateEventArgs {
-
-}
diff --git a/src/util/plugin/plugin_data_objects/LoginEventArgs.ts b/src/util/plugin/plugin_data_objects/LoginEventArgs.ts
deleted file mode 100644
index 391b852ea..000000000
--- a/src/util/plugin/plugin_data_objects/LoginEventArgs.ts
+++ /dev/null
@@ -1,7 +0,0 @@
-export interface PreLoginEventArgs {
-
-}
-
-export interface OnLoginEventArgs {
-
-}
diff --git a/src/util/plugin/plugin_data_objects/MessageEventArgs.ts b/src/util/plugin/plugin_data_objects/MessageEventArgs.ts
deleted file mode 100644
index 0a3498c2a..000000000
--- a/src/util/plugin/plugin_data_objects/MessageEventArgs.ts
+++ /dev/null
@@ -1,7 +0,0 @@
-export interface PreMessageEventArgs {
-
-}
-
-export interface OnMessageEventArgs {
-
-}
diff --git a/src/util/plugin/plugin_data_objects/RegisterEventArgs.ts b/src/util/plugin/plugin_data_objects/RegisterEventArgs.ts
deleted file mode 100644
index 7f7c0c760..000000000
--- a/src/util/plugin/plugin_data_objects/RegisterEventArgs.ts
+++ /dev/null
@@ -1,7 +0,0 @@
-export interface PreRegisterEventArgs {
-
-}
-
-export interface OnRegisterEventArgs {
-
-}
diff --git a/src/util/plugin/plugin_data_objects/TypingEventArgs.ts b/src/util/plugin/plugin_data_objects/TypingEventArgs.ts
deleted file mode 100644
index f6660692f..000000000
--- a/src/util/plugin/plugin_data_objects/TypingEventArgs.ts
+++ /dev/null
@@ -1,7 +0,0 @@
-export interface PreTypingEventArgs {
-
-}
-
-export interface OnTypingEventArgs {
-
-}
diff --git a/src/util/plugin/plugin_data_objects/_gen.sh b/src/util/plugin/plugin_data_objects/_gen.sh
deleted file mode 100755
index 9fbd1749d..000000000
--- a/src/util/plugin/plugin_data_objects/_gen.sh
+++ /dev/null
@@ -1,21 +0,0 @@
-#!/bin/sh
-while read event
-do
- if [ ! -f "${event}EventArgs.ts" ]
- then
- echo Making event $event...
- (
- echo "export interface Pre${event}EventArgs {"
- echo ' '
- echo '}'
- echo ''
- echo "export interface On${event}EventArgs {"
- echo ' '
- echo '}'
- ) > ${event}EventArgs.ts
- fi
-done < _pdo
-
-echo ''
-
-node ../../../../scripts/gen_index.js .. --recursive
\ No newline at end of file