refactor: move edit_bot_status to another file in helpers (#838)

This commit is contained in:
Skillz4Killz
2021-04-12 11:17:55 -04:00
committed by GitHub
parent ef9aa237bb
commit af3dbf1564
2 changed files with 23 additions and 25 deletions
+23
View File
@@ -0,0 +1,23 @@
import { eventHandlers } from "../../bot.ts";
import { DiscordGatewayOpcodes } from "../../types/codes/gateway_opcodes.ts";
import { StatusUpdate } from "../../types/gateway/status_update.ts";
import { ws } from "../../ws/ws.ts";
export function editBotStatus(data: Omit<StatusUpdate, "afk" | "since">) {
ws.shards.forEach((shard) => {
eventHandlers.debug?.(
"loop",
`Running forEach loop in editBotStatus function.`
);
shard.ws.send(
JSON.stringify({
op: DiscordGatewayOpcodes.StatusUpdate,
d: {
since: null,
afk: false,
...data,
},
})
);
});
}