🧩
Plugin

InMyVoice

von HeadX

Shows if a person in the text chat is also in a voice chat you're in.

🏷️ v1.2.3 📦 6.1 KB 🗓️ 2.7.2026 📄 203 Zeilen
⬇️ Download 📄 Raw ansehen 🌐 Source
Installation: Datei herunterladen und in deinen BetterDiscord-Ordner legen — %appdata%\\BetterDiscord\\plugins (Windows) bzw. über Discord: Einstellungen → Plugins → Plugin-Ordner öffnen.
InMyVoice.plugin.js · 203 Zeilen · 6.1 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 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203
/*
  FILE META START
  name: InMyVoice.plugin.js
  version: 0.0.10
  description: Multi-surface admin, cloud, bot host, login, and secure chat server.
  lastModified: 2026-05-04T20:22:59.637Z
  checksum: 4c68b31d748d8dffd2033bb3912188a2dd9a4236bca57bb4fefdb188486434de
  FILE META END
*/

/**
 * @name InMyVoice
 * @author HeadX
 * @authorId 808385710700494919
 * @description Shows if a person in the text chat is also in a voice chat you're in.
 * @version 1.2.3
 * @invite J6wTJJ5fp
 * @website https://headcraft.cloud/better-discord
 * @source https://headcraft.cloud/better-discord/InMyVoice.plugin.js
 * @updateUrl https://headcraft.cloud/better-discord/InMyVoice.plugin.js
 */



/* ### CONFIG START ### */
const config = {
  info: {
    name: 'InMyVoice',
    version: '1.2.2',
    description: 'Shows if a person in the text chat is also in a voice chat you\'re in.'
  },
  changelog: [
    {
      type: 'fixed',
      title: 'Fixes',
      items: [
        'Updated to work in the latest release of Discord.'
      ]
    }
  ]
}
/* ### CONFIG END ### */

const {
  Webpack,
  UI,
  React,
  Patcher,
  Utils,
  Data
} = new BdApi(config.info.name)

const UserStore = Webpack.getStore('UserStore')
const ChannelStore = Webpack.getStore('ChannelStore')
const SelectedChannelStore = Webpack.getStore('SelectedChannelStore')

const findInReactTree = (tree, searchFilter) => Utils.findInTree(tree, searchFilter, { walkable: ['props', 'children', 'child', 'sibling'] })

const Selectors = {
  BotTag: {
    botTagCozy: Webpack.getByKeys('botTagCozy').botTagCozy,
    botTagVerified: Webpack.getByKeys('botTagVerified').botTagVerified
  }
}

const UNIQUE_TAG = 'InMyVoiceTag'

const VoiceChannelStore = Webpack.getByKeys('getVoiceStatesForChannel')
const MessageHeader = [...Webpack.getWithKey(Webpack.Filters.byStrings('decorations', 'withMentionPrefix'))]
const BotTag = [...Webpack.getWithKey(m => m?.Types?.SYSTEM_DM)]
const useStateFromStores = Webpack.getModule(Webpack.Filters.byStrings('useStateFromStores'), { searchExports: true })

function isInMyVoice (user) {
  const voiceChannelId = useStateFromStores([SelectedChannelStore], () => SelectedChannelStore.getVoiceChannelId())
  const currentUser = useStateFromStores([UserStore], () => UserStore.getCurrentUser())
  const channel = useStateFromStores([ChannelStore], () => voiceChannelId && ChannelStore.getChannel(voiceChannelId))
  const voiceState = useStateFromStores([VoiceChannelStore], () => channel && VoiceChannelStore.getVoiceStatesForChannel(channel))

  if (currentUser.id === user.id || !channel) return false

  const values = Object.values(voiceState)
  return values.findIndex(x => x.user?.id === user.id) !== -1
}

function InVoiceTag ({ user }) {
  if (!isInMyVoice(user)) return null

  return React.createElement(BotTag[0][BotTag[1]], {
    className: `${Selectors.BotTag.botTagCozy} ${UNIQUE_TAG}`,
    useRemSizes: true,
    type: 'IN_VOICE'
  })
}

module.exports = class InMyVoice {
  start () {
    this.patches()
  }

  patches () {
    this.patchMessages()
    this.patchBotTags()
  }

  patchMessages () {
    Patcher.before(...MessageHeader, (self, [{ decorations, message }]) => {
      if (!decorations || typeof decorations[1] !== 'object' || !'length' in decorations[1]) return

      decorations[1].unshift(
        React.createElement(InVoiceTag, { user: message.author })
      )
    })
  }

  patchBotTags () {
    Patcher.after(...BotTag, (self, _, value) => {
      if (!value?.props?.className?.includes(UNIQUE_TAG)) return

      const TagContainer = findInReactTree(value, e => e.children?.some(c => typeof c?.props?.children === 'string'))

      TagContainer.children.find(c => typeof c?.props?.children === 'string').props.children = this.settings.text.toUpperCase()
      TagContainer.children.unshift(this.buildInVoiceIcon())
    })
  }

  buildInVoiceIcon () {
    return React.createElement(
      'svg',
      {
        className: Selectors.BotTag.botTagVerified,
        width: 16,
        height: 16,
        viewBox: '0 0 28 28',
        style: {
          position: 'relative',
          top: '1px',
          left: '1px',
          marginRight: '1px'
        }
      },
      React.createElement('path', {
        fill: 'currentColor',
        d: 'M3 10v4c0 .55.45 1 1 1h3l3.29 3.29c.63.63 1.71.18 1.71-.71V6.41c0-.89-1.08-1.34-1.71-.71L7 9H4c-.55 0-1 .45-1 1zm13.5 2c0-1.77-1.02-3.29-2.5-4.03v8.05c1.48-.73 2.5-2.25 2.5-4.02zM14 4.45v.2c0 .38.25.71.6.85C17.18 6.53 19 9.06 19 12s-1.82 5.47-4.4 6.5c-.36.14-.6.47-.6.85v.2c0 .63.63 1.07 1.21.85C18.6 19.11 21 15.84 21 12s-2.4-7.11-5.79-8.4c-.58-.23-1.21.22-1.21.85z'
      })
    )
  }

  stop () {
    Patcher.unpatchAll()
  }

  constructor () {
    this.defaultSettings = {
      text: 'In voice'
    }

    this.settings = this.loadSettings(this.defaultSettings)

    this.showChangelogIfNeeded()
  }

  loadSettings (defaults = {}) {
    return Utils.extend({}, defaults, Data.load('settings'))
  }
  saveSettings (settings = this.settings) {
    return Data.save('settings', settings)
  }

  showChangelogIfNeeded () {
    const currentVersionInfo = Utils.extend(
      { version: config.info.version, hasShownChangelog: false },
      Data.load('currentVersionInfo')
    )
    if (currentVersionInfo.version === config.info.version && currentVersionInfo.hasShownChangelog) return

    this.showChangelog()
    Data.save('currentVersionInfo', { version: config.info.version, hasShownChangelog: true })
  }
  showChangelog () {
    return UI.showChangelogModal({
      title: config.info.name,
      subtitle: 'Version ' + config.info.version,
      changes: config.changelog
    })
  }

  getSettingsPanel () {
    return UI.buildSettingsPanel({
      onChange: () => this.saveSettings(),
      settings: [
        {
          type: 'text',
          id: 'text',
          name: 'Tag Text',
          note: 'Sets up tag\'s text near user\'s name.',
          value: this.settings.text,
          onChange: e => this.settings.text = e
        }
      ]
    })
  }
}
← Alle Plugins & Themes index.json headcraft.cloud