Perhaps something like this:

(This version isn't much better)
if len(parts) > 3:
    if int(parts[3]) > 5:
        count = 5
    else:
        count = parts[3]
else:
    count = 1
    
===========================
====== OR =================
===========================

(I think this is the more 'pythonic' way of doing it)
try:
    count = int(parts[3])
    if count > 5:     # limit to 5 to avoid spam
        count = 5
except IndexError:
    count = 1

Thoughts?