up
This commit is contained in:
10
readme.md
10
readme.md
@@ -15,15 +15,19 @@ The available options are:
|
|||||||
- discordToken = the discord bot token (required)
|
- discordToken = the discord bot token (required)
|
||||||
- ip = Ip address of your mindustry server. Usually leave as localhost if running the bot on the same machine as the mindustry server (required)
|
- ip = Ip address of your mindustry server. Usually leave as localhost if running the bot on the same machine as the mindustry server (required)
|
||||||
- port = Port of the socket used by the mindustry server. It is set to the default port used by the mindustry server but you can check which port is in use by useing the "config socketInputPort" command in the server console (required)
|
- port = Port of the socket used by the mindustry server. It is set to the default port used by the mindustry server but you can check which port is in use by useing the "config socketInputPort" command in the server console (required)
|
||||||
- trigger = The single letter or character that will be used to call the bot (ex. ;command !command ?command mcommand) (optional)
|
- prefix = The word or character that will be used to call the bot (ex. ;command !command ?command MScommand) (optional)
|
||||||
- roles = Not currently implemented (optional)
|
- roles = unimplemented
|
||||||
|
|
||||||
## Commands
|
## Commands
|
||||||
; is currently the default bot prompt
|
; is currently the default bot prompt
|
||||||
|
|
||||||
- ;console (command to send to mindustry server console)
|
- ;console (command to send to mindustry server console)
|
||||||
|
|
||||||
(parenthesis not needed for console command)
|
- ;git (post git link)
|
||||||
|
|
||||||
|
- ;discord (post discord link)
|
||||||
|
|
||||||
|
(parenthesis not needed)
|
||||||
|
|
||||||
|
|
||||||
## Todo
|
## Todo
|
||||||
|
|||||||
34
src/main.rs
34
src/main.rs
@@ -9,6 +9,8 @@ use serenity::framework::standard::macros::{command, group, help, hook};
|
|||||||
use serenity::framework::standard::{StandardFramework, CommandResult, Args, HelpOptions, CommandGroup, help_commands};
|
use serenity::framework::standard::{StandardFramework, CommandResult, Args, HelpOptions, CommandGroup, help_commands};
|
||||||
use serenity::utils::Color;
|
use serenity::utils::Color;
|
||||||
use std::collections::HashSet;
|
use std::collections::HashSet;
|
||||||
|
use std::error::Error;
|
||||||
|
use std::io::Stderr;
|
||||||
use std::str::FromStr;
|
use std::str::FromStr;
|
||||||
|
|
||||||
#[group]
|
#[group]
|
||||||
@@ -115,19 +117,19 @@ async fn console(ctx: &Context, msg: &Message) -> CommandResult {
|
|||||||
let data = ctx.data.read().await;
|
let data = ctx.data.read().await;
|
||||||
|
|
||||||
let sock = data.get::<TcpSock>().unwrap();
|
let sock = data.get::<TcpSock>().unwrap();
|
||||||
let conf = data.get::<Config>().unwrap();
|
// let conf = data.get::<Config>().unwrap();
|
||||||
|
|
||||||
if !check_role(ctx, msg, conf).await {
|
// if !check_role(ctx, msg, conf).await.unwrap_or_else(|e| false) {
|
||||||
// msg.channel_id.say(ctx, "You do not have permission to use this command").await?;
|
// // msg.channel_id.say(ctx, "You do not have permission to use this command").await?;
|
||||||
msg.channel_id.send_message(ctx, |m| {
|
// msg.channel_id.send_message(ctx, |m| {
|
||||||
m.content("test")
|
// m.content("test")
|
||||||
.embed(|e| e
|
// .embed(|e| e
|
||||||
.title("No Permissions")
|
// .title("No Permissions")
|
||||||
.description("You do not have permission to use this command")
|
// .description("You do not have permission to use this command")
|
||||||
.color(Color::RED))
|
// .color(Color::RED))
|
||||||
}).await?;
|
// }).await?;
|
||||||
return Ok(());
|
// return Ok(());
|
||||||
}
|
// }
|
||||||
|
|
||||||
msg.reply(ctx, format!("```\n{}\n```", cons_rw(sock, &input.unwrap()))).await?;
|
msg.reply(ctx, format!("```\n{}\n```", cons_rw(sock, &input.unwrap()))).await?;
|
||||||
Ok(())
|
Ok(())
|
||||||
@@ -145,6 +147,8 @@ async fn discord(ctx: &Context, msg: &Message) -> CommandResult {
|
|||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
||||||
async fn check_role(ctx: &Context, msg: &Message, conf: &Config) -> bool {
|
// async fn check_role(ctx: &Context, msg: &Message, conf: &Config) -> Result<bool, SerenityError> {
|
||||||
msg.author.has_role(ctx, msg.guild_id.unwrap(), RoleId::from(u64::from_str(&conf.roles.cons).unwrap())).await.unwrap()
|
// let id = RoleId::from(u64::from_str(&conf.roles.cons))?;
|
||||||
}
|
// let check = msg.author.has_role(ctx, msg.guild_id.unwrap(), id).await?;
|
||||||
|
// Ok(check)
|
||||||
|
// }
|
||||||
Reference in New Issue
Block a user