npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

minecord

v0.0.25

Published

Connects Discord and Minecraft Servers without any mods or plugins.

Downloads

75

Readme

Minecord

Software License npm npm

Connects Minecraft Server and Discord without any mods or plugins.

Minecord

Installation

npm install -g minecord

Usage

In your Minecraft server.properties, make sure you have and restart the server.

enable-rcon=true
rcon.password=[minecraftRconPassword]
rcon.port=[minecraftRconPort]

Create a bot of Discord from here and get bot token.

Then let the created Bot participate in a specific channel from the OAuth 2 URL Generator.

Set up the config.json file.

{
  "pluginsDir": null,
  "enable": [
    "chat",
    "login",
    "death",
    "whitelist",
    "server"
  ],
  "disable": [],
  "minecraftLog": "/var/minecraft/logs/latest.log",
  "minecraftRconHost": "localhost",
  "minecraftRconPort": 25575,
  "minecraftRconPassword": "password",
  "discordBotToken": "bot_token",
  "discordChannel": "channel_id"
}

In order to acquire the channel ID, enable developer mode in your Discord client, then right click channel and select "Copy ID".

And run Minecord.

minecord --config /path/to/config.json

Alternatively, the setting can be given as an option.

minecord --help

  Usage: minecord [options]

  Options:

    -V, --version                         output the version number
    -c, --config <file>                   set configuration file
    -p, --plugins-dir <dir>               set local plugins directory
    --enable <plugins>                    enable plugin by name, "--enable PLUGIN1,PLUGIN2" for multiple plugins
    --disable <plugins>                   disable plugin by name, "--disable PLUGIN1,PLUGIN2" for multiple plugins
    --minecraft-log <path>                set the path to Minecraft log (It is recommended to specify them collectively in the configuration file)
    --minecraft-rcon-host <host>          set the Minecraft Server rcon host (It is recommended to specify them collectively in the configuration file)
    --minecraft-rcon-port <port>          set the Minecraft Server rcon port (It is recommended to specify them collectively in the configuration file)
    --minecraft-rcon-password <password>  set the Minecraft Server rcon password (It is recommended to specify them collectively in the configuration file)
    --discord-bot-token <token>           set Discord bot token (It is recommended to specify them collectively in the configuration file)
    --discord-channel <id>                set Discord channel ID for for the discord bot (It is recommended to specify them collectively in the configuration file)
    -h, --help                            output usage information

If you are an administrator of the channel of Discord, you can use it more conveniently by unifying Discord's nickname and Minecraft's username.

Plugins

By default, the following plugins are included.

  • chat : Sharing messages entered by users with Minecraft and Discord on their respective screens. (Default: enable)
  • login : Transfer login notification in Minecraft to Discord. (Default: disable)
  • death : Transfer the dead player notification in Minecraft to Discord. (Default: disable)
  • whitelist : Transfer whitelist operation notification in Minecraft to Discord. (Default: disable)
  • server : Transfer notification of start and stop of Minecraft server to Discord. (Default: disable)

How to make a plugin

To load the local plugin, please put the plugin in the directory specified by the --plugins-dir option and specify it in the configuration file.

When publishing the global plugin, please publish it as minecord-plugin-[PLUGIN].

export default Plugin => new Plugin({
  discord ({message, channel, user, sendToDiscord, sendToMinecraft}) {
    // Processing when receiving a message from Discord.
  },
  minecraft ({log, time, causedAt, level, message, channel, user, sendToDiscord, sendToMinecraft}) {
    // Processing when receiving a message from Minecraft.
  }
})

discord() method

It is executed when a message is received from the Discord channel.

Argument message is Message object of discord.js.

Argument channel is TextChannel object of discord.js.

Argument user is User object of discord.js.

Argument sendToDiscord is send function of discord.js.

Argument sendToMinecraft is send function of node-modern-rcon.

minecraft() method

It is executed when new Minecraft log is detected.

Argument log is one Minecraft log line.

Argument time, causedAt, level and message is the value obtained by parsing the Minecraft log.

For example, it becomes as follows.

[01:23:45] [Server thread/INFO]: player joined the game
export default Plugin => new Plugin({
  minecraft ({log, time, causedAt, level, message, channel, user, sendToDiscord, sendToMinecraft}) {
    console.log(log === '[01:23:45] [Server thread/INFO]: player joined the game')
    console.log(time === '01:23:45')
    console.log(causedAt === 'Server thread')
    console.log(level === 'INFO')
    console.log(message === 'player joined the game')
    // All true
  }
})

Argument channel is TextChannel object of discord.js.

Argument user is User object of discord.js.

Argument sendToDiscord is send function of discord.js.

Argument sendToMinecraft is send function of node-modern-rcon.

Author

@n0f

Follow

Contribution

I would be delighted if you rewrite README.md in native English!!

Of course, I would be delighted if you point out any problems or improvements related to the program.

Or, I would appreciate it if you increase the number of plugins included by default.

https://github.com/node-link/minecord/issues

Licence

MIT