<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"><channel><title><![CDATA[MMM-Slack stop randomise messages]]></title><description><![CDATA[<p dir="auto">I am trying to get rid of the randomiser in MMM-Slack module. I want the messages to show in order from oldest to newest. I’m sure I’m approaching it the wrong way but I just can’t get it to work without the randomiser. Pls help!</p>
]]></description><link>https://forum.magicmirror.builders/topic/6356/mmm-slack-stop-randomise-messages</link><generator>RSS for Node</generator><lastBuildDate>Wed, 09 Sep 2026 19:49:06 GMT</lastBuildDate><atom:link href="https://forum.magicmirror.builders/topic/6356.rss" rel="self" type="application/rss+xml"/><pubDate>Tue, 23 Jan 2018 08:59:52 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to MMM-Slack stop randomise messages on Thu, 05 Apr 2018 12:02:05 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/mediathreat" aria-label="Profile: mediathreat">@<bdi>mediathreat</bdi></a> I think it is possible, as long as the images have some kind of html address or similar, but I have no idea how to do it. I’ve moved on to other projects now :) almost finished an arcade cabinet :D</p>
]]></description><link>https://forum.magicmirror.builders/post/37982</link><guid isPermaLink="true">https://forum.magicmirror.builders/post/37982</guid><dc:creator><![CDATA[saibam]]></dc:creator><pubDate>Thu, 05 Apr 2018 12:02:05 GMT</pubDate></item><item><title><![CDATA[Reply to MMM-Slack stop randomise messages on Wed, 04 Apr 2018 02:49:50 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/saibam" aria-label="Profile: saibam">@<bdi>saibam</bdi></a> do you think its possible to modify the code to get images or links that are posted into the slack channel and display them on the magic mirror?</p>
]]></description><link>https://forum.magicmirror.builders/post/37910</link><guid isPermaLink="true">https://forum.magicmirror.builders/post/37910</guid><dc:creator><![CDATA[mediathreat]]></dc:creator><pubDate>Wed, 04 Apr 2018 02:49:50 GMT</pubDate></item><item><title><![CDATA[Reply to MMM-Slack stop randomise messages on Wed, 28 Mar 2018 01:40:45 GMT]]></title><description><![CDATA[<p dir="auto">Thanks! This nailed it perfectly! Hopefully the MMM-SLACK package maintainer might add this info to be clearer. Now that I have it working, I wonder if I can go in and see if I can add showing photos from a slack channel to the code base</p>
]]></description><link>https://forum.magicmirror.builders/post/37504</link><guid isPermaLink="true">https://forum.magicmirror.builders/post/37504</guid><dc:creator><![CDATA[mediathreat]]></dc:creator><pubDate>Wed, 28 Mar 2018 01:40:45 GMT</pubDate></item><item><title><![CDATA[Reply to MMM-Slack stop randomise messages on Tue, 27 Mar 2018 11:42:43 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/mediathreat" aria-label="Profile: mediathreat">@<bdi>mediathreat</bdi></a> here is the correct link to create your token: <a href="https://api.slack.com/custom-integrations/legacy-tokens" target="_blank" rel="noopener noreferrer nofollow ugc">https://api.slack.com/custom-integrations/legacy-tokens</a></p>
]]></description><link>https://forum.magicmirror.builders/post/37478</link><guid isPermaLink="true">https://forum.magicmirror.builders/post/37478</guid><dc:creator><![CDATA[saibam]]></dc:creator><pubDate>Tue, 27 Mar 2018 11:42:43 GMT</pubDate></item><item><title><![CDATA[Reply to MMM-Slack stop randomise messages on Tue, 27 Mar 2018 10:15:59 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/mediathreat" aria-label="Profile: mediathreat">@<bdi>mediathreat</bdi></a> we followed the link in the readme <a href="https://api.slack.com/tokens" target="_blank" rel="noopener noreferrer nofollow ugc">https://api.slack.com/tokens</a> and from there we created our own app. I’m sorry I can’t find where I found the token in there, you will have to try and error your way :) I will keep looking some but can’t guarantee I find anything. Slack API pages are a mess imo.  And no you don’t need the leading # in the config file.</p>
]]></description><link>https://forum.magicmirror.builders/post/37475</link><guid isPermaLink="true">https://forum.magicmirror.builders/post/37475</guid><dc:creator><![CDATA[saibam]]></dc:creator><pubDate>Tue, 27 Mar 2018 10:15:59 GMT</pubDate></item><item><title><![CDATA[Reply to MMM-Slack stop randomise messages on Fri, 23 Mar 2018 00:23:18 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/saibam" aria-label="Profile: saibam">@<bdi>saibam</bdi></a>  Which Slack token do you use to connect to slack and do you have to put the leading # hash sign in the config file for the channel where it listens?</p>
]]></description><link>https://forum.magicmirror.builders/post/37316</link><guid isPermaLink="true">https://forum.magicmirror.builders/post/37316</guid><dc:creator><![CDATA[mediathreat]]></dc:creator><pubDate>Fri, 23 Mar 2018 00:23:18 GMT</pubDate></item><item><title><![CDATA[Reply to MMM-Slack stop randomise messages on Tue, 30 Jan 2018 09:14:41 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/gekberlin" aria-label="Profile: gekberlin">@<bdi>gekberlin</bdi></a> Yes.</p>
<pre><code>currentMessage = emoji_replace(currentMessage);
</code></pre>
<p dir="auto">will not work as emoji_replace is my own function for replacing :smiley: with an emoji.<br />
so just get rid of that line and it will work.</p>
<p dir="auto">And you will also have to instantiate currentMessageId and currentMessageCount globally. I.e.</p>
<pre><code>var currentMessageId = 0
var currentMessageCount = 0
</code></pre>
<p dir="auto">at the top of the js file.</p>
]]></description><link>https://forum.magicmirror.builders/post/34939</link><guid isPermaLink="true">https://forum.magicmirror.builders/post/34939</guid><dc:creator><![CDATA[saibam]]></dc:creator><pubDate>Tue, 30 Jan 2018 09:14:41 GMT</pubDate></item><item><title><![CDATA[Reply to MMM-Slack stop randomise messages on Mon, 29 Jan 2018 18:17:26 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/saibam" aria-label="Profile: saibam">@<bdi>saibam</bdi></a> Thanks for your fast reply!<br />
I’ve put in the code but then I didn’t get any message displayed anymore.<br />
Did I have done something wrong ?</p>
<pre><code>	getDom: function() {
		var messageElement = document.createElement('div');
		if (currentMessageCount &lt; this.slackMessages.length || currentMessageCount == 0){
	currentMessageId = 0;
	currentMessageCount = this.slackMessages.length;
}
var maxAllowed = 5;
var topMessages = this.slackMessages.slice(0, (maxAllowed 0));
var maxCount = Math.min(maxAllowed, topMessages.length);
if (currentMessageId == maxCount 0) { currentMessageId = 0; }
var currentMessage = topMessages[currentMessageId].message;
currentMessage = emoji_replace(currentMessage);
messageElement.innerHTML = currentMessage;
currentMessageId ++;
		}
		return messageElement;
	}
});

