Create a group DM Discord.js - javascript

I am trying to get my bot to message two people but in the same chat window (like when you add a friend to a conversation). The only thing I've found is how to send to a single person by doing <client>.send(message); How could I add a second person to that conversation?
Any examples would be highly appreciated.

Discord.js doesn't really implement that because in Discord bots can't join Group DMs. You would need a self-bot (a bot that runs on a user account), but Discord doesn't want them to be used, so discord.js didn't make this options.
Therefore, at the moment there's no way to do that: the groupDMChannel class can't be used to create them, and since there's no method to do that from the client or from a DM channel I think you're stuck there :\

just taking a quick look at the Discord.js documentation, it seems they do have a GroupDMChannel class, and this seems to be what you want / need to use.
The two methods that stand out to me:
send
addUser
Where I'm assuming (I know I shouldn't!) that you have to call addUser first.
disclaimer: not going into detail, since I don't have experience using this particular module

Related

In my userinfo command how should i do that I don’t have to use the ID of the person and ping them. It will show the info of the person using the cmd

I want to make it so when i execute the command without pinging or using the ID of the person it will show the userinfo of the person using the command.
You will have to check message.mentions.members.first(). If it's undefined then use the message's author - message.author.
But it's hard to help and give suggestions without showing us what you have made so far.

Discord bot (either Python or Javascript) that can store information

So I was thinking of making a Discord bot for a Dungeons and Dragons server for me and my friends when I realized that (gasp) I don't know how to create variables or store information when it comes to Discord bots.
(Yes, I do know how to make variables in regular Python, if that helps. I also know how to set up a bot and add it to Discord, I just need to get the hard coding down)
So therefore, I hath decided to ask ye Stack Overflow gods, dispensers of coding wisdom and masters of carpal tunnel, to assist me with... figuring out how to make a bot that can store information and such. Fair warning, this will probably be the first of many questions.
TL;DR: Could someone please help me make a bot that can store information about a fictional character(s) (i.e. name, age, etc.)?
Look into shelve for python. You interact with it like it's a python dictionary/map, but it saves to a file.
you might be able to use this
if msg.startswith("g?list"):
fb = []
if "fb" in db.keys():
fb = db["fb"]
await message.channel.send(fb)
await client.process_commands(message)
just make sure to change the command prefix to whatever your bots command prefix is.

How would I mention someone In Discord JS

I want to be able to mention a user when they join the server I really need help with this.
For user mentions it is the user's ID with <# at the start and > at the end,
like this:
<#17372382352635>
I figured out how to do it I will help some of you guys so when you are making it put the tilda key instead of ''.
You'll need the following method guildMemberAdd from Discord.js
bot.on('guildMemberAdd', async (guild_member) => {
//message.send with notification, for `guild_member.user.username`
})
You may also find the example code, in the repo of my own Discord bot, which is actually check (for proper names) and renaming users, on server join event.
My personal advice, not to use DM (because users may have forbid to receive messages from non-friends and members of the mutual discord server.
And as was mentioned before, by Dpk, you may use <#idOfUser/Channel/Whatever> to create a link or mention or any other thing via it's ID.

What is the best way to create a Reaction Roll function for my discord bot using discord.js?

I have been trying to do this for some time, but to no luck.
I am fairly new javascript so am not very competent at it.
I essentially want it to work like the reaction roles bot:
It asks which channel to add the reaction roles to,
you reply with '#general' for instance.
Then it asks which message you want to add it too,
you reply with the '[message ID]' you want the reaction roles added to.
Then it asks which emoji to react with to get the role,
you reply with that emoji (also include failsafe in case its a nitro only emoji).
Then it asks for which role to give the person,
you reply with something like '#moderator'.
Finally it asks if you want to receive the roll (1) from clicking on it or remove the roll (2) from the user.
you reply with either '1' or '2'
Then it will add the reaction to the message and that should be it and it would work.
Any help at all is welcome,
even if it only contributes to a small part of this,
I am aware after programming on other languages it is never easy to make these things.
Thank you everyone!
The tutorial that Delight posted started me off on a long journey of discovery.
After much research I have found the best way to make it was by following this tutorial:
https://www.youtube.com/watch?v=2CCGwsbNaSc&list=PL_cUvD4qzbkxKEHA-_CFmEG0Y2qQCqYFT&index=1
Which helped integrate a Database also.
Also the person making the video was very very good at explaining what they did and walked you through it, allowing me to make all the changes I wanted to with no problems.
I can't possibly explain the stuff as well as this person, so if you want to make a good reaction roles bot please look at that guys tutorials. :)
I would use
client.on("messageReactionAdd", reaction => {
});
to detect if someone reacted to a message. Then I would check if the message was a reaction role message and add the role if everything looks ok. You might wanna check out this tutorial on reaction roles.

Re-create channel with same permissions

I am trying to create a bot that re-creates a channel with the same permissions.
So my current code re-creates the channel fine in the same position, NSFW value, etc. but it doesn't put the permissions of the old channel into the new one :/
I've been searching the whole day but couldn't solve it.
I didn't know that Discord.js had a .clone method for GuildChannel
This is more easier now based on the documentation :-)
I am pretty sure this could help you:
recreatedchannel.replacePermissionOverwrites({ overwrites: firstChannel.permissionOverwrites });
You basically overwrite the permissions of the new channel with the permissions of the channel you are recreating. Always worked for me :)
Question
I don't think this is possible. And anyways couldn't you just clone the channel. The reasoning behind the bot I don't really understand. Will you tell me the reasoning. Is your discord server a roleplay server?
You can see how to clone a server at Facebook Pro Tippy Clone Channel!

Categories