Skip to content

Commit

Permalink
Initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
schiltz3 authored Feb 5, 2024
0 parents commit dcde3c8
Show file tree
Hide file tree
Showing 30 changed files with 4,459 additions and 0 deletions.
5 changes: 5 additions & 0 deletions .deepsource.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
version = 1

[[analyzers]]
name = "javascript"
enabled = true
21 changes: 21 additions & 0 deletions .github/PULL_REQUEST_TEMPLATE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@

# Descriptive title

A person with no idea what task you were working on before should at least
have an idea as to what you did.

# Link to github card
Type `#` to see list of autolinks to pull requests or issues

# Changes
The body should contain a high-level overview of the individual changes you made, what parts of the application you changed, etc.
This may be in list form.


*
*
*


You may also wish to include links to related pull requests, issues, or branches which may affect your changes.
You can mention people by using `@`
12 changes: 12 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
# To get started with Dependabot version updates, you'll need to specify which
# package ecosystems to update and where the package manifests are located.
# Please see the documentation for all configuration options:
# https://docs.github.com/github/administering-a-repository/configuration-options-for-dependency-updates

version: 2
updates:
- package-ecosystem: "npm" # See documentation for possible values
directory: "/" # Location of package manifests
schedule:
interval: "daily"
target-branch: "staging"
70 changes: 70 additions & 0 deletions .github/workflows/codeql.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
# For most projects, this workflow file will not need changing; you simply need
# to commit it to your repository.
#
# You may wish to alter this file to override the set of languages analyzed,
# or to provide custom queries or build logic.
#
# ******** NOTE ********
# We have attempted to detect the languages in your repository. Please check
# the `language` matrix defined below to confirm you have the correct set of
# supported CodeQL languages.
#
name: "CodeQL"

on:
push:
pull_request:
branches: [ main, staging ]
schedule:
- cron: '19 8 * * 2'

jobs:
analyze:
name: Analyze
runs-on: ubuntu-latest
permissions:
actions: read
contents: read
security-events: write

strategy:
fail-fast: false
matrix:
language: [ 'javascript' ]
# CodeQL supports [ 'cpp', 'csharp', 'go', 'java', 'javascript', 'python', 'ruby' ]
# Learn more about CodeQL language support at https://aka.ms/codeql-docs/language-support

steps:
- name: Checkout repository
uses: actions/checkout@v3

# Initializes the CodeQL tools for scanning.
- name: Initialize CodeQL
uses: github/codeql-action/init@v2
with:
languages: ${{ matrix.language }}
# If you wish to specify custom queries, you can do so here or in a config file.
# By default, queries listed here will override any specified in a config file.
# Prefix the list here with "+" to use these queries and those in the config file.

# Details on CodeQL's query packs refer to : https://docs.github.com/en/code-security/code-scanning/automatically-scanning-your-code-for-vulnerabilities-and-errors/configuring-code-scanning#using-queries-in-ql-packs
# queries: security-extended,security-and-quality


# Autobuild attempts to build any compiled languages (C/C++, C#, or Java).
# If this step fails, then you should remove it and run the build manually (see below)
- name: Autobuild
uses: github/codeql-action/autobuild@v2

# ℹ️ Command-line programs to run using the OS shell.
# 📚 See https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#jobsjob_idstepsrun

# If the Autobuild fails above, remove it and uncomment the following three lines.
# modify them (or add more) to build your code if your project, please refer to the EXAMPLE below for guidance.

# - run: |
# echo "Run, Build Application using script"
# ./location_of_script_within_repo/buildscript.sh

- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v2
22 changes: 22 additions & 0 deletions .github/workflows/dependency-review.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
# Dependency Review Action
#
# This Action will scan dependency manifest files that change as part of a Pull Request, surfacing known-vulnerable versions of the packages declared or updated in the PR. Once installed, if the workflow run is marked as required, PRs introducing known-vulnerable packages will be blocked from merging.
#
# Source repository: https://github.com/actions/dependency-review-action
# Public documentation: https://docs.github.com/en/code-security/supply-chain-security/understanding-your-software-supply-chain/about-dependency-review#dependency-review-enforcement
name: 'Dependency Review'
on:
pull_request:
branches: [main, staging]

permissions:
contents: read

jobs:
dependency-review:
runs-on: ubuntu-latest
steps:
- name: 'Checkout Repository'
uses: actions/checkout@v3
- name: 'Dependency Review'
uses: actions/dependency-review-action@v2
17 changes: 17 additions & 0 deletions .github/workflows/docker-image.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
name: Docker Image CI

on:
push:
pull_request:
branches: [ main, staging ]

jobs:

build:

runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v3
- name: Build the Docker image
run: docker build . --file Dockerfile --tag my-image-name:$(date +%s)
21 changes: 21 additions & 0 deletions .github/workflows/format.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
name: Format
on:
pull_request:
branches: ['*', '!main']
jobs:
format:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
with:
ref: ${{ github.head_ref }}
- uses: actions/setup-node@v2
with:
node-version: ">=16.13.2"
- run: npm ci
- run: npm run format
- name: Commit changes
uses: stefanzweifel/git-auto-commit-action@v4
with:
commit_message: Apply auto formatting changes
branch: ${{ github.head_ref }}
23 changes: 23 additions & 0 deletions .github/workflows/publish-docker-image.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
name: Publish Docker image to GitHub Package Registry
on:
push:
branches: [ main ]
jobs:
build:
runs-on: ubuntu-latest
steps:

