-
Notifications
You must be signed in to change notification settings - Fork 0
/
bot.py
57 lines (46 loc) · 2.17 KB
/
bot.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
import logging
import sys
from kik_unofficial.datatypes.xmpp.chatting import *
import kik_unofficial.datatypes.xmpp.chatting as chatting
from kik_unofficial.client import KikClient
from kik_unofficial.callbacks import KikClientCallback
from kik_unofficial.datatypes.xmpp.errors import SignUpError, LoginError
from kik_unofficial.datatypes.xmpp.roster import FetchRosterResponse, PeersInfoResponse
from kik_unofficial.datatypes.xmpp.sign_up import RegisterResponse, UsernameUniquenessResponse
from kik_unofficial.datatypes.xmpp.login import LoginResponse, ConnectionFailedResponse
from kik_unofficial.datatypes.xmpp.xiphias import UsersResponse, UsersByAliasResponse
from typing import Union, List, Tuple
import time, re, datetime, requests, json, _thread, configparser
from bs4 import BeautifulSoup
from helper_funcs import *
#above is importing
#below is the config obviously
config = configparser.ConfigParser()
config.read('config.ini')
username = config['REQUIRED']['username']
password = config['REQUIRED']['password']
device_id = config['REQUIRED']['device_id']
android_id = config['REQUIRED']['android_id']
owner = config['REQUIRED']['owner']
prefix = config['REQUIRED']['prefix']
kik_bot_username = config['OPTIONAL']['kik_bot_username']
kik_bot_key = config['OPTIONAL']['kik_bot_api_key']
# above is the config setup
def main():
bot = RedsCute()
class RedsCute(KikClientCallback):
def __init__(self):
self.client = KikClient(self, username, password, device_id_override = device_id, android_id_override = android_id)
def on_authenticated(self):
print("Authenticated")
ensure_bot(username)
clear_captchas()
_thread.start_new_thread( check_captchas, (self.client, username, ) )
def on_login_ended(self, response: LoginResponse):
print("Full name: {} {} JID:{} Device ID:{}".format(response.first_name, response.last_name, from_jid, device_id))
#commands
elif chat_message.body.lower() == prefix+"credits":
self.client.send_chat_message(chat_message.from_jid, "This is a Simple Bot set up by Red./nThis wasnt tested so dont freak out if it has errors.")
return
if __name__ == '__main__':
main()