@@ -141,13 +141,13 @@ def parse_tokens_generator(
141141
142142 # user mentions
143143 if LexingRule .USER_MENTION in current_token :
144- yield Node (NodeType .USER , id = int (current_token .groups [0 ]))
144+ yield Node (NodeType .USER , id = int (current_token .groups [0 ]), content = current_token . value )
145145 i += 1
146146 continue
147147
148148 # role mentions
149149 if LexingRule .ROLE_MENTION in current_token :
150- yield Node (NodeType .ROLE , id = int (current_token .groups [0 ]))
150+ yield Node (NodeType .ROLE , id = int (current_token .groups [0 ]), content = current_token . value )
151151 i += 1
152152 continue
153153
@@ -156,23 +156,25 @@ def parse_tokens_generator(
156156 yield Node (
157157 NodeType .TIMESTAMP ,
158158 id = int (current_token .groups [0 ]),
159- content = current_token .groups [1 ],
159+ code_lang = current_token .groups [1 ],
160+ content = current_token .value ,
160161 )
161162 i += 1
162163 continue
163164
164165 # channel mentions
165166 if LexingRule .CHANNEL_MENTION in current_token :
166- yield Node (NodeType .CHANNEL , id = int (current_token .groups [0 ]))
167+ yield Node (NodeType .CHANNEL , id = int (current_token .groups [0 ]), content = current_token . value )
167168 i += 1
168169 continue
169170
170171 # slash commands
171172 if LexingRule .SLASH_COMMAND_MENTION in current_token :
172173 yield Node (
173174 NodeType .SLASH_COMMAND ,
174- content = current_token .groups [0 ],
175+ code_lang = current_token .groups [0 ],
175176 id = int (current_token .groups [1 ]),
177+ content = current_token .value ,
176178 )
177179 i += 1
178180 continue
@@ -183,7 +185,8 @@ def parse_tokens_generator(
183185 yield Node (
184186 NodeType .EMOJI_CUSTOM ,
185187 id = emoji_id ,
186- content = current_token .groups [0 ],
188+ content = current_token .value ,
189+ code_lang = current_token .groups [0 ],
187190 url = f"https://cdn.discordapp.com/emojis/{ emoji_id } .png"
188191 )
189192 i += 1
@@ -195,7 +198,8 @@ def parse_tokens_generator(
195198 yield Node (
196199 NodeType .EMOJI_CUSTOM_ANIMATED ,
197200 id = emoji_id ,
198- content = current_token .groups [0 ],
201+ code_lang = current_token .groups [0 ],
202+ content = current_token .value ,
199203 url = f"https://cdn.discordapp.com/emojis/{ emoji_id } .gif"
200204 )
201205 i += 1
@@ -217,32 +221,47 @@ def parse_tokens_generator(
217221 if LexingRule .EMOJI_UNICODE_ENCODED in current_token :
218222 yield Node (
219223 NodeType .EMOJI_UNICODE_ENCODED ,
220- content = current_token .groups [0 ],
224+ content = current_token .value ,
225+ code_lang = current_token .groups [0 ],
221226 )
222227 i += 1
223228 continue
224229
225230 # URL with preview embedded
226231 if LexingRule .URL_WITH_PREVIEW_EMBEDDED in current_token :
227- yield Node (NodeType .URL_WITH_PREVIEW_EMBEDDED , url = current_token .groups [1 ], content = current_token .groups [0 ])
232+ yield Node (
233+ NodeType .URL_WITH_PREVIEW_EMBEDDED ,
234+ url = current_token .groups [1 ],
235+ code_lang = current_token .groups [0 ],
236+ content = current_token .value ,
237+ )
228238 i += 1
229239 continue
230240
231241 # URL without preview
232242 if LexingRule .URL_WITHOUT_PREVIEW_EMBEDDED in current_token :
233- yield Node (NodeType .URL_WITHOUT_PREVIEW_EMBEDDED , url = current_token .groups [1 ], content = current_token .groups [0 ])
243+ yield Node (
244+ NodeType .URL_WITHOUT_PREVIEW_EMBEDDED ,
245+ url = current_token .groups [1 ],
246+ code_lang = current_token .groups [0 ],
247+ content = current_token .value ,
248+ )
234249 i += 1
235250 continue
236251
237252 # URL with preview
238253 if LexingRule .URL_WITH_PREVIEW in current_token :
239- yield Node (NodeType .URL_WITH_PREVIEW , url = current_token .value )
254+ yield Node (
255+ NodeType .URL_WITH_PREVIEW ,
256+ url = current_token .value ,
257+ content = current_token .value ,
258+ )
240259 i += 1
241260 continue
242261
243262 # URL without preview
244263 if LexingRule .URL_WITHOUT_PREVIEW in current_token :
245- yield Node (NodeType .URL_WITHOUT_PREVIEW , url = current_token .value [1 :- 1 ])
264+ yield Node (NodeType .URL_WITHOUT_PREVIEW , url = current_token .value [1 :- 1 ], content = current_token . value )
246265 i += 1
247266 continue
248267
0 commit comments