<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>zethrae.us/blog &#187; bot</title>
	<atom:link href="http://zethrae.us/blog/tag/bot/feed/" rel="self" type="application/rss+xml" />
	<link>http://zethrae.us/blog</link>
	<description>using technology to facilitate awesome.</description>
	<lastBuildDate>Thu, 19 Jan 2012 05:45:35 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<item>
		<title>Introducing Anna</title>
		<link>http://zethrae.us/blog/2008/introducing-anna/</link>
		<comments>http://zethrae.us/blog/2008/introducing-anna/#comments</comments>
		<pubDate>Tue, 22 Jul 2008 22:06:34 +0000</pubDate>
		<dc:creator>zethraeus</dc:creator>
				<category><![CDATA[programming]]></category>
		<category><![CDATA[anna]]></category>
		<category><![CDATA[bot]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[twitter]]></category>

		<guid isPermaLink="false">http://zethrae.us/blog/?p=17</guid>
		<description><![CDATA[This morning I finished the twitter bot I mentioned in my twitter api post. It has been named &#8216;Anna&#8217; in homage to the Basshunter song. It&#8217;s twitter alias is @spsp (st pauls school private). It is written in PHP and &#8230; <a href="http://zethrae.us/blog/2008/introducing-anna/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>This morning I finished the twitter bot I mentioned in my <a href="http://zethrae.us/blog/2008/07/twitterapi/">twitter api post</a>. It has been named &#8216;Anna&#8217; in homage to the Basshunter song. It&#8217;s twitter alias is @spsp (st pauls school private). It is written in PHP and is more than just a bit of a hack job as opposed to any quality programming. I have never before done any work with XML so my method of transferring it to a usable array probably deserves a fair bit of criticizm. Anyway, I&#8217;ll upload a zip of the script for anyone interested to use, improve on or just comment on.</p>

<p>Purpose:</p>

<ul>
    <li>Allows mass invisible messages by reposting a direct message to it to all those following it. (This is invisible as long as the bot itself is &#8216;protected&#8217;, which it is.)</li>
    <li>Effectively creates a &#8216;group&#8217; within Twitter.</li>
</ul>

<p>Usage:</p>

<ul>
    <li><strong>Follow @spsp</strong></li>
    <li><strong>Direct message</strong> your message <strong>to spsp</strong> with the regular syntax. i.e. &#8220;<strong>d spsp</strong> @zethraeus I am testing your excuse-for-a bot&#8221;.</li>
    <li>The message will be reposed as a regular tweet by the bot, without the initial &#8216;d sps&#8217;, but with <strong>your twitter alias signed at the end</strong>. i.e. the above message would be posted as &#8220;@zethraeus I am testing your excuse-for-a bot ~ @alias&#8221;.</li>
</ul>

<p>Limitations:</p>

<ul>
    <li>The bot can not handle accented characters. It will cut off your message from the point the accented character is introduced. This is the case because of a quirk in php&#8217;s libxml2 functionality &#8211; and because I am not a particularly good or dedicated PHP programmer. This quirk is not a bug (apparently).</li>
    <li>Should your message be above 140 characters once the &#8216;d spsp&#8217; is removed and your alias is appended, it will be shortened in Twitter, and any clients like Twitterrific. It will require a click through to see the unabridged version. Whilst this isn&#8217;t a huge issue, it&#8217;s probably worth keeping the tweets a little bit shorter.</li>
    <li>In theory, if the modified tweet exceeds 160 characters, it may not send. In reality, Twitter wont let you have a name long enough to make this occur in normal usage.</li>
    <li>The tweets are passed on every five minutes. (This is a cron job)</li>
    <li>The maximum processable tweets at each 5 minute slot are 20. I don&#8217;t know enough about the workings of http://twitter.com/direct_messages.xml to say whether any tweets exceeding the 20 will be lost into Twitter or just processed 5 minutes later.</li>
</ul>

<p>The script is comprised of three files.</p>

<ol>
    <li>process.php grabs all of @spsp&#8217;s direct messages since the last recorded id, records the new last id and reposts the direct messages as tweets.</li>
    <li>twitter.php, found at <a href="http://www.aimclear.com/code/twitter/twitter.txt">http://www.aimclear.com/code/twitter/twitter.txt</a> is a modified version of the twitter api. It is responsible for actually posting the status.</li>
    <li>lastid.txt is simply used to record the id of last read direct message so that tweets aren&#8217;t posted twice.</li>
</ol>

<p>All of these files are available for <a href="http://zethrae.us/dump/annatwittergroups.zip">download</a> and the bits that are mine, are in the public domain for you to do what you want with.</p>

<p><strong>I just hope that people <em>use</em> it!</strong></p>
]]></content:encoded>
			<wfw:commentRss>http://zethrae.us/blog/2008/introducing-anna/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
	</channel>
</rss>

