you're welcome shelby
parent
77a5cafce7
commit
b13a206268
13
bot.py
13
bot.py
|
@ -5,6 +5,7 @@ A bot by turtlebasket
|
||||||
|
|
||||||
import asyncio
|
import asyncio
|
||||||
import json
|
import json
|
||||||
|
from urllib.request import urlopen, Request
|
||||||
import discord
|
import discord
|
||||||
from discord.ext import commands
|
from discord.ext import commands
|
||||||
from bot_utils import *
|
from bot_utils import *
|
||||||
|
@ -69,6 +70,11 @@ async def help(ctx):
|
||||||
name=">>ping",
|
name=">>ping",
|
||||||
value="Get bot latency."
|
value="Get bot latency."
|
||||||
)
|
)
|
||||||
|
|
||||||
|
embed.add_field(
|
||||||
|
name=">>shibe",
|
||||||
|
value="shibe :dog: :eyes"
|
||||||
|
)
|
||||||
|
|
||||||
await ctx.send(embed=embed)
|
await ctx.send(embed=embed)
|
||||||
|
|
||||||
|
@ -100,6 +106,13 @@ async def addEmote(ctx, emote_name: str):
|
||||||
file_bytes = await ctx.message.attachments[0].read()
|
file_bytes = await ctx.message.attachments[0].read()
|
||||||
await ctx.guild.create_custom_emoji(name=emote_name, image=file_bytes)
|
await ctx.guild.create_custom_emoji(name=emote_name, image=file_bytes)
|
||||||
|
|
||||||
|
@bot.command()
|
||||||
|
async def shibe(ctx):
|
||||||
|
# with urllib.request.urlopen("http://shibe.online/api/shibes?count=1&urls=true&httpsUrls=true") as json_return:
|
||||||
|
with urlopen(Request(url="http://shibe.online/api/shibes?count=1&urls=true&httpsUrls=true", headers={'User-Agent': 'Mozilla/5.0'})) as json_return:
|
||||||
|
shibe_contents = json_return.read()
|
||||||
|
await ctx.send(embed=discord.Embed(
|
||||||
|
title="{0}, here is your random shibe:".format(ctx.message.author.name)).set_image(url=json.loads(shibe_contents)[0]))
|
||||||
|
|
||||||
@bot.command(aliases=['latency'])
|
@bot.command(aliases=['latency'])
|
||||||
async def ping(ctx):
|
async def ping(ctx):
|
||||||
|
|
|
@ -0,0 +1,42 @@
|
||||||
|
import sqlite3
|
||||||
|
connection = sqlite3.connect('storage.db')
|
||||||
|
|
||||||
|
c = connection.cursor()
|
||||||
|
|
||||||
|
c.execute
|
||||||
|
|
||||||
|
|
||||||
|
"""
|
||||||
|
import json
|
||||||
|
import bot
|
||||||
|
|
||||||
|
class server_obj:
|
||||||
|
ID = 0
|
||||||
|
|
||||||
|
MUTE_VOTE_TIME = 30
|
||||||
|
MIN_MUTE_VOTERS = 4 # should be 3
|
||||||
|
MUTE_TIME = 600 # 10 mins
|
||||||
|
|
||||||
|
KICK_VOTE_TIME = 300
|
||||||
|
MIN_KICK_VOTERS = 6
|
||||||
|
|
||||||
|
BAN_VOTE_TIME = 1200
|
||||||
|
MIN_BAN_VOTERS = 8
|
||||||
|
|
||||||
|
def __init__(self, id: int):
|
||||||
|
self.ID = id
|
||||||
|
|
||||||
|
def new_server_json(id: int):
|
||||||
|
json.dump(server_obj(id), "server_data/{}.json".format(str(id)))
|
||||||
|
|
||||||
|
def update_attribute(server: int, attrib: str, value):
|
||||||
|
try:
|
||||||
|
with open('server_data/{}.json'.format(str(server)), 'r+') as target:
|
||||||
|
json_file = json.load(target)
|
||||||
|
json_file["{}".format(attrib)] = value
|
||||||
|
json_file.close()
|
||||||
|
except FileNotFoundError:
|
||||||
|
new_server_json(id)
|
||||||
|
|
||||||
|
def load_attribute():
|
||||||
|
"""
|
Loading…
Reference in New Issue