Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

made it asynchronous (hopefully) #1

Merged
merged 1 commit into from Oct 1, 2018
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions phoneBot.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
""" For setup instructions, read the README.md
By Spectrix#0001. Enjoy """

import discord, asyncio, requests, json
import discord, asyncio, aiohttp, json
from discord.ext import commands
from discord.ext.commands.cooldowns import BucketType

Expand All @@ -21,7 +21,8 @@ async def call(ctx, *, message):
report = {}
report["value1"] = f"New message. {message}"
report["value2"] = f". Sent by {ctx.author.name} on the server {ctx.guild.name}."
requests.post("https://maker.ifttt.com/trigger/" + config["eventName"] +"/with/key/" + config["IFTTTkey"], data=report)
async with aiohttp.ClientSession() as session:
await session.post("https://maker.ifttt.com/trigger/" + config["eventName"] +"/with/key/" + config["IFTTTkey"], data=report)
await ctx.send("**Data posted! Calling the bot owner now :telephone_receiver:**")
else:
await ctx.send(f"**{ctx.author.mention} You can't send messages over 250 chars long. :no_entry:**")
Expand Down