MoGo
This Discord bot automatically detects Links and shortens them
Created Jun 26, 2022 - Last updated: Jun 26, 2022
discord-bot
discordgo
go
linkshortener
What?
MoGo is a Discord bot that scans through new messages for links to shorten them.
Technical
Tech used
MoGo was built using Golang and discordgo.
How?
But how exactly does MoGo detect whether something is a link or not? The only input it gets is some text like " something something https://example.com something".
The Answer is Regular Expressions!
https?:\/\/(([a-z0-9]){0,}\.)?([a-z0-9]){2,63}\.[a-z]{2,}(\/[\s\S]{0,}?){0,}
The Regular Expression above describes a URL and tells MoGo whether something is an URL or not.