mirror of
https://github.com/Matthww/TuneBot.git
synced 2026-09-21 19:57:48 +00:00
Migrated from keys to set datastructure in Redis
This commit is contained in:
+2
-2
@@ -11,6 +11,7 @@ import lavalink
|
||||
from bot import ChristmasBot
|
||||
from utils.EmbedGenerator import EmbedGenerator
|
||||
from utils.paginator import HelpPaginator
|
||||
from utils.database import AutoJoin
|
||||
|
||||
|
||||
class InformationCog(commands.Cog, name="Information"):
|
||||
@@ -78,8 +79,7 @@ class InformationCog(commands.Cog, name="Information"):
|
||||
)
|
||||
await ctx.send(fmt)
|
||||
|
||||
from utils import database
|
||||
database.AutoJoin.get_channels()
|
||||
AutoJoin.get_channels()
|
||||
|
||||
@commands.command(name="help", aliases=["about", "info"], slash_command=True)
|
||||
@commands.cooldown(1, 1, commands.BucketType.user)
|
||||
|
||||
+4
-9
@@ -2,8 +2,6 @@ import asyncio
|
||||
import re
|
||||
from typing import Optional
|
||||
|
||||
from aioredis.client import Redis
|
||||
|
||||
import discord
|
||||
from discord.channel import TextChannel
|
||||
from discord.ext.commands.context import Context
|
||||
@@ -17,6 +15,8 @@ from utils.database import AutoJoin
|
||||
from context import CustomContext
|
||||
from discord import Embed
|
||||
|
||||
from utils.database import Playlist
|
||||
|
||||
url_rx = re.compile(r"https?://(?:www\.)?.+")
|
||||
|
||||
|
||||
@@ -96,7 +96,7 @@ class Music(commands.Cog):
|
||||
|
||||
for guild_id, (voicechannel_id, textchannel_id) in redis_result.items():
|
||||
player = self.bot.lavalink.player_manager.create(guild_id)
|
||||
player.store('channel', textchannel_id)
|
||||
player.store("channel", textchannel_id)
|
||||
voice_channel = await self.bot.fetch_channel(voicechannel_id)
|
||||
await voice_channel.connect(cls=LavalinkVoiceClient)
|
||||
if not player.is_playing:
|
||||
@@ -109,12 +109,7 @@ class Music(commands.Cog):
|
||||
await textchannel.send("Automatically joined the voice channel")
|
||||
|
||||
async def fill_player_queue(self, player: DefaultPlayer, buffer: Optional[int] = 1):
|
||||
pipeline = self.bot._redis_client.pipeline()
|
||||
for _ in range(buffer):
|
||||
pipeline.randomkey()
|
||||
|
||||
queries = await pipeline.execute()
|
||||
print(queries)
|
||||
queries = await Playlist.random(self.bot._redis_client, buffer)
|
||||
# Get the results for the query from Lavalink.
|
||||
for query in queries:
|
||||
result = await player.node.get_tracks(query)
|
||||
|
||||
Reference in New Issue
Block a user