Remove broken is_text_based check
This commit is contained in:
parent
8390bf0ec6
commit
6d324e10cb
@ -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(())
|
||||
}
|
||||
|
@ -99,14 +99,13 @@ impl SoundCtx for Data {
|
||||
let sound = sqlx::query_as_unchecked!(
|
||||
Sound,
|
||||
"
|
||||
SELECT name, id, public, server_id, uploader_id
|
||||
SELECT name, id, public, server_id, uploader_id
|
||||
FROM sounds
|
||||
WHERE id = ? AND (
|
||||
public = 1 OR
|
||||
uploader_id = ? OR
|
||||
server_id = ?
|
||||
)
|
||||
",
|
||||
)",
|
||||
id,
|
||||
user_id,
|
||||
guild_id
|
||||
@ -123,7 +122,7 @@ SELECT name, id, public, server_id, uploader_id
|
||||
sound = sqlx::query_as_unchecked!(
|
||||
Sound,
|
||||
"
|
||||
SELECT name, id, public, server_id, uploader_id
|
||||
SELECT name, id, public, server_id, uploader_id
|
||||
FROM sounds
|
||||
WHERE name = ? AND (
|
||||
public = 1 OR
|
||||
@ -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,
|
||||
@ -154,7 +152,7 @@ SELECT name, id, public, server_id, uploader_id
|
||||
sound = sqlx::query_as_unchecked!(
|
||||
Sound,
|
||||
"
|
||||
SELECT name, id, public, server_id, uploader_id
|
||||
SELECT name, id, public, server_id, uploader_id
|
||||
FROM sounds
|
||||
WHERE name LIKE CONCAT('%', ?, '%') AND (
|
||||
public = 1 OR
|
||||
@ -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,
|
||||
@ -199,15 +196,14 @@ SELECT name, id, public, server_id, uploader_id
|
||||
sqlx::query_as_unchecked!(
|
||||
Sound,
|
||||
"
|
||||
SELECT name, id, public, server_id, uploader_id
|
||||
FROM sounds
|
||||
WHERE name LIKE CONCAT(?, '%') AND (uploader_id = ? OR server_id = ? OR EXISTS(
|
||||
SELECT name, id, public, server_id, uploader_id
|
||||
FROM sounds
|
||||
WHERE name LIKE CONCAT(?, '%') AND (uploader_id = ? OR server_id = ? OR EXISTS(
|
||||
SELECT 1
|
||||
FROM favorite_sounds
|
||||
WHERE sound_id = id AND user_id = ?
|
||||
))
|
||||
LIMIT 25
|
||||
",
|
||||
))
|
||||
LIMIT 25",
|
||||
query,
|
||||
user_id,
|
||||
guild_id.into(),
|
||||
@ -227,15 +223,14 @@ LIMIT 25
|
||||
sqlx::query_as_unchecked!(
|
||||
Sound,
|
||||
"
|
||||
SELECT name, id, public, server_id, uploader_id
|
||||
FROM sounds
|
||||
WHERE name LIKE CONCAT(?, '%') AND EXISTS(
|
||||
SELECT name, id, public, server_id, uploader_id
|
||||
FROM sounds
|
||||
WHERE name LIKE CONCAT(?, '%') AND EXISTS(
|
||||
SELECT 1
|
||||
FROM favorite_sounds
|
||||
WHERE sound_id = id AND user_id = ?
|
||||
)
|
||||
LIMIT 25
|
||||
",
|
||||
)
|
||||
LIMIT 25",
|
||||
query,
|
||||
user_id.into(),
|
||||
)
|
||||
@ -253,12 +248,11 @@ LIMIT 25
|
||||
sqlx::query_as_unchecked!(
|
||||
Sound,
|
||||
"
|
||||
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
|
||||
LIMIT ?, ?
|
||||
",
|
||||
LIMIT ?, ?",
|
||||
user_id.into(),
|
||||
page * 25,
|
||||
(page + 1) * 25
|
||||
@ -270,11 +264,10 @@ SELECT name, id, public, server_id, uploader_id
|
||||
sqlx::query_as_unchecked!(
|
||||
Sound,
|
||||
"
|
||||
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)
|
||||
@ -295,13 +288,12 @@ SELECT name, id, public, server_id, uploader_id
|
||||
sqlx::query_as_unchecked!(
|
||||
Sound,
|
||||
"
|
||||
SELECT name, id, public, server_id, uploader_id
|
||||
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
|
||||
LIMIT ?, ?
|
||||
",
|
||||
LIMIT ?, ?",
|
||||
user_id.into(),
|
||||
page * 25,
|
||||
(page + 1) * 25
|
||||
@ -313,12 +305,11 @@ SELECT name, id, public, server_id, uploader_id
|
||||
sqlx::query_as_unchecked!(
|
||||
Sound,
|
||||
"
|
||||
SELECT name, id, public, server_id, uploader_id
|
||||
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)
|
||||
@ -339,12 +330,11 @@ SELECT name, id, public, server_id, uploader_id
|
||||
sqlx::query_as_unchecked!(
|
||||
Sound,
|
||||
"
|
||||
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
|
||||
LIMIT ?, ?
|
||||
",
|
||||
LIMIT ?, ?",
|
||||
guild_id.into(),
|
||||
page * 25,
|
||||
(page + 1) * 25
|
||||
@ -357,11 +347,10 @@ SELECT name, id, public, server_id, uploader_id
|
||||
sqlx::query_as_unchecked!(
|
||||
Sound,
|
||||
"
|
||||
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)
|
||||
@ -418,11 +407,10 @@ impl Sound {
|
||||
let record = sqlx::query_as_unchecked!(
|
||||
Src,
|
||||
"
|
||||
SELECT src
|
||||
SELECT src
|
||||
FROM sounds
|
||||
WHERE id = ?
|
||||
LIMIT 1
|
||||
",
|
||||
LIMIT 1",
|
||||
self.id
|
||||
)
|
||||
.fetch_one(db_pool)
|
||||
@ -469,10 +457,9 @@ SELECT src
|
||||
|
||||
let c = sqlx::query!(
|
||||
"
|
||||
SELECT COUNT(1) as count
|
||||
SELECT COUNT(1) as count
|
||||
FROM sounds
|
||||
WHERE uploader_id = ?
|
||||
",
|
||||
WHERE uploader_id = ?",
|
||||
user_id
|
||||
)
|
||||
.fetch_one(db_pool)
|
||||
@ -491,12 +478,11 @@ SELECT COUNT(1) as count
|
||||
|
||||
let c = sqlx::query!(
|
||||
"
|
||||
SELECT COUNT(1) as count
|
||||
SELECT COUNT(1) as count
|
||||
FROM sounds
|
||||
WHERE
|
||||
uploader_id = ? AND
|
||||
name = ?
|
||||
",
|
||||
name = ?",
|
||||
user_id,
|
||||
name
|
||||
)
|
||||
@ -513,12 +499,11 @@ SELECT COUNT(1) as count
|
||||
) -> Result<(), Box<dyn std::error::Error + Send + Sync>> {
|
||||
sqlx::query!(
|
||||
"
|
||||
UPDATE sounds
|
||||
SET
|
||||
UPDATE sounds
|
||||
SET
|
||||
public = ?
|
||||
WHERE
|
||||
id = ?
|
||||
",
|
||||
WHERE
|
||||
id = ?",
|
||||
self.public,
|
||||
self.id
|
||||
)
|
||||
@ -619,9 +604,8 @@ WHERE
|
||||
Some(data) => {
|
||||
match sqlx::query!(
|
||||
"
|
||||
INSERT INTO sounds (name, server_id, uploader_id, public, src)
|
||||
VALUES (?, ?, ?, 1, ?)
|
||||
",
|
||||
INSERT INTO sounds (name, server_id, uploader_id, public, src)
|
||||
VALUES (?, ?, ?, 1, ?)",
|
||||
name,
|
||||
server_id,
|
||||
user_id,
|
||||
|
Loading…
Reference in New Issue
Block a user