Author SHA1 Message Date
matthew 41a098d577 Feature/multi node support and tos privacy command (#52)
* add support for multiple nodes

* add a tos and privacy command
2023-04-11 23:07:39 +02:00
niku e25e7e78f8 Merge pull request #50 from Matthww/feature/add_privacy_and_tos_command
Add Privacy Policy and Terms of Service command
2022-12-06 22:59:00 +01:00
matthew c01e773c31 Add Privacy Policy and Terms of Service command 2022-12-06 22:55:40 +01:00
5 changed files with 15 additions and 20 deletions
+5 -8
View File
@@ -129,15 +129,12 @@ class TuneBot(commands.Bot):
self.lavalink = self.create_lavalink(self.user.id) self.lavalink = self.create_lavalink(self.user.id)
def create_lavalink(self, user_id: int) -> "lavalink.Client": def create_lavalink(self, user_id: int) -> "lavalink.Client":
cfg = self.config["lavalink"] nodes = self.config["nodes"]
client: lavalink.Client = lavalink.Client(user_id, player=CustomPlayer) client: lavalink.Client = lavalink.Client(user_id, player=CustomPlayer)
client.add_node( # get the lavalink nodes from the config
cfg["host"], for node in nodes:
cfg["port"], client.add_node(nodes[node]["host"], nodes[node]["port"], nodes[node]["password"], nodes[node]["region"], nodes[node]["name"])
cfg["password"],
cfg["region"],
cfg["name"],
)
return client return client
async def get_context(self, message: Message, *, cls=CustomContext): async def get_context(self, message: Message, *, cls=CustomContext):
-2
View File
@@ -26,7 +26,6 @@ class MusicCog(BaseCog, name="Music"):
self.bot.lavalink.add_event_hook(self.track_hook) self.bot.lavalink.add_event_hook(self.track_hook)
"""
@commands.Cog.listener() @commands.Cog.listener()
async def on_ready(self): async def on_ready(self):
while not self.is_lavalink_ready(): while not self.is_lavalink_ready():
@@ -44,7 +43,6 @@ class MusicCog(BaseCog, name="Music"):
await player.play() await player.play()
except: except:
logger.error(f"Failed to autojoin guild {guild_id}.") logger.error(f"Failed to autojoin guild {guild_id}.")
"""
async def track_hook(self, event: lavalink.Event): async def track_hook(self, event: lavalink.Event):
if isinstance(event, lavalink.events.QueueEndEvent): if isinstance(event, lavalink.events.QueueEndEvent):
+2 -2
View File
@@ -1,7 +1,7 @@
from discord.ext import commands from discord.ext import commands
from bot import TuneBot from bot import TuneBot
#from cogs.settings.interactions import SettingCommands from cogs.settings.interactions import SettingCommands
from cogs.settings.interactions import SourceCommands from cogs.settings.interactions import SourceCommands
from context import CustomContext from context import CustomContext
from utils.classes import BaseCog from utils.classes import BaseCog
@@ -13,5 +13,5 @@ class SettingsCog(BaseCog, name="Settings"):
async def setup(bot: TuneBot): async def setup(bot: TuneBot):
await bot.add_cog(SettingsCog(bot)) await bot.add_cog(SettingsCog(bot))
#bot.tree.add_command(SettingCommands(bot), override=True) bot.tree.add_command(SettingCommands(bot), override=True)
bot.tree.add_command(SourceCommands(bot), override=True) bot.tree.add_command(SourceCommands(bot), override=True)
-2
View File
@@ -105,7 +105,6 @@ class SourceCommands(app_commands.Group):
await ctx.response.send_message(embed=embed) await ctx.response.send_message(embed=embed)
"""
class SettingCommands(app_commands.Group): class SettingCommands(app_commands.Group):
def __init__(self, bot: "TuneBot"): def __init__(self, bot: "TuneBot"):
super().__init__(name="settings", description="Tweak and customize") super().__init__(name="settings", description="Tweak and customize")
@@ -144,4 +143,3 @@ class SettingCommands(app_commands.Group):
await autojoin.disable() await autojoin.disable()
embed.title = "AutoJoin disabled" embed.title = "AutoJoin disabled"
await ctx.response.send_message(embed=embed) await ctx.response.send_message(embed=embed)
"""
+3 -1
View File
@@ -8,12 +8,14 @@
"prefix": "ck!", "prefix": "ck!",
"redis_url": "", "redis_url": "",
"redis_prefix": "", "redis_prefix": "",
"lavalink": { "nodes": {
"example": {
"host": "", "host": "",
"port": 2333, "port": 2333,
"password": "", "password": "",
"region": "", "region": "",
"name": "" "name": ""
}
}, },
"colors": { "colors": {
"embed": "7289da" "embed": "7289da"