GithubHelp home page GithubHelp logo

xackery / talkeq Goto Github PK

View Code? Open in Web Editor NEW
16.0 6.0 10.0 337 KB

Everquest (eqlog, telnet) <-> Chat (discord)

License: Apache License 2.0

Makefile 1.95% Go 98.05%
everquest discord eqlog telnet nats

talkeq's Introduction

TalkEQ

GoDoc Go Report Card

Total alerts

Platform Tests & Build

TalkEQ bridges links between everquest and other services. Extends DiscordEQ.

Setup

  • Go to releases and download the latest exe or binary for your operating systsem.
  • Go to https://discordapp.com/developers/ and sign in
  • Click New Application the top right area
  • Write anything you wish for the app name, click Create App
  • Start the talkeq executable once. This generates a talkeq.conf file
  • Copy the Application ID into your talkeq.conf's discord client_id section
  • On the left pane, click Bot
  • Press Add Bot, Yes, do it!
  • Click the Reset Token button, Yes, do it!
  • Press the copy button in the Token section
  • Uncheck the Public Bot option
  • Scroll to the bottom of the bot section, and toggle the Message Content Intent option (Due to this fix)
  • Replace on this link's {CLIENT_ID} field with the client ID you obtained earlier. https://discordapp.com/oauth2/authorize?&client_id={CLIENT_ID}&scope=bot&permissions=268504064
  • Open the link and authorize your bot to access your server.
  • Ensure the bot now appears offline on your server's general channel

Configure TalkEQ

  • Start talkeq up. The first run, it will say a new talkeq.conf file was created. Please open this file and configure talkeq, then run it again..
  • Edit the talkeq.conf, walking through each section and applying it for your situation. There are comments that help you through the process.

Configure discord users to talk from Discord to EQ

Using Discord Roles

  • (Admin-level accounts on Discord can only do the following steps.)
  • Inside discord go to Server Settings.
  • Go to Roles.
  • Create a new role, with the name: IGN: <username>. The IGN: prefix is required for DiscordEQ to detect a player and is used to identify the player in game, For example, to identify the discord user Xackery as Shin, Create a role named IGN: Shin, right click the user Xackery, and assign the role to them.
  • If the above user chats inside the assigned channel, their message will appear in game as Shin says from discord, 'Their Message Here'

Using Users Database

  • When talkeq runs, a users.txt file is generated the same directory as talkeq. Peek at the file to see the layout.
  • If you write to this file, talkeq will hot reload the contents and update it's lookup table in memory for mapping users from discord to telnet (eq)
  • You can write a website to edit this file, or by hand, to update talkeq and sync your player IGN tags

/etc/init.d/talkeq change APPDIR/APPBIN, user, and group to your set options

!/bin/sh

### BEGIN INIT INFO
# Provides:          talkeqdaemon
# Required-Start:    $local_fs $network $syslog
# Required-Stop:     $local_fs $network $syslog
# Default-Start:     2 3 4 5
# Default-Stop:      0 1 6
# Short-Description: TalkEQ
# Description:       TalkEQ start-stop-daemon - Debian
### END INIT INFO

NAME="talkeq"
PATH="/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin"
APPDIR="/home/eqemu/talkeq/"
APPBIN="/home/eqemu/talkeq/talkeq"
APPARGS=""
USER="eqemu"
GROUP="eqemu"

# Include functions
set -e
. /lib/lsb/init-functions

start() {
  printf "Starting '$NAME'... "
  start-stop-daemon --start --chuid "$USER:$GROUP" --background --make-pidfile --pidfile /var/run/$NAME.pid --chdir "$APPDIR" --startas /bin/bash -- -c "exec $APPBIN > /var/log/talkeq.log 2>&1"
  printf "done\n"
}
#We need this function to ensure the whole process tree will be killed
killtree() {
    local _pid=$1
    local _sig=${2-TERM}
    for _child in $(ps -o pid --no-headers --ppid ${_pid}); do
        killtree ${_child} ${_sig}
    done
    kill -${_sig} ${_pid}
}

stop() {
  printf "Stopping '$NAME'... "
  [ -z `cat /var/run/$NAME.pid 2>/dev/null` ] || \
  while test -d /proc/$(cat /var/run/$NAME.pid); do
    killtree $(cat /var/run/$NAME.pid) 15
    sleep 0.5
  done
  [ -z `cat /var/run/$NAME.pid 2>/dev/null` ] || rm /var/run/$NAME.pid
  printf "done\n"
}

status() {
  status_of_proc -p /var/run/$NAME.pid "" $NAME && exit 0 || exit $?
}

