我试图制作skype令人讨厌的垃圾邮件机器人,其中一个功能是调用人员的可能性,我知道它无用且生涩,但我只是为了学习如何编写python代码。
所以我写了这个:
import os, random, string, Skype4Py, sys, time
skype = Skype4Py.Skype()
def SkypeSpammer():
value = int(raw_input('Enter amount of messages you want to spam: '))
victim = raw_input('Enter skype username of victim: ')
message = raw_input('Enter message you want to spam: ')
delay = float(raw_input('Enter delay in between messages in seconds: '))
for i in range(value):
skype.SendMessage(victim , message)
time.sleep(delay)
def SkypeCaller():
skype.PlaceCall('skypeusername')
def OptionMenu():
print '[x] What feature do you want to use?'
print '[1] Skype Spammer'
print '[2] Skype Annoying Caller'
print '[3] Close'
option = raw_input('Choose: ')
if(option == '1'):
SkypeSpammer()
elif(option == '2'):
print 'Still in progress'
elif(option == '3'):
print 'Closing...'
time.sleep(0.1)
sys.exit()
else:
print ('Invalid option, try again...')
time.sleep(1.5)
OptionMenu()
SkypeCaller()
正如你在SkypeCaller中看到的,我编写了一个简单的命令,它调用了()中指定的用户名,但每当我运行它时都没有任何反应。知道为什么吗?
答案 0 :(得分:0)
您好像缺少将Skype对象连接到Skype客户端的附加呼叫
skype.Attach()
尝试查看此示例https://github.com/Skype4Py/Skype4Py/blob/master/examples/callfriend.py
编辑:
您正在使用的Skype4Py模块的文档中提供的快速示例(相同的github)是:
import Skype4Py
# Create an instance of the Skype class.
skype = Skype4Py.Skype()
# Connect the Skype object to the Skype client.
skype.Attach()
# Obtain some information from the client and print it out.
print 'Your full name:', skype.CurrentUser.FullName
print 'Your contacts:'
for user in skype.Friends:
print ' ', user.FullName
仅仅调用
是不够的skype = Skype4Py.Skype()
程序顶部的方法还需要
skype.Attach()
所以尝试添加上面的行,使其看起来像
skype = Skype4Py.Skype()
skype.Attach()