How Can I Configure props.channel for Discord Sources in Local Code When CLI Can't Find My Server Channels?

This topic was automatically generated from Slack. You can find the original thread here.

How do I configure props.channel for discord sources when editing the code locally? The cli is not able to find channels in my server even after connecting my discord account. I keep getting the error

Configuring prop channels...
X Sorry, your reply was invalid: Unhandled array intrinsic prop type $.discord.channel

I am trying to run pd dev new-message.mjs within pipedream/components/discord/sources/new-message . Could I get some help on this?

Hi , thank you for contributing. Could you share your full code if possible?

I haven’t written any lines of code yet. Just trying to get the existing new-message source to run.

Here is the code inside new-message.mjs:

import discord from "../../discord.app.mjs";
import sampleEmit from "./test-event.mjs";

export default {
  type: "source",
  key: "discord-new-message",
  name: "New Message (Instant)",
  description: "Emit new event for each message posted to one or more channels in a Discord server",
  version: "1.0.2",

  dedupe: "unique",
  props: {
    discord,
    channels: {
      type: "$.discord.channel[]",
      appProp: "discord",
      label: "Channels",
      description: "Select the channel(s) you'd like to be notified for",
    },
    // eslint-disable-next-line pipedream/props-label,pipedream/props-description
    discordApphook: {
      type: "$.interface.apphook",
      appProp: "discord",
      async eventNames() {
        return this.channels || [];
      },
    },
  },
  async run(event) {
    if (event.guildID != this.discord.$auth.guild_id) {
      console.log("not authorized guild id!")
      return;
    }
    console.log(event);
    this.$emit(event, {
      id: event.id,
    });
  },
  sampleEmit,
};

Very new to the project so any help would be appreciated!

I think the source was developed a while ago and it might not compatible with the current version of Pipedream CLI. You might need to use pd publish to publish the source and test it under Sources > My Sources