JustATac0 / GLaDOS

Code for the discord bot from this video >>> https://www.youtube.com/watch?v=EIUqm8k1VOY&lc=UgyNN_NTW5IvWNbMKYZ4AaABAg
Creative Commons Zero v1.0 Universal
15 stars 9 forks source link

Added Want You Gone song to the bot #3

Closed kneeecaps closed 1 year ago

kneeecaps commented 2 years ago

Added wantyougone song to the bot.

kneeecaps commented 2 years ago

I would also like to note that both your code and the code I have here has a lot of redundant lines. Pretty much the whole thing can be done in maybe 5 lines with lists instead of 400 lines. If I have some more time, I'll go back and change my code so it is more efficient.

Basically what I have done, is I have added Want You Gone from Portal 2 end credits. If you make a video of the code I have written for the second song, would you please maybe just put my name in a little card at the end or something?

kneeecaps commented 2 years ago

Oh and also, your code for I'm Still Alive has pretty much the whole timings stuffed up. I downloaded the mp3 you linked for the guy that made an issue over this and the timings still do not work properly. I think this may partially be due to internet though, while I added the other song in, I noticed I had to change the timings based off what my ping was doing at the time. Basically, the bot may only work with accurate timings at certain internet speeds

kneeecaps commented 2 years ago

Just greatly optimized my code with the new commit. New code is nearly a third of the idle run time as the last one, it is also a lot neater and easier to edit later.

The main flaws of this new commit is that it includes 4 very long lists. These lists can be shortened to two slightly more complicated lists with the inclusion of dataclasses, though my personal opinion is the difference will be too minimal for this to be worth doing.

I have also done the maths on this, my improvements are roughly 42% faster than the improvements Oman395 did, though after looking at his code, I believe he may be planning to implement something similar to what I have done with lists. He has loaded a function into memory which deals with sending the messages and the delays in one line, as I'm sure you have seen since you approved it, this will most likely decrease idle run time further than what I have done. Although I'm not sure how big the difference will be, Oman395's version will be faster when he adds in lists unless I do something like what he has done with the function.

To sum up all the changes I have made with this branch, I don't think there is much else I can add to it, I have added Want You Gone from the Portal 2 soundtrack and optimized the code. As I said before, there are further optimizations that can happen, though my personal opinion is that the difference will be minimal and not worth the extra effort of doing it.

I also mentioned this before though I'll put it here again since I am summing up all my last comments, though if you make a video featuring my code, would you please at least put my name on a card at the end or something?

Oman395 commented 2 years ago

Why not set up the arrays as something like stillalive = [ [time, lyric], [time, lyric] ] Or something along those lines? Could also be easily stored via JSON as dedicated files for easier use

Oman395 commented 2 years ago

Update: JSON appears to be working so far, just need to make sure it's not accidentally just using the old code cause I left it in for debugging purposes

kneeecaps commented 2 years ago

If I have some spare time, I might convert the arrays to something like in your comment. The main reason I used the four separate arrays was I was trying to find that sweet spot between efficient code and readable code. I may have gone a bit too far onto the readable side though, so I'll probably change it around later today if I get some free time.

You are right in that it could also be stored in a JSON file, though the only real benefit from that change will be increased readability of the code which is something I would normally do near the end of a project.

If you have any more feedback or criticism I'm happy to hear it

Oman395 commented 2 years ago

PR up with JSON implemented #4

Oman395 commented 2 years ago

I feel kinda bad but I implemented it as [lyric, time] not [time, lyric]. Should be pretty easy to fix tho, if ya want I can probably get it fixed by ~12pm est

