User:Lowercase sigmabot II/Source.py: Difference between revisions

Content deleted Content added
Updating source) (bot
Updating source) (bot
Line 1:
Source as of 1907:3752, 2228 September 2013 (UTC).
 
== Sandbot1.py ==
Line 59:
@property
def is_allowed(self):
return self.shutoff_page.content.lower() == "true" or True
 
def get_templates_on(self, page):
tl = tuple(self.api.iterator(500, prop="templates", tlnamespace=10, titles=page))
if not tl[0].get("templates", None):
return
for x in tl[0]["templates"]:
yield self.api.page(x["title"])
 
def check_if_heading_is_gone(self, box):
tl = tuple(self.api.iterator(500, prop="templates", tlnamespace=10, titles=page)box.title)
templates_in_box = self.get_templates_on(box)
res = returnnext(tl)
return not ("Template:Sandbox heading" in [x.title for x in templates_in_box])
#print(res)
return not ("Template:Sandbox heading" not in [x.['title'] for x in templates_in_box]res.get("templates", "")]
 
def run(self):
Line 80 ⟶ 75:
if box.revision_user.name == "Lowercase sigmabot II":
continue
if self.check_if_heading_is_gone(box.title):
box.prepend(self.REINSERT, summary="Reinserting sandbox header) (bot", bot=True)
print("\thad a header reinserted!")