Skip to content

Commit

Permalink
Migrate on_message to subhooks
Browse files Browse the repository at this point in the history
  • Loading branch information
Mikk155 committed Oct 7, 2024
1 parent 9f3f49c commit a4881be
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 10 deletions.
4 changes: 2 additions & 2 deletions plugins.json
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@
"Description": "Fix twitter and instagram embeeds",
"Hooks":
[
"on_message"
"on_link"
]
},
{
Expand All @@ -75,7 +75,7 @@
"Description": "Count users pings",
"Hooks":
[
"on_message"
"on_mention"
]
},
{
Expand Down
2 changes: 1 addition & 1 deletion plugins/fix_embeeds.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
"https://x.com/": "https://fxtwitter.com/",
};

async def on_message( message: discord.Message ):
async def on_link( message: discord.Message, urls: list[str] ):

for link, replace in fix_embeeds_kvp.items():

Expand Down
9 changes: 2 additions & 7 deletions plugins/ping_counter.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,14 +24,9 @@

from plugins.main import *

async def on_message( message: discord.Message ):
async def on_mention( message: discord.Message, mentions: list[ discord.Member | discord.User ] ):

if message.author.id == bot.user.id:
return Hook.Continue();

mentioned_users = message.mentions

for user in mentioned_users:
for user in mentions:

mention = gpUtils.mention( user );

Expand Down

0 comments on commit a4881be

Please # to comment.