コード例 #1
0
from discord.ext import commands
from discord.ext.commands import Bot, Context
from models.command import CommandInfo

import config
from util.discord.channel import ChannelUtil
from util.discord.messages import Messages
from db.models.muted import Muted
from db.models.user import User
from util.discord.paginator import Entry, Page, Paginator

## Command documentation
MUTE_INFO = CommandInfo(
    triggers = ["mute"],
    overview = "Mute a user by ID",
    details = f"No longer receive tip notifications from a specific user. Example: `{config.Config.instance().command_prefix}mute 419483863115366410`"
)
UNMUTE_INFO = CommandInfo(
    triggers = ["unmute"],
    overview = "Unmute a user by ID",
    details = f"Receive tip notifications from a user again. Example: `{config.Config.instance().command_prefix}unmute 419483863115366410`"
)
MUTED_INFO = CommandInfo(
    triggers = ["muted"],
    overview = "View list of muted users",
    details = f"View the list of every user you have muted."
)


class UserOptionsCog(commands.Cog):
    """Commands for admins only"""
コード例 #2
0
from db.models.user import User
from db.redis import RedisDB
from util.discord.paginator import Entry, Page, Paginator
from util.regex import RegexUtil, AmountAmbiguousException, AmountMissingException
from util.validators import Validators
from models.constants import Constants
from util.number import NumberUtil
from db.models.transaction import Transaction
from util.util import Utils
import asyncio
from tasks.transaction_queue import TransactionQueue

