Creates an announcement to other servers your bot is in even when you are not in it! To set up this snippet, please create a slash command named "/announcementcreate" in the Command Builder: https://autocode.com/tools/discord/command-builder/
const lib = require('lib')({token: process.env.STDLIB_SECRET_TOKEN}); //gets the standard library so that you can use the apis in standard library
const botOwnerId = `${process.env.botOwnerID}`; //this your botOwnerID goes when you first installed this snippet and got requested for the id!
if (context.params.event.member.user.id === botOwnerId) {
await lib.discord.channels['@0.1.2'].messages.create({
//creates a message with embed format
channel_name: `#announcements`, //push your announcement to other server's channel named announcements
content: `Haiii @everyone! Thanks for using my snippet! I am so happy to announce that we are now rolling out new features!\n\nIf you wanna report a bug or have any questions to ask regarding this snippet, feel free to contact me on Discord: notedwin.music#5148!\n\nWe appreciate your continuous support and will be looking forward adding more usable and fun snippets!`,
tts: false, //tts means text-to-speech, set this to false
embeds: [
//creates an embed message
{
type: 'rich',
title: `🤖New Features Announcement!`, //the title of this annpuncement
description: '', //you can always add a description if you want to
color: 0x00ffff, //embed aqua color code, feel free to change it to any color code you want!
fields: [
//fields holds all your information about this announcement and put it into this embed
{
name: `💬Feature #1:`,
value: `Description of feature #1! Feel Free To Change however you want or copy from open bracket to close bracket to create a new line`,
},
{
name: `💬Feature #2:`,
value: `Description of feature #2! You can always remove one of the info holder if you want to!`,
},
{
name: `💬Features #3:`,
value: `Description of feature #3! Customize it however you want to!`,
},
{
name: `💬FAQ#0: Questions?`,
value: `Then this will be your answer field!`,
},
{
name: `💭FAQ#1: Need help setting up this as a prefix command?`,
value: `Feel free to message me on Discord: notedwin.music#5148 or ask in the #support-request!`,
},
{
name: `💭FAQ#2: I have more questions/ wanna report a bug!`,
value: `Join my discord support server here: https://discord.gg/qKzThHGBKa and report it in #bugs\n\n\nYou will get a Bug Seeker Role after the bug report was confirmed! \n*You can receive a Bug Hunter Role if you are actively reporting bugs, but hopefully there are not much bugs to fix lmao!*`,
},
],
image: {
//an image you want to attach at the bottom of the embed message, optional, just for aesthetic:)
url: `https://i.imgur.com/8fGT46k.gif`, //the link of your image
height: 0,
width: 0,
},
author: {
//author information
name: `Notedwin, Bot Developer`, //this can be your name or anything
url: `https://top.gg/bot/881841988733923368/vote`, //when someone clicks on your name, they will be redirected to a website, in my case, this link is to vote my bot!
icon_url: `https://cdn.discordapp.com/avatars/881841988733923368/23384e0723e84c5cfc8df7b503f0c339.png?size=256`, //this is the author avatar, I extracted this from my bot using inspect element. You can also upload an image to discord and copy the image link and paste it here!
},
},
],
});
} else {
//if the person trying to use this command is not the bot owner,
return await lib.discord.channels['@0.2.0'].messages.create({
//returns a message saying only bot owner can use it
channel_id: `${context.params.event.channel_id}`, //gets the channel id of where the command was sent. When you run on Autocode, you might get an error saying it's a test data. it will get the channel id fine when you run it on Discord!
content: `This command is for only **Bot owner**!`,
});
}