# Automod

Many automod bots will ignore messages sent via WidgetBot, which can be annoying to admins. A solution is using Pylon and code it yourself. In this guide, we'll make a simple check to delete invite links.

First, you'll need to add the Pylon bot to your server.
Then, click your server in the list and click "Open Code Editor". Delete the example code in the editor, so it's blank.

This code will delete all messages sent invite links detected with a regex:

const inviteRegex = /(discord\.(gg|io|me|li)|discord(app)?\.com\/invite)(\/.+)/i;

discord.on('MESSAGE_CREATE', async (msg) => {
  if (inviteRegex.test(msg.content)) await msg.delete();

Paste that in and save. Pylon should now instantly delete messages containing an invite link.

Need help with Pylon?

Go to the Pylon Discord server to get help with using Pylon.