## Command documentation
ADD_FAVORITE_INFO = CommandInfo(
    triggers = ["addfavorite"],
    overview = "Add a user to your favorites list",
    details = f"Add a user to your favorites list. You can have up to **25 favorites**. Example: `{config.Config.instance().command_prefix}addfavorite @bbedward`"
)
REMOVE_FAVORITE_INFO = CommandInfo(
    triggers = ["unfavorite", "removefavorite"],
    overview = "Remove a user from your favorites list",
    details = f"Remove a user from your favorites list Example: `{config.Config.instance().command_prefix}removefavorite 419483863115366410`"
)
FAVORITES_INFO = CommandInfo(
    triggers = ["favorites"],
    overview = "View list of users you have favorited",
    details = f"View the list of every user you have favorited. You can tip all of them using `{config.Config.instance().command_prefix}{'banfavorites' if Env.banano() else 'ntipfavorites'} <amount>`"
)
TIPFAVORITES_INFO = CommandInfo(
    triggers = ["banfavorites" if Env.banano() else "ntipfavorites"],
    overview = "Tip all the favorites",
コード例 #3
0
ファイル: admin.py プロジェクト: zonbie585/graham_discord_bot
from db.redis import RedisDB
from models.command import CommandInfo
from tortoise.transactions import in_transaction

import config
import logging
from util.discord.messages import Messages
from util.discord.paginator import Entry, Page, Paginator
from util.discord.channel import ChannelUtil
from util.env import Env
from util.regex import RegexUtil, AmountMissingException

## Command documentation
PAUSE_INFO = CommandInfo(
    triggers = ["pause"],
    overview = "Pause all transaction activity",
    details = "All users will be unable to withdraw or tip while the bot is paused."
)
RESUME_INFO = CommandInfo(
    triggers = ["resume", "unpause"],
    overview = "Resume all transaction activity",
    details = "Everybody can tip again when it's unpaused :)"
)
FREEZE_INFO = CommandInfo(
    triggers = ["freeze"],
    overview = "Freeze the mentioned users",
    details = "Completely freeze all mentioned users or user ID accounts"
)
DEFROST_INFO = CommandInfo(
    triggers = ["defrost", "unfreeze"],
    overview = "Un-freeze a user",
コード例 #4
0
ファイル: rain.py プロジェクト: zonbie585/graham_discord_bot
from util.validators import Validators
from util.util import Utils
from util.discord.channel import ChannelUtil
from util.discord.messages import Messages
from db.models.user import User
from db.redis import RedisDB
from typing import List
from models.constants import Constants
from db.models.transaction import Transaction
from tasks.transaction_queue import TransactionQueue

# Commands Documentation
RAIN_INFO = CommandInfo(
    triggers=["brain" if Env.banano() else "nrain", "brian", "nrian"],
    overview="Distribute a tip amount amongst active users",
    details="Distribute amount amongst active users." +
    f"\nExample: `{config.Config.instance().command_prefix}{'b' if Env.banano() else 'n'}rain 1000` will distribute 1000 {Env.currency_symbol()} between everyone who is active."
    +
    f"\n **minimum amount to rain: {config.Config.instance().get_rain_minimum()} {Env.currency_symbol()}**"
)


class RainCog(commands.Cog):
    def __init__(self, bot: Bot):
        self.bot = bot
        self.logger = logging.getLogger()

    @commands.Cog.listener()
    async def on_message(self, message: discord.Message):
        # Update active
        if not ChannelUtil.is_private(message.channel) and len(
                message.content) > 0 and message.content[0] not in [
コード例 #5
0
from discord.ext import commands
from discord.ext.commands import Bot, Context
from models.command import CommandInfo
from util.discord.messages import Messages
from util.regex import RegexUtil, AddressMissingException
from db.models.account import Account
from db.models.user import User

import discord
from util.env import Env

# Commands Documentation
WFU_INFO = CommandInfo(
    triggers = ["wfu", "walletfor", "walletforuser"],
    overview = "Get address for a particular user.",
    details = f"This will show information a about a user's account"
)
UFW_INFO = CommandInfo(
    triggers = ["ufw", "userfor", "userforwallet"],
    overview = "Get user info from a particular address",
    details = f"This will show information about a user's account"
)

class SpyCog(commands.Cog):
    def __init__(self, bot: Bot):
        self.bot = bot

    @commands.command(aliases=WFU_INFO.triggers)
    async def wfu_cmd(self, ctx: Context):
        msg = ctx.message
コード例 #6
0
import secrets
import random
from util.discord.channel import ChannelUtil
from db.redis import RedisDB
from tasks.transaction_queue import TransactionQueue
from util.validators import Validators
from util.number import NumberUtil
from util.util import Utils
from models.constants import Constants

# Commands Documentation
START_GIVEAWAY_INFO = CommandInfo(
    triggers = ["giveaway", "givearai"],
    overview = "Start a giveaway",
    details = "Start a giveaway with specified parameters" +
                f"\n**minimum amount: {config.Config.instance().get_giveaway_minimum()} {Env.currency_symbol()}**" +
                f"\n**minimum duration: {config.Config.instance().get_giveaway_min_duration()} minutes" +
                f"\n**maximum duration: {config.Config.instance().get_giveaway_max_duration()} minutes" +
                f"\n**Example:** `{config.Config.instance().command_prefix}giveaway 10 duration=30 fee=0.05`" + 
                f"\nWould start a giveaway of 10 {Env.currency_symbol()} that lasts 30 minutes with a 0.05 {Env.currency_symbol()} fee."
)
TICKET_INFO = CommandInfo(
    triggers = ["ticket", "enter", "e"],
    overview = "Enter the currently active giveaway",
    details = "Enter the currently active giveaway, if there is one." +
                f"\nFor giveaways without a fee, simply use `{config.Config.instance().command_prefix}ticket`"
                f"\nFor giveaways with a fee, simply use `{config.Config.instance().command_prefix}ticket <fee>`"
                f"\n**In private channels, id is required** example: `{config.Config.instance().command_prefix}ticket <fee> id=3` for giveaway #3"
)
TICKETSTATUS_INFO = CommandInfo(
    triggers = ["ticketstatus", "ts"],
    overview = "Check entry status",
コード例 #7
0
from tasks.transaction_queue import TransactionQueue
from util.env import Env
from util.regex import RegexUtil, AmountMissingException, AmountAmbiguousException, AddressAmbiguousException, AddressMissingException
from util.validators import Validators
from util.discord.channel import ChannelUtil
from util.discord.messages import Messages

import asyncio
import config
import logging

## Command(s) documentation
REGISTER_INFO = CommandInfo(
    triggers = ["deposit", "register", "wallet", "address"],
    overview = "Shows your account address",
    details = "Displays your tip bot account address along with a QR code. QR code is encoded with an amount if provided" +
                f"\n- Send {Env.currency_name()} to this address to increase your tip bot balance" +
                "\n- If you do not have a tip bot account yet, this command will create one for you (receiving a tip automatically creates an account too)"
)
BALANCE_INFO = CommandInfo(
    triggers = ["balance", "bal", "$"],
    overview = "Shows your account balance",
    details = f"Displays the balance of your bot account (in {Env.currency_symbol()})." +
                f"\n - Available Balance represents the amount of {Env.currency_symbol()} that you have available to tip or withdraw." +
                f"\n - Pending Balance represents the amount of {Env.currency_symbol()} that has been sent or received, but not processed by the bot yet."
)
SEND_INFO = CommandInfo(
    triggers = ["send", "withdraw"],
    overview = f"Send {Env.currency_name()} to an external address.",
    details = f"Send specified amount to specified address." +
                f"\nExample `{config.Config.instance().command_prefix}send 10 {Env.currency_symbol().lower()}_3o7uzba8b9e1wqu5ziwpruteyrs3scyqr761x7ke6w1xctohxfh5du75qgaj` - Sends 10 {Env.currency_symbol()}"
コード例 #8
0
from db.models.user import User
from db.redis import RedisDB
from tasks.transaction_queue import TransactionQueue

import asyncio
import config
import cogs.rain as rain
import secrets
from util.util import Utils

## Command documentation
TIP_INFO = CommandInfo(
    triggers=["ban", "b"] if Env.banano() else ["ntip", "n"],
    overview="Send a tip to mentioned users",
    details=
    f"Tip specified amount to mentioned user(s) (**minimum tip is {Constants.TIP_MINIMUM} {Constants.TIP_UNIT}**)"
    + "\nThe recipient(s) will be notified of your tip via private message" +
    "\nSuccessful tips will be deducted from your available balance immediately.\n"
    +
    f"Example: `{config.Config.instance().command_prefix}{'ban' if Env.banano() else 'ntip'} 2 @user1 @user2` would send 2 to user1 and 2 to user2"
)
TIPSPLIT_INFO = CommandInfo(
    triggers=["bansplit", "bs"] if Env.banano() else ["ntipsplit", "ns"],
    overview="Split a tip among mentioned users",
    details=
    f"Divide the specified amount between mentioned user(s) (**minimum tip is {Constants.TIP_MINIMUM} {Constants.TIP_UNIT}**)"
    + "\nThe recipient(s) will be notified of your tip via private message" +
    "\nSuccessful tips will be deducted from your available balance immediately.\n"
    +
    f"Example: `{config.Config.instance().command_prefix}{'bansplit' if Env.banano() else 'ntipsplit'} 2 @user1 @user2` would send 1 to user1 and 2 to user2"
)
TIPRANDOM_INFO = CommandInfo(
コード例 #9
0
ファイル: stats.py プロジェクト: cpass78/graham_discord_bot
import config
from db.models.stats import Stats
from db.models.user import User
from db.redis import RedisDB
from models.command import CommandInfo
from rpc.client import RPCClient
from util.discord.channel import ChannelUtil
from util.discord.messages import Messages
from util.env import Env
from util.number import NumberUtil

## Command documentation
TIPSTATS_INFO = CommandInfo(
    triggers=["tipstats"],
    overview="Display your personal tipping stats for a specific server.",
    details=
    f"This will display your personal tipping statistics from the server you send the command from. This command can't be used in DM"
)
TOPTIPS_INFO = CommandInfo(
    triggers=["toptips"],
    overview="Display biggest tips for a specific server.",
    details=
    f"This will display the biggest tip of all time, of the current month, and of the day for the current server. This command can't be used in DM"
)
LEADERBOARD_INFO = CommandInfo(
    triggers=["ballers", "leaderboard"],
    overview="Show a list of the top 15 tippers this year.",
    details=
    f"This will display a list of the top 15 tippers on the current server. This command can't be used in DM\n"
    +
    f"These stats are reset once a year - for all time stats use `{config.Config.instance().command_prefix}legacyboard`"