# cogs/......略
@commands.command()
async def clock(self, ctx, mins, todo):
embed = discord.Embed(title = "提醒", description = f"您已预约了{mins}分钟後提醒您", color = 0x4599)
embed.set_thumbnail(url = "https://www.formula-ai.com/wp-content/uploads/2020/09/python_or_java_meme.jpg")
await ctx.send(embed = embed)
time.sleep(int(mins) * 60)
sms = discord.Embed(title = "时间到", description = f"您刚刚预约了{mins}分钟要{todo},现在时间已经到罗", color = 0x4599)
sms.set_thumbnail(url = "https://www.formula-ai.com/wp-content/uploads/2020/09/python_or_java_meme.jpg")
await ctx.message.author.send(embed = sms)
@commands.command()
async def plus(self, ctx, nums):
if nums == None:
return
nums = int(nums)
# 打开json档看user.id是否存在
async def read_data():
with open("bank.json", "r")as file:
users = json.load(file)
return users
# 如果不存在就建立
async def open_account(user):
users = await read_data()
if str(user.id) in users:
return False
else:
users[str(user.id)] = {}
users[str(user.id)]["货物量"] = 0
with open("plus.json", "w") as f:
json.dump(users, f)
return True
# 存在就添加及改写
async def reset(user, change = 0, mode = "amount"):
users = await read_data()
users[str(user.id)][mode] += change
with open("plus.json", "w") as f:
json.dump(users, f)
bal = [users[str(user.id)]["amount"]]
return bal
users = await read_data()
to_count = {}
total = []
for user in users:
name = int(user)
total_amount = users[user]["amount"]
to_count[total_amount] = name
total.append(total_amount)
total = sorted(total, reverse = True)
embed = discord.Embed(title = "这次的量", description = "将订货量排序後的结果呈现", color = 0x5568)
embed.set_thumbnail(url = "https://www.formula-ai.com/wp-content/uploads/2020/09/python_or_java_meme.jpg")
for i in total:
userid = to_count[i]
member = await bot.fetch_user(userid)
name = member.name
embed.add_field(name = f"{name}", value = f"您订购的数量为{i}", inline = False)
await ctx.send(embed = embed)
<<: Day 27 - Rancher Fleet Kustomize 应用程序部署
D20. 字串题练习 这题是之前老师出的题目但是我一直解不出来,後来看很久,还跑去问同学才解出来的,...
画出一张属於自己的学习地图,只有知道自己身在何处,才不会迷路。你必须知道这项学习的终点,该拥有什麽样...
本文目标 记忆体层接 介绍快取的组成 常见的快取机制 使用快取需要面对的同步问题 进入正题 CPU ...
-图片来源:Toussaint Ilboudo 我碰到了有关卢克小组中的暴力攻击事件的帖子,并恭敬...
虚设常式(Stub)简介 今天的文章进入了新的系列,那因为接下来的概念是非常抽象的,所以会介绍数个核...