from os import environ
import argparse
import discord

ap = argparse.ArgumentParser()
ap.add_argument('channel', help='the discord id of the channel to post to')
ap.add_argument('text', help='the text to post')

a = ap.parse_args()

if 'TOKEN' not in environ:
  print('please set an environment variable TOKEN with the bot token')
  exit(1)

token = environ['TOKEN']

discord.post(discord.session(token), f'/channels/{a.channel}/messages', {'content': a.text})