correct sentence

Hello!
This sentence: " My deskmate is usually talkative and lively but there are moments when he is bad-tempered and selfish." is correct?( grammatically speaking )
Thank you for your time!

Yes, it’s OK. You could consider putting a comma before “but”. The word “deskmate” does not seem to be listed in many (or any) dictionaries, but it’s clear enough what it means.

May I be permitted to point out that it is incorrect to insert a space after an opening quote, after an opening bracket, or before a closing bracket.