Remove macros
This commit is contained in:
parent
130be477d0
commit
5ac371acb1
|
@ -1,4 +1,3 @@
|
|||
use crate::debugln;
|
||||
use serenity::{
|
||||
framework::standard::{
|
||||
macros::{command, group},
|
||||
|
@ -7,6 +6,7 @@ use serenity::{
|
|||
model::prelude::*,
|
||||
prelude::*,
|
||||
};
|
||||
use log::debug;
|
||||
use std::convert::TryFrom;
|
||||
|
||||
#[group]
|
||||
|
@ -26,7 +26,7 @@ pub async fn leave_guild(ctx: &Context, _msg: &Message, mut args: Args) -> Comma
|
|||
async fn send_message(ctx: &Context, _msg: &Message, mut args: Args) -> CommandResult {
|
||||
let channel_id = args.single::<ChannelId>()?;
|
||||
let message = args.single::<String>()?;
|
||||
debugln!("Send {} into {:?}", message, channel_id);
|
||||
debug!("Send {} into {:?}", message, channel_id);
|
||||
channel_id.say(ctx, message).await?;
|
||||
Ok(())
|
||||
}
|
||||
|
|
|
@ -1,8 +0,0 @@
|
|||
#[macro_export]
|
||||
macro_rules! debugln {
|
||||
($($arg:tt)*) => {
|
||||
if cfg!(debug_assertions) {
|
||||
log::debug!($($arg)*);
|
||||
}
|
||||
};
|
||||
}
|
13
src/main.rs
13
src/main.rs
|
@ -38,7 +38,6 @@ mod api;
|
|||
mod commands;
|
||||
mod config;
|
||||
mod data;
|
||||
mod macros;
|
||||
mod presence;
|
||||
|
||||
const PREFIX: &str = "?";
|
||||
|
@ -49,8 +48,8 @@ pub(crate) static mut INVITE_URL: Option<String> = None;
|
|||
#[tokio::main]
|
||||
async fn main() -> IoResult<()> {
|
||||
log4rs::init_file("log4rs.yaml", Default::default()).unwrap();
|
||||
let conf: config::Conf = toml::from_str(&std::fs::read_to_string("Conf.toml")?)?;
|
||||
debugln!("conf : {:?}", conf);
|
||||
let conf: config::Conf = toml::from_str(&fs::read_to_string("Conf.toml")?)?;
|
||||
debug!("conf : {:?}", conf);
|
||||
|
||||
let token = conf.bot.token;
|
||||
|
||||
|
@ -66,7 +65,7 @@ async fn main() -> IoResult<()> {
|
|||
}
|
||||
}
|
||||
|
||||
debugln!("Log attachments : {}", unsafe { LOG_ATTACHMENTS });
|
||||
debug!("Log attachments : {}", unsafe { LOG_ATTACHMENTS });
|
||||
|
||||
let dir = Path::new("logging");
|
||||
if !dir.exists() {
|
||||
|
@ -91,7 +90,7 @@ async fn main() -> IoResult<()> {
|
|||
Err(why) => panic!("Could not access application info: {:?}", why),
|
||||
};
|
||||
|
||||
debugln!("Owners : {:?}", owners);
|
||||
debug!("Owners : {:?}", owners);
|
||||
|
||||
let mut framework = StandardFramework::new()
|
||||
.configure(|c| {
|
||||
|
@ -262,7 +261,7 @@ impl EventHandler for Messages {
|
|||
}
|
||||
|
||||
async fn download_to_log(attachment: Attachment) -> commands::Result<()> {
|
||||
debugln!("Download_to_log : {:?}", attachment);
|
||||
debug!("Download_to_log : {:?}", attachment);
|
||||
let path = Path::new("logging").join(format!("{}-{}", attachment.id, attachment.filename));
|
||||
let content = reqwest::get(&attachment.url).await?.bytes().await?;
|
||||
let mut file = File::create(path).await?;
|
||||
|
@ -282,7 +281,7 @@ async fn normal_message(_ctx: &Context, msg: &Message) {
|
|||
|
||||
#[hook]
|
||||
async fn dispatch_error(ctx: &Context, msg: &Message, error: DispatchError) {
|
||||
debugln!("Dispatch error : {:?}", error);
|
||||
debug!("Dispatch error : {:?}", error);
|
||||
match error {
|
||||
DispatchError::Ratelimited(seconds) => {
|
||||
let _ = msg
|
||||
|
|
Loading…
Reference in New Issue