Server to server automatic copy and paste feature - discord

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.

Related

Placing SQL Server generated emails in Outlook Outbox

We send monthly emails generated in SQL Server(2017) using sp_send_dbmail to clients containing sensitive data. Recently, there's been a breach where a client received something they shouldn't have received. The cause of this is honestly just bad code, but going forward we want to be able to screen emails more effectively. We are now avoiding the sensitive data issue by asking clients to log in to our system to look at this data instead. Whilst this would be perfectly normal procedure, certain people demand everything in an email. It's a security problem, but the client wants what they want, and the head honcho wants to give the client what they want.
We use Outlook, which has an outbox that nobody really uses anymore as far as I know. Is there a way to get SQL Server to place emails into a shared outbox account so that we can screen emails that contain sensitive data before we send them out?
For initial QA, data for emails containing alerts are generated via stored procedures and sent to QA analysts to check over. This is done by manually setting the recipients to the QA analysts for emails to all clients.
We don't expect them to cover every email as that would be insane, so we ask that they check a random selection to be confident enough that the data is accurate.
Once they are happy, we run the stored procedures again but we pass a parameter so that it cursors through a table that contains every email alert for each client and generates the tailored email for each client and is sent using sp_send_dbmail.
In other words, the email being screened by the QA analysts might not be the same as the email send to clients. This is how the breach occurred.
If we had a way to get these emails into a shared outbox, the QA work can be done on that shared outbox and then we can send the emails. Asking someone to hit send for a big bunch of emails would still be a pain, but perhaps a little less so than having another breach.
AFAIK sp_send_dbmail uses SMTP to send messages. If you want to place messages in the Drafts (or any other) folder of a particular mailbox, you will need to create messages (without sending) using Graph or EWS.

Copy Reactions To Discord Messages

We made a mistake on our Discord server by using a free tool for managing roles. I won't mention it by name. The tool doesn't allow us to edit the original embed that contains all of the emojis and associated roles. As well, Discord doesn't seem to allow you to edit another user's messages, even if you own the server. And that makes good sense.
So what we're left with is creating a new roles message that looks like the old one and adding the reactions to it. However, we don't want everyone to have to go back and redo their reactions since moving the message wouldn't do anything to their existing roles. We still want to be able to see who reacted to the original message, and preferably be able to transfer the original reactions. I would like to know if it is possible to copy the old reactions over to the new message. I kind of think that Discord won't allow it in keeping with the model that you can't do something that a user would do for themselves. But I thought I would ask here first.
Our server management bot is built using JDA and runs on a Linux server.
No it's not possible to transfer over Discord reactions to a different message.
Use better botsite that can edit embed message or bot message
you can create here: https://botghost.com/?invite=981659393298923621
Go to embed builder and try to make a new post there and read how to edit bot post that you posted using this botghost

Run One instance of Discord bot per server, So bot doesn't turn on on every server

So my code activates a listener which will then just simply return the message to the user. However, once the listener is activated, it will be GLOBALLY activated, so all servers with this bot will be affected. How can i create one instance of the bot per server.
The only way to run multiple instances of a bot would be to copy the bot's code and use it in several other bots. You'd need to create several bot applications/users from the developers page and generate tokens for each bot.
It's a bit sketchy and not recommended so I'd be careful with what you're trying to achieve here.

How do I only allow certain functions to work on a specific Discord server ID?

I have a joke Discord bot which automatically nicknames people for the main server it's on, but I also allow some other friends to put it on their server for fun. The only issue is, the automatic rename thing also happens there.
What would the correct line of code be to make it so the lines of code responsible for the auto-nickname feature only run when someone joins a specific server and not any server with the bot?
Each guild in discord has a guild ID, witch is unique, so you could use it to determine if the bot should do the nickname change in that specific guild.
I can't show you an exact line of code since you didn't specify the language you are writing your bot in but I'll write the basic idea of it.
if (message.guild.id != "Your main guild id") return;
This assumes that you execute this on a per message basis, but since you didn't provide much more detail this is as much as I can give in terms of code example.
Another thing to consider is how to get the guild ID in the first place, firstly enable development mode in discord in case you haven't already, to do that you should:
Open your Discord settings
click on Appearance
Scroll down to Developer mode and enable it.
Once you did that, you can right click the server name and go to "Copy ID", and you have your id.

How to dynamically connect to a database

I want to connect Django to a database that the user will set in the main page.
The user will have to precise the engine (with a combobox), the database, login, password etc in a form, and I want to proceed the connection with the submit.
So far, I tried to set "DATABASES = {}" in settings.py, but it returns an error.
Have you got any clue about how to do it?
You have to connect your app to a database.
There is no way that I know of to change the database connection dynamically.
The only things I can think of are a bit convoluted:
If you want to change your back-end database:
I would suggest having a separate setting file for the database (I will call it dbsettings.py) that you will include in the settings file.
At the submit, you would lunch a script that will change the dbsettings.py file, and restart the django server (with a CLI call for example)
If the database is user specific, configure and fire up another django instance, and have the two instances communicate (you could use celery for messaging or django commands)
I (and other people) may come up with better solutions if we had a little more details

Resources