updated timezone
This commit is contained in:
parent
e9a4bfe264
commit
dc9cb2a8d9
Binary file not shown.
Before Width: | Height: | Size: 1.9 MiB After Width: | Height: | Size: 1.9 MiB |
12
src/index.js
12
src/index.js
|
@ -26,6 +26,8 @@ const client = new Client({
|
||||||
|
|
||||||
const config = JSON.parse(fs.readFileSync(path.resolve("config", "config.json")));
|
const config = JSON.parse(fs.readFileSync(path.resolve("config", "config.json")));
|
||||||
|
|
||||||
|
process.env.TZ = config.timezone;
|
||||||
|
|
||||||
client.once(Events.ClientReady, readyClient => {
|
client.once(Events.ClientReady, readyClient => {
|
||||||
console.log(`Ready! Logged in as ${readyClient.user.tag}`);
|
console.log(`Ready! Logged in as ${readyClient.user.tag}`);
|
||||||
});
|
});
|
||||||
|
@ -70,9 +72,7 @@ client.on('ready', () => {
|
||||||
|
|
||||||
console.log("Updating on boot");
|
console.log("Updating on boot");
|
||||||
|
|
||||||
let date = new Date().toISOString().
|
let date = new Date().toLocaleString('th-TH');
|
||||||
replace(/T/, ' '). // replace T with a space
|
|
||||||
replace(/\..+/, '')
|
|
||||||
|
|
||||||
let caption = `# Weather Update\n## ${date}\n${radar_caption}`
|
let caption = `# Weather Update\n## ${date}\n${radar_caption}`
|
||||||
|
|
||||||
|
@ -107,11 +107,9 @@ client.on('ready', () => {
|
||||||
await channel.messages.delete(message_id);
|
await channel.messages.delete(message_id);
|
||||||
console.log("Delete old message");
|
console.log("Delete old message");
|
||||||
|
|
||||||
let date = new Date().toISOString().
|
let date = new Date().toLocaleString('th-TH');
|
||||||
replace(/T/, ' '). // replace T with a space
|
|
||||||
replace(/\..+/, '')
|
|
||||||
|
|
||||||
let caption = `# Weather Update\n## ${date} Asia/Bangkok\n${radar_caption}`
|
let caption = `# Weather Update\n## ${date}\n${radar_caption}`
|
||||||
|
|
||||||
let message = await channel.send({
|
let message = await channel.send({
|
||||||
content: caption,
|
content: caption,
|
||||||
|
|
Loading…
Reference in New Issue