mirror of
https://github.com/discordeno/discordeno.git
synced 2026-06-16 19:28:17 +00:00
moves random function
This commit is contained in:
@@ -27,4 +27,5 @@ export * from "./src/util/cache.ts";
|
|||||||
export * from "./src/util/collection.ts";
|
export * from "./src/util/collection.ts";
|
||||||
export * from "./src/util/permissions.ts";
|
export * from "./src/util/permissions.ts";
|
||||||
export * from "./src/util/utils.ts";
|
export * from "./src/util/utils.ts";
|
||||||
|
export * from "./src/util/random.ts";
|
||||||
export * from "./src/ws/mod.ts";
|
export * from "./src/ws/mod.ts";
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
import { chooseRandom } from "./utils.ts";
|
import { chooseRandom } from "./random.ts";
|
||||||
|
|
||||||
export class Collection<K, V> extends Map<K, V> {
|
export class Collection<K, V> extends Map<K, V> {
|
||||||
maxSize?: number;
|
maxSize?: number;
|
||||||
|
|||||||
@@ -0,0 +1,3 @@
|
|||||||
|
export function chooseRandom<T>(array: T[]) {
|
||||||
|
return array[Math.floor(Math.random() * array.length)];
|
||||||
|
}
|
||||||
@@ -27,10 +27,6 @@ export function editBotsStatus(
|
|||||||
sendGatewayCommand("EDIT_BOTS_STATUS", { status, game: { name, type } });
|
sendGatewayCommand("EDIT_BOTS_STATUS", { status, game: { name, type } });
|
||||||
}
|
}
|
||||||
|
|
||||||
export function chooseRandom<T>(array: T[]) {
|
|
||||||
return array[Math.floor(Math.random() * array.length)];
|
|
||||||
}
|
|
||||||
|
|
||||||
export async function urlToBase64(url: string) {
|
export async function urlToBase64(url: string) {
|
||||||
const buffer = await fetch(url).then((res) => res.arrayBuffer());
|
const buffer = await fetch(url).then((res) => res.arrayBuffer());
|
||||||
const imageStr = encode(buffer);
|
const imageStr = encode(buffer);
|
||||||
|
|||||||
Reference in New Issue
Block a user