Skip to content

Commit

Permalink
1.0-61
Browse files Browse the repository at this point in the history
- fixed toot ending with exclamation mark not taking parameter.
  • Loading branch information
Canorus committed Dec 7, 2018
1 parent 47cfdfd commit 1dee3c9
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 8 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,8 @@ Original repository is removed because I found out a file contains my login cred

### Todo

- [ ] Toot ending with exclamation mark. This is **urgent**
- [x] `reply` to notification hmm
- [x] ~~Toot ending with exclamation mark. This is **urgent**~~ fixed on 1.0-61
- [x] ~~`mreply` to notification hmm~~
- [ ] `-web`
- [x] ~~Contents warning message~~
- [ ] multiple accounts
Expand Down
17 changes: 11 additions & 6 deletions toot.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,11 +34,9 @@ def clipboard_image():

try:
toot_sp = re.compile(" !.*?:.?").split(toot)
print(toot_sp)
toot_split = re.findall('!.*?:',toot)
toot_split = re.findall(' !.*?:',toot)
for i in range(len(toot_split)):
toot_split[i] = toot_split[i][1:-1]
print(toot_split)
toot_split[i] = toot_split[i][2:-1]
toot_split.insert(0,'status')
except:
# if finding param breaks
Expand Down Expand Up @@ -74,10 +72,11 @@ def clipboard_image():
for i in range(len(toot_sp)):
hd[toot_split[i]] = unicodedata.normalize('NFC',toot_sp[i])

if 'prev' in toot_sp:
if 'prev' in toot_split:
account_id = requests.get(instance+'/api/v1/accounts/verify_credentials',headers=status_h).json()['id']
#print(requests.get(instance+'/api/v1/accounts/verify_credentials',headers=status_h).json())
prev_status = requests.get(instance+'/api/v1/accounts/'+account_id+'/statuses',headers=status_h).json()[0]['id']
hd['in_reply_to_id'] = prev_status
hd['in_reply_to_id']=prev_status

if 'clipboard' in toot_split:
media_id = ''
Expand All @@ -88,5 +87,11 @@ def clipboard_image():
del hd['cb']
hd['media_ids[]']=media_id

if 'in_reply_to_id' in toot_split and 'silent' not in toot_split:
import json
who_reply_to = json.loads(requests.get(instance+'/api/v1/statuses/'+hd['in_reply_to_id']).content.decode('utf-8'))['account']['acct']
hd['status'] += ' @'+who_reply_to

#print('hd is '+str(hd))
st = requests.post(instance+'/api/v1/statuses',data=hd,headers=status_h)
print(st.json())

0 comments on commit 1dee3c9

Please sign in to comment.