mirror of
https://github.com/RafaelSolVargas/Vulkan.git
synced 2025-10-29 16:57:23 +00:00
Others buttons are now working using handlers to do the work
This commit is contained in:
@@ -11,14 +11,12 @@ class BackButton(Button):
|
|||||||
self.__bot = bot
|
self.__bot = bot
|
||||||
|
|
||||||
async def callback(self, interaction: Interaction) -> None:
|
async def callback(self, interaction: Interaction) -> None:
|
||||||
|
"""Callback to when Button is clicked"""
|
||||||
|
# Return to Discord that this command is being processed
|
||||||
await interaction.response.defer()
|
await interaction.response.defer()
|
||||||
|
|
||||||
handler = PrevHandler(interaction, self.__bot)
|
handler = PrevHandler(interaction, self.__bot)
|
||||||
response = await handler.run()
|
response = await handler.run()
|
||||||
print(response)
|
|
||||||
print(response.success)
|
|
||||||
print(response.error)
|
|
||||||
print(response.error)
|
|
||||||
print(response.embed)
|
|
||||||
if response.embed:
|
if response.embed:
|
||||||
await interaction.followup.send(embed=response.embed)
|
await interaction.followup.send(embed=response.embed)
|
||||||
|
|||||||
@@ -1,11 +1,20 @@
|
|||||||
from discord import ButtonStyle, Interaction
|
from discord import ButtonStyle, Interaction
|
||||||
from discord.ui import Button
|
from discord.ui import Button
|
||||||
from Config.Emojis import VEmojis
|
from Config.Emojis import VEmojis
|
||||||
|
from Handlers.LoopHandler import LoopHandler
|
||||||
|
from Music.VulkanBot import VulkanBot
|
||||||
|
|
||||||
|
|
||||||
class LoopAllButton(Button):
|
class LoopAllButton(Button):
|
||||||
def __init__(self):
|
def __init__(self, bot: VulkanBot):
|
||||||
super().__init__(label="Loop All", style=ButtonStyle.secondary, emoji=VEmojis().LOOP_ALL)
|
super().__init__(label="Loop All", style=ButtonStyle.secondary, emoji=VEmojis().LOOP_ALL)
|
||||||
|
self.__bot = bot
|
||||||
|
|
||||||
async def callback(self, interaction: Interaction) -> None:
|
async def callback(self, interaction: Interaction) -> None:
|
||||||
pass
|
await interaction.response.defer()
|
||||||
|
|
||||||
|
handler = LoopHandler(interaction, self.__bot)
|
||||||
|
response = await handler.run('all')
|
||||||
|
|
||||||
|
if response.embed:
|
||||||
|
await interaction.followup.send(embed=response.embed)
|
||||||
|
|||||||
@@ -1,11 +1,20 @@
|
|||||||
from discord import ButtonStyle, Interaction
|
from discord import ButtonStyle, Interaction
|
||||||
from discord.ui import Button
|
from discord.ui import Button
|
||||||
from Config.Emojis import VEmojis
|
from Config.Emojis import VEmojis
|
||||||
|
from Handlers.LoopHandler import LoopHandler
|
||||||
|
from Music.VulkanBot import VulkanBot
|
||||||
|
|
||||||
|
|
||||||
class LoopOffButton(Button):
|
class LoopOffButton(Button):
|
||||||
def __init__(self):
|
def __init__(self, bot: VulkanBot):
|
||||||
super().__init__(label="Loop Off", style=ButtonStyle.secondary, emoji=VEmojis().LOOP_OFF)
|
super().__init__(label="Loop Off", style=ButtonStyle.secondary, emoji=VEmojis().LOOP_OFF)
|
||||||
|
self.__bot = bot
|
||||||
|
|
||||||
async def callback(self, interaction: Interaction) -> None:
|
async def callback(self, interaction: Interaction) -> None:
|
||||||
pass
|
await interaction.response.defer()
|
||||||
|
|
||||||
|
handler = LoopHandler(interaction, self.__bot)
|
||||||
|
response = await handler.run('off')
|
||||||
|
|
||||||
|
if response.embed:
|
||||||
|
await interaction.followup.send(embed=response.embed)
|
||||||
|
|||||||
@@ -1,11 +1,20 @@
|
|||||||
from discord import ButtonStyle, Interaction
|
from discord import ButtonStyle, Interaction
|
||||||
from discord.ui import Button
|
from discord.ui import Button
|
||||||
from Config.Emojis import VEmojis
|
from Config.Emojis import VEmojis
|
||||||
|
from Handlers.LoopHandler import LoopHandler
|
||||||
|
from Music.VulkanBot import VulkanBot
|
||||||
|
|
||||||
|
|
||||||
class LoopOneButton(Button):
|
class LoopOneButton(Button):
|
||||||
def __init__(self):
|
def __init__(self, bot: VulkanBot):
|
||||||
super().__init__(label="Loop One", style=ButtonStyle.secondary, emoji=VEmojis().LOOP_ONE)
|
super().__init__(label="Loop One", style=ButtonStyle.secondary, emoji=VEmojis().LOOP_ONE)
|
||||||
|
self.__bot = bot
|
||||||
|
|
||||||
async def callback(self, interaction: Interaction) -> None:
|
async def callback(self, interaction: Interaction) -> None:
|
||||||
pass
|
await interaction.response.defer()
|
||||||
|
|
||||||
|
handler = LoopHandler(interaction, self.__bot)
|
||||||
|
response = await handler.run('one')
|
||||||
|
|
||||||
|
if response.embed:
|
||||||
|
await interaction.followup.send(embed=response.embed)
|
||||||
|
|||||||
@@ -1,11 +1,20 @@
|
|||||||
from discord import ButtonStyle, Interaction
|
from discord import ButtonStyle, Interaction
|
||||||
from discord.ui import Button
|
from discord.ui import Button
|
||||||
from Config.Emojis import VEmojis
|
from Config.Emojis import VEmojis
|
||||||
|
from Handlers.PauseHandler import PauseHandler
|
||||||
|
from Music.VulkanBot import VulkanBot
|
||||||
|
|
||||||
|
|
||||||
class PauseButton(Button):
|
class PauseButton(Button):
|
||||||
def __init__(self):
|
def __init__(self, bot: VulkanBot):
|
||||||
super().__init__(label="Pause", style=ButtonStyle.secondary, emoji=VEmojis().PAUSE)
|
super().__init__(label="Pause", style=ButtonStyle.secondary, emoji=VEmojis().PAUSE)
|
||||||
|
self.__bot = bot
|
||||||
|
|
||||||
async def callback(self, interaction: Interaction) -> None:
|
async def callback(self, interaction: Interaction) -> None:
|
||||||
pass
|
await interaction.response.defer()
|
||||||
|
|
||||||
|
handler = PauseHandler(interaction, self.__bot)
|
||||||
|
response = await handler.run()
|
||||||
|
|
||||||
|
if response.embed:
|
||||||
|
await interaction.followup.send(embed=response.embed)
|
||||||
|
|||||||
@@ -1,11 +1,20 @@
|
|||||||
from discord import ButtonStyle, Interaction
|
from discord import ButtonStyle, Interaction
|
||||||
from discord.ui import Button
|
from discord.ui import Button
|
||||||
from Config.Emojis import VEmojis
|
from Config.Emojis import VEmojis
|
||||||
|
from Music.VulkanBot import VulkanBot
|
||||||
|
from Handlers.ResumeHandler import ResumeHandler
|
||||||
|
|
||||||
|
|
||||||
class PlayButton(Button):
|
class PlayButton(Button):
|
||||||
def __init__(self):
|
def __init__(self, bot: VulkanBot):
|
||||||
super().__init__(label="Play", style=ButtonStyle.secondary, emoji=VEmojis().PLAY)
|
super().__init__(label="Play", style=ButtonStyle.secondary, emoji=VEmojis().PLAY)
|
||||||
|
self.__bot = bot
|
||||||
|
|
||||||
async def callback(self, interaction: Interaction) -> None:
|
async def callback(self, interaction: Interaction) -> None:
|
||||||
pass
|
await interaction.response.defer()
|
||||||
|
|
||||||
|
handler = ResumeHandler(interaction, self.__bot)
|
||||||
|
response = await handler.run()
|
||||||
|
|
||||||
|
if response.embed:
|
||||||
|
await interaction.followup.send(embed=response.embed)
|
||||||
|
|||||||
@@ -1,11 +1,20 @@
|
|||||||
from discord import ButtonStyle, Interaction
|
from discord import ButtonStyle, Interaction
|
||||||
from discord.ui import Button
|
from discord.ui import Button
|
||||||
from Config.Emojis import VEmojis
|
from Config.Emojis import VEmojis
|
||||||
|
from Music.VulkanBot import VulkanBot
|
||||||
|
from Handlers.SkipHandler import SkipHandler
|
||||||
|
|
||||||
|
|
||||||
class SkipButton(Button):
|
class SkipButton(Button):
|
||||||
def __init__(self):
|
def __init__(self, bot: VulkanBot):
|
||||||
super().__init__(label="Skip", style=ButtonStyle.secondary, emoji=VEmojis().SKIP)
|
super().__init__(label="Skip", style=ButtonStyle.secondary, emoji=VEmojis().SKIP)
|
||||||
|
self.__bot = bot
|
||||||
|
|
||||||
async def callback(self, interaction: Interaction) -> None:
|
async def callback(self, interaction: Interaction) -> None:
|
||||||
pass
|
await interaction.response.defer()
|
||||||
|
|
||||||
|
handler = SkipHandler(interaction, self.__bot)
|
||||||
|
response = await handler.run()
|
||||||
|
|
||||||
|
if response.embed:
|
||||||
|
await interaction.followup.send(embed=response.embed)
|
||||||
|
|||||||
@@ -1,11 +1,20 @@
|
|||||||
|
from Handlers.QueueHandler import QueueHandler
|
||||||
from discord import ButtonStyle, Interaction
|
from discord import ButtonStyle, Interaction
|
||||||
from discord.ui import Button
|
from discord.ui import Button
|
||||||
from Config.Emojis import VEmojis
|
from Config.Emojis import VEmojis
|
||||||
|
from Music.VulkanBot import VulkanBot
|
||||||
|
|
||||||
|
|
||||||
class SongsButton(Button):
|
class SongsButton(Button):
|
||||||
def __init__(self):
|
def __init__(self, bot: VulkanBot):
|
||||||
super().__init__(label="Songs", style=ButtonStyle.secondary, emoji=VEmojis().QUEUE)
|
super().__init__(label="Songs", style=ButtonStyle.secondary, emoji=VEmojis().QUEUE)
|
||||||
|
self.__bot = bot
|
||||||
|
|
||||||
async def callback(self, interaction: Interaction) -> None:
|
async def callback(self, interaction: Interaction) -> None:
|
||||||
pass
|
await interaction.response.defer()
|
||||||
|
|
||||||
|
handler = QueueHandler(interaction, self.__bot)
|
||||||
|
response = await handler.run()
|
||||||
|
|
||||||
|
if response.embed:
|
||||||
|
await interaction.followup.send(embed=response.embed)
|
||||||
|
|||||||
@@ -1,11 +1,20 @@
|
|||||||
from discord import ButtonStyle, Interaction
|
from discord import ButtonStyle, Interaction
|
||||||
from discord.ui import Button
|
from discord.ui import Button
|
||||||
from Config.Emojis import VEmojis
|
from Config.Emojis import VEmojis
|
||||||
|
from Music.VulkanBot import VulkanBot
|
||||||
|
from Handlers.StopHandler import StopHandler
|
||||||
|
|
||||||
|
|
||||||
class StopButton(Button):
|
class StopButton(Button):
|
||||||
def __init__(self):
|
def __init__(self, bot: VulkanBot):
|
||||||
super().__init__(label="Stop", style=ButtonStyle.secondary, emoji=VEmojis().STOP)
|
super().__init__(label="Stop", style=ButtonStyle.secondary, emoji=VEmojis().STOP)
|
||||||
|
self.__bot = bot
|
||||||
|
|
||||||
async def callback(self, interaction: Interaction) -> None:
|
async def callback(self, interaction: Interaction) -> None:
|
||||||
pass
|
await interaction.response.defer()
|
||||||
|
|
||||||
|
handler = StopHandler(interaction, self.__bot)
|
||||||
|
response = await handler.run()
|
||||||
|
|
||||||
|
if response.embed:
|
||||||
|
await interaction.followup.send(embed=response.embed)
|
||||||
|
|||||||
@@ -20,11 +20,11 @@ class PlayerView(View):
|
|||||||
super().__init__(timeout=timeout)
|
super().__init__(timeout=timeout)
|
||||||
self.__bot = bot
|
self.__bot = bot
|
||||||
self.add_item(BackButton(self.__bot))
|
self.add_item(BackButton(self.__bot))
|
||||||
self.add_item(PauseButton())
|
self.add_item(PauseButton(self.__bot))
|
||||||
self.add_item(PlayButton())
|
self.add_item(PlayButton(self.__bot))
|
||||||
self.add_item(StopButton())
|
self.add_item(StopButton(self.__bot))
|
||||||
self.add_item(SkipButton())
|
self.add_item(SkipButton(self.__bot))
|
||||||
self.add_item(SongsButton())
|
self.add_item(SongsButton(self.__bot))
|
||||||
self.add_item(LoopOneButton())
|
self.add_item(LoopOneButton(self.__bot))
|
||||||
self.add_item(LoopOffButton())
|
self.add_item(LoopOffButton(self.__bot))
|
||||||
self.add_item(LoopAllButton())
|
self.add_item(LoopAllButton(self.__bot))
|
||||||
|
|||||||
Reference in New Issue
Block a user