Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
127 commits
Select commit Hold shift + click to select a range
441ad3f
Redesign levels embed with generated UserCards
TheKing-OfTime Oct 28, 2022
921b5ad
Minor fixes
TheKing-OfTime Dec 5, 2022
69634ec
Merge branch 'master' into commands_levels
TheKing-OfTime Jul 17, 2023
04becd5
Refactor roundRect function
TheKing-OfTime Jul 18, 2023
f024da1
Refactor UserLevelCard & implement requested changes
TheKing-OfTime Jul 18, 2023
b05fca5
Fix crash & remove unused dependency
TheKing-OfTime Jul 18, 2023
e415db1
Fix another crash
TheKing-OfTime Jul 18, 2023
79d694e
Add fill to roundRect
TheKing-OfTime Jul 18, 2023
47f1cf8
Add beginPath to roundRect
TheKing-OfTime Jul 18, 2023
d40f9d0
Change avatar resolution
TheKing-OfTime Jul 18, 2023
076db02
Try to expand embed
TheKing-OfTime Jul 18, 2023
5a2f658
Try to make style relative
TheKing-OfTime Jul 18, 2023
90fc3c8
Change resolution
TheKing-OfTime Jul 18, 2023
eab9e5b
Fix relativity
TheKing-OfTime Jul 18, 2023
0338062
Fix font relativity
TheKing-OfTime Jul 18, 2023
4d71869
Try to fix font relativity
TheKing-OfTime Jul 18, 2023
1ff9e7c
Try to fix font relativity
TheKing-OfTime Jul 18, 2023
9264744
Try to fix font relativity
TheKing-OfTime Jul 18, 2023
30be848
Try to fix font relativity
TheKing-OfTime Jul 18, 2023
eda38ca
Try to fix font relativity
TheKing-OfTime Jul 18, 2023
452b02b
Try to fix font relativity
TheKing-OfTime Jul 18, 2023
3f01ae3
Try to fix font relativity
TheKing-OfTime Jul 18, 2023
c5b26b9
Try to fix font relativity
TheKing-OfTime Jul 18, 2023
962fa21
Try to fix font relativity
TheKing-OfTime Jul 18, 2023
0061c4f
Try to fix font relativity
TheKing-OfTime Jul 18, 2023
c1c0081
Try to fix font relativity
TheKing-OfTime Jul 18, 2023
0b39308
Initial levels card rewrite (Include migration to mysql2)
TheKing-OfTime Aug 4, 2023
fe1e407
Fixed text alignment bug. Optimized applyText function (8 times faster)
TheKing-OfTime Aug 5, 2023
a15f67a
Remove extra constants
TheKing-OfTime Aug 5, 2023
494f8d5
Fix wrong activity on row init
TheKing-OfTime Aug 5, 2023
4a198d5
Fix banner displaying
TheKing-OfTime Aug 5, 2023
e02eb31
Fix banner displaying
TheKing-OfTime Aug 5, 2023
79fef42
Add initial assets for all levels
TheKing-OfTime Aug 5, 2023
fee72d3
Code style fixes
TheKing-OfTime Aug 5, 2023
4993710
Implemented and tested Labels
TheKing-OfTime Aug 5, 2023
09ac41f
Implement requested changes: single class files
TheKing-OfTime Aug 5, 2023
0acab44
Add comments for makeRounded
TheKing-OfTime Aug 5, 2023
9d64197
Add jsdoc for Icon
TheKing-OfTime Aug 5, 2023
aff7089
Add jsdoc for Rect
TheKing-OfTime Aug 5, 2023
9a3e715
Add jsdoc for TextBox
TheKing-OfTime Aug 5, 2023
0b3ddac
Add jsdoc for Label
TheKing-OfTime Aug 5, 2023
2d4f97d
Add jsdoc for ProgressBar
TheKing-OfTime Aug 5, 2023
2f1a08c
Add endline at files ends
TheKing-OfTime Aug 5, 2023
6a1e102
Remove extra imports
TheKing-OfTime Aug 5, 2023
b1556e3
Finish main functionality of levelCards
TheKing-OfTime Aug 5, 2023
e24881f
connect banners with DB. Add initial moderation tools for banners
TheKing-OfTime Aug 6, 2023
deeb1a8
Finish new level cards functionality
TheKing-OfTime Aug 7, 2023
6c161a3
Code cleanup & add card generation time to logs
TheKing-OfTime Aug 7, 2023
cb0c843
Update jsDoc
TheKing-OfTime Aug 7, 2023
6a2c6ad
Add caching & fix wrong max allowed username width
TheKing-OfTime Aug 7, 2023
e7e8a05
Add generation time to level card
TheKing-OfTime Aug 7, 2023
ddd94e3
minor fix
TheKing-OfTime Aug 7, 2023
0601dd0
Try fix linux inconsistent behavior
TheKing-OfTime Aug 7, 2023
1448b18
Try fix linux inconsistent behavior & add fonts from mockup
TheKing-OfTime Aug 7, 2023
c152908
Try fix linux inconsistent behavior
TheKing-OfTime Aug 7, 2023
d56740d
Try fix linux inconsistent behavior
TheKing-OfTime Aug 7, 2023
cfe7554
Try fix linux inconsistent behavior
TheKing-OfTime Aug 7, 2023
20a45ea
Try fix linux inconsistent behavior
TheKing-OfTime Aug 7, 2023
69a12dd
Try fix linux inconsistent behavior
TheKing-OfTime Aug 7, 2023
d1ad2a6
Try fix linux inconsistent behavior
TheKing-OfTime Aug 7, 2023
d27c403
Try fix linux inconsistent behavior
TheKing-OfTime Aug 7, 2023
cb6688c
Try fix linux inconsistent behavior
TheKing-OfTime Aug 7, 2023
a4c3430
Try fix linux inconsistent behavior
TheKing-OfTime Aug 7, 2023
0f12b1f
Try fix linux inconsistent behavior
TheKing-OfTime Aug 7, 2023
1c90b2e
Try fix linux inconsistent behavior
TheKing-OfTime Aug 7, 2023
02e7841
Try fix linux inconsistent behavior
TheKing-OfTime Aug 7, 2023
6afa44f
Try fix linux inconsistent behavior
TheKing-OfTime Aug 7, 2023
c261bb5
Try fix linux inconsistent behavior
TheKing-OfTime Aug 7, 2023
e56546c
Try fix linux inconsistent behavior
TheKing-OfTime Aug 7, 2023
8a41b53
Try fix linux inconsistent behavior
TheKing-OfTime Aug 7, 2023
9d9a2b0
Try fix linux inconsistent behavior
TheKing-OfTime Aug 7, 2023
7aefc32
Try fix linux inconsistent behavior
TheKing-OfTime Aug 7, 2023
b0c189a
Try fix linux inconsistent behavior
TheKing-OfTime Aug 7, 2023
0989422
Try fix linux inconsistent behavior
TheKing-OfTime Aug 7, 2023
608475b
Add special alert for blocked banners
TheKing-OfTime Aug 8, 2023
5d3ca03
Upgrade card caching (added full caching) &
TheKing-OfTime Aug 8, 2023
75ffa89
Fix linux inconsistent
TheKing-OfTime Aug 8, 2023
e5d9366
Fix linux inconsistent
TheKing-OfTime Aug 8, 2023
59d14e8
Fix secondary label text relative position
TheKing-OfTime Aug 8, 2023
fbb5928
Update level card management & add UI for animations management
TheKing-OfTime Aug 8, 2023
c07022d
Add support for animated avatars and banners
TheKing-OfTime Aug 8, 2023
b5dcc04
Some fixes
TheKing-OfTime Aug 8, 2023
1465d66
Several bug fixes & performance improvements
TheKing-OfTime Aug 9, 2023
cd7acee
Improve card generation process logging
TheKing-OfTime Aug 9, 2023
eb9055a
Fix banner clipping in animated cards
TheKing-OfTime Aug 9, 2023
99daedd
Fix time background
TheKing-OfTime Aug 9, 2023
aec0d76
Fix animatedMediaContent deferation
TheKing-OfTime Aug 9, 2023
59709b2
Fix no banner exception
TheKing-OfTime Aug 9, 2023
6efda8b
fix:Parallel gif generation.
TheKing-OfTime Aug 9, 2023
b85c4ca
Add progressbar to Discord
TheKing-OfTime Aug 9, 2023
b0f54c1
Fix parallel generation
TheKing-OfTime Aug 9, 2023
e76a6bb
Optimize gif generation & add each gif frame caching
TheKing-OfTime Aug 10, 2023
1c11508
Remake result gif caching
TheKing-OfTime Aug 10, 2023
4a2a4bd
Change max gif size
TheKing-OfTime Aug 12, 2023
a415380
Fix non looping partial gifs
TheKing-OfTime Aug 13, 2023
960dd11
Fix typo
TheKing-OfTime Aug 26, 2023
280a2ea
Fix typos in locales
TheKing-OfTime Aug 26, 2023
0dbbdf7
Migrate caching system from RAM to ROM
TheKing-OfTime Nov 15, 2023
23a2810
debug
TheKing-OfTime Nov 15, 2023
099d014
debug
TheKing-OfTime Nov 15, 2023
e73cfff
debug
TheKing-OfTime Nov 15, 2023
41d35f2
debug
TheKing-OfTime Nov 15, 2023
7404b07
debug
TheKing-OfTime Nov 15, 2023
14ccdac
debug
TheKing-OfTime Nov 15, 2023
a20280b
debug
TheKing-OfTime Nov 15, 2023
5de2d2d
debug
TheKing-OfTime Nov 15, 2023
9c03580
debug
TheKing-OfTime Nov 16, 2023
22843cc
debug
TheKing-OfTime Nov 16, 2023
3b3b1fe
debug
TheKing-OfTime Nov 16, 2023
2633b54
debug
TheKing-OfTime Nov 16, 2023
a6c8fa5
debug
TheKing-OfTime Nov 16, 2023
084b930
debug
TheKing-OfTime Nov 16, 2023
f4cff79
debug
TheKing-OfTime Nov 16, 2023
0021dbc
debug
TheKing-OfTime Nov 16, 2023
b266717
debug
TheKing-OfTime Nov 16, 2023
d9ad4e3
debug
TheKing-OfTime Nov 16, 2023
beac780
debug
TheKing-OfTime Nov 16, 2023
06ad21b
debug
TheKing-OfTime Nov 16, 2023
c7861cd
debug
TheKing-OfTime Nov 16, 2023
ccf173e
Add feature alerts
TheKing-OfTime Nov 16, 2023
176e58f
Fix transparent gifs and add min progressbar length
TheKing-OfTime Nov 18, 2023
3ba2b79
Make appearance button disabled.
TheKing-OfTime Nov 21, 2023
9770901
Fix typos
TheKing-OfTime Nov 21, 2023
d6dce3f
Merge remote-tracking branch 'origin/commands_levels' into commands_l…
TheKing-OfTime Nov 21, 2023
9c1d4ed
debug
TheKing-OfTime Jan 6, 2024
b555897
Fix typos
TheKing-OfTime Jan 6, 2024
f72e525
Merge branch 'master' into commands_levels
TheKing-OfTime Aug 28, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .editorconfig
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
charset = utf-8
end_of_line = crlf
indent_size = 4
indent_style = space
indent_style = tab
insert_final_newline = false
max_line_length = 120
tab_width = 4
Expand Down Expand Up @@ -196,7 +196,7 @@ ij_typescript_wrap_comments = true
indent_size = 2
indent_style = tab
max_line_length = 80
tab_width = 2
tab_width = 4
ij_continuation_indent_size = 2
ij_javascript_align_imports = false
ij_javascript_align_multiline_array_initializer_expression = false
Expand Down
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@
/*.bat
/.idea
/.env
/commands/levels/UserLevelCard/cache/
/BaseClasses/
/commands/diplomacy/
/Error/
/libs/
/libs/
2 changes: 1 addition & 1 deletion commands/handler/functions/autoThread.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ module.exports = {
title += name + ' ' + time;
}

msg.startThread({ name: title });
await msg.startThread({ name: title });
}

};
6 changes: 3 additions & 3 deletions commands/handler/functions/pingPromoter.js
Original file line number Diff line number Diff line change
Expand Up @@ -43,14 +43,14 @@ module.exports = {
if(embed) {
msg.log('Embed found');
break;
};
}

};
}

if(!embed?.description?.includes('Успешный Up!')) {
msg.log('Embed is invalid. Description: ' + embed.description);
return;
};
}

msg.log('CD started');
await sleep(this.COOLDOWN_UP);
Expand Down
79 changes: 79 additions & 0 deletions commands/levels/UserLevelCard/CacheController.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
const fs = require('fs').promises;
const p = require('path')

class CacheController {

#path = '';
#type = '';

constructor (path, type) {
this.#path = path.slice(0, -9) + "/UserLevelCard/cache/" + type
this.#type = '/' + type
console.log("Cache controller connected: " + this.#path);
this.clearAll();
}

async get(name) {
const endPath = this.#path + '/' + name;
let data = null;
const displayPlace = this.#type + '/' + name;
console.log("Getting cached data from: " + displayPlace);
try {
data = await fs.readFile(endPath);
} catch (e) {
console.log("Failed to get cache");
return null;
}
console.log("Cache found in: " + displayPlace);
return data;
}

async getAsJson(name) {
const endPath = this.#path + '/' + name + '.json';
let data = null;
const displayPlace = this.#type + '/' + name + '.json';
console.log("Getting cached data from: " + displayPlace);

try {
data = JSON.parse(await fs.readFile(endPath, 'utf8'));
} catch (e) {
console.log('Cache not found');
return null;
}
console.log("Cache found in: " + displayPlace);
return data;
}

async set(name, file) {
const displayPlace = this.#type + '/' + name + ' (' + file.length + ')';
console.log("Writing cached data to: " + displayPlace)
try {
await fs.writeFile(this.#path + '/' + name, file, {encoding: 'utf-8', })
} catch {
console.log("Failed to write cache")
return null
}
console.log("Cache written to: " + displayPlace)
return true
}

async setAsJson(name, object) {
await this.set(name + '.json', JSON.stringify(object));
}

async clear(name) {
console.log('Clearing cache: ' + this.#type + ' ' + name)
await fs.rm(this.#path + '/' + name)
}

async clearAll() {
console.log('Clearing all caches: ' + this.#type)
const files = await fs.readdir(this.#path + '/')
for (const file of files) {
await this.clear(file)
}
console.log('Caches cleared: ' + this.#type)
}
}

module.exports = CacheController
16 changes: 16 additions & 0 deletions commands/levels/UserLevelCard/CanvasWrapper.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
const CanvasElement = require('./wrapperClasses/CanvasElement');
const Icon = require('./wrapperClasses/Icon');
const Rect = require('./wrapperClasses/Rect');
const TextBox = require('./wrapperClasses/TextBox');
const Label = require('./wrapperClasses/Label');
const ProgressBar = require('./wrapperClasses/ProgressBar');


module.exports = {
CanvasElement,
Rect,
TextBox,
Icon,
Label,
ProgressBar
}
Loading