Skip to content

Commit

Permalink
Update to kazagumo.mod@v1.1.0
Browse files Browse the repository at this point in the history
  • Loading branch information
RainyXeon committed Dec 24, 2023
1 parent c080dd7 commit 5ee45cf
Show file tree
Hide file tree
Showing 14 changed files with 2,657 additions and 1,052 deletions.
6 changes: 4 additions & 2 deletions .github/ISSUE_TEMPLATE/bug_report.md
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
---
name: Bug report
about: Create a report to help us improve
title: ''
title: ""
labels: bug
assignees: RainyXeon

---

**Describe the bug**
A clear and concise description of what the bug is.

**To Reproduce**
Steps to reproduce the behavior:

1. Go to '...'
2. Click on '....'
3. Scroll down to '....'
Expand All @@ -24,6 +24,7 @@ A clear and concise description of what you expected to happen.
If applicable, add screenshots to help explain your problem.

**Host info: (use `/info status` command and paste here, below is example)**

- OS: Linux 6.2.0-1016-aws (x64)
- CPU: AMD EPYC 7R13 Processor
- Uptime: 1m 10.3s
Expand All @@ -32,6 +33,7 @@ If applicable, add screenshots to help explain your problem.
- Node.js: v21.1.0

**Bot info (use `/info status` command and paste here, below is example):**

- Codename: hatsuharu (AzurLane)
- Bot version: 3.0.4
- Autofix version: 4.1.0
Expand Down
3 changes: 1 addition & 2 deletions .github/ISSUE_TEMPLATE/feature_request.md
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
---
name: Feature request
about: Suggest an idea for this project
title: ''
title: ""
labels: enhancement, help wanted
assignees: RainyXeon

---

**Is your feature request related to a problem? Please describe.**
Expand Down
5 changes: 1 addition & 4 deletions .github/ISSUE_TEMPLATE/some-small-help.md
Original file line number Diff line number Diff line change
@@ -1,10 +1,7 @@
---
name: Some small help
about: Some small help that u need owner to help with
title: ''
title: ""
labels: help wanted, question
assignees: RainyXeon

---


11 changes: 5 additions & 6 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,12 @@ name: Build release

on:
push:
branches: [ "main" ]
branches: ["main"]
pull_request:
branches: [ "main" ]
branches: ["main"]

jobs:
build:

runs-on: ubuntu-latest

strategy:
Expand Down Expand Up @@ -45,15 +44,15 @@ jobs:
key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }}
restore-keys: |
${{ runner.os }}-pnpm-store-
- name: Install dependencies
run: pnpm install

- name: Build bot
run: node build.mjs build:github

- name: Push ByteBlaze build zip to artifact
uses: actions/upload-artifact@v3
with:
name: "ByteBlaze"
path: out/
path: out/
4 changes: 2 additions & 2 deletions app.example.yml
Original file line number Diff line number Diff line change
Expand Up @@ -58,10 +58,10 @@ features:

MESSAGE_CONTENT:
enable: true
commands:
commands:
enable: true
prefix: "d!" # The prefix you want

AUTOFIX_LAVALINK: # Fix the lavalink server when the current is down
enable: true
reconnectTries: 5
Expand Down
72 changes: 33 additions & 39 deletions build.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ import archiver from "dir-archiver";
import { XMLParser, XMLBuilder } from "fast-xml-parser";
import fse from "fs-extra";
import { plsParseArgs } from "plsargs";
import copydir from 'copy-dir';
import path from "path"
import copydir from "copy-dir";
import path from "path";
const args = plsParseArgs(process.argv.slice(2));
const parser = new XMLParser();
const builder = new XMLBuilder();
Expand All @@ -30,7 +30,7 @@ const ignored = [
"pnpm-lock.yaml",
"tsconfig.json",
".github",
"out"
"out",
];

function logger(data, type) {
Expand All @@ -53,40 +53,40 @@ if (!acceptedParams.includes(args.get(0))) {
}

if (args.get(0) == acceptedParams[0]) {
const checkDir = ["./dist", "./out", "./.cylane", "./logs"]
const checkDir = ["./dist", "./out", "./.cylane", "./logs"];

checkDir.forEach(async (data) => {
if (fse.existsSync(data))
if (fse.existsSync(data))
fse.rmdirSync(data, { recursive: true, force: true });
})
});

logger("Clean successfully!", "info");
process.exit();
}

console.log(args.get(0), acceptedParams[2])
console.log(args.get(0), acceptedParams[2]);

if (args.get(0) == acceptedParams[2]) {
const child = spawn(/^win/.test(process.platform) ? "npm.cmd" : "npm", [
"run",
"build:full",
]);

child.stdout.on("data", (data) => {
logger(data, "build");
});

child.stderr.on("data", (data) => {
logger(data, "build");
});

child.on("error", (error) => {
logger(error.message, "error");
});

child.on("close", async (code) => {
logger(`Build finished with code ${code}`, "build");

// Edit manifest
const manifestRaw = fse.readFileSync("./dist/manifest.xml", "utf-8");
const manifest = parser.parse(manifestRaw);
Expand All @@ -101,33 +101,30 @@ if (args.get(0) == acceptedParams[2]) {
`\n` +
"<!-- You will be responsible for this when changing any content in the file. -->" +
`\n`;

manifest.metadata.bot.version = `${botVersion}+${objectDate}`;

fse.writeFileSync(
"./dist/manifest.xml",
builder.build(manifest) + warningData,
"utf-8"
);

logger(
"Edit manifest file complete!",
"build"
);

logger("Edit manifest file complete!", "build");

await fse.mkdir("./out");
await fse.mkdir("./out/ByteBlaze");

copydir.sync('.', './out/ByteBlaze', {
filter: function(stat, filepath, filename){
if(stat === 'file' && ignored.includes(filename)) {
copydir.sync(".", "./out/ByteBlaze", {
filter: function (stat, filepath, filename) {
if (stat === "file" && ignored.includes(filename)) {
return false;
}
if (stat === 'directory' && ignored.includes(filename)) {
if (stat === "directory" && ignored.includes(filename)) {
return false;
}
return true; // remind to return a true value when file check passed.
}
return true; // remind to return a true value when file check passed.
},
});
});
} else {
Expand All @@ -136,22 +133,22 @@ if (args.get(0) == acceptedParams[2]) {
"run",
"build:full",
]);

child.stdout.on("data", (data) => {
logger(data, "build");
});

child.stderr.on("data", (data) => {
logger(data, "build");
});

child.on("error", (error) => {
logger(error.message, "error");
});

child.on("close", async (code) => {
logger(`Build finished with code ${code}`, "build");

// Edit manifest
const manifestRaw = fse.readFileSync("./dist/manifest.xml", "utf-8");
const manifest = parser.parse(manifestRaw);
Expand All @@ -166,24 +163,21 @@ if (args.get(0) == acceptedParams[2]) {
`\n` +
"<!-- You will be responsible for this when changing any content in the file. -->" +
`\n`;

manifest.metadata.bot.version = `${botVersion}+${objectDate}`;

fse.writeFileSync(
"./dist/manifest.xml",
builder.build(manifest) + warningData,
"utf-8"
);

logger(
"Edit manifest file complete!",
"build"
);


logger("Edit manifest file complete!", "build");

// Archive build
await fse.mkdir("./out");
const path = `./out/ByteBlaze.zip`;

const zipper = new archiver(".", path, false, ignored);
zipper.createZip();
logger("Archive all build file successfully!!!", "build");
Expand Down
18 changes: 9 additions & 9 deletions clearSlash.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -8,17 +8,18 @@ config();

class ClearSlash {
constructor() {
this.execute()
this.execute();
}

async execute() {
const configData = this.ConfigData
const configData = this.ConfigData;
const rest = new REST({ version: "10" }).setToken(configData.bot.TOKEN);
const client = await rest.get(Routes.user());

rest.put(Routes.applicationCommands(client.id), { body: [] })
.then(() => console.log('Successfully deleted all application commands.'))
.catch(console.error);

rest
.put(Routes.applicationCommands(client.id), { body: [] })
.then(() => console.log("Successfully deleted all application commands."))
.catch(console.error);
}

get ConfigData() {
Expand Down Expand Up @@ -66,8 +67,7 @@ class ClearSlash {
process.env[extract[1]] &&
boolean.includes(process.env[extract[1]].trim().toLowerCase())
) {
const boolean_prase_res =
this.parseBoolean(process.env[extract[1]]);
const boolean_prase_res = this.parseBoolean(process.env[extract[1]]);
res_array.push(
_.replace(element, extract[0], String(boolean_prase_res))
);
Expand Down Expand Up @@ -113,4 +113,4 @@ class ClearSlash {
}
}

new ClearSlash()
new ClearSlash();
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@
"fs-extra": "^11.1.1",
"humanize-duration": "^3.30.0",
"js-yaml": "^4.1.0",
"kazagumo.mod": "^1.0.0",
"kazagumo.mod": "^1.1.0",
"lodash": "^4.17.21",
"markdown-it": "^13.0.2",
"moment": "^2.29.4",
Expand Down
Loading

0 comments on commit 5ee45cf

Please sign in to comment.