Skip to content

Commit

Permalink
Resolving issue 33
Browse files Browse the repository at this point in the history
  • Loading branch information
RafaelSolVargas committed Jan 23, 2023
1 parent a72c4c7 commit 7310eda
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 1 deletion.
4 changes: 4 additions & 0 deletions Config/Configs.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,10 @@
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')
Expand Down
3 changes: 3 additions & 0 deletions Parallelism/PlayerProcess.py
Original file line number Diff line number Diff line change
Expand Up @@ -297,6 +297,9 @@ async def __timeoutHandler(self) -> None:
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)
Expand Down
9 changes: 8 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -69,14 +69,21 @@ 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**
- Go to [Discord](https://discord.com/developers) and invite your Bot to your own server
- 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>
Expand Down

0 comments on commit 7310eda

Please sign in to comment.