-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Replace twitter links with vxtwitter
- Loading branch information
1 parent
0580dae
commit 2928754
Showing
3 changed files
with
20 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
import discord | ||
|
||
async def on_message(message: discord.Message, conf): | ||
if conf.enforce_vxtwitter: | ||
base_len = 19 | ||
i = message.content.find('https://twitter.com') | ||
if i == -1: | ||
base_len = 18 | ||
i = message.content.find('http://twitter.com') | ||
if i != -1: | ||
space = message.content.find(" ", i) | ||
if space == -1: | ||
space = len(message.content) | ||
url = f'https://vxtwitter.com{message.content[i + base_len: space]}' | ||
await message.edit(suppress=True) | ||
await message.reply(url) |