Recherche avancée

Médias (0)

Mot : - Tags -/interaction

Aucun média correspondant à vos critères n’est disponible sur le site.

Autres articles (93)

  • Amélioration de la version de base

    13 septembre 2013

    Jolie sélection multiple
    Le plugin Chosen permet d’améliorer l’ergonomie des champs de sélection multiple. Voir les deux images suivantes pour comparer.
    Il suffit pour cela d’activer le plugin Chosen (Configuration générale du site > Gestion des plugins), puis de configurer le plugin (Les squelettes > Chosen) en activant l’utilisation de Chosen dans le site public et en spécifiant les éléments de formulaires à améliorer, par exemple select[multiple] pour les listes à sélection multiple (...)

  • Le plugin : Gestion de la mutualisation

    2 mars 2010, par

    Le plugin de Gestion de mutualisation permet de gérer les différents canaux de mediaspip depuis un site maître. Il a pour but de fournir une solution pure SPIP afin de remplacer cette ancienne solution.
    Installation basique
    On installe les fichiers de SPIP sur le serveur.
    On ajoute ensuite le plugin "mutualisation" à la racine du site comme décrit ici.
    On customise le fichier mes_options.php central comme on le souhaite. Voilà pour l’exemple celui de la plateforme mediaspip.net :
    < ?php (...)

  • Gestion de la ferme

    2 mars 2010, par

    La ferme est gérée dans son ensemble par des "super admins".
    Certains réglages peuvent être fais afin de réguler les besoins des différents canaux.
    Dans un premier temps il utilise le plugin "Gestion de mutualisation"

Sur d’autres sites (10962)

  • Need help to create a queue system with a discord.py bot

    19 août 2024, par Zamv

    im trying to create a bot with discord.py, i'll start saying that the bot is for personal use so please don't point out that i shouldn't use ydl in the comments, ty :&#xA;Also, im a beginner, so please tell me what I can improve and any errors there are, I will be happy to listen.&#xA;That said, i've been stuck on trying to create this queue system for songs for the past 3 days, the bot was working perfectly fine and played some urls before i implemented the play_next function, now it doesn't even play the first song, even if it sends confirmation messages both in the terminal that in the discord channel, i know that the code might be a little confusing, but please i really need to know how to make this work

    &#xA;

    i wrote two main functions : "play_next" to play the next song in the queue and "play", the main command.&#xA;Here is my play_next function :

    &#xA;

    async def play_next(self,ctx):&#xA;        if not ctx.voice_client.is_playing: #(don&#x27;t know if this is correct as I also check if the bot isn&#x27;t                     playing anything in the play function)&#xA;            &#xA;            if self.song.queue: &#xA;                next_song = self.song_queue.pop(0) #deleting the first element of the queue, so if we have (song_0, song_1 and song_2) the bot should delete (song_0) making in fact song_1 the "next" song_0&#xA;                try:&#xA;                    ctx.voice_client.play(discord.FFmpegPCMAudio(next_song), &#xA;                                          after=lambda e: self.bot.loop.create_task(self.play_next(ctx))) #Not gonna lie here, i asked chat gpt for this line, it should make the bot automatically play the next song one after another, correct me if I am wrong&#xA;&#xA;#this is not important&#xA;                    embed = discord.Embed(&#xA;                        title="Song",&#xA;                        description=f"Now playing {next_song}",&#xA;                        color = 0x1DB954&#xA;                    )&#xA;                    await ctx.send(embed=embed)&#xA;                except Exception as e:&#xA;                    print(f"Error playing the next song: {e}")&#xA;&#xA;            else:&#xA;                await ctx.voice_client.disconnect()  # disconnecting from the voice channel if the queue is empty&#xA;                print("Disconnected from the voice channel as the queue is empty.")&#xA;

    &#xA;

    I think that the main problem of my bot is the play_next function, but here it is my "play" function :

    &#xA;

        @commands.command(pass_context=True)&#xA;    async def play(self, ctx, url: str):  &#xA;        if ctx.author.voice:  # first checking if the user is in a voice channel&#xA;            if not ctx.voice_client: #then checking if the bot is already connected to a voice channel&#xA;                channel = ctx.message.author.voice.channel &#xA;                try:&#xA;                    await channel.connect()  #then joining&#xA;                    print("I joined the voice channel!")&#xA;                except Exception as e:&#xA;                    print(f"Failed to connect to the voice channel: {e}")&#xA;                    return&#xA;&#xA;            song_path = f"song_{self.song_index}.mp3" #note, im using cogs, i declared self.song_index with the value of 0 &#xA;            self.song_index &#x2B;= 1 #i thought that this was the easiest way of creating a new file for each song&#xA;&#xA;            ydl_opts = {&#xA;                &#x27;format&#x27;: &#x27;bestaudio/best&#x27;,&#xA;                &#x27;postprocesors&#x27;: [{&#xA;                    &#x27;key&#x27;: &#x27;FFmpegExtractAudio&#x27;,&#xA;                    &#x27;preferredcodec&#x27;: &#x27;mp3&#x27;,&#xA;                    &#x27;preferredquality&#x27;: &#x27;192&#x27;,&#xA;                }],&#xA;                &#x27;outtmpl&#x27;: song_path&#xA;            }&#xA;            try:&#xA;                with youtube_dl.YoutubeDL(ydl_opts) as ydl:&#xA;                    print("Starting download...")&#xA;                    ydl.download([url]) #this is where it should download the song provided by the url&#xA;                    print("Download finished.")&#xA;            except Exception as e:&#xA;                await ctx.send(f"Failed to download the song: {e}")&#xA;                return&#xA;&#xA;#i think that the next two if statements are the main threats&#xA;            if os.path.exists(song_path): #if there is atleast 1 song in the queue&#xA;                self.song_queue.append(song_path) #append the next one&#xA;                embed = discord.Embed(&#xA;                    title="Added to Queue!",&#xA;                    description = f"{url} has been added to the queue.",&#xA;                    color=0x33ff33&#xA;                )&#xA;                await ctx.send(embed=embed)&#xA;&#xA;&#xA;                if not ctx.voice_client.is_playing(): #checking if the bot is already playing something, don&#x27;t know if i should put this if statement here&#xA;                    print("Starting playback...")&#xA;                    await self.play_next(ctx) #if nothing is playing, then the bot should play the next song&#xA;&#xA;&#xA;&#xA;            else:&#xA;                await ctx.send("Failed to download or find the audio file.")&#xA;&#xA;        else:&#xA;            embed = discord.Embed(&#xA;                title="❌You must be in a voice channel",&#xA;                color=0xff6666&#xA;            )&#xA;            await ctx.send(embed=embed)&#xA;

    &#xA;

    thanks in advance, i will try to read and answer any questions as soon as possible

    &#xA;

  • Issues with Discord JS Music Bot

    5 décembre 2020, par Thresio

    I am in the process of creating a Discord bot with JS, giving it management, auto role, etc. I just got to the music section of it and I can't quite figure out whats wrong.

    &#xA;&#xA;

    I believe I have installed FFmpeg correctly, as I have access to it from within the terminal. I have also used npm to bring ytdl-core and opusscript into my program.

    &#xA;&#xA;

    What this should do is make the bot join the chat, then play the Youtube link. Currently, I am not error checking the second argument as I just wanted to get it working initially. I have implemented several different instances of .toString() and String() however it always gives the same error listed below.

    &#xA;&#xA;

    . The program still throws this error :

    &#xA;&#xA;

    TypeError [ERR_INVALID_ARG_TYPE]: The "file" argument must be of type string. Received type object&#xA;TypeError [ERR_INVALID_ARG_TYPE]: The "file" argument must be of type string. Received type object&#xA;&#xA;C:\Users\Thresio&#x27;s PC\Desktop\Discord Bot\node_modules\opusscript\build\opusscript_native_wasm.js:8&#xA;var Module=typeof Module!=="undefined"?Module:{};var moduleOverrides={};var&#xA;key;for(key in Module){if(Module.hasOwnProperty(key))&#xA;{moduleOverrides[key]=Module[key]}}Module["arguments"]=&#xA;[];Module["thisProgram"]="./this.program";Module["quit"]=function(status,toThrow) {throw&#xA;toThrow};Module["preRun"]=[];Module["postRun"]=[];var ENVIRONMENT_IS_WEB=false;var &#xA;ENVIRONMENT_IS_WORKER=false;var ENVIRONMENT_IS_NODE=false;var ENVIRONMENT_HAS_NODE=false;var &#xA;ENVIRONMENT_IS_SHELL=false;ENVIRONMENT_IS_WEB=typeof window==="object";ENVIRONMENT_IS_WORKER=typeof &#xA;importScripts==="function";ENVIRONMENT_HAS_NODE=typeof process==="object"&amp;&amp;typeof &#xA;process.versions==="object"&amp;&amp;typeof &#xA;process.versions.node==="string";ENVIRONMENT_IS_NODE=ENVIRONMENT_HAS_NODE&amp;&amp;!ENVIRONMENT_IS_WEB&amp;&amp;!ENVIRONM&#xA;ENT_IS_WORKER;ENVIRONMENT_IS_SHELL=!ENVIRONMENT_IS_WEB&amp;&amp;!ENVIRONMENT_IS_NODE&amp;&amp;!ENVIRONMENT_IS_WORKER;var&#xA;scriptDirectory="";function locateFile(path){i&#xA;abort(TypeError [ERR_INVALID_ARG_TYPE]: The "file" argument must be of type &#xA;string. Received type object). Build with -s ASSERTIONS=1 for more info. &#xA;

    &#xA;&#xA;

    Here is my code for calling play :

    &#xA;&#xA;

    case &#x27;play&#x27;:&#xA;&#xA;            function play(connection, message){&#xA;                var server = servers[message.guild.id];&#xA;&#xA;                server.dispatcher = connection.playStream(ytdl(server.queue[0], {filter: &#x27;audioonly&#x27;}));&#xA;&#xA;                server.queue.shift();&#xA;&#xA;                server.dispatcher.on(&#x27;end&#x27;, function(){&#xA;                    if(server.queue[0]){&#xA;                        play(connection, message);&#xA;                    }else {&#xA;                        connection.disconnect();&#xA;                    }&#xA;                })&#xA;            }&#xA;&#xA;            if(!args[1]){&#xA;                message.channel.send(&#x27;You need to provide a link!&#x27;);&#xA;                return;&#xA;            }&#xA;&#xA;            if(!message.member.voiceChannel){&#xA;                message.channel.send(&#x27;You must be in a voice channel to play music!&#x27;);&#xA;                return;&#xA;            }&#xA;&#xA;            if(!servers[message.guild.id]) servers[message.guild.id] = {&#xA;                queue: []&#xA;            }&#xA;&#xA;            var server = servers[message.guild.id];&#xA;&#xA;            server.queue.push(args[1]);&#xA;&#xA;            if(!message.guild.voiceConnection) message.member.voiceChannel.join().then(function(connection){&#xA;                play(connection, message);&#xA;            })&#xA;            break;&#xA;

    &#xA;&#xA;

    If anyone could assist with this, I would be very grateful.

    &#xA;&#xA;

    EDIT : I unfortunately never figured out my main issue, but I have now found code that works (unlike mine :/).&#xA;For anyone else having this issue, I suggest using the code found here.&#xA;Works like a charm !

    &#xA;

  • Flutter : Failed assertion : 'file.absolute.existsSync()' : is not true

    11 août 2022, par whatwhatwhat

    In my app, a user can send a file to others in a group chat. First, the user records some audio using their mic. The file is then touched up using FFMPEG. Then, the file is uploaded to Firebase Cloud Storage and if this is successful, a record is written in Firebase Realtime Database.

    &#xA;

    I'm getting the error below when the user records a long audio file and then presses submit. It almost seems as though FFMPEG hasn't finished processing the file...but I thought I used my async/await correctly to make sure that this processing is finished before moving on ?

    &#xA;

    &#xA;

    ##MyAppFile## saveMyAppFileToCloudStorage Error : 'package:firebase_storage/src/reference.dart' : Failed assertion : line 127 pos 12 : 'file.absolute.existsSync()' : is not true.

    &#xA;

    &#xA;

    Psuedo-code :

    &#xA;

      &#xA;
    1. User records audio
    2. &#xA;

    3. Audio file is processed using FFMPEG and the new processed file is created on the user's phone
    4. &#xA;

    5. User hits submit, uploading the file to Cloud Storage and, if successful, writing a record to Realtime Database
    6. &#xA;

    &#xA;

    Order of Functions After User Hits Submit :

    &#xA;

      &#xA;
    1. msgInput.dart -> sendMyAppFile()
    2. &#xA;

    3. msgInput.dart -> prepareMyAppFileForSending()
    4. &#xA;

    5. msgInput.dart -> runFFMPEGHighLow()
    6. &#xA;

    7. message_dao.dart -> sendMyAppFile()
    8. &#xA;

    9. message_dao.dart -> saveMyAppFileToCloudStorage() //ERROR COMES FROM THIS FUNCTION
    10. &#xA;

    &#xA;

    The Code :

    &#xA;

    //msgInput.dart&#xA;Future<void> sendMyAppFile() async {&#xA;    if (sendableMyAppFileExists == 1) {&#xA;      final MyAppFileReadyToBeSent = await prepareMyAppFileForSending();&#xA;&#xA;      if (MyAppFileReadyToBeSent == &#x27;1&#x27;) {&#xA;        messageDao.sendMyAppFile(MyAppFile, filepath, filename); &#xA;      } else {&#xA;      &#xA;      }&#xA;    }&#xA;&#xA;    setState(() {&#xA;      sendableMyAppFileExists = 0;&#xA;    });&#xA;  }&#xA;  &#xA;  Future<string> prepareMyAppFileForSending() async {&#xA;    if (sendableMyAppFileExists == 1) {&#xA;      if (recordedMyAppFileFilterID == &#x27;1&#x27;) {&#xA;&#xA;        await runFFMPEGHighLow(&#x27;1&#x27;); &#xA;&#xA;        return &#x27;1&#x27;;&#xA;      }&#xA;&#xA;      if (recordedMyAppFileFilterID == &#x27;2&#x27;) {&#xA;&#xA;        await runFFMPEGHighLow(&#x27;2&#x27;); &#xA;&#xA;        return &#x27;1&#x27;;&#xA;      }&#xA;    }&#xA;&#xA;    return &#x27;0&#x27;;&#xA;  }&#xA;  &#xA;  Future<void> runFFMPEGHighLow(String filterID) async { &#xA;    if (filterID != &#x27;1&#x27; &amp;&amp; filterID != &#x27;2&#x27;) {&#xA;      return;&#xA;    }&#xA;&#xA;    if (sendableMyAppFileExists == 1) {&#xA;      if (filterID == &#x27;1&#x27;) {&#xA;&#xA;        await FFmpegKit.executeAsync(/*...parms...*/);&#xA;        setState(() {&#xA;          currentMyAppFileFilename = currentMyAppFileFilename &#x2B; &#x27;1.mp3&#x27;; &#xA;        });&#xA;&#xA;      }&#xA;&#xA;      if (filterID == &#x27;2&#x27;) {&#xA;&#xA;        await FFmpegKit.executeAsync(/*...parms...*/);&#xA;        setState(() {&#xA;          currentMyAppFileFilename = currentMyAppFileFilename &#x2B; &#x27;2.mp3&#x27;;&#xA;        });&#xA;&#xA;      }&#xA;    }&#xA;  }&#xA;  &#xA;//message_dao.dart&#xA;void sendMyAppFile(ChatData MyAppFile, String filepath, String filename) {&#xA;    saveMyAppFileToCloudStorage(filepath, filename).then((value) {&#xA;      if (value == true) {&#xA;        saveMyAppFileToRTDB(MyAppFile);&#xA;      }&#xA;    });&#xA;  }&#xA;  &#xA;Future<bool> saveMyAppFileToCloudStorage(String filepath, String filename) async {&#xA;    //filepath: /data/user/0/com.example.MyApp/app_flutter/MyApp/MyAppAudioFiles/MyAppFiles/2d7af6ae-6361-4be5-8209-8498dd17d77d1.mp3&#xA;    //filename: 2d7af6ae-6361-4be5-8209-8498dd17d77d1.mp3&#xA;&#xA;    _firebaseStoragePath = MyAppFileStorageDir &#x2B; filename;&#xA;    &#xA;    File file = File(filepath);&#xA;&#xA;    try {&#xA;      await _firebaseStorage&#xA;          .ref(_firebaseStoragePath)&#xA;          .putFile(file);&#xA;      return true;&#xA;    } catch (e) {&#xA;      print(&#x27;##MyAppFile## saveMyAppFileToCloudStorage Error: &#x27; &#x2B; e.toString()); //ERROR COMES FROM THIS LINE&#xA;      return false;&#xA;    }&#xA;    return true;&#xA;  }&#xA;</bool></void></string></void>

    &#xA;