-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtestMidjourneyMessage.js
39 lines (32 loc) · 1.05 KB
/
testMidjourneyMessage.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
require('dotenv').config({ path: __dirname + '/.env' })
var downloadPhoto = require("./utility/downloadPhoto.js");
var util = require("util");
const { Client, Intents } = require('discord.js');
const client = new Client({
intents: [
"MessageContent",
"GuildMessages",
"Guilds"
]
});
var channelID = "1125566730761154564";
(async () => {
try {
await client.login(process.env.DISCORD_TOKEN);
console.log("LOGGED IN", client.user.tag)
const channel = await client.channels.fetch(channelID);
var messages = await channel.messages.fetch({limit:1})
if (messages && messages.first() && messages.first().attachments.first()) {
var photoURL = messages.first().attachments.first().url
console.log("New Image URL Found", photoURL);
process.exit(0);
} else {
console.log("No Messages Found");
process.exit(0);
}
} catch (err) {
console.log("DISCORD ERROR");
console.log(err);
process.exit(1);
}
})();