public static void Enter()
 {
     while (true)
     {
         try {
             processUpdates();
             Verify.runTask();
             Cleanup.runTask();
         }
         catch (Exception E) {
             Helpers.writeStack(E.ToString());
             Thread.Sleep(500);
         }
     }
 }
Exemple #2
0
        public static void doNotify(long user, long mid, long groupID, GroupConfigurationObject GCO, long jmid)
        {
            var ra = 0;

            SQL.NonQuery($"UPDATE `verify` SET notified=TRUE WHERE `user`={user} AND `group`={groupID}", out ra);
            var thc = new TGChat {
                id = groupID
            };
            var thu = new TGUser {
                id = user
            };
            var thm        = Telegram.getChatMember(thc, thu);
            var deleteJMID = GCO.getBool("dontdeletejoinmessage");

            if (mid != 0)
            {
                Telegram.deleteMessage(thc, mid);
            }

            if (jmid != 0 && deleteJMID == false)
            {
                Telegram.deleteMessage(thc, jmid);
            }

            root.callHook.Call("verUserVerifiedNotify", thc, thu, groupID, GCO);


            if (GCO.getBool("verifyannounce"))
            {
                var name    = Helpers.getMentionName(thm);
                var sendMsg =
                    Localization.getStringLocalized(GCO.getString("language"), "verify/userVerified", name);
                var vermsg = GCO.getString("verifymessage");

                if ((vermsg != null) & (vermsg.Length > 2))
                {
                    sendMsg = vermsg;
                    sendMsg = sendMsg.Replace("%NAME", name);
                }

                var msg = Telegram.sendMessage(new TGChat {
                    id = groupID
                }, sendMsg, "HTML");
                Cleanup.addMessage(msg);
            }
        }
Exemple #3
0
        public static void doRemovalDoubt(long user, long mid, long groupID, GroupConfigurationObject GCO, long jmid)
        {
            int ra = 0;

            SQL.NonQuery($"DELETE FROM `verify` WHERE `user`={user} AND `group`={groupID}", out ra);
            SQL.NonQuery($"INSERT INTO `verify_doubt` (`user`,`group`) VALUES({user},{groupID})", out ra);
            Removals.addIncident(new TGUser()
            {
                id = user
            }, new TGChat {
                id = groupID
            }, "VERIFYEXPIRE");
            root.callHook.Call("verUserRemoved", user, mid, groupID, GCO, true);
            var thc = new TGChat()
            {
                id = groupID
            };
            var thu = new TGUser()
            {
                id = user
            };
            var thm = Telegram.getChatMember(thc, thu);

            if (mid != 0)
            {
                Telegram.deleteMessage(thc, mid);
            }
            if (jmid != 0)
            {
                Telegram.deleteMessage(thc, jmid);
            }
            Telegram.kickChatMember(thc, thu, 120);
            if (GCO.getBool("verifyannounce"))
            {
                var name    = Helpers.getMentionName(thm);
                var sendMsg = Localization.getStringLocalized(GCO.getString("language"), "verify/userKickedDoubt", name);
                var msg     = Telegram.sendMessage(new TGChat()
                {
                    id = groupID
                }, sendMsg);
                Cleanup.addMessage(msg);
            }
        }
Exemple #4
0
        public static void doRemoval(long user, long mid, long groupID, GroupConfigurationObject GCO, long jmid)
        {
            int ra = 0;

            Removals.addIncident(new TGUser()
            {
                id = user
            }, new TGChat {
                id = groupID
            }, "VERIFYEXPIRE");
            SQL.NonQuery($"DELETE FROM `verify` WHERE `user`={user} AND `group`={groupID}", out ra);
            root.callHook.Call("verUserRemoved", user, mid, groupID, GCO, false);
            var thc = new TGChat()
            {
                id = groupID
            };
            var thu = new TGUser()
            {
                id = user
            };
            var thm = Telegram.getChatMember(thc, thu);

            if (mid != 0)
            {
                Telegram.deleteMessage(thc, mid);
            }
            if (jmid != 0)
            {
                Telegram.deleteMessage(thc, jmid);
            }
            Telegram.kickChatMember(thc, thu, 0);
            //Telegram.sendMessage(thc, "welcome to kicked, nobody will ever know you existed.");
            if (GCO.getBool("verifyannounce"))
            {
                var name    = Helpers.getMentionName(thm);
                var sendMsg = Localization.getStringLocalized(GCO.getString("language"), "verify/userKicked", name);
                var msg     = Telegram.sendMessage(new TGChat()
                {
                    id = groupID
                }, sendMsg);
                Cleanup.addMessage(msg);
            }
        }