Largely embed wording changes + other small tweaks + combine pause commands
This commit is contained in:
parent
e2916fb0aa
commit
4e8030eca4
@ -19,16 +19,15 @@ class Autoplay(commands.Cog):
|
||||
async def autoplay(
|
||||
self, interaction: discord.Interaction, toggle: Literal["ON", "OFF"]
|
||||
):
|
||||
"Keep the music playing forever with music suggestions from OpenAI"
|
||||
"Keep music playing 24/7 with AI-generated song recommendations"
|
||||
if toggle == "OFF":
|
||||
self.bot.autoplay.remove(interaction.guild.id)
|
||||
|
||||
embed = create_embed(
|
||||
title="Autoplay Off",
|
||||
description=(
|
||||
"Autoplay has been turned off. I will no longer"
|
||||
" automatically add new songs to the queue based on AI"
|
||||
" recommendations."
|
||||
"Autoplay has been turned off. Song recommendations will"
|
||||
" no longer be added to the queue."
|
||||
),
|
||||
)
|
||||
return await interaction.response.send_message(embed=embed)
|
||||
@ -40,8 +39,8 @@ class Autoplay(commands.Cog):
|
||||
title="Autoplay Already Enabled",
|
||||
description=(
|
||||
"Autoplay is already enabled. If you would like to turn it"
|
||||
" off, choose the `OFF` option in the"
|
||||
" </autoplay:1228216490386391052> command."
|
||||
" off, run </autoplay:1228216490386391052> and choose the"
|
||||
" `OFF` option."
|
||||
),
|
||||
)
|
||||
return await interaction.response.send_message(
|
||||
@ -54,9 +53,8 @@ class Autoplay(commands.Cog):
|
||||
embed = create_embed(
|
||||
title="Not Enough Context",
|
||||
description=(
|
||||
"You must have at least 5 songs in the queue so that I can"
|
||||
" get a good understanding of what music I should continue"
|
||||
" to play. Add some more music to the queue, then try"
|
||||
"Autoplay requires at least 5 songs in the queue in order"
|
||||
" to generate recommendations. Please add more and try"
|
||||
" again."
|
||||
),
|
||||
)
|
||||
@ -84,9 +82,9 @@ class Autoplay(commands.Cog):
|
||||
embed = create_embed(
|
||||
title=":infinity: Autoplay Enabled :infinity:",
|
||||
description=(
|
||||
"I have added a few similar songs to the queue and will"
|
||||
" continue to do so once the queue gets low again. Now"
|
||||
" just sit back and enjoy the music!\n\nEnabled by:"
|
||||
"Recommendations have been generated and added to the"
|
||||
" queue. Autoplay will automatically search for more"
|
||||
" songs whenever the queue gets low.\n\nEnabled by:"
|
||||
f" {interaction.user.mention}"
|
||||
),
|
||||
)
|
||||
@ -96,11 +94,9 @@ class Autoplay(commands.Cog):
|
||||
embed = create_embed(
|
||||
title="Autoplay Error",
|
||||
description=(
|
||||
"Autoplay is an experimental feature, meaning sometimes it"
|
||||
" doesn't work as expected. I had an error when attempting"
|
||||
" to get similar songs for you, please try running the"
|
||||
" command again. If the issue persists, fill out a bug"
|
||||
" report with the </bug:1224840889906499626> command."
|
||||
"Unable to get AI recommendations at this time. Please try"
|
||||
" again. If issues continue, please fill out a bug report"
|
||||
" with </bug:1224840889906499626>."
|
||||
),
|
||||
)
|
||||
await interaction.edit_original_response(embed=embed)
|
||||
|
@ -15,7 +15,9 @@ class BugReport(discord.ui.Modal, title="Report a bug"):
|
||||
placeholder="EX: itsmefreddy01...",
|
||||
)
|
||||
command = discord.ui.TextInput(
|
||||
label="Command with error", placeholder="EX: skip...", required=True
|
||||
label="Command with error",
|
||||
placeholder="EX: autoplay, skip...",
|
||||
required=True,
|
||||
)
|
||||
report = discord.ui.TextInput(
|
||||
label="A detailed report of the bug",
|
||||
@ -27,8 +29,8 @@ class BugReport(discord.ui.Modal, title="Report a bug"):
|
||||
|
||||
async def on_submit(self, interaction: discord.Interaction):
|
||||
await interaction.response.send_message(
|
||||
f"Thanks for your bug report. We will get back to you as soon as"
|
||||
f" possible",
|
||||
f"Thanks for your bug report. We will work on resolving the"
|
||||
f" issue as soon as possible.",
|
||||
ephemeral=True,
|
||||
)
|
||||
channel = self.bot.get_channel(BUG_CHANNEL_ID)
|
||||
|
@ -169,18 +169,18 @@ class Help(commands.Cog):
|
||||
embed = discord.Embed(
|
||||
title=f":musical_note: Help :musical_note:",
|
||||
description=(
|
||||
"**Check out recent news and updates about the bot with"
|
||||
" the </news:1260842465666007040> command!\n\u200b**"
|
||||
"**Check out recent updates with the"
|
||||
" </news:1260842465666007040> command!\n\u200b**"
|
||||
),
|
||||
color=BOT_COLOR,
|
||||
)
|
||||
|
||||
embed.add_field(
|
||||
name="**Use Me**",
|
||||
name="**Get Started**",
|
||||
value=(
|
||||
"> To get started, use the </play:1224840890368000172>"
|
||||
" command and enter the name or link to the song of your"
|
||||
" choice."
|
||||
"> Start playing music with the"
|
||||
" </play:1224840890368000172> command. Enter the name or"
|
||||
" link of the song you want to play."
|
||||
),
|
||||
inline=False,
|
||||
)
|
||||
@ -195,9 +195,9 @@ class Help(commands.Cog):
|
||||
embed.add_field(
|
||||
name="**Help for Specific Commands**",
|
||||
value=(
|
||||
"> If you want more information on how to use a specific"
|
||||
" command, use the </help:1224854217597124610> command and"
|
||||
" include the specific command."
|
||||
"> To get information on a specific command, use"
|
||||
" </help:1224854217597124610> and include the command"
|
||||
" name."
|
||||
),
|
||||
inline=False,
|
||||
)
|
||||
|
@ -65,8 +65,9 @@ class Lyrics(commands.Cog):
|
||||
f" {player.current.author}"
|
||||
),
|
||||
description=(
|
||||
"Song lyrics are too long to display on Discord. [Click"
|
||||
f" here to view the lyrics on Genius]({song.url})."
|
||||
"The lyrics for this song are too long to display on"
|
||||
" Discord. [Click here to view the lyrics on"
|
||||
f" Genius]({song.url})."
|
||||
),
|
||||
thumbnail=player.current.artwork_url,
|
||||
)
|
||||
|
@ -13,7 +13,7 @@ class News(commands.Cog):
|
||||
async def news(self, interaction: discord.Interaction):
|
||||
"Get recent news and updates about the bot"
|
||||
embed = discord.Embed(
|
||||
title="Recent News :newspaper2:",
|
||||
title="Recent News and Updates",
|
||||
description=(
|
||||
"View recent code commits"
|
||||
" [here](https://github.com/packetparker/guava/commits)\n\u200b"
|
||||
@ -22,30 +22,12 @@ class News(commands.Cog):
|
||||
)
|
||||
|
||||
embed.add_field(
|
||||
name="**Lyrics!**",
|
||||
value=(
|
||||
"> You can now get lyrics for the song that is currently"
|
||||
" playing. Just use the `/lyrics` command! Some songs may not"
|
||||
" have lyrics available, but the bot will do its best to find"
|
||||
" them."
|
||||
),
|
||||
)
|
||||
|
||||
embed.add_field(
|
||||
name="**Apple Music Support!**",
|
||||
value=(
|
||||
"> After some trial and error, you can now play music through"
|
||||
" Apple Music links. Just paste the link and the bot will do"
|
||||
" the rest!"
|
||||
),
|
||||
)
|
||||
|
||||
embed.add_field(
|
||||
name="**Autoplay Update**",
|
||||
value=(
|
||||
"> Autoplay is now much more stable after a revamp of the"
|
||||
" previous system. If you experienced short outages recently,"
|
||||
" this was due to the update. Thank you for your patience!"
|
||||
name="**Limited YouTube Support**",
|
||||
description=(
|
||||
"Support for YouTube links and searches has been added. This"
|
||||
" is currently in a testing phase and is not guaranteed to"
|
||||
" work. If you encounter any issues, please submit a but"
|
||||
" report."
|
||||
),
|
||||
inline=False,
|
||||
)
|
||||
|
@ -15,7 +15,7 @@ class NowPlaying(commands.Cog):
|
||||
@app_commands.command()
|
||||
@app_commands.check(Music.create_player)
|
||||
async def np(self, interaction: discord.Interaction):
|
||||
"Show what song is currently playing"
|
||||
"See what song is currently playing"
|
||||
player = self.bot.lavalink.player_manager.get(interaction.guild.id)
|
||||
|
||||
time_in = str(datetime.timedelta(milliseconds=player.position))[:-7]
|
||||
|
@ -1,5 +1,6 @@
|
||||
import discord
|
||||
import datetime
|
||||
from typing import Literal
|
||||
from discord import app_commands
|
||||
from discord.ext import commands
|
||||
from cogs.music import Music
|
||||
@ -12,21 +13,39 @@ class Pause(commands.Cog):
|
||||
self.bot = bot
|
||||
|
||||
@app_commands.command()
|
||||
@app_commands.describe(pause="TRUE to pause, FALSE to unpause")
|
||||
@app_commands.check(Music.create_player)
|
||||
async def pause(self, interaction: discord.Interaction):
|
||||
"Pauses the song that is currently playing"
|
||||
async def pause(
|
||||
self, interaction: discord.Interaction, pause: Literal["TRUE", "FALSE"]
|
||||
):
|
||||
"Pause or unpause the current song"
|
||||
player = self.bot.lavalink.player_manager.get(interaction.guild.id)
|
||||
|
||||
await player.set_pause(pause=True)
|
||||
embed = create_embed(
|
||||
title=f"Music Now Paused ⏸️",
|
||||
description=(
|
||||
f"**[{player.current.title}]({player.current.uri})**\n\nQueued"
|
||||
f" by: {player.current.requester.mention}"
|
||||
),
|
||||
thumbnail=player.current.artwork_url,
|
||||
)
|
||||
await interaction.response.send_message(embed=embed)
|
||||
if pause:
|
||||
await player.set_pause(pause=True)
|
||||
embed = create_embed(
|
||||
title=f"Music Paused ⏸️",
|
||||
description=(
|
||||
f"**[{player.current.title}]({player.current.uri})** by"
|
||||
f" {player.current.author}\n\nQueued by:"
|
||||
f" {player.current.requester.mention}"
|
||||
),
|
||||
thumbnail=player.current.artwork_url,
|
||||
)
|
||||
return await interaction.response.send_message(embed=embed)
|
||||
|
||||
else:
|
||||
await player.set_pause(pause=False)
|
||||
embed = create_embed(
|
||||
title=f"Music Unpaused ▶️",
|
||||
description=(
|
||||
f"**[{player.current.title}]({player.current.uri})** by"
|
||||
f" {player.current.author}\n\nQueued by:"
|
||||
f" {player.current.requester.mention}"
|
||||
),
|
||||
thumbnail=player.current.artwork_url,
|
||||
)
|
||||
return await interaction.response.send_message(embed=embed)
|
||||
|
||||
|
||||
async def setup(bot):
|
||||
|
@ -91,7 +91,7 @@ class Play(commands.Cog):
|
||||
# Create the embed if the results are a playlist
|
||||
if results.load_type == LoadType.PLAYLIST:
|
||||
embed = create_embed(
|
||||
title="Songs Queued!",
|
||||
title="Songs Queued",
|
||||
description=(
|
||||
f"**{results.playlist_info.name}**\n"
|
||||
f"` {len(results.tracks)} ` tracks\n\n"
|
||||
@ -104,7 +104,7 @@ class Play(commands.Cog):
|
||||
# Remove all but first track (most relevant result)
|
||||
results.tracks = results.tracks[:1]
|
||||
embed = create_embed(
|
||||
title="Song Queued!",
|
||||
title="Song Queued",
|
||||
description=(
|
||||
f"**{results.tracks[0].title}** by"
|
||||
f" **{results.tracks[0].author}**\n\nQueued by:"
|
||||
@ -119,9 +119,9 @@ class Play(commands.Cog):
|
||||
embed = create_embed(
|
||||
title="Nothing Found",
|
||||
description=(
|
||||
"I was not able to find or load any songs for that query."
|
||||
" Please try again and fill out a bug report with"
|
||||
" </bug:1224840889906499626> if this continues to happen."
|
||||
"No songs were found for that query. Please try again and"
|
||||
" fill out a bug report with </bug:1224840889906499626> if"
|
||||
" this continues to happen."
|
||||
),
|
||||
)
|
||||
return await interaction.response.send_message(
|
||||
@ -143,9 +143,20 @@ class Play(commands.Cog):
|
||||
try:
|
||||
await results.tracks[0].load(player.node)
|
||||
# If it fails, remove it from the queue and alert the user
|
||||
except LoadError:
|
||||
except LoadError as e:
|
||||
player.queue.remove(results.tracks[0])
|
||||
raise LoadError
|
||||
embed = create_embed(
|
||||
title="Load Error",
|
||||
description=(
|
||||
"Apple Music and Spotify do not allow direct"
|
||||
" playing from their websites, and I was unable to"
|
||||
" load a track on a supported platform. Please try"
|
||||
" again."
|
||||
),
|
||||
)
|
||||
return await interaction.response.send_message(
|
||||
embed=embed, ephemeral=True
|
||||
)
|
||||
|
||||
# Join the voice channel if not already connected
|
||||
if not interaction.guild.voice_client:
|
||||
|
@ -23,12 +23,20 @@ class Remove(commands.Cog):
|
||||
title="Nothing Queued",
|
||||
description="There are no songs in the queue to remove.",
|
||||
)
|
||||
return await interaction.response.send_message(embed=embed)
|
||||
return await interaction.response.send_message(
|
||||
embed=embed, ephemeral=True
|
||||
)
|
||||
|
||||
if number > len(player.queue) or number < 1:
|
||||
embed = create_embed(
|
||||
title="Number Out of Range",
|
||||
description=(
|
||||
"The number you entered is outside of the allowed range."
|
||||
" Please try again with a valid song number."
|
||||
),
|
||||
)
|
||||
return await interaction.response.send_message(
|
||||
"Number out of range - please try again!",
|
||||
ephemeral=True,
|
||||
embed=embed, ephemeral=True
|
||||
)
|
||||
|
||||
index = number - 1
|
||||
@ -40,9 +48,8 @@ class Remove(commands.Cog):
|
||||
embed = create_embed(
|
||||
title="Song Removed from Queue",
|
||||
description=(
|
||||
"**Song Removed -"
|
||||
f" [{removed_title}]({removed_url})**\n\nIssued by:"
|
||||
f" {interaction.user.mention}"
|
||||
f"**[{removed_title}]({removed_url})** has been unqueued.\n\n"
|
||||
f"Issued by: {interaction.user.mention}"
|
||||
),
|
||||
thumbnail=removed_artwork,
|
||||
)
|
||||
|
@ -1,33 +0,0 @@
|
||||
import discord
|
||||
import datetime
|
||||
from discord import app_commands
|
||||
from discord.ext import commands
|
||||
from cogs.music import Music
|
||||
|
||||
from utils.config import create_embed
|
||||
|
||||
|
||||
class Resume(commands.Cog):
|
||||
def __init__(self, bot):
|
||||
self.bot = bot
|
||||
|
||||
@app_commands.command()
|
||||
@app_commands.check(Music.create_player)
|
||||
async def resume(self, interaction: discord.Interaction):
|
||||
"Resumes the paused song"
|
||||
player = self.bot.lavalink.player_manager.get(interaction.guild.id)
|
||||
|
||||
await player.set_pause(pause=False)
|
||||
embed = create_embed(
|
||||
title=f"Music Now Resumed ⏯️",
|
||||
description=(
|
||||
f"**[{player.current.title}]({player.current.uri})**\n\nQueued"
|
||||
f" by: {player.current.requester.mention}"
|
||||
),
|
||||
thumbnail=player.current.artwork_url,
|
||||
)
|
||||
await interaction.response.send_message(embed=embed)
|
||||
|
||||
|
||||
async def setup(bot):
|
||||
await bot.add_cog(Resume(bot))
|
@ -75,15 +75,16 @@ class Skip(commands.Cog):
|
||||
try:
|
||||
await player.skip()
|
||||
break
|
||||
except LoadError:
|
||||
except LoadError as e:
|
||||
continue
|
||||
|
||||
if not player.current:
|
||||
embed = create_embed(
|
||||
title="End of Queue",
|
||||
description=(
|
||||
"All songs in queue have been played. Thank you for using"
|
||||
f" me :wave:\n\nIssued by: {interaction.user.mention}"
|
||||
"I have left the voice channel as all songs in the queue"
|
||||
" have been played.\n\n"
|
||||
f"Issued by: {interaction.user.mention}"
|
||||
),
|
||||
)
|
||||
return await interaction.response.send_message(embed=embed)
|
||||
@ -92,13 +93,9 @@ class Skip(commands.Cog):
|
||||
# So just wait a sec before sending the message
|
||||
await asyncio.sleep(0.5)
|
||||
embed = create_embed(
|
||||
title="Track Skipped",
|
||||
description=(
|
||||
f"**Now Playing: [{next_song.title}]({next_song.uri})** by"
|
||||
f" {next_song.author}\n\nQueued by:"
|
||||
f" {next_song.requester.mention}"
|
||||
title=(
|
||||
f"{'Track Skipped' if number == 1 else f'{number} Tracks Skipped'}"
|
||||
),
|
||||
thumbnail=next_song.artwork_url,
|
||||
)
|
||||
await interaction.response.send_message(embed=embed)
|
||||
|
||||
|
@ -28,8 +28,8 @@ class Stop(commands.Cog):
|
||||
embed = create_embed(
|
||||
title="Queue Cleared and Music Stopped",
|
||||
description=(
|
||||
"Thank you for using me :wave:\n\nIssued by:"
|
||||
f" {interaction.user.mention}"
|
||||
f"Thank you for using {self.bot.me.mention}\n\n"
|
||||
f"Issued by: {interaction.user.mention}"
|
||||
),
|
||||
)
|
||||
await interaction.response.send_message(embed=embed)
|
||||
|
@ -69,22 +69,5 @@ class Tree(app_commands.CommandTree):
|
||||
except discord.errors.InteractionResponded:
|
||||
await interaction.followup.send(embed=embed, ephemeral=True)
|
||||
|
||||
elif (error, LoadError):
|
||||
embed = create_embed(
|
||||
title="Load Error",
|
||||
description=(
|
||||
"Apple Music and Spotify do not allow direct playing from"
|
||||
" their websites, and I was unable to load a track on a"
|
||||
" valid source. Please try again."
|
||||
),
|
||||
)
|
||||
# Only send the error if the interaction is still valid
|
||||
try:
|
||||
await interaction.response.send_message(
|
||||
embed=embed, ephemeral=True
|
||||
)
|
||||
except discord.errors.InteractionResponded:
|
||||
pass
|
||||
|
||||
else:
|
||||
raise error
|
||||
|
@ -15,7 +15,7 @@ async def load(
|
||||
"""
|
||||
Get the playlist info from the Spotify API
|
||||
"""
|
||||
playlist_id = query.split("/playlist/")[1].split("?si=")[0]
|
||||
playlist_id = query.split("/playlist/")[1]
|
||||
|
||||
try:
|
||||
# Get the playlist info
|
||||
|
Loading…
x
Reference in New Issue
Block a user