generated from HoloTech/discord-bot-template
Initial commit
This commit is contained in:
12
scripts/start_bot.py
Executable file
12
scripts/start_bot.py
Executable file
@@ -0,0 +1,12 @@
|
||||
# !/bin/python3
|
||||
|
||||
import sys
|
||||
import os
|
||||
|
||||
sys.path.insert(0, os.path.join(os.getcwd()))
|
||||
sys.path.insert(0, os.path.join(os.getcwd(), "src"))
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
from bot import _main
|
||||
_main()
|
||||
35
scripts/start_debug.py
Executable file
35
scripts/start_debug.py
Executable file
@@ -0,0 +1,35 @@
|
||||
# !/bin/python3
|
||||
|
||||
import sys
|
||||
import os
|
||||
import tracemalloc
|
||||
import asyncio
|
||||
|
||||
|
||||
sys.path.insert(0, os.path.join(os.getcwd()))
|
||||
sys.path.insert(0, os.path.join(os.getcwd(), "src"))
|
||||
|
||||
tracemalloc.start()
|
||||
|
||||
|
||||
def loop_exception_handler(loop, context):
|
||||
print(context)
|
||||
task: asyncio.Task = context.get('task', None)
|
||||
if task is not None:
|
||||
addendum = f"<Task name='{task.get_name()}' stack='{task.get_stack()}'>"
|
||||
message = context.get('message', '')
|
||||
context['message'] = ' '.join((message, addendum))
|
||||
loop.default_exception_handler(context)
|
||||
|
||||
|
||||
def main():
|
||||
loop = asyncio.get_event_loop()
|
||||
loop.set_exception_handler(loop_exception_handler)
|
||||
loop.set_debug(enabled=True)
|
||||
|
||||
from bot import _main
|
||||
_main()
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
main()
|
||||
Reference in New Issue
Block a user