Beispiel #1
0
from config_bot import *
import random

# Reddit stuff
r = praw.Reddit(user_agent="ARTCbot 1.3.0 by herumph",
                client_id=ID,
                client_secret=SECRET,
                username=REDDIT_USERNAME,
                password=REDDIT_PASS)

sub = "artc"
#sub = "RumphyBot"
subreddit = r.subreddit(sub)

# Fetching arrays
already_done = artcbot.get_array("already_done")
# not ideal to get contributors every time but it's not a problem
contributors = [
    str(contributor) for contributor in r.subreddit(sub).contributor()
]

# Looking at comments
for comment in r.subreddit(sub).comments(limit=25):
    if (comment.id not in already_done and str(comment.author) != "artcbot"):
        # marking comment as read if it's a reply
        # this ensures that the PM part does not respond as well
        comment.mark_read()
        already_done.append(comment.id)
        # Making sure the already_done file doesn't get too big.
        del already_done[0]
        artcbot.write_out("already_done", already_done)
Beispiel #2
0
import praw
from config_bot import *

#Reddit stuff
r = praw.Reddit(user_agent="ARTCbot 1.3.0 by herumph",
                client_id=ID,
                client_secret=SECRET,
                username=REDDIT_USERNAME,
                password=REDDIT_PASS)

#sub = "artc"
sub = "RumphyBot"
subreddit = r.subreddit(sub)

#Fetching arrays
already_done = artcbot.get_array("already_done")
#not ideal to get contributors every time but it's not a problem
contributors = [
    str(contributor) for contributor in r.subreddit(sub).contributor()
]

#Looking at comments
for comment in r.subreddit(sub).comments(limit=25):
    reply = ""
    if (comment.id not in already_done and str(comment.author) != "artcbot"):
        #marking comment as read if it's a reply
        #this ensures that the PM part does not respond as well
        comment.mark_read()
        already_done.append(comment.id)
        #Making sure the already_done file doesn't get too big.
        del already_done[0]
Beispiel #3
0
import artcbot
import os
import re
import time
import codecs
import random
from slackclient import SlackClient
from datetime import datetime

slack_token = os.environ["SLACK_BOT_TOKEN"]
sc = SlackClient(slack_token)

#getting arrays
command_list = artcbot.get_array("command_list")
built_in = ["add","edit","delete","vdot","planner","pacing","splits",\
"convertpace","convertdistance","trainingpaces","acute","upcoming"]
#I'm lazy
built_in = ["!" + i for i in built_in]


def sendMessage(user, channel, message):
    sc.api_call("chat.postMessage",
                username="******",
                icon_emoji=":robot_face:",
                channel=channel,
                link_names=1,
                text='<@' + user + '>' + ' ' + message)


def getChannel(event):
    return event['channel']
Beispiel #4
0
sc = SlackClient(slack_token)

# welcome message
welcomeMessage = "Welcome to slack, you are automatically added to the channels #random and #general." + \
    " If you click 'channels' on the left side of your screen, you can also look through other channels you can join." + \
    "\n\nYou can also directly message users with the option below your channels." + \
    " In a chat, you can specifically get the attention of a user by writing @theirusername, similar to Twitter." + \
    "\n\nTo use emojis type `:emojiname:` or click the add emoji option in your message box." + \
    " You can also react to people's messages with emoji by clicking their message and " + \
    "the add reaction button, then selecting the emoji you feel is appropriate." + \
    "\n\nAlso, if you have a concern about your full name being displayed." + \
    " You can go to the dropdown in the top left of your page, and go to 'profile and account' and then click 'edit profile.'" + \
    " From there, you can change how your full name appears in the profile other users can see."

# getting arrays
command_list = artcbot.get_array("command_list")
built_in = artcbot.get_array("built_in")
built_in = ["!" + i for i in built_in]


def errorMessage(user):
    errors = [
        "Something went wrong :party_rip:", "Oh no you killed artcbot",
        "Your command is bad and you should feel bad",
        "artcbot is taking a vacation :palm_tree:",
        "Here lies artcbot. Viciously murdered by <@" + user + "> :rip:"
    ]
    return errors[random.randint(0, len(errors) - 1)]


def sendMessage(user, channel, message):