members.go 740 B

123456789101112131415161718192021222324
  1. package discord
  2. import (
  3. "github.com/bwmarrin/discordgo"
  4. )
  5. // GetMember gets a discord member.
  6. // session : An active discordgo session
  7. // guid : The ID of the Guild
  8. // uid : The ID of a User.
  9. func GetMember(session *discordgo.Session, guid, uid string) (*discordgo.Member, error) {
  10. return session.GuildMember(guid, uid)
  11. }
  12. // UpdateMember edits the roles of a member.
  13. // session : An active discordgo session
  14. // guid : The ID of the Guild
  15. // template : GuildMemberParams for Role and Nick
  16. // roles : A list of role ID's to set on the member.
  17. func UpdateMember(session *discordgo.Session, guid, uid string, template *discordgo.GuildMemberParams) error {
  18. _, err := session.GuildMemberEdit(guid, uid, template)
  19. return err
  20. }