chore: removed empty whitespace lines
This commit is contained in:
parent
9e66b56721
commit
7efd98f1f3
5 changed files with 22 additions and 22 deletions
|
@ -51,7 +51,7 @@ pub async fn moove(http: Arc<Http>, msg: Message, m_channel_id: u64) -> anyhow::
|
||||||
.map(| embed | CreateEmbed::from(embed))
|
.map(| embed | CreateEmbed::from(embed))
|
||||||
.collect();
|
.collect();
|
||||||
|
|
||||||
|
|
||||||
let mut new_content = format!("Sent by {}\n mooved {}\n", msg_to_moove.author, msg.author);
|
let mut new_content = format!("Sent by {}\n mooved {}\n", msg_to_moove.author, msg.author);
|
||||||
let mut new_msg = CreateMessage::new();
|
let mut new_msg = CreateMessage::new();
|
||||||
|
|
||||||
|
@ -68,7 +68,7 @@ pub async fn moove(http: Arc<Http>, msg: Message, m_channel_id: u64) -> anyhow::
|
||||||
let embed = CreateEmbed::new()
|
let embed = CreateEmbed::new()
|
||||||
.field("MOO", new_content, false)
|
.field("MOO", new_content, false)
|
||||||
.field("Message:\n", msg_to_moove.content.clone(), false);
|
.field("Message:\n", msg_to_moove.content.clone(), false);
|
||||||
|
|
||||||
new_msg = new_msg.add_embed(embed);
|
new_msg = new_msg.add_embed(embed);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -16,32 +16,32 @@ pub async fn paginate_search_stations(
|
||||||
let ctx_id = ctx.id();
|
let ctx_id = ctx.id();
|
||||||
let prev_button_id = format!("{}prev", ctx_id);
|
let prev_button_id = format!("{}prev", ctx_id);
|
||||||
let next_button_id = format!("{}next", ctx_id);
|
let next_button_id = format!("{}next", ctx_id);
|
||||||
|
|
||||||
let search_builder = search_builder;
|
let search_builder = search_builder;
|
||||||
|
|
||||||
let Ok(stations) = search_builder.clone().send().await else {
|
let Ok(stations) = search_builder.clone().send().await else {
|
||||||
ctx.reply_ephemeral("Something went wrong, try searching again").await?;
|
ctx.reply_ephemeral("Something went wrong, try searching again").await?;
|
||||||
return Ok(())
|
return Ok(())
|
||||||
};
|
};
|
||||||
|
|
||||||
let mut page = 0;
|
let mut page = 0;
|
||||||
|
|
||||||
let embed = create_station_list_embed(&stations, page);
|
let embed = create_station_list_embed(&stations, page);
|
||||||
|
|
||||||
// Send the embed with the first page as content
|
// Send the embed with the first page as content
|
||||||
let reply = {
|
let reply = {
|
||||||
let components = CreateActionRow::Buttons(vec![
|
let components = CreateActionRow::Buttons(vec![
|
||||||
CreateButton::new(&prev_button_id).emoji('◀'),
|
CreateButton::new(&prev_button_id).emoji('◀'),
|
||||||
CreateButton::new(&next_button_id).emoji('▶'),
|
CreateButton::new(&next_button_id).emoji('▶'),
|
||||||
]);
|
]);
|
||||||
|
|
||||||
CreateReply::default()
|
CreateReply::default()
|
||||||
.embed(embed)
|
.embed(embed)
|
||||||
.components(vec![components])
|
.components(vec![components])
|
||||||
};
|
};
|
||||||
|
|
||||||
ctx.send(reply).await?;
|
ctx.send(reply).await?;
|
||||||
|
|
||||||
// Loop through incoming interactions with the navigation buttons
|
// Loop through incoming interactions with the navigation buttons
|
||||||
let mut offset = 0;
|
let mut offset = 0;
|
||||||
let limit_int = limit as u32;
|
let limit_int = limit as u32;
|
||||||
|
@ -73,16 +73,16 @@ pub async fn paginate_search_stations(
|
||||||
if stations.is_empty() {
|
if stations.is_empty() {
|
||||||
offset = 0;
|
offset = 0;
|
||||||
page = 0;
|
page = 0;
|
||||||
|
|
||||||
let Ok(new_stations) = search_builder.clone().offset(offset.to_string()).send().await else {
|
let Ok(new_stations) = search_builder.clone().offset(offset.to_string()).send().await else {
|
||||||
ctx.reply_ephemeral("Something went wrong, try searching again").await?;
|
ctx.reply_ephemeral("Something went wrong, try searching again").await?;
|
||||||
return Ok(())
|
return Ok(())
|
||||||
};
|
};
|
||||||
stations = new_stations;
|
stations = new_stations;
|
||||||
}
|
}
|
||||||
|
|
||||||
let embed = create_station_list_embed(&stations, page);
|
let embed = create_station_list_embed(&stations, page);
|
||||||
|
|
||||||
// Update the message with the new page contents
|
// Update the message with the new page contents
|
||||||
press
|
press
|
||||||
.create_response(
|
.create_response(
|
||||||
|
|
|
@ -15,7 +15,7 @@ pub async fn handle(ctx: Context, msg: Message) {
|
||||||
if msg.author.bot {
|
if msg.author.bot {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
let lower_case_content = msg.content.to_lowercase();
|
let lower_case_content = msg.content.to_lowercase();
|
||||||
|
|
||||||
let bot_id = ctx.cache.current_user().id;
|
let bot_id = ctx.cache.current_user().id;
|
||||||
|
@ -31,7 +31,7 @@ pub async fn handle(ctx: Context, msg: Message) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// X and IG not embedding correctly (IG fix does not work for now need to find different one)
|
// X and IG not embedding correctly (IG fix does not work for now need to find different one)
|
||||||
let link_fixes = HashMap::from([
|
let link_fixes = HashMap::from([
|
||||||
("//x.com", "//fixvx.com")
|
("//x.com", "//fixvx.com")
|
||||||
|
@ -96,7 +96,7 @@ async fn henlo(http: Arc<Http>, msg: Message) -> bool {
|
||||||
|
|
||||||
let emoji = EMOJIS.choose(&mut rand::rng()).unwrap_or(&"🐮");
|
let emoji = EMOJIS.choose(&mut rand::rng()).unwrap_or(&"🐮");
|
||||||
let response = format!("Henlooo {} {}", msg.author.name, emoji);
|
let response = format!("Henlooo {} {}", msg.author.name, emoji);
|
||||||
|
|
||||||
match msg.reply(http.clone(), response).await {
|
match msg.reply(http.clone(), response).await {
|
||||||
Ok(_) => { return true }
|
Ok(_) => { return true }
|
||||||
Err(e) => {
|
Err(e) => {
|
||||||
|
|
|
@ -26,13 +26,13 @@ pub async fn notice_wrapper(ctx: Context) {
|
||||||
|
|
||||||
/// Send embed with event name and optional special message to guild's general channel
|
/// Send embed with event name and optional special message to guild's general channel
|
||||||
async fn announce_event(guild_id: GuildId, name: &str, special_message: &str, http: Arc<Http>) -> anyhow::Result<()> {
|
async fn announce_event(guild_id: GuildId, name: &str, special_message: &str, http: Arc<Http>) -> anyhow::Result<()> {
|
||||||
|
|
||||||
let mut event_embed = CreateEmbed::new()
|
let mut event_embed = CreateEmbed::new()
|
||||||
.color(Colour::new(rand::random::<u32>() % 0xFFFFFF))
|
.color(Colour::new(rand::random::<u32>() % 0xFFFFFF))
|
||||||
.title("Today's event is:");
|
.title("Today's event is:");
|
||||||
|
|
||||||
let system_channel = utilities::get_system_channel(guild_id, &http).await?;
|
let system_channel = utilities::get_system_channel(guild_id, &http).await?;
|
||||||
|
|
||||||
if special_message.contains("http") {
|
if special_message.contains("http") {
|
||||||
event_embed = event_embed.description(name);
|
event_embed = event_embed.description(name);
|
||||||
system_channel.send_message(http.clone(),
|
system_channel.send_message(http.clone(),
|
||||||
|
|
|
@ -4,13 +4,13 @@ use serenity::http::Http;
|
||||||
|
|
||||||
pub async fn send_error(_http: Arc<Http>, msg: String) -> anyhow::Result<()> {
|
pub async fn send_error(_http: Arc<Http>, msg: String) -> anyhow::Result<()> {
|
||||||
println!("ERROR: {msg}");
|
println!("ERROR: {msg}");
|
||||||
|
|
||||||
#[cfg(feature="RELEASE")] {
|
#[cfg(feature="RELEASE")] {
|
||||||
use serenity::all::ChannelId;
|
use serenity::all::ChannelId;
|
||||||
use std::process::exit;
|
use std::process::exit;
|
||||||
use std::env;
|
use std::env;
|
||||||
use anyhow::Context;
|
use anyhow::Context;
|
||||||
|
|
||||||
let channel_id: String = env::var("DEBUG_CHANNEL_ID").context("DEBUG_CHANNEL_ID not found in env file")?;
|
let channel_id: String = env::var("DEBUG_CHANNEL_ID").context("DEBUG_CHANNEL_ID not found in env file")?;
|
||||||
match ChannelId::new(channel_id.parse::<u64>().unwrap())
|
match ChannelId::new(channel_id.parse::<u64>().unwrap())
|
||||||
.say(_http, msg).await {
|
.say(_http, msg).await {
|
||||||
|
@ -20,7 +20,7 @@ pub async fn send_error(_http: Arc<Http>, msg: String) -> anyhow::Result<()> {
|
||||||
}
|
}
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
||||||
#[cfg(feature="RELEASE")]
|
#[cfg(feature="RELEASE")]
|
||||||
pub async fn hello(http: Arc<Http>) -> anyhow::Result<()> {
|
pub async fn hello(http: Arc<Http>) -> anyhow::Result<()> {
|
||||||
use serenity::all::ChannelId;
|
use serenity::all::ChannelId;
|
||||||
|
@ -40,7 +40,7 @@ pub async fn hello(http: Arc<Http>) -> anyhow::Result<()> {
|
||||||
];
|
];
|
||||||
|
|
||||||
let message = messages.choose(&mut rand::rng()).unwrap_or(&"Chello").to_string();
|
let message = messages.choose(&mut rand::rng()).unwrap_or(&"Chello").to_string();
|
||||||
|
|
||||||
let channel_id: String = env::var("DEBUG_CHANNEL_ID").context("DEBUG_CHANNEL_ID not found in env file")?;
|
let channel_id: String = env::var("DEBUG_CHANNEL_ID").context("DEBUG_CHANNEL_ID not found in env file")?;
|
||||||
let channel = ChannelId::new(channel_id.parse::<u64>().unwrap());
|
let channel = ChannelId::new(channel_id.parse::<u64>().unwrap());
|
||||||
if let Err(why) = channel.say(http, message).await {
|
if let Err(why) = channel.say(http, message).await {
|
||||||
|
|
Loading…
Reference in a new issue