Compare commits
2 Commits
7ebc2b93b8
...
689821dd02
Author | SHA1 | Date |
---|---|---|
Thibaut Broggi | 689821dd02 | |
Thibaut Broggi | 81c9127153 |
|
@ -36,8 +36,24 @@ class GuildsManager {
|
|||
if (!this.#guilds[guild_id]?.[guild_action.target]?.[guild_action.action]) {
|
||||
message.channel.send(`The command ${guild_action.target} ${guild_action.action} is not implemented yet`)
|
||||
} else {
|
||||
try {
|
||||
const output = await this.#guilds[guild_id][guild_action.target][guild_action.action](guild_action)
|
||||
return output
|
||||
} catch (e) {
|
||||
const error_message = await message.channel.send(":warning: Something went wrong. React with :eyes: to get more information about this error.")
|
||||
error_message.react("👀")
|
||||
error_message.awaitReactions((r, u) => r.emoji.name === "👀" && u.id !== error_message.author.id, {max: 1})
|
||||
.then(() => {
|
||||
message.channel.send(`Target manager: **${guild_action.target}** Action: **${guild_action.action}** Parameters: **${guild_action.params.join(', ')}**`
|
||||
+ "\n"
|
||||
+ `Original message: \`${guild_action.message}\``
|
||||
+ "\n"
|
||||
+ "```js\n"
|
||||
+ e.stack
|
||||
+ "\n```")
|
||||
})
|
||||
return null
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -15,7 +15,6 @@ class Youtube {
|
|||
* @return {Track[]} An array of objects representing the search results. <code>source</code> is set to <code>"youtube"</code>
|
||||
*/
|
||||
async search_track(search) {
|
||||
try {
|
||||
const req = await fetch('https://www.youtube.com/results?search_query='
|
||||
+ encodeURIComponent(search))
|
||||
const body = await req.text()
|
||||
|
@ -31,10 +30,6 @@ class Youtube {
|
|||
source: 'youtube',
|
||||
})
|
||||
})
|
||||
} catch(e) {
|
||||
console.error(e)
|
||||
return []
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
Loading…
Reference in New Issue