-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathWhatsapp.py
41 lines (32 loc) · 1.01 KB
/
Whatsapp.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
from twilio.rest import Client
# from Tracker import converted_price
import os
account_sid = os.environ['account_sid_key']
auth_token = os.environ['auth_token_key']
client = Client(account_sid, auth_token)
def send_msg(price):
message = client.messages.create(
from_='whatsapp: twilio number',
body=price,
to='whatsapp: recievers number'
)
print(message.sid)
def deco(fun):
def foo(num):
return fun(num ** 2)
return foo
bot = commands.Bot(command_prefix='/')
token = os.environ['DISCORD_BOT_TOKEN']
@bot.event
async def on_command_error(ctx, error):
orig_error = getattr(error, "original", error)
error_msg = ''.join(traceback.TracebackException.from_exception(orig_error).format())
await ctx.send(error_msg)
@bot.command()
async def ping(ctx):
await ctx.send('pong')
# @deco
# def square(num):
# return num**2
# n = square(2)
# print(n)