Compare commits
3 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| afda0680ec | |||
| 021133954e | |||
| 7baa04dbc2 |
2
konabot/docs/concepts/罗文.txt
Normal file
2
konabot/docs/concepts/罗文.txt
Normal file
@ -0,0 +1,2 @@
|
|||||||
|
关于罗文和洛温:
|
||||||
|
AdoreLowen 希望和洛温阿特金森区分,所以最好就不要叫他洛温了!此方 BOT 会在一些群提醒叫错了的人。
|
||||||
@ -1,10 +1,17 @@
|
|||||||
import base64
|
import base64
|
||||||
|
import math
|
||||||
import random
|
import random
|
||||||
import time
|
import time
|
||||||
|
|
||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
|
|
||||||
|
|
||||||
|
def dec_func(t: float) -> float:
|
||||||
|
if t < 86400:
|
||||||
|
return 0.5 * (1 + math.tanh(t / 43200 - 1))
|
||||||
|
return math.exp(-0.00000043 * (t - 86400))
|
||||||
|
|
||||||
|
|
||||||
class RandomTextManager:
|
class RandomTextManager:
|
||||||
_cache: list[tuple[float, str]]
|
_cache: list[tuple[float, str]]
|
||||||
|
|
||||||
@ -55,7 +62,8 @@ class RandomTextManager:
|
|||||||
|
|
||||||
for ts, cn in self._cache:
|
for ts, cn in self._cache:
|
||||||
contents.append(cn)
|
contents.append(cn)
|
||||||
weights.append((abs(now - ts) + 0.01) ** (-1))
|
# weights.append((abs(now - ts) + 0.01) ** (-1))
|
||||||
|
weights.append(dec_func(now - ts))
|
||||||
|
|
||||||
return random.choices(contents, weights)[0]
|
return random.choices(contents, weights)[0]
|
||||||
|
|
||||||
|
|||||||
@ -53,7 +53,7 @@ async def _(
|
|||||||
if doc is None:
|
if doc is None:
|
||||||
# 检索模式
|
# 检索模式
|
||||||
if section is None:
|
if section is None:
|
||||||
section_set = {1}
|
section_set = {1, 7}
|
||||||
else:
|
else:
|
||||||
section_set = {section}
|
section_set = {section}
|
||||||
if 1 in section_set and is_admin(event):
|
if 1 in section_set and is_admin(event):
|
||||||
|
|||||||
Reference in New Issue
Block a user