from datetime import datetime
now = datetime.now()
date_time = now.strftime("%Y-%m-%d, %H:%M:%S")
print(date_time)
# cogs/Times.py
# 略
@commands.command(pass_context = True)@bot.command()
async def time(ctx):
now = datetime.now()
await ctx.send(now.strftime("%Y-%m-%d %H:%M:%S"))
# 略
# cogs/randomLucky.py
# 略
import random
lucky = ["lucky~~~", "not bad", "Soso", "green hat",
"fuck your self"]
class randomLucky(Cog_Extension):
@commands.command(pass_context = True)
async def rand(ctx):
cat = random.randint(0, 4)
await ctx.channel.send(lucky[int(cat)])
# 略
如果我只想要一人一天只能发送一次呢??
我们要怎麽做?
刚才使用的author可以来出来了~~
建立名为match的json档
{
}
# 写在最下面
async def read_data():
with open("match.json", "r") as file:
users = json.load(file)
return users
# bot.run...
这个函式可以读取json档(唯读),所以我将他每个users的这个key回传
然後,要怎麽写??
前言 今天要来介绍 Go 语言里的网路操作,这边会以介绍 net/http 这个套件为主,并且介绍什...
Photo by Victoriano Izquierdo on Unsplash 文章同步发布於...
在本章中,我们将介绍 React Context。React Context 与 props 相同,...
前言 今天先来谈谈数学的部分。 微积分 在「线性代数」或「离散数学」都有极少的部分会用到,而现在的我...
最近在某网通群组刚好有聊到,所以乾脆来写一篇文解释一下乖乖传说背後的科学论证吧 先说明缘起,到底是哪...