Discord.py-rewirte Log server id? - discord

How Do I log when my bot joins the server and prints the server id?
Like so when the bot joins a server it will print the server id.
If you can give any help thanks.

You can make use of the on_guild_join event. From there you can use the guild object within the event parameters to gather the id.
https://discordpy.readthedocs.io/en/rewrite/api.html#discord.on_guild_join
https://discordpy.readthedocs.io/en/latest/api.html#guild

Related

How do I access the Sharebuilder UserID in SQL Server Report Builder

I am trying to pull the Sharepoint UserID out so I can use it as a parameter to control what the user of a dashboard can see. I have tried setting up a UserID parameter using the built-in field UserID and used that in a query to get a list of personnel but Report Builder gives me an error that I am trying to use a forward reference. How can I access the UserID in such a way that I can use to pull up the user's information from a SQL Server database? Thank you in advance for your help.
I fixed this problem by moving my UserID parameter to the top of my parameter list. Thanks

Send an email to current user in SQL Server Agent job when job fails

I have a SQL Job where I want to send an email alert if job fails. I know that for this functionalty I have to Configure Database Mail and than Adjust the properties within the SQL Server Agent. This article gives pretty good detail http://www.sherweb.com/blog/how-to-set-up-database-mail-for-sql-server-job-failures/.
What I want is, instead of setting up an email address to particular user like person1#test.com, I want to send an email to current user. This way who ever logged in to database and runs the job receives the email on job failure.
As I see, there are two benefits of this approach,
i. One particular user won't get flooded with emails. ii. Who ever is running the job can know that job has failed.
For example,
If I set person1#test.com and person2 logs in than on job failure person1 will receive an email. I don't want that. Is there any way that I can do this in SQL Server Agent Job settings. If no than how can I achieve this?
Like SELECT SYSTEM_USER or SELECT SUSER_NAME() gives me current user and use that as outgoing email address.
I think you are confused, if one user will start the job manually then you use a STORE PROCEDURE and there you can get the connected user information.
But pgAgent will run the process automatic and run using the USER you setup on the job.

Testing sp_send_dbmail

Does anyone know if there is a way to setup sql server to send all mail to one specific email address rather than what has been passed into sp_send_dbmail?
I ask as I need to verify what is going to be sent on a system that has customer email addresses and I don't want to actually send the email but rather check the contents.
The customer occasionally go onto this system to test certain things out which may trigger emails. At the moment these email are not sent out to anyone as the system is not setup for mail. I want this to stay the same but instead send all these mails to an internal email address. I don't know all the code that sends emails as there are approx. 3000 stored procedures in this system.
I have been searching on-line but can only find how to setup email.
If you're just looking to verify what will be sent, you can query the msdb.dbo.sysmail_mailitems table:
SELECT *
FROM msdb.dbo.sysmail_mailitems
This table holds the recipients, subject, body, format, query, sent_date, from_address, reply_to, and some other fields. I also suspect, though I haven't test, that if you updated that table to a new recipient email address that you could send them to the one address as you've requested above.
1)You can check mail is started or not using GUI.
2)you check email sending using following command.
Select * from msdb.dbo.sysmail_sentitems order by last_mod_date desc
enter image description here
unable to relay in Exchange Server :- Launch Exchange Server Manager and move to Administrative Groups. Select Administrative Group Name then choose Server>Server Name. Now click on Protocols and Select SMTP.
Right-click on Default SMTP Virtual Server and select Properties
In Access tab, click on Relay>only the list below
Now check the checkbox “Allow all systems to successfully authenticate to relay regardless of the list above” and close. ....check with internal team for permission.

Send automated email

I want to send automated emails to UserType( requester, assignee ,reviewer,admin) based on an insert and.or update in Database.
EX:
A remainder email send to requester, assignee ,reviewer and admin if the reviewer is not able to review the data in 7 days from the date it is assigned to him/her.
I know I can do this with SQL JOB or with Windows Services. But I ma looking for different way to do this if possible and/or does SSIS provide such functionality?
I think another option is to setup the trigger on insert/update of tables that need to be monitored then then called a stored procedure that use msdb.dbo.sp_send_dbmail to send out email.
You can look at the answer in this post for reference on how to send email using sp_send_dbmail.
Sending Email in SQL Server 2008 R2. I hope that helps.

SQL Login notification

I want to be notified of SQL Server logins that has a particular value for the Application Name property of the connection string. Can someone help me to get these type of notifications by email or by any other recommended method?
You're looking for a logon trigger. In the trigger you can inspect the connection application name (note that this setting is not secure and can be easily spoofed). Use sp_send_dbmail to send yourself mail.

Resources