update
This commit is contained in:
parent
2e65c7acae
commit
333e670e0e
1 changed files with 10 additions and 11 deletions
|
@ -1,17 +1,17 @@
|
||||||
diff --git a/main.py b/main.py
|
diff --git a/main.py b/main.py
|
||||||
index 53dc289..9acbb43 100644
|
index 21adf31..31cdd28 100644
|
||||||
--- a/main.py
|
--- a/main.py
|
||||||
+++ b/main.py
|
+++ b/main.py
|
||||||
@@ -56,7 +56,7 @@ class MatrixClient(nio.AsyncClient):
|
@@ -56,7 +56,7 @@ class MatrixClient(nio.AsyncClient):
|
||||||
await self.sync(timeout)
|
await self.sync(timeout)
|
||||||
|
|
||||||
# Set up event callbacks
|
# Set up event callbacks after syncing once to ignore old messages.
|
||||||
- callbacks = Callbacks(self)
|
- callbacks = Callbacks(self)
|
||||||
+ callbacks = Callbacks(self, discord_client)
|
+ callbacks = Callbacks(self, discord_client)
|
||||||
|
|
||||||
self.add_event_callback(
|
self.add_event_callback(
|
||||||
callbacks.message_callback,
|
callbacks.message_callback,
|
||||||
@@ -320,8 +320,9 @@ class DiscordClient(discord.ext.commands.Bot):
|
@@ -351,8 +351,9 @@ class DiscordClient(discord.ext.commands.Bot):
|
||||||
|
|
||||||
|
|
||||||
class Callbacks(object):
|
class Callbacks(object):
|
||||||
|
@ -22,8 +22,8 @@ index 53dc289..9acbb43 100644
|
||||||
|
|
||||||
def get_channel(self, room):
|
def get_channel(self, room):
|
||||||
channel_id = next(
|
channel_id = next(
|
||||||
@@ -450,7 +451,9 @@ class Callbacks(object):
|
@@ -500,7 +501,9 @@ class Callbacks(object):
|
||||||
for emote in emotes:
|
# :emote: becomes <:emote:emote_id>
|
||||||
if emote not in added_emotes:
|
if emote not in added_emotes:
|
||||||
added_emotes.append(emote)
|
added_emotes.append(emote)
|
||||||
- emote_ = discord.utils.get(guild.emojis, name=emote)
|
- emote_ = discord.utils.get(guild.emojis, name=emote)
|
||||||
|
@ -32,4 +32,3 @@ index 53dc289..9acbb43 100644
|
||||||
+ )
|
+ )
|
||||||
if emote_:
|
if emote_:
|
||||||
message = message.replace(f":{emote}:", str(emote_))
|
message = message.replace(f":{emote}:", str(emote_))
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue