How do I get a user's boost date - discord.js

Does anyone know how i can get a user's boost date?
I'm making a command where the user can see the day of your boost, I already tried to get the nitro signature start date, but I specifically need the boost date

You can see since when a user boosts a server by reading the premiumSince property from a guild member.
Solution
This can look like this:
client.guilds.cache.get(guild_id).members.cache.get(member_id).premiumSince.
Just replace guild_id with your server id and member_id with your the user id. Note: The premiumSince property is only avalible for a guild member that is why you have to get the guild first and then the user!
Date Conversion
The line of code should give you an output like this 1995-12-17T03:24:00 to convert the date take a look at this post about JavaScript's Date() function.

Related

QBO SDK PHP getting all deposits customer

I would like to know how to get all deposits of a target customer with the following SDK (https://github.com/intuit/QuickBooks-V3-PHP-SDK).
Is there an easier way than getting all deposits, then looping to extract the wanted customer's deposits?
Official QBO answer:
You can get complete deposit list by querying the “Query a deposit”
API end point. If we use filter in query, then it may return incorrect
results. Better you can iterate the response and add filter logic in
your code and get specified

Firebase pagination using a timestamp/date as the orderBy

I am struggling to get pagination working when I use a date (firebase timestamp) to retrieve data.
This is basically what I do:
let jobsRef = db.collection("jobs")
.orderBy('createdAt', 'desc')
.limit(QUERY_LIMIT);
jobsRef = jobsRef.startAfter(this.props.jobs[this.props.jobs.length - 1].createdAt);
However it seems that i get returned items sometimes that I have just already received. I am guessing because of similar dates?
So how could I basically return a list of jobs ordered by createdAt and have an offset/limit (pagination)?
createdAt looks like the timestamp type: 23 October 2020 at 17:26:31 UTC+2
When I log createdAt however I see this: {seconds: 1603537477, nanoseconds: 411000000}
Maybe I should be storing createdAt as a unix timestamp? Or what is the ideal way to deal with this?
Here is how it looks in the database (popup when i click edit on createdAt):
If multiple documents can have the same value for the field you're sorting on, passing in a value for that field is not guaranteed to point to a unique document. So you indeed may be passing in an ambiguous instruction, leading to an unwanted result.
When possible, I highly recommend passing the entire document to the Firestore API. This leaves it up to Firestore to take the necessary data from that document to uniquely/unambiguously find the anchor for your query.
So instead of:
jobsRef.startAfter(this.props.jobs[this.props.jobs.length - 1].createdAt);
Do:
jobsRef.startAfter(this.props.jobs[this.props.jobs.length - 1]);
I was facings a similar problem, after may hours I finally found a solution, all you need to do is converting that number to firestore's Timestamp
import { Timestamp }. from #angular/fire/firestore;
let createdAt: number = 56772766688383;
let timestamp = Timestamp.fromMillis(createdAt);
//then pass that to startAfter
startAfter(timestamp)

How can I get Watson to recognize two different dates upon user input?

If a user asks the following sentence:
For some reason Watson uses the first date for the both $checkin and $checkout variables even though it detects the second date.
You can refer to the "dialog node" screenshot to see how the nodes are setup.
How can I get Watson to recognize the first date is the checkin date and the second one is the checkout date. Is there a way I could tell Watson after the first date is used if a second one is detected use it to fill the next slot?
I've found something about the #sys-date range_link entity. But the documentation is not detailed.
This is easy to do, but comes with issues you need to be aware of.
Slots allows you to define variables as they are read. For example.
Will generate this:
The issue is that you are assuming that people will ask in the same order that you need the information. If this doesn't happen then this will fail.
You can mitigate this by shaping how the user may ask the question. For example:
"Please let me know where you are leaving and going to"
The person is more likely to respond with the exit date first.
BETA
This is likely to change and doesn't fully work as you expect. You can enable the beta #sys-date in the options. So I wouldn't recommend relying on this until it is final.
You first need to check for range_link. This will tell you if it detected that two dates are connected to each other.
Then you can do the following:
From Date: <? entities['sys-date'].filter("d", "d.role.type == 'date_from'")[0]?.value ?>
To Date: <? entities['sys-date'].filter("d", "d.role.type == 'date_to'")[0]?.value ?>
What this does is find the exact record that has the role of date_from and returns the value. Likewise for date_to.
You end up with something like this.

How to get salesforce Activity id

I have a salesforce query that extracting users time report
SELECT ID,Logged_Date__c ,CreatedBy.Email, CreatedBy.id, CreatedBy.Name, Time_Spent_Hours__c, Activity__c, CaseId__r.CaseNumber, CaseId__r.Account.id, CaseId__r.Account.Name , Utilized__c
FROM Time_and_Placement_Tracking__c
The Activity__c returns with the activity text.
I was trying to use Activity__c.Id, Activity__r etc. but all returns with error.
Is there a way to get the Activity id?
Verify these
You need to get to the object definition and see the field info. You can use workbench or any other API tool if you are familiar with and get the object and field def's.
Check the data type for Activity__c field. It should be a lookup/master relation. If it is not, find the field which ties to Activity object.
Open the field to get the API name and use that in the query with a '__r' extension.

SilverPOP API - Automated message report

I need to export all data from Silverpop automated message with silverpop API
apparently there are no many information on the net apart from the official guide "XML API Developer’s Guide ENGAGE"
I need to know how to:
retrieve a list of Automated message
extract / download data of selected report (for all days-not single one)
finally (again not documented in the official guide); how to programmatically export final report having set MOVE_TO_FTP=true
(the guide quotes Use the MOVE_TO_FTP parameter to retrieve the output file programmatically)
thank you very much in advance for any help in this
You can use the RawRecipientDataExport XML API export to get the following:
• One or more mailings
• One or more Mailing/Report ID combinations (for Autoresponders)
• A specific Database (optional: include related queries)
• A specific Group of Automated Messages
• An Event Date Range
• A Mailing Date Range
For automated messages, you can use the following XML tags <CAMPAIGN_ACTIVE/>, <CAMPAIGN_COMPLETED/>, and <CAMPAIGN_CANCELLED/> to retrieve active Groups of Automated Messages, retrieve completed Groups of Automated Messages, and retrieve canceled Groups of Automated Messages, respectively.
To get data for all days and not just one, you can set a date range for send dates and event dates, by putting your desired date ranges within the <SEND_DATE_START> and <SEND_DATE_END> tags and <EVENT_DATE_START> and <EVENT_DATE_END> tags. The date formats are like this: 12/02/2011 23:59:00
Hope this helps.

Resources