Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Huge Migration #17

Open
wants to merge 42 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
42 commits
Select commit Hold shift + click to select a range
611605a
fix
AstroX11 Jan 16, 2025
e6c44bf
fixing
AstroX11 Jan 16, 2025
a19bac8
breaking chnages
AstroX11 Jan 16, 2025
97368cb
Update antispam.js
AstroX11 Jan 16, 2025
7ccc98b
fix
AstroX11 Jan 16, 2025
99e0c2b
Update antiword.js
AstroX11 Jan 16, 2025
ae68a88
Update areact.js
AstroX11 Jan 16, 2025
930d035
Update ban.js
AstroX11 Jan 16, 2025
a15cfde
Update bgm.js
AstroX11 Jan 16, 2025
73e9fc6
fix
AstroX11 Jan 16, 2025
d23fda0
Update greetings.js
AstroX11 Jan 16, 2025
683372a
Update group_event.js
AstroX11 Jan 16, 2025
0fdcd41
Update mention.js
AstroX11 Jan 16, 2025
82f0fd9
Update mention.js
AstroX11 Jan 16, 2025
9ba4bf5
Update notes.js
AstroX11 Jan 16, 2025
11e317c
Update plugins.js
AstroX11 Jan 16, 2025
d59f972
fix
AstroX11 Jan 16, 2025
0b30b81
fix
AstroX11 Jan 16, 2025
3870f0c
Update warn.js
AstroX11 Jan 16, 2025
f6a348b
Update store.js
AstroX11 Jan 16, 2025
45f102b
fix
AstroX11 Jan 16, 2025
bfd45d1
fixing
AstroX11 Jan 16, 2025
0282ab0
fix
AstroX11 Jan 16, 2025
98679d7
fix
AstroX11 Jan 16, 2025
02e75fb
Update group.js
AstroX11 Jan 17, 2025
c85b497
Update plugins.js
AstroX11 Jan 17, 2025
465c2a2
tests
AstroX11 Jan 17, 2025
920d56a
update
AstroX11 Jan 17, 2025
d4fe6f4
Update readme.md
AstroX11 Jan 17, 2025
4b81b4a
Update readme.md
AstroX11 Jan 17, 2025
f68b469
update
AstroX11 Jan 17, 2025
61c6ca7
Update readme.md
AstroX11 Jan 17, 2025
b10266b
Update readme.md
AstroX11 Jan 17, 2025
52b8cb2
Update readme.md
AstroX11 Jan 17, 2025
5dbfd66
basing
AstroX11 Jan 18, 2025
435f6e7
fix
AstroX11 Jan 18, 2025
52e3a53
building
AstroX11 Jan 18, 2025
b37bc72
Update lib/events.js
AstroX11 Jan 18, 2025
c4d8f1d
antidelete feature remastered
AstroX11 Jan 19, 2025
1c255d0
sudo improved
AstroX11 Jan 19, 2025
88dfff0
better command execution
AstroX11 Jan 19, 2025
ba6d2d2
chore: removed meta
AstroX11 Jan 19, 2025
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
18 changes: 10 additions & 8 deletions .github/ISSUE_TEMPLATE/bug_report.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,14 @@ about: Create a report to help us improve
title: ''
labels: ''
assignees: ''

---

**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,15 +24,17 @@ A clear and concise description of what you expected to happen.
If applicable, add screenshots to help explain your problem.

**Desktop (please complete the following information):**
- OS: [e.g. iOS]
- Browser [e.g. chrome, safari]
- Version [e.g. 22]

- OS: [e.g. iOS]
- Browser [e.g. chrome, safari]
- Version [e.g. 22]

**Smartphone (please complete the following information):**
- Device: [e.g. iPhone6]
- OS: [e.g. iOS8.1]
- Browser [e.g. stock browser, safari]
- Version [e.g. 22]

- Device: [e.g. iPhone6]
- OS: [e.g. iOS8.1]
- Browser [e.g. stock browser, safari]
- Version [e.g. 22]

**Additional context**
Add any other context about the problem here.
1 change: 0 additions & 1 deletion .github/ISSUE_TEMPLATE/feature_request.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ about: Suggest an idea for this project
title: ''
labels: ''
assignees: ''

---

**Is your feature request related to a problem? Please describe.**
Expand Down
50 changes: 25 additions & 25 deletions .github/contributing.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,28 +8,28 @@
2. **Clone the Forked Repository**

- Download your forked repository to your local machine:
```bash
git clone https://github.com/<your-username>/Xstro.git
cd Xstro
```
```bash
git clone https://github.com/<your-username>/Xstro.git
cd Xstro
```

3. **Set Upstream for Updates**

- Add the main Xstro repository as the `upstream` to ensure you can sync changes from the original project:
```bash
git remote add upstream https://github.com/AstroX11/Xstro.git
```
```bash
git remote add upstream https://github.com/AstroX11/Xstro.git
```
- Verify the remote repositories:
```bash
git remote -v
```
```bash
git remote -v
```

