mirror of
https://github.com/sigmasternchen/MinervaBot
synced 2025-03-15 07:59:00 +00:00
let's try this
This commit is contained in:
parent
4bb2b61d76
commit
494e7ba142
1 changed files with 12 additions and 11 deletions
23
main.py
23
main.py
|
@ -63,24 +63,25 @@ if __name__ == "__main__":
|
||||||
|
|
||||||
counter = 0
|
counter = 0
|
||||||
|
|
||||||
lastChange = 0
|
lastChangeT = 0
|
||||||
|
lastChangeDM = 0
|
||||||
|
|
||||||
lastChange = api.direct_messages(since_id = lastChange)
|
lastChangeDM = api.direct_messages()
|
||||||
if len(lastChange) == 0:
|
if len(lastChangeDM) == 0:
|
||||||
lastChange = 0
|
lastChangeDM = 0
|
||||||
else:
|
else:
|
||||||
lastChange = lastChange[0].GetId()
|
lastChangeDM = lastChangeDM[0].GetId()
|
||||||
tmp = api.mentions_timeline(since_id = lastChange)
|
lastChangeT = api.mentions_timeline()
|
||||||
if len(tmp) != 0:
|
if len(tmp) != 0:
|
||||||
lastChange = lastChange[0].GetId()
|
lastChangeT = lastChangeT[0].GetId()
|
||||||
|
|
||||||
while true:
|
while true:
|
||||||
if ALLOW_COMMANDS:
|
if ALLOW_COMMANDS:
|
||||||
dms = api.direct_messages(since_id = lastChange)
|
dms = api.direct_messages(since_id = lastChangeDM)
|
||||||
|
|
||||||
commandsToExecute = []
|
commandsToExecute = []
|
||||||
for dm in dms:
|
for dm in dms:
|
||||||
lastChange = dm.id
|
lastChangeDM = dm.id
|
||||||
if len(COMMAND_SOURCE_ACCOUNTS) == 0:
|
if len(COMMAND_SOURCE_ACCOUNTS) == 0:
|
||||||
commandsToExecute.append([
|
commandsToExecute.append([
|
||||||
dm.GetSenderScreenName(),
|
dm.GetSenderScreenName(),
|
||||||
|
@ -97,9 +98,9 @@ if __name__ == "__main__":
|
||||||
log("unprivileged user @" + dm.author.screen_name + " tried to execute command (dm) \"" + dm.text.replace("\n", "\\n") + "\"\n")
|
log("unprivileged user @" + dm.author.screen_name + " tried to execute command (dm) \"" + dm.text.replace("\n", "\\n") + "\"\n")
|
||||||
|
|
||||||
if not ALLOW_ONLY_DM_COMMANDS:
|
if not ALLOW_ONLY_DM_COMMANDS:
|
||||||
mentions = api.mentions_timeline(since_id = lastChange)
|
mentions = api.mentions_timeline(since_id = lastChangeT)
|
||||||
for mention in mentions:
|
for mention in mentions:
|
||||||
lastChange = mention.id
|
lastChangeT = mention.id
|
||||||
if len(COMMAND_SOURCE_ACCOUNTS) == 0:
|
if len(COMMAND_SOURCE_ACCOUNTS) == 0:
|
||||||
commandsToExecute.append([
|
commandsToExecute.append([
|
||||||
mention.author.screen_name,
|
mention.author.screen_name,
|
||||||
|
|
Loading…
Reference in a new issue