mirror of
https://github.com/ChomeNS/chomens-bot-mc.git
synced 2024-11-14 10:44:55 -05:00
*time fix + improve?
This commit is contained in:
parent
5d41b4c908
commit
059d1e201b
1 changed files with 16 additions and 12 deletions
|
@ -8,11 +8,15 @@ module.exports = {
|
|||
trusted: 0,
|
||||
execute (bot, username, sender, prefix, args, config, hash, ownerhash, selector) {
|
||||
const timezone = args.join(' ')
|
||||
const momented = moment().tz(timezone).format('dddd, MMMM Do, YYYY, hh:mm:ss A')
|
||||
const format = 'dddd, MMMM Do, YYYY, hh:mm:ss A'
|
||||
const momented = moment().tz(timezone).format(format)
|
||||
const component = [{ text: 'The current date and time for the timezone ', color: 'white' }, { text: timezone, color: 'aqua' }, { text: ' is: ', color: 'white' }, { text: momented, color: 'green' }]
|
||||
if (timezone.toLowerCase() === 'asia/bangkok' || timezone.toLowerCase() === 'utc') {
|
||||
bot.tellraw(selector, component)
|
||||
} else if (momented === moment().format('dddd, MMMM Do, YYYY, hh:mm:ss A')) {
|
||||
if (momented === moment().format(format) &&
|
||||
(timezone.toLowerCase() === 'asia/bangkok' ||
|
||||
timezone.toLowerCase() === 'utc' ||
|
||||
timezone.toLowerCase() === 'america/new_york'
|
||||
)
|
||||
) {
|
||||
throw new SyntaxError('Invalid timezone')
|
||||
} else {
|
||||
bot.tellraw(selector, component)
|
||||
|
@ -20,15 +24,15 @@ module.exports = {
|
|||
},
|
||||
discordExecute (bot, username, sender, prefix, args, channeldc, message, config) {
|
||||
const timezone = args.join(' ')
|
||||
const momented = moment().tz(timezone).format('dddd, MMMM Do, YYYY, hh:mm:ss A')
|
||||
const format = 'dddd, MMMM Do, YYYY, hh:mm:ss A'
|
||||
const momented = moment().tz(timezone).format(format)
|
||||
const description = `The current date and time for the timezone ${timezone} is: ${momented}`
|
||||
if (timezone.toLowerCase() === 'asia/bangkok' || timezone.toLowerCase() === 'utc') {
|
||||
const Embed = new EmbedBuilder()
|
||||
.setColor(config.discord.embedsColors.normal)
|
||||
.setTitle('Time')
|
||||
.setDescription(description)
|
||||
channeldc.send({ embeds: [Embed] })
|
||||
} else if (momented === moment().format('dddd, MMMM Do, YYYY, hh:mm:ss A')) {
|
||||
if (momented === moment().format(format) &&
|
||||
(timezone.toLowerCase() === 'asia/bangkok' ||
|
||||
timezone.toLowerCase() === 'utc' ||
|
||||
timezone.toLowerCase() === 'america/new_york'
|
||||
)
|
||||
) {
|
||||
throw new SyntaxError('Invalid timezone')
|
||||
} else {
|
||||
const Embed = new EmbedBuilder()
|
||||
|
|
Loading…
Reference in a new issue