Command Usage in DMs | Discord.js - discord

I am making a bot that has a command where you can text people.
The point is you send a text through a server to a user, which the user will receive a DM with the contents. The user uses the command through the bot's DMs which will then send that message to the senders DMs.
Basically I need to know how to make it so the user can use the command through DMs and send a message back to the sender.

What you can do if you don't use database is save the senderID who dm-ed someone through the command in server. And then take the senderID from the json get user from it and then save as a variable.

You can use this function to send a dm
user.send("message here");
User is the user object and send is one of it's methods.

Related

Can I create an app or a bot in discord that send messages as it was me?

I want an app/bot that reads the last message that were sent to a specific channel on a server that I participate and depending on the text I want to send a message to that same channel. The thing is, I want to do it in my name, not using a bot id. I know that you can create a bot using your own name and avatar but what I really want is to send a message using my own account. Is that possible? Could not find anything like that in the docs, maybe a missed something?
I do not think you are even allowed to do this so I doubt the discord API would have support for this
Discord Guidelines
"Do not use self-bots or user-bots. Each account must be associated with a human, not a bot. Self-bots put strain on Discord’s infrastructure and our ability to run our services. For more information, you can read our Developer Policies"
However, if you really wanted to do this you could use a macro at the risk of getting your account banned by discord if they found out. You could create a macro in python using the pyautogui module.

Discord bot get user id by only name

So I'm currently making a bot that should dm users who entered their discord name(example#0000) outside of discord, I now need the bot to convert their names into their Id's, in order to dm them.
Is that even possible?
For clarification, the bot is not on the same server as the users and has never interacted with them.
No, it’s not possible to get a User/Member instance by name if you don’t share a guild, the only possible way would be to fetch it from the API using an ID
user = await bot.fetch_user(123345567901)

Make it so that a someone cannot react to a discord message until a channel has been deleted

So basically I have a support bot that creates a channel when someone reacts that only staff have access to. In order to prevent abuse I want to make it so that a new channel channel cannot be created by the same person unless the a previously open channel is deleted.
Give your bot access to the AuditLogs will allow you to see who is creating the channels but I suspect that's not gonna help because the bot will be the one creating and deleting the channels, for the discord server he is the owner of the action.
Maybe the only way is to store in the bot code a map of the channel id and his owner (user that typed the command). With this every time a user try to create a new channel you can check on your map if there is any channel active for that user and if there is show some kind of error message.

Custom pings on announce command Discord.js

Right now I have an announce command that pings everyone when I send an announcement, but I want to change the ping so that it pings a certain role in my server. The first code is the code that works and pings everyone, and the second two lines of code are the custom ping that is not sending as a ping but just a line of text. How can I make the second two lines of code send as a ping like the #everyone?
message.channel.send(`#everyone`)
message.channel.send(announceEmbed);
message.channel.send(`#Stream`)
message.channel.send(announceEmbed);
It is an exception that only everyone role would ping the everyone role of the guild when sent as #everyone. But it is not the case for other roles, as well as for member and channel. So
You can ping/mention the particular role using the ID of the role,
message.channel.send(`<#&roleid>`);

Server to server automatic copy and paste feature

I'm helping a friend set up a server and was wondering if it was possible to copy and paste the messages on one server to another without being an admin on one of them?
To copy the messages to and from one server, you'd want to use webhooks to move them across and preserve the username. A feature like this has been implemented in various discord bots, but if you want to create your own then here is a discord.js example of how to do so: https://anidiots.guide/discord-webhooks.
What you'd want to do is to wait for the message event, then get (or create) a webhook from the other server with the user's name, then send the message contents in that webhook.

Resources