case "$1" in
  start)
    start
    ;;
  stop)
    stop
    ;;
  restart)
    stop
    start
    ;;
  status)
    status
    ;;
  *)
    echo "Usage: $NAME {start|stop|restart|status}" >&2
    exit 1
    ;;
esac

exit 0

Source Services

Name Channels
Telnet ooc, broadcast
EQLog ooc, guild, auction, general, shout
PEQEditorSQLLog peqeditorsqllog

Broadcast Services

Name Channels
Discord ooc, auction, general, peqeditorsqllog
Telnet ooc

Service Descriptions

  • Telnet - EQEMU uses this as a way to communicate with the server
  • EQLog - Everquest's client generates a log when you type /log, and it logs data the client sees
  • PEQEditorSQLLog - EQEMU's PEQ Editor is configured to log sql events, you can relay this info to discord
  • Discord - Chat service that lets you relay information to it via bots

Example of using sql:

# SQL Report can be used to show stats on discord
# An ideal way to set this up is create a private voice channel
# Then bind it to various queries

[sql_report]
	# Enable SQL Reporting
	enabled = false

	# host for database
	# default: 127.0.0.1:3306
	host = "127.0.0.1:3306"

	# username to connect to database with.
	# default: eqemu
	username = "eqemu"

	# password to connect to database with.
	# default: eqemupass
	password = "eqemupass"

	# database to connect to
	# default: eqemu
	database = "eqemu"


[[sql_report.entries]]
	channel_id = "678525065905831968"
	query = "SELECT level2 FROM character_data cd INNER JOIN account a ON a.id = cd.account_id WHERE a.status = 0 ORDER BY level2 DESC LIMIT 1"
	pattern = "Highest Level: {{.Data}}"
	refresh = "5m"

[[sql_report.entries]]
	channel_id = "676283027361366026"
	query = "SELECT count(id) FROM character_data WHERE zone_id != 386 AND last_login > UNIX_TIMESTAMP()-3600"
	pattern = "In Dungeon: {{.Data}}"
	refresh = "60s"

[[sql_report.entries]]
	channel_id = "678525229672169472"
	query = "SELECT count(id) FROM character_data WHERE zone_id = 386 AND last_login > UNIX_TIMESTAMP()-3600"
	pattern = "In Hub: {{.Data}}"
	refresh = "60s"

[[sql_report.entries]]
	channel_id = "676282331627257856"
	query = "SELECT count(id) FROM account"
	pattern = "Accounts: {{.Data}}"
	refresh = "30m"

talkeq's People

Contributors

dependabot[bot] avatar projecteon avatar towbes avatar xackery avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

talkeq's Issues

send with webhook instead of bot for masked links

//telnet_msg.go

// replace the relevant line with
out += fmt.Sprintf("[%s](%s%d)", itemName, t.config.ItemURL, itemID)
// discord.go
// add to import block ...
	"net/http"
	"encoding/json"
//done import block ...

// Send sends a message to discord
func (t *Discord) Send(req request.DiscordSend) error {
	if !t.config.IsEnabled {
		return fmt.Errorf("not enabled")
	}

	if !t.isConnected {
		return fmt.Errorf("not connected")
	}

	webhookUrl := //<YOUR WEBHOOK URL>

	payload := DiscordWebhook{
		Content: req.Message,
	}

	jsonPayload, err := json.Marshal(payload)
	if err != nil {
		return fmt.Errorf("Failed to parse payload to JSON: %w", err)
	}

	resp, err := http.Post(webhookUrl, "application/json", bytes.NewBuffer(jsonPayload))
	if err != nil {
		return fmt.Errorf("Failed to send POST request: %w", err)
	}

	defer resp.Body.Close()

	if resp.StatusCode != http.StatusOK {
		return fmt.Errorf("Received non-200 response: %d", resp.StatusCode)
	}

	return nil
}

My Go knowledge is absolute garbage and I have no idea how to integrate this correctly into your overall structure (my fork is getting more and more off the rails and is not-good-but-works-for-my-needs), so not gonna PR it. This does work, though. Maybe useful to you or someone else.

I'm going to try to work in reverse link handling (convert allaclone links to ingame links), and would love to contribute all of this but would need some handholding on getting it together correctly.

phpbb forum new posting support

SELECT username, forum_name, topic_title, post_text FROM phpbb_posts p INNER JOIN phpbb_users u ON p.poster_id = u.user_id INNER JOIN phpbb_topics t ON t.topic_id = p.topic_id INNER JOIN phpbb_forums f ON p.forum_id = f.forum_id WHERE post_id > 1;

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.