Update 'bot.py'
This commit is contained in:
parent
4a77927779
commit
909a6c1faa
64
bot.py
64
bot.py
@ -1,32 +1,32 @@
|
|||||||
def write_pid():
|
def write_pid():
|
||||||
pid = os.getpid()
|
pid = os.getpid()
|
||||||
with open('/tmp/spam.pid', 'w') as f:
|
with open('/tmp/spam.pid', 'w') as f:
|
||||||
f.write(str(pid))
|
f.write(str(pid))
|
||||||
print('Hello my(i \'m spambot) pid is ' + str(pid))
|
print('Hello my(i \'m spambot) pid is ' + str(pid))
|
||||||
write_pid()
|
write_pid()
|
||||||
|
|
||||||
from discord.ext import commands
|
from discord.ext import commands
|
||||||
import asyncio
|
import asyncio
|
||||||
|
|
||||||
client = commands.Bot(command_prefix="$")
|
client = commands.Bot(command_prefix="$")
|
||||||
|
|
||||||
|
|
||||||
@client.event
|
@client.event
|
||||||
async def on_ready():
|
async def on_ready():
|
||||||
print("Potato is ready.")
|
print("Potato is ready.")
|
||||||
|
|
||||||
|
|
||||||
@client.command(help='(what to spam) (interval(sec)) (how many times spam)')
|
@client.command(help='(what to spam) (interval(sec)) (how many times spam)')
|
||||||
@commands.has_permissions(administrator=True)
|
@commands.has_permissions(administrator=True)
|
||||||
async def spamhere(ctx, what, interval, times):
|
async def spamhere(ctx, what, interval, times):
|
||||||
try:
|
try:
|
||||||
for i in range(int(times)):
|
for i in range(int(times)):
|
||||||
await ctx.send(what)
|
await ctx.send(what)
|
||||||
await asyncio.sleep(int(interval))
|
await asyncio.sleep(int(interval))
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
await ctx.send(e)
|
await ctx.send(e)
|
||||||
|
|
||||||
|
|
||||||
with open("/home/git/spam_key") as tkn:
|
with open("/home/spambot/spam_key") as tkn:
|
||||||
client.run(tkn.read())
|
client.run(tkn.read())
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user