Remove broken is_text_based check

This commit is contained in:
jude 2023-10-21 17:06:41 +01:00
parent 8390bf0ec6
commit 6d324e10cb
2 changed files with 117 additions and 138 deletions

View File

@ -25,10 +25,6 @@ pub async fn play(
let guild = ctx.guild().unwrap();
if channel.as_ref().map_or(false, |c| c.is_text_based()) {
ctx.say("The channel specified is not a voice channel.")
.await?;
} else {
ctx.say(
play_from_query(
&ctx.serenity_context(),
@ -42,7 +38,6 @@ pub async fn play(
.await,
)
.await?;
}
Ok(())
}

View File

@ -105,8 +105,7 @@ SELECT name, id, public, server_id, uploader_id
public = 1 OR
uploader_id = ? OR
server_id = ?
)
",
)",
id,
user_id,
guild_id
@ -139,8 +138,7 @@ SELECT name, id, public, server_id, uploader_id
) DESC,
server_id = ? DESC,
public = 1 DESC,
rand()
",
rand()",
name,
user_id,
guild_id,
@ -170,8 +168,7 @@ SELECT name, id, public, server_id, uploader_id
) DESC,
server_id = ? DESC,
public = 1 DESC,
rand()
",
rand()",
name,
user_id,
guild_id,
@ -206,8 +203,7 @@ WHERE name LIKE CONCAT(?, '%') AND (uploader_id = ? OR server_id = ? OR EXISTS(
FROM favorite_sounds
WHERE sound_id = id AND user_id = ?
))
LIMIT 25
",
LIMIT 25",
query,
user_id,
guild_id.into(),
@ -234,8 +230,7 @@ WHERE name LIKE CONCAT(?, '%') AND EXISTS(
FROM favorite_sounds
WHERE sound_id = id AND user_id = ?
)
LIMIT 25
",
LIMIT 25",
query,
user_id.into(),
)
@ -257,8 +252,7 @@ SELECT name, id, public, server_id, uploader_id
FROM sounds
WHERE uploader_id = ?
ORDER BY id DESC
LIMIT ?, ?
",
LIMIT ?, ?",
user_id.into(),
page * 25,
(page + 1) * 25
@ -273,8 +267,7 @@ SELECT name, id, public, server_id, uploader_id
SELECT name, id, public, server_id, uploader_id
FROM sounds
WHERE uploader_id = ?
ORDER BY id DESC
",
ORDER BY id DESC",
user_id.into()
)
.fetch_all(&self.database)
@ -300,8 +293,7 @@ SELECT name, id, public, server_id, uploader_id
INNER JOIN favorite_sounds f ON sounds.id = f.sound_id
WHERE f.user_id = ?
ORDER BY id DESC
LIMIT ?, ?
",
LIMIT ?, ?",
user_id.into(),
page * 25,
(page + 1) * 25
@ -317,8 +309,7 @@ SELECT name, id, public, server_id, uploader_id
FROM sounds
INNER JOIN favorite_sounds f ON sounds.id = f.sound_id
WHERE f.user_id = ?
ORDER BY id DESC
",
ORDER BY id DESC",
user_id.into()
)
.fetch_all(&self.database)
@ -343,8 +334,7 @@ SELECT name, id, public, server_id, uploader_id
FROM sounds
WHERE server_id = ?
ORDER BY id DESC
LIMIT ?, ?
",
LIMIT ?, ?",
guild_id.into(),
page * 25,
(page + 1) * 25
@ -360,8 +350,7 @@ SELECT name, id, public, server_id, uploader_id
SELECT name, id, public, server_id, uploader_id
FROM sounds
WHERE server_id = ?
ORDER BY id DESC
",
ORDER BY id DESC",
guild_id.into()
)
.fetch_all(&self.database)
@ -421,8 +410,7 @@ impl Sound {
SELECT src
FROM sounds
WHERE id = ?
LIMIT 1
",
LIMIT 1",
self.id
)
.fetch_one(db_pool)
@ -471,8 +459,7 @@ SELECT src
"
SELECT COUNT(1) as count
FROM sounds
WHERE uploader_id = ?
",
WHERE uploader_id = ?",
user_id
)
.fetch_one(db_pool)
@ -495,8 +482,7 @@ SELECT COUNT(1) as count
FROM sounds
WHERE
uploader_id = ? AND
name = ?
",
name = ?",
user_id,
name
)
@ -517,8 +503,7 @@ UPDATE sounds
SET
public = ?
WHERE
id = ?
",
id = ?",
self.public,
self.id
)
@ -620,8 +605,7 @@ WHERE
match sqlx::query!(
"
INSERT INTO sounds (name, server_id, uploader_id, public, src)
VALUES (?, ?, ?, 1, ?)
",
VALUES (?, ?, ?, 1, ?)",
name,
server_id,
user_id,