Skip to content
This repository has been archived by the owner on Nov 11, 2024. It is now read-only.

chore(release): version 3.1.0 #949

Merged
merged 33 commits into from
Oct 29, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
33 commits
Select commit Hold shift + click to select a range
43fe96f
chore: change version
Mednoob Jun 2, 2022
5ac397b
chore: change version
Mednoob Jun 2, 2022
b372e87
chore: Merge branch 'feat/3.1.0' of https://github.com/Clytage/rawon …
Mednoob Jun 3, 2022
323a143
feat(utils/functions): add normalizeTime util
Mednoob Jun 3, 2022
21d87dd
feat(NowPlayingCommand): add song progress bar
Mednoob Jun 3, 2022
6da5d55
feat(NowPlayingCommand): remove useless ternary
Mednoob Jun 8, 2022
627f901
fix(AboutCommand): set import assertion for importing `package.json`
Mednoob Jun 8, 2022
0dcbc2c
fix: fix embed `setAuthor` deprecation warning in some files
Mednoob Jun 8, 2022
221f2be
chore: change version
Mednoob Jun 2, 2022
a8c945b
feat(utils/functions): add normalizeTime util
Mednoob Jun 3, 2022
5d30a63
feat(NowPlayingCommand): add song progress bar
Mednoob Jun 3, 2022
c1273b8
feat(NowPlayingCommand): remove useless ternary
Mednoob Jun 8, 2022
a8ef73a
fix(AboutCommand): set import assertion for importing `package.json`
Mednoob Jun 8, 2022
5ee0950
fix: fix embed `setAuthor` deprecation warning in some files
Mednoob Jun 8, 2022
4a0aef1
chore: Merge branch 'feat/3.1.0' of https://github.com/Clytage/rawon …
Mednoob Jul 23, 2022
9f9b74d
chore(deps): update lockfile
Mednoob Jul 23, 2022
bb69f79
feat(JSONDataManager): minify data file
Mednoob Jul 23, 2022
3e3fd42
feat(SongManager): use incremental index instead of Date.now
Mednoob Jul 23, 2022
c8e0363
feat(index): make a reusable function to check env properties
Mednoob Jul 23, 2022
c8a27f2
Merge branch 'main' into feat/3.1.0
Mednoob Oct 9, 2022
e00f0a4
feat(index): set `force` to true in rmSync
Mednoob Oct 9, 2022
74dcf3a
chore: dropped support for Heroku (#1037)
Oct 9, 2022
6e4bd45
feat(readme): added tutorial video
Oct 9, 2022
ac483a2
chore: Merge branch 'feat/3.1.0' of https://github.com/Clytage/rawon …
Mednoob Oct 9, 2022
ad4c67f
feat(index): remove `dev.env` from git ignore if bot is running on gl…
Mednoob Oct 9, 2022
69f8550
Merge branch 'main' into feat/3.1.0
Oct 16, 2022
28f0b3f
Merge branch 'main' into feat/3.1.0
Mednoob Oct 24, 2022
b8197dc
feat: move progress bar as separate util
Mednoob Oct 28, 2022
9225de8
feat(VolumeCommand): add bar and buttons for no-args response
Mednoob Oct 28, 2022
40ed298
feat: Add Replit support (#1051)
Mednoob Oct 29, 2022
ad2e4ef
chore: change version
Mednoob Oct 29, 2022
1de8cca
chore: Merge branch 'feat/3.1.0' of https://github.com/Clytage/rawon …
Mednoob Oct 29, 2022
7a45d59
Merge branch 'main' into feat/3.1.0
Mednoob Oct 29, 2022
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
26 changes: 24 additions & 2 deletions .replit
Original file line number Diff line number Diff line change
@@ -1,2 +1,24 @@
language="nodejs"
run="npm start"
run = "npm run start"

[languages.typescript]
pattern = "**/{*.ts,*.js,*.tsx,*.jsx}"
syntax = "typescript"

[languages.typescript.languageServer]
start = [ "typescript-language-server", "--stdio" ]

[packager]
language = "nodejs"

[packager.features]
packageSearch = true
guessImports = true

[env]
XDG_CONFIG_HOME = "/home/runner/.config"

[nix]
channel = "stable-21_11"

[gitHubImport]
requiredFiles = [".replit", "replit.nix", ".config"]
1 change: 1 addition & 0 deletions .swcrc
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
{
"$schema": "https://json.schemastore.org/swcrc",
"jsc": {
"parser": {
"syntax": "typescript",
Expand Down
1 change: 0 additions & 1 deletion Procfile

This file was deleted.

9 changes: 4 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,10 +34,9 @@ $ npm start

## Hosting Setup

### Heroku
You can host this bot to make it stay online on Heroku.

<a href="https://heroku.com/deploy?template=https://github.com/Clytage/rawon"><img src="https://www.herokucdn.com/deploy/button.svg" alt="Deploy to Heroku"></a>
<a href="http://www.youtube.com/watch?feature=player_embedded&v=9csIDZYpaJM" target="_blank">
<img src="http://img.youtube.com/vi/9csIDZYpaJM/0.jpg" alt="Setup Guide Video" width="360" border="10" />
</a>

### Glitch
You can use Glitch too for this project, featured with its code editor.
Expand All @@ -46,7 +45,7 @@ You can use Glitch too for this project, featured with its code editor.
2. Go to [glitch.com](https://glitch.com) and make an account
3. Click **New Project** then **Import from GitHub**, specify the pop-up field with `https://github.com/<your-name>/rawon` (without `<>`)
4. Please wait for a while, this process takes some minutes
5. Find `.env` file and delete it, find `.env_example` file and rename it back to `.env`
5. Find `.env` file and delete it, then find `.env_example` file and rename it to `.env`
6. After specifying `.env`, open **Tools** > **Terminal**
7. Type `refresh`, and track the process from **Logs**

Expand Down
88 changes: 0 additions & 88 deletions app.json

This file was deleted.

94 changes: 40 additions & 54 deletions index.js
Original file line number Diff line number Diff line change
@@ -1,60 +1,46 @@
import { downloadExecutable } from "./yt-dlp-utils";
import { existsSync, readFileSync, writeFileSync, rmSync } from "fs";
import { execSync } from "child_process";
import { existsSync, rmSync } from "fs";
import { resolve } from "path";
import { Server } from "https";
import module from "module";

const isGlitch = (
process.env.PROJECT_DOMAIN !== undefined &&
process.env.PROJECT_INVITE_TOKEN !== undefined &&
process.env.API_SERVER_EXTERNAL !== undefined &&
process.env.PROJECT_REMIX_CHAIN !== undefined);
const ensureEnv = arr => arr.every(x => process.env[x] !== undefined);

const isReplit = (
process.env.REPLIT_DB_URL !== undefined &&
process.env.REPL_ID !== undefined &&
process.env.REPL_IMAGE !== undefined &&
process.env.REPL_LANGUAGE !== undefined &&
process.env.REPL_OWNER !== undefined &&
process.env.REPL_PUBKEYS !== undefined &&
process.env.REPL_SLUG !== undefined)
const isGlitch = ensureEnv([
"PROJECT_DOMAIN",
"PROJECT_INVITE_TOKEN",
"API_SERVER_EXTERNAL",
"PROJECT_REMIX_CHAIN"
]);

const isGitHub = (
process.env.GITHUB_ENV !== undefined &&
process.env.GITHUB_EVENT_PATH !== undefined &&
process.env.GITHUB_REPOSITORY_OWNER !== undefined &&
process.env.GITHUB_RETENTION_DAYS !== undefined &&
process.env.GITHUB_HEAD_REF !== undefined &&
process.env.GITHUB_GRAPHQL_URL !== undefined &&
process.env.GITHUB_API_URL !== undefined &&
process.env.GITHUB_WORKFLOW !== undefined &&
process.env.GITHUB_RUN_ID !== undefined &&
process.env.GITHUB_BASE_REF !== undefined &&
process.env.GITHUB_ACTION_REPOSITORY !== undefined &&
process.env.GITHUB_ACTION !== undefined &&
process.env.GITHUB_RUN_NUMBER !== undefined &&
process.env.GITHUB_REPOSITORY !== undefined &&
process.env.GITHUB_ACTION_REF !== undefined &&
process.env.GITHUB_ACTIONS !== undefined &&
process.env.GITHUB_WORKSPACE !== undefined &&
process.env.GITHUB_JOB !== undefined &&
process.env.GITHUB_SHA !== undefined &&
process.env.GITHUB_RUN_ATTEMPT !== undefined &&
process.env.GITHUB_REF !== undefined &&
process.env.GITHUB_ACTOR !== undefined &&
process.env.GITHUB_PATH !== undefined &&
process.env.GITHUB_EVENT_NAME !== undefined &&
process.env.GITHUB_SERVER_URL !== undefined
)
const isReplit = ensureEnv([
"REPLIT_DB_URL",
"REPL_ID",
"REPL_IMAGE",
"REPL_LANGUAGE",
"REPL_OWNER",
"REPL_PUBKEYS",
"REPL_SLUG"
]);

const isGitHub = ensureEnv([
"GITHUB_ENV",
"GITHUB_REPOSITORY_OWNER",
"GITHUB_HEAD_REF",
"GITHUB_API_URL",
"GITHUB_REPOSITORY",
"GITHUB_SERVER_URL"
]);

function npmInstall(deleteDir = false, forceInstall = false, additionalArgs = []) {
if (deleteDir) {
const modulesPath = resolve(process.cwd(), "node_modules");

if (existsSync(modulesPath)) {
rmSync(modulesPath, {
recursive: true
recursive: true,
force: true
});
}
}
Expand All @@ -63,6 +49,17 @@ function npmInstall(deleteDir = false, forceInstall = false, additionalArgs = []
}

if (isGlitch) {
const gitIgnorePath = resolve(process.cwd(), ".gitignore");
try {
const data = readFileSync(gitIgnorePath, "utf8").toString();
if (data.includes("dev.env")) {
writeFileSync(gitIgnorePath, data.replace("\ndev.env", ""));
console.info("Removed dev.env from .gitignore");
}
} catch {
console.error("Failed to remove dev.env from .gitignore");
}

try {
console.info("[INFO] Trying to re-install modules...");
npmInstall();
Expand All @@ -84,24 +81,13 @@ if (isGlitch) {
}
}

if (isReplit) {
console.warn("[WARN] We haven't added stable support for running this bot using Replit, bugs and errors may come up.");

if (Number(process.versions.node.split(".")[0]) < 16) {
console.info("[INFO] This Replit doesn't use Node.js v16 or newer, trying to install Node.js v16...");
execSync(`npm i --save-dev [email protected] && npm config set prefix=$(pwd)/node_modules/node && export PATH=$(pwd)/node_modules/node/bin:$PATH`);
console.info("[INFO] Node.js v16 has been installed, please restart the bot.");
process.exit(0);
}
}

if (isGitHub) {
console.warn("[WARN] Running this bot using GitHub is not recommended.");
}

const require = module.createRequire(import.meta.url);

if (!isGlitch) {
if (!isGlitch && !isReplit) {
try {
require("ffmpeg-static");
} catch {
Expand Down
15 changes: 13 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "rawon",
"version": "3.0.0",
"version": "3.1.0",
"description": "A simple powerful Discord music bot built to fulfill your production desires. Easy to use, with no coding required.",
"main": "index.js",
"type": "module",
Expand Down
12 changes: 12 additions & 0 deletions replit.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{ pkgs }: {
deps = [
pkgs.python38
pkgs.ffmpeg.bin
pkgs.yarn
pkgs.esbuild
pkgs.nodejs-16_x

pkgs.nodePackages.typescript
pkgs.nodePackages.typescript-language-server
];
}
4 changes: 3 additions & 1 deletion src/commands/moderation/ModLogsCommand.ts
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,9 @@ export class ModLogsCommand extends BaseCommand {
ctx.reply({
embeds: [
createEmbed("info")
.setAuthor(i18n.__("commands.moderation.modlogs.embedTitle"))
.setAuthor({
name: i18n.__("commands.moderation.modlogs.embedTitle")
})
.addField(
`${this.client.config.mainPrefix}modlogs enable`,
i18n.__("commands.moderation.modlogs.slashEnableDescription")
Expand Down
4 changes: 3 additions & 1 deletion src/commands/music/DJCommand.ts
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,9 @@ export class DJCommand extends BaseCommand {
ctx.reply({
embeds: [
createEmbed("info")
.setAuthor(i18n.__("commands.music.dj.embedTitle"))
.setAuthor({
name: i18n.__("commands.music.dj.embedTitle")
})
.addField(
`${this.client.config.mainPrefix}dj enable`,
i18n.__("commands.music.dj.slashEnableDescription")
Expand Down
Loading