Sends a changelog in an announcements channel, set by you, with project name, and colored additions, removals and fixes. Preview: https://media.discordapp.net/attachments/933768528346107914/934816760274767965/unknown.png (Updated to use date instead of relative time)
// 1: Create a command in https://autocode.com/tools/discord/command-builder/ called changelog
// 2: Give it the options: project, additions, removals and fixes, in order
// ALL OPTIONS M̲U̲S̲T̲ BE REQUIRED - Just use a whitespace character if you don't want to fill any of thes options out (https://qwerty.dev/whitespace/)
// 3: Click save command
// If you set it as a "global" command you have to wait around an hour to appear
// If you set it as a command in a specific guild, the command will appear instantly but o͟n͟l͟y in that guild
const lib = require('lib')({token: process.env.STDLIB_SECRET_TOKEN});
// start of changelog command
if (!context.params.event.member.permission_names.includes('ADMIN')) { // checks if user has admin
await lib.discord.channels['@0.2.0'].messages.create({
channel_id: `${process.env.CHANGELOGCHANNELID}`, // gets data from the enviroment variable
content: ``,
tts: false,
embeds: [
{
type: 'rich',
title: `${context.params.event.data.options[0].value} | `,
// Gets the name of the project and gets the timestamp
description: '',
color: 0x00ffff,
fields: [
{
name: `Additions:`,
value:
'```diff\n' +
`+ ${context.params.event.data.options[1].value}\n` +
'```', // uses + to combine the strings - context.params.event.data.options[1].value gets the data from option 2
},
{
name: `Removals:`,
value:
'```diff\n' +
`- ${context.params.event.data.options[2].value}\n` +
'```',
},
{
name: `Fixes:`,
value:
'```fix\n' +
`/ ${context.params.event.data.options[3].value}\n` +
'```',
},
],
footer: {
text: `Posted By ${context.params.event.member.user.username}`, // gets the username of who posted the changelog
icon_url: `https://cdn.discordapp.com/avatars/${context.params.event.member.user.id}/${context.params.event.member.user.avatar}.webp`, // gets the avatar of the user
},
},
],
});
}
// end
// tells the user if they don't have admin
else {
await lib.discord.channels['@0.2.0'].messages.create({
channel_id: `${context.params.event.channel_id}`,
content: '',
tts: false,
embeds: [
{
type: 'rich',
title: `⚡ There was an error! OR, you don't have ADMINISTRATOR!`,
description: '',
color: 0x00ffff,
},
],
});
}