4.0.0 • Published 10 months ago

mapih v4.0.0

Weekly downloads
-
License
MIT
Repository
github
Last release
10 months ago

view on npm npm module downloads

Mapih

Comprehensive collection of Discord, OpenAI, Anthropic, Spotify, YouTube, Twitter, Slack, Imgur, DropBox, Box and various Google API endpoint handlers

Discord is the only completed set of handlers, the rest are still in early development


Authentication

Choose one of the following options to authenticate:

Option 1: Using Environment Variablese

If you are using OnSocket, use this file to get the valid keys but add them to OnSocket's environment variables on the website itself.

Rename the provided .env.example file at the root of your project to .env and fill in any tokens/keys you wish to use.

Option 2: Using Initialization Function

const mapih = require('mapih');

// Minimum requirement if using this method
mapih.initialize({ discord: 'bot_token' });

// All possible properties
mapih.initialize({
  discord: 'bot_token',
  openai: 'sk-1p7NKtCpA0sG7XLdT3L7EqW9GFefX',
  spotify: {
    client_id: 'cc4287d9Cm4692a9f681d07d9boqji83',
    client_secret: '898Nb8f7b09tMnb2lkj3c55443ddmn0ze',
    redirect_uri: 'http:localhost:8001/spotify',
    scope: 'user-read-email user-read-private'
  },
  google: {
    api_key: 'AISlkuhyA4q4L9m0c3I09maoOYTN0wuyWdA',
    client_id: '2164170085-9r94msc46elo.apps.googleusercontent.com',
    client_secret: 'GOSLPM-sPn88Kn6GWk90Nh0uk_MNim7698By4',
    redirect_uri: 'http://localhost:8001/youtube'
  },
  slack: {
    user: '6942854604069-6272480346098-6284925009575-6901309',
    bot: '6942854604069-6262140883098-Vt6RKehxmTj4Luvvy',
    client_id: '6942854604069.624286609478',
    client_secret: '4e4998dh94rl846bdsdfegfb0f12',
    redirect_uri: 'http:localhost:8001/slack',
    user_scope: 'admin users:read.email',
    bot_scope: 'users:read.email channels:read'
  },
  dropbox: {
    basic_token: 'N09asdfGlzZzB9P63465efasNWxAvfpk3dQ',
    access_token: 'sl.BsobToktTBbsdf235aiihH7j60T_4T',
    client_id: '7cxvzmptyug7ymc9',
    client_secret: 'easdf8980k6csdf5y7u',
    redirect_uri: 'http:localhost:8001/dropbox'
  },
  box: {
    client_id: '3sdfgi8j90fpl8q25809sd0',
    client_secret: 'Jsdf6BB4UErgS2chrg4365sdfBXS',
    redirect_uri: 'http:localhost:8001/box'
  },
});

Basic usage

(async() => {

  await mapih.discord.channels.messages.create({
    channel_id: '774133713733812275',
    content: 'hello'
  });

})();

Table of Contents

| Discord | Slack | Spotify | YouTube | Dropbox | Box | Utils |

Discord Methods

