main1.go 55 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220222122222223222422252226222722282229223022312232223322342235223622372238223922402241224222432244224522462247224822492250225122522253225422552256225722582259226022612262226322642265226622672268226922702271227222732274227522762277227822792280228122822283228422852286228722882289229022912292229322942295229622972298229923002301230223032304230523062307230823092310231123122313231423152316231723182319232023212322232323242325232623272328232923302331233223332334233523362337233823392340234123422343234423452346234723482349235023512352235323542355235623572358235923602361
  1. package main
  2. import (
  3. "fmt"
  4. "os"
  5. "regexp"
  6. "strconv"
  7. "strings"
  8. "syscall"
  9. "time"
  10. talkservice "github.com/bashery/linethrift"
  11. "github.com/bashery/botline/oop"
  12. "github.com/kardianos/osext"
  13. "github.com/tidwall/gjson"
  14. )
  15. func SendMycreator(from string) bool {
  16. if InArray2(MAKERS, from) {
  17. return true
  18. } else if UserBot.GetCreator(from) {
  19. return true
  20. }
  21. return false
  22. }
  23. func SendMyseller(from string) bool {
  24. if InArray2(MAKERS, from) {
  25. return true
  26. } else if UserBot.GetCreator(from) {
  27. return true
  28. } else if UserBot.GetSeller(from) {
  29. return true
  30. }
  31. return false
  32. }
  33. func SendMybuyer(from string) bool {
  34. if InArray2(MAKERS, from) {
  35. return true
  36. } else if UserBot.GetCreator(from) {
  37. return true
  38. } else if UserBot.GetSeller(from) {
  39. return true
  40. } else if UserBot.GetBuyer(from) {
  41. return true
  42. }
  43. return false
  44. }
  45. func SendMyowner(from string) bool {
  46. if InArray2(MAKERS, from) {
  47. return true
  48. } else if UserBot.GetCreator(from) {
  49. return true
  50. } else if UserBot.GetSeller(from) {
  51. return true
  52. } else if UserBot.GetBuyer(from) {
  53. return true
  54. } else if UserBot.GetOwner(from) {
  55. return true
  56. }
  57. return false
  58. }
  59. func SendMymaster(from string) bool {
  60. if InArray2(MAKERS, from) {
  61. return true
  62. } else if UserBot.GetCreator(from) {
  63. return true
  64. } else if UserBot.GetSeller(from) {
  65. return true
  66. } else if UserBot.GetBuyer(from) {
  67. return true
  68. } else if UserBot.GetOwner(from) {
  69. return true
  70. } else if UserBot.GetMaster(from) {
  71. return true
  72. }
  73. return false
  74. }
  75. func SendMyadmin(from string) bool {
  76. if InArray2(MAKERS, from) {
  77. return true
  78. } else if UserBot.GetCreator(from) {
  79. return true
  80. } else if UserBot.GetSeller(from) {
  81. return true
  82. } else if UserBot.GetBuyer(from) {
  83. return true
  84. } else if UserBot.GetOwner(from) {
  85. return true
  86. } else if UserBot.GetMaster(from) {
  87. return true
  88. } else if UserBot.GetAdmin(from) {
  89. return true
  90. }
  91. return false
  92. }
  93. func SendMygowner(group string, from string) bool {
  94. Room := oop.GetRoom(group)
  95. if InArray2(MAKERS, from) {
  96. return true
  97. } else if UserBot.GetCreator(from) {
  98. return true
  99. } else if UserBot.GetSeller(from) {
  100. return true
  101. } else if UserBot.GetBuyer(from) {
  102. return true
  103. } else if UserBot.GetOwner(from) {
  104. return true
  105. } else if UserBot.GetMaster(from) {
  106. return true
  107. } else if UserBot.GetAdmin(from) {
  108. return true
  109. } else if InArray2(Room.Gowner, from) == true {
  110. return true
  111. }
  112. return false
  113. }
  114. func SendMygadmin(group string, from string) bool {
  115. Room := oop.GetRoom(group)
  116. if InArray2(MAKERS, from) {
  117. return true
  118. } else if UserBot.GetCreator(from) {
  119. return true
  120. } else if UserBot.GetSeller(from) {
  121. return true
  122. } else if UserBot.GetBuyer(from) {
  123. return true
  124. } else if UserBot.GetOwner(from) {
  125. return true
  126. } else if UserBot.GetMaster(from) {
  127. return true
  128. } else if UserBot.GetAdmin(from) {
  129. return true
  130. } else if InArray2(Room.Gowner, from) {
  131. return true
  132. } else if InArray2(Room.Gadmin, from) {
  133. return true
  134. }
  135. return false
  136. }
  137. func InArrayInt64(arr []int64, str int64) bool {
  138. for _, tar := range arr {
  139. if tar == str {
  140. return true
  141. }
  142. }
  143. return false
  144. }
  145. func GetCodeprem(num int, sinder string, group string) bool {
  146. if num == 0 {
  147. if InArray2(MAKERS, sinder) {
  148. return true
  149. }
  150. } else if num == 1 {
  151. if SendMycreator(sinder) {
  152. return true
  153. }
  154. } else if num == 2 {
  155. if SendMyseller(sinder) {
  156. return true
  157. }
  158. } else if num == 3 {
  159. if SendMybuyer(sinder) {
  160. return true
  161. }
  162. } else if num == 4 {
  163. if SendMyowner(sinder) {
  164. return true
  165. }
  166. } else if num == 5 {
  167. if SendMymaster(sinder) {
  168. return true
  169. }
  170. return false
  171. } else if num == 6 {
  172. if SendMyadmin(sinder) {
  173. return true
  174. }
  175. } else if num == 7 {
  176. if SendMygowner(group, sinder) {
  177. return true
  178. }
  179. } else if num == 8 {
  180. if SendMygadmin(group, sinder) {
  181. return true
  182. }
  183. }
  184. return false
  185. }
  186. func PerCheckList() string {
  187. list := ""
  188. var test1 string
  189. if SetHelper.Rngcmd != nil {
  190. list += "✠ 𝗟𝗶𝘀𝘁 𝗽𝗲𝗿𝗺 :\n\n"
  191. for i := range SetHelper.Rngcmd {
  192. if SetHelper.Rngcmd[i] == 0 {
  193. test1 = "Maker"
  194. list += fmt.Sprintf("%v : %v\n", i, test1)
  195. } else if SetHelper.Rngcmd[i] == 1 {
  196. test1 = "Creator"
  197. list += fmt.Sprintf("%v : %v\n", i, test1)
  198. } else if SetHelper.Rngcmd[i] == 2 {
  199. test1 = "Seller"
  200. list += fmt.Sprintf("%v : %v\n", i, test1)
  201. } else if SetHelper.Rngcmd[i] == 3 {
  202. test1 = "Buyer"
  203. list += fmt.Sprintf("%v : %v\n", i, test1)
  204. } else if SetHelper.Rngcmd[i] == 4 {
  205. test1 = "Owner"
  206. list += fmt.Sprintf("%v : %v\n", i, test1)
  207. } else if SetHelper.Rngcmd[i] == 5 {
  208. test1 = "Master"
  209. list += fmt.Sprintf("%v : %v\n", i, test1)
  210. } else if SetHelper.Rngcmd[i] == 6 {
  211. test1 = "Admin"
  212. list += fmt.Sprintf("%v : %v\n", i, test1)
  213. } else if SetHelper.Rngcmd[i] == 7 {
  214. test1 = "Gowner"
  215. list += fmt.Sprintf("%v : %v\n", i, test1)
  216. } else if SetHelper.Rngcmd[i] == 8 {
  217. test1 = "Gadmin"
  218. list += fmt.Sprintf("%v : %v\n", i, test1)
  219. }
  220. }
  221. }
  222. return list
  223. }
  224. func Addpermcmd(client *oop.Account, to string, test1 string, test2 string) {
  225. x := 0
  226. numr := 0
  227. list := ""
  228. if test1 == "maker" {
  229. x = 0
  230. } else if test1 == "creator" {
  231. x = 1
  232. } else if test1 == "seller" {
  233. x = 2
  234. } else if test1 == "buyer" {
  235. x = 3
  236. } else if test1 == "owner" {
  237. x = 4
  238. } else if test1 == "master" {
  239. x = 5
  240. } else if test1 == "admin" {
  241. x = 6
  242. } else if test1 == "gowner" {
  243. x = 7
  244. } else if test1 == "gadmin" {
  245. x = 8
  246. } else {
  247. list += "Rank not found.\nUse .perm <rank> <command>\nAvailable ranks: \nbuyer/owner/master/admin/gowner/gadmin."
  248. }
  249. if list != "Rank not found.\nUse .perm <rank> <command>\nAvailable ranks: \nbuyer/owner/master/admin/gowner/gadmin." {
  250. cmd2 := test2
  251. _, value := SetHelper.Rngcmd[cmd2]
  252. if value == true {
  253. if SetHelper.Rngcmd[cmd2] != x {
  254. SetHelper.Rngcmd[cmd2] = x
  255. numr = 5
  256. }
  257. } else {
  258. list += "Command not found.\nUse ths Command First."
  259. }
  260. }
  261. if list != "Rank not found.\nUse .perm <rank> <command>\nAvailable ranks: \nbuyer/owner/master/admin/gowner/gadmin." {
  262. if list != "Command not found.\nUse ths Command First." {
  263. if numr != 5 {
  264. cmd1 := test1
  265. cmd2 := test2
  266. list += fmt.Sprintf("%v is already a %v command.\n", cmd2, cmd1)
  267. } else {
  268. cmd1 := test1
  269. cmd2 := test2
  270. list += fmt.Sprintf("Changed permission to %v for: %v \n", cmd1, cmd2)
  271. }
  272. client.SendMessage(to, list)
  273. } else {
  274. client.SendMessage(to, list+"\n")
  275. }
  276. } else {
  277. client.SendMessage(to, list+"\n")
  278. }
  279. }
  280. func GetComs(gr int, data string) int {
  281. defer oop.PanicOnly()
  282. _, value := SetHelper.Rngcmd[data]
  283. if value == false {
  284. SetHelper.Rngcmd[data] = gr
  285. }
  286. xx := SetHelper.Rngcmd[data]
  287. return xx
  288. }
  289. func CheckAccount(user string) *oop.Account {
  290. for _, cl := range ClientBot {
  291. if cl.MID == user {
  292. return cl
  293. }
  294. }
  295. return nil
  296. }
  297. func Checkuser(client *oop.Account, group string) ([]*oop.Account, []string) {
  298. list := []string{}
  299. err, _, memlist := client.GetGroupMembers(group)
  300. if err != nil {
  301. return nil, list
  302. }
  303. exe := []*oop.Account{}
  304. for mid, _ := range memlist {
  305. if InArray2(Squadlist, mid) {
  306. cl := CheckAccount(mid)
  307. if !cl.Limited {
  308. exe = append(exe, cl)
  309. }
  310. } else if MemUser(group, mid) {
  311. list = append(list, mid)
  312. }
  313. }
  314. if len(exe) != 0 && len(list) != 0 {
  315. return exe, list
  316. }
  317. return nil, list
  318. }
  319. func CheckBan(client *oop.Account, group string) []string {
  320. list := []string{}
  321. err, _, memlist := client.GetGroupMembers(group)
  322. if err != nil {
  323. return list
  324. }
  325. for mid, _ := range memlist {
  326. if MemUser(group, mid) {
  327. if MemBan(group, mid) {
  328. list = append(list, mid)
  329. }
  330. }
  331. }
  332. return list
  333. }
  334. func GETgrade(num int) string {
  335. if num == 0 {
  336. return "Maker"
  337. } else if num == 1 {
  338. return "Creator"
  339. } else if num == 2 {
  340. return "seller"
  341. } else if num == 3 {
  342. return "Buyer"
  343. } else if num == 4 {
  344. return "Owner"
  345. } else if num == 5 {
  346. return "Master"
  347. } else if num == 6 {
  348. return "Admin"
  349. } else if num == 7 {
  350. return "Gowner"
  351. } else if num == 8 {
  352. return "Gadmin"
  353. }
  354. return "None"
  355. }
  356. func Canceljoin(Client *oop.Account, Group string) {
  357. defer panicHandle("canceljoin")
  358. _, _, pind := Client.GetChatList(Group)
  359. for _, i := range pind {
  360. if oop.IsPending(Client, Group, i) == true {
  361. Client.CancelChatInvitations(Group, i)
  362. }
  363. }
  364. }
  365. func Nukjoin(Client *oop.Account, Optime int64, Group string) {
  366. defer panicHandle("Nukejoin")
  367. _, ok := Ceknuke.Get(Optime)
  368. if !ok {
  369. Ceknuke.Set(Optime, 1)
  370. } else {
  371. return
  372. }
  373. exe, list := Checkuser(Client, Group)
  374. if exe != nil {
  375. no := 0
  376. i := 0
  377. lm := len(list)
  378. acts := []*oop.Account{}
  379. var cl *oop.Account
  380. for ; i < lm; i++ {
  381. if no >= len(exe) {
  382. no = 0
  383. }
  384. acts = append(acts, exe[no])
  385. no += 1
  386. }
  387. for n, target := range list {
  388. go func(n int, target string) {
  389. cl = acts[n]
  390. cl.DeleteOtherFromChats(Group, target)
  391. }(n, target)
  392. }
  393. }
  394. }
  395. func RemoveSticker(items []*Stickers, item *Stickers) []*Stickers {
  396. defer oop.PanicOnly()
  397. newitems := []*Stickers{}
  398. for _, i := range items {
  399. if i != item {
  400. newitems = append(newitems, i)
  401. }
  402. }
  403. return newitems
  404. }
  405. func AutopurgeEnd(client *oop.Account, Group string, mem []string) {
  406. defer panicHandle("AutopurgeEnd")
  407. for _, target := range mem {
  408. client.DeleteOtherFromChats(Group, target)
  409. }
  410. }
  411. func AppendLastSticker(s []*Stickers, e *Stickers) []*Stickers {
  412. defer oop.PanicOnly()
  413. s = RemoveSticker(s, e)
  414. s = append(s, e)
  415. if len(s) >= 1000 {
  416. s = s[100:]
  417. return s
  418. }
  419. return s
  420. }
  421. func CheckMessage(waktu int64, typ int8) bool {
  422. if typ == 1 {
  423. for _, wkt := range timeSend {
  424. if wkt == waktu {
  425. return false
  426. break
  427. }
  428. }
  429. timeSend = append(timeSend, waktu)
  430. return true
  431. }
  432. return false
  433. }
  434. func Remove(s []string, r string) []string {
  435. new := make([]string, len(s))
  436. copy(new, s)
  437. for i, v := range new {
  438. if v == r {
  439. return append(new[:i], new[i+1:]...)
  440. }
  441. }
  442. return s
  443. }
  444. func fmtDuration(d time.Duration) string {
  445. d = d.Round(time.Second)
  446. x := d
  447. h := d / time.Hour
  448. d -= h * time.Hour
  449. m := d / time.Minute
  450. d -= m * time.Minute
  451. if x < 60*time.Second {
  452. return fmt.Sprintf("%v", x)
  453. } else if x < 3600*time.Second {
  454. return fmt.Sprintf("%02dMinutes's", m)
  455. } else if x < 86400*time.Second {
  456. return fmt.Sprintf("%02dHour's %02dMinute's", h%24, m)
  457. } else {
  458. return fmt.Sprintf("%02dDay's %02dHour's %02dMinute's", h/24, h%24, m)
  459. }
  460. }
  461. func CancelEnd(client *oop.Account, Group string, mem []string) {
  462. defer panicHandle("CancelEnd")
  463. for _, target := range mem {
  464. client.CancelChatInvitations(Group, target)
  465. }
  466. }
  467. func Setpurgealln(client *oop.Account, to string, invits []string) {
  468. for _, cc := range invits {
  469. if oop.IsMembers(client, to, cc) == true {
  470. client.DeleteOtherFromChats(to, cc)
  471. } else if oop.IsPending(client, to, cc) == true {
  472. client.CancelChatInvitations(to, cc)
  473. }
  474. }
  475. }
  476. func SelectBot(client *oop.Account, to string) (*oop.Account, error) {
  477. err, _, memlist := client.GetGroupMembers(to)
  478. if err != nil {
  479. return nil, err
  480. }
  481. exe := []*oop.Account{}
  482. for mid, _ := range memlist {
  483. if InArray2(Squadlist, mid) {
  484. cl := GetKorban(mid)
  485. if !cl.Limited {
  486. exe = append(exe, cl)
  487. }
  488. }
  489. }
  490. if len(exe) != 0 {
  491. return exe[0], err
  492. }
  493. return nil, err
  494. }
  495. func CheckBot(client *oop.Account, to string) (*oop.Account, error) {
  496. err, _, memlist := client.GetGroupMembers(to)
  497. if err != nil {
  498. return nil, err
  499. }
  500. exe := []*oop.Account{}
  501. for mid, _ := range memlist {
  502. if InArray2(Squadlist, mid) {
  503. cl := GetKorban(mid)
  504. if !cl.Limited {
  505. exe = append(exe, cl)
  506. }
  507. }
  508. }
  509. if len(exe) != 0 {
  510. return exe[0], err
  511. }
  512. return nil, err
  513. }
  514. func GetKorban(user string) *oop.Account {
  515. for _, cl := range ClientBot {
  516. if cl.MID == user {
  517. return cl
  518. }
  519. }
  520. return nil
  521. }
  522. func squadMention(mlist []string) (m *oop.Account, b bool) {
  523. for _, l := range mlist {
  524. if InArray2(Squadlist, l) {
  525. cl := GetKorban(l)
  526. return cl, true
  527. }
  528. }
  529. return nil, false
  530. }
  531. func StripOut(kata string) string {
  532. kata = strings.TrimSpace(kata)
  533. return kata
  534. }
  535. func Setinviteto(client *oop.Account, to string, invits []string) {
  536. news := []string{}
  537. for _, cc := range invits {
  538. if oop.IsMembers(client, to, cc) == false && oop.IsPending(client, to, cc) == false {
  539. news = append(news, cc)
  540. }
  541. }
  542. if len(news) != 0 {
  543. client.InviteIntoChatPollVer(to, news)
  544. }
  545. }
  546. func Setinvitetomsg(client *oop.Account, to string, invits []string) []string {
  547. defer panicHandle("Setinvitetomsg")
  548. bans := []string{}
  549. news := []string{}
  550. room := oop.GetRoom(to)
  551. exe := room.HaveClient
  552. for _, cc := range invits {
  553. if oop.IsMembers(client, to, cc) == false && oop.IsPending(client, to, cc) == false {
  554. if !MemBan(to, cc) {
  555. if oop.IsFriends(client, cc) == false {
  556. client.FindAndAddContactsByMidnew(cc)
  557. time.Sleep(250 * time.Millisecond)
  558. }
  559. news = append(news, cc)
  560. } else {
  561. bans = append(bans, cc)
  562. }
  563. }
  564. }
  565. if len(news) != 0 && len(exe) != 0 {
  566. celek := len(news)
  567. no := 0
  568. bat := 5
  569. ClAct := len(exe)
  570. if ClAct != 0 {
  571. if celek < bat {
  572. for _, cl := range exe {
  573. cl.GetRecommendationIds()
  574. for _, mid := range news {
  575. oop.AddContact3(cl, mid)
  576. }
  577. fl, _ := cl.GetAllContactIds()
  578. bb := []string{}
  579. for _, mid := range news {
  580. if InArray2(fl, mid) {
  581. bb = append(bb, mid)
  582. news = Remove(news, mid)
  583. }
  584. }
  585. if len(bb) != 0 {
  586. cl.InviteIntoGroupNormal(to, bb)
  587. }
  588. if len(news) == 0 {
  589. break
  590. }
  591. }
  592. } else {
  593. hajar := []string{}
  594. z := celek / bat
  595. y := z + 1
  596. for i := 0; i < y; i++ {
  597. if no >= ClAct {
  598. no = 0
  599. }
  600. client := exe[no]
  601. if i == z {
  602. hajar = news[i*bat:]
  603. } else {
  604. hajar = news[i*bat : (i+1)*bat]
  605. }
  606. if len(hajar) != 0 {
  607. client.GetRecommendationIds()
  608. for _, mid := range hajar {
  609. oop.AddContact3(client, mid)
  610. }
  611. fl, _ := client.GetAllContactIds()
  612. bb := []string{}
  613. for _, mid := range hajar {
  614. if InArray2(fl, mid) {
  615. bb = append(bb, mid)
  616. }
  617. }
  618. if len(bb) != 0 {
  619. client.InviteIntoGroupNormal(to, bb)
  620. }
  621. }
  622. no += 1
  623. }
  624. }
  625. }
  626. }
  627. return bans
  628. }
  629. func gettxt(from string, client *oop.Account, pesan string, rname string, sname string, Mid string, MentionMsg []string, group string) string {
  630. var txt string
  631. ca, ok := squadMention(MentionMsg)
  632. if ok {
  633. pr, _ := ca.GetContact(ca.MID)
  634. name := pr.DisplayName
  635. Vs := fmt.Sprintf("@%v", name)
  636. Vs = strings.ToLower(Vs)
  637. Vs = strings.TrimSuffix(Vs, " ")
  638. txt = strings.Replace(pesan, Vs, "", 1)
  639. txt = strings.TrimPrefix(txt, " ")
  640. for _, men := range MentionMsg {
  641. prs, _ := ca.GetContact(men)
  642. names := prs.DisplayName
  643. jj := fmt.Sprintf("@%v", names)
  644. jj = strings.ToLower(jj)
  645. jj = strings.TrimSuffix(jj, " ")
  646. txt = strings.Replace(txt, jj, "", 1)
  647. txt = StripOut(txt)
  648. }
  649. used = rname
  650. }
  651. if strings.HasPrefix(pesan, rname) {
  652. txt = strings.Replace(pesan, rname, "", 1)
  653. used = rname
  654. } else if strings.HasPrefix(pesan, sname) {
  655. txt = strings.Replace(pesan, sname, "", 1)
  656. used = sname
  657. }
  658. txt = StripOut(txt)
  659. return txt
  660. }
  661. func LogLast(op *talkservice.Operation, midds string) {
  662. defer oop.PanicOnly()
  663. if op.Type == 26 {
  664. if op.Message.ContentType == 18 {
  665. return
  666. }
  667. }
  668. LastActive.Set(midds, op)
  669. }
  670. func LogOp(op *talkservice.Operation, client *oop.Account) {
  671. defer oop.PanicOnly()
  672. tipe := op.Type
  673. pelaku := op.Param2
  674. if tipe == 124 {
  675. if InArray2(Squadlist, pelaku) {
  676. return
  677. }
  678. LogLast(op, pelaku)
  679. } else if tipe == 133 {
  680. if InArray2(Squadlist, pelaku) {
  681. return
  682. }
  683. LogLast(op, pelaku)
  684. } else if tipe == 130 {
  685. if InArray2(Squadlist, pelaku) {
  686. return
  687. }
  688. LogLast(op, pelaku)
  689. } else if tipe == 122 {
  690. if InArray2(Squadlist, pelaku) {
  691. return
  692. }
  693. LogLast(op, pelaku)
  694. } else if tipe == 55 {
  695. if InArray2(Squadlist, pelaku) {
  696. return
  697. }
  698. LogLast(op, pelaku)
  699. } else if tipe == 128 {
  700. if InArray2(Squadlist, pelaku) {
  701. return
  702. }
  703. LogLast(op, pelaku)
  704. } else if tipe == 26 {
  705. msg := op.Message
  706. if InArray2(Squadlist, msg.From_) {
  707. return
  708. }
  709. LogLast(op, msg.From_)
  710. }
  711. }
  712. func Setkickto(client *oop.Account, to string, invits []string) {
  713. defer panicHandle("Setkickto")
  714. for _, cc := range invits {
  715. if oop.IsMembers(client, to, cc) == true {
  716. client.DeleteOtherFromChats(to, cc)
  717. }
  718. }
  719. }
  720. func addCon(cons []string) {
  721. n := 0
  722. for _, con := range cons {
  723. for _, cl := range ClientBot {
  724. fl, _ := cl.GetAllContactIds()
  725. if !InArray2(fl, con) && con != cl.MID && !cl.Limitadd {
  726. cl.FindAndAddContactsByMidnew2(con)
  727. time.Sleep(3 * time.Second)
  728. }
  729. }
  730. n += 1
  731. }
  732. }
  733. func ReloginProgram() error {
  734. file, err := osext.Executable()
  735. if err != nil {
  736. return err
  737. }
  738. err = syscall.Exec(file, os.Args, os.Environ())
  739. if err != nil {
  740. return err
  741. }
  742. return nil
  743. }
  744. func GenerateTimeLog(client *oop.Account, to string) {
  745. loc, _ := time.LoadLocation("Asia/Jakarta")
  746. a := time.Now().In(loc)
  747. yyyy := strconv.Itoa(a.Year())
  748. MM := a.Month().String()
  749. dd := strconv.Itoa(a.Day())
  750. hh := a.Hour()
  751. mm := a.Minute()
  752. ss := a.Second()
  753. var hhconv string
  754. var mmconv string
  755. var ssconv string
  756. if hh < 10 {
  757. hhconv = "0" + strconv.Itoa(hh)
  758. } else {
  759. hhconv = strconv.Itoa(hh)
  760. }
  761. if mm < 10 {
  762. mmconv = "0" + strconv.Itoa(mm)
  763. } else {
  764. mmconv = strconv.Itoa(mm)
  765. }
  766. if ss < 10 {
  767. ssconv = "0" + strconv.Itoa(ss)
  768. } else {
  769. ssconv = strconv.Itoa(ss)
  770. }
  771. times := "↳Date : " + dd + "-" + MM + "-" + yyyy + "\n↳Time : " + hhconv + ":" + mmconv + ":" + ssconv
  772. client.SendMessage(to, times)
  773. }
  774. func SelectallBot(client *oop.Account, to string) ([]*oop.Account, error) {
  775. err, _, memlist := client.GetGroupMembers(to)
  776. if err != nil {
  777. return nil, err
  778. }
  779. exe := []*oop.Account{}
  780. for mid, _ := range memlist {
  781. if InArray2(Squadlist, mid) {
  782. cl := GetKorban(mid)
  783. exe = append(exe, cl)
  784. }
  785. }
  786. if len(exe) != 0 {
  787. return exe, err
  788. }
  789. return nil, err
  790. }
  791. func Setcancelto(client *oop.Account, to string, invits []string) {
  792. defer panicHandle("Setcancelto")
  793. for _, x := range invits {
  794. if oop.IsPending(client, to, x) == true {
  795. client.CancelChatInvitations(to, x)
  796. }
  797. }
  798. }
  799. func cekOp(optime int64) bool {
  800. for _, tar := range oplist {
  801. if tar == optime {
  802. return false
  803. }
  804. }
  805. oplist = append(oplist, optime)
  806. return true
  807. }
  808. func cekOpinvite(optime int64) bool {
  809. for _, tar := range oplistinvite {
  810. if tar == optime {
  811. return false
  812. }
  813. }
  814. oplistinvite = append(oplistinvite, optime)
  815. return true
  816. }
  817. func AppendLastD(s [][]string, e []string) [][]string {
  818. defer oop.PanicOnly()
  819. s = append(s, e)
  820. if len(s) >= 1000 {
  821. s = s[100:]
  822. return s
  823. }
  824. return s
  825. }
  826. func AppendLast(s []string, e string) []string {
  827. defer oop.PanicOnly()
  828. s = Remove(s, e)
  829. s = append(s, e)
  830. if len(s) >= 1000 {
  831. s = s[100:]
  832. return s
  833. }
  834. return s
  835. }
  836. func LlistCheck(client *oop.Account, to string, typec string, nCount int, sender string, rplay string, mentionlist []string) (ss []string) {
  837. saodd := []string{}
  838. if len(mentionlist) != 0 {
  839. for a := range mentionlist {
  840. if !InArray2(saodd, mentionlist[a]) && !InArray2(Squadlist, mentionlist[a]) {
  841. saodd = append(saodd, mentionlist[a])
  842. }
  843. }
  844. return saodd
  845. } else if rplay != "" {
  846. if !InArray2(saodd, rplay) {
  847. saodd = append(saodd, rplay)
  848. }
  849. return saodd
  850. } else if typec == "lmid" {
  851. g, ok := Lastmid.Get(to)
  852. if !ok {
  853. g = [][]string{}
  854. Lastmid.Set(to, g)
  855. } else {
  856. num := nCount
  857. c := g.([][]string)
  858. lk := len(c)
  859. if lk != 0 {
  860. no := 0
  861. for i := lk - 1; i >= 0; i-- {
  862. if no < num {
  863. saodd = append(saodd, c[i]...)
  864. }
  865. no++
  866. }
  867. return saodd
  868. }
  869. }
  870. } else if typec == "linvite" {
  871. g, ok := Lastinvite.Get(to)
  872. if !ok {
  873. g = []string{}
  874. Lastinvite.Set(to, g)
  875. } else {
  876. num := nCount
  877. c := g.([]string)
  878. lk := len(c)
  879. if lk != 0 {
  880. no := 0
  881. for i := lk - 1; i >= 0; i-- {
  882. if no < num {
  883. saodd = append(saodd, c[i])
  884. }
  885. no++
  886. }
  887. return saodd
  888. }
  889. }
  890. } else if typec == "lkick" {
  891. g, ok := Lastkick.Get(to)
  892. if !ok {
  893. g = []string{}
  894. Lastkick.Set(to, g)
  895. } else {
  896. num := nCount
  897. c := g.([]string)
  898. lk := len(c)
  899. if lk != 0 {
  900. no := 0
  901. for i := lk - 1; i >= 0; i-- {
  902. if no < num {
  903. saodd = append(saodd, c[i])
  904. }
  905. no++
  906. }
  907. return saodd
  908. }
  909. }
  910. } else if typec == "lcancel" {
  911. g, ok := Lastcancel.Get(to)
  912. if !ok {
  913. g = []string{}
  914. Lastcancel.Set(to, g)
  915. } else {
  916. num := nCount
  917. c := g.([]string)
  918. lk := len(c)
  919. if lk != 0 {
  920. no := 0
  921. for i := lk - 1; i >= 0; i-- {
  922. if no < num {
  923. saodd = append(saodd, c[i])
  924. }
  925. no++
  926. }
  927. return saodd
  928. }
  929. }
  930. } else if typec == "lqr" {
  931. g, ok := Lastupdate.Get(to)
  932. if !ok {
  933. g = []string{}
  934. Lastupdate.Set(to, g)
  935. } else {
  936. num := nCount
  937. c := g.([]string)
  938. lk := len(c)
  939. if lk != 0 {
  940. no := 0
  941. for i := lk - 1; i >= 0; i-- {
  942. if no < num {
  943. saodd = append(saodd, c[i])
  944. }
  945. no++
  946. }
  947. return saodd
  948. }
  949. }
  950. } else if typec == "ljoin" {
  951. g, ok := Lastjoin.Get(to)
  952. if !ok {
  953. g = []string{}
  954. Lastjoin.Set(to, g)
  955. } else {
  956. num := nCount
  957. c := g.([]string)
  958. lk := len(c)
  959. if lk != 0 {
  960. no := 0
  961. for i := lk - 1; i >= 0; i-- {
  962. if no < num {
  963. saodd = append(saodd, c[i])
  964. }
  965. no++
  966. }
  967. return saodd
  968. }
  969. }
  970. } else if typec == "ltag" {
  971. g, ok := Lasttag.Get(to)
  972. if !ok {
  973. g = []string{}
  974. Lasttag.Set(to, g)
  975. } else {
  976. num := nCount
  977. c := g.([]string)
  978. lk := len(c)
  979. if lk != 0 {
  980. no := 0
  981. for i := lk - 1; i >= 0; i-- {
  982. if no < num {
  983. saodd = append(saodd, c[i])
  984. }
  985. no++
  986. }
  987. return saodd
  988. }
  989. }
  990. } else if typec == "lcon" {
  991. g, ok := Lastcon.Get(to)
  992. if !ok {
  993. g = []string{}
  994. Lastcon.Set(to, g)
  995. } else {
  996. num := nCount
  997. c := g.([]string)
  998. lk := len(c)
  999. if lk != 0 {
  1000. no := 0
  1001. for i := lk - 1; i >= 0; i-- {
  1002. if no < num {
  1003. saodd = append(saodd, c[i])
  1004. }
  1005. no++
  1006. }
  1007. return saodd
  1008. }
  1009. }
  1010. } else if typec == "lleave" {
  1011. g, ok := Lastleave.Get(to)
  1012. if !ok {
  1013. g = []string{}
  1014. Lastleave.Set(to, g)
  1015. } else {
  1016. num := nCount
  1017. c := g.([]string)
  1018. lk := len(c)
  1019. if lk != 0 {
  1020. no := 0
  1021. for i := lk - 1; i >= 0; i-- {
  1022. if no < num {
  1023. saodd = append(saodd, c[i])
  1024. }
  1025. no++
  1026. }
  1027. return saodd
  1028. }
  1029. }
  1030. } else if typec == "@me" {
  1031. if !InArray2(saodd, sender) {
  1032. saodd = append(saodd, sender)
  1033. }
  1034. return saodd
  1035. } else if typec == "@all" {
  1036. Member := client.GetChatListMem(to)
  1037. for i := 0; i < len(Member); i++ {
  1038. if !InArray2(saodd, Member[i]) {
  1039. saodd = append(saodd, Member[i])
  1040. }
  1041. }
  1042. return saodd
  1043. } else if typec == "@pending" {
  1044. _, _, pind := client.GetChatList(to)
  1045. for _, i := range pind {
  1046. if !InArray2(saodd, i) {
  1047. saodd = append(saodd, i)
  1048. }
  1049. }
  1050. return saodd
  1051. }
  1052. return saodd
  1053. }
  1054. func savejoin(Pelaku string, Optime int64) {
  1055. defer oop.PanicOnly()
  1056. ix := IndexOf(Detectjoin.User, Pelaku)
  1057. if ix == -1 {
  1058. Detectjoin.User = append(Detectjoin.User, Pelaku)
  1059. Detectjoin.Time = append(Detectjoin.Time, Optime)
  1060. } else {
  1061. Detectjoin.Time[ix] = Optime
  1062. }
  1063. }
  1064. func LogGet(op *talkservice.Operation) {
  1065. defer oop.PanicOnly()
  1066. tipe := op.Type
  1067. pelaku := op.Param2
  1068. korban := op.Param3
  1069. if tipe == 124 || tipe == 123 {
  1070. var invites []string
  1071. if tipe == 124 {
  1072. invites = strings.Split(korban, "\x1e")
  1073. } else {
  1074. invites = strings.Split(pelaku, "\x1e")
  1075. }
  1076. ll := len(invites)
  1077. if ll != 0 {
  1078. g, ok := Lastinvite.Get(op.Param1)
  1079. if !ok {
  1080. Lastinvite.Set(op.Param1, invites)
  1081. } else {
  1082. c := g.([]string)
  1083. for _, can := range invites {
  1084. c = AppendLast(c, can)
  1085. }
  1086. Lastinvite.Set(op.Param1, c)
  1087. }
  1088. }
  1089. } else if tipe == 133 {
  1090. g, ok := Lastkick.Get(op.Param1)
  1091. if !ok {
  1092. g = []string{op.Param3}
  1093. Lastkick.Set(op.Param1, g)
  1094. } else {
  1095. c := g.([]string)
  1096. c = AppendLast(c, op.Param3)
  1097. Lastkick.Set(op.Param1, c)
  1098. }
  1099. } else if tipe == 132 {
  1100. g, ok := Lastkick.Get(op.Param1)
  1101. if !ok {
  1102. g = []string{op.Param2}
  1103. Lastkick.Set(op.Param1, g)
  1104. } else {
  1105. c := g.([]string)
  1106. c = AppendLast(c, op.Param2)
  1107. Lastkick.Set(op.Param1, c)
  1108. }
  1109. } else if tipe == 130 {
  1110. g, ok := Lastjoin.Get(op.Param1)
  1111. if !ok {
  1112. g = []string{op.Param2}
  1113. Lastjoin.Set(op.Param1, g)
  1114. } else {
  1115. c := g.([]string)
  1116. c = AppendLast(c, op.Param2)
  1117. Lastjoin.Set(op.Param1, c)
  1118. }
  1119. } else if tipe == 125 {
  1120. g, ok := Lastcancel.Get(op.Param1)
  1121. if !ok {
  1122. g = []string{op.Param2}
  1123. Lastcancel.Set(op.Param1, g)
  1124. } else {
  1125. c := g.([]string)
  1126. c = AppendLast(c, op.Param2)
  1127. Lastcancel.Set(op.Param1, c)
  1128. }
  1129. } else if tipe == 126 {
  1130. g, ok := Lastcancel.Get(op.Param1)
  1131. if !ok {
  1132. g = []string{op.Param3}
  1133. Lastcancel.Set(op.Param1, g)
  1134. } else {
  1135. c := g.([]string)
  1136. c = AppendLast(c, op.Param3)
  1137. Lastcancel.Set(op.Param1, c)
  1138. }
  1139. } else if tipe == 122 {
  1140. g, ok := Lastupdate.Get(op.Param1)
  1141. if !ok {
  1142. g = []string{op.Param2}
  1143. Lastupdate.Set(op.Param1, g)
  1144. } else {
  1145. c := g.([]string)
  1146. c = AppendLast(c, op.Param2)
  1147. Lastupdate.Set(op.Param1, c)
  1148. }
  1149. } else if tipe == 128 {
  1150. g, ok := Lastleave.Get(op.Param1)
  1151. if !ok {
  1152. g = []string{op.Param2}
  1153. Lastleave.Set(op.Param1, g)
  1154. } else {
  1155. c := g.([]string)
  1156. c = AppendLast(c, op.Param2)
  1157. Lastleave.Set(op.Param1, c)
  1158. }
  1159. } else if tipe == 26 {
  1160. var MentionMsg = MentionList(op)
  1161. msg := op.Message
  1162. if InArray2(Squadlist, msg.From_) {
  1163. return
  1164. }
  1165. if len(MentionMsg) != 0 {
  1166. g, ok := Lasttag.Get(msg.To)
  1167. if !ok {
  1168. g = MentionMsg
  1169. Lasttag.Set(msg.To, g)
  1170. } else {
  1171. c := g.([]string)
  1172. for _, men := range MentionMsg {
  1173. c = AppendLast(c, men)
  1174. }
  1175. Lasttag.Set(msg.To, c)
  1176. }
  1177. } else if msg.ContentType == 13 {
  1178. mids := msg.ContentMetadata["mid"]
  1179. g, ok := Lastcon.Get(msg.To)
  1180. if !ok {
  1181. g = []string{mids}
  1182. Lastcon.Set(msg.To, g)
  1183. } else {
  1184. c := g.([]string)
  1185. c = AppendLast(c, mids)
  1186. Lastcon.Set(msg.To, c)
  1187. }
  1188. } else if msg.ContentType == 7 {
  1189. var ids []string
  1190. var pids []string
  1191. zx := msg.ContentMetadata
  1192. vok, cook := zx["REPLACE"]
  1193. if cook {
  1194. ress := gjson.Get(vok, "sticon")
  1195. mp := ress.Map()
  1196. yo := mp["resources"]
  1197. vls := yo.Array()
  1198. for _, vl := range vls {
  1199. mm := vl.Map()
  1200. pids = append(pids, mm["productId"].String())
  1201. ids = append(ids, mm["sticonId"].String())
  1202. }
  1203. } else {
  1204. ids = []string{zx["STKID"]}
  1205. pids = []string{zx["STKPKGID"]}
  1206. }
  1207. g, ok := Laststicker.Get(msg.To)
  1208. if !ok {
  1209. g = []*Stickers{&Stickers{Id: ids[0], Pid: pids[0]}}
  1210. Laststicker.Set(msg.To, g)
  1211. } else {
  1212. c := g.([]*Stickers)
  1213. c = AppendLastSticker(c, &Stickers{Id: ids[0], Pid: pids[0]})
  1214. Laststicker.Set(msg.To, c)
  1215. }
  1216. } else if msg.ContentType == 0 {
  1217. if strings.Contains(msg.Text, "u") {
  1218. regex, _ := regexp.Compile(`u\w{32}`)
  1219. links := regex.FindAllString(msg.Text, -1)
  1220. mmd := []string{}
  1221. for _, a := range links {
  1222. if len(a) == 33 {
  1223. mmd = append(mmd, a)
  1224. }
  1225. }
  1226. if len(mmd) != 0 {
  1227. g, ok := Lastmid.Get(msg.To)
  1228. if !ok {
  1229. g = [][]string{mmd}
  1230. Lastmid.Set(msg.To, g)
  1231. } else {
  1232. c := g.([][]string)
  1233. c = AppendLastD(c, mmd)
  1234. Lastmid.Set(msg.To, c)
  1235. }
  1236. }
  1237. }
  1238. }
  1239. }
  1240. }
  1241. func BanAll(memlist []string) {
  1242. ilen := len(memlist)
  1243. for i := 0; i < ilen; i++ {
  1244. Banned.AddBan(memlist[i])
  1245. }
  1246. }
  1247. func botDuration(d time.Duration) string {
  1248. d = d.Round(time.Second)
  1249. h := d / time.Hour
  1250. d -= h * time.Hour
  1251. m := d / time.Minute
  1252. d -= m * time.Minute
  1253. return fmt.Sprintf("%2d Days, %2d Hours, %2d Mins.", h/24, h%24, m)
  1254. }
  1255. func (self *kickop) ceko(pelaku int64) bool {
  1256. if !InArrayInt64(self.Opinv, pelaku) {
  1257. self.Opinv = append(self.Opinv, pelaku)
  1258. return true
  1259. }
  1260. return false
  1261. }
  1262. func (self *kickop) cek(pelaku string) bool {
  1263. if !InArray2(self.Kick, pelaku) {
  1264. self.Kick = append(self.Kick, pelaku)
  1265. return true
  1266. }
  1267. return false
  1268. }
  1269. func (self *kickop) del(pelaku string) {
  1270. self.Kick = Remove(self.Kick, pelaku)
  1271. }
  1272. func (self *kickop) ceki(pelaku string) bool {
  1273. defer oop.PanicOnly()
  1274. if !InArray2(self.Inv, pelaku) {
  1275. self.Inv = append(self.Inv, pelaku)
  1276. return true
  1277. }
  1278. return false
  1279. }
  1280. func (self *kickop) deli(pelaku string) {
  1281. self.Inv = Remove(self.Inv, pelaku)
  1282. }
  1283. func (self *kickop) clear() {
  1284. self.Inv = []string{}
  1285. self.Kick = []string{}
  1286. self.Opinv = []int64{}
  1287. }
  1288. func Checklistexpel(client *oop.Account, to string, targets []string, pl int, sinder string) {
  1289. Room := oop.GetRoom(to)
  1290. if len(targets) > 1 {
  1291. target := []string{}
  1292. conts := 0
  1293. conts2 := 0
  1294. for _, from := range targets {
  1295. if InArray2(MAKERS, from) {
  1296. if !InArray2(MAKERS, sinder) {
  1297. conts++
  1298. }
  1299. } else {
  1300. conts2++
  1301. }
  1302. if UserBot.GetCreator(from) {
  1303. if InArray2(MAKERS, sinder) {
  1304. target = append(target, from)
  1305. UserBot.DelCreator(from)
  1306. } else {
  1307. conts++
  1308. }
  1309. } else {
  1310. conts2++
  1311. }
  1312. if UserBot.GetSeller(from) {
  1313. if SendMycreator(sinder) {
  1314. target = append(target, from)
  1315. UserBot.DelSeller(from)
  1316. } else {
  1317. conts++
  1318. }
  1319. } else {
  1320. conts2++
  1321. }
  1322. if UserBot.GetBuyer(from) {
  1323. if SendMyseller(sinder) {
  1324. target = append(target, from)
  1325. UserBot.DelBuyer(from)
  1326. } else {
  1327. conts++
  1328. }
  1329. } else {
  1330. conts2++
  1331. }
  1332. if UserBot.GetOwner(from) {
  1333. if SendMybuyer(sinder) {
  1334. target = append(target, from)
  1335. UserBot.DelOwner(from)
  1336. } else {
  1337. conts++
  1338. }
  1339. } else {
  1340. conts2++
  1341. }
  1342. if UserBot.GetMaster(from) {
  1343. if SendMyowner(sinder) {
  1344. target = append(target, from)
  1345. UserBot.DelMaster(from)
  1346. } else {
  1347. conts++
  1348. }
  1349. } else {
  1350. conts2++
  1351. }
  1352. if UserBot.GetAdmin(from) {
  1353. if SendMyadmin(sinder) {
  1354. target = append(target, from)
  1355. UserBot.DelAdmin(from)
  1356. } else {
  1357. conts++
  1358. }
  1359. } else {
  1360. conts2++
  1361. }
  1362. if InArray2(Room.Gowner, from) {
  1363. if SendMyadmin(sinder) {
  1364. target = append(target, from)
  1365. Room.Gowner = Remove(Room.Gowner, from)
  1366. } else {
  1367. conts++
  1368. }
  1369. } else {
  1370. conts2++
  1371. }
  1372. if InArray2(Room.Gadmin, from) {
  1373. if SendMygowner(to, sinder) {
  1374. target = append(target, from)
  1375. Room.Gadmin = Remove(Room.Gadmin, from)
  1376. } else {
  1377. conts++
  1378. }
  1379. } else {
  1380. conts2++
  1381. }
  1382. if UserBot.GetBot(from) {
  1383. if SendMyowner(sinder) {
  1384. target = append(target, from)
  1385. UserBot.DelBot(from)
  1386. } else {
  1387. conts++
  1388. }
  1389. } else {
  1390. conts2++
  1391. }
  1392. }
  1393. if len(target) != 0 {
  1394. list := ""
  1395. if pl == 1 {
  1396. list += "Expeled from Buyer\n"
  1397. } else if pl == 2 {
  1398. list += "Expeled from Owner\n"
  1399. } else if pl == 3 {
  1400. list += "Expeled from Master\n"
  1401. } else if pl == 4 {
  1402. list += "Expeled from Admin\n"
  1403. } else if pl == 5 {
  1404. list += "Expeled from Bot\n"
  1405. } else if pl == 6 {
  1406. list += "Expeled from Gowner\n"
  1407. } else if pl == 7 {
  1408. list += "Expeled from Gadmin\n"
  1409. } else if pl == 8 {
  1410. list += "Expeled from Access\n"
  1411. } else if pl == 9 {
  1412. list += "Expeled from Creator\n"
  1413. } else if pl == 17 {
  1414. list += "Expeled from Seller\n"
  1415. }
  1416. for i := range target {
  1417. list += "\n" + strconv.Itoa(i+1) + ". " + "@!"
  1418. }
  1419. client.SendPollMention(to, list, target)
  1420. if pl == 2 {
  1421. logAccess(client, to, sinder, "unowner", target, 2)
  1422. } else if pl == 3 {
  1423. logAccess(client, to, sinder, "unmaster", target, 2)
  1424. } else if pl == 4 {
  1425. logAccess(client, to, sinder, "unadmin", target, 2)
  1426. } else if pl == 5 {
  1427. logAccess(client, to, sinder, "unbot", target, 2)
  1428. } else if pl == 6 {
  1429. logAccess(client, to, sinder, "ungowner", target, 2)
  1430. } else if pl == 7 {
  1431. logAccess(client, to, sinder, "ungadmin", target, 2)
  1432. } else if pl == 8 {
  1433. logAccess(client, to, sinder, "expel", target, 2)
  1434. }
  1435. } else if conts != 0 {
  1436. list := "Sorry, your grade is too low.\n"
  1437. client.SendMessage(to, list)
  1438. } else if conts2 != 0 {
  1439. list := "Users not have access.\n"
  1440. client.SendMessage(to, list)
  1441. }
  1442. } else {
  1443. target := []string{}
  1444. conts := 0
  1445. conts2 := 0
  1446. for _, from := range targets {
  1447. if InArray2(MAKERS, from) {
  1448. if !InArray2(MAKERS, sinder) {
  1449. conts++
  1450. }
  1451. } else {
  1452. conts2++
  1453. }
  1454. if UserBot.GetCreator(from) {
  1455. if InArray2(MAKERS, sinder) {
  1456. target = append(target, from)
  1457. UserBot.DelCreator(from)
  1458. } else {
  1459. conts++
  1460. }
  1461. } else {
  1462. conts2++
  1463. }
  1464. if UserBot.GetSeller(from) {
  1465. if SendMycreator(sinder) {
  1466. target = append(target, from)
  1467. UserBot.DelSeller(from)
  1468. } else {
  1469. conts++
  1470. }
  1471. } else {
  1472. conts2++
  1473. }
  1474. if UserBot.GetBuyer(from) {
  1475. if SendMyseller(sinder) {
  1476. target = append(target, from)
  1477. UserBot.DelBuyer(from)
  1478. } else {
  1479. conts++
  1480. }
  1481. } else {
  1482. conts2++
  1483. }
  1484. if UserBot.GetOwner(from) {
  1485. if SendMybuyer(sinder) {
  1486. target = append(target, from)
  1487. UserBot.DelOwner(from)
  1488. } else {
  1489. conts++
  1490. }
  1491. } else {
  1492. conts2++
  1493. }
  1494. if UserBot.GetMaster(from) {
  1495. if SendMyowner(sinder) {
  1496. target = append(target, from)
  1497. UserBot.DelMaster(from)
  1498. } else {
  1499. conts++
  1500. }
  1501. } else {
  1502. conts2++
  1503. }
  1504. if UserBot.GetAdmin(from) {
  1505. if SendMyadmin(sinder) {
  1506. target = append(target, from)
  1507. UserBot.DelAdmin(from)
  1508. } else {
  1509. conts++
  1510. }
  1511. } else {
  1512. conts2++
  1513. }
  1514. if InArray2(Room.Gowner, from) {
  1515. if SendMyadmin(sinder) {
  1516. target = append(target, from)
  1517. Room.Gowner = Remove(Room.Gowner, from)
  1518. } else {
  1519. conts++
  1520. }
  1521. } else {
  1522. conts2++
  1523. }
  1524. if InArray2(Room.Gadmin, from) {
  1525. if SendMygowner(to, sinder) {
  1526. target = append(target, from)
  1527. Room.Gadmin = Remove(Room.Gadmin, from)
  1528. } else {
  1529. conts++
  1530. }
  1531. } else {
  1532. conts2++
  1533. }
  1534. if UserBot.GetBot(from) {
  1535. if SendMyowner(sinder) {
  1536. target = append(target, from)
  1537. UserBot.DelBot(from)
  1538. } else {
  1539. conts++
  1540. }
  1541. } else {
  1542. conts2++
  1543. }
  1544. }
  1545. if len(target) != 0 {
  1546. list := ""
  1547. if pl == 1 {
  1548. list += "Removed from Buyer\n"
  1549. } else if pl == 2 {
  1550. list += "Removed from Owner\n"
  1551. } else if pl == 3 {
  1552. list += "Removed from Master\n"
  1553. } else if pl == 4 {
  1554. list += "Expeled from Admin\n"
  1555. } else if pl == 5 {
  1556. list += "Expeled from Bot\n"
  1557. } else if pl == 6 {
  1558. list += "Expeled from Gowner\n"
  1559. } else if pl == 7 {
  1560. list += "Expeled from Gadmin\n"
  1561. } else if pl == 8 {
  1562. list += "Expeled from Access\n"
  1563. } else if pl == 9 {
  1564. list += "Expeled from Creator\n"
  1565. } else if pl == 17 {
  1566. list += "Expeled from Seller\n"
  1567. }
  1568. for i := range target {
  1569. list += "\n" + strconv.Itoa(i+1) + ". " + "@!"
  1570. }
  1571. client.SendPollMention(to, list, target)
  1572. if pl == 2 {
  1573. logAccess(client, to, sinder, "unowner", target, 2)
  1574. } else if pl == 3 {
  1575. logAccess(client, to, sinder, "unmaster", target, 2)
  1576. } else if pl == 4 {
  1577. logAccess(client, to, sinder, "unadmin", target, 2)
  1578. } else if pl == 5 {
  1579. logAccess(client, to, sinder, "unbot", target, 2)
  1580. } else if pl == 6 {
  1581. logAccess(client, to, sinder, "ungowner", target, 2)
  1582. } else if pl == 7 {
  1583. logAccess(client, to, sinder, "ungadmin", target, 2)
  1584. } else if pl == 8 {
  1585. logAccess(client, to, sinder, "expel", target, 2)
  1586. }
  1587. } else if conts != 0 {
  1588. list := "Sorry, your grade is too low.\n"
  1589. client.SendMessage(to, list)
  1590. } else if conts2 != 0 {
  1591. list := "Users not have access.\n"
  1592. client.SendMessage(to, list)
  1593. }
  1594. }
  1595. }
  1596. func Checkqr() {
  1597. Qrwar = true
  1598. time.Sleep(1 * time.Second)
  1599. Qrwar = false
  1600. }
  1601. func Cmdlistcheck() string {
  1602. list2 := "✠ 𝗟𝗶𝘀𝘁 𝗖𝗺𝗱 :\n\n"
  1603. list := ""
  1604. if Commands.Botname != "" {
  1605. list += fmt.Sprintf(" - Botname: %s\n", Commands.Botname)
  1606. }
  1607. if Commands.Upallimage != "" {
  1608. list += fmt.Sprintf(" - Upallimage: %s\n", Commands.Upallimage)
  1609. }
  1610. if Commands.Upallcover != "" {
  1611. list += fmt.Sprintf(" - Upallcover: %s\n", Commands.Upallcover)
  1612. }
  1613. if Commands.Unsend != "" {
  1614. list += fmt.Sprintf(" - Unsend: %s\n", Commands.Unsend)
  1615. }
  1616. if Commands.Upvallimage != "" {
  1617. list += fmt.Sprintf(" - Upvallimage: %s\n", Commands.Upvallimage)
  1618. }
  1619. if Commands.Upvallcover != "" {
  1620. list += fmt.Sprintf(" - Upvallcover: %s\n", Commands.Upvallcover)
  1621. }
  1622. if Commands.Appname != "" {
  1623. list += fmt.Sprintf(" - Appname: %s\n", Commands.Appname)
  1624. }
  1625. if Commands.Useragent != "" {
  1626. list += fmt.Sprintf(" - Useragent: %s\n", Commands.Useragent)
  1627. }
  1628. if Commands.Hostname != "" {
  1629. list += fmt.Sprintf(" - Hostname: %s\n", Commands.Hostname)
  1630. }
  1631. if Commands.Friends != "" {
  1632. list += fmt.Sprintf(" - Friends: %s\n", Commands.Friends)
  1633. }
  1634. if Commands.Adds != "" {
  1635. list += fmt.Sprintf(" - Adds: %s\n", Commands.Adds)
  1636. }
  1637. if Commands.Limits != "" {
  1638. list += fmt.Sprintf(" - Limits: %s\n", Commands.Limits)
  1639. }
  1640. if Commands.Addallbots != "" {
  1641. list += fmt.Sprintf(" - Addallbots: %s\n", Commands.Addallbots)
  1642. }
  1643. if Commands.Addallsquads != "" {
  1644. list += fmt.Sprintf(" - Addallsquads: %s\n", Commands.Addallsquads)
  1645. }
  1646. if Commands.Leave != "" {
  1647. list += fmt.Sprintf(" - Leave: %s\n", Commands.Leave)
  1648. }
  1649. if Commands.Respon != "" {
  1650. list += fmt.Sprintf(" - Respon: %s\n", Commands.Respon)
  1651. }
  1652. if Commands.Ping != "" {
  1653. list += fmt.Sprintf(" - Ping: %s\n", Commands.Ping)
  1654. }
  1655. if Commands.Count != "" {
  1656. list += fmt.Sprintf(" - Count: %s\n", Commands.Count)
  1657. }
  1658. if Commands.Limitout != "" {
  1659. list += fmt.Sprintf(" - 1111111: %s\n", Commands.Limitout)
  1660. }
  1661. if Commands.Access != "" {
  1662. list += fmt.Sprintf(" - Access: %s\n", Commands.Access)
  1663. }
  1664. if Commands.Allbanlist != "" {
  1665. list += fmt.Sprintf(" - Allbanlist: %s\n", Commands.Allbanlist)
  1666. }
  1667. if Commands.Allgaccess != "" {
  1668. list += fmt.Sprintf(" - Allgaccess: %s\n", Commands.Allgaccess)
  1669. }
  1670. if Commands.Gaccess != "" {
  1671. list += fmt.Sprintf(" - Gaccess: %s\n", Commands.Gaccess)
  1672. }
  1673. if Commands.Checkram != "" {
  1674. list += fmt.Sprintf(" - Checkram: %s\n", Commands.Checkram)
  1675. }
  1676. if Commands.Backups != "" {
  1677. list += fmt.Sprintf(" - Backups: %s\n", Commands.Backups)
  1678. }
  1679. if Commands.Upimage != "" {
  1680. list += fmt.Sprintf(" - Upimage: %s\n", Commands.Upimage)
  1681. }
  1682. if Commands.Upcover != "" {
  1683. list += fmt.Sprintf(" - Upcover: %s\n", Commands.Upcover)
  1684. }
  1685. if Commands.Upvimage != "" {
  1686. list += fmt.Sprintf(" - Upvimage: %s\n", Commands.Upvimage)
  1687. }
  1688. if Commands.Upvcover != "" {
  1689. list += fmt.Sprintf(" - Upvcover: %s\n", Commands.Upvcover)
  1690. }
  1691. if Commands.Bringall != "" {
  1692. list += fmt.Sprintf(" - Bringall: %s\n", Commands.Bringall)
  1693. }
  1694. if Commands.Purgeall != "" {
  1695. list += fmt.Sprintf(" - Purgeall: %s\n", Commands.Purgeall)
  1696. }
  1697. if Commands.Banlist != "" {
  1698. list += fmt.Sprintf(" - Banlist: %s\n", Commands.Banlist)
  1699. }
  1700. if Commands.Clearban != "" {
  1701. list += fmt.Sprintf(" - Clearban: %s\n", Commands.Clearban)
  1702. }
  1703. if Commands.Stayall != "" {
  1704. list += fmt.Sprintf(" - Stayall: %s\n", Commands.Stayall)
  1705. }
  1706. if Commands.Clearchat != "" {
  1707. list += fmt.Sprintf(" - Clearchat: %s\n", Commands.Clearchat)
  1708. }
  1709. if Commands.Here != "" {
  1710. list += fmt.Sprintf(" - Here: %s\n", Commands.Here)
  1711. }
  1712. if Commands.Speed != "" {
  1713. list += fmt.Sprintf(" - Speed: %s\n", Commands.Speed)
  1714. }
  1715. if Commands.Status != "" {
  1716. list += fmt.Sprintf(" - Status: %s\n", Commands.Status)
  1717. }
  1718. if Commands.Tagall != "" {
  1719. list += fmt.Sprintf(" - Tagall: %s\n", Commands.Tagall)
  1720. }
  1721. if Commands.Kick != "" {
  1722. list += fmt.Sprintf(" - Kick: %s\n", Commands.Kick)
  1723. }
  1724. if Commands.Max != "" {
  1725. list += fmt.Sprintf(" - Protect Max: %s\n", Commands.Max)
  1726. }
  1727. if Commands.None != "" {
  1728. list += fmt.Sprintf(" - Protect None: %s\n", Commands.None)
  1729. }
  1730. if Commands.Kickall != "" {
  1731. list += fmt.Sprintf(" - Kickall: %s\n", Commands.Kickall)
  1732. }
  1733. if Commands.Cancelall != "" {
  1734. list += fmt.Sprintf(" - Cancelall: %s\n", Commands.Cancelall)
  1735. }
  1736. if list != "" {
  1737. return list2 + list
  1738. } else {
  1739. return "Not found set Cmd.\n"
  1740. }
  1741. }
  1742. func bToMb(b uint64) uint64 {
  1743. return b / 1024 / 1024
  1744. }
  1745. func TimeDown(Fucking int) bool {
  1746. switch Fucking {
  1747. case 0:
  1748. time.Sleep(200 * time.Millisecond)
  1749. return true
  1750. case 1:
  1751. time.Sleep(400 * time.Millisecond)
  1752. return true
  1753. case 2:
  1754. time.Sleep(600 * time.Millisecond)
  1755. return true
  1756. case 3:
  1757. time.Sleep(800 * time.Millisecond)
  1758. return true
  1759. case 4:
  1760. time.Sleep(1000 * time.Millisecond)
  1761. return true
  1762. case 5:
  1763. time.Sleep(1200 * time.Millisecond)
  1764. return true
  1765. case 6:
  1766. time.Sleep(1400 * time.Millisecond)
  1767. return true
  1768. case 7:
  1769. time.Sleep(1600 * time.Millisecond)
  1770. return true
  1771. case 8:
  1772. time.Sleep(1800 * time.Millisecond)
  1773. return true
  1774. case 9:
  1775. time.Sleep(2000 * time.Millisecond)
  1776. return true
  1777. case 10:
  1778. time.Sleep(2200 * time.Millisecond)
  1779. return true
  1780. case 11:
  1781. time.Sleep(2400 * time.Millisecond)
  1782. return true
  1783. case 12:
  1784. time.Sleep(2600 * time.Millisecond)
  1785. return true
  1786. case 13:
  1787. time.Sleep(2800 * time.Millisecond)
  1788. return true
  1789. case 14:
  1790. time.Sleep(3000 * time.Millisecond)
  1791. return true
  1792. case 15:
  1793. time.Sleep(3200 * time.Millisecond)
  1794. return true
  1795. case 16:
  1796. time.Sleep(3400 * time.Millisecond)
  1797. return true
  1798. case 17:
  1799. time.Sleep(3600 * time.Millisecond)
  1800. return true
  1801. case 18:
  1802. time.Sleep(3800 * time.Millisecond)
  1803. return true
  1804. case 19:
  1805. time.Sleep(4000 * time.Millisecond)
  1806. return true
  1807. case 20:
  1808. time.Sleep(4200 * time.Millisecond)
  1809. return true
  1810. case 21:
  1811. time.Sleep(4400 * time.Millisecond)
  1812. return true
  1813. case 22:
  1814. time.Sleep(4600 * time.Millisecond)
  1815. return true
  1816. case 23:
  1817. time.Sleep(4800 * time.Millisecond)
  1818. return true
  1819. default:
  1820. return false
  1821. }
  1822. }
  1823. func LeaveallGroups(client *oop.Account, to string) []string {
  1824. allg := []string{}
  1825. for i := range ClientBot {
  1826. groups, _ := ClientBot[i].GetGroupIdsJoined()
  1827. grup, _ := ClientBot[i].GetGroups(groups)
  1828. for _, gi := range grup {
  1829. if gi.ChatMid != to {
  1830. ClientBot[i].LeaveGroup(gi.ChatMid)
  1831. time.Sleep(1 * time.Second)
  1832. if !InArray2(allg, gi.ChatMid) {
  1833. allg = append(allg, gi.ChatMid)
  1834. }
  1835. }
  1836. }
  1837. }
  1838. return allg
  1839. }
  1840. func logAccess(client *oop.Account, group, from, tipe string, targets []string, tempat int64) {
  1841. defer panicHandle("logAccess")
  1842. if !LogMode || SendMyseller(from) {
  1843. return
  1844. }
  1845. nm, _, _ := client.GetChatList(group)
  1846. var ts = ""
  1847. if tipe == "ban" {
  1848. if len(targets) == 0 {
  1849. return
  1850. }
  1851. if tempat == 1 {
  1852. ts += fmt.Sprintf("@! banned %v user's:\n", len(targets))
  1853. cuh, _ := client.GetContacts(targets)
  1854. for _, prs := range cuh {
  1855. name := prs.DisplayName
  1856. ts += fmt.Sprintf("\n %s", name)
  1857. }
  1858. } else {
  1859. ts += fmt.Sprintf("@! banned %v user's from \n%s\n\nTarget:", len(targets), nm)
  1860. cuh, _ := client.GetContacts(targets)
  1861. for _, prs := range cuh {
  1862. name := prs.DisplayName
  1863. ts += fmt.Sprintf("\n %s", name)
  1864. }
  1865. }
  1866. } else if tipe == "unban" {
  1867. if len(targets) == 0 {
  1868. return
  1869. }
  1870. if tempat == 1 {
  1871. ts += fmt.Sprintf("@! unbaned %v user's:\n", len(targets))
  1872. cuh, _ := client.GetContacts(targets)
  1873. for _, prs := range cuh {
  1874. name := prs.DisplayName
  1875. ts += fmt.Sprintf("\n %s", name)
  1876. }
  1877. } else {
  1878. ts += fmt.Sprintf("@! unbaned %v user's from \n%s\n\nTarget:", len(targets), nm)
  1879. cuh, _ := client.GetContacts(targets)
  1880. for _, prs := range cuh {
  1881. name := prs.DisplayName
  1882. ts += fmt.Sprintf("\n %s", name)
  1883. }
  1884. }
  1885. } else if tipe == "owner" {
  1886. if len(targets) == 0 {
  1887. return
  1888. }
  1889. if tempat == 1 {
  1890. ts += fmt.Sprintf("@! promoted owner %v user's:\n", len(targets))
  1891. cuh, _ := client.GetContacts(targets)
  1892. for _, prs := range cuh {
  1893. name := prs.DisplayName
  1894. ts += fmt.Sprintf("\n %s", name)
  1895. }
  1896. } else {
  1897. ts += fmt.Sprintf("@! promoted owner %v user's from \n%s\n\nTarget:", len(targets), nm)
  1898. cuh, _ := client.GetContacts(targets)
  1899. for _, prs := range cuh {
  1900. name := prs.DisplayName
  1901. ts += fmt.Sprintf("\n %s", name)
  1902. }
  1903. }
  1904. } else if tipe == "unowner" {
  1905. if len(targets) == 0 {
  1906. return
  1907. }
  1908. if tempat == 1 {
  1909. ts += fmt.Sprintf("@! expeled owner %v user's:\n", len(targets))
  1910. cuh, _ := client.GetContacts(targets)
  1911. for _, prs := range cuh {
  1912. name := prs.DisplayName
  1913. ts += fmt.Sprintf("\n %s", name)
  1914. }
  1915. } else {
  1916. ts += fmt.Sprintf("@! expeled owner %v user's from \n%s\n\nTarget:", len(targets), nm)
  1917. cuh, _ := client.GetContacts(targets)
  1918. for _, prs := range cuh {
  1919. name := prs.DisplayName
  1920. ts += fmt.Sprintf("\n %s", name)
  1921. }
  1922. }
  1923. } else if tipe == "bot" {
  1924. if len(targets) == 0 {
  1925. return
  1926. }
  1927. if tempat == 1 {
  1928. ts += fmt.Sprintf("@! promoted bot %v user's:\n", len(targets))
  1929. cuh, _ := client.GetContacts(targets)
  1930. for _, prs := range cuh {
  1931. name := prs.DisplayName
  1932. ts += fmt.Sprintf("\n %s", name)
  1933. }
  1934. } else {
  1935. ts += fmt.Sprintf("@! promoted bot %v user's from \n%s\n\nTarget:", len(targets), nm)
  1936. cuh, _ := client.GetContacts(targets)
  1937. for _, prs := range cuh {
  1938. name := prs.DisplayName
  1939. ts += fmt.Sprintf("\n %s", name)
  1940. }
  1941. }
  1942. } else if tipe == "unbot" {
  1943. if len(targets) == 0 {
  1944. return
  1945. }
  1946. if tempat == 1 {
  1947. ts += fmt.Sprintf("@! expeled bot %v user's:\n", len(targets))
  1948. cuh, _ := client.GetContacts(targets)
  1949. for _, prs := range cuh {
  1950. name := prs.DisplayName
  1951. ts += fmt.Sprintf("\n %s", name)
  1952. }
  1953. } else {
  1954. ts += fmt.Sprintf("@! expeled bot %v user's from \n%s\n\nTarget:", len(targets), nm)
  1955. cuh, _ := client.GetContacts(targets)
  1956. for _, prs := range cuh {
  1957. name := prs.DisplayName
  1958. ts += fmt.Sprintf("\n %s", name)
  1959. }
  1960. }
  1961. } else if tipe == "mute" {
  1962. if len(targets) == 0 {
  1963. return
  1964. }
  1965. if tempat == 1 {
  1966. ts += fmt.Sprintf("@! muted %v user's:\n", len(targets))
  1967. cuh, _ := client.GetContacts(targets)
  1968. for _, prs := range cuh {
  1969. name := prs.DisplayName
  1970. ts += fmt.Sprintf("\n %s", name)
  1971. }
  1972. } else {
  1973. ts += fmt.Sprintf("@! muted %v user's from \n%s\n\nTarget:", len(targets), nm)
  1974. cuh, _ := client.GetContacts(targets)
  1975. for _, prs := range cuh {
  1976. name := prs.DisplayName
  1977. ts += fmt.Sprintf("\n %s", name)
  1978. }
  1979. }
  1980. } else if tipe == "unmute" {
  1981. if len(targets) == 0 {
  1982. return
  1983. }
  1984. if tempat == 1 {
  1985. ts += fmt.Sprintf("@! unmuted %v user's:\n", len(targets))
  1986. cuh, _ := client.GetContacts(targets)
  1987. for _, prs := range cuh {
  1988. name := prs.DisplayName
  1989. ts += fmt.Sprintf("\n %s", name)
  1990. }
  1991. } else {
  1992. ts += fmt.Sprintf("@! unmuted %v user's from \n%s\n\nTarget:", len(targets), nm)
  1993. cuh, _ := client.GetContacts(targets)
  1994. for _, prs := range cuh {
  1995. name := prs.DisplayName
  1996. ts += fmt.Sprintf("\n %s", name)
  1997. }
  1998. }
  1999. } else if tipe == "fuck" {
  2000. if len(targets) == 0 {
  2001. return
  2002. }
  2003. if tempat == 1 {
  2004. ts += fmt.Sprintf("@! fuck %v user's:\n", len(targets))
  2005. cuh, _ := client.GetContacts(targets)
  2006. for _, prs := range cuh {
  2007. name := prs.DisplayName
  2008. ts += fmt.Sprintf("\n %s", name)
  2009. }
  2010. } else {
  2011. ts += fmt.Sprintf("@! fuck %v user's from \n%s\n\nTarget:", len(targets), nm)
  2012. cuh, _ := client.GetContacts(targets)
  2013. for _, prs := range cuh {
  2014. name := prs.DisplayName
  2015. ts += fmt.Sprintf("\n %s", name)
  2016. }
  2017. }
  2018. } else if tipe == "master" {
  2019. if len(targets) == 0 {
  2020. return
  2021. }
  2022. if tempat == 1 {
  2023. ts += fmt.Sprintf("@! promoted Master %v user's:\n", len(targets))
  2024. cuh, _ := client.GetContacts(targets)
  2025. for _, prs := range cuh {
  2026. name := prs.DisplayName
  2027. ts += fmt.Sprintf("\n %s", name)
  2028. }
  2029. } else {
  2030. ts += fmt.Sprintf("@! promoted Master %v user's from \n%s\n\nTarget:", len(targets), nm)
  2031. cuh, _ := client.GetContacts(targets)
  2032. for _, prs := range cuh {
  2033. name := prs.DisplayName
  2034. ts += fmt.Sprintf("\n %s", name)
  2035. }
  2036. }
  2037. } else if tipe == "unmaster" {
  2038. if len(targets) == 0 {
  2039. return
  2040. }
  2041. if tempat == 1 {
  2042. ts += fmt.Sprintf("@! expeled Master %v user's:\n", len(targets))
  2043. cuh, _ := client.GetContacts(targets)
  2044. for _, prs := range cuh {
  2045. name := prs.DisplayName
  2046. ts += fmt.Sprintf("\n %s", name)
  2047. }
  2048. } else {
  2049. ts += fmt.Sprintf("@! expeled Master %v user's from \n%s\n\nTarget:", len(targets), nm)
  2050. cuh, _ := client.GetContacts(targets)
  2051. for _, prs := range cuh {
  2052. name := prs.DisplayName
  2053. ts += fmt.Sprintf("\n %s", name)
  2054. }
  2055. }
  2056. } else if tipe == "admin" {
  2057. if len(targets) == 0 {
  2058. return
  2059. }
  2060. if tempat == 1 {
  2061. ts += fmt.Sprintf("@! promoted admin %v user's:\n", len(targets))
  2062. cuh, _ := client.GetContacts(targets)
  2063. for _, prs := range cuh {
  2064. name := prs.DisplayName
  2065. ts += fmt.Sprintf("\n %s", name)
  2066. }
  2067. } else {
  2068. ts += fmt.Sprintf("@! promoted admin %v user's from \n%s\n\nTarget:", len(targets), nm)
  2069. cuh, _ := client.GetContacts(targets)
  2070. for _, prs := range cuh {
  2071. name := prs.DisplayName
  2072. ts += fmt.Sprintf("\n %s", name)
  2073. }
  2074. }
  2075. } else if tipe == "unadmin" {
  2076. if len(targets) == 0 {
  2077. return
  2078. }
  2079. if tempat == 1 {
  2080. ts += fmt.Sprintf("@! expeled admin %v user's:\n", len(targets))
  2081. cuh, _ := client.GetContacts(targets)
  2082. for _, prs := range cuh {
  2083. name := prs.DisplayName
  2084. ts += fmt.Sprintf("\n %s", name)
  2085. }
  2086. } else {
  2087. ts += fmt.Sprintf("@! expeled admin %v user's from \n%s\n\nTarget:", len(targets), nm)
  2088. cuh, _ := client.GetContacts(targets)
  2089. for _, prs := range cuh {
  2090. name := prs.DisplayName
  2091. ts += fmt.Sprintf("\n %s", name)
  2092. }
  2093. }
  2094. } else if tipe == "gowner" {
  2095. if len(targets) == 0 {
  2096. return
  2097. }
  2098. ts += fmt.Sprintf("@! promoted gowner %v user's from \n%s\n\nTarget:", len(targets), nm)
  2099. cuh, _ := client.GetContacts(targets)
  2100. for _, prs := range cuh {
  2101. name := prs.DisplayName
  2102. ts += fmt.Sprintf("\n %s", name)
  2103. }
  2104. } else if tipe == "ungowner" {
  2105. if len(targets) == 0 {
  2106. return
  2107. }
  2108. ts += fmt.Sprintf("@! expeled gowner %v user's from \n%s\n\nTarget:", len(targets), nm)
  2109. cuh, _ := client.GetContacts(targets)
  2110. for _, prs := range cuh {
  2111. name := prs.DisplayName
  2112. ts += fmt.Sprintf("\n %s", name)
  2113. }
  2114. } else if tipe == "gadmin" {
  2115. if len(targets) == 0 {
  2116. return
  2117. }
  2118. ts += fmt.Sprintf("@! promoted gadmin %v user's from \n%s\n\nTarget:", len(targets), nm)
  2119. cuh, _ := client.GetContacts(targets)
  2120. for _, prs := range cuh {
  2121. name := prs.DisplayName
  2122. ts += fmt.Sprintf("\n %s", name)
  2123. }
  2124. } else if tipe == "ungadmin" {
  2125. if len(targets) == 0 {
  2126. return
  2127. }
  2128. ts += fmt.Sprintf("@! expeled gadmin %v user's from \n%s\n\nTarget:", len(targets), nm)
  2129. cuh, _ := client.GetContacts(targets)
  2130. for _, prs := range cuh {
  2131. name := prs.DisplayName
  2132. ts += fmt.Sprintf("\n %s", name)
  2133. }
  2134. } else if tipe == "expel" {
  2135. if len(targets) == 0 {
  2136. return
  2137. }
  2138. if tempat == 1 {
  2139. ts += fmt.Sprintf("@! expeled access %v user's:\n", len(targets))
  2140. cuh, _ := client.GetContacts(targets)
  2141. for _, prs := range cuh {
  2142. name := prs.DisplayName
  2143. ts += fmt.Sprintf("\n %s", name)
  2144. }
  2145. } else {
  2146. ts += fmt.Sprintf("@! expeled access %v user's from \n%s\n\nTarget:", len(targets), nm)
  2147. cuh, _ := client.GetContacts(targets)
  2148. for _, prs := range cuh {
  2149. name := prs.DisplayName
  2150. ts += fmt.Sprintf("\n %s", name)
  2151. }
  2152. }
  2153. } else if tipe == "clearowner" {
  2154. if len(targets) == 0 {
  2155. return
  2156. }
  2157. if tempat == 1 {
  2158. ts += fmt.Sprintf("@! cleared all owner %v user's:\n", len(targets))
  2159. cuh, _ := client.GetContacts(targets)
  2160. for _, prs := range cuh {
  2161. name := prs.DisplayName
  2162. ts += fmt.Sprintf("\n %s", name)
  2163. }
  2164. } else {
  2165. ts += fmt.Sprintf("@! cleared all owner %v user's from \n%s\n\nTarget:", len(targets), nm)
  2166. cuh, _ := client.GetContacts(targets)
  2167. for _, prs := range cuh {
  2168. name := prs.DisplayName
  2169. ts += fmt.Sprintf("\n %s", name)
  2170. }
  2171. }
  2172. } else if tipe == "clearmaster" {
  2173. if len(targets) == 0 {
  2174. return
  2175. }
  2176. if tempat == 1 {
  2177. ts += fmt.Sprintf("@! cleared all master %v user's:\n", len(targets))
  2178. cuh, _ := client.GetContacts(targets)
  2179. for _, prs := range cuh {
  2180. name := prs.DisplayName
  2181. ts += fmt.Sprintf("\n %s", name)
  2182. }
  2183. } else {
  2184. ts += fmt.Sprintf("@! cleared all master %v user's from \n%s\n\nTarget:", len(targets), nm)
  2185. cuh, _ := client.GetContacts(targets)
  2186. for _, prs := range cuh {
  2187. name := prs.DisplayName
  2188. ts += fmt.Sprintf("\n %s", name)
  2189. }
  2190. }
  2191. } else if tipe == "clearadmin" {
  2192. if len(targets) == 0 {
  2193. return
  2194. }
  2195. if tempat == 1 {
  2196. ts += fmt.Sprintf("@! cleared all admin %v user's:\n", len(targets))
  2197. cuh, _ := client.GetContacts(targets)
  2198. for _, prs := range cuh {
  2199. name := prs.DisplayName
  2200. ts += fmt.Sprintf("\n %s", name)
  2201. }
  2202. } else {
  2203. ts += fmt.Sprintf("@! cleared all admin %v user's from \n%s\n\nTarget:", len(targets), nm)
  2204. cuh, _ := client.GetContacts(targets)
  2205. for _, prs := range cuh {
  2206. name := prs.DisplayName
  2207. ts += fmt.Sprintf("\n %s", name)
  2208. }
  2209. }
  2210. } else if tipe == "clearban" {
  2211. if len(targets) == 0 {
  2212. return
  2213. }
  2214. if tempat == 1 {
  2215. ts += fmt.Sprintf("@! cleared all banlist %v user's:\n", len(targets))
  2216. cuh, _ := client.GetContacts(targets)
  2217. for _, prs := range cuh {
  2218. name := prs.DisplayName
  2219. ts += fmt.Sprintf("\n %s", name)
  2220. }
  2221. } else {
  2222. ts += fmt.Sprintf("@! cleared all banlist %v user's from \n%s\n\nTarget:", len(targets), nm)
  2223. cuh, _ := client.GetContacts(targets)
  2224. for _, prs := range cuh {
  2225. name := prs.DisplayName
  2226. ts += fmt.Sprintf("\n %s", name)
  2227. }
  2228. }
  2229. } else if tipe == "clearbot" {
  2230. if len(targets) == 0 {
  2231. return
  2232. }
  2233. if tempat == 1 {
  2234. ts += fmt.Sprintf("@! cleared all bot %v user's:\n", len(targets))
  2235. cuh, _ := client.GetContacts(targets)
  2236. for _, prs := range cuh {
  2237. name := prs.DisplayName
  2238. ts += fmt.Sprintf("\n %s", name)
  2239. }
  2240. } else {
  2241. ts += fmt.Sprintf("@! cleared all bot %v user's from \n%s\n\nTarget:", len(targets), nm)
  2242. cuh, _ := client.GetContacts(targets)
  2243. for _, prs := range cuh {
  2244. name := prs.DisplayName
  2245. ts += fmt.Sprintf("\n %s", name)
  2246. }
  2247. }
  2248. } else if tipe == "clearmute" {
  2249. if len(targets) == 0 {
  2250. return
  2251. }
  2252. if tempat == 1 {
  2253. ts += fmt.Sprintf("@! cleared all mutelist %v user's:\n", len(targets))
  2254. cuh, _ := client.GetContacts(targets)
  2255. for _, prs := range cuh {
  2256. name := prs.DisplayName
  2257. ts += fmt.Sprintf("\n %s", name)
  2258. }
  2259. } else {
  2260. ts += fmt.Sprintf("@! cleared all mutelist %v user's from \n%s\n\nTarget:", len(targets), nm)
  2261. cuh, _ := client.GetContacts(targets)
  2262. for _, prs := range cuh {
  2263. name := prs.DisplayName
  2264. ts += fmt.Sprintf("\n %s", name)
  2265. }
  2266. }
  2267. } else if tipe == "kick" {
  2268. if len(targets) == 0 {
  2269. return
  2270. }
  2271. ts += fmt.Sprintf("@! kick %v user's from\n%s\n\n", len(targets), nm)
  2272. cuh, _ := client.GetContacts(targets)
  2273. for _, prs := range cuh {
  2274. name := prs.DisplayName
  2275. ts += fmt.Sprintf("\n %s", name)
  2276. }
  2277. } else if tipe == "cancel" {
  2278. if len(targets) == 0 {
  2279. return
  2280. }
  2281. ts += fmt.Sprintf("@! cancel %v invitation's from\n%s\n\n", len(targets), nm)
  2282. cuh, _ := client.GetContacts(targets)
  2283. for _, prs := range cuh {
  2284. name := prs.DisplayName
  2285. ts += fmt.Sprintf("\n %s", name)
  2286. }
  2287. } else if tipe == "invite" {
  2288. if len(targets) == 0 {
  2289. return
  2290. }
  2291. ts += fmt.Sprintf("@! invite %v user's from\n%s\n\n", len(targets), nm)
  2292. cuh, _ := client.GetContacts(targets)
  2293. for _, prs := range cuh {
  2294. name := prs.DisplayName
  2295. ts += fmt.Sprintf("\n %s", name)
  2296. }
  2297. } else if tipe == "Kickall" {
  2298. ts += fmt.Sprintf("@! Nukeall %v user's from\n%s", len(targets), nm)
  2299. } else if tipe == "purgeall" {
  2300. ts += fmt.Sprintf("@! purgeall %v user's from\n%s", len(targets), nm)
  2301. } else if tipe == "purge" {
  2302. ts += fmt.Sprintf("@! purge %v user's in:\n%s", len(targets), nm)
  2303. } else if tipe == "cancelall" {
  2304. ts += fmt.Sprintf("@! cancelall %v invitation's from\n%s", len(targets), nm)
  2305. } else if tipe == "leave" {
  2306. ts += fmt.Sprintf("@! bot's leave from\n%s", nm)
  2307. } else if tipe == "bringbot" {
  2308. ts += fmt.Sprintf("@! Invite bot's\n%s", nm)
  2309. } else if tipe == "addfrind" {
  2310. ts += fmt.Sprintf("@! he added %v as friend\nMid : \n%s", group, from)
  2311. }
  2312. room := oop.GetRoom(LogGroup)
  2313. if len(room.Client) != 0 {
  2314. exe, err := SelectBot(room.Client[0], LogGroup)
  2315. if err == nil {
  2316. if exe != nil {
  2317. exe.SendMention(LogGroup, ts, []string{from})
  2318. }
  2319. } else {
  2320. LogMode = false
  2321. LogGroup = ""
  2322. }
  2323. }
  2324. }