blob: d6da79256cb893a6748e9f1b07f19cd37343b7b3 (
plain)
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
58
59
60
61
62
63
64
65
66
67
|
package net.miz_hi.smileessence.command.status.impl;
import net.miz_hi.smileessence.Client;
import net.miz_hi.smileessence.command.IConfirmable;
import net.miz_hi.smileessence.command.IHideable;
import net.miz_hi.smileessence.command.status.StatusCommand;
import net.miz_hi.smileessence.model.status.tweet.TweetModel;
import net.miz_hi.smileessence.task.impl.TweetTask;
import twitter4j.StatusUpdate;
import java.util.Random;
public class StatusCommandCongrats extends StatusCommand implements IHideable, IConfirmable
{
public StatusCommandCongrats(TweetModel status)
{
super(status);
}
@Override
public String getName()
{
return "お祝いする";
}
@Override
public void workOnUiThread()
{
int favCount;
Random rand = new Random();
int r = rand.nextInt(100);
if (r < 50)
{
favCount = 50;
}
else if (r < 80)
{
favCount = 100;
}
else if (r < 90)
{
favCount = 250;
}
else if (r < 99)
{
favCount = 1000;
}
else
{
favCount = 10000;
}
String str = String.format("@%s Congrats on your %s ★ tweet! http://favstar.fm/t/%s", status.getOriginal().user.screenName, favCount, status.getOriginal().statusId);
StatusUpdate update = new StatusUpdate(str);
update.setInReplyToStatusId(status.getOriginal().statusId);
status.getOriginal().favorite();
new TweetTask(update).callAsync();
}
@Override
public boolean getDefaultVisibility()
{
return Client.getPermission().canWarotaRT();
}
}
|