llonebot-dist 7.0.1 → 7.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (83) hide show
  1. package/llonebot.js +2336 -10459
  2. package/llonebot.js.map +1 -1
  3. package/node_modules/cosmokit/LICENSE +21 -0
  4. package/node_modules/cosmokit/README.md +24 -0
  5. package/node_modules/cosmokit/lib/index.cjs +463 -0
  6. package/node_modules/cosmokit/lib/index.cjs.map +6 -0
  7. package/node_modules/cosmokit/lib/index.d.ts +142 -0
  8. package/node_modules/cosmokit/lib/index.mjs +403 -0
  9. package/node_modules/cosmokit/lib/index.mjs.map +6 -0
  10. package/node_modules/cosmokit/package.json +56 -0
  11. package/node_modules/cosmokit/src/array.ts +35 -0
  12. package/node_modules/cosmokit/src/index.ts +5 -0
  13. package/node_modules/cosmokit/src/misc.ts +57 -0
  14. package/node_modules/cosmokit/src/string.ts +101 -0
  15. package/node_modules/cosmokit/src/time.ts +91 -0
  16. package/node_modules/cosmokit/src/types.ts +129 -0
  17. package/node_modules/has-flag/index.d.ts +39 -0
  18. package/node_modules/has-flag/index.js +8 -0
  19. package/node_modules/has-flag/license +9 -0
  20. package/node_modules/has-flag/package.json +46 -0
  21. package/node_modules/has-flag/readme.md +89 -0
  22. package/node_modules/object-inspect/CHANGELOG.md +424 -0
  23. package/node_modules/object-inspect/LICENSE +21 -0
  24. package/node_modules/object-inspect/example/all.js +23 -0
  25. package/node_modules/object-inspect/example/circular.js +6 -0
  26. package/node_modules/object-inspect/example/fn.js +5 -0
  27. package/node_modules/object-inspect/example/inspect.js +10 -0
  28. package/node_modules/object-inspect/index.js +544 -0
  29. package/node_modules/object-inspect/package-support.json +20 -0
  30. package/node_modules/object-inspect/package.json +105 -0
  31. package/node_modules/object-inspect/readme.markdown +84 -0
  32. package/node_modules/object-inspect/test/bigint.js +58 -0
  33. package/node_modules/object-inspect/test/browser/dom.js +15 -0
  34. package/node_modules/object-inspect/test/circular.js +16 -0
  35. package/node_modules/object-inspect/test/deep.js +12 -0
  36. package/node_modules/object-inspect/test/element.js +53 -0
  37. package/node_modules/object-inspect/test/err.js +48 -0
  38. package/node_modules/object-inspect/test/fakes.js +29 -0
  39. package/node_modules/object-inspect/test/fn.js +76 -0
  40. package/node_modules/object-inspect/test/global.js +17 -0
  41. package/node_modules/object-inspect/test/has.js +15 -0
  42. package/node_modules/object-inspect/test/holes.js +15 -0
  43. package/node_modules/object-inspect/test/indent-option.js +271 -0
  44. package/node_modules/object-inspect/test/inspect.js +139 -0
  45. package/node_modules/object-inspect/test/lowbyte.js +12 -0
  46. package/node_modules/object-inspect/test/number.js +58 -0
  47. package/node_modules/object-inspect/test/quoteStyle.js +26 -0
  48. package/node_modules/object-inspect/test/toStringTag.js +40 -0
  49. package/node_modules/object-inspect/test/undef.js +12 -0
  50. package/node_modules/object-inspect/test/values.js +261 -0
  51. package/node_modules/object-inspect/test-core-js.js +26 -0
  52. package/node_modules/object-inspect/util.inspect.js +1 -0
  53. package/node_modules/reggol/LICENSE +21 -0
  54. package/node_modules/reggol/README.md +8 -0
  55. package/node_modules/reggol/index.d.ts +79 -0
  56. package/node_modules/reggol/lib/browser.mjs +299 -0
  57. package/node_modules/reggol/lib/node.js +31 -0
  58. package/node_modules/reggol/lib/shared.js +258 -0
  59. package/node_modules/reggol/lib/shared.mjs +266 -0
  60. package/node_modules/reggol/node_modules/supports-color/browser.js +24 -0
  61. package/node_modules/reggol/node_modules/supports-color/index.js +152 -0
  62. package/node_modules/reggol/node_modules/supports-color/license +9 -0
  63. package/node_modules/reggol/node_modules/supports-color/package.json +58 -0
  64. package/node_modules/reggol/node_modules/supports-color/readme.md +77 -0
  65. package/node_modules/reggol/package.json +65 -0
  66. package/node_modules/reggol/src/browser.ts +8 -0
  67. package/node_modules/reggol/src/index.ts +3 -0
  68. package/node_modules/reggol/src/node.ts +8 -0
  69. package/node_modules/reggol/src/shared.ts +249 -0
  70. package/node_modules/supports-color/browser.d.ts +1 -0
  71. package/node_modules/supports-color/browser.js +35 -0
  72. package/node_modules/supports-color/index.d.ts +55 -0
  73. package/node_modules/supports-color/index.js +202 -0
  74. package/node_modules/supports-color/license +9 -0
  75. package/node_modules/supports-color/package.json +64 -0
  76. package/node_modules/supports-color/readme.md +75 -0
  77. package/package.json +1 -1
  78. package//344/275/277/347/224/250/350/257/264/346/230/216.txt +2 -2
  79. package//346/233/264/346/226/260/346/227/245/345/277/227.txt +23 -0
  80. package/webui/assets/index-DH65Wt1j.css +0 -1
  81. package/webui/assets/index-fRyBxWld.js +0 -273
  82. package/webui/index.html +0 -13
  83. package/webui/logo.jpg +0 -0
