如何向播放 activity 的用户添加图像?(discord.py)
how to add an image to user playing activity?(discord.py)
我正在尝试在 discord.py 中添加图像用户 activity 状态,基本上,问题是我似乎无法添加图像,所以我查找了 discord.py API 但找不到如何去做。所以,如果你知道,请回答。
想知道如何加一个。 (不适用于机器人)
代码如下
import discord, os, keep_alive, datetime
import discord.ext
from discord.ext import tasks
intents = discord.Intents.default()
client = discord.Client()
launch_time = datetime.datetime.utcnow()
@client.event
async def on_ready():
print("Account Activated")
print(launch_time)
if not Status_loop.is_running():
Status_loop.start()
把它放在一个循环中不断更新activity
@tasks.loop(seconds=1, count=None, reconnect=True)
async def Status_loop():
delta_uptime = datetime.datetime.utcnow() - launch_time
hours, remainder = divmod(int(delta_uptime.total_seconds()), 3600)
minutes, seconds = divmod(remainder, 60)
days, hours = divmod(hours, 24)
print(f"Online Time: {days:02d}d | {hours:02d}h | {minutes:02d}m | {seconds:02d}s")
await client.change_presence(status = discord.Status.dnd,
activity = discord.Activity(type=discord.ActivityType.playing,
large_image = "https://i.imgur.com/Kk2BvJg.jpg",
large_text = "This is Game Icon",
name = "Sleeping Simulator",
details = "Dreams of Desires(Easy)",
state = f"{days:02d}d | {hours:02d}h | {minutes:02d}m Passed"))
这是用户帐户的状态
如果你想知道我为什么要这样做,那么我只是想要一个自定义状态
似乎在尝试了网站和其他各种方法之后,我终于使用 replit 上传的文件得到了它 link...并且成功了...
large_image = "https://e8a593e1-79cc-4f08-9992-2b588af90e7f.id.repl.co/static/sleepingface.jpg",
large_text = "This is Game Icon",
small_image = "https://e8a593e1-79cc-4f08-9992-2b588af90e7f.id.repl.co/static/sleepingface.jpg",
small_text = "This is Game Icon",
结果:
我正在尝试在 discord.py 中添加图像用户 activity 状态,基本上,问题是我似乎无法添加图像,所以我查找了 discord.py API 但找不到如何去做。所以,如果你知道,请回答。
想知道如何加一个。 (不适用于机器人)
代码如下
import discord, os, keep_alive, datetime
import discord.ext
from discord.ext import tasks
intents = discord.Intents.default()
client = discord.Client()
launch_time = datetime.datetime.utcnow()
@client.event
async def on_ready():
print("Account Activated")
print(launch_time)
if not Status_loop.is_running():
Status_loop.start()
把它放在一个循环中不断更新activity
@tasks.loop(seconds=1, count=None, reconnect=True)
async def Status_loop():
delta_uptime = datetime.datetime.utcnow() - launch_time
hours, remainder = divmod(int(delta_uptime.total_seconds()), 3600)
minutes, seconds = divmod(remainder, 60)
days, hours = divmod(hours, 24)
print(f"Online Time: {days:02d}d | {hours:02d}h | {minutes:02d}m | {seconds:02d}s")
await client.change_presence(status = discord.Status.dnd,
activity = discord.Activity(type=discord.ActivityType.playing,
large_image = "https://i.imgur.com/Kk2BvJg.jpg",
large_text = "This is Game Icon",
name = "Sleeping Simulator",
details = "Dreams of Desires(Easy)",
state = f"{days:02d}d | {hours:02d}h | {minutes:02d}m Passed"))
这是用户帐户的状态
如果你想知道我为什么要这样做,那么我只是想要一个自定义状态
似乎在尝试了网站和其他各种方法之后,我终于使用 replit 上传的文件得到了它 link...并且成功了...
large_image = "https://e8a593e1-79cc-4f08-9992-2b588af90e7f.id.repl.co/static/sleepingface.jpg",
large_text = "This is Game Icon",
small_image = "https://e8a593e1-79cc-4f08-9992-2b588af90e7f.id.repl.co/static/sleepingface.jpg",
small_text = "This is Game Icon",
结果: