renamed a function. removed name from guild
This commit is contained in:
parent
619678de36
commit
d57e1d3ab1
446
Cargo.lock
generated
446
Cargo.lock
generated
File diff suppressed because it is too large
Load Diff
@ -3,7 +3,6 @@ use sqlx::mysql::MySqlPool;
|
||||
|
||||
pub struct GuildData {
|
||||
pub id: u64,
|
||||
pub name: Option<String>,
|
||||
pub prefix: String,
|
||||
pub volume: u8,
|
||||
pub allow_greets: bool,
|
||||
@ -14,7 +13,7 @@ impl GuildData {
|
||||
let guild_data = sqlx::query_as_unchecked!(
|
||||
GuildData,
|
||||
"
|
||||
SELECT id, name, prefix, volume, allow_greets
|
||||
SELECT id, prefix, volume, allow_greets
|
||||
FROM servers
|
||||
WHERE id = ?
|
||||
",
|
||||
@ -64,7 +63,6 @@ INSERT IGNORE INTO roles (guild_id, role)
|
||||
|
||||
Ok(GuildData {
|
||||
id: *guild.id.as_u64(),
|
||||
name: Some(guild.name.clone()),
|
||||
prefix: String::from("?"),
|
||||
volume: 100,
|
||||
allow_greets: true,
|
||||
@ -79,14 +77,12 @@ INSERT IGNORE INTO roles (guild_id, role)
|
||||
"
|
||||
UPDATE servers
|
||||
SET
|
||||
name = ?,
|
||||
prefix = ?,
|
||||
volume = ?,
|
||||
allow_greets = ?
|
||||
WHERE
|
||||
id = ?
|
||||
",
|
||||
self.name,
|
||||
self.prefix,
|
||||
self.volume,
|
||||
self.allow_greets,
|
||||
|
10
src/main.rs
10
src/main.rs
@ -457,15 +457,7 @@ async fn main() -> Result<(), Box<dyn std::error::Error + Send + Sync>> {
|
||||
};
|
||||
|
||||
match GuildData::get_from_id(guild.clone(), pool.clone()).await {
|
||||
Some(mut guild_data) => {
|
||||
let name = Some(guild.name);
|
||||
|
||||
if guild_data.name != name {
|
||||
guild_data.name = name;
|
||||
guild_data.commit(pool).await.unwrap();
|
||||
}
|
||||
Some(guild_data.prefix)
|
||||
}
|
||||
Some(guild_data) => Some(guild_data.prefix),
|
||||
|
||||
None => {
|
||||
GuildData::create_from_guild(guild, pool).await.unwrap();
|
||||
|
@ -111,7 +111,7 @@ SELECT name, id, plays, public, server_id, uploader_id
|
||||
}
|
||||
}
|
||||
|
||||
async fn get_self_src(&self, db_pool: MySqlPool) -> Vec<u8> {
|
||||
async fn src(&self, db_pool: MySqlPool) -> Vec<u8> {
|
||||
struct Src {
|
||||
src: Vec<u8>,
|
||||
}
|
||||
@ -145,7 +145,7 @@ SELECT src
|
||||
if !path.exists() {
|
||||
let mut file = File::create(&path).await?;
|
||||
|
||||
file.write_all(&self.get_self_src(db_pool).await).await?;
|
||||
file.write_all(&self.src(db_pool).await).await?;
|
||||
}
|
||||
|
||||
Ok(ffmpeg(path_name).await.expect("FFMPEG ERROR!"))
|
||||
|
Loading…
Reference in New Issue
Block a user