late-submissions
Elnu 3 years ago
parent faf2a38400
commit 5b5f9c56f5

@ -1,15 +1,15 @@
use crate::utils::*;
use serde_json::Map;
use serenity::framework::standard::{macros::command, Args, CommandResult}; use serenity::framework::standard::{macros::command, Args, CommandResult};
use serenity::http::typing::Typing;
use serenity::model::prelude::*; use serenity::model::prelude::*;
use serenity::prelude::*; use serenity::prelude::*;
use serenity::http::typing::Typing; use slug::slugify;
use std::env; use std::env;
use std::fs; use std::fs;
use serde_json::Map;
use std::fs::File; use std::fs::File;
use std::io::Write; use std::io::Write;
use std::path::Path; use std::path::Path;
use slug::slugify;
use crate::utils::*;
#[command] #[command]
async fn challenge(ctx: &Context, msg: &Message) -> CommandResult { async fn challenge(ctx: &Context, msg: &Message) -> CommandResult {

@ -1,7 +1,7 @@
use crate::utils::*;
use serenity::framework::standard::{macros::command, Args, CommandResult}; use serenity::framework::standard::{macros::command, Args, CommandResult};
use serenity::model::prelude::*; use serenity::model::prelude::*;
use serenity::prelude::*; use serenity::prelude::*;
use crate::utils::*;
#[command] #[command]
async fn i(ctx: &Context, msg: &Message, args: Args) -> CommandResult { async fn i(ctx: &Context, msg: &Message, args: Args) -> CommandResult {

@ -1,7 +1,7 @@
use serenity::framework::standard::macros::hook;
use serenity::framework::standard::{macros::command, CommandResult}; use serenity::framework::standard::{macros::command, CommandResult};
use serenity::model::prelude::*; use serenity::model::prelude::*;
use serenity::prelude::*; use serenity::prelude::*;
use serenity::framework::standard::macros::hook;
use std::env; use std::env;

@ -1,16 +1,16 @@
use rand::seq::IteratorRandom;
use serde_json::Map;
use serde_json::Value;
use serenity::framework::standard::{Args, CommandResult}; use serenity::framework::standard::{Args, CommandResult};
use serenity::model::prelude::*; use serenity::model::prelude::*;
use serenity::prelude::*; use serenity::prelude::*;
use std::env;
use std::fs; use std::fs;
use serde_json::Map;
use serde_json::Value;
use std::fs::File; use std::fs::File;
use std::fs::OpenOptions; use std::fs::OpenOptions;
use std::io::Read; use std::io::Read;
use std::io::Write; use std::io::Write;
use std::process::Command; use std::process::Command;
use rand::seq::IteratorRandom;
use std::env;
pub fn get_challenge_number() -> i32 { pub fn get_challenge_number() -> i32 {
let challenge_dir = format!("{}/content/challenges", env::var("HUGO").unwrap()); let challenge_dir = format!("{}/content/challenges", env::var("HUGO").unwrap());
@ -107,7 +107,6 @@ pub fn rebuild_site() {
.expect("Failed to rebuild site"); .expect("Failed to rebuild site");
} }
pub fn get_guild_data_path() -> String { pub fn get_guild_data_path() -> String {
env::var("GUILD_DATA").unwrap() env::var("GUILD_DATA").unwrap()
} }
@ -148,7 +147,13 @@ pub fn set_guild_data(guild_data: Map<String, Value>) {
.unwrap(); .unwrap();
} }
pub async fn send(ctx: &Context, msg: &Message, message: &str, ping: bool, pin: bool) -> CommandResult { pub async fn send(
ctx: &Context,
msg: &Message,
message: &str,
ping: bool,
pin: bool,
) -> CommandResult {
let guild_data = get_guild_data(); let guild_data = get_guild_data();
let mut announcements_count = 0; let mut announcements_count = 0;
for (_guild, data) in guild_data.iter() { for (_guild, data) in guild_data.iter() {
@ -211,8 +216,12 @@ pub fn get_so_diagram(kanji: char) -> String {
) )
} }
pub async fn display_kanji(
pub async fn display_kanji(ctx: &Context, msg: &Message, kanji: char, comment: &str) -> CommandResult { ctx: &Context,
msg: &Message,
kanji: char,
comment: &str,
) -> CommandResult {
msg.reply(&ctx.http, format!("{}{}", kanji, comment)) msg.reply(&ctx.http, format!("{}{}", kanji, comment))
.await?; .await?;
let url = get_so_diagram(kanji); let url = get_so_diagram(kanji);

Loading…
Cancel
Save