匿名
未登录
创建账号
登录
Postal Wiki
搜索
查看“︁用户:Hehuabot/AutoArchive”︁的源代码
来自Postal Wiki
命名空间
用户页
讨论
更多
更多
页面操作
阅读
查看源代码
历史
用户贡献
←
用户:Hehuabot/AutoArchive
因为以下原因,您没有权限编辑该页面:
您请求的操作仅限属于该用户组的用户执行:
用户
您可以查看和复制此页面的源代码。
这个机器人运行[[mediawikiwiki:Manual:Pywikibot|Pywikibot]]代码,可以根据你的设置自动将你的用户讨论页存档,机器人的存档操作'''不会'''触发新消息提示。机器人每天自动运行一次此程序,所以设置好之后请不要着急。 以下用法仅供参考,实际用法以官方说明[[mediawikiwiki:Manual:Pywikibot/archivebot.py/setup]]为准。 === 存档设置 === 请把以下的设置模板放在页面的'''最顶部''',不可以放在子页面中。每行只填写一个参数,即每个分隔符(|)应另起一行,最后的「}}」应独占一行: {{warning|请不要直接复制下方的几行代码,这只是解释用途,并不能正常使用。}} <pre style="overflow: auto"> {{User:Hehua/ArchiveConfig | algo = old(...) | archive = 存档所在页面 [其他参数 - ***请先阅读下文***] }} </pre> <!-- Well, maybe '''not exactly''' that (read about required options below), but that's how it's done. By the way, [[User:Hehua/ArchiveConfig|the template]] has '''no content''' and is sysop-'''protected''', so don't worry about visual appearance. :) The bot expects to see only one parameter per line. The closing }} must be on its own line. There must be no leading spaces before the pipes. If you drop out the newlines used in the above example, e.g. by wrapping the template invocation onto a single line, the bot may not do what you expect. Also, the template must be located: #before the first ==second level header== on the page #on the actual page and not transcluded from a subpage, such as a page header, etc.--> === 例子 === :<span style="font-size:180%; color:Red;">'''以下所有例子中,请把“User talk:Example”改成你的用户讨论页!'''</span> :<span style="color:darkgreen;">'''如果仍然不能正常工作,请阅读下方''minthreadsleft''和''minthreadstoarchive''参数的介绍。'''</span> ==== 例子一:固定存档页 ==== {{warning|尽管这是最简单的,但可能不是最好的选择,第二个例子更加常用}} <pre style="overflow: auto"> {{User:Hehua/ArchiveConfig | algo = old(7d) | archive = User talk:Example/存档 }} </pre> 这样的话机器人会把[[User talk:Example]]中7天以前的讨论存档至[[User talk:Example/存档]]。注意这个存档会一直增长,很有可能变得难以打开。 ==== 例子二:自动增加存档页 ==== <pre style="overflow: auto"> {{User:Hehua/ArchiveConfig | algo = old(31d) | archive = User talk:Example/存档%(counter)d | counter = 1 | maxarchivesize = 70K | archiveheader = {{talkarchive}} | minthreadstoarchive = 1 | minthreadsleft = 4 }} </pre> 这告诉机器人存档超过31天(留下最近的四个)的讨论,从[[User talk:Example]]存档至[[User talk:Example/存档1]],直到它的长度超过70K。这时,机器人会自动新建第二个存档页,并更新设置中的counter参数。请注意要设置一个'''maxarchivesize'''参数,否则会像第一种情况一样。此外,每个存档页顶部会加上{{tl|talkarchive}}模板,你也可以选择其他模板。 ==== 例子三:按日期存档 ==== {{warning|'''不要'''将下面的year等变量替换成实际的数值。}} <pre style="overflow: auto"> {{User:Hehua/ArchiveConfig | algo = old(5d) | archive = User talk:Example/存档/%(year)d年/%(month)s月 }} </pre> 这样设置以后,超过5天的讨论会按月存档。例如2013年2月的讨论会存档至[[User talk:Example/存档/2013年/2月]]。 === 参数解释 === <pre> {{User:Hehua/ArchiveConfig | archive = | algo = | counter = | maxarchivesize = | minthreadsleft = | minthreadstoarchive = | archiveheader = | key = }} </pre> {| class = "wikitable" ! 参数 || 介绍 |- | <tt>archive</tt> || 存档页的名称。这个参数支持[[#变量|使用变量]],可以由机器人根据变量的值(比如月份)来建立存档页。请注意不要加入模板或魔术字之类的东西。除非机器人的操作者给你提供了一个<tt>key</tt>(见下方),存档页必须是被存档页面的子页面。 |- | <tt>algo</tt> || 决定机器人是否存档一个讨论的算法。目前只有一种形式:'''<tt>old(...)</tt>''',其中'''...'''表示一个讨论若多久没有新留言则会被存档(例如:''24h''、''72h''、''5d''、''21d''等等) |- | <tt>counter</tt> || 存档页数的计数器。如果<tt>archive</tt>参数没有使用变量<tt>%(counter)d</tt>,那么这个参数会被忽略。如果你现在已有存档页,请把它设为当前的存档页数目。Wcam-bot在需要时会自动更新这个数值。 |- | <tt>maxarchivesize</tt> || 存档页的最大长度。如果没有使用<tt>%(counter)d</tt>则会被忽略。这个参数有两种形式:#K和#T。例如<tt>maxarchivesize=256K</tt>表示最大长度为256KB,<tt>maxarchivesize=100T</tt>表示最大长度为100个讨论(无论字节数为多少)。 |- | <tt>minthreadsleft</tt> || 页面上最少留下的讨论数目(防止页面被清空),默认值为5。 |- | <tt>minthreadstoarchive</tt> || 每次存档的讨论数目的最小值,用于降低编辑频率。Wcam-bot在可存档讨论数目低于此数值时不会进行存档,默认值为2。 |- | <tt>archiveheader</tt> || 加在存档页顶部的内容。这个参数支持[[#变量|使用变量]]。注意这个参数'''不能'''使用多行文字。你可以在存档页顶部加上你的存档索引,默认值为{{tl|talk archive}}。 |- | <tt>key</tt> || 将页面内容存档至子页面以外的地方需要本参数,以尽量避免恶作剧、破坏。 |} === 变量 === {| class = "wikitable" ! 变量 || 意义 |- | <tt>%(counter)d</tt> || <tt>counter</tt>的当前数值 |- | <tt>%(year)d</tt> || 待存档讨论的年份 |- | <tt>%(month)d</tt> || 待存档讨论的月份 |- | <tt>%(quarter)d</tt> || 待存档讨论的季度(1-4) |- | <tt>%(monthname)s</tt> || 英文月份名称,中文版不需要 |- | <tt>%(monthnameshort)s</tt> || 英文月份简称,中文版不需要 |} <!-- Those [[python (programming language)|python]]-savvy people will immediately recognize these variables are filled at runtime with the <tt>%</tt> operator and should know how to adjust the format. A few points of interest to others: *make sure you don't mess up the last letter after the brackets (it's "d" for [[integer]]s and "s" for [[string (computer science)|strings]]) *integer variables may be left-padded with zeros: *:<tt>%(counter)03d</tt> evaluates to <tt>013</tt> if the <tt>counter</tt>'s value equals 13, *:<tt>%(month)02d</tt> becomes <tt>05</tt> for May etc. === After you have set up archiving === The bot runs once a day at a preset hour, or twice a day for [[WP:Administrators' Noticeboard|WP:AN]] and [[Wikipedia:Administrators' noticeboard/Incidents|WP:AN/I]]. Simply wait for the next cycle and you should see the bot's entries in the history list of your article '''providing''' there was anything to archive, and the history list entry should provide a link to the archive page you specified.<br /> Various [[WP:TM|templates]] will produce an automatic list of archive subpages. Typically, such a template will be added to the top-level talk page to make archives easier to find. Simply add the template name in <code><nowiki>{{curly-braces}}</nowiki></code> where you want it to appear. Popular templates used for this purpose include: * <code>{{tl|archives}}</code> * <code>{{tl|archive box}}</code> * <code>{{tl|talk header}}</code> (this template has other functions, but can include a list of archives and a search box) === Delaying or preventing archiving of particular threads === Archiving can be delayed for a particular thread by substituting the template {{tl|DNAU}} into the thread. Use <code><nowiki>{{subst:DNAU}}</nowiki></code> to retain a thread indefinitely, or <code><nowiki>{{subst:DNAU|<integer>}}</nowiki></code> to retain a thread for <integer> days. see the template documentation for details about its use and function. --> <includeonly> <!-- 本行下加入模板的分類 --> [[Category:机器人控制模板]] <!-- 本行下加入模板的跨語言鏈接 --> </includeonly>
该页面使用的模板:
模板:Tl
(
查看源代码
)
模板:Warning
(
查看源代码
)
返回
用户:Hehuabot/AutoArchive
。
导航
导航
首页
讨论版
最近更改
随机页面
深色模式
帮助
规章制度
编辑规范
格式指导
管理员公示板
人员任免方针
沙盒
链接
QQ群
Discord社区服务器
wiki工具
wiki工具
特殊页面
页面工具
页面工具
用户页面工具
日志
查看用户组
更多
链入页面
相关更改
页面信息
页面日志