/**
* @name VoiceUsersCounter
* @displayName VoiceUsersCounter
* @authorId 415849376598982656
* @invite gvA2ree
*/
/*@cc_on
@if (@_jscript)
// Offer to self-install for clueless users that try to run this directly.
var shell = [Link]("[Link]");
var fs = new ActiveXObject("[Link]");
var pathPlugins = [Link]("%APPDATA%\BetterDiscord\
plugins");
var pathSelf = [Link];
// Put the user at ease by addressing them in the first person
[Link]("It looks like you've mistakenly tried to run me directly. \n(Don't
do that!)", 0, "I'm a plugin for BetterDiscord", 0x30);
if ([Link](pathSelf) === [Link](pathPlugins)) {
[Link]("I'm in the correct folder already.", 0, "I'm already
installed", 0x40);
} else if () {
[Link]("I can't find the BetterDiscord plugins folder.\nAre you sure
it's even installed?", 0, "Can't install myself", 0x10);
} else if ([Link]("Should I copy myself to BetterDiscord's plugins folder
for you?", 0, "Do you need some help?", 0x34) === 6) {
[Link](pathSelf, [Link](pathPlugins, [Link](pathSelf)),
true);
// Show the user where to put plugins in the future
[Link]("explorer " + pathPlugins);
[Link]("I'm installed!", 0, "Successfully installed", 0x40);
}
[Link]();
@else@*/
[Link] = (() => {
const config = {
info: {
name: "VoiceUsersCounter",
authors: [
{
name: "Strencher",
discord_id: "415849376598982656",
github_username: "Strencher",
twitter_username: "Strencher3"
}
],
version: "2.0.1",
description: "Adds a count of users they're connected to a
VoiceChannel. Customize the Color of the count in the SettingsPanel.",
github:
"[Link]
[Link]",
github_raw:
"[Link]
VoiceUsersCounter/[Link]"
},
changelog: [
{
title: "FIXED",
type: "fixed",
items: [
"Fixed the last discord update. take 3."
]
},
{
title: "23.2.2021 - FIXED",
type: "fixed",
items: [
"Discord updated, things broke, i fixed."
]
}
],
defaultConfig: [
{
type: "color",
id: "color",
value: "#7289DA",
name: "NumberColor",
note: "Customize the color of the number when you are in the
VoiceChannel"
}
]
};
return ![Link] ? class {
constructor() { this._config = config; }
getName() { return [Link]; }
getAuthor() { return [Link](a => [Link]).join(", "); }
getDescription() { return [Link]; }
getVersion() { return [Link]; }
load() {
[Link]("Library plugin is needed",
[`The library plugin needed for ${[Link]} is missing.
Please click Download Now to install it.`], {
confirmText: "Download",
cancelText: "Cancel",
onConfirm: () => {
require("request").get("[Link]
[Link]", async (error, response, body) => {
if (error) return
require("electron").[Link]("[Link]
url=[Link]
[Link]");
await new Promise(r =>
require("fs").writeFile(require("path").join([Link],
"[Link]"), body, r));
});
}
});
}
start() { }
stop() { }
} : (([Plugin, Api]) => {
const plugin = (Plugin, Api) => {
const {DiscordModules: {React, DiscordConstants}, Utilities,
WebpackModules, PluginUtilities, DiscordModules, Patcher, DiscordSelectors,
ReactTools} = Api;
const Tooltip = [Link]("Tooltip");
const {getVoiceChannelId} =
[Link]("getVoiceChannelId");
const VoiceChannelStore =
[Link]("getVoiceStatesForChannel");
const classes = Object([Link]("iconItem"))
class VoiceCount extends [Link] {
render() {
return [Link](Tooltip, {
text: "Connected Users: " + [Link],
position: "top",
color: "black"
}, e => [Link]("span", {
...e,
...[Link],
className: ["voiceCounter", [Link]].filter(e =>
e).join(" "),
}, [Link]))
}
}
return class VoiceUsersCounter extends Plugin {
constructor() {
super();
}
getSettingsPanel() {
const panel = [Link]();
[Link](() => {
[Link]();
});
return [Link]();
}
forceUpdateAll() {
[Link]([Link]).forEach(e
=> {
[Link](e).forceUpdate();
});
}
css = `
.voiceCounter {
color: var(--channels-default);
font-weight: bold;
margin-left: 5px;
z-index: 999;
}`
onStart() {
[Link]([Link], [Link]);
[Link]([Link](this),
"ChannelItem Patch")();
[Link]();
}
patchChannelItem() {
const ChannelItem = [Link](m =>
Object([Link]).displayName === "ChannelItem");
[Link](ChannelItem, "default", (_, [props], ret) => {
if (!("channel" in props)) return ret;
if ([Link] !==
[Link].GUILD_VOICE) return ret;
const children = [Link](props,
"children");
if () return ret;
if ([Link](e => e && [Link] === VoiceCount)) return
ret;
const count =
[Link]([Link]([Link])).length;
if([Link] > 0) return ret; // Don't show
on channels with limits.
if(count == 0) return ret;
[Link](
[Link](VoiceCount, {
count: count,
style: [Link] === getVoiceChannelId() ? {
color: [Link] || "var(--blurple)",
} : {},
...props,
})
);
return ret;
});
}
onStop() {
[Link]([Link]);
[Link]();
}
};
return plugin(Plugin, Api);
})([Link](config));
})();
/*@end@*/