def __init__(self, **kwargs): self.nano = kwargs.get("nano") self.client = kwargs.get("client") self.stats = kwargs.get("stats") self.gif = giphypop.Giphy()
def __init__(self, bot): self.bot = bot self.giphypop = giphypop.Giphy()
def sendMessages(msg): if fuzz.token_set_ratio("hello hi", msg['direct_message']['text']) > 50: twitter_api.direct_messages.new( user=msg['direct_message']['sender']['screen_name'], text="Hey!") if fuzz.token_set_ratio("hurt myself", msg['direct_message']['text']) > 50: twitter_api.direct_messages.new( user=msg['direct_message']['sender']['screen_name'], text= "I'm sorry you're in so much pain. I won't leave you or abandon you." ) elif fuzz.token_set_ratio("pain hurt inside", msg['direct_message']['text']) > 50: twitter_api.direct_messages.new( user=msg['direct_message']['sender']['screen_name'], text="You’re not alone in this. We're here for you.") elif fuzz.token_set_ratio("I love cats!", msg['direct_message']['text']) > 60: twitter_api.direct_messages.new( user=msg['direct_message']['sender']['screen_name'], text=list(giphypop.Giphy().search("cats"))[0]) elif fuzz.token_set_ratio("distance from friends family", msg['direct_message']['text']) > 50: twitter_api.direct_messages.new( user=msg['direct_message']['sender']['screen_name'], text= "Keep yourself united with your loved ones. They will always be there to help you." ) elif fuzz.token_set_ratio("avoid everything isolation", msg['direct_message']['text']) > 50: twitter_api.direct_messages.new( user=msg['direct_message']['sender']['screen_name'], text= "Come out into the sunshine! The world is much better with you in it :)" ) elif fuzz.token_set_ratio("agony makes me insane", msg['direct_message']['text']) > 50: twitter_api.direct_messages.new( user=msg['direct_message']['sender']['screen_name'], text="Do you want a hug? I will always be here for you") elif fuzz.token_set_ratio("exhuasting battle", msg['direct_message']['text']) > 50: twitter_api.direct_messages.new( user=msg['direct_message']['sender']['screen_name'], text="You'll make it through!") elif fuzz.token_set_ratio("eat less starve", msg['direct_message']['text']) > 50: twitter_api.direct_messages.new( user=msg['direct_message']['sender']['screen_name'], text= "Keep yourself well. You derseve it. You are the best person I know." ) elif fuzz.token_set_ratio("procrastinate", msg['direct_message']['text']) > 50: twitter_api.direct_messages.new( user=msg['direct_message']['sender']['screen_name'], text= "I know how much you want to curl away from the world, but I'll be there with you every step of the way." ) elif fuzz.token_set_ratio("empty and hopeless", msg['direct_message']['text']) > 50: twitter_api.direct_messages.new( user=msg['direct_message']['sender']['screen_name'], text= "I know life may seem hopeless now, but you will get through it.") elif fuzz.token_set_ratio("frustration and anger", msg['direct_message']['text']) > 50: twitter_api.direct_messages.new( user=msg['direct_message']['sender']['screen_name'], text="You're not going crazy. Stay strong, I believe in you.") elif fuzz.token_set_ratio("anxious and restless", msg['direct_message']['text']) > 50: twitter_api.direct_messages.new( user=msg['direct_message']['sender']['screen_name'], text= "We are not on this earth to see through one another, but to see one another through." ) elif fuzz.token_set_ratio("worthless and guilt", msg['direct_message']['text']) > 50: twitter_api.direct_messages.new( user=msg['direct_message']['sender']['screen_name'], text="You deserve the world. You mean everything to me. I <3 you") elif fuzz.token_set_ratio("back pain and headaches", msg['direct_message']['text']) > 50: twitter_api.direct_messages.new( user=msg['direct_message']['sender']['screen_name'], text= "Stay strong. These pains will pass, and I will help you through them." ) elif fuzz.token_set_ratio("can't get out of bed", msg['direct_message']['text']) > 50: twitter_api.direct_messages.new( user=msg['direct_message']['sender']['screen_name'], text= "You can survive this. When all this is over, I’ll still be here and so will you." ) elif fuzz.token_set_ratio("fatigue and tired", msg['direct_message']['text']) > 50: twitter_api.direct_messages.new( user=msg['direct_message']['sender']['screen_name'], text= "Even if it doesn't seem that way now, this feeling will not last forever." ) elif fuzz.token_set_ratio("can't think", msg['direct_message']['text']) > 50: twitter_api.direct_messages.new( user=msg['direct_message']['sender']['screen_name'], text= "I might not always be able to to understand, but I offer my compassion" ) elif fuzz.token_set_ratio("can't sleep", msg['direct_message']['text']) > 50: twitter_api.direct_messages.new( user=msg['direct_message']['sender']['screen_name'], text= "Just breathe, relax. Think of something peaceful and positive. You'll make it through this." ) elif fuzz.token_set_ratio("kill myself", msg['direct_message']['text']) > 50: twitter_api.direct_messages.new( user=msg['direct_message']['sender']['screen_name'], text="DONT KILL YOURSELF THERE'S TOO MUCH TO LIVE FOR!") elif fuzz.token_set_ratio("Nothing good in life", msg['direct_message']['text']) > 50: twitter_api.direct_messages.new( user=msg['direct_message']['sender']['screen_name'], text= "Take pride in your small victories, because they lead to bigger ones." ) elif fuzz.token_set_ratio("depressed", msg['direct_message']['text']) > 50: twitter_api.direct_messages.new( user=msg['direct_message']['sender']['screen_name'], text= "You're not wrong for feeling the way you do and no one blames you for it." ) elif fuzz.token_set_ratio("sad", msg['direct_message']['text']) > 50: twitter_api.direct_messages.new( user=msg['direct_message']['sender']['screen_name'], text="I won't always know how you feel, but I care about you")
def giphy_grabber(search, output_data, max_returns): """ Function for creating input json for creating QR codes from a giphy search Args: search: keyword output_data: file for saving output max_returns: number of giphy links to save Returns: <output_data> containing a json with info to build a QR code """ # call giphy g = giphypop.Giphy() # search based on keyword results = [(x.id, x.url) for x in g.search(search.replace('_', ' '))] results = results[:max_returns] # color dict cmap = { "aliceblue": "#f0f8ff", "antiquewhite": "#faebd7", "aqua": "#00ffff", "aquamarine": "#7fffd4", "azure": "#f0ffff", "beige": "#f5f5dc", "bisque": "#ffe4c4", "black": "#000000", "blanchedalmond": "#ffebcd", "blue": "#0000ff", "blueviolet": "#8a2be2", "brown": "#a52a2a", "burlywood": "#deb887", "cadetblue": "#5f9ea0", "chartreuse": "#7fff00", "chocolate": "#d2691e", "coral": "#ff7f50", "cornflowerblue": "#6495ed", "cornsilk": "#fff8dc", "crimson": "#dc143c", "cyan": "#00ffff", "darkblue": "#00008b", "darkcyan": "#008b8b", "darkgoldenrod": "#b8860b", "darkgray": "#a9a9a9", "darkgrey": "#a9a9a9", "darkgreen": "#006400", "darkkhaki": "#bdb76b", "darkmagenta": "#8b008b", "darkolivegreen": "#556b2f", "darkorange": "#ff8c00", "darkorchid": "#9932cc", "darkred": "#8b0000", "darksalmon": "#e9967a", "darkseagreen": "#8fbc8f", "darkslateblue": "#483d8b", "darkslategray": "#2f4f4f", "darkslategrey": "#2f4f4f", "darkturquoise": "#00ced1", "darkviolet": "#9400d3", "deeppink": "#ff1493", "deepskyblue": "#00bfff", "dimgray": "#696969", "dimgrey": "#696969", "dodgerblue": "#1e90ff", "firebrick": "#b22222", "floralwhite": "#fffaf0", "forestgreen": "#228b22", "fuchsia": "#ff00ff", "gainsboro": "#dcdcdc", "ghostwhite": "#f8f8ff", "gold": "#ffd700", "goldenrod": "#daa520", "gray": "#808080", "grey": "#808080", "green": "#008000", "greenyellow": "#adff2f", "honeydew": "#f0fff0", "hotpink": "#ff69b4", "indianred": "#cd5c5c", "indigo": "#4b0082", "ivory": "#fffff0", "khaki": "#f0e68c", "lavender": "#e6e6fa", "lavenderblush": "#fff0f5", "lawngreen": "#7cfc00", "lemonchiffon": "#fffacd", "lightblue": "#add8e6", "lightcoral": "#f08080", "lightcyan": "#e0ffff", "lightgoldenrodyellow": "#fafad2", "lightgreen": "#90ee90", "lightgray": "#d3d3d3", "lightgrey": "#d3d3d3", "lightpink": "#ffb6c1", "lightsalmon": "#ffa07a", "lightseagreen": "#20b2aa", "lightskyblue": "#87cefa", "lightslategray": "#778899", "lightslategrey": "#778899", "lightsteelblue": "#b0c4de", "lightyellow": "#ffffe0", "lime": "#00ff00", "limegreen": "#32cd32", "linen": "#faf0e6", "magenta": "#ff00ff", "maroon": "#800000", "mediumaquamarine": "#66cdaa", "mediumblue": "#0000cd", "mediumorchid": "#ba55d3", "mediumpurple": "#9370db", "mediumseagreen": "#3cb371", "mediumslateblue": "#7b68ee", "mediumspringgreen": "#00fa9a", "mediumturquoise": "#48d1cc", "mediumvioletred": "#c71585", "midnightblue": "#191970", "mintcream": "#f5fffa", "mistyrose": "#ffe4e1", "moccasin": "#ffe4b5", "navajowhite": "#ffdead", "navy": "#000080", "oldlace": "#fdf5e6", "olive": "#808000", "olivedrab": "#6b8e23", "orange": "#ffa500", "orangered": "#ff4500", "orchid": "#da70d6", "palegoldenrod": "#eee8aa", "palegreen": "#98fb98", "paleturquoise": "#afeeee", "palevioletred": "#db7093", "papayawhip": "#ffefd5", "peachpuff": "#ffdab9", "peru": "#cd853f", "pink": "#ffc0cb", "plum": "#dda0dd", "powderblue": "#b0e0e6", "purple": "#800080", "rebeccapurple": "#663399", "red": "#ff0000", "rosybrown": "#bc8f8f", "royalblue": "#4169e1", "saddlebrown": "#8b4513", "salmon": "#fa8072", "sandybrown": "#f4a460", "seagreen": "#2e8b57", "seashell": "#fff5ee", "sienna": "#a0522d", "silver": "#c0c0c0", "skyblue": "#87ceeb", "slateblue": "#6a5acd", "slategray": "#708090", "slategrey": "#708090", "snow": "#fffafa", "springgreen": "#00ff7f", "steelblue": "#4682b4", "tan": "#d2b48c", "teal": "#008080", "thistle": "#d8bfd8", "tomato": "#ff6347", "turquoise": "#40e0d0", "violet": "#ee82ee", "wheat": "#f5deb3", "white": "#ffffff", "whitesmoke": "#f5f5f5", "yellow": "#ffff00", "yellowgreen": "#9acd32", } # format to dictionary out = dict() for i, u in results: n, c = random.choice(list(cmap.items())) out.update({i: {"data": u, "color": c}}) # save to json file with open(output_data, 'w') as fp: json.dump(out, fp, indent=4)
import requests import giphypop import random import shutil import configparser from discord.ext.commands import Bot config = configparser.ConfigParser() config.read("eindbazen.ini") TOKEN = config['Tokens']['discord'] GIFTOKEN = config['Tokens']['gif'] VERSION = "0.0.2" client = Bot(command_prefix="!") gapi = giphypop.Giphy(GIFTOKEN) def removeCommand(messageContent): retMsg = messageContent.split(' ', 1) if len(retMsg) > 1: return retMsg[1] else: return '' @client.command(pass_context=True) async def join(ctx): channel = ctx.message.author.voice.voice_channel await client.join_voice_channel(channel)
import discord import giphypop import requests nigger = [ 'https://media.giphy.com/media/l0ExcmTLOCZyecYaA/giphy.gif', 'https://media.giphy.com/media/26gsjUq73y6M2VTSU/giphy.gif', 'https://media.giphy.com/media/l0Ex8HiCGD8BnsVvG/giphy.gif', 'https://media.giphy.com/media/26xBJJEETvqGHxVIc/giphy.gif', 'https://media.giphy.com/media/l0Ex9w7OHj6M3ieK4/giphy.gif', ] btc_message = ('The current price of Bitcoin in USD is $') client = discord.Client() g = giphypop.Giphy('Your giphy api key') helpdoc = [ 'These are the hot commands for ur memes', '```!rapeme will get you raped```', '```!erection will give you some hot and steamy stuff```', '```!cat will give u some adorable pussy```', '```!doge will give u them puppers', '```!BTC will give u the price of that good good crypto```', '```!n***a will give u that good good```',
async def randomgif(self,ctx): async with ctx.typing(): a=gp.Giphy() b=a.random_gif() await ctx.send(b.url)
def ret_render_template(): name = request.args.get("name") g = giphypop.Giphy() gif = g.random_gif(tag=name) return render_template("index.html", user_name=name, gif_url=gif.media_url)
def __init__(self, bot, settings): self.bot = bot self.settings = settings self.ua = 'CorpNewt DeepThoughtBot' self.giphy = giphypop.Giphy()
def get_gif(search_term): g = giphypop.Giphy() gifs = g.search(search_term) # returns a list of objects return gifs
def rGif(message): msg = message.text.replace('/gif', '').lstrip(' ') if msg != "": g = giphypop.Giphy() gr = g.screensaver(msg) bot.send_message(message.chat.id, str(gr.url))
def getGiphy(): giphy = giphypop.Giphy() res = giphy.screensaver() print(res.url) return res.media_url
import os import random import discord import giphypop COMMAND_START = "charlie, " LINK_KEY = "url" client = discord.Client() TOKEN = os.environ.get("BOT_TOKEN") GIPHY_KEY = os.environ.get("GIPHY_API_KEY") giphy = giphypop.Giphy(GIPHY_KEY) MESSAGES = [ "shake shack?", "YOOOOO", "based based??", "alex literally shut the f**k up", "justin you're literally so annoying", "listening to podcast rn", "alkjfnlajniaundkljn", "WEIRDCHAMP", "POG", "LOL stop", "i'm on tiktok", "new vid up on yt", "bedwars?", "wanna speedrun", "mc?", "fall guys?", "OMG let's play speedrunners that actually sounds like so much fun", "i'll prob just order a refund but wtv", "that's HYPE", "that's so pog", "i hate college", "reading is for losers", "ping me when ur not playing league", "i don't even like films or filmmaking", "gifs are so pog", "TIMOTHEE CHALAMET", "laughing my ass off right now at the current moment, no cap", "stop roasting my gifs let me live", "seraphine gap or smtn idk league", "they really need to open up movie theaters bruh", "let's watch a movie", "can we do something i'm so bored", "rgmormlkfdmsoimoan", "i love gifs so much", "f**k you aviv", "gn"
def get_gifs(term): g = giphypop.Giphy() results = g.search(term) return results
IMAGE_URL_LENGTH = 23 MAX_TWEET_TEXT_LENGTH = TWEET_LENGTH - IMAGE_URL_LENGTH - 1 DOTS = '...' BACKOFF = 0.5 # Initial wait time before attempting to reconnect MAX_BACKOFF = 300 # Maximum wait time between connection attempts MAX_IMAGE_SIZE = 3072 * 1024 # bytes USERNAME = '******' logging.basicConfig( filename='logger.log', level=logging.INFO, format='%(asctime)s - %(name)s - %(levelname)s - %(message)s') logger = logging.getLogger(__name__) # Giphy client giphy = giphypop.Giphy(api_key=config.giphy['key']) # Twitter client auth = tweepy.OAuthHandler(config.twitter['key'], config.twitter['secret']) auth.set_access_token(config.twitter['access_token'], config.twitter['access_token_secret']) api = tweepy.API(auth) # Tweet parser parser = ttp.Parser() # backoff time backoff = BACKOFF def get_gif_filename(term): images = [ i for i in giphy.search(term, limit=20) if i.filesize < MAX_IMAGE_SIZE ]
def __init__(self, logger=None): self.logger = logger if not self.logger: self.logger = default_logger self.gipher = giphypop.Giphy()
from roast import * from database import * from spotify import * from compliments import generate_compliment from libs import * from help import help_text from os.path import join, dirname from dotenv import load_dotenv from flask import Flask from flask import request app = Flask(__name__) dotenv_path = join(dirname(__file__), '.env') load_dotenv(dotenv_path) gif = giphypop.Giphy() admin_sender_id = os.environ.get("ADMIN_SENDER_ID") access_token = os.environ.get("GROUPME_ACCESS_TOKEN") ball_responses = [ "It is certain.", "It is decidedly so.", "Without a doubt.", "Yes - definitely.", "You may rely on it.", "As I see it, yes.", "Most likely.", "Outlook is good.", "Yes.", "Signs point to yes.", "Reply hazy, try again.", "Ask again later.", "Better not tell you now.", "Cannot predict now.", "Concentrate and ask again.", "Don't count on it.", "My reply is no.", "My sources say no.", "No.", "Absolutely the frik not.", "Outlook not so good.", "Very doubtful." ] profanity = ["damn", "shit", "f**k", "bitch", "dammit"] @app.route('/callback/get', methods=['GET'])
import datetime import os import giphypop from unsplash.api import Api from unsplash.auth import Auth VERSION = os.getenv('VERSION') GIPHYKEY = os.getenv('GIPHYKEY') UNSPLASH_ACCESS_KEY = os.getenv('UNSPLASH_ACCESS_KEY') UNSPLASH_SECRET_KEY = os.getenv('UNSPLASH_SECRET_KEY') UNSPLASH_REDIRECT_URI = os.getenv('UNSPLASH_REDIRECT_URI') # -- Initialize Photo Libraries g = giphypop.Giphy(api_key = GIPHYKEY) client_id = UNSPLASH_ACCESS_KEY client_secret = UNSPLASH_SECRET_KEY redirect_uri = UNSPLASH_REDIRECT_URI code = "" auth = Auth(client_id, client_secret, redirect_uri, code=code) api = Api(auth) class RandomImage(commands.Cog): def __init__(self, bot): self.bot = bot # -- Giphy --
# -*- coding: utf-8 -*- import paho.mqtt.client as mqtt from pytg import Telegram import json import random import os import requests import giphypop g = giphypop.Giphy() tg = Telegram( telegram="/home/pi/tg/bin/telegram-cli", pubkey_file="/home/pi/tg/bin/tg-server.pub") receiver = tg.receiver sender = tg.sender # The callback for when the client receives a CONNACK response from the server. def on_connect(client, userdata, flags, rc): print("Connected with result code "+str(rc)) # Subscribing in on_connect() means that if we lose the connection and # reconnect then subscriptions will be renewed. client.subscribe("/opentrigger/signals/release") # The callback for when a PUBLISH message is received from the server. def on_message(client, userdata, msg): print("I GOT IT") print(msg.topic+" "+str(msg.payload)) uuid = json.loads(msg.payload)['UniqueIdentifier'] age = json.loads(msg.payload)['Age']
except KeyError: pass if 'direct_message' in msg: if msg['direct_message']['sender']['screen_name'] != "TherapyChatBot": if fuzz.token_set_ratio("hello hi", msg['direct_message']['text']) > 50: twitter_api.direct_messages.new(user=msg['direct_message']['sender']['screen_name'], text="Hey!") if fuzz.token_set_ratio("hurt myself", msg['direct_message']['text']) > 50: twitter_api.direct_messages.new(user=msg['direct_message']['sender']['screen_name'], text="I'm sorry you're in so much pain. I won't leave you or abandon you.") elif fuzz.token_set_ratio("pain hurt inside", msg['direct_message']['text']) > 50: twitter_api.direct_messages.new(user=msg['direct_message']['sender']['screen_name'], text="You’re not alone in this. We're here for you.") elif fuzz.token_set_ratio("I love cats!", msg['direct_message']['text']) > 60: twitter_api.direct_messages.new(user=msg['direct_message']['sender']['screen_name'], text=list(giphypop.Giphy().search("cats"))[0]) elif fuzz.token_set_ratio("distance from friends family", msg['direct_message']['text']) > 50: twitter_api.direct_messages.new(user=msg['direct_message']['sender']['screen_name'], text="Keep yourself united with your loved ones. They will always be there to help you.") elif fuzz.token_set_ratio("avoid everything isolation", msg['direct_message']['text']) > 50: twitter_api.direct_messages.new(user=msg['direct_message']['sender']['screen_name'], text="Come out into the sunshine! The world is much better with you in it :)") elif fuzz.token_set_ratio("agony makes me insane", msg['direct_message']['text']) > 50: twitter_api.direct_messages.new(user=msg['direct_message']['sender']['screen_name'], text="Do you want a hug? I will always be here for you") elif fuzz.token_set_ratio("exhuasting battle", msg['direct_message']['text']) > 50: twitter_api.direct_messages.new(user=msg['direct_message']['sender']['screen_name'], text="You'll make it through!") elif fuzz.token_set_ratio("eat less starve", msg['direct_message']['text']) > 50: twitter_api.direct_messages.new(user=msg['direct_message']['sender']['screen_name'], text="Keep yourself well. You derseve it. You are the best person I know.")