npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

mapih

v4.0.0

Published

Complete collection of Discord API endpoint handlers.

Downloads

53

Readme

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)

| Method | Description | |--------------------------------------------------------|------------------------------------------------------------------| | retrieve | Get information about a guild | | create | Create a new guild | | update | Modify a guild's settings | | destroy | Delete a guild | | getPreview | Get the guild's preview | | retrieve | Get guild ban with given id | | getAll | Get a list of a guild's bans | | create | Create a new guild ban | | destroy | Delete a guild ban | | getInvites | Get a list of a guild's invites | | updateMFAlevel | Modify the guild's MFA level | | getPruneCount | Get number of members that would be removed in a prune operation | | beginPrune | Begin a prune operation | | getVoiceRegions | Get a list of a guild's voice regions | | getAllIntegrations | Get a list of a guild's integrations | | destroyIntegration | Delete a guild integration | | retrieveWidget | Get the guild's widget | | retrieveWidgetSettings | Get the guild's widget settings | | retrieveWidgetImage | Get the guild's widget image | | updateWidget | Modify the guild's widget | | retrieveVanityURL | Get the guild's vanity url | | retrieveWelcomeScreen | Get the guild's welcome screen | | updateWelcomeScreen | Modify the guild's welcome screen | | retrieveOnboarding | Get the guild's onboarding | | updateOnboarding | Modify the guild's onboarding | | newMemberWelcome | * undocumented |

Get Guild

Parameters

| Field | Type | Description | |--------------|-----------|----------------------------------------| | guild_id | snowflake | the id of the guild | | with_counts? | boolean | Approcimate 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

| Field | Type | Description | |--------------------------------|---------------------------------------------|------------------------------------------------------------------------------------------| | name | string | Name of the guild (2-100 characters) | | icon? | string/buffer | Guild icon (url to image or image buffer) | | roles? | array of Role objects | Roles to add to the guild | | channels? | array of PartialChannel objects | Channels to add to the guild | | verification_level? | number | The guild's verification level | | default_message_notifications? | number | Default message notification level | | explicit_content_filter? | number | Explicit content filter level | | afk_channel_id? | snowflake | ID for afk channel | | afk_timeout? | number | afk timeout in seconds, can be set to: 60, 300, 900, 1800, 3600 | | system_channel_id? | snowflake | The id of the channel where guild notices such as welcome messages and boost events are posted | | system_channel_flags? | number | System 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

| Field | Type | Description | |-------------------------------|------------|------------------------------------------------------------------------------------------------| | name | string | Name of the guild (2-100 characters) | | description | string | | | owner_id | snowflake | User id to transfer server ownership to | | icon | url/buffer | | | splash | url/buffer | | | discovery_splash | url/buffer | | | banner | url/buffer | | | verification_level | number | The guild's verification level | | default_message_notifications | number | Default message notification level | | explicit_content_filter | number | Explicit content filter level | | afk_channel_id | snowflake | id for afk channel | | afk_timeout | number | afk timeout in seconds, can be set to: 60, 300, 900, 1800, 3600 | | system_channel_id | snowflake | The id of the channel where guild notices such as welcome messages and boost events are posted | | system_channel_flags | number | System channel flags | | rules_channel_id | snowflake | | | system_updates_channel_id | snowflake | | | premium_progress_bar_enabled | number | |

Example

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

Delete Guild

Parameters

| Field | Type | Description | |----------|-----------|----------------------| | guild_id | snowflake | the 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

| Field | Type | Description | |----------|-----------|----------------------| | guild_id | snowflake | the 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

| Field | Type | Description | |----------|-----------|--------------------------------------------| | guild_id | snowflake | the id of the guild | | user_id | snowflake | The 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

| Field | Type | Description | |----------|-----------|---------------------------------------------------------------| | guild_id | snowflake | the id of the guild | | limit? | number | Number of users to return (up to maximum 1000) (default 1000) | | before? | snowflake | Consider only users before given user ID | | after? | snowflake | Consider 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

| Field | Type | Description | |-------------------------|-----------|--------------------------------------------------------------------------------------------| | guild_id | snowflake | the id of the guild | | user_id | snowflake | User ID of the user to ban | | delete_message_seconds? | snowflake | Number of seconds to delete the banned user's messages for, between 0 and 604800 (7 days). | | reason? | string | Reason 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

| Field | Type | Description | |----------|-----------|------------------------------| | guild_id | snowflake | the id of the guild | | user_id | snowflake | User ID of the user to unban | | reason? | string | Reason |

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

| Field | Type | Description | |----------|-----------|-------------------------| | guild_id | snowflake | the id of the guild | | level | number | MFA 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

