rearranging and experiments
This commit is contained in:
		
							parent
							
								
									11e5cd7f77
								
							
						
					
					
						commit
						6990957c9e
					
				
					 12 changed files with 156 additions and 26 deletions
				
			
		
							
								
								
									
										26
									
								
								d2m/converters/message-to-event.js
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										26
									
								
								d2m/converters/message-to-event.js
									
										
									
									
									
										Normal file
									
								
							| 
						 | 
				
			
			@ -0,0 +1,26 @@
 | 
			
		|||
// @ts-check
 | 
			
		||||
 | 
			
		||||
const markdown = require("discord-markdown")
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * @param {import("discord-api-types/v10").APIMessage} message
 | 
			
		||||
 * @returns {import("../../types").M_Room_Message_content}
 | 
			
		||||
 */
 | 
			
		||||
module.exports = function(message) {
 | 
			
		||||
	const body = message.content
 | 
			
		||||
	const html = markdown.toHTML(body, {
 | 
			
		||||
		discordCallback: {
 | 
			
		||||
			user: Function,
 | 
			
		||||
			channel: Function,
 | 
			
		||||
			role: Function,
 | 
			
		||||
			everyone: Function,
 | 
			
		||||
			here: Function
 | 
			
		||||
		}
 | 
			
		||||
	}, null, null)
 | 
			
		||||
	return {
 | 
			
		||||
		msgtype: "m.text",
 | 
			
		||||
		body: body,
 | 
			
		||||
		format: "m.custom.html",
 | 
			
		||||
		formatted_body: html
 | 
			
		||||
	}
 | 
			
		||||
}
 | 
			
		||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue