-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathAPI_Functions.js
More file actions
31 lines (25 loc) · 1.46 KB
/
API_Functions.js
File metadata and controls
31 lines (25 loc) · 1.46 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
// Define BdApi Functions
const { Webpack: {getModule, getStore, Filters}, React, Patcher } = BdApi;
// Fetch SelectedGuildStore and GuildMemberCountStore to get Member Count
const SelectedGuildStore = Webpack.getStore('SelectedGuildStore')
const GuildMemberCountStore = Webpack.getStore('GuildMemberCountStore')
GuildMemberCountStore.getMemberCount(SelectedGuildStore.getGuildId());
// Fetch SelectedChannelStore and ChannelStore to get Thread Member Count
const SelectedChannelStore = Webpack.getStore('SelectedChannelStore')
const ChannelStore = Webpack.getStore('ChannelStore')
ChannelStore.getChannel(SelectedChannelStore.getChannelId())
// Alternate way of Fetching Thread Member Count
const ThreadMembersStore = Webpack.getStore("ThreadMembersStore")
ThreadMembersStore.getMemberCount(SelectedChannelStore.getChannelId())
// Fetches the Store for a Given Function
function getFunctionStore(functionString) {
dispatchToken = Webpack.getModule(Webpack.Filters.byKeys(functionString))._dispatchToken
console.log(Webpack.getModule(Webpack.Filters.byKeys(functionString))._dispatcher._actionHandlers._dependencyGraph.nodes[dispatchToken].name)
}
// Ex: getFunctionStore('getLastSelectedChannelId') >>> SelectedChannelStore
// Switch Themes
Webpack.getModule(x=>x.updateTheme).updateTheme("light")
Webpack.getModule(x=>x.updateTheme).updateTheme("dark")
// Show Toast
const { createToast, showToast } = BdApi.Webpack.getModule(x => x.createToast);
showToast(createToast("Message Here!", 1));