Skip to content

Commit

Permalink
Merge pull request #26 from AlexInCube/3.0-dev
Browse files Browse the repository at this point in the history
3.0.1
  • Loading branch information
AlexInCube authored Jul 6, 2024
2 parents 0497962 + 7c2a678 commit 158117b
Show file tree
Hide file tree
Showing 98 changed files with 3,418 additions and 2,246 deletions.
1 change: 1 addition & 0 deletions .env
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ BOT_SOUNDCLOUD_CLIENT_ID=undefined
BOT_SOUNDCLOUD_TOKEN=undefined

BOT_YANDEXMUSIC_TOKEN=undefined
BOT_YANDEXMUSIC_UID=undefined

MONGO_URI=undefined
MONGO_DATABASE_NAME=undefined
7 changes: 2 additions & 5 deletions .eslintrc.json
Original file line number Diff line number Diff line change
@@ -1,10 +1,7 @@
{
"root": true,
"parser": "@typescript-eslint/parser",
"plugins": [
"@typescript-eslint",
"prettier"
],
"plugins": ["@typescript-eslint", "prettier"],
"env": {
"commonjs": true,
"es2021": true,
Expand All @@ -22,6 +19,6 @@
"rules": {
"@typescript-eslint/no-var-requires": 0,
"@typescript-eslint/no-non-null-assertion": 0,
"prettier/prettier": 2
"prettier/prettier": ["error", { "endOfLine": "auto" }]
}
}
61 changes: 61 additions & 0 deletions .github/ISSUE_TEMPLATE/bug_report.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
name: Bug Report
description: Bug report for anything
labels: ["bug"]
body:
- type: markdown
attributes:
value: |
Please also ensure you have searched for any existing reports of this issue before you begin - if one exists, please leave a thumbs-up and/or a comment on that one, rather than knowingly filing a duplicate report, as duplicates just slow things down.
Note that most fields are required to be filled-in before you can submit this report, as it is all essential information which we will require in order to confirm and fix your issue.

- type: dropdown
id: user-type
attributes:
label: Who are you? User (who just use bot from discord)/developer/admin (who download all bot stuff to host)?
description: If you are on an older version, update and confirm your issue stil exists!
multiple: true
options:
- User
- Developer
- Admin
validations:
required: true

- type: textarea
id: description
attributes:
label: Description
description: Write a concise yet detailed description of the issue!)
validations:
required: true

- type: textarea
id: steps
attributes:
label: Steps To Reproduce
description: Add detailed, ordered steps for someone else to recreate the issue into the gaps below (add as many steps into the middle as you require)
value: |
1. Use command
2.
3.
4. See the issue
validations:
required: true

- type: dropdown
id: repro-rate
attributes:
label: How reliably can you recreate this issue using your steps above?
options:
- Always
- Most Times
- Only Sometimes
- Rarely
- Only Ever Happened Once
validations:
required: true

- type: markdown
attributes:
value: Thanks for taking the time to fill out this bug report!
6 changes: 6 additions & 0 deletions .github/ISSUE_TEMPLATE/config.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
blank_issues_enabled: false
contact_links:
- name: Frequently Asked Questions
url: https://github.com/AlexInCube/AICoTest/wiki/Frequently-Asked-Questions
about: AICoTest Frequently Asked Questions

35 changes: 35 additions & 0 deletions .github/ISSUE_TEMPLATE/feature-request.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
name: Feature Request
description: Suggest an improvement for AICoTest!
labels: ["feature"]
body:
- type: textarea
id: problem
attributes:
label: Is your feature request related to a problem?
description: A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]
validations:
required: true

- type: textarea
id: solution
attributes:
label: Describe the solution you'd like
description: A clear and concise description of what you want to happen.
validations:
required: true

- type: textarea
id: alternatives
attributes:
label: Describe alternatives you've considered
description: A clear and concise description of any alternative solutions or features you've considered.
validations:
required: false

