Merge branch 'master' into Discord_Verify

This commit is contained in:
2020-11-06 23:29:36 +01:00
9 changed files with 245 additions and 9 deletions

37
functions/bannedWords.py Normal file
View File

@@ -0,0 +1,37 @@
import json
def load():
with open("files/banned_words.json", "r") as fp:
return json.load(fp)
def write(words):
with open("files/banned_words.json", "w") as fp:
json.dump(words, fp)
def ban_word(word: str):
words = load()
# Already been banned
if word.lower() in words:
return False
# Add to the list of words
words.append(word.lower())
write(words)
return True
def remove_word(word: str):
words = load()
# Not banned
if word.lower() not in words:
return False
# Unban word
words.remove(word.lower())
write(words)
return True

12
functions/embeds.py Normal file
View File

@@ -0,0 +1,12 @@
import discord
def modEmbed(author):
embed = discord.Embed(colour=discord.Colour.orange())
# Attach the server icon as a file
file = discord.File("files/images/server_icon.png", filename="icon.png")
embed.set_author(name=author, icon_url="attachment://icon.png")
return embed, file