'My discord bot that can copy/paste messages from one channel to another, how do I make it copy the attachment as well?
This is the code I have written so far. It works but I can seem to understand how to grab the attachment of the post and include it in the copy/pasted message. Would something like let attachment = context.params.event.attachments; work?
// authenticates you with the API standard library
// type `await lib.` to display API autocomplete
const lib = require('lib')({token: process.env.STDLIB_SECRET_TOKEN});
let channel = context.params.event.channel_id;
let msg = context.params.event.content;
let member = context.params.event.author.id;
if (context.params.event.content.startsWith(`Alerts`)) {
await lib.discord.channels['@0.3.0'].messages.create({
channel_id: `948355963495272458`,
content: `<#${channel}> <@${member}> **| ${msg}**`
});
}
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
