discordjs / discord.js

A powerful JavaScript library for interacting with the Discord API
https://discord.js.org
Apache License 2.0
25.44k stars 3.97k forks source link

Guild Object does not return the voice Attribute described in the documentation #4106

Closed SemmelJochen closed 4 years ago

SemmelJochen commented 4 years ago

Hey. I am trying to get to a voiceConnection from a Message object. I read the Documentation from version 12.2.0. It says that the Guild object has a voice (VoiceState) attribute where I can get to the connection (VoiceConnection). But the object i keep getting is the following:

Guild {
  members: GuildMemberManager {
    cacheType: [Function: Collection],
    cache: Collection [Map] {
      '699697231829270681' => [GuildMember],    
      '691695646293360773' => [GuildMember],    
      '570747582960107540' => [GuildMember],    
      '306095670488465410' => [GuildMember],    
      '235088799074484224' => [GuildMember],    
      '699265271822549062' => [GuildMember],    
      '701404477005234198' => [GuildMember]     
    },
    guild: [Circular]
  },
  channels: GuildChannelManager {
    cacheType: [Function: Collection],
    cache: Collection [Map] {
      '699265328454303774' => [CategoryChannel],
      '699265328454303775' => [CategoryChannel],
      '699265440517586964' => [TextChannel],    
      '699265473979744390' => [TextChannel],    
      '699265836350701588' => [VoiceChannel],   
      '699267396262821909' => [TextChannel],    
      '699302378255679639' => [TextChannel],    
      '699655368393097256' => [VoiceChannel],   
      '699655481236521050' => [TextChannel]     
    },
    guild: [Circular]
  },
  roles: RoleManager {
    cacheType: [Function: Collection],
    cache: Collection [Map] {
      '699265328005513277' => [Role],
      '699617090138800209' => [Role],
      '699617486407991316' => [Role],
      '699617681229479957' => [Role],
      '699699325072179321' => [Role],
      '701491718041632830' => [Role]
    },
    guild: [Circular]
  },
  presences: PresenceManager {
    cacheType: [Function: Collection],
    cache: Collection [Map] {
      '235088799074484224' => [Presence],
      '306095670488465410' => [Presence],
      '570747582960107540' => [Presence],
      '699697231829270681' => [Presence],
      '701404477005234198' => [Presence]
    }
  },
  voiceStates: VoiceStateManager {
    cacheType: [Function: Collection],
    cache: Collection [Map] {
      '235088799074484224' => [VoiceState],
      '306095670488465410' => [VoiceState],
      '570747582960107540' => [VoiceState],
      '691695646293360773' => [VoiceState],
      '699697231829270681' => [VoiceState]
    },
    guild: [Circular]
  },
  deleted: false,
  available: true,
  id: '699265328005513277',
  shardID: 0,
  name: 'DAZN',
  icon: 'f7846b326da13a9ced6de3191fdae542',
  splash: null,
  region: 'europe',
  memberCount: 7,
  large: false,
  features: [],
  applicationID: null,
  afkTimeout: 300,
  afkChannelID: null,
  systemChannelID: null,
  embedEnabled: undefined,
  premiumTier: 0,
  premiumSubscriptionCount: 0,
  verificationLevel: 'NONE',
  explicitContentFilter: 'DISABLED',
  mfaLevel: 0,
  joinedTimestamp: 1587326073495,
  defaultMessageNotifications: 'ALL',
  systemChannelFlags: SystemChannelFlags { bitfield: 0 },
  vanityURLCode: null,
  description: null,
  banner: null,
  rulesChannelID: null,
  publicUpdatesChannelID: null,
  ownerID: '306095670488465410',
  emojis: GuildEmojiManager {
    cacheType: [Function: Collection],
    cache: Collection [Map] {},
    guild: [Circular]
  }
}

As you can see... There is no voice attribute. Please help me...

Further details:

monbrey commented 4 years ago

Guild#voice is a getter, not an enumerable property, which is why it does not appear when you log a Guild object.

The issue tracker is only for bug reports and enhancement suggestions. If you have a question, please ask it in the Discord server instead of opening an issue – you will get redirected there anyway.