Well, my bot does it something like this:
print "Connecting to Mastodon...\n";
my $client = Mastodon::Client->new(
instance => $config->{server},
name => 'TotallyLegitBot',
client_id => $config->{key},
client_secret => $config->{secret},
access_token => $config->{token},
coerce_entities => 1,
);
print "Posting message...\n";
$client->post_status('Dear Sir! I am prince Bob of Nigeria and i have
+an offer for you...');
Hope that helps.
EDIT: For authentication, i went to my Mastodon account to Preferences/Development, clicked on "New Application", filled in application name and clicked submit. Then click the link with that application again and you get key+secret+token that you give your application. There are probably other ways to authorize it, but that's the one i found works without problems and with the least fuzzing about.
-
Are you posting in the right place? Check out Where do I post X? to know for sure.
-
Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
<code> <a> <b> <big>
<blockquote> <br /> <dd>
<dl> <dt> <em> <font>
<h1> <h2> <h3> <h4>
<h5> <h6> <hr /> <i>
<li> <nbsp> <ol> <p>
<small> <strike> <strong>
<sub> <sup> <table>
<td> <th> <tr> <tt>
<u> <ul>
-
Snippets of code should be wrapped in
<code> tags not
<pre> tags. In fact, <pre>
tags should generally be avoided. If they must
be used, extreme care should be
taken to ensure that their contents do not
have long lines (<70 chars), in order to prevent
horizontal scrolling (and possible janitor
intervention).
-
Want more info? How to link
or How to display code and escape characters
are good places to start.
|