You can make conversation between two channels! You type a message in a channel and it will appear in another channel! Also, whenever someone types a message in that channel, it will be sent to yours! To get started, go to file and change "channel1" to the id of the first channel and "channel2" to the id of the second! You can also alter the message detail. Change the value of line 14 to make it custom to your server! (look at lines 18-20 to see what you can utilize)
const lib = require('lib')({token: process.env.STDLIB_SECRET_TOKEN});
let channel1 = `000000000000000000`; //id of first channel that you want to link
let channel2 = `000000000000000000`; //id of second channel that you want to link
let text = context.params.event.content; //get message that you type
let sentchannel = context.params.event.channel_id; //channel that you sent the message
let user = `${context.params.event.author.username}#${context.params.event.author.discriminator}`; //username who sent message
let server = await lib.discord.guilds['@0.1.0'].retrieve({
guild_id: context.params.event.guild_id,
});
let guild = server.name;
let picture = '';
let message = `Message come from server:***\`${guild}\`*** by:***\`${user}\`***:\n${text}`;
/*
you can change this message, for example, you can use only `${text}`
${guild} = guild name
${user} = user name and discriminator
${text} = message to sent
*/
let attach = context.params.event.attachments;
if (attach.length > 0) {
for (let i = 0; i < attach.length; i++) {
picture = picture + `\n${attach[i].url}`;
}
message = message + picture;
}
//check attachments
if (sentchannel == channel1) {
await lib.discord.channels['@0.2.0'].messages.create({
channel_id: channel2,
content: message,
});
} else if (sentchannel == channel2) {
await lib.discord.channels['@0.2.0'].messages.create({
channel_id: channel1,
content: message,
});
}
//now, sent!