Applications    getMe    updateMe    appRoleConnectionMeta    updateAppRoleConnectionMeta    commands        retrieve        getAll        create        update        destroy        bulkOverwrite        retrievePermissions        getAllPermissions        updatePermissions    entitlements        getAll        create        destroy    skus        getAll Audit Log    retrieve Auto Moderation    retrieveRule    getAllRules    createRule    updateRule    destroyRule Channels    retrieve    update    destroy    updatePermissions    deletePermissions    getinvites    inviteCreate    typingCreate    followAnnouncementChannel    groupDMadd    groupDMremove    messages        retrieve        getAll        create        update        destroy        bulkDelete        crosspost        pin        unpin        getPinned    threads        forumThreadCreate        createFromMessage        createWithoutMessage        join        leave        addMember        removeMember        retrieveMember        getAllMembers        getAllPublicArchived        getAllPrivateArchived        getAllJoinedPrivateArchived    reactions        create        deleteOwn        deleteUser        deleteAll        deleteAllEmoji        getUsers Guilds    create    update    destroy    retrieve    destroy    getPreview    retrieve    getAll    create    destroy    getInvites    updateMFAlevel    getPruneCount    beginPrune    getVoiceRegions    getAllIntegrations    destroyIntegration    retrieveWidget    retrieveWidgetImage    retrieveWidgetSettings    updateWidget    retrieveVanityURL    retrieveWelcomeScreen    updateWelcomeScreen    retrieveOnboarding    updateOnboarding    newMemberWelcome    channels        getAll        create        updatePositions    members        retrieve        getAll        search        remove        update        updateCurrent        addRole        removeRole        getPermissionNames        timeout    roles        retrieve        getAll        create        update        destroy        updatePositions    emojis        retrieve        getAll        create        update        destroy    stickers        retrieve        nitroPacks        getAll        retrieveGuild        create        update        destroy    events        retrieve        getAll        getUsers        create        update        destroy    templates        retrieve        getAll        create        createGuild        sync        update        destroy Interactions    callback        reply        defer        get_original        update_original        delete_original        component_defer        component_update        autocomplete_reply        modal_reply        upgrade    followup        retrieve        create        update        destroy Invites    retrieve    revoke OAuth 2 Stage Instances    retrieve    create    update    destroy Users    retrieve    currentUser    myGuilds    currentMember    updateCurrent    connections    appRoleConnection    updateAppRoleConnection    createDM    createGroupDM    leaveGuild Webhooks    retrieve    retrieveWithToken    retrieveChannel    retrieveGuild    retrieveMessage    updateMessage    destroyMessage    create    update    updateWithToken    destroy    destroyWithToken    execute Objects/Types    Guilds    Users    Channels    Interactions    Roles    Emojis/Stickers    Message Components    Webhooks    Invites    Application    Audit Log    Auto Moderation

OpenAI Methods

Chat    create Images    create Speech    create Embeddings    create

Slack Methods

Docs coming soon

Spotify Methods

Users    me    topItems    getProfile Search    advanced    artists    songs    albums Songs    retrieve    retrieveMany    recommendations    save    unsave    saved    isSaved    analyze    audioFeatures    audioFeaturesMany Artists    retrieve    retrieveMany    recommendations    albums    related    follow    unfollow    following    isFollowing Albums    retrieve    retrieveMany    songs    new    save    unsave    saved    isSaved Playlists    featured    category    create    addSongs    update    updateSongs    removeSongs    retrieveSongs    created    following    isFollowing    follow    unfollow    user    cover    updateCover Playback    state    currentSong    devices    togglePlayback    pause    skip    previous    seek    setVolume    toggleShuffle    toggleRepeat    queue    recent    addToQueue    transfer

Utils Methods

Storage    get    getMany    set    setMany    delete    deleteMany    merge    push    export    filter    all    has    entries    keys    values    size    bytes    toJson    clear    equals    history    clearHistory


Discord

Guilds

All functions relating to Discord Guilds (servers)

MethodDescription
retrieveGet information about a guild
createCreate a new guild
updateModify a guild's settings
destroyDelete a guild
getPreviewGet the guild's preview
retrieveGet guild ban with given id
getAllGet a list of a guild's bans
createCreate a new guild ban
destroyDelete a guild ban
getInvitesGet a list of a guild's invites
updateMFAlevelModify the guild's MFA level
getPruneCountGet number of members that would be removed in a prune operation
beginPruneBegin a prune operation
getVoiceRegionsGet a list of a guild's voice regions
getAllIntegrationsGet a list of a guild's integrations
destroyIntegrationDelete a guild integration
retrieveWidgetGet the guild's widget
retrieveWidgetSettingsGet the guild's widget settings
retrieveWidgetImageGet the guild's widget image
updateWidgetModify the guild's widget
retrieveVanityURLGet the guild's vanity url
retrieveWelcomeScreenGet the guild's welcome screen
updateWelcomeScreenModify the guild's welcome screen
retrieveOnboardingGet the guild's onboarding
updateOnboardingModify the guild's onboarding
newMemberWelcome* undocumented

Get Guild

Parameters

FieldTypeDescription
guild_idsnowflakethe id of the guild
with_counts?booleanApprocimate member and presence counts

Example

await mapih.discord.guilds.retrieve({
  guild_id: '0000000000'
});

Create Guild

This endpoint can be used only by bots in less than 10 servers.

Parameters

