mirror of
https://github.com/sigmasternchen/MinervaBot
synced 2025-03-15 07:59:00 +00:00
this should finish the port to tweepy
This commit is contained in:
parent
5d163f5ebd
commit
9e74a2d9d8
2 changed files with 8 additions and 7 deletions
15
main.py
15
main.py
|
@ -10,7 +10,7 @@ import string
|
|||
import random
|
||||
|
||||
from config import *
|
||||
from gen-config import *
|
||||
from genconfig import *
|
||||
|
||||
logfile = open(LOG_FILE, LOG_TYPE)
|
||||
|
||||
|
@ -92,6 +92,7 @@ if __name__ == "__main__":
|
|||
if not ALLOW_ONLY_DM_COMMANDS:
|
||||
mentions = api.mention_timeline(since_id = lastChange)
|
||||
for mention in mentions:
|
||||
lastChange = mention.id
|
||||
if len(COMMAND_SOURCE_ACCOUNTS) == 0:
|
||||
commandsToExecute.append([
|
||||
mention.author.screen_name,
|
||||
|
@ -113,18 +114,18 @@ if __name__ == "__main__":
|
|||
output = subprocess.Popen(command[1], shell=True, stdout=PIPE).stdout.read()
|
||||
log("result: " + output);
|
||||
if (output + command[0]).len() + 2 > 140:
|
||||
api.PostUpdate(status = command[0] + "Output of command is too long. I'm sry. : /")
|
||||
api.update_status(status = command[0] + "Output of command is too long. I'm sry. : /")
|
||||
else:
|
||||
api.PostUpdate(status = command[0] + " " + output)
|
||||
api.update_status(status = command[0] + " " + output)
|
||||
|
||||
|
||||
for command in UPDATE_COMMANDS:
|
||||
output = subprocess.Popen(UPDATE_COMMANDS[command], shell=True, stdout=PIPE).stdout.read()
|
||||
if len(DESTINATION_ACCOUNTS):
|
||||
for username in DESTINATION_ACCOUNTS:
|
||||
api.PostUpdate(status = (username + " " + command + COMMAND_NAME_SEPERATOR + output))
|
||||
api.update_status(status = ("@" + username + " " + command + COMMAND_NAME_SEPERATOR + output))
|
||||
else:
|
||||
api.PostUpdate(status = (command + COMMAND_NAME_SEPERATOR + output))
|
||||
api.update_status(status = (command + COMMAND_NAME_SEPERATOR + output))
|
||||
|
||||
|
||||
if counter % 3 == 0:
|
||||
|
@ -133,9 +134,9 @@ if __name__ == "__main__":
|
|||
if output != WARNING_COMMANDS[command][1]:
|
||||
if len(WARNING_DESTINATION_ACCOUNTS):
|
||||
for username in WARNING_DESTINATION_ACCOUNTS:
|
||||
api.PostUpdate(status = username + " WARNING: " + command + COMMAND_NAME_SEPERATOR + WARNING_COMMANDS[command][2])
|
||||
api.update_status(status = username + " WARNING: " + command + COMMAND_NAME_SEPERATOR + WARNING_COMMANDS[command][2])
|
||||
else:
|
||||
api.PostUpdate(status = "WARNING: " + command + COMMAND_NAME_SEPERATOR + WARNING_COMMANDS[command][2])
|
||||
api.update_status(status = "WARNING: " + command + COMMAND_NAME_SEPERATOR + WARNING_COMMANDS[command][2])
|
||||
time.sleep(5 * 60)
|
||||
|
||||
counter++
|
||||
|
|
Loading…
Reference in a new issue