Audio, TTS
This commit is contained in:
25
src/main.py
25
src/main.py
@@ -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()
|
||||
|
||||
Reference in New Issue
Block a user