</code></pre>
]]></description><link>https://forum.magicmirror.builders/post/34886</link><guid isPermaLink="true">https://forum.magicmirror.builders/post/34886</guid><dc:creator><![CDATA[gekberlin]]></dc:creator><pubDate>Mon, 29 Jan 2018 18:17:26 GMT</pubDate></item><item><title><![CDATA[Reply to MMM-Slack stop randomise messages on Mon, 29 Jan 2018 09:01:50 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/gekberlin" aria-label="Profile: gekberlin">@<bdi>gekberlin</bdi></a> Yes. Change maxAllowed to 5. Put it in MMM-Slack.js under the getDom: function() where it creates the html elements. I also noticed that it didnt work as expected where I had (maxCount -1) and (maxAllowed - 1). I removed the -1 and it worked like a charm.</p>
]]></description><link>https://forum.magicmirror.builders/post/34862</link><guid isPermaLink="true">https://forum.magicmirror.builders/post/34862</guid><dc:creator><![CDATA[saibam]]></dc:creator><pubDate>Mon, 29 Jan 2018 09:01:50 GMT</pubDate></item><item><title><![CDATA[Reply to MMM-Slack stop randomise messages on Sun, 28 Jan 2018 17:18:51 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/saibam" aria-label="Profile: saibam">@<bdi>saibam</bdi></a> That sounds pretty good. I wanted to achive the same for the last 5 messages. So i would simpley exchange the 10 for a 5. But where do I have to put the code into ? In the mmm-slack.js ?<br />
I would relay appreciate any help.</p>
]]></description><link>https://forum.magicmirror.builders/post/34815</link><guid isPermaLink="true">https://forum.magicmirror.builders/post/34815</guid><dc:creator><![CDATA[gekberlin]]></dc:creator><pubDate>Sun, 28 Jan 2018 17:18:51 GMT</pubDate></item><item><title><![CDATA[Reply to MMM-Slack stop randomise messages on Wed, 24 Jan 2018 09:10:41 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/ninjabreadman" aria-label="Profile: ninjabreadman">@<bdi>ninjabreadman</bdi></a> thanks for the answer but this will only show the latest message. I solved it in a rather long but still nice way. The idea is to show the latest 10 messages and when a new message is sent it will show it instantly.<br />
currentMessageCount and currentMessgeId are global variables instantiated to 0. emoji_replace is my own function to include emojis in the message.</p>
<pre><code>if (currentMessageCount &lt; this.slackMessages.length || currentMessageCount == 0){ 
	currentMessageId = 0;
	currentMessageCount = this.slackMessages.length;
}
var maxAllowed = 10;
		
var topMessages = this.slackMessages.slice(0, (maxAllowed - 1));
		
var maxCount = Math.min(maxAllowed, topMessages.length);
		
if (currentMessageId == maxCount - 1) { currentMessageId = 0; }
		
var currentMessage = topMessages[currentMessageId].message;
currentMessage = emoji_replace(currentMessage);
messageElement.innerHTML = currentMessage;
currentMessageId ++;
</code></pre>
]]></description><link>https://forum.magicmirror.builders/post/34589</link><guid isPermaLink="true">https://forum.magicmirror.builders/post/34589</guid><dc:creator><![CDATA[saibam]]></dc:creator><pubDate>Wed, 24 Jan 2018 09:10:41 GMT</pubDate></item><item><title><![CDATA[Reply to MMM-Slack stop randomise messages on Tue, 23 Jan 2018 14:49:26 GMT]]></title><description><![CDATA[<p dir="auto">Hi <a class="plugin-mentions-user plugin-mentions-a" href="/user/saibam" aria-label="Profile: saibam">@<bdi>saibam</bdi></a>,</p>
<p dir="auto">Just change:</p>
<pre><code>var randomMessageId = Math.floor(Math.random() * this.slackMessages.length);
</code></pre>
<p dir="auto">to the following:</p>
<pre><code>var randomMessageId = 0;
</code></pre>
<p dir="auto">It should work (unrandomizing the order), so long as the <code>slackMessages</code> array is in ascending order. <em>If not, and it’s in descending order, set to <code>this.slackMessages.length - 1</code> instead of <code>0</code>.</em></p>
]]></description><link>https://forum.magicmirror.builders/post/34537</link><guid isPermaLink="true">https://forum.magicmirror.builders/post/34537</guid><dc:creator><![CDATA[ninjabreadman]]></dc:creator><pubDate>Tue, 23 Jan 2018 14:49:26 GMT</pubDate></item><item><title><![CDATA[Reply to MMM-Slack stop randomise messages on Tue, 23 Jan 2018 12:01:09 GMT]]></title><description><![CDATA[<pre><code>if(this.slackMessages.length &gt; 0) {
     var randomMessageId = Math.floor(Math.random() * this.slackMessages.length);
     var randomMessage = this.slackMessages[randomMessageId].message;
</code></pre>
<p dir="auto">I want just ‘x’ instead of the ‘randomMessageId’ on the last line and can’t figure out how to do it.</p>
]]></description><link>https://forum.magicmirror.builders/post/34528</link><guid isPermaLink="true">https://forum.magicmirror.builders/post/34528</guid><dc:creator><![CDATA[saibam]]></dc:creator><pubDate>Tue, 23 Jan 2018 12:01:09 GMT</pubDate></item></channel></rss>