← Discord Bot

New Guild Member from Discord Bot API

Pipedream makes it easy to connect APIs for Discord Bot and 1000+ other apps remarkably fast.

Trigger workflow on
New Guild Member from the Discord Bot API
Next, do this
Connect to 1000+ APIs using code and no-code building blocks
No credit card required
Into to Pipedream
Watch us build a workflow
Watch us build a workflow
7 min
Watch now ➜
Trusted by 250,000+ developers from startups to Fortune 500 companies:
Trusted by 250,000+ developers from startups to Fortune 500 companies

Developers Pipedream

Getting Started

Trigger a workflow on New Guild Member with Discord Bot API. When you configure and deploy the workflow, it will run on Pipedream's servers 24x7 for free.

  1. Configure the New Guild Member trigger
    1. Connect your Discord Bot account
    2. Select a Guild
    3. Configure timer
  2. Add steps to connect to 1000+ APIs using code and no-code building blocks
  3. Deploy the workflow
  4. Send a test event to validate your setup
  5. Turn on the trigger

Integrations

Send Message with Discord Webhook API on New Guild Member from Discord Bot API
Discord Bot + Discord Webhook
 
Try it
Add Multiple Rows with Google Sheets API on New Guild Member from Discord Bot API
Discord Bot + Google Sheets
 
Try it
Get Film with SWAPI - Star Wars API on New Guild Member from Discord Bot API
Discord Bot + SWAPI - Star Wars
 
Try it
Create Multiple Records with Airtable API on New Guild Member from Discord Bot API
Discord Bot + Airtable
 
Try it
Send any HTTP Request with HTTP / Webhook API on New Guild Member from Discord Bot API
Discord Bot + HTTP / Webhook
 
Try it

Details

This is a pre-built, open source component from Pipedream's GitHub repo. The component is developed by Pipedream and the community, and verified and maintained by Pipedream.

To contribute an update to an existing component or create a new component, create a PR on GitHub. If you're new to Pipedream component development, you can start with quickstarts for trigger span and action development, and then review the component API reference.

New Guild Member on Discord Bot
Description:Emit new event for every member added to a guild
Version:0.0.5
Key:discord_bot-new-guild-member

Code

import common from "../common.mjs";
import { DEFAULT_POLLING_SOURCE_TIMER_INTERVAL } from "@pipedream/platform";

export default {
  ...common,
  key: "discord_bot-new-guild-member",
  name: "New Guild Member",
  description: "Emit new event for every member added to a guild",
  type: "source",
  version: "0.0.5",
  props: {
    ...common.props,
    db: "$.service.db",
    timer: {
      type: "$.interface.timer",
      default: {
        intervalSeconds: DEFAULT_POLLING_SOURCE_TIMER_INTERVAL,
      },
    },
  },
  methods: {
    ...common.methods,
  },
  async run({ $ }) {
    const guildMembers = this._getGuildMemberIDs();
    const { guildId } = this;
    const params = {
      limit: 100,
    };
    let anyNewMember = false;

    while (true) {
      const members = await this.discord.getGuildMembers({
        $,
        guildId,
        params,
      });

      if (members.length === 1) {
        if (anyNewMember) {
          this._setGuildMemberIDs(guildMembers);
        }
        return;
      }

      for (const member of members) {
        const {
          user,
          joined_at: joinedAt,
        } = member;

        if (user.bot) continue;

        if (!(user.id in guildMembers)) {
          anyNewMember = true;
          guildMembers[user.id] = true;
          this.$emit(member, {
            summary: `New member: ${user.username}`,
            id: user.id,
            ts: Date.parse(joinedAt),
          });
        }

        params.after = user.id;
      }
    }
  },
};

Configuration

This component may be configured based on the props defined in the component code. Pipedream automatically prompts for input values in the UI and CLI.
LabelPropTypeDescription
Discord BotdiscordappThis component uses the Discord Bot app.
GuildguildIdstringSelect a value from the drop down menu.
N/Adb$.service.dbThis component uses $.service.db to maintain state between component invocations.
timer$.interface.timer

Authentication

Discord Bot uses API keys for authentication. When you connect your Discord Bot account, Pipedream securely stores the keys so you can easily authenticate to Discord Bot APIs in both code and no-code steps.

This app allows you to use the Discord API using your own Discord bot. If you don't want to use a custom bot, and you just need to use the Discord API, exit this screen and use the Discord app, instead.


If you want to use your own Discord bot, but haven't created one yet, see these instructions or watch this video. You'll need to add this bot to your server(s) to make successful API requests.

Once you've created your bot, you'll find the Bot token within the Bot section of your app. Enter that token below.

About Discord Bot

Use this app to interact with the Discord API using a bot in your account

More Ways to Use Discord Bot

Triggers

New Message in Channel from the Discord Bot API

Emit new event for each message posted to one or more channels

 
Try it

Actions

Add Role with the Discord Bot API

Assign a role to a user. Remember that your bot requires the MANAGE_ROLES permission. See the docs here

 
Try it
Create Channel Invite with the Discord Bot API

Create a new invite for the channel. See the docs here

 
Try it
Create DM with the Discord Bot API

Create a new DM channel with a user. See the docs here and here

 
Try it
Create Guild Channel with the Discord Bot API

Create a new channel for the guild. See the docs here

 
Try it
Delete Channel with the Discord Bot API

Delete a Channel.

 
Try it