Rewrite createdate and joindate gets

Update botinfo to work with new getCreationDate
Update userinfo to work with new getCreationDate
Update userinfo to work with new getJoinDate
This commit is contained in:
SileNce5k 2021-06-27 18:14:58 +02:00
parent 0d5502bc92
commit 49e6eaed11
No known key found for this signature in database
GPG key ID: C507260E7F2583AD
6 changed files with 19 additions and 44 deletions

View file

@ -1,34 +0,0 @@
module.exports = function (user) {
let creationMonth, creationDate, creationHours, creationMinutes, creationSeconds;
if (user.createdAt.getUTCMonth().toString().length === 1)
creationMonth = "0" + (1+user.createdAt.getUTCMonth())
else
creationMonth = (1+user.createdAt.getUTCMonth())
if (user.createdAt.getUTCDate().toString().length === 1)
creationDate = "0" + user.createdAt.getUTCDate()
else
creationDate = user.createdAt.getUTCDate()
if (user.createdAt.getUTCHours().toString().length === 1)
creationHours = "0" + user.createdAt.getUTCHours()
else
creationHours = user.createdAt.getUTCHours()
if (user.createdAt.getUTCMinutes().toString().length === 1)
creationMinutes = "0" + user.createdAt.getUTCMinutes()
else
creationMinutes = user.createdAt.getUTCMinutes()
if (user.createdAt.getUTCSeconds().toString().length === 1)
creationSeconds = "0" + user.createdAt.getUTCSeconds()
else
creationSeconds = user.createdAt.getUTCSeconds()
let creation = `${user.createdAt.getUTCFullYear()}-${creationMonth}-${creationDate} ${creationHours}:${creationMinutes}:${creationSeconds}`
return { creation: creation }
}

4
util/getCreationDate.js Normal file
View file

@ -0,0 +1,4 @@
module.exports = function(user){
let date = user.createdAt;
return date.getUTCFullYear().toString()+"-"+date.getUTCMonth()+"-"+date.getUTCDate()+" "+date.getUTCHours()+":"+date.getUTCMinutes()+":"+date.getUTCSeconds();
}

5
util/getJoinDate.js Normal file
View file

@ -0,0 +1,5 @@
module.exports = function(user, guild){
const member = guild.member(user)
let date = member.joinedAt;
return date.getUTCFullYear().toString()+"-"+date.getUTCMonth()+"-"+date.getUTCDate()+" "+date.getUTCHours()+":"+date.getUTCMinutes()+":"+date.getUTCSeconds();
}