forked from adam/discord-bot-shtik
Compare commits
6 Commits
master
...
offline-20
Author | SHA1 | Date | |
---|---|---|---|
1b8a714a96 | |||
7c22ae1643 | |||
e0c7bdb35f | |||
9648ea563b | |||
1d73fe0be8 | |||
5eeec24069 |
@ -22,7 +22,7 @@ public class GeneralSnarkCloudNative : Behavior
|
|||||||
if(Behaver.Instance.IsSelf(message.Author.Id))
|
if(Behaver.Instance.IsSelf(message.Author.Id))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
if(message.Channel.EffectivePermissions.ReactionsPossible)
|
if(!message.Channel.EffectivePermissions.ReactionsPossible)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
if((MeannessFilterLevel)message.Channel.EffectivePermissions.MeannessFilterLevel < MeannessFilterLevel.Medium)
|
if((MeannessFilterLevel)message.Channel.EffectivePermissions.MeannessFilterLevel < MeannessFilterLevel.Medium)
|
||||||
|
@ -42,7 +42,7 @@ public class GeneralSnarkMisspellDefinitely : Behavior
|
|||||||
|
|
||||||
foreach(var k in snarkmap.Keys)
|
foreach(var k in snarkmap.Keys)
|
||||||
{
|
{
|
||||||
if( Regex.IsMatch(message.Content, "\\b"+k+"\\b", RegexOptions.IgnoreCase))
|
if( Regex.IsMatch(message.Content?.ToLower(), "\\b"+k+"\\b", RegexOptions.IgnoreCase))
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
|
@ -112,7 +112,7 @@ namespace vassago.Conversion
|
|||||||
accumulator = reverseConversion.Item4(accumulator);
|
accumulator = reverseConversion.Item4(accumulator);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (normalizedDestUnit == currencyConf.Base || currencyConf.rates.Select(r => r.Key).Contains(normalizedDestUnit))
|
if (currencyConf != null && (normalizedDestUnit == currencyConf.Base || currencyConf.rates.Select(r => r.Key).Contains(normalizedDestUnit)))
|
||||||
{
|
{
|
||||||
return $"{String.Format("approximately {0:0.00}", accumulator)} {normalizedDestUnit} as of {currencyConf.DateUpdated.ToLongDateString()}";
|
return $"{String.Format("approximately {0:0.00}", accumulator)} {normalizedDestUnit} as of {currencyConf.DateUpdated.ToLongDateString()}";
|
||||||
}
|
}
|
||||||
|
@ -11,6 +11,9 @@ public class User
|
|||||||
public Guid Id { get; set; }
|
public Guid Id { get; set; }
|
||||||
public List<Account> Accounts { get; set; }
|
public List<Account> Accounts { get; set; }
|
||||||
|
|
||||||
|
//if I ever get lots and lots of tags, or some automatic way to register a feature's arbitrary tags, then I can move this off.
|
||||||
|
//public bool Tag_CanTwitchSummon { get; set; }
|
||||||
|
|
||||||
public string DisplayName
|
public string DisplayName
|
||||||
{
|
{
|
||||||
get
|
get
|
||||||
|
@ -138,10 +138,9 @@ public class DiscordInterface
|
|||||||
var mentionOfMe = "<@" + client.CurrentUser.Id + ">";
|
var mentionOfMe = "<@" + client.CurrentUser.Id + ">";
|
||||||
m.MentionsMe = true;
|
m.MentionsMe = true;
|
||||||
}
|
}
|
||||||
if (await Behaver.Instance.ActOn(m))
|
await Behaver.Instance.ActOn(m);
|
||||||
{
|
m.ActedOn = true; // for its own ruposess it might act on it later, but either way, fuck it, we checked.
|
||||||
m.ActedOn = true;
|
|
||||||
}
|
|
||||||
_db.SaveChanges();
|
_db.SaveChanges();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -16,7 +16,7 @@ namespace vassago.DiscordInterface
|
|||||||
new CommandSetup(){
|
new CommandSetup(){
|
||||||
Id = "freedomunits",
|
Id = "freedomunits",
|
||||||
UpdatedAt = new DateTime(2023, 5, 21, 13, 3, 0),
|
UpdatedAt = new DateTime(2023, 5, 21, 13, 3, 0),
|
||||||
guild = 825293851110801428,
|
guild = 825293851110801428, //TODO: demagic this magic number
|
||||||
register = register_FreedomUnits
|
register = register_FreedomUnits
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
@ -24,8 +24,16 @@ public class UsersController : Controller
|
|||||||
}
|
}
|
||||||
public async Task<IActionResult> Details(Guid id)
|
public async Task<IActionResult> Details(Guid id)
|
||||||
{
|
{
|
||||||
|
var user = await _db.Users
|
||||||
|
.Include(u => u.Accounts)
|
||||||
|
.FirstAsync(u => u.Id == id);
|
||||||
|
var allTheChannels = await _db.Channels.ToListAsync();
|
||||||
|
foreach(var acc in user.Accounts)
|
||||||
|
{
|
||||||
|
acc.SeenInChannel = allTheChannels.FirstOrDefault(c => c.Id == acc.SeenInChannel.Id);
|
||||||
|
}
|
||||||
return _db.Users != null ?
|
return _db.Users != null ?
|
||||||
View(await _db.Users.Include(u => u.Accounts).FirstAsync(u => u.Id == id)) :
|
View(user) :
|
||||||
Problem("Entity set '_db.Users' is null.");
|
Problem("Entity set '_db.Users' is null.");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -23,7 +23,7 @@
|
|||||||
<tr>
|
<tr>
|
||||||
<th scope="row">Lewdness Filter Level</th>
|
<th scope="row">Lewdness Filter Level</th>
|
||||||
<td>
|
<td>
|
||||||
<select name="LewdnessFilterLevel" id="LewdnessFilterLevel" onchange="patchModel(jsonifyChannel())">
|
<select name="LewdnessFilterLevel" id="LewdnessFilterLevel" onchange="patchModel(jsonifyChannel(), '/api/Channels/')">
|
||||||
<!option value="" @(ThisChannel.LewdnessFilterLevel == null ? "selected" : "")>⤵ inherited - @Enumerations.GetDescription(IfInheritedLewdnessFilterLevel)</!option>
|
<!option value="" @(ThisChannel.LewdnessFilterLevel == null ? "selected" : "")>⤵ inherited - @Enumerations.GetDescription(IfInheritedLewdnessFilterLevel)</!option>
|
||||||
@foreach (Enumerations.LewdnessFilterLevel enumVal in
|
@foreach (Enumerations.LewdnessFilterLevel enumVal in
|
||||||
Enum.GetValues(typeof(Enumerations.LewdnessFilterLevel)))
|
Enum.GetValues(typeof(Enumerations.LewdnessFilterLevel)))
|
||||||
@ -53,7 +53,7 @@
|
|||||||
<tr>
|
<tr>
|
||||||
<th scope="row">Meanness Filter Level</th>
|
<th scope="row">Meanness Filter Level</th>
|
||||||
<td>
|
<td>
|
||||||
<select name="MeannessFilterLevel" id="MeannessFilterLevel" onchange="patchModel(jsonifyChannel())">
|
<select name="MeannessFilterLevel" id="MeannessFilterLevel" onchange="patchModel(jsonifyChannel(), '/api/Channels/')">
|
||||||
<!option value="" @(ThisChannel.MeannessFilterLevel == null ? "selected" : "")>⤵ inherited - @Enumerations.GetDescription(IfInheritedMeannessFilterLevel)</!option>
|
<!option value="" @(ThisChannel.MeannessFilterLevel == null ? "selected" : "")>⤵ inherited - @Enumerations.GetDescription(IfInheritedMeannessFilterLevel)</!option>
|
||||||
@foreach (Enumerations.MeannessFilterLevel enumVal in
|
@foreach (Enumerations.MeannessFilterLevel enumVal in
|
||||||
Enum.GetValues(typeof(Enumerations.MeannessFilterLevel)))
|
Enum.GetValues(typeof(Enumerations.MeannessFilterLevel)))
|
||||||
@ -81,7 +81,7 @@
|
|||||||
<td>@(ThisChannel.SubChannels?.Count ?? 0)</td>
|
<td>@(ThisChannel.SubChannels?.Count ?? 0)</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<th scope="row">Users</th>
|
<th scope="row">Accounts</th>
|
||||||
<td>@(ThisChannel.Users?.Count ?? 0)</td>
|
<td>@(ThisChannel.Users?.Count ?? 0)</td>
|
||||||
</tr>
|
</tr>
|
||||||
</tbody>
|
</tbody>
|
||||||
@ -109,5 +109,12 @@
|
|||||||
console.log(channelNow);
|
console.log(channelNow);
|
||||||
return channelNow;
|
return channelNow;
|
||||||
}
|
}
|
||||||
|
function getTree() {
|
||||||
|
var tree = @Html.Raw(ViewData["treeString"]);
|
||||||
|
console.log(tree);
|
||||||
|
return tree;
|
||||||
|
}
|
||||||
|
|
||||||
|
$('#tree').bstreeview({ data: getTree() });
|
||||||
</script>
|
</script>
|
||||||
}
|
}
|
@ -1,21 +1,86 @@
|
|||||||
@model User
|
@model User
|
||||||
|
@using Newtonsoft.Json
|
||||||
|
@using System.Text
|
||||||
@{
|
@{
|
||||||
ViewData["Title"] = "User details";
|
ViewData["Title"] = "User details";
|
||||||
}
|
}
|
||||||
|
<table class="table">
|
||||||
|
<tbody>
|
||||||
|
<tr>
|
||||||
|
<td><input type="text" id="displayName" value="@Model.DisplayName"></input> <button onclick="patchModel(jsonifyUser(), @Html.Raw("'/api/Users/'"))">update</button></td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>
|
||||||
|
<div id="accountsTree"></div>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>
|
||||||
|
<div id="tagsTree"></div>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
<a asp-controller="Accounts" asp-action="Details" asp-route-id="1">placeholderlink</a>
|
||||||
|
|
||||||
User @Model.DisplayName<br />
|
|
||||||
|
|
||||||
<div class="permissions">
|
@section Scripts{
|
||||||
|
|
||||||
</div>
|
<script type="text/javascript">
|
||||||
|
@{
|
||||||
<div class="accounts">
|
var userAsString = JsonConvert.SerializeObject(Model, new JsonSerializerSettings
|
||||||
@foreach (var acc in Model.Accounts)
|
|
||||||
{
|
{
|
||||||
<div class="account @acc.Protocol">
|
ReferenceLoopHandling = ReferenceLoopHandling.Ignore
|
||||||
<div class="protocol-icon"> </div>
|
});
|
||||||
@Html.DisplayFor(acc => acc.DisplayName)
|
}
|
||||||
<a asp-controller="Accounts" asp-action="Details" asp-route-id="@acc.Id">Details</a>
|
const userOnLoad = @Html.Raw(userAsString);
|
||||||
</div>
|
function jsonifyUser() {
|
||||||
|
var userNow = structuredClone(userOnLoad);
|
||||||
|
userNow.Accounts = null;
|
||||||
|
userNow.DisplayName = document.querySelector("#displayName").value;
|
||||||
|
//userNow.Tag_CanTwitchSummon = document.querySelector("#tagCanTwitchSummon").checked;
|
||||||
|
console.log(userNow);
|
||||||
|
return userNow;
|
||||||
|
}
|
||||||
|
function getAccountsTree() {
|
||||||
|
@{
|
||||||
|
var sb = new StringBuilder();
|
||||||
|
sb.Append("[{text: \"accounts\", \"expanded\":true, nodes: [");
|
||||||
|
var first = true;
|
||||||
|
foreach (var acc in Model.Accounts)
|
||||||
|
{
|
||||||
|
if(!first)
|
||||||
|
sb.Append(',');
|
||||||
|
sb.Append($"{{text: \"<div class=\\\"account {acc.Protocol}\\\"><div class=\\\"protocol-icon\\\"> </div>{acc.SeenInChannel.LineageSummary}/<a href=\\\"/Accounts/Details/{acc.Id}\\\">{acc.DisplayName}</a>\"}}");
|
||||||
|
first=false;
|
||||||
|
}
|
||||||
|
sb.Append("]}]");
|
||||||
|
}
|
||||||
|
console.log(@Html.Raw(sb.ToString()));
|
||||||
|
var tree = @Html.Raw(sb.ToString());
|
||||||
|
return tree;
|
||||||
|
}
|
||||||
|
|
||||||
|
function getTagsTree() {
|
||||||
|
@{
|
||||||
|
sb = new StringBuilder();
|
||||||
|
sb.Append("[{text: \"permission tags\", \"expanded\":true, nodes: [");
|
||||||
|
first = true;
|
||||||
|
for(int i = 0; i < 1; i++)
|
||||||
|
{
|
||||||
|
if(!first)
|
||||||
|
sb.Append(',');
|
||||||
|
sb.Append($"{{text: \"<input type=\\\"checkbox\\\" > is goated (w/ sauce)</input>\"}}");
|
||||||
|
first=false;
|
||||||
|
}
|
||||||
|
sb.Append("]}]");
|
||||||
|
}
|
||||||
|
console.log(@Html.Raw(sb.ToString()));
|
||||||
|
var tree = @Html.Raw(sb.ToString());
|
||||||
|
return tree;
|
||||||
|
}
|
||||||
|
$('#accountsTree').bstreeview({ data: getAccountsTree() });
|
||||||
|
$('#tagsTree').bstreeview({ data: getTagsTree() });
|
||||||
|
document.querySelectorAll("input[type=checkbox]").forEach(node => {node.onchange = () => {patchModel(jsonifyUser(), '/api/Users/')}});
|
||||||
|
</script>
|
||||||
}
|
}
|
||||||
</div>
|
|
||||||
|
15
fail133653846161056785/error0.err
Normal file
15
fail133653846161056785/error0.err
Normal file
@ -0,0 +1,15 @@
|
|||||||
|
{
|
||||||
|
"ClassName": "System.ComponentModel.Win32Exception",
|
||||||
|
"Message": "An error occurred trying to start process 'convert' with working directory '/home/adam/Desktop/vassago'. No such file or directory",
|
||||||
|
"Data": null,
|
||||||
|
"InnerException": null,
|
||||||
|
"HelpURL": null,
|
||||||
|
"StackTraceString": " at System.Diagnostics.Process.ForkAndExecProcess(ProcessStartInfo startInfo, String resolvedFilename, String[] argv, String[] envp, String cwd, Boolean setCredentials, UInt32 userId, UInt32 groupId, UInt32[] groups, Int32& stdinFd, Int32& stdoutFd, Int32& stderrFd, Boolean usesTerminal, Boolean throwOnNoExec)\n at System.Diagnostics.Process.StartCore(ProcessStartInfo startInfo)\n at vassago.ExternalProcess.GoPlz(String commandPath, String commandArguments) in /home/adam/Desktop/vassago/externalProcess.cs:line 30",
|
||||||
|
"RemoteStackTraceString": null,
|
||||||
|
"RemoteStackIndex": 0,
|
||||||
|
"ExceptionMethod": null,
|
||||||
|
"HResult": -2147467259,
|
||||||
|
"Source": "System.Diagnostics.Process",
|
||||||
|
"WatsonBuckets": null,
|
||||||
|
"NativeErrorCode": 2
|
||||||
|
}
|
@ -2,12 +2,15 @@
|
|||||||
// for details on configuring this project to bundle and minify static web assets.
|
// for details on configuring this project to bundle and minify static web assets.
|
||||||
|
|
||||||
// Write your JavaScript code.
|
// Write your JavaScript code.
|
||||||
|
function Account(displayName, accountId, protocol){
|
||||||
function testfunct(caller){
|
this.displayName = displayName;
|
||||||
console.log("[gibberish]");
|
this.accountId = accountId;
|
||||||
console.log(caller);
|
this.protocol = protocol;
|
||||||
}
|
}
|
||||||
function patchModel(model)
|
//todo: figure out what the URL actually needs to be, rather than assuming you get a whole-ass server to yourself.
|
||||||
|
//you selfish fuck... What are you, fox?
|
||||||
|
//as it stands, you want something like /api/Channels/, trailing slash intentional
|
||||||
|
function patchModel(model, apiUrl)
|
||||||
{
|
{
|
||||||
//structure the model your (dang) self into a nice object
|
//structure the model your (dang) self into a nice object
|
||||||
console.log(model);
|
console.log(model);
|
||||||
@ -16,15 +19,12 @@ function patchModel(model)
|
|||||||
var components = window.location.pathname.split('/');
|
var components = window.location.pathname.split('/');
|
||||||
if(components[2] !== "Details")
|
if(components[2] !== "Details")
|
||||||
{
|
{
|
||||||
console.log("wtf are you doing? " + components[2] + " is something other than Details")
|
console.log("wtf are you doing? " + components[2] + " is something other than Details");
|
||||||
|
//add different endpoings here, if you like
|
||||||
}
|
}
|
||||||
var type=components[1];
|
var type=components[1];
|
||||||
var id=components[3];
|
var id=components[3];
|
||||||
|
|
||||||
//todo: figure out what the URL actually needs to be, rather than assuming you get a whole-ass server to yourself.
|
|
||||||
//you selfish fuck. What are you, fox?
|
|
||||||
var apiUrl = "/api/Channels/"
|
|
||||||
|
|
||||||
console.log("dexter impression: I am now ready to post the following content:");
|
console.log("dexter impression: I am now ready to post the following content:");
|
||||||
console.log(JSON.stringify(model));
|
console.log(JSON.stringify(model));
|
||||||
fetch(apiUrl, {
|
fetch(apiUrl, {
|
||||||
|
Loading…
Reference in New Issue
Block a user