khyperia / weechat-discord

Unmaintained! And also apparently this is against their TOS so DON'T USE THIS -- Weechat plugin for Discord support - https://weechat.org/ https://discordapp.com/
MIT License
51 stars 24 forks source link

buffers not appearing when i connect? #41

Closed zbsfm closed 4 years ago

zbsfm commented 4 years ago

hi there! not sure if this project is even being maintained any more but i thought i'd drop in and see if i could get help with something.

i'm on macOS - i've installed everything and loaded the plugin within weechat. no problems so far - the plugin loads without issue. it appears to successfully connect with the token i retrieved with the python script (which required a bit of modification to not throw an error - i will attach my fork of that script just in case that has something to do with my problem.

however, when i connect, my discord buffers don't show up on the left side. in fact, nothing visibly changes, other than the app claiming i'm connected.

what am i missing here?

thanks a lot!

import subprocess
import sys
import string
import platform

def strings(filename, min=4):
    with open(filename, "rignore") as f:
        result = ""
        for c in f.read():
            if c in string.printable:
                result += c
                continue
            if len(result) >= min:
                yield result
            result = ""
        if len(result) >= min:
            yield result

def run_command(cmd):
    output = subprocess.Popen(
        [cmd], shell=True, stdout=subprocess.PIPE , # stderr=subprocess.DEVNULL
    )
    return output.communicate()[0].decode().splitlines()

def main():
    print("Searching for Discord localstorage databases...")
    rg = False
    if platform.system() == "Darwin":
        results = run_command("mdfind \"kMDItemDisplayName=='*.ldb'\"")
    else:
        try:
            subprocess.check_output(["rg", "--version"])
            results = run_command("rg ~/ --files -g '*.ldb'")
            rg = True
        except FileNotFoundError:
            results = run_command("find ~/ -name '*.ldb'")

    if len(results) == 0 and rg:
        # try again, but search hidden directories
        results = run_command("rg ~/ --hidden --files -g '*.ldb'")

    if len(results) == 0:
        print("No databases found.")
        sys.exit(1)

    discord_databases = list(filter(lambda x: "discord" in x, results))

    token_candidates = set()
    for database in discord_databases:
        for candidate in strings(database, 40):
            if " " in candidate:
                continue
            parts = candidate.split(".", 3)
            if len(parts) != 3:
                continue
            if len(parts[1]) < 6:
                continue
            token_candidates.add(candidate[1:-2])

    if len(token_candidates) == 0:
        print("No Discord tokens found")
        return

    print("Likely Discord tokens are:\n")
    for token in token_candidates:
        print(token)

if __name__ == "__main__":
    main()
khyperia commented 4 years ago

Hello! Sadly, I learned after developing this for a while that this client is against Discord's Terms Of Service (see header in the repo - even just using it can get you permanently banned from Discord), so I will not be providing any support or accepting any PRs.

zbsfm commented 4 years ago

i did see that, i was prepared to risk it but i understand :) thanks for your attempt at this project anyway! hopefully we can eventually have a way to consolidate all the various messaging platforms someday. (slack, discord, whatsapp, sms, etc etc)