Resolving issue 33

This commit is contained in:
Rafael Vargas 2023-01-23 10:35:52 -03:00
parent a72c4c7d8d
commit 7310eda1a1
3 changed files with 15 additions and 1 deletions

View File

@ -7,6 +7,10 @@ from Config.Folder import Folder
class VConfigs(Singleton):
def __init__(self) -> None:
if not super().created:
# You can change this boolean to False if you want to prevent the Bot from auto disconnecting
# Resolution for the issue: https://github.com/RafaelSolVargas/Vulkan/issues/33
self.SHOULD_AUTO_DISCONNECT_WHEN_ALONE = True
self.BOT_PREFIX = '!'
try:
self.BOT_TOKEN = config('BOT_TOKEN')

View File

@ -297,6 +297,9 @@ class PlayerProcess(Process):
if self.__guild.voice_client is None:
return
if not VConfigs().SHOULD_AUTO_DISCONNECT_WHEN_ALONE:
return
if self.__guild.voice_client.is_playing() or self.__guild.voice_client.is_paused():
if not self.__isBotAloneInChannel(): # If bot is not alone continue to play
self.__timer = TimeoutClock(self.__timeoutHandler, self.__loop)

View File

@ -69,7 +69,7 @@ BOT_PREFIX=Your_Wanted_Prefix_For_Vulkan
```
### **⚙️ Configs**
The config file is located at ```./config/Configs.py```, it doesn't require any change, but if you can change values to the way you want.
The config file is located at ```./config/Configs.py```, it doesn't require any change, but if you can change values to the way you want. <br>
### **Initialization**
@ -77,6 +77,13 @@ The config file is located at ```./config/Configs.py```, it doesn't require any
- Run ```python main.py``` in console to start
### **Configuring Auto Disconnect**
As a result of the [Issue 33](https://github.com/RafaelSolVargas/Vulkan/issues/33) now you can configure if the Bot will auto disconnect when being alone in the voice channel, the default configuration is to disconnect within 300 seconds if it finds out no one is currently listing to it.
To change that you must: <br>
- Change the property SHOULD_AUTO_DISCONNECT_WHEN_ALONE of the VConfigs class to False
> The path to the file is ./Config/Configs.py
<br>
<hr>
<br>