0
votes

Im trying to host my Discord Bot, in python, on Heroku. But the requirements.txt cant download the webbrowser and time module.

First of all, yes I do know webbrowser is an integrated module from Python. But when I use the Discord bot, for example, to open Twitter it doesn`t work. Ive tried many times with reuploading the script to Heroku. But when Im writting "webbrowser" into the requirements.txt it cant find it.

line to open twitter per command:

if message.content == "/tw": webbrowser.open("https://www.twitter.com")

It should display:

downloaded webbrowser from path/path/... (<-- just an example)

But then that comes:

error, can`t find a module named webbrowser.py

or

error, can`t download webbrowser.py

When I include Lib/webbrowser.py:

Lib/webbrowser.py seems like a path. Is it really one?

Or, when the build failed:

Could not find a version that satisfies the requirement webbrowser

The imports i used in the project:

  • discord
  • webbrowser
  • time
  • asyncio

The modules in the requirements.txt(without the webbrowser module):

1
Show us your imports. - Patrick Haugh
You don't need to add modules from the standard library to your requirements.txt. Have you tried leaving it out of that file and just including the import in your code? - Patrick Haugh
But then then the website doesnt open/the command doesnt work. The heroku logs also dont show any further information - Luis Leuppi

1 Answers

0
votes

Ok, i know it is late, but the reason why you can't create a command like this is probably about security. Discord just doesn't want you to be able to redirect users to other websites/links. Which, to be honest, makes sense