summary refs log tree commit diff
path: root/util/src
diff options
context:
space:
mode:
authorFlam3rboy <34555296+Flam3rboy@users.noreply.github.com>2021-08-17 22:42:16 +0200
committerFlam3rboy <34555296+Flam3rboy@users.noreply.github.com>2021-08-17 22:42:16 +0200
commite611126c7c168b7c14e6d79fe02e1f996937bbfc (patch)
treeffe0135fdf4ca7ae9b9005bbb85a6689345a06c2 /util/src
parent:sparkles: mention regex (diff)
downloadserver-e611126c7c168b7c14e6d79fe02e1f996937bbfc.tar.xz
:art: clean up
Diffstat (limited to 'util/src')
-rw-r--r--util/src/util/Config.ts4
-rw-r--r--util/src/util/Event.ts5
2 files changed, 3 insertions, 6 deletions
diff --git a/util/src/util/Config.ts b/util/src/util/Config.ts
index ec1efc6c..a93e1846 100644
--- a/util/src/util/Config.ts
+++ b/util/src/util/Config.ts
@@ -211,11 +211,11 @@ export const DefaultOptions: DefaultOptions = {
 				},
 				webhook: {
 					count: 5,
-					window: 5,
+					window: 20,
 				},
 				channel: {
 					count: 5,
-					window: 5,
+					window: 20,
 				},
 				auth: {
 					login: {
diff --git a/util/src/util/Event.ts b/util/src/util/Event.ts
index 53e74c5f..0dbddc76 100644
--- a/util/src/util/Event.ts
+++ b/util/src/util/Event.ts
@@ -6,7 +6,7 @@ const events = new EventEmitter();
 
 export async function emitEvent(payload: Omit<Event, "created_at">) {
 	const id = (payload.channel_id || payload.user_id || payload.guild_id) as string;
-	if (!id) console.error("event doesn't contain any id", payload);
+	if (!id) return console.error("event doesn't contain any id", payload);
 
 	if (RabbitMQ.connection) {
 		const data = typeof payload.data === "object" ? JSON.stringify(payload.data) : payload.data; // use rabbitmq for event transmission
@@ -16,7 +16,6 @@ export async function emitEvent(payload: Omit<Event, "created_at">) {
 		const successful = RabbitMQ.channel?.publish(id, "", Buffer.from(`${data}`), { type: payload.event });
 		if (!successful) throw new Error("failed to send event");
 	} else {
-		console.log("emit event", id);
 		events.emit(id, payload);
 	}
 }
@@ -46,10 +45,8 @@ export async function listenEvent(event: string, callback: (event: EventOpts) =>
 		return rabbitListen(opts?.channel || RabbitMQ.channel, event, callback, { acknowledge: opts?.acknowledge });
 	} else {
 		const cancel = () => {
-			console.log("cancel event", event);
 			events.removeListener(event, callback);
 		};
-		console.log("listen event", event);
 		events.addListener(event, (opts) => callback({ ...opts, cancel }));
 
 		return cancel;