This commit is contained in:
Inex Code 2022-05-05 19:49:41 +00:00
parent c81dfdf5c9
commit 94ac7cfcb6
2 changed files with 7 additions and 7 deletions

View file

@ -37,6 +37,7 @@ Future<void> _importPosts(fileUri) async {
for (final line in lines) {
if (line.isEmpty && post != '') {
posts.add(post);
print('Added post: $post');
} else {
post += '$line\n';
}
@ -44,6 +45,7 @@ Future<void> _importPosts(fileUri) async {
if (post != '') {
posts.add(post);
print('Added post: $post');
}
// Read posts.json and add posts to it
@ -96,14 +98,14 @@ void main(List<String> args) async {
await _importPosts('/data/posts.txt');
// Post a random post
await _postRandomPost();
// await _postRandomPost();
// Post a random post at random time
// Random time is between 1 and 8 hours
// Random time is choosen after every post
while (true) {
await Future.delayed(Duration(hours: Random().nextInt(8) + 1));
await _postRandomPost();
}
// while (true) {
// await Future.delayed(Duration(hours: Random().nextInt(8) + 1));
// await _postRandomPost();
// }
}

View file

@ -10,8 +10,6 @@ environment:
dependencies:
args: ^2.0.0
dio: ^4.0.6
shelf: ^1.1.0
shelf_router: ^1.0.0
dev_dependencies:
http: ^0.13.0