From c48f93b545d6ce550b51c2aa4c374a4348629c67 Mon Sep 17 00:00:00 2001 From: Sami <samip5@users.noreply.github.com> Date: Fri, 6 Jul 2018 11:54:25 +0300 Subject: [PATCH] Migrate: More updates --- Music-bot/bot.py | 5 +++-- Music-bot/cogs/music.py | 14 ++++++++++++-- 2 files changed, 15 insertions(+), 4 deletions(-) diff --git a/Music-bot/bot.py b/Music-bot/bot.py index b8dff79..c8bfcb3 100644 --- a/Music-bot/bot.py +++ b/Music-bot/bot.py @@ -37,6 +37,7 @@ if __name__ == '__main__': except: print(f'Failed to load extension {extension}.', file=sys.stderr) traceback.print_exc() + bot.run(dev_token) -bot.run(dev_token) -#bot.run(production_token) +# +# bot.run(production_token) diff --git a/Music-bot/cogs/music.py b/Music-bot/cogs/music.py index efa0d5c..35d4f69 100644 --- a/Music-bot/cogs/music.py +++ b/Music-bot/cogs/music.py @@ -17,6 +17,7 @@ import itertools import sys import traceback from functools import partial +from typing import List import discord import youtube_dl @@ -310,11 +311,14 @@ class Music: vc.resume() await ctx.send(f'**`{ctx.author}`**: Resumed the song!') - @commands.command(name='vote_skip') + @commands.command(name='vote_skip', enabled=False) async def vote_skip_(self, ctx): """Skips the song if the required votes have been acquired""" vc = ctx.voice_client - votes = [] + + votes: List[str] = [] + votes_needed = int(3) + vote_count = int(0) if not vc or not vc.is_connected(): return await ctx.send('I am not currently playing anything!', delete_after=20) @@ -326,9 +330,15 @@ class Music: if not {ctx.author} in votes: votes.append(f'{ctx.author}') + await ctx.send(f"There is now {len(votes)} votes!") + await ctx.send(votes) elif {ctx.author} in votes: await ctx.send(f"**`{ctx.author}`**: You have already voted") + if len(votes) == votes_needed or len(votes) > votes_needed: + await ctx.send("We have enough votes to skip, skipping.") + vc.stop() + @commands.command(name='skip') @checks.song_requester_or_dj() async def skip_(self, ctx): -- GitLab