GithubHelp home page GithubHelp logo

operator873 / cabalbot Goto Github PK

View Code? Open in Web Editor NEW
0.0 2.0 1.0 221 KB

An IRC bot for Wikimedia users which handles a wide range of functions and interactions

License: MIT License

Python 100.00%
irc wikimedia wikimedia-tools wikipedia sopel-modules sopel-plugin sopel

cabalbot's Introduction

Github issues Github forks Github stars Github contributors

Wikimedia CabalBot

A Sopel IRC bot plugin which provides a wide arrange of functions for Wikipedia/Wikimedia users. Current functions are:

  • Report edits on a single page on any project with or without ping
  • Globally watch a page in a specified namespace across all projects
  • Report RC feed directly to any channel for any project
  • Report Abuse Filter feed directly to any channel for any project
  • Various IRC commands to assist with integration

General Commands

The following commands are general commands the bot will respond to.

!hush / !mute
Temporarily stop all commands to this channel. The bot will snitch who hushed it. Useful during mass actions.

!speak / !unmute
Resume reporting changes to the channel.

!namespace {(int) OR (string)}
This is a limited dictionary query of some namespace numbers and names for reference. For example, to find the namespace number for "User" you would execute !namespace User which would return 2. Alternatively, you can also query to see what name space an integer is: !namespace 2 which would return "Article talk"

Watch Commands

These commands instruct the bot to report changes to the specified page on the specified project. The ping setting will result in the bot mentioning the nick used to set the page to be watched.

!watch add simplewiki Wikipedia:Vandalism in progress
This command would result in changes to Wikipedia:Vandalism in progress on simple.wikipedia.org being reported in the current channel.

watch del simplewiki Wikipedia:Vandalism in progress
This command would result in changes to Wikipedia:Vandalism in progress on simple.wikipedia.org no longer being reported in the current channel.

!watch ping on enwiki Some Article
Add a ping to a watch report for the indicated page. In other words, the bot will specifically mention your IRC nick.

!watch ping off enwiki Some Article
This will make the bot stop mentioning your nick during reports.

Global Watch Commands

!globalwatch {action} {namespaceID} {title}
General for of commands

!globalwatch add 0 Main Page
Adds the page called "Main Page" in 0 namespace (Article) to global watch.

!globalwatch del 3 Operator873
Stops following global changes to Operator873's talk page (3 is User talk)

!globalwatch ping on 0 Main Page
Adds a ping (nick mention) to the global watch of "Main Page"

!globalwatch ping off 0 Main Page
Removes the ping from the global watch of "Main Page"

Wikimedia Commands

These commands generally preformat a hyperlink to other Wikimedia tools by community memebers.

!bullseye <ip>
Get a link for GeneralNotability's Bullseye tool for information on an IP address.

!ca <targetAccount>
Generate a link to CentralAuth for the supplied Account.

!contribs <project> <target>
Get a link to the contributions list for the target on the project provided. Target can be an account or an IP address. The project uses meta, outreach, species or enwikibooks format.

!geo <ip>
Links to a geoip tool for the given IP address.

!google <search string>
Returns a hyperlink for a Google search for the supplied string.

!guc <target>
Generates a link to the guc tool for the supplied target, last hour only. Use !gucall for a complete listing.

!ipqs <ip>
Link to IP Quality Score for the supplied IP address

!proxy <ip>
Generates a link to SQL's ipcheck tool for the provided IP address.

!rbf <ip>
Get a link to stwalkerster's Range Block Finder tool for the provided IP address.

!stalktoy <target>
Creates a hyperlink to the stalktoy with the target as the object of the stalk.

!stewardry <target>
Get a link for the stewardry tool for the supplied target.

!urban <string>
Returns a link to the Urban Dictionary for the supplied term.

!whois <ip>
Generates a link to the WHOIS tool with the supplied IP address.

!xact <target>
Get a link to the cross wiki activity tool for the supplied target.

!xtools <project> <target>
Get a link for Xtools on the project provided for the target provided.

Bot Admin Commands

These commands are only available to Bot Admins and are genereally considered sensitive.

