Skip to content

Commit

Permalink
fix: install built-in modules in a way that works when running main.t…
Browse files Browse the repository at this point in the history
…s with URL (#224)
  • Loading branch information
rojvv committed Jul 22, 2022
1 parent 900810b commit 20833a7
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 7 deletions.
9 changes: 2 additions & 7 deletions main.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { NewMessage, StringSession, TelegramClient } from "$grm";
import { dirname, fromFileUrl, join } from "./deps.ts";
import env from "./env.ts";
import modules from "./modules/mod.ts";
import { managerModule, ModuleManager } from "./module_manager.ts";

const client = new TelegramClient(
Expand All @@ -16,12 +16,7 @@ try {
} catch (_err) {
//
}
manager.installMultiple(
await ModuleManager.directory(
join(dirname(fromFileUrl(import.meta.url)), "modules"),
),
false,
);
manager.installMultiple(modules, false);
manager.install(managerModule(manager), false);
manager.installMultiple(await ModuleManager.directory("externals"), true);
client.addEventHandler(manager.handler, new NewMessage({}));
Expand Down
7 changes: 7 additions & 0 deletions modules/mod.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
import admin from "./admin/mod.ts";
import files from "./files/mod.ts";
import util from "./util/mod.ts";

const modules = [admin, files, util];

export default modules;

0 comments on commit 20833a7

Please sign in to comment.