@@ -0,0 +1,91 @@
1
+ export namespace Time {
2
+ export const millisecond = 1
3
+ export const second = 1000
4
+ export const minute = second * 60
5
+ export const hour = minute * 60
6
+ export const day = hour * 24
7
+ export const week = day * 7
8
+
9
+ let timezoneOffset = new Date().getTimezoneOffset()
10
+
11
+ export function setTimezoneOffset(offset: number) {
12
+ timezoneOffset = offset
13
+ }
14
+
15
+ export function getTimezoneOffset() {
16
+ return timezoneOffset
17
+ }
18
+
19
+ export function getDateNumber(date: number | Date = new Date(), offset?: number) {
20
+ if (typeof date === 'number') date = new Date(date)
21
+ if (offset === undefined) offset = timezoneOffset
22
+ return Math.floor((date.valueOf() / minute - offset) / 1440)
23
+ }
24
+
25
+ export function fromDateNumber(value: number, offset?: number) {
26
+ const date = new Date(value * day)
27
+ if (offset === undefined) offset = timezoneOffset
28
+ return new Date(+date + offset * minute)
29
+ }
30
+
31
+ const numeric = /\d+(?:\.\d+)?/.source
32
+ const timeRegExp = new RegExp(`^${[
33
+ 'w(?:eek(?:s)?)?',
34
+ 'd(?:ay(?:s)?)?',
35
+ 'h(?:our(?:s)?)?',
36
+ 'm(?:in(?:ute)?(?:s)?)?',
37
+ 's(?:ec(?:ond)?(?:s)?)?',
38
+ ].map(unit => `(${numeric}${unit})?`).join('')}$`)
39
+
40
+ export function parseTime(source: string) {
41
+ const capture = timeRegExp.exec(source)
42
+ if (!capture) return 0
43
+ return (parseFloat(capture[1]) * week || 0)
44
+ + (parseFloat(capture[2]) * day || 0)
45
+ + (parseFloat(capture[3]) * hour || 0)
46
+ + (parseFloat(capture[4]) * minute || 0)
47
+ + (parseFloat(capture[5]) * second || 0)
48
+ }
49
+
50
+ export function parseDate(date: string) {
51
+ const parsed = parseTime(date)
52
+ if (parsed) {
53
+ date = Date.now() + parsed as any
54
+ } else if (/^\d{1,2}(:\d{1,2}){1,2}$/.test(date)) {
55
+ date = `${new Date().toLocaleDateString()}-${date}`
56
+ } else if (/^\d{1,2}-\d{1,2}-\d{1,2}(:\d{1,2}){1,2}$/.test(date)) {
57
+ date = `${new Date().getFullYear()}-${date}`
58
+ }
59
+ return date ? new Date(date) : new Date()
60
+ }
61
+
62
+ export function format(ms: number) {
63
+ const abs = Math.abs(ms)
64
+ if (abs >= day - hour / 2) {
65
+ return Math.round(ms / day) + 'd'
66
+ } else if (abs >= hour - minute / 2) {
67
+ return Math.round(ms / hour) + 'h'
68
+ } else if (abs >= minute - second / 2) {
69
+ return Math.round(ms / minute) + 'm'
70
+ } else if (abs >= second) {
71
+ return Math.round(ms / second) + 's'
72
+ }
73
+ return ms + 'ms'
74
+ }
75
+
76
+ export function toDigits(source: number, length = 2) {
77
+ return source.toString().padStart(length, '0')
78
+ }
79
+
80
+ export function template(template: string, time = new Date()) {
81
+ return template
82
+ .replace('yyyy', time.getFullYear().toString())
83
+ .replace('yy', time.getFullYear().toString().slice(2))
84
+ .replace('MM', toDigits(time.getMonth() + 1))
85
+ .replace('dd', toDigits(time.getDate()))
86
+ .replace('hh', toDigits(time.getHours()))
87
+ .replace('mm', toDigits(time.getMinutes()))
88
+ .replace('ss', toDigits(time.getSeconds()))
89
+ .replace('SSS', toDigits(time.getMilliseconds(), 3))
90
+ }
91
+ }
@@ -0,0 +1,129 @@
1
+ import { isNullable } from './misc'
2
+
3
+ type GlobalConstructorNames = keyof {
4
+ [K in keyof typeof globalThis as typeof globalThis[K] extends abstract new (...args: any) => any ? K : never]: K
5
+ }
6
+
7
+ export function is<K extends GlobalConstructorNames>(type: K): (value: any) => value is InstanceType<typeof globalThis[K]>
8
+ export function is<K extends GlobalConstructorNames>(type: K, value: any): value is InstanceType<typeof globalThis[K]>
9
+ export function is<K extends GlobalConstructorNames>(type: K, value?: any): any {
10
+ if (arguments.length === 1) return (value: any) => is(type, value)
11
+ return type in globalThis && value instanceof (globalThis[type] as any)
12
+ || Object.prototype.toString.call(value).slice(8, -1) === type
13
+ }
14
+
15
+ function isArrayBufferLike(value: any): value is ArrayBufferLike {
16
+ return is('ArrayBuffer', value) || is('SharedArrayBuffer', value)
17
+ }
18
+
19
+ function isArrayBufferSource(value: any): value is Binary.Source {
20
+ return isArrayBufferLike(value) || ArrayBuffer.isView(value)
21
+ }
22
+
23
+ export namespace Binary {
24
+ export type Source<T extends ArrayBufferLike = ArrayBufferLike> = T | ArrayBufferView<T>
25
+
26
+ export const is = isArrayBufferLike
27
+ export const isSource = isArrayBufferSource
28
+
29
+ export function fromSource<T extends ArrayBufferLike>(source: Source<T>): T {
30
+ if (ArrayBuffer.isView(source)) {
31
+ // https://stackoverflow.com/questions/8609289/convert-a-binary-nodejs-buffer-to-javascript-arraybuffer#answer-31394257
32
+ return source.buffer.slice(source.byteOffset, source.byteOffset + source.byteLength) as T
33
+ } else {
34
+ return source
35
+ }
36
+ }
37
+
38
+ export function toBase64(source: ArrayBufferLike) {
39
+ if (typeof Buffer !== 'undefined') {
40
+ return Buffer.from(source).toString('base64')
41
+ }
42
+ let binary = ''
43
+ const bytes = new Uint8Array(source)
44
+ for (let i = 0; i < bytes.byteLength; i++) {
45
+ binary += String.fromCharCode(bytes[i])
46
+ }
47
+ return btoa(binary)
48
+ }
49
+
50
+ export function fromBase64(source: string) {
51
+ if (typeof Buffer !== 'undefined') return fromSource(Buffer.from(source, 'base64'))
52
+ return Uint8Array.from(atob(source), c => c.charCodeAt(0))
53
+ }
54
+
55
+ export function toHex(source: ArrayBufferLike) {
56
+ if (typeof Buffer !== 'undefined') return Buffer.from(source).toString('hex')
57
+ return Array.from(new Uint8Array(source), byte => byte.toString(16).padStart(2, '0')).join('')
58
+ }
59
+
60
+ export function fromHex(source: string) {
61
+ if (typeof Buffer !== 'undefined') return fromSource(Buffer.from(source, 'hex'))
62
+ const hex = source.length % 2 === 0 ? source : source.slice(0, source.length - 1)
63
+ const buffer: number[] = []
64
+ for (let i = 0; i < hex.length; i += 2) {
65
+ buffer.push(parseInt(`${hex[i]}${hex[i + 1]}`, 16))
66
+ }
67
+ return Uint8Array.from(buffer).buffer
68
+ }
69
+ }
70
+
71
+ export const base64ToArrayBuffer = Binary.fromBase64
72
+ export const arrayBufferToBase64 = Binary.toBase64
73
+ export const hexToArrayBuffer = Binary.fromHex
74
+ export const arrayBufferToHex = Binary.toHex
75
+
76
+ export function clone<T>(source: T): T
77
+ export function clone(source: any, refs = new Map<any, any>()) {
78
+ if (!source || typeof source !== 'object') return source
79
+ if (is('Date', source)) return new Date(source.valueOf())
80
+ if (is('RegExp', source)) return new RegExp(source.source, source.flags)
81
+ if (isArrayBufferLike(source)) return source.slice(0)
82
+ if (ArrayBuffer.isView(source)) return source.buffer.slice(source.byteOffset, source.byteOffset + source.byteLength)
83
+ const cached = refs.get(source)
84
+ if (cached) return cached
85
+ if (Array.isArray(source)) {
86
+ const result: any[] = []
87
+ refs.set(source, result)
88
+ source.forEach((value, index) => {
89
+ result[index] = Reflect.apply(clone, null, [value, refs])
90
+ })
91
+ return result
92
+ }
93
+ const result = Object.create(Object.getPrototypeOf(source))
94
+ refs.set(source, result)
95
+ for (const key of Reflect.ownKeys(source)) {
96
+ const descriptor = { ...Reflect.getOwnPropertyDescriptor(source, key) }
97
+ if ('value' in descriptor) {
98
+ descriptor.value = Reflect.apply(clone, null, [descriptor.value, refs])
99
+ }
100
+ Reflect.defineProperty(result, key, descriptor)
101
+ }
102
+ return result
103
+ }
104
+
105
+ export function deepEqual(a: any, b: any, strict?: boolean): boolean {
106
+ if (a === b) return true
107
+ if (!strict && isNullable(a) && isNullable(b)) return true
108
+ if (typeof a !== typeof b) return false
109
+ if (typeof a !== 'object') return false
110
+ if (!a || !b) return false
111
+
112
+ function check<T>(test: (x: any) => x is T, then: (a: T, b: T) => boolean) {
113
+ return test(a) ? test(b) ? then(a, b) : false : test(b) ? false : undefined
114
+ }
115
+
116
+ return check(Array.isArray, (a, b) => a.length === b.length && a.every((item, index) => deepEqual(item, b[index])))
117
+ ?? check(is('Date'), (a, b) => a.valueOf() === b.valueOf())
118
+ ?? check(is('RegExp'), (a, b) => a.source === b.source && a.flags === b.flags)
119
+ ?? check(isArrayBufferLike, (a, b) => {
120
+ if (a.byteLength !== b.byteLength) return false
121
+ const viewA = new Uint8Array(a)
122
+ const viewB = new Uint8Array(b)
123
+ for (let i = 0; i < viewA.length; i++) {
124
+ if (viewA[i] !== viewB[i]) return false
125
+ }
126
+ return true
127
+ })
128
+ ?? Object.keys({ ...a, ...b }).every(key => deepEqual(a[key], b[key], strict))
129
+ }
@@ -0,0 +1,39 @@
1
+ /**
2
+ Check if [`argv`](https://nodejs.org/docs/latest/api/process.html#process_process_argv) has a specific flag.
3
+
4
+ @param flag - CLI flag to look for. The `--` prefix is optional.
5
+ @param argv - CLI arguments. Default: `process.argv`.
6
+ @returns Whether the flag exists.
7
+
8
+ @example
9
+ ```
10
+ // $ ts-node foo.ts -f --unicorn --foo=bar -- --rainbow
11
+
12
+ // foo.ts
13
+ import hasFlag = require('has-flag');
14
+
15
+ hasFlag('unicorn');
16
+ //=> true
17
+
18
+ hasFlag('--unicorn');
19
+ //=> true
20
+
21
+ hasFlag('f');
22
+ //=> true
23
+
24
+ hasFlag('-f');
25
+ //=> true
26
+
27
+ hasFlag('foo=bar');
28
+ //=> true
29
+
30
+ hasFlag('foo');
31
+ //=> false
32
+
33
+ hasFlag('rainbow');
34
+ //=> false
35
+ ```
36
+ */
37
+ declare function hasFlag(flag: string, argv?: string[]): boolean;
38
+
39
+ export = hasFlag;
@@ -0,0 +1,8 @@
1
+ 'use strict';
2
+
3
+ module.exports = (flag, argv = process.argv) => {
4
+ const prefix = flag.startsWith('-') ? '' : (flag.length === 1 ? '-' : '--');
5
+ const position = argv.indexOf(prefix + flag);
6
+ const terminatorPosition = argv.indexOf('--');
7
+ return position !== -1 && (terminatorPosition === -1 || position < terminatorPosition);
8
+ };
@@ -0,0 +1,9 @@
1
+ MIT License
2
+
3
+ Copyright (c) Sindre Sorhus <sindresorhus@gmail.com> (sindresorhus.com)
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
6
+
7
+ The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
8
+
9
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
@@ -0,0 +1,46 @@
1
+ {
2
+ "name": "has-flag",
3
+ "version": "4.0.0",
4
+ "description": "Check if argv has a specific flag",
5
+ "license": "MIT",
6
+ "repository": "sindresorhus/has-flag",
7
+ "author": {
8
+ "name": "Sindre Sorhus",
9
+ "email": "sindresorhus@gmail.com",
10
+ "url": "sindresorhus.com"
11
+ },
12
+ "engines": {
13
+ "node": ">=8"
14
+ },
15
+ "scripts": {
16
+ "test": "xo && ava && tsd"
17
+ },
18
+ "files": [
19
+ "index.js",
20
+ "index.d.ts"
21
+ ],
22
+ "keywords": [
23
+ "has",
24
+ "check",
25
+ "detect",
26
+ "contains",
27
+ "find",
28
+ "flag",
29
+ "cli",
30
+ "command-line",
31
+ "argv",
32
+ "process",
33
+ "arg",
34
+ "args",
35
+ "argument",
36
+ "arguments",
37
+ "getopt",
38
+ "minimist",
39
+ "optimist"
40
+ ],
41
+ "devDependencies": {
42
+ "ava": "^1.4.1",
43
+ "tsd": "^0.7.2",
44
+ "xo": "^0.24.0"
45
+ }
46
+ }
@@ -0,0 +1,89 @@
1
+ # has-flag [![Build Status](https://travis-ci.org/sindresorhus/has-flag.svg?branch=master)](https://travis-ci.org/sindresorhus/has-flag)
2
+
3
+ > Check if [`argv`](https://nodejs.org/docs/latest/api/process.html#process_process_argv) has a specific flag
4
+
5
+ Correctly stops looking after an `--` argument terminator.
6
+
7
+ ---
8
+
9
+ <div align="center">
10
+ <b>
11
+ <a href="https://tidelift.com/subscription/pkg/npm-has-flag?utm_source=npm-has-flag&utm_medium=referral&utm_campaign=readme">Get professional support for this package with a Tidelift subscription</a>
12
+ </b>
13
+ <br>
14
+ <sub>
15
+ Tidelift helps make open source sustainable for maintainers while giving companies<br>assurances about security, maintenance, and licensing for their dependencies.
16
+ </sub>
17
+ </div>
18
+
19
+ ---
20
+
21
+
22
+ ## Install
23
+
24
+ ```
25
+ $ npm install has-flag
26
+ ```
27
+
28
+
29
+ ## Usage
30
+
31
+ ```js
32
+ // foo.js
33
+ const hasFlag = require('has-flag');
34
+
35
+ hasFlag('unicorn');
36
+ //=> true
37
+
38
+ hasFlag('--unicorn');
39
+ //=> true
40
+
41
+ hasFlag('f');
42
+ //=> true
43
+
44
+ hasFlag('-f');
45
+ //=> true
46
+
47
+ hasFlag('foo=bar');
48
+ //=> true
49
+
50
+ hasFlag('foo');
51
+ //=> false
52
+
53
+ hasFlag('rainbow');
54
+ //=> false
55
+ ```
56
+
57
+ ```
58
+ $ node foo.js -f --unicorn --foo=bar -- --rainbow
59
+ ```
60
+
61
+
62
+ ## API
63
+
64
+ ### hasFlag(flag, [argv])
65
+
66
+ Returns a boolean for whether the flag exists.
67
+
68
+ #### flag
69
+
70
+ Type: `string`
71
+
72
+ CLI flag to look for. The `--` prefix is optional.
73
+
74
+ #### argv
75
+
76
+ Type: `string[]`<br>
77
+ Default: `process.argv`
78
+
79
+ CLI arguments.
80
+
81
+
82
+ ## Security
83
+
84
+ To report a security vulnerability, please use the [Tidelift security contact](https://tidelift.com/security). Tidelift will coordinate the fix and disclosure.
85
+
86
+
87
+ ## License
88
+
89
+ MIT © [Sindre Sorhus](https://sindresorhus.com)