FieldTypeDescription
namestringName of the guild (2-100 characters)
icon?string/bufferGuild icon (url to image or image buffer)
roles?array of Role objectsRoles to add to the guild
channels?array of PartialChannel objectsChannels to add to the guild
verification_level?numberThe guild's verification level
default_message_notifications?numberDefault message notification level
explicit_content_filter?numberExplicit content filter level
afk_channel_id?snowflakeID for afk channel
afk_timeout?numberafk timeout in seconds, can be set to: 60, 300, 900, 1800, 3600
system_channel_id?snowflakeThe id of the channel where guild notices such as welcome messages and boost events are posted
system_channel_flags?numberSystem channel flags

Example

await mapih.discord.guilds.create({
  name: "Eric's Server",
  icon: 'https://imgurl.png', // or buffer
  default_message_notifications: 1, // ONLY_MENTIONS
  verification_level: 0, // NONE
  explicit_content_filter: 0, // DISABLED
  roles: [{
    name: 'Administrator',
    permissions: 1 << 3,
    hoist: 'true',
    mentionable: 'false'
  }],
  channels: [
    {
      name: 'my-category',
      type: 4, // GUILD_CATEGORY
      id: 1
    },
    {
      name: 'bot-testing',
      type: 0, // GUILD_TEXT
      id: 2,
      parent_id: 1 // 'my-category'
    }
  ]
});

Modify Guild

Parameters

FieldTypeDescription
namestringName of the guild (2-100 characters)
descriptionstring
owner_idsnowflakeUser id to transfer server ownership to
iconurl/buffer
splashurl/buffer
discovery_splashurl/buffer
bannerurl/buffer
verification_levelnumberThe guild's verification level
default_message_notificationsnumberDefault message notification level
explicit_content_filternumberExplicit content filter level
afk_channel_idsnowflakeid for afk channel
afk_timeoutnumberafk timeout in seconds, can be set to: 60, 300, 900, 1800, 3600
system_channel_idsnowflakeThe id of the channel where guild notices such as welcome messages and boost events are posted
system_channel_flagsnumberSystem channel flags
rules_channel_idsnowflake
system_updates_channel_idsnowflake
premium_progress_bar_enablednumber

Example

await mapih.discord.guilds.update({
  name: "Eric's New Server",
  // ...
});

Delete Guild

Parameters

FieldTypeDescription
guild_idsnowflakethe id of the guild

Example

await mapih.discord.guilds.destroy({
  guild_id: '0000000000'
});

Get Guild Preview

• If the user is not in the guild, then the guild must be lurkable.

Parameters

FieldTypeDescription
guild_idsnowflakethe id of the guild

Example

await mapih.discord.guilds.getPreview({
  guild_id: '0000000000'
});

Get Guild Ban

• Returns a ban object for the given user or a 404 not found if the ban cannot be found. • Requires the BAN_MEMBERS permission.

Parameters

FieldTypeDescription
guild_idsnowflakethe id of the guild
user_idsnowflakeThe ID of the user the ban was created for

Example

await mapih.discord.guilds.retrieve({
  guild_id: '0000000000',
  user_id: '0000000000'
});

Get Guild Bans

Parameters

FieldTypeDescription
guild_idsnowflakethe id of the guild
limit?numberNumber of users to return (up to maximum 1000) (default 1000)
before?snowflakeConsider only users before given user ID
after?snowflakeConsider only users after given user ID

Example

await mapih.discord.guilds.getAll({
  guild_id: '0000000000',
  limit: 50,
  after: '0000000000'
});

Create Guild Ban

• Requires the BAN_MEMBERS permission.

Parameters

FieldTypeDescription
guild_idsnowflakethe id of the guild
user_idsnowflakeUser ID of the user to ban
delete_message_seconds?snowflakeNumber of seconds to delete the banned user's messages for, between 0 and 604800 (7 days).
reason?stringReason for the ban

Example

await mapih.discord.guilds.create({
  guild_id: '0000000000',
  user_id: '0000000000',
  delete_message_seconds: 604800,
  reason: 'not cool enough'
});

Remove Guild Ban

• Requires the BAN_MEMBERS permission.

Parameters

FieldTypeDescription
guild_idsnowflakethe id of the guild
user_idsnowflakeUser ID of the user to unban
reason?stringReason

Example

await mapih.discord.guilds.destroy({
  guild_id: '0000000000',
  user_id: '0000000000',
  reason: 'ok I guess you\'re alright'
});

Modify Guild MFA Level

• Requires guild ownership.

Parameters

FieldTypeDescription
guild_idsnowflakethe id of the guild
levelnumberMFA level

