Ok, now i know what your problem is. You're using discord.py and everytime when you write a message you trigger the event onMessage so you create everytime a new Variable named "counter" with 0 and then you increase it to 1 but the counter int is never saved. A fix for this is some kind of data source. You could try to save the number everytime e.g. in a txt file. That should make it work (Code):
counter = 0
# What the Message should start with
if message.content.startswith('Text'):
# Try to read the file, if it is not existing create it with 0 as number in it.
try:
f = open("counter.txt", "r")
# Set the content of the text file as counter int
counter = int(f.readline())
except:
f = open("counter.txt", "a")
f.write(str(0))
# Add a Number to the Counter
counter += 1
# Overwrite the current Number with the New Number
f = open("counter.txt", "w")
f.write(str(counter))
# Send a Message with a certain String (Test! in this case and the Int
# that got counted up)
await message.channel.send('Test! ' + str(counter))