Fix the " bug on discord side.

This commit is contained in:
Nova Cat 2024-12-31 21:09:18 -08:00
parent d2946bc4ee
commit f9e60d6070

View file

@ -367,8 +367,8 @@ async def on_message(message):
if message.content[:3] == "/me" or message.content[:4] == "b$me": if message.content[:3] == "/me" or message.content[:4] == "b$me":
await message.delete() await message.delete()
hook(gilwebhook, json={"content": "***[" + message.author.display_name + "] (Guilded) " + " ".join(message.content.split(" ")[1:]), "username": "SweeBridge Guilded", "avatar_url": "https://git.swee.codes/swee/SweeBridge/raw/branch/main/logos/sweebridge-guilded.png"}) hook(gilwebhook, json={"content": "***[" + message.author.display_name + "] (Guilded) " + " ".join(message.content.split(" ")[1:]), "username": "SweeBridge Guilded", "avatar_url": "https://git.swee.codes/swee/SweeBridge/raw/branch/main/logos/sweebridge-guilded.png"})
if discord_enable: hook(discwebhook, json={"content": "***[" + message.author.display_name + "] (Discord) " + " ".join(message.content.split(" ")[1:]), "username": "SweeBridge Guilded", "avatar_url": "https://git.swee.codes/swee/SweeBridge/raw/branch/main/logos/sweebridge-guilded.png"}) if discord_enable: hook(discwebhook, json={"content": "***[" + message.author.display_name + "] (Discord) " + message.content, "username": "SweeBridge Guilded", "avatar_url": "https://git.swee.codes/swee/SweeBridge/raw/branch/main/logos/sweebridge-guilded.png"})
if libera_enable: libera.send_irc(libera_channel, "***[" + message.author.display_name +"] (Guilded) " + " ".join(message.content.split(" ")[1:]).replace("\n","(Newline)")) if libera_enable: libera.send_irc(libera_channel, "***[" + message.author.display_name +"] (Guilded) " + message.content.replace("\n","(Newline)"))
else: else:
if pfp != None: if pfp != None:
if discord_enable: hook(discwebhook, json={"content": message.content, "username": message.author.display_name, "avatar_url": pfp}) if discord_enable: hook(discwebhook, json={"content": message.content, "username": message.author.display_name, "avatar_url": pfp})
@ -438,16 +438,16 @@ class MyClient(discord.Client):
await message.delete() await message.delete()
if guilded_enable: hook(gilwebhook, json={"content": "***[" + message.author.display_name + "] (Guilded) " + message.content[3:]}) if guilded_enable: hook(gilwebhook, json={"content": "***[" + message.author.display_name + "] (Guilded) " + message.content[3:]})
hook(discwebhook, json={"content": "***[" + message.author.display_name + "] (Discord) " + message.content[3:]}) hook(discwebhook, json={"content": "***[" + message.author.display_name + "] (Discord) " + message.content[3:]})
libera.send_irc(libera_channel, "***[" + message.author.display_name +"] (Discord) " + message.content.replace("\\","\\\\").replace("\n","(Newline)").replace("\"","\\\"")[3:]) libera.send_irc(libera_channel, "***[" + message.author.display_name +"] (Discord) " + " ".join(message.content.replace("\n","(Newline)").split(" ")[1:]))
elif message.content[0] == "_" and libera_enable: elif message.content[0] == "_" and libera_enable:
if guilded_enable: hook(gilwebhook, json={"content": "***[" + message.author.display_name + "] (Guilded) " + message.content[1:-1]}) if guilded_enable: hook(gilwebhook, json={"content": "***[" + message.author.display_name + "] (Guilded) " + message.content[1:-1]})
libera.send_irc(libera_channel, "***[" + message.author.display_name +"] (Discord) " + message.content.replace("\\","\\\\").replace("\n","(Newline)").replace("\"","\\\"")[1:-1]) libera.send_irc(libera_channel, "***[" + message.author.display_name +"] (Discord) " + message.content.replace("\n","(Newline)")[1:-1])
else: else:
if pfp != None: if pfp != None:
if guilded_enable: hook(gilwebhook, json={"content": message.content, "username": message.author.display_name.replace("_", " "), "avatar_url": pfp}) if guilded_enable: hook(gilwebhook, json={"content": message.content, "username": message.author.display_name.replace("_", " "), "avatar_url": pfp})
else: else:
if guilded_enable: hook(gilwebhook, json={"content": message.content, "username": message.author.display_name.replace("_", " ")}) if guilded_enable: hook(gilwebhook, json={"content": message.content, "username": message.author.display_name.replace("_", " ")})
if libera_enable: libera.send_irc(libera_channel, "[" + message.author.display_name +"] (Discord): " + message.content.replace("\\","\\\\").replace("\n","(Newline)").replace("\"","\\\"")) if libera_enable: libera.send_irc(libera_channel, "[" + message.author.display_name +"] (Discord): " + message.content.replace("\n","(Newline)"))
if message.content[:13] == "b$liberausers": if message.content[:13] == "b$liberausers":
if libera_enable: if libera_enable:
temp = "" temp = ""