|
|
@ -1,6 +1,6 @@ |
|
|
|
import assert from "assert"; |
|
|
|
import assert from "assert"; |
|
|
|
import logging from '../lib/logging.js'; |
|
|
|
import logging from '../lib/logging.js'; |
|
|
|
import { Client, IntentsBitField, Partials } from "discord.js"; |
|
|
|
import { Client, IntentsBitField, Partials, ChannelType } from "discord.js"; |
|
|
|
import { User } from "../lib/models.js"; |
|
|
|
import { User } from "../lib/models.js"; |
|
|
|
import { company } from '../emails/config.js'; |
|
|
|
import { company } from '../emails/config.js'; |
|
|
|
import { discord } from "../lib/config.js"; |
|
|
|
import { discord } from "../lib/config.js"; |
|
|
@ -27,8 +27,8 @@ const load_guild_channel = async (client) => { |
|
|
|
const channels = await guild.channels.fetch(); |
|
|
|
const channels = await guild.channels.fetch(); |
|
|
|
|
|
|
|
|
|
|
|
for(let chan of channels.entries()) { |
|
|
|
for(let chan of channels.entries()) { |
|
|
|
if(chan[1].type === "GUILD_TEXT") { |
|
|
|
if(chan[1].type === ChannelType.GuildText) { |
|
|
|
// remember, return await puts the errors here
|
|
|
|
log.info(`Found guild text channel ${JSON.stringify(chan[1])}`); |
|
|
|
return [guild, await chan[1].fetch()]; |
|
|
|
return [guild, await chan[1].fetch()]; |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
@ -43,8 +43,8 @@ await client.login(discord.token); |
|
|
|
const [guild, channel] = await load_guild_channel(client); |
|
|
|
const [guild, channel] = await load_guild_channel(client); |
|
|
|
|
|
|
|
|
|
|
|
// if it doesn't exist make it and add it to their account
|
|
|
|
// if it doesn't exist make it and add it to their account
|
|
|
|
log.info("Connected to Sever/Guild", guild.name); |
|
|
|
log.info(`Connected to Sever/Guild ${guild.name}`); |
|
|
|
log.info("Sending invites from Channel", channel.name); |
|
|
|
log.info(`!!Sending invites from Channel ${JSON.stringify(channel, null, 4)}`); |
|
|
|
|
|
|
|
|
|
|
|
const invite_email = await load_templates("discord_email"); |
|
|
|
const invite_email = await load_templates("discord_email"); |
|
|
|
|
|
|
|
|
|
|
|