forked from embee/woomy
		
	music is fixed, it just needs polish now ^^
This commit is contained in:
		
							parent
							
								
									abab09546c
								
							
						
					
					
						commit
						1760fbcda1
					
				
					 2 changed files with 37 additions and 8 deletions
				
			
		
							
								
								
									
										3
									
								
								index.js
									
										
									
									
									
								
							
							
						
						
									
										3
									
								
								index.js
									
										
									
									
									
								
							| 
						 | 
					@ -96,9 +96,8 @@ const init = async () => {
 | 
				
			||||||
  // Login to Discord
 | 
					  // Login to Discord
 | 
				
			||||||
  function failedToLogin (err) {
 | 
					  function failedToLogin (err) {
 | 
				
			||||||
    client.logger.error('Couldn\'t login: ' + err)
 | 
					    client.logger.error('Couldn\'t login: ' + err)
 | 
				
			||||||
 | 
					 | 
				
			||||||
    process.exit(0)
 | 
					    process.exit(0)
 | 
				
			||||||
  };
 | 
					  }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  if (client.devmode !== true) {
 | 
					  if (client.devmode !== true) {
 | 
				
			||||||
    client.login(client.config.token).catch(failedToLogin)
 | 
					    client.login(client.config.token).catch(failedToLogin)
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -57,7 +57,6 @@ module.exports = client => {
 | 
				
			||||||
    try {
 | 
					    try {
 | 
				
			||||||
      const id = await ytdl.getURLVideoID(query)
 | 
					      const id = await ytdl.getURLVideoID(query)
 | 
				
			||||||
      resp = await fetch('https://invidious.snopyta.org/api/v1/videos/' + id)
 | 
					      resp = await fetch('https://invidious.snopyta.org/api/v1/videos/' + id)
 | 
				
			||||||
      console.log(resp)
 | 
					 | 
				
			||||||
    } catch (err) {
 | 
					    } catch (err) {
 | 
				
			||||||
      resp = await fetch('https://invidious.snopyta.org/api/v1/search?q=' + encodeURIComponent(query))
 | 
					      resp = await fetch('https://invidious.snopyta.org/api/v1/search?q=' + encodeURIComponent(query))
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
| 
						 | 
					@ -124,11 +123,44 @@ module.exports = client => {
 | 
				
			||||||
          embed.setTitle('Please reply with a number `1-' + i + '` to select which song you want to add to the queue.')
 | 
					          embed.setTitle('Please reply with a number `1-' + i + '` to select which song you want to add to the queue.')
 | 
				
			||||||
          embed.setColor(client.embedColour(message.guild))
 | 
					          embed.setColor(client.embedColour(message.guild))
 | 
				
			||||||
          embed.setDescription(output)
 | 
					          embed.setDescription(output)
 | 
				
			||||||
          const selection = await client.awaitReply(message, embed)
 | 
					
 | 
				
			||||||
          console.log(selection)
 | 
					          let selection = await client.awaitReply(message, embed)
 | 
				
			||||||
 | 
					          selection = Number(selection)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
          switch (selection) {
 | 
					          switch (selection) {
 | 
				
			||||||
 | 
					            case 1:
 | 
				
			||||||
 | 
					              video = videos[0]
 | 
				
			||||||
 | 
					              break
 | 
				
			||||||
 | 
					            case 2:
 | 
				
			||||||
 | 
					              if (videos[1]) {
 | 
				
			||||||
 | 
					                video = videos[1]
 | 
				
			||||||
 | 
					              } else {
 | 
				
			||||||
 | 
					                return message.channel.send('Invalid choice.')
 | 
				
			||||||
 | 
					              }
 | 
				
			||||||
 | 
					              break
 | 
				
			||||||
 | 
					            case 3:
 | 
				
			||||||
 | 
					              if (videos[2]) {
 | 
				
			||||||
 | 
					                video = videos[2]
 | 
				
			||||||
 | 
					              } else {
 | 
				
			||||||
 | 
					                return message.channel.send('Invalid choice.')
 | 
				
			||||||
 | 
					              }
 | 
				
			||||||
 | 
					              break
 | 
				
			||||||
 | 
					            case 4:
 | 
				
			||||||
 | 
					              if (videos[3]) {
 | 
				
			||||||
 | 
					                video = videos[3]
 | 
				
			||||||
 | 
					              } else {
 | 
				
			||||||
 | 
					                return message.channel.send('Invalid choice.')
 | 
				
			||||||
 | 
					              }
 | 
				
			||||||
 | 
					              break
 | 
				
			||||||
 | 
					            case 5:
 | 
				
			||||||
 | 
					              if (videos[4]) {
 | 
				
			||||||
 | 
					                video = videos[4]
 | 
				
			||||||
 | 
					              } else {
 | 
				
			||||||
 | 
					                return message.channel.send('Invalid choice.')
 | 
				
			||||||
 | 
					              }
 | 
				
			||||||
 | 
					              break
 | 
				
			||||||
 | 
					            default:
 | 
				
			||||||
 | 
					              return message.channel.send('Invalid choice.')
 | 
				
			||||||
          }
 | 
					          }
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -138,8 +170,6 @@ module.exports = client => {
 | 
				
			||||||
          video = videos
 | 
					          video = videos
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        console.log(video)
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
        // Add video to queue
 | 
					        // Add video to queue
 | 
				
			||||||
        guild.queue.push({ video: video, requestedBy: message.member.id })
 | 
					        guild.queue.push({ video: video, requestedBy: message.member.id })
 | 
				
			||||||
      }
 | 
					      }
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue