• If you need help or want to discuss things, you now can also join us on our Discord Server!
  • A first preview of the unlimited version of SinusBot can be found in the Upcoming Changes thread. A version for Windows will follow, but we don't have a release date, yet.

Bug Recording Issue

Status
Not open for further replies.

Gleydar

New Member
Hello, I have recently tried to implement recording on command with the bot. This is the basic Code I use so far:
Code:
function(sinusbot, config) {
    var recording = false;
    var engine = require('engine');
    var audio = require('audio');
    var event = require('event');

    sinusbot.on('chat', function(ev)
    {
        var users = config.AllowedUsers.split(",");
        if(ev.msg == config.RecordingCmd) {
            for(var i = 0; i < users.length; i++) {
                var uid = users[i];
                if(ev.clientUid == uid) {
                    if(!recording) {
                        sinusbot.setARC(0x01);
                        audio.startRecording();
                        recording = true;
                        engine.log("Starting to record because of " + ev.clientUid);
                    } else {
                        audio.stopRecording();
                        recording = false;
                        engine.log("Stopped recording because of " + ev.clientUid);
                    }
                }
            }
        }
    });
});
The file for the recording is created as expected, but it stays at one kb and doesn't grow at all, even when the bot is playing audio.
Does anyone of you have experience with that kind of stuff? Maybe even implemented recording? I would be happy about any help! Thanks in advance!
 

mxschmitt

Moderator
Staff member
is awesome!
V.I.P.
is uber awesome!
Contributor
Insider
Try to use the new scripting engine. The old one (which uses sinusbot.* functions is the old one | try to not use any sinusbot. function) will not be maintained and removed in the future. Good luck ;)
 

Gleydar

New Member
I tried to do it using the audio one, but that doesn't seem to work either, sadly :/ (It should still record the Bots audio, right?)
Code:
event.on('chat', function(ev)
    {
        var users = config.AllowedUsers.split(",");
        if(ev.text == config.RecordingCmd) {
            for(var i = 0; i < users.length; i++) {
                var uid = users[i];
                if(ev.client.uid() == uid) {
                    if(!recording) {
                        audio.setAudioReturnChannel(true);
                        audio.startRecording();
                        recording = true;
                        engine.log("Starting to record because of " + ev.clientUid);
                    } else {
                        audio.setAudioReturnChannel(false);
                        audio.stopRecording();
                        recording = false;
                        engine.log("Stopped recording because of " + ev.clientUid);
                    }
                }
            }
        }
    });
I am now using this code, the problem, however, is the same
 
Last edited:

Gleydar

New Member
As I wrote in my updated version of the post, I already tried that approach :/ The bot seems to open and close the audio channels correctly, as it displays him recording/not recording on the server. Just, apparently, the data is not written to the file correctly, as it doesn't grow at all. Maybe @flyth, can you help here?
 
Last edited:

Gleydar

New Member
Okay, this doesn't seem to be a bug at all, just oddly connected behavior. You need to set EnableWebstream in the config.ini file to true, as the two functions are tied together. Thanks to flyth for his help!
 
Status
Not open for further replies.
Top