-
Notifications
You must be signed in to change notification settings - Fork 7
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add Vibe Mode #42
base: master
Are you sure you want to change the base?
Add Vibe Mode #42
Conversation
Hello @aadibajpai! Thanks for updating this PR.
Comment last updated at 2020-08-20 01:32:12 UTC |
Codecov Report
@@ Coverage Diff @@
## master #42 +/- ##
==========================================
- Coverage 28.70% 27.11% -1.60%
==========================================
Files 9 9
Lines 310 354 +44
==========================================
+ Hits 89 96 +7
- Misses 221 258 +37
Continue to review full report at Codecov.
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Well, I know you said it's not going to work with more users, but this approach is a no-go. Using self
statement makes it almost impossible to make it work for more users. Also, I don't like the idea of calling it vibe mode, Especially in code, what if someone will work on this except us? We would need to explain to him what it is, code should be self-explanatory, this is an unnecessary complication. This is all right to add this as command alias, but not as default one.
fixed |
@thealphadollar, this adds a looping feature to the bot, where you once call the commands and it will keep sending lyrics as activity changes until you stop listening or kill the loop with $kill. The logic is that the $vibe command adds your info to a shared variable and starts a loop if the loop isn't already running. And then the loop every 5s takes care of all the users in the shared variable and $kill removes your info from the shared variable. There's a bunch of debug print statements there but I'll get rid of them. |
@dolphingarlic @fadedcoder review again, thanks! |
looks like there's a problem with the logging part, it doesn't integrate well with this. Once commented it works as intended.
SwagLyricsBot/general_commands.py
Outdated
|
||
@commands.command() | ||
async def vibe(self, ctx): | ||
prev = self.current.copy() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Instead of copying the entire dict, you could just check whether the new dict has length equal to 1
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also, check whether the user is already in self.current
if you do this
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
alright
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also, check whether the user is already in
self.current
if you do this
what do you mean by this
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
look at the updated commit and see if that's ok?
SwagLyricsBot/general_commands.py
Outdated
await self.send_lyrics(channel, song, artists) | ||
except LyricsError as e: | ||
print('No activity detected, stopping loop.') | ||
await channel.send("No activity detected, killing the vibe.") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
await channel.send("No activity detected, killing the vibe.") | |
await channel.send("No activity detected. Killing the vibe.") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
it's not that bad is it?
self.vibe_mode.start() | ||
|
||
@commands.command() | ||
async def kill(self, ctx): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe rename this to kill_vibe
or something to prevent ambiguity
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ambiguity with what?
Make logs work (you can't call |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Make changes based on the comment above
we don't need to store channel now since DMs only
check now, also how much console output would you like to keep so it's okay? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Well, it's too much same information for one loop, get rid of it, it should print maybe ony a user name + song name.
And get rid of the slang. Use casual language, but not slang. It's not consistent for the rest of the bot and I will not merge it until you change it. I let you leave $vibe as a command string, but provide aliases like $loop
, and describe it in $help
Oh and fix the conflict
Fine, It can stay then |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Add the user nickname in this line https://github.com/aadibajpai/SwagLyrics-discord-bot/blob/vibe/SwagLyricsBot/general_commands.py#L49. You should add the log to webhook that someone started vibe and ended it, so we can investigate it easier. Also include the number of people currently in vibe.
Implements an automatic loop so you do not need to request lyrics again and again if the song changes, until you stop listening to music or use the $kill command.
This is similar to the way it works in the cli swaglyrics application.