
Recherche avancée
Médias (91)
-
Spitfire Parade - Crisis
15 mai 2011, par
Mis à jour : Septembre 2011
Langue : English
Type : Audio
-
Wired NextMusic
14 mai 2011, par
Mis à jour : Février 2012
Langue : English
Type : Video
-
Video d’abeille en portrait
14 mai 2011, par
Mis à jour : Février 2012
Langue : français
Type : Video
-
Sintel MP4 Surround 5.1 Full
13 mai 2011, par
Mis à jour : Février 2012
Langue : English
Type : Video
-
Carte de Schillerkiez
13 mai 2011, par
Mis à jour : Septembre 2011
Langue : English
Type : Texte
-
Publier une image simplement
13 avril 2011, par ,
Mis à jour : Février 2012
Langue : français
Type : Video
Autres articles (22)
-
Publier sur MédiaSpip
13 juin 2013Puis-je poster des contenus à partir d’une tablette Ipad ?
Oui, si votre Médiaspip installé est à la version 0.2 ou supérieure. Contacter au besoin l’administrateur de votre MédiaSpip pour le savoir -
Ajouter notes et légendes aux images
7 février 2011, parPour pouvoir ajouter notes et légendes aux images, la première étape est d’installer le plugin "Légendes".
Une fois le plugin activé, vous pouvez le configurer dans l’espace de configuration afin de modifier les droits de création / modification et de suppression des notes. Par défaut seuls les administrateurs du site peuvent ajouter des notes aux images.
Modification lors de l’ajout d’un média
Lors de l’ajout d’un média de type "image" un nouveau bouton apparait au dessus de la prévisualisation (...) -
Organiser par catégorie
17 mai 2013, parDans MédiaSPIP, une rubrique a 2 noms : catégorie et rubrique.
Les différents documents stockés dans MédiaSPIP peuvent être rangés dans différentes catégories. On peut créer une catégorie en cliquant sur "publier une catégorie" dans le menu publier en haut à droite ( après authentification ). Une catégorie peut être rangée dans une autre catégorie aussi ce qui fait qu’on peut construire une arborescence de catégories.
Lors de la publication prochaine d’un document, la nouvelle catégorie créée sera proposée (...)
Sur d’autres sites (3991)
-
How to make a basic youtube music bot work with searching titles instead of the URL
21 janvier 2021, par BrandonHello so i've followed this tutorial and added this code to my current bot to make it have a music bot function. Im wondering how to make the following code work with the youtube search function, for example right now I have to do
!play URL
but I would also like to be able to do!play name of song
then the bot will search and play the most matched song.


I am new to javascript but I know I shouldn't be looking for handouts, but some help would be appreciated.



const Discord = require("discord.js");
const { prefix, token } = require("./config.json");
const ytdl = require("ytdl-core");

const client = new Discord.Client();

const queue = new Map();

client.once("ready", () => {
 console.log("Ready!");
});

client.once("reconnecting", () => {
 console.log("Reconnecting!");
});

client.once("disconnect", () => {
 console.log("Disconnect!");
});

client.on("message", async message => {
 if (message.author.bot) return;
 if (!message.content.startsWith(prefix)) return;

 const serverQueue = queue.get(message.guild.id);

 if (message.content.startsWith(`${prefix}play`)) {
 execute(message, serverQueue);
 return;
 } else if (message.content.startsWith(`${prefix}skip`)) {
 skip(message, serverQueue);
 return;
 } else if (message.content.startsWith(`${prefix}stop`)) {
 stop(message, serverQueue);
 return;
 } else {
 message.channel.send("You need to enter a valid command!");
 }
});

async function execute(message, serverQueue) {
 const args = message.content.split(" ");

 const voiceChannel = message.member.voice.channel;
 if (!voiceChannel)
 return message.channel.send(
 "You need to be in a voice channel to play music!"
 );
 const permissions = voiceChannel.permissionsFor(message.client.user);
 if (!permissions.has("CONNECT") || !permissions.has("SPEAK")) {
 return message.channel.send(
 "I need the permissions to join and speak in your voice channel!"
 );
 }

 const songInfo = await ytdl.getInfo(args[1]);
 const song = {
 title: songInfo.title,
 url: songInfo.video_url
 };

 if (!serverQueue) {
 const queueContruct = {
 textChannel: message.channel,
 voiceChannel: voiceChannel,
 connection: null,
 songs: [],
 volume: 5,
 playing: true
 };

 queue.set(message.guild.id, queueContruct);

 queueContruct.songs.push(song);

 try {
 var connection = await voiceChannel.join();
 queueContruct.connection = connection;
 play(message.guild, queueContruct.songs[0]);
 } catch (err) {
 console.log(err);
 queue.delete(message.guild.id);
 return message.channel.send(err);
 }
 } else {
 serverQueue.songs.push(song);
 return message.channel.send(`${song.title} has been added to the queue!`);
 }
}

function skip(message, serverQueue) {
 if (!message.member.voice.channel)
 return message.channel.send(
 "You have to be in a voice channel to stop the music!"
 );
 if (!serverQueue)
 return message.channel.send("There is no song that I could skip!");
 serverQueue.connection.dispatcher.end();
}

function stop(message, serverQueue) {
 if (!message.member.voice.channel)
 return message.channel.send(
 "You have to be in a voice channel to stop the music!"
 );
 serverQueue.songs = [];
 serverQueue.connection.dispatcher.end();
}

function play(guild, song) {
 const serverQueue = queue.get(guild.id);
 if (!song) {
 serverQueue.voiceChannel.leave();
 queue.delete(guild.id);
 return;
 }

 const dispatcher = serverQueue.connection
 .play(ytdl(song.url))
 .on("finish", () => {
 serverQueue.songs.shift();
 play(guild, serverQueue.songs[0]);
 })
 .on("error", error => console.error(error));
 dispatcher.setVolumeLogarithmic(serverQueue.volume / 5);
 serverQueue.textChannel.send(`Start playing: **${song.title}**`);
}

client.login(token);



-
When I try to play my Music Discord Bot it doesn't play music
1er juin 2020, par EthanDevelopsWhen I try to play my Music Discord Bot it doesn't play music. It uses ytdl-core and ffmpeg
My code is :



const Discord = require('discord.js');
const bot = new Discord.Client

const ytdl = require("ytdl-core")


const token = 'API TOKEN'

const PREFIX = '?';

var version = '1.2';

var servers = {};

bot.on('ready', () =>{
 console.log('This bot is online!' + version);
})

bot.on('message', message => {

 let args = message.content.substring(PREFIX.length).split(" ");

 switch(args[0]){
 case 'play':

 function play(connection, message){
 var server = servers[message.guild.id];

 server.dispatcher = connection.play(ytdl(server.queue[0], {filter: "audioonly"}))

 server.queue.shift();

 server.dispatcher.on("end", function(){
 if(server.queue[0]){
 play(connection, message);
 }else {
 connection.disconnect();
 }
 });



 }



 if(!args[1]){
 message.channel.send("You need to provide a link!")
 return;
 }

 if(!message.member.voice.channel){
 message.channel.send("You must be in a Voice Channel to play the bot!")
 return;
 }

 if(!servers[message.guild.id]) servers[message.guild.id] = {
 queue: []
 }

 var server = servers[message.guild.id];

 server.queue.push(args[1]);

 if(!message.guild.voice) message.member.voice.channel.join().then(function(connection){
 play(connection, message);
 })

 break;
 }



 });


 bot.login(token);




Whenever I try to play a song this error happens :





(node:5180) UnhandledPromiseRejectionWarning : Error : FFmpeg/avconv not
 found !
 at Function.getInfo (C :\Users\picar\Desktop\DiscordMusicBot\node_modules\prism-media\src\core\FFmpeg.js:130:11)
 at Function.create (C :\Users\picar\Desktop\DiscordMusicBot\node_modules\prism-media\src\core\FFmpeg.js:143:38)
 at new FFmpeg (C :\Users\picar\Desktop\DiscordMusicBot\node_modules\prism-media\src\core\FFmpeg.js:44:27)
 at AudioPlayer.playUnknown (C :\Users\picar\Desktop\DiscordMusicBot\node_modules\discord.js\src\client\voice\player\BasePlayer.js:47:20)
 at VoiceConnection.play (C :\Users\picar\Desktop\DiscordMusicBot\node_modules\discord.js\src\client\voice\util\PlayInterface.js:71:28)
 at play (C :\Users\picar\Desktop\DiscordMusicBot\index.js:29:48)
 at C :\Users\picar\Desktop\DiscordMusicBot\index.js:66:17
 at processTicksAndRejections (internal/process/task_queues.js:97:5)
 (node:5180) UnhandledPromiseRejectionWarning : Unhandled promise rejection. This error originated either by throwing inside of an async
 function without a catch block, or by rejecting a promise which was
 not handled with .catch(). To terminate the node process on unhandled
 promise rejection, use the CLI flag
--unhandled-rejections=strict

 (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode).
 (rejection id : 1)
 (node:5180) [DEP0018] DeprecationWarning : Unhandled promise rejections are deprecated. In the future, promise rejections that are
 not handled will terminate the Node.js process with a non-zero exit
 code




I'm getting very frustrated as the tutorial I'm watching is using a different version of everything !!! Please help.


-
Discord BOT Music player : plays 3 songs at once
15 août 2020, par LaCalientaI am developing my Discord bot that plays music, I am using DSahrpPlus as a wrapper and got the bot mostly working


Commands get parsed corecly


using System;
using System.Diagnostics;
using System.IO;
using System.Threading.Tasks;

using DSharpPlus;
using DSharpPlus.CommandsNext;
using DSharpPlus.CommandsNext.Attributes;
using DSharpPlus.Entities;
using DSharpPlus.VoiceNext;

using WolfBot.Attributes;
using WolfBot.Commands.Music;

namespace WolfBot.Commands
{
 class MusicCommands : BaseCommandModule
 {
 int SongID = 1;
 MusicPlayer player;
 [Command("join")]
 [RequirePermissionsCustom(Permissions.UseVoice)]
 public async Task Join(CommandContext ctx)
 {
 //Initialize music player
 player = new MusicPlayer(ctx);

 var vnext = ctx.Client.GetVoiceNext();

 var vnc = vnext.GetConnection(ctx.Guild);
 if (vnc != null)
 {
 await ctx.RespondAsync("Already connected in this guild.");
 throw new InvalidOperationException("Already connected in this guild.");
 }

 var chn = ctx.Member?.VoiceState?.Channel;
 if (chn == null)
 {
 await ctx.RespondAsync("You need to be in a voice channel.");
 throw new InvalidOperationException("You need to be in a voice channel.");
 }

 vnc = await vnext.ConnectAsync(chn);
 await ctx.RespondAsync(DiscordEmoji.FromName(ctx.Client, ":ok_hand:")); //-