4. **Create a New Branch**

- Always create a separate branch for your contributions to keep your work organized:
```bash
git checkout -b feature/your-feature-name
```
```bash
git checkout -b feature/your-feature-name
```
- Use a descriptive branch name that reflects your changes, such as `bugfix/issue-12` or `feature/add-auth`.

5. **Make Your Changes**
Expand All @@ -45,17 +45,17 @@
7. **Commit Your Changes**
- Stage your changes and write a clear, concise commit message:
```bash
git add .
git commit -m "Description of changes, e.g., Fix login issue #12"
```
```bash
git add .
git commit -m "Description of changes, e.g., Fix login issue #12"
```
8. **Push to Your Fork**
- Push your changes to the branch in your forked repository:
```bash
git push origin feature/your-feature-name
```
```bash
git push origin feature/your-feature-name
```
9. **Submit a Pull Request**
Expand All @@ -64,13 +64,13 @@
- Add a meaningful title and a detailed explanation of your changes.
- Submit the pull request to the `main` branch of the original Xstro repository.
10. **Review Process**
10. **Review Process**
- The maintainers will review your pull request. If changes are required, they will provide feedback.
- Make the requested updates and push them to the same branch to update the pull request.
- The maintainers will review your pull request. If changes are required, they will provide feedback.
- Make the requested updates and push them to the same branch to update the pull request.
11. **Merge or Close**
- Once your changes are approved, they will be merged into the main repository. If not, the maintainers may explain why the contribution doesn’t fit and provide guidance.
11. **Merge or Close**
- Once your changes are approved, they will be merged into the main repository. If not, the maintainers may explain why the contribution doesn’t fit and provide guidance.
---
Expand Down
6 changes: 3 additions & 3 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
version: 2
updates:
- package-ecosystem: "npm"
directory: "/"
- package-ecosystem: 'npm'
directory: '/'
schedule:
interval: "weekly"
interval: 'weekly'
104 changes: 54 additions & 50 deletions .github/js/panel.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,75 +3,79 @@ import { spawnSync } from 'node:child_process';
import { join, resolve } from 'node:path';

const CONFIG = {
SESSION_ID: '', // Put your Session ID Here kid!
PROJECT_DIR: 'Xstro',
REPO_URL: 'https://github.com/AstroX11/Xstro.git',
APP_NAME: 'Xstro',
MAIN_SCRIPT: 'index.js',
SESSION_ID: '', // Put your Session ID Here kid!
PROJECT_DIR: 'Xstro',
REPO_URL: 'https://github.com/AstroX11/Xstro.git',
APP_NAME: 'Xstro',
MAIN_SCRIPT: 'index.js',
};

function handleError(message, error) {
console.error(message, error);
process.exit(1);
console.error(message, error);
process.exit(1);
}

function cloneRepository() {
console.log('Cloning repository...');
const cloneResult = spawnSync('git', ['clone', CONFIG.REPO_URL, CONFIG.PROJECT_DIR], {
stdio: 'inherit',
shell: true, // For Windows compatibility
});
if (cloneResult.error || cloneResult.status !== 0) {
handleError('Failed to clone repository.', cloneResult.error);
}
console.log('Cloning repository...');
const cloneResult = spawnSync('git', ['clone', CONFIG.REPO_URL, CONFIG.PROJECT_DIR], {
stdio: 'inherit',
shell: true, // For Windows compatibility
});
if (cloneResult.error || cloneResult.status !== 0) {
handleError('Failed to clone repository.', cloneResult.error);
}
}

function writeEnvFile() {
try {
writeFileSync(join(CONFIG.PROJECT_DIR, '.env'), `SESSION_ID=${CONFIG.SESSION_ID}`);
} catch (error) {
handleError('Failed to write .env file', error);
}
try {
writeFileSync(join(CONFIG.PROJECT_DIR, '.env'), `SESSION_ID=${CONFIG.SESSION_ID}`);
} catch (error) {
handleError('Failed to write .env file', error);
}
}

function installDependencies() {
console.log('Installing dependencies...');
const installResult = spawnSync('yarn', ['install'], {
cwd: resolve(CONFIG.PROJECT_DIR),
stdio: 'inherit',
shell: true, // Ensure compatibility with Windows
});
if (installResult.error || installResult.status !== 0) {
handleError('Failed to install dependencies.', installResult.error);
}
console.log('Installing dependencies...');
const installResult = spawnSync('yarn', ['install'], {
cwd: resolve(CONFIG.PROJECT_DIR),
stdio: 'inherit',
shell: true, // Ensure compatibility with Windows
});
if (installResult.error || installResult.status !== 0) {
handleError('Failed to install dependencies.', installResult.error);
}
}

