You can use:
did -v chan_modes $replacecs(%chanmodes,c,3,i,4,m,5,n,6,p,7,r,8,s,9,t,10,z,11,A,12,C,13,G,14,M,15,K,16,N,17,O,18,Q,19,R,20,S,21,T,22,V,23,u,24)
etc...instead of a bunch of vertical if statements.