Example

await mapih.discord.guilds.updateMFAlevel({
  guild_id: '0000000000',
  level: 0
});

Get Guild Prune Count

• By default, prune will not remove users with roles. • You can optionally include specific roles in your prune by providing the include_roles parameter. • Any inactive user that has a subset of the provided role(s) will be counted in the prune and users with additional roles will not.

Parameters

FieldTypeDescription
guild_idsnowflakethe id of the guild
daysnumberNumber of days to count prune for (1-30) (Default 7)
include_roles?string[]An array of role IDs to include

Example

await mapih.discord.guilds.getPruneCount({
  guild_id: '0000000000',
  days: 3,
  include_roles: [
    '0000000000'
  ]
});

Begin Guild Prune

• For large guilds it's recommended to set the compute_prune_count option to false, forcing pruned to null. • By default, prune will not remove users with roles. • You can optionally include specific roles in your prune by providing the include_roles parameter. • Any inactive user that has a subset of the provided role(s) will be counted in the prune and users with additional roles will not.

Parameters

FieldTypeDescription
guild_idsnowflakethe id of the guild
daysnumberNumber of days to count prune for (1-30) (default 7)
compute_prune_countbooleanWhether pruned is returned, discouraged for large guilds (default true)
include_roles?snowflake[]An array of role IDs to include
reason?stringReason

Example

await mapih.discord.guilds.beginPrune({
  guild_id: '0000000000',
  days: 3,
  compute_prune_count: true,
  include_roles: [
    '0000000000'
  ]
});

Get Guild Voice Regions

Parameters

FieldTypeDescription
guild_idsnowflakethe id of the guild

Example

await mapih.discord.guilds.getVoiceRegions({
  guild_id: '0000000000'
});

Get Guild Integrations

This endpoint returns a maximum of 50 integrations. If a guild has more integrations, they cannot be accessed.

Parameters

FieldTypeDescription
guild_idsnowflakethe id of the guild

Example

await mapih.discord.guilds.getAllIntegrations({
  guild_id: '0000000000'
});

Delete Guild Integration

• Deletes any associated webhooks and kicks the associated bot if there is one.

Parameters

FieldTypeDescription
guild_idsnowflakethe id of the guild
integration_idsnowflakeThe ID of the integration to delete

Example

await mapih.discord.guilds.destroyIntegration({
  guild_id: '0000000000'
});

Get Guild Widget

Parameters

FieldTypeDescription
guild_idsnowflakethe id of the guild

Example

await mapih.discord.guilds.retrieveWidget({
  guild_id: '0000000000'
});

Get Guild Widget Settings

Parameters

FieldTypeDescription
guild_idsnowflakethe id of the guild

Example

await mapih.discord.guilds.retrieveWidgetSettings({
  guild_id: '0000000000'
});

Get Guild Widget Image

Widget Style Options
ValueDescriptionExample
shieldshield style widget with Discord icon and guild members online countExample
banner1large image with guild icon, name and online count. "POWERED BY DISCORD" as the footer of the widgetExample
banner2smaller widget style with guild icon, name and online count. Split on the right with Discord logoExample
banner3large image with guild icon, name and online count. In the footer, Discord logo on the left and "Chat Now" on the rightExample
banner4large Discord logo at the top of the widget. Guild icon, name and online count in the middle portion of the widget and a "JOIN MY SERVER" button at the bottomExample

Parameters

FieldTypeDescription
guild_idsnowflakethe id of the guild
stylestringWidget style (see above)

Example

await mapih.discord.guilds.retrieveWidgetImage({
  guild_id: '0000000000',
  style: 'banner3'
});

Modify Guild Widget

Parameters

FieldTypeDescription
guild_idsnowflakethe id of the guild
channel_id?snowflaketemp
enabled?booleanWhether the widget is enabled

Example

await mapih.discord.guilds.updateWidget({
  guild_id: '0000000000',
  enabled: true
});

Get Guild Vanity URL

Parameters

FieldTypeDescription
guild_idsnowflakethe id of the guild

Example

await mapih.discord.guilds.retrieveVanityURL({
  guild_id: '0000000000'
});

Get Guild Welcome Screen

Parameters

FieldTypeDescription
guild_idsnowflakethe id of the guild

Example

await mapih.discord.guilds.retrieveWelcomeScreen({
  guild_id: '0000000000'
});

Modify Guild Welcome Screen

Parameters

FieldTypeDescription
guild_idsnowflakethe id of the guild
description?stringThe server description to show in the welcome screen
enabled?booleanWhether the welcome screen is enabled.
welcome_channels?array of welcome screen channel objectsChannels shown in the welcome screen, up to 5

Example

await mapih.discord.guilds.updateWelcomeScreen({
  guild_id: '0000000000',
  enabled: true
});

Get Guild Onboarding

Parameters

FieldTypeDescription
guild_idsnowflakethe id of the guild

Example

await mapih.discord.guilds.retrieveOnboarding({
  guild_id: '0000000000',
  enabled: true
});

Modify Guild Onboarding

• Requires the MANAGE_GUILD and MANAGE_ROLES permissions. • Onboarding enforces constraints when enabled. These constraints are that there must be at least 7 Default Channels and at least 5 of them must allow sending messages to the @everyone role. The mode field modifies what is considered when enforcing these constraints.**

Parameters

FieldTypeDescription
guild_idsnowflakethe id of the guild
promptsarray of onboarding prompt objectsPrompts shown during onboarding and in customize commutity
default_channel_idsarray of snowflakesChannel IDs that members get opted into automatically
enabledbooleanWhether onboarding is enabled in the guild
modeonboarding modeCurrent mode of onboarding

Example

await mapih.discord.guilds.updateOnboarding({
  guild_id: '0000000000',
  prompts: [{
    id: '0000000000',
    type: 0,
    title: 'Prompt Title',
    single_select: true,
    required: true,
    in_onboarding: true,
    options: [{
      title: 'Option Title',
      description: 'Option description',
      id: '0000000000',
      channel_ids: [
        '0000000000'
      ],
      role_ids: [
        '0000000000'
      ],
      emoji: {
        id: '0000000000',
        name: 'emoji_name',
        animated: false
      }
    }]
  }]
});

Guild Channels

MethodDescription
getAllRetrieve all channels in a guild.
createCreate a new guild channel.
updatePositionsModify the positions of channels.

Get Guild Channels

Does not include threads

Parameters

FieldTypeDescription
guild_idsnowflakethe id of the guild

Example

await mapih.discord.guilds.channels.getAll({
  guild_id: '0000000000'
});

Create Guild Channel

All parameters to this endpoint are optional and nullable excluding name

Parameters

FieldTypeDescriptionChannel Type
namestringchannel name (1-100 characters)All
typenumberthe type of channelAll
topicstringchannel topic (0-1024 characters)Text, Announcement, Forum, Media
bitratenumberthe bitrate (in bits) of the voice or stage channel; min 8000Voice, Stage
user_limitnumberthe user limit of the voice channelVoice, Stage
rate_limit_per_usernumberamount of seconds a user has to wait before sending another message (0-21600); bots, as well as users with the permission manage_messages or manage_channel, are unaffectedText, Voice, Stage, Forum, Media
positionnumbersorting position of the channelAll
permission_overwritesarray of partial overwrite objectsthe channel's permission overwritesAll
parent_idsnowflakeid of the parent category for a channelText, Voice, Announcement, Stage, Forum, Media
nsfwbooleanwhether the channel is nsfwText, Voice, Announcement, Stage, Forum
rtc_regionstringchannel voice region id of the voice or stage channel, automatic when set to nullVoice, Stage
video_quality_modenumberthe camera video quality mode of the voice channelVoice, Stage
default_auto_archive_durationnumberthe default duration that the clients use (not the API) for newly created threads in the channel, in minutes, to automatically archive the thread after recent activityText, Announcement, Forum, Media
default_reaction_emojidefault reaction objectemoji to show in the add reaction button on a thread in a GUILD_FORUM or a GUILD_MEDIA channelForum, Media
available_tagsarray of tag objectsset of tags that can be used in a GUILD_FORUM or a GUILD_MEDIA channelForum, Media
default_sort_ordernumberthe default sort order type used to order posts in GUILD_FORUM and GUILD_MEDIA channelsForum, Media
default_forum_layoutnumberthe default forum layout view used to display posts in GUILD_FORUM channelsForum
default_thread_rate_limit_per_usernumberthe initial rate_limit_per_user to set on newly created threads in a channel. this field is copied to the thread at creation time and does not live update.Text, Announcement, Forum, Media

Example

