scripts/list.ts (view raw)
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 |
import client, { rest } from "@/discord";
import config from "../src/config.ts";
import { codeBlock, Events, Routes } from "discord.js";
await client.login(config.discord.token)
client.on(Events.ClientReady, async (client) => {
const servers = await client.guilds.fetch()
console.log(`You are in ${servers.size} servers!`)
for (const [id, server] of servers) {
console.log(id, server.name)
const channels = await client.guilds.cache.get(id)?.channels.fetch()
if (!channels) continue
for (const [id, channel] of channels) {
// console.log(`\t${id}, ${channel?.name}`)
if (id === "1478940790112915486") {
if (!channel?.isSendable()) continue
// await channel.send("??? that returned an error but the message did go through good job discord")
const messages = await channel.messages.fetch({ limit: 100 })
for (const [id, message] of messages) {
console.log(`${message.author.tag} ${message.content}`)
}
}
}
}
})
|