This commit is contained in:
Profitroll 2023-04-19 14:27:12 +02:00
commit a178aa2af9
3 changed files with 200 additions and 15 deletions

166
.gitignore vendored Normal file
View File

@ -0,0 +1,166 @@
# ---> Python
# Byte-compiled / optimized / DLL files
__pycache__/
*.py[cod]
*$py.class
# C extensions
*.so
# Distribution / packaging
.Python
build/
develop-eggs/
dist/
downloads/
eggs/
.eggs/
lib/
lib64/
parts/
sdist/
var/
wheels/
share/python-wheels/
*.egg-info/
.installed.cfg
*.egg
MANIFEST
# PyInstaller
# Usually these files are written by a python script from a template
# before PyInstaller builds the exe, so as to inject date/other infos into it.
*.manifest
*.spec
# Installer logs
pip-log.txt
pip-delete-this-directory.txt
# Unit test / coverage reports
htmlcov/
.tox/
.nox/
.coverage
.coverage.*
.cache
nosetests.xml
coverage.xml
*.cover
*.py,cover
.hypothesis/
.pytest_cache/
cover/
# Translations
*.mo
*.pot
# Django stuff:
*.log
local_settings.py
db.sqlite3
db.sqlite3-journal
# Flask stuff:
instance/
.webassets-cache
# Scrapy stuff:
.scrapy
# Sphinx documentation
docs/_build/
# PyBuilder
.pybuilder/
target/
# Jupyter Notebook
.ipynb_checkpoints
# IPython
profile_default/
ipython_config.py
# pyenv
# For a library or package, you might want to ignore these files since the code is
# intended to run in multiple environments; otherwise, check them in:
# .python-version
# pipenv
# According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
# However, in case of collaboration, if having platform-specific dependencies or dependencies
# having no cross-platform support, pipenv may install dependencies that don't work, or not
# install all needed dependencies.
#Pipfile.lock
# poetry
# Similar to Pipfile.lock, it is generally recommended to include poetry.lock in version control.
# This is especially recommended for binary packages to ensure reproducibility, and is more
# commonly ignored for libraries.
# https://python-poetry.org/docs/basic-usage/#commit-your-poetrylock-file-to-version-control
#poetry.lock
# PEP 582; used by e.g. github.com/David-OConnor/pyflow
__pypackages__/
# Celery stuff
celerybeat-schedule
celerybeat.pid
# SageMath parsed files
*.sage.py
# Environments
.env
.venv
env/
venv/
ENV/
env.bak/
venv.bak/
# Spyder project settings
.spyderproject
.spyproject
# Rope project settings
.ropeproject
# mkdocs documentation
/site
# mypy
.mypy_cache/
.dmypy.json
dmypy.json
# Pyre type checker
.pyre/
# pytype static type analyzer
.pytype/
# Cython debug symbols
cython_debug/
# PyCharm
# JetBrains specific template is maintainted in a separate JetBrains.gitignore that can
# be found at https://github.com/github/gitignore/blob/main/Global/JetBrains.gitignore
# and can be added to the global gitignore or merged into this file. For a more nuclear
# option (not recommended) you can uncomment the following to ignore the entire idea folder.
#.idea/
# ---> VisualStudioCode
.vscode/*
!.vscode/tasks.json
!.vscode/launch.json
!.vscode/extensions.json
!.vscode/*.code-snippets
# Local History for Visual Studio Code
.history/
# Built Visual Studio Code Extensions
*.vsix

View File

@ -1,5 +1,19 @@
# YusarinBot <h1 align="center">YusarinBot</h1>
[![License: GPL v2](https://img.shields.io/badge/License-GPL_v2-blue.svg)](https://www.gnu.org/licenses/old-licenses/gpl-2.0.en.html) [![Crowdin](https://badges.crowdin.net/yusarinbot/localized.svg)](https://crowdin.com/project/yusarinbot) ![Discord](https://img.shields.io/discord/940760922346123284)
<p align="center">
<a href="https://www.gnu.org/licenses/old-licenses/gpl-2.0.en.html">
<img alt="License: GPL v2" src="https://img.shields.io/badge/License-GPL_v2-blue.svg">
</a>
<a href="https://crowdin.com/project/yusarinbot">
<img alt="Crowdin" src="https://badges.crowdin.net/yusarinbot/localized.svg">
</a>
<a href="https://git.end-play.xyz/profitroll/YusarinBot">
<img alt="Code style: black" src="https://img.shields.io/badge/code%20style-black-000000.svg">
</a>
<a href="https://discord.com/invite/2zpzErtnNT">
<img alt="Discord" src="https://img.shields.io/discord/940760922346123284">
</a>
</p>
Simple, easy to set up, yet reliable. Simple, easy to set up, yet reliable.
A specially designed bot for creating private voice channels on your Discord servers. A specially designed bot for creating private voice channels on your Discord servers.
@ -8,6 +22,7 @@ Installation instructions are listed below. Please, make sure you have installed
> Since version 1.5 only slash commands are supported. If you'd like to use old-fashioned commands and commands prefix feature consider installing [1.4 version](https://git.end-play.xyz/profitroll/YusarinBot/releases/tag/v1.4) which is the last one compatible with those. > Since version 1.5 only slash commands are supported. If you'd like to use old-fashioned commands and commands prefix feature consider installing [1.4 version](https://git.end-play.xyz/profitroll/YusarinBot/releases/tag/v1.4) which is the last one compatible with those.
## Installation (Short) ## Installation (Short)
1. `git clone https://git.end-play.xyz/profitroll/YusarinBot` 1. `git clone https://git.end-play.xyz/profitroll/YusarinBot`
2. `cd YusarinBot` 2. `cd YusarinBot`
3. `pip install -r requirements.txt` 3. `pip install -r requirements.txt`
@ -15,23 +30,26 @@ Installation instructions are listed below. Please, make sure you have installed
5. `python yusarin.py` 5. `python yusarin.py`
## Installation (Detailed) ## Installation (Detailed)
1. Download and install Python 3.8+ 1. Download and install Python 3.8+
2. Download bot's release: https://git.end-play.xyz/profitroll/YusarinBot/releases/latest 2. Download bot's release: <https://git.end-play.xyz/profitroll/YusarinBot/releases/latest>
3. Unpack your archive to folder. Name it YusarinBot for example 3. Unpack your archive to folder. Name it YusarinBot for example
4. Change working directory using `cd YusarinBot` or `cd FolderYouHaveCreated` 4. Change working directory using `cd YusarinBot` or `cd FolderYouHaveCreated`
5. If you're using Linux system - install [dependencies for Pycord](https://docs.pycord.dev/en/stable/installing.html#installing) 5. If you're using Linux system - install [dependencies for Pycord](https://docs.pycord.dev/en/stable/installing.html#installing)
6. Run `pip install -r requirements.txt` to install dependencies 6. Run `pip install -r requirements.txt` to install dependencies
7. [Optionally] run `pip install -r requirements-optional.txt` to install optional dependencies 7. [Optionally] run `pip install -r requirements-optional.txt` to install optional dependencies
8. Create new Discord application at https://discord.com/developers/applications 8. Create new Discord application at <https://discord.com/developers/applications>
9. You can rename it however you want, set needed descriptions etc 9. You can rename it however you want, set needed descriptions etc
10. Go to "Bot" tab and enable application as bot 10. Go to "Bot" tab and enable application as bot
11. Copy token of your bot 11. Copy token of your bot
12. Open file `config.json` with your favorite text editor and paste your token as value of "bot_token" key 12. Open file `config.json` with your favorite text editor and paste your token as value of "bot_token" key
13. Copy your own Discord ID and paste it as value of "owner" key (How to get ID: https://support.playhive.com/discord-user-id/) 13. Copy your own Discord ID and paste it as value of "owner" key (How to get ID: <https://support.playhive.com/discord-user-id/>)
14. Bot is ready! Run it using `python yusarin.py` 14. Bot is ready! Run it using `python yusarin.py`
## Config explanation ## Config explanation
Default configuration file is [available here](https://git.end-play.xyz/profitroll/YusarinBot/blob/main/config.json)
Default configuration file is [available here](https://git.profitroll.eu/profitroll/YusarinBot/src/branch/main/config.json)
- "debug" - Option that enables more detailed log messages [Boolean] - "debug" - Option that enables more detailed log messages [Boolean]
- "owner" - Discord ID of user who will be able to execute admin commands (`$shutdown` for example) [Integer] - "owner" - Discord ID of user who will be able to execute admin commands (`$shutdown` for example) [Integer]
- "bot_name" - Name of your bot. Is not used anywhere yet [String] - "bot_name" - Name of your bot. Is not used anywhere yet [String]
@ -51,6 +69,7 @@ Default configuration file is [available here](https://git.end-play.xyz/profitro
- "auto_clear_timer" - Option that defines how often "auto_clear_trash" will do its job [Integer] - "auto_clear_timer" - Option that defines how often "auto_clear_trash" will do its job [Integer]
## Extra ## Extra
1. Bot doesn't have any self updaters **yet** 1. Bot doesn't have any self updaters **yet**
2. You can add public version of the bot to your Discord server using this link: https://www.end-play.xyz/yusarin/invite 2. You can add public version of the bot to your Discord server using this link: <https://www.end-play.xyz/yusarin/invite>
3. If you have questions/suggestions - just join our [Discord Support Server](https://discord.com/invite/2zpzErtnNT) 3. If you have questions/suggestions - just join our [Discord Support Server](https://discord.com/invite/2zpzErtnNT)

View File

@ -12,7 +12,7 @@ from os import getpid
from functions import * from functions import *
pid = getpid() pid = getpid()
version = 1.8 version = 1.9
if ( if (
loadJson("config.json")["owner"] == "SET-OWNER-ID" loadJson("config.json")["owner"] == "SET-OWNER-ID"
@ -24,15 +24,15 @@ if (
exit() exit()
if loadJson("config.json")["check_for_updates"]: if loadJson("config.json")["check_for_updates"]:
try:
serv_ver = loads(
get("https://api.end-play.xyz/version?app=yusarinbot&apikey=publickey").text
)["version"]
if float(serv_ver) > version:
appendLog(
f"YusarinBot version {serv_ver} is available. Download new version here: https://git.end-play.xyz/profitroll/YusarinBot/releases/latest"
)
appendLog(f"Currently using YusarinBot v{str(version)}") appendLog(f"Currently using YusarinBot v{str(version)}")
try:
releases = get(
"https://git.end-play.xyz/api/v1/repos/profitroll/YusarinBot/releases?draft=false&pre-release=false&page=1&limit=1"
).json()
if float(releases[0]["tag_name"].replace("v", "")) > version:
appendLog(
f"YusarinBot version {releases[0]['tag_name']} is available. Download new version here: {releases[0]['html_url']}"
)
except Exception as exp: except Exception as exp:
appendLog( appendLog(
f"Could not get YusarinBot cloud version due to {exp}. Currently using {str(version)}" f"Could not get YusarinBot cloud version due to {exp}. Currently using {str(version)}"