Merge pull request #4 from j4k0xb/main
feat: spoof available emojis setting
This commit is contained in:
commit
26aed823b6
@ -1,5 +1,5 @@
|
||||
const { React } = require('powercord/webpack');
|
||||
const { SliderInput } = require('powercord/components/settings');
|
||||
const { SliderInput, SwitchItem } = require('powercord/components/settings');
|
||||
|
||||
module.exports = class NitroBypassSettings extends React.Component {
|
||||
constructor(props) {
|
||||
@ -20,6 +20,13 @@ module.exports = class NitroBypassSettings extends React.Component {
|
||||
>
|
||||
Emoji size
|
||||
</SliderInput>
|
||||
<SwitchItem
|
||||
note="Also replaces non-animated emojis of the current guild with links."
|
||||
value={this.props.getSetting('spoofAvailableEmojis', false)}
|
||||
onChange={() => this.props.toggleSetting('spoofAvailableEmojis')}
|
||||
>
|
||||
Spoof available emojis
|
||||
</SwitchItem>
|
||||
</>
|
||||
);
|
||||
}
|
||||
|
9
index.js
9
index.js
@ -14,6 +14,7 @@ module.exports = class NitroBypass extends Plugin {
|
||||
|
||||
const message = await getModule(['sendMessage', 'editMessage']);
|
||||
const currentUser = await getModule(['getCurrentUser']);
|
||||
this.getGuildId = (await getModule(['getLastSelectedGuildId'])).getGuildId;
|
||||
|
||||
// spoof client side premium
|
||||
let tries = 1;
|
||||
@ -33,11 +34,19 @@ module.exports = class NitroBypass extends Plugin {
|
||||
emojiReplacePatch(args) {
|
||||
const message = args[1];
|
||||
const emojis = message.validNonShortcutEmojis;
|
||||
const guildId = this.getGuildId();
|
||||
|
||||
emojis.forEach((emoji) => {
|
||||
// skip discord emojis
|
||||
if (!emoji.require_colons) return;
|
||||
|
||||
// skip available emojis
|
||||
if (
|
||||
!this.settings.get('spoofAvailableEmojis', false) &&
|
||||
emoji.guildId === guildId && !emoji.animated
|
||||
)
|
||||
return;
|
||||
|
||||
// create the emoji string which we will replace
|
||||
const emojiString = `<${emoji.animated ? 'a' : ''}:${emoji.originalName || emoji.name}:${
|
||||
emoji.id
|
||||
|
Loading…
Reference in New Issue
Block a user