out-of-your-element/index.js

34 lines
746 B
JavaScript
Raw Normal View History

2023-04-25 20:06:08 +00:00
// @ts-check
2023-05-04 20:25:00 +00:00
const sqlite = require("better-sqlite3")
2023-03-05 16:05:35 +00:00
const HeatSync = require("heatsync")
2022-12-07 00:10:31 +00:00
const config = require("./config")
2023-03-05 16:05:35 +00:00
const passthrough = require("./passthrough")
2023-05-04 20:25:00 +00:00
const db = new sqlite("db/ooye.db")
2023-03-05 16:05:35 +00:00
const sync = new HeatSync()
2023-06-28 20:08:17 +00:00
Object.assign(passthrough, {config, sync, db})
2023-03-05 16:05:35 +00:00
2023-04-25 20:06:08 +00:00
const DiscordClient = require("./d2m/discord-client")
2022-12-07 00:10:31 +00:00
2023-07-10 22:10:47 +00:00
const discord = new DiscordClient(config.discordToken, true)
2023-03-05 16:05:35 +00:00
passthrough.discord = discord
2023-06-28 20:08:17 +00:00
const as = require("./m2d/appservice")
passthrough.as = as
sync.require("./m2d/event-dispatcher")
2023-07-04 20:41:15 +00:00
discord.snow.requestHandler.on("requestError", data => {
console.error("request error", data)
})
2023-03-05 16:05:35 +00:00
;(async () => {
await discord.cloud.connect()
console.log("Discord gateway started")
require("./stdin")
})()