The classic programming exercise.
For every integer in some range:
- Print "fizz" if the number is divisible by 3
- Print "buzz" if the number is divisible by 5
/*! | |
* /r/anime custom page width + background userstyle/RES snippet | |
* by /u/geo1088 | |
* public domain | |
* | |
* If you use this style, please don't send modmails when it breaks | |
* Instead, message /u/geo1088 directy: | |
* <https://www.reddit.com/compose?to=geo1088> | |
*/ |
import csv | |
import praw | |
import re | |
r = praw.Reddit(client_id="",client_secret="",username="",password="",user_agent="") | |
submission = r.submission(id="") | |
with open("file.csv", "r", encoding="utf-8") as file: | |
apps_reader = csv.reader(file) | |
for i, row in enumerate(apps_reader): |
const Eris = require('eris') | |
const request = require('superagent') | |
const config = { | |
token: 'HI PUT THINGS HERE', // the token used to run the bot | |
frequency: 60, // frequency of server icon switch in minutes | |
guildId: '149327211470520321', // the guild you want to change the icon of | |
images: [ // an array of image URLs | |
'https://b.thumbs.redditmedia.com/AQ_47wQPWDOEuP0LohFeFYpoa3fdLcqWrgIxDYvU_PI.png' | |
] | |
} |
const eris = require('eris') | |
const bot = new eris('token') | |
bot.on('guildMemberAdd', (member, guild) => { | |
bot.getDMChannel(member.id).then(channel => { | |
console.log(channel.id) | |
}).catch(e => { | |
console.log('Get channel fail\n' + e) | |
}) | |
}) |
bot.registerCommand("help", (msg, args) => { | |
var result = ""; | |
if(args.length > 0) { | |
var cur = bot.commands[bot.commandAliases[args[0]] || args[0]]; | |
if(!cur) { | |
return "Command not found"; | |
} | |
var label = cur.label; | |
for(var i = 1; i < args.length; ++i) { | |
cur = cur.subcommands[cur.subcommandAliases[args[i]] || args[i]]; |
// replaces https://github.com/abalabahaha/eris/blob/master/lib/command/CommandClient.js#L78-L123 | |
this.registerCommand("help", (msg, args) => { | |
var result = ""; | |
if(args.length > 0) { | |
var cur = this.commands[this.commandAliases[args[0]] || args[0]]; | |
if(!cur) { | |
return "Command not found"; | |
} | |
var label = cur.label; | |
for(var i = 1; i < args.length; ++i) { |
@charset "utf-8"; | |
/* CSS Document */ | |
@import url(http://fonts.googleapis.com/css?family=Oswald:700); | |
body { | |
background-attachment: fixed, scroll; | |
background-color: #FFF; | |
background-image: url("https://i.imgur.com/rrZbXQb.jpg"), url("http://i.imgur.com/CY8doiE.png"); |
;(function batchDeleteMyMessages (channel, limit, before = undefined, loops = 1) { | |
if (limit <= 0 || loops > 10) return console.log(limit, loops) // If there are no more messages or we've been here too long, leave | |
// Get 100 messages from the channel | |
channel.getMessages(100, before).then(messages => { | |
// Get a list of all the messages from the bot | |
let toDelete = messages.filter(m => m.author.id === (channel.guild.shard.client || channel._client).user.id) | |
// Also save the ID of the first message so we can give to the next iteration | |
const firstMessageId = messages[0].id |
import praw, time, requests, json | |
r = praw.Reddit( | |
client_id="", | |
client_secret="", | |
username="", | |
password="", | |
user_agent="script:some_random_identifier:v1.0 (by /u/you)") | |
sub = r.subreddit("your_sub") # no /r/ here |