如何从colllection中获得第二个成员

时间:2018-05-27 18:56:47

标签: javascript node.js discord discord.js

我有这个系列:

template<class T>
bool Pair<T>::operator==(const Pair<T> &pair)
{
  if(strcmp(getKey(),pair.getKey())==0 && pair.getValue()==pair.getValue())
  {
      return true;
  }
      return false;
}

我用它来获取它

  Collection {
  '200641654165165' => ClientUser {
  id: '200641654165165',
  username: 'test',
  discriminator: '4905',
  avatar: 'r32rfk324r5aspp;d',
  bot: true,
  lastMessageID: '450334234326660373',
  lastMessage:
   Message {
     channel: [TextChannel],
     id: '45035325246660373',
     type: 'DEFAULT',
     content: '',
     author: [Circular],
     member: [GuildMember],
     pinned: false,
     tts: false,
     nonce: null,
     system: false,
     embeds: [Array],
     attachments: Collection {},
     createdTimestamp: 152723434238,
     editedTimestamp: null,
     reactions: Collection {},
     mentions: [MessageMentions],
     webhookID: null,
     hit: null,
     _edits: [] },
  verified: true,
  email: null,
  localPresence: { status: 'online', game: [Object], afk: false, since: 0 },
  _typing: Map {},
  friends: Collection {},
  blocked: Collection {},
  notes: Collection {},
  premium: null,
  mfaEnabled: true,
  mobile: null,
  settings: ClientUserSettings { user: [Circular] },
  guildSettings: Collection {} },
  '204651434234236752' => User {
  id: '204651434234236752',
  username: 'me',
  discriminator: '4212',
  avatar: '9574776gfv3f3c01facc41a01d26',
  bot: false,
  lastMessageID: '45036434494844427',
  lastMessage:
   Message {
     channel: [TextChannel],
     id: '45036953244844427',
     type: 'DEFAULT',
     content: '.c',
     author: [Circular],
     member: [GuildMember],
     pinned: false,
     tts: false,
     nonce: '450369532530174208',
     system: false,
     embeds: [],
     attachments: Collection {},
     createdTimestamp: 1523246950554,
     editedTimestamp: null,
     reactions: Collection {},
     mentions: [MessageMentions],
     webhookID: null,
     hit: null,
     _edits: [] } } }

我无法弄清楚如何才能从这个系列中获得第二名成员。

1 个答案:

答案 0 :(得分:0)

找到解决方案。

替换“const user = reactions.get(join).users” 用“const user = reactions.get(join).users.first(2)[1]”