mirror of
https://github.com/TotalFreedomMC/TotalFreedomBot.git
synced 2025-08-05 03:55:26 +00:00
Various formatting
Hopefully this will make the static analysis tool happier
This commit is contained in:
parent
2d2bde604d
commit
866054884a
14 changed files with 202 additions and 147 deletions
16
main.py
16
main.py
|
@ -18,7 +18,8 @@ load_dotenv()
|
|||
botToken = os.getenv('botToken')
|
||||
|
||||
intents = discord.Intents.all()
|
||||
bot = commands.Bot(command_prefix=os.getenv('prefix'), description='TotalFreedom bot help command', intents=intents)
|
||||
bot = commands.Bot(command_prefix=os.getenv('prefix'),
|
||||
description='TotalFreedom bot help command', intents=intents)
|
||||
|
||||
|
||||
extensions = [
|
||||
|
@ -34,9 +35,11 @@ if __name__ == '__main__':
|
|||
for extension in extensions:
|
||||
try:
|
||||
bot.load_extension(extension)
|
||||
print(f"[{str(datetime.utcnow().replace(microsecond=0))[11:]} INFO]: [Extensions] {extension} loaded successfully")
|
||||
print(
|
||||
f"[{str(datetime.utcnow().replace(microsecond=0))[11:]} INFO]: [Extensions] {extension} loaded successfully")
|
||||
except Exception as e:
|
||||
print(f"[{str(datetime.utcnow().replace(microsecond=0))[11:]} INFO]: [Extensions] {extension} didn't load {e}")
|
||||
print(
|
||||
f"[{str(datetime.utcnow().replace(microsecond=0))[11:]} INFO]: [Extensions] {extension} didn't load {e}")
|
||||
|
||||
|
||||
@bot.event
|
||||
|
@ -54,7 +57,7 @@ async def on_message(message):
|
|||
if role.id in bypass_roles:
|
||||
bypass = True
|
||||
else:
|
||||
if 'Server has started' in message.content: # Telnet reconnect script
|
||||
if 'Server has started' in message.content: # Telnet reconnect script
|
||||
try:
|
||||
bot.telnet_object.connect()
|
||||
except Exception as e:
|
||||
|
@ -63,12 +66,13 @@ async def on_message(message):
|
|||
try:
|
||||
bot.telnet_object.connect()
|
||||
except Exception as fuckup:
|
||||
print(f'Second attempt failed to reconnect telnet: {fuckup}')
|
||||
print(
|
||||
f'Second attempt failed to reconnect telnet: {fuckup}')
|
||||
if not bypass:
|
||||
if re.search('discord\.gg\/[a-zA-z0-9\-]{1,16}', message.content) or re.search('discordapp\.com\/invite\/[a-z0-9]+/ig', message.content):
|
||||
await message.delete()
|
||||
await message.channel.send(f"{message.author.mention} do not post invite links to other discord servers.")
|
||||
|
||||
|
||||
if message.content.lower().startswith(os.getenv('prefix')):
|
||||
await bot.process_commands(message)
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue