FactoCord (Factorio to Discord bridge bot) Template



  • Hi guys, I have been looking into a way of getting Factorio to communicate between discord and vice versa and came across FactoCord https://github.com/FactoKit/FactoCord

    So... I decided to modify the existing Factorio template to include and run Factorio from FactoCord

    I have tested it and it is all working

    {
      "pufferd": {
        "type": "factocord",
        "display": "FactoCord",
        "install": {
          "commands": [
            {
              "type": "writefile",
              "text": "\n DiscordToken = \"${discordtoken}\"\n FactorioChannelID = \"${factoriochannelid}\"\n LaunchParameters = \"--port ${port} --bind ${ip} --start-server ${saves} --server-settings ${serversettings}\"\n Executable = \"${executable}\"\n AdminIDs = \"${adminids}\"\n Prefix = \"${prefix}\"\n ModListLocation = \"${modslist}\"",
              "target": ".env"
            },
    	{
              "commands": [
                "curl -L -o factorio.tar.xz https://www.factorio.com/get-download/latest/headless/linux64",
                "mkdir factorio",
                "tar --no-same-owner -xvf factorio.tar.xz",
                "cp factorio/data/server-settings.example.json factorio/data/server-settings.json",
                "./factorio/bin/x64/factorio --create saves/default.zip",
                "curl -L -o FactoCord-1.3.tar.gz https://github.com/FactoKit/FactoCord/releases/download/1.3/FactoCord-1.3.tar.gz",
                "tar -xvf FactoCord-1.3.tar.gz" 
                ],
              "type": "command"
            }
          ]
        },
        "run": {
          "stop": "/quit",
          "pre": [],
          "post": [],
          "arguments": [],
          "program": "./FactoCord"
        },
        "environment": {
          "type": "tty"
        },
        "data": {
    	    "discordtoken": {
    			"value": "",
    			"required": true,
    			"desc": "Discord Bot Token",
    			"display": "Discord Bot Token",
    			"internal": false
    		},
    		"factoriochannelid": {
    			"value": "",
    			"required": true,
    			"desc": "Discord Factorio channel ID",
    			"display": "Discord Factorio channel ID",
    			"internal": false
    		},
    		"port": {
    			"value": "34197",
    			"required": true,
    			"desc": "Factorio Server Port",
    			"display": "Server Port",
    			"internal": false
    		},
    		"ip": {
    			"value": "0.0.0.0",
    			"required": true,
    			"desc": "Server IP Address",
    			"display": "IP Address",
    			"internal": false
    		},
    		"saves": {
    			"value": "saves/default.zip",
    			"required": true,
    			"desc": "Factorio Save location",
    			"display": "Factorio Save location",
    			"internal": false
    		},
    		"serversettings": {
    			"value": "factorio/data/server-settings.json",
    			"required": true,
    			"desc": "Server Settings location",
    			"display": "Server Settings location",
    			"internal": false
    		},
    		"executable": {
    			"value": "factorio/bin/x64/factorio",
    			"required": true,
    			"desc": "Server executable location",
    			"display": "Server executable location",
    			"internal": false
    		},
    		"adminids": {
    			"value": "",
    			"required": false,
    			"desc": "Discord bot Admin IDs (Separate with comma)",
    			"display": "Server Admin IDs",
    			"internal": false
    		},
    		"prefix": {
    			"value": "$",
    			"required": true,
    			"desc": "Bot command prefix",
    			"display": "Bot command prefix",
    			"internal": false
    		},
    		"modslist": {
    			"value": "factorio/mods/mod-list.json",
    			"required": true,
    			"desc": "Factorio Mods location",
    			"display": "Factorio Mods location",
    			"internal": false
    		}
        }
      }
    }
    

 

2
Online

830
Users

846
Topics

3.6k
Posts