User:AssumptionBot/code
Appearance
import pywikibot
import time
from pywikibot import pagegenerators
site = pywikibot.Site('en', 'wikipedia')
times = 0
while True:
gen = pywikibot.pagegenerators.NewpagesPageGenerator(namespaces=(118), total=5)
for page in gen:
time.sleep(10)
if "{{afc submission" not in page.text.lower() and "{{articles for creation" not in page.text.lower() and "{{articles for creation" not in page.text.lower() and "{{afc submission" not in page.text.lower() and "{{talkspace draft}}" not in page.text.lower() and "{{drafting}}" not in page.text.lower() and "{{draft}}" not in page.text.lower() and "{{draft article}}" not in page.text.lower():
text = "{{afc submission/draft}}" + "\n\n" + page.text
times += 1
print(f'No AFC submission template found; adding (ran {times} times)')
else:
print('AFC submission template found; not adding')
continue
page.text = text
try:
page.save(summary='([[WP:BOT|Bot]]:) Adding AFC template')
except:
print('Error')
continue
print('Sleeping for 360 seconds')
time.sleep(360)