Skip to content

Commit

Permalink
Apply some suggestions
Browse files Browse the repository at this point in the history
  • Loading branch information
fwqaaq committed Apr 10, 2024
1 parent dea338a commit 67124e8
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 11 deletions.
5 changes: 0 additions & 5 deletions deno.jsonc
Original file line number Diff line number Diff line change
Expand Up @@ -30,10 +30,5 @@
"./package-lock.json",
"./bundling/bundles"
]
},
"imports": {
"@std/path": "jsr:@std/path@^0.221.0",
"grammy_types": "https://deno.land/x/[email protected]/mod.ts",
"debug": "https://cdn.skypack.dev/[email protected]"
}
}
2 changes: 1 addition & 1 deletion src/platform.deno.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
export const isDeno = typeof Deno !== "undefined";

// === Export debug
import debug from "debug";
import debug from "https://cdn.skypack.dev/debug@4.3.4";
export { debug };
const DEBUG = "DEBUG";
if (isDeno) {
Expand Down
12 changes: 7 additions & 5 deletions src/types.deno.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
// === Needed imports
import { basename } from "@std/path";
import { basename } from "jsr:@std/path@^0.221.0";
import { iterateReader } from "jsr:@std/io@^0.221.0";

import {
type ApiMethods as ApiMethodsF,
type InputMedia as InputMediaF,
Expand All @@ -10,13 +12,13 @@ import {
type InputMediaVideo as InputMediaVideoF,
type InputSticker as InputStickerF,
type Opts as OptsF,
} from "grammy_types";
} from "https://deno.land/x/grammy_types@v3.6.2/mod.ts";
import { debug as d, isDeno } from "./platform.deno.ts";

const debug = d("grammy:warn");

// === Export all API types
export * from "grammy_types";
export * from "https://deno.land/x/grammy_types@v3.6.2/mod.ts";

/** A value, or a potentially async function supplying that value */
type MaybeSupplier<T> = T | (() => T | Promise<T>);
Expand Down Expand Up @@ -114,10 +116,10 @@ export class InputFile {
);
}
using file = await Deno.open(data);
return file.readable;
return iterateReader(file);
}
if (data instanceof Blob) return data.stream();
if (isDenoFile(data)) return data.readable;
if (isDenoFile(data)) return iterateReader(data);
// Handle Response objects
if (data instanceof Response) {
if (data.body === null) throw new Error(`No response body!`);
Expand Down

0 comments on commit 67124e8

Please sign in to comment.