chir.py

- twitter bot that earns bitcoin via ppc links
git clone git://git.acid.vegas/chir.py.git
Log | Files | Refs | Archive | README | LICENSE

debug.py (2199B)

      1 #!/usr/bin/env python
      2 # Chir.py Twitter Bot - Developed by acidvegas in Python (https://acid.vegas/chir.py)
      3 # debug.py
      4 
      5 import os
      6 import sys
      7 import time
      8 
      9 import config
     10 
     11 def action(msg):
     12     print('%s | [#] - %s' % (get_time(), msg))
     13 
     14 def alert(msg):
     15     print('%s | [+] - %s' % (get_time(), msg))
     16 
     17 def check_config():
     18     for item in (config.coinurl_uuid, config.twitter_consumer_key, config.twitter_consumer_secret, config.twitter_access_token, config.twitter_access_token_secret):
     19         if item == 'CHANGEME':
     20             error_exit('Edit your config file!')
     21 
     22 def check_imports():
     23     try:
     24         import tweepy
     25     except ImportError:
     26         error_exit('Failed to import the Tweepy library! (http://pypi.python.org/pypi/tweepy)')
     27     try:
     28         import feedparser
     29     except ImportError:
     30         error_exit('Failed to import the FeedParser library! (http://pypi.python.org/pypi/feedparser)')
     31 
     32 def check_root():
     33     if os.getuid() == 0 or os.geteuid() == 0:
     34         return True
     35     else:
     36         return False
     37 
     38 def check_version(major):
     39     if sys.version_info.major == major:
     40         return True
     41     else:
     42         return False
     43 
     44 def check_windows():
     45     if os.name == 'nt':
     46         return True
     47     else:
     48         return False
     49 
     50 def clear():
     51     if check_windows():
     52         os.system('cls')
     53     else:
     54         os.system('clear')
     55 
     56 def error(msg, reason=None):
     57     if reason:
     58         print('%s | [!] - %s (%s)' % (get_time(), msg, str(reason)))
     59     else:
     60         print('%s | [!] - %s' % (get_time(), msg))
     61 
     62 def error_exit(msg):
     63     raise SystemExit('%s | [!] - %s' % (get_time(), msg))
     64 
     65 def get_time():
     66     return time.strftime('%I:%M:%S')
     67 
     68 def get_windows():
     69     if os.name == 'nt':
     70         return True
     71     else:
     72         return False
     73 
     74 def info():
     75     clear()
     76     print(''.rjust(56, '#'))
     77     print('#' + ''.center(54) + '#')
     78     print('#' + 'Chir.py Twitter Bot'.center(54) + '#')
     79     print('#' + 'Developed by acidvegas in Python '.center(54) + '#')
     80     print('#' + 'https://acid.vegas/chir.py'.center(54) + '#')
     81     print('#' + ''.center(54) + '#')
     82     print(''.rjust(56, '#'))
     83 
     84 def keep_alive():
     85     try:
     86         while True:
     87             input('')
     88     except KeyboardInterrupt:
     89         sys.exit()