A command that setups your log channel
const lib = require('lib')({token: process.env.STDLIB_SECRET_TOKEN});
const content = context.params.event.content;
let message = context.params.event.content;
// You can change the name of the command and the prefix use **` `** in order to use env and use *' '* in order to be normal
if (message.startsWith('!modlogs')) {
let text = context.params.event.content.split(' ');
const channel_ids = content.match(/\d{18}/);
if (channel_ids && channel_ids[0]) {
const channel_id = channel_ids[0];
// Restores the channel
const logc = await lib.utils.kv['@0.1.16'].set({
key: `LOGCHANNEL_${context.params.event.guild_id}`,
value: channel_id,
});
// Succesfull message
await lib.discord.channels['@0.2.1'].messages.create({
channel_id: context.params.event.channel_id,
content: `Your modlog channel is now <#${channel_id}>.`,
});
} else {
// Sends this message if did not mentioned a channel
await lib.discord.channels['@0.2.1'].messages.create({
channel_id: context.params.event.channel_id,
content: `Please mention a channel in order to set the modlogs channel.`,
});
}
}
// Paste this to another file of your code
const logchannel = await lib.utils.kv['@0.1.16'].get({
key: `LOGCHANNEL_${context.params.event.guild_id}`,
}).then((res) => res);
// If you pasted the above code use **logchannel.channel_id** in the *channel_id*. Thx for installing this snippet!