Discord bot help/Minecraft developer help

Status
This thread has been locked.

AfkClient

Banned
Feedback score
1
Posts
85
Reactions
4
Resources
0
Hi there!
I am looking for someone who can help me make my discord bot.
I want the bot to be able to run a command like /f top in minecraft and print the outcome in to a discord channel.
I already came as far as this:
1. Type the command in discord: .ftop
2. There should be a script that runs /f top in a console client
3. The outcome of that command should be send do a diffrent script
4. The bot takes the outcome out of that script
5. The bot prints the outcome in the discord channel

If you have any idea how to make this and if you know how to explain it to me then leave a message down here, or pm me!
If you can explain me how this works and how I can make it myself I am willing to pay for it.

-AfkClient
 
PebbleHost
High performance, consistent uptime and fast support. Minecraft hosting that just works.

Harry

Rustacean
Management
Feedback score
10
Posts
1,606
Reactions
876
Resources
0
I'll outline the basic principle here, but you can DM me on Discord for more information (replies might be a bit slow though).

If the factions plugin was custom, this would be relatively easy, but from the sounds of it, you're using a generic one.
You'll need to be able to communicate between the two instances (unless you host the Discord bot within the plugin - which I haven't tested, but don't see why it wouldn't be possible), so you'll need to set up TCP sockets securely, or another method of communication.

You'll then need to create a class that implements the CommandSender interface, like below:
Code:
public class CommandOutput implements CommandSender {
    private List<String> messages = new ArrayList<String>();
 
    public List<String> getMessages(){
        return getMessages();
    }
 
    //inherited
 
    @Override
    public PermissionAttachment addAttachment(Plugin arg0) {
        // TODO Auto-generated method stub
        return null;
    }

    @Override
    public PermissionAttachment addAttachment(Plugin arg0, int arg1) {
        // TODO Auto-generated method stub
        return null;
    }

    @Override
    public PermissionAttachment addAttachment(Plugin arg0, String arg1, boolean arg2) {
        // TODO Auto-generated method stub
        return null;
    }

    @Override
    public PermissionAttachment addAttachment(Plugin arg0, String arg1, boolean arg2, int arg3) {
        // TODO Auto-generated method stub
        return null;
    }

    @Override
    public Set<PermissionAttachmentInfo> getEffectivePermissions() {
        // TODO Auto-generated method stub
        return null;
    }

    @Override
    public boolean hasPermission(String arg0) {
        // TODO Auto-generated method stub
        return false;
    }

    @Override
    public boolean hasPermission(Permission arg0) {
        // TODO Auto-generated method stub
        return false;
    }

    @Override
    public boolean isPermissionSet(String arg0) {
        // TODO Auto-generated method stub
        return false;
    }

    @Override
    public boolean isPermissionSet(Permission arg0) {
        // TODO Auto-generated method stub
        return false;
    }

    @Override
    public void recalculatePermissions() {
        // TODO Auto-generated method stub
    
    }

    @Override
    public void removeAttachment(PermissionAttachment arg0) {
        // TODO Auto-generated method stub
    
    }

    @Override
    public boolean isOp() {
        // TODO Auto-generated method stub
        return false;
    }

    @Override
    public void setOp(boolean arg0) {
        // TODO Auto-generated method stub
    
    }

    @Override
    public String getName() {
        // TODO Auto-generated method stub
        return null;
    }

    @Override
    public Server getServer() {
        // TODO Auto-generated method stub
        return null;
    }

    @Override
    public void sendMessage(String arg0) {
        messages.add(arg0);
    }

    @Override
    public void sendMessage(String[] arg0) {
        messages.addAll(Arrays.asList(arg0));
    }

    @Override
    public Spigot spigot() {
        // TODO Auto-generated method stub
        return null;
    }
}

You should then be able to do this, but I haven't tested it.
Code:
CommandOutput output = new CommandOutput();
     
onCommand(output, getCommand("f"), "f", "top".split(" "));
System.out.println(output.getMessages().toString());
 
Last edited:

AfkClient

Banned
Feedback score
1
Posts
85
Reactions
4
Resources
0
Thanks! If anyone has any other idea or is willing to help me do it, please pm me!
 
Banned forever. Reason: Scamming (https://builtbybit.com/threads/afkclient-scam-report.466868/)
Status
This thread has been locked.
Top