mirror of
https://github.com/blitzkit/blitzkit.git
synced 2026-10-23 11:39:50 +02:00
feat: start of monorepo
This commit is contained in:
1 parent
14f39d71ac
commit
73c7bdf0c0
260 files changed
+1236
-1235
No files matched your search
@@ -0,0 +1,31 @@
|
||||
import { Region } from '../../constants/regions';
|
||||
|
||||
export const MIN_REGION_IDS: Record<Region, number> = {
|
||||
asia: 20e8,
|
||||
com: 10e8,
|
||||
eu: 5e8,
|
||||
};
|
||||
|
||||
export const MAX_REGION_IDS: Record<Region, number> = {
|
||||
asia: 31e8 - 1,
|
||||
com: MIN_REGION_IDS.asia - 1,
|
||||
eu: MIN_REGION_IDS.com - 1,
|
||||
};
|
||||
|
||||
export function idToRegion(id: number): Region {
|
||||
if (id >= 42e8) {
|
||||
throw new Error('bot id');
|
||||
} else if (id >= 31e8) {
|
||||
throw new Error('china id');
|
||||
} else if (id >= 20e8) {
|
||||
return 'asia';
|
||||
} else if (id >= 10e8) {
|
||||
return 'com';
|
||||
} else if (id >= 5e8) {
|
||||
return 'eu';
|
||||
} else if (id >= 0) {
|
||||
throw new Error('ru id');
|
||||
} else {
|
||||
throw new Error(`id ${id} is out of range`);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
export * from './idToRegion';
|
||||
Reference in new issue
Block a user