This commit is contained in:
Agatha Rose 2019-07-27 15:08:05 +03:00
parent 424fca4239
commit a9bd2e0860
1 changed files with 20 additions and 12 deletions

View File

@ -1,9 +1,8 @@
#[macro_use] #[macro_use]
extern crate serenity; extern crate serenity;
extern crate rand; extern crate rand;
extern crate urbandict;
//extern crate select;
extern crate sys_info; extern crate sys_info;
extern crate urbandict;
use rand::Rng; use rand::Rng;
use serenity::client::Client; use serenity::client::Client;
@ -18,14 +17,13 @@ impl EventHandler for Handler {
fn ready(&self, ctx: Context, ready: Ready) { fn ready(&self, ctx: Context, ready: Ready) {
if let Some(shard) = ready.shard { if let Some(shard) = ready.shard {
println!( println!(
"{} is connected on shard {}/{}!", "INFO: {} is connected on shard {}/{}!\n>>",
ready.user.name, shard[0], shard[1] ready.user.name, shard[0], shard[1]
); );
println!("--------------------------------------------");
use serenity::model::gateway::Game; use serenity::model::gateway::Game;
use serenity::model::user::OnlineStatus; use serenity::model::user::OnlineStatus;
let game = Game::playing("with knives"); let game = Game::playing("with lemons");
let status = OnlineStatus::Online; let status = OnlineStatus::Online;
ctx.set_presence(Some(game), status); ctx.set_presence(Some(game), status);
@ -39,7 +37,7 @@ fn main() {
.expect("Error creating client"); .expect("Error creating client");
client.with_framework( client.with_framework(
StandardFramework::new() StandardFramework::new()
.configure(|c| c.prefix("OwO ").case_insensitivity(true)) .configure(|c| c.prefix("OwO ").case_insensitivity(false))
.cmd("init", init) .cmd("init", init)
.cmd("gayculator", gayculator) .cmd("gayculator", gayculator)
.command("ad", |c| { .command("ad", |c| {
@ -60,12 +58,13 @@ fn main() {
.cmd("ship", ship) .cmd("ship", ship)
.cmd("uwu", uwu) .cmd("uwu", uwu)
.cmd("host", host) .cmd("host", host)
.cmd("headpat", headpat)
.cmd("what's this", what), .cmd("what's this", what),
); );
// start listening for events by starting a single shard // start listening for events by starting a single shard
if let Err(why) = client.start() { if let Err(e) = client.start() {
println!("An error occurred while running the client: {:?}", why); println!("An error occurred while running the client: {:?}", e);
} }
} }
@ -73,7 +72,7 @@ command!(init(_ctx, message) {
let num = rand::thread_rng().gen_range(0, 2); let num = rand::thread_rng().gen_range(0, 2);
match num { match num {
0 => { 0 => {
let _ = message.channel_id.say("The Discordinator9000 is ready to kick yer butts!"); let _ = message.channel_id.say("The Discordinator9000 is going sicko mode!");
} }
1 => { 1 => {
let _ = message.channel_id.say("The Discordinator9000 is ready to take over the world!"); let _ = message.channel_id.say("The Discordinator9000 is ready to take over the world!");
@ -158,6 +157,15 @@ use std::hash::{Hash, Hasher};
} }
}); });
command!(headpat(_ctx, message, args) {
message.channel_id.send_message(|m|
m.embed(|e|
e.title(format!("Sending headpats to {}...", args.trim().to_string()))
.image("https://i.pinimg.com/originals/83/1a/90/831a903eab6d827dcfd298b9e3196e30.jpg")
.description("Source: https://www.pinterest.com/pin/377809856242075277/"))
).expect("Failed to send message!");
});
command!(uwu(_ctx, message) { command!(uwu(_ctx, message) {
let num = rand::thread_rng().gen_range(0, 4); let num = rand::thread_rng().gen_range(0, 4);
match num { match num {
@ -249,7 +257,7 @@ command!(help(_ctx, message) {
("OwO what's this ``word``", "Find a definition of word", false), ("OwO what's this ``word``", "Find a definition of word", false),
("OwO ship ``name 1`` ``name 2``", "*shipping intensifies*", false), ("OwO ship ``name 1`` ``name 2``", "*shipping intensifies*", false),
("Admin commands:", "\u{200B}", true), ("Admin commands:", "\u{200B}", true),
("OwO halt", "shut me down", false), ("OwO halt", "kill me", false),
("OwO list_srv", "list my servers", false), ("OwO list_srv", "list my servers", false),
("OwO host", "Display host info", false) ("OwO host", "Display host info", false)
]) ])
@ -263,7 +271,7 @@ let num = CACHE.read().guilds.len();
let _ = message.channel_id.send_message(|m| m let _ = message.channel_id.send_message(|m| m
.embed(|e| e .embed(|e| e
.title("Discordinator9000's info:") .title("Discordinator9000's info:")
.description(":h_:") .description("h")
.field("Author:", "#9000", false) .field("Author:", "#9000", false)
.field("Server count:", num , false) .field("Server count:", num , false)
.field("Invite:", "[Invite link](https://discordapp.com/api/oauth2/authorize?client_id=470350233419907129&permissions=2048&scope=bot)", false ) .field("Invite:", "[Invite link](https://discordapp.com/api/oauth2/authorize?client_id=470350233419907129&permissions=2048&scope=bot)", false )
@ -282,7 +290,7 @@ let text: String = args.trim().parse()
} else if text.to_lowercase().contains("amit") { } else if text.to_lowercase().contains("amit") {
let _ = message.channel_id.say("Amiter is big dumb"); let _ = message.channel_id.say("Amiter is big dumb");
} else if text.to_lowercase().contains("discordinator") { } else if text.to_lowercase().contains("discordinator") {
let _ = message.channel_id.say("Metaaaa, dude"); let _ = message.channel_id.say("Option<(!, ())>");
} else { } else {
let _ = message.channel_id.say(format!("Me and {} are friends!", text)); let _ = message.channel_id.say(format!("Me and {} are friends!", text));
} }