You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
29 lines
697 B
29 lines
697 B
import Surreal from "https://deno.land/x/surrealdb@v0.5.0/mod.ts";
|
|
import config from "./config.ts";
|
|
import { GoofyAhhException } from "./bot.ts";
|
|
|
|
export const db = new Surreal(`${config.general.db.url}/rpc`);
|
|
|
|
export interface Channel {
|
|
moduleName: string;
|
|
name: string;
|
|
description: string;
|
|
history: {
|
|
name: string;
|
|
content: string;
|
|
}[];
|
|
}
|
|
|
|
export default async function init() {
|
|
try {
|
|
await db.signin({
|
|
user: config.general.db.user,
|
|
pass: config.general.db.pass,
|
|
});
|
|
|
|
await db.use(config.general.db.namespace, config.general.db.database);
|
|
} catch (e) {
|
|
throw new GoofyAhhException(e);
|
|
}
|
|
}
|