diff --git a/.eslintcache b/.eslintcache index 7cd45f6..fc390a7 100644 --- a/.eslintcache +++ b/.eslintcache @@ -1 +1 @@ -[{"C:\\Users\\lu\\Documents\\GitHub\\test\\src\\commands\\imagine\\Imagine.ts":"1","C:\\Users\\lu\\Documents\\GitHub\\test\\src\\commands\\imagine\\Invite.ts":"2","C:\\Users\\lu\\Documents\\GitHub\\test\\src\\commands\\imagine\\Ping.ts":"3","C:\\Users\\lu\\Documents\\GitHub\\test\\src\\config.ts":"4","C:\\Users\\lu\\Documents\\GitHub\\test\\src\\events\\client\\ClientReady.ts":"5","C:\\Users\\lu\\Documents\\GitHub\\test\\src\\events\\client\\InteractionCreate.ts":"6","C:\\Users\\lu\\Documents\\GitHub\\test\\src\\index.ts":"7","C:\\Users\\lu\\Documents\\GitHub\\test\\src\\structures\\Canvas.ts":"8","C:\\Users\\lu\\Documents\\GitHub\\test\\src\\structures\\Client.ts":"9","C:\\Users\\lu\\Documents\\GitHub\\test\\src\\structures\\Command.ts":"10","C:\\Users\\lu\\Documents\\GitHub\\test\\src\\structures\\Event.ts":"11","C:\\Users\\lu\\Documents\\GitHub\\test\\src\\structures\\index.ts":"12","C:\\Users\\lu\\Documents\\GitHub\\test\\src\\structures\\Logger.ts":"13","C:\\Users\\lu\\Documents\\GitHub\\test\\src\\commands\\imagine\\About.ts":"14","C:\\Users\\lu\\Documents\\GitHub\\Midjourney\\src\\commands\\imagine\\About.ts":"15","C:\\Users\\lu\\Documents\\GitHub\\Midjourney\\src\\commands\\imagine\\Imagine.ts":"16","C:\\Users\\lu\\Documents\\GitHub\\Midjourney\\src\\commands\\imagine\\Invite.ts":"17","C:\\Users\\lu\\Documents\\GitHub\\Midjourney\\src\\commands\\imagine\\Ping.ts":"18","C:\\Users\\lu\\Documents\\GitHub\\Midjourney\\src\\config.ts":"19","C:\\Users\\lu\\Documents\\GitHub\\Midjourney\\src\\events\\client\\ClientReady.ts":"20","C:\\Users\\lu\\Documents\\GitHub\\Midjourney\\src\\events\\client\\InteractionCreate.ts":"21","C:\\Users\\lu\\Documents\\GitHub\\Midjourney\\src\\index.ts":"22","C:\\Users\\lu\\Documents\\GitHub\\Midjourney\\src\\structures\\Canvas.ts":"23","C:\\Users\\lu\\Documents\\GitHub\\Midjourney\\src\\structures\\Client.ts":"24","C:\\Users\\lu\\Documents\\GitHub\\Midjourney\\src\\structures\\Command.ts":"25","C:\\Users\\lu\\Documents\\GitHub\\Midjourney\\src\\structures\\Event.ts":"26","C:\\Users\\lu\\Documents\\GitHub\\Midjourney\\src\\structures\\index.ts":"27","C:\\Users\\lu\\Documents\\GitHub\\Midjourney\\src\\structures\\Logger.ts":"28"},{"size":3456,"mtime":1713738596647,"results":"29","hashOfConfig":"30"},{"size":1211,"mtime":1713738596647,"results":"31","hashOfConfig":"30"},{"size":1351,"mtime":1713738223574,"results":"32","hashOfConfig":"30"},{"size":267,"mtime":1713736156287,"results":"33","hashOfConfig":"30"},{"size":524,"mtime":1713739001796,"results":"34","hashOfConfig":"30"},{"size":1470,"mtime":1713738596647,"results":"35","hashOfConfig":"30"},{"size":806,"mtime":1713735956312,"results":"36","hashOfConfig":"30"},{"size":2327,"mtime":1713738667186,"results":"37","hashOfConfig":"30"},{"size":4929,"mtime":1713738960324,"results":"38","hashOfConfig":"30"},{"size":2703,"mtime":1713735956350,"results":"39","hashOfConfig":"30"},{"size":632,"mtime":1713735682276,"results":"40","hashOfConfig":"30"},{"size":221,"mtime":1713735956356,"results":"41","hashOfConfig":"30"},{"size":1619,"mtime":1713735479158,"results":"42","hashOfConfig":"30"},{"size":2698,"mtime":1713739073308,"results":"43","hashOfConfig":"30"},{"size":2713,"mtime":1714218780357,"results":"44","hashOfConfig":"45"},{"size":3758,"mtime":1714219539997,"results":"46","hashOfConfig":"45"},{"size":1225,"mtime":1714219540004,"results":"47","hashOfConfig":"45"},{"size":1366,"mtime":1714218196521,"results":"48","hashOfConfig":"45"},{"size":237,"mtime":1714217387631,"results":"49","hashOfConfig":"45"},{"size":524,"mtime":1713739001796,"results":"50","hashOfConfig":"45"},{"size":1469,"mtime":1714219540030,"results":"51","hashOfConfig":"45"},{"size":758,"mtime":1714217317354,"results":"52","hashOfConfig":"45"},{"size":2332,"mtime":1713739085235,"results":"53","hashOfConfig":"45"},{"size":4621,"mtime":1714218780443,"results":"54","hashOfConfig":"45"},{"size":2377,"mtime":1714218081661,"results":"55","hashOfConfig":"45"},{"size":629,"mtime":1714218780457,"results":"56","hashOfConfig":"45"},{"size":200,"mtime":1714218780460,"results":"57","hashOfConfig":"45"},{"size":1575,"mtime":1714218451582,"results":"58","hashOfConfig":"45"},{"filePath":"59","messages":"60","suppressedMessages":"61","errorCount":1,"fatalErrorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0,"source":null},"f0i4t8",{"filePath":"62","messages":"63","suppressedMessages":"64","errorCount":1,"fatalErrorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0,"source":null},{"filePath":"65","messages":"66","suppressedMessages":"67","errorCount":1,"fatalErrorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0,"source":null},{"filePath":"68","messages":"69","suppressedMessages":"70","errorCount":0,"fatalErrorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},{"filePath":"71","messages":"72","suppressedMessages":"73","errorCount":0,"fatalErrorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},{"filePath":"74","messages":"75","suppressedMessages":"76","errorCount":0,"fatalErrorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},{"filePath":"77","messages":"78","suppressedMessages":"79","errorCount":0,"fatalErrorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},{"filePath":"80","messages":"81","suppressedMessages":"82","errorCount":0,"fatalErrorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},{"filePath":"83","messages":"84","suppressedMessages":"85","errorCount":3,"fatalErrorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0,"source":null},{"filePath":"86","messages":"87","suppressedMessages":"88","errorCount":3,"fatalErrorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0,"source":null},{"filePath":"89","messages":"90","suppressedMessages":"91","errorCount":1,"fatalErrorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0,"source":null},{"filePath":"92","messages":"93","suppressedMessages":"94","errorCount":0,"fatalErrorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},{"filePath":"95","messages":"96","suppressedMessages":"97","errorCount":0,"fatalErrorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},{"filePath":"98","messages":"99","suppressedMessages":"100","errorCount":1,"fatalErrorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0,"source":null},{"filePath":"101","messages":"102","suppressedMessages":"103","errorCount":0,"fatalErrorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},"xaatuj",{"filePath":"104","messages":"105","suppressedMessages":"106","errorCount":1,"fatalErrorCount":0,"warningCount":0,"fixableErrorCount":1,"fixableWarningCount":0,"source":null},{"filePath":"107","messages":"108","suppressedMessages":"109","errorCount":1,"fatalErrorCount":0,"warningCount":0,"fixableErrorCount":1,"fixableWarningCount":0,"source":null},{"filePath":"110","messages":"111","suppressedMessages":"112","errorCount":0,"fatalErrorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},{"filePath":"113","messages":"114","suppressedMessages":"115","errorCount":0,"fatalErrorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},{"filePath":"116","messages":"117","suppressedMessages":"118","errorCount":0,"fatalErrorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},{"filePath":"119","messages":"120","suppressedMessages":"121","errorCount":1,"fatalErrorCount":0,"warningCount":0,"fixableErrorCount":1,"fixableWarningCount":0,"source":null},{"filePath":"122","messages":"123","suppressedMessages":"124","errorCount":0,"fatalErrorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},{"filePath":"125","messages":"126","suppressedMessages":"127","errorCount":0,"fatalErrorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},{"filePath":"128","messages":"129","suppressedMessages":"130","errorCount":1,"fatalErrorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0,"source":null},{"filePath":"131","messages":"132","suppressedMessages":"133","errorCount":2,"fatalErrorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0,"source":null},{"filePath":"134","messages":"135","suppressedMessages":"136","errorCount":1,"fatalErrorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0,"source":null},{"filePath":"137","messages":"138","suppressedMessages":"139","errorCount":0,"fatalErrorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},{"filePath":"140","messages":"141","suppressedMessages":"142","errorCount":0,"fatalErrorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},"C:\\Users\\lu\\Documents\\GitHub\\test\\src\\commands\\imagine\\Imagine.ts",["143"],[],"C:\\Users\\lu\\Documents\\GitHub\\test\\src\\commands\\imagine\\Invite.ts",["144"],[],"C:\\Users\\lu\\Documents\\GitHub\\test\\src\\commands\\imagine\\Ping.ts",["145"],[],"C:\\Users\\lu\\Documents\\GitHub\\test\\src\\config.ts",[],[],"C:\\Users\\lu\\Documents\\GitHub\\test\\src\\events\\client\\ClientReady.ts",[],[],"C:\\Users\\lu\\Documents\\GitHub\\test\\src\\events\\client\\InteractionCreate.ts",[],[],"C:\\Users\\lu\\Documents\\GitHub\\test\\src\\index.ts",[],[],"C:\\Users\\lu\\Documents\\GitHub\\test\\src\\structures\\Canvas.ts",[],[],"C:\\Users\\lu\\Documents\\GitHub\\test\\src\\structures\\Client.ts",["146","147","148"],[],"C:\\Users\\lu\\Documents\\GitHub\\test\\src\\structures\\Command.ts",["149","150","151"],[],"C:\\Users\\lu\\Documents\\GitHub\\test\\src\\structures\\Event.ts",["152"],[],"C:\\Users\\lu\\Documents\\GitHub\\test\\src\\structures\\index.ts",[],[],"C:\\Users\\lu\\Documents\\GitHub\\test\\src\\structures\\Logger.ts",[],[],"C:\\Users\\lu\\Documents\\GitHub\\test\\src\\commands\\imagine\\About.ts",["153"],[],"C:\\Users\\lu\\Documents\\GitHub\\Midjourney\\src\\commands\\imagine\\About.ts",[],[],"C:\\Users\\lu\\Documents\\GitHub\\Midjourney\\src\\commands\\imagine\\Imagine.ts",["154"],[],"C:\\Users\\lu\\Documents\\GitHub\\Midjourney\\src\\commands\\imagine\\Invite.ts",["155"],[],"C:\\Users\\lu\\Documents\\GitHub\\Midjourney\\src\\commands\\imagine\\Ping.ts",[],[],"C:\\Users\\lu\\Documents\\GitHub\\Midjourney\\src\\config.ts",[],[],"C:\\Users\\lu\\Documents\\GitHub\\Midjourney\\src\\events\\client\\ClientReady.ts",[],[],"C:\\Users\\lu\\Documents\\GitHub\\Midjourney\\src\\events\\client\\InteractionCreate.ts",["156"],[],"C:\\Users\\lu\\Documents\\GitHub\\Midjourney\\src\\index.ts",[],[],"C:\\Users\\lu\\Documents\\GitHub\\Midjourney\\src\\structures\\Canvas.ts",[],[],"C:\\Users\\lu\\Documents\\GitHub\\Midjourney\\src\\structures\\Client.ts",["157"],[],"C:\\Users\\lu\\Documents\\GitHub\\Midjourney\\src\\structures\\Command.ts",["158","159"],[],"C:\\Users\\lu\\Documents\\GitHub\\Midjourney\\src\\structures\\Event.ts",["160"],[],"C:\\Users\\lu\\Documents\\GitHub\\Midjourney\\src\\structures\\index.ts",[],[],"C:\\Users\\lu\\Documents\\GitHub\\Midjourney\\src\\structures\\Logger.ts",[],[],{"ruleId":"161","severity":2,"message":"162","line":64,"column":5,"nodeType":"163","messageId":"164","endLine":64,"endColumn":14},{"ruleId":"161","severity":2,"message":"162","line":30,"column":5,"nodeType":"163","messageId":"164","endLine":30,"endColumn":14},{"ruleId":"161","severity":2,"message":"162","line":30,"column":5,"nodeType":"163","messageId":"164","endLine":30,"endColumn":14},{"ruleId":"165","severity":2,"message":"166","line":20,"column":1,"nodeType":"167","endLine":20,"endColumn":35},{"ruleId":"165","severity":2,"message":"168","line":22,"column":1,"nodeType":"167","endLine":22,"endColumn":38},{"ruleId":"161","severity":2,"message":"162","line":35,"column":5,"nodeType":"163","messageId":"164","endLine":35,"endColumn":23},{"ruleId":"169","severity":2,"message":"170","line":14,"column":38,"nodeType":"171","messageId":"172","endLine":14,"endColumn":41},{"ruleId":"173","severity":2,"message":"174","line":48,"column":22,"nodeType":"175","messageId":"176","endLine":48,"endColumn":33},{"ruleId":"173","severity":2,"message":"177","line":48,"column":35,"nodeType":"175","messageId":"176","endLine":48,"endColumn":47},{"ruleId":"173","severity":2,"message":"178","line":16,"column":25,"nodeType":"175","messageId":"176","endLine":16,"endColumn":29},{"ruleId":"161","severity":2,"message":"162","line":36,"column":5,"nodeType":"163","messageId":"164","endLine":36,"endColumn":14},{"ruleId":"179","severity":2,"message":"180","line":24,"column":21,"nodeType":"181","messageId":"182","endLine":24,"endColumn":63,"fix":"183"},{"ruleId":"179","severity":2,"message":"180","line":18,"column":21,"nodeType":"181","messageId":"182","endLine":18,"endColumn":58,"fix":"184"},{"ruleId":"179","severity":2,"message":"180","line":23,"column":34,"nodeType":"181","messageId":"182","endLine":23,"endColumn":89,"fix":"185"},{"ruleId":"161","severity":2,"message":"162","line":36,"column":5,"nodeType":"163","messageId":"164","endLine":36,"endColumn":23},{"ruleId":"173","severity":2,"message":"174","line":70,"column":22,"nodeType":"175","messageId":"176","endLine":70,"endColumn":33},{"ruleId":"173","severity":2,"message":"177","line":70,"column":35,"nodeType":"175","messageId":"176","endLine":70,"endColumn":47},{"ruleId":"173","severity":2,"message":"178","line":23,"column":25,"nodeType":"175","messageId":"176","endLine":23,"endColumn":29},"@typescript-eslint/explicit-function-return-type","Missing return type on function.","FunctionExpression","missingReturnType","import/order","`replicate` import should occur before import of `./Logger.js`","ImportDeclaration","`./Canvas.js` import should occur before import of `./Logger.js`","@typescript-eslint/no-redundant-type-constituents","'any' overrides all other types in this union type.","TSAnyKeyword","overrides","@typescript-eslint/no-unused-vars","'client' is defined but never used. Allowed unused args must match /^_/u.","Identifier","unusedVar","'message' is defined but never used. Allowed unused args must match /^_/u.","'args' is defined but never used. Allowed unused args must match /^_/u.","quotes","Strings must use singlequote.","Literal","wrongQuotes",{"range":"186","text":"187"},{"range":"188","text":"189"},{"range":"190","text":"191"},[676,718],"'📷 | Crée une image à partir d\\'un prompt'",[561,598],"'📨 | Afficher le lien d\\'invitation.'",[981,1036],"'NSFW content detected. You can\\' generate NSFW images!'"] \ No newline at end of file +[{"C:\\Users\\lu\\Documents\\GitHub\\test\\src\\commands\\imagine\\Imagine.ts":"1","C:\\Users\\lu\\Documents\\GitHub\\test\\src\\commands\\imagine\\Invite.ts":"2","C:\\Users\\lu\\Documents\\GitHub\\test\\src\\commands\\imagine\\Ping.ts":"3","C:\\Users\\lu\\Documents\\GitHub\\test\\src\\config.ts":"4","C:\\Users\\lu\\Documents\\GitHub\\test\\src\\events\\client\\ClientReady.ts":"5","C:\\Users\\lu\\Documents\\GitHub\\test\\src\\events\\client\\InteractionCreate.ts":"6","C:\\Users\\lu\\Documents\\GitHub\\test\\src\\index.ts":"7","C:\\Users\\lu\\Documents\\GitHub\\test\\src\\structures\\Canvas.ts":"8","C:\\Users\\lu\\Documents\\GitHub\\test\\src\\structures\\Client.ts":"9","C:\\Users\\lu\\Documents\\GitHub\\test\\src\\structures\\Command.ts":"10","C:\\Users\\lu\\Documents\\GitHub\\test\\src\\structures\\Event.ts":"11","C:\\Users\\lu\\Documents\\GitHub\\test\\src\\structures\\index.ts":"12","C:\\Users\\lu\\Documents\\GitHub\\test\\src\\structures\\Logger.ts":"13","C:\\Users\\lu\\Documents\\GitHub\\test\\src\\commands\\imagine\\About.ts":"14","C:\\Users\\lu\\Documents\\GitHub\\Midjourney\\src\\commands\\imagine\\About.ts":"15","C:\\Users\\lu\\Documents\\GitHub\\Midjourney\\src\\commands\\imagine\\Imagine.ts":"16","C:\\Users\\lu\\Documents\\GitHub\\Midjourney\\src\\commands\\imagine\\Invite.ts":"17","C:\\Users\\lu\\Documents\\GitHub\\Midjourney\\src\\commands\\imagine\\Ping.ts":"18","C:\\Users\\lu\\Documents\\GitHub\\Midjourney\\src\\config.ts":"19","C:\\Users\\lu\\Documents\\GitHub\\Midjourney\\src\\events\\client\\ClientReady.ts":"20","C:\\Users\\lu\\Documents\\GitHub\\Midjourney\\src\\events\\client\\InteractionCreate.ts":"21","C:\\Users\\lu\\Documents\\GitHub\\Midjourney\\src\\index.ts":"22","C:\\Users\\lu\\Documents\\GitHub\\Midjourney\\src\\structures\\Canvas.ts":"23","C:\\Users\\lu\\Documents\\GitHub\\Midjourney\\src\\structures\\Client.ts":"24","C:\\Users\\lu\\Documents\\GitHub\\Midjourney\\src\\structures\\Command.ts":"25","C:\\Users\\lu\\Documents\\GitHub\\Midjourney\\src\\structures\\Event.ts":"26","C:\\Users\\lu\\Documents\\GitHub\\Midjourney\\src\\structures\\index.ts":"27","C:\\Users\\lu\\Documents\\GitHub\\Midjourney\\src\\structures\\Logger.ts":"28"},{"size":3456,"mtime":1713738596647,"results":"29","hashOfConfig":"30"},{"size":1211,"mtime":1713738596647,"results":"31","hashOfConfig":"30"},{"size":1351,"mtime":1713738223574,"results":"32","hashOfConfig":"30"},{"size":267,"mtime":1713736156287,"results":"33","hashOfConfig":"30"},{"size":524,"mtime":1713739001796,"results":"34","hashOfConfig":"30"},{"size":1470,"mtime":1713738596647,"results":"35","hashOfConfig":"30"},{"size":806,"mtime":1713735956312,"results":"36","hashOfConfig":"30"},{"size":2327,"mtime":1713738667186,"results":"37","hashOfConfig":"30"},{"size":4929,"mtime":1713738960324,"results":"38","hashOfConfig":"30"},{"size":2703,"mtime":1713735956350,"results":"39","hashOfConfig":"30"},{"size":632,"mtime":1713735682276,"results":"40","hashOfConfig":"30"},{"size":221,"mtime":1713735956356,"results":"41","hashOfConfig":"30"},{"size":1619,"mtime":1713735479158,"results":"42","hashOfConfig":"30"},{"size":2698,"mtime":1713739073308,"results":"43","hashOfConfig":"30"},{"size":2713,"mtime":1714218780357,"results":"44","hashOfConfig":"45"},{"size":3758,"mtime":1714570121247,"results":"46","hashOfConfig":"45"},{"size":1225,"mtime":1714570121255,"results":"47","hashOfConfig":"45"},{"size":1366,"mtime":1714218196521,"results":"48","hashOfConfig":"45"},{"size":237,"mtime":1714217387631,"results":"49","hashOfConfig":"45"},{"size":524,"mtime":1713739001796,"results":"50","hashOfConfig":"45"},{"size":1469,"mtime":1714570121281,"results":"51","hashOfConfig":"45"},{"size":843,"mtime":1714568661889,"results":"52","hashOfConfig":"45"},{"size":2332,"mtime":1713739085235,"results":"53","hashOfConfig":"45"},{"size":4623,"mtime":1714570099180,"results":"54","hashOfConfig":"45"},{"size":2255,"mtime":1714570121327,"results":"55","hashOfConfig":"45"},{"size":634,"mtime":1714570121332,"results":"56","hashOfConfig":"45"},{"size":200,"mtime":1714218780460,"results":"57","hashOfConfig":"45"},{"size":1734,"mtime":1714570121344,"results":"58","hashOfConfig":"45"},{"filePath":"59","messages":"60","suppressedMessages":"61","errorCount":1,"fatalErrorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0,"source":null},"f0i4t8",{"filePath":"62","messages":"63","suppressedMessages":"64","errorCount":1,"fatalErrorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0,"source":null},{"filePath":"65","messages":"66","suppressedMessages":"67","errorCount":1,"fatalErrorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0,"source":null},{"filePath":"68","messages":"69","suppressedMessages":"70","errorCount":0,"fatalErrorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},{"filePath":"71","messages":"72","suppressedMessages":"73","errorCount":0,"fatalErrorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},{"filePath":"74","messages":"75","suppressedMessages":"76","errorCount":0,"fatalErrorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},{"filePath":"77","messages":"78","suppressedMessages":"79","errorCount":0,"fatalErrorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},{"filePath":"80","messages":"81","suppressedMessages":"82","errorCount":0,"fatalErrorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},{"filePath":"83","messages":"84","suppressedMessages":"85","errorCount":3,"fatalErrorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0,"source":null},{"filePath":"86","messages":"87","suppressedMessages":"88","errorCount":3,"fatalErrorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0,"source":null},{"filePath":"89","messages":"90","suppressedMessages":"91","errorCount":1,"fatalErrorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0,"source":null},{"filePath":"92","messages":"93","suppressedMessages":"94","errorCount":0,"fatalErrorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},{"filePath":"95","messages":"96","suppressedMessages":"97","errorCount":0,"fatalErrorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},{"filePath":"98","messages":"99","suppressedMessages":"100","errorCount":1,"fatalErrorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0,"source":null},{"filePath":"101","messages":"102","suppressedMessages":"103","errorCount":0,"fatalErrorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},"xaatuj",{"filePath":"104","messages":"105","suppressedMessages":"106","errorCount":1,"fatalErrorCount":0,"warningCount":0,"fixableErrorCount":1,"fixableWarningCount":0,"source":null},{"filePath":"107","messages":"108","suppressedMessages":"109","errorCount":1,"fatalErrorCount":0,"warningCount":0,"fixableErrorCount":1,"fixableWarningCount":0,"source":null},{"filePath":"110","messages":"111","suppressedMessages":"112","errorCount":0,"fatalErrorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},{"filePath":"113","messages":"114","suppressedMessages":"115","errorCount":0,"fatalErrorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},{"filePath":"116","messages":"117","suppressedMessages":"118","errorCount":0,"fatalErrorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},{"filePath":"119","messages":"120","suppressedMessages":"121","errorCount":1,"fatalErrorCount":0,"warningCount":0,"fixableErrorCount":1,"fixableWarningCount":0,"source":null},{"filePath":"122","messages":"123","suppressedMessages":"124","errorCount":0,"fatalErrorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},{"filePath":"125","messages":"126","suppressedMessages":"127","errorCount":0,"fatalErrorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},{"filePath":"128","messages":"129","suppressedMessages":"130","errorCount":0,"fatalErrorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},{"filePath":"131","messages":"132","suppressedMessages":"133","errorCount":0,"fatalErrorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},{"filePath":"134","messages":"135","suppressedMessages":"136","errorCount":0,"fatalErrorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},{"filePath":"137","messages":"138","suppressedMessages":"139","errorCount":0,"fatalErrorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},{"filePath":"140","messages":"141","suppressedMessages":"142","errorCount":0,"fatalErrorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},"C:\\Users\\lu\\Documents\\GitHub\\test\\src\\commands\\imagine\\Imagine.ts",["143"],[],"C:\\Users\\lu\\Documents\\GitHub\\test\\src\\commands\\imagine\\Invite.ts",["144"],[],"C:\\Users\\lu\\Documents\\GitHub\\test\\src\\commands\\imagine\\Ping.ts",["145"],[],"C:\\Users\\lu\\Documents\\GitHub\\test\\src\\config.ts",[],[],"C:\\Users\\lu\\Documents\\GitHub\\test\\src\\events\\client\\ClientReady.ts",[],[],"C:\\Users\\lu\\Documents\\GitHub\\test\\src\\events\\client\\InteractionCreate.ts",[],[],"C:\\Users\\lu\\Documents\\GitHub\\test\\src\\index.ts",[],[],"C:\\Users\\lu\\Documents\\GitHub\\test\\src\\structures\\Canvas.ts",[],[],"C:\\Users\\lu\\Documents\\GitHub\\test\\src\\structures\\Client.ts",["146","147","148"],[],"C:\\Users\\lu\\Documents\\GitHub\\test\\src\\structures\\Command.ts",["149","150","151"],[],"C:\\Users\\lu\\Documents\\GitHub\\test\\src\\structures\\Event.ts",["152"],[],"C:\\Users\\lu\\Documents\\GitHub\\test\\src\\structures\\index.ts",[],[],"C:\\Users\\lu\\Documents\\GitHub\\test\\src\\structures\\Logger.ts",[],[],"C:\\Users\\lu\\Documents\\GitHub\\test\\src\\commands\\imagine\\About.ts",["153"],[],"C:\\Users\\lu\\Documents\\GitHub\\Midjourney\\src\\commands\\imagine\\About.ts",[],[],"C:\\Users\\lu\\Documents\\GitHub\\Midjourney\\src\\commands\\imagine\\Imagine.ts",["154"],[],"C:\\Users\\lu\\Documents\\GitHub\\Midjourney\\src\\commands\\imagine\\Invite.ts",["155"],[],"C:\\Users\\lu\\Documents\\GitHub\\Midjourney\\src\\commands\\imagine\\Ping.ts",[],[],"C:\\Users\\lu\\Documents\\GitHub\\Midjourney\\src\\config.ts",[],[],"C:\\Users\\lu\\Documents\\GitHub\\Midjourney\\src\\events\\client\\ClientReady.ts",[],[],"C:\\Users\\lu\\Documents\\GitHub\\Midjourney\\src\\events\\client\\InteractionCreate.ts",["156"],[],"C:\\Users\\lu\\Documents\\GitHub\\Midjourney\\src\\index.ts",[],[],"C:\\Users\\lu\\Documents\\GitHub\\Midjourney\\src\\structures\\Canvas.ts",[],[],"C:\\Users\\lu\\Documents\\GitHub\\Midjourney\\src\\structures\\Client.ts",[],[],"C:\\Users\\lu\\Documents\\GitHub\\Midjourney\\src\\structures\\Command.ts",[],[],"C:\\Users\\lu\\Documents\\GitHub\\Midjourney\\src\\structures\\Event.ts",[],[],"C:\\Users\\lu\\Documents\\GitHub\\Midjourney\\src\\structures\\index.ts",[],[],"C:\\Users\\lu\\Documents\\GitHub\\Midjourney\\src\\structures\\Logger.ts",[],[],{"ruleId":"157","severity":2,"message":"158","line":64,"column":5,"nodeType":"159","messageId":"160","endLine":64,"endColumn":14},{"ruleId":"157","severity":2,"message":"158","line":30,"column":5,"nodeType":"159","messageId":"160","endLine":30,"endColumn":14},{"ruleId":"157","severity":2,"message":"158","line":30,"column":5,"nodeType":"159","messageId":"160","endLine":30,"endColumn":14},{"ruleId":"161","severity":2,"message":"162","line":20,"column":1,"nodeType":"163","endLine":20,"endColumn":35},{"ruleId":"161","severity":2,"message":"164","line":22,"column":1,"nodeType":"163","endLine":22,"endColumn":38},{"ruleId":"157","severity":2,"message":"158","line":35,"column":5,"nodeType":"159","messageId":"160","endLine":35,"endColumn":23},{"ruleId":"165","severity":2,"message":"166","line":14,"column":38,"nodeType":"167","messageId":"168","endLine":14,"endColumn":41},{"ruleId":"169","severity":2,"message":"170","line":48,"column":22,"nodeType":"171","messageId":"172","endLine":48,"endColumn":33},{"ruleId":"169","severity":2,"message":"173","line":48,"column":35,"nodeType":"171","messageId":"172","endLine":48,"endColumn":47},{"ruleId":"169","severity":2,"message":"174","line":16,"column":25,"nodeType":"171","messageId":"172","endLine":16,"endColumn":29},{"ruleId":"157","severity":2,"message":"158","line":36,"column":5,"nodeType":"159","messageId":"160","endLine":36,"endColumn":14},{"ruleId":"175","severity":2,"message":"176","line":24,"column":21,"nodeType":"177","messageId":"178","endLine":24,"endColumn":63,"fix":"179"},{"ruleId":"175","severity":2,"message":"176","line":18,"column":21,"nodeType":"177","messageId":"178","endLine":18,"endColumn":58,"fix":"180"},{"ruleId":"175","severity":2,"message":"176","line":23,"column":34,"nodeType":"177","messageId":"178","endLine":23,"endColumn":89,"fix":"181"},"@typescript-eslint/explicit-function-return-type","Missing return type on function.","FunctionExpression","missingReturnType","import/order","`replicate` import should occur before import of `./Logger.js`","ImportDeclaration","`./Canvas.js` import should occur before import of `./Logger.js`","@typescript-eslint/no-redundant-type-constituents","'any' overrides all other types in this union type.","TSAnyKeyword","overrides","@typescript-eslint/no-unused-vars","'client' is defined but never used. Allowed unused args must match /^_/u.","Identifier","unusedVar","'message' is defined but never used. Allowed unused args must match /^_/u.","'args' is defined but never used. Allowed unused args must match /^_/u.","quotes","Strings must use singlequote.","Literal","wrongQuotes",{"range":"182","text":"183"},{"range":"184","text":"185"},{"range":"186","text":"187"},[676,718],"'📷 | Crée une image à partir d\\'un prompt'",[561,598],"'📨 | Afficher le lien d\\'invitation.'",[981,1036],"'NSFW content detected. You can\\' generate NSFW images!'"] \ No newline at end of file diff --git a/package.json b/package.json index 4df1c5b..d0b7a42 100644 --- a/package.json +++ b/package.json @@ -1,12 +1,13 @@ { "name": "midjourney", - "version": "1.1.0", + "version": "1.2.0", "description": "A simple midjourney bot for discord", "type": "module", "main": "dist/index.js", "scripts": { "start": "npm run build && node dist/index.js", - "clean": "rm -rf dist", + "cleanw": "rmdir /s /q dist", + "cleanl": "rm -rf dist", "build": "tsc --project tsconfig.json", "lint": "eslint . --cache --ext .js,.jsx,.ts,.tsx", "lint:fix": "eslint . --fix --cache --ext .js,.jsx,.ts,.tsx", @@ -25,9 +26,9 @@ "@types/node": "^20.12.7", "@types/signale": "^1.4.7", "ts-node": "^10.9.2", - "@typescript-eslint/eslint-plugin": "^7.7.1", - "@typescript-eslint/parser": "^7.7.1", - "eslint": "^8.56.0", + "@typescript-eslint/eslint-plugin": "^7.8.0", + "@typescript-eslint/parser": "^7.8.0", + "eslint": "^8.57.0", "eslint-plugin-import": "^2.29.1", "eslint-plugin-unicorn": "^52.0.0", "prettier": "^3.2.5" @@ -49,7 +50,7 @@ "discord.js": "^14.14.1", "replicate": "^0.29.1", "signale": "^1.4.0", - "undici": "^6.14.0", + "undici": "^6.15.0", "dotenv": "^16.4.5" } } diff --git a/src/events/client/InteractionCreate.ts b/src/events/client/InteractionCreate.ts index d7a819f..2b861ce 100644 --- a/src/events/client/InteractionCreate.ts +++ b/src/events/client/InteractionCreate.ts @@ -15,10 +15,7 @@ export default class InteractionCreate extends Event { try { await command.run(this.client, interaction); } catch (error) { - if ( - error.message === - 'Prediction failed: NSFW content detected. Try running it again, or try a different prompt.' - ) { + if (error instanceof Error && error.message === 'Prediction failed: NSFW content detected. Try running it again, or try a different prompt.') { await interaction[interaction.replied ? 'editReply' : 'reply']({ content: 'NSFW content detected. You can\' generate NSFW images!', ephemeral: true, @@ -26,13 +23,16 @@ export default class InteractionCreate extends Event { return; } + if (error instanceof Error) { + this.client.logger.error(error); - this.client.logger.error(error); - - await interaction[interaction.replied ? 'editReply' : 'reply']({ - content: 'There was an error while executing this command!', - ephemeral: true, - }); + await interaction[interaction.replied ? 'editReply' : 'reply']({ + content: 'There was an error while executing this command!', + ephemeral: true, + }); + } else { + console.error('An unexpected error occurred:', error); + } } } } diff --git a/src/index.ts b/src/index.ts index ab023bb..d041ad0 100644 --- a/src/index.ts +++ b/src/index.ts @@ -16,7 +16,11 @@ const client = new Bot(clientOptions); client.start(config.token); -process.on('unhandledRejection', (error: Error) => client.logger.error(error)); -process.on('uncaughtException', (error: Error) => client.logger.error(error)); -process.on('warning', (warning: Error) => client.logger.warn(warning)); -process.on('exit', () => client.logger.warn('Process exited!')); +function setupEventListeners(): void { + process.on('unhandledRejection', (error: Error) => client.logger.error(error)); + process.on('uncaughtException', (error: Error) => client.logger.error(error)); + process.on('warning', (warning: Error) => client.logger.warn(warning)); + process.on('exit', () => client.logger.warn('Process exited!')); +} + +setupEventListeners(); diff --git a/src/structures/Client.ts b/src/structures/Client.ts index f740051..4f5396f 100644 --- a/src/structures/Client.ts +++ b/src/structures/Client.ts @@ -26,31 +26,26 @@ export default class Bot extends Client { public commands = new Collection(); private data: RESTPostAPIChatInputApplicationCommandsJSONBody[] = []; public replicate: Replicate | null = null; - public canvas: Canvas = new Canvas(); + public canvas = new Canvas(); constructor(options: ClientOptions) { super(options); this.config = config; } - public async start(token: string) { - this.logger.start('Starting bot...'); - if (!config.replicateToken) { - this.logger.error('Replicate token is missing.'); - return; + public async start(token: string): Promise { + try { + this.logger.start('Starting bot...'); + if (!config.replicateToken) throw new Error('Replicate token is missing.'); + this.replicate = new Replicate({ auth: config.replicateToken }); + if (!this.replicate) throw new Error('Failed to initialize Replicate.'); + this.logger.info('Replicate is initialized.'); + await this.loadCommands(); + await this.loadEvents(); + await this.login(token); + } catch (error) { + this.logger.error(error); } - this.replicate = new Replicate({ - auth: config.replicateToken, - }); - if (!this.replicate) { - this.logger.error('Failed to initialize Replicate.'); - return; - } - this.logger.info('Replicate is initialized.'); - - await this.loadCommands(); - await this.loadEvents(); - await this.login(token); } public embed(): EmbedBuilder { @@ -66,7 +61,7 @@ export default class Bot extends Client { for (const file of eventFiles) { const eventFile = (await import(`../events/${event}/${file}`)).default; const eventClass = new eventFile(this, file); - this.on(eventClass.name, (...args: any[]) => eventClass.run(...args)); + this.on(eventClass.name, (...args: unknown[]) => eventClass.run(...args)); } } } @@ -103,9 +98,9 @@ export default class Bot extends Client { } this.once('ready', async () => { - const applicationCommands = Routes.applicationCommands(this.config.clientId ?? ''); + const applicationCommands = Routes.applicationCommands(config.clientId ?? ''); try { - const rest = new REST({ version: '10' }).setToken(this.config.token ?? ''); + const rest = new REST({ version: '10' }).setToken(config.token ?? ''); await rest.put(applicationCommands, { body: this.data }); this.logger.info(`Successfully loaded slash commands!`); } catch (error) { diff --git a/src/structures/Command.ts b/src/structures/Command.ts index 987cbf9..da527cb 100644 --- a/src/structures/Command.ts +++ b/src/structures/Command.ts @@ -3,31 +3,23 @@ import { ApplicationCommandOption, PermissionResolvable } from 'discord.js'; import { Bot } from './index.js'; interface CommandDescription { - content: string | null; - usage: string | null; - examples: string[] | null; + content: string; + usage: string; + examples: string[]; } interface CommandOptions { name: string; - nameLocalizations?: any; + nameLocalizations?: Record; description?: CommandDescription; - descriptionLocalizations?: any; + descriptionLocalizations?: Record; aliases?: string[]; cooldown?: number; - args?: boolean; - player?: { - voice: boolean; - dj: boolean; - active: boolean; - djPerm: string | null; - }; permissions?: { dev: boolean; client: string[] | PermissionResolvable; user: string[] | PermissionResolvable; }; - slashCommand?: boolean; options?: ApplicationCommandOption[]; category?: string; } @@ -35,9 +27,9 @@ interface CommandOptions { export default class Command { public client: Bot; public name: string; - public nameLocalizations: any; + public nameLocalizations: Record; public description: CommandDescription; - public descriptionLocalizations: any; + public descriptionLocalizations: Record | null; public cooldown: number; public permissions: { dev: boolean; @@ -45,7 +37,7 @@ export default class Command { user: string[] | PermissionResolvable; }; public options: ApplicationCommandOption[]; - public category: string | null; + public category: string; constructor(client: Bot, options: CommandOptions) { this.client = client; @@ -67,7 +59,7 @@ export default class Command { this.category = options.category || 'general'; } - public async run(client: Bot, message: any): Promise { + public async run(_client: Bot, _message: any): Promise { return await Promise.resolve(); } } diff --git a/src/structures/Event.ts b/src/structures/Event.ts index 9f249c8..6fce979 100644 --- a/src/structures/Event.ts +++ b/src/structures/Event.ts @@ -20,7 +20,7 @@ export default class Event { this.fileName = file.split('.')[0]; } - public async run(...args: any[]): Promise { + public async run(..._args: unknown[]): Promise { return await Promise.resolve(); } } diff --git a/src/structures/Logger.ts b/src/structures/Logger.ts index 379385a..2582fe6 100644 --- a/src/structures/Logger.ts +++ b/src/structures/Logger.ts @@ -1,42 +1,52 @@ import pkg from 'signale'; const { Signale } = pkg; +enum LogLevel { + INFO = 'info', + WARN = 'warn', + ERROR = 'error', + DEBUG = 'debug', + SUCCESS = 'success', + LOG = 'log', + PAUSE = 'pause', + START = 'start', +} + interface LoggerOptions { disabled?: boolean; interactive?: boolean; - logLevel?: string; + logLevel?: LogLevel; scope?: string; - types?: { - info: { badge: string; color: string; label: string }; - warn: { badge: string; color: string; label: string }; - error: { badge: string; color: string; label: string }; - debug: { badge: string; color: string; label: string }; - success: { badge: string; color: string; label: string }; - log: { badge: string; color: string; label: string }; - pause: { badge: string; color: string; label: string }; - start: { badge: string; color: string; label: string }; - }; + types?: Record; } const defaultOptions: LoggerOptions = { disabled: false, interactive: false, - logLevel: 'info', + logLevel: LogLevel.INFO, scope: 'Midjourney', types: { - info: { badge: 'ℹ', color: 'blue', label: 'info' }, - warn: { badge: '⚠', color: 'yellow', label: 'warn' }, - error: { badge: '✖', color: 'red', label: 'error' }, - debug: { badge: '🐛', color: 'magenta', label: 'debug' }, - success: { badge: '✔', color: 'green', label: 'success' }, - log: { badge: '📝', color: 'white', label: 'log' }, - pause: { badge: '⏸', color: 'yellow', label: 'pause' }, - start: { badge: '▶', color: 'green', label: 'start' }, + [LogLevel.INFO]: { badge: 'ℹ', color: 'blue', label: 'info' }, + [LogLevel.WARN]: { badge: '⚠', color: 'yellow', label: 'warn' }, + [LogLevel.ERROR]: { badge: '✖', color: 'red', label: 'error' }, + [LogLevel.DEBUG]: { badge: '🐛', color: 'magenta', label: 'debug' }, + [LogLevel.SUCCESS]: { badge: '✔', color: 'green', label: 'success' }, + [LogLevel.LOG]: { badge: '📝', color: 'white', label: 'log' }, + [LogLevel.PAUSE]: { badge: '⏸', color: 'yellow', label: 'pause' }, + [LogLevel.START]: { badge: '▶', color: 'green', label: 'start' }, }, }; export default class Logger extends Signale { constructor(options: LoggerOptions = {}) { super({ ...defaultOptions, ...options }); + this.validateOptions(options); + } + + private validateOptions(options: LoggerOptions): void { + const validLogLevels = Object.values(LogLevel); + if (options.logLevel && !validLogLevels.includes(options.logLevel)) { + throw new Error(`Invalid log level: ${options.logLevel}`); + } } }