This snippet allows your bot sending daily new question in your channel. It creates a thread for all your members to respond in.
const lib = require('lib')({token: process.env.STDLIB_SECRET_TOKEN});
const randomQuestion = require('random-question');
// * ----------------------- * //
let question = randomQuestion.randomQuestion();
let qotd = await lib.discord.channels['@0.2.2'].messages.create({
channel_id: process.env.channel_id,
content: ``, // IDEA: add a ping reminder!
embeds: [
{
title: ``,
description: `📢 **__Question Of The Day__**
${question}`,
color: 0xcdebff,
footer: {
text: `New QOTD!`,
},
},
],
});
let reaction1 = await lib.discord.channels['@0.3.2'].messages.reactions.create({
emoji: `<:star:942181056201768990>`, //change the emoji name and ID to your liking!
message_id: `${qotd.id}`,
channel_id: `${process.env.channel_id}`,
});
let threads = await lib.discord.channels['@0.2.0'].threads.create({
channel_id: `${process.env.channel_id}`, // required
name: `AOTD`, // required
auto_archive_duration: 1440,
message_id: qotd.id,
type: 'GUILD_PUBLIC_THREAD',
});
await lib.discord.channels['@0.2.0'].threads.update({
thread_id: `${threads.id}`,
rate_limit_per_user: 300,
});