diff --git a/README.md b/README.md
index 3ae3442..dd99c9d 100644
--- a/README.md
+++ b/README.md
@@ -1,38 +1,44 @@
-# discordeq
+# DiscordEQ
This plugin allows Everquest to communicate with Discord in a bidirectional manner.
-##How to install
-
-### Note for previous versions
-* If you were running a previous version of DiscordEQ, you can now remove the quest file that I had you create, it is no longer needed!
-
-###Set up eqemu_config.xml
-* Add to eqemu_config.xml these lines:
-```xml
-
-
- YourDiscordUsername
- YourDiscordPassword
- YourTelnetAccountLSNAme
- YourTelnetPassword
- ServerIDFromDiscord
- ChannelIDFromDiscord
- 5
- http://yourallaclone.com/alla/?a=item&id=
-
+##How to Configure
+
+###Edit eqemu_config
+* Add to eqemu_config.json these lines under the server {} section:
+```json
+ "discord" : {
+ "channelid" : "{CHANNELID}",
+ "itemurl" : "{ITEMURL}",
+ "refreshrate" : "15",
+ "clientid": "{CLIENTID}",
+ "serverid" : "{SERVERID}",
+ "username" : "{YOURTOKEN}",
+ "commandchannelid": "{YOURCOMMANDCHANNELID}"
+ },
```
+* each section above with {WORD} sections will be populated with data as you follow below steps.
+
+###Prepare App/Bot in Discord
+* Go to https://discordapp.com/developers/
+* Click My Apps on the top left area.
+* Click + New App
+* Write anything you wish for the app name, click Create App
+* Copy the clientid into your discord into the {CHANNELID} field in eqemu_config
+* Scroll down to the bot section, and click Create Bot User
+* Confirm with Yes, Do it!
+* Make sure Public Bot is unchecked, as well as oauth2 grant.
+* Save, click to reveal the token. Copy the bot token into your {YOURTOKEN} field in eqemu_config, under username
+
+###Prepare server, channel IDs
+* Inside Discord, right click your server's circular icon and on the bottom choose Copy ID.
+* Paste the serverID into your eqemu_config's {SERVERID} field
+* Create a new channel for OOC chat. Right click the channels' name and copy ID.
+* Paste the channelID into your eqemu_config's {CHANNELID} field
+
+### Prepare itemURL (optional)
+* If you have a website that has item links, replace the {ITEMURL} field with the website, e.g. "http://yoursite.com/item.php?id=". It is assumed your item id's are appended to the end of the url link.
+* If you don't have a website with itemlinks, remove the {ITEMURL} entry all together and keep it empty. Discord will italics itemlinks in game when displayed on Discord then.
-###Set ServerID and ChannelID
-* Click the sprocket on the bottom left area to go into user settings.
-* Inside User Settings Pop up, go to the Appearance tab on left.
-* Inside the Appearance tab, Enable on the Developer Mode option
-* Hit done to exit the user settings pop up.
-* Inside Discord, create a channel called #ooc (or another name, whichever you prefer)
-* Right click the channel's name, and choose the copy link option. When you paste it, you'll get a number that represents a channelid noted above.
-* Right click the server's name, and copy link. When you paste it, you'll get a number that represents serverid noted above.
-
-###Set ItemURL
-* this is optional, if you leave the itemurl field blank (or remove it), it will default to showing item links in italics in chat, e.g. *Arrow* when someone itemlinks an Arrow.
###Enable Telnet
* Look through eqemu_config and you will find an option for telnet="enabled".
@@ -40,8 +46,9 @@ This plugin allows Everquest to communicate with Discord in a bidirectional mann
###Set a telnet account password
* Go to your Accounts table on the DB, and set a password for one of your GM accounts. You can manually enter a password in there, plain text, and copy/paste it into the field in your eqemu_config.xml.
-###Run Discord.
-* Run discordeq from the same directory that eqemu_config.xml exists. If any settings are incorrect, you will be prompted on what is incorrect and how to fix it.
+###Run DiscordEQ
+* Your first run should fail with an unauthorized notification, since you have not given your bot permissions to your server yet. You will see a link on the bottom you can copy paste into a browser, and give it permission to access your server.
+
###Enabling Players to talk from Discord to EQ
* Admin-level accounts can only do the following steps.
@@ -53,8 +60,3 @@ This plugin allows Everquest to communicate with Discord in a bidirectional mann
### (Optional) Extend Telnet Timeout
* By default, telnet's timeout is 10 minutes. You can update it's timeout to a longer duration by setting the rule Console:SessionTimeOut to a higher value.
-
-## How to Compile from Source.
-* This repository uses [govendor](https://github.com/kardianos/govendor).
-* Build and install govendor, and inside the discordeq directory once pulled, type `govendor sync` (Note: Your $PATH needs to point to your go/bin path to use the goevndor binary).
-* This ensures you keep versions of packages locked in properly.
diff --git a/build.sh b/build.sh
index ffd2584..1347ac3 100755
--- a/build.sh
+++ b/build.sh
@@ -1,17 +1,24 @@
set -e
-export VERSION="0.49"
+export VERSION="0.50"
export NAME="discordeq"
+echo "Preparing discordeq v${VERSION}"
rm -rf bin/*
echo "Building Linux"
+echo "x64"
GOOS=linux GOARCH=amd64 go build main.go
mv main bin/$NAME-$VERSION-linux-x64
+echo "x86"
GOOS=linux GOARCH=386 go build main.go
mv main bin/$NAME-$VERSION-linux-x86
echo "Building Windows"
+echo "x64"
GOOS=windows GOARCH=amd64 go build main.go
mv main.exe bin/$NAME-$VERSION-windows-x64.exe
+echo "x86"
GOOS=windows GOARCH=386 go build main.go
mv main.exe bin/$NAME-$VERSION-windows-x86.exe
echo "Building OSX"
+echo "x64"
GOOS=darwin GOARCH=amd64 go build main.go
mv main bin/$NAME-$VERSION-osx-x64
+echo "Completed."
diff --git a/main.go b/main.go
index fb6df92..f91f884 100644
--- a/main.go
+++ b/main.go
@@ -49,6 +49,13 @@ func startService() {
os.Exit(1)
}
+ if config.Discord.Password == "" && config.Discord.ClientID == "" {
+ applog.Error.Println("I don't see a password set in your discord > password section of eqemu_config, as well as no client id, please adjust.")
+ fmt.Println("press a key then enter to exit.")
+ fmt.Scan(&option)
+ os.Exit(1)
+ }
+
if config.Discord.ServerID == "" {
applog.Error.Println("I don't see a serverid set in your discord > serverid section of eqemuconfig, please adjust.")
fmt.Println("press a key then enter to exit.")
@@ -87,8 +94,16 @@ func isNewTelnetConfig(config *eqemuconfig.Config) bool {
func listenToDiscord(config *eqemuconfig.Config, disco *discord.Discord) (err error) {
for {
- applog.Info.Println("[Discord] Connecting as", config.Discord.Username, "...")
+ if len(config.Discord.Password) > 0 { //don't show username if it's token based
+ applog.Info.Println("[Discord] Connecting as", config.Discord.Username, "...")
+ } else {
+ applog.Info.Println("[Discord] Connecting...")
+ }
if err = listener.ListenToDiscord(config, disco); err != nil {
+ if strings.Contains(err.Error(), "Unauthorized") {
+ applog.Info.Printf("Your bot is not authorized to access this server.\nClick this link and give the bot access: https://discordapp.com/oauth2/authorize?&client_id=%s&scope=bot&permissions=0", config.Discord.ClientID)
+ return
+ }
applog.Error.Println("[Discord] Disconnected with error:", err.Error())
}