!feedadmin {add/del/list} <ircAccount>
Modify or read the current feedadmins for the channel the command was used in. The list option does not need a target, instead returning a list of current feedadmins in that channel.

!watchstatus
Get the current status of the thread containing the EventListener

!watchstart
If the thread is dead or has not been started, start EventListener into a new thread.

!watchstop
Set the thread flag and gracefully stop the EventSource thread. Then delete it from bot memory.

!addmember
Adds an IRC nick/Wikimedia account association for Global Sysops/Stewards

!removemember
Removes an IRC nick/Wikimedia account association for Global Sysops/Stewards

!setlang <project>
Informs the bot which project should be used in this channel for autolinking.

!unsetlang
Removes the lang setting from the channel.

!ignorenick <IRCAccount>
Tells the bot to not autolink [[bracket wikilinks]] from this IRC account. Useful for avoiding bot-bot interaction.

!unnignorenick <IRCAccount>
Removes the IRC Account name from the ignored list and will resume generating autolinks.

!restart or !restartbot <reason>
Orders the bot to fully restart with the provided reason (not required)

!quit or !botdie <reason>
Orders the bot to terminate its process with the provided reason (not required)

Feed Admin Commands

Users that are trusted and set as a Feed Admin in a particular channel have access to the following commands.

!logreporter {start/stop} <project>
Starts log reporter for the specified project with default action BLOCK enabled.

!logreporter {add/del} <project> <action>
Adds the action provided to the list of log events that should be reported. Any log_type sent by Wikimedia EventStream can be added. Some examples are:
['abusefilter', 'upload', 'move', 'thanks', 'delete', 'review', 'patrol', 'newusers', 'block', 'growthexperiments', 'pagetriage-curation', 'pagetriage-copyvio', 'protect', 'stable', 'merge', 'tag', 'pagetranslation', 'import', 'notifytranslators', 'massmessage', 'globalauth', 'gblblock']

!abusefeed or !affeed {start/stop} <project>
The bot will report Abuse/Edit Filter activations on the indicated project

!rcfeed {start/stop} <project>
The bot will report all activity for the provided project in the current channel. Very noisy. There is no AI or selective reporting with this command.

!confirmedfeed {start/stop} <project>
The bot will report all edits and action performed by editors that are not confirmed.

!oresfeed or !vandalfeed or !vandalismfeed {start/stop} <project>
Report edits that are likely vandalism via the ORES stream with a probability in the report.

GlobalSysBot Commands

!onirc <project>
Report CSD category members for the given project. Good for deleting pages on GS wikis.

!addmember <target> <WikiAccountName>
Adds a new Global Sysop IRC nick to the database and associates it with their Wikimedia account.

!delmember <WikiAccountName>
Deletes all IRC nicks from the database for the Wikimedia account.

!addwiki <projectAbbreviation> <APIurl> <CSDCategory>
Adds a new project to the database with the provided api url and CSD category

!delwiki <projectAbbreviation> Deletes a project from the database allowing for correction or remove from GS monitoring.

cabalbot's People

Contributors

dannys712 avatar operator873 avatar tks4fish avatar

Watchers

 avatar  avatar

Forkers

tks4fish

cabalbot's Issues

"people" table expansion script

Write a Python on shell script to process indicated project tables an add data to two tables called "people".

Example, the script should accept a CLI input like "metawiki enwiki ptwiki" and process those tables. The process action should be selecting nicks in the table, collapsing duplicates, and adding the selected nicks and the project to a row in the "people" table.

ignorenick doesn't add to database

MrFishBot and CVNBots added via IRC command, but failed to make it to the ignore_nicks table. Added manually but need to investigate for broken function/sql statement.

Autolink intelligence

Autolink (currently living in wikicmds) which takes [[links]] in chat and delivers a formatted hyperlink to chat needs to be able to know what project to link to based on trigger.sender. A new database table will be added called channel_lang which will have columns channel, project, and url. The table will have the url column in order to allow shortened urls like enwp.org. Any function checking the table should be able to handle url being null.

In addition, commands for bot admins to add, rewrite, and remove information from this table will need to be written. Likely a new sub-module will be needed. Perhaps called autolink or something similar.

Update README

There are lots of changes happening. The README needs to be caught up.

