Recherche avancée

Médias (0)

Mot : - Tags -/flash

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

Autres articles (52)

  • Personnaliser en ajoutant son logo, sa bannière ou son image de fond

    5 septembre 2013, par

    Certains thèmes prennent en compte trois éléments de personnalisation : l’ajout d’un logo ; l’ajout d’une bannière l’ajout d’une image de fond ;

  • La file d’attente de SPIPmotion

    28 novembre 2010, par

    Une file d’attente stockée dans la base de donnée
    Lors de son installation, SPIPmotion crée une nouvelle table dans la base de donnée intitulée spip_spipmotion_attentes.
    Cette nouvelle table est constituée des champs suivants : id_spipmotion_attente, l’identifiant numérique unique de la tâche à traiter ; id_document, l’identifiant numérique du document original à encoder ; id_objet l’identifiant unique de l’objet auquel le document encodé devra être attaché automatiquement ; objet, le type d’objet auquel (...)

  • Publier sur MédiaSpip

    13 juin 2013

    Puis-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

Sur d’autres sites (9190)

  • How do I add a cool down to a command for a discord music bot [closed]

    22 mars 2021, par sherbit fish

    I'm making a music bot in discord and I need to add a cool down into this command so that people don't spam it and crash the bot. What should I do to fix this problem ?

    


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

client.on('message', async message => {
  if (message.member.voice.channel) {
    const connection = await message.member.voice.channel.join();
    console.log(`sound was just played`);
connection.play(ytdl('https://www.youtube.com/watch?v=jRxSRyrTANY',{ highWaterMark: 50 },{ quality: 'highestaudio' },{ type: 'opus' }));
setTimeout(() => {
  connection.disconnect();
}, 12000); 
  }
});


    


  • My music doesn't play correctly and other problems - Discord.py

    24 mars 2021, par Diacono

    So, I'm triying to let my bot play songs directly from the url (without downloading them like the song.mp3 method) but I'm having a hard time. The bot plays only 1 song and when I try to play another song it doesn't play it.
I'm also getting 2 errors : video_link is not defined and self is not defined.
Also when I try to play live music like "lofi hip hop radio - beats to relax/study to" nothing happens.
Can you help me please ???

    


    This is my code

    


    import asyncio
import discord
from discord.ext import commands, tasks
import requests
import json
from random import choice
from discord.utils import get
from discord import FFmpegPCMAudio
import youtube_dl
bot = commands.Bot(command_prefix="!")



ytdl_format_options = {
    'format': 'bestaudio/best',
    'outtmpl': '%(extractor)s-%(id)s-%(title)s.%(ext)s',
    'restrictfilenames': True,
    'noplaylist': True,
    'nocheckcertificate': True,
    'ignoreerrors': False,
    'logtostderr': False,
    'quiet': True,
    'no_warnings': True,
    'default_search': 'auto',
    'source_address': '0.0.0.0' # bind to ipv4 since ipv6 addresses cause issues sometimes
}

ffmpeg_options = {
    'options': '-vn'
}

ytdl = youtube_dl.YoutubeDL(ytdl_format_options)

class YTDLSource(discord.PCMVolumeTransformer):
    def __init__(self, source, *, data, volume=0.5):
        super().__init__(source, volume)

        self.data = data

        self.title = data.get('title')
        self.url = data.get('url')

    @classmethod
    async def from_url(cls, url, *, loop=None, stream=False):
        loop = loop or asyncio.get_event_loop()
        data = await loop.run_in_executor(None, lambda: ytdl.extract_info(url, download= not stream))

        if 'entries' in data:
            data = data['entries'][0]

        filename = data['url'] if stream else ytdl.prepare_filename(data)
        return cls(discord.FFmpegPCMAudio(filename, **ffmpeg_options), data=data)


@bot.command()
async def play(ctx, url):
    voice = await ctx.author.voice.channel.connect()
    player = await YTDLSource.from_url(url, loop=client.loop)
    ctx.voice_client.play(player, after=lambda e: print('Player error: %s' % e) if e else None)
    ydl_opts = {'format': 'bestaudio'}
    FFMPEG_OPTIONS = {'before_options': '-reconnect 1 -reconnect_streamed 1 -reconnect_delay_max 5', 'options': '-vn'}
    with youtube_dl.YoutubeDL(ydl_opts) as ydl:
         info = ydl.extract_info(video_link, download=False)
         URL = info['formats'][0]['url']
    voice = get(self.bot.voice_clients, guild=ctx.guild)
    voice.play(discord.FFmpegPCMAudio(URL, **FFMPEG_OPTIONS))


    


  • My code accidently deleted my 'song.mp3' file in Discord.py music bot

    2 avril 2021, par Alkaria

    I was coding my discord bot and i was trying to make the bot not try to connect twice. Like, if it's already connected any user sends another ' !play' command, i don't want it to error. But that's not my problem. I or my code accidently deleted my 'song.mp3' file. How do i get it back. I closed the pycharm so i can't do 'CRTL + Z'.

    


    @client.command()

    


    async def play(ctx, url : str) :

    


    song_there = os.path.isfile("song.mp3")
try:
    if song_there:
        os.remove("song.mp3")
except PermissionError:
    await ctx.send("Şimdi Çalan şarkının bitmesini bekleyin. Yada '!stop' komutunu kullanın.")
    return
# connects the voice channel
connected = ctx.author.voice
audio = discord.FFmpegPCMAudio("song.mp3")

voiceChannel = discord.utils.get(ctx.guild.voice_channels, name='music')
if not discord.client.VoiceClient == None:  # None being the default value if the bot isnt in a channel (which is why the is_connected() is returning errors)
    await voiceChannel.connect()
    await ctx.send(f"Joined **{voiceChannel}**")
    discord.client.VoiceClient.play()
else:
    await ctx.send("I'm already connected!")



audio = discord.FFmpegPCMAudio("song.mp3")

# Dowloads the video from the link given

ydl_opts = {
    'format': 'bestaudio/best',
    'postprocessors': [{
        'key': 'FFmpegExtractAudio',
        'preferredcodec': 'mp3',
        'preferredquality': '192',
    }],
}
with youtube_dl.YoutubeDL(ydl_opts) as ydl:
    ydl.download([url])
for file in os.listdir("./"):
    if file.endswith(".mp3"):
        os.rename(file, "song.mp3")