await mapih.discord.guilds.channels.create({
  guild_id: '0000000000',
  name: 'my-new-channel',
  type: 0,
  topic: 'Cool people only',
  position: 19
});

Modify Guild Channel Positions

Only channels to be modified are required

Parameters

FieldTypeDescription
idsnowflakechannel id
position??numbersorting position of the channel
lock_permissions??booleansyncs the permission overwrites with the new parent, if moving to a new category
parent_id??snowflakethe new parent ID for the channel that is moved

Example

await mapih.discord.guilds.channels.updatePositions({
  guild_id: '0000000000',
  channels: [{
    id: '0000000000',
    position: 3,
    lock_permissions: true,
    parent_id: '0000000000'
  }]
});

Guild Members

MethodDescription
retrieveReturns information about a user
getAllList all members of a guild
searchSearch for guild members by name or nickname
removeRemove a member from a guild
updateModify attributes of a guild member
updateCurrentModify the current bot's nickname in the guild
addRoleAdd a role to a guild member
removeRoleRemove a role from a guild member
getPermissionNamesGet a user's permission's names
timeoutUpdate a member's communication timeout

Get Guild Member

Parameters

FieldTypeDescription
guild_idsnowflakethe id of the guild
user_idsnowflakeThe ID of the user

Example

await mapih.discord.guilds.members.retrieve({
  guild_id: '0000000000',
  user_id: '0000000000'
});

List Guild Members

Parameters

FieldTypeDescription
guild_idsnowflakethe id of the guild
limitnumberMax number of members to return (1-1000) (default 1)
aftersnowflakeThe highest user id in the previous page (default 0)

Example

await mapih.discord.guilds.members.getAll({
  guild_id: '0000000000',
  limit: 1000
});

Search Guild Members

Parameters

FieldTypeDescription
guild_idsnowflakethe id of the guild
querystringQuery string to match username(s) and nickname(s) against
limitnumberMax number of members to return (1-1000) (default 1)

Example

await mapih.discord.guilds.members.search({
  guild_id: '0000000000',
  query: 'lostmyinfo',
  limit: 1
});

Remove Guild Member

Parameters

FieldTypeDescription
guild_idsnowflakethe id of the guild
user_idsnowflakeThe ID of the user to remove
reason?stringReason for kick

Example

await mapih.discord.guilds.members.remove({
  guild_id: '0000000000',
  user_id: '0000000000',
  reason: 'not cool enough'
});

Modify Guild Member

• If the channel_id is set to null, this will force the target user to be disconnected from voice.

All parameters to this endpoint are optional and nullable.

Parameters

FieldTypeDescriptionPermission
guild_idsnowflakethe id of the guild
role_idsnowflakethe id of the role
nickstringvalue to set user's nickname toMANAGE_NICKNAMES
rolesarray of snowflakesarray of role ids the member is assignedMANAGE_ROLES
mutebooleanwhether the user is muted in voice channelsMUTE_MEMBERS
deafbooleanwhether the user is deafened in voice channelsDEAFEN_MEMBERS
channel_idsnowflakeid of channel to move user to (if they are connected to voice)MOVE_MEMBERS
communication_disabled_untilISO8601 timestampwhen the user's timeout will expire (up to 28 days in the future)MODERATE_MEMBERS
flagsnumberguild member flagsMODERATE_MEMBERS

Example

await mapih.discord.guilds.members.update({
  guild_id: '0000000000',
  nick: 'cool new nick'
});

Modify Current Member

Parameters

FieldTypeDescription
guild_idsnowflakethe id of the guild
nick?stringValue to set user's nickname to

Example

await mapih.discord.guilds.members.updateCurrent({
  guild_id: '0000000000',
  nick: 'cool new nick'
});

Add Guild Member Role

Parameters

FieldTypeDescription
guild_idsnowflakethe id of the guild
user_idsnowflakeThe user ID of the user to assign the role to
role_idsnowflakeThe role ID of the role to give the user

Example

await mapih.discord.guilds.members.addRole({
  guild_id: '0000000000',
  user_id: '0000000000',
  role_id: '0000000000'
});

Remove Guild Member Role

Parameters

FieldTypeDescription
guild_idsnowflakethe id of the guild
user_idsnowflakeThe user ID of the user to remove the role from
role_idsnowflakeThe role ID of the role to remove from the user

Example

await mapih.discord.guilds.members.removeRole({
  guild_id: '0000000000',
  user_id: '0000000000',
  role_id: '0000000000'
});

Get Member Permission Names

Parameters

TypeDescription
array of role IDsRoles of a member
array of role objectsRoles of a guild

Example

const x = params.member.roles;
const y = params.guild.roles;
const permNames = getPermissionNames(x, y);

Timeout Guild Member

• Sets/adjusts/clears a member's timeout

Parameters

FieldTypeDescription
guild_idsnowflakethe id of the guild
user_idsnowflakeThe user ID of the user to remove the role from
durationnumberDuration in seconds to set timeout. Set to null or omit to clear timeout.
reason?stringReason

Example

// timeout a member for 5 minutes
await mapih.discord.guilds.members.timeout({
  guild_id: '0000000000',
  user_id: '0000000000',
  duration: 300 // 5 minutes
});

// clear a member's timeout
await mapih.discord.guilds.members.timeout({
  guild_id: '0000000000'
4.0.0

10 months ago

3.17.0

12 months ago

3.17.2

12 months ago

3.17.1

12 months ago

3.18.0

12 months ago

3.19.3

10 months ago

3.19.0

10 months ago

3.19.2

10 months ago

3.19.1

10 months ago

3.16.1

1 year ago

3.16.0

1 year ago

3.15.0

1 year ago

3.14.0

1 year ago

3.13.2

1 year ago

3.13.1

1 year ago

3.13.0

1 year ago

3.12.1

1 year ago

3.12.0

1 year ago

3.11.0

1 year ago

3.10.6

1 year ago

3.10.3

1 year ago

3.10.2

1 year ago

3.10.5

1 year ago

3.10.4

1 year ago

3.10.1

1 year ago

3.10.0

1 year ago

3.9.3

1 year ago

3.9.2

1 year ago

3.9.1

1 year ago

3.9.4

1 year ago

3.9.0

1 year ago

3.8.0

1 year ago

3.6.0

1 year ago

3.7.0

1 year ago

3.5.4

1 year ago

3.5.3

1 year ago

3.5.2

1 year ago

3.5.1

1 year ago

3.5.0

1 year ago

3.4.0

1 year ago

3.3.0

1 year ago

3.2.1

2 years ago

3.2.0

2 years ago

3.1.1

2 years ago

3.1.0

2 years ago

3.0.1

2 years ago

3.0.0

2 years ago

2.2.0

2 years ago

2.4.0

2 years ago

2.6.0

2 years ago

2.5.5

2 years ago

2.3.0

2 years ago

2.1.1

2 years ago

2.5.0

2 years ago

2.7.0

2 years ago

2.5.2

2 years ago

2.5.1

2 years ago

2.5.4

2 years ago

2.5.3

2 years ago

2.0.2

2 years ago

2.0.1

2 years ago

2.0.0

2 years ago

2.1.0

2 years ago

1.1.7

2 years ago

1.1.6

3 years ago

1.1.5

3 years ago

1.1.4

3 years ago

1.1.3

3 years ago

1.1.2-a

3 years ago

1.1.6-e

3 years ago

1.1.6-d

3 years ago

1.1.6-c

3 years ago

1.1.6-b

3 years ago

1.1.6-a

3 years ago

1.1.3-s

3 years ago

1.1.3-r

3 years ago

1.1.0

3 years ago

1.0.8

3 years ago

1.0.7

3 years ago

1.0.6

3 years ago

1.0.5

3 years ago

1.1.2

3 years ago

1.0.8-a

3 years ago

1.0.4-f

3 years ago

1.1.0-f

3 years ago

1.1.0-e

3 years ago

1.1.1-b

3 years ago

1.1.1-a

3 years ago

1.0.4-e

3 years ago

1.0.4-d

3 years ago

1.0.4-c

3 years ago

1.0.4-b

3 years ago

1.0.4

3 years ago

1.0.3-a

3 years ago

1.0.3

3 years ago

1.0.2-a

3 years ago

1.0.2

3 years ago

1.0.1-b

3 years ago

1.0.1-a

3 years ago

1.0.0-g

3 years ago

1.0.0-f

3 years ago

1.0.0-e

3 years ago

1.0.0-d

3 years ago

1.0.0-c

3 years ago

1.0.0-b

3 years ago

1.0.0-a

3 years ago

1.0.0

3 years ago