Oman395 commented 2 years ago
[
  [ 'This was a triumph.', 0 ],
  [ "I'm making a note here:", 4 ],
  [ '**HUGE SUCCESS.**', 1.5 ],
  [ "It's hard to overstate", 3 ],
  [ 'my satisfaction.', 2 ],
  [ 'Aperture Science', 4.5 ],
  [ 'We do what we must', 4 ],
  [ 'because we can.', 1.5 ],
  [ 'For the good of all of us.', 3 ],
  [ 'Except the ones who are dead.', 3 ],
  [ "But there's no sense crying", 2 ],
  [ 'over every mistake.', 1.8 ],
  [ 'You just keep on trying', 1.8 ],
  [ 'till you run out of cake.', 1.8 ],
  [ 'And the Science gets done.', 1.8 ],
  [ 'And you make a neat gun.', 1.8 ],
  [ 'For the people who are', 1.5 ],
  [ '**still alive.**', 1.5 ],
  [ "I'm not even angry.", 8 ],
  [ "I'm being so sincere right now.", 4 ],
  [ 'Even though you', 4 ],
  [ 'broke my heart.', 2 ],
  [ 'And killed me.', 2 ],
  [ 'And tore me to pieces.', 3 ],
  [ 'And threw every piece into', 3 ],
  [ 'a fire.', 2.5 ],
  [ 'As they burned it hurt because', 3 ],
  [ 'I was so happy for you!', 3 ],
  [ 'Now these points of data', 1.8 ],
  [ 'make a beautiful line.', 1.8 ],
  [ "And we're out of beta.", 1.8 ],
  [ "We're releasing on time.", 1.8 ],
  [ "So I'm GLaD. I got burned.", 1.8 ],
  [ 'Think of all the things we learned', 1.5 ],
  [ 'for the people who are', 1.8 ],
  [ '**still alive.**', 1.2 ],
  [ 'Go ahead and leave me.', 8 ],
  [ 'I think I prefer to stay inside.', 4 ],
  [ "Maybe you'll find", 4 ],
  [ 'someone else', 2 ],
  [ 'to help you.', 2 ],
  [ 'Maybe Black Mesa', 3 ],
  [ 'THAT WAS A JOKE.', 3 ],
  [ '** HA HA. FAT CHANCE.**', 2 ],
  [ 'Anyway,', 2.5 ],
  [ 'this cake is great.', 1.5 ],
  [ "It's so delicious and moist.", 2 ],
  [ 'Look at me still talking', 1.8 ],
  [ "when there's Science to do.", 1.8 ],
  [ 'When I look out there,', 1.8 ],
  [ "it makes me GLaD I'm not you.", 1.8 ],
  [ "I've experiments to run.", 1.8 ],
  [ 'There is research to be done.', 1.5 ],
  [ 'on the people who are', 1.8 ],
  [ '**still alive.**', 1.2 ],
  [ 'And believe me I am', 1.2 ],
  [ '**still alive.**', 1.2 ],
  [ "I'm doing Science and I'm", 1.2 ],
  [ '**still alive.**', 1.2 ],
  [ "I feel FANTASTIC and I'm", 1.2 ],
  [ '**still alive.**', 1.2 ],
  [ "While you're dying I'll be", 1.2 ],
  [ '**still alive.**', 1.2 ],
  [ "And when you're dead I will be", 1.2 ],
  [ '**still alive.**', 1.2 ],
  [ '**STILL ALIVE**', 1.2 ],
  [ '**still alive.**', 1.2 ]
]
Oman395 commented 2 years ago
[
  [ 'Well here we are again', 5 ],
  [ "It's always such a pleasure", 1 ],
  [ 'Remember when you tried', 2 ],
  [ 'to kill me twice?', 1 ],
  [ 'Oh how we laughed and laughed', 2 ],
  [ "Except I wasn't laughing", 1.5 ],
  [ 'Under the circumstances', 2 ],
  [ "I've been shockingly nice", 1.5 ],
  [ 'You want your freedom?', 3.2 ],
  [ 'Take it', 1.5 ],
  [ "That's what I'm counting on", 2 ],
  [ 'I used to want you dead', 4 ],
  [ 'But', 2.3 ],
  [ 'now I only want you gone', 0.05 ],
  [ 'She was a lot like you', 6.8 ],
  [ '(Maybe not quite as heavy)', 1.6 ],
  [ 'Now little Caroline is in here too', 1.4 ],
  [ 'One day they woke me up', 3.5 ],
  [ 'So I could live forever', 1.8 ],
  [ "It's such a shame the same", 1.8 ],
  [ 'Will never happen to you', 0.8 ],
  [ "You've got your", 3.8 ],
  [ 'short sad', 0.3 ],
  [ 'life left', 0.6 ],
  [ "That's what I'm counting on", 2 ],
  [ "I'll let you get right to it", 4 ],
  [ 'Now I only want you gone', 2 ],
  [ 'Goodbye my only friend', 7.5 ],
  [ 'Oh, did you think I meant you?', 1.5 ],
  [ 'That would be funny', 1.5 ],
  [ "if it weren't so sad", 1.5 ],
  [ 'Well you have been replaced', 2.5 ],
  [ "I don't need anyone now", 1.5 ],
  [ 'When I delete you maybe', 1.5 ],
  [ '[REDACTED]', 1.5 ],
  [ 'Go make some new disaster', 2.6 ],
  [ "That's what I'm counting on", 3.7 ],
  [ "You're someone else's problem", 4.4 ],
  [ 'Now I only want you gone', 2.7 ],
  [ 'Now I only want you gone', 4 ],
  [ 'Now I only want you gone', 4 ]
]
kneeecaps commented 2 years ago

The order doesn't really matter, I just did it as [time, lyric] because it was easier to copy and paste the data I already had that way. I'm fine with either version of it, whatever is easier for you

Oman395 commented 2 years ago

tbh I can pretty easily swap between, here's pretty much how I usually do it (in js b/c im a js guy lol)

let arr = [
 [second, first],
 [second,first]
]

for(let i = 0; i < arr.length; i++) {
 let a = arr[i][0];
 let b = arr[i][1];
 arr[i] = [b, a];
}