Audio, TTS

This commit is contained in:
James H
2023-04-08 00:35:31 +01:00
parent 0f3416c11b
commit 2d5a58f996
10 changed files with 389 additions and 62 deletions

View File

@@ -1,3 +1,4 @@
import discord
import json
from core.bot import Bot
@@ -5,31 +6,33 @@ from core.bot import Bot
def main():
try:
with open("config.json", "rt") as config_file:
with open('config.json', 'rt') as config_file:
config = json.load(config_file)
except OSError as e:
print(f"Could not open config.json! Error: {e.strerror}")
print(f'Could not open config.json! Error: {e.strerror}')
return
except Exception as e:
print(f"Error loading config. Error: {e}")
print(f'Error loading config. Error: {e}')
return
# Load token from token file if not in JSON config
if config["token"] == "":
if config['token'] == '':
try:
with open("token.txt", "rt") as token_file:
config["token"] = token_file.readline()
with open('token.txt', 'rt') as token_file:
config['token'] = token_file.readline()
except OSError as e:
print(f"Could not open token.txt! Error: {e.strerror}")
print(f'Could not open token.txt! Error: {e.strerror}')
return
try:
bot = Bot()
intents = discord.Intents.default()
intents.message_content = True
bot = Bot(intents=intents)
bot.load_config(config)
bot.run(config["token"])
bot.run(config['token'])
except Exception as e:
print(f"Exception running bot! Error: {e}")
print(f'Exception running bot! Error: {e}')
return
if __name__ == "__main__":
if __name__ == '__main__':
main()