This repository has been archived by the owner on Nov 22, 2019. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #65 from kj415j45/patch-2.3
Update to 2.4
- Loading branch information
Showing
16 changed files
with
218 additions
and
84 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
<?php | ||
|
||
$msg=<<<EOT | ||
kjBot 用户使用情况记录 | ||
用法: | ||
!recordStat 阅读用户协议 | ||
!recordStat.verify 同意 | ||
!recordStat.cancel 取消同意 | ||
EOT; | ||
|
||
leave($msg); | ||
|
||
?> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
<?php | ||
|
||
$msg=<<<EOT | ||
搜索 | ||
用法: | ||
!search{.pixiv|.baidu|.google} | ||
返回指定的搜索引擎链接 | ||
更多搜索即将到来™ | ||
EOT; | ||
|
||
leave($msg); | ||
|
||
?> |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
<?php | ||
|
||
global $User_id; | ||
loadModule('credit.tools'); | ||
|
||
if(fromGroup())leave(); | ||
if(trim(getData('recordStat/'.$User_id))!='true')leave(); | ||
|
||
if(trim(getData('recordStat/r'.$User_id))=='true')decCredit($User_id, 415); | ||
setData('recordStat/'.$User_id, 'cancel'); | ||
setData('recordStat/r'.$User_id, 'false'); | ||
|
||
leave('您已取消 kjBot 的个人记录。'); | ||
|
||
?> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
<?php | ||
|
||
global $Queue, $User_id; | ||
|
||
$agreement=<<<EOT | ||
感谢您使用 kjBot! | ||
kjBot 需要使用您个人的命令使用情况来优化您的使用体验。 | ||
如果您不同意(我们默认您不同意),kjBot 将不会记名收集您的使用记录。 | ||
不同意记名记录不会影响您的正常使用。 | ||
如果您同意,请输入 | ||
!recordStat.verify | ||
EOT; | ||
|
||
setData('recordStat/'.$User_id, 'read'); | ||
$Queue[]= sendPM($agreement); //仅在私聊中发送用户协议 | ||
|
||
?> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
<?php | ||
|
||
global $User_id; | ||
loadModule('credit.tools'); | ||
|
||
if(fromGroup())leave(); //禁止在群内进行验证 | ||
switch(trim(getData('recordStat/'.$User_id))){ | ||
case 'cancel': | ||
setData('recordStat/'.$User_id, 'true'); | ||
leave('感谢您的支持'); | ||
case 'read': | ||
addCredit($User_id, 415); | ||
setData('recordStat/'.$User_id, 'true'); | ||
setData('recordStat/r'.$User_id, 'true'); | ||
leave("感谢您的支持,奖励 415 金币\n请注意,如果您在将来要求取消记录,需要将这 415 金币交还。"); | ||
case 'true': | ||
leave("您已经同意 kjBot 记录您的使用情况,如需取消请输入\n!recordStat.cancel"); | ||
default: | ||
leave('请先阅读协议!'); | ||
} | ||
|
||
|
||
?> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,5 +3,6 @@ | |
require('frame.php'); | ||
require('convert.php'); | ||
require('text.php'); | ||
require('statDB.php'); | ||
|
||
?> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
<?php | ||
function addCommandCount($user_id, $command){ | ||
global $StatDB; | ||
if(trim(getData('recordStat/'.$user_id))==='true'){ //如果用户同意记名记录 | ||
$row = getCommandCount($user_id, $command); | ||
if($row === false){ | ||
$StatDB->query("INSERT INTO record VALUES ({$user_id}, '{$command}', 1)"); | ||
}else{ | ||
$count = $row['count']; | ||
$StatDB->query("UPDATE record SET count = {$count}+1 WHERE user_id={$user_id} AND command='{$command}'"); | ||
} | ||
|
||
} | ||
$row = getCommandCount($user_id, $command); | ||
if($row === false){ | ||
$StatDB->query("INSERT INTO record VALUES (0, '{$command}', 1)"); | ||
}else{ | ||
$count = $row['count']; | ||
$StatDB->query("UPDATE record SET count = {$count}+1 WHERE user_id=0 AND command='{$command}'"); | ||
} | ||
} | ||
|
||
function getCommandCount($user_id, $command){ | ||
global $StatDB; | ||
$result = $StatDB->query("SELECT count FROM record WHERE user_id={$user_id} AND command='{$command}'"); | ||
return $result->fetchArray(); | ||
} | ||
|
||
function getUserCommandCount($user_id){ | ||
global $StatDB; | ||
$result = $StatDB->query("SELECT command, count FROM record WHERE user_id={$user_id}"); | ||
while($row = $result->fetchArray() && $row !== false){ | ||
$text.="{$row['command']} {$row['count']}"; | ||
} | ||
return $text; | ||
} | ||
|
||
?> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
PRAGMA foreign_keys=OFF; | ||
BEGIN TRANSACTION; | ||
CREATE TABLE record( | ||
user_id BIGINT NOT NULL, | ||
command TEXT NOT NULL, | ||
count NOT NULL | ||
); | ||
COMMIT; |