Esempio n. 1
0
    default=get_token(),
    help="The Discord token for your bot.",
)
parser.add_argument(
    "-p",
    "--persist",
    type=Path,
    default=Path("model.json"),
    help="The file path for storing the model persistently.",
)

args = parser.parse_args()

chain = Chain(1)
if args.persist.exists():
    chain.deserialize(args.persist.read_text())
chain_lock = asyncio.Lock()

client = discord.Client()


@client.event
async def on_ready():
    print(f"Logged on as {client.user}.")


@client.event
async def on_message(message):
    async with chain_lock:
        # Don't respond to ourself.
        if message.author == client.user: