
Recherche avancée
Médias (1)
-
Bug de détection d’ogg
22 mars 2013, par
Mis à jour : Avril 2013
Langue : français
Type : Video
Autres articles (64)
-
Taille des images et des logos définissables
9 février 2011, parDans beaucoup d’endroits du site, logos et images sont redimensionnées pour correspondre aux emplacements définis par les thèmes. L’ensemble des ces tailles pouvant changer d’un thème à un autre peuvent être définies directement dans le thème et éviter ainsi à l’utilisateur de devoir les configurer manuellement après avoir changé l’apparence de son site.
Ces tailles d’images sont également disponibles dans la configuration spécifique de MediaSPIP Core. La taille maximale du logo du site en pixels, on permet (...) -
Configuration spécifique d’Apache
4 février 2011, parModules spécifiques
Pour la configuration d’Apache, il est conseillé d’activer certains modules non spécifiques à MediaSPIP, mais permettant d’améliorer les performances : mod_deflate et mod_headers pour compresser automatiquement via Apache les pages. Cf ce tutoriel ; mode_expires pour gérer correctement l’expiration des hits. Cf ce tutoriel ;
Il est également conseillé d’ajouter la prise en charge par apache du mime-type pour les fichiers WebM comme indiqué dans ce tutoriel.
Création d’un (...) -
Encodage et transformation en formats lisibles sur Internet
10 avril 2011MediaSPIP transforme et ré-encode les documents mis en ligne afin de les rendre lisibles sur Internet et automatiquement utilisables sans intervention du créateur de contenu.
Les vidéos sont automatiquement encodées dans les formats supportés par HTML5 : MP4, Ogv et WebM. La version "MP4" est également utilisée pour le lecteur flash de secours nécessaire aux anciens navigateurs.
Les documents audios sont également ré-encodés dans les deux formats utilisables par HTML5 :MP3 et Ogg. La version "MP3" (...)
Sur d’autres sites (3689)
-
I tried programming a discord bot for music, it joins the channel, it apparently "speaks" but i can't hear anything
2 avril 2020, par boraxI tried to code it alone, but I got the same problem, then I copied the code from https://gabrieltanner.org/blog/dicord-music-bot and it persists. I have downloaded FFmpeg, but I still think the problem lies there. Any suggestions ? (it's my first time here, I don't know how much of the code is relevant, also, i get this Error : FFmpeg/avconv not found !)



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

const ytdl = require("ytdl-core");

const token = 'REDACTED';

const prefix = '$';

var version = '1.1.2';

var servers = {};

const queue = new Map();

client.on('ready', () => {
 console.log('BOT is online');
})
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);



-
Discord Music Bot joins voice channel, light up green but didnt has any audio. Worked well for 2 weeks before. No errors in console
8 juin 2021, par FeXI coded a bot with node.js. I used the example by Crawl for his music bot. I did everything similar to him. After I finished my build everything worked. Every other command and the
play
command. But now after 2 weeks the bot joins the voice channel, light up green but has no sound. I updatedffmpeg
,@discordjs/opus
,ffmpeg-static
and downloaded the completed version from ffmpeg but the bot still has no audio. Thequeue
,volume
,nowplaying
,skip
,shuffle
,loop
everything works. But after I got the video or playlist with the play command the bot only joins light up green but has no audio. So the bot definitly get the url, get the video, get everything he needs to play. But after joining he doesnt use the informations to play. Also he doesnt leave the voicechannel after the song should end.


function play(guild, song) {

 try {

 const ServerMusicQueue = queue.get(guild.id);

 if (!song) {

 ServerMusicQueue.textchannel.send(`ퟎ
-
Discord music bot won't join Voice channel
16 mars 2024, par SkelyI followed a tutorial for creating a music bot in discord, but it will not join my vc no matter what. Every command works and it gives the correct responses and songs is in the queue. The bot have every permission know to man, but it still won't join. Any way to fix this issue ?
Thanks in advance !!


This is my code and files


main.py


import discord
from discord.ext import commands
import os
import asyncio

from help_cog import help_cog
from music_cog import music_cog

bot = commands.Bot(
 command_prefix="?", 
 intents=discord.Intents.all(),
 help_command=None
)

async def main():
 async with bot:
 await bot.add_cog(help_cog(bot))
 await bot.add_cog(music_cog(bot))
 await bot.start(os.getenv("TOKEN"))

asyncio.run(main())



music_cog.py


import discord
from discord.ext import commands

from yt_dlp import YoutubeDL

import yt_dlp as youtube_dl

class music_cog(commands.Cog):
 def __init__(self, bot):
 self.bot = bot

 self.is_playing = False
 self.is_paused = False

 self.music_queue = []
 self.YDL_OPTIONS = {"format": "bestaudio", "postprocessors": [{"key": "FFmpegExtractAudio", "preferredcodec": "mp3", "preferredquality": "192",}]}
 self.FFMPEG_OPTIONS = {"before_options": "-reconnect 1 -reconnect_streamed 1 -reconnect_delay_max 5", "options": "-vn"}

 self.vc = None
 print("Success")

 def search_yt(self, item):
 with YoutubeDL(self.YDL_OPTIONS) as ydl:
 try:
 info = ydl.extract_info(f"ytsearch:{item}", download=False)["entries"][0]
 except Exception:
 return False
 return {"source": info["url"], "title": info["title"]}

 def play_next(self):
 if len(self.music_queue) > 0:
 self.is_playing = True

 m_url = self.music_queue[0][0]["source"]

 self.music_queue.pop(0)

 self.vc.play(discord.FFmpegPCMAudio(m_url, **self.FFMPEG_OPTIONS), after=lambda e: self.play_next())
 else:
 self.is_playing = False

 async def play_music(self, ctx):
 if len(self.music_queue) > 0:
 self.is_playing = True
 m_url = self.music_queue[0][0]["source"]

 if self.vc == None or not self.vc.is_connected():
 self.vc = await self.music_queue[0][1].connect()

 if self.vc == None:
 await ctx.send("Could not connect to the voice channel")
 return
 else:
 await self.vc.move_to(self.music_queue[0][1])
 
 self.music_queue.pop(0)

 self.vc.play(discord.FFmpegPCMAudio(m_url, **self.FFMPEG_OPTIONS), after=lambda e: self.play_next())

 else:
 self.is_playing = False

 @commands.command(name="play", aliases=["p", "playing"], help="Play the selected song from YouTube")
 async def play(self, ctx, *args):
 query = " ".join(args)

 voice_channel = ctx.author.voice.channel
 if voice_channel is None:
 await ctx.send("Connect to a voice channel!")
 elif self.is_paused:
 self.vc.resume()
 else:
 song = self.search_yt(query)
 if type(song) == type(True):
 await ctx.send("Could not download the song. Incorrect format, try a different keyword")
 else:
 await ctx.send("Song added to queue")
 self.music_queue.append([song, voice_channel])

 if self.is_playing == False:
 await self.play_music(ctx)
 
 @commands.command(name="pause", help="Pauses the current song being played")
 async def pause(self, ctx, *args):
 if self.is_playing:
 self.is_playing = False
 self.is_paused = True
 self.vc.pause()
 elif self.is_paused:
 self.is_playing = True
 self.is_paused = False
 self.vc.resume()

 @commands.command(name="resume", aliases=["r"], help="Resumes playing the current song")
 async def resume(self, ctx, *args):
 if self.is_paused:
 self.is_playing = True
 self.is_paused = False
 self.vc.resume()
 
 @commands.command(name="skip", aliases=["s"], help="Skips the currently played song")
 async def skip(self, ctx, *args):
 if self.vc != None and self.vc:
 self.vc.stop()
 await self.play_music(ctx)

 @commands.command(name="queue", aliases=["q"], help="Displays all the songs currently in queue")
 async def queue(self, ctx):
 retval = ""

 for i in range(0, len(self.music_queue)):
 if i > 4: break
 retval += self.music_queue[i][0]["title"] + "\n"

 if retval != "":
 await ctx.send(retval)
 else:
 await ctx.send("No music in the current queue")
 
 @commands.command(name="clear", aliases=["c", "bin"], help="Stops the current song and clears the queue")
 async def clear(self, ctx, *args):
 if self.vc != None and self.is_playing:
 self.vc.stop()
 self.music_queue = []
 await ctx.send("Music queue cleared")

 @commands.command(name="leave", aliases=["disconnect", "l", "d"], help="Kick the bot from the voice channel")
 async def leave(self, ctx):
 self.is_playing = False
 self.is_paused = False
 await self.vc.disconnect()



help_cog.py


import discord
from discord.ext import commands

class help_cog(commands.Cog):
 def __init__(self, bot):
 self.bot = bot

 self.help_message = """
 Help message
"""

 self.text_channel_text = []
 
 @commands.Cog.listener()
 async def on_ready(self):
 for guild in self.bot.guilds:
 for channel in guild.text_channels:
 self.text_channel_text.append(channel)

 await self.send_to_all(self.help_message)

 async def send_to_all(self, msg):
 for text_channel in self.text_channel_text:
 await text_channel.send(msg)
 
 @commands.command(name="help", help="Displays all the available commands")
 async def help(self, ctx):
 await ctx.send(self.help_message)