Skip to content

Commit

Permalink
Merge pull request #3 from NicolasDerumigny/master
Browse files Browse the repository at this point in the history
Handeling caps + ignoring commas and full stops
  • Loading branch information
TomCasavant authored Feb 19, 2022
2 parents da1c044 + 7fd8987 commit cde10b5
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions reddit.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,12 @@


class RedditPlugin(Plugin):
@command.passive("((^| )r\/)([^\s]+)", multiple=True)
@command.passive("((^| )r\/)([^\s^,^.]+)", multiple=True)
async def handler(self, evt: MessageEvent, subs: List[Tuple[str, str]]) -> None:
await evt.mark_read()
subreddits = [] # List of all subreddits given by user
for _, r_slash, __, sub_str in subs:
link = "https://reddit.com/r/{}".format(urllib.parse.quote(sub_str))
link = "https://reddit.com/r/{}".format(urllib.parse.quote(sub_str.lower()))

async with self.http.head(
link, headers={"User-agent": "redditmaubot"}, allow_redirects=True
Expand Down

0 comments on commit cde10b5

Please sign in to comment.