| Field | Type | Description | |--------------- |-----------|------------------------------------------------------| | guild_id | snowflake | the id of the guild | | days | number | Number 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

| Field | Type | Description | |---------------------|-------------|---------------------------------------------------------------------------| | guild_id | snowflake | the id of the guild | | days | number | Number of days to count prune for (1-30) (default 7) | | compute_prune_count | boolean | Whether pruned is returned, discouraged for large guilds (default true) | | include_roles? | snowflake[] | An array of role IDs to include | | reason? | string | Reason |

Example

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

Get Guild Voice Regions

Parameters

| Field | Type | Description | |----------|-----------|---------------------| | guild_id | snowflake | the 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

| Field | Type | Description | |----------|-----------|---------------------| | guild_id | snowflake | the 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

| Field | Type | Description | |----------------|-----------|-------------------------------------| | guild_id | snowflake | the id of the guild | | integration_id | snowflake | The ID of the integration to delete |

Example

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

Get Guild Widget

Parameters

| Field | Type | Description | |----------|-----------|---------------------| | guild_id | snowflake | the id of the guild |

Example

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

Get Guild Widget Settings

Parameters

| Field | Type | Description | |----------|-----------|---------------------| | guild_id | snowflake | the id of the guild |

Example

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

Get Guild Widget Image

Widget Style Options

| Value | Description | Example | |---------|----------------------------------------------------------------------------------------------------------------------------------------------------------------|--------------------------------------------------------------------------------------| | shield | shield style widget with Discord icon and guild members online count | Example | | banner1 | large image with guild icon, name and online count. "POWERED BY DISCORD" as the footer of the widget | Example | | banner2 | smaller widget style with guild icon, name and online count. Split on the right with Discord logo | Example | | banner3 | large image with guild icon, name and online count. In the footer, Discord logo on the left and "Chat Now" on the right | Example | | banner4 | large 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 bottom | Example |

Parameters

| Field | Type | Description | |----------|-----------|--------------------------| | guild_id | snowflake | the id of the guild | | style | string | Widget style (see above) |

Example

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

Modify Guild Widget

Parameters

| Field | Type | Description | |-------------|-----------|-------------------------------| | guild_id | snowflake | the id of the guild | | channel_id? | snowflake | temp | | enabled? | boolean | Whether the widget is enabled |

Example

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

Get Guild Vanity URL

Parameters

| Field | Type | Description | |----------|-----------|---------------------| | guild_id | snowflake | the id of the guild |

Example

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

Get Guild Welcome Screen

Parameters

| Field | Type | Description | |----------|-----------|---------------------| | guild_id | snowflake | the id of the guild |

Example

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

Modify Guild Welcome Screen

Parameters

| Field | Type | Description | |-------------------|---------------------------------------------------------------------------|------------------------------------------------------| | guild_id | snowflake | the id of the guild | | description? | string | The server description to show in the welcome screen | | enabled? | boolean | Whether the welcome screen is enabled. | | welcome_channels? | array of welcome screen channel objects | Channels shown in the welcome screen, up to 5 |

Example

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

Get Guild Onboarding

Parameters

| Field | Type | Description | |----------|-----------|---------------------| | guild_id | snowflake | the 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

| Field | Type | Description | |---------------------|--------------------------------------------------------------------|------------------------------------------------------------| | guild_id | snowflake | the id of the guild | | prompts | array of onboarding prompt objects | Prompts shown during onboarding and in customize commutity | | default_channel_ids | array of snowflakes | Channel IDs that members get opted into automatically | | enabled | boolean | Whether onboarding is enabled in the guild | | mode | onboarding mode | Current 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

| Method | Description | |------------------------------------------------------|-----------------------------------| | getAll | Retrieve all channels in a guild. | | create | Create a new guild channel. | | updatePositions | Modify the positions of channels. |

Get Guild Channels

Does not include threads

Parameters

| Field | Type | Description | |----------|-----------|---------------------| | guild_id | snowflake | the 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

| Field | Type | Description | Channel Type | |------------------------------------|---------------------------------------------------------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|------------------------------------------------| | name | string | channel name (1-100 characters) | All | | type | number | the type of channel | All | | topic | string | channel topic (0-1024 characters) | Text, Announcement, Forum, Media | | bitrate | number | the bitrate (in bits) of the voice or stage channel; min 8000 | Voice, Stage | | user_limit | number | the user limit of the voice channel | Voice, Stage | | rate_limit_per_user | number | amount 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 unaffected | Text, Voice, Stage, Forum, Media | | position | number | sorting position of the channel | All | | permission_overwrites | array of partial overwrite objects | the channel's permission overwrites | All | | parent_id | snowflake | id of the parent category for a channel | Text, Voice, Announcement, Stage, Forum, Media | | nsfw | boolean | whether the channel is nsfw | Text, Voice, Announcement, Stage, Forum | | rtc_region | string | channel voice region id of the voice or stage channel, automatic when set to null | Voice, Stage | | video_quality_mode | number | the camera video quality mode of the voice channel | Voice, Stage | | default_auto_archive_duration | number | the 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 activity | Text, Announcement, Forum, Media | | default_reaction_emoji | default reaction object | emoji to show in the add reaction button on a thread in a GUILD_FORUM or a GUILD_MEDIA channel | Forum, Media | | available_tags | array of tag objects | set of tags that can be used in a GUILD_FORUM or a GUILD_MEDIA channel | Forum, Media | | default_sort_order | number | the default sort order type used to order posts in GUILD_FORUM and GUILD_MEDIA channels | Forum, Media | | default_forum_layout | number | the default forum layout view used to display posts in GUILD_FORUM channels | Forum | | default_thread_rate_limit_per_user | number | the 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

| Field | Type | Description | |-------------------|------------|----------------------------------------------------------------------------------| | id | snowflake | channel id | | position? | ?number | sorting position of the channel | | lock_permissions? | ?boolean | syncs the permission overwrites with the new parent, if moving to a new category | | parent_id? | ?snowflake | the 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

| Method | Description | |------------------------------------------------------|------------------------------------------------| | retrieve | Returns information about a user | | getAll | List all members of a guild | | search | Search for guild members by name or nickname | | remove | Remove a member from a guild | | update | Modify attributes of a guild member | | updateCurrent | Modify the current bot's nickname in the guild | | addRole | Add a role to a guild member | | removeRole | Remove a role from a guild member | | getPermissionNames | Get a user's permission's names | | timeout | Update a member's communication timeout |

Get Guild Member

Parameters

| Field | Type | Description | |----------|-----------|----------------------| | guild_id | snowflake | the id of the guild | | user_id | snowflake | The ID of the user |

Example

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

List Guild Members

Parameters

| Field | Type | Description | |----------|-----------|------------------------------------------------------| | guild_id | snowflake | the id of the guild | | limit | number | Max number of members to return (1-1000) (default 1) | | after | snowflake | The 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

| Field | Type | Description | |----------|-----------|-----------------------------------------------------------| | guild_id | snowflake | the id of the guild | | query | string | Query string to match username(s) and nickname(s) against | | limit | number | Max 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

| Field | Type | Description | |----------|-----------|------------------------------| | guild_id | snowflake | the id of the guild | | user_id | snowflake | The ID of the user to remove | | reason? | string | Reason 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

| Field | Type | Description | Permission | |------------------------------|---------------------|-------------------------------------------------------------------|------------------| | guild_id | snowflake | the id of the guild | | | role_id | snowflake | the id of the role | | | nick | string | value to set user's nickname to | MANAGE_NICKNAMES | | roles | array of snowflakes | array of role ids the member is assigned | MANAGE_ROLES | | mute | boolean | whether the user is muted in voice channels | MUTE_MEMBERS | | deaf | boolean | whether the user is deafened in voice channels | DEAFEN_MEMBERS | | channel_id | snowflake | id of channel to move user to (if they are connected to voice) | MOVE_MEMBERS | | communication_disabled_until | ISO8601 timestamp | when the user's timeout will expire (up to 28 days in the future) | MODERATE_MEMBERS | | flags | number | guild member flags | MODERATE_MEMBERS |

Example

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

Modify Current Member

Parameters

| Field | Type | Description | |----------|-----------|---------------------------------| | guild_id | snowflake | the id of the guild | | nick? | string | Value 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

| Field | Type | Description | |----------|-----------|-----------------------------------------------| | guild_id | snowflake | the id of the guild | | user_id | snowflake | The user ID of the user to assign the role to | | role_id | snowflake | The 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

| Field | Type | Description | |----------|-----------|-------------------------------------------------| | guild_id | snowflake | the id of the guild | | user_id | snowflake | The user ID of the user to remove the role from | | role_id | snowflake | The 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

| Type | Description | |-----------------------|-------------------| | array of role IDs | Roles of a member | | array of role objects | Roles 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

| Field | Type | Description | |----------|-----------|-----------------------------------------------------------------------------| | guild_id | snowflake | the id of the guild | | user_id | snowflake | The user ID of the user to remove the role from | | duration | number | Duration in seconds to set timeout. Set to null or omit to clear timeout. | | reason? | string | Reason |

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'