Answer the question
In order to leave comments, you need to log in
How to make message time with timezone?
With code like this:
@bot.event
async def on_ready():
DiscordComponents(bot)
await bot.change_presence(activity=discord.Game(name="Monro FamQ"))
current_time = datetime.now().time()
res = bot.get_channel(882269213807497327)
log = discord.Embed(title = '',description = '', colour = 0xFFFF00)
log.set_thumbnail(url = f'https://media.discordapp.net/attachments/716571065270140938/880854910005047366/-7.png?width=701&height=701')
log.add_field(name="", value= '', inline=True)
log.set_footer(icon_url = 'https://media.discordapp.net/attachments/716571065270140938/880854176735854622/-6.png?width=701&height=701',
text = "Сегодня в %d:%d" % (current_time.hour, current_time.minute))
await res.send(
embed = log)
print("Бот включен")
Answer the question
In order to leave comments, you need to log in
You don’t need to compose the string time from the components yourself, there are ready-made methods.
Discord does not provide information about the user’s time zone, so it’s impossible to show everyone his time as text. But you can add a timestamp to embed, then everyone will receive an individual time, taking into account their time zone:
datetime.datetime.now().strftime('%H:%M')
embed = discord.Embed(title='test',timestamp=datetime.datetime.utcnow())
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question