So the thing is I have a github repo for my discord bot, and every time a message is sent in the server, the json file along that code is supposed to be updated, but it does not get updated after every refresh... Now is it due to the traffic of the github databases, or does the json file get updated only on the server of the bot(in my case, its heroku) and not in the github?
The file that's on your Heroku server is independent of GitHub.  Even if your Heroku instance is a Git repository, that Git repository is independent of the one on GitHub.  In order to get the JSON file from the repository on Heroku to GitHub, you'd have to add and commit the file, make sure that GitHub was added as a remote, and then push, using a suitable set of credentials.
However, having said that, you probably don't want to do that.  Data files, like your JSON file, don't belong in repositories.  Code repositories are best suited to storing your code and the data it operates on should be stored elsewhere, such as in a database or in a set of files.
Does the json file in a github repository require time to be updated?