- name: Copy Repo Files
uses: actions/checkout@main

#This Action Emits 2 Variables, IMAGE_SHA_NAME and IMAGE_URL
#which you can reference in subsequent steps
- name: Publish Docker Image to GPR
uses: machine-learning-apps/gpr-docker-publish@master
id: docker
with:
IMAGE_NAME: 'BaseBot'
TAG: 'latest'
DOCKERFILE_PATH: './Dockerfile'
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
.vscode
*.env
node_modules
3 changes: 3 additions & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
*
!*.ts
!*/
20 changes: 20 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# BaseBot Contributing guidelines

## Developing New Features

First create a new branch with it's base set to the [staging](https://github.com/Antares-Network/BaseBot/tree/staging) branch.
For naming conventions use `feature/GithubUsername/FeatureName`. Example: `feature/nathen418/mongodb-support`
Next when your feature is ready to be merged, submit a pull request to the [staging](https://github.com/Antares-Network/BaseBot/tree/staging) branch.
This will be used to test your changes along side the rest of the code and any other pending new features.

## Fixing Bugs

Do the same as the instructions except when naming your branch use the naming convention: `bugfix/GithubUsername/BugName`. Example: `bugfix/nathen418/fix-api-connection-err`

## Editing/Merging Pull Requests

Only merge pull requests you authored or have been approved by the author to merge.

## Pushing to branches

Only push to branches you have been given permission to push to. This means that you should only commit to branches that have your name in the branch name unless the branch owner has given you permission to push to it.
17 changes: 17 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
FROM node:16

RUN mkdir -p /usr/src/bot

WORKDIR /usr/src/bot

COPY package*.json ./

RUN npm ci

COPY . .

RUN npm install -g typescript ts-node

CMD [ "ts-node", "index.ts" ]

LABEL org.opencontainers.image.source="https://github.com/Antares-Network/Base-Bot"
21 changes: 21 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
MIT License

Copyright (c) 2022 Nate Goldsborough

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
Empty file added README.md
Empty file.
53 changes: 53 additions & 0 deletions commands/owner/say.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
import chalk from "chalk";
import DiscordJS, { PermissionFlagsBits, TextChannel } from "discord.js";
import { CommandObject, CommandType, CommandUsage } from "wokcommands";

export default {
name: "say",
category: "admin",
description: "Sends an admin specified message to the specified channel.",
permissions: [PermissionFlagsBits.ManageMessages],
type: CommandType.SLASH,
guildOnly: true,
options: [
{
name: "content",
description: "What to say",
type: DiscordJS.ApplicationCommandOptionType.String,
required: true,
},
{
name: "channel",
description: "The channel to say the thing in",
type: DiscordJS.ApplicationCommandOptionType.Channel,
required: false,
},
],

callback: ({ interaction }: CommandUsage) => {
if (!interaction) return;
const content = interaction.options.getString("content", true);
const channel = (interaction.options.getChannel("channel") as TextChannel) || (interaction.channel as TextChannel);
if (!content) {
interaction?.reply({
content: "You need to provide a content to say",
ephemeral: true,
});
return;
}
channel.send(content);
interaction.reply({
content: `Message sent in <#${channel.id}>`,
ephemeral: true,
});

// Log the command usage
console.log(
chalk.blue(
`${chalk.green(`[COMMAND]`)} ${chalk.yellow(interaction?.user?.tag)} used the ${chalk.green(`/say`)} command in ${chalk.yellow(
interaction?.guild?.name
)}`
)
);
},
} as CommandObject;
40 changes: 40 additions & 0 deletions commands/user/github.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
import chalk from "chalk";
import { EmbedBuilder, PermissionFlagsBits } from "discord.js";
import { CommandObject, CommandType, CommandUsage } from "wokcommands";

export default {
name: "github",
category: "user",
description: "Sends an embed with a link to the github repo for the bot.",
permissions: [PermissionFlagsBits.SendMessages],
type: CommandType.SLASH,
guildOnly: true,

callback: ({ client, interaction }: CommandUsage) => {
// Embed values
const color = "#0099ff";
const thumbnail = "https://antaresnetwork.com/resources/BaseBot/base-server-icon.png";
const title = "Github";
const description = "Click here to go to the BaseBot repo: \n https://github.com/Antares-Network/BaseBot";
const footer = `Delivered in: ${client.ws.ping}ms | BaseBot | ${process.env.VERSION}`;
const footerIcon = "https://antaresnetwork.com/resources/BaseBot/icon.jpg";

// Embed construction
const Embed = new EmbedBuilder()
.setColor(color)
.setTitle(title)
.setThumbnail(thumbnail)
.setDescription(description)
.setFooter({ text: footer, iconURL: footerIcon });

// Log the command usage
console.log(
chalk.blue(
`${chalk.green(`[COMMAND]`)} ${chalk.yellow(interaction?.user?.tag)} used the ${chalk.green(`/github`)} command in ${chalk.yellow(
interaction?.guild?.name
)}`
)
);
return { embeds: [Embed] };
},
} as CommandObject;
Loading

0 comments on commit dcde3c8

Please sign in to comment.