Skip to content

Commit

Permalink
Quick Bug Fixes/Mistakes
Browse files Browse the repository at this point in the history
  • Loading branch information
Jetsurf committed Sep 29, 2024
1 parent 34c4af5 commit decd50c
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 4 deletions.
2 changes: 1 addition & 1 deletion bot.py
Original file line number Diff line number Diff line change
Expand Up @@ -925,7 +925,7 @@ async def on_guild_join(server):
global client, serverVoices, url, dev, owners, mysqlHandler, configData

print(f"I joined server: {server.name}")
serverVoices[server.id] = vserver.voiceServer(client, mysqlHandler, server.id, configData['soundsdir'])
serverVoices[server.id] = vserver.voiceServer(client, mysqlHandler, server.id, configData['soundsdir'], configData['ffmpeg_bin'])

print(f"I am now in {str(len(client.guilds))} servers")
updateTopGg()
Expand Down
4 changes: 2 additions & 2 deletions modules/stringcrypt.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ def writeSecretKeyFile(self, path):
# Given a string, returns bytes padded to the cipher's block size.
# We use RFC5652 padding: https://datatracker.ietf.org/doc/html/rfc5652#section-6.3
def padString(self, string):
if Crypto.Cipher.AES.block_size > 255:
if Cryptodome.Cipher.AES.block_size > 255:
raise Exception(f"Cipher block size {Crypto.Cipher.AES.block_size} too large for padding method")
data = string.encode('utf-8')
blklen = len(data) % Crypto.Cipher.AES.block_size
Expand All @@ -58,7 +58,7 @@ def encryptString(self, plaintext):
if self.key == None:
raise Exception("Attempt to encrypt with no secret key set")
cipher = f"AES-{Cryptodome.Cipher.AES.block_size * 8}"
iv = self.random.read(Crypto.Cipher.AES.block_size)
iv = self.random.read(Cryptodome.Cipher.AES.block_size)
aes = Cryptodome.Cipher.AES.new(self.key, Cryptodome.Cipher.AES.MODE_CBC, iv)
ciphertext = aes.encrypt(self.padString(plaintext))
return f"cipher={cipher};iv={iv.hex()};ciphertext={ciphertext.hex()}"
Expand Down
6 changes: 5 additions & 1 deletion modules/vserver.py
Original file line number Diff line number Diff line change
Expand Up @@ -294,7 +294,11 @@ def __init__(self, source, *, data, volume=0.07):
@classmethod
async def get_info(cls, url, *, loop=None, stream=True):
loop = loop or asyncio.get_event_loop()
data = await loop.run_in_executor(None, lambda: ytdl.extract_info(url, download=not stream))
try:
data = await loop.run_in_executor(None, lambda: ytdl.extract_info(url, download=not stream))
except Exception as e:
print(f"Unsupported URL - failure in yt-dlp setup for URL {url}: {str(e)}")
return None

if data['extractor'] == 'generic' or data['extractor'] == 'youtube:search':
return None
Expand Down

0 comments on commit decd50c

Please sign in to comment.