mirror of
https://github.com/Equicord/Equicord.git
synced 2025-06-16 18:07:02 -04:00
Add more Webpack Commons & utils
This commit is contained in:
parent
bb7332cefd
commit
2105de8ca5
4 changed files with 25 additions and 0 deletions
10
src/utils/discord.ts
Normal file
10
src/utils/discord.ts
Normal file
|
@ -0,0 +1,10 @@
|
|||
import { Guild } from "discord-types/general";
|
||||
import { ChannelStore, SelectedChannelStore, GuildStore } from "../webpack/common";
|
||||
|
||||
export function getCurrentChannel() {
|
||||
return ChannelStore.getChannel(SelectedChannelStore.getChannelId());
|
||||
}
|
||||
|
||||
export function getCurrentGuild(): Guild | undefined {
|
||||
return GuildStore.getGuild(getCurrentChannel()?.guild_id);
|
||||
}
|
|
@ -125,3 +125,7 @@ export function humanFriendlyJoin(elements: any[], mapper: (e: any) => string =
|
|||
export function classes(...classes: string[]) {
|
||||
return classes.join(" ");
|
||||
}
|
||||
|
||||
export function sleep(ms: number): Promise<void> {
|
||||
return new Promise(r => setTimeout(r, ms));
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue