discord消息获取日期时间

huangapple go评论72阅读模式
英文:

discord message get date time

问题

这是我的代码:

else {
            String words = objMsg.getContentRaw().substring(5);

            Message msg = event.getMessage();
            Member target = msg.getMember();

            assert target != null;
            objMsgCh.sendMessage("__***警告:***__\n**日期:** " + msg.getTimeCreated()).queue();
            objMsgCh.sendMessage("**消息:** " + words + "\n**被警告者:** " + target.getUser().getAsTag()).queue();
        }
英文:

How can I get discord's message send time, because when I use msg.getTimeCreated()), it gets the time but with 4 hours early, what I need to use to be the same as the message time sended?

Here is my code :

else {
            String words = objMsg.getContentRaw().substring(5);

            Message msg = event.getMessage();
            Member target = msg.getMember();

            assert target != null;
            objMsgCh.sendMessage("__***WARN :***__\n**DATE:** " + msg.getTimeCreated()).queue();
            objMsgCh.sendMessage("**Message:** " + words + "\n**Warned from:** " + target.getUser().getAsTag()).queue();
        }

答案1

得分: 0

Sure, here's the translation:

好的,在您的代码中使用这个:

var embed = new Discord.MessageEmbed()
.setTimestamp()
英文:

ok use this in ur code
var embed = new Discord.MessageEmbed()
.setTimestamp()

huangapple
  • 本文由 发表于 2020年10月8日 16:33:27
  • 转载请务必保留本文链接:https://go.coder-hub.com/64258734.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定