Skip to content

Instantly share code, notes, and snippets.

@pepepper
Last active August 8, 2019 10:41
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save pepepper/525045604c94b76878cd383235f7c5b5 to your computer and use it in GitHub Desktop.
Save pepepper/525045604c94b76878cd383235f7c5b5 to your computer and use it in GitHub Desktop.
//mastodon-cpp 0.105.1
#include <iostream>
#include <string>
#include <memory>
#include <vector>
#include <fstream>
#include <random>
#include <mastodon-cpp/mastodon-cpp.hpp>
// Include all headers in mastodon-cpp/easy/
#include <mastodon-cpp/easy/all.hpp>
int main(int argc, char *argv[]){
std::vector<std::string> charactor={"A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z","a","b","c","d","e","f","g","h","i","j","k","l","m","n","o","p","q","r","s","t","u","v","w","x","y","z","0","1","2","3","4","5","6","7","8","9","あ","い","う","え","お","か","き","く","け","こ","さ","し","す","せ","そ","た","ち","つ","て","と","な","に","ぬ","ね","の","は","ひ","ふ","へ","ほ","ま","み","む","め","も","や","ゆ","よ","ら","り","る","れ","ろ","わ","を","ん","ア","イ","ウ","エ","オ","カ","キ","ク","ケ","コ","サ","シ","ス","セ","ソ","タ","チ","ツ","テ","ト","ナ","ニ","ヌ","ネ","ノ","ハ","ヒ","フ","ヘ","ホ","マ","ミ","ム","メ","モ","ヤ","ユ","ヨ","ラ","リ","ル","レ","ロ","ワ","ヲ","ン"};
std::random_device seed_gen;
std::mt19937 engine(seed_gen());
std::uniform_int_distribution<> dist(0, charactor.size()-1);
std::string name;
for(int i=0;i<8;i++){
name+=charactor[dist(engine)];
}
std:ifstream file("token.txt");
std:string domain,token;
file>>domain;
file>>token;
std::cout << "changing name..."<<std::endl;
Mastodon::API masto(domain, token);
masto.patch(Mastodon::API::v1::accounts_update_credentials,{{"display_name",{name}}});
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment