club-penguin/club-penguin.py

72 lines
1.5 KiB
Python
Raw Normal View History

import asyncio
2020-05-15 21:58:03 -04:00
import discord
import re
2020-05-15 21:58:03 -04:00
import sys
client = discord.Client()
RUDE_WORDS_PREFIXONLY = [
'ass',
2020-05-15 22:58:10 -04:00
'cum',
'hell',
'sex'
]
2020-05-15 21:58:03 -04:00
RUDE_WORDS = [
'bastard',
'bitch',
'boob',
2020-05-16 16:07:07 -04:00
'bukkake',
2020-05-15 21:58:03 -04:00
'cock',
2020-05-15 22:04:06 -04:00
'crap',
2020-05-15 21:58:03 -04:00
'cunt',
'damn',
'dick',
'dildo',
'fuck',
2020-05-16 16:07:07 -04:00
'jizz',
'lotion',
'lube',
2020-05-15 21:58:03 -04:00
'penis',
2020-05-15 22:58:10 -04:00
'piss',
2020-05-15 21:58:03 -04:00
'porn',
2020-05-15 22:58:10 -04:00
'scrotum',
2020-05-15 21:58:03 -04:00
'shit',
'slut',
'tiddy',
'tiddies',
'tits',
'titty',
'titties',
'vagina'
]
REGEX_STR = '|'.join(['+'.join(list(w)) for w in RUDE_WORDS] + [r'\b' + '+'.join(list(w)) for w in RUDE_WORDS_PREFIXONLY])
RUDE_WORDS_REGEX = re.compile(REGEX_STR, re.IGNORECASE)
2020-05-15 21:58:03 -04:00
@client.event
async def on_ready():
print('logged in as {0.user}'.format(client), file=sys.stderr)
@client.event
async def on_message(message):
if message.author == client.user:
return
2020-05-16 12:34:21 -04:00
if message.channel.is_nsfw():
return
if RUDE_WORDS_REGEX.search(message.content):
2020-05-15 21:58:03 -04:00
await message.channel.send('Your Club Penguin account has been deactivated for inappropriate language.')
oldnick = message.author.nick
try:
await message.author.edit(nick="BANNED")
await asyncio.sleep(300)
await message.author.edit(nick=oldnick)
except discord.Forbidden:
print('Permissions error while trying to change nickname of {}'.format(message.author), file=sys.stderr)
2020-05-15 21:58:03 -04:00
with open('token') as f:
token = f.read().strip()
client.run(token)