Advertisement
Guest User

Untitled

a guest
Oct 30th, 2014
145
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 5.23 KB | None | 0 0
  1. unit Unit1;
  2.  
  3. interface
  4.  
  5. uses
  6. System.Classes, Winapi.Windows, Winapi.Messages, System.SysUtils, System.Variants, Vcl.Graphics,
  7. Vcl.Controls, Vcl.Forms, Vcl.Dialogs, Vcl.StdCtrls, Vcl.ExtCtrls,RegExpr, lib, IdURI, httpapp;
  8.  
  9.  
  10. type
  11. TMyThread = class(TThread)
  12. private
  13. { Private declarations }
  14. protected
  15. procedure Execute; override;
  16. procedure bash;
  17. function hi(name:string): string;
  18. procedure dela;
  19. procedure paru;
  20. procedure ychi;
  21. procedure mat;
  22. end;
  23.  
  24. implementation
  25. uses Unit3;
  26. var r:TRegExpr;
  27.  
  28. procedure TMyThread.bash;
  29. var b,anekdot:string;
  30. begin
  31. r:=TRegExpr.Create;
  32. try
  33. b:=Form3.IdHttp1.Get('http://bash.im/random');
  34. r.InputString:=b;
  35. r.Expression:='<div class="text">(.*?)</div>';
  36. except
  37. showmessage('Не удалось получить цитату!');
  38. end;
  39. if r.Exec then begin
  40. anekdot:=r.Match[1];
  41. Form3.Memo1.Lines.Add(anekdot);
  42. end;
  43. try
  44. Form3.IdHttp1.Get('https://api.vk.com/method/messages.send?chat_id=134&message='+HttpEncode(UTF8Encode(anekdot))+'&access_token='+Form3.Edit1.Text);
  45. except
  46. showmessage('Не удалось отправить сообщение');
  47. end;
  48. end;
  49.  
  50. procedure TMyThread.dela;
  51. var a: array[0..7] of string;
  52. i:integer;
  53. begin
  54. a[0]:='Лучше, чем у тебя ';
  55. a[1]:='Норм';
  56. a[2]:='Всё окок';
  57. a[3]:='Хуево';
  58. a[4]:='А у тебя?';
  59. a[5]:='Тебе не похуй?';
  60. randomize;
  61. i:= 1 + Random(6);
  62. try
  63. Form3.IdHttp1.Get('https://api.vk.com/method/messages.send?chat_id=134&message='+HttpEncode(UTF8Encode(a[i]))+'&access_token='+Form3.Edit1.Text);
  64. except
  65. showmessage('Не удалось отправить сообщение');
  66. end;
  67. end;
  68.  
  69. procedure TMyThread.Execute;
  70. var s,anekdot,id,id2, userid,username:string;
  71. begin
  72. r:=TRegExpr.Create;
  73. id2:='';
  74. repeat
  75. begin
  76. try
  77. s:=Form3.IdHttp1.Get('https://api.vk.com/method/messages.get?count=1&access_token='+Form3.Edit1.Text);
  78. except
  79. showmessage('Не удалось получить сообщение!');
  80. end;
  81. r.InputString:=s;
  82. r.Expression:='"uid":(.*?),"read_st';
  83. if r.Exec then
  84. begin
  85. userid:=r.Match[1];
  86. end;
  87. userid:=Form3.IdHttp1.Get('https://api.vk.com/method/users.get?user_ids=73857562&access_token='+Form3.Edit1.Text);
  88. r.InputString:=userid;
  89. r.Expression:='"first_name":"(.*?)","last_name"';
  90. if r.Exec then
  91. begin
  92. username:=r.Match[1];
  93. end;
  94. r.InputString:=s;
  95. r.Expression:='{"mid":(.*?),"date":';
  96. if r.Exec then
  97. begin
  98. id:=r.Match[1];
  99. end;
  100. if(id<>id2) then
  101. begin
  102. r.Expression:='body":"(.*?)","chat_id';
  103. if r.Exec then begin
  104. if(AnsiCompareText(r.Match[1],'цитата')=0) or (AnsiCompareText(r.Match[1],'цытата')=0) then
  105. bash();
  106. if(AnsiCompareText(r.Match[1],'привет')=0) or (AnsiCompareText(r.Match[1],'ку')=0) or (AnsiCompareText(r.Match[1],'qq')=0) or (AnsiCompareText(r.Match[1],'Здравст')=0) then
  107. hi(username);
  108. if(AnsiCompareText(r.Match[1],'пары')=0) then
  109. paru();
  110. if(AnsiCompareText(r.Match[1],'учимся')=0) then
  111. ychi();
  112. if(AnsiCompareText(r.Match[1],'хуй')=0) or (AnsiCompareText(r.Match[1],'иди')=0) or(AnsiCompareText(r.Match[1],'пидор')=0) or (AnsiCompareText(r.Match[1],'пидорас')=0) then
  113.  
  114. end;
  115. end;
  116. sleep(5000);
  117. id2:=id;
  118. end;
  119. until(1>2);
  120. end;
  121.  
  122.  
  123.  
  124. function TMyThread.hi(name: string): string;
  125. var a: array[0..7] of string;
  126. i:integer;
  127. begin
  128. a[0]:='Привет, '+name;
  129. a[1]:='Ку';
  130. a[2]:='Qq';
  131. a[3]:='Здарова';
  132. a[4]:='Шо хочешь?';
  133. a[5]:='Ты по делу или просто попиздеть?';
  134. a[6]:='Здравствуй';
  135. randomize;
  136. i:= 1 + Random(7);
  137. try
  138. Form3.IdHttp1.Get('https://api.vk.com/method/messages.send?chat_id=134&message='+HttpEncode(UTF8Encode(a[i]))+'&access_token='+Form3.Edit1.Text);
  139. except
  140. showmessage('Не удалось отправить сообщение');
  141. end;
  142. end;
  143.  
  144. procedure TMyThread.mat;
  145. var a: array[0..7] of string;
  146. i:integer;
  147. begin
  148. a[0]:='Да пошел ты нахуй сука';
  149. a[1]:='Ты ебанат';
  150. a[2]:='Зашквар';
  151. a[3]:='Хуесос';
  152. a[4]:='Нет, ты';
  153. a[5]:='Неудачник, агришься на бота';
  154. a[6]:='Да по твоему аватару видно, что ты уебан';
  155. randomize;
  156. i:= 1 + Random(7);
  157. try
  158. Form3.IdHttp1.Get('https://api.vk.com/method/messages.send?chat_id=134&message='+HttpEncode(UTF8Encode(a[i]))+'&access_token='+Form3.Edit1.Text);
  159. except
  160. showmessage('Не удалось отправить сообщение');
  161. end;
  162.  
  163. end;
  164.  
  165. procedure TMyThread.paru;
  166. begin
  167. try
  168. Form3.IdHttp1.Get('https://api.vk.com/method/messages.send?chat_id=134&message='+HttpEncode(UTF8Encode('Пары на завтра глянь тут http://mk.sumdu.edu.ua/index.php/component/content/article?id=200'))+'&access_token='+Form3.Edit1.Text);
  169. except
  170. showmessage('Не удалось отправить сообщение');
  171. end;
  172.  
  173. end;
  174.  
  175. procedure TMyThread.ychi;
  176. begin
  177. try
  178. Form3.IdHttp1.Get('https://api.vk.com/method/messages.send?chat_id=134&message='+HttpEncode(UTF8Encode('Конечно учимся'))+'&access_token='+Form3.Edit1.Text);
  179. except
  180. showmessage('Не удалось отправить сообщение');
  181. end;
  182. end;
  183.  
  184. end.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement