mirror of
https://github.com/toast-ts/Daggerbot-TS.git
synced 2024-11-18 04:40:59 -05:00
Compare commits
2 Commits
eba24d6570
...
584ffc1d6a
Author | SHA1 | Date | |
---|---|---|---|
|
584ffc1d6a | ||
|
e4c92f732e |
13
README.md
13
README.md
@ -1,8 +1,8 @@
|
|||||||
<p align="center">
|
<p align="center">
|
||||||
<img width="630" height="250" src="https://github.com/toast-ts/Daggerbot-TS/assets/96593068/87a3c8b2-2209-42f0-851c-6cdebf9ef740">
|
<img width="630" height="250" src="https://github.com/toast-ts/Daggerbot-TS/assets/96593068/87a3c8b2-2209-42f0-851c-6cdebf9ef740">
|
||||||
<h1 align="center">Daggerbot V3 Description</h1>
|
<h1 align="center">Daggerbot V3 Description</h1>
|
||||||
|
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
This is a repository for V3 revision that has been transitioned and rewritten from V2 bot to be more robust and reliable with today's standards.
|
This is a repository for V3 revision that has been transitioned and rewritten from V2 bot to be more robust and reliable with today's standards.
|
||||||
|
|
||||||
This revision took **4 months** (Late September to Mid December) working on and off to do literally everything that needed a rewrite so badly that it cannot be done in V2.
|
This revision took **4 months** (Late September to Mid December) working on and off to do literally everything that needed a rewrite so badly that it cannot be done in V2.
|
||||||
@ -21,6 +21,15 @@ If you're looking for V2 revision, it has been moved to a [branch called `old`](
|
|||||||
|
|
||||||
This is a revision history of how far we come in development cycle;
|
This is a revision history of how far we come in development cycle;
|
||||||
| Revision | Language | Library | Commands |
|
| Revision | Language | Library | Commands |
|
||||||
|---------|----------|-----------|----------|
|
|----------|----------|---------|----------|
|
||||||
| V1 | JavaScript | Discord.JS v13 | Message commands |
|
| V1 | JavaScript | Discord.JS v13 | Message commands |
|
||||||
| V2-V3 | TypeScript | Discord.JS v14 | Slash/message commands |
|
| V2-V3 | TypeScript | Discord.JS v14 | Slash/message commands |
|
||||||
|
|
||||||
|
## CLI arguments (`process.argv[..]`)
|
||||||
|
`yarn dev` - Starts the development bot with predefined args.
|
||||||
|
The args in question is;
|
||||||
|
| Argument | Usage |
|
||||||
|
|----------|-------|
|
||||||
|
| `src/DB-Beta.config.json` | Location of config file - [2] |
|
||||||
|
| `daggerbotbeta` | Service name in TokenService to fetch tokens data from - [3] |
|
||||||
|
| `true` | Toggle debug mode in Discord.js library - [4] |
|
||||||
|
@ -20,11 +20,11 @@ export default class CanvasBuilder {
|
|||||||
// Handle negative
|
// Handle negative
|
||||||
for (const [i, change] of data.entries()) if (change < 0) data[i] = data[i - 1] || data[i + 1] || 0;
|
for (const [i, change] of data.entries()) if (change < 0) data[i] = data[i - 1] || data[i + 1] || 0;
|
||||||
|
|
||||||
const LBdataFirst = Math.ceil(Math.max(...data) * 10 ** (-Math.max(...data).toString().split('').length + 2)) * 10 ** (Math.max(...data).toString().split('').length - 2)
|
const LB_MAX_VAL = Math.max(...data);
|
||||||
const LBdataSecond = Math.ceil(Math.max(...data) * 10 ** (-Math.max(...data).toString().split('').length + 3)) * 10 ** (Math.max(...data).toString().split('').length - 3)
|
const LB_SCALE_UP = Math.pow(10, -Math.floor(Math.log10(LB_MAX_VAL)));
|
||||||
|
const LB_SCALED_DATA = Math.ceil(LB_MAX_VAL*LB_SCALE_UP) / LB_SCALE_UP;
|
||||||
|
|
||||||
const firstTop = type === 'leaderboard' ? LBdataFirst : 16;
|
const top = type === 'leaderboard' ? LB_SCALED_DATA : 16;
|
||||||
const secondTop = type === 'leaderboard' ? LBdataSecond : 16;
|
|
||||||
const textSize = 40;
|
const textSize = 40;
|
||||||
const origin = [15, 65];
|
const origin = [15, 65];
|
||||||
const size = [1300, 630];
|
const size = [1300, 630];
|
||||||
@ -37,7 +37,7 @@ export default class CanvasBuilder {
|
|||||||
|
|
||||||
const intervalCandidates:[number, number, number][] = [];
|
const intervalCandidates:[number, number, number][] = [];
|
||||||
for (let i = 4; i < 10; i++) {
|
for (let i = 4; i < 10; i++) {
|
||||||
const interval = firstTop / i;
|
const interval = top / i;
|
||||||
if (Number.isInteger(interval)) intervalCandidates.push([interval, i, i * Math.max(interval.toString().split('').filter(x=>x === '0').length / interval.toString().length, 0.3) * (['1', '2', '4', '5', '6', '8'].includes(interval.toString()[0]) ? 1.5 : 0.67)]);
|
if (Number.isInteger(interval)) intervalCandidates.push([interval, i, i * Math.max(interval.toString().split('').filter(x=>x === '0').length / interval.toString().length, 0.3) * (['1', '2', '4', '5', '6', '8'].includes(interval.toString()[0]) ? 1.5 : 0.67)]);
|
||||||
}
|
}
|
||||||
const chosenInterval = intervalCandidates.sort((a,b)=>b[2]-a[2])[0];
|
const chosenInterval = intervalCandidates.sort((a,b)=>b[2]-a[2])[0];
|
||||||
@ -45,7 +45,7 @@ export default class CanvasBuilder {
|
|||||||
this.ctx.strokeStyle = this.palette.oddHorizontal;
|
this.ctx.strokeStyle = this.palette.oddHorizontal;
|
||||||
|
|
||||||
for (let i = 0; i <= chosenInterval[1]; i++) {
|
for (let i = 0; i <= chosenInterval[1]; i++) {
|
||||||
const y = origin[1] + size[1] - (i * (chosenInterval[0] / secondTop) * size[1]);
|
const y = origin[1] + size[1] - (i * (chosenInterval[0] / top) * size[1]);
|
||||||
if (y < origin[1]) continue;
|
if (y < origin[1]) continue;
|
||||||
const even = ((i + 1) % 2) === 0;
|
const even = ((i + 1) % 2) === 0;
|
||||||
if (even) this.ctx.strokeStyle = this.palette.evenHorizontal;
|
if (even) this.ctx.strokeStyle = this.palette.evenHorizontal;
|
||||||
@ -82,7 +82,7 @@ export default class CanvasBuilder {
|
|||||||
for (let [i, currentValue] of data.entries()) {
|
for (let [i, currentValue] of data.entries()) {
|
||||||
if (currentValue < 0) currentValue = 0;
|
if (currentValue < 0) currentValue = 0;
|
||||||
const X = i * nodeWidth + origin[0];
|
const X = i * nodeWidth + origin[0];
|
||||||
const Y = ((1 - (currentValue / secondTop)) * size[1]) + origin[1];
|
const Y = ((1 - (currentValue / top)) * size[1]) + origin[1];
|
||||||
const nextValue = data[i + 1];
|
const nextValue = data[i + 1];
|
||||||
const previousValue = data[i - 1];
|
const previousValue = data[i - 1];
|
||||||
this.ctx.strokeStyle = type === 'players' ? gradient : null;
|
this.ctx.strokeStyle = type === 'players' ? gradient : null;
|
||||||
@ -103,7 +103,7 @@ export default class CanvasBuilder {
|
|||||||
this.ctx.closePath();
|
this.ctx.closePath();
|
||||||
|
|
||||||
if (currentValue !== previousValue || currentValue !== nextValue) {
|
if (currentValue !== previousValue || currentValue !== nextValue) {
|
||||||
// Ball. What else?
|
// Balls. What else? I mean.. I'm not that creative, I'm just a comment not a funny comedian.
|
||||||
this.ctx.fillStyle = type === 'players' ? gradient : null;
|
this.ctx.fillStyle = type === 'players' ? gradient : null;
|
||||||
this.ctx.beginPath();
|
this.ctx.beginPath();
|
||||||
this.ctx.arc(X, Y, this.ctx.lineWidth * 1.2, 0, 2 * Math.PI);
|
this.ctx.arc(X, Y, this.ctx.lineWidth * 1.2, 0, 2 * Math.PI);
|
||||||
@ -131,6 +131,7 @@ export default class CanvasBuilder {
|
|||||||
// Time
|
// Time
|
||||||
this.ctx.fillText('time ->', origin[0] + (textSize / 2), origin[1] + size[1] + (textSize));
|
this.ctx.fillText('time ->', origin[0] + (textSize / 2), origin[1] + size[1] + (textSize));
|
||||||
|
|
||||||
|
// 100degree the fuck back to sender.
|
||||||
return this.canvas;
|
return this.canvas;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user