【发布时间】:2020-12-21 21:57:21
【问题描述】:
我正在尝试使用discord.js 和ytdl-core 创建一个音乐机器人。我想在使用名为!nowplaying 的命令时显示当前时间戳。但是,我不确定我是如何获得时间的。我的代码:
//bot.queue is a collection, and contains some attributes, like songs (array) and connection (ytdl)
let queue = bot.queue.get(message.guild.id);
const time = queue.connection.streamTime; //Doesn't work!
//Convert time here, then output
message.channel.send(`Now Playing - ${queue.songs[0].title} - ${time}`);
我尝试过使用queue.connection.streamTime 和其他方法,但它们没有奏效
【问题讨论】:
标签: discord.js ytdl