Skip to content

Commit

Permalink
Merge pull request #10 from TheBluekr/Development
Browse files Browse the repository at this point in the history
Update Stable to match Development
  • Loading branch information
TheBluekr authored Nov 10, 2023
2 parents 41f17f1 + 7360b3b commit 4853386
Show file tree
Hide file tree
Showing 2 changed files with 52 additions and 4 deletions.
28 changes: 28 additions & 0 deletions .github/workflows/deploy-stable.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
name: remote ssh command
on:
push:
branches:
- Stable
pull_request:
branches:
- Stable
workflow_dispatch:
branches:
- Stable
jobs:
build:
name: Build
runs-on: ubuntu-latest
steps:
- name: executing remote ssh commands using key
uses: appleboy/[email protected]
with:
host: ${{ secrets.SSH_HOST }}
username: ${{ secrets.SSH_USER }}
key: ${{ secrets.SSH_PRIVATE_KEY }}
script: |
cd ${{ secrets.WORK_DIR }}
pwd
git pull
cd ..
docker-compose restart
28 changes: 24 additions & 4 deletions cogs/lavalink.py
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ async def play(self, interaction: discord.Interaction, url: str=None):
embed = self.embed.create_embed(interaction.user)

if(url):
tracks = await wavelink.NodePool.get_tracks(url, wavelink.YouTubeTrack)
tracks = await wavelink.NodePool.get_tracks(url, cls=wavelink.YouTubeTrack)
if(not tracks):
embed.description = f"Could not find tracks with url: `{url}`"
return await interaction.response.send_message(embed=embed)
Expand Down Expand Up @@ -137,12 +137,12 @@ async def add(self, interaction: discord.Interaction, url: str):
else:
vc: wavelink.Player = interaction.guild.voice_client

tracks = await wavelink.NodePool.get_tracks(url, wavelink.YouTubeTrack)
tracks = await wavelink.NodePool.get_tracks(url, cls=wavelink.YouTubeTrack)
if(not tracks):
embed.description = f"Could not find tracks with url: `{url}`"
return await interaction.response.send_message(embed=embed)

track = Track(tracks[0].id, tracks[0].info, requester=interaction.user)
track = Track(interaction.user, tracks[0])

embed.description = f"**Added**:\n**[{track.title}](https://www.youtube.com/watch?v={track.identifier} '{track.identifier}')**"
embed.set_footer(text=f"Requested by: {track.requester}", icon_url=track.requester.avatar.url)
Expand All @@ -159,7 +159,7 @@ async def add(self, interaction: discord.Interaction, url: str):
@check_voice_user()
@music.command()
async def search(self, interaction: discord.Interaction, query: str):
tracks = await wavelink.NodePool.get_tracks(query, wavelink.YouTubeTrack)
tracks = await wavelink.NodePool.get_tracks(query, cls=wavelink.YouTubeTrack)

embed = self.embed.create_embed(interaction.user)

Expand Down Expand Up @@ -259,9 +259,19 @@ async def stop(self, interaction: discord.Interaction):
async def skip(self, interaction: discord.Interaction):
"""Skips the current playing song.
"""
embed = self.embed.create_embed(interaction.user)

if not interaction.guild.voice_client:
embed.description = "Not connected to voice"
return await interaction.response.send_message(embed=embed)

vc: wavelink.Player = interaction.guild.voice_client

await vc.stop(force=True)

embed.description = "Skipped current song"

await interaction.response.send_message(embed=embed)

@commands.guild_only()
@check_voice_user()
Expand All @@ -287,8 +297,18 @@ async def volume(self, interaction: discord.Interaction, volume: app_commands.Ra
@music.command(description="Sets the current position in the track to the specified time")
async def set(self, interaction: discord.Interaction, position: float):
"""Sets the current playback to the specified time (in seconds)"""
embed = self.embed.create_embed(interaction.user)

if not interaction.guild.voice_client:
embed.description = "Not connected to voice"
return await interaction.response.send_message(embed=embed)

vc: wavelink.Player = interaction.guild.voice_client
await vc.seek(round(position*1000.0))

embed.description = f"Set playback to {position}s"

await interaction.response.send_message(embed=embed)

@commands.guild_only()
@check_voice_user()
Expand Down

0 comments on commit 4853386

Please sign in to comment.