- type: textarea
id: additional
attributes:
label: Additional context
description: Add any other context or screenshots about the feature request here.
validations:
required: false
15 changes: 15 additions & 0 deletions .github/workflows/wiki.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
name: Wiki
on:
push:
branches: ['master']
paths:
- wiki/**
- .github/workflows/wiki.yml
permissions:
contents: write
jobs:
wiki:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: Andrew-Chen-Wang/github-wiki-action@v4
3 changes: 2 additions & 1 deletion .prettierrc
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,6 @@
"semi": true,
"trailingComma": "none",
"singleQuote": true,
"printWidth": 100
"printWidth": 100,
"endOfLine": "auto"
}
9 changes: 9 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,17 @@ RUN pnpm run build
RUN pnpm prune --prod

FROM base as prod

RUN addgroup --system --gid 1001 nodejs
RUN adduser --system --uid 1001 aicbot

WORKDIR /bot
COPY --from=build /botbuild/build ./build
COPY --from=build /botbuild/node_modules ./node_modules
COPY --from=build /botbuild/package.json .

RUN chown -R aicbot:nodejs /bot

USER aicbot

CMD ["npm", "run", "production"]
69 changes: 2 additions & 67 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,78 +1,13 @@
<p align="center">
<img width="96" src="src/logo.png" alt="BotLogo">
<img width="96" src="icons/logo.png" alt="BotLogo">
</p>
<h1 align="center">AICTest</h1>
<p align="center">
Cool audiobot for Discord created by <a href="https://vk.com/alexincube"><b>@AlexInCube</b></a></p>

## 🌟 Features
- Command /alcotest which shows your alcohol count in blood
- Audioplayer based on [Distube](https://github.com/skick1234/DisTube) with buttons ![image](https://i.imgur.com/zqQ6ViY.png)
- Audioplayer based on [Distube](https://github.com/skick1234/DisTube) with buttons ![play-audioplayer](/wiki/images/commands/play-audioplayer.png)
- Support YouTube, Spotify, Soundcloud, any HTTP-stream and Discord Attachments (/playfile support MP3/WAV/OGG)
- Support Slash and Text commands (with customizable prefix per server using /setprefix)
- Localization (English and Russian are currently supported)

## 🎛️ Requirements
- Node.js 20 or higher
- MongoDB 6.0 or higher
- ffmpeg latest

## How to run bot?
### ⚙️ Configure .env
You can use Docker image or install things from "Requirements" and source code locally.
But in both cases, you need to configure .env file.

- Create .env.production
- Fill all fields in .env.production. If the field is marked as (Optional), you can skip it.
- (Required) To get Discord Token, follow this [guide](https://discordjs.guide/preparations/setting-up-a-bot-application.html#creating-your-bot). After following the guide, you need to enable privileged intents in [Discord Developer Portal.](https://github.com/AlexInCube/AlCoTest/assets/25522245/fdbcdcf1-9501-47f0-93bf-7e76806f623f)
- (Optional) To get Spotify Secret and ID, follow this [guide](https://stevesie.com/docs/pages/spotify-client-id-secret-developer-api)
- (Optional) To get Yandex Music token, follow this [guide](https://github.com/MarshalX/yandex-music-api/discussions/513)
```
BOT_VERBOSE_LOGGING=<boolean> (Optional) The bot will give more information about what it is doing to the console, useful for debugging. By default is: false
BOT_COMMAND_PREFIX=<default prefix you want> (Required) Used only for text commands, for example: //
BOT_LANGUAGE=<language> (Optional) Supported values: en ru. By default is: en
MONGO_URI=<ip to mongodb> (Required) If you run bot locally, use mongodb://localhost:27017. If you run in Docker, use mongodb://mongo:27017
MONGO_DATABASE_NAME=<any name you want> (Required) Database name in MongoDB, for example: aicbot
BOT_DISCORD_TOKEN=<discord token> (Required)
BOT_DISCORD_CLIENT_ID=<discord bot id> (Required)
BOT_DISCORD_OVERPOWERED_ID=<your id in discord> (Required) This need to retrieve reports in direct message
BOT_SPOTIFY_CLIENT_SECRET=<spotify secret> (Optional)
BOT_SPOTIFY_CLIENT_ID=<spotify id> (Optional)
BOT_YANDEXMUSIC_TOKEN=<yandexmusic token> (Optional)
```

### 🍪 Youtube Cookie
Also, it is preferable to provide cookies for YouTube.
This will allow you to play 18+ videos and bypass YouTube rate limiting error (429 Error).
I highly recommend that you create a new Google account from which you get the cookie.
You cannot watch videos in your browser from this account,
otherwise your cookie will be reset, and you will need to retrieve it again.

- Install an extension for extracting cookie, [EditThisCookie](https://www.editthiscookie.com/blog/2014/03/install-editthiscookie/)
- Go to [YouTube](https://www.youtube.com/)
- Log in to your account. (You should use a new account for this purpose)
- Click on the extension icon and click "Export" button.
- Create file yt-cookies.json and paste cookie in this file

### 🖥️ Run locally
- Install things from "Requirements" section
- Follow the "Configure .env" section and put .env.production in folder with repository.
- Follow the "YouTube Cookie" section and put yt-cookies.json in the folder with repository.
- Run commands below

```npm
npm install
npm run build
npm run production
```

### 🐋 Run in Docker
- Copy docker-compose.yml, Dockerfile in empty folder
- Follow the "Configure .env" section and put .env.production in folder with Dockerfile etc.
- Follow the "YouTube Cookie" section and put yt-cookies.json in the folder with Dockerfile etc.
- Run command ```docker-compose up --detach --force-recreate``` in folder with files
17 changes: 17 additions & 0 deletions binding.gyp
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
{
'targets': [
{
'target_name': 'bindings',
'sources': [ 'bindings.node' ],
'cflags!': [ '-fno-exceptions' ],
'cflags_cc!': [ '-fno-exceptions' ],
'conditions': [
['OS=="mac"', {
'xcode_settings': {
'GCC_ENABLE_CPP_EXCEPTIONS': 'YES'
}
}]
]
}
]
}
2 changes: 1 addition & 1 deletion docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ services:
volumes:
- ./data:/data/db
ports:
- '27018:27017'
- '27017:27017'
aicbot:
container_name: aicbot
image: alexincube/aicotest:latest
Expand Down
Binary file added icons/audioplayer/player/play.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added icons/audioplayer/services/apple-music.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added icons/audioplayer/services/attach-file.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added icons/audioplayer/services/audio-waves.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added icons/audioplayer/services/soundcloud.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added icons/audioplayer/services/spotify.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added icons/audioplayer/services/yandex-music.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added icons/audioplayer/services/youtube.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added icons/error.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
File renamed without changes
Binary file added icons/warning.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
31 changes: 18 additions & 13 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "aicbot",
"version": "2.5.0",
"version": "3.0.1",
"description": "Discord Bot for playing music",
"main": "build/main.js",
"scripts": {
Expand All @@ -13,37 +13,42 @@
"author": "AlexInCube",
"license": "ISC",
"dependencies": {
"@discordjs/opus": "^0.9.0",
"@discordjs/rest": "^1.7.1",
"@discordjs/voice": "^0.16.1",
"@distube/soundcloud": "^1.3.5",
"@distube/spotify": "^1.6.1",
"@distube/yt-dlp": "^1.1.3",
"@distube/ytdl-core": "^4.13.3",
"@distube/direct-link": "^1.0.1",
"@distube/file": "^1.0.1",
"@distube/soundcloud": "^2.0.2",
"@distube/spotify": "^2.0.2",
"@distube/youtube": "^1.0.2",
"@distube/yt-dlp": "^2.0.1",
"@distube/ytdl-core": "^4.13.4",
"@distube/ytsr": "^2.0.4",
"cross-env": "7.0.3",
"discord.js": "14.14.1",
"distube": "^4.2.2",
"distube-yandex-music-plugin": "^0.2.1",
"discord.js": "^14.15.3",
"distube": "^5.0.2",
"distube-apple-music": "^0.1.0",
"distube-yandex-music-plugin": "^1.0.4",
"dotenv": "^16.4.5",
"i18next": "^22.5.1",
"i18next-fs-backend": "^2.3.1",
"mongoose": "^7.6.12",
"mongoose": "^7.7.0",
"node-os-utils": "^1.3.7",
"opusscript": "^0.1.1",
"prism-media": "^1.3.5",
"sodium-native": "^4.1.1",
"uuid": "^9.0.1",
"zod": "^3.23.8"
},
"devDependencies": {
"@types/node": "^20.12.12",
"@types/node": "^20.14.10",
"@types/node-os-utils": "^1.3.4",
"@types/uuid": "^9.0.8",
"@typescript-eslint/eslint-plugin": "^5.62.0",
"@typescript-eslint/parser": "^5.62.0",
"eslint": "^8.57.0",
"eslint-config-prettier": "^9.1.0",
"eslint-plugin-prettier": "^5.1.3",
"prettier": "^3.2.5",
"typescript": "^5.4.5"
"prettier": "^3.3.2",
"typescript": "^5.5.3"
}
}
Loading

0 comments on commit 158117b

Please sign in to comment.