function startApplication() {
console.log('Starting application...');
const startResult = spawnSync('pm2', ['start', CONFIG.MAIN_SCRIPT, '--name', CONFIG.APP_NAME, '--attach'], {
cwd: resolve(CONFIG.PROJECT_DIR),
stdio: 'inherit',
shell: true, // Ensure compatibility with Windows
});
console.log('Starting application...');
const startResult = spawnSync(
'pm2',
['start', CONFIG.MAIN_SCRIPT, '--name', CONFIG.APP_NAME, '--attach'],
{
cwd: resolve(CONFIG.PROJECT_DIR),
stdio: 'inherit',
shell: true, // Ensure compatibility with Windows
}
);

if (startResult.error || startResult.status !== 0) {
console.error('PM2 start failed. Falling back to Node.js.');
const nodeResult = spawnSync('node', [CONFIG.MAIN_SCRIPT], {
cwd: resolve(CONFIG.PROJECT_DIR),
stdio: 'inherit',
shell: true,
});
if (nodeResult.error || nodeResult.status !== 0) {
handleError('Failed to start the application with Node.js.', nodeResult.error);
}
}
if (startResult.error || startResult.status !== 0) {
console.error('PM2 start failed. Falling back to Node.js.');
const nodeResult = spawnSync('node', [CONFIG.MAIN_SCRIPT], {
cwd: resolve(CONFIG.PROJECT_DIR),
stdio: 'inherit',
shell: true,
});
if (nodeResult.error || nodeResult.status !== 0) {
handleError('Failed to start the application with Node.js.', nodeResult.error);
}
}
}

function XstroPanel() {
if (!existsSync(CONFIG.PROJECT_DIR)) cloneRepository();
writeEnvFile();
installDependencies();
startApplication();
if (!existsSync(CONFIG.PROJECT_DIR)) cloneRepository();
writeEnvFile();
installDependencies();
startApplication();
}

XstroPanel();
4 changes: 2 additions & 2 deletions .github/js/test.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { getChatSummary, getName } from '../../sql/store.js';

console.log(await getChatSummary());
console.log(await getChatSummary());

// console.log(await getName('[email protected]'))
// console.log(await getName('[email protected]'))
20 changes: 10 additions & 10 deletions .github/workflows/docker-image.yml
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
name: Docker Image Build

on:
push:
branches: ['master']
pull_request:
branches: ['master']
push:
branches: ['master']
pull_request:
branches: ['master']

jobs:
build:
runs-on: ubuntu-latest
build:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v4
- name: Build the Docker image
run: docker build . --file Dockerfile --tag my-image-name:$(date +%s)
steps:
- uses: actions/checkout@v4
- name: Build the Docker image
run: docker build . --file Dockerfile --tag my-image-name:$(date +%s)
8 changes: 3 additions & 5 deletions .github/workflows/docker-publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,22 +9,20 @@ on:
schedule:
- cron: '27 21 * * *'
push:
branches: [ "master" ]
branches: ['master']
# Publish semver tags as releases.
tags: [ 'v*.*.*' ]
tags: ['v*.*.*']
pull_request:
branches: [ "master" ]
branches: ['master']

env:
# Use docker.io for Docker Hub if empty
REGISTRY: ghcr.io
# github.repository as <account>/<repo>
IMAGE_NAME: ${{ github.repository }}


jobs:
build:

runs-on: ubuntu-latest
permissions:
contents: read
Expand Down
13 changes: 6 additions & 7 deletions .github/workflows/greetings.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
name: Greetings

on:
[pull_request_target, issues]
on: [pull_request_target, issues]

jobs:
greeting:
Expand All @@ -10,8 +9,8 @@ jobs:
issues: write
pull-requests: write
steps:
- uses: actions/first-interaction@v1
with:
repo-token: ${{ secrets.GITHUB_TOKEN }}
issue-message: "Welcome to the repository! Thank you for opening your first issue! 😊"
pr-message: "Thank you for your first pull request! 🎉 We appreciate your contribution."
- uses: actions/first-interaction@v1
with:
repo-token: ${{ secrets.GITHUB_TOKEN }}
issue-message: 'Welcome to the repository! Thank you for opening your first issue! 😊'
pr-message: 'Thank you for your first pull request! 🎉 We appreciate your contribution.'
12 changes: 6 additions & 6 deletions .github/workflows/label.yml
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
name: Labeler

on:
on:
pull_request_target: # Triggered when a pull request is made to the repository

jobs:
label:
runs-on: ubuntu-latest
permissions:
contents: read # Read repository contents (to check file paths in PRs)
pull-requests: write # Write permissions to apply labels on pull requests
contents: read # Read repository contents (to check file paths in PRs)
pull-requests: write # Write permissions to apply labels on pull requests

steps:
- uses: actions/labeler@v4 # Use the labeler action
with:
repo-token: "${{ secrets.GITHUB_TOKEN }}" # Access token for authentication
- uses: actions/labeler@v4 # Use the labeler action
with:
repo-token: '${{ secrets.GITHUB_TOKEN }}' # Access token for authentication
Loading
Loading