Skip to content

Commit

Permalink
Merge Dev branch into Main (#5)
Browse files Browse the repository at this point in the history
* Fix discord.userroles missing from default config

* Update user build scripts

* Update Readme.md

* Start cleaning up the lua scripts

* Fix os.exit when generated a default config

* Generate a default config on build

* Merge builds into a single yml

* Update Actions

* Remove legacy Discord method

* Update Readme and add methods.md

* Fix IRC Method Typo

* Fix lua script typo's and fix some spacing.

* Add an enableInteractiveConsole for running goTES3MP headless

* Update and tidy up the tes3mp scripts

* Add Migration code to newer config layout (Untested)

* Actually run the Migration on OnServerInit

* Fix missing checks for IrcBridge.SendSystemMessage

* Add update checking

* Dependency updates

* Add VPN Api checks and warning if none are set but vpnChecker is enabled

* Remove DataManager Requirement

* Fix missing Sync Method send to tes3mp

* Add ready event to Discord.go

* Fix and overhaul of scripting after removing DataManager

* Implement sendDiscordMessage

* [Spelling Fix] responce - > response

* Update Readme

* Add build status and discord link

* Add missing staffRole back in

* Add Features - Mention and Channel Link conversion for Discord Relay (#4)

* Added functionality to convert mentions

---------

Co-authored-by: Shigbeard <[email protected]>
  • Loading branch information
HotaruBlaze and Shigbeard committed May 24, 2023
1 parent 06e2831 commit e781516
Show file tree
Hide file tree
Showing 30 changed files with 818 additions and 466 deletions.
22 changes: 13 additions & 9 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ name: Build

on:
release:
types: [released]
types: [published]

env:
IMAGE_REGISTRY: ghcr.io
Expand All @@ -14,30 +14,34 @@ jobs:
name: Build Linux
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3
- name: Set up Go 1.x
uses: actions/setup-go@v2
uses: actions/setup-go@v3
with:
go-version: ^1.20
stable: true
id: linux-build
- name: Build-Linux
run: go build -ldflags="-X 'main.Build=${{ github.event.release.tag_name }}' -X 'main.GitCommit=$GITHUB_SHA'" -o build/goTES3MP-Linux src/*.go
- name: Generate default config
run: cd build/ &&chmod +x goTES3MP-Linux && ./goTES3MP-Linux

- name: GH Release
uses: softprops/[email protected]
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
files: build/goTES3MP-Linux
files: |
build/goTES3MP-Linux
build/config.yaml
build-windows:
name: Build Windows
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3
- name: Set up Go 1.x
uses: actions/setup-go@v2
uses: actions/setup-go@v3
with:
go-version: ^1.20
stable: true
Expand All @@ -56,10 +60,10 @@ jobs:
name: Add Scripts
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3

- name: Compress scripts
uses: papeloto/action-zip@v1
uses: papeloto/action-zip@v1.1
with:
files: tes3mp/
dest: build/tes3mp-scripts.zip
Expand All @@ -78,7 +82,7 @@ jobs:
env:
DOCKER_CONFIG: $HOME/.docker
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3

- name: Set up Docker Buildx
id: buildx
Expand Down
70 changes: 0 additions & 70 deletions .github/workflows/prerelease-build.yml

This file was deleted.

39 changes: 27 additions & 12 deletions Readme.md
Original file line number Diff line number Diff line change
@@ -1,22 +1,30 @@
# goTES3MP for TES3MP
### Note:
This was an attempt at having an aditional layer ontop of tes3mp, however this proved to be unreliable. So this was replaced with a client-server model, that allows you to move more advanced logic to golang, And by default serves as a replacement for [TES3MP_DiscordRelay](https://github.com/HotaruBlaze/TES3MP_DiscordRelay)
[![Main](https://github.com/HotaruBlaze/goTES3MP/actions/workflows/build.yml/badge.svg)](https://github.com/HotaruBlaze/goTES3MP/actions/workflows/build.yml)
[![](https://dcbadge.vercel.app/api/server/66KTvnwFUC?style=flat-square)](https://discord.gg/66KTvnwFUC)

# Known Issues
<!-- * TES3MP does not shutdown correctly most of the time with SIGINT, or closing the application, It's recommended to use another script for this, such as [ShutdownServer](https://github.com/tes3mp-scripts/ShutdownServer). -->
<!-- * Sometimes goTES3MP loses connection to Discord, this usually fixes itself after a couple of minutes, if not try running the "reloaddiscord" command. -->
* Mentioning Channel names and emotes will be glitched/formatted incorrectly, This is known and a fix is being looked for.

# Goal
- [x] Recreate [TES3MP_DiscordRelay](https://github.com/HotaruBlaze/TES3MP_DiscordRelay) with bug fixes and Discord role support.
- [X] Added a web endpoint for accessing server status, such as current player count and players.
- [X] Show CurrentPlayers/MaxPlayers as Discord bot status.

An golang Client/Server appliaction for TES3MP utilizing golang and IRC for server communication and features such as a Discord-Chat bridge, anti-VPN protection and more.

The previous depricated version of this is: [TES3MP_DiscordRelay](https://github.com/HotaruBlaze/TES3MP_DiscordRelay)

# Features
- Discord-Chatbridge to/from TES3MP and Discord
- Anti-VPN protection, using publicly available apis
- Ability to do remote TES3MP commands from Discord.
# Worthwhile Notes
* TES3MP does not shutdown correctly most of the time with SIGINT, or closing the application, It's recommended to use another script for this, such as [ShutdownServer](https://github.com/tes3mp-scripts/ShutdownServer).

* Sometimes goTES3MP fails to connect to Discord, this usually fixes itself after a couple of minutes, if not try running the "reloaddiscord" command on goTES3MP.

# Requirements
- An IRC Server, I recommend my personal fork of [oragono](https://github.com/oragono/oragono) found [here](https://github.com/HotaruBlaze/oragono-tes3mp)
- [Datamanager](https://github.com/tes3mp-scripts/DataManager) for TES3MP
- Golang version >= 1.20
- An IRC Server, I recommend my personal fork of [ergo](https://github.com/ergochat/ergo) found [here](https://github.com/HotaruBlaze/ergo-tes3mp)
- *[cjson](https://github.com/TES3MP/lua-cjson) (Included in tes3mp-scripts.zip)

# Methods Documentation found [Here](docs/methods.md)


# Install Instructions - Standalone
1. Download the latest build with accompanying tes3mp-scripts.zip
2. Extract and copy the custom and lib folders to `server` folder.
Expand Down Expand Up @@ -58,4 +66,11 @@ networks:
relay-net:
volumes:
irc_data:
```
# Build Instructions - Linux (assumes Ubuntu/Debian)
```
sudo apt install golang-go git
git clone https://github.com/HotaruBlaze/goTES3MP
cd goTES3MP
./scripts/build.sh
```
74 changes: 74 additions & 0 deletions docs/methods.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
# GoTES3MP Methods

### Note: syncid is not used however it hasnt been fully removed from the source code and still has to be included in some places, however can be a blank string.

# "Sync" Method: [Link](../tes3mp/scripts/custom/goTES3MP\sync.lua)
```lua
local messageJson = {
ServerID = ServerID,
method = "Sync",
source = "TES3MP",
data = {
MaxPlayers = tostring(tes3mp.GetMaxPlayers()),
CurrentPlayerCount = tostring(logicHandler.GetConnectedPlayerCount()),
Forced = tostring(forceResync),
Status = "Ping",
}
}
```
The Sync method is very importent to goTES3MP, this is designed to make sure the communications are working correctly, aswell as keeping the player count updated.

You may also threat this as a Ping/Pong system, as goTES3MP will respond with a pong if it reads and is able to process what it received.

The **Forced** variable is used with the command `/forceSync` and will force goTES3MP to accept the data thats being sent with it, this is useful if your ServerID has changed or you restarted/updated goTES3MP, however this is usually not needed and will be handled automatically.

# "IRC" Method:
This script used to support using IRC to **<u>Chat with Discord and tes3mp</u>**. However when this was rewritten with a more refined system, this method was never reimplemented, It's been left in as it may be reimplemented in the future.

# "rawDiscord" Method:
```lua
local messageJson =
method = "rawDiscord",
source = "TES3MP",
serverid = goTES3MP.GetServerID(),
syncid = GoTES3MPSyncID,
data = {
channel = discordChannel,
server = discordServer,
message = "**" .. "[TES3MP] " .. tes3mp.GetName(pid) .. " has connected" .. "**"
}
```
This method is the main one you will be using for tes3mp->discord, as this method is very flexible with its use.

channel: The desired discord channel you want the bot to send the message to.
server: The desired discord server you want the bot to use.

message: This is what you want the bot to send to discord as a message. Note that this also supports multilined inputs and any discord formatting tips. This should also work with emotes however they can be a little buggy, so it's **<u>recommended that you use Discord emoticons and not default unicode, such as smiley faces</u>**


# "VPNCheck" Method: [Link](../tes3mp/scripts/custom/goTES3MP/VPNChecker.lua)
```lua
local messageJson = {
method = "VPNCheck",
source = "TES3MP",
serverid = goTES3MP.GetServerID(),
syncid = GoTES3MPSyncID,
data = {
channel = discordChannel,
server = discordServer,
message = IP,
playerpid = tostring(pid)
}
}
```
Now, this method is quite simple, all this method does is send goTES3MP the players PID and IP to goTES3MP with a VPNCheck method.

goTES3MP will then check that against multiple sources to see how trustworthy an ip is. Using the following websites:<br>
https://iphub.info<br>
https://ipqualityscore.com

You may find the related goTES3MP code [here](../src/vpnChecker.go), However theirs not much to read, it will just show you the api responses and how the bot is building/handling it.

Note that currently, if you wish to use Anti-VPN you should use both services, as iphub can miss some ip's that ipqualityscore will catch.

If an IP is deamed to be an VPN or seemingly bad, such as a proxy, it will send a VPNCheck method back to tes3mp, with a modified data packet, telling it to kick that pid. You can find this [Here](../tes3mp/scripts/custom/IrcBridge/IrcBridge.lua#L107-L130)
13 changes: 8 additions & 5 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,17 @@ require (
github.com/bwmarrin/discordgo v0.27.1
github.com/fatih/color v1.15.0
github.com/fsnotify/fsnotify v1.6.0
github.com/google/go-github v17.0.0+incompatible
github.com/hashicorp/go-version v1.6.0
github.com/sirupsen/logrus v1.9.0
github.com/spf13/viper v1.15.0
github.com/thoj/go-ircevent v0.0.0-20210723090443-73e444401d64
github.com/tidwall/pretty v1.2.1
golang.org/x/exp v0.0.0-20230321023759-10a507213a29
golang.org/x/exp v0.0.0-20230510235704-dd950f8aeaea
)

require (
github.com/google/go-querystring v1.1.0 // indirect
github.com/gorilla/websocket v1.5.0 // indirect
github.com/hashicorp/hcl v1.0.0 // indirect
github.com/magiconair/properties v1.8.7 // indirect
Expand All @@ -26,10 +29,10 @@ require (
github.com/spf13/jwalterweatherman v1.1.0 // indirect
github.com/spf13/pflag v1.0.5 // indirect
github.com/subosito/gotenv v1.4.2 // indirect
golang.org/x/crypto v0.7.0 // indirect
golang.org/x/net v0.8.0 // indirect
golang.org/x/sys v0.6.0 // indirect
golang.org/x/text v0.8.0 // indirect
golang.org/x/crypto v0.9.0 // indirect
golang.org/x/net v0.10.0 // indirect
golang.org/x/sys v0.8.0 // indirect
golang.org/x/text v0.9.0 // indirect
gopkg.in/ini.v1 v1.67.0 // indirect
gopkg.in/yaml.v3 v3.0.1 // indirect
)
25 changes: 16 additions & 9 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,10 @@ github.com/google/go-cmp v0.5.1/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/
github.com/google/go-cmp v0.5.2/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE=
github.com/google/go-cmp v0.5.4/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE=
github.com/google/go-cmp v0.5.9 h1:O2Tfq5qg4qc4AmwVlvv0oLiVAGB7enBSJ2x2DqQFi38=
github.com/google/go-github v17.0.0+incompatible h1:N0LgJ1j65A7kfXrZnUDaYCs/Sf4rEjNlfyDHW9dolSY=
github.com/google/go-github v17.0.0+incompatible/go.mod h1:zLgOLi98H3fifZn+44m+umXrS52loVEgC2AApnigrVQ=
github.com/google/go-querystring v1.1.0 h1:AnCroh3fv4ZBgVIf1Iwtovgjaw/GiKJo8M8yD/fhyJ8=
github.com/google/go-querystring v1.1.0/go.mod h1:Kcdr2DB4koayq7X8pmAG4sNG59So17icRSOU623lUBU=
github.com/google/martian v2.1.0+incompatible/go.mod h1:9I4somxYTbIHy5NJKHRl3wXiIaQGbYVAs8BPL6v8lEs=
github.com/google/martian/v3 v3.0.0/go.mod h1:y5Zk1BBys9G+gd6Jrk0W3cC1+ELVxBWuIGO+w/tUAp0=
github.com/google/martian/v3 v3.1.0/go.mod h1:y5Zk1BBys9G+gd6Jrk0W3cC1+ELVxBWuIGO+w/tUAp0=
Expand All @@ -123,6 +127,8 @@ github.com/googleapis/google-cloud-go-testing v0.0.0-20200911160855-bcd43fbb19e8
github.com/gorilla/websocket v1.4.2/go.mod h1:YR8l580nyteQvAITg2hZ9XVh4b55+EU/adAjf1fMHhE=
github.com/gorilla/websocket v1.5.0 h1:PPwGk2jz7EePpoHN/+ClbZu8SPxiqlu12wZP/3sWmnc=
github.com/gorilla/websocket v1.5.0/go.mod h1:YR8l580nyteQvAITg2hZ9XVh4b55+EU/adAjf1fMHhE=
github.com/hashicorp/go-version v1.6.0 h1:feTTfFNnjP967rlCxM/I9g701jU+RN74YKx2mOkIeek=
github.com/hashicorp/go-version v1.6.0/go.mod h1:fltr4n8CU8Ke44wwGCBoEymUuxUHl09ZGVZPK5anwXA=
github.com/hashicorp/golang-lru v0.5.0/go.mod h1:/m3WP610KZHVQ1SGc6re/UDhFvYD7pJ4Ao+sR/qLZy8=
github.com/hashicorp/golang-lru v0.5.1/go.mod h1:/m3WP610KZHVQ1SGc6re/UDhFvYD7pJ4Ao+sR/qLZy8=
github.com/hashicorp/hcl v1.0.0 h1:0Anlzjpi4vEasTeNFn2mLJgTSwt0+6sfsiTG8qcWGx4=
Expand Down Expand Up @@ -202,8 +208,8 @@ golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8U
golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto=
golang.org/x/crypto v0.0.0-20210421170649-83a5a9bb288b/go.mod h1:T9bdIzuCu7OtxOm1hfPfRQxPLYneinmdGuTeoZ9dtd4=
golang.org/x/crypto v0.0.0-20220722155217-630584e8d5aa/go.mod h1:IxCIyHEi3zRg3s0A5j5BB6A9Jmi73HwBIUl50j+osU4=
golang.org/x/crypto v0.7.0 h1:AvwMYaRytfdeVt3u6mLaxYtErKYjxA2OXjJ1HHq6t3A=
golang.org/x/crypto v0.7.0/go.mod h1:pYwdfH91IfpZVANVyUOhSIPZaFoJGxTFbZhFTx+dXZU=
golang.org/x/crypto v0.9.0 h1:LF6fAI+IutBocDJ2OT0Q1g8plpYljMZ4+lty+dsqw3g=
golang.org/x/crypto v0.9.0/go.mod h1:yrmDGqONDYtNj3tH8X9dzUun2m2lzPa9ngI6/RUPGR0=
golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA=
golang.org/x/exp v0.0.0-20190306152737-a1d7652674e8/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA=
golang.org/x/exp v0.0.0-20190510132918-efd6b22b2522/go.mod h1:ZjyILWgesfNpC6sMxTJOJm9Kp84zZh5NQWvqDGG3Qr8=
Expand All @@ -214,8 +220,8 @@ golang.org/x/exp v0.0.0-20191227195350-da58074b4299/go.mod h1:2RIsYlXP63K8oxa1u0
golang.org/x/exp v0.0.0-20200119233911-0405dc783f0a/go.mod h1:2RIsYlXP63K8oxa1u096TMicItID8zy7Y6sNkU49FU4=
golang.org/x/exp v0.0.0-20200207192155-f17229e696bd/go.mod h1:J/WKrq2StrnmMY6+EHIKF9dgMWnmCNThgcyBT1FY9mM=
golang.org/x/exp v0.0.0-20200224162631-6cc2880d07d6/go.mod h1:3jZMyOhIsHpP37uCMkUooju7aAi5cS1Q23tOzKc+0MU=
golang.org/x/exp v0.0.0-20230321023759-10a507213a29 h1:ooxPy7fPvB4kwsA2h+iBNHkAbp/4JxTSwCmvdjEYmug=
golang.org/x/exp v0.0.0-20230321023759-10a507213a29/go.mod h1:CxIveKay+FTh1D0yPZemJVgC/95VzuuOLq5Qi4xnoYc=
golang.org/x/exp v0.0.0-20230510235704-dd950f8aeaea h1:vLCWI/yYrdEHyN2JzIzPO3aaQJHQdp89IZBA/+azVC4=
golang.org/x/exp v0.0.0-20230510235704-dd950f8aeaea/go.mod h1:V1LtkGg67GoY2N1AnLN78QLrzxkLyJw7RJb1gzOOz9w=
golang.org/x/image v0.0.0-20190227222117-0694c2d4d067/go.mod h1:kZ7UVZpmo3dzQBMxlp+ypCbDeSB+sBbTgSJuh5dn5js=
golang.org/x/image v0.0.0-20190802002840-cff245a6509b/go.mod h1:FeLwcggjj3mMvU+oOTbSwawSJRM1uh48EjtB4UJZlP0=
golang.org/x/lint v0.0.0-20181026193005-c67002cb31c3/go.mod h1:UVdnD1Gm6xHRNCYTkRU2/jEulfH38KcIWyp/GAMgvoE=
Expand Down Expand Up @@ -272,8 +278,8 @@ golang.org/x/net v0.0.0-20201224014010-6772e930b67b/go.mod h1:m0MpNAwzfU5UDzcl9v
golang.org/x/net v0.0.0-20210226172049-e18ecbb05110/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg=
golang.org/x/net v0.0.0-20210614182718-04defd469f4e/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y=
golang.org/x/net v0.0.0-20211112202133-69e39bad7dc2/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y=
golang.org/x/net v0.8.0 h1:Zrh2ngAOFYneWTAIAPethzeaQLuHwhuBkuV6ZiRnUaQ=
golang.org/x/net v0.8.0/go.mod h1:QVkue5JL9kW//ek3r6jTKnTFis1tRmNAW2P1shuFdJc=
golang.org/x/net v0.10.0 h1:X2//UzNDwYmtCLn7To6G58Wr6f5ahEAQgKNzv9Y951M=
golang.org/x/net v0.10.0/go.mod h1:0qNGK6F8kojg2nk9dLZ2mShWaEBan6FAoqfSigmmuDg=
golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U=
golang.org/x/oauth2 v0.0.0-20190226205417-e64efc72b421/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw=
golang.org/x/oauth2 v0.0.0-20190604053449-0f29369cfe45/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw=
Expand Down Expand Up @@ -331,8 +337,9 @@ golang.org/x/sys v0.0.0-20210615035016-665e8c7367d1/go.mod h1:oPkhp1MJrh7nUepCBc
golang.org/x/sys v0.0.0-20220715151400-c0bba94af5f8/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.0.0-20220811171246-fbc7d0a398ab/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.0.0-20220908164124-27713097b956/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.6.0 h1:MVltZSvRTcU2ljQOhs94SXPftV6DCNnZViHeQps87pQ=
golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.8.0 h1:EBmGv8NaZBZTWvrbjNoL6HVt+IVy3QDQpJs7VRIw3tU=
golang.org/x/sys v0.8.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo=
golang.org/x/text v0.0.0-20170915032832-14c0d48ead0c/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
Expand All @@ -342,8 +349,8 @@ golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
golang.org/x/text v0.3.4/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
golang.org/x/text v0.3.6/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ=
golang.org/x/text v0.8.0 h1:57P1ETyNKtuIjB4SRd15iJxuhj8Gc416Y78H3qgMh68=
golang.org/x/text v0.8.0/go.mod h1:e1OnstbJyHTd6l/uOt8jFFHp6TRDWZR/bV3emEE/zU8=
golang.org/x/text v0.9.0 h1:2sjJmO8cDvYveuX97RDLsxlyUxLl+GHoLxBiRdHllBE=
golang.org/x/text v0.9.0/go.mod h1:e1OnstbJyHTd6l/uOt8jFFHp6TRDWZR/bV3emEE/zU8=
golang.org/x/time v0.0.0-20181108054448-85acf8d2951c/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ=
golang.org/x/time v0.0.0-20190308202827-9d24e82272b4/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ=
golang.org/x/time v0.0.0-20191024005414-555d28b269f0/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ=
Expand Down
13 changes: 13 additions & 0 deletions scripts/build-windows.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# Commit hash
$commitHash = (git rev-parse HEAD)

# Path Resolving
$goFiles = Get-ChildItem -Path 'src\' -Name '*.go' -File
$goFiles = $goFiles | ForEach-Object {"src/$_"}

# Build variables for go build
Set-Variable GOOS=windows
Set-Variable GOARCH=amd64

# Build command
go build -ldflags="-X 'main.Build=v0.0.0-Dev' -X 'main.GitCommit=$commitHash'" -o build/goTES3MP-Windows.exe $goFiles
Loading

0 comments on commit e781516

Please sign in to comment.