📄 robot.pas
字号:
unit robot;
interface
uses
Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
Db, DBF, ExtCtrls, Grids, DBGrids, StdCtrls, Mask, DBCtrls;
type
TBotCfgDlg = class(TForm)
AutoUserTable: TDBF;
AutoUserDS: TDataSource;
DBGrid1: TDBGrid;
Panel1: TPanel;
AutoUserTableUSERID: TFloatField;
AutoUserTableGREETMSG: TStringField;
AutoUserTableBYEMSG: TStringField;
Label1: TLabel;
DBEdit1: TDBEdit;
DBEdit2: TDBEdit;
DBEdit3: TDBEdit;
DBNavigator1: TDBNavigator;
Label2: TLabel;
Label3: TLabel;
Label4: TLabel;
private
{ Private declarations }
public
{ Public declarations }
function GetGreetMsg(const UserId:string;var Msg:string):Boolean;
function GetByeMsg(const UserId:string;var Msg:string):Boolean;
end;
var
BotCfgDlg: TBotCfgDlg;
implementation
{$R *.DFM}
{ TBotCfgDlg }
function TBotCfgDlg.GetByeMsg(const UserId: string;
var Msg: string): Boolean;
begin
with AutoUserTable do
begin
First;
while not Eof do
begin
if(FieldByName('UserId').AsString=UserId)then
begin
Msg:=FieldByName('ByeMsg').AsString;
Result:=True;
Break;
end
else if(FieldByName('UserId').AsString='0')then
begin
Msg:=FieldByName('ByeMsg').AsString;
Result:=True;
end;
Next;
end;
end;
end;
function TBotCfgDlg.GetGreetMsg(const UserId: string;
var Msg: string): Boolean;
begin
with AutoUserTable do
begin
First;
while not Eof do
begin
if(FieldByName('UserId').AsString=UserId)then
begin
Msg:=FieldByName('GreetMsg').AsString;
Result:=True;
Break;
end
else if(FieldByName('UserId').AsString='0')then
begin
Msg:=FieldByName('GreetMsg').AsString;
Result:=True;
end;
Next;
end;
end;
end;
end.
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -