Skip to content

Commit

Permalink
Big bug fix!
Browse files Browse the repository at this point in the history
  • Loading branch information
henry232323 committed Jun 19, 2019
1 parent da38ca1 commit a5423e9
Show file tree
Hide file tree
Showing 5 changed files with 55 additions and 38 deletions.
15 changes: 8 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,13 +31,14 @@ have tokens, here's how to find yours:

1. Open Discord
2. Press Ctrl+Shift+i
3. Click "Application" tab
4. Expand Storage > Local Storage > https://discordapp.com
5. Find "token" under "key"
6. Copy the text in quotes on the same row

Starting soon (not yet) the app will **ONLY** accept tokens, however once tokens are mandatory, we will also
get some cool new functionality.
3. Click "Network" tab
4. Type into filter "/api/v6"
5. Press Ctrl+R (restarts Discord)
6. Click the Library tab
7. Click "Headers"
8. Select an item, "science" will always work
9. Scroll to "Request Headers"
10. Your token is after "authorization: "

# Quirks
Pesterchum-Discord lets you do custom quirks using Regex! (Regular Expression) for help on quirks (they work identically) check out
Expand Down
5 changes: 4 additions & 1 deletion gui.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,10 @@ def __init__(self, loop, app, **kwargs):
def initialize(self):
uic.loadUi(self.theme["ui_path"] + "/Main.ui", self)

self.nameButton.setText(self.app.client.user.name)
if self.app.client.user is not None:
self.nameButton.setText(self.app.client.user.name)
else:
self.nameButton.setText("")
self.nameButton.setIcon(QIcon(self.theme["path"] + "/chummy.png"))

# Fix dimensions
Expand Down
34 changes: 20 additions & 14 deletions pesterchum.py
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ def __init__(self):
loop = QEventLoop(self)
self.loop = loop
asyncio.set_event_loop(loop)
self.session = aiohttp.ClientSession(loop=loop)
self.session = None

self.idle = False
self.trayIcon = None
Expand All @@ -87,17 +87,19 @@ def __init__(self):

self.nick = None
self.token, self.botAccount = UserAuth
self.client = (AutoShardClient if self.botAccount else DiscordClient)(app=self, loop=self.loop)
self.client = (lambda app, loop: AutoShardClient(app=app, loop=loop, shard_id=3) if self.botAccount else DiscordClient(app=app, loop=loop))(app=self, loop=self.loop)
#print(self.client)

if not UserAuth[0]:
self.openAuth(i=True)
save_auth((self.token, self.botAccount,))

#asyncio.ensure_future(self.loop.run_in_executor(QThreadExecutor(1), self.connecting()))
self.loop.call_later(0, self.connecting)
#self.loop.call_later(0, self.connecting)
loop.create_task(self.runbot())

self.gui = Gui(self.loop, self)
self.gui.initialize()
loop.run_forever()

def cli(self):
Expand Down Expand Up @@ -154,17 +156,21 @@ async def on_message(self, message):

async def on_ready(self):
"""Called on `Client.on_ready`, generally once the client is logged in and ready"""
try:
print("received ready")
self.connectingDialog.close()
self.connectingDialog = None
self.nick = self.client.user.name
self.quirks = Quirks(self)
if "debug" in sys.argv:
self.cli()
sa.WaveObject.from_wave_file(os.path.join(self.theme["path"], "alarm.wav")).play()
finally:
self.gui.initialize()
if self.session is None:
self.session = aiohttp.ClientSession(loop=self.loop)
try:
print("received ready")
#self.connectingDialog.close()
#self.connectingDialog = None
self.nick = self.client.user.name
self.quirks = Quirks(self)
if "debug" in sys.argv:
self.cli()
sa.WaveObject.from_wave_file(os.path.join(self.theme["path"], "alarm.wav")).play()
except Exception as e:
self.bot.nameButton.setText(str(e))
finally:
self.gui.initialize()

def change_mood(self, mood):
if mood in ("offline", "abscond"):
Expand Down
4 changes: 2 additions & 2 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
-e git+https://github.com/henry232323/quamash
-e git+https://github.com/harvimt/quamash
PyQt5 >= 5.7
-e git+https://github.com/Rapptz/discord.py@rewrite#egg=discord.py
aiohttp >= 1.0.5
aiohttp>=3.3.0,<3.6.0
requests >= 2.12.4
async-timeout >= 1.1.0
simpleaudio
35 changes: 21 additions & 14 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,15 +24,15 @@

sys.argv.append("build")

include_files = ["resources", "themes", "README.md", "LICENSE"]

include_files = ["resources", "themes", "README.md", "LICENSE"]

includes = ["PyQt5", "os", "json", "types", "discord", "aiohttp",
"requests", "contextlib", "io", "inspect", "traceback", "subprocess",
"async_timeout", "asyncio", "asyncio.compat", "asyncio.base_futures",
"asyncio.base_events", "asyncio.base_tasks", "asyncio.base_subprocess",
"asyncio.proactor_events", "asyncio.constants","asyncio.selector_events",
"asyncio.windows_utils"]
"requests", "contextlib", "io", "inspect", "traceback", "subprocess",
"async_timeout", "asyncio", "asyncio.base_futures",
"asyncio.base_events", "asyncio.base_tasks", "asyncio.base_subprocess",
"asyncio.proactor_events", "asyncio.constants", "asyncio.selector_events",
"asyncio.windows_utils", "idna.idnadata", "quamash", "asyncio.format_helpers",
"asyncio.sslproto", "idna_ssl", "ssl", "_ssl"]

if os.name == "posix":
includes.append("idna.idnadata")
Expand All @@ -43,18 +43,25 @@
'pywin.debugger', 'pywin.debugger.dbgcon', 'pywin.dialogs', 'tcl',
'unittest', 'idlelib', 'nacl', "_lzma", "_hashlib", "_bz2"],
"include_files": include_files,
}
}

base = None
if sys.platform == "win32":
base = "Win32GUI"
base = "Win32GUI"

if sys.platform == "win32":
PYTHON_INSTALL_DIR = os.path.dirname(os.path.dirname(os.__file__))
build_exe_options['include_files'] += [
os.path.join(PYTHON_INSTALL_DIR, 'DLLs', 'libcrypto-1_1-x64.dll'),
os.path.join(PYTHON_INSTALL_DIR, 'DLLs', 'libssl-1_1-x64.dll'),
]

setup(
name="Pesterchum-Discord",
version="1.3.6",
description="A Discord client mimicking the Pesterchum chat client from Homestuck, Uses a lot of code from my Pesterchum Client.",
version="1.3.7",
description="Pesterchum Client",
options={"build_exe": build_exe_options},
executables=[
Executable("pesterchum.py", base=base, icon="resources/pc_chummy.ico"),
Executable("updater.py", base=None, icon="resources/sburb.ico")]
)
Executable("pesterchum.py", base=base, icon="resources/pc_chummy.ico"),
Executable("updater.py", base=None, icon="resources/sburb.ico")]
)

0 comments on commit a5423e9

Please sign in to comment.