cry over ts

v2
Kit Kasune 2 years ago
parent d7efeb7b16
commit cca831a86b
  1. 1
      .gitignore
  2. 2
      bot.js
  3. 16
      src/json/config.json
  4. 16
      src/util/json/config.json
  5. 5
      src/util/log/log.js
  6. 11
      src/util/ts/log/getlevel.ts
  7. 0
      src/util/ts/log/levels.json
  8. 25
      src/util/ts/log/log.ts
  9. 0
      src/util/ts/log/types.ts
  10. 1
      src/util/util/ts/log/getlevel.d.ts
  11. 20
      src/util/util/ts/log/getlevel.js
  12. 5
      src/util/util/ts/log/levels.json
  13. 17
      src/util/util/ts/log/log.d.ts
  14. 8
      src/util/util/ts/log/log.js
  15. 0
      src/util/util/ts/log/types.d.ts
  16. 0
      src/util/util/ts/log/types.js

1
.gitignore vendored

@ -1,5 +1,4 @@
node_modules/
config.json
auth.json
test.js
/.idea/

@ -1,4 +1,4 @@
const logger = require('./src/util/log/log');
const logger = require('./src/util/ts/log/log');
const client = {test: 'e', config: {logLevel: 1}};
const log = logger(client);
log();

@ -0,0 +1,16 @@
{
"log": {
"suffix": ">>",
"defaultLevel": 1,
"colors": {
"error": "",
"warn": "",
"success": "",
"notice": "",
"primary": "",
"secondary": "",
"altprimary": "",
"altsecondary": ""
}
}
}

@ -0,0 +1,16 @@
{
"log": {
"suffix": ">>",
"defaultLevel": 1,
"colors": {
"error": "",
"warn": "",
"success": "",
"notice": "",
"primary": "",
"secondary": "",
"altprimary": "",
"altsecondary": ""
}
}
}

@ -1,5 +0,0 @@
const getLevel = require('./getlevel');
module.exports = client => (message, level, source, color) => {
};

@ -1,9 +1,8 @@
const config = require('../../json/config.json');
const levels = require('./levels.json');
import config = require('../../../json/config.json');
import levels = require('./levels.json');
const validStrings = Object.keys(levels);
const getLevel = (level) => {
console.log(level)
const getLevel = (level: string | number): number => {
if (typeof level === 'number') {
if (level <= 0) {return 0;}
if (level > 3) {return 3;}
@ -12,6 +11,4 @@ const getLevel = (level) => {
const levelM = `${level}`.trim().toUpperCase();
return validStrings.includes(levelM) ? levels[levelM] : typeof config.log.defaultLevel === 'number' ? getLevel(config.log.defaultLevel) : 1;
}
};
module.exports = getLevel;
};

@ -0,0 +1,25 @@
import {Client} from "discord.js";
function color() {};
export const log = (client: Client) => (log: any | LogOptionsObject = "Test Log", options?: LogOptionsObject) => {
};
export interface LogOptionsObject {
message?: any,
level?: string | number,
source?: string | {
text?: string,
color?: Color
},
color?: Color,
suffix?: string
}
export interface ColorObject {
type: "hex" | "default",
color: string
}
export type Color = string | ColorObject;

@ -0,0 +1 @@
export {};

@ -0,0 +1,20 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const config = require("../../../json/config.json");
const levels = require("./levels.json");
const validStrings = Object.keys(levels);
const getLevel = (level) => {
if (typeof level === 'number') {
if (level <= 0) {
return 0;
}
if (level > 3) {
return 3;
}
return Math.floor(level);
}
else {
const levelM = `${level}`.trim().toUpperCase();
return validStrings.includes(levelM) ? levels[levelM] : typeof config.log.defaultLevel === 'number' ? getLevel(config.log.defaultLevel) : 1;
}
};

@ -0,0 +1,5 @@
{
"TOP": 0,
"STANDARD": 1,
"VERBOSE": 2
}

@ -0,0 +1,17 @@
import { Client } from "discord.js";
export declare const log: (client: Client) => (log?: any | LogOptionsObject, options?: LogOptionsObject) => void;
export interface LogOptionsObject {
message?: any;
level?: string | number;
source?: string | {
text?: string;
color?: Color;
};
color?: Color;
suffix?: string;
}
export interface ColorObject {
type: "hex" | "default";
color: string;
}
export declare type Color = string | ColorObject;

@ -0,0 +1,8 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.log = void 0;
function color() { }
;
const log = (client) => (log = "Test Log", options) => {
};
exports.log = log;
Loading…
Cancel
Save