Sopel module is deprecated

Sopel module is deprecated. Replace @module with @plugin and from sopel import module with from sopel import plugin.

Write af_feed function

Write a function that accepts two inputs, "bot" which contains the bot commands and "change" which accepts the EventStream data. The function should select the channel for the abuse filter feed from the below sqlite database table and send the report to the channel via the bot class. Bonus points for pretty format and colors.

At present, I'm not sure of the format EventStreams sends AbuseLog hits. So I don't know how the report would be handled.

The function should rely on a sqlite database table called "af_feed" which has two columns: "project" and "channel"

{{Template}} autolink doesn't work

Autolink was written for [[bracket links]] and I forgot to do {{curly braces}} for template links. Should be an easy fix via another @plugin.find() regex match.

Dropped RC reports

Beginning recently, and possibly related to workload, bots have been dropping RC reports. Investigate converting the engine to async

Write various basic bot responses

With CabalBot being retired, there are several basic functions that will need to be reproduced. This might be better handled as a standalone plugin.

Handle link requests like !ca !contribs !guc etc

GStools is broken

!addwiki and !onirc are broken.

!addwiki seems to only add trigger.group(5) instead of the whole string

!onirc needs a negative response if there are no pages in the CSD cat.

contribs and xtools

The !contribs and !xtools commands will need to be rebuilt. The trigger.group() has no len attribute and can't be counted.

rc_feed admin

Add process for adding to, removing from, and querying a new table called rc_feed_admin which contains columns "nick" "project" "channel". These are IRC accounts of individuals authorized to use commands like !hush !speak within an rc_feed channel

Build relational table functions

New tables 'people' and 'channels' are created for relational support. Add populating sql commands to add to and delete from these tables on !watch add and !watch del respectively. !globalwatch should also write to these tables, but in people table, project should be global and no difference to the channels table.

Table: people
Columns

  • nick
  • project

Table channels
Columns

  • channel
  • nick

Make the bot modular

Break the various functions out of the massive current script to make local callable plugins to use as needed. The Watcher file has grown into a very cumbersome and long script. It needs to be broken down into more digestible components that can be included or excluded as the situation requires by lay-users.

Antivandalism Mode

Using the existing ORES feed, set a threshold for probability via IRC command. If threshold is crossed, revert the edit, add message to editor's talk page. Likely won't be as fancy as ChenzwBot but good as an emergency stand in.

af_feed admin

Add process for adding to, removing from, and querying a new table called af_feed_admin which contains columns "nick" "project" "channel". These are IRC accounts of individuals authorized to use commands like !hush !speak within an af_feed channel

Write rc_feed function

Bot873 will be assuming duties of CabalBot. This includes acting as a recent changes bot for newiki and should have the capability of expanding into other small projects.

The function should expect two inputs "bot" which contains the bot commands and "change" which is the json formatted event from EventStreams. The function should rely on a sqlite3 database table called "rc_feed" with columns "project" and "channel" for where to report the change.

Very basic structure follows:

`db = sqlite3.connect(DB)
c = db.cursor()
channel = c.execute('''SELECT channel FROM rc_feed WHERE project=?;''', (change['wiki'],)).fetchall()
db,close()

bot.say(theChange, channel)
`

Reduce number of sqlite calls

Probably because it's processing so frequently, but rcfeed slowly builds a significant lag. This is likely due to lack of optimization within the rcfeed reporting process. ORESfeed currently does not experience the same trouble.

"channels" table expansion script

Write a Python on shell script to process indicated project tables an add data to two tables called "channels".

Example, the script should accept a CLI input like "metawiki enwiki ptwiki" and process those tables. The process action should be selecting chan and nicks in the table, collapsing duplicates, and adding the selected chan and nicks to a row in the "channels" table.

Add single page stalk for feedadmin per channel

Add a function that adds a single page watch function for feedadmins to stalk a single page in a channel. Possible route to this would be to use the existing function, but perform a feedadmin check, then use the channel as the account name.

Watchers stop

EventStream and ORES stream both abruptly stop without warning.

Convert to f strings

Review entire plugin for places to replace old methods for joining strings with f strings.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.