main2.go 42 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488
  1. package main
  2. import (
  3. "fmt"
  4. "runtime"
  5. "sort"
  6. "strconv"
  7. "strings"
  8. "sync"
  9. "time"
  10. "github.com/bashery/botline/oop"
  11. talkservice "github.com/bashery/linethrift"
  12. )
  13. func checkunbanbots(client *oop.Account, to string, targets []string, pl int, sinder string) {
  14. room := oop.GetRoom(to)
  15. target := []string{}
  16. for _, from := range targets {
  17. if Banned.GetFuck(from) {
  18. target = append(target, from)
  19. Banned.DelFuck(from)
  20. } else if Banned.GetBan(from) {
  21. target = append(target, from)
  22. Banned.DelBan(from)
  23. } else if InArray2(room.Gban, from) {
  24. target = append(target, from)
  25. Ungban(to, from)
  26. } else if Banned.GetMute(from) {
  27. target = append(target, from)
  28. Banned.DelMute(from)
  29. }
  30. }
  31. if len(target) != 0 {
  32. list := ""
  33. if pl == 1 {
  34. list += "Removed from banlist:\n"
  35. } else if pl == 2 {
  36. list += "Removed from fucklist:\n"
  37. } else if pl == 3 {
  38. list += "Removed from gbanlist:\n"
  39. } else if pl == 4 {
  40. list += "Removed from mutelist:\n"
  41. }
  42. for i := range target {
  43. list += "\n" + strconv.Itoa(i+1) + ". " + "@!"
  44. }
  45. client.SendPollMention(to, list, target)
  46. if pl == 1 {
  47. logAccess(client, to, sinder, "unban", target, 2)
  48. } else if pl == 2 {
  49. logAccess(client, to, sinder, "unfuck", target, 2)
  50. } else if pl == 3 {
  51. logAccess(client, to, sinder, "ungban", target, 2)
  52. } else if pl == 4 {
  53. logAccess(client, to, sinder, "unmute", target, 2)
  54. }
  55. } else {
  56. list := ""
  57. if pl == 1 {
  58. list += "User(s) not in banlist.\n"
  59. } else if pl == 2 {
  60. list += "User(s) not in fucklist.\n"
  61. } else if pl == 3 {
  62. list += "User(s) not in gbanlist.\n"
  63. } else if pl == 4 {
  64. list += "User(s) not in mutelist.\n"
  65. }
  66. client.SendMessage(to, list)
  67. }
  68. }
  69. func CheckExprd(s *oop.Account, to string, sender string) bool {
  70. base := time.Date(time.Now().Year(), time.Now().Month(), time.Now().Day(), time.Now().Hour(), time.Now().Minute(), time.Now().Second(), 0, time.UTC)
  71. d := fmt.Sprintf("%v", Data.Dalltime)
  72. has := strings.Split(d, "-")
  73. has2 := strings.Split(has[2], "T")
  74. yy, _ := strconv.Atoi(has[0])
  75. mm, _ := strconv.Atoi(has[1])
  76. timeup, _ := strconv.Atoi(has2[0])
  77. batas := time.Date(yy, time.Month(mm), timeup, 00, 00, 0, 0, time.UTC)
  78. if batas.Before(base) {
  79. if !SendMycreator(sender) {
  80. s.SendMessage(to, "Sorry your bots is expired, Please Contact with our Creator to renew your squad. ;-)")
  81. return false
  82. }
  83. return true
  84. }
  85. return true
  86. }
  87. func fmtDurations(d time.Duration) string {
  88. d = d.Round(time.Second)
  89. x := d
  90. h := d / time.Hour
  91. d -= h * time.Hour
  92. m := d / time.Minute
  93. d -= m * time.Minute
  94. if x < 60*time.Second {
  95. return fmt.Sprintf("%v", x)
  96. } else if x < 3600*time.Second {
  97. return fmt.Sprintf("%02dMin", m)
  98. } else if x < 86400*time.Second {
  99. return fmt.Sprintf("%02dH %02dMin", h%24, m)
  100. } else {
  101. return fmt.Sprintf("%02dD %02dH %02dMin", h/24, h%24, m)
  102. }
  103. }
  104. func CekDuedate() time.Time {
  105. bod := string(Data.Dalltime)
  106. date, _ := time.Parse(time.RFC3339, bod)
  107. return date
  108. }
  109. func CheckLastActive(client *oop.Account, targets string) string {
  110. list := ""
  111. mek, tu := LastActive.Get(targets)
  112. if tu {
  113. asu := mek.(*talkservice.Operation)
  114. if asu.Type == 55 {
  115. names1, _ := client.GetGroupMember(asu.Param1)
  116. cok := asu.CreatedTime / 1000
  117. i, _ := strconv.ParseInt(fmt.Sprintf("%v", cok), 10, 64)
  118. tm := time.Unix(i, 0)
  119. ss := time.Since(tm)
  120. sp := fmtDuration(ss)
  121. list += "- LastActive: " + sp + "\n- Type: Read Message\n- Group: " + names1 + "\n\n"
  122. } else if asu.Type == 124 {
  123. names1, _ := client.GetGroupMember(asu.Param1)
  124. cok := asu.CreatedTime / 1000
  125. i, _ := strconv.ParseInt(fmt.Sprintf("%v", cok), 10, 64)
  126. tm := time.Unix(i, 0)
  127. ss := time.Since(tm)
  128. sp := fmtDuration(ss)
  129. invites := strings.Split(asu.Param3, "\x1e")
  130. nos := 0
  131. her := ""
  132. for _, ampemng := range invites {
  133. nos += 1
  134. pr, _ := client.GetContact(ampemng)
  135. her += fmt.Sprintf("\n %v. %v", nos, pr.DisplayName)
  136. }
  137. list += "- LastActive: " + sp + "\n- Type: Invited member\n- Group: " + names1 + "\n- Target: " + her + "\n\n"
  138. } else if asu.Type == 133 {
  139. names1, _ := client.GetGroupMember(asu.Param1)
  140. cok := asu.CreatedTime / 1000
  141. i, _ := strconv.ParseInt(fmt.Sprintf("%v", cok), 10, 64)
  142. tm := time.Unix(i, 0)
  143. ss := time.Since(tm)
  144. sp := fmtDuration(ss)
  145. pr, _ := client.GetContact(asu.Param3)
  146. list += "- LastActive: " + sp + "\n- Type : Kick member\n- Group: " + names1 + "\n- Target: " + pr.DisplayName + "\n\n"
  147. } else if asu.Type == 126 {
  148. names1, _ := client.GetGroupMember(asu.Param1)
  149. cok := asu.CreatedTime / 1000
  150. i, _ := strconv.ParseInt(fmt.Sprintf("%v", cok), 10, 64)
  151. tm := time.Unix(i, 0)
  152. ss := time.Since(tm)
  153. sp := fmtDuration(ss)
  154. pr, _ := client.GetContact(asu.Param3)
  155. list += "- LastActive: " + sp + "\n- Type: Cancel member\n- Group: " + names1 + "\n- Target: " + pr.DisplayName + "\n\n"
  156. } else if asu.Type == 26 {
  157. msg := asu.Message
  158. if msg.ToType == 2 {
  159. names1, _ := client.GetGroupMember(msg.To)
  160. cok := asu.CreatedTime / 1000
  161. i, _ := strconv.ParseInt(fmt.Sprintf("%v", cok), 10, 64)
  162. tm := time.Unix(i, 0)
  163. ss := time.Since(tm)
  164. sp := fmtDuration(ss)
  165. tx := ""
  166. if msg.ContentType == 0 {
  167. tx = msg.Text
  168. } else {
  169. tx = "Non Text Message"
  170. }
  171. list += "- LastActive: " + sp + "\n- Type: Send Message\n- Group: " + names1 + "\n- Message: " + tx + "\n\n"
  172. }
  173. } else if asu.Type == 130 {
  174. names1, _ := client.GetGroupMember(asu.Param1)
  175. cok := asu.CreatedTime / 1000
  176. i, _ := strconv.ParseInt(fmt.Sprintf("%v", cok), 10, 64)
  177. tm := time.Unix(i, 0)
  178. ss := time.Since(tm)
  179. sp := fmtDuration(ss)
  180. list += "- LastActive: " + sp + "\n- Type: Join Group\n- Group: " + names1 + "\n\n"
  181. } else if asu.Type == 122 {
  182. names1, _ := client.GetGroupMember(asu.Param1)
  183. cok := asu.CreatedTime / 1000
  184. i, _ := strconv.ParseInt(fmt.Sprintf("%v", cok), 10, 64)
  185. tm := time.Unix(i, 0)
  186. ss := time.Since(tm)
  187. sp := fmtDuration(ss)
  188. var ti string
  189. if asu.Param3 == "4" {
  190. g, _ := client.GetGroup3(asu.Param1)
  191. if g.Extra.GroupExtra.PreventedJoinByTicket == false {
  192. ti = "Open qr"
  193. } else {
  194. ti = "Close qr"
  195. }
  196. } else if asu.Param3 == "1" {
  197. ti = "Change Group Name"
  198. }
  199. list += "- LastActive: " + sp + "\n- Type: Update Group\n- Group: " + names1 + "\n- Type: " + ti + "\n\n"
  200. }
  201. }
  202. return list
  203. }
  204. func InArray2(ArrList []string, rstr string) bool {
  205. for _, x := range ArrList {
  206. if x == rstr {
  207. return true
  208. }
  209. }
  210. return false
  211. }
  212. func Checklistaccess(client *oop.Account, group string, targets []string, pl int, sinder string) {
  213. Room := oop.GetRoom(group)
  214. if pl == 12 {
  215. countr := 0
  216. countr1 := 0
  217. list := "Account Info: \n\n"
  218. for n, xx := range targets {
  219. new := client.Getcontactuser(xx)
  220. if new != nil {
  221. list += "Name: Closed Account \n"
  222. } else {
  223. x, _ := client.GetContact(xx)
  224. list += fmt.Sprintf("Name: %v \n", x.DisplayName)
  225. status := "status: None\n\n"
  226. if InArray2(MAKERS, targets[n]) {
  227. status = "status: Makers\n\n"
  228. } else if UserBot.GetCreator(targets[n]) {
  229. status = "status: Creator\n\n"
  230. } else if UserBot.GetBuyer(targets[n]) {
  231. status = "status: Buyer\n\n"
  232. } else if UserBot.GetOwner(targets[n]) {
  233. status = "status: Owner\n\n"
  234. } else if UserBot.GetMaster(targets[n]) {
  235. status = "status: Master\n\n"
  236. } else if UserBot.GetAdmin(targets[n]) {
  237. status = "status: Admin\n\n"
  238. } else if InArray2(Room.Gowner, targets[n]) {
  239. status = "status: GroupOwnar\n\n"
  240. } else if InArray2(Room.Gadmin, targets[n]) {
  241. status = "status: GroupAdmin\n\n"
  242. } else if UserBot.GetBot(targets[n]) {
  243. status = "status: Bot\n\n"
  244. } else if Banned.GetFuck(targets[n]) {
  245. status = "status: Fuck\n\n"
  246. } else if Banned.GetBan(targets[n]) {
  247. status = "status: Ban\n\n"
  248. } else if Banned.GetMute(targets[n]) {
  249. status = "status: Mute\n\n"
  250. } else if InArray2(Room.Gban, targets[n]) {
  251. status = "status: Groupban\n\n"
  252. } else if InArray2(Squadlist, targets[n]) {
  253. status = "status: My team\n\n"
  254. } else if UserBot.GetSeller(targets[n]) {
  255. status = "status: My Seller\n\n"
  256. }
  257. list += status
  258. if !InArray2(checkHaid, targets[n]) {
  259. new := CheckLastActive(client, targets[n])
  260. list += new
  261. }
  262. listGroup := "\nMember of:\n"
  263. listPinde := "\nPending of:\n"
  264. grs, _ := client.GetGroupIdsJoined()
  265. groups, _ := client.GetGroups(grs)
  266. for _, x := range groups {
  267. if oop.IsMembers(client, x.ChatMid, targets[n]) == true {
  268. countr = countr + 1
  269. nm, _, _ := client.GetChatList(x.ChatMid)
  270. listGroup += nm + "\n"
  271. }
  272. if oop.IsPending(client, x.ChatMid, targets[n]) == true {
  273. countr1 = countr1 + 1
  274. nm, _, _ := client.GetChatList(x.ChatMid)
  275. listPinde += nm + "\n"
  276. }
  277. }
  278. if countr != 0 {
  279. list += fmt.Sprintf("Groups: %v\n", countr)
  280. } else {
  281. list += "Groups: 0\n"
  282. }
  283. if countr1 != 0 {
  284. list += fmt.Sprintf("Pendings: %v\n", countr1)
  285. } else {
  286. list += "Pendings: 0\n"
  287. }
  288. if countr != 0 {
  289. if !InArray2(checkHaid, targets[n]) {
  290. list += listGroup
  291. }
  292. }
  293. if countr1 != 0 {
  294. if !InArray2(checkHaid, targets[n]) {
  295. list += listPinde
  296. }
  297. }
  298. }
  299. }
  300. client.SendMessage(group, list)
  301. } else if pl == 16 {
  302. list := ""
  303. for n, xx := range targets {
  304. rengs := strconv.Itoa(n + 1)
  305. new := client.Getcontactuser(xx)
  306. if new != nil {
  307. list += rengs + ". Closed Account \n"
  308. } else {
  309. x, _ := client.GetContact(xx)
  310. list += fmt.Sprintf("%v. %v\n", n+1, x.DisplayName)
  311. }
  312. }
  313. client.SendMessage(group, list)
  314. } else if pl == 14 {
  315. list := ""
  316. for n, xx := range targets {
  317. rengs := strconv.Itoa(n + 1)
  318. new := client.Getcontactuser(xx)
  319. if new != nil {
  320. list += rengs + ". Closed Account \n"
  321. } else {
  322. x, _ := client.GetContact(xx)
  323. list += fmt.Sprintf("%v. %v\n_%v\n", n+1, x.DisplayName, targets[n])
  324. }
  325. }
  326. client.SendMessage(group, list)
  327. } else {
  328. if len(targets) > 1 {
  329. creator := []string{}
  330. buyer := []string{}
  331. owner := []string{}
  332. master := []string{}
  333. admin := []string{}
  334. gowner := []string{}
  335. gadmin := []string{}
  336. squad := []string{}
  337. bot := []string{}
  338. ban := []string{}
  339. fuck := []string{}
  340. mute := []string{}
  341. Gban := []string{}
  342. Glist := []string{}
  343. Maker := []string{}
  344. Seller := []string{}
  345. for _, from := range targets {
  346. if MemUser(group, from) && !MemBan2(group, from) {
  347. if !InArray2(Glist, from) {
  348. Glist = append(Glist, from)
  349. }
  350. } else if UserBot.GetCreator(from) {
  351. creator = append(creator, from)
  352. } else if UserBot.GetSeller(from) {
  353. Seller = append(Seller, from)
  354. } else if InArray2(MAKERS, from) {
  355. Maker = append(Maker, from)
  356. } else if UserBot.GetBuyer(from) {
  357. buyer = append(buyer, from)
  358. } else if UserBot.GetOwner(from) {
  359. owner = append(owner, from)
  360. } else if UserBot.GetMaster(from) {
  361. master = append(master, from)
  362. } else if UserBot.GetAdmin(from) {
  363. admin = append(admin, from)
  364. } else if InArray2(Room.Gowner, from) {
  365. gowner = append(gowner, from)
  366. } else if InArray2(Room.Gadmin, from) {
  367. gadmin = append(gadmin, from)
  368. } else if UserBot.GetBot(from) {
  369. bot = append(bot, from)
  370. } else if Banned.GetFuck(from) {
  371. fuck = append(fuck, from)
  372. } else if Banned.GetBan(from) {
  373. ban = append(ban, from)
  374. } else if Banned.GetMute(from) {
  375. mute = append(mute, from)
  376. } else if InArray2(Room.Gban, from) {
  377. Gban = append(Gban, from)
  378. } else if InArray2(Squadlist, from) {
  379. squad = append(squad, from)
  380. }
  381. }
  382. list2 := ""
  383. if len(Glist) != 0 {
  384. if pl == 1 {
  385. list2 += "Promoted as Buyer:\n\n"
  386. } else if pl == 2 {
  387. list2 += "Promoted as Owner:\n\n"
  388. } else if pl == 3 {
  389. list2 += "Promoted as Master:\n\n"
  390. } else if pl == 4 {
  391. list2 += "Promoted as Admin:\n\n"
  392. } else if pl == 5 {
  393. list2 += "Promoted as Bot:\n\n"
  394. } else if pl == 6 {
  395. list2 += "Promoted as Gowner:\n\n"
  396. } else if pl == 7 {
  397. list2 += "Promoted as Gadmin\n\n"
  398. } else if pl == 8 {
  399. list2 += "Added to banlist:\n\n"
  400. } else if pl == 9 {
  401. list2 += "Added to fucklist:\n\n"
  402. } else if pl == 10 {
  403. list2 += "Added to gbanlist:\n\n"
  404. } else if pl == 11 {
  405. list2 += "Added to mutelist:\n\n"
  406. } else if pl == 13 {
  407. list2 += "Added to Creatorlist:\n\n"
  408. } else if pl == 17 {
  409. list2 += "Added to Sellerlist:\n\n"
  410. }
  411. for n, xx := range Glist {
  412. rengs := strconv.Itoa(n + 1)
  413. new := client.Getcontactuser(xx)
  414. if new != nil {
  415. list2 += rengs + ". Closed Account \n"
  416. } else {
  417. x, _ := client.GetContact(xx)
  418. list2 += rengs + ". " + x.DisplayName + "\n"
  419. if pl == 1 {
  420. UserBot.AddBuyer(xx)
  421. } else if pl == 2 {
  422. UserBot.AddOwner(xx)
  423. } else if pl == 13 {
  424. UserBot.AddCreator(xx)
  425. } else if pl == 3 {
  426. UserBot.AddMaster(xx)
  427. } else if pl == 4 {
  428. UserBot.AddAdmin(xx)
  429. } else if pl == 5 {
  430. UserBot.AddBot(xx)
  431. } else if pl == 6 {
  432. Room.Gowner = append(Room.Gowner, xx)
  433. } else if pl == 7 {
  434. Room.Gadmin = append(Room.Gadmin, xx)
  435. } else if pl == 8 {
  436. Banned.AddBan(xx)
  437. } else if pl == 9 {
  438. Banned.AddBan(xx)
  439. } else if pl == 10 {
  440. Addgban(xx, group)
  441. } else if pl == 11 {
  442. Banned.AddBan(xx)
  443. } else if pl == 17 {
  444. UserBot.AddSeller(xx)
  445. }
  446. }
  447. }
  448. if pl == 2 {
  449. logAccess(client, group, sinder, "owner", Glist, 2)
  450. } else if pl == 3 {
  451. logAccess(client, group, sinder, "master", Glist, 2)
  452. } else if pl == 4 {
  453. logAccess(client, group, sinder, "admin", Glist, 2)
  454. } else if pl == 5 {
  455. logAccess(client, group, sinder, "bot", Glist, 2)
  456. } else if pl == 6 {
  457. logAccess(client, group, sinder, "gowner", Glist, 2)
  458. } else if pl == 7 {
  459. logAccess(client, group, sinder, "gadmin", Glist, 2)
  460. } else if pl == 8 {
  461. logAccess(client, group, sinder, "ban", Glist, 2)
  462. } else if pl == 9 {
  463. logAccess(client, group, sinder, "fuck", Glist, 2)
  464. } else if pl == 10 {
  465. logAccess(client, group, sinder, "gban", Glist, 2)
  466. } else if pl == 11 {
  467. logAccess(client, group, sinder, "mute", Glist, 2)
  468. }
  469. }
  470. list := "Users have access:\n"
  471. if len(creator) != 0 {
  472. list += "\n𝗘𝘅𝗶𝘀𝘁 𝗶𝗻 𝘁𝗲𝗮𝗺:\n"
  473. for n, xx := range creator {
  474. rengs := strconv.Itoa(n + 1)
  475. new := client.Getcontactuser(xx)
  476. if new != nil {
  477. list += rengs + ". Closed Account \n"
  478. } else {
  479. x, _ := client.GetContact(xx)
  480. list += rengs + ". " + x.DisplayName + "\n"
  481. }
  482. }
  483. }
  484. if len(Seller) != 0 {
  485. list += "\n𝗘𝘅𝗶𝘀𝘁 𝗶𝗻 𝗦𝗲𝗹𝗹𝗲𝗿:\n"
  486. for n, xx := range Seller {
  487. rengs := strconv.Itoa(n + 1)
  488. new := client.Getcontactuser(xx)
  489. if new != nil {
  490. list += rengs + ". Closed Account \n"
  491. } else {
  492. x, _ := client.GetContact(xx)
  493. list += rengs + ". " + x.DisplayName + "\n"
  494. }
  495. }
  496. }
  497. if len(Maker) != 0 {
  498. list += "\n𝗘𝘅𝗶𝘀𝘁 𝗶𝗻 𝘁𝗲𝗮𝗺:\n"
  499. for n, xx := range Maker {
  500. rengs := strconv.Itoa(n + 1)
  501. new := client.Getcontactuser(xx)
  502. if new != nil {
  503. list += rengs + ". Closed Account \n"
  504. } else {
  505. x, _ := client.GetContact(xx)
  506. list += rengs + ". " + x.DisplayName + "\n"
  507. }
  508. }
  509. }
  510. if len(buyer) != 0 {
  511. list += "\n𝗘𝘅𝗶𝘀𝘁 𝗶𝗻 𝗯𝘂𝘆𝗲𝗿𝘀:\n"
  512. for n, xx := range buyer {
  513. rengs := strconv.Itoa(n + 1)
  514. new := client.Getcontactuser(xx)
  515. if new != nil {
  516. list += rengs + ". Closed Account \n"
  517. } else {
  518. x, _ := client.GetContact(xx)
  519. list += rengs + ". " + x.DisplayName + "\n"
  520. }
  521. }
  522. }
  523. if len(owner) != 0 {
  524. list += "\n𝗘𝘅𝗶𝘀𝘁 𝗶𝗻 𝗼𝘄𝗻𝗲𝗿𝘀:\n"
  525. for n, xx := range owner {
  526. rengs := strconv.Itoa(n + 1)
  527. new := client.Getcontactuser(xx)
  528. if new != nil {
  529. list += rengs + ". Closed Account \n"
  530. } else {
  531. x, _ := client.GetContact(xx)
  532. list += rengs + ". " + x.DisplayName + "\n"
  533. }
  534. }
  535. }
  536. if len(master) != 0 {
  537. list += "\n𝗘𝘅𝗶𝘀𝘁 𝗶𝗻 𝗺𝗮𝘀𝘁𝗲𝗿𝘀:\n"
  538. for n, xx := range master {
  539. rengs := strconv.Itoa(n + 1)
  540. new := client.Getcontactuser(xx)
  541. if new != nil {
  542. list += rengs + ". Closed Account \n"
  543. } else {
  544. x, _ := client.GetContact(xx)
  545. list += rengs + ". " + x.DisplayName + "\n"
  546. }
  547. }
  548. }
  549. if len(admin) != 0 {
  550. list += "\n𝗘𝘅𝗶𝘀𝘁 𝗶𝗻 𝗮𝗱𝗺𝗶𝗻𝘀:\n"
  551. for n, xx := range admin {
  552. rengs := strconv.Itoa(n + 1)
  553. new := client.Getcontactuser(xx)
  554. if new != nil {
  555. list += rengs + ". Closed Account \n"
  556. } else {
  557. x, _ := client.GetContact(xx)
  558. list += rengs + ". " + x.DisplayName + "\n"
  559. }
  560. }
  561. }
  562. if len(gowner) != 0 {
  563. list += "\n𝗘𝘅𝗶𝘀𝘁 𝗶𝗻 𝗴𝗼𝘄𝗻𝗲𝗿𝘀:\n"
  564. for n, xx := range gowner {
  565. rengs := strconv.Itoa(n + 1)
  566. new := client.Getcontactuser(xx)
  567. if new != nil {
  568. list += rengs + ". Closed Account \n"
  569. } else {
  570. x, _ := client.GetContact(xx)
  571. list += rengs + ". " + x.DisplayName + "\n"
  572. }
  573. }
  574. }
  575. if len(gadmin) != 0 {
  576. list += "\n𝗘𝘅𝗶𝘀𝘁 𝗶𝗻 𝗴𝗮𝗱𝗺𝗶𝗻𝘀:\n"
  577. for n, xx := range gadmin {
  578. rengs := strconv.Itoa(n + 1)
  579. new := client.Getcontactuser(xx)
  580. if new != nil {
  581. list += rengs + ". Closed Account \n"
  582. } else {
  583. x, _ := client.GetContact(xx)
  584. list += rengs + ". " + x.DisplayName + "\n"
  585. }
  586. }
  587. }
  588. if len(bot) != 0 {
  589. list += "\n𝗘𝘅𝗶𝘀𝘁 𝗶𝗻 𝗯𝗼𝘁𝗹𝗶𝘀𝘁\n"
  590. for n, xx := range bot {
  591. rengs := strconv.Itoa(n + 1)
  592. new := client.Getcontactuser(xx)
  593. if new != nil {
  594. list += rengs + ". Closed Account \n"
  595. } else {
  596. x, _ := client.GetContact(xx)
  597. list += rengs + ". " + x.DisplayName + "\n"
  598. }
  599. }
  600. }
  601. if len(squad) != 0 {
  602. list += "\n𝗘𝘅𝗶𝘀𝘁 𝗶𝗻 𝘀𝗾𝘂𝗮𝗱:\n"
  603. for n, xx := range squad {
  604. rengs := strconv.Itoa(n + 1)
  605. new := client.Getcontactuser(xx)
  606. if new != nil {
  607. list += rengs + ". Closed Account \n"
  608. } else {
  609. x, _ := client.GetContact(xx)
  610. list += rengs + ". " + x.DisplayName + "\n"
  611. }
  612. }
  613. }
  614. if len(ban) != 0 {
  615. list += "𝗘𝘅𝗶𝘀𝘁.𝗶𝗻 𝗯𝗮𝗻𝗹𝗶𝘀𝘁:\n"
  616. for n, xx := range ban {
  617. rengs := strconv.Itoa(n + 1)
  618. new := client.Getcontactuser(xx)
  619. if new != nil {
  620. list += rengs + ". Closed Account \n"
  621. } else {
  622. x, _ := client.GetContact(xx)
  623. list += rengs + ". " + x.DisplayName + "\n"
  624. }
  625. }
  626. }
  627. if len(fuck) != 0 {
  628. list += "\n𝗘𝘅𝗶𝘀𝘁 𝗶𝗻 𝗳𝘂𝗰𝗸𝗹𝗶𝘀𝘁:\n"
  629. for n, xx := range fuck {
  630. rengs := strconv.Itoa(n + 1)
  631. new := client.Getcontactuser(xx)
  632. if new != nil {
  633. list += rengs + ". Closed Account \n"
  634. } else {
  635. x, _ := client.GetContact(xx)
  636. list += rengs + ". " + x.DisplayName + "\n"
  637. }
  638. }
  639. }
  640. if len(Gban) != 0 {
  641. list += "\n𝗘𝘅𝗶𝘀𝘁 𝗶𝗻 𝗴𝗯𝗮𝗻𝗹𝗶𝘀𝘁:\n\n"
  642. for n, xx := range Gban {
  643. rengs := strconv.Itoa(n + 1)
  644. new := client.Getcontactuser(xx)
  645. if new != nil {
  646. list += rengs + ". Closed Account \n"
  647. } else {
  648. x, _ := client.GetContact(xx)
  649. list += rengs + ". " + x.DisplayName + "\n"
  650. }
  651. }
  652. }
  653. if len(mute) != 0 {
  654. list += "\n𝗘𝘅𝗶𝘀𝘁 𝗶𝗻 𝗠𝘂𝘁𝗲𝗹𝗶𝘀𝘁:\n\n"
  655. for n, xx := range mute {
  656. rengs := strconv.Itoa(n + 1)
  657. new := client.Getcontactuser(xx)
  658. if new != nil {
  659. list += rengs + ". Closed Account \n"
  660. } else {
  661. x, _ := client.GetContact(xx)
  662. list += rengs + ". " + x.DisplayName + "\n"
  663. }
  664. }
  665. }
  666. if list != "Users have access:\n" {
  667. if list2 != "" {
  668. list2 += "\n"
  669. }
  670. client.SendMessage(group, list2+list)
  671. } else {
  672. client.SendMessage(group, list2)
  673. }
  674. } else {
  675. list := ""
  676. for n, from := range targets {
  677. if InArray2(MAKERS, from) {
  678. list += "User have access exist in taem list."
  679. } else if UserBot.GetCreator(from) {
  680. list += "User have access exist in Creator list."
  681. } else if UserBot.GetSeller(from) {
  682. list += "User have access exist in seller list."
  683. } else if UserBot.GetBuyer(from) {
  684. list += "User have access exist in buyer list."
  685. } else if UserBot.GetOwner(from) {
  686. list += "User have access exist in owner list."
  687. } else if UserBot.GetMaster(from) {
  688. list += "User have access exist in master list."
  689. } else if UserBot.GetAdmin(from) {
  690. list += "User have access exist in admin list."
  691. } else if InArray2(Room.Gowner, from) {
  692. list += "User have access exist in gowner list."
  693. } else if InArray2(Room.Gadmin, from) {
  694. list += "User have access exist in gadmin list."
  695. } else if UserBot.GetBot(from) {
  696. list += "User have access exist in bot list."
  697. } else if Banned.GetFuck(from) {
  698. list += "User have access exist in fuck list."
  699. } else if Banned.GetBan(from) {
  700. list += "User have access exist in ban list."
  701. } else if InArray2(Room.Gban, from) {
  702. list += "User have access exist in gban list."
  703. } else if InArray2(Squadlist, from) {
  704. list += "User have access exist in squad list."
  705. } else if Banned.GetMute(from) {
  706. list += "User have access exist in mute list."
  707. } else if MemUser(group, from) && !MemBan2(group, from) {
  708. if pl == 1 {
  709. list += "Promoted as Buyer:\n"
  710. } else if pl == 2 {
  711. list += "Promoted as Owner:\n"
  712. } else if pl == 3 {
  713. list += "Promoted as Master:\n"
  714. } else if pl == 4 {
  715. list += "Promoted as Admin:\n"
  716. } else if pl == 5 {
  717. list += "Promoted as Bot:\n"
  718. } else if pl == 6 {
  719. list += "Promoted as Gowner:\n"
  720. } else if pl == 7 {
  721. list += "Promoted as Gadmin:\n"
  722. } else if pl == 8 {
  723. list += "Added to banlist:\n"
  724. } else if pl == 9 {
  725. list += "Added to fucklist:\n"
  726. } else if pl == 10 {
  727. list += "Added to gbanlist:\n"
  728. } else if pl == 11 {
  729. list += "Added to mutelist:\n"
  730. } else if pl == 13 {
  731. list += "Added to Creatorlist:\n"
  732. } else if pl == 17 {
  733. list += "Added to Sellerlist:\n"
  734. }
  735. rengs := strconv.Itoa(n + 1)
  736. new := client.Getcontactuser(from)
  737. if new != nil {
  738. list += "\n " + rengs + ". Closed Account"
  739. } else {
  740. x, _ := client.GetContact(from)
  741. list += "\n " + rengs + ". " + x.DisplayName
  742. if pl == 1 {
  743. UserBot.AddBuyer(from)
  744. } else if pl == 2 {
  745. UserBot.AddOwner(from)
  746. } else if pl == 3 {
  747. UserBot.AddMaster(from)
  748. } else if pl == 4 {
  749. UserBot.AddAdmin(from)
  750. } else if pl == 5 {
  751. UserBot.AddBot(from)
  752. } else if pl == 6 {
  753. Room.Gowner = append(Room.Gowner, from)
  754. } else if pl == 13 {
  755. UserBot.AddCreator(from)
  756. } else if pl == 7 {
  757. Room.Gadmin = append(Room.Gadmin, from)
  758. } else if pl == 8 {
  759. autokickban(client, group, from)
  760. Banned.AddBan(from)
  761. } else if pl == 9 {
  762. Banned.AddFuck(from)
  763. } else if pl == 10 {
  764. Addgban(from, group)
  765. } else if pl == 11 {
  766. Banned.AddMute(from)
  767. } else if pl == 17 {
  768. UserBot.AddSeller(from)
  769. }
  770. }
  771. if pl == 2 {
  772. logAccess(client, group, sinder, "owner", []string{from}, 2)
  773. } else if pl == 3 {
  774. logAccess(client, group, sinder, "master", []string{from}, 2)
  775. } else if pl == 4 {
  776. logAccess(client, group, sinder, "admin", []string{from}, 2)
  777. } else if pl == 5 {
  778. logAccess(client, group, sinder, "bot", []string{from}, 2)
  779. } else if pl == 6 {
  780. logAccess(client, group, sinder, "gowner", []string{from}, 2)
  781. } else if pl == 7 {
  782. logAccess(client, group, sinder, "gadmin", []string{from}, 2)
  783. } else if pl == 8 {
  784. logAccess(client, group, sinder, "ban", []string{from}, 2)
  785. } else if pl == 9 {
  786. logAccess(client, group, sinder, "fuck", []string{from}, 2)
  787. } else if pl == 10 {
  788. logAccess(client, group, sinder, "gban", []string{from}, 2)
  789. } else if pl == 11 {
  790. logAccess(client, group, sinder, "mute", []string{from}, 2)
  791. }
  792. }
  793. }
  794. client.SendMessage(group, list)
  795. }
  796. }
  797. }
  798. func GetSquad(tok *oop.Account, to string) []*oop.Account {
  799. defer panicHandle("GetSquad")
  800. nm, memlist, invitee := tok.GetChatList(to)
  801. Bots := []*oop.Account{}
  802. MIdbot := []string{}
  803. GoClint := []*oop.Account{}
  804. Gomid := []string{}
  805. for _, ym := range memlist {
  806. if InArray2(Squadlist, ym) {
  807. idx := GetKorban(ym)
  808. MIdbot = append(MIdbot, ym)
  809. Bots = append(Bots, idx)
  810. }
  811. }
  812. room := oop.GetRoom(to)
  813. room.Name = nm
  814. for _, ym := range invitee {
  815. if InArray2(Squadlist, ym) {
  816. Gomid = append(Gomid, ym)
  817. idx := GetKorban(ym)
  818. GoClint = append(GoClint, idx)
  819. }
  820. }
  821. room.AddSquad(MIdbot, Bots, GoClint, Gomid)
  822. return Bots
  823. }
  824. func AutojoinQr(client *oop.Account, to string) {
  825. defer panicHandle("AutojoinQr")
  826. ti, err := client.ReissueChatTicket(to)
  827. if err == nil {
  828. go client.UpdateChatQrV2(to, false)
  829. all := []*oop.Account{}
  830. room := oop.GetRoom(to)
  831. cuk := room.Client
  832. for _, x := range ClientBot {
  833. if !oop.InArrayCl(cuk, x) && !oop.InArrayCl(oop.KickBans, x) && !oop.InArrayCl(room.GoClient, x) {
  834. all = append(all, x)
  835. }
  836. }
  837. sort.Slice(all, func(i, j int) bool {
  838. return all[i].KickPoint < all[j].KickPoint
  839. })
  840. var wg sync.WaitGroup
  841. wi := GetSquad(client, to)
  842. for i := 0; i < len(all); i++ {
  843. l := all[i]
  844. if l != client && !oop.InArrayCl(wi, l) {
  845. wg.Add(1)
  846. go func() {
  847. l.AcceptTicket(to, ti)
  848. wg.Done()
  849. }()
  850. }
  851. }
  852. wg.Wait()
  853. client.UpdateChatQrV2(to, true)
  854. GetSquad(client, to)
  855. }
  856. }
  857. func qrGo(cl *oop.Account, cans []*oop.Account, to string) {
  858. defer panicHandle("QR_go")
  859. Room := oop.GetRoom(to)
  860. mes := make(chan bool)
  861. go func() {
  862. err := cl.UpdateChatQrV2(to, false)
  863. if err != nil {
  864. mes <- false
  865. } else {
  866. mes <- true
  867. }
  868. }()
  869. Room.Qr = false
  870. var ticket string
  871. link, err := cl.ReissueChatTicket(to)
  872. if err == nil {
  873. ticket = link
  874. } else {
  875. ticket = "error"
  876. }
  877. var wg sync.WaitGroup
  878. if ticket != "error" && ticket != "" {
  879. ok := <-mes
  880. if !ok {
  881. return
  882. }
  883. for _, cc := range cans {
  884. wg.Add(1)
  885. go func(c *oop.Account) {
  886. err := c.AcceptTicket(to, ticket)
  887. if err != nil {
  888. fmt.Println(err)
  889. }
  890. wg.Done()
  891. }(cc)
  892. }
  893. wg.Wait()
  894. Room.Qr = true
  895. }
  896. if Room.Qr {
  897. go func() {
  898. err := cl.UpdateChatQrV2(to, true)
  899. if err != nil {
  900. mes <- true
  901. } else {
  902. mes <- false
  903. }
  904. }()
  905. }
  906. }
  907. func hstg(to, u string) {
  908. room := oop.GetRoom(to)
  909. if !InArray2(room.LeaveBack, u) {
  910. room.LeaveBack = append(room.LeaveBack, u)
  911. }
  912. }
  913. func RunBot(client *oop.Account, ch chan int) {
  914. defer panicHandle("RunBot")
  915. runtime.GOMAXPROCS(cpu)
  916. client.Revision = -1
  917. for {
  918. multiFunc, err := client.FetchOps(25)
  919. if err != nil || len(multiFunc) == 0 {
  920. continue
  921. }
  922. go func(fetch []*talkservice.Operation) {
  923. for _, op := range multiFunc {
  924. if op.Type == 124 {
  925. runtime.GOMAXPROCS(cpu)
  926. Optime := op.CreatedTime
  927. rngcmd := GetComs(4, "invitebot")
  928. Group, user := op.Param1, op.Param2
  929. invited := strings.Split(op.Param3, "\x1e")
  930. Room := oop.GetRoom(Group)
  931. if InArray2(invited, client.MID) {
  932. if oop.IoGOBot(Group, client) {
  933. if InArray2(client.Squads, user) {
  934. client.AcceptGroupInvitationNormal(Group)
  935. if client.Limited == false {
  936. if !InArrayInt64(cekGo, Optime) {
  937. cekGo = append(cekGo, Optime)
  938. AcceptJoin(client, Group)
  939. }
  940. }
  941. } else if UserBot.GetBot(user) {
  942. client.AcceptGroupInvitationNormal(Group)
  943. if client.Limited == false {
  944. if !InArrayInt64(cekGo, Optime) {
  945. cekGo = append(cekGo, Optime)
  946. AcceptJoin(client, Group)
  947. }
  948. }
  949. } else if GetCodeprem(rngcmd, user, Group) {
  950. client.AcceptGroupInvitationNormal(Group)
  951. if client.Limited == false {
  952. if !InArrayInt64(cekGo, Optime) {
  953. cekGo = append(cekGo, Optime)
  954. AcceptJoin(client, Group)
  955. }
  956. }
  957. } else {
  958. grs, _ := client.GetGroupIdsJoined()
  959. if InArray2(grs, Group) {
  960. client.LeaveGroup(Group)
  961. fl, _ := client.GetAllContactIds()
  962. if InArray2(fl, user) {
  963. client.UnFriend(user)
  964. }
  965. }
  966. }
  967. }
  968. } else {
  969. Optime := op.CreatedTime
  970. if Room.ProInvite {
  971. if MemUser(Group, user) {
  972. go func() {
  973. if filterWar.ceki(user) {
  974. kickPelaku(client, Group, user)
  975. filterWar.deli(user)
  976. Banned.AddBan(user)
  977. }
  978. }()
  979. if filterWar.ceko(Optime) {
  980. Room.ListInvited = invited
  981. CancelProtect(client, invited, Group)
  982. }
  983. } else {
  984. if filterWar.ceko(Optime) {
  985. cancelallcek(client, invited, Group)
  986. }
  987. }
  988. } else {
  989. if MemBan(Group, user) {
  990. go func() {
  991. if filterWar.ceki(user) {
  992. kickPelaku(client, Group, user)
  993. filterWar.deli(user)
  994. }
  995. }()
  996. if filterWar.ceko(Optime) {
  997. BanAll(invited)
  998. cancelall(client, invited, Group)
  999. }
  1000. } else {
  1001. if MemUser(Group, user) {
  1002. go func() {
  1003. if filterWar.ceki(user) {
  1004. for _, vo := range invited {
  1005. if MemBan(Group, vo) {
  1006. kickPelaku(client, Group, user)
  1007. Banned.AddBan(user)
  1008. break
  1009. }
  1010. }
  1011. filterWar.deli(user)
  1012. }
  1013. }()
  1014. if filterWar.ceko(Optime) {
  1015. cancelallcek(client, invited, Group)
  1016. }
  1017. }
  1018. }
  1019. }
  1020. }
  1021. if _, ok := filtermsg.Get(Optime); !ok {
  1022. filtermsg.Set(Optime, client)
  1023. LogOp(op, client)
  1024. LogGet(op)
  1025. }
  1026. } else if op.Type == 133 {
  1027. runtime.GOMAXPROCS(cpu)
  1028. Optime := op.CreatedTime
  1029. Group, user, Invited := op.Param1, op.Param2, op.Param3
  1030. Room := oop.GetRoom(Group)
  1031. if client.MID == Invited {
  1032. oop.Gones(Group, client)
  1033. if MemUser(Group, user) {
  1034. Banned.AddBan(user)
  1035. }
  1036. } else if !InArray2(Room.GoMid, client.MID) {
  1037. if InArray2(client.Squads, Invited) {
  1038. if MemUser(Group, user) {
  1039. if oop.IoGOBot(Group, client) {
  1040. Banned.AddBan(user)
  1041. go func() {
  1042. if filterWar.cek(user) {
  1043. groupBackupKick(client, Group, user, true)
  1044. filterWar.del(user)
  1045. }
  1046. }()
  1047. if filterWar.cek(Invited) {
  1048. groupBackupInv(client, Group, Optime, Invited)
  1049. filterWar.del(Invited)
  1050. }
  1051. }
  1052. }
  1053. } else {
  1054. if !MemUserN(Group, Invited) {
  1055. if Checkkickuser(Group, user, Invited) {
  1056. back(Group, Invited)
  1057. if filterWar.ceki(user) {
  1058. kickPelaku(client, Group, user)
  1059. filterWar.deli(user)
  1060. if MemUser(Group, user) {
  1061. Banned.AddBan(user)
  1062. }
  1063. }
  1064. }
  1065. } else {
  1066. if Room.ProKick {
  1067. if MemUser(Group, user) {
  1068. if Room.Backup {
  1069. back(Group, Invited)
  1070. }
  1071. if _, ok := Nkick.Get(user); !ok {
  1072. Nkick.Set(user, 1)
  1073. kickPelaku(client, Group, user)
  1074. Banned.AddBan(user)
  1075. }
  1076. }
  1077. }
  1078. }
  1079. }
  1080. } else {
  1081. if MemUser(Group, Invited) {
  1082. if MemUser(Group, user) {
  1083. back(Group, Invited)
  1084. Banned.AddBan(user)
  1085. _, memlist := client.GetGroupMember(Group)
  1086. oke := []string{}
  1087. for mid, _ := range memlist {
  1088. if InArray2(Squadlist, mid) {
  1089. oke = append(oke, mid)
  1090. }
  1091. }
  1092. if len(oke) == 0 {
  1093. if !InArrayInt64(cekGo, Optime) {
  1094. cekGo = append(cekGo, Optime)
  1095. cls := []*oop.Account{}
  1096. Bot2 := Room.Bot
  1097. bots := Room.HaveClient
  1098. for n, cl := range Room.GoClient {
  1099. if n < 2 {
  1100. go cl.AcceptGroupInvitationNormal(Group)
  1101. cls = append(cls, cl)
  1102. }
  1103. }
  1104. cc := len(cls)
  1105. if cc != 0 {
  1106. Purgesip(Group, cls[0])
  1107. if Autojoin == "qr" {
  1108. qrGo(cls[0], bots, Group)
  1109. } else if Autojoin == "invite" {
  1110. cls[0].InviteIntoChatPollVer(Group, Bot2)
  1111. }
  1112. for _, cl := range cls {
  1113. Room.ConvertGo(cl)
  1114. }
  1115. }
  1116. }
  1117. }
  1118. }
  1119. }
  1120. }
  1121. if _, ok := filtermsg.Get(Optime); !ok {
  1122. filtermsg.Set(Optime, client)
  1123. LogOp(op, client)
  1124. LogGet(op)
  1125. }
  1126. } else if op.Type == 130 {
  1127. runtime.GOMAXPROCS(cpu)
  1128. Group, user := op.Param1, op.Param2
  1129. Room := oop.GetRoom(Group)
  1130. if oop.IoGOBot(Group, client) {
  1131. if Room.ProJoin {
  1132. if MemUser(Group, user) {
  1133. if filterWar.ceki(user) {
  1134. kickPelaku(client, Group, user)
  1135. filterWar.deli(user)
  1136. Banned.AddBan(user)
  1137. }
  1138. }
  1139. } else {
  1140. if MemBan(Group, user) {
  1141. if MemUser(Group, user) {
  1142. if filterWar.ceki(user) {
  1143. kickPelaku(client, Group, user)
  1144. filterWar.deli(user)
  1145. Banned.AddBan(user)
  1146. }
  1147. }
  1148. } else {
  1149. if InArray2(Room.ListInvited, user) {
  1150. if MemUser(Group, user) {
  1151. if cekjoin(user) {
  1152. kickPelaku(client, Group, user)
  1153. deljoin(user)
  1154. Room.ListInvited = Remove(Room.ListInvited, user)
  1155. }
  1156. } else {
  1157. Room.ListInvited = Remove(Room.ListInvited, user)
  1158. }
  1159. } else {
  1160. if Room.Welcome {
  1161. if _, ok := cewel.Get(user); !ok {
  1162. cewel.Set(user, 1)
  1163. if cekjoin(user) {
  1164. if !InArray2(Squadlist, user) {
  1165. Room.WelsomeSet(client, Group, user)
  1166. }
  1167. }
  1168. }
  1169. }
  1170. }
  1171. }
  1172. }
  1173. }
  1174. Optime := op.CreatedTime
  1175. if _, ok := filtermsg.Get(Optime); !ok {
  1176. filtermsg.Set(Optime, client)
  1177. LogOp(op, client)
  1178. LogGet(op)
  1179. }
  1180. } else if op.Type == 122 {
  1181. runtime.GOMAXPROCS(cpu)
  1182. Group, user, invited := op.Param1, op.Param2, op.Param3
  1183. Optime := op.CreatedTime
  1184. Room := oop.GetRoom(Group)
  1185. if client.Limited == false && oop.IoGOBot(Group, client) {
  1186. if MemUser(Group, user) {
  1187. if Room.ProQr || AutoproN == true {
  1188. if invited == "4" {
  1189. if cekOp2(Optime) {
  1190. go func() {
  1191. cans := oop.Actor(Group)
  1192. for _, cl := range cans {
  1193. err := cl.UpdateChatQrV2(Group, true)
  1194. if err == nil {
  1195. break
  1196. }
  1197. }
  1198. }()
  1199. if filterWar.ceki(user) {
  1200. kickPelaku(client, Group, user)
  1201. filterWar.deli(user)
  1202. Banned.AddBan(user)
  1203. }
  1204. }
  1205. }
  1206. } else if Room.ProName || AutoproN == true {
  1207. if invited == "1" {
  1208. if cekOp2(Optime) {
  1209. go func() {
  1210. cans := oop.Actor(Group)
  1211. for _, cl := range cans {
  1212. err := cl.UpdateChatName(Group, Room.Name)
  1213. if err == nil {
  1214. break
  1215. }
  1216. }
  1217. }()
  1218. if filterWar.ceki(user) {
  1219. kickPelaku(client, Group, user)
  1220. filterWar.deli(user)
  1221. }
  1222. }
  1223. }
  1224. } else {
  1225. if MemBan(Group, user) {
  1226. if invited == "4" {
  1227. if cekOp2(Optime) {
  1228. go func() {
  1229. cans := oop.Actor(Group)
  1230. for _, cl := range cans {
  1231. err := cl.UpdateChatQrV2(Group, true)
  1232. if err == nil {
  1233. break
  1234. }
  1235. }
  1236. }()
  1237. if filterWar.ceki(user) {
  1238. kickPelaku(client, Group, user)
  1239. filterWar.deli(user)
  1240. Banned.AddBan(user)
  1241. }
  1242. }
  1243. } else if invited == "1" {
  1244. if cekOp2(Optime) {
  1245. go func() {
  1246. cans := oop.Actor(Group)
  1247. for _, cl := range cans {
  1248. err := cl.UpdateChatName(Group, Room.Name)
  1249. if err == nil {
  1250. break
  1251. }
  1252. }
  1253. }()
  1254. if filterWar.ceki(user) {
  1255. kickPelaku(client, Group, user)
  1256. filterWar.deli(user)
  1257. }
  1258. }
  1259. }
  1260. }
  1261. }
  1262. }
  1263. }
  1264. if _, ok := filtermsg.Get(Optime); !ok {
  1265. filtermsg.Set(Optime, client)
  1266. LogOp(op, client)
  1267. LogGet(op)
  1268. }
  1269. } else if op.Type == 126 {
  1270. runtime.GOMAXPROCS(cpu)
  1271. Optime := op.CreatedTime
  1272. Group, user, Invited := op.Param1, op.Param2, op.Param3
  1273. Room := oop.GetRoom(Group)
  1274. if client.MID == Invited {
  1275. oop.Gones(Group, client)
  1276. if MemUser(Group, user) {
  1277. Banned.AddBan(user)
  1278. }
  1279. } else if !InArray2(Room.GoMid, client.MID) {
  1280. if InArray2(client.Squads, Invited) {
  1281. if MemUser(Group, user) {
  1282. if oop.IoGOBot(Group, client) {
  1283. Banned.AddBan(user)
  1284. go func() {
  1285. if filterWar.cek(user) {
  1286. groupBackupKick(client, Group, user, true)
  1287. filterWar.del(user)
  1288. }
  1289. }()
  1290. if filterWar.cek(Invited) {
  1291. groupBackupInv(client, Group, Optime, Invited)
  1292. filterWar.del(Invited)
  1293. }
  1294. }
  1295. }
  1296. } else {
  1297. if !MemUserN(Group, Invited) {
  1298. if Checkkickuser(Group, user, Invited) {
  1299. back(Group, Invited)
  1300. if filterWar.ceki(user) {
  1301. kickPelaku(client, Group, user)
  1302. filterWar.deli(user)
  1303. if MemUser(Group, user) {
  1304. Banned.AddBan(user)
  1305. }
  1306. }
  1307. }
  1308. } else {
  1309. if Room.ProCancel {
  1310. if MemUser(Group, user) {
  1311. if Room.Backup {
  1312. back(Group, Invited)
  1313. }
  1314. if _, ok := Nkick.Get(user); !ok {
  1315. Nkick.Set(user, 1)
  1316. kickPelaku(client, Group, user)
  1317. Banned.AddBan(user)
  1318. }
  1319. }
  1320. }
  1321. }
  1322. }
  1323. } else {
  1324. if MemUser(Group, Invited) {
  1325. if MemUser(Group, user) {
  1326. back(Group, Invited)
  1327. Banned.AddBan(user)
  1328. _, memlist := client.GetGroupMember(Group)
  1329. oke := []string{}
  1330. for mid, _ := range memlist {
  1331. if InArray2(Squadlist, mid) {
  1332. oke = append(oke, mid)
  1333. }
  1334. }
  1335. if len(oke) == 0 {
  1336. if !InArrayInt64(cekGo, Optime) {
  1337. cekGo = append(cekGo, Optime)
  1338. cls := []*oop.Account{}
  1339. Bot := Room.Bot
  1340. bots := Room.HaveClient
  1341. for n, cl := range Room.GoClient {
  1342. if n < 2 {
  1343. go cl.AcceptGroupInvitationNormal(Group)
  1344. cls = append(cls, cl)
  1345. }
  1346. }
  1347. cc := len(cls)
  1348. if cc != 0 {
  1349. Purgesip(Group, cls[0])
  1350. if Autojoin == "qr" {
  1351. qrGo(cls[0], bots, Group)
  1352. } else if Autojoin == "invite" {
  1353. cls[0].InviteIntoChatPollVer(Group, Bot)
  1354. }
  1355. for _, cl := range cls {
  1356. Room.ConvertGo(cl)
  1357. }
  1358. }
  1359. }
  1360. }
  1361. }
  1362. }
  1363. }
  1364. if _, ok := filtermsg.Get(Optime); !ok {
  1365. filtermsg.Set(Optime, client)
  1366. LogOp(op, client)
  1367. LogGet(op)
  1368. }
  1369. } else if op.Type == 5 {
  1370. Group := op.Param1
  1371. if LogMode && !InArray2(client.Squads, Group) {
  1372. logAccess(client, client.Namebot, Group, "addfrind", []string{}, 2)
  1373. }
  1374. } else if op.Type == 55 {
  1375. Optime := op.CreatedTime
  1376. Group, user := op.Param1, op.Param2
  1377. if client.Limited == false && oop.IoGOBot(Group, client) {
  1378. if cekOp(Optime) {
  1379. if MemBan(Group, user) {
  1380. kickPelaku(client, Group, user)
  1381. } else {
  1382. Room := oop.GetRoom(Group)
  1383. if Room.Lurk && !InArray2(checkHaid, user) {
  1384. Room.CheckLurk(client, Group, user)
  1385. }
  1386. }
  1387. }
  1388. }
  1389. if _, ok := filtermsg.Get(Optime); !ok {
  1390. filtermsg.Set(Optime, client)
  1391. LogOp(op, client)
  1392. LogGet(op)
  1393. }
  1394. } else if op.Type == 26 {
  1395. msg := op.Message
  1396. Optime := op.CreatedTime
  1397. if msg.ContentType != 18 {
  1398. if _, ok := Command.Get(Optime); !ok {
  1399. Command.Set(Optime, client)
  1400. if _, ok := filterop.Get(Optime); !ok {
  1401. filterop.Set(Optime, 1)
  1402. Bot(op, client, ch)
  1403. }
  1404. }
  1405. }
  1406. if _, ok := filtermsg.Get(Optime); !ok {
  1407. filtermsg.Set(Optime, client)
  1408. LogOp(op, client)
  1409. LogGet(op)
  1410. }
  1411. } else if op.Type == 128 {
  1412. Optime := op.CreatedTime
  1413. Group, user := op.Param1, op.Param2
  1414. if !InArray2(Squadlist, user) {
  1415. Room := oop.GetRoom(Group)
  1416. if Room.Backleave {
  1417. jangan := true
  1418. tm, ok := botleave.Get(user)
  1419. if ok {
  1420. if time.Now().Sub(tm.(time.Time)) < 5*time.Second {
  1421. jangan = false
  1422. }
  1423. }
  1424. if jangan {
  1425. if filterWar.ceki(user) {
  1426. if !MemBan(Group, user) && !InArray2(Squadlist, user) && !UserBot.GetBot(user) && !InArray2(Room.GoMid, user) {
  1427. hstg(Group, user)
  1428. Room.Leave = time.Now()
  1429. }
  1430. }
  1431. }
  1432. } else {
  1433. if Room.Leavebool {
  1434. if _, ok := cleave.Get(user); !ok {
  1435. cleave.Set(user, 1)
  1436. if !MemBan(Group, user) && !InArray2(Squadlist, user) && !UserBot.GetBot(user) && !InArray2(Room.GoMid, user) {
  1437. Room.LeaveSet(client, Group, user)
  1438. }
  1439. }
  1440. }
  1441. }
  1442. }
  1443. if _, ok := filtermsg.Get(Optime); !ok {
  1444. filtermsg.Set(Optime, client)
  1445. LogOp(op, client)
  1446. LogGet(op)
  1447. }
  1448. } else if op.Type == 30 {
  1449. Group := op.Param1
  1450. Room := oop.GetRoom(Group)
  1451. if Room.Announce && oop.IoGOBot(Group, client) {
  1452. Optime := op.CreatedTime
  1453. if cekOp(Optime) {
  1454. Room.CheckAnnounce(client, Group)
  1455. }
  1456. }
  1457. } else if op.Type == 123 {
  1458. client.CInvite()
  1459. } else if op.Type == 132 {
  1460. client.CountKick()
  1461. } else if op.Type == 125 {
  1462. client.CCancel()
  1463. }
  1464. }
  1465. }(multiFunc)
  1466. for _, ops := range multiFunc {
  1467. if ops.Type == 0 {
  1468. client.CorrectRevision(ops, false, true, true)
  1469. } else {
  1470. client.CorrectRevision(ops, true, false, false)
  1471. }
  1472. }
  1473. }
  1474. }