I *think* bettas have a 6 month memory, but I could be wrong.
Bettas are very intelligent inquisitive creatures and each has their own unique personality. My boy, for example is flare-happy but non-aggressive and placid towards the shrimps he lives with. (He also thinks he's the prettiest thing in the world and is a show-off).
Yes, it's true you can condition a betta to do trick for food, but you do the same with dogs, cats, and even humans are conditioned and can be conditioned to respond to certain things (I know people who have conditioned their roommates with popcorn).
Also, bettas can, and do, feel pain. Why do you think they thrash about when they're out of water and suffocating, or clamp their fins when they're sick? They can feel it, and don't like it one bit.