MagicMirror Forum

    • Register
    • Login
    • Search
    • Recent
    • Tags
    • Unsolved
    • Solved
    • MagicMirror² Repository
    • Documentation
    • Donate
    • Discord
    1. Home
    2. mediathreat
    • Profile
    • Following 0
    • Followers 0
    • Topics 5
    • Posts 17
    • Best 2
    • Controversial 0
    • Groups 0

    mediathreat

    @mediathreat

    2
    Reputation
    728
    Profile views
    17
    Posts
    0
    Followers
    0
    Following
    Joined Last Online

    mediathreat Unfollow Follow

    Best posts made by mediathreat

    • RE: Easy Twitter feed

      how do you show more than one entry from the RSS feed?

      posted in General Discussion
      mediathreat
      mediathreat
    • RE: Box/Frame around module

      @broberg whoa you just opened a whole new world of customization for me thanks dude!

      posted in Development
      mediathreat
      mediathreat

    Latest posts made by mediathreat

    • Would it be cool to add a way to add MAME to Magic Mirror?

      I wonder if there is a way to add a MAME game to the css/html on Magic Mirror or at least do a temp video overlay to play mame here and there on a magic mirror.

      I know we mostly use it for information, but it might be cool to be able to bring up a quick mame session for cool factor and for fun. Galaxian on a mirror could be kinda awesome right before work.

      posted in Feature Requests
      mediathreat
      mediathreat
    • How can I inject some CSS styles in a block of text in Javascript so I can differentiate two different blocks of text

      Hi I’m kludging some code together, how Can i inject some CSS into this terrible piece of javascript I hacked together. I want to style the elements so that the title is different from the text. Here is what my screen looks like now - its the center piece about Super Troopers:

      alt text
      Id love to bold out "super troopers paul soter is a nimbly-bimly adman as a title to seperate it from the rest of it which is the text/description part.

      Here’s my code block that generates this:

      var ratio = Math.min(200 / Number(fix_width) , 200 / Number(fix_height));
      		var width = fix_width*ratio;
      		var height = fix_height*ratio;
      		var messageElement = document.createElement('div');
      		messageElement.className = 'light medium';
      		messageElement.innerHTML = "<table><tr><td><img src=" + image_bed + " /></td><td>" +  this.slackMessages[0].title + "</td></tr><tr><td>" + this.slackMessages[0].text + "</td></tr></table>";
      		}
      		return messageElement;
      
      
      posted in Development
      mediathreat
      mediathreat
    • RE: Attempt to Rebuild MMM-Slack with media handling, includes dont seem to load

      Actually the fix above got the whole thing working and I was able to strip the code down quite a bit with the new simpler function calls. Thank you! I hope to have a updated module posted to the forum soon from github

      @strawberry-3.141 said in Attempt to Rebuild MMM-Slack with media handling, includes dont seem to load:

      @mediathreat dou you have it in your local node_modules folder?

      posted in Development
      mediathreat
      mediathreat
    • RE: Attempt to Rebuild MMM-Slack with media handling, includes dont seem to load

      @strawberry-3.141 oops thanks for that, yeah- i cut and paste in two sections and forgot that part.

      Is there a way I can check to debug why it wont load the

      var RtmClient = require(‘@slack/client’).RTMClient;

      posted in Development
      mediathreat
      mediathreat
    • Attempt to Rebuild MMM-Slack with media handling, includes dont seem to load

      I’m banging my head to rewrite the MMM-Slack module to unfurl links and media shared on slack onto the screen using the most current version of @slack node sdk. My first test code run from node seems to work lovely:

      var NodeHelper = require('node_helper');
      var RtmClient = require('@slack/client').RTMClient;
      // Not sure we need this:
      // var CLIENT_EVENTS = require('@slack/client').CLIENT_EVENTS;
      // These hold the variables for us to extra the message data
      
      // at some point this needs to come from the config
      var rtm = new RtmClient('xxxxxxKEY_REDACTEDxxxxx');
      console.log(RtmClient);
      rtm.start();
      
      let channel;
      
      rtm.on('authenticated', (rtmStartData) => {
        console.log('connected');
      });
      
      rtm.on('message', function(message) {
          console.log(message.message);
      });
      
      
      rtm.on('slack_event', function(event) {
          console.log(event);
       });
      

      i get a nice output of the messages from slack in JSON, however when i use similiar code to send notifications to the new module in node_helper.js. rtm is never defined! my debug has led me to it not even being defined.included at the top. Here’s my code for the stripped version:

      var NodeHelper = require("node_helper");
      var RtmClient = require('@slack/client').RtmClient;
      // Not sure we need this:
      var CLIENT_EVENTS = require('@slack/client').CLIENT_EVENTS;
      var userName = '';
      var messageText = '';
      var messages = [];
      
      module.exports = NodeHelper.create({
              start: function () {
                      //this.config = {}
              },
      
              socketNotificationReceived: function (notification, payload) {
                      if (notification === 'START_CONNECTION') {
                              // startslackconnects sends config to front end
                              this.config = payload;
                              //this.sendSocketNotification(notification , payload);
                              this.startSlackConnection(payload);
                      }
              },
      
              startSlackConnection: function(config) {
                      var self = this;
                      var token = config.config.slackToken;
                      var rtm = new RtmClient('xxxREDACTED KEY');
                     //  this.sendSocketNotification('SIGN IN' , rtm);  this shows NULL on the front end!
      
                      rtm.start();
      
                      let channel;
      
                      rtm.on('authenticated', (rtmStartData) => {
                              this.sendSocketNotifcation('AUTH' , "CONNECTED");
                      });
      
                      rtm.on('message', function(message) {
                              this.sendSocketNotifcation('SLACK_DATA' , message);
                      });
                    rtm.on('slack_event',  function(event) {
      
                              this.sendSocketNotifcation('SLACK_DATA' , event);
                      });
      
              }
      
      
      });
      
      

      I did noticed that a directory structure for the updated @slack/client is different than the one from the original module (and it doesnt have a index.js in the top directory. I dont know if that has anything to do with it. I have the old version in the original MMM-Slack directory and that works fine. As I mentioned before when i run the version above from the command line , it works fine - defining rtm (RtmClient) and using it to connect and pull data, but once i try the same code in node_helper.js as the second piece of code… no go. rtm is blank and no data is found.

      It sends all data to the front end sucessfully wether its the payload is full or not, I’m just coming up Null or worse with trying to include the slack/client

      Any ideas where I can start looking to fix this?

      posted in Development
      mediathreat
      mediathreat
    • RE: MagicMirror in Slack ... we'll see you there.

      i got the error too… limit for invites reached

      posted in MagicMirror
      mediathreat
      mediathreat
    • RE: MMM-Slack stop randomise messages

      @saibam 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?

      posted in Troubleshooting
      mediathreat
      mediathreat
    • RE: Request a Twitterfeed

      I rewrote a new twitterfeed module, right now based on a RSS Feed… I’ll post it soon!

      posted in Requests
      mediathreat
      mediathreat
    • RE: Box/Frame around module

      @broberg whoa you just opened a whole new world of customization for me thanks dude!

      posted in Development
      mediathreat
      mediathreat
    • RE: Box/Frame around module

      @strawberry-3.141 where would that custom.css go? which directory? in the module directory?

      posted in Development
      mediathreat
      mediathreat