How to send a global message?
I'm wanting to send a message (in a way as a global announcement to all servers) about important information regarding the bot. In this instance, regarding unplanned downtime.
guild.channels.find(t => t.name == 'general').send
I think.. is correct coding to find a text-channel with the name #general. (I want to add 'announcements' / 'lounge') as a back-up if #general isn't an option.
I have no clue where to start on coding up this command.
Any help would be appreciated.
BELOW YOU CAN FIND A SEMI-TEMPLATE / IDEA OF WHAT I WANT?
some parts of the code are chopped out, this is no way effects below.
exports.exec = async (Peepo, message, args) => {
// Fires Error message that the command wasn't ran correctly.
if (args.length < 1) {
return message.channel.send({embed: {
color: 0,
description: `${message.author} add some words.`
}
});
}
// Fires Error message that the command wasn't ran correctly.
// FETCH CHANNELS TO SEND ANNOUNCEMENT TO
message.channel.send({
embed: {
color: 0,
title: ` ANNOUNCEMENT`,
description: `${guild.name}{`,
footer: {
text: "${guild.name} this is an official message from the creator of this bot."
};
/* * * * */
discord.js
add a comment |
I'm wanting to send a message (in a way as a global announcement to all servers) about important information regarding the bot. In this instance, regarding unplanned downtime.
guild.channels.find(t => t.name == 'general').send
I think.. is correct coding to find a text-channel with the name #general. (I want to add 'announcements' / 'lounge') as a back-up if #general isn't an option.
I have no clue where to start on coding up this command.
Any help would be appreciated.
BELOW YOU CAN FIND A SEMI-TEMPLATE / IDEA OF WHAT I WANT?
some parts of the code are chopped out, this is no way effects below.
exports.exec = async (Peepo, message, args) => {
// Fires Error message that the command wasn't ran correctly.
if (args.length < 1) {
return message.channel.send({embed: {
color: 0,
description: `${message.author} add some words.`
}
});
}
// Fires Error message that the command wasn't ran correctly.
// FETCH CHANNELS TO SEND ANNOUNCEMENT TO
message.channel.send({
embed: {
color: 0,
title: ` ANNOUNCEMENT`,
description: `${guild.name}{`,
footer: {
text: "${guild.name} this is an official message from the creator of this bot."
};
/* * * * */
discord.js
Maybe you can useGuild.defaultChannel
Note: This is deprecated and may be removed in other versions
– Koen Hollander
Nov 26 '18 at 14:40
I'm on11.4.2 for Discord JS
I don't believe it works anymore sadly
– Imaginebeingme
Nov 26 '18 at 14:54
add a comment |
I'm wanting to send a message (in a way as a global announcement to all servers) about important information regarding the bot. In this instance, regarding unplanned downtime.
guild.channels.find(t => t.name == 'general').send
I think.. is correct coding to find a text-channel with the name #general. (I want to add 'announcements' / 'lounge') as a back-up if #general isn't an option.
I have no clue where to start on coding up this command.
Any help would be appreciated.
BELOW YOU CAN FIND A SEMI-TEMPLATE / IDEA OF WHAT I WANT?
some parts of the code are chopped out, this is no way effects below.
exports.exec = async (Peepo, message, args) => {
// Fires Error message that the command wasn't ran correctly.
if (args.length < 1) {
return message.channel.send({embed: {
color: 0,
description: `${message.author} add some words.`
}
});
}
// Fires Error message that the command wasn't ran correctly.
// FETCH CHANNELS TO SEND ANNOUNCEMENT TO
message.channel.send({
embed: {
color: 0,
title: ` ANNOUNCEMENT`,
description: `${guild.name}{`,
footer: {
text: "${guild.name} this is an official message from the creator of this bot."
};
/* * * * */
discord.js
I'm wanting to send a message (in a way as a global announcement to all servers) about important information regarding the bot. In this instance, regarding unplanned downtime.
guild.channels.find(t => t.name == 'general').send
I think.. is correct coding to find a text-channel with the name #general. (I want to add 'announcements' / 'lounge') as a back-up if #general isn't an option.
I have no clue where to start on coding up this command.
Any help would be appreciated.
BELOW YOU CAN FIND A SEMI-TEMPLATE / IDEA OF WHAT I WANT?
some parts of the code are chopped out, this is no way effects below.
exports.exec = async (Peepo, message, args) => {
// Fires Error message that the command wasn't ran correctly.
if (args.length < 1) {
return message.channel.send({embed: {
color: 0,
description: `${message.author} add some words.`
}
});
}
// Fires Error message that the command wasn't ran correctly.
// FETCH CHANNELS TO SEND ANNOUNCEMENT TO
message.channel.send({
embed: {
color: 0,
title: ` ANNOUNCEMENT`,
description: `${guild.name}{`,
footer: {
text: "${guild.name} this is an official message from the creator of this bot."
};
/* * * * */
discord.js
discord.js
edited Nov 26 '18 at 16:44
Federico Grandi
3,28531230
3,28531230
asked Nov 26 '18 at 12:36
ImaginebeingmeImaginebeingme
308
308
Maybe you can useGuild.defaultChannel
Note: This is deprecated and may be removed in other versions
– Koen Hollander
Nov 26 '18 at 14:40
I'm on11.4.2 for Discord JS
I don't believe it works anymore sadly
– Imaginebeingme
Nov 26 '18 at 14:54
add a comment |
Maybe you can useGuild.defaultChannel
Note: This is deprecated and may be removed in other versions
– Koen Hollander
Nov 26 '18 at 14:40
I'm on11.4.2 for Discord JS
I don't believe it works anymore sadly
– Imaginebeingme
Nov 26 '18 at 14:54
Maybe you can use
Guild.defaultChannel
Note: This is deprecated and may be removed in other versions– Koen Hollander
Nov 26 '18 at 14:40
Maybe you can use
Guild.defaultChannel
Note: This is deprecated and may be removed in other versions– Koen Hollander
Nov 26 '18 at 14:40
I'm on
11.4.2 for Discord JS
I don't believe it works anymore sadly– Imaginebeingme
Nov 26 '18 at 14:54
I'm on
11.4.2 for Discord JS
I don't believe it works anymore sadly– Imaginebeingme
Nov 26 '18 at 14:54
add a comment |
2 Answers
2
active
oldest
votes
The easiest solution would be to message the guild owner.
client.guilds.forEach(guild => {
client.users.get(guild.ownerID).send("Important announcement!");
});
Every guild has an owner, so there's no worry about a server renaming their #general channel.
This is actually a really smart and unique way of doing it. Many thanks for this.
– Imaginebeingme
Nov 28 '18 at 0:48
add a comment |
Below is a basic forEach loop that will send a message to the general channel of every server - do note it will not send if the guild doesn't have a #general
client.guilds.forEach(guild => {
guild.channels.find(t => t.name == 'general').send('Some important announcement to all guilds!');
})
add a comment |
Your Answer
StackExchange.ifUsing("editor", function () {
StackExchange.using("externalEditor", function () {
StackExchange.using("snippets", function () {
StackExchange.snippets.init();
});
});
}, "code-snippets");
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "1"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});
function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});
}
});
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53481254%2fhow-to-send-a-global-message%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
2 Answers
2
active
oldest
votes
2 Answers
2
active
oldest
votes
active
oldest
votes
active
oldest
votes
The easiest solution would be to message the guild owner.
client.guilds.forEach(guild => {
client.users.get(guild.ownerID).send("Important announcement!");
});
Every guild has an owner, so there's no worry about a server renaming their #general channel.
This is actually a really smart and unique way of doing it. Many thanks for this.
– Imaginebeingme
Nov 28 '18 at 0:48
add a comment |
The easiest solution would be to message the guild owner.
client.guilds.forEach(guild => {
client.users.get(guild.ownerID).send("Important announcement!");
});
Every guild has an owner, so there's no worry about a server renaming their #general channel.
This is actually a really smart and unique way of doing it. Many thanks for this.
– Imaginebeingme
Nov 28 '18 at 0:48
add a comment |
The easiest solution would be to message the guild owner.
client.guilds.forEach(guild => {
client.users.get(guild.ownerID).send("Important announcement!");
});
Every guild has an owner, so there's no worry about a server renaming their #general channel.
The easiest solution would be to message the guild owner.
client.guilds.forEach(guild => {
client.users.get(guild.ownerID).send("Important announcement!");
});
Every guild has an owner, so there's no worry about a server renaming their #general channel.
answered Nov 27 '18 at 16:40
Thomas BlasquezThomas Blasquez
435
435
This is actually a really smart and unique way of doing it. Many thanks for this.
– Imaginebeingme
Nov 28 '18 at 0:48
add a comment |
This is actually a really smart and unique way of doing it. Many thanks for this.
– Imaginebeingme
Nov 28 '18 at 0:48
This is actually a really smart and unique way of doing it. Many thanks for this.
– Imaginebeingme
Nov 28 '18 at 0:48
This is actually a really smart and unique way of doing it. Many thanks for this.
– Imaginebeingme
Nov 28 '18 at 0:48
add a comment |
Below is a basic forEach loop that will send a message to the general channel of every server - do note it will not send if the guild doesn't have a #general
client.guilds.forEach(guild => {
guild.channels.find(t => t.name == 'general').send('Some important announcement to all guilds!');
})
add a comment |
Below is a basic forEach loop that will send a message to the general channel of every server - do note it will not send if the guild doesn't have a #general
client.guilds.forEach(guild => {
guild.channels.find(t => t.name == 'general').send('Some important announcement to all guilds!');
})
add a comment |
Below is a basic forEach loop that will send a message to the general channel of every server - do note it will not send if the guild doesn't have a #general
client.guilds.forEach(guild => {
guild.channels.find(t => t.name == 'general').send('Some important announcement to all guilds!');
})
Below is a basic forEach loop that will send a message to the general channel of every server - do note it will not send if the guild doesn't have a #general
client.guilds.forEach(guild => {
guild.channels.find(t => t.name == 'general').send('Some important announcement to all guilds!');
})
answered Nov 26 '18 at 13:48
ethamitcethamitc
332211
332211
add a comment |
add a comment |
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53481254%2fhow-to-send-a-global-message%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Maybe you can use
Guild.defaultChannel
Note: This is deprecated and may be removed in other versions– Koen Hollander
Nov 26 '18 at 14:40
I'm on
11.4.2 for Discord JS
I don't believe it works anymore sadly– Imaginebeingme
Nov 26 '18 at 14:54